tocco-widget-utils 0.1.39 → 0.1.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/changelog.md +8 -0
- package/dist/bootstrap.js +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
package/dist/bootstrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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,(()=>(()=>{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)},813:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},c=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,c=Object.create(o.prototype),i=new S(n||[]);return c._invoke=function(t,e,r){var n=l;return function(o,c){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw c;return D()}for(r.method=o,r.arg=c;;){var i=r.delegate;if(i){var a=k(i,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(t,e,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(t,r,i),c}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l="suspendedStart",p="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function w(){}var b={};b[c]=function(){return this};var m=Object.getPrototypeOf,O=m&&m(m(_([])));O&&O!==r&&n.call(O,c)&&(b=O);var x=w.prototype=v.prototype=Object.create(b);function j(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,c,i,a){var u=f(t[o],t,c);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):e.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,a)}))}a(u.arg)}var o;this._invoke=function(t,n){function c(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(c,c):c()}}function k(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=f(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var c=o.arg;return c?c.done?(r[t.resultName]=c.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):c:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function E(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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function _(t){if(t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:D}}function D(){return{value:e,done:!0}}return g.prototype=x.constructor=w,w.constructor=g,g.displayName=u(w,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,a,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},j(P.prototype),P.prototype[i]=function(){return this},t.AsyncIterator=P,t.async=function(e,r,n,o,c){void 0===c&&(c=Promise);var i=new P(s(e,r,n,o),c);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},j(x),u(x,a,"Generator"),x[c]=function(){return this},x.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=_,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},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 r=this;function o(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var c=this.tryEntries.length-1;c>=0;--c){var i=this.tryEntries[c],a=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.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,y):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),y},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),L(r),y}},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;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},659:t=>{"use strict";t.exports=JSON.parse('{"name":"tocco-widget-utils","version":"0.1.39","description":"","scripts":{"compile:prod":"cd ../../../ && npm run compile:prod -- --package=widget-utils","prepublish":"npm run compile:prod","test":"jest"},"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(926),e=r.n(t),o=r(757),c=r.n(o);const i=function(){var t;window.console&&(t=console).log.apply(t,arguments)},a=function(){if(window.console){var t=console.error||console.log;t.apply(void 0,arguments)}};var u=function(t){return"/js/tocco-".concat(t,"/dist/")},s=function(t,e){var r=t!==e?e:"index";return"".concat(u(t)).concat(r,".js")},f=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)}))};const l=f,p=s;var d="toccoBackendUrl",h="data-tocco-widget-key",y="data-tocco-visibility-status",v=r(713),g=r.n(v);function w(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 b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var m=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Headers;r.set("Content-Type","application/json");var n=b({headers:r,method:"GET",credentials:"include"},e);return fetch(t,n)},O=function(t){var e=t.ok,r=t.status;return t.json().then((function(t){return{ok:e,status:r,body:t}}))},x="error",j=function(){var t=e()(c().mark((function t(e,r,n){var o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o="ERROR MESSAGE: ".concat(n.message," \nSTACK: ").concat(n.stack?n.stack.substring(0,1e3):"-"),i="".concat(r,"\n").concat(o),a(i),t.next=5,k(x,e,i);case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),P=function(){var t=e()(c().mark((function t(e,r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a(r),t.next=3,k(x,e,r);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),k=function(){var t=e()(c().mark((function t(e,r,n){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m("".concat(r,"/nice2/log?level=").concat(e,"&message=").concat(encodeURI(n)),{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)}}(),E=function(t,e,r){try{var n=document.getElementById(e)||function(t){var e=document.createElement("style");return e.id=t,document.head.appendChild(e),e}(e);n.innerHTML=r}catch(e){j(t,"Could not apply global styles.",e)}},L=function(t,e,r){var n=r.map((function(t){return"[".concat("data-tocco-widget-ref",'="').concat(e,'"][').concat(y,'~="').concat(t,'"]')})).join(",\n"),o="".concat(n," {\n display: inherit;\n}");E(t,"".concat("tocco-visibility-status-styles","-").concat(e),o)};const S=function(t){var e=t.backendUrl,r="[".concat(y,"] {display: none;}");E(e,"tocco-initial-visibility-status-styles",r)};var _=r(813),D=r.n(_),T=r(8),N=r.n(T);function C(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 A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var R=function(){var t=window.toccoTheme;if(t&&"object"===N()(t))return t},G=function(t){return t&&Object.keys(t).length>0&&"function"==typeof t[Object.keys(t)[0]]},I=function(t){var e=window.toccoEventHandlers;if(G(e))return e;if(e){var r=e[t];if(G(r))return r}return{}},M=function(t,e){window.toccoMethods=A(A({},window.toccoMethods),{},g()({},t,e))};function U(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 B(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?U(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var F=function(t){return t.getAttribute(h)},H=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)&&P(t,c.message),void(404===o&&P(t,"Widget config '".concat(r,"' not found."))))},V=function(t,e,r){return function(){for(var n=arguments.length,o=new Array(n),c=0;c<n;c++)o[c]=arguments[c];var i=o[0].status;L(t,e,i),"function"==typeof r&&r.apply(void 0,o)}},z=function(){var t=e()(c().mark((function t(e,r,n){var o,i,a,u,s,f,d,h,y,v,g,w;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=F(n),t.next=3,m("".concat(e,"/nice2/rest/widget/configs/").concat(o)).then(O).then((function(t){return H(e,t,o)})).then((function(t){return null==t?void 0:t.body})).catch((function(t){j(e,"Could not fetch widget config '".concat(o,"'."),t)}));case 3:if(!(i=t.sent)){t.next=21;break}return a=i.appName,u=i.packageName,s=i.locale,f=i.config,t.prev=6,t.next=9,l("".concat(r).concat(p(u,a)));case 9:t.next=15;break;case 11:return t.prev=11,t.t0=t.catch(6),j(e,"Could not fetch package 'tocco-".concat(u,"'."),t.t0),t.abrupt("return");case 15:d=I(o),h=B(B({},d),{},{onVisibilityStatusChange:V(e,o,d.onVisibilityStatusChange)}),y=R(),v=B(B(B({backendUrl:e},y?{customTheme:y}:{}),{},{locale:s},f),{},{appContext:{embedType:"widget",widgetConfigKey:o}},h),g="".concat(r,"/js/tocco-").concat(u,"/dist/");try{w=window.reactRegistry.render(a,n,"",v,h,g),M(o,w)}catch(t){j(e,"Could not render app '".concat(a,"'."),t)}case 21:case"end":return t.stop()}}),t,null,[[6,11]])})));return function(e,r,n){return t.apply(this,arguments)}}(),K=function(t){var e=r(659).version,n=B({version:e},t),o=window.toccoBootstrap;return o?(i("tocco-widget-utils - bootstrap script is already initialized"),!D()(o,n)&&a("More than one bootstrap script with different settings has been found. Add only one bootstrap script per page.","\nInitialized bootstrap script:",o,"\nIgnored bootstrap script:",n),!1):(window.toccoBootstrap=n,i("tocco-widget-utils - v".concat(e," - bootstrap")),!0)},W=function(){var t=e()(c().mark((function t(e){var r,n,o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(K(e)){t.next=3;break}return t.abrupt("return");case 3:return r=e.backendUrl,n=e.assetUrl,o=document.querySelectorAll("[".concat(h,"]")),i=Array.prototype.slice.call(o),t.next=8,Promise.all(i.map((function(t){return z(r,n,t)})));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();const Y=W;var q,J;q=function(t){var e=t.currentScript.getAttribute("src");if(e.startsWith("http")){var r=new URL(e);return r.protocol+"//"+r.host}var n=window.location;return n.protocol+"//"+n.host}(document),J={backendUrl:window[d]?window[d]:q,assetUrl:q},S(J),document.addEventListener("DOMContentLoaded",e()(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(window.React&&window.reactRegistry){t.next=5;break}return t.next=3,l("".concat(q,"/nice2/javascript/nice2-react.release.js"));case 3:t.next=6;break;case 5:i("tocco-widget-utils - React and react-registry already loaded - v".concat(window.React.version));case 6:return t.next=8,Y(J);case 8: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,(()=>(()=>{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)},813:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},c=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,c=Object.create(o.prototype),i=new S(n||[]);return c._invoke=function(t,e,r){var n=l;return function(o,c){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw c;return D()}for(r.method=o,r.arg=c;;){var i=r.delegate;if(i){var a=k(i,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(t,e,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(t,r,i),c}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l="suspendedStart",p="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function w(){}var b={};b[c]=function(){return this};var m=Object.getPrototypeOf,O=m&&m(m(_([])));O&&O!==r&&n.call(O,c)&&(b=O);var x=w.prototype=v.prototype=Object.create(b);function j(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,c,i,a){var u=f(t[o],t,c);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):e.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,a)}))}a(u.arg)}var o;this._invoke=function(t,n){function c(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(c,c):c()}}function k(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=f(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var c=o.arg;return c?c.done?(r[t.resultName]=c.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):c:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function E(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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function _(t){if(t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:D}}function D(){return{value:e,done:!0}}return g.prototype=x.constructor=w,w.constructor=g,g.displayName=u(w,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,a,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},j(P.prototype),P.prototype[i]=function(){return this},t.AsyncIterator=P,t.async=function(e,r,n,o,c){void 0===c&&(c=Promise);var i=new P(s(e,r,n,o),c);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},j(x),u(x,a,"Generator"),x[c]=function(){return this},x.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=_,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},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 r=this;function o(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var c=this.tryEntries.length-1;c>=0;--c){var i=this.tryEntries[c],a=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.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,y):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),y},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),L(r),y}},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;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},659:t=>{"use strict";t.exports=JSON.parse('{"name":"tocco-widget-utils","version":"0.1.41","description":"","scripts":{"compile:prod":"cd ../../../ && npm run compile:prod -- --package=widget-utils","prepublish":"npm run compile:prod","test":"jest"},"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(926),e=r.n(t),o=r(757),c=r.n(o);const i=function(){var t;window.console&&(t=console).log.apply(t,arguments)},a=function(){if(window.console){var t=console.error||console.log;t.apply(void 0,arguments)}};var u=function(t){return"/js/tocco-".concat(t,"/dist/")},s=function(t,e){var r=t!==e?e:"index";return"".concat(u(t)).concat(r,".js")},f=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)}))};const l=f,p=s;var d="toccoBackendUrl",h="data-tocco-widget-key",y="data-tocco-visibility-status",v=r(713),g=r.n(v);function w(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 b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var m=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Headers;r.set("Content-Type","application/json");var n=b({headers:r,method:"GET",credentials:"include"},e);return fetch(t,n)},O=function(t){var e=t.ok,r=t.status;return t.json().then((function(t){return{ok:e,status:r,body:t}}))},x="error",j=function(){var t=e()(c().mark((function t(e,r,n){var o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o="ERROR MESSAGE: ".concat(n.message," \nSTACK: ").concat(n.stack?n.stack.substring(0,1e3):"-"),i="".concat(r,"\n").concat(o),a(i),t.next=5,k(x,e,i);case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),P=function(){var t=e()(c().mark((function t(e,r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a(r),t.next=3,k(x,e,r);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),k=function(){var t=e()(c().mark((function t(e,r,n){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m("".concat(r,"/nice2/log?level=").concat(e,"&message=").concat(encodeURI(n)),{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)}}(),E=function(t,e,r){try{var n=document.getElementById(e)||function(t){var e=document.createElement("style");return e.id=t,document.head.appendChild(e),e}(e);n.innerHTML=r}catch(e){j(t,"Could not apply global styles.",e)}},L=function(t,e,r){var n=r.map((function(t){return"[".concat("data-tocco-widget-ref",'="').concat(e,'"][').concat(y,'~="').concat(t,'"]')})).join(",\n"),o="".concat(n," {\n display: inherit;\n}");E(t,"".concat("tocco-visibility-status-styles","-").concat(e),o)};const S=function(t){var e=t.backendUrl,r="[".concat(y,"] {display: none;}");E(e,"tocco-initial-visibility-status-styles",r)};var _=r(813),D=r.n(_),T=r(8),N=r.n(T);function C(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 A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var R=function(){var t=window.toccoTheme;if(t&&"object"===N()(t))return t},G=function(t){return t&&Object.keys(t).length>0&&"function"==typeof t[Object.keys(t)[0]]},I=function(t){var e=window.toccoEventHandlers;if(G(e))return e;if(e){var r=e[t];if(G(r))return r}return{}},M=function(t,e){window.toccoMethods=A(A({},window.toccoMethods),{},g()({},t,e))};function U(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 B(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?U(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var F=function(t){return t.getAttribute(h)},H=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)&&P(t,c.message),void(404===o&&P(t,"Widget config '".concat(r,"' not found."))))},V=function(t,e,r){return function(){for(var n=arguments.length,o=new Array(n),c=0;c<n;c++)o[c]=arguments[c];var i=o[0].status;L(t,e,i),"function"==typeof r&&r.apply(void 0,o)}},z=function(){var t=e()(c().mark((function t(e,r,n){var o,i,a,u,s,f,d,h,y,v,g,w;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=F(n),t.next=3,m("".concat(e,"/nice2/rest/widget/configs/").concat(o)).then(O).then((function(t){return H(e,t,o)})).then((function(t){return null==t?void 0:t.body})).catch((function(t){j(e,"Could not fetch widget config '".concat(o,"'."),t)}));case 3:if(!(i=t.sent)){t.next=21;break}return a=i.appName,u=i.packageName,s=i.locale,f=i.config,t.prev=6,t.next=9,l("".concat(r).concat(p(u,a)));case 9:t.next=15;break;case 11:return t.prev=11,t.t0=t.catch(6),j(e,"Could not fetch package 'tocco-".concat(u,"'."),t.t0),t.abrupt("return");case 15:d=I(o),h=B(B({},d),{},{onVisibilityStatusChange:V(e,o,d.onVisibilityStatusChange)}),y=R(),v=B(B(B({backendUrl:e},y?{customTheme:y}:{}),{},{locale:s},f),{},{appContext:{embedType:"widget",widgetConfigKey:o}},h),g="".concat(r,"/js/tocco-").concat(u,"/dist/");try{w=window.reactRegistry.render(a,n,"",v,h,g),M(o,w)}catch(t){j(e,"Could not render app '".concat(a,"'."),t)}case 21:case"end":return t.stop()}}),t,null,[[6,11]])})));return function(e,r,n){return t.apply(this,arguments)}}(),K=function(t){var e=r(659).version,n=B({version:e},t),o=window.toccoBootstrap;return o?(i("tocco-widget-utils - bootstrap script is already initialized"),!D()(o,n)&&a("More than one bootstrap script with different settings has been found. Add only one bootstrap script per page.","\nInitialized bootstrap script:",o,"\nIgnored bootstrap script:",n),!1):(window.toccoBootstrap=n,i("tocco-widget-utils - v".concat(e," - bootstrap")),!0)},W=function(){var t=e()(c().mark((function t(e){var r,n,o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(K(e)){t.next=3;break}return t.abrupt("return");case 3:return r=e.backendUrl,n=e.assetUrl,o=document.querySelectorAll("[".concat(h,"]")),i=Array.prototype.slice.call(o),t.next=8,Promise.all(i.map((function(t){return z(r,n,t)})));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();const Y=W;var q,J;q=function(t){var e=t.currentScript.getAttribute("src");if(e.startsWith("http")){var r=new URL(e);return r.protocol+"//"+r.host}var n=window.location;return n.protocol+"//"+n.host}(document),J={backendUrl:window[d]?window[d]:q,assetUrl:q},S(J),document.addEventListener("DOMContentLoaded",e()(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(window.React&&window.reactRegistry){t.next=5;break}return t.next=3,l("".concat(q,"/nice2/javascript/nice2-react.release.js"));case 3:t.next=6;break;case 5:i("tocco-widget-utils - React and react-registry already loaded - v".concat(window.React.version));case 6:return t.next=8,Y(J);case 8:case"end":return t.stop()}}),t)}))))})(),n})()));
|