@lvble/core 2.0.23 → 2.0.24
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/dist/_bundles/core.js +1 -1
- package/dist/_bundles/core.js.map +1 -1
- package/dist/_bundles/core.min.js +1 -1
- package/dist/_bundles/core.min.js.map +1 -1
- package/dist/lib/lvble.js +8 -10
- package/dist/lib/lvble.js.map +1 -1
- package/dist/lib-esm/lvble.js +8 -10
- package/dist/lib-esm/lvble.js.map +1 -1
- package/package.json +1 -1
package/dist/_bundles/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("MyLib",[],t):"object"==typeof exports?exports.MyLib=t():e.MyLib=t()}(self,(()=>(()=>{"use strict";var e={915:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,i)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(755),t)},755:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Lvble=t.Environment=void 0,function(e){e.Local="local",e.Dev="development",e.Sandbox="sandbox",e.Production="production"}(n||(t.Environment=n={}));const o={[n.Local]:"http://localhost:3001",[n.Dev]:"https://widget.pms.development.nowlvble.com",[n.Sandbox]:"https://widget.pms.sandbox.nowlvble.com",[n.Production]:"https://widget.pms.production.nowlvble.com"},i={[n.Local]:"http://localhost:3000",[n.Dev]:"https://experience.pms.development.nowlvble.com",[n.Sandbox]:"https://experience.pms.sandbox.nowlvble.com",[n.Production]:"https://experience.pms.production.nowlvble.com"};var r;!function(e){e.FinishOnboarding="finishOnboarding",e.FinishOffboarding="finishOffboarding",e.FinishSplit="finishSplit",e.FinishRepay="finishRepay"}(r||(r={})),r.FinishOnboarding,r.FinishOffboarding,r.FinishSplit,r.FinishRepay;class s extends HTMLElement{constructor(){super(),Object.defineProperty(this,"_typeToEvent",{enumerable:!0,configurable:!0,writable:!0,value:{onboarding:r.FinishOnboarding,offboarding:r.FinishOffboarding,split:r.FinishSplit,repay:r.FinishRepay}}),Object.defineProperty(this,"_iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.attachShadow({mode:"open"})}get mode(){return this.getAttribute("mode")}set mode(e){e?this.setAttribute("mode",e):this.removeAttribute("mode")}get environment(){return this.getAttribute("environment")}set environment(e){e?this.setAttribute("environment",e):this.removeAttribute("environment")}get token(){return this.getAttribute("token")}set token(e){e?this.setAttribute("token",e):this.removeAttribute("token")}connectedCallback(){var e;const t=`${o[this.environment]}?token=${this.token}&environment=${this.environment}`,n=document.createElement("iframe");n.src=t,n.width="100%",n.height="100%",n.style.borderStyle="solid",n.style.borderRadius="10px",n.style.borderColor="transparent",this._iframe=n,null===(e=this.shadowRoot)||void 0===e||e.appendChild(n)}disconnectedCallback(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}}let d;customElements.define("lvble-widget",s),customElements.get("lvble-widget"),customElements.get("lvble-widget"),t.Lvble=e=>({createWidget:t=>{const n=new s;
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("MyLib",[],t):"object"==typeof exports?exports.MyLib=t():e.MyLib=t()}(self,(()=>(()=>{"use strict";var e={915:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,i)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(755),t)},755:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Lvble=t.Environment=void 0,function(e){e.Local="local",e.Dev="development",e.Sandbox="sandbox",e.Production="production"}(n||(t.Environment=n={}));const o={[n.Local]:"http://localhost:3001",[n.Dev]:"https://widget.pms.development.nowlvble.com",[n.Sandbox]:"https://widget.pms.sandbox.nowlvble.com",[n.Production]:"https://widget.pms.production.nowlvble.com"},i={[n.Local]:"http://localhost:3000",[n.Dev]:"https://experience.pms.development.nowlvble.com",[n.Sandbox]:"https://experience.pms.sandbox.nowlvble.com",[n.Production]:"https://experience.pms.production.nowlvble.com"};var r;!function(e){e.FinishOnboarding="finishOnboarding",e.FinishOffboarding="finishOffboarding",e.FinishSplit="finishSplit",e.FinishRepay="finishRepay"}(r||(r={})),r.FinishOnboarding,r.FinishOffboarding,r.FinishSplit,r.FinishRepay;class s extends HTMLElement{constructor(){super(),Object.defineProperty(this,"_typeToEvent",{enumerable:!0,configurable:!0,writable:!0,value:{onboarding:r.FinishOnboarding,offboarding:r.FinishOffboarding,split:r.FinishSplit,repay:r.FinishRepay}}),Object.defineProperty(this,"_iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.attachShadow({mode:"open"})}get mode(){return this.getAttribute("mode")}set mode(e){e?this.setAttribute("mode",e):this.removeAttribute("mode")}get environment(){return this.getAttribute("environment")}set environment(e){e?this.setAttribute("environment",e):this.removeAttribute("environment")}get token(){return this.getAttribute("token")}set token(e){e?this.setAttribute("token",e):this.removeAttribute("token")}connectedCallback(){var e;const t=`${o[this.environment]}?token=${this.token}&environment=${this.environment}`,n=document.createElement("iframe");n.src=t,n.width="100%",n.height="100%",n.style.borderStyle="solid",n.style.borderRadius="10px",n.style.borderColor="transparent",this._iframe=n,null===(e=this.shadowRoot)||void 0===e||e.appendChild(n)}disconnectedCallback(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}}let d;customElements.define("lvble-widget",s),customElements.get("lvble-widget"),customElements.get("lvble-widget"),t.Lvble=e=>({createWidget:t=>{const n=new s;n.environment=e.environment,n.token=e.token,n.mode=t.mode;var i=function(n){if(n.origin!=o[e.environment])return void console.debug(`Received message from unknown origin: ${n.origin}`);const i=n.data;t.onEvent(i.eventType,i.data)};return window.removeEventListener("message",i),window.addEventListener("message",i),n},open:t=>{const n={onboarding:`${i[e.environment]}?token=${e.token}`,offboarding:`${i[e.environment]}?token=${e.token}`,split:`${i[e.environment]}?token=${e.token}`,repay:`${i[e.environment]}?token=${e.token}`},o=t.mode?n[t.mode]:`${i[e.environment]}?token=${e.token}`,r=screen.width/2-225,s=screen.height/2-400;d=window.open(o,"LvblePopup","width=450,height=800,location=no,left="+r+",top="+s);var a=function(n){if(n.origin!=i[e.environment])return void console.debug(`Received message from unknown origin: ${n.origin}`);const o=n.data,r=document.querySelectorAll("lvble-widget");n=JSON.parse(JSON.stringify(n)),r.forEach((e=>{var t,n;null===(n=(null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector("iframe")).contentWindow)||void 0===n||n.postMessage(o,"*")})),t.onEvent(o.eventType,o.data)};window.removeEventListener("message",a),window.addEventListener("message",a)}})}},t={};return function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}(915)})()));
|
|
2
2
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,QAAS,GAAIH,GACM,iBAAZC,QACdA,QAAe,MAAID,IAEnBD,EAAY,MAAIC,GACjB,CATD,CASGK,MAAM,I,mhBCTT,W,cC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AAS,EAAIqC,IAO9B,SAASnB,EAAgBC,GACvB,GACEA,EAAQC,QAAUlD,EAA0B4C,EAAYvB,aAKxD,YAHA8B,QAAQC,MACN,yCAAyCH,EAAQC,UAIrD,MAAMkB,EAAYnB,EAAQI,KACpBgB,EAAU3C,SAAS4C,iBAAiB,gBAE1CrB,EAAUsB,KAAKC,MAAMD,KAAKE,UAAUxB,IAEpCoB,EAAQK,SAAST,I,QAGA,QAFd,GACa,QAAZ,EAAAA,EAAE7B,kBAAU,eAAEuC,cAAc,WAC5BC,qBAAa,SAAEC,YAAYT,EAAW,IAAI,IAG9CR,EAAYN,QAAQc,EAAUb,UAAWa,EAAUf,KACrD,CA3BAb,EAASgB,OAAOG,KACdG,EACA,aACA,yCAAuDC,EAAI,QAAUG,GA0BvEV,OAAOC,oBAAoB,UAAWT,GACtCQ,OAAOE,iBAAiB,UAAWV,EAAgB,G,GCtQrD8B,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa5F,QAGrB,IAAIC,EAASwF,EAAyBE,GAAY,CAGjD3F,QAAS,CAAC,GAOX,OAHA8F,EAAoBH,GAAUI,KAAK9F,EAAOD,QAASC,EAAQA,EAAOD,QAAS0F,GAGpEzF,EAAOD,OACf,CCnB0B0F,CAAoB,I","sources":["webpack://MyLib/webpack/universalModuleDefinition","webpack://MyLib/./src/lib/index.ts","webpack://MyLib/./src/lib/lvble.ts","webpack://MyLib/webpack/bootstrap","webpack://MyLib/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"MyLib\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"MyLib\"] = factory();\n\telse\n\t\troot[\"MyLib\"] = factory();\n})(self, () => {\nreturn ","export * from './lvble'\n","export enum Environment {\n Local = \"local\",\n Dev = \"development\",\n Sandbox = \"sandbox\",\n Production = \"production\",\n}\nconst envToBaseUrlMapWidget: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\n [Environment.Dev]: \"https://widget.pms.development.nowlvble.com\",\n [Environment.Sandbox]: \"https://widget.pms.sandbox.nowlvble.com\",\n [Environment.Production]: \"https://widget.pms.production.nowlvble.com\",\n};\n\nconst envToBaseUrlMapExperience: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3000\",\n [Environment.Dev]: \"https://experience.pms.development.nowlvble.com\",\n [Environment.Sandbox]: \"https://experience.pms.sandbox.nowlvble.com\",\n [Environment.Production]: \"https://experience.pms.production.nowlvble.com\",\n};\n\nexport type Mode = \"onboarding\" | \"offboarding\" | \"split\" | \"repay\";\nexport type ErrorData = {\n type: \"error\";\n reason: string;\n};\nexport type OnboardingData =\n | ErrorData\n | {\n type: \"success\";\n status: string;\n };\nexport type SplitData =\n | ErrorData\n | {\n type: \"success\";\n external_id: string;\n settlement_id: string;\n amount: number;\n };\nexport type CloseData =\n | ErrorData\n | {\n type: \"close\";\n };\n// TODO: Make this the event type in the onEvent callback signature\nexport type EventData = OnboardingData | SplitData | CloseData;\n\nenum EventType {\n FinishOnboarding = \"finishOnboarding\",\n FinishOffboarding = \"finishOffboarding\",\n FinishSplit = \"finishSplit\",\n FinishRepay = \"finishRepay\",\n}\n\nconst modeToEventType = {\n onboarding: EventType.FinishOnboarding,\n offboarding: EventType.FinishOffboarding,\n split: EventType.FinishSplit,\n repay: EventType.FinishRepay,\n};\n\nexport interface InitOptions {\n // The environment to use.\n environment: Environment;\n // The widget token to use.\n token: string;\n}\n\nexport interface OpenOptions {\n // The mode to open the popup in. See Mode for more information.\n mode?: Mode;\n // The callback to invoke when the popup has sent an event (e.g. user clicked a button).\n onEvent: (eventType: string, data: any) => void;\n}\n\nexport interface CreateWidgetOptions extends OpenOptions {\n mode?: Extract<Mode, \"onboarding\" | \"repay\">;\n // The callback to invoke when the popup has sent an event (e.g. user clicked a button).\n onEvent: (eventType: string, data: any) => void;\n}\n\nclass LvbleWidget extends HTMLElement {\n _typeToEvent = {\n onboarding: EventType.FinishOnboarding,\n offboarding: EventType.FinishOffboarding,\n split: EventType.FinishSplit,\n repay: EventType.FinishRepay,\n };\n _iframe?: HTMLIFrameElement;\n\n constructor() {\n super();\n this.attachShadow({ mode: \"open\" });\n }\n\n get mode(): Mode {\n return this.getAttribute(\"mode\") as Mode;\n }\n\n set mode(val: Mode | undefined) {\n if (val) {\n this.setAttribute(\"mode\", val);\n } else {\n this.removeAttribute(\"mode\");\n }\n }\n\n get environment(): Environment {\n return this.getAttribute(\"environment\") as Environment;\n }\n\n set environment(val) {\n if (val) {\n this.setAttribute(\"environment\", val);\n } else {\n this.removeAttribute(\"environment\");\n }\n }\n\n get token() {\n return this.getAttribute(\"token\") as string;\n }\n\n set token(val: string) {\n if (val) {\n this.setAttribute(\"token\", val);\n } else {\n this.removeAttribute(\"token\");\n }\n }\n\n connectedCallback() {\n const iframeSrc = `${envToBaseUrlMapWidget[this.environment]}?token=${\n this.token\n }&environment=${this.environment}`;\n\n const iframe = document.createElement(\"iframe\");\n iframe.src = iframeSrc;\n iframe.width = `100%`;\n iframe.height = `100%`;\n iframe.style.borderStyle = \"solid\";\n iframe.style.borderRadius = \"10px\";\n iframe.style.borderColor = \"transparent\";\n this._iframe = iframe;\n\n this.shadowRoot?.appendChild(iframe);\n }\n\n disconnectedCallback() {\n if (this.shadowRoot) this.shadowRoot.innerHTML = \"\";\n }\n}\n\ncustomElements.define(\"lvble-widget\", LvbleWidget);\n\nconst modeWidgetMap: Record<\n Extract<Mode, \"onboarding\" | \"repay\">,\n CustomElementConstructor | undefined\n> = {\n onboarding: customElements.get(\"lvble-widget\"),\n repay: customElements.get(\"lvble-widget\"),\n};\n\nlet _popup: Window;\n\nconst lvble = (initOptions: InitOptions) => {\n return {\n /**\n * This function creates a widget that can be embedded in your website.\n *\n * @param createOptions The options for creating the widget. See CreateWidgetOptions for more information.\n * @returns The widget.\n */\n // TODO: Add support for no mode\n createWidget: (createOptions: CreateWidgetOptions) => {\n const widget = new LvbleWidget()\n \n // (\n // createOptions.mode\n // ? new modeWidgetMap[createOptions.mode]!()\n // : new (customElements.get(\n // \"lvble-widget\"\n // ) as CustomElementConstructor)()\n // ) as LvbleWidget;\n widget.environment = initOptions.environment;\n widget.token = initOptions.token;\n widget.mode = createOptions.mode;\n\n function messageListener(message: MessageEvent) {\n if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {\n console.debug(\n `Received message from unknown origin: ${message.origin}`\n );\n return;\n }\n\n const data = message.data;\n createOptions.onEvent(data.eventType, data.data);\n };\n\n window.removeEventListener(\"message\", messageListener);\n window.addEventListener(\"message\", messageListener);\n return widget;\n },\n /**\n * This function opens a popup with the relevant mode.\n * @param openOptions The options for opening the widget. See OpenOptions for more information.\n * @returns undefined.\n */\n open: (openOptions: OpenOptions) => {\n const modeUrlMap: Record<Mode, string> = {\n onboarding: `${\n envToBaseUrlMapExperience[initOptions.environment]\n }?token=${initOptions.token}`,\n offboarding: `${\n envToBaseUrlMapExperience[initOptions.environment]\n }?token=${initOptions.token}`,\n split: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${\n initOptions.token\n }`,\n repay: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${\n initOptions.token\n }`,\n };\n\n const modeUrl = openOptions.mode ? \n modeUrlMap[openOptions.mode] : \n `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`;\n\n const w = 450;\n const h = 800;\n const l = screen.width / 2 - w / 2;\n const t = screen.height / 2 - h / 2;\n _popup = window.open(\n modeUrl,\n \"LvblePopup\",\n \"width=\" + w + \",height=\" + h + \",location=no,left=\" + l + \",top=\" + t\n ) as Window;\n\n function messageListener(message: MessageEvent) {\n if (\n message.origin != envToBaseUrlMapExperience[initOptions.environment]\n ) {\n console.debug(\n `Received message from unknown origin: ${message.origin}`\n );\n return;\n }\n const eventData = message.data;\n const iframes = document.querySelectorAll(\"lvble-widget\");\n\n message = JSON.parse(JSON.stringify(message));\n\n iframes.forEach((w) => {\n (\n w.shadowRoot?.querySelector(\"iframe\") as HTMLIFrameElement\n ).contentWindow?.postMessage(eventData, \"*\");\n });\n\n openOptions.onEvent(eventData.eventType, eventData.data);\n };\n \n window.removeEventListener(\"message\", messageListener);\n window.addEventListener(\"message\", messageListener);\n },\n };\n};\n\nexport type LvbleType = ReturnType<typeof lvble>;\n\nexport const Lvble = lvble;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(915);\n"],"names":["root","factory","exports","module","define","amd","self","Environment","envToBaseUrlMapWidget","Local","Dev","Sandbox","Production","envToBaseUrlMapExperience","EventType","FinishOnboarding","FinishOffboarding","FinishSplit","FinishRepay","LvbleWidget","HTMLElement","constructor","super","onboarding","offboarding","split","repay","this","attachShadow","mode","getAttribute","val","setAttribute","removeAttribute","environment","token","connectedCallback","iframeSrc","iframe","document","createElement","src","width","height","style","borderStyle","borderRadius","borderColor","_iframe","shadowRoot","appendChild","disconnectedCallback","innerHTML","_popup","customElements","get","Lvble","initOptions","createWidget","createOptions","widget","messageListener","message","origin","console","debug","data","onEvent","eventType","window","removeEventListener","addEventListener","open","openOptions","modeUrlMap","modeUrl","l","screen","w","t","h","eventData","iframes","querySelectorAll","JSON","parse","stringify","forEach","querySelector","contentWindow","postMessage","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"core.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,QAAS,GAAIH,GACM,iBAAZC,QACdA,QAAe,MAAID,IAEnBD,EAAY,MAAIC,GACjB,CATD,CASGK,MAAM,I,mhBCTT,W,cCAA,IAAYC,E,8EAAZ,SAAYA,GACV,gBACA,oBACA,oBACA,yBACD,CALD,CAAYA,IAAW,cAAXA,EAAW,KAMvB,MAAMC,EAAqD,CACzD,CAACD,EAAYE,OAAQ,wBACrB,CAACF,EAAYG,KAAM,8CACnB,CAACH,EAAYI,SAAU,0CACvB,CAACJ,EAAYK,YAAa,8CAGtBC,EAAyD,CAC7D,CAACN,EAAYE,OAAQ,wBACrB,CAACF,EAAYG,KAAM,kDACnB,CAACH,EAAYI,SAAU,8CACvB,CAACJ,EAAYK,YAAa,kDA8B5B,IAAKE,GAAL,SAAKA,GACH,sCACA,wCACA,4BACA,2BACD,CALD,CAAKA,IAAAA,EAAS,KAQAA,EAAUC,iBACTD,EAAUE,kBAChBF,EAAUG,YACVH,EAAUI,YAuBnB,MAAMC,UAAoBC,YASxB,WAAAC,GACEC,QATF,2C,gDAAe,CACbC,WAAYT,EAAUC,iBACtBS,YAAaV,EAAUE,kBACvBS,MAAOX,EAAUG,YACjBS,MAAOZ,EAAUI,eAEnB,sC,yDAIES,KAAKC,aAAa,CAAEC,KAAM,QAC5B,CAEA,QAAIA,GACF,OAAOF,KAAKG,aAAa,OAC3B,CAEA,QAAID,CAAKE,GACHA,EACFJ,KAAKK,aAAa,OAAQD,GAE1BJ,KAAKM,gBAAgB,OAEzB,CAEA,eAAIC,GACF,OAAOP,KAAKG,aAAa,cAC3B,CAEA,eAAII,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MyLib/webpack/universalModuleDefinition","webpack://MyLib/./src/lib/index.ts","webpack://MyLib/./src/lib/lvble.ts","webpack://MyLib/webpack/bootstrap","webpack://MyLib/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"MyLib\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"MyLib\"] = factory();\n\telse\n\t\troot[\"MyLib\"] = factory();\n})(self, () => {\nreturn ","export * from './lvble'\n","export enum Environment {\n Local = \"local\",\n Dev = \"development\",\n Sandbox = \"sandbox\",\n Production = \"production\",\n}\nconst envToBaseUrlMapWidget: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\n [Environment.Dev]: \"https://widget.pms.development.nowlvble.com\",\n [Environment.Sandbox]: \"https://widget.pms.sandbox.nowlvble.com\",\n [Environment.Production]: \"https://widget.pms.production.nowlvble.com\",\n};\n\nconst envToBaseUrlMapExperience: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3000\",\n [Environment.Dev]: \"https://experience.pms.development.nowlvble.com\",\n [Environment.Sandbox]: \"https://experience.pms.sandbox.nowlvble.com\",\n [Environment.Production]: \"https://experience.pms.production.nowlvble.com\",\n};\n\nexport type Mode = \"onboarding\" | \"offboarding\" | \"split\" | \"repay\";\nexport type ErrorData = {\n type: \"error\";\n reason: string;\n};\nexport type OnboardingData =\n | ErrorData\n | {\n type: \"success\";\n status: string;\n };\nexport type SplitData =\n | ErrorData\n | {\n type: \"success\";\n external_id: string;\n settlement_id: string;\n amount: number;\n };\nexport type CloseData =\n | ErrorData\n | {\n type: \"close\";\n };\n// TODO: Make this the event type in the onEvent callback signature\nexport type EventData = OnboardingData | SplitData | CloseData;\n\nenum EventType {\n FinishOnboarding = \"finishOnboarding\",\n FinishOffboarding = \"finishOffboarding\",\n FinishSplit = \"finishSplit\",\n FinishRepay = \"finishRepay\",\n}\n\nconst modeToEventType = {\n onboarding: EventType.FinishOnboarding,\n offboarding: EventType.FinishOffboarding,\n split: EventType.FinishSplit,\n repay: EventType.FinishRepay,\n};\n\nexport interface InitOptions {\n // The environment to use.\n environment: Environment;\n // The widget token to use.\n token: string;\n}\n\nexport interface OpenOptions {\n // The mode to open the popup in. See Mode for more information.\n mode?: Mode;\n // The callback to invoke when the popup has sent an event (e.g. user clicked a button).\n onEvent: (eventType: string, data: any) => void;\n}\n\nexport interface CreateWidgetOptions extends OpenOptions {\n mode?: Extract<Mode, \"onboarding\" | \"repay\">;\n // The callback to invoke when the popup has sent an event (e.g. user clicked a button).\n onEvent: (eventType: string, data: any) => void;\n}\n\nclass LvbleWidget extends HTMLElement {\n _typeToEvent = {\n onboarding: EventType.FinishOnboarding,\n offboarding: EventType.FinishOffboarding,\n split: EventType.FinishSplit,\n repay: EventType.FinishRepay,\n };\n _iframe?: HTMLIFrameElement;\n\n constructor() {\n super();\n this.attachShadow({ mode: \"open\" });\n }\n\n get mode(): Mode {\n return this.getAttribute(\"mode\") as Mode;\n }\n\n set mode(val: Mode | undefined) {\n if (val) {\n this.setAttribute(\"mode\", val);\n } else {\n this.removeAttribute(\"mode\");\n }\n }\n\n get environment(): Environment {\n return this.getAttribute(\"environment\") as Environment;\n }\n\n set environment(val) {\n if (val) {\n this.setAttribute(\"environment\", val);\n } else {\n this.removeAttribute(\"environment\");\n }\n }\n\n get token() {\n return this.getAttribute(\"token\") as string;\n }\n\n set token(val: string) {\n if (val) {\n this.setAttribute(\"token\", val);\n } else {\n this.removeAttribute(\"token\");\n }\n }\n\n connectedCallback() {\n const iframeSrc = `${envToBaseUrlMapWidget[this.environment]}?token=${\n this.token\n }&environment=${this.environment}`;\n\n const iframe = document.createElement(\"iframe\");\n iframe.src = iframeSrc;\n iframe.width = `100%`;\n iframe.height = `100%`;\n iframe.style.borderStyle = \"solid\";\n iframe.style.borderRadius = \"10px\";\n iframe.style.borderColor = \"transparent\";\n this._iframe = iframe;\n\n this.shadowRoot?.appendChild(iframe);\n }\n\n disconnectedCallback() {\n if (this.shadowRoot) this.shadowRoot.innerHTML = \"\";\n }\n}\n\ncustomElements.define(\"lvble-widget\", LvbleWidget);\n\nconst modeWidgetMap: Record<\n Extract<Mode, \"onboarding\" | \"repay\">,\n CustomElementConstructor | undefined\n> = {\n onboarding: customElements.get(\"lvble-widget\"),\n repay: customElements.get(\"lvble-widget\"),\n};\n\nlet _popup: Window;\n\nconst lvble = (initOptions: InitOptions) => {\n return {\n /**\n * This function creates a widget that can be embedded in your website.\n *\n * @param createOptions The options for creating the widget. See CreateWidgetOptions for more information.\n * @returns The widget.\n */\n // TODO: Add support for no mode\n createWidget: (createOptions: CreateWidgetOptions) => {\n const widget = new LvbleWidget()\n \n // (\n // createOptions.mode\n // ? new modeWidgetMap[createOptions.mode]!()\n // : new (customElements.get(\n // \"lvble-widget\"\n // ) as CustomElementConstructor)()\n // ) as LvbleWidget;\n widget.environment = initOptions.environment;\n widget.token = initOptions.token;\n widget.mode = createOptions.mode;\n\n var messageListenerLvble = function messageListener(message: MessageEvent) {\n if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {\n console.debug(\n `Received message from unknown origin: ${message.origin}`\n );\n return;\n }\n\n const data = message.data;\n createOptions.onEvent(data.eventType, data.data);\n };\n\n window.removeEventListener(\"message\", messageListenerLvble);\n window.addEventListener(\"message\", messageListenerLvble);\n return widget;\n },\n /**\n * This function opens a popup with the relevant mode.\n * @param openOptions The options for opening the widget. See OpenOptions for more information.\n * @returns undefined.\n */\n open: (openOptions: OpenOptions) => {\n const modeUrlMap: Record<Mode, string> = {\n onboarding: `${\n envToBaseUrlMapExperience[initOptions.environment]\n }?token=${initOptions.token}`,\n offboarding: `${\n envToBaseUrlMapExperience[initOptions.environment]\n }?token=${initOptions.token}`,\n split: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${\n initOptions.token\n }`,\n repay: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${\n initOptions.token\n }`,\n };\n\n const modeUrl = openOptions.mode ? \n modeUrlMap[openOptions.mode] : \n `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`;\n\n const w = 450;\n const h = 800;\n const l = screen.width / 2 - w / 2;\n const t = screen.height / 2 - h / 2;\n _popup = window.open(\n modeUrl,\n \"LvblePopup\",\n \"width=\" + w + \",height=\" + h + \",location=no,left=\" + l + \",top=\" + t\n ) as Window;\n\n var messageListenerOpen = function messageListener(message: MessageEvent) {\n if (\n message.origin != envToBaseUrlMapExperience[initOptions.environment]\n ) {\n console.debug(\n `Received message from unknown origin: ${message.origin}`\n );\n return;\n }\n const eventData = message.data;\n const iframes = document.querySelectorAll(\"lvble-widget\");\n\n message = JSON.parse(JSON.stringify(message));\n\n iframes.forEach((w) => {\n (\n w.shadowRoot?.querySelector(\"iframe\") as HTMLIFrameElement\n ).contentWindow?.postMessage(eventData, \"*\");\n });\n\n openOptions.onEvent(eventData.eventType, eventData.data);\n };\n\n window.removeEventListener(\"message\", messageListenerOpen);\n window.addEventListener(\"message\", messageListenerOpen);\n },\n };\n};\n\nexport type LvbleType = ReturnType<typeof lvble>;\n\nexport const Lvble = lvble;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(915);\n"],"names":["root","factory","exports","module","define","amd","self","Environment","envToBaseUrlMapWidget","Local","Dev","Sandbox","Production","envToBaseUrlMapExperience","EventType","FinishOnboarding","FinishOffboarding","FinishSplit","FinishRepay","LvbleWidget","HTMLElement","constructor","super","onboarding","offboarding","split","repay","this","attachShadow","mode","getAttribute","val","setAttribute","removeAttribute","environment","token","connectedCallback","iframeSrc","iframe","document","createElement","src","width","height","style","borderStyle","borderRadius","borderColor","_iframe","shadowRoot","appendChild","disconnectedCallback","innerHTML","_popup","customElements","get","Lvble","initOptions","createWidget","createOptions","widget","messageListenerLvble","message","origin","console","debug","data","onEvent","eventType","window","removeEventListener","addEventListener","open","openOptions","modeUrlMap","modeUrl","l","screen","w","t","h","messageListenerOpen","eventData","iframes","querySelectorAll","JSON","parse","stringify","forEach","querySelector","contentWindow","postMessage","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("MyLib",[],t):"object"==typeof exports?exports.MyLib=t():e.MyLib=t()}(self,(()=>(()=>{"use strict";var e={915:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,i)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(755),t)},755:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Lvble=t.Environment=void 0,function(e){e.Local="local",e.Dev="development",e.Sandbox="sandbox",e.Production="production"}(n||(t.Environment=n={}));const o={[n.Local]:"http://localhost:3001",[n.Dev]:"https://widget.pms.development.nowlvble.com",[n.Sandbox]:"https://widget.pms.sandbox.nowlvble.com",[n.Production]:"https://widget.pms.production.nowlvble.com"},i={[n.Local]:"http://localhost:3000",[n.Dev]:"https://experience.pms.development.nowlvble.com",[n.Sandbox]:"https://experience.pms.sandbox.nowlvble.com",[n.Production]:"https://experience.pms.production.nowlvble.com"};var r;!function(e){e.FinishOnboarding="finishOnboarding",e.FinishOffboarding="finishOffboarding",e.FinishSplit="finishSplit",e.FinishRepay="finishRepay"}(r||(r={})),r.FinishOnboarding,r.FinishOffboarding,r.FinishSplit,r.FinishRepay;class s extends HTMLElement{constructor(){super(),Object.defineProperty(this,"_typeToEvent",{enumerable:!0,configurable:!0,writable:!0,value:{onboarding:r.FinishOnboarding,offboarding:r.FinishOffboarding,split:r.FinishSplit,repay:r.FinishRepay}}),Object.defineProperty(this,"_iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.attachShadow({mode:"open"})}get mode(){return this.getAttribute("mode")}set mode(e){e?this.setAttribute("mode",e):this.removeAttribute("mode")}get environment(){return this.getAttribute("environment")}set environment(e){e?this.setAttribute("environment",e):this.removeAttribute("environment")}get token(){return this.getAttribute("token")}set token(e){e?this.setAttribute("token",e):this.removeAttribute("token")}connectedCallback(){var e;const t=`${o[this.environment]}?token=${this.token}&environment=${this.environment}`,n=document.createElement("iframe");n.src=t,n.width="100%",n.height="100%",n.style.borderStyle="solid",n.style.borderRadius="10px",n.style.borderColor="transparent",this._iframe=n,null===(e=this.shadowRoot)||void 0===e||e.appendChild(n)}disconnectedCallback(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}}let d;customElements.define("lvble-widget",s),customElements.get("lvble-widget"),customElements.get("lvble-widget"),t.Lvble=e=>({createWidget:t=>{const n=new s;
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("MyLib",[],t):"object"==typeof exports?exports.MyLib=t():e.MyLib=t()}(self,(()=>(()=>{"use strict";var e={915:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,i)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(755),t)},755:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Lvble=t.Environment=void 0,function(e){e.Local="local",e.Dev="development",e.Sandbox="sandbox",e.Production="production"}(n||(t.Environment=n={}));const o={[n.Local]:"http://localhost:3001",[n.Dev]:"https://widget.pms.development.nowlvble.com",[n.Sandbox]:"https://widget.pms.sandbox.nowlvble.com",[n.Production]:"https://widget.pms.production.nowlvble.com"},i={[n.Local]:"http://localhost:3000",[n.Dev]:"https://experience.pms.development.nowlvble.com",[n.Sandbox]:"https://experience.pms.sandbox.nowlvble.com",[n.Production]:"https://experience.pms.production.nowlvble.com"};var r;!function(e){e.FinishOnboarding="finishOnboarding",e.FinishOffboarding="finishOffboarding",e.FinishSplit="finishSplit",e.FinishRepay="finishRepay"}(r||(r={})),r.FinishOnboarding,r.FinishOffboarding,r.FinishSplit,r.FinishRepay;class s extends HTMLElement{constructor(){super(),Object.defineProperty(this,"_typeToEvent",{enumerable:!0,configurable:!0,writable:!0,value:{onboarding:r.FinishOnboarding,offboarding:r.FinishOffboarding,split:r.FinishSplit,repay:r.FinishRepay}}),Object.defineProperty(this,"_iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.attachShadow({mode:"open"})}get mode(){return this.getAttribute("mode")}set mode(e){e?this.setAttribute("mode",e):this.removeAttribute("mode")}get environment(){return this.getAttribute("environment")}set environment(e){e?this.setAttribute("environment",e):this.removeAttribute("environment")}get token(){return this.getAttribute("token")}set token(e){e?this.setAttribute("token",e):this.removeAttribute("token")}connectedCallback(){var e;const t=`${o[this.environment]}?token=${this.token}&environment=${this.environment}`,n=document.createElement("iframe");n.src=t,n.width="100%",n.height="100%",n.style.borderStyle="solid",n.style.borderRadius="10px",n.style.borderColor="transparent",this._iframe=n,null===(e=this.shadowRoot)||void 0===e||e.appendChild(n)}disconnectedCallback(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}}let d;customElements.define("lvble-widget",s),customElements.get("lvble-widget"),customElements.get("lvble-widget"),t.Lvble=e=>({createWidget:t=>{const n=new s;n.environment=e.environment,n.token=e.token,n.mode=t.mode;var i=function(n){if(n.origin!=o[e.environment])return void console.debug(`Received message from unknown origin: ${n.origin}`);const i=n.data;t.onEvent(i.eventType,i.data)};return window.removeEventListener("message",i),window.addEventListener("message",i),n},open:t=>{const n={onboarding:`${i[e.environment]}?token=${e.token}`,offboarding:`${i[e.environment]}?token=${e.token}`,split:`${i[e.environment]}?token=${e.token}`,repay:`${i[e.environment]}?token=${e.token}`},o=t.mode?n[t.mode]:`${i[e.environment]}?token=${e.token}`,r=screen.width/2-225,s=screen.height/2-400;d=window.open(o,"LvblePopup","width=450,height=800,location=no,left="+r+",top="+s);var a=function(n){if(n.origin!=i[e.environment])return void console.debug(`Received message from unknown origin: ${n.origin}`);const o=n.data,r=document.querySelectorAll("lvble-widget");n=JSON.parse(JSON.stringify(n)),r.forEach((e=>{var t,n;null===(n=(null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector("iframe")).contentWindow)||void 0===n||n.postMessage(o,"*")})),t.onEvent(o.eventType,o.data)};window.removeEventListener("message",a),window.addEventListener("message",a)}})}},t={};return function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}(915)})()));
|
|
2
2
|
//# sourceMappingURL=core.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBA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,EAAYtB,SAIVwC,EAAUF,EAAY5C,KAC1B6C,EAAWD,EAAY5C,MACvB,GAAGhB,EAA0B4C,EAAYvB,sBAAsBuB,EAAYtB,QAIvEyC,EAAIC,OAAOnC,MAAQ,EAAIoC,IACvBC,EAAIF,OAAOlC,OAAS,EAAIqC,IAO9B,SAASnB,EAAgBC,GACvB,GACEA,EAAQC,QAAUlD,EAA0B4C,EAAYvB,aAKxD,YAHA8B,QAAQC,MACN,yCAAyCH,EAAQC,UAIrD,MAAMkB,EAAYnB,EAAQI,KACpBgB,EAAU3C,SAAS4C,iBAAiB,gBAE1CrB,EAAUsB,KAAKC,MAAMD,KAAKE,UAAUxB,IAEpCoB,EAAQK,SAAST,I,QAGA,QAFd,GACa,QAAZ,EAAAA,EAAE7B,kBAAU,eAAEuC,cAAc,WAC5BC,qBAAa,SAAEC,YAAYT,EAAW,IAAI,IAG9CR,EAAYN,QAAQc,EAAUb,UAAWa,EAAUf,KACrD,CA3BAb,EAASgB,OAAOG,KACdG,EACA,aACA,yCAAuDC,EAAI,QAAUG,GA0BvEV,OAAOC,oBAAoB,UAAWT,GACtCQ,OAAOE,iBAAiB,UAAWV,EAAgB,G,GCtQrD8B,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa5F,QAGrB,IAAIC,EAASwF,EAAyBE,GAAY,CAGjD3F,QAAS,CAAC,GAOX,OAHA8F,EAAoBH,GAAUI,KAAK9F,EAAOD,QAASC,EAAQA,EAAOD,QAAS0F,GAGpEzF,EAAOD,OACf,CCnB0B0F,CAAoB,I","sources":["webpack://MyLib/webpack/universalModuleDefinition","webpack://MyLib/./src/lib/index.ts","webpack://MyLib/./src/lib/lvble.ts","webpack://MyLib/webpack/bootstrap","webpack://MyLib/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"MyLib\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"MyLib\"] = factory();\n\telse\n\t\troot[\"MyLib\"] = factory();\n})(self, () => {\nreturn ","export * from './lvble'\n","export enum Environment {\n Local = \"local\",\n Dev = \"development\",\n Sandbox = \"sandbox\",\n Production = \"production\",\n}\nconst envToBaseUrlMapWidget: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\n [Environment.Dev]: \"https://widget.pms.development.nowlvble.com\",\n [Environment.Sandbox]: \"https://widget.pms.sandbox.nowlvble.com\",\n [Environment.Production]: \"https://widget.pms.production.nowlvble.com\",\n};\n\nconst envToBaseUrlMapExperience: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3000\",\n [Environment.Dev]: \"https://experience.pms.development.nowlvble.com\",\n [Environment.Sandbox]: \"https://experience.pms.sandbox.nowlvble.com\",\n [Environment.Production]: \"https://experience.pms.production.nowlvble.com\",\n};\n\nexport type Mode = \"onboarding\" | \"offboarding\" | \"split\" | \"repay\";\nexport type ErrorData = {\n type: \"error\";\n reason: string;\n};\nexport type OnboardingData =\n | ErrorData\n | {\n type: \"success\";\n status: string;\n };\nexport type SplitData =\n | ErrorData\n | {\n type: \"success\";\n external_id: string;\n settlement_id: string;\n amount: number;\n };\nexport type CloseData =\n | ErrorData\n | {\n type: \"close\";\n };\n// TODO: Make this the event type in the onEvent callback signature\nexport type EventData = OnboardingData | SplitData | CloseData;\n\nenum EventType {\n FinishOnboarding = \"finishOnboarding\",\n FinishOffboarding = \"finishOffboarding\",\n FinishSplit = \"finishSplit\",\n FinishRepay = \"finishRepay\",\n}\n\nconst modeToEventType = {\n onboarding: EventType.FinishOnboarding,\n offboarding: EventType.FinishOffboarding,\n split: EventType.FinishSplit,\n repay: EventType.FinishRepay,\n};\n\nexport interface InitOptions {\n // The environment to use.\n environment: Environment;\n // The widget token to use.\n token: string;\n}\n\nexport interface OpenOptions {\n // The mode to open the popup in. See Mode for more information.\n mode?: Mode;\n // The callback to invoke when the popup has sent an event (e.g. user clicked a button).\n onEvent: (eventType: string, data: any) => void;\n}\n\nexport interface CreateWidgetOptions extends OpenOptions {\n mode?: Extract<Mode, \"onboarding\" | \"repay\">;\n // The callback to invoke when the popup has sent an event (e.g. user clicked a button).\n onEvent: (eventType: string, data: any) => void;\n}\n\nclass LvbleWidget extends HTMLElement {\n _typeToEvent = {\n onboarding: EventType.FinishOnboarding,\n offboarding: EventType.FinishOffboarding,\n split: EventType.FinishSplit,\n repay: EventType.FinishRepay,\n };\n _iframe?: HTMLIFrameElement;\n\n constructor() {\n super();\n this.attachShadow({ mode: \"open\" });\n }\n\n get mode(): Mode {\n return this.getAttribute(\"mode\") as Mode;\n }\n\n set mode(val: Mode | undefined) {\n if (val) {\n this.setAttribute(\"mode\", val);\n } else {\n this.removeAttribute(\"mode\");\n }\n }\n\n get environment(): Environment {\n return this.getAttribute(\"environment\") as Environment;\n }\n\n set environment(val) {\n if (val) {\n this.setAttribute(\"environment\", val);\n } else {\n this.removeAttribute(\"environment\");\n }\n }\n\n get token() {\n return this.getAttribute(\"token\") as string;\n }\n\n set token(val: string) {\n if (val) {\n this.setAttribute(\"token\", val);\n } else {\n this.removeAttribute(\"token\");\n }\n }\n\n connectedCallback() {\n const iframeSrc = `${envToBaseUrlMapWidget[this.environment]}?token=${\n this.token\n }&environment=${this.environment}`;\n\n const iframe = document.createElement(\"iframe\");\n iframe.src = iframeSrc;\n iframe.width = `100%`;\n iframe.height = `100%`;\n iframe.style.borderStyle = \"solid\";\n iframe.style.borderRadius = \"10px\";\n iframe.style.borderColor = \"transparent\";\n this._iframe = iframe;\n\n this.shadowRoot?.appendChild(iframe);\n }\n\n disconnectedCallback() {\n if (this.shadowRoot) this.shadowRoot.innerHTML = \"\";\n }\n}\n\ncustomElements.define(\"lvble-widget\", LvbleWidget);\n\nconst modeWidgetMap: Record<\n Extract<Mode, \"onboarding\" | \"repay\">,\n CustomElementConstructor | undefined\n> = {\n onboarding: customElements.get(\"lvble-widget\"),\n repay: customElements.get(\"lvble-widget\"),\n};\n\nlet _popup: Window;\n\nconst lvble = (initOptions: InitOptions) => {\n return {\n /**\n * This function creates a widget that can be embedded in your website.\n *\n * @param createOptions The options for creating the widget. See CreateWidgetOptions for more information.\n * @returns The widget.\n */\n // TODO: Add support for no mode\n createWidget: (createOptions: CreateWidgetOptions) => {\n const widget = new LvbleWidget()\n \n // (\n // createOptions.mode\n // ? new modeWidgetMap[createOptions.mode]!()\n // : new (customElements.get(\n // \"lvble-widget\"\n // ) as CustomElementConstructor)()\n // ) as LvbleWidget;\n widget.environment = initOptions.environment;\n widget.token = initOptions.token;\n widget.mode = createOptions.mode;\n\n function messageListener(message: MessageEvent) {\n if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {\n console.debug(\n `Received message from unknown origin: ${message.origin}`\n );\n return;\n }\n\n const data = message.data;\n createOptions.onEvent(data.eventType, data.data);\n };\n\n window.removeEventListener(\"message\", messageListener);\n window.addEventListener(\"message\", messageListener);\n return widget;\n },\n /**\n * This function opens a popup with the relevant mode.\n * @param openOptions The options for opening the widget. See OpenOptions for more information.\n * @returns undefined.\n */\n open: (openOptions: OpenOptions) => {\n const modeUrlMap: Record<Mode, string> = {\n onboarding: `${\n envToBaseUrlMapExperience[initOptions.environment]\n }?token=${initOptions.token}`,\n offboarding: `${\n envToBaseUrlMapExperience[initOptions.environment]\n }?token=${initOptions.token}`,\n split: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${\n initOptions.token\n }`,\n repay: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${\n initOptions.token\n }`,\n };\n\n const modeUrl = openOptions.mode ? \n modeUrlMap[openOptions.mode] : \n `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`;\n\n const w = 450;\n const h = 800;\n const l = screen.width / 2 - w / 2;\n const t = screen.height / 2 - h / 2;\n _popup = window.open(\n modeUrl,\n \"LvblePopup\",\n \"width=\" + w + \",height=\" + h + \",location=no,left=\" + l + \",top=\" + t\n ) as Window;\n\n function messageListener(message: MessageEvent) {\n if (\n message.origin != envToBaseUrlMapExperience[initOptions.environment]\n ) {\n console.debug(\n `Received message from unknown origin: ${message.origin}`\n );\n return;\n }\n const eventData = message.data;\n const iframes = document.querySelectorAll(\"lvble-widget\");\n\n message = JSON.parse(JSON.stringify(message));\n\n iframes.forEach((w) => {\n (\n w.shadowRoot?.querySelector(\"iframe\") as HTMLIFrameElement\n ).contentWindow?.postMessage(eventData, \"*\");\n });\n\n openOptions.onEvent(eventData.eventType, eventData.data);\n };\n \n window.removeEventListener(\"message\", messageListener);\n window.addEventListener(\"message\", messageListener);\n },\n };\n};\n\nexport type LvbleType = ReturnType<typeof lvble>;\n\nexport const Lvble = lvble;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(915);\n"],"names":["root","factory","exports","module","define","amd","self","Environment","envToBaseUrlMapWidget","Local","Dev","Sandbox","Production","envToBaseUrlMapExperience","EventType","FinishOnboarding","FinishOffboarding","FinishSplit","FinishRepay","LvbleWidget","HTMLElement","constructor","super","onboarding","offboarding","split","repay","this","attachShadow","mode","getAttribute","val","setAttribute","removeAttribute","environment","token","connectedCallback","iframeSrc","iframe","document","createElement","src","width","height","style","borderStyle","borderRadius","borderColor","_iframe","shadowRoot","appendChild","disconnectedCallback","innerHTML","_popup","customElements","get","Lvble","initOptions","createWidget","createOptions","widget","messageListener","message","origin","console","debug","data","onEvent","eventType","window","removeEventListener","addEventListener","open","openOptions","modeUrlMap","modeUrl","l","screen","w","t","h","eventData","iframes","querySelectorAll","JSON","parse","stringify","forEach","querySelector","contentWindow","postMessage","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"core.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,QAAS,GAAIH,GACM,iBAAZC,QACdA,QAAe,MAAID,IAEnBD,EAAY,MAAIC,GACjB,CATD,CASGK,MAAM,I,mhBCTT,W,cCAA,IAAYC,E,8EAAZ,SAAYA,GACV,gBACA,oBACA,oBACA,yBACD,CALD,CAAYA,IAAW,cAAXA,EAAW,KAMvB,MAAMC,EAAqD,CACzD,CAACD,EAAYE,OAAQ,wBACrB,CAACF,EAAYG,KAAM,8CACnB,CAACH,EAAYI,SAAU,0CACvB,CAACJ,EAAYK,YAAa,8CAGtBC,EAAyD,CAC7D,CAACN,EAAYE,OAAQ,wBACrB,CAACF,EAAYG,KAAM,kDACnB,CAACH,EAAYI,SAAU,8CACvB,CAACJ,EAAYK,YAAa,kDA8B5B,IAAKE,GAAL,SAAKA,GACH,sCACA,wCACA,4BACA,2BACD,CALD,CAAKA,IAAAA,EAAS,KAQAA,EAAUC,iBACTD,EAAUE,kBAChBF,EAAUG,YACVH,EAAUI,YAuBnB,MAAMC,UAAoBC,YASxB,WAAAC,GACEC,QATF,2C,gDAAe,CACbC,WAAYT,EAAUC,iBACtBS,YAAaV,EAAUE,kBACvBS,MAAOX,EAAUG,YACjBS,MAAOZ,EAAUI,eAEnB,sC,yDAIES,KAAKC,aAAa,CAAEC,KAAM,QAC5B,CAEA,QAAI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,IAAIC,EAASyF,EAAyBE,GAAY,CAGjD5F,QAAS,CAAC,GAOX,OAHA+F,EAAoBH,GAAUI,KAAK/F,EAAOD,QAASC,EAAQA,EAAOD,QAAS2F,GAGpE1F,EAAOD,OACf,CCnB0B2F,CAAoB,I","sources":["webpack://MyLib/webpack/universalModuleDefinition","webpack://MyLib/./src/lib/index.ts","webpack://MyLib/./src/lib/lvble.ts","webpack://MyLib/webpack/bootstrap","webpack://MyLib/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"MyLib\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"MyLib\"] = factory();\n\telse\n\t\troot[\"MyLib\"] = factory();\n})(self, () => {\nreturn ","export * from './lvble'\n","export enum Environment {\n Local = \"local\",\n Dev = \"development\",\n Sandbox = \"sandbox\",\n Production = \"production\",\n}\nconst envToBaseUrlMapWidget: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\n [Environment.Dev]: \"https://widget.pms.development.nowlvble.com\",\n [Environment.Sandbox]: \"https://widget.pms.sandbox.nowlvble.com\",\n [Environment.Production]: \"https://widget.pms.production.nowlvble.com\",\n};\n\nconst envToBaseUrlMapExperience: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3000\",\n [Environment.Dev]: \"https://experience.pms.development.nowlvble.com\",\n [Environment.Sandbox]: \"https://experience.pms.sandbox.nowlvble.com\",\n [Environment.Production]: \"https://experience.pms.production.nowlvble.com\",\n};\n\nexport type Mode = \"onboarding\" | \"offboarding\" | \"split\" | \"repay\";\nexport type ErrorData = {\n type: \"error\";\n reason: string;\n};\nexport type OnboardingData =\n | ErrorData\n | {\n type: \"success\";\n status: string;\n };\nexport type SplitData =\n | ErrorData\n | {\n type: \"success\";\n external_id: string;\n settlement_id: string;\n amount: number;\n };\nexport type CloseData =\n | ErrorData\n | {\n type: \"close\";\n };\n// TODO: Make this the event type in the onEvent callback signature\nexport type EventData = OnboardingData | SplitData | CloseData;\n\nenum EventType {\n FinishOnboarding = \"finishOnboarding\",\n FinishOffboarding = \"finishOffboarding\",\n FinishSplit = \"finishSplit\",\n FinishRepay = \"finishRepay\",\n}\n\nconst modeToEventType = {\n onboarding: EventType.FinishOnboarding,\n offboarding: EventType.FinishOffboarding,\n split: EventType.FinishSplit,\n repay: EventType.FinishRepay,\n};\n\nexport interface InitOptions {\n // The environment to use.\n environment: Environment;\n // The widget token to use.\n token: string;\n}\n\nexport interface OpenOptions {\n // The mode to open the popup in. See Mode for more information.\n mode?: Mode;\n // The callback to invoke when the popup has sent an event (e.g. user clicked a button).\n onEvent: (eventType: string, data: any) => void;\n}\n\nexport interface CreateWidgetOptions extends OpenOptions {\n mode?: Extract<Mode, \"onboarding\" | \"repay\">;\n // The callback to invoke when the popup has sent an event (e.g. user clicked a button).\n onEvent: (eventType: string, data: any) => void;\n}\n\nclass LvbleWidget extends HTMLElement {\n _typeToEvent = {\n onboarding: EventType.FinishOnboarding,\n offboarding: EventType.FinishOffboarding,\n split: EventType.FinishSplit,\n repay: EventType.FinishRepay,\n };\n _iframe?: HTMLIFrameElement;\n\n constructor() {\n super();\n this.attachShadow({ mode: \"open\" });\n }\n\n get mode(): Mode {\n return this.getAttribute(\"mode\") as Mode;\n }\n\n set mode(val: Mode | undefined) {\n if (val) {\n this.setAttribute(\"mode\", val);\n } else {\n this.removeAttribute(\"mode\");\n }\n }\n\n get environment(): Environment {\n return this.getAttribute(\"environment\") as Environment;\n }\n\n set environment(val) {\n if (val) {\n this.setAttribute(\"environment\", val);\n } else {\n this.removeAttribute(\"environment\");\n }\n }\n\n get token() {\n return this.getAttribute(\"token\") as string;\n }\n\n set token(val: string) {\n if (val) {\n this.setAttribute(\"token\", val);\n } else {\n this.removeAttribute(\"token\");\n }\n }\n\n connectedCallback() {\n const iframeSrc = `${envToBaseUrlMapWidget[this.environment]}?token=${\n this.token\n }&environment=${this.environment}`;\n\n const iframe = document.createElement(\"iframe\");\n iframe.src = iframeSrc;\n iframe.width = `100%`;\n iframe.height = `100%`;\n iframe.style.borderStyle = \"solid\";\n iframe.style.borderRadius = \"10px\";\n iframe.style.borderColor = \"transparent\";\n this._iframe = iframe;\n\n this.shadowRoot?.appendChild(iframe);\n }\n\n disconnectedCallback() {\n if (this.shadowRoot) this.shadowRoot.innerHTML = \"\";\n }\n}\n\ncustomElements.define(\"lvble-widget\", LvbleWidget);\n\nconst modeWidgetMap: Record<\n Extract<Mode, \"onboarding\" | \"repay\">,\n CustomElementConstructor | undefined\n> = {\n onboarding: customElements.get(\"lvble-widget\"),\n repay: customElements.get(\"lvble-widget\"),\n};\n\nlet _popup: Window;\n\nconst lvble = (initOptions: InitOptions) => {\n return {\n /**\n * This function creates a widget that can be embedded in your website.\n *\n * @param createOptions The options for creating the widget. See CreateWidgetOptions for more information.\n * @returns The widget.\n */\n // TODO: Add support for no mode\n createWidget: (createOptions: CreateWidgetOptions) => {\n const widget = new LvbleWidget()\n \n // (\n // createOptions.mode\n // ? new modeWidgetMap[createOptions.mode]!()\n // : new (customElements.get(\n // \"lvble-widget\"\n // ) as CustomElementConstructor)()\n // ) as LvbleWidget;\n widget.environment = initOptions.environment;\n widget.token = initOptions.token;\n widget.mode = createOptions.mode;\n\n var messageListenerLvble = function messageListener(message: MessageEvent) {\n if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {\n console.debug(\n `Received message from unknown origin: ${message.origin}`\n );\n return;\n }\n\n const data = message.data;\n createOptions.onEvent(data.eventType, data.data);\n };\n\n window.removeEventListener(\"message\", messageListenerLvble);\n window.addEventListener(\"message\", messageListenerLvble);\n return widget;\n },\n /**\n * This function opens a popup with the relevant mode.\n * @param openOptions The options for opening the widget. See OpenOptions for more information.\n * @returns undefined.\n */\n open: (openOptions: OpenOptions) => {\n const modeUrlMap: Record<Mode, string> = {\n onboarding: `${\n envToBaseUrlMapExperience[initOptions.environment]\n }?token=${initOptions.token}`,\n offboarding: `${\n envToBaseUrlMapExperience[initOptions.environment]\n }?token=${initOptions.token}`,\n split: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${\n initOptions.token\n }`,\n repay: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${\n initOptions.token\n }`,\n };\n\n const modeUrl = openOptions.mode ? \n modeUrlMap[openOptions.mode] : \n `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`;\n\n const w = 450;\n const h = 800;\n const l = screen.width / 2 - w / 2;\n const t = screen.height / 2 - h / 2;\n _popup = window.open(\n modeUrl,\n \"LvblePopup\",\n \"width=\" + w + \",height=\" + h + \",location=no,left=\" + l + \",top=\" + t\n ) as Window;\n\n var messageListenerOpen = function messageListener(message: MessageEvent) {\n if (\n message.origin != envToBaseUrlMapExperience[initOptions.environment]\n ) {\n console.debug(\n `Received message from unknown origin: ${message.origin}`\n );\n return;\n }\n const eventData = message.data;\n const iframes = document.querySelectorAll(\"lvble-widget\");\n\n message = JSON.parse(JSON.stringify(message));\n\n iframes.forEach((w) => {\n (\n w.shadowRoot?.querySelector(\"iframe\") as HTMLIFrameElement\n ).contentWindow?.postMessage(eventData, \"*\");\n });\n\n openOptions.onEvent(eventData.eventType, eventData.data);\n };\n\n window.removeEventListener(\"message\", messageListenerOpen);\n window.addEventListener(\"message\", messageListenerOpen);\n },\n };\n};\n\nexport type LvbleType = ReturnType<typeof lvble>;\n\nexport const Lvble = lvble;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(915);\n"],"names":["root","factory","exports","module","define","amd","self","Environment","envToBaseUrlMapWidget","Local","Dev","Sandbox","Production","envToBaseUrlMapExperience","EventType","FinishOnboarding","FinishOffboarding","FinishSplit","FinishRepay","LvbleWidget","HTMLElement","constructor","super","onboarding","offboarding","split","repay","this","attachShadow","mode","getAttribute","val","setAttribute","removeAttribute","environment","token","connectedCallback","iframeSrc","iframe","document","createElement","src","width","height","style","borderStyle","borderRadius","borderColor","_iframe","shadowRoot","appendChild","disconnectedCallback","innerHTML","_popup","customElements","get","Lvble","initOptions","createWidget","createOptions","widget","messageListenerLvble","message","origin","console","debug","data","onEvent","eventType","window","removeEventListener","addEventListener","open","openOptions","modeUrlMap","modeUrl","l","screen","w","t","h","messageListenerOpen","eventData","iframes","querySelectorAll","JSON","parse","stringify","forEach","querySelector","contentWindow","postMessage","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
|
package/dist/lib/lvble.js
CHANGED
|
@@ -133,17 +133,16 @@ const lvble = (initOptions) => {
|
|
|
133
133
|
widget.environment = initOptions.environment;
|
|
134
134
|
widget.token = initOptions.token;
|
|
135
135
|
widget.mode = createOptions.mode;
|
|
136
|
-
function messageListener(message) {
|
|
136
|
+
var messageListenerLvble = function messageListener(message) {
|
|
137
137
|
if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {
|
|
138
138
|
console.debug(`Received message from unknown origin: ${message.origin}`);
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
const data = message.data;
|
|
142
142
|
createOptions.onEvent(data.eventType, data.data);
|
|
143
|
-
}
|
|
144
|
-
;
|
|
145
|
-
window.
|
|
146
|
-
window.addEventListener("message", messageListener);
|
|
143
|
+
};
|
|
144
|
+
window.removeEventListener("message", messageListenerLvble);
|
|
145
|
+
window.addEventListener("message", messageListenerLvble);
|
|
147
146
|
return widget;
|
|
148
147
|
},
|
|
149
148
|
/**
|
|
@@ -166,7 +165,7 @@ const lvble = (initOptions) => {
|
|
|
166
165
|
const l = screen.width / 2 - w / 2;
|
|
167
166
|
const t = screen.height / 2 - h / 2;
|
|
168
167
|
_popup = window.open(modeUrl, "LvblePopup", "width=" + w + ",height=" + h + ",location=no,left=" + l + ",top=" + t);
|
|
169
|
-
function messageListener(message) {
|
|
168
|
+
var messageListenerOpen = function messageListener(message) {
|
|
170
169
|
if (message.origin != envToBaseUrlMapExperience[initOptions.environment]) {
|
|
171
170
|
console.debug(`Received message from unknown origin: ${message.origin}`);
|
|
172
171
|
return;
|
|
@@ -179,10 +178,9 @@ const lvble = (initOptions) => {
|
|
|
179
178
|
(_b = ((_a = w.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("iframe")).contentWindow) === null || _b === void 0 ? void 0 : _b.postMessage(eventData, "*");
|
|
180
179
|
});
|
|
181
180
|
openOptions.onEvent(eventData.eventType, eventData.data);
|
|
182
|
-
}
|
|
183
|
-
;
|
|
184
|
-
window.
|
|
185
|
-
window.addEventListener("message", messageListener);
|
|
181
|
+
};
|
|
182
|
+
window.removeEventListener("message", messageListenerOpen);
|
|
183
|
+
window.addEventListener("message", messageListenerOpen);
|
|
186
184
|
},
|
|
187
185
|
};
|
|
188
186
|
};
|
package/dist/lib/lvble.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lvble.js","sourceRoot":"","sources":["../../src/lib/lvble.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;AAC3B,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AACD,MAAM,qBAAqB,GAAgC;IACzD,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,uBAA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OAAO,GAAG,CAAC,CAC7D,CAAC;YAEZ,IAAI,mBAAmB,GAAG,SAAS,eAAe,CAAC,OAAqB;gBACtE,IACE,OAAO,CAAC,MAAM,IAAI,yBAAyB,CAAC,WAAW,CAAC,WAAW,CAAC,EACpE;oBACA,OAAO,CAAC,KAAK,CACX,yCAAyC,OAAO,CAAC,MAAM,EAAE,CAC1D,CAAC;oBACF,OAAO;iBACR;gBACD,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;gBAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;gBAE1D,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;gBAE9C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;;oBACpB,MAAA,CACE,MAAA,CAAC,CAAC,UAAU,0CAAE,aAAa,CAAC,QAAQ,CACrC,CAAA,CAAC,aAAa,0CAAE,WAAW,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAC;gBAEH,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;YAC3D,CAAC,CAAC;YAEF,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;YAC3D,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAIW,QAAA,KAAK,GAAG,KAAK,CAAC"}
|
package/dist/lib-esm/lvble.js
CHANGED
|
@@ -130,17 +130,16 @@ const lvble = (initOptions) => {
|
|
|
130
130
|
widget.environment = initOptions.environment;
|
|
131
131
|
widget.token = initOptions.token;
|
|
132
132
|
widget.mode = createOptions.mode;
|
|
133
|
-
function messageListener(message) {
|
|
133
|
+
var messageListenerLvble = function messageListener(message) {
|
|
134
134
|
if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {
|
|
135
135
|
console.debug(`Received message from unknown origin: ${message.origin}`);
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
const data = message.data;
|
|
139
139
|
createOptions.onEvent(data.eventType, data.data);
|
|
140
|
-
}
|
|
141
|
-
;
|
|
142
|
-
window.
|
|
143
|
-
window.addEventListener("message", messageListener);
|
|
140
|
+
};
|
|
141
|
+
window.removeEventListener("message", messageListenerLvble);
|
|
142
|
+
window.addEventListener("message", messageListenerLvble);
|
|
144
143
|
return widget;
|
|
145
144
|
},
|
|
146
145
|
/**
|
|
@@ -163,7 +162,7 @@ const lvble = (initOptions) => {
|
|
|
163
162
|
const l = screen.width / 2 - w / 2;
|
|
164
163
|
const t = screen.height / 2 - h / 2;
|
|
165
164
|
_popup = window.open(modeUrl, "LvblePopup", "width=" + w + ",height=" + h + ",location=no,left=" + l + ",top=" + t);
|
|
166
|
-
function messageListener(message) {
|
|
165
|
+
var messageListenerOpen = function messageListener(message) {
|
|
167
166
|
if (message.origin != envToBaseUrlMapExperience[initOptions.environment]) {
|
|
168
167
|
console.debug(`Received message from unknown origin: ${message.origin}`);
|
|
169
168
|
return;
|
|
@@ -176,10 +175,9 @@ const lvble = (initOptions) => {
|
|
|
176
175
|
(_b = ((_a = w.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("iframe")).contentWindow) === null || _b === void 0 ? void 0 : _b.postMessage(eventData, "*");
|
|
177
176
|
});
|
|
178
177
|
openOptions.onEvent(eventData.eventType, eventData.data);
|
|
179
|
-
}
|
|
180
|
-
;
|
|
181
|
-
window.
|
|
182
|
-
window.addEventListener("message", messageListener);
|
|
178
|
+
};
|
|
179
|
+
window.removeEventListener("message", messageListenerOpen);
|
|
180
|
+
window.addEventListener("message", messageListenerOpen);
|
|
183
181
|
},
|
|
184
182
|
};
|
|
185
183
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lvble.js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