tocco-widget-utils 0.1.13 → 0.1.16
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 +9 -0
- package/dist/bootstrap.js +15 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
package/dist/bootstrap.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
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)},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=p;return function(o,c){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw c;return D()}for(r.method=o,r.arg=c;;){var i=r.delegate;if(i){var a=E(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===p)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=f(t,e,r);if("normal"===u.type){if(n=r.done?d:l,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,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 p="suspendedStart",l="suspendedYield",h="executing",d="completed",y={};function v(){}function g(){}function w(){}var m={};m[c]=function(){return this};var b=Object.getPrototypeOf,O=b&&b(b(_([])));O&&O!==r&&n.call(O,c)&&(m=O);var j=w.prototype=v.prototype=Object.create(m);function x(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,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):e.resolve(p).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 E(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,E(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 k(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(k,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=j.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(j),t},t.awrap=function(t){return{__await:t}},x(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()}))},x(j),u(j,a,"Generator"),j[c]=function(){return this},j.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.13","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(926),e=r.n(t),o=r(757),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)}};var f="toccoBackendUrl",p="data-tocco-widget-key";function l(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 h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Headers;r.set("Content-Type","application/json");var n=h({headers:r,method:"GET",credentials:"include"},e);return fetch(t,n)},y=function(t){var e=t.ok,r=t.status;return t.json().then((function(t){return{ok:e,status:r,body:t}}))},v="error",g=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),s(i),t.next=5,m(v,e,i);case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),w=function(){var t=e()(c().mark((function t(e,r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s(r),t.next=3,m(v,e,r);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),m=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,d("".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)}}(),b=r(8),O=r.n(b);function j(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 x(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var P=function(t){return t.getAttribute("data-id")},E=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)}))},k=function(){var t=window.toccoTheme;if(t&&"object"===O()(t))return t},L=function(t){return t&&Object.keys(t).length>0&&"function"==typeof t[Object.keys(t)[0]]},S=function(t){var e=window.toccoEventHandlers;if(L(e))return e;if(e){var r=P(t);if(r){var n=e[r];if(L(n))return n}}return{}},_=function(t,e){var r=P(t);r&&(window.toccoMethods=x(x({},window.toccoMethods),{},a()({},r,e)))};function D(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 N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?D(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):D(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var T=function(t){return t.getAttribute(p)},A=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)&&w(t,c.message),void(404===o&&w(t,"Widget config '".concat(r,"' not found."))))},C=function(){var t=e()(c().mark((function t(e,r,n){var o,i,a,u,s,f,p,l,h,v,w;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=T(n),t.next=3,d("".concat(e,"/nice2/rest/widget/configs/").concat(o)).then(y).then((function(t){return A(e,t,o)})).then((function(t){return null==t?void 0:t.body})).catch((function(t){g(e,"Could not fetch widget config '".concat(o,"'."),t)}));case 3:if(!(i=t.sent)){t.next=20;break}return a=i.appName,u=i.packageName,s=i.locale,f=i.config,t.prev=6,t.next=9,E("".concat(r,"/js/tocco-").concat(u,"/dist/index.js"));case 9:t.next=15;break;case 11:return t.prev=11,t.t0=t.catch(6),g(e,"Could not fetch package 'tocco-".concat(u,"'."),t.t0),t.abrupt("return");case 15:p=k(),l=N(N(N({backendUrl:e},p?{customTheme:p}:{}),{},{locale:s},f),{},{appContext:{embedType:"widget",widgetConfigKey:o}}),h=S(n),v="".concat(r,"/js/tocco-").concat(u,"/dist/");try{w=window.reactRegistry.render(a,n,"",l,h,v),_(n,w)}catch(t){g(e,"Could not render app '".concat(a,"'."),t)}case 20:case"end":return t.stop()}}),t,null,[[6,11]])})));return function(e,r,n){return t.apply(this,arguments)}}(),G=function(){if(window.toccoBootstrap)return u("tocco-widget-utils - bootstrap script is already initialized"),!1;var t=r(659).version;return window.toccoBootstrap={version:t},u("tocco-widget-utils - v".concat(t," - bootstrap")),!0},M=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(G()){t.next=3;break}return t.abrupt("return");case 3:return r=e.backendUrl,n=e.assetUrl,o=document.querySelectorAll("[".concat(p,"]")),i=Array.prototype.slice.call(o),t.next=8,Promise.all(i.map((function(t){return C(r,n,t)})));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();const R=M;var U,I;U=function(t){var e=t.currentScript.getAttribute("src"),r=new URL(e);return r.protocol+"//"+r.host}(document),I={backendUrl:window[f]?window[f]:U,assetUrl:U},document.addEventListener("DOMContentLoaded",e()(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E("".concat(U,"/nice2/javascript/nice2-react.release.js"));case 2:return t.next=4,R(I);case 4:case"end":return t.stop()}}),t)}))))})(),n})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React")):"function"==typeof define&&define.amd?define(["React"],e):"object"==typeof exports?exports["tocco-widget-utils"]=e(require("React")):t["tocco-widget-utils"]=e(t.React)}(self,(t=>(()=>{var e={228:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},858:t=>{t.exports=function(t){if(Array.isArray(t))return 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}},884:t=>{t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,c=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,c=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw c}}return r}}},521:t=>{t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},38:(t,e,r)=>{var n=r(858),o=r(884),c=r(379),i=r(521);t.exports=function(t,e){return n(t)||o(t,e)||c(t,e)||i()}},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},379:(t,e,r)=>{var n=r(228);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},757:(t,e,r)=>{t.exports=r(666)},239:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},560:(t,e,r)=>{var n=r(239),o=r(218);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},218:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},418:t=>{"use strict";
|
|
2
|
+
/*
|
|
3
|
+
object-assign
|
|
4
|
+
(c) Sindre Sorhus
|
|
5
|
+
@license MIT
|
|
6
|
+
*/var e=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,c){for(var i,a,u=o(t),s=1;s<arguments.length;s++){for(var f in i=Object(arguments[s]))r.call(i,f)&&(u[f]=i[f]);if(e){a=e(i);for(var l=0;l<a.length;l++)n.call(i,a[l])&&(u[a[l]]=i[a[l]])}}return u}},251:(t,e,r)=>{"use strict";
|
|
7
|
+
/** @license React v17.0.2
|
|
8
|
+
* react-jsx-runtime.production.min.js
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
r(418);var n=r(24),o=60103;if(60107,"function"==typeof Symbol&&Symbol.for){var c=Symbol.for;o=c("react.element"),c("react.fragment")}var i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a=Object.prototype.hasOwnProperty,u={key:!0,ref:!0,__self:!0,__source:!0};function s(t,e,r){var n,c={},s=null,f=null;for(n in void 0!==r&&(s=""+r),void 0!==e.key&&(s=""+e.key),void 0!==e.ref&&(f=e.ref),e)a.call(e,n)&&!u.hasOwnProperty(n)&&(c[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps)void 0===c[n]&&(c[n]=e[n]);return{$$typeof:o,type:t,key:s,ref:f,props:c,_owner:i.current}}e.jsx=s,e.jsxs=s},893:(t,e,r)=>{"use strict";t.exports=r(251)},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 _(n||[]);return c._invoke=function(t,e,r){var n=l;return function(o,c){if(n===y)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw c;return A()}for(r.method=o,r.arg=c;;){var i=r.delegate;if(i){var a=E(i,r);if(a){if(a===d)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=y;var u=f(t,e,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===d)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",y="executing",h="completed",d={};function v(){}function b(){}function g(){}var m={};m[c]=function(){return this};var w=Object.getPrototypeOf,O=w&&w(w(L([])));O&&O!==r&&n.call(O,c)&&(m=O);var j=g.prototype=v.prototype=Object.create(m);function x(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 E(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,E(t,r),"throw"===r.method))return d;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=f(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,d;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,d):c:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function S(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function L(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:A}}function A(){return{value:e,done:!0}}return b.prototype=j.constructor=g,g.constructor=b,b.displayName=u(g,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,u(t,a,"GeneratorFunction")),t.prototype=Object.create(j),t},t.awrap=function(t){return{__await:t}},x(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()}))},x(j),u(j,a,"Generator"),j[c]=function(){return this},j.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=L,_.prototype={constructor:_,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(k),!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,d):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),d},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),k(r),d}},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;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},24:e=>{"use strict";e.exports=t},659:t=>{"use strict";t.exports=JSON.parse('{"name":"tocco-widget-utils","version":"0.1.16","description":"","scripts":{"compile:prod":"cd ../../../ && npm run compile:prod -- --package=widget-utils","prepublish":"npm run compile:prod"},"dependencies":{},"devDependencies":{"tocco-util":"*"}}')}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var c=r[t]={exports:{}};return e[t](c,c.exports,n),c.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{"use strict";n.r(o);var t=n(926),e=n.n(t),r=n(757),c=n.n(r);n(38),n(24);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=n(713),s=n.n(u),f=n(8),l=n.n(f);new Uint8Array(16);for(var p=[],y=0;y<256;++y)p.push((y+256).toString(16).substr(1));n(560);n(893);var h=function(t){return"/js/tocco-".concat(t,"/dist/")},d=function(t,e){var r=t!==e?e:"index";return"".concat(h(t)).concat(r,".js")},v=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 b=v,g=d;var m="toccoBackendUrl",w="data-tocco-widget-key";function O(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 j(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?O(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var x=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Headers;r.set("Content-Type","application/json");var n=j({headers:r,method:"GET",credentials:"include"},e);return fetch(t,n)},P=function(t){var e=t.ok,r=t.status;return t.json().then((function(t){return{ok:e,status:r,body:t}}))},E="error",S=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,_(E,e,i);case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),k=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,_(E,e,r);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),_=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,x("".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)}}();function L(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?L(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var N=function(t){return t.getAttribute("data-id")},T=function(){var t=window.toccoTheme;if(t&&"object"===l()(t))return t},D=function(t){return t&&Object.keys(t).length>0&&"function"==typeof t[Object.keys(t)[0]]},R=function(t){var e=window.toccoEventHandlers;if(D(e))return e;if(e){var r=N(t);if(r){var n=e[r];if(D(n))return n}}return{}},C=function(t,e){var r=N(t);r&&(window.toccoMethods=A(A({},window.toccoMethods),{},s()({},r,e)))};function I(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 U(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?I(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var G=function(t){return t.getAttribute(w)},F=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)&&k(t,c.message),void(404===o&&k(t,"Widget config '".concat(r,"' not found."))))},M=function(){var t=e()(c().mark((function t(e,r,n){var o,i,a,u,s,f,l,p,y,h,d;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=G(n),t.next=3,x("".concat(e,"/nice2/rest/widget/configs/").concat(o)).then(P).then((function(t){return F(e,t,o)})).then((function(t){return null==t?void 0:t.body})).catch((function(t){S(e,"Could not fetch widget config '".concat(o,"'."),t)}));case 3:if(!(i=t.sent)){t.next=20;break}return a=i.appName,u=i.packageName,s=i.locale,f=i.config,t.prev=6,t.next=9,b("".concat(r).concat(g(u,a)));case 9:t.next=15;break;case 11:return t.prev=11,t.t0=t.catch(6),S(e,"Could not fetch package 'tocco-".concat(u,"'."),t.t0),t.abrupt("return");case 15:l=T(),p=U(U(U({backendUrl:e},l?{customTheme:l}:{}),{},{locale:s},f),{},{appContext:{embedType:"widget",widgetConfigKey:o}}),y=R(n),h="".concat(r,"/js/tocco-").concat(u,"/dist/");try{d=window.reactRegistry.render(a,n,"",p,y,h),C(n,d)}catch(t){S(e,"Could not render app '".concat(a,"'."),t)}case 20:case"end":return t.stop()}}),t,null,[[6,11]])})));return function(e,r,n){return t.apply(this,arguments)}}(),B=function(){if(window.toccoBootstrap)return i("tocco-widget-utils - bootstrap script is already initialized"),!1;var t=n(659).version;return window.toccoBootstrap={version:t},i("tocco-widget-utils - v".concat(t," - bootstrap")),!0},q=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(B()){t.next=3;break}return t.abrupt("return");case 3:return r=e.backendUrl,n=e.assetUrl,o=document.querySelectorAll("[".concat(w,"]")),i=Array.prototype.slice.call(o),t.next=8,Promise.all(i.map((function(t){return M(r,n,t)})));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();const Y=q;var $,H;$=function(t){var e=t.currentScript.getAttribute("src"),r=new URL(e);return r.protocol+"//"+r.host}(document),H={backendUrl:window[m]?window[m]:$,assetUrl:$},document.addEventListener("DOMContentLoaded",e()(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b("".concat($,"/nice2/javascript/nice2-react.release.js"));case 2:return t.next=4,Y(H);case 4:case"end":return t.stop()}}),t)}))))})(),o})()));
|