@enplug/sdk-dashboard
Advanced tools
Comparing version 5.0.0-dev.13 to 5.0.0
import { EnplugDashboardSDK } from './src'; | ||
import { Dashboard } from './src/dashboard'; | ||
import { Social } from './src/social'; | ||
declare global { | ||
const enplug: EnplugDashboardSDK; | ||
} | ||
declare const enplug: EnplugDashboardSDK; | ||
export * from './src/external-types'; |
{ | ||
"name": "@enplug/sdk-dashboard", | ||
"version": "5.0.0-dev.13", | ||
"version": "5.0.0", | ||
"description": "Enplug Dashboard SDK", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.ts", |
@@ -37,2 +37,12 @@ import { | ||
/** | ||
* Returns current app ID. | ||
*/ | ||
getCurrentAppId(): Promise<string> { | ||
return this.bridge.sendMessage({ | ||
namespace: MessageNamespaces.App, | ||
name: MessageNames.getCurrentAppId, | ||
}); | ||
} | ||
/** | ||
* Loads all information for the current user. | ||
@@ -39,0 +49,0 @@ */ |
@@ -45,6 +45,6 @@ import { InboundMessage, OutboundMessage, PendingCallInfo } from '../internal-types'; | ||
* @param {MessageEvent} event An event coming from calling `postMessage` on the App's frame. | ||
* @returns {boolean} Whether the event has been sucessfully processed. | ||
* @returns {boolean} Whether to allow the event to ne handled by another event handler. | ||
*/ | ||
protected receiveMessage(event: MessageEvent): boolean { | ||
if (event && event.type === 'message') { | ||
if (event && event.type === 'message' && typeof event.data === 'string') { | ||
try { | ||
@@ -54,6 +54,5 @@ const response = JSON.parse(event.data) as InboundMessage; | ||
} catch (e) { | ||
console.log(`${TAG} Couldn't parse response: ${e}`); | ||
// ignore | ||
} | ||
} | ||
return false; | ||
} | ||
@@ -64,6 +63,6 @@ | ||
* @param {InboundMessage} response A dashboard's response to App's call. | ||
* @returns {boolean} Whether the event has been sucessfully processed. | ||
* @returns {boolean} Whether to allow the event to ne handled by another event handler. | ||
*/ | ||
private dispatchResponse(response: InboundMessage): boolean { | ||
if (response.callId) { | ||
protected dispatchResponse(response: InboundMessage): boolean { | ||
if (response.callId && typeof response.success === 'boolean') { | ||
const { resolve, reject, persistent } = this.pendingCalls.get(response.callId); | ||
@@ -82,7 +81,6 @@ if (resolve && reject) { | ||
} | ||
return true; | ||
return false; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
@@ -12,4 +12,4 @@ import { BridgeBase } from './bridge-base'; | ||
super(window); | ||
window.addEventListener('message', this.receiveMessage, true); | ||
this.postMessage = (msg) => window.postMessage(msg, '*'); | ||
window.addEventListener('message', this.receiveMessage.bind(this), false); | ||
this.postMessage = (msg) => window.parent.postMessage(JSON.stringify(msg), '*'); | ||
console.log(`${TAG} Creating Dashboard SDK`); | ||
@@ -16,0 +16,0 @@ } |
@@ -93,64 +93,65 @@ /** | ||
export enum MessageNames { | ||
GetAccount = 'getAccount', | ||
GetUser = 'getUser', | ||
GetDisplayGroups = 'getDisplays', | ||
GetSelectedDisplayId = 'getSelectedDisplayId', | ||
GetAssets = 'getAssets', | ||
GetAssetsByIds = 'getAssetsByIds', | ||
GetAssetsForApp = 'getAssetsForApp', | ||
BulkCreateAssets = 'bulkCreateAssets', | ||
BulkDeployAssets = 'bulkDeployAssets', | ||
SaveAsset = 'saveAsset', | ||
UpdateAssetOrder = 'updateAssetOrder', | ||
DeleteAsset = 'deleteAsset', | ||
GetDefaultAssets = 'getDefaultAssets', | ||
GetFonts = 'getFonts', | ||
GetThemes = 'getThemes', | ||
GetTheme = 'getTheme', | ||
EditTheme = 'editTheme', | ||
SaveTheme = 'saveTheme', | ||
DeleteTheme = 'deleteTheme', | ||
HasFeatureFlag = 'hasFeatureFlag', | ||
Click = 'click', | ||
ConfirmUnsavedChanges = 'unsavedChanges', | ||
ErrorIndicator = 'indicator.error', | ||
LoadingIndicator = 'indicator.loading', | ||
Navigate = 'navigate', | ||
NavigateBack = 'navigateBack', | ||
OpenConfirm = 'confirm', | ||
PageError = 'page.error', | ||
PageLoading = 'page.loading', | ||
PageNotFound = 'page.notFound', | ||
Preview = 'preview', | ||
SetDisplaySelectorCallback = 'set.selectorCallback', | ||
SetDisplaySelectorVisibility = 'set.selectorEnabled', | ||
SetHeaderButtons = 'set.buttons', | ||
SetHeaderTitle = 'set.title', | ||
SuccessIndicator = 'indicator.success', | ||
SwitchToView = 'switchToView', | ||
Upload = 'upload', | ||
ProcessAssetResource = 'processAssetResource', | ||
EncodeStatus = 'encodeStatus', | ||
OpenContentIntervalSettingsDialog = 'openContentIntervalSettingsDialog', | ||
SetAppHasUnsavedChanges = 'appHasUnsavedChanges', | ||
ClearQueryString = 'clearQueryString', | ||
AuthInstagram = 'authInstagram', | ||
AuthSlack = 'authSlack', | ||
GetInstagramAccounts = 'getInstagramAccounts', | ||
LookupTwitterId = 'lookupTwitterId', | ||
GetSlackTeams = 'getSlackTeams', | ||
GetSlackChannels = 'getSlackChannels', | ||
AddFacebookPage = 'addFacebookPage', | ||
GetFeeds = 'getFeeds', | ||
SaveFeed = 'saveFeed', | ||
DeleteFeed = 'deleteFeed', | ||
OpenPreapprovalDialog = 'openPreapprovalDialog', | ||
LoadAllItems = 'loadAllItems', | ||
ApproveItem = 'approveItem', | ||
RemoveItem = 'removeItem', | ||
FavoriteItem = 'favoriteItem', | ||
UnfavoriteItem = 'unfavoriteItem', | ||
BanItem = 'banItem', | ||
LoadBlacklist = 'loadBlacklist', | ||
UnbanUser = 'unbanUser', | ||
GetAccount = 'app.getAccount', | ||
getCurrentAppId = 'app.getCurrentAppId', | ||
GetUser = 'app.getUser', | ||
GetDisplayGroups = 'app.getDisplays', | ||
GetSelectedDisplayId = 'app.getSelectedDisplayId', | ||
GetAssets = 'app.getAssets', | ||
GetAssetsByIds = 'app.getAssetsByIds', | ||
GetAssetsForApp = 'app.getAssetsForApp', | ||
BulkCreateAssets = 'app.bulkCreateAssets', | ||
BulkDeployAssets = 'app.bulkDeployAssets', | ||
SaveAsset = 'app.saveAsset', | ||
UpdateAssetOrder = 'app.updateAssetOrder', | ||
DeleteAsset = 'app.deleteAsset', | ||
GetDefaultAssets = 'app.getDefaultAssets', | ||
GetFonts = 'app.getFonts', | ||
GetThemes = 'app.getThemes', | ||
GetTheme = 'app.getTheme', | ||
EditTheme = 'app.editTheme', | ||
SaveTheme = 'app.saveTheme', | ||
DeleteTheme = 'app.deleteTheme', | ||
HasFeatureFlag = 'app.hasFeatureFlag', | ||
Click = 'dashboard.click', | ||
ConfirmUnsavedChanges = 'dashboard.unsavedChanges', | ||
ErrorIndicator = 'dashboard.indicator.error', | ||
LoadingIndicator = 'dashboard.indicator.loading', | ||
Navigate = 'dashboard.navigate', | ||
NavigateBack = 'dashboard.navigateBack', | ||
OpenConfirm = 'dashboard.confirm', | ||
PageError = 'dashboard.page.error', | ||
PageLoading = 'dashboard.page.loading', | ||
PageNotFound = 'dashboard.page.notFound', | ||
Preview = 'dashboard.preview', | ||
SetDisplaySelectorCallback = 'dashboard.set.selectorCallback', | ||
SetDisplaySelectorVisibility = 'dashboard.set.selectorEnabled', | ||
SetHeaderButtons = 'dashboard.set.buttons', | ||
SetHeaderTitle = 'dashboard.set.title', | ||
SuccessIndicator = 'dashboard.indicator.success', | ||
SwitchToView = 'dashboard.switchToView', | ||
Upload = 'dashboard.upload', | ||
ProcessAssetResource = 'dashboard.processAssetResource', | ||
EncodeStatus = 'dashboard.encodeStatus', | ||
OpenContentIntervalSettingsDialog = 'dashboard.openContentIntervalSettingsDialog', | ||
SetAppHasUnsavedChanges = 'dashboard.appHasUnsavedChanges', | ||
ClearQueryString = 'social.clearQueryString', | ||
AuthInstagram = 'social.authInstagram', | ||
AuthSlack = 'social.authSlack', | ||
GetInstagramAccounts = 'social.getInstagramAccounts', | ||
LookupTwitterId = 'social.lookupTwitterId', | ||
GetSlackTeams = 'social.getSlackTeams', | ||
GetSlackChannels = 'social.getSlackChannels', | ||
AddFacebookPage = 'social.addFacebookPage', | ||
GetFeeds = 'social.getFeeds', | ||
SaveFeed = 'social.saveFeed', | ||
DeleteFeed = 'social.deleteFeed', | ||
OpenPreapprovalDialog = 'social.openPreapprovalDialog', | ||
LoadAllItems = 'social.loadAllItems', | ||
ApproveItem = 'social.approveItem', | ||
RemoveItem = 'social.removeItem', | ||
FavoriteItem = 'social.favoriteItem', | ||
UnfavoriteItem = 'social.unfavoriteItem', | ||
BanItem = 'social.banItem', | ||
LoadBlacklist = 'social.loadBlacklist', | ||
UnbanUser = 'social.unbanUser', | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
194353
2891
1
1