@enplug/dashboard-sdk
Advanced tools
Comparing version 4.7.17 to 4.7.19
@@ -0,0 +0,0 @@ # Changelog |
@@ -552,2 +552,4 @@ (function (window) { | ||
* | ||
* @param {string} [level] 'Default', 'Network', 'Account' | ||
* @param {string} [levelId] NetworkId or AccountId | ||
* @param {function} onSuccess | ||
@@ -557,5 +559,9 @@ * @param {function} [onError] | ||
*/ | ||
this.getDefaultAssets = function (onSuccess, onError) { | ||
return this.method({ | ||
this.getDefaultAssets = function (level, levelId, onSuccess, onError) { | ||
return this.method({ | ||
name: 'getDefaultAssets', | ||
params: { | ||
level: level, | ||
levelId: levelId | ||
}, | ||
successCallback: onSuccess, | ||
@@ -1338,15 +1344,2 @@ errorCallback: onError, | ||
// Old Instagram auth method. TODO(arek): remove when it's safe to do so. | ||
this.authenticate = function (authCode, redirectUri, onSuccess, onError) { | ||
this.validate(authCode, 'string', 'No authCode provided.'); | ||
this.validate(redirectUri, 'string', 'No redirectUri provided.'); | ||
return this.method({ | ||
name: 'authenticate', | ||
params: {authCode: authCode, redirectUri: redirectUri}, | ||
successCallback: onSuccess, | ||
errorCallback: onError | ||
}); | ||
}; | ||
// Current Instagram auth method. | ||
this.authInstagram = function(token, onSuccess, onError) { | ||
@@ -1362,12 +1355,2 @@ this.validate(token, 'string', 'No authCode provided.'); | ||
this.authFacebook = function (params, onSuccess, onError) { | ||
console.log('authFacebook', params); | ||
return this.method({ | ||
name: 'authFacebook', | ||
params: params, | ||
successCallback: onSuccess, | ||
errorCallback: onError | ||
}); | ||
}; | ||
this.authSlack = function(authToken, redirectUrl, onSuccess, onError) { | ||
@@ -1374,0 +1357,0 @@ this.validate(authToken, 'string', 'No Slack auth token provided'); |
@@ -1,1 +0,1 @@ | ||
!function(a){"use strict";a.enplug={debug:!1,classes:{},noop:function(){}}}(window),function(a){"use strict";function b(b,d){function e(b){a.debug&&(arguments[0]=c+arguments[0],console.log.apply(console,arguments))}function f(b){if(b.successCallback&&"function"!=typeof b.successCallback)throw new Error(c+"Success callback must be a function.");if(b.successCallback=b.successCallback||a.noop,b.errorCallback&&"function"!=typeof b.errorCallback)throw new Error(c+"Error callback must be a function.");b.errorCallback=b.errorCallback||a.noop}function g(a){try{var b=JSON.parse(a.data);return b.namespace===d&&"boolean"==typeof b.success&&b}catch(c){}return!1}this.callId=0,this.pendingCalls={},this.namespace=d,this.send=function(a){if(a.name){a.callId=++this.callId,a.namespace=d,a.transient=!!a.transient,a.persistent=!!a.persistent,f(a),e("Calling method:",a),a.transient||(this.pendingCalls[a.callId]=a);try{var g=JSON.stringify(a);b.parent.postMessage(g,"*")}catch(h){console.error(c+"Error:",h)}return a.callId}throw new Error(c+"All transport method calls must have a name.")},this.handleEvent=function(a){if("message"===a.type){var b=g(a);if(b){var c=this.pendingCalls[b.callId];if(c)return c.persistent||delete this.pendingCalls[b.callId],e("Calling method "+(b.success?"success":"error")+" callback:",{call:c,response:b}),(b.success?c.successCallback:c.errorCallback)(b.data),!0}}return!1},this.cleanup=function(){b.removeEventListener("message",this,!1)},b.addEventListener("message",this,!1)}var c="[Enplug SDK] ";b.prototype.TAG=c,a.classes.Transport=b}(window.enplug),function(a,b){"use strict";function c(c){if(!c)throw new Error(b.classes.Transport.prototype.TAG+"Senders must specify a method prefix.");this.prefix=c,this.novalidate=!1,this.transport=new b.classes.Transport(a,c)}c.prototype={validate:function(a,b,c){if(!(this.novalidate||null!=a&&("array"===b?Array.isArray(a):typeof a===b)))throw new Error(this.transport.TAG+c)},method:function(a){if("object"==typeof a)return a.name=this.prefix+"."+a.name,this.transport.send(a);throw new Error("Transport options must be an object.")},cleanup:function(){this.transport.cleanup()}},b.classes.Sender=c}(window,window.enplug),function(a){"use strict";function b(){a.classes.Sender.call(this,"app"),this.getAccount=function(a,b){return this.method({name:"getAccount",successCallback:a,errorCallback:b})},this.getUser=function(a,b){return this.method({name:"getUser",successCallback:a,errorCallback:b})},this.getDisplayGroups=function(a,b){return this.method({name:"getDisplays",successCallback:a,errorCallback:b})},this.getSelectedDisplayId=function(a,b){return this.method({name:"getSelectedDisplayId",successCallback:a,errorCallback:b})},this.getAssets=function(a,b){return this.method({name:"getAssets",successCallback:a,errorCallback:b})},this.getAssetsForApp=function(a,b,c){return this.method({name:"getAssetsForApp",appId:a,successCallback:b,errorCallback:c})},this.bulkCreateAssets=function(a,b,c,d){var e={assets:a,dialogOptions:b||{}};return this.validate(e.assets,"array","You must provide an array of assets (object) when creating new assets."),this.validate(e.assets[0],"object","You must provide an array of assets (object) when creating new assets."),e.assets[0]&&this.validate(e.assets[0].Value,"object","You must provide a Value (object) when creating an asset."),this.method({name:"bulkCreateAssets",params:e,successCallback:c,errorCallback:d})},this.bulkDeployAssets=function(a,b,c,d){var e={assets:a,dialogOptions:b||{}};return this.validate(e.assets,"array","You must provide an array of assets (object) when deploying assets."),this.validate(e.assets[0],"object","You must provide an array of assets (object) when deploying assets."),e.assets[0]&&(this.validate(e.assets[0].Value,"object","You must provide a Value (object) when deploying an asset."),this.validate(e.assets[0].Id,"string","You must provide the ID (string) on the asset you want to update.")),this.method({name:"bulkDeployAssets",params:e,successCallback:c,errorCallback:d})},this.saveAsset=function(a,b,c,d){this.validate(a,"object","You must provide an asset object to save.");var e={asset:a,dialogOptions:b||{}};return this.method({name:"saveAsset",params:e,successCallback:c,errorCallback:d})},this.updateAssetOrder=function(a,b,c){return this.validate(a,"array","You must provide an array of assets (or asset ids) in the new order."),this.method({name:"updateAssetOrder",params:{assets:a},successCallback:b,errorCallback:c})},this.deleteAsset=function(a,b,c){return Array.isArray(a)?(this.validate(a,"array","You must pass a single ID (string) or Array of asset IDs to be deleted."),this.validate(a[0],"string","You must provide at least one Asset ID (string) to be deleted.")):(this.validate(a,"string","You must provide the ID (string) of the asset to delete."),a=[a]),this.method({name:"deleteAsset",params:{ids:a},successCallback:b,errorCallback:c})},this.getDefaultAssets=function(a,b){return this.method({name:"getDefaultAssets",successCallback:a,errorCallback:b})},this.getThemes=function(a,b,c){return this.method({name:"getThemes",params:{appId:a},successCallback:b,errorCallback:c})},this.getTheme=function(a,b,c){return this.method({name:"getTheme",params:{id:a},successCallback:b,errorCallback:c})},this.editTheme=function(a,b,c,d,e,f,g,h,i){return this.validate(a,"object","You must provide the theme definition (object)."),this.method({name:"editTheme",params:{themeDefinition:a,theme:b,previewUrl:c,previewAsset:d,layout:e,fonts:f,feedData:g},successCallback:h,errorCallback:i})},this.saveTheme=function(a,b,c){return this.validate(a,"object","You must provide the theme (object) to save."),this.validate(a.Value,"object","You must provide the theme.Value (object) to save."),this.method({name:"saveTheme",params:{theme:a},successCallback:b,errorCallback:c})},this.deleteTheme=function(a,b,c){return this.validate(a,"string","You must provide the ID (string) of the theme to remove."),this.method({name:"deleteTheme",params:{themeId:a},successCallback:b,errorCallback:c})},this.hasFeatureFlag=function(a,b,c){return this.validate(a,"string","You must provide the flag name (string)."),this.method({name:"hasFeatureFlag",params:{flagName:a},successCallback:b,errorCallback:c})},this.getDisplay=this.getDisplayGroups,this.getDisplays=this.getDisplayGroups,this.getDisplayGroup=this.getDisplayGroups}b.prototype=Object.create(a.classes.Sender.prototype),a.classes.AccountSender=b,a.account=new b}(window.enplug),function(a,b){"use strict";function c(){function c(){return g.click(),!0}a.classes.Sender.call(this,"dashboard");var d=[],e=function(){},f=!0;this.setHeaderTitle=function(a,b,c){return this.validate(a,"string","Header title must be a string."),this.method({name:"set.title",params:a,successCallback:b,errorCallback:c})},this.setDisplaySelectorCallback=function(a,b){return this.validate(a,"function","To enable the display selector in the page title you must supply a callback function."),e=a,this.method({name:"set.selectorCallback",params:a,persistent:!0,successCallback:function(a){return"function"==typeof e&&void 0!==a&&e(a),a},errorCallback:b})},this.setDisplaySelectorVisibility=function(a,b,c){return this.validate(a,"boolean","Setting the display selector visibility requires a boolean argument, true to show or false to hide."),this.method({name:"set.selectorEnabled",params:a,successCallback:b,errorCallback:c})},this.switchToView=function(a,b,c,d){var e={displayGroupId:a,displayGroupName:b};return this.method({name:"switchToView",params:e,successCallback:c,errorCallback:d})},this.setHeaderButtons=function(a,b,c){this.validate(a,"object","Header buttons must be an object (single) or array (multiple)."),d=[],a=Array.isArray(a)?a:[a];for(var e=0;e<a.length;e++){var f=a[e];this.validate(f,"object","Header buttons must be objects."),f&&(this.validate(f.action,"function","Header buttons must have an action (function)."),f.id="button-"+Math.round(9999*Math.random()+1),d[f.id]=f)}return this.method({name:"set.buttons",params:a,persistent:!0,successCallback:function(a){if(a){var c=d[a.id];c?c.action():console.warn("Unrecognized button click:",a)}"function"==typeof b&&b(a)},errorCallback:c})},this.pageLoading=function(a,b,c){return this.validate(a,"boolean","Page loading status must be a boolean."),this.method({name:"page.loading",params:a,successCallback:function(){f=a,"function"==typeof b&&b(f)},errorCallback:c})},this.isLoading=function(){return f},this.pageError=function(a,b){return this.method({name:"page.error",successCallback:a,errorCallback:b})},this.pageNotFound=function(a,b){return this.method({name:"page.notFound",successCallback:a,errorCallback:b})},this.loadingIndicator=function(a,b,c){return this.validate(a,"string","Loading indicator requires a loading message (string)"),this.method({name:"indicator.loading",params:a,successCallback:b,errorCallback:c})},this.successIndicator=function(a,b,c){return this.validate(a,"string","Success indicator requires a success message (string)"),this.method({name:"indicator.success",params:a,successCallback:b,errorCallback:c})},this.errorIndicator=function(a,b,c){return this.validate(a,"string","Error indicator requires an error message (string)"),this.method({name:"indicator.error",params:a,successCallback:b,errorCallback:c})},this.openConfirm=function(a,b,c){return this.validate(a,"object","Confirm box requires options to be set (object)."),a&&(this.validate(a.title,"string","Confirm box requires options.title to be set (string)."),this.validate(a.text,"string","Confirm box requires options.text to be set (string).")),this.method({name:"confirm",params:a,successCallback:b,errorCallback:c})},this.confirmUnsavedChanges=function(a,b){return this.method({name:"unsavedChanges",successCallback:a,errorCallback:b})},this.navigate=function(a,b,c){return this.method({name:"navigate",params:{data:a},successCallback:b,errorCallback:c})},this.navigateBack=function(a,b,c){return this.method({name:"navigateBack",params:{assetId:a},successCallback:b,errorCallback:c})},this.preview=function(a,b,c,d,e,f,g){return this.method({name:"preview",params:{url:a,asset:b,theme:c,layout:d,feedData:e},successCallback:f,errorCallback:g})},this.upload=function(a,b,c){return this.method({name:"upload",params:a,successCallback:b,errorCallback:c})},this.processAssetResource=function(a,b,c,d,e){return this.validate(a,"string","You must provide the accountId (string)."),this.validate(b,"string","You must provide the appId (string)."),this.validate(c,"array","You must provide the assets (array)."),this.method({name:"processAssetResource",params:{accountId:a,appId:b,assets:c},successCallback:d,errorCallback:e})},this.encodeStatus=function(a,b,c){return this.validate(a,"string","You must provide the url (string)."),this.method({name:"encodeStatus",params:a,successCallback:b,errorCallback:c})},this.cleanup=function(){b.removeEventListener("click",c,!1),a.classes.Sender.prototype.cleanup.call(this)},this.click=function(){return this.method({name:"click",transient:!0})},this.openContentIntervalSettingsDialog=function(a,b,c,d,e){return this.validate(a,"string","You must provide the appName (string)."),this.validate(b,"string","You must provide the level (string)."),this.validate(c,"string","You must provide the levelId (string)."),this.method({name:"openContentIntervalSettingsDialog",params:{appName:a,level:b,levelId:c},successCallback:d,errorCallback:e})},this.setAppHasUnsavedChanges=function(a,b){return this.validate(a,"boolean","To report changes to the dashboard you must supply a value."),this.method({name:"appHasUnsavedChanges",params:{hasUnsavedChanges:a},errorCallback:b})};var g=this;b.addEventListener("click",c,!1)}c.prototype=Object.create(a.classes.Sender.prototype),a.classes.DashboardSender=c,a.dashboard=new c}(window.enplug,document),function(a,b){"use strict";function c(){a.classes.Sender.call(this,"social"),this.clearQueryString=function(){return this.method({name:"clearQueryString"})},this.authenticate=function(a,b,c,d){return this.validate(a,"string","No authCode provided."),this.validate(b,"string","No redirectUri provided."),this.method({name:"authenticate",params:{authCode:a,redirectUri:b},successCallback:c,errorCallback:d})},this.authInstagram=function(a,b,c){return this.validate(a,"string","No authCode provided."),this.method({name:"authInstagram",params:{accessToken:a},successCallback:b,errorCallback:c})},this.authFacebook=function(a,b,c){return console.log("authFacebook",a),this.method({name:"authFacebook",params:a,successCallback:b,errorCallback:c})},this.authSlack=function(a,b,c,d){return this.validate(a,"string","No Slack auth token provided"),this.validate(b,"string","No redirect url provided"),this.method({name:"authSlack",params:{verificationCode:a,redirectUrl:b},successCallback:c,errorCallback:d})},this.addFacebookPage=function(a,b,c,d,e){return this.validate(a,"string","No feedId provided"),this.validate(b,"string","No pageId provided"),this.validate(c,"string","No accessToken provided"),this.method({name:"addFacebookPage",params:{feedId:a,pageId:b,accessToken:c},successCallback:d,errorCallback:e})},this.getInstagramAccounts=function(a,b,c){return this.validate(a,"string","No Facebook User Id provided"),this.method({name:"getInstagramAccounts",params:{userId:a},successCallback:b,errorCallback:c})},this.lookupTwitterId=function(a,b,c){return this.validate(a,"string","No username provided"),this.method({name:"lookupTwitterId",params:a,successCallback:b,errorCallback:c})},this.getSlackTeams=function(a,b){return this.method({name:"getSlackTeams",successCallback:a,errorCallback:b})},this.getSlackChannels=function(a,b,c){return this.validate(a,"string","No teamId provided"),this.method({name:"getSlackChannels",params:a,successCallback:b,errorCallback:c})},this.getFeeds=function(a,b,c){return this.validate(a,"string","No assetid provided."),this.method({name:"getFeeds",params:a,successCallback:b,errorCallback:c})},this.saveFeed=function(a,b,c){return this.validate(a,"object","No asset provided."),this.method({name:"saveFeed",params:a,successCallback:b,errorCallback:c})},this.deleteFeed=function(a,b,c){return this.validate(a,"string","No feedid provided."),this.method({name:"deleteFeed",params:a,successCallback:b,errorCallback:c})},this.openPreapprovalDialog=function(a,b,c,d,e){return this.validate(a,"object","No feed provided."),this.method({name:"openPreapprovalDialog",params:{feed:a,iconUrl:b,options:c},successCallback:d,errorCallback:e})},this.loadAllItems=function(a,b,c){return this.validate(a,"string","No assetId provided."),this.method({name:"loadAllItems",params:a,successCallback:b,errorCallback:c})},this.approveItem=function(a,b,c,d){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.method({name:"approveItem",params:{itemId:a,assetId:b},successCallback:c,errorCallback:d})},this.removeItem=function(a,b,c,d){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.method({name:"removeItem",params:{itemId:a,assetId:b},successCallback:c,errorCallback:d})},this.favoriteItem=function(a,b,c,d,e){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.validate(c,"string","No network provided."),this.method({name:"favoriteItem",params:{itemId:a,assetId:b,network:c},successCallback:d,errorCallback:e})},this.unfavoriteItem=function(a,b,c,d,e){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.validate(c,"string","No network provided."),this.method({name:"unfavoriteItem",params:{itemId:a,assetId:b,network:c},successCallback:d,errorCallback:e})},this.banItem=function(a,b,c,d){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.method({name:"banItem",params:{itemId:a,assetId:b},successCallback:c,errorCallback:d})},this.loadBlacklist=function(a,b,c,d){return this.validate(a,"string","No accountId provided."),this.validate(b,"string","No socialNetwork provided."),this.method({name:"loadBlacklist",params:{accountId:a,socialNetwork:b},successCallback:c,errorCallback:d})},this.unbanUser=function(a,b,c,d,e){return this.validate(a,"string","No username provided."),this.validate(b,"string","No socialNetwork provided."),this.validate(c,"string","No accountId provided."),this.method({name:"unbanUser",params:{username:a,socialNetwork:b,accountId:c},successCallback:d,errorCallback:e})}}c.prototype=Object.create(a.classes.Sender.prototype),a.classes.SocialSender=c,a.social=new c}(window.enplug,document),function(a,b){"use strict";function c(b,c,d){var e=d.send;d.send=function(f){var g=b.defer(),h=f.successCallback||a.noop,i=f.errorCallback||a.noop;return f.successCallback=function(a){c.$apply(function(){g.resolve(a),h(a)})},f.errorCallback=function(a){c.$apply(function(){g.reject(a),i(a)})},e.call(d,f),g.promise}}function d(a){return function(a){return function(d,e){var f=a.charAt(0).toUpperCase()+a.slice(1)+"Sender",g=new b.classes[f];return b[a].cleanup(),b[a]=g,c(d,e,g.transport),g}}(a)}if(a){var e=a.module("enplug.sdk",[]);e.factory("$enplugDashboard",["$q","$rootScope",d("dashboard")]),e.factory("$enplugAccount",["$q","$rootScope",d("account")])}}(window.angular,window.enplug); | ||
!function(a){"use strict";a.enplug={debug:!1,classes:{},noop:function(){}}}(window),function(a){"use strict";function b(b,d){function e(b){a.debug&&(arguments[0]=c+arguments[0],console.log.apply(console,arguments))}function f(b){if(b.successCallback&&"function"!=typeof b.successCallback)throw new Error(c+"Success callback must be a function.");if(b.successCallback=b.successCallback||a.noop,b.errorCallback&&"function"!=typeof b.errorCallback)throw new Error(c+"Error callback must be a function.");b.errorCallback=b.errorCallback||a.noop}function g(a){try{var b=JSON.parse(a.data);return b.namespace===d&&"boolean"==typeof b.success&&b}catch(c){}return!1}this.callId=0,this.pendingCalls={},this.namespace=d,this.send=function(a){if(a.name){a.callId=++this.callId,a.namespace=d,a.transient=!!a.transient,a.persistent=!!a.persistent,f(a),e("Calling method:",a),a.transient||(this.pendingCalls[a.callId]=a);try{var g=JSON.stringify(a);b.parent.postMessage(g,"*")}catch(h){console.error(c+"Error:",h)}return a.callId}throw new Error(c+"All transport method calls must have a name.")},this.handleEvent=function(a){if("message"===a.type){var b=g(a);if(b){var c=this.pendingCalls[b.callId];if(c)return c.persistent||delete this.pendingCalls[b.callId],e("Calling method "+(b.success?"success":"error")+" callback:",{call:c,response:b}),(b.success?c.successCallback:c.errorCallback)(b.data),!0}}return!1},this.cleanup=function(){b.removeEventListener("message",this,!1)},b.addEventListener("message",this,!1)}var c="[Enplug SDK] ";b.prototype.TAG=c,a.classes.Transport=b}(window.enplug),function(a,b){"use strict";function c(c){if(!c)throw new Error(b.classes.Transport.prototype.TAG+"Senders must specify a method prefix.");this.prefix=c,this.novalidate=!1,this.transport=new b.classes.Transport(a,c)}c.prototype={validate:function(a,b,c){if(!(this.novalidate||null!=a&&("array"===b?Array.isArray(a):typeof a===b)))throw new Error(this.transport.TAG+c)},method:function(a){if("object"==typeof a)return a.name=this.prefix+"."+a.name,this.transport.send(a);throw new Error("Transport options must be an object.")},cleanup:function(){this.transport.cleanup()}},b.classes.Sender=c}(window,window.enplug),function(a){"use strict";function b(){a.classes.Sender.call(this,"app"),this.getAccount=function(a,b){return this.method({name:"getAccount",successCallback:a,errorCallback:b})},this.getUser=function(a,b){return this.method({name:"getUser",successCallback:a,errorCallback:b})},this.getDisplayGroups=function(a,b){return this.method({name:"getDisplays",successCallback:a,errorCallback:b})},this.getSelectedDisplayId=function(a,b){return this.method({name:"getSelectedDisplayId",successCallback:a,errorCallback:b})},this.getAssets=function(a,b){return this.method({name:"getAssets",successCallback:a,errorCallback:b})},this.getAssetsForApp=function(a,b,c){return this.method({name:"getAssetsForApp",appId:a,successCallback:b,errorCallback:c})},this.bulkCreateAssets=function(a,b,c,d){var e={assets:a,dialogOptions:b||{}};return this.validate(e.assets,"array","You must provide an array of assets (object) when creating new assets."),this.validate(e.assets[0],"object","You must provide an array of assets (object) when creating new assets."),e.assets[0]&&this.validate(e.assets[0].Value,"object","You must provide a Value (object) when creating an asset."),this.method({name:"bulkCreateAssets",params:e,successCallback:c,errorCallback:d})},this.bulkDeployAssets=function(a,b,c,d){var e={assets:a,dialogOptions:b||{}};return this.validate(e.assets,"array","You must provide an array of assets (object) when deploying assets."),this.validate(e.assets[0],"object","You must provide an array of assets (object) when deploying assets."),e.assets[0]&&(this.validate(e.assets[0].Value,"object","You must provide a Value (object) when deploying an asset."),this.validate(e.assets[0].Id,"string","You must provide the ID (string) on the asset you want to update.")),this.method({name:"bulkDeployAssets",params:e,successCallback:c,errorCallback:d})},this.saveAsset=function(a,b,c,d){this.validate(a,"object","You must provide an asset object to save.");var e={asset:a,dialogOptions:b||{}};return this.method({name:"saveAsset",params:e,successCallback:c,errorCallback:d})},this.updateAssetOrder=function(a,b,c){return this.validate(a,"array","You must provide an array of assets (or asset ids) in the new order."),this.method({name:"updateAssetOrder",params:{assets:a},successCallback:b,errorCallback:c})},this.deleteAsset=function(a,b,c){return Array.isArray(a)?(this.validate(a,"array","You must pass a single ID (string) or Array of asset IDs to be deleted."),this.validate(a[0],"string","You must provide at least one Asset ID (string) to be deleted.")):(this.validate(a,"string","You must provide the ID (string) of the asset to delete."),a=[a]),this.method({name:"deleteAsset",params:{ids:a},successCallback:b,errorCallback:c})},this.getDefaultAssets=function(a,b,c,d){return this.method({name:"getDefaultAssets",params:{level:a,levelId:b},successCallback:c,errorCallback:d})},this.getThemes=function(a,b,c){return this.method({name:"getThemes",params:{appId:a},successCallback:b,errorCallback:c})},this.getTheme=function(a,b,c){return this.method({name:"getTheme",params:{id:a},successCallback:b,errorCallback:c})},this.editTheme=function(a,b,c,d,e,f,g,h,i){return this.validate(a,"object","You must provide the theme definition (object)."),this.method({name:"editTheme",params:{themeDefinition:a,theme:b,previewUrl:c,previewAsset:d,layout:e,fonts:f,feedData:g},successCallback:h,errorCallback:i})},this.saveTheme=function(a,b,c){return this.validate(a,"object","You must provide the theme (object) to save."),this.validate(a.Value,"object","You must provide the theme.Value (object) to save."),this.method({name:"saveTheme",params:{theme:a},successCallback:b,errorCallback:c})},this.deleteTheme=function(a,b,c){return this.validate(a,"string","You must provide the ID (string) of the theme to remove."),this.method({name:"deleteTheme",params:{themeId:a},successCallback:b,errorCallback:c})},this.hasFeatureFlag=function(a,b,c){return this.validate(a,"string","You must provide the flag name (string)."),this.method({name:"hasFeatureFlag",params:{flagName:a},successCallback:b,errorCallback:c})},this.getDisplay=this.getDisplayGroups,this.getDisplays=this.getDisplayGroups,this.getDisplayGroup=this.getDisplayGroups}b.prototype=Object.create(a.classes.Sender.prototype),a.classes.AccountSender=b,a.account=new b}(window.enplug),function(a,b){"use strict";function c(){function c(){return g.click(),!0}a.classes.Sender.call(this,"dashboard");var d=[],e=function(){},f=!0;this.setHeaderTitle=function(a,b,c){return this.validate(a,"string","Header title must be a string."),this.method({name:"set.title",params:a,successCallback:b,errorCallback:c})},this.setDisplaySelectorCallback=function(a,b){return this.validate(a,"function","To enable the display selector in the page title you must supply a callback function."),e=a,this.method({name:"set.selectorCallback",params:a,persistent:!0,successCallback:function(a){return"function"==typeof e&&void 0!==a&&e(a),a},errorCallback:b})},this.setDisplaySelectorVisibility=function(a,b,c){return this.validate(a,"boolean","Setting the display selector visibility requires a boolean argument, true to show or false to hide."),this.method({name:"set.selectorEnabled",params:a,successCallback:b,errorCallback:c})},this.switchToView=function(a,b,c,d){var e={displayGroupId:a,displayGroupName:b};return this.method({name:"switchToView",params:e,successCallback:c,errorCallback:d})},this.setHeaderButtons=function(a,b,c){this.validate(a,"object","Header buttons must be an object (single) or array (multiple)."),d=[],a=Array.isArray(a)?a:[a];for(var e=0;e<a.length;e++){var f=a[e];this.validate(f,"object","Header buttons must be objects."),f&&(this.validate(f.action,"function","Header buttons must have an action (function)."),f.id="button-"+Math.round(9999*Math.random()+1),d[f.id]=f)}return this.method({name:"set.buttons",params:a,persistent:!0,successCallback:function(a){if(a){var c=d[a.id];c?c.action():console.warn("Unrecognized button click:",a)}"function"==typeof b&&b(a)},errorCallback:c})},this.pageLoading=function(a,b,c){return this.validate(a,"boolean","Page loading status must be a boolean."),this.method({name:"page.loading",params:a,successCallback:function(){f=a,"function"==typeof b&&b(f)},errorCallback:c})},this.isLoading=function(){return f},this.pageError=function(a,b){return this.method({name:"page.error",successCallback:a,errorCallback:b})},this.pageNotFound=function(a,b){return this.method({name:"page.notFound",successCallback:a,errorCallback:b})},this.loadingIndicator=function(a,b,c){return this.validate(a,"string","Loading indicator requires a loading message (string)"),this.method({name:"indicator.loading",params:a,successCallback:b,errorCallback:c})},this.successIndicator=function(a,b,c){return this.validate(a,"string","Success indicator requires a success message (string)"),this.method({name:"indicator.success",params:a,successCallback:b,errorCallback:c})},this.errorIndicator=function(a,b,c){return this.validate(a,"string","Error indicator requires an error message (string)"),this.method({name:"indicator.error",params:a,successCallback:b,errorCallback:c})},this.openConfirm=function(a,b,c){return this.validate(a,"object","Confirm box requires options to be set (object)."),a&&(this.validate(a.title,"string","Confirm box requires options.title to be set (string)."),this.validate(a.text,"string","Confirm box requires options.text to be set (string).")),this.method({name:"confirm",params:a,successCallback:b,errorCallback:c})},this.confirmUnsavedChanges=function(a,b){return this.method({name:"unsavedChanges",successCallback:a,errorCallback:b})},this.navigate=function(a,b,c){return this.method({name:"navigate",params:{data:a},successCallback:b,errorCallback:c})},this.navigateBack=function(a,b,c){return this.method({name:"navigateBack",params:{assetId:a},successCallback:b,errorCallback:c})},this.preview=function(a,b,c,d,e,f,g){return this.method({name:"preview",params:{url:a,asset:b,theme:c,layout:d,feedData:e},successCallback:f,errorCallback:g})},this.upload=function(a,b,c){return this.method({name:"upload",params:a,successCallback:b,errorCallback:c})},this.processAssetResource=function(a,b,c,d,e){return this.validate(a,"string","You must provide the accountId (string)."),this.validate(b,"string","You must provide the appId (string)."),this.validate(c,"array","You must provide the assets (array)."),this.method({name:"processAssetResource",params:{accountId:a,appId:b,assets:c},successCallback:d,errorCallback:e})},this.encodeStatus=function(a,b,c){return this.validate(a,"string","You must provide the url (string)."),this.method({name:"encodeStatus",params:a,successCallback:b,errorCallback:c})},this.cleanup=function(){b.removeEventListener("click",c,!1),a.classes.Sender.prototype.cleanup.call(this)},this.click=function(){return this.method({name:"click",transient:!0})},this.openContentIntervalSettingsDialog=function(a,b,c,d,e){return this.validate(a,"string","You must provide the appName (string)."),this.validate(b,"string","You must provide the level (string)."),this.validate(c,"string","You must provide the levelId (string)."),this.method({name:"openContentIntervalSettingsDialog",params:{appName:a,level:b,levelId:c},successCallback:d,errorCallback:e})},this.setAppHasUnsavedChanges=function(a,b){return this.validate(a,"boolean","To report changes to the dashboard you must supply a value."),this.method({name:"appHasUnsavedChanges",params:{hasUnsavedChanges:a},errorCallback:b})};var g=this;b.addEventListener("click",c,!1)}c.prototype=Object.create(a.classes.Sender.prototype),a.classes.DashboardSender=c,a.dashboard=new c}(window.enplug,document),function(a,b){"use strict";function c(){a.classes.Sender.call(this,"social"),this.clearQueryString=function(){return this.method({name:"clearQueryString"})},this.authInstagram=function(a,b,c){return this.validate(a,"string","No authCode provided."),this.method({name:"authInstagram",params:{accessToken:a},successCallback:b,errorCallback:c})},this.authSlack=function(a,b,c,d){return this.validate(a,"string","No Slack auth token provided"),this.validate(b,"string","No redirect url provided"),this.method({name:"authSlack",params:{verificationCode:a,redirectUrl:b},successCallback:c,errorCallback:d})},this.addFacebookPage=function(a,b,c,d,e){return this.validate(a,"string","No feedId provided"),this.validate(b,"string","No pageId provided"),this.validate(c,"string","No accessToken provided"),this.method({name:"addFacebookPage",params:{feedId:a,pageId:b,accessToken:c},successCallback:d,errorCallback:e})},this.getInstagramAccounts=function(a,b,c){return this.validate(a,"string","No Facebook User Id provided"),this.method({name:"getInstagramAccounts",params:{userId:a},successCallback:b,errorCallback:c})},this.lookupTwitterId=function(a,b,c){return this.validate(a,"string","No username provided"),this.method({name:"lookupTwitterId",params:a,successCallback:b,errorCallback:c})},this.getSlackTeams=function(a,b){return this.method({name:"getSlackTeams",successCallback:a,errorCallback:b})},this.getSlackChannels=function(a,b,c){return this.validate(a,"string","No teamId provided"),this.method({name:"getSlackChannels",params:a,successCallback:b,errorCallback:c})},this.getFeeds=function(a,b,c){return this.validate(a,"string","No assetid provided."),this.method({name:"getFeeds",params:a,successCallback:b,errorCallback:c})},this.saveFeed=function(a,b,c){return this.validate(a,"object","No asset provided."),this.method({name:"saveFeed",params:a,successCallback:b,errorCallback:c})},this.deleteFeed=function(a,b,c){return this.validate(a,"string","No feedid provided."),this.method({name:"deleteFeed",params:a,successCallback:b,errorCallback:c})},this.openPreapprovalDialog=function(a,b,c,d,e){return this.validate(a,"object","No feed provided."),this.method({name:"openPreapprovalDialog",params:{feed:a,iconUrl:b,options:c},successCallback:d,errorCallback:e})},this.loadAllItems=function(a,b,c){return this.validate(a,"string","No assetId provided."),this.method({name:"loadAllItems",params:a,successCallback:b,errorCallback:c})},this.approveItem=function(a,b,c,d){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.method({name:"approveItem",params:{itemId:a,assetId:b},successCallback:c,errorCallback:d})},this.removeItem=function(a,b,c,d){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.method({name:"removeItem",params:{itemId:a,assetId:b},successCallback:c,errorCallback:d})},this.favoriteItem=function(a,b,c,d,e){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.validate(c,"string","No network provided."),this.method({name:"favoriteItem",params:{itemId:a,assetId:b,network:c},successCallback:d,errorCallback:e})},this.unfavoriteItem=function(a,b,c,d,e){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.validate(c,"string","No network provided."),this.method({name:"unfavoriteItem",params:{itemId:a,assetId:b,network:c},successCallback:d,errorCallback:e})},this.banItem=function(a,b,c,d){return this.validate(a,"string","No itemId provided."),this.validate(b,"string","No assetId provided."),this.method({name:"banItem",params:{itemId:a,assetId:b},successCallback:c,errorCallback:d})},this.loadBlacklist=function(a,b,c,d){return this.validate(a,"string","No accountId provided."),this.validate(b,"string","No socialNetwork provided."),this.method({name:"loadBlacklist",params:{accountId:a,socialNetwork:b},successCallback:c,errorCallback:d})},this.unbanUser=function(a,b,c,d,e){return this.validate(a,"string","No username provided."),this.validate(b,"string","No socialNetwork provided."),this.validate(c,"string","No accountId provided."),this.method({name:"unbanUser",params:{username:a,socialNetwork:b,accountId:c},successCallback:d,errorCallback:e})}}c.prototype=Object.create(a.classes.Sender.prototype),a.classes.SocialSender=c,a.social=new c}(window.enplug,document),function(a,b){"use strict";function c(b,c,d){var e=d.send;d.send=function(f){var g=b.defer(),h=f.successCallback||a.noop,i=f.errorCallback||a.noop;return f.successCallback=function(a){c.$apply(function(){g.resolve(a),h(a)})},f.errorCallback=function(a){c.$apply(function(){g.reject(a),i(a)})},e.call(d,f),g.promise}}function d(a){return function(a){return function(d,e){var f=a.charAt(0).toUpperCase()+a.slice(1)+"Sender",g=new b.classes[f];return b[a].cleanup(),b[a]=g,c(d,e,g.transport),g}}(a)}if(a){var e=a.module("enplug.sdk",[]);e.factory("$enplugDashboard",["$q","$rootScope",d("dashboard")]),e.factory("$enplugAccount",["$q","$rootScope",d("account")])}}(window.angular,window.enplug); |
@@ -538,4 +538,2 @@ /* - DASHBOARD types - */ | ||
clearQueryString: () => CallId, | ||
authenticate: (authCode: string, redirectUri: string, onSuccess?: Function, onError?: Function) => CallId; | ||
authFacebook: (params: FacebookAuthParams, onSuccess?: Function, onError?: Function) => CallId; | ||
authInstagram: (accessToken: string, onSuccess?: Function, onError?: Function) => CallId; | ||
@@ -542,0 +540,0 @@ authSlack: (authCode: string, redirectUrl: string, onSuccess?: Function, onError?: Function) => CallId; |
{ | ||
"name": "@enplug/dashboard-sdk", | ||
"version": "4.7.17", | ||
"version": "4.7.19", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -0,0 +0,0 @@ # Enplug Dashboard SDK |
@@ -266,2 +266,4 @@ (function (enplug) { | ||
* | ||
* @param {string} [level] 'Default', 'Network', 'Account' | ||
* @param {string} [levelId] NetworkId or AccountId | ||
* @param {function} onSuccess | ||
@@ -271,5 +273,9 @@ * @param {function} [onError] | ||
*/ | ||
this.getDefaultAssets = function (onSuccess, onError) { | ||
return this.method({ | ||
this.getDefaultAssets = function (level, levelId, onSuccess, onError) { | ||
return this.method({ | ||
name: 'getDefaultAssets', | ||
params: { | ||
level: level, | ||
levelId: levelId | ||
}, | ||
successCallback: onSuccess, | ||
@@ -276,0 +282,0 @@ errorCallback: onError, |
@@ -0,0 +0,0 @@ (function (angular, enplug) { |
@@ -0,0 +0,0 @@ (function (window) { |
@@ -0,0 +0,0 @@ (function (window, enplug) { |
@@ -21,15 +21,2 @@ ;(function (enplug, document) { | ||
// Old Instagram auth method. TODO(arek): remove when it's safe to do so. | ||
this.authenticate = function (authCode, redirectUri, onSuccess, onError) { | ||
this.validate(authCode, 'string', 'No authCode provided.'); | ||
this.validate(redirectUri, 'string', 'No redirectUri provided.'); | ||
return this.method({ | ||
name: 'authenticate', | ||
params: {authCode: authCode, redirectUri: redirectUri}, | ||
successCallback: onSuccess, | ||
errorCallback: onError | ||
}); | ||
}; | ||
// Current Instagram auth method. | ||
this.authInstagram = function(token, onSuccess, onError) { | ||
@@ -45,12 +32,2 @@ this.validate(token, 'string', 'No authCode provided.'); | ||
this.authFacebook = function (params, onSuccess, onError) { | ||
console.log('authFacebook', params); | ||
return this.method({ | ||
name: 'authFacebook', | ||
params: params, | ||
successCallback: onSuccess, | ||
errorCallback: onError | ||
}); | ||
}; | ||
this.authSlack = function(authToken, redirectUrl, onSuccess, onError) { | ||
@@ -57,0 +34,0 @@ this.validate(authToken, 'string', 'No Slack auth token provided'); |
@@ -0,0 +0,0 @@ (function (enplug) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
323112
3406