@lvble/core 2.0.17 → 2.0.19

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.
@@ -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:function(e,t){var n,o,i,r,c,a=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)});Object.defineProperty(t,"__esModule",{value:!0}),t.Lvble=t.Environment=void 0,function(e){e.Local="local",e.Sandbox="sandbox",e.Production="production"}(c||(t.Environment=c={}));var s,l=((o={})[c.Local]="http://localhost:3001",o[c.Sandbox]="https://widget.sandbox.pms.nowlvble.com",o[c.Production]="https://api.production.partners.nowlvble.com",o),u=((i={})[c.Local]="http://localhost:3001",i[c.Sandbox]="https://experience.sandbox.pms.nowlvble.com",i[c.Production]="https://api.production.partners.nowlvble.com",i);!function(e){e.FinishOnboarding="finishOnboarding",e.FinishOffboarding="finishOffboarding",e.FinishSplit="finishSplit",e.FinishRepay="finishRepay"}(s||(s={})),s.FinishOnboarding,s.FinishOffboarding,s.FinishSplit,s.FinishRepay;var d=function(e){function t(){var t=e.call(this)||this;return Object.defineProperty(t,"_typeToEvent",{enumerable:!0,configurable:!0,writable:!0,value:{onboarding:s.FinishOnboarding,offboarding:s.FinishOffboarding,split:s.FinishSplit,repay:s.FinishRepay}}),Object.defineProperty(t,"_iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.attachShadow({mode:"open"}),t}return a(t,e),Object.defineProperty(t.prototype,"mode",{get:function(){return this.getAttribute("mode")},set:function(e){e?this.setAttribute("mode",e):this.removeAttribute("mode")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"environment",{get:function(){return this.getAttribute("environment")},set:function(e){e?this.setAttribute("environment",e):this.removeAttribute("environment")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"token",{get:function(){return this.getAttribute("token")},set:function(e){e?this.setAttribute("token",e):this.removeAttribute("token")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectedCallback",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t="".concat(l[this.environment],"?token=").concat(this.token,"&environment=").concat(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)}}),Object.defineProperty(t.prototype,"disconnectedCallback",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}}),t}(HTMLElement);null!==(r=customElements.get("lvble-widget"))&&void 0!==r||customElements.define("lvble-widget",d),customElements.get("lvble-widget"),customElements.get("lvble-widget"),t.Lvble=function(e){return{createWidget:function(t){var n=new d;return n.environment=e.environment,n.token=e.token,n.mode=t.mode,window.addEventListener("message",(function(n){if(n.origin==l[e.environment]){var o=n.data;t.onEvent(o.eventType,o)}else console.debug("Received message from unknown origin: ".concat(n.origin))})),n},open:function(t){var n={onboarding:"".concat(u[e.environment],"?token=").concat(e.token),offboarding:"".concat(u[e.environment],"?token=").concat(e.token),split:"".concat(u[e.environment],"?token=").concat(e.token),repay:"".concat(u[e.environment],"?token=").concat(e.token)},o=t.mode?n[t.mode]:"",i=screen.width/2-225,r=screen.height/2-400;window.open(o,"LvblePopup","width=450,height=800,location=no,left="+i+",top="+r),window.addEventListener("message",(function(n){if(n.origin==u[e.environment]){var o=n.data,i=document.querySelectorAll("lvble-widget");n=JSON.parse(JSON.stringify(n)),i.forEach((function(e){var t,o;null===(o=(null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector("iframe")).contentWindow)||void 0===o||o.postMessage(n,"*")})),t.onEvent(o.eventType,o)}else console.debug("Received message from unknown origin: ".concat(n.origin))}))}}}}},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)})()));
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.sandbox.pms.nowlvble.com",[n.Production]:"https://api.production.partners.nowlvble.com"},i={[n.Local]:"http://localhost:3001",[n.Sandbox]:"https://experience.sandbox.pms.nowlvble.com",[n.Production]:"https://api.production.partners.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;return n.environment=e.environment,n.token=e.token,n.mode=t.mode,window.addEventListener("message",(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)})),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]:"",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),window.addEventListener("message",(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,o;null===(o=(null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector("iframe")).contentWindow)||void 0===o||o.postMessage(n,"*")})),t.onEvent(o.eventType,o)}))}})}},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,gCCAYC,E,uiBAAZ,SAAYA,GACV,gBACA,oBACA,yBACD,CAJD,CAAYA,IAAW,cAAXA,EAAW,KAKvB,IAuCKC,EAvCCC,IAAqB,MACxBF,EAAYG,OAAQ,wBACrB,EAACH,EAAYI,SAAU,0CACvB,EAACJ,EAAYK,YAAa,+C,GAGtBC,IAAyB,MAC5BN,EAAYG,OAAQ,wBACrB,EAACH,EAAYI,SAAU,8CACvB,EAACJ,EAAYK,YAAa,+C,IA8B5B,SAAKJ,GACH,sCACA,wCACA,4BACA,2BACD,CALD,CAAKA,IAAAA,EAAS,KAQAA,EAAUM,iBACTN,EAAUO,kBAChBP,EAAUQ,YACVR,EAAUS,YAJnB,IA2BA,c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gDAAyCN,EAAQC,QAgBvD,GAGF,EAEJ,C,GClQIyB,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAapF,QAGrB,IAAIC,EAASgF,EAAyBE,GAAY,CAGjDnF,QAAS,CAAC,GAOX,OAHAsF,EAAoBH,GAAUI,KAAKtF,EAAOD,QAASC,EAAQA,EAAOD,QAASkF,GAGpEjF,EAAOD,OACf,CCnB0BkF,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.sandbox.pms.nowlvble.com\",\n [Environment.Production]: \"https://api.production.partners.nowlvble.com\",\n};\n\nconst envToBaseUrlMapExperience: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\n [Environment.Sandbox]: \"https://experience.sandbox.pms.nowlvble.com\",\n [Environment.Production]: \"https://api.production.partners.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.get(\"lvble-widget\") ??\n customElements.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);\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 ? modeUrlMap[openOptions.mode] : \"\";\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(message, \"*\");\n });\n\n openOptions.onEvent(eventData.eventType, eventData);\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","EventType","envToBaseUrlMapWidget","Local","Sandbox","Production","envToBaseUrlMapExperience","FinishOnboarding","FinishOffboarding","FinishSplit","FinishRepay","onboarding","offboarding","split","repay","attachShadow","mode","this","getAttribute","val","setAttribute","removeAttribute","iframeSrc","environment","token","iframe","document","createElement","src","width","height","style","borderStyle","borderRadius","borderColor","_iframe","shadowRoot","appendChild","innerHTML","HTMLElement","customElements","get","LvbleWidget","Lvble","initOptions","createWidget","createOptions","widget","window","addEventListener","message","origin","data","onEvent","eventType","console","debug","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,yBACD,CAJD,CAAYA,IAAW,cAAXA,EAAW,KAKvB,MAAMC,EAAqD,CACzD,CAACD,EAAYE,OAAQ,wBACrB,CAACF,EAAYG,SAAU,0CACvB,CAACH,EAAYI,YAAa,gDAGtBC,EAAyD,CAC7D,CAACL,EAAYE,OAAQ,wBACrB,CAACF,EAAYG,SAAU,8CACvB,CAACH,EAAYI,YAAa,gDA8B5B,IAAKE,GAAL,SAAKA,GACH,sCACA,wCACA,4BACA,2BACD,CALD,CAAKA,IAAAA,EAAS,KAQAA,EAAUC,iBACTD,E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AeH,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.sandbox.pms.nowlvble.com\",\n [Environment.Production]: \"https://api.production.partners.nowlvble.com\",\n};\n\nconst envToBaseUrlMapExperience: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\n [Environment.Sandbox]: \"https://experience.sandbox.pms.nowlvble.com\",\n [Environment.Production]: \"https://api.production.partners.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);\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 ? modeUrlMap[openOptions.mode] : \"\";\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(message, \"*\");\n });\n\n openOptions.onEvent(eventData.eventType, eventData);\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,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:function(e,t){var n,o,i,r,c,a=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)});Object.defineProperty(t,"__esModule",{value:!0}),t.Lvble=t.Environment=void 0,function(e){e.Local="local",e.Sandbox="sandbox",e.Production="production"}(c||(t.Environment=c={}));var s,l=((o={})[c.Local]="http://localhost:3001",o[c.Sandbox]="https://widget.sandbox.pms.nowlvble.com",o[c.Production]="https://api.production.partners.nowlvble.com",o),u=((i={})[c.Local]="http://localhost:3001",i[c.Sandbox]="https://experience.sandbox.pms.nowlvble.com",i[c.Production]="https://api.production.partners.nowlvble.com",i);!function(e){e.FinishOnboarding="finishOnboarding",e.FinishOffboarding="finishOffboarding",e.FinishSplit="finishSplit",e.FinishRepay="finishRepay"}(s||(s={})),s.FinishOnboarding,s.FinishOffboarding,s.FinishSplit,s.FinishRepay;var d=function(e){function t(){var t=e.call(this)||this;return Object.defineProperty(t,"_typeToEvent",{enumerable:!0,configurable:!0,writable:!0,value:{onboarding:s.FinishOnboarding,offboarding:s.FinishOffboarding,split:s.FinishSplit,repay:s.FinishRepay}}),Object.defineProperty(t,"_iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.attachShadow({mode:"open"}),t}return a(t,e),Object.defineProperty(t.prototype,"mode",{get:function(){return this.getAttribute("mode")},set:function(e){e?this.setAttribute("mode",e):this.removeAttribute("mode")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"environment",{get:function(){return this.getAttribute("environment")},set:function(e){e?this.setAttribute("environment",e):this.removeAttribute("environment")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"token",{get:function(){return this.getAttribute("token")},set:function(e){e?this.setAttribute("token",e):this.removeAttribute("token")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectedCallback",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t="".concat(l[this.environment],"?token=").concat(this.token,"&environment=").concat(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)}}),Object.defineProperty(t.prototype,"disconnectedCallback",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}}),t}(HTMLElement);null!==(r=customElements.get("lvble-widget"))&&void 0!==r||customElements.define("lvble-widget",d),customElements.get("lvble-widget"),customElements.get("lvble-widget"),t.Lvble=function(e){return{createWidget:function(t){var n=new d;return n.environment=e.environment,n.token=e.token,n.mode=t.mode,window.addEventListener("message",(function(n){if(n.origin==l[e.environment]){var o=n.data;t.onEvent(o.eventType,o)}else console.debug("Received message from unknown origin: ".concat(n.origin))})),n},open:function(t){var n={onboarding:"".concat(u[e.environment],"?token=").concat(e.token),offboarding:"".concat(u[e.environment],"?token=").concat(e.token),split:"".concat(u[e.environment],"?token=").concat(e.token),repay:"".concat(u[e.environment],"?token=").concat(e.token)},o=t.mode?n[t.mode]:"",i=screen.width/2-225,r=screen.height/2-400;window.open(o,"LvblePopup","width=450,height=800,location=no,left="+i+",top="+r),window.addEventListener("message",(function(n){if(n.origin==u[e.environment]){var o=n.data,i=document.querySelectorAll("lvble-widget");n=JSON.parse(JSON.stringify(n)),i.forEach((function(e){var t,o;null===(o=(null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector("iframe")).contentWindow)||void 0===o||o.postMessage(n,"*")})),t.onEvent(o.eventType,o)}else console.debug("Received message from unknown origin: ".concat(n.origin))}))}}}}},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)})()));
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.sandbox.pms.nowlvble.com",[n.Production]:"https://api.production.partners.nowlvble.com"},i={[n.Local]:"http://localhost:3001",[n.Sandbox]:"https://experience.sandbox.pms.nowlvble.com",[n.Production]:"https://api.production.partners.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;return n.environment=e.environment,n.token=e.token,n.mode=t.mode,window.addEventListener("message",(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)})),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]:"",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),window.addEventListener("message",(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,o;null===(o=(null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector("iframe")).contentWindow)||void 0===o||o.postMessage(n,"*")})),t.onEvent(o.eventType,o)}))}})}},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,gCCAYC,E,uiBAAZ,SAAYA,GACV,gBACA,oBACA,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AOC,iBAAiB,WAvBA,SAACC,GACvB,GACEA,EAAQC,QAAU7C,EAA0BsC,EAAYrB,aAD1D,CAQA,IAAM2C,EAAYhB,EAAQE,KACpBe,EAAUzC,SAAS0C,iBAAiB,gBAE1ClB,EAAUmB,KAAKC,MAAMD,KAAKE,UAAUrB,IAEpCiB,EAAQK,SAAQ,SAACT,G,QAGA,QAFd,GACa,QAAZ,EAAAA,EAAE3B,kBAAU,eAAEqC,cAAc,WAC5BC,qBAAa,SAAEC,YAAYzB,EAAS,IACxC,IAEAQ,EAAYL,QAAQa,EAAUZ,UAAWY,E,MAhBvCX,QAAQC,MACN,gDAAyCN,EAAQC,QAgBvD,GAGF,EAEJ,C,GClQIyB,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAapF,QAGrB,IAAIC,EAASgF,EAAyBE,GAAY,CAGjDnF,QAAS,CAAC,GAOX,OAHAsF,EAAoBH,GAAUI,KAAKtF,EAAOD,QAASC,EAAQA,EAAOD,QAASkF,GAGpEjF,EAAOD,OACf,CCnB0BkF,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.sandbox.pms.nowlvble.com\",\n [Environment.Production]: \"https://api.production.partners.nowlvble.com\",\n};\n\nconst envToBaseUrlMapExperience: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\n [Environment.Sandbox]: \"https://experience.sandbox.pms.nowlvble.com\",\n [Environment.Production]: \"https://api.production.partners.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.get(\"lvble-widget\") ??\n customElements.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);\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 ? modeUrlMap[openOptions.mode] : \"\";\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(message, \"*\");\n });\n\n openOptions.onEvent(eventData.eventType, eventData);\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","EventType","envToBaseUrlMapWidget","Local","Sandbox","Production","envToBaseUrlMapExperience","FinishOnboarding","FinishOffboarding","FinishSplit","FinishRepay","onboarding","offboarding","split","repay","attachShadow","mode","this","getAttribute","val","setAttribute","removeAttribute","iframeSrc","environment","token","iframe","document","createElement","src","width","height","style","borderStyle","borderRadius","borderColor","_iframe","shadowRoot","appendChild","innerHTML","HTMLElement","customElements","get","LvbleWidget","Lvble","initOptions","createWidget","createOptions","widget","window","addEventListener","message","origin","data","onEvent","eventType","console","debug","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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HA+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,YAAYzB,EAAS,IAAI,IAG5CQ,EAAYH,QAAQW,EAAUV,UAAWU,EAAU,GAGF,G,GC9PrDU,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.sandbox.pms.nowlvble.com\",\n [Environment.Production]: \"https://api.production.partners.nowlvble.com\",\n};\n\nconst envToBaseUrlMapExperience: Record<Environment, string> = {\n [Environment.Local]: \"http://localhost:3001\",\n [Environment.Sandbox]: \"https://experience.sandbox.pms.nowlvble.com\",\n [Environment.Production]: \"https://api.production.partners.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);\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 ? modeUrlMap[openOptions.mode] : \"\";\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(message, \"*\");\n });\n\n openOptions.onEvent(eventData.eventType, eventData);\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 +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;AAaD,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,CAA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,WAAW;CA0DT,CAAC"}
package/dist/lib/lvble.js CHANGED
@@ -1,21 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var _a, _b;
18
- var _c;
19
2
  Object.defineProperty(exports, "__esModule", { value: true });
20
3
  exports.Lvble = exports.Environment = void 0;
21
4
  var Environment;
@@ -24,16 +7,16 @@ var Environment;
24
7
  Environment["Sandbox"] = "sandbox";
25
8
  Environment["Production"] = "production";
26
9
  })(Environment || (exports.Environment = Environment = {}));
27
- var envToBaseUrlMapWidget = (_a = {},
28
- _a[Environment.Local] = "http://localhost:3001",
29
- _a[Environment.Sandbox] = "https://widget.sandbox.pms.nowlvble.com",
30
- _a[Environment.Production] = "https://api.production.partners.nowlvble.com",
31
- _a);
32
- var envToBaseUrlMapExperience = (_b = {},
33
- _b[Environment.Local] = "http://localhost:3001",
34
- _b[Environment.Sandbox] = "https://experience.sandbox.pms.nowlvble.com",
35
- _b[Environment.Production] = "https://api.production.partners.nowlvble.com",
36
- _b);
10
+ const envToBaseUrlMapWidget = {
11
+ [Environment.Local]: "http://localhost:3001",
12
+ [Environment.Sandbox]: "https://widget.sandbox.pms.nowlvble.com",
13
+ [Environment.Production]: "https://api.production.partners.nowlvble.com",
14
+ };
15
+ const envToBaseUrlMapExperience = {
16
+ [Environment.Local]: "http://localhost:3001",
17
+ [Environment.Sandbox]: "https://experience.sandbox.pms.nowlvble.com",
18
+ [Environment.Production]: "https://api.production.partners.nowlvble.com",
19
+ };
37
20
  var EventType;
38
21
  (function (EventType) {
39
22
  EventType["FinishOnboarding"] = "finishOnboarding";
@@ -41,17 +24,16 @@ var EventType;
41
24
  EventType["FinishSplit"] = "finishSplit";
42
25
  EventType["FinishRepay"] = "finishRepay";
43
26
  })(EventType || (EventType = {}));
44
- var modeToEventType = {
27
+ const modeToEventType = {
45
28
  onboarding: EventType.FinishOnboarding,
46
29
  offboarding: EventType.FinishOffboarding,
47
30
  split: EventType.FinishSplit,
48
31
  repay: EventType.FinishRepay,
49
32
  };
50
- var LvbleWidget = /** @class */ (function (_super) {
51
- __extends(LvbleWidget, _super);
52
- function LvbleWidget() {
53
- var _this = _super.call(this) || this;
54
- Object.defineProperty(_this, "_typeToEvent", {
33
+ class LvbleWidget extends HTMLElement {
34
+ constructor() {
35
+ super();
36
+ Object.defineProperty(this, "_typeToEvent", {
55
37
  enumerable: true,
56
38
  configurable: true,
57
39
  writable: true,
@@ -62,96 +44,72 @@ var LvbleWidget = /** @class */ (function (_super) {
62
44
  repay: EventType.FinishRepay,
63
45
  }
64
46
  });
65
- Object.defineProperty(_this, "_iframe", {
47
+ Object.defineProperty(this, "_iframe", {
66
48
  enumerable: true,
67
49
  configurable: true,
68
50
  writable: true,
69
51
  value: void 0
70
52
  });
71
- _this.attachShadow({ mode: "open" });
72
- return _this;
53
+ this.attachShadow({ mode: "open" });
73
54
  }
74
- Object.defineProperty(LvbleWidget.prototype, "mode", {
75
- get: function () {
76
- return this.getAttribute("mode");
77
- },
78
- set: function (val) {
79
- if (val) {
80
- this.setAttribute("mode", val);
81
- }
82
- else {
83
- this.removeAttribute("mode");
84
- }
85
- },
86
- enumerable: false,
87
- configurable: true
88
- });
89
- Object.defineProperty(LvbleWidget.prototype, "environment", {
90
- get: function () {
91
- return this.getAttribute("environment");
92
- },
93
- set: function (val) {
94
- if (val) {
95
- this.setAttribute("environment", val);
96
- }
97
- else {
98
- this.removeAttribute("environment");
99
- }
100
- },
101
- enumerable: false,
102
- configurable: true
103
- });
104
- Object.defineProperty(LvbleWidget.prototype, "token", {
105
- get: function () {
106
- return this.getAttribute("token");
107
- },
108
- set: function (val) {
109
- if (val) {
110
- this.setAttribute("token", val);
111
- }
112
- else {
113
- this.removeAttribute("token");
114
- }
115
- },
116
- enumerable: false,
117
- configurable: true
118
- });
119
- Object.defineProperty(LvbleWidget.prototype, "connectedCallback", {
120
- enumerable: false,
121
- configurable: true,
122
- writable: true,
123
- value: function () {
124
- var _a;
125
- var iframeSrc = "".concat(envToBaseUrlMapWidget[this.environment], "?token=").concat(this.token, "&environment=").concat(this.environment);
126
- var iframe = document.createElement("iframe");
127
- iframe.src = iframeSrc;
128
- iframe.width = "100%";
129
- iframe.height = "100%";
130
- iframe.style.borderStyle = "solid";
131
- iframe.style.borderRadius = "10px";
132
- iframe.style.borderColor = "transparent";
133
- this._iframe = iframe;
134
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(iframe);
55
+ get mode() {
56
+ return this.getAttribute("mode");
57
+ }
58
+ set mode(val) {
59
+ if (val) {
60
+ this.setAttribute("mode", val);
61
+ }
62
+ else {
63
+ this.removeAttribute("mode");
64
+ }
65
+ }
66
+ get environment() {
67
+ return this.getAttribute("environment");
68
+ }
69
+ set environment(val) {
70
+ if (val) {
71
+ this.setAttribute("environment", val);
135
72
  }
136
- });
137
- Object.defineProperty(LvbleWidget.prototype, "disconnectedCallback", {
138
- enumerable: false,
139
- configurable: true,
140
- writable: true,
141
- value: function () {
142
- if (this.shadowRoot)
143
- this.shadowRoot.innerHTML = "";
73
+ else {
74
+ this.removeAttribute("environment");
144
75
  }
145
- });
146
- return LvbleWidget;
147
- }(HTMLElement));
148
- (_c = customElements.get("lvble-widget")) !== null && _c !== void 0 ? _c : customElements.define("lvble-widget", LvbleWidget);
149
- var modeWidgetMap = {
76
+ }
77
+ get token() {
78
+ return this.getAttribute("token");
79
+ }
80
+ set token(val) {
81
+ if (val) {
82
+ this.setAttribute("token", val);
83
+ }
84
+ else {
85
+ this.removeAttribute("token");
86
+ }
87
+ }
88
+ connectedCallback() {
89
+ var _a;
90
+ const iframeSrc = `${envToBaseUrlMapWidget[this.environment]}?token=${this.token}&environment=${this.environment}`;
91
+ const iframe = document.createElement("iframe");
92
+ iframe.src = iframeSrc;
93
+ iframe.width = `100%`;
94
+ iframe.height = `100%`;
95
+ iframe.style.borderStyle = "solid";
96
+ iframe.style.borderRadius = "10px";
97
+ iframe.style.borderColor = "transparent";
98
+ this._iframe = iframe;
99
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(iframe);
100
+ }
101
+ disconnectedCallback() {
102
+ if (this.shadowRoot)
103
+ this.shadowRoot.innerHTML = "";
104
+ }
105
+ }
106
+ customElements.define("lvble-widget", LvbleWidget);
107
+ const modeWidgetMap = {
150
108
  onboarding: customElements.get("lvble-widget"),
151
109
  repay: customElements.get("lvble-widget"),
152
110
  };
153
- var _popup;
154
- var lvble = function (initOptions) {
111
+ let _popup;
112
+ const lvble = (initOptions) => {
155
113
  return {
156
114
  /**
157
115
  * This function creates a widget that can be embedded in your website.
@@ -160,8 +118,8 @@ var lvble = function (initOptions) {
160
118
  * @returns The widget.
161
119
  */
162
120
  // TODO: Add support for no mode
163
- createWidget: function (createOptions) {
164
- var widget = new LvbleWidget();
121
+ createWidget: (createOptions) => {
122
+ const widget = new LvbleWidget();
165
123
  // (
166
124
  // createOptions.mode
167
125
  // ? new modeWidgetMap[createOptions.mode]!()
@@ -172,12 +130,12 @@ var lvble = function (initOptions) {
172
130
  widget.environment = initOptions.environment;
173
131
  widget.token = initOptions.token;
174
132
  widget.mode = createOptions.mode;
175
- var messageListener = function (message) {
133
+ const messageListener = (message) => {
176
134
  if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {
177
- console.debug("Received message from unknown origin: ".concat(message.origin));
135
+ console.debug(`Received message from unknown origin: ${message.origin}`);
178
136
  return;
179
137
  }
180
- var data = message.data;
138
+ const data = message.data;
181
139
  createOptions.onEvent(data.eventType, data);
182
140
  };
183
141
  window.addEventListener("message", messageListener);
@@ -188,28 +146,28 @@ var lvble = function (initOptions) {
188
146
  * @param openOptions The options for opening the widget. See OpenOptions for more information.
189
147
  * @returns undefined.
190
148
  */
191
- open: function (openOptions) {
192
- var modeUrlMap = {
193
- onboarding: "".concat(envToBaseUrlMapExperience[initOptions.environment], "?token=").concat(initOptions.token),
194
- offboarding: "".concat(envToBaseUrlMapExperience[initOptions.environment], "?token=").concat(initOptions.token),
195
- split: "".concat(envToBaseUrlMapExperience[initOptions.environment], "?token=").concat(initOptions.token),
196
- repay: "".concat(envToBaseUrlMapExperience[initOptions.environment], "?token=").concat(initOptions.token),
149
+ open: (openOptions) => {
150
+ const modeUrlMap = {
151
+ onboarding: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`,
152
+ offboarding: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`,
153
+ split: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`,
154
+ repay: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`,
197
155
  };
198
- var modeUrl = openOptions.mode ? modeUrlMap[openOptions.mode] : "";
199
- var w = 450;
200
- var h = 800;
201
- var l = screen.width / 2 - w / 2;
202
- var t = screen.height / 2 - h / 2;
156
+ const modeUrl = openOptions.mode ? modeUrlMap[openOptions.mode] : "";
157
+ const w = 450;
158
+ const h = 800;
159
+ const l = screen.width / 2 - w / 2;
160
+ const t = screen.height / 2 - h / 2;
203
161
  _popup = window.open(modeUrl, "LvblePopup", "width=" + w + ",height=" + h + ",location=no,left=" + l + ",top=" + t);
204
- var messageListener = function (message) {
162
+ const messageListener = (message) => {
205
163
  if (message.origin != envToBaseUrlMapExperience[initOptions.environment]) {
206
- console.debug("Received message from unknown origin: ".concat(message.origin));
164
+ console.debug(`Received message from unknown origin: ${message.origin}`);
207
165
  return;
208
166
  }
209
- var eventData = message.data;
210
- var iframes = document.querySelectorAll("lvble-widget");
167
+ const eventData = message.data;
168
+ const iframes = document.querySelectorAll("lvble-widget");
211
169
  message = JSON.parse(JSON.stringify(message));
212
- iframes.forEach(function (w) {
170
+ iframes.forEach((w) => {
213
171
  var _a, _b;
214
172
  (_b = ((_a = w.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("iframe")).contentWindow) === null || _b === void 0 ? void 0 : _b.postMessage(message, "*");
215
173
  });
@@ -1 +1 @@
1
- {"version":3,"file":"lvble.js","sourceRoot":"","sources":["../../src/lib/lvble.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;AAC3B,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AACD,IAAM,qBAAqB;IACzB,GAAC,WAAW,CAAC,KAAK,IAAG,uBAAuB;IAC5C,GAAC,WAAW,CAAC,OAAO,IAAG,yCAAyC;IAChE,GAAC,WAAW,CAAC,UAAU,IAAG,8CAA8C;OACzE,CAAC;AAEF,IAAM,yBAAyB;IAC7B,GAAC,WAAW,CAAC,KAAK,IAAG,uBAAuB;IAC5C,GAAC,WAAW,CAAC,OAAO,IAAG,6CAA6C;IACpE,GAAC,WAAW,CAAC,UAAU,IAAG,8CAA8C;OACzE,CAAC;AA6BF,IAAK,SAKJ;AALD,WAAK,SAAS;IACZ,kDAAqC,CAAA;IACrC,oDAAuC,CAAA;IACvC,wCAA2B,CAAA;IAC3B,wCAA2B,CAAA;AAC7B,CAAC,EALI,SAAS,KAAT,SAAS,QAKb;AAED,IAAM,eAAe,GAAG;IACtB,UAAU,EAAE,SAAS,CAAC,gBAAgB;IACtC,WAAW,EAAE,SAAS,CAAC,iBAAiB;IACxC,KAAK,EAAE,SAAS,CAAC,WAAW;IAC5B,KAAK,EAAE,SAAS,CAAC,WAAW;CAC7B,CAAC;AAsBF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AG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAEjD,eAAO,MAAM,KAAK,gBApGU,WAAW;IAEnC;;;;;OAKG;kCAE2B,mBAAmB;IA4BjD;;;;OAIG;wBACiB,WAAW;CA0DT,CAAC"}
@@ -1,36 +1,19 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var _a, _b;
17
- var _c;
18
1
  export var Environment;
19
2
  (function (Environment) {
20
3
  Environment["Local"] = "local";
21
4
  Environment["Sandbox"] = "sandbox";
22
5
  Environment["Production"] = "production";
23
6
  })(Environment || (Environment = {}));
24
- var envToBaseUrlMapWidget = (_a = {},
25
- _a[Environment.Local] = "http://localhost:3001",
26
- _a[Environment.Sandbox] = "https://widget.sandbox.pms.nowlvble.com",
27
- _a[Environment.Production] = "https://api.production.partners.nowlvble.com",
28
- _a);
29
- var envToBaseUrlMapExperience = (_b = {},
30
- _b[Environment.Local] = "http://localhost:3001",
31
- _b[Environment.Sandbox] = "https://experience.sandbox.pms.nowlvble.com",
32
- _b[Environment.Production] = "https://api.production.partners.nowlvble.com",
33
- _b);
7
+ const envToBaseUrlMapWidget = {
8
+ [Environment.Local]: "http://localhost:3001",
9
+ [Environment.Sandbox]: "https://widget.sandbox.pms.nowlvble.com",
10
+ [Environment.Production]: "https://api.production.partners.nowlvble.com",
11
+ };
12
+ const envToBaseUrlMapExperience = {
13
+ [Environment.Local]: "http://localhost:3001",
14
+ [Environment.Sandbox]: "https://experience.sandbox.pms.nowlvble.com",
15
+ [Environment.Production]: "https://api.production.partners.nowlvble.com",
16
+ };
34
17
  var EventType;
35
18
  (function (EventType) {
36
19
  EventType["FinishOnboarding"] = "finishOnboarding";
@@ -38,17 +21,16 @@ var EventType;
38
21
  EventType["FinishSplit"] = "finishSplit";
39
22
  EventType["FinishRepay"] = "finishRepay";
40
23
  })(EventType || (EventType = {}));
41
- var modeToEventType = {
24
+ const modeToEventType = {
42
25
  onboarding: EventType.FinishOnboarding,
43
26
  offboarding: EventType.FinishOffboarding,
44
27
  split: EventType.FinishSplit,
45
28
  repay: EventType.FinishRepay,
46
29
  };
47
- var LvbleWidget = /** @class */ (function (_super) {
48
- __extends(LvbleWidget, _super);
49
- function LvbleWidget() {
50
- var _this = _super.call(this) || this;
51
- Object.defineProperty(_this, "_typeToEvent", {
30
+ class LvbleWidget extends HTMLElement {
31
+ constructor() {
32
+ super();
33
+ Object.defineProperty(this, "_typeToEvent", {
52
34
  enumerable: true,
53
35
  configurable: true,
54
36
  writable: true,
@@ -59,96 +41,72 @@ var LvbleWidget = /** @class */ (function (_super) {
59
41
  repay: EventType.FinishRepay,
60
42
  }
61
43
  });
62
- Object.defineProperty(_this, "_iframe", {
44
+ Object.defineProperty(this, "_iframe", {
63
45
  enumerable: true,
64
46
  configurable: true,
65
47
  writable: true,
66
48
  value: void 0
67
49
  });
68
- _this.attachShadow({ mode: "open" });
69
- return _this;
50
+ this.attachShadow({ mode: "open" });
70
51
  }
71
- Object.defineProperty(LvbleWidget.prototype, "mode", {
72
- get: function () {
73
- return this.getAttribute("mode");
74
- },
75
- set: function (val) {
76
- if (val) {
77
- this.setAttribute("mode", val);
78
- }
79
- else {
80
- this.removeAttribute("mode");
81
- }
82
- },
83
- enumerable: false,
84
- configurable: true
85
- });
86
- Object.defineProperty(LvbleWidget.prototype, "environment", {
87
- get: function () {
88
- return this.getAttribute("environment");
89
- },
90
- set: function (val) {
91
- if (val) {
92
- this.setAttribute("environment", val);
93
- }
94
- else {
95
- this.removeAttribute("environment");
96
- }
97
- },
98
- enumerable: false,
99
- configurable: true
100
- });
101
- Object.defineProperty(LvbleWidget.prototype, "token", {
102
- get: function () {
103
- return this.getAttribute("token");
104
- },
105
- set: function (val) {
106
- if (val) {
107
- this.setAttribute("token", val);
108
- }
109
- else {
110
- this.removeAttribute("token");
111
- }
112
- },
113
- enumerable: false,
114
- configurable: true
115
- });
116
- Object.defineProperty(LvbleWidget.prototype, "connectedCallback", {
117
- enumerable: false,
118
- configurable: true,
119
- writable: true,
120
- value: function () {
121
- var _a;
122
- var iframeSrc = "".concat(envToBaseUrlMapWidget[this.environment], "?token=").concat(this.token, "&environment=").concat(this.environment);
123
- var iframe = document.createElement("iframe");
124
- iframe.src = iframeSrc;
125
- iframe.width = "100%";
126
- iframe.height = "100%";
127
- iframe.style.borderStyle = "solid";
128
- iframe.style.borderRadius = "10px";
129
- iframe.style.borderColor = "transparent";
130
- this._iframe = iframe;
131
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(iframe);
52
+ get mode() {
53
+ return this.getAttribute("mode");
54
+ }
55
+ set mode(val) {
56
+ if (val) {
57
+ this.setAttribute("mode", val);
58
+ }
59
+ else {
60
+ this.removeAttribute("mode");
61
+ }
62
+ }
63
+ get environment() {
64
+ return this.getAttribute("environment");
65
+ }
66
+ set environment(val) {
67
+ if (val) {
68
+ this.setAttribute("environment", val);
132
69
  }
133
- });
134
- Object.defineProperty(LvbleWidget.prototype, "disconnectedCallback", {
135
- enumerable: false,
136
- configurable: true,
137
- writable: true,
138
- value: function () {
139
- if (this.shadowRoot)
140
- this.shadowRoot.innerHTML = "";
70
+ else {
71
+ this.removeAttribute("environment");
141
72
  }
142
- });
143
- return LvbleWidget;
144
- }(HTMLElement));
145
- (_c = customElements.get("lvble-widget")) !== null && _c !== void 0 ? _c : customElements.define("lvble-widget", LvbleWidget);
146
- var modeWidgetMap = {
73
+ }
74
+ get token() {
75
+ return this.getAttribute("token");
76
+ }
77
+ set token(val) {
78
+ if (val) {
79
+ this.setAttribute("token", val);
80
+ }
81
+ else {
82
+ this.removeAttribute("token");
83
+ }
84
+ }
85
+ connectedCallback() {
86
+ var _a;
87
+ const iframeSrc = `${envToBaseUrlMapWidget[this.environment]}?token=${this.token}&environment=${this.environment}`;
88
+ const iframe = document.createElement("iframe");
89
+ iframe.src = iframeSrc;
90
+ iframe.width = `100%`;
91
+ iframe.height = `100%`;
92
+ iframe.style.borderStyle = "solid";
93
+ iframe.style.borderRadius = "10px";
94
+ iframe.style.borderColor = "transparent";
95
+ this._iframe = iframe;
96
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(iframe);
97
+ }
98
+ disconnectedCallback() {
99
+ if (this.shadowRoot)
100
+ this.shadowRoot.innerHTML = "";
101
+ }
102
+ }
103
+ customElements.define("lvble-widget", LvbleWidget);
104
+ const modeWidgetMap = {
147
105
  onboarding: customElements.get("lvble-widget"),
148
106
  repay: customElements.get("lvble-widget"),
149
107
  };
150
- var _popup;
151
- var lvble = function (initOptions) {
108
+ let _popup;
109
+ const lvble = (initOptions) => {
152
110
  return {
153
111
  /**
154
112
  * This function creates a widget that can be embedded in your website.
@@ -157,8 +115,8 @@ var lvble = function (initOptions) {
157
115
  * @returns The widget.
158
116
  */
159
117
  // TODO: Add support for no mode
160
- createWidget: function (createOptions) {
161
- var widget = new LvbleWidget();
118
+ createWidget: (createOptions) => {
119
+ const widget = new LvbleWidget();
162
120
  // (
163
121
  // createOptions.mode
164
122
  // ? new modeWidgetMap[createOptions.mode]!()
@@ -169,12 +127,12 @@ var lvble = function (initOptions) {
169
127
  widget.environment = initOptions.environment;
170
128
  widget.token = initOptions.token;
171
129
  widget.mode = createOptions.mode;
172
- var messageListener = function (message) {
130
+ const messageListener = (message) => {
173
131
  if (message.origin != envToBaseUrlMapWidget[initOptions.environment]) {
174
- console.debug("Received message from unknown origin: ".concat(message.origin));
132
+ console.debug(`Received message from unknown origin: ${message.origin}`);
175
133
  return;
176
134
  }
177
- var data = message.data;
135
+ const data = message.data;
178
136
  createOptions.onEvent(data.eventType, data);
179
137
  };
180
138
  window.addEventListener("message", messageListener);
@@ -185,28 +143,28 @@ var lvble = function (initOptions) {
185
143
  * @param openOptions The options for opening the widget. See OpenOptions for more information.
186
144
  * @returns undefined.
187
145
  */
188
- open: function (openOptions) {
189
- var modeUrlMap = {
190
- onboarding: "".concat(envToBaseUrlMapExperience[initOptions.environment], "?token=").concat(initOptions.token),
191
- offboarding: "".concat(envToBaseUrlMapExperience[initOptions.environment], "?token=").concat(initOptions.token),
192
- split: "".concat(envToBaseUrlMapExperience[initOptions.environment], "?token=").concat(initOptions.token),
193
- repay: "".concat(envToBaseUrlMapExperience[initOptions.environment], "?token=").concat(initOptions.token),
146
+ open: (openOptions) => {
147
+ const modeUrlMap = {
148
+ onboarding: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`,
149
+ offboarding: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`,
150
+ split: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`,
151
+ repay: `${envToBaseUrlMapExperience[initOptions.environment]}?token=${initOptions.token}`,
194
152
  };
195
- var modeUrl = openOptions.mode ? modeUrlMap[openOptions.mode] : "";
196
- var w = 450;
197
- var h = 800;
198
- var l = screen.width / 2 - w / 2;
199
- var t = screen.height / 2 - h / 2;
153
+ const modeUrl = openOptions.mode ? modeUrlMap[openOptions.mode] : "";
154
+ const w = 450;
155
+ const h = 800;
156
+ const l = screen.width / 2 - w / 2;
157
+ const t = screen.height / 2 - h / 2;
200
158
  _popup = window.open(modeUrl, "LvblePopup", "width=" + w + ",height=" + h + ",location=no,left=" + l + ",top=" + t);
201
- var messageListener = function (message) {
159
+ const messageListener = (message) => {
202
160
  if (message.origin != envToBaseUrlMapExperience[initOptions.environment]) {
203
- console.debug("Received message from unknown origin: ".concat(message.origin));
161
+ console.debug(`Received message from unknown origin: ${message.origin}`);
204
162
  return;
205
163
  }
206
- var eventData = message.data;
207
- var iframes = document.querySelectorAll("lvble-widget");
164
+ const eventData = message.data;
165
+ const iframes = document.querySelectorAll("lvble-widget");
208
166
  message = JSON.parse(JSON.stringify(message));
209
- iframes.forEach(function (w) {
167
+ iframes.forEach((w) => {
210
168
  var _a, _b;
211
169
  (_b = ((_a = w.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("iframe")).contentWindow) === null || _b === void 0 ? void 0 : _b.postMessage(message, "*");
212
170
  });
@@ -216,5 +174,5 @@ var lvble = function (initOptions) {
216
174
  },
217
175
  };
218
176
  };
219
- export var Lvble = lvble;
177
+ export const Lvble = lvble;
220
178
  //# sourceMappingURL=lvble.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lvble.js","sourceRoot":"","sources":["../../src/lib/lvble.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;AAC3B,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AACD,IAAM,qBAAqB;IACzB,GAAC,WAAW,CAAC,KAAK,IAAG,uBAAuB;IAC5C,GAAC,WAAW,CAAC,OAAO,IAAG,yCAAyC;IAChE,GAAC,WAAW,CAAC,UAAU,IAAG,8CAA8C;OACzE,CAAC;AAEF,IAAM,yBAAyB;IAC7B,GAAC,WAAW,CAAC,KAAK,IAAG,uBAAuB;IAC5C,GAAC,WAAW,CAAC,OAAO,IAAG,6CAA6C;IACpE,GAAC,WAAW,CAAC,UAAU,IAAG,8CAA8C;OACzE,CAAC;AA6BF,IAAK,SAKJ;AALD,WAAK,SAAS;IACZ,kDAAqC,CAAA;IACrC,oDAAuC,CAAA;IACvC,wCAA2B,CAAA;IAC3B,wCAA2B,CAAA;AAC7B,CAAC,EALI,SAAS,KAAT,SAAS,QAKb;AAED,IAAM,eAAe,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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lvble/core",
3
3
  "private": false,
4
- "version": "2.0.17",
4
+ "version": "2.0.19",
5
5
  "main": "./dist/_bundles/index.js",
6
6
  "module": "./dist/lib-esm/index.js",
7
7
  "types": "./dist/lib/index.d.ts",