@widgetic/editor 3.10.37 → 3.10.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/control.js CHANGED
@@ -1 +1 @@
1
- !function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var i={};e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=175)}({175:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(176);window.EmbedController=n.a},176:function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=i(177),r=i(178),s=i.n(r),d=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),a=void 0,c=void 0,u=void 0,l=void 0,h=function(t){(window.opener||window.parent).postMessage(JSON.stringify(t),"*")},p={load:function(){return h({t:"u",d:window.name})},apiReady:function(){return h({t:"d",d:window.name})},notify:function(t,e){return h({t:"ce",id:window.name,d:e,e:t.type||t})},replyPublicApiCall:function(t,e,i){return h({t:"pr",id:t,err:e,d:i})}},f=function(t,e){return{id:"c-0",widget_id:t.id,width:t.width,height:t.height,skin_id:t.skins[0].id,content:e?t.content[0].content.map(function(t,e){return t.id=e,t.composition_id="c-0",t._isDemoContent=!0,t}):[],metadata:{client:(window.location.search.match(/client_id=([^\&$]+)/)||[])[1]}}},w=function(){function t(e,i){var o=i.loader,r=i.widget,s=i.user,d=i.composition,a=i.skin,c=i.js,u=i.css,l=i.data,h=i.demo,p=void 0===h||h,f=i.bootstrapped,w=void 0!==f&&f;if(n(this,t),this.el=e,this.loader=o,this.bootstrapped=w,!r&&!l)throw new Error("You must supply either `widget` or `data`");this.widget=r,this.dataURL=l,this.user=s,this.composition=d,this.skin=a,this.loadDemo=p,this.js="https://widgetic.com"+c,this.css="https://widgetic.com"+u,this.dataLoaded=Widgetic.Aye.defer(),this.dataLoaded.promise.then(this._showBranding.bind(this)),this._init(),this._initEditorApi()}return d(t,[{key:"_init",value:function(){var t=this,e=function(){};this.bootstrapped?(this._loadModels(),this._loadData(),this._loadWidget()):s.a("https://files.widgetic.com/file/widgetic-uploads/assets/js/core-js.shim.min.js","https://widgetic.com/bundles/blogvioapp/js/editor/core.vendor.js","https://widgetic.com/bundles/blogvioapp/js/require.js","https://widgetic.com/bundles/blogvioapp/css/embed.css",this.css,e,"https://widgetic.com/bundles/blogvioapp/js/spine.js",e,"https://widgetic.com/bundles/blogvioapp/js/editor/core.js",this._loadModels.bind(this),this._loadData.bind(this),this.js,function(){return t.dataLoaded.promise.then(t._loadWidget.bind(t)).fail(function(t){return console.error(t)})})}},{key:"_loadModels",value:function(){a=window.require("core/models/widget"),c=window.require("core/models/composition"),u=window.require("core/models/content"),l=window.require("core/models/skin")}},{key:"_loadData",value:function(){var t=this;if(!this.dataURL)return this._hydrateModels();Widgetic.uxhr(this.dataURL,null,{success:function(e){var i=void 0;try{i=JSON.parse(e)}catch(t){return console.error("Could not parse response",e)}t.skin=i.skin,t.composition=i.composition,t.widget=i.widget,t.user=i.user,t._hydrateModels()},error:function(t){return console.error("The widget data could not be loaded",t)}})}},{key:"_hydrateModels",value:function(){this.composition=this.composition||f(this.widget,this.loadDemo),a.refresh(this.widget),c.refresh(this.composition),l.refresh(this.skin||this.widget.skins),this._skin=l.first(),u.refresh(this.composition.content),this.dataLoaded.resolve(),this._initApi()}},{key:"_initApi",value:function(){var t=new o.a;Widgetic.Event.on(window,"message",t.receiver),t.skinSet.listen(this._onSkinSet.bind(this)),t.contentCleared.listen(this._onContentCleared.bind(this)),t.contentAdded.listen(this._onContentAdded.bind(this)),t.publicApiCalled.listen(this._onPublicApiCalled.bind(this)),p.apiReady()}},{key:"_initEditorApi",value:function(){var t=this;window.getPreview=function(){return{widget:function(){return t.widgetController},window:window}},window.getData=function(){return{widget:t.widget,composition:$.extend({},t.composition,{widget_id:t.widget.id,width:(t.composition||t.widget).width,height:(t.composition||t.widget).height,content:t.composition.content,skin_id:t.composition.skin_id}),skin:t.skin||t.widget.skins[0],user:t.user}},window.getCurrentData=function(){return{widget:t.widgetController}};var e=(window.location.search.match(/access_token=([^\&$]+)/)||[])[1];e&&Widgetic.auth.token(e)}},{key:"_loadWidget",value:function(){var t=this,e=Widgetic.parse(window.location.href),i=void 0!==e.queryKey.edit_mode?Widgetic.UI.Composition.EDIT_MODE:Widgetic.UI.Composition.EMBED_MODE,n={mode:i,embedOptions:{resize:e.queryKey.resize,autoscale:e.queryKey.autoscale,adaptive:e.queryKey.adaptive},widget:this.widget,composition:{id:this.composition.id},referrer:document.referrer},o=window.require(this.widget.module);this.widgetController=new o({metadata:n},this._skin,u.all()),this.loader&&this.loader.parentNode.removeChild(this.loader);var r=$('<div class="widget-container" style="width:1px; min-width: 100%; height: 100%">');$(this.el).append(r),r.append(this.widgetController.el),this.widgetController.added(),this.widgetController.getPublicEvents&&this.widgetController.getPublicEvents().forEach(function(e){t.widgetController.on(e,function(t){return p.notify(e,t)})}),p.load()}},{key:"_showBranding",value:function(){!(!this.user||!this.user.premium)&&this.user.premium||window.location.search.indexOf("branding")>=0&&window.initBranding()}},{key:"_onSkinSet",value:function(t){this._skin=t,this.widgetController&&this.widgetController.setSkin(this._skin)}},{key:"_onContentCleared",value:function(){this.widgetController&&this.widgetController.clearContent()}},{key:"_onContentAdded",value:function(t){this.widgetController&&this.widgetController.addContent(t)}},{key:"_onPublicApiCalled",value:function(t){if(!this.widgetController)throw new Error("The widget is not ready yet.");if(!this.widgetController.getPublicMethods)throw new Error("The widget does not support public api calls.");var e=this.widgetController.getPublicMethods(),i=this.widgetController.widget;if(-1===e.indexOf(t.method)||!(t.method in i))throw new Error("The widget does not support method `"+t.method+"`.");try{var n=i[t.method].apply(i,t.args);p.replyPublicApiCall(t.id,null,n)}catch(e){p.replyPublicApiCall(t.id,{message:e.message,stack:e.stack})}}}]),t}();e.a=w},177:function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=i(56),r=i.n(o),s=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),d=void 0,a=void 0,c=void 0,u=function(){function t(){n(this,t),d=window.require("core/models/skin"),c=window.require("core/models/content"),a=window.require("core/models/composition"),this.eventMap={cx:"clearContent",sc:"setContent",ac:"addContent",cc:"changeContent",rc:"removeContent",ss:"setSkin",cs:"changeSkin",asht:"addSheet",acss:"addCss",pa:"publicApi"},this.receiver=this.receiver.bind(this),this.skin=d.first(),this.composition=a.first(),this.skinSet=new r.a,this.contentCleared=new r.a,this.contentAdded=new r.a,this.publicApiCalled=new r.a}return s(t,[{key:"receiver",value:function(t){var e=void 0;try{e=JSON.parse(t.data)}catch(t){return console.warn(t)}var i=this.eventMap[e.t];if(i&&this[i])try{this[i](e.d)}catch(t){console.error(t)}}},{key:"setSkin",value:function(t){this.skin.unbind(),this.skin=new d(t),this.composition.updateAttribute("skin_id",this.skin.id,{ajax:!1}),this.skinSet.broadcast(this.skin)}},{key:"changeSkin",value:function(t){this.skin.updateAttributes(t,{attribute:Object.keys(t)[0],ajax:!1})}},{key:"clearDemoContent",value:function(){return c.select(function(t){return t._isDemoContent}).forEach(function(t){try{t.destroy()}catch(t){}})}},{key:"clearContent",value:function(){c.destroyAll(),this.composition.updateAttribute("content",[],{ajax:!1}),this.contentCleared.broadcast()}},{key:"getContent",value:function(){return this.composition.getContent()}},{key:"setContent",value:function(t){this.clearContent(),t.map(this.addContent.bind(this))}},{key:"addContent",value:function(t){this.clearDemoContent();try{return c.find(t.id),console.warn("Content with id "+t.id+" already exists, use changeContent if you want to update it!")}catch(t){}null==t.id&&(t.id=Widgetic.GUID()),t.composition_id||(t.composition_id=this.composition.id);var e=new c(t);e.save(),this.contentAdded.broadcast(e)}},{key:"changeContent",value:function(t){var e=t.item?t.item:t,i=t.attribute;if(null==e.id)return console.error("Content must have an id:",t);var n=void 0;try{n=c.find(e.id)}catch(t){return console.warn("Content with id "+e.id+" doesn't exists, use addContent if you want to add it!")}n.updateAttributes(e,{attribute:i,ajax:!1})}},{key:"removeContent",value:function(t){try{return c.find(t.id).destroy()}catch(e){return console.error("Content "+t.id+" couldn't be removed!",e.stack)}}},{key:"addSheet",value:function(t){var e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}},{key:"addCss",value:function(t){this._customCssNode||(this._customCssNode=document.createElement("style"),document.head.appendChild(this._customCssNode)),this._customCssNode.textContent+=t}},{key:"publicApi",value:function(t){this.publicApiCalled.broadcast(t)}}]),t}();e.a=u},178:function(t,e,i){var n,o;!function(i,r){n=[],void 0!==(o=function(){return i.toast=r()}.apply(e,n))&&(t.exports=o)}(this,function(){function t(){var t=document.getElementsByTagName("head")[0],i=function(e){if(t){if(e.length){for(var r,s,d=-1;r=e[++d];)if("string"==typeof r)n(r);else if("function"==typeof r){s=r;break}o(s,Array.prototype.slice.call(e,d+1))}}else setTimeout(function(){i(e)},50)},n=function(i){var n,o,s=/\.(\w+)$/.exec(i),d=/^\[(\w+)\](.+)/.exec(i);if(null!==d)n=d[1],i=d[2];else{if(null===s)return;n=s[1]}if(!(i in e))switch(e[i]=!1,n){case"js":o=document.createElement("script"),o.src=i,o.async=!1,t.appendChild(o);var a=navigator.appVersion.match(/MSIE (\d)/);null!==a&&parseInt(a[1],10)<9?o.onreadystatechange=function(){/ded|co/.test(this.readyState)&&(e[i]=!0,o.onreadystatechange=null)}:o.onload=function(){e[i]=!0,o.onload=null};break;case"css":o=document.createElement("link"),o.rel="styleSheet",o.href=i,t.appendChild(o),r(o,i);break;default:return void delete e[i]}},o=function(t,n){for(var r in e)if(!e[r])return void setTimeout(function(){o(t,n)},50);"function"==typeof t&&t(),i(n)},r=function(t,i){t.sheet||t.styleSheet?e[i]=!0:setTimeout(function(){r(t,i)},50)};i(arguments)}var e={};return t})},56:function(t,e){function i(){function t(t){for(var e=i.slice(),n=0;n<e.length;n++)e[n].deleted||e[n].fn(t)}function e(t){function e(){for(var e=0;e<i.length;e++)if(i[e].fn===t){i[e].deleted=!0,i.splice(e,1);break}}return i.push(new n(t)),e}var i=[];return{broadcast:t,listen:e}}function n(t){this.fn=t,this.deleted=!1}t.exports=i}});
1
+ !function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var i={};e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=175)}({175:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(176);window.EmbedController=n.a},176:function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=i(177),r=i(178),s=i.n(r),d=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),a=void 0,c=void 0,u=void 0,l=void 0,h=function(t){(window.opener||window.parent).postMessage(JSON.stringify(t),"*")},f={load:function(){return h({t:"u",d:window.name})},apiReady:function(){return h({t:"d",d:window.name})},notify:function(t,e){return h({t:"ce",id:window.name,d:e,e:t.type||t})},replyPublicApiCall:function(t,e,i){return h({t:"pr",id:t,err:e,d:i})}},p=function(t,e){return{id:"c-0",widget_id:t.id,width:t.width,height:t.height,skin_id:t.skins[0].id,content:e?t.content[0].content.map(function(t,e){return t.id=e,t.composition_id="c-0",t._isDemoContent=!0,t}):[],metadata:{client:(window.location.search.match(/client_id=([^\&$]+)/)||[])[1]}}},w=function(){function t(e,i){var o=i.loader,r=i.widget,s=i.user,d=i.composition,a=i.skin,c=i.js,u=i.css,l=i.data,h=i.demo,f=void 0===h||h,p=i.bootstrapped,w=void 0!==p&&p;if(n(this,t),this.el=e,this.loader=o,this.bootstrapped=w,!r&&!l)throw new Error("You must supply either `widget` or `data`");this.widget=r,this.dataURL=l,this.user=s,this.composition=d,this.skin=a,this.loadDemo=f,this.js="https://widgetic.com"+c,this.css="https://widgetic.com"+u,this.dataLoaded=Widgetic.Aye.defer(),this.dataLoaded.promise.then(this._showBranding.bind(this)),this._init(),this._initEditorApi()}return d(t,[{key:"_init",value:function(){var t=this,e=function(){};this.bootstrapped?(this._loadModels(),this._loadData(),this._loadWidget()):s.a("https://files.widgetic.com/file/widgetic-uploads/assets/js/core-js.shim.min.js","https://widgetic.com/bundles/blogvioapp/js/editor/core.vendor.js","https://widgetic.com/bundles/blogvioapp/js/require.js","https://widgetic.com/bundles/blogvioapp/css/embed.css",this.css,e,"https://widgetic.com/bundles/blogvioapp/js/spine.js",e,"https://widgetic.com/bundles/blogvioapp/js/editor/core.js",this._loadModels.bind(this),this._loadData.bind(this),this.js,function(){return t.dataLoaded.promise.then(t._loadWidget.bind(t)).fail(function(t){return console.error(t)})})}},{key:"_loadModels",value:function(){a=window.require("core/models/widget"),c=window.require("core/models/composition"),u=window.require("core/models/content"),l=window.require("core/models/skin")}},{key:"_loadData",value:function(){var t=this;if(!this.dataURL)return this._hydrateModels();Widgetic.uxhr(this.dataURL,null,{success:function(e){var i=void 0;try{i=JSON.parse(e)}catch(t){return console.error("Could not parse response",e)}t.skin=i.skin,t.composition=i.composition,t.widget=i.widget,t.user=i.user,t._hydrateModels()},error:function(t){return console.error("The widget data could not be loaded",t)}})}},{key:"_hydrateModels",value:function(){this.composition=this.composition||p(this.widget,this.loadDemo),a.refresh(this.widget),c.refresh(this.composition),l.refresh(this.skin||this.widget.skins),this._skin=l.first(),u.refresh(this.composition.content),this.dataLoaded.resolve(),this._initApi()}},{key:"_initApi",value:function(){var t=new o.a;Widgetic.Event.on(window,"message",t.receiver),t.skinSet.listen(this._onSkinSet.bind(this)),t.contentCleared.listen(this._onContentCleared.bind(this)),t.contentAdded.listen(this._onContentAdded.bind(this)),t.publicApiCalled.listen(this._onPublicApiCalled.bind(this)),f.apiReady()}},{key:"_initEditorApi",value:function(){var t=this;window.getPreview=function(){return{widget:function(){return t.widgetController},window:window}},window.getData=function(){return{widget:t.widget,composition:$.extend({},t.composition,{widget_id:t.widget.id,width:(t.composition||t.widget).width,height:(t.composition||t.widget).height,content:t.composition.content,skin_id:t.composition.skin_id}),skin:t.skin||t.widget.skins[0],user:t.user}},window.getCurrentData=function(){return{widget:t.widgetController}};var e=(window.location.search.match(/access_token=([^\&$]+)/)||[])[1];e&&Widgetic.auth.token(e)}},{key:"_loadWidget",value:function(){var t=this,e=Widgetic.parse(window.location.href),i=void 0!==e.queryKey.edit_mode?Widgetic.UI.Composition.EDIT_MODE:Widgetic.UI.Composition.EMBED_MODE,n={mode:i,embedOptions:{resize:e.queryKey.resize,autoscale:e.queryKey.autoscale,adaptive:e.queryKey.adaptive},widget:this.widget,composition:{id:this.composition.id},referrer:document.referrer},o=window.require(this.widget.module);this.widgetController=new o({metadata:n},this._skin,u.all()),this.loader&&this.loader.parentNode.removeChild(this.loader);var r=$('<div class="widget-container" style="width:1px; min-width: 100%; height: 100%">');$(this.el).append(r),r.append(this.widgetController.el),this.widgetController.added(),this.widgetController.getPublicEvents&&this.widgetController.getPublicEvents().forEach(function(e){t.widgetController.on(e,function(t){return f.notify(e,t)})}),f.load()}},{key:"_showBranding",value:function(){var t=new URLSearchParams(window.location.search).get("branding");t||(t="off"),!(!this.user||!this.user.premium)&&this.user.premium||(t="on"),"off"!=t&&window.initBranding()}},{key:"_onSkinSet",value:function(t){this._skin=t,this.widgetController&&this.widgetController.setSkin(this._skin)}},{key:"_onContentCleared",value:function(){this.widgetController&&this.widgetController.clearContent()}},{key:"_onContentAdded",value:function(t){this.widgetController&&this.widgetController.addContent(t)}},{key:"_onPublicApiCalled",value:function(t){if(!this.widgetController)throw new Error("The widget is not ready yet.");if(!this.widgetController.getPublicMethods)throw new Error("The widget does not support public api calls.");var e=this.widgetController.getPublicMethods(),i=this.widgetController.widget;if(-1===e.indexOf(t.method)||!(t.method in i))throw new Error("The widget does not support method `"+t.method+"`.");try{var n=i[t.method].apply(i,t.args);f.replyPublicApiCall(t.id,null,n)}catch(e){f.replyPublicApiCall(t.id,{message:e.message,stack:e.stack})}}}]),t}();e.a=w},177:function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=i(56),r=i.n(o),s=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),d=void 0,a=void 0,c=void 0,u=function(){function t(){n(this,t),d=window.require("core/models/skin"),c=window.require("core/models/content"),a=window.require("core/models/composition"),this.eventMap={cx:"clearContent",sc:"setContent",ac:"addContent",cc:"changeContent",rc:"removeContent",ss:"setSkin",cs:"changeSkin",asht:"addSheet",acss:"addCss",pa:"publicApi"},this.receiver=this.receiver.bind(this),this.skin=d.first(),this.composition=a.first(),this.skinSet=new r.a,this.contentCleared=new r.a,this.contentAdded=new r.a,this.publicApiCalled=new r.a}return s(t,[{key:"receiver",value:function(t){var e=void 0;try{e=JSON.parse(t.data)}catch(t){return console.warn(t)}var i=this.eventMap[e.t];if(i&&this[i])try{this[i](e.d)}catch(t){console.error(t)}}},{key:"setSkin",value:function(t){this.skin.unbind(),this.skin=new d(t),this.composition.updateAttribute("skin_id",this.skin.id,{ajax:!1}),this.skinSet.broadcast(this.skin)}},{key:"changeSkin",value:function(t){this.skin.updateAttributes(t,{attribute:Object.keys(t)[0],ajax:!1})}},{key:"clearDemoContent",value:function(){return c.select(function(t){return t._isDemoContent}).forEach(function(t){try{t.destroy()}catch(t){}})}},{key:"clearContent",value:function(){c.destroyAll(),this.composition.updateAttribute("content",[],{ajax:!1}),this.contentCleared.broadcast()}},{key:"getContent",value:function(){return this.composition.getContent()}},{key:"setContent",value:function(t){this.clearContent(),t.map(this.addContent.bind(this))}},{key:"addContent",value:function(t){this.clearDemoContent();try{return c.find(t.id),console.warn("Content with id "+t.id+" already exists, use changeContent if you want to update it!")}catch(t){}null==t.id&&(t.id=Widgetic.GUID()),t.composition_id||(t.composition_id=this.composition.id);var e=new c(t);e.save(),this.contentAdded.broadcast(e)}},{key:"changeContent",value:function(t){var e=t.item?t.item:t,i=t.attribute;if(null==e.id)return console.error("Content must have an id:",t);var n=void 0;try{n=c.find(e.id)}catch(t){return console.warn("Content with id "+e.id+" doesn't exists, use addContent if you want to add it!")}n.updateAttributes(e,{attribute:i,ajax:!1})}},{key:"removeContent",value:function(t){try{return c.find(t.id).destroy()}catch(e){return console.error("Content "+t.id+" couldn't be removed!",e.stack)}}},{key:"addSheet",value:function(t){var e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}},{key:"addCss",value:function(t){this._customCssNode||(this._customCssNode=document.createElement("style"),document.head.appendChild(this._customCssNode)),this._customCssNode.textContent+=t}},{key:"publicApi",value:function(t){this.publicApiCalled.broadcast(t)}}]),t}();e.a=u},178:function(t,e,i){var n,o;!function(i,r){n=[],void 0!==(o=function(){return i.toast=r()}.apply(e,n))&&(t.exports=o)}(this,function(){function t(){var t=document.getElementsByTagName("head")[0],i=function(e){if(t){if(e.length){for(var r,s,d=-1;r=e[++d];)if("string"==typeof r)n(r);else if("function"==typeof r){s=r;break}o(s,Array.prototype.slice.call(e,d+1))}}else setTimeout(function(){i(e)},50)},n=function(i){var n,o,s=/\.(\w+)$/.exec(i),d=/^\[(\w+)\](.+)/.exec(i);if(null!==d)n=d[1],i=d[2];else{if(null===s)return;n=s[1]}if(!(i in e))switch(e[i]=!1,n){case"js":o=document.createElement("script"),o.src=i,o.async=!1,t.appendChild(o);var a=navigator.appVersion.match(/MSIE (\d)/);null!==a&&parseInt(a[1],10)<9?o.onreadystatechange=function(){/ded|co/.test(this.readyState)&&(e[i]=!0,o.onreadystatechange=null)}:o.onload=function(){e[i]=!0,o.onload=null};break;case"css":o=document.createElement("link"),o.rel="styleSheet",o.href=i,t.appendChild(o),r(o,i);break;default:return void delete e[i]}},o=function(t,n){for(var r in e)if(!e[r])return void setTimeout(function(){o(t,n)},50);"function"==typeof t&&t(),i(n)},r=function(t,i){t.sheet||t.styleSheet?e[i]=!0:setTimeout(function(){r(t,i)},50)};i(arguments)}var e={};return t})},56:function(t,e){function i(){function t(t){for(var e=i.slice(),n=0;n<e.length;n++)e[n].deleted||e[n].fn(t)}function e(t){function e(){for(var e=0;e<i.length;e++)if(i[e].fn===t){i[e].deleted=!0,i.splice(e,1);break}}return i.push(new n(t)),e}var i=[];return{broadcast:t,listen:e}}function n(t){this.fn=t,this.deleted=!1}t.exports=i}});
@@ -379,14 +379,21 @@ var EmbedController = function () {
379
379
  }, {
380
380
  key: '_showBranding',
381
381
  value: function _showBranding() {
382
+ // read branding value
383
+ var brandingValue = new URLSearchParams(window.location.search).get('branding');
384
+ // console.log("read brandingValue:", brandingValue);
385
+ if (!brandingValue) brandingValue = 'off';
386
+
387
+ // check if user is premium
382
388
  var isPremium = this.user && this.user.premium ? this.user.premium : false;
383
- // console.log("_showBranding:", this.user, isPremium, window.location.search.indexOf('branding'));
384
- if (isPremium) return;
385
389
 
386
- // show branding only if the flag is on
387
- if (window.location.search.indexOf('branding') >= 0) {
388
- window.initBranding();
389
- }
390
+ // establish branding
391
+ if (!isPremium) brandingValue = "on";
392
+ // console.log("final brandingValue:", this.user, isPremium, brandingValue);
393
+
394
+
395
+ // show branding if user is free or flag is on
396
+ if (brandingValue != "off") window.initBranding();
390
397
  }
391
398
  }, {
392
399
  key: '_onSkinSet',
package/lib/dev/editor.js CHANGED
@@ -13347,7 +13347,7 @@ WidgetEditor = (function(superClass) {
13347
13347
  this.el.append(this.tabs.el);
13348
13348
  LoginPopup.place(this.el);
13349
13349
  Blogvio.pubsub.subscribe('api/token/update', this._updateLoggedInStatus);
13350
- this.el.attr('editorVersion', "3.10.37");
13350
+ this.el.attr('editorVersion', "3.10.41");
13351
13351
  }
13352
13352
 
13353
13353
 
@@ -23255,15 +23255,15 @@ var INSTAGRAM_DEFAULTS, InstagramService, Service, api, auth_url, host,
23255
23255
 
23256
23256
  Service = __webpack_require__(8);
23257
23257
 
23258
- host = 'https://widgetic.com';
23258
+ host = 'https://widgetic.com' + '/services/instagram';
23259
23259
 
23260
23260
  INSTAGRAM_DEFAULTS = {
23261
23261
  client_id: '542808610040105',
23262
23262
  client_secret: '0a88504381f577dbbef400d4232a4258',
23263
- redirect_uri: host + '/services/instagram/auth_token',
23263
+ redirect_uri: host + '/auth_token',
23264
23264
  scope: 'user_profile,user_media',
23265
23265
  response_type: 'code',
23266
- api_url: host + '/services/instagram/',
23266
+ api_url: host,
23267
23267
  demo: "IGQVJVNUw5cHB5cUFiZATFxVmgyeWtSVFJjTDYyRmNnWDZAJZA3llVXREa1BsS1EtVGJ2UEdlbHJNbDV1UUQ2YkVSZA3YwS1dPWXJzYXFGQzdZAMlhBLTBWWWNkTVNHTGNDLW10dkdhNW0wMDVqMkhZAWEhqbgZDZD",
23268
23268
  token_storage: "redis",
23269
23269
  encodeToken: false,
@@ -23377,15 +23377,15 @@ Service = __webpack_require__(8);
23377
23377
 
23378
23378
  Entry = __webpack_require__(9);
23379
23379
 
23380
- host = 'https://widgetic.com';
23380
+ host = 'https://widgetic.com' + '/services/instagram/';
23381
23381
 
23382
23382
  INSTAGRAM_DEFAULTS = {
23383
23383
  client_id: '542808610040105',
23384
23384
  client_secret: '0a88504381f577dbbef400d4232a4258',
23385
- redirect_uri: host + '/services/instagram/auth_token',
23385
+ redirect_uri: host + 'auth_token',
23386
23386
  scope: 'user_profile,user_media',
23387
23387
  response_type: 'code',
23388
- api_url: host + '/services/instagram/',
23388
+ api_url: host,
23389
23389
  demo: "IGQVJVNUw5cHB5cUFiZATFxVmgyeWtSVFJjTDYyRmNnWDZAJZA3llVXREa1BsS1EtVGJ2UEdlbHJNbDV1UUQ2YkVSZA3YwS1dPWXJzYXFGQzdZAMlhBLTBWWWNkTVNHTGNDLW10dkdhNW0wMDVqMkhZAWEhqbgZDZD",
23390
23390
  token_storage: "redis",
23391
23391
  encodeToken: false,
@@ -23636,7 +23636,7 @@ module.exports = InstagramService;
23636
23636
  /* 170 */
23637
23637
  /***/ (function(module, exports, __webpack_require__) {
23638
23638
 
23639
- var Entry, SC, Service, SoundCloudService, config,
23639
+ var Entry, SC, Service, SoundCloudService, config, widgetic_backend_url,
23640
23640
  bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
23641
23641
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
23642
23642
  hasProp = {}.hasOwnProperty;
@@ -23645,23 +23645,26 @@ Service = __webpack_require__(8);
23645
23645
 
23646
23646
  Entry = __webpack_require__(9);
23647
23647
 
23648
+ widgetic_backend_url = 'https://widgetic.com/wservices/soundcloud/';
23649
+
23648
23650
  SC = __webpack_require__(171);
23649
23651
 
23650
23652
  config = {
23653
+ api_url: 'https://api.soundcloud.com',
23651
23654
  client_id: 'aed0aa63baf747a83ad0b6b246acddca',
23652
23655
  redirect_uri: 'https://widgetic.com/connect/soundcloud',
23653
- grant_type: 'refresh_token',
23654
- api_url: 'https://api.soundcloud.com'
23656
+ tracks_url: widgetic_backend_url + 'tracks/',
23657
+ grant_type: 'refresh_token'
23655
23658
  };
23656
23659
 
23657
23660
  SC.initialize(config);
23658
23661
 
23659
23662
  SC.client_id = config.client_id;
23660
23663
 
23661
- SC.redirect_uri = config.redirect_uri;
23662
-
23663
23664
  SC.api_url = config.api_url;
23664
23665
 
23666
+ SC.tracks_url = config.tracks_url;
23667
+
23665
23668
  try {
23666
23669
  SC.auth_token = localStorage.getItem('soundcloudAuthToken');
23667
23670
  } catch (error1) {}
@@ -23685,7 +23688,6 @@ SoundCloudService = (function(superClass) {
23685
23688
  SoundCloudService.prototype.SCGet = function(path) {
23686
23689
  var url;
23687
23690
  url = ("" + SC.api_url) + path;
23688
- console.log("SCGet path:", path, SC.auth_token);
23689
23691
  return $.ajax({
23690
23692
  url: url,
23691
23693
  type: 'GET',
@@ -23824,16 +23826,7 @@ SoundCloudService = (function(superClass) {
23824
23826
  };
23825
23827
 
23826
23828
  SoundCloudService.prototype.getURL = function(entry, callback) {
23827
- return this.SCGet("/tracks/" + entry.id + "/stream").then((function(_this) {
23828
- return function(streams) {
23829
- console.log("fetchTrackStreams result:", streams);
23830
- return callback(streams);
23831
- };
23832
- })(this))["catch"]((function(_this) {
23833
- return function(error) {
23834
- return console.log('Fetch Track Streams error: ' + error);
23835
- };
23836
- })(this));
23829
+ return callback(SC.tracks_url + "?id=" + entry.id + "&atoken=" + SC.auth_token);
23837
23830
  };
23838
23831
 
23839
23832
  return SoundCloudService;