@blotoutio/providers-blotout-wallet-sdk 0.65.1 → 0.67.0
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/core.cjs.js +345 -0
- package/core.js +348 -0
- package/core.mjs +343 -0
- package/index.cjs.js +294 -244
- package/index.js +294 -244
- package/index.mjs +294 -244
- package/package.json +19 -8
- package/stores/shopify/index.cjs.js +9 -4
- package/stores/shopify/index.js +9 -4
- package/stores/shopify/index.mjs +9 -4
- package/ui.cjs.js +867 -0
- package/ui.js +870 -0
- package/ui.mjs +865 -0
package/ui.js
ADDED
@@ -0,0 +1,870 @@
|
|
1
|
+
(function () {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var _a$1;
|
5
|
+
const registryKey = Symbol.for('blotout-wallet');
|
6
|
+
if (typeof window != 'undefined') {
|
7
|
+
(_a$1 = window[registryKey]) !== null && _a$1 !== void 0 ? _a$1 : (window[registryKey] = {});
|
8
|
+
}
|
9
|
+
|
10
|
+
/******************************************************************************
|
11
|
+
Copyright (c) Microsoft Corporation.
|
12
|
+
|
13
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
14
|
+
purpose with or without fee is hereby granted.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
17
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
18
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
19
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
20
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
21
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
22
|
+
PERFORMANCE OF THIS SOFTWARE.
|
23
|
+
***************************************************************************** */
|
24
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
25
|
+
|
26
|
+
|
27
|
+
function __decorate(decorators, target, key, desc) {
|
28
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
30
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
31
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
32
|
+
}
|
33
|
+
|
34
|
+
function __metadata(metadataKey, metadataValue) {
|
35
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
36
|
+
}
|
37
|
+
|
38
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
39
|
+
var e = new Error(message);
|
40
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
41
|
+
};
|
42
|
+
|
43
|
+
/**
|
44
|
+
* @license
|
45
|
+
* Copyright 2019 Google LLC
|
46
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
47
|
+
*/
|
48
|
+
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;
|
49
|
+
|
50
|
+
/**
|
51
|
+
* @license
|
52
|
+
* Copyright 2017 Google LLC
|
53
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
54
|
+
*/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");
|
55
|
+
|
56
|
+
/**
|
57
|
+
* @license
|
58
|
+
* Copyright 2017 Google LLC
|
59
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
60
|
+
*/
|
61
|
+
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};
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @license
|
65
|
+
* Copyright 2017 Google LLC
|
66
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
67
|
+
*/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");
|
68
|
+
|
69
|
+
/**
|
70
|
+
* @license
|
71
|
+
* Copyright 2017 Google LLC
|
72
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
73
|
+
*/
|
74
|
+
const t$1=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
75
|
+
|
76
|
+
/**
|
77
|
+
* @license
|
78
|
+
* Copyright 2017 Google LLC
|
79
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
80
|
+
*/const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.P(o,void 0,t),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n$1(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* @license
|
84
|
+
* Copyright 2017 Google LLC
|
85
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
86
|
+
*/function r(r){return n$1({...r,state:!0,attribute:!1})}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* @license
|
90
|
+
* Copyright 2017 Google LLC
|
91
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
92
|
+
*/
|
93
|
+
const e$2=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
94
|
+
|
95
|
+
/**
|
96
|
+
* @license
|
97
|
+
* Copyright 2017 Google LLC
|
98
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
99
|
+
*/function e$1(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}="object"==typeof s?n:i??(()=>{const t=Symbol();return {get(){return this[t]},set(e){this[t]=e;}}})();return e$2(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return e$2(n,s,{get(){return o(this)}})}}
|
100
|
+
|
101
|
+
/**
|
102
|
+
* @license
|
103
|
+
* Copyright 2017 Google LLC
|
104
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
105
|
+
*/
|
106
|
+
const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});let i$1 = class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
|
107
|
+
|
108
|
+
/**
|
109
|
+
* @license
|
110
|
+
* Copyright 2018 Google LLC
|
111
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
112
|
+
*/const n="important",i=" !"+n,o$1=e(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"style"!==t$1.name||t$1.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r="string"==typeof e&&e.endsWith(i);t.includes("-")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:""):s[t]=e;}}return w}});
|
113
|
+
|
114
|
+
/**
|
115
|
+
* @license
|
116
|
+
* Copyright 2021 Google LLC
|
117
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
118
|
+
*/
|
119
|
+
function*o(o,t){const f="function"==typeof t;if(void 0!==o){let i=-1;for(const n of o)i>-1&&(yield f?t(i):t),i++,yield n;}}
|
120
|
+
|
121
|
+
const spring = 'linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1)';
|
122
|
+
const easeOutQuart = `cubic-bezier(0.25, 1, 0.5, 1)`;
|
123
|
+
|
124
|
+
const expand = (str) => str.split(',').flatMap((entry) => {
|
125
|
+
if (!entry.includes('-')) {
|
126
|
+
return entry;
|
127
|
+
}
|
128
|
+
const result = [];
|
129
|
+
const [start, end] = entry.split('-').map(Number);
|
130
|
+
for (let i = start; i <= end; i++) {
|
131
|
+
result.push(i.toString());
|
132
|
+
}
|
133
|
+
return result;
|
134
|
+
});
|
135
|
+
/**
|
136
|
+
* Exported from https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes
|
137
|
+
*
|
138
|
+
* In Dev Tools, select the `tbody` element containing the area codes and run the following code,
|
139
|
+
* replacing the emdash character with a simple endash:
|
140
|
+
*
|
141
|
+
* ```ts
|
142
|
+
* [...$0.querySelectorAll('td:first-child')]
|
143
|
+
* .filter(cell => cell.firstChild.nodeName != 'A')
|
144
|
+
* .map(cell => cell.textContent.trim()).join(',')
|
145
|
+
* ```
|
146
|
+
*/
|
147
|
+
new Set([
|
148
|
+
...expand('200,211,221,222,230,232,233,235,237-238,241,243,244,245,247,255,257,258-259,261,265,266,271,273,274,275,277,278,280,282,283,285-287,288,290-299'),
|
149
|
+
...expand('300,311,322,324,327,328,333,335,338,342,344,348-349,353,355,356,357-359,362,366,369,370-379,381,382,383-384,387,388,389,390-399'),
|
150
|
+
...expand('400,411,420,421-422,426-427,428,429,433,439,444,446,449,451-454,455,456,457,459,460,461-462,465,466,467,471,476,477,481-483,485-486,487,488,489,490-499'),
|
151
|
+
...expand('511,532,535,536,537,538,542-543,545-547,549-550,552-554,555,556,558,560,565,568,569,576,578,583,589,590-599'),
|
152
|
+
...expand('611,621,624,625,627,632,633,634-635,637-638,642-643,644,648,652-654,655,663,665,666,668,673-676,677,679,685,686,687,688,690-699'),
|
153
|
+
...expand('711,722,723,729,733,735-736,739,741,744,745-746,748,749-751,752,755,756,759,761,764,766,768,776,777,783,788,789,790-799'),
|
154
|
+
...expand('811,821,822,823-824,827,834,836,841-842,846,851,852-853,871,874-875,879,880-887,889,890-899'),
|
155
|
+
...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'),
|
156
|
+
]);
|
157
|
+
|
158
|
+
const delay = (n, resolvedValue) => new Promise((resolve) => setTimeout(() => resolve(resolvedValue), n));
|
159
|
+
|
160
|
+
const customAttributes = {
|
161
|
+
'--bw-primary': { type: 'color', defaultValue: '#000000' },
|
162
|
+
'--bw-title-color': { type: 'color', defaultValue: '#000000' },
|
163
|
+
'--bw-secondary': { type: 'color', defaultValue: '#4e647f' },
|
164
|
+
'--bw-background': { type: 'color', defaultValue: '#ffffff' },
|
165
|
+
'--bw-button-foreground': { type: 'color', defaultValue: '#ffffff' },
|
166
|
+
'--bw-button-background': { type: 'color', defaultValue: '#2b65cf' },
|
167
|
+
'--bw-input-border': { type: 'color', defaultValue: '#dbe2eb' },
|
168
|
+
'--bw-input-foreground': { type: 'color', defaultValue: '#52525B' },
|
169
|
+
'--bw-input-background': { type: 'color', defaultValue: '#ffffff' },
|
170
|
+
'--bw-backdrop': { type: 'color', defaultValue: '#00000077' },
|
171
|
+
text: {
|
172
|
+
type: 'text',
|
173
|
+
defaultValue: "Hey! Your cart has expired!<br>But we've got you covered! \u{1F609}",
|
174
|
+
},
|
175
|
+
title: { type: 'text', defaultValue: '' },
|
176
|
+
inputLabel: { type: 'text', defaultValue: 'Enter your email ID' },
|
177
|
+
restoreLabel: { type: 'text', defaultValue: 'Restore Cart' },
|
178
|
+
rejectionLabel: {
|
179
|
+
type: 'text',
|
180
|
+
defaultValue: 'No thanks, delete my expired cart',
|
181
|
+
},
|
182
|
+
};
|
183
|
+
|
184
|
+
const cssVars = i$4 `
|
185
|
+
:host {
|
186
|
+
--primary: var(
|
187
|
+
--bw-primary,
|
188
|
+
${r$5(customAttributes['--bw-primary'].defaultValue)}
|
189
|
+
);
|
190
|
+
--secondary: var(
|
191
|
+
--bw-secondary,
|
192
|
+
${r$5(customAttributes['--bw-secondary'].defaultValue)}
|
193
|
+
);
|
194
|
+
--title-color: var(
|
195
|
+
--bw-title-color,
|
196
|
+
var(
|
197
|
+
--primary,
|
198
|
+
${r$5(customAttributes['--bw-title-color'].defaultValue)}
|
199
|
+
)
|
200
|
+
);
|
201
|
+
--background: var(
|
202
|
+
--bw-background,
|
203
|
+
${r$5(customAttributes['--bw-background'].defaultValue)}
|
204
|
+
);
|
205
|
+
--button-foreground: var(
|
206
|
+
--bw-button-foreground,
|
207
|
+
${r$5(customAttributes['--bw-button-foreground'].defaultValue)}
|
208
|
+
);
|
209
|
+
--button-background: var(
|
210
|
+
--bw-button-background,
|
211
|
+
${r$5(customAttributes['--bw-button-background'].defaultValue)}
|
212
|
+
);
|
213
|
+
--input-border: var(
|
214
|
+
--bw-input-border,
|
215
|
+
${r$5(customAttributes['--bw-input-border'].defaultValue)}
|
216
|
+
);
|
217
|
+
--input-foreground: var(
|
218
|
+
--bw-input-foreground,
|
219
|
+
${r$5(customAttributes['--bw-input-foreground'].defaultValue)}
|
220
|
+
);
|
221
|
+
--input-background: var(
|
222
|
+
--bw-input-background,
|
223
|
+
${r$5(customAttributes['--bw-input-background'].defaultValue)}
|
224
|
+
);
|
225
|
+
--backdrop: var(
|
226
|
+
--bw-backdrop,
|
227
|
+
${r$5(customAttributes['--bw-backdrop'].defaultValue)}
|
228
|
+
);
|
229
|
+
|
230
|
+
--spring-easing: ${r$5(spring)};
|
231
|
+
}
|
232
|
+
`;
|
233
|
+
|
234
|
+
const isGecko = () => /\bGecko\/\d+/.test(navigator.userAgent);
|
235
|
+
|
236
|
+
const fadeInDialog = (element) => {
|
237
|
+
const animations = [
|
238
|
+
element.animate([
|
239
|
+
{ transform: 'translateY(-20px)', opacity: 0 },
|
240
|
+
{ transform: 'translateY(0)', opacity: 1 },
|
241
|
+
], { duration: 600, easing: spring, composite: 'add' }),
|
242
|
+
];
|
243
|
+
// Gecko does not support animating ::backdrop pseudo elements
|
244
|
+
if (!isGecko()) {
|
245
|
+
animations.push(element.animate([{ opacity: 0 }, { opacity: 1 }], {
|
246
|
+
duration: 300,
|
247
|
+
easing: 'ease-out',
|
248
|
+
pseudoElement: '::backdrop',
|
249
|
+
fill: 'forwards',
|
250
|
+
}));
|
251
|
+
}
|
252
|
+
return Promise.all(animations.map((anim) => anim.finished));
|
253
|
+
};
|
254
|
+
const fadeOutToBottom = (element) => {
|
255
|
+
const animations = [
|
256
|
+
element.animate([
|
257
|
+
{ transform: 'translateY(0)', opacity: 1 },
|
258
|
+
{ transform: 'translateY(20px)', opacity: 0 },
|
259
|
+
], { duration: 600, easing: spring }),
|
260
|
+
];
|
261
|
+
// Gecko does not support animating ::backdrop pseudo elements
|
262
|
+
if (!isGecko()) {
|
263
|
+
animations.push(element.animate([{ opacity: 1 }, { opacity: 0 }], {
|
264
|
+
duration: 300,
|
265
|
+
easing: 'ease-out',
|
266
|
+
pseudoElement: '::backdrop',
|
267
|
+
fill: 'forwards',
|
268
|
+
}));
|
269
|
+
}
|
270
|
+
return Promise.all(animations.map((anim) => anim.finished));
|
271
|
+
};
|
272
|
+
const flipOut = (element) => {
|
273
|
+
const animation = element.animate([
|
274
|
+
{ transform: 'perspective(1000px) rotateX(0)' },
|
275
|
+
{ transform: 'perspective(1000px) rotateX(-90deg)' },
|
276
|
+
], { duration: 180, easing: easeOutQuart });
|
277
|
+
return animation.finished;
|
278
|
+
};
|
279
|
+
const flipIn = (element) => {
|
280
|
+
const animation = element.animate([
|
281
|
+
{ transform: 'perspective(1000px) rotateX(90deg)' },
|
282
|
+
{ transform: 'perspective(1000px) rotateX(0)' },
|
283
|
+
], { duration: 180, easing: easeOutQuart });
|
284
|
+
return animation.finished;
|
285
|
+
};
|
286
|
+
|
287
|
+
const getCookieValue = (key) => {
|
288
|
+
var _a;
|
289
|
+
try {
|
290
|
+
if (!document || !document.cookie) {
|
291
|
+
return '';
|
292
|
+
}
|
293
|
+
const cookies = parseCookies(document.cookie);
|
294
|
+
return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
|
295
|
+
}
|
296
|
+
catch {
|
297
|
+
return '';
|
298
|
+
}
|
299
|
+
};
|
300
|
+
const parseCookies = (cookie) => {
|
301
|
+
return Object.fromEntries(cookie
|
302
|
+
.split(/;\s+/)
|
303
|
+
.map((r) => r.split('=').map((str) => str.trim()))
|
304
|
+
.map(([cookieKey, ...cookieValues]) => {
|
305
|
+
const cookieValue = cookieValues.join('=');
|
306
|
+
if (!cookieKey) {
|
307
|
+
return [];
|
308
|
+
}
|
309
|
+
let decodedValue = '';
|
310
|
+
if (cookieValue) {
|
311
|
+
try {
|
312
|
+
decodedValue = decodeURIComponent(cookieValue);
|
313
|
+
}
|
314
|
+
catch (e) {
|
315
|
+
console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
|
316
|
+
decodedValue = cookieValue;
|
317
|
+
}
|
318
|
+
}
|
319
|
+
return [cookieKey, decodedValue];
|
320
|
+
}));
|
321
|
+
};
|
322
|
+
const setCookie = (key, value, options) => {
|
323
|
+
var _a;
|
324
|
+
try {
|
325
|
+
if (!document) {
|
326
|
+
return;
|
327
|
+
}
|
328
|
+
const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
|
329
|
+
if (options === null || options === void 0 ? void 0 : options['maxAge']) {
|
330
|
+
extras.push(`max-age=${options['maxAge']}`);
|
331
|
+
}
|
332
|
+
if (options === null || options === void 0 ? void 0 : options.expires) {
|
333
|
+
extras.push(`expires=${options.expires}`);
|
334
|
+
}
|
335
|
+
if (options === null || options === void 0 ? void 0 : options.partitioned) {
|
336
|
+
extras.push('partitioned');
|
337
|
+
}
|
338
|
+
if (options === null || options === void 0 ? void 0 : options.samesite) {
|
339
|
+
extras.push(`samesite=${options.samesite}`);
|
340
|
+
}
|
341
|
+
if (options === null || options === void 0 ? void 0 : options.secure) {
|
342
|
+
extras.push('secure');
|
343
|
+
}
|
344
|
+
document.cookie = `${key}=${encodeURIComponent(value)};${extras.join(';')}`;
|
345
|
+
}
|
346
|
+
catch {
|
347
|
+
return;
|
348
|
+
}
|
349
|
+
};
|
350
|
+
|
351
|
+
const canLog = () => {
|
352
|
+
try {
|
353
|
+
return localStorage.getItem('edgeTagDebug') === '1';
|
354
|
+
}
|
355
|
+
catch {
|
356
|
+
return false;
|
357
|
+
}
|
358
|
+
};
|
359
|
+
const logger = {
|
360
|
+
log: (...args) => {
|
361
|
+
if (canLog()) {
|
362
|
+
console.log(...args);
|
363
|
+
}
|
364
|
+
},
|
365
|
+
error: (...args) => {
|
366
|
+
if (canLog()) {
|
367
|
+
console.error(...args);
|
368
|
+
}
|
369
|
+
},
|
370
|
+
info: (...args) => {
|
371
|
+
if (canLog()) {
|
372
|
+
console.info(...args);
|
373
|
+
}
|
374
|
+
},
|
375
|
+
trace: (...args) => {
|
376
|
+
if (canLog()) {
|
377
|
+
console.trace(...args);
|
378
|
+
}
|
379
|
+
},
|
380
|
+
table: (...args) => {
|
381
|
+
if (canLog()) {
|
382
|
+
console.table(...args);
|
383
|
+
}
|
384
|
+
},
|
385
|
+
dir: (...args) => {
|
386
|
+
if (canLog()) {
|
387
|
+
console.dir(...args);
|
388
|
+
}
|
389
|
+
},
|
390
|
+
};
|
391
|
+
|
392
|
+
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">
|
393
|
+
<g clip-path="url(#clip0_10367_379)">
|
394
|
+
<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"/>
|
395
|
+
<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"/>
|
396
|
+
<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"/>
|
397
|
+
</g>
|
398
|
+
<defs>
|
399
|
+
<clipPath id="clip0_10367_379">
|
400
|
+
<rect width="64" height="64" fill="none"/>
|
401
|
+
</clipPath>
|
402
|
+
</defs>
|
403
|
+
</svg>
|
404
|
+
`;
|
405
|
+
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">
|
406
|
+
<g clip-path="url(#clip0_10367_199)">
|
407
|
+
<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"/>
|
408
|
+
<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"/>
|
409
|
+
<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"/>
|
410
|
+
<path d="M32 16.3992L26.8 11.1992L24 13.9992L32 21.9992L46 7.99922L43.2 5.19922L32 16.3992Z" fill="currentColor"/>
|
411
|
+
</g>
|
412
|
+
<defs>
|
413
|
+
<clipPath id="clip0_10367_199">
|
414
|
+
<rect width="64" height="64" fill="none"/>
|
415
|
+
</clipPath>
|
416
|
+
</defs>
|
417
|
+
</svg>
|
418
|
+
`;
|
419
|
+
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">
|
420
|
+
<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"/>
|
421
|
+
<path d="M47.5332 12.334L51.2443 16.0451L15.5379 51.7515L11.8268 48.0404L47.5332 12.334Z" fill="currentColor"/>
|
422
|
+
</svg>
|
423
|
+
`;
|
424
|
+
|
425
|
+
/**
|
426
|
+
* Sets the max-age for the dismissed popup cookie
|
427
|
+
*/
|
428
|
+
const DISMISSED_COOKIE_LIFETIME = 1800;
|
429
|
+
/**
|
430
|
+
* The delay applied when the page becomes visible before fetching expired carts
|
431
|
+
* and possibly displaying the popup
|
432
|
+
*/
|
433
|
+
const POPUP_IMPRESSION_DELAY = 1000;
|
434
|
+
const formatString = (str) => {
|
435
|
+
const parts = str.split(/<\s*br\s*\/?\s*>/);
|
436
|
+
return o(parts, x `<br />`);
|
437
|
+
};
|
438
|
+
let BlotoutWallet = class BlotoutWallet extends s {
|
439
|
+
constructor() {
|
440
|
+
super(...arguments);
|
441
|
+
this.hasEmail = false;
|
442
|
+
this.lastExpiredCart = undefined;
|
443
|
+
this.state = 'ready';
|
444
|
+
this.isStylesheetInjected = false;
|
445
|
+
this.transitionTo = (newState) => {
|
446
|
+
return flipOut(this.dialog)
|
447
|
+
.then(() => (this.state = newState))
|
448
|
+
.then(() => flipIn(this.dialog))
|
449
|
+
.catch(logger.error);
|
450
|
+
};
|
451
|
+
this.restoreCart = async () => {
|
452
|
+
if (!this.lastExpiredCart) {
|
453
|
+
return;
|
454
|
+
}
|
455
|
+
const email = this.email.value.trim().toLowerCase();
|
456
|
+
if (email) {
|
457
|
+
await this.walletAPI.saveEmail(email);
|
458
|
+
this.email.value = '';
|
459
|
+
this.hasEmail = true;
|
460
|
+
this.dispatchEvent(new CustomEvent('blotout-wallet-email-saved', { bubbles: true }));
|
461
|
+
}
|
462
|
+
this.restoreResponse = await this.storeAPI.addItems(this.lastExpiredCart.items, this.lastExpiredCart.token);
|
463
|
+
const expiredCartId = this.lastExpiredCart.cartId;
|
464
|
+
// We attempt to mark the cart as restored, but if the request fails,
|
465
|
+
// we log the error in the console and let the user continue. Since the
|
466
|
+
// problem is probably in the `/cart/restore` endpoint, further attempts
|
467
|
+
// would not resolve the problem, which would just increase the number
|
468
|
+
// of failed calls and not solve the problem.
|
469
|
+
await this.walletAPI.restoreCart(expiredCartId, this.silentRestore).catch(logger.error);
|
470
|
+
this.lastExpiredCart = undefined;
|
471
|
+
this.dispatchEvent(new CustomEvent('blotout-wallet-cart-restored', {
|
472
|
+
bubbles: true,
|
473
|
+
}));
|
474
|
+
};
|
475
|
+
this.onSubmit = async (ev) => {
|
476
|
+
ev.preventDefault();
|
477
|
+
ev.stopPropagation();
|
478
|
+
try {
|
479
|
+
await this.transitionTo('loading');
|
480
|
+
await this.restoreCart();
|
481
|
+
await this.transitionTo('restored');
|
482
|
+
await delay(2000);
|
483
|
+
if (this.state == 'restored') {
|
484
|
+
this.hideModal('restore');
|
485
|
+
}
|
486
|
+
// handle afterRestore action
|
487
|
+
if (this.afterRestore) {
|
488
|
+
switch (this.afterRestore.action) {
|
489
|
+
case 'refresh': {
|
490
|
+
window.location.reload();
|
491
|
+
break;
|
492
|
+
}
|
493
|
+
case 'redirect': {
|
494
|
+
try {
|
495
|
+
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
496
|
+
}
|
497
|
+
catch (e) {
|
498
|
+
console.error('Invalid redirect URL', e);
|
499
|
+
}
|
500
|
+
break;
|
501
|
+
}
|
502
|
+
case 'checkout': {
|
503
|
+
const url = this.storeAPI.getCheckoutURL();
|
504
|
+
if (url) {
|
505
|
+
window.location.href = url.toString();
|
506
|
+
}
|
507
|
+
}
|
508
|
+
}
|
509
|
+
}
|
510
|
+
}
|
511
|
+
catch (e) {
|
512
|
+
logger.error(e);
|
513
|
+
await this.transitionTo('failed');
|
514
|
+
}
|
515
|
+
};
|
516
|
+
this.onDialogClick = () => {
|
517
|
+
if (this.state == 'loading') {
|
518
|
+
return;
|
519
|
+
}
|
520
|
+
this.hideModal();
|
521
|
+
this.email.value = '';
|
522
|
+
};
|
523
|
+
this.onWrapperClick = (ev) => {
|
524
|
+
ev.stopPropagation();
|
525
|
+
};
|
526
|
+
this.onDialogClose = () => {
|
527
|
+
const action = this.dialog.returnValue;
|
528
|
+
if (!action && (this.state == 'ready' || this.state == 'failed')) {
|
529
|
+
this.setDismissed();
|
530
|
+
}
|
531
|
+
};
|
532
|
+
this.expiredCartContent = () => {
|
533
|
+
var _a, _b, _c, _d, _e;
|
534
|
+
return x `<form
|
535
|
+
class="restore-form"
|
536
|
+
method="dialog"
|
537
|
+
@submit=${this.onSubmit}
|
538
|
+
>
|
539
|
+
${((_a = this.theme) === null || _a === void 0 ? void 0 : _a.title)
|
540
|
+
? x `<h1 class="title">${this.theme.title}</h1>`
|
541
|
+
: T}
|
542
|
+
<div class="text">
|
543
|
+
${formatString(((_b = this.theme) === null || _b === void 0 ? void 0 : _b.text) || customAttributes.text.defaultValue)}
|
544
|
+
</div>
|
545
|
+
<input
|
546
|
+
type="email"
|
547
|
+
name="email"
|
548
|
+
class="email"
|
549
|
+
placeholder=${((_c = this.theme) === null || _c === void 0 ? void 0 : _c.inputLabel) ||
|
550
|
+
customAttributes.inputLabel.defaultValue}
|
551
|
+
?required=${!this.hasEmail}
|
552
|
+
style=${o$1({
|
553
|
+
display: this.hasEmail ? 'none' : 'block',
|
554
|
+
})}
|
555
|
+
/>
|
556
|
+
<button class="restore" type="submit">
|
557
|
+
${((_d = this.theme) === null || _d === void 0 ? void 0 : _d.restoreLabel) ||
|
558
|
+
customAttributes.restoreLabel.defaultValue}
|
559
|
+
</button>
|
560
|
+
</form>
|
561
|
+
<button class="reject" type="button" @click=${this.skipCarts}>
|
562
|
+
${((_e = this.theme) === null || _e === void 0 ? void 0 : _e.rejectionLabel) ||
|
563
|
+
customAttributes.rejectionLabel.defaultValue}
|
564
|
+
</button> `;
|
565
|
+
};
|
566
|
+
this.loadingContent = () => {
|
567
|
+
return x `
|
568
|
+
${cart({ class: 'icon' })}
|
569
|
+
<div>Your cart is being restored …</div>
|
570
|
+
`;
|
571
|
+
};
|
572
|
+
this.restoredContent = () => {
|
573
|
+
return x `
|
574
|
+
${cartTick({ class: 'icon' })}
|
575
|
+
<div>Cart restored successfully!</div>
|
576
|
+
${this.restoreResponse
|
577
|
+
? x `<p>Some items could not be added: ${this.restoreResponse}</p>`
|
578
|
+
: T}
|
579
|
+
`;
|
580
|
+
};
|
581
|
+
this.failedContent = () => {
|
582
|
+
return x `
|
583
|
+
${circleCross({ class: 'icon' })}
|
584
|
+
<div>Sorry, we couldn't restore your cart.</div>
|
585
|
+
<form method="dialog" @submit=${this.onSubmit}>
|
586
|
+
<button class="restore" type="submit">Try Again</button>
|
587
|
+
</form>
|
588
|
+
<button class="reject" @click=${this.skipCarts}>Dismiss</button>
|
589
|
+
`;
|
590
|
+
};
|
591
|
+
}
|
592
|
+
get isPopUpDismissed() {
|
593
|
+
return getCookieValue('isPopUpDismissed') === '1';
|
594
|
+
}
|
595
|
+
setDismissed() {
|
596
|
+
setCookie('isPopUpDismissed', '1', { maxAge: DISMISSED_COOKIE_LIFETIME });
|
597
|
+
this.walletAPI.sendEvent('popupDismissed').catch(logger.error);
|
598
|
+
}
|
599
|
+
connectedCallback() {
|
600
|
+
var _a;
|
601
|
+
super.connectedCallback();
|
602
|
+
if (!this.isStylesheetInjected && ((_a = this.theme) === null || _a === void 0 ? void 0 : _a.css)) {
|
603
|
+
const sheet = new CSSStyleSheet();
|
604
|
+
sheet.replaceSync(this.theme.css);
|
605
|
+
this.shadowRoot.adoptedStyleSheets.push(sheet);
|
606
|
+
this.isStylesheetInjected = true;
|
607
|
+
}
|
608
|
+
if (document.hidden) {
|
609
|
+
document.addEventListener('visibilitychange', () => this.initialize(), {
|
610
|
+
once: true,
|
611
|
+
});
|
612
|
+
}
|
613
|
+
else {
|
614
|
+
this.initialize();
|
615
|
+
}
|
616
|
+
}
|
617
|
+
async initialize() {
|
618
|
+
if (this.isPopUpDismissed) {
|
619
|
+
return;
|
620
|
+
}
|
621
|
+
await delay(POPUP_IMPRESSION_DELAY);
|
622
|
+
try {
|
623
|
+
const { email, carts } = await this.walletAPI.getExpiredCarts();
|
624
|
+
this.dispatchEvent(new CustomEvent('blotout-wallet-loaded', { bubbles: true }));
|
625
|
+
this.hasEmail = email;
|
626
|
+
this.lastExpiredCart = carts[0];
|
627
|
+
if (carts === null || carts === void 0 ? void 0 : carts.length) {
|
628
|
+
if (this.silentRestore) {
|
629
|
+
this.restoreCart().catch(logger.error);
|
630
|
+
}
|
631
|
+
else if (!this.isPopUpDismissed) {
|
632
|
+
this.showModal();
|
633
|
+
}
|
634
|
+
}
|
635
|
+
}
|
636
|
+
catch (err) {
|
637
|
+
logger.error(err);
|
638
|
+
}
|
639
|
+
}
|
640
|
+
showModal() {
|
641
|
+
this.dialog.showModal();
|
642
|
+
new Promise(requestAnimationFrame)
|
643
|
+
.catch(logger.error)
|
644
|
+
.finally(() => fadeInDialog(this.dialog));
|
645
|
+
this.dispatchEvent(new CustomEvent('blotout-wallet-shown', { bubbles: true }));
|
646
|
+
this.walletAPI.sendEvent('popupShown').catch(logger.error);
|
647
|
+
}
|
648
|
+
hideModal(action) {
|
649
|
+
fadeOutToBottom(this.dialog)
|
650
|
+
.catch(logger.error)
|
651
|
+
.finally(() => { var _a; return (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close(action); });
|
652
|
+
this.dispatchEvent(new CustomEvent('blotout-wallet-hidden', { bubbles: true }));
|
653
|
+
this.restoreResponse = undefined;
|
654
|
+
}
|
655
|
+
async skipCarts() {
|
656
|
+
this.hideModal('skip');
|
657
|
+
try {
|
658
|
+
await this.walletAPI.deleteCarts();
|
659
|
+
this.lastExpiredCart = undefined;
|
660
|
+
}
|
661
|
+
catch (e) {
|
662
|
+
logger.error(e);
|
663
|
+
}
|
664
|
+
}
|
665
|
+
render() {
|
666
|
+
if (this.isPopUpDismissed) {
|
667
|
+
return T;
|
668
|
+
}
|
669
|
+
return x ` <dialog
|
670
|
+
class="popup"
|
671
|
+
@click=${this.onDialogClick}
|
672
|
+
@close=${this.onDialogClose}
|
673
|
+
>
|
674
|
+
<div @click=${this.onWrapperClick}>
|
675
|
+
<div
|
676
|
+
class="centered"
|
677
|
+
style=${o$1({
|
678
|
+
display: this.state == 'ready' ? undefined : 'none',
|
679
|
+
})}
|
680
|
+
>
|
681
|
+
${this.expiredCartContent()}
|
682
|
+
</div>
|
683
|
+
<div
|
684
|
+
class="centered"
|
685
|
+
style=${o$1({
|
686
|
+
display: this.state == 'loading' ? undefined : 'none',
|
687
|
+
})}
|
688
|
+
>
|
689
|
+
${this.loadingContent()}
|
690
|
+
</div>
|
691
|
+
<div
|
692
|
+
class="centered"
|
693
|
+
style=${o$1({
|
694
|
+
display: this.state == 'restored' ? undefined : 'none',
|
695
|
+
})}
|
696
|
+
>
|
697
|
+
${this.restoredContent()}
|
698
|
+
</div>
|
699
|
+
<div
|
700
|
+
class="centered"
|
701
|
+
style=${o$1({
|
702
|
+
display: this.state == 'failed' ? undefined : 'none',
|
703
|
+
})}
|
704
|
+
>
|
705
|
+
${this.failedContent()}
|
706
|
+
</div>
|
707
|
+
</div>
|
708
|
+
</dialog>`;
|
709
|
+
}
|
710
|
+
};
|
711
|
+
BlotoutWallet.styles = [
|
712
|
+
cssVars,
|
713
|
+
i$4 `
|
714
|
+
* {
|
715
|
+
box-sizing: border-box;
|
716
|
+
font-family: inherit;
|
717
|
+
font-size: 16px;
|
718
|
+
line-height: 24px;
|
719
|
+
}
|
720
|
+
|
721
|
+
strong {
|
722
|
+
font-weight: bold;
|
723
|
+
}
|
724
|
+
|
725
|
+
button {
|
726
|
+
cursor: pointer;
|
727
|
+
}
|
728
|
+
|
729
|
+
.popup {
|
730
|
+
width: 430px;
|
731
|
+
max-width: 100vw;
|
732
|
+
color: var(--primary);
|
733
|
+
background: var(--background);
|
734
|
+
border: none;
|
735
|
+
border-radius: 20px;
|
736
|
+
padding: 24px;
|
737
|
+
text-align: center;
|
738
|
+
}
|
739
|
+
|
740
|
+
.popup::backdrop {
|
741
|
+
background: var(--backdrop);
|
742
|
+
backdrop-filter: blur(4px);
|
743
|
+
}
|
744
|
+
|
745
|
+
.restore-form {
|
746
|
+
display: flex;
|
747
|
+
flex-direction: column;
|
748
|
+
gap: 16px;
|
749
|
+
width: 100%;
|
750
|
+
}
|
751
|
+
|
752
|
+
.title {
|
753
|
+
margin: 0;
|
754
|
+
padding: 0;
|
755
|
+
font-size: 20px;
|
756
|
+
font-weight: bold;
|
757
|
+
line-height: 30px;
|
758
|
+
color: var(--title-color);
|
759
|
+
}
|
760
|
+
|
761
|
+
.text {
|
762
|
+
margin: 0;
|
763
|
+
padding: 0;
|
764
|
+
}
|
765
|
+
|
766
|
+
.email {
|
767
|
+
width: 100%;
|
768
|
+
border: 1px solid var(--input-border);
|
769
|
+
color: var(--input-foreground);
|
770
|
+
background: var(--input-background);
|
771
|
+
padding: 10px 16px;
|
772
|
+
border-radius: 5px;
|
773
|
+
}
|
774
|
+
|
775
|
+
.email::placeholder {
|
776
|
+
color: var(--input-foreground);
|
777
|
+
color: color(from var(--input-foreground) srgb r g b / 0.7);
|
778
|
+
}
|
779
|
+
|
780
|
+
:is(.email, button):focus-visible {
|
781
|
+
outline-color: var(--primary);
|
782
|
+
}
|
783
|
+
|
784
|
+
.restore {
|
785
|
+
width: 100%;
|
786
|
+
border: none;
|
787
|
+
color: var(--button-foreground);
|
788
|
+
background: var(--button-background);
|
789
|
+
border-radius: 5px;
|
790
|
+
padding: 12px 20px;
|
791
|
+
}
|
792
|
+
|
793
|
+
.reject {
|
794
|
+
font-size: 14px;
|
795
|
+
line-height: 20px;
|
796
|
+
color: var(--secondary);
|
797
|
+
border: none;
|
798
|
+
background: none;
|
799
|
+
padding: 0;
|
800
|
+
text-decoration: underline var(--secondary);
|
801
|
+
}
|
802
|
+
|
803
|
+
.centered {
|
804
|
+
display: flex;
|
805
|
+
flex-direction: column;
|
806
|
+
gap: 16px;
|
807
|
+
width: 100%;
|
808
|
+
justify-content: center;
|
809
|
+
align-items: center;
|
810
|
+
}
|
811
|
+
|
812
|
+
.icon {
|
813
|
+
color: var(--button-background);
|
814
|
+
}
|
815
|
+
`,
|
816
|
+
];
|
817
|
+
__decorate([
|
818
|
+
e$1('dialog'),
|
819
|
+
__metadata("design:type", HTMLDialogElement)
|
820
|
+
], BlotoutWallet.prototype, "dialog", void 0);
|
821
|
+
__decorate([
|
822
|
+
e$1('input[name=email]'),
|
823
|
+
__metadata("design:type", HTMLInputElement)
|
824
|
+
], BlotoutWallet.prototype, "email", void 0);
|
825
|
+
__decorate([
|
826
|
+
r(),
|
827
|
+
__metadata("design:type", Boolean)
|
828
|
+
], BlotoutWallet.prototype, "hasEmail", void 0);
|
829
|
+
__decorate([
|
830
|
+
r(),
|
831
|
+
__metadata("design:type", Object)
|
832
|
+
], BlotoutWallet.prototype, "lastExpiredCart", void 0);
|
833
|
+
__decorate([
|
834
|
+
r(),
|
835
|
+
__metadata("design:type", String)
|
836
|
+
], BlotoutWallet.prototype, "state", void 0);
|
837
|
+
__decorate([
|
838
|
+
r(),
|
839
|
+
__metadata("design:type", Object)
|
840
|
+
], BlotoutWallet.prototype, "restoreResponse", void 0);
|
841
|
+
BlotoutWallet = __decorate([
|
842
|
+
t$1('blotout-wallet')
|
843
|
+
], BlotoutWallet);
|
844
|
+
|
845
|
+
var _a;
|
846
|
+
let wallet;
|
847
|
+
if (typeof window != 'undefined' && typeof document != 'undefined') {
|
848
|
+
(_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
|
849
|
+
// if a custom implementation is already present, don't override it
|
850
|
+
if (!window[registryKey].ui) {
|
851
|
+
window[registryKey].ui = {
|
852
|
+
init(params) {
|
853
|
+
if (wallet) {
|
854
|
+
return;
|
855
|
+
}
|
856
|
+
wallet = document.createElement('blotout-wallet');
|
857
|
+
if (params.theme) {
|
858
|
+
wallet.style.cssText = Object.entries(params.theme)
|
859
|
+
.filter(([name]) => name.startsWith('--'))
|
860
|
+
.map(([name, value]) => `${name}:${value}`)
|
861
|
+
.join(';');
|
862
|
+
}
|
863
|
+
Object.assign(wallet, params);
|
864
|
+
document.body.append(wallet);
|
865
|
+
},
|
866
|
+
};
|
867
|
+
}
|
868
|
+
}
|
869
|
+
|
870
|
+
})();
|