@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.js CHANGED
@@ -35,6 +35,18 @@ var ProvidersBlotoutWalletSdk = (function () {
35
35
  ...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'),
36
36
  ]);
37
37
 
38
+ const EMAIL_RE = /^[\w!#$%&'*+/=?^`{|}~-]+(:?\.[\w!#$%&'*+/=?^`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
39
+ const normalizeEmail = (email) => {
40
+ if (!email) {
41
+ return '';
42
+ }
43
+ const trimmedEmail = email.trim().toLowerCase();
44
+ if (!EMAIL_RE.test(trimmedEmail)) {
45
+ return '';
46
+ }
47
+ return trimmedEmail;
48
+ };
49
+
38
50
  const delay = (n, resolvedValue) => new Promise((resolve) => setTimeout(() => resolve(resolvedValue), n));
39
51
 
40
52
  const createEnabled = () => ({
@@ -112,9 +124,11 @@ var ProvidersBlotoutWalletSdk = (function () {
112
124
  const packageName = 'blotoutWallet';
113
125
  const PREVIEW_KEY_NAME = '_blotoutWalletPreview';
114
126
 
115
- var _a;
127
+ var _a$1;
116
128
  const registryKey = Symbol.for('blotout-wallet');
117
- (_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
129
+ if (typeof window != 'undefined') {
130
+ (_a$1 = window[registryKey]) !== null && _a$1 !== void 0 ? _a$1 : (window[registryKey] = {});
131
+ }
118
132
 
119
133
  // eslint-disable-next-line @nx/enforce-module-boundaries
120
134
  const getPreviewKey = () => {
@@ -133,7 +147,7 @@ var ProvidersBlotoutWalletSdk = (function () {
133
147
  cartToken: null,
134
148
  previewKey: getPreviewKey(),
135
149
  };
136
- if (!window) {
150
+ if (typeof window == 'undefined') {
137
151
  return result;
138
152
  }
139
153
  const store = window[registryKey].storeAPI;
@@ -143,6 +157,250 @@ var ProvidersBlotoutWalletSdk = (function () {
143
157
  return result;
144
158
  };
145
159
 
160
+ /**
161
+ * @license
162
+ * Copyright 2019 Google LLC
163
+ * SPDX-License-Identifier: BSD-3-Clause
164
+ */
165
+ 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;
166
+
167
+ /**
168
+ * @license
169
+ * Copyright 2017 Google LLC
170
+ * SPDX-License-Identifier: BSD-3-Clause
171
+ */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");
172
+
173
+ /**
174
+ * @license
175
+ * Copyright 2017 Google LLC
176
+ * SPDX-License-Identifier: BSD-3-Clause
177
+ */
178
+ 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};
179
+
180
+ /**
181
+ * @license
182
+ * Copyright 2017 Google LLC
183
+ * SPDX-License-Identifier: BSD-3-Clause
184
+ */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");
185
+
186
+ 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">
187
+ <g clip-path="url(#clip0_10367_379)">
188
+ <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"/>
189
+ <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"/>
190
+ <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"/>
191
+ </g>
192
+ <defs>
193
+ <clipPath id="clip0_10367_379">
194
+ <rect width="64" height="64" fill="none"/>
195
+ </clipPath>
196
+ </defs>
197
+ </svg>
198
+ `;
199
+ 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">
200
+ <g clip-path="url(#clip0_10367_199)">
201
+ <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"/>
202
+ <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"/>
203
+ <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"/>
204
+ <path d="M32 16.3992L26.8 11.1992L24 13.9992L32 21.9992L46 7.99922L43.2 5.19922L32 16.3992Z" fill="currentColor"/>
205
+ </g>
206
+ <defs>
207
+ <clipPath id="clip0_10367_199">
208
+ <rect width="64" height="64" fill="none"/>
209
+ </clipPath>
210
+ </defs>
211
+ </svg>
212
+ `;
213
+ 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">
214
+ <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"/>
215
+ <path d="M47.5332 12.334L51.2443 16.0451L15.5379 51.7515L11.8268 48.0404L47.5332 12.334Z" fill="currentColor"/>
216
+ </svg>
217
+ `;
218
+ 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==`;
219
+
220
+ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, storeAPI, }) => {
221
+ if (!baseURL) {
222
+ throw new Error(`baseURL missing`);
223
+ }
224
+ if (!userId) {
225
+ throw new Error(`userId missing`);
226
+ }
227
+ if (!storeAPI) {
228
+ throw new Error(`store API implementation missing`);
229
+ }
230
+ const getHeaders = (json = false) => {
231
+ const headers = new Headers({ EdgeTagUserId: userId });
232
+ if (json) {
233
+ headers.set('Content-type', 'application/json; charset=utf-8');
234
+ }
235
+ return headers;
236
+ };
237
+ const getURL = (path) => {
238
+ const url = new URL(`/providers/blotoutWallet${path}`, baseURL);
239
+ const cartToken = storeAPI.getCartToken();
240
+ if (cartToken) {
241
+ url.searchParams.set('t', cartToken);
242
+ }
243
+ const previewKey = getPreviewKey();
244
+ if (previewKey) {
245
+ url.searchParams.set('pk', previewKey);
246
+ }
247
+ return url;
248
+ };
249
+ const getExpiredCarts = async () => {
250
+ const response = await fetchImpl(getURL('/cart/expired'), {
251
+ method: 'GET',
252
+ headers: getHeaders(),
253
+ });
254
+ if (!response.ok) {
255
+ throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
256
+ }
257
+ const result = (await response.json());
258
+ if (result.hasJustExpired) {
259
+ window.edgetag('tag', 'CartRecovery_CartExpiredOnVisit', undefined, undefined, { destination: baseURL });
260
+ }
261
+ return result;
262
+ };
263
+ const sendEvent = async (action) => {
264
+ const response = await fetchImpl(getURL('/user/event'), {
265
+ method: 'POST',
266
+ headers: getHeaders(true),
267
+ body: JSON.stringify({ action }),
268
+ });
269
+ if (!response.ok) {
270
+ throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
271
+ }
272
+ };
273
+ const saveEmail = async (email) => {
274
+ const normalized = normalizeEmail(email);
275
+ if (!normalized) {
276
+ throw new Error(`Could not save email - invalid email format`);
277
+ }
278
+ window.edgetag('user', 'email', normalized, {}, { destination: baseURL });
279
+ const response = await fetchImpl(getURL('/user/email'), {
280
+ method: 'POST',
281
+ headers: getHeaders(true),
282
+ body: JSON.stringify({ email: normalized }),
283
+ });
284
+ if (!response.ok) {
285
+ throw new Error(`Could not save email - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
286
+ }
287
+ window.edgetag('tag', 'CartRecovery_KeepCartEmailSaved', undefined, undefined, { destination: baseURL });
288
+ };
289
+ const restoreCart = async (cartId, isSilent) => {
290
+ const response = await fetchImpl(getURL(`/cart/restore/${encodeURIComponent(cartId)}`), {
291
+ method: 'POST',
292
+ headers: getHeaders(),
293
+ });
294
+ if (!response.ok) {
295
+ throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
296
+ }
297
+ // Send the request as beacon as there could be a immediate redirect in the next step
298
+ window.edgetag('tag', 'CartRecovery_CartRestored', { isSilent }, undefined, { method: 'beacon' });
299
+ };
300
+ const deleteCarts = async () => {
301
+ const response = await fetchImpl(getURL('/cart/skip'), {
302
+ method: 'POST',
303
+ headers: getHeaders(),
304
+ });
305
+ if (!response.ok) {
306
+ throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
307
+ }
308
+ window.edgetag('tag', 'CartRecovery_CartDeclined', undefined, undefined, {
309
+ destination: baseURL,
310
+ });
311
+ };
312
+ return {
313
+ getExpiredCarts,
314
+ sendEvent,
315
+ saveEmail,
316
+ restoreCart,
317
+ deleteCarts,
318
+ };
319
+ };
320
+
321
+ const logStyles = `
322
+ padding: 4px 8px 4px 36px;
323
+ border: 1px dashed red;
324
+ border-radius: 3px;
325
+ font-weight: bold;
326
+ background: url(${logoImage}) 8px 50% no-repeat;
327
+ background-size: 24px 16px;
328
+ `;
329
+ const log = (message) => console.log(`%c${message}`, logStyles);
330
+ const error = (message) => console.error(`%c${message}`, logStyles);
331
+ const init = (params) => {
332
+ var _a, _b, _c, _d, _e, _f, _g, _h;
333
+ if (typeof window == 'undefined' || typeof document == 'undefined') {
334
+ // if loaded in non-browser SDKs, return early
335
+ return;
336
+ }
337
+ let storeAPI = window[registryKey].storeAPI;
338
+ if (!storeAPI) {
339
+ storeAPI = window[registryKey].storeAPI =
340
+ (_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
341
+ }
342
+ if (!storeAPI) {
343
+ console.error('Implementation for store API missing!');
344
+ return;
345
+ }
346
+ if (window.top !== window) {
347
+ // exit if not in top window
348
+ return;
349
+ }
350
+ const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
351
+ const experiment = createExperiment({
352
+ name: mode,
353
+ userId: params.userId,
354
+ previewKey,
355
+ userPreviewKey: getPreviewKey(),
356
+ });
357
+ if (experiment.name == 'preview') {
358
+ if (experiment.isEnabled) {
359
+ log('Previewing functionality using preview key');
360
+ }
361
+ else if (getPreviewKey()) {
362
+ log('Preview key set but does not match the configured key');
363
+ }
364
+ }
365
+ if (enabled || experiment.isEnabled) {
366
+ const uiImplementation = window[registryKey].ui;
367
+ if (!uiImplementation) {
368
+ error('UI implementation is missing');
369
+ return;
370
+ }
371
+ const walletAPI = createWalletAPI({
372
+ baseURL: params.baseUrl,
373
+ storeAPI,
374
+ userId: params.userId,
375
+ });
376
+ uiImplementation.init({
377
+ theme: (_e = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d.theme) !== null && _e !== void 0 ? _e : {},
378
+ afterRestore: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.afterRestore) !== null && _g !== void 0 ? _g : {
379
+ action: 'none',
380
+ },
381
+ silentRestore: !!((_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.silentRestore),
382
+ walletAPI,
383
+ storeAPI,
384
+ });
385
+ }
386
+ };
387
+
388
+ // eslint-disable-next-line @nx/enforce-module-boundaries
389
+ const data = {
390
+ name: packageName,
391
+ init,
392
+ tag,
393
+ };
394
+ try {
395
+ if (typeof window !== 'undefined') {
396
+ window.edgetagProviders = window.edgetagProviders || [];
397
+ window.edgetagProviders.push(data);
398
+ }
399
+ }
400
+ catch {
401
+ // no window
402
+ }
403
+
146
404
  /******************************************************************************
147
405
  Copyright (c) Microsoft Corporation.
148
406
 
@@ -176,32 +434,6 @@ var ProvidersBlotoutWalletSdk = (function () {
176
434
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
177
435
  };
178
436
 
179
- /**
180
- * @license
181
- * Copyright 2019 Google LLC
182
- * SPDX-License-Identifier: BSD-3-Clause
183
- */
184
- 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;
185
-
186
- /**
187
- * @license
188
- * Copyright 2017 Google LLC
189
- * SPDX-License-Identifier: BSD-3-Clause
190
- */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");
191
-
192
- /**
193
- * @license
194
- * Copyright 2017 Google LLC
195
- * SPDX-License-Identifier: BSD-3-Clause
196
- */
197
- 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};
198
-
199
- /**
200
- * @license
201
- * Copyright 2017 Google LLC
202
- * SPDX-License-Identifier: BSD-3-Clause
203
- */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");
204
-
205
437
  /**
206
438
  * @license
207
439
  * Copyright 2017 Google LLC
@@ -465,40 +697,6 @@ var ProvidersBlotoutWalletSdk = (function () {
465
697
  },
466
698
  };
467
699
 
468
- 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">
469
- <g clip-path="url(#clip0_10367_379)">
470
- <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"/>
471
- <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"/>
472
- <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"/>
473
- </g>
474
- <defs>
475
- <clipPath id="clip0_10367_379">
476
- <rect width="64" height="64" fill="none"/>
477
- </clipPath>
478
- </defs>
479
- </svg>
480
- `;
481
- 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">
482
- <g clip-path="url(#clip0_10367_199)">
483
- <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"/>
484
- <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"/>
485
- <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"/>
486
- <path d="M32 16.3992L26.8 11.1992L24 13.9992L32 21.9992L46 7.99922L43.2 5.19922L32 16.3992Z" fill="currentColor"/>
487
- </g>
488
- <defs>
489
- <clipPath id="clip0_10367_199">
490
- <rect width="64" height="64" fill="none"/>
491
- </clipPath>
492
- </defs>
493
- </svg>
494
- `;
495
- 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">
496
- <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"/>
497
- <path d="M47.5332 12.334L51.2443 16.0451L15.5379 51.7515L11.8268 48.0404L47.5332 12.334Z" fill="currentColor"/>
498
- </svg>
499
- `;
500
- 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==`;
501
-
502
700
  /**
503
701
  * Sets the max-age for the dismissed popup cookie
504
702
  */
@@ -531,45 +729,23 @@ var ProvidersBlotoutWalletSdk = (function () {
531
729
  }
532
730
  const email = this.email.value.trim().toLowerCase();
533
731
  if (email) {
534
- window.edgetag('user', 'email', email, {}, { destination: this.edgeURL });
535
- const response = await fetch(this.getUrl('/user/email'), {
536
- method: 'POST',
537
- body: JSON.stringify({
538
- email: email,
539
- }),
540
- headers: this.getHeaders(true),
541
- });
542
- if (!response.ok) {
543
- throw new Error(`Could not save email ${response.status}: ${await response.text()}`);
544
- }
732
+ await this.walletAPI.saveEmail(email);
545
733
  this.email.value = '';
546
734
  this.hasEmail = true;
547
735
  this.dispatchEvent(new CustomEvent('blotout-wallet-email-saved', { bubbles: true }));
548
- window.edgetag('tag', 'CartRecovery_KeepCartEmailSaved', {}, {}, { destination: this.edgeURL });
549
736
  }
550
- this.restoreResponse = await this.storeApi.addItems(this.lastExpiredCart.items, this.lastExpiredCart.token);
737
+ this.restoreResponse = await this.storeAPI.addItems(this.lastExpiredCart.items, this.lastExpiredCart.token);
551
738
  const expiredCartId = this.lastExpiredCart.cartId;
552
739
  // We attempt to mark the cart as restored, but if the request fails,
553
740
  // we log the error in the console and let the user continue. Since the
554
741
  // problem is probably in the `/cart/restore` endpoint, further attempts
555
742
  // would not resolve the problem, which would just increase the number
556
743
  // of failed calls and not solve the problem.
557
- await fetch(this.getUrl(`/cart/restore/${expiredCartId}`), {
558
- method: 'POST',
559
- headers: this.getHeaders(),
560
- })
561
- .then(async (response) => {
562
- if (!response.ok) {
563
- throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
564
- }
565
- })
566
- .catch(logger.error);
744
+ await this.walletAPI.restoreCart(expiredCartId, this.silentRestore).catch(logger.error);
567
745
  this.lastExpiredCart = undefined;
568
746
  this.dispatchEvent(new CustomEvent('blotout-wallet-cart-restored', {
569
747
  bubbles: true,
570
748
  }));
571
- // Send the request as beacon as there could be a immediate redirect in the next step
572
- window.edgetag('tag', 'CartRecovery_CartRestored', { isSilent: !!this.silentRestore }, {}, { method: 'beacon', destination: this.edgeURL });
573
749
  };
574
750
  this.onSubmit = async (ev) => {
575
751
  ev.preventDefault();
@@ -599,7 +775,7 @@ var ProvidersBlotoutWalletSdk = (function () {
599
775
  break;
600
776
  }
601
777
  case 'checkout': {
602
- const url = this.storeApi.getCheckoutURL();
778
+ const url = this.storeAPI.getCheckoutURL();
603
779
  if (url) {
604
780
  window.location.href = url.toString();
605
781
  }
@@ -688,26 +864,12 @@ var ProvidersBlotoutWalletSdk = (function () {
688
864
  `;
689
865
  };
690
866
  }
691
- get storeApi() {
692
- var _a;
693
- return (_a = window[registryKey]) === null || _a === void 0 ? void 0 : _a.storeAPI;
694
- }
695
867
  get isPopUpDismissed() {
696
868
  return getCookieValue('isPopUpDismissed') === '1';
697
869
  }
698
870
  setDismissed() {
699
871
  setCookie('isPopUpDismissed', '1', { maxAge: DISMISSED_COOKIE_LIFETIME });
700
- fetch(this.getUrl('/user/event'), {
701
- method: 'POST',
702
- headers: this.getHeaders(),
703
- body: JSON.stringify({ action: 'popupDismissed' }),
704
- })
705
- .then(async (response) => {
706
- if (!response.ok) {
707
- throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
708
- }
709
- })
710
- .catch(logger.error);
872
+ this.walletAPI.sendEvent('popupDismissed').catch(logger.error);
711
873
  }
712
874
  connectedCallback() {
713
875
  var _a;
@@ -728,37 +890,22 @@ var ProvidersBlotoutWalletSdk = (function () {
728
890
  }
729
891
  }
730
892
  async initialize() {
731
- var _a;
732
- if (!this.userId) {
733
- logger.error('No UserId set');
734
- return;
735
- }
736
893
  if (this.isPopUpDismissed) {
737
894
  return;
738
895
  }
739
896
  await delay(POPUP_IMPRESSION_DELAY);
740
897
  try {
741
- const response = await fetch(this.getUrl('/cart/expired'), {
742
- method: 'GET',
743
- headers: this.getHeaders(),
744
- });
745
- if (!response.ok) {
746
- throw new Error(`Unable to get Expired Cart ${response.status}: ${await response.text()}`);
747
- }
898
+ const { email, carts } = await this.walletAPI.getExpiredCarts();
748
899
  this.dispatchEvent(new CustomEvent('blotout-wallet-loaded', { bubbles: true }));
749
- const result = await response.json();
750
- this.hasEmail = result.email;
751
- this.lastExpiredCart = result.carts[0];
752
- if ((_a = result.carts) === null || _a === void 0 ? void 0 : _a.length) {
900
+ this.hasEmail = email;
901
+ this.lastExpiredCart = carts[0];
902
+ if (carts === null || carts === void 0 ? void 0 : carts.length) {
753
903
  if (this.silentRestore) {
754
904
  this.restoreCart().catch(logger.error);
755
905
  }
756
906
  else if (!this.isPopUpDismissed) {
757
907
  this.showModal();
758
908
  }
759
- if (result.hasJustExpired) {
760
- window.edgetag('tag', 'CartRecovery_CartExpiredOnVisit', {}, {}, { destination: this.edgeURL });
761
- }
762
909
  }
763
910
  }
764
911
  catch (err) {
@@ -771,17 +918,7 @@ var ProvidersBlotoutWalletSdk = (function () {
771
918
  .catch(logger.error)
772
919
  .finally(() => fadeInDialog(this.dialog));
773
920
  this.dispatchEvent(new CustomEvent('blotout-wallet-shown', { bubbles: true }));
774
- fetch(this.getUrl('/user/event'), {
775
- method: 'POST',
776
- headers: this.getHeaders(),
777
- body: JSON.stringify({ action: 'popupShown' }),
778
- })
779
- .then(async (response) => {
780
- if (!response.ok) {
781
- throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
782
- }
783
- })
784
- .catch(logger.error);
921
+ this.walletAPI.sendEvent('popupShown').catch(logger.error);
785
922
  }
786
923
  hideModal(action) {
787
924
  fadeOutToBottom(this.dialog)
@@ -790,40 +927,10 @@ var ProvidersBlotoutWalletSdk = (function () {
790
927
  this.dispatchEvent(new CustomEvent('blotout-wallet-hidden', { bubbles: true }));
791
928
  this.restoreResponse = undefined;
792
929
  }
793
- getHeaders(json = false) {
794
- const headers = new Headers({
795
- EdgeTagUserId: this.userId,
796
- });
797
- if (json) {
798
- headers.set('Content-type', 'application/json; charset=utf-8');
799
- }
800
- return headers;
801
- }
802
- getUrl(path) {
803
- const url = new URL(`/providers/blotoutWallet${path}`, this.edgeURL);
804
- if (this.storeApi) {
805
- const cartToken = this.storeApi.getCartToken();
806
- if (cartToken) {
807
- url.searchParams.set('t', cartToken);
808
- }
809
- const previewKey = getPreviewKey();
810
- if (previewKey) {
811
- url.searchParams.set('pk', previewKey);
812
- }
813
- }
814
- return url;
815
- }
816
930
  async skipCarts() {
817
931
  this.hideModal('skip');
818
932
  try {
819
- const response = await fetch(this.getUrl('/cart/skip'), {
820
- method: 'POST',
821
- headers: this.getHeaders(),
822
- });
823
- if (!response.ok) {
824
- throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
825
- }
826
- window.edgetag('tag', 'CartRecovery_CartDeclined', {}, {}, { destination: this.edgeURL });
933
+ await this.walletAPI.deleteCarts();
827
934
  this.lastExpiredCart = undefined;
828
935
  }
829
936
  catch (e) {
@@ -1010,86 +1117,28 @@ var ProvidersBlotoutWalletSdk = (function () {
1010
1117
  t$1('blotout-wallet')
1011
1118
  ], BlotoutWallet);
1012
1119
 
1013
- const logStyles = `
1014
- padding: 4px 8px 4px 36px;
1015
- border: 1px dashed red;
1016
- border-radius: 3px;
1017
- font-weight: bold;
1018
- background: url(${logoImage}) 8px 50% no-repeat;
1019
- background-size: 24px 16px;
1020
- `;
1021
- const log = (message) => console.log(`%c${message}`, logStyles);
1022
- const init = (params) => {
1023
- var _a, _b, _c, _d, _e, _f;
1024
- let store = window[registryKey].storeAPI;
1025
- if (!store) {
1026
- store = window[registryKey].storeAPI =
1027
- (_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
1028
- }
1029
- if (!store) {
1030
- console.error('Implementation for store API missing!');
1031
- return;
1032
- }
1033
- if (
1034
- // if loaded in non-browser SDKs
1035
- !window ||
1036
- !document ||
1037
- window.top !== window) {
1038
- return;
1039
- }
1040
- const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
1041
- const experiment = createExperiment({
1042
- name: mode,
1043
- userId: params.userId,
1044
- previewKey,
1045
- userPreviewKey: getPreviewKey(),
1120
+ var _a, _b;
1121
+ var _c;
1122
+ let wallet;
1123
+ if (typeof window != 'undefined' && typeof document != 'undefined') {
1124
+ (_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
1125
+ // if a custom implementation is already present, don't override it
1126
+ (_b = (_c = window[registryKey]).ui) !== null && _b !== void 0 ? _b : (_c.ui = {
1127
+ init(params) {
1128
+ if (wallet) {
1129
+ return;
1130
+ }
1131
+ wallet = document.createElement('blotout-wallet');
1132
+ if (params.theme) {
1133
+ wallet.style.cssText = Object.entries(params.theme)
1134
+ .filter(([name]) => name.startsWith('--'))
1135
+ .map(([name, value]) => `${name}:${value}`)
1136
+ .join(';');
1137
+ }
1138
+ Object.assign(wallet, params);
1139
+ document.body.append(wallet);
1140
+ },
1046
1141
  });
1047
- if (experiment.name == 'preview') {
1048
- if (experiment.isEnabled) {
1049
- log('Previewing functionality using preview key');
1050
- }
1051
- else if (getPreviewKey()) {
1052
- log('Preview key set but does not match the configured key');
1053
- }
1054
- }
1055
- if (enabled || experiment.isEnabled) {
1056
- // if the component is already defined, skip creating the element to avoid
1057
- // layering multiple widgets
1058
- if (window[registryKey].wallet) {
1059
- return;
1060
- }
1061
- const element = (window[registryKey].wallet =
1062
- document.createElement('blotout-wallet'));
1063
- const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
1064
- if (theme) {
1065
- element.style.cssText = Object.entries(theme)
1066
- .filter(([name]) => name.startsWith('--'))
1067
- .map(([name, value]) => `${name}:${value}`)
1068
- .join(';');
1069
- }
1070
- element.theme = theme;
1071
- element.edgeURL = params.baseUrl;
1072
- element.userId = params.userId;
1073
- element.afterRestore = (_e = params.manifest.variables) === null || _e === void 0 ? void 0 : _e.afterRestore;
1074
- element.silentRestore = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.silentRestore;
1075
- document.body.append(element);
1076
- }
1077
- };
1078
-
1079
- // eslint-disable-next-line @nx/enforce-module-boundaries
1080
- const data = {
1081
- name: packageName,
1082
- init,
1083
- tag,
1084
- };
1085
- try {
1086
- if (window) {
1087
- window.edgetagProviders = window.edgetagProviders || [];
1088
- window.edgetagProviders.push(data);
1089
- }
1090
- }
1091
- catch {
1092
- // no window
1093
1142
  }
1094
1143
 
1095
1144
  return data;