@enplug/sdk-dashboard
Advanced tools
Comparing version 5.2.2-slackauth.2 to 5.2.2-zoning-1
{ | ||
"name": "@enplug/sdk-dashboard", | ||
"version": "5.2.2-slackauth.2", | ||
"version": "5.2.2-zoning-1", | ||
"description": "Enplug Dashboard SDK", | ||
@@ -14,3 +14,3 @@ "main": "./src/index.ts", | ||
"start": "npm-run-all clean lint test", | ||
"publish-dev": "npm run bundle:prod && npm publish --tag dev", | ||
"publish-dev": "npm run bundle && npm publish --tag dev", | ||
"release": "npm run bundle && enplug-release-sdk", | ||
@@ -17,0 +17,0 @@ "release:prod": "npm run bundle:prod && enplug-release-sdk", |
@@ -15,3 +15,5 @@ import { | ||
DefaultAsset, | ||
} from '../types/external-types'; | ||
ZoningAppsResponse, | ||
ZoningSlotInfo, | ||
} from '../types/external-types'; | ||
import { BridgeBase } from './bridge/bridge-base'; | ||
@@ -154,3 +156,4 @@ import { validateArray, validateObject, validateString } from './utils'; | ||
*/ | ||
bulkDeployAssets<T>(assets: Array<Asset<T>>, dialogOptions: DeployDialogOptions = {}): Promise<Array<Asset<T>>> { | ||
bulkDeployAssets<T>(assets: Array<Asset<T>>, dialogOptions: DeployDialogOptions = {}) | ||
: Promise<Array<Asset<T>>> { | ||
validateArray(assets, 'You must provide an array of assets when deploying assets.'); | ||
@@ -297,2 +300,82 @@ validateObject(assets[0], 'You must provide an array of assets (objects) when deploying assets.'); | ||
/** | ||
* Loads list of banner/ticker widget apps | ||
*/ | ||
getZoningApps(): Promise<ZoningAppsResponse> { | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.App, | ||
name: MessageNames.GetZoningApps, | ||
}); | ||
} | ||
/** | ||
* Loads widget assets used in a given zoning asset layout | ||
*/ | ||
getZoningLayoutAssets(assetId: string): Promise<Array<Asset<any>>> { | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.App, | ||
name: MessageNames.GetZoningLayoutAssets, | ||
params: { | ||
assetId, | ||
}, | ||
}); | ||
} | ||
/** | ||
* Shows modal allowing to pick existing widget or create new | ||
*/ | ||
acquireZoningWidget( | ||
zoningAssetId: string, | ||
zone: 'banner' | 'ticker', zoneInfo: ZoningSlotInfo, | ||
widgetAppId: string, | ||
usedAssetsIds: 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.AcquireZoningWidget, | ||
params: { | ||
widgetAppId, | ||
zoningAssetId, | ||
zone, | ||
zoneInfo, | ||
usedAssetsIds, | ||
}, | ||
}); | ||
} | ||
/** | ||
* 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. | ||
@@ -353,9 +436,11 @@ * @param {string?} appId | ||
*/ | ||
editTheme<AssetValue, FeedType>(themeDefinition: ThemeDefinition, | ||
theme: ThemeAsset<any>, | ||
previewUrl: string, | ||
previewAsset?: Array<Asset<AssetValue>>, | ||
layout?: Layout, | ||
fonts?: FontDefinition[], | ||
feedData?: FeedData<FeedType>): Promise<ThemeAsset<AssetValue>> { | ||
editTheme<AssetValue, FeedType>( | ||
themeDefinition: ThemeDefinition, | ||
theme: ThemeAsset<any>, | ||
previewUrl: string, | ||
previewAsset?: Array<Asset<AssetValue>>, | ||
layout?: Layout, | ||
fonts?: FontDefinition[], | ||
feedData?: FeedData<FeedType>, | ||
): Promise<ThemeAsset<AssetValue>> { | ||
validateObject(themeDefinition, 'You must provide the theme definition (object).'); | ||
@@ -425,2 +510,16 @@ | ||
} | ||
/** | ||
* Updates dashboard window url without reloading the page | ||
*/ | ||
appUrlChanged(appPath: string): Promise<any> { | ||
validateString(appPath, 'You must provide the appPath (string).'); | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.App, | ||
name: MessageNames.AppUrlChanged, | ||
params: { | ||
appPath, | ||
}, | ||
}); | ||
} | ||
} |
@@ -14,3 +14,4 @@ import { | ||
DataConnectionConfig, | ||
} from '../types/external-types'; | ||
AssetPreviewRequest, | ||
} from '../types/external-types'; | ||
import { BridgeBase } from './bridge/bridge-base'; | ||
@@ -134,2 +135,11 @@ import { validateArray, validateBool, validateFunction, validateObject, validateString } from './utils'; | ||
// TODO | ||
navigateToZoning(assetId?: string): Promise<any> { | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.Dashboard, | ||
name: MessageNames.NavigateToZoning, | ||
params: { assetId }, | ||
}); | ||
} | ||
/** | ||
@@ -145,4 +155,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 +216,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 +237,38 @@ namespace: MessageNamespaces.Dashboard, | ||
/** | ||
* todo | ||
*/ | ||
previewAsset<TAssetValue = any, TThemeValue = any, TFeedType = any>( | ||
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>, origin: string) | ||
: Promise<{ | ||
previewType: 'app' | 'graphics' | 'video' | 'url', | ||
previewUrl: string, theme: any, feedData: any, locale: string, | ||
}> { | ||
validateString(appId, 'appId must be a string.'); | ||
validateObject(asset, 'asset must be an instance of Asset<any>.'); | ||
validateString(origin, 'origin must be a string.'); | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.Dashboard, | ||
name: MessageNames.GetAssetPreviewData, | ||
params: { | ||
appId, | ||
asset, | ||
origin, | ||
}, | ||
}); | ||
} | ||
/** | ||
* Sets the current callback for the title bar breadcrumb display selector dropdown. | ||
@@ -281,3 +328,3 @@ * Attaching a callback enables the dropdown, it is disabled by default. | ||
// Reset current buttons. | ||
this.currentButtons = { }; | ||
this.currentButtons = {}; | ||
@@ -388,3 +435,4 @@ buttons = Array.isArray(buttons) ? buttons : [buttons]; | ||
*/ | ||
processAssetResource<T>(accountId: string, appId: string, assets: Array<Asset<T>>): Promise<any> { | ||
processAssetResource<T>(accountId: string, appId: string, assets: Array<Asset<T>>) | ||
: Promise<any> { | ||
validateString(accountId, 'You must provide the accountId (string).'); | ||
@@ -391,0 +439,0 @@ validateString(appId, 'You must provide the appId (string).'); |
@@ -109,2 +109,7 @@ /** | ||
GetDefaultAssets = 'app.getDefaultAssets', | ||
GetZoningApps = 'app.getZoningApps', | ||
AcquireZoningWidget = 'app.acquireZoningWidget', | ||
GetZoningData = 'app.getZoningData', | ||
EditZoningWidget = 'app.editZoningWidget', | ||
GetZoningLayoutAssets = 'app.getZoningLayoutAssets', | ||
GetFonts = 'app.getFonts', | ||
@@ -117,2 +122,3 @@ GetThemes = 'app.getThemes', | ||
HasFeatureFlag = 'app.hasFeatureFlag', | ||
AppUrlChanged = 'app.appUrlChanged', | ||
Click = 'dashboard.click', | ||
@@ -124,2 +130,3 @@ ConfirmUnsavedChanges = 'dashboard.unsavedChanges', | ||
NavigateBack = 'dashboard.navigateBack', | ||
NavigateToZoning = 'dashboard.navigateToZoning', | ||
OpenConfirm = 'dashboard.confirm', | ||
@@ -130,2 +137,4 @@ PageError = 'dashboard.page.error', | ||
Preview = 'dashboard.preview', | ||
GetAssetPreviewData = 'dashboard.getAssetPreviewData', | ||
PreviewAsset = 'dashboard.previewAsset', | ||
SetDisplaySelectorCallback = 'dashboard.set.selectorCallback', | ||
@@ -132,0 +141,0 @@ SetDisplaySelectorVisibility = 'dashboard.set.selectorEnabled', |
@@ -7,25 +7,15 @@ /** These are meant to avaialable to client apps */ | ||
export interface BaseAsset<T> { | ||
/** | ||
* WCF date = "/Date(137...)/" | ||
*/ | ||
/** WCF date = "/Date(137...)/" */ | ||
Created?: string; | ||
/** | ||
* Duration of play in seconds. | ||
*/ | ||
/** Duration of play in seconds. */ | ||
Duration?: number; | ||
/** | ||
* Asset ID | ||
*/ | ||
/** Asset ID */ | ||
Id: string | null; | ||
/** | ||
* Details of play schedule. | ||
*/ | ||
/** Details of play schedule. */ | ||
Schedule?: Schedule; | ||
/** | ||
* Value object provided when created. NOTE: Only objects allowed. | ||
*/ | ||
/** Value object provided when created. NOTE: Only objects allowed. */ | ||
Value: T; | ||
@@ -37,13 +27,37 @@ | ||
/** | ||
* Optional Theme Id if set | ||
*/ | ||
/** Optional Theme Id if set */ | ||
ThemeId?: string; | ||
/** | ||
* Optional, used when user is in the content approval flow | ||
*/ | ||
/** Optional, used when user is in the content approval flow */ | ||
NeedsApproval?: boolean; | ||
} | ||
export interface Asset<T> extends BaseAsset<T> { | ||
/** Array of Ids of Display Groups this asset is currently deployed to */ | ||
VenueIds: string[]; | ||
/** Position within app's list of assets on a display group or in the library */ | ||
Order?: number; | ||
/** Asset version in the Content Approval flow */ | ||
Version?: number; | ||
IsZoningWidget?: boolean; | ||
/** Currently @ Value.Name - subject to change. Display name of the asset. used in lists. */ | ||
Name?: string; | ||
/** Currently @ Value.Zone - subject to change. Zoning widget asset slot type */ | ||
Zone?: 'banner' | 'ticker'; | ||
/** List of zoning assets on which the obj - a widget asset is placed */ | ||
ZoningAssetIds?: string[]; | ||
} | ||
export interface DefaultAsset<T> extends BaseAsset<T> { | ||
Level: DefaultAssetLevel; | ||
LevelId?: string; | ||
DeployedId?: string; | ||
} | ||
export interface AssetDataBackendValue { | ||
@@ -69,4 +83,6 @@ AssetId?: string; | ||
export interface DataBoundScheduleBackend { | ||
Start: string; // .NET TimeSpan | ||
EndAfter: string; // .NET TimeSpan | ||
/** .NET TimeSpan */ | ||
Start: string; | ||
/** .NET TimeSpan */ | ||
EndAfter: string; | ||
Yearly: boolean; | ||
@@ -111,31 +127,24 @@ } | ||
export interface Asset<T> extends BaseAsset<T> { | ||
/** | ||
* Array of Ids of Display Groups this asset is currently deployed to | ||
*/ | ||
VenueIds: string[]; | ||
export interface Schedule { | ||
/** "2019-03-27T00:00:00" */ | ||
ActivationDate?: string; | ||
/** | ||
* Asset version in the Content Approval flow | ||
*/ | ||
Version?: number; | ||
} | ||
/** Limit days */ | ||
ActiveDays: string[]; | ||
export interface DefaultAsset<T> extends BaseAsset<T> { | ||
Level: DefaultAssetLevel; | ||
LevelId?: string; | ||
DeployedId?: string; | ||
} | ||
export interface Schedule { | ||
ActivationDate?: string; // "2019-03-27T00:00:00" | ||
ActiveDays: string[]; // Limit days | ||
Created: string; // WCF date | ||
/** WCF date */ | ||
Created: string; | ||
DeleteWhenExpired: boolean; | ||
ExpirationCount: number; | ||
ExpirationDate: string; // "2019-03-27T00:00:00" | ||
Id: string; // Schedule ID | ||
/** "2019-03-27T00:00:00" */ | ||
ExpirationDate: string; | ||
/** Schedule ID */ | ||
Id: string; | ||
IsDeleted: boolean; | ||
IsPriority: boolean; | ||
LastSaved: string; // WCF date | ||
/** WCF date */ | ||
LastSaved: string; | ||
PlayTimes: TimeRange[]; | ||
@@ -146,4 +155,6 @@ Recurrence: number; | ||
export interface TimeRange { | ||
StartTime: string; // "09:00:00" | ||
EndTime: string; // "22:59:00" | ||
/** "09:00:00" */ | ||
StartTime: string; | ||
/** "22:59:00" */ | ||
EndTime: string; | ||
} | ||
@@ -200,2 +211,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> { | ||
@@ -284,3 +312,4 @@ socialItems?: any[]; | ||
uploadSourceAppId?: string; | ||
forceCrop?: boolean; // forceCrop should be used together with isMultipleSelection = false | ||
/** forceCrop should be used together with isMultipleSelection = false */ | ||
forceCrop?: boolean; | ||
cropForceAspectRatio?: number; | ||
@@ -326,16 +355,21 @@ cropMaximumImageWidth?: number; | ||
export interface EnplugUser { | ||
id: string; // User id in the system | ||
accountId: string; // Current user's account ID | ||
type: string; // User access type | ||
/** User id in the system */ | ||
id: string; | ||
/** Current user's account ID */ | ||
accountId: string; | ||
/** User access type */ | ||
type: string; | ||
data: { | ||
email: string; | ||
firstName: string; | ||
lastName: string; | ||
accountName: string; | ||
locale: string; | ||
accountStatus: string; | ||
email: string; | ||
firstName: string; | ||
lastName: string; | ||
accountName: string; | ||
locale: string; | ||
accountStatus: string; | ||
}; | ||
has: { | ||
rootAccess: boolean; | ||
limitedAccess: boolean; | ||
rootAccess: boolean; | ||
limitedAccess: boolean; | ||
}; | ||
@@ -345,4 +379,7 @@ } | ||
export interface DisplayGroup { | ||
language: string; // e.g. English, Russian, French | ||
orientation: string; // Landscape or Portrait | ||
/** e.g. English, Russian, French */ | ||
language: string; | ||
/** Landscape or Portrait */ | ||
orientation: string; | ||
timezone: string; | ||
@@ -352,10 +389,6 @@ } | ||
export interface DeployDialogOptions { | ||
/** | ||
* Whether to show the schedule tab in the dialog. | ||
*/ | ||
/** Whether to show the schedule tab in the dialog. */ | ||
showSchedule?: boolean; | ||
/** | ||
* Schedule tab options. Relevant if `showSchedule` is true. | ||
*/ | ||
/** Schedule tab options. Relevant if `showSchedule` is true. */ | ||
scheduleOptions?: { | ||
@@ -366,33 +399,33 @@ /** | ||
*/ | ||
showDuration: boolean; | ||
showDuration?: boolean; | ||
showLimitDays?: boolean; | ||
showLimitTime?: boolean; | ||
showScheduleForLater?: boolean; | ||
/** | ||
* allow user to choose the schedule repeat options | ||
*/ | ||
/** allow user to choose the schedule repeat options */ | ||
showRepeat?: boolean; | ||
/** | ||
* allow user to edit Priotiy Play flag | ||
*/ | ||
/** allow user to edit Priotiy Play flag */ | ||
showPriorityPlay?: boolean; | ||
/** | ||
* Graphics app only this one | ||
*/ | ||
/** Graphics app only this one */ | ||
setDefaultDurationForNewImages?: 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; | ||
isNew?: boolean; | ||
/** | ||
* by default, other option is 'schedule' | ||
*/ | ||
/** by default, other option is 'schedule' */ | ||
initialTab?: string; | ||
/** | ||
* Message to show when the save is successful | ||
*/ | ||
/** Message to show when the save is successful */ | ||
successMessage?: string; | ||
/** | ||
* Message to show while the save call is in progress | ||
*/ | ||
/** Message to show while the save call is in progress */ | ||
loadingMessage?: string; | ||
/** | ||
@@ -403,29 +436,23 @@ * To force showing the DeployDialog when updating existing asset. | ||
showDeployDialog?: boolean; | ||
/** | ||
* asset.Value props to validate | ||
*/ | ||
noDialog?: boolean; | ||
/** asset.Value props to validate */ | ||
requiredAssetProps?: string[]; | ||
/** | ||
* allow user to edit assets' tags | ||
*/ | ||
/** allow user to edit assets' tags */ | ||
showTagsEditor?: boolean; | ||
/** | ||
* Graphics and Arts app only this one - list of assets to traverse with < > buttons | ||
*/ | ||
/** Graphics and Arts app only this one - list of assets to traverse with < > buttons */ | ||
assetsToNavigate?: Array<Asset<any>>; | ||
/** | ||
* Graphics and Arts app only use this one | ||
*/ | ||
/** Graphics and Arts app only use this one */ | ||
canNavigate?: boolean; | ||
/** | ||
* Graphics and Arts app only use this one | ||
*/ | ||
/** Graphics and Arts app only use this one */ | ||
showDetails?: boolean; | ||
/** | ||
* The type of presented asset | ||
*/ | ||
/** The type of presented asset */ | ||
detailsType?: 'graphic' | 'art'; | ||
/** | ||
* Graphics and Arts app only use this one | ||
*/ | ||
/** Graphics and Arts app only use this one */ | ||
showReporting?: boolean; | ||
@@ -436,49 +463,49 @@ } | ||
export interface FacebookAuthParams { | ||
FeedId: string; | ||
AdminAccessToken: string; | ||
PageId: string; | ||
FeedId: string; | ||
AdminAccessToken: string; | ||
PageId: string; | ||
} | ||
export interface TwitterSubscriptionStatusResponse { | ||
UsedFollows: string[]; | ||
UsedTracks: string[]; | ||
AllowedFollows: 0; | ||
AllowedTracks: 0; | ||
UsedFollows: string[]; | ||
UsedTracks: string[]; | ||
AllowedFollows: 0; | ||
AllowedTracks: 0; | ||
} | ||
export interface SocialItemMedia { | ||
Source: string; | ||
Type: string; | ||
Source: string; | ||
Type: string; | ||
} | ||
export interface SocialItemUser { | ||
Avatar: string; | ||
Link: string; | ||
Name: string; | ||
Avatar: string; | ||
Link: string; | ||
Name: string; | ||
} | ||
export interface SocialItem { | ||
Created: Date; | ||
FlaggedWords: any[]; | ||
Id: string; | ||
IsFavorited: boolean; | ||
Link: string; | ||
Media: SocialItemMedia; | ||
SocialItemId: string; | ||
SocialNetwork: string; | ||
Text: string; | ||
User: EnplugUser; | ||
Created: Date; | ||
FlaggedWords: any[]; | ||
Id: string; | ||
IsFavorited: boolean; | ||
Link: string; | ||
Media: SocialItemMedia; | ||
SocialItemId: string; | ||
SocialNetwork: string; | ||
Text: string; | ||
User: EnplugUser; | ||
} | ||
export interface SocialItemsResponse { | ||
__type: string; | ||
LiveItems: SocialItem[]; | ||
PendingItems: SocialItem[]; | ||
SocialNetworks: string[]; | ||
__type: string; | ||
LiveItems: SocialItem[]; | ||
PendingItems: SocialItem[]; | ||
SocialNetworks: string[]; | ||
} | ||
export interface PreapprovalDialogOptions { | ||
showVideoEnabled?: boolean; | ||
showImagesEnabled?: boolean; | ||
showConnectedUserNeedsApproval?: boolean; | ||
showVideoEnabled?: boolean; | ||
showImagesEnabled?: boolean; | ||
showConnectedUserNeedsApproval?: boolean; | ||
} | ||
@@ -539,4 +566,4 @@ | ||
// tslint:disable: no-empty-interface | ||
export interface ConnectionQueryParams extends ConnectionParams {} | ||
export interface ConnectionHttpHeaders extends ConnectionParams {} | ||
export interface ConnectionQueryParams extends ConnectionParams { } | ||
export interface ConnectionHttpHeaders extends ConnectionParams { } | ||
@@ -566,1 +593,19 @@ export type RefreshFrequency = 1 | 5 | 10 | 30; | ||
} | ||
export interface ZoningAppsResponse { | ||
BannerApps: ZoningApp[]; | ||
TickerApps: ZoningApp[]; | ||
} | ||
export interface ZoningApp { | ||
AppId: string; | ||
ConfigureUrl: string; | ||
Name: string; | ||
} | ||
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
221907
3537