@enplug/sdk-dashboard
Advanced tools
Comparing version 5.2.1-zoning-1 to 5.2.1-zoning-10
{ | ||
"name": "@enplug/sdk-dashboard", | ||
"version": "5.2.1-zoning-1", | ||
"version": "5.2.1-zoning-10", | ||
"description": "Enplug Dashboard SDK", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.ts", |
@@ -16,2 +16,3 @@ import { | ||
ZoningAppsResponse, | ||
ZoningSlotInfo, | ||
} from '../types/external-types'; | ||
@@ -296,2 +297,5 @@ import { BridgeBase } from './bridge/bridge-base'; | ||
/** | ||
* Loads list of banner/ticker widget apps | ||
*/ | ||
getZoningApps(): Promise<ZoningAppsResponse> { | ||
@@ -304,2 +308,5 @@ return this.bridge.sendMessage({ | ||
/** | ||
* Loads widget assets used in a given zoning asset layout | ||
*/ | ||
getZoningLayoutAssets(assetId: string): Promise<Array<Asset<any>>> { | ||
@@ -315,10 +322,22 @@ return this.bridge.sendMessage({ | ||
acquireZoningAsset(appId: string): Promise<Asset<any>> { | ||
validateString(appId, 'You must provide an appId parameter'); | ||
/** | ||
* Shows modal allowing to pick existing widget or create new | ||
*/ | ||
acquireZoningWidget( | ||
zoningAssetId: string, | ||
zone: 'banner' | 'ticker', zoneInfo: ZoningSlotInfo, | ||
widgetAppId: string, | ||
): Promise<Asset<any>> { | ||
validateString(widgetAppId, 'You must provide an widgetAppId parameter'); | ||
validateString(zone, 'You must provide an zone parameter'); | ||
validateObject(zoneInfo, 'You must provide a zoneInfo parameter'); | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.App, | ||
name: MessageNames.AcquireZoningAsset, | ||
name: MessageNames.AcquireZoningWidget, | ||
params: { | ||
appId, | ||
widgetAppId, | ||
zoningAssetId, | ||
zone, | ||
zoneInfo, | ||
}, | ||
@@ -329,2 +348,33 @@ }); | ||
/** | ||
* Fetches zoning data available after adding/editing a widget | ||
*/ | ||
editZoningWidget( | ||
zoningAssetId: string, | ||
zone: 'banner' | 'ticker', zoneInfo: ZoningSlotInfo, | ||
widgetAppId: string, widgetAssetId: string, | ||
): Promise<any> { | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.App, | ||
name: MessageNames.EditZoningWidget, | ||
params: { | ||
widgetAppId, | ||
zoningAssetId, | ||
widgetAssetId, | ||
zone, | ||
zoneInfo, | ||
}, | ||
}); | ||
} | ||
/** | ||
* Fetches zoning data available after adding/editing a widget | ||
*/ | ||
getZoningData(): Promise<any> { | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.App, | ||
name: MessageNames.GetZoningData, | ||
}); | ||
} | ||
/** | ||
* Loads available fonts for the current app or for specified appId. | ||
@@ -331,0 +381,0 @@ * @param {string?} appId |
@@ -14,3 +14,4 @@ import { | ||
DataConnectionConfig, | ||
} from '../types/external-types'; | ||
AssetPreviewRequest, | ||
} from '../types/external-types'; | ||
import { BridgeBase } from './bridge/bridge-base'; | ||
@@ -134,2 +135,10 @@ import { validateArray, validateBool, validateFunction, validateObject, validateString } from './utils'; | ||
// TODO | ||
navigateToZoning(): Promise<any> { | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.Dashboard, | ||
name: MessageNames.NavigateToZoning, | ||
}); | ||
} | ||
/** | ||
@@ -145,4 +154,4 @@ * Opens a confirm window with Yes/No buttons and configurable messages. | ||
if (options) { | ||
validateString(options.title, 'Confirm box requires options.title to be set (string).'); | ||
validateString(options.text, 'Confirm box requires options.text to be set (string).'); | ||
validateString(options.title, 'Confirm box requires options.title to be set (string).'); | ||
validateString(options.text, 'Confirm box requires options.text to be set (string).'); | ||
} | ||
@@ -206,7 +215,8 @@ | ||
*/ | ||
preview<AssetValue, ThemeValue, FeedType>(url: string, | ||
asset: Asset<AssetValue>, | ||
theme: ThemeAsset<ThemeValue>, | ||
layout?: Layout, | ||
feedData?: FeedData<FeedType>): Promise<any> { | ||
preview<AssetValue, ThemeValue, FeedType>( | ||
url: string, | ||
asset: Asset<AssetValue>, | ||
theme: ThemeAsset<ThemeValue>, | ||
layout?: Layout, | ||
feedData?: FeedData<FeedType>): Promise<any> { | ||
return this.bridge.sendMessage({ | ||
@@ -226,2 +236,33 @@ namespace: MessageNamespaces.Dashboard, | ||
/** | ||
* todo | ||
*/ | ||
previewAsset<TAssetValue, TThemeValue, TFeedType>( | ||
request: AssetPreviewRequest<TAssetValue, TThemeValue, TFeedType>): Promise<any> { | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.Dashboard, | ||
name: MessageNames.PreviewAsset, | ||
params: { ...request }, | ||
}); | ||
} | ||
/** | ||
* todo | ||
*/ | ||
getAssetPreviewData(appId: string, asset: Asset<any>) | ||
: Promise<{ previewType: 'app' | 'graphics' | 'video' | 'url', previewUrl: string }> { | ||
validateString(appId, 'appId must be a string.'); | ||
validateObject(asset, 'asset must be an instance of Asset<any>.'); | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.Dashboard, | ||
name: MessageNames.GetAssetPreviewData, | ||
params: { | ||
appId, | ||
asset, | ||
}, | ||
}); | ||
} | ||
/** | ||
* Sets the current callback for the title bar breadcrumb display selector dropdown. | ||
@@ -281,3 +322,3 @@ * Attaching a callback enables the dropdown, it is disabled by default. | ||
// Reset current buttons. | ||
this.currentButtons = { }; | ||
this.currentButtons = {}; | ||
@@ -284,0 +325,0 @@ buttons = Array.isArray(buttons) ? buttons : [buttons]; |
@@ -110,3 +110,5 @@ /** | ||
GetZoningApps = 'app.getZoningApps', | ||
AcquireZoningAsset = 'app.acquireZoningAsset', | ||
AcquireZoningWidget = 'app.acquireZoningWidget', | ||
GetZoningData = 'app.getZoningData', | ||
EditZoningWidget = 'app.editZoningWidget', | ||
GetZoningLayoutAssets = 'app.getZoningLayoutAssets', | ||
@@ -127,2 +129,3 @@ GetFonts = 'app.getFonts', | ||
NavigateBack = 'dashboard.navigateBack', | ||
NavigateToZoning = 'dashboard.navigateToZoning', | ||
OpenConfirm = 'dashboard.confirm', | ||
@@ -133,2 +136,4 @@ PageError = 'dashboard.page.error', | ||
Preview = 'dashboard.preview', | ||
GetAssetPreviewData = 'dashboard.getAssetPreviewData', | ||
PreviewAsset = 'dashboard.previewAsset', | ||
SetDisplaySelectorCallback = 'dashboard.set.selectorCallback', | ||
@@ -135,0 +140,0 @@ SetDisplaySelectorVisibility = 'dashboard.set.selectorEnabled', |
@@ -119,2 +119,3 @@ /** These are meant to avaialable to client apps */ | ||
Order?: number; | ||
Zone: 'banner' | 'ticker'; | ||
} | ||
@@ -197,2 +198,19 @@ | ||
export interface AssetPreviewRequest<TAssetValue, TThemeValue, TFeedType> { | ||
url: string; // ? is ignored anyways | ||
asset: Asset<TAssetValue>; | ||
theme: ThemeAsset<TThemeValue>; | ||
feedData?: FeedData<TFeedType>; | ||
layout?: Layout; | ||
zoningConfig?: ZoningConfig; | ||
} | ||
export interface ZoningConfig { | ||
zoning: 'banner' | 'ticker' | 'elevator'; | ||
ratioWidth: number; | ||
ratioHeight: number; | ||
width: number; | ||
height: number; | ||
} | ||
export interface FeedData<T> { | ||
@@ -359,3 +377,3 @@ socialItems?: any[]; | ||
*/ | ||
showDuration: boolean; | ||
showDuration?: boolean; | ||
showLimitDays?: boolean; | ||
@@ -377,2 +395,6 @@ showLimitTime?: boolean; | ||
}; | ||
/** | ||
* Whether only one app-asset can be deployed to a Display Group | ||
* When `true` disables Display Groups with assets from the current app deployed | ||
*/ | ||
singleton?: boolean; | ||
@@ -568,1 +590,8 @@ isNew?: boolean; | ||
} | ||
export interface ZoningSlotInfo { | ||
width: number; | ||
height: number; | ||
ratioW: number; | ||
ratioH: number; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
219013
3517