tocco-widget-utils 0.1.3 → 0.1.4
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/changelog.md +3 -0
- package/dist/bootstrap.js +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
package/dist/bootstrap.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["tocco-widget-utils"]=e():t["tocco-widget-utils"]=e()}(self,(function(){return(()=>{var t={926:t=>{function e(t,e,r,n,o,c,i){try{var a=t[c](i),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,c){var i=t.apply(r,n);function a(t){e(i,o,c,a,u,"next",t)}function u(t){e(i,o,c,a,u,"throw",t)}a(void 0)}))}}},713:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},8:t=>{function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=e=function(t){return typeof t}:t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(r)}t.exports=e},757:(t,e,r)=>{t.exports=r(666)},666:t=>{var e=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",c=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function a(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof p?e:p,c=Object.create(o.prototype),i=new x(n||[]);return c._invoke=function(t,e,r){var n="suspendedStart";return function(o,c){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw c;return E()}for(r.method=o,r.arg=c;;){var i=r.delegate;if(i){var a=b(i,r);if(a){if(a===f)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),c}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function l(){}function d(){}var h={};h[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(P([])));v&&v!==e&&r.call(v,o)&&(h=v);var g=d.prototype=p.prototype=Object.create(h);function m(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,c){function i(){return new e((function(n,i){!function n(o,c,i,a){var u=s(t[o],t,c);if("throw"!==u.type){var f=u.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,i,a)}),(function(t){n("throw",t,i,a)})):e.resolve(p).then((function(t){f.value=t,i(f)}),(function(t){return n("throw",t,i,a)}))}a(u.arg)}(o,c,n,i)}))}return n=n?n.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,c=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return c.next=c}}return{next:E}}function E(){return{value:void 0,done:!0}}return l.prototype=g.constructor=d,d.constructor=l,l.displayName=a(d,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,a(t,i,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),w.prototype[c]=function(){return this},t.AsyncIterator=w,t.async=function(e,r,n,o,c){void 0===c&&(c=Promise);var i=new w(u(e,r,n,o),c);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},m(g),a(g,i,"Generator"),g[o]=function(){return this},g.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var c=this.tryEntries[o],i=c.completion;if("root"===c.tryLoc)return n("end");if(c.tryLoc<=this.prev){var a=r.call(c,"catchLoc"),u=r.call(c,"finallyLoc");if(a&&u){if(this.prev<c.catchLoc)return n(c.catchLoc,!0);if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else if(a){if(this.prev<c.catchLoc)return n(c.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return n(c.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var c=o;break}}c&&("break"===t||"continue"===t)&&c.tryLoc<=e&&e<=c.finallyLoc&&(c=null);var i=c?c.completion:{};return i.type=t,i.arg=e,c?(this.method="next",this.next=c.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},255:t=>{"use strict";t.exports=JSON.parse('{"name":"tocco-widget-utils","version":"0.1.3","description":"","scripts":{"compile:prod":"cd ../../ && npm run compile:prod -- --package=widget-utils","prepublish":"npm run compile:prod"},"dependencies":{},"devDependencies":{"tocco-util":"*"}}')}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var c=e[n]={exports:{}};return t[n](c,c.exports,r),c.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n);var t=r(757),e=r.n(t),o=r(926),c=r.n(o),i=r(713),a=r.n(i);const u=function(){var t;window.console&&(t=console).log.apply(t,arguments)},s=function(){if(window.console){var t=console.error||console.log;t.apply(void 0,arguments)}};function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var l=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Headers;r.set("Content-Type","application/json");var n=p({headers:r,method:"GET",credentials:"include"},e);return fetch(t,n)},d=function(t){var e=t.ok,r=t.status;return t.json().then((function(t){return{ok:e,status:r,body:t}}))},h="error",y=function(){var t=c()(e().mark((function t(r,n,o){var c,i;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c="ERROR MESSAGE: ".concat(o.message," \nSTACK: ").concat(o.stack?o.stack.substring(0,1e3):"-"),i="".concat(n,"\n").concat(c),s(i),t.next=5,g(h,r,i);case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),v=function(){var t=c()(e().mark((function t(r,n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s(n),t.next=3,g(h,r,n);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),g=function(){var t=c()(e().mark((function t(r,n,o){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,l("".concat(n,"/nice2/log?level=").concat(r,"&message=").concat(encodeURI(o)),{method:"POST"});case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])})));return function(e,r,n){return t.apply(this,arguments)}}(),m=r(8),w=r.n(m);function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function O(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var j=function(t){return t.getAttribute("data-id")},x=function(t){return new Promise((function(e,r){var n=document.createElement("script");n.src=t,n.async=!0,n.type="text/javascript",n.onload=function(){e()},n.onerror=function(){r(new Error("Could not load script."))},n.crossorogin=!0;var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(n,o)}))},P=function(){var t=window.toccoTheme;if(t&&"object"===w()(t))return t},E=function(t){return t&&Object.keys(t).length>0&&"function"==typeof t[Object.keys(t)[0]]},k=function(t){var e=window.toccoEventHandlers;if(E(e))return e;if(e){var r=j(t);if(r){var n=e[r];if(E(n))return n}}return{}},L=function(t,e){var r=j(t);r&&(window.toccoMethods=O(O({},window.toccoMethods),{},a()({},r,e)))};function S(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?S(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var D=function(t){return t.getAttribute("data-tocco-widget-key")},N=function(t,e,r){var n=e.ok,o=e.status,c=e.body;return n?e:(403===o&&"INVALID_DOMAIN"===(null==c?void 0:c.errorCode)&&v(t,c.message),void(404===o&&v(t,"Widget config '".concat(r,"' not found."))))},T=function(){var t=c()(e().mark((function t(r,n){var o,c,i,a,u,s,f,p,h,v,g;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=D(n),t.next=3,l("".concat(r,"/nice2/rest/widget/configs/").concat(o)).then(d).then((function(t){return N(r,t,o)})).then((function(t){return null==t?void 0:t.body})).catch((function(t){y(r,"Could not fetch widget config '".concat(o,"'."),t)}));case 3:if(!(c=t.sent)){t.next=20;break}return i=c.appName,a=c.packageName,u=c.locale,s=c.config,t.prev=6,t.next=9,x("".concat(r,"/js/tocco-").concat(a,"/dist/index.js"));case 9:t.next=15;break;case 11:return t.prev=11,t.t0=t.catch(6),y(r,"Could not fetch package 'tocco-".concat(a,"'."),t.t0),t.abrupt("return");case 15:f=P(),p=_(_({backendUrl:r},f?{customTheme:f}:{}),{},{locale:u},s),h=k(n),v="".concat(r,"/js/tocco-").concat(a,"/dist/");try{g=window.reactRegistry.render(i,n,"",p,h,v),L(n,g)}catch(t){y(r,"Could not render app '".concat(i,"'."),t)}case 20:case"end":return t.stop()}}),t,null,[[6,11]])})));return function(e,r){return t.apply(this,arguments)}}(),A=function(){if(window.toccoBootstrap)return u("tocco-widget-utils - bootstrap script is already initialized"),!1;var t=r(255).version;return window.toccoBootstrap={version:t},u("tocco-widget-utils - v".concat(t," - bootstrap")),!0};const G=function(){var t=c()(e().mark((function t(r){var n,o,c;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(A()){t.next=3;break}return t.abrupt("return");case 3:return n=r.backendUrl,o=document.querySelectorAll("[".concat("data-tocco-widget-key","]")),c=Array.prototype.slice.call(o),t.next=8,Promise.all(c.map((function(t){return T(n,t)})));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();var C,M;C=function(t){var e=t.currentScript.getAttribute("src"),r=new URL(e);return r.protocol+"//"+r.host}(document),M={backendUrl:C},document.addEventListener("DOMContentLoaded",c()(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x("".concat(C,"/nice2/javascript/nice2-react.release.js"));case 2:return t.next=4,G(M);case 4:case"end":return t.stop()}}),t)}))))})(),n})()}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["tocco-widget-utils"]=e():t["tocco-widget-utils"]=e()}(self,(function(){return(()=>{var t={926:t=>{function e(t,e,r,n,o,c,i){try{var a=t[c](i),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,c){var i=t.apply(r,n);function a(t){e(i,o,c,a,u,"next",t)}function u(t){e(i,o,c,a,u,"throw",t)}a(void 0)}))}}},713:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},8:t=>{function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=e=function(t){return typeof t}:t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(r)}t.exports=e},757:(t,e,r)=>{t.exports=r(666)},666:t=>{var e=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",c=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function a(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof p?e:p,c=Object.create(o.prototype),i=new x(n||[]);return c._invoke=function(t,e,r){var n="suspendedStart";return function(o,c){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw c;return E()}for(r.method=o,r.arg=c;;){var i=r.delegate;if(i){var a=b(i,r);if(a){if(a===f)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),c}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function l(){}function d(){}var h={};h[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(P([])));v&&v!==e&&r.call(v,o)&&(h=v);var g=d.prototype=p.prototype=Object.create(h);function m(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,c){function i(){return new e((function(n,i){!function n(o,c,i,a){var u=s(t[o],t,c);if("throw"!==u.type){var f=u.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,i,a)}),(function(t){n("throw",t,i,a)})):e.resolve(p).then((function(t){f.value=t,i(f)}),(function(t){return n("throw",t,i,a)}))}a(u.arg)}(o,c,n,i)}))}return n=n?n.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,c=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return c.next=c}}return{next:E}}function E(){return{value:void 0,done:!0}}return l.prototype=g.constructor=d,d.constructor=l,l.displayName=a(d,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,a(t,i,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),w.prototype[c]=function(){return this},t.AsyncIterator=w,t.async=function(e,r,n,o,c){void 0===c&&(c=Promise);var i=new w(u(e,r,n,o),c);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},m(g),a(g,i,"Generator"),g[o]=function(){return this},g.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var c=this.tryEntries[o],i=c.completion;if("root"===c.tryLoc)return n("end");if(c.tryLoc<=this.prev){var a=r.call(c,"catchLoc"),u=r.call(c,"finallyLoc");if(a&&u){if(this.prev<c.catchLoc)return n(c.catchLoc,!0);if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else if(a){if(this.prev<c.catchLoc)return n(c.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return n(c.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var c=o;break}}c&&("break"===t||"continue"===t)&&c.tryLoc<=e&&e<=c.finallyLoc&&(c=null);var i=c?c.completion:{};return i.type=t,i.arg=e,c?(this.method="next",this.next=c.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},255:t=>{"use strict";t.exports=JSON.parse('{"name":"tocco-widget-utils","version":"0.1.4","description":"","scripts":{"compile:prod":"cd ../../ && npm run compile:prod -- --package=widget-utils","prepublish":"npm run compile:prod"},"dependencies":{},"devDependencies":{"tocco-util":"*"}}')}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var c=e[n]={exports:{}};return t[n](c,c.exports,r),c.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n);var t=r(757),e=r.n(t),o=r(926),c=r.n(o),i=r(713),a=r.n(i);const u=function(){var t;window.console&&(t=console).log.apply(t,arguments)},s=function(){if(window.console){var t=console.error||console.log;t.apply(void 0,arguments)}};function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var l=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Headers;r.set("Content-Type","application/json");var n=p({headers:r,method:"GET",credentials:"include"},e);return fetch(t,n)},d=function(t){var e=t.ok,r=t.status;return t.json().then((function(t){return{ok:e,status:r,body:t}}))},h="error",y=function(){var t=c()(e().mark((function t(r,n,o){var c,i;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c="ERROR MESSAGE: ".concat(o.message," \nSTACK: ").concat(o.stack?o.stack.substring(0,1e3):"-"),i="".concat(n,"\n").concat(c),s(i),t.next=5,g(h,r,i);case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),v=function(){var t=c()(e().mark((function t(r,n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s(n),t.next=3,g(h,r,n);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),g=function(){var t=c()(e().mark((function t(r,n,o){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,l("".concat(n,"/nice2/log?level=").concat(r,"&message=").concat(encodeURI(o)),{method:"POST"});case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])})));return function(e,r,n){return t.apply(this,arguments)}}(),m=r(8),w=r.n(m);function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function O(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var j=function(t){return t.getAttribute("data-id")},x=function(t){return new Promise((function(e,r){var n=document.createElement("script");n.src=t,n.async=!0,n.type="text/javascript",n.onload=function(){e()},n.onerror=function(){r(new Error("Could not load script."))},n.crossorogin=!0;var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(n,o)}))},P=function(){var t=window.toccoTheme;if(t&&"object"===w()(t))return t},E=function(t){return t&&Object.keys(t).length>0&&"function"==typeof t[Object.keys(t)[0]]},k=function(t){var e=window.toccoEventHandlers;if(E(e))return e;if(e){var r=j(t);if(r){var n=e[r];if(E(n))return n}}return{}},L=function(t,e){var r=j(t);r&&(window.toccoMethods=O(O({},window.toccoMethods),{},a()({},r,e)))};function S(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?S(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var D=function(t){return t.getAttribute("data-tocco-widget-key")},N=function(t,e,r){var n=e.ok,o=e.status,c=e.body;return n?e:(403===o&&"INVALID_DOMAIN"===(null==c?void 0:c.errorCode)&&v(t,c.message),void(404===o&&v(t,"Widget config '".concat(r,"' not found."))))},T=function(){var t=c()(e().mark((function t(r,n){var o,c,i,a,u,s,f,p,h,v,g;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=D(n),t.next=3,l("".concat(r,"/nice2/rest/widget/configs/").concat(o)).then(d).then((function(t){return N(r,t,o)})).then((function(t){return null==t?void 0:t.body})).catch((function(t){y(r,"Could not fetch widget config '".concat(o,"'."),t)}));case 3:if(!(c=t.sent)){t.next=20;break}return i=c.appName,a=c.packageName,u=c.locale,s=c.config,t.prev=6,t.next=9,x("".concat(r,"/js/tocco-").concat(a,"/dist/index.js"));case 9:t.next=15;break;case 11:return t.prev=11,t.t0=t.catch(6),y(r,"Could not fetch package 'tocco-".concat(a,"'."),t.t0),t.abrupt("return");case 15:f=P(),p=_(_({backendUrl:r},f?{customTheme:f}:{}),{},{locale:u},s),h=k(n),v="".concat(r,"/js/tocco-").concat(a,"/dist/");try{g=window.reactRegistry.render(i,n,"",p,h,v),L(n,g)}catch(t){y(r,"Could not render app '".concat(i,"'."),t)}case 20:case"end":return t.stop()}}),t,null,[[6,11]])})));return function(e,r){return t.apply(this,arguments)}}(),A=function(){if(window.toccoBootstrap)return u("tocco-widget-utils - bootstrap script is already initialized"),!1;var t=r(255).version;return window.toccoBootstrap={version:t},u("tocco-widget-utils - v".concat(t," - bootstrap")),!0};const G=function(){var t=c()(e().mark((function t(r){var n,o,c;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(A()){t.next=3;break}return t.abrupt("return");case 3:return n=r.backendUrl,o=document.querySelectorAll("[".concat("data-tocco-widget-key","]")),c=Array.prototype.slice.call(o),t.next=8,Promise.all(c.map((function(t){return T(n,t)})));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();var C,M;C=function(t){var e=t.currentScript.getAttribute("src"),r=new URL(e);return r.protocol+"//"+r.host}(document),M={backendUrl:C},document.addEventListener("DOMContentLoaded",c()(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x("".concat(C,"/nice2/javascript/nice2-react.release.js"));case 2:return t.next=4,G(M);case 4:case"end":return t.stop()}}),t)}))))})(),n})()}));
|
|
2
2
|
//# sourceMappingURL=bootstrap.js.map
|