@blotoutio/providers-blotout-wallet-sdk 0.66.0 → 0.67.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
@@ -34,6 +34,18 @@ new Set([
34
34
  ...expand('911,921,922,923,924,926,927,932,933,935,942,944,946,950,953,955,957-958,960-969,974,975,976,977,981-982,987,988,990-999'),
35
35
  ]);
36
36
 
37
+ const EMAIL_RE = /^[\w!#$%&'*+/=?^`{|}~-]+(:?\.[\w!#$%&'*+/=?^`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
38
+ const normalizeEmail = (email) => {
39
+ if (!email) {
40
+ return '';
41
+ }
42
+ const trimmedEmail = email.trim().toLowerCase();
43
+ if (!EMAIL_RE.test(trimmedEmail)) {
44
+ return '';
45
+ }
46
+ return trimmedEmail;
47
+ };
48
+
37
49
  const delay = (n, resolvedValue) => new Promise((resolve) => setTimeout(() => resolve(resolvedValue), n));
38
50
 
39
51
  const createEnabled = () => ({
@@ -111,9 +123,11 @@ const customAttributes = {
111
123
  const packageName = 'blotoutWallet';
112
124
  const PREVIEW_KEY_NAME = '_blotoutWalletPreview';
113
125
 
114
- var _a;
126
+ var _a$1;
115
127
  const registryKey = Symbol.for('blotout-wallet');
116
- (_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
128
+ if (typeof window != 'undefined') {
129
+ (_a$1 = window[registryKey]) !== null && _a$1 !== void 0 ? _a$1 : (window[registryKey] = {});
130
+ }
117
131
 
118
132
  // eslint-disable-next-line @nx/enforce-module-boundaries
119
133
  const getPreviewKey = () => {
@@ -132,7 +146,7 @@ const tag = () => {
132
146
  cartToken: null,
133
147
  previewKey: getPreviewKey(),
134
148
  };
135
- if (!window) {
149
+ if (typeof window == 'undefined') {
136
150
  return result;
137
151
  }
138
152
  const store = window[registryKey].storeAPI;
@@ -142,6 +156,250 @@ const tag = () => {
142
156
  return result;
143
157
  };
144
158
 
159
+ /**
160
+ * @license
161
+ * Copyright 2019 Google LLC
162
+ * SPDX-License-Identifier: BSD-3-Clause
163
+ */
164
+ 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$5=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$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.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;
165
+
166
+ /**
167
+ * @license
168
+ * Copyright 2017 Google LLC
169
+ * SPDX-License-Identifier: BSD-3-Clause
170
+ */const{is:i$3,defineProperty:e$4,getOwnPropertyDescriptor:r$4,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$4,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$4(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");
171
+
172
+ /**
173
+ * @license
174
+ * Copyright 2017 Google LLC
175
+ * SPDX-License-Identifier: BSD-3-Clause
176
+ */
177
+ 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$3="?"+h,n$2=`<${o$3}>`,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$3)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};
178
+
179
+ /**
180
+ * @license
181
+ * Copyright 2017 Google LLC
182
+ * SPDX-License-Identifier: BSD-3-Clause
183
+ */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");
184
+
185
+ const cart = (attrs) => b `<svg class=${attrs === null || attrs === void 0 ? void 0 : attrs.class} style=${attrs === null || attrs === void 0 ? void 0 : attrs.style} width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
186
+ <g clip-path="url(#clip0_10367_379)">
187
+ <path d="M20 60C22.2091 60 24 58.2091 24 56C24 53.7909 22.2091 52 20 52C17.7909 52 16 53.7909 16 56C16 58.2091 17.7909 60 20 60Z" fill="currentColor"/>
188
+ <path d="M48 60C50.2091 60 52 58.2091 52 56C52 53.7909 50.2091 52 48 52C45.7909 52 44 53.7909 44 56C44 58.2091 45.7909 60 48 60Z" fill="currentColor"/>
189
+ <path d="M56 14.0004H11.64L10 5.60041C9.9065 5.14186 9.65515 4.73061 9.28972 4.43826C8.92428 4.14591 8.46789 3.99097 8 4.00041H0V8.00041H6.36L14 46.4004C14.0935 46.859 14.3448 47.2702 14.7103 47.5626C15.0757 47.8549 15.5321 48.0098 16 48.0004H52V44.0004H17.64L16 36.0004H52C52.4623 36.0117 52.9143 35.8624 53.2789 35.578C53.6436 35.2936 53.8984 34.8916 54 34.4404L58 16.4404C58.067 16.1437 58.0655 15.8355 57.9954 15.5395C57.9254 15.2434 57.7888 14.9672 57.5959 14.7319C57.4031 14.4967 57.1591 14.3085 56.8825 14.1817C56.606 14.0549 56.3041 13.9929 56 14.0004ZM50.4 32.0004H15.24L12.44 18.0004H53.5L50.4 32.0004Z" fill="currentColor"/>
190
+ </g>
191
+ <defs>
192
+ <clipPath id="clip0_10367_379">
193
+ <rect width="64" height="64" fill="none"/>
194
+ </clipPath>
195
+ </defs>
196
+ </svg>
197
+ `;
198
+ const cartTick = (attrs) => b `<svg class=${attrs === null || attrs === void 0 ? void 0 : attrs.class} style=${attrs === null || attrs === void 0 ? void 0 : attrs.style} width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
199
+ <g clip-path="url(#clip0_10367_199)">
200
+ <path d="M20 60C22.2091 60 24 58.2091 24 56C24 53.7909 22.2091 52 20 52C17.7909 52 16 53.7909 16 56C16 58.2091 17.7909 60 20 60Z" fill="currentColor"/>
201
+ <path d="M48 60C50.2091 60 52 58.2091 52 56C52 53.7909 50.2091 52 48 52C45.7909 52 44 53.7909 44 56C44 58.2091 45.7909 60 48 60Z" fill="currentColor"/>
202
+ <path d="M9.9612 5.6078C9.87053 5.15441 9.62557 4.74645 9.26801 4.45332C8.91045 4.16018 8.46236 3.99999 8 4H0V8H6.36L14.0388 46.3922C14.1295 46.8456 14.3744 47.2536 14.732 47.5467C15.0896 47.8398 15.5376 48 16 48H52V44H17.64L16.04 36H52C52.455 36 52.8965 35.8449 53.2514 35.5601C53.6064 35.2754 53.8537 34.8782 53.9524 34.434L58.489 14H54.3942L50.3964 32H15.24L9.9612 5.6078Z" fill="currentColor"/>
203
+ <path d="M32 16.3992L26.8 11.1992L24 13.9992L32 21.9992L46 7.99922L43.2 5.19922L32 16.3992Z" fill="currentColor"/>
204
+ </g>
205
+ <defs>
206
+ <clipPath id="clip0_10367_199">
207
+ <rect width="64" height="64" fill="none"/>
208
+ </clipPath>
209
+ </defs>
210
+ </svg>
211
+ `;
212
+ const circleCross = (attrs) => b `<svg class=${attrs === null || attrs === void 0 ? void 0 : attrs.class} style=${attrs === null || attrs === void 0 ? void 0 : attrs.style} width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
213
+ <path d="M32 9.25C44.544 9.25 54.75 19.456 54.75 32C54.75 44.544 44.544 54.75 32 54.75C19.456 54.75 9.25 44.544 9.25 32C9.25 19.456 19.456 9.25 32 9.25ZM32 4C16.5361 4 4 16.5361 4 32C4 47.4639 16.5361 60 32 60C47.4639 60 60 47.4639 60 32C60 16.5361 47.4639 4 32 4Z" fill="currentColor"/>
214
+ <path d="M47.5332 12.334L51.2443 16.0451L15.5379 51.7515L11.8268 48.0404L47.5332 12.334Z" fill="currentColor"/>
215
+ </svg>
216
+ `;
217
+ const logoImage = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAgCAYAAABU1PscAAAACXBIWXMAAAsTAAALEwEAmpwYAAAEt0lEQVRYhdWYX4hUdRTHP+d358+6azNGqUVqilrQXaNIClKSQHsQpJceSu4IBSFIvQRWLwWW9dBD0IMYvUTNSAUGGVRYGLFQQU8aO2VhhVpBlOHcdXd2Z+b+vj3MrG6z7c7OpO32hTt/DjO/+/2ec37nnPszgJEoXCvYB2w3WCIwFi5+B44AB3Kl8nEbKYTrJT4ZSLlV1cSb13zzmx2BGWlneGmo5rUvJfH8QMqtGm34hez1i0gkvBeIzUDkgO3V5P9BfhISYDgzdqQMFrenjQGZwDAgEdQXYF5J4IxrXTs1ZyCojHs9UU30QN3rlZSzsXlh2QFe4NqNzgzgvEnFfKn8ruCoQW2h5tg0AS0YWF8lCg3I/JeEukVqvgmYzezFuWBeBQRmeClJoAokvawxbwICMzz6WbAf7BhQp4cJYE4CDEg7I3CGJERzs0ui7kXSQ5UNHJjsq4b0ea40fKr7FZqYi4Ag5Yxqw39X8zoKHBfEhpYCdwPbsoEtq3k5dSNEgPCtT8RRuBK4AUhP2i6PAOOPsYbfCxwWVsmXhqcu/mqlEK6ZSLQ37WxnIuV9FxraUMg4e9wZ1xmGEA0vGppdTEcB+WJ5CBia/D5S2JAWygJjueKwzxfLPwF74ig8lQnsqbrXsq4icQlBzavevJd+aHG73ZndhJSZack5b+KRaPB6occkfx+wBPgljsJDwDu5UjnOlcovx1G4OhvYrrpXvofpw4DXgTdypfKPAHEUbnLGCx62zOSUOZXgkcLgeqEjAyn3ZNbZxrSzdX2B25IN7DVnvBRH4XIAwcGJRKfpIofb0P6/oFOb6BiB8d0brTZafbE/5W4da/jU5B3qCGcQmO0GfR1HYSlXKn8bR+GXKbPVDZTrMgoCHgG2xlF4BgiADYlYyyxPWB0F1MaqG4B7qonPtvPxgowzEmkH8AEQA8PO7AJSriv6kGScpZ2xCdgkoOFFIolZItp5D8hWpB2ZxgzuTCQkVgDZlumcGY0uyQMUa16fctnLKDqfNOv1P8IZmBFLF0kvphn+2WGt1xbVXKl8Fjjbmc/fMYc+YCe89H0msI31RKl21zgMB8c8qrRM673U32nZxINHdwKb4yic4EqNErni8Ggchc/VEhWzgV1T92o9DRl9gTGe+C8ScUimP+PC4FKku+qeqzr1gkQiMFvp0QH9i2FuTmU0Vyp/hLFzItGQF+MtAiOjDf9WIh4WnMoXvxFSIRvYzTA9UjOJwAgCY3Fg5Hu55tzIcsXyx5Vdt3xm3tYLloD9CpzNlYYbACOFwa2S9tS9lndTPqUeXd/CTAIEjOdLZVUK4ToTi4CTuTfLNaA89Yf+0dvsQrX+kKT9zuxG9ThH9AqLo9AzZfM4Ay8qwNPAGWAbUADea10nMRszKS+4A3gw7exeSf2Jem/BPQsYiULf3ugMSLmmSYAk0s5R955EjNGsGH2ZwDImrOY7jIxXCM6MlCB2xt+GL9E8CzIueTRJPAY4o3/SXuvlSeYywQyEzjngw0XBtOMhYHo6iOb4kKj5Pl+wpge9xGEn7NnRhj89kHJyC/XwZwoCM7LOkXY2BLxtAJUoXGPwDHC/wdUL8Xi9lbYe+A14HziYK5VP/AXU+TX099lFgwAAAABJRU5ErkJggg==`;
218
+
219
+ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, storeAPI, }) => {
220
+ if (!baseURL) {
221
+ throw new Error(`baseURL missing`);
222
+ }
223
+ if (!userId) {
224
+ throw new Error(`userId missing`);
225
+ }
226
+ if (!storeAPI) {
227
+ throw new Error(`store API implementation missing`);
228
+ }
229
+ const getHeaders = (json = false) => {
230
+ const headers = new Headers({ EdgeTagUserId: userId });
231
+ if (json) {
232
+ headers.set('Content-type', 'application/json; charset=utf-8');
233
+ }
234
+ return headers;
235
+ };
236
+ const getURL = (path) => {
237
+ const url = new URL(`/providers/blotoutWallet${path}`, baseURL);
238
+ const cartToken = storeAPI.getCartToken();
239
+ if (cartToken) {
240
+ url.searchParams.set('t', cartToken);
241
+ }
242
+ const previewKey = getPreviewKey();
243
+ if (previewKey) {
244
+ url.searchParams.set('pk', previewKey);
245
+ }
246
+ return url;
247
+ };
248
+ const getExpiredCarts = async () => {
249
+ const response = await fetchImpl(getURL('/cart/expired'), {
250
+ method: 'GET',
251
+ headers: getHeaders(),
252
+ });
253
+ if (!response.ok) {
254
+ throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
255
+ }
256
+ const result = (await response.json());
257
+ if (result.hasJustExpired) {
258
+ window.edgetag('tag', 'CartRecovery_CartExpiredOnVisit', undefined, undefined, { destination: baseURL });
259
+ }
260
+ return result;
261
+ };
262
+ const sendEvent = async (action) => {
263
+ const response = await fetchImpl(getURL('/user/event'), {
264
+ method: 'POST',
265
+ headers: getHeaders(true),
266
+ body: JSON.stringify({ action }),
267
+ });
268
+ if (!response.ok) {
269
+ throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
270
+ }
271
+ };
272
+ const saveEmail = async (email) => {
273
+ const normalized = normalizeEmail(email);
274
+ if (!normalized) {
275
+ throw new Error(`Could not save email - invalid email format`);
276
+ }
277
+ window.edgetag('user', 'email', normalized, {}, { destination: baseURL });
278
+ const response = await fetchImpl(getURL('/user/email'), {
279
+ method: 'POST',
280
+ headers: getHeaders(true),
281
+ body: JSON.stringify({ email: normalized }),
282
+ });
283
+ if (!response.ok) {
284
+ throw new Error(`Could not save email - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
285
+ }
286
+ window.edgetag('tag', 'CartRecovery_KeepCartEmailSaved', undefined, undefined, { destination: baseURL });
287
+ };
288
+ const restoreCart = async (cartId, isSilent) => {
289
+ const response = await fetchImpl(getURL(`/cart/restore/${encodeURIComponent(cartId)}`), {
290
+ method: 'POST',
291
+ headers: getHeaders(),
292
+ });
293
+ if (!response.ok) {
294
+ throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
295
+ }
296
+ // Send the request as beacon as there could be a immediate redirect in the next step
297
+ window.edgetag('tag', 'CartRecovery_CartRestored', { isSilent }, undefined, { method: 'beacon' });
298
+ };
299
+ const deleteCarts = async () => {
300
+ const response = await fetchImpl(getURL('/cart/skip'), {
301
+ method: 'POST',
302
+ headers: getHeaders(),
303
+ });
304
+ if (!response.ok) {
305
+ throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
306
+ }
307
+ window.edgetag('tag', 'CartRecovery_CartDeclined', undefined, undefined, {
308
+ destination: baseURL,
309
+ });
310
+ };
311
+ return {
312
+ getExpiredCarts,
313
+ sendEvent,
314
+ saveEmail,
315
+ restoreCart,
316
+ deleteCarts,
317
+ };
318
+ };
319
+
320
+ const logStyles = `
321
+ padding: 4px 8px 4px 36px;
322
+ border: 1px dashed red;
323
+ border-radius: 3px;
324
+ font-weight: bold;
325
+ background: url(${logoImage}) 8px 50% no-repeat;
326
+ background-size: 24px 16px;
327
+ `;
328
+ const log = (message) => console.log(`%c${message}`, logStyles);
329
+ const error = (message) => console.error(`%c${message}`, logStyles);
330
+ const init = (params) => {
331
+ var _a, _b, _c, _d, _e, _f, _g, _h;
332
+ if (typeof window == 'undefined' || typeof document == 'undefined') {
333
+ // if loaded in non-browser SDKs, return early
334
+ return;
335
+ }
336
+ let storeAPI = window[registryKey].storeAPI;
337
+ if (!storeAPI) {
338
+ storeAPI = window[registryKey].storeAPI =
339
+ (_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
340
+ }
341
+ if (!storeAPI) {
342
+ console.error('Implementation for store API missing!');
343
+ return;
344
+ }
345
+ if (window.top !== window) {
346
+ // exit if not in top window
347
+ return;
348
+ }
349
+ const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
350
+ const experiment = createExperiment({
351
+ name: mode,
352
+ userId: params.userId,
353
+ previewKey,
354
+ userPreviewKey: getPreviewKey(),
355
+ });
356
+ if (experiment.name == 'preview') {
357
+ if (experiment.isEnabled) {
358
+ log('Previewing functionality using preview key');
359
+ }
360
+ else if (getPreviewKey()) {
361
+ log('Preview key set but does not match the configured key');
362
+ }
363
+ }
364
+ if (enabled || experiment.isEnabled) {
365
+ const uiImplementation = window[registryKey].ui;
366
+ if (!uiImplementation) {
367
+ error('UI implementation is missing');
368
+ return;
369
+ }
370
+ const walletAPI = createWalletAPI({
371
+ baseURL: params.baseUrl,
372
+ storeAPI,
373
+ userId: params.userId,
374
+ });
375
+ uiImplementation.init({
376
+ theme: (_e = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d.theme) !== null && _e !== void 0 ? _e : {},
377
+ afterRestore: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.afterRestore) !== null && _g !== void 0 ? _g : {
378
+ action: 'none',
379
+ },
380
+ silentRestore: !!((_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.silentRestore),
381
+ walletAPI,
382
+ storeAPI,
383
+ });
384
+ }
385
+ };
386
+
387
+ // eslint-disable-next-line @nx/enforce-module-boundaries
388
+ const data = {
389
+ name: packageName,
390
+ init,
391
+ tag,
392
+ };
393
+ try {
394
+ if (typeof window !== 'undefined') {
395
+ window.edgetagProviders = window.edgetagProviders || [];
396
+ window.edgetagProviders.push(data);
397
+ }
398
+ }
399
+ catch {
400
+ // no window
401
+ }
402
+
145
403
  /******************************************************************************
146
404
  Copyright (c) Microsoft Corporation.
147
405
 
@@ -175,32 +433,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
175
433
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
176
434
  };
177
435
 
178
- /**
179
- * @license
180
- * Copyright 2019 Google LLC
181
- * SPDX-License-Identifier: BSD-3-Clause
182
- */
183
- 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$5=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$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.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;
184
-
185
- /**
186
- * @license
187
- * Copyright 2017 Google LLC
188
- * SPDX-License-Identifier: BSD-3-Clause
189
- */const{is:i$3,defineProperty:e$4,getOwnPropertyDescriptor:r$4,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$4,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$4(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");
190
-
191
- /**
192
- * @license
193
- * Copyright 2017 Google LLC
194
- * SPDX-License-Identifier: BSD-3-Clause
195
- */
196
- 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$3="?"+h,n$2=`<${o$3}>`,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$3)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};
197
-
198
- /**
199
- * @license
200
- * Copyright 2017 Google LLC
201
- * SPDX-License-Identifier: BSD-3-Clause
202
- */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");
203
-
204
436
  /**
205
437
  * @license
206
438
  * Copyright 2017 Google LLC
@@ -464,40 +696,6 @@ const logger = {
464
696
  },
465
697
  };
466
698
 
467
- const cart = (attrs) => b `<svg class=${attrs === null || attrs === void 0 ? void 0 : attrs.class} style=${attrs === null || attrs === void 0 ? void 0 : attrs.style} width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
468
- <g clip-path="url(#clip0_10367_379)">
469
- <path d="M20 60C22.2091 60 24 58.2091 24 56C24 53.7909 22.2091 52 20 52C17.7909 52 16 53.7909 16 56C16 58.2091 17.7909 60 20 60Z" fill="currentColor"/>
470
- <path d="M48 60C50.2091 60 52 58.2091 52 56C52 53.7909 50.2091 52 48 52C45.7909 52 44 53.7909 44 56C44 58.2091 45.7909 60 48 60Z" fill="currentColor"/>
471
- <path d="M56 14.0004H11.64L10 5.60041C9.9065 5.14186 9.65515 4.73061 9.28972 4.43826C8.92428 4.14591 8.46789 3.99097 8 4.00041H0V8.00041H6.36L14 46.4004C14.0935 46.859 14.3448 47.2702 14.7103 47.5626C15.0757 47.8549 15.5321 48.0098 16 48.0004H52V44.0004H17.64L16 36.0004H52C52.4623 36.0117 52.9143 35.8624 53.2789 35.578C53.6436 35.2936 53.8984 34.8916 54 34.4404L58 16.4404C58.067 16.1437 58.0655 15.8355 57.9954 15.5395C57.9254 15.2434 57.7888 14.9672 57.5959 14.7319C57.4031 14.4967 57.1591 14.3085 56.8825 14.1817C56.606 14.0549 56.3041 13.9929 56 14.0004ZM50.4 32.0004H15.24L12.44 18.0004H53.5L50.4 32.0004Z" fill="currentColor"/>
472
- </g>
473
- <defs>
474
- <clipPath id="clip0_10367_379">
475
- <rect width="64" height="64" fill="none"/>
476
- </clipPath>
477
- </defs>
478
- </svg>
479
- `;
480
- const cartTick = (attrs) => b `<svg class=${attrs === null || attrs === void 0 ? void 0 : attrs.class} style=${attrs === null || attrs === void 0 ? void 0 : attrs.style} width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
481
- <g clip-path="url(#clip0_10367_199)">
482
- <path d="M20 60C22.2091 60 24 58.2091 24 56C24 53.7909 22.2091 52 20 52C17.7909 52 16 53.7909 16 56C16 58.2091 17.7909 60 20 60Z" fill="currentColor"/>
483
- <path d="M48 60C50.2091 60 52 58.2091 52 56C52 53.7909 50.2091 52 48 52C45.7909 52 44 53.7909 44 56C44 58.2091 45.7909 60 48 60Z" fill="currentColor"/>
484
- <path d="M9.9612 5.6078C9.87053 5.15441 9.62557 4.74645 9.26801 4.45332C8.91045 4.16018 8.46236 3.99999 8 4H0V8H6.36L14.0388 46.3922C14.1295 46.8456 14.3744 47.2536 14.732 47.5467C15.0896 47.8398 15.5376 48 16 48H52V44H17.64L16.04 36H52C52.455 36 52.8965 35.8449 53.2514 35.5601C53.6064 35.2754 53.8537 34.8782 53.9524 34.434L58.489 14H54.3942L50.3964 32H15.24L9.9612 5.6078Z" fill="currentColor"/>
485
- <path d="M32 16.3992L26.8 11.1992L24 13.9992L32 21.9992L46 7.99922L43.2 5.19922L32 16.3992Z" fill="currentColor"/>
486
- </g>
487
- <defs>
488
- <clipPath id="clip0_10367_199">
489
- <rect width="64" height="64" fill="none"/>
490
- </clipPath>
491
- </defs>
492
- </svg>
493
- `;
494
- const circleCross = (attrs) => b `<svg class=${attrs === null || attrs === void 0 ? void 0 : attrs.class} style=${attrs === null || attrs === void 0 ? void 0 : attrs.style} width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
495
- <path d="M32 9.25C44.544 9.25 54.75 19.456 54.75 32C54.75 44.544 44.544 54.75 32 54.75C19.456 54.75 9.25 44.544 9.25 32C9.25 19.456 19.456 9.25 32 9.25ZM32 4C16.5361 4 4 16.5361 4 32C4 47.4639 16.5361 60 32 60C47.4639 60 60 47.4639 60 32C60 16.5361 47.4639 4 32 4Z" fill="currentColor"/>
496
- <path d="M47.5332 12.334L51.2443 16.0451L15.5379 51.7515L11.8268 48.0404L47.5332 12.334Z" fill="currentColor"/>
497
- </svg>
498
- `;
499
- const logoImage = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAgCAYAAABU1PscAAAACXBIWXMAAAsTAAALEwEAmpwYAAAEt0lEQVRYhdWYX4hUdRTHP+d358+6azNGqUVqilrQXaNIClKSQHsQpJceSu4IBSFIvQRWLwWW9dBD0IMYvUTNSAUGGVRYGLFQQU8aO2VhhVpBlOHcdXd2Z+b+vj3MrG6z7c7OpO32hTt/DjO/+/2ec37nnPszgJEoXCvYB2w3WCIwFi5+B44AB3Kl8nEbKYTrJT4ZSLlV1cSb13zzmx2BGWlneGmo5rUvJfH8QMqtGm34hez1i0gkvBeIzUDkgO3V5P9BfhISYDgzdqQMFrenjQGZwDAgEdQXYF5J4IxrXTs1ZyCojHs9UU30QN3rlZSzsXlh2QFe4NqNzgzgvEnFfKn8ruCoQW2h5tg0AS0YWF8lCg3I/JeEukVqvgmYzezFuWBeBQRmeClJoAokvawxbwICMzz6WbAf7BhQp4cJYE4CDEg7I3CGJERzs0ui7kXSQ5UNHJjsq4b0ea40fKr7FZqYi4Ag5Yxqw39X8zoKHBfEhpYCdwPbsoEtq3k5dSNEgPCtT8RRuBK4AUhP2i6PAOOPsYbfCxwWVsmXhqcu/mqlEK6ZSLQ37WxnIuV9FxraUMg4e9wZ1xmGEA0vGppdTEcB+WJ5CBia/D5S2JAWygJjueKwzxfLPwF74ig8lQnsqbrXsq4icQlBzavevJd+aHG73ZndhJSZack5b+KRaPB6occkfx+wBPgljsJDwDu5UjnOlcovx1G4OhvYrrpXvofpw4DXgTdypfKPAHEUbnLGCx62zOSUOZXgkcLgeqEjAyn3ZNbZxrSzdX2B25IN7DVnvBRH4XIAwcGJRKfpIofb0P6/oFOb6BiB8d0brTZafbE/5W4da/jU5B3qCGcQmO0GfR1HYSlXKn8bR+GXKbPVDZTrMgoCHgG2xlF4BgiADYlYyyxPWB0F1MaqG4B7qonPtvPxgowzEmkH8AEQA8PO7AJSriv6kGScpZ2xCdgkoOFFIolZItp5D8hWpB2ZxgzuTCQkVgDZlumcGY0uyQMUa16fctnLKDqfNOv1P8IZmBFLF0kvphn+2WGt1xbVXKl8Fjjbmc/fMYc+YCe89H0msI31RKl21zgMB8c8qrRM673U32nZxINHdwKb4yic4EqNErni8Ggchc/VEhWzgV1T92o9DRl9gTGe+C8ScUimP+PC4FKku+qeqzr1gkQiMFvp0QH9i2FuTmU0Vyp/hLFzItGQF+MtAiOjDf9WIh4WnMoXvxFSIRvYzTA9UjOJwAgCY3Fg5Hu55tzIcsXyx5Vdt3xm3tYLloD9CpzNlYYbACOFwa2S9tS9lndTPqUeXd/CTAIEjOdLZVUK4ToTi4CTuTfLNaA89Yf+0dvsQrX+kKT9zuxG9ThH9AqLo9AzZfM4Ay8qwNPAGWAbUADea10nMRszKS+4A3gw7exeSf2Jem/BPQsYiULf3ugMSLmmSYAk0s5R955EjNGsGH2ZwDImrOY7jIxXCM6MlCB2xt+GL9E8CzIueTRJPAY4o3/SXuvlSeYywQyEzjngw0XBtOMhYHo6iOb4kKj5Pl+wpge9xGEn7NnRhj89kHJyC/XwZwoCM7LOkXY2BLxtAJUoXGPwDHC/wdUL8Xi9lbYe+A14HziYK5VP/AXU+TX099lFgwAAAABJRU5ErkJggg==`;
500
-
501
699
  /**
502
700
  * Sets the max-age for the dismissed popup cookie
503
701
  */
@@ -530,45 +728,23 @@ let BlotoutWallet = class BlotoutWallet extends s {
530
728
  }
531
729
  const email = this.email.value.trim().toLowerCase();
532
730
  if (email) {
533
- window.edgetag('user', 'email', email, {}, { destination: this.edgeURL });
534
- const response = await fetch(this.getUrl('/user/email'), {
535
- method: 'POST',
536
- body: JSON.stringify({
537
- email: email,
538
- }),
539
- headers: this.getHeaders(true),
540
- });
541
- if (!response.ok) {
542
- throw new Error(`Could not save email ${response.status}: ${await response.text()}`);
543
- }
731
+ await this.walletAPI.saveEmail(email);
544
732
  this.email.value = '';
545
733
  this.hasEmail = true;
546
734
  this.dispatchEvent(new CustomEvent('blotout-wallet-email-saved', { bubbles: true }));
547
- window.edgetag('tag', 'CartRecovery_KeepCartEmailSaved', {}, {}, { destination: this.edgeURL });
548
735
  }
549
- this.restoreResponse = await this.storeApi.addItems(this.lastExpiredCart.items, this.lastExpiredCart.token);
736
+ this.restoreResponse = await this.storeAPI.addItems(this.lastExpiredCart.items, this.lastExpiredCart.token);
550
737
  const expiredCartId = this.lastExpiredCart.cartId;
551
738
  // We attempt to mark the cart as restored, but if the request fails,
552
739
  // we log the error in the console and let the user continue. Since the
553
740
  // problem is probably in the `/cart/restore` endpoint, further attempts
554
741
  // would not resolve the problem, which would just increase the number
555
742
  // of failed calls and not solve the problem.
556
- await fetch(this.getUrl(`/cart/restore/${expiredCartId}`), {
557
- method: 'POST',
558
- headers: this.getHeaders(),
559
- })
560
- .then(async (response) => {
561
- if (!response.ok) {
562
- throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
563
- }
564
- })
565
- .catch(logger.error);
743
+ await this.walletAPI.restoreCart(expiredCartId, this.silentRestore).catch(logger.error);
566
744
  this.lastExpiredCart = undefined;
567
745
  this.dispatchEvent(new CustomEvent('blotout-wallet-cart-restored', {
568
746
  bubbles: true,
569
747
  }));
570
- // Send the request as beacon as there could be a immediate redirect in the next step
571
- window.edgetag('tag', 'CartRecovery_CartRestored', { isSilent: !!this.silentRestore }, {}, { method: 'beacon', destination: this.edgeURL });
572
748
  };
573
749
  this.onSubmit = async (ev) => {
574
750
  ev.preventDefault();
@@ -598,7 +774,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
598
774
  break;
599
775
  }
600
776
  case 'checkout': {
601
- const url = this.storeApi.getCheckoutURL();
777
+ const url = this.storeAPI.getCheckoutURL();
602
778
  if (url) {
603
779
  window.location.href = url.toString();
604
780
  }
@@ -687,26 +863,12 @@ let BlotoutWallet = class BlotoutWallet extends s {
687
863
  `;
688
864
  };
689
865
  }
690
- get storeApi() {
691
- var _a;
692
- return (_a = window[registryKey]) === null || _a === void 0 ? void 0 : _a.storeAPI;
693
- }
694
866
  get isPopUpDismissed() {
695
867
  return getCookieValue('isPopUpDismissed') === '1';
696
868
  }
697
869
  setDismissed() {
698
870
  setCookie('isPopUpDismissed', '1', { maxAge: DISMISSED_COOKIE_LIFETIME });
699
- fetch(this.getUrl('/user/event'), {
700
- method: 'POST',
701
- headers: this.getHeaders(),
702
- body: JSON.stringify({ action: 'popupDismissed' }),
703
- })
704
- .then(async (response) => {
705
- if (!response.ok) {
706
- throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
707
- }
708
- })
709
- .catch(logger.error);
871
+ this.walletAPI.sendEvent('popupDismissed').catch(logger.error);
710
872
  }
711
873
  connectedCallback() {
712
874
  var _a;
@@ -727,37 +889,22 @@ let BlotoutWallet = class BlotoutWallet extends s {
727
889
  }
728
890
  }
729
891
  async initialize() {
730
- var _a;
731
- if (!this.userId) {
732
- logger.error('No UserId set');
733
- return;
734
- }
735
892
  if (this.isPopUpDismissed) {
736
893
  return;
737
894
  }
738
895
  await delay(POPUP_IMPRESSION_DELAY);
739
896
  try {
740
- const response = await fetch(this.getUrl('/cart/expired'), {
741
- method: 'GET',
742
- headers: this.getHeaders(),
743
- });
744
- if (!response.ok) {
745
- throw new Error(`Unable to get Expired Cart ${response.status}: ${await response.text()}`);
746
- }
897
+ const { email, carts } = await this.walletAPI.getExpiredCarts();
747
898
  this.dispatchEvent(new CustomEvent('blotout-wallet-loaded', { bubbles: true }));
748
- const result = await response.json();
749
- this.hasEmail = result.email;
750
- this.lastExpiredCart = result.carts[0];
751
- if ((_a = result.carts) === null || _a === void 0 ? void 0 : _a.length) {
899
+ this.hasEmail = email;
900
+ this.lastExpiredCart = carts[0];
901
+ if (carts === null || carts === void 0 ? void 0 : carts.length) {
752
902
  if (this.silentRestore) {
753
903
  this.restoreCart().catch(logger.error);
754
904
  }
755
905
  else if (!this.isPopUpDismissed) {
756
906
  this.showModal();
757
907
  }
758
- if (result.hasJustExpired) {
759
- window.edgetag('tag', 'CartRecovery_CartExpiredOnVisit', {}, {}, { destination: this.edgeURL });
760
- }
761
908
  }
762
909
  }
763
910
  catch (err) {
@@ -770,17 +917,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
770
917
  .catch(logger.error)
771
918
  .finally(() => fadeInDialog(this.dialog));
772
919
  this.dispatchEvent(new CustomEvent('blotout-wallet-shown', { bubbles: true }));
773
- fetch(this.getUrl('/user/event'), {
774
- method: 'POST',
775
- headers: this.getHeaders(),
776
- body: JSON.stringify({ action: 'popupShown' }),
777
- })
778
- .then(async (response) => {
779
- if (!response.ok) {
780
- throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
781
- }
782
- })
783
- .catch(logger.error);
920
+ this.walletAPI.sendEvent('popupShown').catch(logger.error);
784
921
  }
785
922
  hideModal(action) {
786
923
  fadeOutToBottom(this.dialog)
@@ -789,40 +926,10 @@ let BlotoutWallet = class BlotoutWallet extends s {
789
926
  this.dispatchEvent(new CustomEvent('blotout-wallet-hidden', { bubbles: true }));
790
927
  this.restoreResponse = undefined;
791
928
  }
792
- getHeaders(json = false) {
793
- const headers = new Headers({
794
- EdgeTagUserId: this.userId,
795
- });
796
- if (json) {
797
- headers.set('Content-type', 'application/json; charset=utf-8');
798
- }
799
- return headers;
800
- }
801
- getUrl(path) {
802
- const url = new URL(`/providers/blotoutWallet${path}`, this.edgeURL);
803
- if (this.storeApi) {
804
- const cartToken = this.storeApi.getCartToken();
805
- if (cartToken) {
806
- url.searchParams.set('t', cartToken);
807
- }
808
- const previewKey = getPreviewKey();
809
- if (previewKey) {
810
- url.searchParams.set('pk', previewKey);
811
- }
812
- }
813
- return url;
814
- }
815
929
  async skipCarts() {
816
930
  this.hideModal('skip');
817
931
  try {
818
- const response = await fetch(this.getUrl('/cart/skip'), {
819
- method: 'POST',
820
- headers: this.getHeaders(),
821
- });
822
- if (!response.ok) {
823
- throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
824
- }
825
- window.edgetag('tag', 'CartRecovery_CartDeclined', {}, {}, { destination: this.edgeURL });
932
+ await this.walletAPI.deleteCarts();
826
933
  this.lastExpiredCart = undefined;
827
934
  }
828
935
  catch (e) {
@@ -1009,86 +1116,28 @@ BlotoutWallet = __decorate([
1009
1116
  t$1('blotout-wallet')
1010
1117
  ], BlotoutWallet);
1011
1118
 
1012
- const logStyles = `
1013
- padding: 4px 8px 4px 36px;
1014
- border: 1px dashed red;
1015
- border-radius: 3px;
1016
- font-weight: bold;
1017
- background: url(${logoImage}) 8px 50% no-repeat;
1018
- background-size: 24px 16px;
1019
- `;
1020
- const log = (message) => console.log(`%c${message}`, logStyles);
1021
- const init = (params) => {
1022
- var _a, _b, _c, _d, _e, _f;
1023
- let store = window[registryKey].storeAPI;
1024
- if (!store) {
1025
- store = window[registryKey].storeAPI =
1026
- (_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
1027
- }
1028
- if (!store) {
1029
- console.error('Implementation for store API missing!');
1030
- return;
1031
- }
1032
- if (
1033
- // if loaded in non-browser SDKs
1034
- !window ||
1035
- !document ||
1036
- window.top !== window) {
1037
- return;
1038
- }
1039
- const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
1040
- const experiment = createExperiment({
1041
- name: mode,
1042
- userId: params.userId,
1043
- previewKey,
1044
- userPreviewKey: getPreviewKey(),
1119
+ var _a, _b;
1120
+ var _c;
1121
+ let wallet;
1122
+ if (typeof window != 'undefined' && typeof document != 'undefined') {
1123
+ (_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
1124
+ // if a custom implementation is already present, don't override it
1125
+ (_b = (_c = window[registryKey]).ui) !== null && _b !== void 0 ? _b : (_c.ui = {
1126
+ init(params) {
1127
+ if (wallet) {
1128
+ return;
1129
+ }
1130
+ wallet = document.createElement('blotout-wallet');
1131
+ if (params.theme) {
1132
+ wallet.style.cssText = Object.entries(params.theme)
1133
+ .filter(([name]) => name.startsWith('--'))
1134
+ .map(([name, value]) => `${name}:${value}`)
1135
+ .join(';');
1136
+ }
1137
+ Object.assign(wallet, params);
1138
+ document.body.append(wallet);
1139
+ },
1045
1140
  });
1046
- if (experiment.name == 'preview') {
1047
- if (experiment.isEnabled) {
1048
- log('Previewing functionality using preview key');
1049
- }
1050
- else if (getPreviewKey()) {
1051
- log('Preview key set but does not match the configured key');
1052
- }
1053
- }
1054
- if (enabled || experiment.isEnabled) {
1055
- // if the component is already defined, skip creating the element to avoid
1056
- // layering multiple widgets
1057
- if (window[registryKey].wallet) {
1058
- return;
1059
- }
1060
- const element = (window[registryKey].wallet =
1061
- document.createElement('blotout-wallet'));
1062
- const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
1063
- if (theme) {
1064
- element.style.cssText = Object.entries(theme)
1065
- .filter(([name]) => name.startsWith('--'))
1066
- .map(([name, value]) => `${name}:${value}`)
1067
- .join(';');
1068
- }
1069
- element.theme = theme;
1070
- element.edgeURL = params.baseUrl;
1071
- element.userId = params.userId;
1072
- element.afterRestore = (_e = params.manifest.variables) === null || _e === void 0 ? void 0 : _e.afterRestore;
1073
- element.silentRestore = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.silentRestore;
1074
- document.body.append(element);
1075
- }
1076
- };
1077
-
1078
- // eslint-disable-next-line @nx/enforce-module-boundaries
1079
- const data = {
1080
- name: packageName,
1081
- init,
1082
- tag,
1083
- };
1084
- try {
1085
- if (window) {
1086
- window.edgetagProviders = window.edgetagProviders || [];
1087
- window.edgetagProviders.push(data);
1088
- }
1089
- }
1090
- catch {
1091
- // no window
1092
1141
  }
1093
1142
 
1094
1143
  module.exports = data;