@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.cjs.js CHANGED
@@ -35,6 +35,17 @@ new Set([
35
35
  ]);
36
36
 
37
37
  const packageName = 'blotoutWallet';
38
+ const customAttributes = {
39
+ '--bw-primary': { type: 'color', defaultValue: '#f25c2b' },
40
+ '--bw-secondary': { type: 'color', defaultValue: '#172a41' },
41
+ '--bw-button': { type: 'color', defaultValue: '#da2e3a' },
42
+ '--bw-foreground': { type: 'color', defaultValue: 'white' },
43
+ '--bw-input-border': { type: 'color', defaultValue: '#dbe2eb' },
44
+ '--bw-input-foreground': { type: 'color', defaultValue: '#172a41' },
45
+ '--bw-input-background': { type: 'color', defaultValue: 'white' },
46
+ '--bw-backdrop': { type: 'color', defaultValue: '#00000077' },
47
+ '--bw-z-index': { type: 'number', defaultValue: '9999' },
48
+ };
38
49
  const cartTokenCookie = 'cart';
39
50
  const cartTokenTwoCookie = 'cart2';
40
51
  const cartCurrencyCookie = 'cart_currency';
@@ -62,6 +73,58 @@ const getCookieValue = (key) => {
62
73
  return '';
63
74
  }
64
75
  };
76
+ const setCookie = (key, value) => {
77
+ try {
78
+ if (!document) {
79
+ return;
80
+ }
81
+ document.cookie = `${key}=${value};path=/`;
82
+ }
83
+ catch {
84
+ return;
85
+ }
86
+ };
87
+
88
+ const canLog = () => {
89
+ try {
90
+ return localStorage.getItem('edgeTagDebug') === '1';
91
+ }
92
+ catch {
93
+ return false;
94
+ }
95
+ };
96
+ const logger = {
97
+ log: (...args) => {
98
+ if (canLog()) {
99
+ console.log(...args);
100
+ }
101
+ },
102
+ error: (...args) => {
103
+ if (canLog()) {
104
+ console.error(...args);
105
+ }
106
+ },
107
+ info: (...args) => {
108
+ if (canLog()) {
109
+ console.info(...args);
110
+ }
111
+ },
112
+ trace: (...args) => {
113
+ if (canLog()) {
114
+ console.trace(...args);
115
+ }
116
+ },
117
+ table: (...args) => {
118
+ if (canLog()) {
119
+ console.table(...args);
120
+ }
121
+ },
122
+ dir: (...args) => {
123
+ if (canLog()) {
124
+ console.dir(...args);
125
+ }
126
+ },
127
+ };
65
128
 
66
129
  var _a;
67
130
  const registryKey = Symbol.for('blotout-wallet');
@@ -81,9 +144,9 @@ const tag = ({ eventName }) => {
81
144
  cartToken = getCookieValue(cartTokenTwoCookie);
82
145
  }
83
146
  if (eventName === 'Purchase') {
84
- document.cookie = `cart2=${cartToken};path=/;Max-Age=10`;
147
+ document.cookie = `${cartTokenTwoCookie}=${cartToken};path=/;Max-Age=10`;
85
148
  }
86
- return { platform, cartToken, cartCurrency };
149
+ return { cartToken, cartCurrency };
87
150
  }
88
151
  default: {
89
152
  return {};
@@ -91,9 +154,588 @@ const tag = ({ eventName }) => {
91
154
  }
92
155
  };
93
156
 
157
+ /******************************************************************************
158
+ Copyright (c) Microsoft Corporation.
159
+
160
+ Permission to use, copy, modify, and/or distribute this software for any
161
+ purpose with or without fee is hereby granted.
162
+
163
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
164
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
165
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
166
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
167
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
168
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
169
+ PERFORMANCE OF THIS SOFTWARE.
170
+ ***************************************************************************** */
171
+ /* global Reflect, Promise, SuppressedError, Symbol */
172
+
173
+
174
+ function __decorate(decorators, target, key, desc) {
175
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
176
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
177
+ 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;
178
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
179
+ }
180
+
181
+ function __metadata(metadataKey, metadataValue) {
182
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
183
+ }
184
+
185
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
186
+ var e = new Error(message);
187
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
188
+ };
189
+
190
+ /**
191
+ * @license
192
+ * Copyright 2019 Google LLC
193
+ * SPDX-License-Identifier: BSD-3-Clause
194
+ */
195
+ 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;
196
+
197
+ /**
198
+ * @license
199
+ * Copyright 2017 Google LLC
200
+ * SPDX-License-Identifier: BSD-3-Clause
201
+ */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");
202
+
203
+ /**
204
+ * @license
205
+ * Copyright 2017 Google LLC
206
+ * SPDX-License-Identifier: BSD-3-Clause
207
+ */
208
+ 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};
209
+
210
+ /**
211
+ * @license
212
+ * Copyright 2017 Google LLC
213
+ * SPDX-License-Identifier: BSD-3-Clause
214
+ */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");
215
+
216
+ /**
217
+ * @license
218
+ * Copyright 2017 Google LLC
219
+ * SPDX-License-Identifier: BSD-3-Clause
220
+ */
221
+ const t$1=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
222
+
223
+ /**
224
+ * @license
225
+ * Copyright 2017 Google LLC
226
+ * SPDX-License-Identifier: BSD-3-Clause
227
+ */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)}
228
+
229
+ /**
230
+ * @license
231
+ * Copyright 2017 Google LLC
232
+ * SPDX-License-Identifier: BSD-3-Clause
233
+ */function r(r){return n$1({...r,state:!0,attribute:!1})}
234
+
235
+ /**
236
+ * @license
237
+ * Copyright 2017 Google LLC
238
+ * SPDX-License-Identifier: BSD-3-Clause
239
+ */
240
+ const e$2=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
241
+
242
+ /**
243
+ * @license
244
+ * Copyright 2017 Google LLC
245
+ * SPDX-License-Identifier: BSD-3-Clause
246
+ */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)}})}}
247
+
248
+ /**
249
+ * @license
250
+ * Copyright 2017 Google LLC
251
+ * SPDX-License-Identifier: BSD-3-Clause
252
+ */
253
+ 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)}};
254
+
255
+ /**
256
+ * @license
257
+ * Copyright 2018 Google LLC
258
+ * SPDX-License-Identifier: BSD-3-Clause
259
+ */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}});
260
+
261
+ 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)';
262
+
263
+ const cssVars = i$4 `
264
+ :host {
265
+ --primary: var(
266
+ --bw-primary,
267
+ ${r$5(customAttributes['--bw-primary'].defaultValue)}
268
+ );
269
+ --secondary: var(
270
+ --bw-secondary,
271
+ ${r$5(customAttributes['--bw-secondary'].defaultValue)}
272
+ );
273
+ --button: var(
274
+ --bw-button,
275
+ ${r$5(customAttributes['--bw-button'].defaultValue)}
276
+ );
277
+ --foreground: var(
278
+ --bw-foreground,
279
+ ${r$5(customAttributes['--bw-foreground'].defaultValue)}
280
+ );
281
+ --input-border: var(
282
+ --bw-input-border,
283
+ ${r$5(customAttributes['--bw-input-border'].defaultValue)}
284
+ );
285
+ --input-foreground: var(
286
+ --bw-input-foreground,
287
+ ${r$5(customAttributes['--bw-input-foreground'].defaultValue)}
288
+ );
289
+ --input-background: var(
290
+ --bw-input-background,
291
+ ${r$5(customAttributes['--bw-input-background'].defaultValue)}
292
+ );
293
+ --backdrop: var(
294
+ --bw-backdrop,
295
+ ${r$5(customAttributes['--bw-backdrop'].defaultValue)}
296
+ );
297
+ --z-index: var(
298
+ --bw-z-index,
299
+ ${r$5(customAttributes['--bw-z-index'].defaultValue)}
300
+ );
301
+
302
+ --spring-easing: ${r$5(spring)};
303
+ }
304
+ `;
305
+
306
+ const blotout = (attrs) => b `<svg
307
+ width="26"
308
+ height="36"
309
+ viewBox="0 0 26 36"
310
+ fill="none"
311
+ xmlns="http://www.w3.org/2000/svg"
312
+ class=${attrs === null || attrs === void 0 ? void 0 : attrs.class}
313
+ style=${attrs === null || attrs === void 0 ? void 0 : attrs.style}
314
+ >
315
+ <path
316
+ fill-rule="evenodd"
317
+ clip-rule="evenodd"
318
+ 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"
319
+ fill="currentColor"
320
+ />
321
+ </svg>`;
322
+ const cross = (attrs) => b `<svg
323
+ width="32"
324
+ height="32"
325
+ viewBox="0 0 32 32"
326
+ fill="none"
327
+ xmlns="http://www.w3.org/2000/svg"
328
+ class=${attrs === null || attrs === void 0 ? void 0 : attrs.class}
329
+ style=${attrs === null || attrs === void 0 ? void 0 : attrs.style}
330
+ >
331
+ <g>
332
+ <path
333
+ 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"
334
+ fill="currentColor"
335
+ />
336
+ </g>
337
+ </svg> `;
338
+
339
+ const fadeInDialog = (element) => {
340
+ const dialogAnimation = element.animate([
341
+ { transform: 'translateY(-20px)', opacity: 0 },
342
+ { transform: 'translateY(0)', opacity: 1 },
343
+ ], { duration: 600, easing: spring, composite: 'add' });
344
+ const backdropAnimation = element.animate([{ opacity: 0 }, { opacity: 1 }], {
345
+ duration: 300,
346
+ easing: 'ease-out',
347
+ pseudoElement: '::backdrop',
348
+ fill: 'forwards',
349
+ });
350
+ return Promise.all([dialogAnimation.finished, backdropAnimation.finished]);
351
+ };
352
+ const fadeOutToBottom = (element) => {
353
+ const dialogAnimation = element.animate([
354
+ { transform: 'translateY(0)', opacity: 1 },
355
+ { transform: 'translateY(20px)', opacity: 0 },
356
+ ], { duration: 600, easing: spring });
357
+ const backdropAnimation = element.animate([{ opacity: 1 }, { opacity: 0 }], {
358
+ duration: 300,
359
+ easing: 'ease-out',
360
+ pseudoElement: '::backdrop',
361
+ fill: 'forwards',
362
+ });
363
+ return Promise.all([dialogAnimation.finished, backdropAnimation.finished]);
364
+ };
365
+
366
+ let BlotoutWallet = class BlotoutWallet extends s {
367
+ constructor() {
368
+ super(...arguments);
369
+ this.emailHasBeenSaved = false;
370
+ this.hasEmail = false;
371
+ this.lastExpiredCart = undefined;
372
+ this.showCheckoutModal = false;
373
+ this.onSubmit = async (ev) => {
374
+ var _a;
375
+ ev.preventDefault();
376
+ ev.stopPropagation();
377
+ const email = (_a = this.email) === null || _a === void 0 ? void 0 : _a.value.trim().toLowerCase();
378
+ try {
379
+ if (email) {
380
+ const response = await fetch(this.getUrl('/user/email'), {
381
+ method: 'POST',
382
+ body: JSON.stringify({
383
+ email: email,
384
+ }),
385
+ headers: this.getHeaders(true),
386
+ });
387
+ if (!response.ok) {
388
+ throw new Error(`Could not save email ${response.status}: ${await response.text()}`);
389
+ }
390
+ this.dispatchEvent(new CustomEvent('blotout-wallet-email-saved', { bubbles: true }));
391
+ }
392
+ if (this.lastExpiredCart) {
393
+ await this.storeApi.addItems(this.lastExpiredCart.items);
394
+ this.showCheckoutModal = true;
395
+ this.hasEmail = this.emailHasBeenSaved;
396
+ if (this.emailHasBeenSaved) {
397
+ this.email.value = '';
398
+ }
399
+ this.dispatchEvent(new CustomEvent('blotout-wallet-restored', {
400
+ bubbles: true,
401
+ }));
402
+ const response = await fetch(this.getUrl(`/cart/restore/${this.lastExpiredCart.cartId}`), {
403
+ method: 'POST',
404
+ headers: this.getHeaders(),
405
+ });
406
+ if (!response.ok) {
407
+ throw new Error(`Could not update status in DB ${response.status}: ${await response.text()}`);
408
+ }
409
+ this.lastExpiredCart = undefined;
410
+ }
411
+ }
412
+ catch (e) {
413
+ logger.error(e);
414
+ }
415
+ };
416
+ this.expiredCartContent = () => {
417
+ return x `<form method="dialog" @submit=${this.onSubmit}>
418
+ <p>
419
+ ${this.hasEmail
420
+ ? x `<strong>Your cart is waiting!</strong><br />It's one click to
421
+ restore it.`
422
+ : x `Your cart is waiting!<br />Just enter your email to bring it
423
+ back.`}
424
+ </p>
425
+ <p>
426
+ <input
427
+ type="email"
428
+ name="email"
429
+ placeholder="Enter email"
430
+ ?required=${!this.hasEmail}
431
+ style=${o({
432
+ display: this.hasEmail ? 'none' : 'block',
433
+ })}
434
+ />
435
+ </p>
436
+ <div class="actions">
437
+ <button class="action" type="submit">Restore Cart</button>
438
+ <button class="action" type="button" @click=${this.skipExpiredCart}>
439
+ Skip
440
+ </button>
441
+ </div>
442
+ </form>`;
443
+ };
444
+ this.cartRestoredContent = () => x `<p>Cart Restored!</p>
445
+ <div class="actions">
446
+ <button class="action" type="button" @click=${this.checkoutHandler}>
447
+ Checkout
448
+ </button>
449
+ <button
450
+ class="action"
451
+ type="button"
452
+ @click=${this.continueShoppingHandler}
453
+ >
454
+ Continue Shopping
455
+ </button>
456
+ </div>`;
457
+ }
458
+ get storeApi() {
459
+ var _a;
460
+ return (_a = window[registryKey]) === null || _a === void 0 ? void 0 : _a.storeAPI;
461
+ }
462
+ get isPopUpDismissed() {
463
+ return getCookieValue('isPopUpDismissed') === '1';
464
+ }
465
+ dismissPopUp() {
466
+ setCookie('isPopUpDismissed', '1');
467
+ }
468
+ connectedCallback() {
469
+ super.connectedCallback();
470
+ if (!this.userId) {
471
+ logger.error('No UserId set');
472
+ return;
473
+ }
474
+ if (this.isPopUpDismissed) {
475
+ return;
476
+ }
477
+ fetch(this.getUrl('/cart/expired'), {
478
+ method: 'GET',
479
+ headers: this.getHeaders(),
480
+ })
481
+ .then(async (response) => {
482
+ if (!response.ok) {
483
+ throw new Error(`Unable to get Expired Cart ${response.status}: ${await response.text()}`);
484
+ }
485
+ this.dispatchEvent(new CustomEvent('blotout-wallet-loaded', { bubbles: true }));
486
+ const result = await response.json();
487
+ this.hasEmail = result.email;
488
+ this.lastExpiredCart = result.carts[0];
489
+ if (result.carts && result.carts.length && !this.isPopUpDismissed) {
490
+ setTimeout(() => {
491
+ this.showModal();
492
+ }, 1000);
493
+ }
494
+ })
495
+ .catch(logger.error);
496
+ }
497
+ showModal() {
498
+ this.dialog.showModal();
499
+ new Promise(requestAnimationFrame).then(() => fadeInDialog(this.dialog));
500
+ this.dispatchEvent(new CustomEvent('blotout-wallet-shown', { bubbles: true }));
501
+ }
502
+ hideModal() {
503
+ fadeOutToBottom(this.dialog).then(() => { var _a; return (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close(); });
504
+ this.dispatchEvent(new CustomEvent('blotout-wallet-hidden', { bubbles: true }));
505
+ }
506
+ getHeaders(json = false) {
507
+ const headers = new Headers({
508
+ EdgeTagUserId: this.userId,
509
+ });
510
+ if (json) {
511
+ headers.set('Content-type', 'application/json; charset=utf-8');
512
+ }
513
+ return headers;
514
+ }
515
+ getUrl(path) {
516
+ const url = new URL(`${this.edgeURL}/providers/blotoutWallet${path}`);
517
+ if (this.storeApi) {
518
+ const { cartToken, cartCurrency } = this.storeApi.getCartInfo();
519
+ url.searchParams.set('c', cartCurrency);
520
+ url.searchParams.set('t', cartToken);
521
+ }
522
+ return url;
523
+ }
524
+ closeCartHandler() {
525
+ this.email.value = '';
526
+ this.dismissPopUp();
527
+ this.hideModal();
528
+ }
529
+ checkoutHandler() {
530
+ this.hideModal();
531
+ window.location.href = `https://${window.location.host}/cart`;
532
+ }
533
+ continueShoppingHandler() {
534
+ this.hideModal();
535
+ window.location.reload();
536
+ }
537
+ async skipExpiredCart() {
538
+ if (!this.email.value && !this.hasEmail) {
539
+ logger.error('Email not entered to skip!');
540
+ return;
541
+ }
542
+ this.hideModal();
543
+ await fetch(this.getUrl('/cart/skip'), {
544
+ method: 'POST',
545
+ headers: this.getHeaders(),
546
+ })
547
+ .then(async (response) => {
548
+ if (!response.ok) {
549
+ throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
550
+ }
551
+ this.lastExpiredCart = undefined;
552
+ })
553
+ .catch(logger.error);
554
+ }
555
+ clickDialogHandler(event) {
556
+ const rect = event.target.getBoundingClientRect();
557
+ if ((rect.left > event.clientX ||
558
+ rect.right < event.clientX ||
559
+ rect.top > event.clientY ||
560
+ rect.bottom < event.clientY) &&
561
+ event.target.nodeName === 'DIALOG') {
562
+ this.hideModal();
563
+ this.dismissPopUp();
564
+ this.email.value = '';
565
+ }
566
+ }
567
+ render() {
568
+ if (this.isPopUpDismissed) {
569
+ return T;
570
+ }
571
+ return x `<dialog @click=${this.clickDialogHandler}>
572
+ ${!this.showCheckoutModal
573
+ ? x ` <button class="dismiss" @click=${this.closeCartHandler}>
574
+ ${cross()}
575
+ </button>`
576
+ : T}
577
+ ${blotout({ class: 'logo' })}
578
+ ${this.showCheckoutModal
579
+ ? this.cartRestoredContent()
580
+ : this.expiredCartContent()}
581
+ </dialog>`;
582
+ }
583
+ };
584
+ BlotoutWallet.styles = [
585
+ cssVars,
586
+ i$4 `
587
+ * {
588
+ box-sizing: border-box;
589
+ font-family: inherit;
590
+ font-size: 16px;
591
+ line-height: 24px;
592
+ }
593
+
594
+ strong {
595
+ font-weight: bold;
596
+ }
597
+
598
+ button {
599
+ cursor: pointer;
600
+ }
601
+
602
+ .hidden {
603
+ display: none;
604
+ }
605
+
606
+ .icon {
607
+ display: block;
608
+ }
609
+
610
+ .logo {
611
+ color: var(--primary);
612
+ }
613
+
614
+ dialog {
615
+ width: 430px;
616
+ max-width: 100vw;
617
+ background: var(--secondary);
618
+ color: var(--foreground);
619
+ border: 0 solid transparent;
620
+ border-top: 4px solid var(--primary);
621
+ border-radius: 20px;
622
+ padding: 24px;
623
+ text-align: center;
624
+ }
625
+
626
+ dialog::backdrop {
627
+ background: var(--backdrop);
628
+ backdrop-filter: blur(4px);
629
+ }
630
+
631
+ .dismiss {
632
+ position: absolute;
633
+ right: 20px;
634
+ top: 20px;
635
+ padding: 0;
636
+ border: 0;
637
+ border: 0;
638
+ background: transparent;
639
+ color: var(--foreground);
640
+ cursor: pointer;
641
+ }
642
+
643
+ .dismiss > svg {
644
+ display: block;
645
+ width: 32px;
646
+ height: 32px;
647
+ }
648
+
649
+ input[name='email'] {
650
+ box-sizing: border-box;
651
+ width: 100%;
652
+ border: 1px solid var(--input-border);
653
+ color: var(--input-foreground);
654
+ background: var(--input-background);
655
+ padding: 10px 16px;
656
+ border-radius: 5px;
657
+ }
658
+
659
+ input[name='email']::placeholder {
660
+ color: var(--input-foreground);
661
+ }
662
+
663
+ .action {
664
+ width: 100%;
665
+ border: none;
666
+ color: var(--foreground);
667
+ background: var(--primary);
668
+ border-radius: 5px;
669
+ padding: 10px 16px;
670
+ }
671
+
672
+ div.actions {
673
+ display: flex;
674
+ justify-content: space-between;
675
+ gap: 10px;
676
+ }
677
+ `,
678
+ ];
679
+ __decorate([
680
+ e$1('dialog'),
681
+ __metadata("design:type", HTMLDialogElement)
682
+ ], BlotoutWallet.prototype, "dialog", void 0);
683
+ __decorate([
684
+ e$1('input[name=email]'),
685
+ __metadata("design:type", HTMLInputElement)
686
+ ], BlotoutWallet.prototype, "email", void 0);
687
+ __decorate([
688
+ r(),
689
+ __metadata("design:type", Boolean)
690
+ ], BlotoutWallet.prototype, "hasEmail", void 0);
691
+ __decorate([
692
+ r(),
693
+ __metadata("design:type", Object)
694
+ ], BlotoutWallet.prototype, "lastExpiredCart", void 0);
695
+ __decorate([
696
+ r(),
697
+ __metadata("design:type", Boolean)
698
+ ], BlotoutWallet.prototype, "showCheckoutModal", void 0);
699
+ BlotoutWallet = __decorate([
700
+ t$1('blotout-wallet')
701
+ ], BlotoutWallet);
702
+
703
+ const init = (params) => {
704
+ var _a, _b, _c, _d;
705
+ if (
706
+ // if loaded in non-browser SDKs
707
+ !window ||
708
+ !document ||
709
+ window.top !== window) {
710
+ return;
711
+ }
712
+ let store = window[registryKey].storeAPI;
713
+ if (!store) {
714
+ store = window[registryKey].storeAPI =
715
+ (_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
716
+ if (!store) {
717
+ throw new Error('Implementation for store API missing!');
718
+ }
719
+ }
720
+ if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enableUI']) {
721
+ const element = (window[registryKey].wallet =
722
+ document.createElement('blotout-wallet'));
723
+ const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
724
+ if (theme) {
725
+ element.style.cssText = Object.entries(theme)
726
+ .map(([name, value]) => `${name}:${value}`)
727
+ .join(';');
728
+ }
729
+ element.edgeURL = params.baseUrl;
730
+ element.userId = params.userId;
731
+ document.body.append(element);
732
+ }
733
+ };
734
+
94
735
  // eslint-disable-next-line @nx/enforce-module-boundaries
95
736
  const data = {
96
737
  name: packageName,
738
+ init,
97
739
  tag,
98
740
  };
99
741
  try {