@blotoutio/providers-blotout-wallet-sdk 0.45.4 → 0.46.1

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/index.js CHANGED
@@ -36,6 +36,17 @@ var ProvidersBlotoutWalletSdk = (function () {
36
36
  ]);
37
37
 
38
38
  const packageName = 'blotoutWallet';
39
+ const customAttributes = {
40
+ '--bw-primary': { type: 'color', defaultValue: '#f25c2b' },
41
+ '--bw-secondary': { type: 'color', defaultValue: '#172a41' },
42
+ '--bw-button': { type: 'color', defaultValue: '#da2e3a' },
43
+ '--bw-foreground': { type: 'color', defaultValue: 'white' },
44
+ '--bw-input-border': { type: 'color', defaultValue: '#dbe2eb' },
45
+ '--bw-input-foreground': { type: 'color', defaultValue: '#172a41' },
46
+ '--bw-input-background': { type: 'color', defaultValue: 'white' },
47
+ '--bw-backdrop': { type: 'color', defaultValue: '#00000077' },
48
+ '--bw-z-index': { type: 'number', defaultValue: '9999' },
49
+ };
39
50
  const cartTokenCookie = 'cart';
40
51
  const cartTokenTwoCookie = 'cart2';
41
52
  const cartCurrencyCookie = 'cart_currency';
@@ -63,6 +74,58 @@ var ProvidersBlotoutWalletSdk = (function () {
63
74
  return '';
64
75
  }
65
76
  };
77
+ const setCookie = (key, value) => {
78
+ try {
79
+ if (!document) {
80
+ return;
81
+ }
82
+ document.cookie = `${key}=${value};path=/`;
83
+ }
84
+ catch {
85
+ return;
86
+ }
87
+ };
88
+
89
+ const canLog = () => {
90
+ try {
91
+ return localStorage.getItem('edgeTagDebug') === '1';
92
+ }
93
+ catch {
94
+ return false;
95
+ }
96
+ };
97
+ const logger = {
98
+ log: (...args) => {
99
+ if (canLog()) {
100
+ console.log(...args);
101
+ }
102
+ },
103
+ error: (...args) => {
104
+ if (canLog()) {
105
+ console.error(...args);
106
+ }
107
+ },
108
+ info: (...args) => {
109
+ if (canLog()) {
110
+ console.info(...args);
111
+ }
112
+ },
113
+ trace: (...args) => {
114
+ if (canLog()) {
115
+ console.trace(...args);
116
+ }
117
+ },
118
+ table: (...args) => {
119
+ if (canLog()) {
120
+ console.table(...args);
121
+ }
122
+ },
123
+ dir: (...args) => {
124
+ if (canLog()) {
125
+ console.dir(...args);
126
+ }
127
+ },
128
+ };
66
129
 
67
130
  var _a;
68
131
  const registryKey = Symbol.for('blotout-wallet');
@@ -82,9 +145,9 @@ var ProvidersBlotoutWalletSdk = (function () {
82
145
  cartToken = getCookieValue(cartTokenTwoCookie);
83
146
  }
84
147
  if (eventName === 'Purchase') {
85
- document.cookie = `cart2=${cartToken};path=/;Max-Age=10`;
148
+ document.cookie = `${cartTokenTwoCookie}=${cartToken};path=/;Max-Age=10`;
86
149
  }
87
- return { platform, cartToken, cartCurrency };
150
+ return { cartToken, cartCurrency };
88
151
  }
89
152
  default: {
90
153
  return {};
@@ -92,9 +155,588 @@ var ProvidersBlotoutWalletSdk = (function () {
92
155
  }
93
156
  };
94
157
 
158
+ /******************************************************************************
159
+ Copyright (c) Microsoft Corporation.
160
+
161
+ Permission to use, copy, modify, and/or distribute this software for any
162
+ purpose with or without fee is hereby granted.
163
+
164
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
165
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
166
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
167
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
168
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
169
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
170
+ PERFORMANCE OF THIS SOFTWARE.
171
+ ***************************************************************************** */
172
+ /* global Reflect, Promise, SuppressedError, Symbol */
173
+
174
+
175
+ function __decorate(decorators, target, key, desc) {
176
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
177
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
178
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
179
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
180
+ }
181
+
182
+ function __metadata(metadataKey, metadataValue) {
183
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
184
+ }
185
+
186
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
187
+ var e = new Error(message);
188
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
189
+ };
190
+
191
+ /**
192
+ * @license
193
+ * Copyright 2019 Google LLC
194
+ * SPDX-License-Identifier: BSD-3-Clause
195
+ */
196
+ const t$3=globalThis,e$5=t$3.ShadowRoot&&(void 0===t$3.ShadyCSS||t$3.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$4 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$5&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$5=t=>new n$4("string"==typeof t?t:t+"",void 0,s$2),i$4=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$4(o,t,s$2)},S$1=(s,o)=>{if(e$5)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$3.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$5?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t;
197
+
198
+ /**
199
+ * @license
200
+ * Copyright 2017 Google LLC
201
+ * SPDX-License-Identifier: BSD-3-Clause
202
+ */const{is:i$3,defineProperty:e$4,getOwnPropertyDescriptor:r$4,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$3,getPrototypeOf:n$3}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$3(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let b$1 = class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$4(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$4(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$3(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}};b$1.elementStyles=[],b$1.shadowRootOptions={mode:"open"},b$1[d$1("elementProperties")]=new Map,b$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b$1}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
203
+
204
+ /**
205
+ * @license
206
+ * Copyright 2017 Google LLC
207
+ * SPDX-License-Identifier: BSD-3-Clause
208
+ */
209
+ const t$2=globalThis,i$2=t$2.trustedTypes,s$1=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$3="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$2="?"+h,n$2=`<${o$2}>`,r$3=document,l=()=>r$3.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),w=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),A=new WeakMap,E=r$3.createTreeWalker(r$3,129);function C(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const P=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$2:d>=0?(o.push(a),s.slice(0,d)+e$3+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [C(t,l+(t[s]||"<?>")+(2===i?"</svg>":"")),o]};class V{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=P(t,s);if(this.el=V.createElement(f,n),E.currentNode=this.el.content,2===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=E.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$3)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?k:"?"===e[1]?H:"@"===e[1]?I:R}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$2?i$2.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),E.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$2)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$3.createElement("template");return s.innerHTML=t,s}}function N(t,i,s=t,e){if(i===w)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=N(t,h._$AS(t,i.values),h,e)),i}class S{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$3).importNode(i,!0);E.currentNode=e;let h=E.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new M(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new L(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=E.nextNode(),o++);}return E.currentNode=r$3,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class M{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=N(this,t,i),c(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==w&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t));}_(t){this._$AH!==T&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$3.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new S(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new V(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new M(this.S(l()),this.S(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=N(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==w,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=N(this,e[s+n],i,n),r===w&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===T?t=T:t!==T&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class k extends R{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===T?void 0:t;}}class H extends R{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==T);}}class I extends R{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=N(this,t,i,0)??T)===w)return;const s=this._$AH,e=t===T&&s!==T||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==T&&(s===T||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t);}}const Z=t$2.litHtmlPolyfillSupport;Z?.(V,M),(t$2.litHtmlVersions??=[]).push("3.1.3");const j=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new M(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
210
+
211
+ /**
212
+ * @license
213
+ * Copyright 2017 Google LLC
214
+ * SPDX-License-Identifier: BSD-3-Clause
215
+ */class s extends b$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=j(i,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return w}}s._$litElement$=!0,s[("finalized")]=!0,globalThis.litElementHydrateSupport?.({LitElement:s});const r$2=globalThis.litElementPolyfillSupport;r$2?.({LitElement:s});(globalThis.litElementVersions??=[]).push("4.0.5");
216
+
217
+ /**
218
+ * @license
219
+ * Copyright 2017 Google LLC
220
+ * SPDX-License-Identifier: BSD-3-Clause
221
+ */
222
+ const t$1=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
223
+
224
+ /**
225
+ * @license
226
+ * Copyright 2017 Google LLC
227
+ * SPDX-License-Identifier: BSD-3-Clause
228
+ */const o$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$1,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.P(o,void 0,t),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n$1(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
229
+
230
+ /**
231
+ * @license
232
+ * Copyright 2017 Google LLC
233
+ * SPDX-License-Identifier: BSD-3-Clause
234
+ */function r(r){return n$1({...r,state:!0,attribute:!1})}
235
+
236
+ /**
237
+ * @license
238
+ * Copyright 2017 Google LLC
239
+ * SPDX-License-Identifier: BSD-3-Clause
240
+ */
241
+ const e$2=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
242
+
243
+ /**
244
+ * @license
245
+ * Copyright 2017 Google LLC
246
+ * SPDX-License-Identifier: BSD-3-Clause
247
+ */function e$1(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}="object"==typeof s?n:i??(()=>{const t=Symbol();return {get(){return this[t]},set(e){this[t]=e;}}})();return e$2(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return e$2(n,s,{get(){return o(this)}})}}
248
+
249
+ /**
250
+ * @license
251
+ * Copyright 2017 Google LLC
252
+ * SPDX-License-Identifier: BSD-3-Clause
253
+ */
254
+ const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});let i$1 = class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
255
+
256
+ /**
257
+ * @license
258
+ * Copyright 2018 Google LLC
259
+ * SPDX-License-Identifier: BSD-3-Clause
260
+ */const n="important",i=" !"+n,o=e(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"style"!==t$1.name||t$1.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r="string"==typeof e&&e.endsWith(i);t.includes("-")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:""):s[t]=e;}}return w}});
261
+
262
+ const spring = 'linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1)';
263
+
264
+ const cssVars = i$4 `
265
+ :host {
266
+ --primary: var(
267
+ --bw-primary,
268
+ ${r$5(customAttributes['--bw-primary'].defaultValue)}
269
+ );
270
+ --secondary: var(
271
+ --bw-secondary,
272
+ ${r$5(customAttributes['--bw-secondary'].defaultValue)}
273
+ );
274
+ --button: var(
275
+ --bw-button,
276
+ ${r$5(customAttributes['--bw-button'].defaultValue)}
277
+ );
278
+ --foreground: var(
279
+ --bw-foreground,
280
+ ${r$5(customAttributes['--bw-foreground'].defaultValue)}
281
+ );
282
+ --input-border: var(
283
+ --bw-input-border,
284
+ ${r$5(customAttributes['--bw-input-border'].defaultValue)}
285
+ );
286
+ --input-foreground: var(
287
+ --bw-input-foreground,
288
+ ${r$5(customAttributes['--bw-input-foreground'].defaultValue)}
289
+ );
290
+ --input-background: var(
291
+ --bw-input-background,
292
+ ${r$5(customAttributes['--bw-input-background'].defaultValue)}
293
+ );
294
+ --backdrop: var(
295
+ --bw-backdrop,
296
+ ${r$5(customAttributes['--bw-backdrop'].defaultValue)}
297
+ );
298
+ --z-index: var(
299
+ --bw-z-index,
300
+ ${r$5(customAttributes['--bw-z-index'].defaultValue)}
301
+ );
302
+
303
+ --spring-easing: ${r$5(spring)};
304
+ }
305
+ `;
306
+
307
+ const blotout = (attrs) => b `<svg
308
+ width="26"
309
+ height="36"
310
+ viewBox="0 0 26 36"
311
+ fill="none"
312
+ xmlns="http://www.w3.org/2000/svg"
313
+ class=${attrs === null || attrs === void 0 ? void 0 : attrs.class}
314
+ style=${attrs === null || attrs === void 0 ? void 0 : attrs.style}
315
+ >
316
+ <path
317
+ fill-rule="evenodd"
318
+ clip-rule="evenodd"
319
+ d="M0.830995 0.42104C0.75879 0.56208 0.758789 0.746712 0.758789 1.11598V34.5089C0.758789 34.8782 0.75879 35.0628 0.830995 35.2038C0.894508 35.3279 0.995851 35.4288 1.1205 35.4921C1.26221 35.5638 1.44772 35.5638 1.81874 35.5638H4.28515C4.65617 35.5638 4.84167 35.5638 4.98338 35.4921C5.10803 35.4288 5.20938 35.3279 5.27289 35.2038C5.3451 35.0628 5.3451 34.8782 5.3451 34.5089V33.3303C7.4389 35.0007 10.0967 36 12.9889 36C19.7435 36 25.2191 30.5502 25.2191 23.8275C25.2191 17.1049 19.7435 11.6552 12.9889 11.6552C10.0967 11.6552 7.4389 12.6544 5.3451 14.3249V1.11598C5.3451 0.746712 5.3451 0.56208 5.27289 0.42104C5.20938 0.296978 5.10803 0.196112 4.98338 0.132899C4.84167 0.0610352 4.65617 0.0610352 4.28515 0.0610352H1.81874C1.44772 0.0610352 1.26221 0.0610352 1.1205 0.132899C0.995851 0.196112 0.894508 0.296978 0.830995 0.42104ZM5.3451 23.8275C5.3451 28.0292 8.76736 31.4353 12.9889 31.4353C17.2105 31.4353 20.6328 28.0292 20.6328 23.8275C20.6328 19.626 17.2105 16.2198 12.9889 16.2198C8.76736 16.2198 5.3451 19.626 5.3451 23.8275Z"
320
+ fill="currentColor"
321
+ />
322
+ </svg>`;
323
+ const cross = (attrs) => b `<svg
324
+ width="32"
325
+ height="32"
326
+ viewBox="0 0 32 32"
327
+ fill="none"
328
+ xmlns="http://www.w3.org/2000/svg"
329
+ class=${attrs === null || attrs === void 0 ? void 0 : attrs.class}
330
+ style=${attrs === null || attrs === void 0 ? void 0 : attrs.style}
331
+ >
332
+ <g>
333
+ <path
334
+ d="M17.4141 16L24 9.4141L22.5859 8L16 14.5859L9.4143 8L8 9.4141L14.5859 16L8 22.5859L9.4143 24L16 17.4141L22.5859 24L24 22.5859L17.4141 16Z"
335
+ fill="currentColor"
336
+ />
337
+ </g>
338
+ </svg> `;
339
+
340
+ const fadeInDialog = (element) => {
341
+ const dialogAnimation = element.animate([
342
+ { transform: 'translateY(-20px)', opacity: 0 },
343
+ { transform: 'translateY(0)', opacity: 1 },
344
+ ], { duration: 600, easing: spring, composite: 'add' });
345
+ const backdropAnimation = element.animate([{ opacity: 0 }, { opacity: 1 }], {
346
+ duration: 300,
347
+ easing: 'ease-out',
348
+ pseudoElement: '::backdrop',
349
+ fill: 'forwards',
350
+ });
351
+ return Promise.all([dialogAnimation.finished, backdropAnimation.finished]);
352
+ };
353
+ const fadeOutToBottom = (element) => {
354
+ const dialogAnimation = element.animate([
355
+ { transform: 'translateY(0)', opacity: 1 },
356
+ { transform: 'translateY(20px)', opacity: 0 },
357
+ ], { duration: 600, easing: spring });
358
+ const backdropAnimation = element.animate([{ opacity: 1 }, { opacity: 0 }], {
359
+ duration: 300,
360
+ easing: 'ease-out',
361
+ pseudoElement: '::backdrop',
362
+ fill: 'forwards',
363
+ });
364
+ return Promise.all([dialogAnimation.finished, backdropAnimation.finished]);
365
+ };
366
+
367
+ let BlotoutWallet = class BlotoutWallet extends s {
368
+ constructor() {
369
+ super(...arguments);
370
+ this.emailHasBeenSaved = false;
371
+ this.hasEmail = false;
372
+ this.lastExpiredCart = undefined;
373
+ this.showCheckoutModal = false;
374
+ this.onSubmit = async (ev) => {
375
+ var _a;
376
+ ev.preventDefault();
377
+ ev.stopPropagation();
378
+ const email = (_a = this.email) === null || _a === void 0 ? void 0 : _a.value.trim().toLowerCase();
379
+ try {
380
+ if (email) {
381
+ const response = await fetch(this.getUrl('/user/email'), {
382
+ method: 'POST',
383
+ body: JSON.stringify({
384
+ email: email,
385
+ }),
386
+ headers: this.getHeaders(true),
387
+ });
388
+ if (!response.ok) {
389
+ throw new Error(`Could not save email ${response.status}: ${await response.text()}`);
390
+ }
391
+ this.dispatchEvent(new CustomEvent('blotout-wallet-email-saved', { bubbles: true }));
392
+ }
393
+ if (this.lastExpiredCart) {
394
+ await this.storeApi.addItems(this.lastExpiredCart.items);
395
+ this.showCheckoutModal = true;
396
+ this.hasEmail = this.emailHasBeenSaved;
397
+ if (this.emailHasBeenSaved) {
398
+ this.email.value = '';
399
+ }
400
+ this.dispatchEvent(new CustomEvent('blotout-wallet-restored', {
401
+ bubbles: true,
402
+ }));
403
+ const response = await fetch(this.getUrl(`/cart/restore/${this.lastExpiredCart.cartId}`), {
404
+ method: 'POST',
405
+ headers: this.getHeaders(),
406
+ });
407
+ if (!response.ok) {
408
+ throw new Error(`Could not update status in DB ${response.status}: ${await response.text()}`);
409
+ }
410
+ this.lastExpiredCart = undefined;
411
+ }
412
+ }
413
+ catch (e) {
414
+ logger.error(e);
415
+ }
416
+ };
417
+ this.expiredCartContent = () => {
418
+ return x `<form method="dialog" @submit=${this.onSubmit}>
419
+ <p>
420
+ ${this.hasEmail
421
+ ? x `<strong>Your cart is waiting!</strong><br />It's one click to
422
+ restore it.`
423
+ : x `Your cart is waiting!<br />Just enter your email to bring it
424
+ back.`}
425
+ </p>
426
+ <p>
427
+ <input
428
+ type="email"
429
+ name="email"
430
+ placeholder="Enter email"
431
+ ?required=${!this.hasEmail}
432
+ style=${o({
433
+ display: this.hasEmail ? 'none' : 'block',
434
+ })}
435
+ />
436
+ </p>
437
+ <div class="actions">
438
+ <button class="action" type="submit">Restore Cart</button>
439
+ <button class="action" type="button" @click=${this.skipExpiredCart}>
440
+ Skip
441
+ </button>
442
+ </div>
443
+ </form>`;
444
+ };
445
+ this.cartRestoredContent = () => x `<p>Cart Restored!</p>
446
+ <div class="actions">
447
+ <button class="action" type="button" @click=${this.checkoutHandler}>
448
+ Checkout
449
+ </button>
450
+ <button
451
+ class="action"
452
+ type="button"
453
+ @click=${this.continueShoppingHandler}
454
+ >
455
+ Continue Shopping
456
+ </button>
457
+ </div>`;
458
+ }
459
+ get storeApi() {
460
+ var _a;
461
+ return (_a = window[registryKey]) === null || _a === void 0 ? void 0 : _a.storeAPI;
462
+ }
463
+ get isPopUpDismissed() {
464
+ return getCookieValue('isPopUpDismissed') === '1';
465
+ }
466
+ dismissPopUp() {
467
+ setCookie('isPopUpDismissed', '1');
468
+ }
469
+ connectedCallback() {
470
+ super.connectedCallback();
471
+ if (!this.userId) {
472
+ logger.error('No UserId set');
473
+ return;
474
+ }
475
+ if (this.isPopUpDismissed) {
476
+ return;
477
+ }
478
+ fetch(this.getUrl('/cart/expired'), {
479
+ method: 'GET',
480
+ headers: this.getHeaders(),
481
+ })
482
+ .then(async (response) => {
483
+ if (!response.ok) {
484
+ throw new Error(`Unable to get Expired Cart ${response.status}: ${await response.text()}`);
485
+ }
486
+ this.dispatchEvent(new CustomEvent('blotout-wallet-loaded', { bubbles: true }));
487
+ const result = await response.json();
488
+ this.hasEmail = result.email;
489
+ this.lastExpiredCart = result.carts[0];
490
+ if (result.carts && result.carts.length && !this.isPopUpDismissed) {
491
+ setTimeout(() => {
492
+ this.showModal();
493
+ }, 1000);
494
+ }
495
+ })
496
+ .catch(logger.error);
497
+ }
498
+ showModal() {
499
+ this.dialog.showModal();
500
+ new Promise(requestAnimationFrame).then(() => fadeInDialog(this.dialog));
501
+ this.dispatchEvent(new CustomEvent('blotout-wallet-shown', { bubbles: true }));
502
+ }
503
+ hideModal() {
504
+ fadeOutToBottom(this.dialog).then(() => { var _a; return (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close(); });
505
+ this.dispatchEvent(new CustomEvent('blotout-wallet-hidden', { bubbles: true }));
506
+ }
507
+ getHeaders(json = false) {
508
+ const headers = new Headers({
509
+ EdgeTagUserId: this.userId,
510
+ });
511
+ if (json) {
512
+ headers.set('Content-type', 'application/json; charset=utf-8');
513
+ }
514
+ return headers;
515
+ }
516
+ getUrl(path) {
517
+ const url = new URL(`${this.edgeURL}/providers/blotoutWallet${path}`);
518
+ if (this.storeApi) {
519
+ const { cartToken, cartCurrency } = this.storeApi.getCartInfo();
520
+ url.searchParams.set('c', cartCurrency);
521
+ url.searchParams.set('t', cartToken);
522
+ }
523
+ return url;
524
+ }
525
+ closeCartHandler() {
526
+ this.email.value = '';
527
+ this.dismissPopUp();
528
+ this.hideModal();
529
+ }
530
+ checkoutHandler() {
531
+ this.hideModal();
532
+ window.location.href = `https://${window.location.host}/cart`;
533
+ }
534
+ continueShoppingHandler() {
535
+ this.hideModal();
536
+ window.location.reload();
537
+ }
538
+ async skipExpiredCart() {
539
+ if (!this.email.value && !this.hasEmail) {
540
+ logger.error('Email not entered to skip!');
541
+ return;
542
+ }
543
+ this.hideModal();
544
+ await fetch(this.getUrl('/cart/skip'), {
545
+ method: 'POST',
546
+ headers: this.getHeaders(),
547
+ })
548
+ .then(async (response) => {
549
+ if (!response.ok) {
550
+ throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
551
+ }
552
+ this.lastExpiredCart = undefined;
553
+ })
554
+ .catch(logger.error);
555
+ }
556
+ clickDialogHandler(event) {
557
+ const rect = event.target.getBoundingClientRect();
558
+ if ((rect.left > event.clientX ||
559
+ rect.right < event.clientX ||
560
+ rect.top > event.clientY ||
561
+ rect.bottom < event.clientY) &&
562
+ event.target.nodeName === 'DIALOG') {
563
+ this.hideModal();
564
+ this.dismissPopUp();
565
+ this.email.value = '';
566
+ }
567
+ }
568
+ render() {
569
+ if (this.isPopUpDismissed) {
570
+ return T;
571
+ }
572
+ return x `<dialog @click=${this.clickDialogHandler}>
573
+ ${!this.showCheckoutModal
574
+ ? x ` <button class="dismiss" @click=${this.closeCartHandler}>
575
+ ${cross()}
576
+ </button>`
577
+ : T}
578
+ ${blotout({ class: 'logo' })}
579
+ ${this.showCheckoutModal
580
+ ? this.cartRestoredContent()
581
+ : this.expiredCartContent()}
582
+ </dialog>`;
583
+ }
584
+ };
585
+ BlotoutWallet.styles = [
586
+ cssVars,
587
+ i$4 `
588
+ * {
589
+ box-sizing: border-box;
590
+ font-family: inherit;
591
+ font-size: 16px;
592
+ line-height: 24px;
593
+ }
594
+
595
+ strong {
596
+ font-weight: bold;
597
+ }
598
+
599
+ button {
600
+ cursor: pointer;
601
+ }
602
+
603
+ .hidden {
604
+ display: none;
605
+ }
606
+
607
+ .icon {
608
+ display: block;
609
+ }
610
+
611
+ .logo {
612
+ color: var(--primary);
613
+ }
614
+
615
+ dialog {
616
+ width: 430px;
617
+ max-width: 100vw;
618
+ background: var(--secondary);
619
+ color: var(--foreground);
620
+ border: 0 solid transparent;
621
+ border-top: 4px solid var(--primary);
622
+ border-radius: 20px;
623
+ padding: 24px;
624
+ text-align: center;
625
+ }
626
+
627
+ dialog::backdrop {
628
+ background: var(--backdrop);
629
+ backdrop-filter: blur(4px);
630
+ }
631
+
632
+ .dismiss {
633
+ position: absolute;
634
+ right: 20px;
635
+ top: 20px;
636
+ padding: 0;
637
+ border: 0;
638
+ border: 0;
639
+ background: transparent;
640
+ color: var(--foreground);
641
+ cursor: pointer;
642
+ }
643
+
644
+ .dismiss > svg {
645
+ display: block;
646
+ width: 32px;
647
+ height: 32px;
648
+ }
649
+
650
+ input[name='email'] {
651
+ box-sizing: border-box;
652
+ width: 100%;
653
+ border: 1px solid var(--input-border);
654
+ color: var(--input-foreground);
655
+ background: var(--input-background);
656
+ padding: 10px 16px;
657
+ border-radius: 5px;
658
+ }
659
+
660
+ input[name='email']::placeholder {
661
+ color: var(--input-foreground);
662
+ }
663
+
664
+ .action {
665
+ width: 100%;
666
+ border: none;
667
+ color: var(--foreground);
668
+ background: var(--primary);
669
+ border-radius: 5px;
670
+ padding: 10px 16px;
671
+ }
672
+
673
+ div.actions {
674
+ display: flex;
675
+ justify-content: space-between;
676
+ gap: 10px;
677
+ }
678
+ `,
679
+ ];
680
+ __decorate([
681
+ e$1('dialog'),
682
+ __metadata("design:type", HTMLDialogElement)
683
+ ], BlotoutWallet.prototype, "dialog", void 0);
684
+ __decorate([
685
+ e$1('input[name=email]'),
686
+ __metadata("design:type", HTMLInputElement)
687
+ ], BlotoutWallet.prototype, "email", void 0);
688
+ __decorate([
689
+ r(),
690
+ __metadata("design:type", Boolean)
691
+ ], BlotoutWallet.prototype, "hasEmail", void 0);
692
+ __decorate([
693
+ r(),
694
+ __metadata("design:type", Object)
695
+ ], BlotoutWallet.prototype, "lastExpiredCart", void 0);
696
+ __decorate([
697
+ r(),
698
+ __metadata("design:type", Boolean)
699
+ ], BlotoutWallet.prototype, "showCheckoutModal", void 0);
700
+ BlotoutWallet = __decorate([
701
+ t$1('blotout-wallet')
702
+ ], BlotoutWallet);
703
+
704
+ const init = (params) => {
705
+ var _a, _b, _c, _d;
706
+ if (
707
+ // if loaded in non-browser SDKs
708
+ !window ||
709
+ !document ||
710
+ window.top !== window) {
711
+ return;
712
+ }
713
+ let store = window[registryKey].storeAPI;
714
+ if (!store) {
715
+ store = window[registryKey].storeAPI =
716
+ (_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
717
+ if (!store) {
718
+ throw new Error('Implementation for store API missing!');
719
+ }
720
+ }
721
+ if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enableUI']) {
722
+ const element = (window[registryKey].wallet =
723
+ document.createElement('blotout-wallet'));
724
+ const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
725
+ if (theme) {
726
+ element.style.cssText = Object.entries(theme)
727
+ .map(([name, value]) => `${name}:${value}`)
728
+ .join(';');
729
+ }
730
+ element.edgeURL = params.baseUrl;
731
+ element.userId = params.userId;
732
+ document.body.append(element);
733
+ }
734
+ };
735
+
95
736
  // eslint-disable-next-line @nx/enforce-module-boundaries
96
737
  const data = {
97
738
  name: packageName,
739
+ init,
98
740
  tag,
99
741
  };
100
742
  try {