@lvble/core 2.0.21 → 2.0.23
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.d.ts +1 -0
- package/dist/lib/lvble.d.ts.map +1 -1
- package/dist/lib/lvble.js +11 -4
- package/dist/lib/lvble.js.map +1 -1
- package/dist/lib-esm/lvble.d.ts +1 -0
- package/dist/lib-esm/lvble.d.ts.map +1 -1
- package/dist/lib-esm/lvble.js +11 -4
- 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.Sandbox="sandbox",e.Production="production"}(n||(t.Environment=n={}));const o={[n.Local]:"http://localhost:3001",[n.Sandbox]:"https://widget.pms.sandbox.nowlvble.com",[n.Production]:"https://widget.pms.production.nowlvble.com"},i={[n.Local]:"http://localhost:3000",[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;function i(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 n.environment=e.environment,n.token=e.token,n.mode=t.mode,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;function a(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)}d=window.open(o,"LvblePopup","width=450,height=800,location=no,left="+r+",top="+s),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,MA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AUG,GA0BvEhB,OAAOC,iBAAiB,WAvBCC,IACvB,GACEA,EAAQC,QAAUnD,EAA0B4C,EAAYvB,aAKxD,YAHA+B,QAAQC,MACN,yCAAyCH,EAAQC,UAIrD,MAAMe,EAAYhB,EAAQI,KACpBa,EAAUzC,SAAS0C,iBAAiB,gBAE1ClB,EAAUmB,KAAKC,MAAMD,KAAKE,UAAUrB,IAEpCiB,EAAQK,SAAST,I,QAGA,QAFd,GACa,QAAZ,EAAAA,EAAE3B,kBAAU,eAAEqC,cAAc,WAC5BC,qBAAa,SAAEC,YAAYT,EAAW,IAAI,IAG9CR,EAAYH,QAAQW,EAAUV,UAAWU,EAAUZ,KAAK,GAGP,G,GChQrDsB,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAazF,QAGrB,IAAIC,EAASqF,EAAyBE,GAAY,CAGjDxF,QAAS,CAAC,GAOX,OAHA2F,EAAoBH,GAAUI,KAAK3F,EAAOD,QAASC,EAAQA,EAAOD,QAASuF,GAGpEtF,EAAOD,OACf,CCnB0BuF,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 Sandbox = \"sandbox\",\n Production = \"production\",\n}\nconst envToBaseUrlMapWidget: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\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.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 const 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 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 const 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.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","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","window","addEventListener","message","origin","console","debug","data","onEvent","eventType","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,Q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AYtB,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,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.Sandbox="sandbox",e.Production="production"}(n||(t.Environment=n={}));const o={[n.Local]:"http://localhost:3001",[n.Sandbox]:"https://widget.pms.sandbox.nowlvble.com",[n.Production]:"https://widget.pms.production.nowlvble.com"},i={[n.Local]:"http://localhost:3000",[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;function i(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 n.environment=e.environment,n.token=e.token,n.mode=t.mode,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;function a(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)}d=window.open(o,"LvblePopup","width=450,height=800,location=no,left="+r+",top="+s),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,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,yBACD,CAJD,CAAYA,IAAW,cAAXA,EAAW,KAKvB,MAAMC,EAAqD,CACzD,CAACD,EAAYE,OAAQ,wBACrB,CAACF,EAAYG,SAAU,0CACvB,CAACH,EAAYI,YAAa,8CAGtBC,EAAyD,CAC7D,CAACL,EAAYE,OAAQ,wBACrB,CAACF,EAAYG,SAAU,8CACvB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,kBAAU,eAAEqC,cAAc,WAC5BC,qBAAa,SAAEC,YAAYT,EAAW,IAAI,IAG9CR,EAAYH,QAAQW,EAAUV,UAAWU,EAAUZ,KAAK,GAGP,G,GChQrDsB,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAazF,QAGrB,IAAIC,EAASqF,EAAyBE,GAAY,CAGjDxF,QAAS,CAAC,GAOX,OAHA2F,EAAoBH,GAAUI,KAAK3F,EAAOD,QAASC,EAAQA,EAAOD,QAASuF,GAGpEtF,EAAOD,OACf,CCnB0BuF,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 Sandbox = \"sandbox\",\n Production = \"production\",\n}\nconst envToBaseUrlMapWidget: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\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.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 const 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 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 const 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.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","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","window","addEventListener","message","origin","console","debug","data","onEvent","eventType","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,EAAy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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":""}
|
package/dist/lib/lvble.d.ts
CHANGED
package/dist/lib/lvble.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lvble.d.ts","sourceRoot":"","sources":["../../src/lib/lvble.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;
|
|
1
|
+
{"version":3,"file":"lvble.d.ts","sourceRoot":"","sources":["../../src/lib/lvble.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,GAAG,gBAAgB;IACnB,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAeD,MAAM,MAAM,IAAI,GAAG,YAAY,GAAG,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,cAAc,GACtB,SAAS,GACT;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACN,MAAM,MAAM,SAAS,GACjB,SAAS,GACT;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACN,MAAM,MAAM,SAAS,GACjB,SAAS,GACT;IACE,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEN,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/D,aAAK,SAAS;IACZ,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;CAC5B;AASD,MAAM,WAAW,WAAW;IAE1B,WAAW,EAAE,WAAW,CAAC;IAEzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAE1B,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC;IAE7C,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACjD;AAED,cAAM,WAAY,SAAQ,WAAW;IACnC,YAAY;;;;;MAKV;IACF,OAAO,CAAC,EAAE,iBAAiB,CAAC;;IAO5B,IAAI,IAAI,IAAI,IAAI,CAEf;IAED,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,GAAG,SAAS,EAM7B;IAED,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,IAAI,WAAW,CAAC,GAAG,EAJA,WAIA,EAMlB;IAED,IAAI,KAAK,IAIM,MAAM,CAFpB;IAED,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM,EAMpB;IAED,iBAAiB;IAiBjB,oBAAoB;CAGrB;AAcD,QAAA,MAAM,KAAK,gBAAiB,WAAW;IAEnC;;;;;OAKG;kCAE2B,mBAAmB;IA8BjD;;;;OAIG;wBACiB,WAAW;CAyDlC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAEjD,eAAO,MAAM,KAAK,gBAzGU,WAAW;IAEnC;;;;;OAKG;kCAE2B,mBAAmB;IA8BjD;;;;OAIG;wBACiB,WAAW;CA6DT,CAAC"}
|
package/dist/lib/lvble.js
CHANGED
|
@@ -4,16 +4,19 @@ exports.Lvble = exports.Environment = void 0;
|
|
|
4
4
|
var Environment;
|
|
5
5
|
(function (Environment) {
|
|
6
6
|
Environment["Local"] = "local";
|
|
7
|
+
Environment["Dev"] = "development";
|
|
7
8
|
Environment["Sandbox"] = "sandbox";
|
|
8
9
|
Environment["Production"] = "production";
|
|
9
10
|
})(Environment || (exports.Environment = Environment = {}));
|
|
10
11
|
const envToBaseUrlMapWidget = {
|
|
11
12
|
[Environment.Local]: "http://localhost:3001",
|
|
13
|
+
[Environment.Dev]: "https://widget.pms.development.nowlvble.com",
|
|
12
14
|
[Environment.Sandbox]: "https://widget.pms.sandbox.nowlvble.com",
|
|
13
15
|
[Environment.Production]: "https://widget.pms.production.nowlvble.com",
|
|
14
16
|
};
|
|
15
17
|
const envToBaseUrlMapExperience = {
|
|
16
18
|
[Environment.Local]: "http://localhost:3000",
|
|
19
|
+
[Environment.Dev]: "https://experience.pms.development.nowlvble.com",
|
|
17
20
|
[Environment.Sandbox]: "https://experience.pms.sandbox.nowlvble.com",
|
|
18
21
|
[Environment.Production]: "https://experience.pms.production.nowlvble.com",
|
|
19
22
|
};
|
|
@@ -130,14 +133,16 @@ const lvble = (initOptions) => {
|
|
|
130
133
|
widget.environment = initOptions.environment;
|
|
131
134
|
widget.token = initOptions.token;
|
|
132
135
|
widget.mode = createOptions.mode;
|
|
133
|
-
|
|
136
|
+
function messageListener(message) {
|
|
134
137
|
if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {
|
|
135
138
|
console.debug(`Received message from unknown origin: ${message.origin}`);
|
|
136
139
|
return;
|
|
137
140
|
}
|
|
138
141
|
const data = message.data;
|
|
139
142
|
createOptions.onEvent(data.eventType, data.data);
|
|
140
|
-
}
|
|
143
|
+
}
|
|
144
|
+
;
|
|
145
|
+
window.removeEventListener("message", messageListener);
|
|
141
146
|
window.addEventListener("message", messageListener);
|
|
142
147
|
return widget;
|
|
143
148
|
},
|
|
@@ -161,7 +166,7 @@ const lvble = (initOptions) => {
|
|
|
161
166
|
const l = screen.width / 2 - w / 2;
|
|
162
167
|
const t = screen.height / 2 - h / 2;
|
|
163
168
|
_popup = window.open(modeUrl, "LvblePopup", "width=" + w + ",height=" + h + ",location=no,left=" + l + ",top=" + t);
|
|
164
|
-
|
|
169
|
+
function messageListener(message) {
|
|
165
170
|
if (message.origin != envToBaseUrlMapExperience[initOptions.environment]) {
|
|
166
171
|
console.debug(`Received message from unknown origin: ${message.origin}`);
|
|
167
172
|
return;
|
|
@@ -174,7 +179,9 @@ const lvble = (initOptions) => {
|
|
|
174
179
|
(_b = ((_a = w.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("iframe")).contentWindow) === null || _b === void 0 ? void 0 : _b.postMessage(eventData, "*");
|
|
175
180
|
});
|
|
176
181
|
openOptions.onEvent(eventData.eventType, eventData.data);
|
|
177
|
-
}
|
|
182
|
+
}
|
|
183
|
+
;
|
|
184
|
+
window.removeEventListener("message", messageListener);
|
|
178
185
|
window.addEventListener("message", messageListener);
|
|
179
186
|
},
|
|
180
187
|
};
|
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,
|
|
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,uBAAuB;IAC5C,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,6CAA6C;IAChE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,yCAAyC;IAChE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,4CAA4C;CACvE,CAAC;AAEF,MAAM,yBAAyB,GAAgC;IAC7D,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,uBAAuB;IAC5C,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,iDAAiD;IACpE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,6CAA6C;IACpE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE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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;YAAA,CAAC;YAEF,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;YACvD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QACtD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAIW,QAAA,KAAK,GAAG,KAAK,CAAC"}
|
package/dist/lib-esm/lvble.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lvble.d.ts","sourceRoot":"","sources":["../../src/lib/lvble.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;
|
|
1
|
+
{"version":3,"file":"lvble.d.ts","sourceRoot":"","sources":["../../src/lib/lvble.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,GAAG,gBAAgB;IACnB,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAeD,MAAM,MAAM,IAAI,GAAG,YAAY,GAAG,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,cAAc,GACtB,SAAS,GACT;IACE,IAAI,EAAE,SAAS,CAA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B;IAED,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM,EAMpB;IAED,iBAAiB;IAiBjB,oBAAoB;CAGrB;AAcD,QAAA,MAAM,KAAK,gBAAiB,WAAW;IAEnC;;;;;OAKG;kCAE2B,mBAAmB;IA8BjD;;;;OAIG;wBACiB,WAAW;CAyDlC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAEjD,eAAO,MAAM,KAAK,gBAzGU,WAAW;IAEnC;;;;;OAKG;kCAE2B,mBAAmB;IA8BjD;;;;OAIG;wBACiB,WAAW;CA6DT,CAAC"}
|
package/dist/lib-esm/lvble.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
export var Environment;
|
|
2
2
|
(function (Environment) {
|
|
3
3
|
Environment["Local"] = "local";
|
|
4
|
+
Environment["Dev"] = "development";
|
|
4
5
|
Environment["Sandbox"] = "sandbox";
|
|
5
6
|
Environment["Production"] = "production";
|
|
6
7
|
})(Environment || (Environment = {}));
|
|
7
8
|
const envToBaseUrlMapWidget = {
|
|
8
9
|
[Environment.Local]: "http://localhost:3001",
|
|
10
|
+
[Environment.Dev]: "https://widget.pms.development.nowlvble.com",
|
|
9
11
|
[Environment.Sandbox]: "https://widget.pms.sandbox.nowlvble.com",
|
|
10
12
|
[Environment.Production]: "https://widget.pms.production.nowlvble.com",
|
|
11
13
|
};
|
|
12
14
|
const envToBaseUrlMapExperience = {
|
|
13
15
|
[Environment.Local]: "http://localhost:3000",
|
|
16
|
+
[Environment.Dev]: "https://experience.pms.development.nowlvble.com",
|
|
14
17
|
[Environment.Sandbox]: "https://experience.pms.sandbox.nowlvble.com",
|
|
15
18
|
[Environment.Production]: "https://experience.pms.production.nowlvble.com",
|
|
16
19
|
};
|
|
@@ -127,14 +130,16 @@ const lvble = (initOptions) => {
|
|
|
127
130
|
widget.environment = initOptions.environment;
|
|
128
131
|
widget.token = initOptions.token;
|
|
129
132
|
widget.mode = createOptions.mode;
|
|
130
|
-
|
|
133
|
+
function messageListener(message) {
|
|
131
134
|
if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {
|
|
132
135
|
console.debug(`Received message from unknown origin: ${message.origin}`);
|
|
133
136
|
return;
|
|
134
137
|
}
|
|
135
138
|
const data = message.data;
|
|
136
139
|
createOptions.onEvent(data.eventType, data.data);
|
|
137
|
-
}
|
|
140
|
+
}
|
|
141
|
+
;
|
|
142
|
+
window.removeEventListener("message", messageListener);
|
|
138
143
|
window.addEventListener("message", messageListener);
|
|
139
144
|
return widget;
|
|
140
145
|
},
|
|
@@ -158,7 +163,7 @@ const lvble = (initOptions) => {
|
|
|
158
163
|
const l = screen.width / 2 - w / 2;
|
|
159
164
|
const t = screen.height / 2 - h / 2;
|
|
160
165
|
_popup = window.open(modeUrl, "LvblePopup", "width=" + w + ",height=" + h + ",location=no,left=" + l + ",top=" + t);
|
|
161
|
-
|
|
166
|
+
function messageListener(message) {
|
|
162
167
|
if (message.origin != envToBaseUrlMapExperience[initOptions.environment]) {
|
|
163
168
|
console.debug(`Received message from unknown origin: ${message.origin}`);
|
|
164
169
|
return;
|
|
@@ -171,7 +176,9 @@ const lvble = (initOptions) => {
|
|
|
171
176
|
(_b = ((_a = w.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("iframe")).contentWindow) === null || _b === void 0 ? void 0 : _b.postMessage(eventData, "*");
|
|
172
177
|
});
|
|
173
178
|
openOptions.onEvent(eventData.eventType, eventData.data);
|
|
174
|
-
}
|
|
179
|
+
}
|
|
180
|
+
;
|
|
181
|
+
window.removeEventListener("message", messageListener);
|
|
175
182
|
window.addEventListener("message", messageListener);
|
|
176
183
|
},
|
|
177
184
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lvble.js","sourceRoot":"","sources":["../../src/lib/lvble.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"lvble.js","sourceRoot":"","sources":["../../src/l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