@blotoutio/providers-blotout-wallet-sdk 0.68.2 → 0.69.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 +143 -40
- package/core.js +143 -40
- package/core.mjs +143 -40
- package/index.cjs.js +242 -177
- package/index.js +242 -177
- package/index.mjs +242 -177
- package/package.json +1 -1
- package/ui.cjs.js +5 -14
- package/ui.js +5 -14
- package/ui.mjs +5 -14
package/index.mjs
CHANGED
@@ -119,6 +119,7 @@ const customAttributes = {
|
|
119
119
|
};
|
120
120
|
|
121
121
|
const packageName = 'blotoutWallet';
|
122
|
+
const cartTokenTwoCookie = 'cart2';
|
122
123
|
const PREVIEW_KEY_NAME = '_blotoutWalletPreview';
|
123
124
|
|
124
125
|
var _a$1;
|
@@ -139,81 +140,173 @@ const getPreviewKey = () => {
|
|
139
140
|
return key;
|
140
141
|
};
|
141
142
|
|
142
|
-
const
|
143
|
+
const getCookieValue = (key) => {
|
144
|
+
var _a;
|
145
|
+
try {
|
146
|
+
if (!document || !document.cookie) {
|
147
|
+
return '';
|
148
|
+
}
|
149
|
+
const cookies = parseCookies(document.cookie);
|
150
|
+
return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
|
151
|
+
}
|
152
|
+
catch {
|
153
|
+
return '';
|
154
|
+
}
|
155
|
+
};
|
156
|
+
const parseCookies = (cookie) => {
|
157
|
+
return Object.fromEntries(cookie
|
158
|
+
.split(/;\s+/)
|
159
|
+
.map((r) => r.split('=').map((str) => str.trim()))
|
160
|
+
.map(([cookieKey, ...cookieValues]) => {
|
161
|
+
const cookieValue = cookieValues.join('=');
|
162
|
+
if (!cookieKey) {
|
163
|
+
return [];
|
164
|
+
}
|
165
|
+
let decodedValue = '';
|
166
|
+
if (cookieValue) {
|
167
|
+
try {
|
168
|
+
decodedValue = decodeURIComponent(cookieValue);
|
169
|
+
}
|
170
|
+
catch (e) {
|
171
|
+
console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
|
172
|
+
decodedValue = cookieValue;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
return [cookieKey, decodedValue];
|
176
|
+
}));
|
177
|
+
};
|
178
|
+
const setCookie = (key, value, options) => {
|
179
|
+
var _a;
|
180
|
+
try {
|
181
|
+
if (!document) {
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
|
185
|
+
if (options === null || options === void 0 ? void 0 : options['maxAge']) {
|
186
|
+
extras.push(`max-age=${options['maxAge']}`);
|
187
|
+
}
|
188
|
+
if (options === null || options === void 0 ? void 0 : options.expires) {
|
189
|
+
extras.push(`expires=${options.expires}`);
|
190
|
+
}
|
191
|
+
if (options === null || options === void 0 ? void 0 : options.partitioned) {
|
192
|
+
extras.push('partitioned');
|
193
|
+
}
|
194
|
+
if (options === null || options === void 0 ? void 0 : options.samesite) {
|
195
|
+
extras.push(`samesite=${options.samesite}`);
|
196
|
+
}
|
197
|
+
if (options === null || options === void 0 ? void 0 : options.secure) {
|
198
|
+
extras.push('secure');
|
199
|
+
}
|
200
|
+
document.cookie = `${key}=${encodeURIComponent(value)};${extras.join(';')}`;
|
201
|
+
}
|
202
|
+
catch {
|
203
|
+
return;
|
204
|
+
}
|
205
|
+
};
|
206
|
+
const expireCookie = (key) => {
|
207
|
+
setCookie(key, '', { maxAge: 0 });
|
208
|
+
};
|
209
|
+
|
210
|
+
const canLog = () => {
|
211
|
+
try {
|
212
|
+
return localStorage.getItem('edgeTagDebug') === '1';
|
213
|
+
}
|
214
|
+
catch {
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
};
|
218
|
+
const prefix = `[EdgeTag]`;
|
219
|
+
const logger = {
|
220
|
+
log: (...args) => {
|
221
|
+
if (canLog()) {
|
222
|
+
console.log(prefix, ...args);
|
223
|
+
}
|
224
|
+
},
|
225
|
+
error: (...args) => {
|
226
|
+
if (canLog()) {
|
227
|
+
console.error(prefix, ...args);
|
228
|
+
}
|
229
|
+
},
|
230
|
+
info: (...args) => {
|
231
|
+
if (canLog()) {
|
232
|
+
console.info(prefix, ...args);
|
233
|
+
}
|
234
|
+
},
|
235
|
+
trace: (...args) => {
|
236
|
+
if (canLog()) {
|
237
|
+
console.trace(prefix, ...args);
|
238
|
+
}
|
239
|
+
},
|
240
|
+
};
|
241
|
+
|
242
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
243
|
+
const getStorageKey = (destination) => `${packageName}|${destination}`;
|
244
|
+
const getStoredData = (destination) => {
|
245
|
+
try {
|
246
|
+
const key = getStorageKey(destination);
|
247
|
+
return JSON.parse(localStorage.getItem(key) || 'null');
|
248
|
+
}
|
249
|
+
catch {
|
250
|
+
return null;
|
251
|
+
}
|
252
|
+
};
|
253
|
+
const setStoredData = (destination, data) => {
|
254
|
+
try {
|
255
|
+
const key = getStorageKey(destination);
|
256
|
+
const merged = Object.assign({}, getStoredData(destination), data);
|
257
|
+
localStorage.setItem(key, JSON.stringify(merged));
|
258
|
+
}
|
259
|
+
catch {
|
260
|
+
/* do nothing */
|
261
|
+
}
|
262
|
+
};
|
263
|
+
const clearStoredData = (destination) => {
|
264
|
+
try {
|
265
|
+
localStorage.removeItem(getStorageKey(destination));
|
266
|
+
}
|
267
|
+
catch {
|
268
|
+
/* do nothing */
|
269
|
+
}
|
270
|
+
};
|
271
|
+
|
272
|
+
const eventsToUpdateLastSeen = new Set([
|
273
|
+
'AddToCart',
|
274
|
+
'RemoveFromCart',
|
275
|
+
'InitiateCheckout',
|
276
|
+
]);
|
277
|
+
const tag = ({ destination, manifestVariables, eventName, }) => {
|
278
|
+
var _a;
|
143
279
|
const result = {
|
144
|
-
cartToken:
|
145
|
-
previewKey:
|
280
|
+
cartToken: '',
|
281
|
+
previewKey: '',
|
282
|
+
lastSeenToken: '',
|
283
|
+
hasCachedData: false,
|
146
284
|
};
|
147
285
|
if (typeof window == 'undefined') {
|
148
286
|
return result;
|
149
287
|
}
|
150
|
-
const
|
151
|
-
|
152
|
-
|
288
|
+
const cartToken = ((_a = window[registryKey].storeAPI) === null || _a === void 0 ? void 0 : _a.getCartToken()) || '';
|
289
|
+
const cachedData = getStoredData(destination);
|
290
|
+
result.previewKey = getPreviewKey() || '';
|
291
|
+
result.cartToken = cartToken;
|
292
|
+
result.lastSeenToken = (cachedData === null || cachedData === void 0 ? void 0 : cachedData.lastSeenToken) || '';
|
293
|
+
result.hasCachedData = !!cachedData;
|
294
|
+
// we want the lastSeenToken to lag behind by one event so that we can
|
295
|
+
// compare the tokens server-side and call expired tokens when cached data
|
296
|
+
// is available
|
297
|
+
if (eventName == 'Purchase') {
|
298
|
+
// purchase resets everything, so clear cached data
|
299
|
+
clearStoredData(destination);
|
300
|
+
// clear the cart2 cookie since we won't need it anymore
|
301
|
+
expireCookie(cartTokenTwoCookie);
|
302
|
+
}
|
303
|
+
else if (!manifestVariables.enabled ||
|
304
|
+
(manifestVariables.enabled && eventsToUpdateLastSeen.has(eventName))) {
|
305
|
+
setStoredData(destination, { lastSeenToken: cartToken });
|
153
306
|
}
|
154
307
|
return result;
|
155
308
|
};
|
156
309
|
|
157
|
-
/**
|
158
|
-
* @license
|
159
|
-
* Copyright 2019 Google LLC
|
160
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
161
|
-
*/
|
162
|
-
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;
|
163
|
-
|
164
|
-
/**
|
165
|
-
* @license
|
166
|
-
* Copyright 2017 Google LLC
|
167
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
168
|
-
*/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");
|
169
|
-
|
170
|
-
/**
|
171
|
-
* @license
|
172
|
-
* Copyright 2017 Google LLC
|
173
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
174
|
-
*/
|
175
|
-
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};
|
176
|
-
|
177
|
-
/**
|
178
|
-
* @license
|
179
|
-
* Copyright 2017 Google LLC
|
180
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
181
|
-
*/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");
|
182
|
-
|
183
|
-
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">
|
184
|
-
<g clip-path="url(#clip0_10367_379)">
|
185
|
-
<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"/>
|
186
|
-
<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"/>
|
187
|
-
<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"/>
|
188
|
-
</g>
|
189
|
-
<defs>
|
190
|
-
<clipPath id="clip0_10367_379">
|
191
|
-
<rect width="64" height="64" fill="none"/>
|
192
|
-
</clipPath>
|
193
|
-
</defs>
|
194
|
-
</svg>
|
195
|
-
`;
|
196
|
-
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">
|
197
|
-
<g clip-path="url(#clip0_10367_199)">
|
198
|
-
<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"/>
|
199
|
-
<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"/>
|
200
|
-
<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"/>
|
201
|
-
<path d="M32 16.3992L26.8 11.1992L24 13.9992L32 21.9992L46 7.99922L43.2 5.19922L32 16.3992Z" fill="currentColor"/>
|
202
|
-
</g>
|
203
|
-
<defs>
|
204
|
-
<clipPath id="clip0_10367_199">
|
205
|
-
<rect width="64" height="64" fill="none"/>
|
206
|
-
</clipPath>
|
207
|
-
</defs>
|
208
|
-
</svg>
|
209
|
-
`;
|
210
|
-
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">
|
211
|
-
<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"/>
|
212
|
-
<path d="M47.5332 12.334L51.2443 16.0451L15.5379 51.7515L11.8268 48.0404L47.5332 12.334Z" fill="currentColor"/>
|
213
|
-
</svg>
|
214
|
-
`;
|
215
|
-
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==`;
|
216
|
-
|
217
310
|
const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, storeAPI, }) => {
|
218
311
|
if (!baseURL) {
|
219
312
|
throw new Error(`baseURL missing`);
|
@@ -244,6 +337,13 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
244
337
|
return url;
|
245
338
|
};
|
246
339
|
const getExpiredCarts = async () => {
|
340
|
+
const cartToken = storeAPI.getCartToken() || '';
|
341
|
+
const storedData = getStoredData(baseURL);
|
342
|
+
if ((storedData === null || storedData === void 0 ? void 0 : storedData.lastSeenToken) === cartToken &&
|
343
|
+
(storedData === null || storedData === void 0 ? void 0 : storedData.response) &&
|
344
|
+
(storedData === null || storedData === void 0 ? void 0 : storedData.token) === cartToken) {
|
345
|
+
return storedData.response;
|
346
|
+
}
|
247
347
|
const response = await fetchImpl(getURL('/cart/expired'), {
|
248
348
|
method: 'GET',
|
249
349
|
headers: getHeaders(),
|
@@ -252,6 +352,11 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
252
352
|
throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
253
353
|
}
|
254
354
|
const result = (await response.json());
|
355
|
+
setStoredData(baseURL, {
|
356
|
+
token: cartToken,
|
357
|
+
response: result,
|
358
|
+
lastSeenToken: cartToken,
|
359
|
+
});
|
255
360
|
if (result.hasJustExpired) {
|
256
361
|
window.edgetag('tag', 'CartRecovery_CartExpiredOnVisit', undefined, undefined, { destination: baseURL });
|
257
362
|
}
|
@@ -291,6 +396,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
291
396
|
if (!response.ok) {
|
292
397
|
throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
|
293
398
|
}
|
399
|
+
clearStoredData(baseURL);
|
294
400
|
// Send the request as beacon as there could be a immediate redirect in the next step
|
295
401
|
window.edgetag('tag', 'CartRecovery_CartRestored', { isSilent }, undefined, { method: 'beacon', destination: baseURL });
|
296
402
|
};
|
@@ -302,6 +408,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
302
408
|
if (!response.ok) {
|
303
409
|
throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
|
304
410
|
}
|
411
|
+
clearStoredData(baseURL);
|
305
412
|
window.edgetag('tag', 'CartRecovery_CartDeclined', undefined, undefined, {
|
306
413
|
destination: baseURL,
|
307
414
|
});
|
@@ -315,6 +422,66 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
315
422
|
};
|
316
423
|
};
|
317
424
|
|
425
|
+
/**
|
426
|
+
* @license
|
427
|
+
* Copyright 2019 Google LLC
|
428
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
429
|
+
*/
|
430
|
+
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;
|
431
|
+
|
432
|
+
/**
|
433
|
+
* @license
|
434
|
+
* Copyright 2017 Google LLC
|
435
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
436
|
+
*/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");
|
437
|
+
|
438
|
+
/**
|
439
|
+
* @license
|
440
|
+
* Copyright 2017 Google LLC
|
441
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
442
|
+
*/
|
443
|
+
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};
|
444
|
+
|
445
|
+
/**
|
446
|
+
* @license
|
447
|
+
* Copyright 2017 Google LLC
|
448
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
449
|
+
*/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");
|
450
|
+
|
451
|
+
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">
|
452
|
+
<g clip-path="url(#clip0_10367_379)">
|
453
|
+
<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"/>
|
454
|
+
<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"/>
|
455
|
+
<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"/>
|
456
|
+
</g>
|
457
|
+
<defs>
|
458
|
+
<clipPath id="clip0_10367_379">
|
459
|
+
<rect width="64" height="64" fill="none"/>
|
460
|
+
</clipPath>
|
461
|
+
</defs>
|
462
|
+
</svg>
|
463
|
+
`;
|
464
|
+
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">
|
465
|
+
<g clip-path="url(#clip0_10367_199)">
|
466
|
+
<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"/>
|
467
|
+
<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"/>
|
468
|
+
<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"/>
|
469
|
+
<path d="M32 16.3992L26.8 11.1992L24 13.9992L32 21.9992L46 7.99922L43.2 5.19922L32 16.3992Z" fill="currentColor"/>
|
470
|
+
</g>
|
471
|
+
<defs>
|
472
|
+
<clipPath id="clip0_10367_199">
|
473
|
+
<rect width="64" height="64" fill="none"/>
|
474
|
+
</clipPath>
|
475
|
+
</defs>
|
476
|
+
</svg>
|
477
|
+
`;
|
478
|
+
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">
|
479
|
+
<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"/>
|
480
|
+
<path d="M47.5332 12.334L51.2443 16.0451L15.5379 51.7515L11.8268 48.0404L47.5332 12.334Z" fill="currentColor"/>
|
481
|
+
</svg>
|
482
|
+
`;
|
483
|
+
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==`;
|
484
|
+
|
318
485
|
const logStyles = `
|
319
486
|
padding: 4px 8px 4px 36px;
|
320
487
|
border: 1px dashed red;
|
@@ -323,8 +490,11 @@ const logStyles = `
|
|
323
490
|
background: url(${logoImage}) 8px 50% no-repeat;
|
324
491
|
background-size: 24px 16px;
|
325
492
|
`;
|
326
|
-
const
|
327
|
-
|
493
|
+
const walletLogger = {
|
494
|
+
log: (message) => console.log(`%c${message}`, logStyles),
|
495
|
+
error: (message) => console.error(`%c${message}`, logStyles),
|
496
|
+
};
|
497
|
+
|
328
498
|
const init = (params) => {
|
329
499
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
330
500
|
if (typeof window == 'undefined' || typeof document == 'undefined') {
|
@@ -337,7 +507,7 @@ const init = (params) => {
|
|
337
507
|
(_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
|
338
508
|
}
|
339
509
|
if (!storeAPI) {
|
340
|
-
|
510
|
+
walletLogger.error('Implementation for store API missing!');
|
341
511
|
return;
|
342
512
|
}
|
343
513
|
if (window.top !== window) {
|
@@ -353,16 +523,16 @@ const init = (params) => {
|
|
353
523
|
});
|
354
524
|
if (experiment.name == 'preview') {
|
355
525
|
if (experiment.isEnabled) {
|
356
|
-
log('Previewing functionality using preview key');
|
526
|
+
walletLogger.log('Previewing functionality using preview key');
|
357
527
|
}
|
358
528
|
else if (getPreviewKey()) {
|
359
|
-
log('Preview key set but does not match the configured key');
|
529
|
+
walletLogger.log('Preview key set but does not match the configured key');
|
360
530
|
}
|
361
531
|
}
|
362
532
|
if (enabled || experiment.isEnabled) {
|
363
533
|
const uiImplementation = window[registryKey].ui;
|
364
534
|
if (!uiImplementation) {
|
365
|
-
error('UI implementation is missing');
|
535
|
+
walletLogger.error('UI implementation is missing');
|
366
536
|
return;
|
367
537
|
}
|
368
538
|
const walletAPI = createWalletAPI({
|
@@ -589,111 +759,6 @@ const flipIn = (element) => {
|
|
589
759
|
return animation.finished;
|
590
760
|
};
|
591
761
|
|
592
|
-
const getCookieValue = (key) => {
|
593
|
-
var _a;
|
594
|
-
try {
|
595
|
-
if (!document || !document.cookie) {
|
596
|
-
return '';
|
597
|
-
}
|
598
|
-
const cookies = parseCookies(document.cookie);
|
599
|
-
return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
|
600
|
-
}
|
601
|
-
catch {
|
602
|
-
return '';
|
603
|
-
}
|
604
|
-
};
|
605
|
-
const parseCookies = (cookie) => {
|
606
|
-
return Object.fromEntries(cookie
|
607
|
-
.split(/;\s+/)
|
608
|
-
.map((r) => r.split('=').map((str) => str.trim()))
|
609
|
-
.map(([cookieKey, ...cookieValues]) => {
|
610
|
-
const cookieValue = cookieValues.join('=');
|
611
|
-
if (!cookieKey) {
|
612
|
-
return [];
|
613
|
-
}
|
614
|
-
let decodedValue = '';
|
615
|
-
if (cookieValue) {
|
616
|
-
try {
|
617
|
-
decodedValue = decodeURIComponent(cookieValue);
|
618
|
-
}
|
619
|
-
catch (e) {
|
620
|
-
console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
|
621
|
-
decodedValue = cookieValue;
|
622
|
-
}
|
623
|
-
}
|
624
|
-
return [cookieKey, decodedValue];
|
625
|
-
}));
|
626
|
-
};
|
627
|
-
const setCookie = (key, value, options) => {
|
628
|
-
var _a;
|
629
|
-
try {
|
630
|
-
if (!document) {
|
631
|
-
return;
|
632
|
-
}
|
633
|
-
const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
|
634
|
-
if (options === null || options === void 0 ? void 0 : options['maxAge']) {
|
635
|
-
extras.push(`max-age=${options['maxAge']}`);
|
636
|
-
}
|
637
|
-
if (options === null || options === void 0 ? void 0 : options.expires) {
|
638
|
-
extras.push(`expires=${options.expires}`);
|
639
|
-
}
|
640
|
-
if (options === null || options === void 0 ? void 0 : options.partitioned) {
|
641
|
-
extras.push('partitioned');
|
642
|
-
}
|
643
|
-
if (options === null || options === void 0 ? void 0 : options.samesite) {
|
644
|
-
extras.push(`samesite=${options.samesite}`);
|
645
|
-
}
|
646
|
-
if (options === null || options === void 0 ? void 0 : options.secure) {
|
647
|
-
extras.push('secure');
|
648
|
-
}
|
649
|
-
document.cookie = `${key}=${encodeURIComponent(value)};${extras.join(';')}`;
|
650
|
-
}
|
651
|
-
catch {
|
652
|
-
return;
|
653
|
-
}
|
654
|
-
};
|
655
|
-
|
656
|
-
const canLog = () => {
|
657
|
-
try {
|
658
|
-
return localStorage.getItem('edgeTagDebug') === '1';
|
659
|
-
}
|
660
|
-
catch {
|
661
|
-
return false;
|
662
|
-
}
|
663
|
-
};
|
664
|
-
const logger = {
|
665
|
-
log: (...args) => {
|
666
|
-
if (canLog()) {
|
667
|
-
console.log(...args);
|
668
|
-
}
|
669
|
-
},
|
670
|
-
error: (...args) => {
|
671
|
-
if (canLog()) {
|
672
|
-
console.error(...args);
|
673
|
-
}
|
674
|
-
},
|
675
|
-
info: (...args) => {
|
676
|
-
if (canLog()) {
|
677
|
-
console.info(...args);
|
678
|
-
}
|
679
|
-
},
|
680
|
-
trace: (...args) => {
|
681
|
-
if (canLog()) {
|
682
|
-
console.trace(...args);
|
683
|
-
}
|
684
|
-
},
|
685
|
-
table: (...args) => {
|
686
|
-
if (canLog()) {
|
687
|
-
console.table(...args);
|
688
|
-
}
|
689
|
-
},
|
690
|
-
dir: (...args) => {
|
691
|
-
if (canLog()) {
|
692
|
-
console.dir(...args);
|
693
|
-
}
|
694
|
-
},
|
695
|
-
};
|
696
|
-
|
697
762
|
/**
|
698
763
|
* Sets the max-age for the dismissed popup cookie
|
699
764
|
*/
|
package/package.json
CHANGED
package/ui.cjs.js
CHANGED
@@ -355,35 +355,26 @@ const canLog = () => {
|
|
355
355
|
return false;
|
356
356
|
}
|
357
357
|
};
|
358
|
+
const prefix = `[EdgeTag]`;
|
358
359
|
const logger = {
|
359
360
|
log: (...args) => {
|
360
361
|
if (canLog()) {
|
361
|
-
console.log(...args);
|
362
|
+
console.log(prefix, ...args);
|
362
363
|
}
|
363
364
|
},
|
364
365
|
error: (...args) => {
|
365
366
|
if (canLog()) {
|
366
|
-
console.error(...args);
|
367
|
+
console.error(prefix, ...args);
|
367
368
|
}
|
368
369
|
},
|
369
370
|
info: (...args) => {
|
370
371
|
if (canLog()) {
|
371
|
-
console.info(...args);
|
372
|
+
console.info(prefix, ...args);
|
372
373
|
}
|
373
374
|
},
|
374
375
|
trace: (...args) => {
|
375
376
|
if (canLog()) {
|
376
|
-
console.trace(...args);
|
377
|
-
}
|
378
|
-
},
|
379
|
-
table: (...args) => {
|
380
|
-
if (canLog()) {
|
381
|
-
console.table(...args);
|
382
|
-
}
|
383
|
-
},
|
384
|
-
dir: (...args) => {
|
385
|
-
if (canLog()) {
|
386
|
-
console.dir(...args);
|
377
|
+
console.trace(prefix, ...args);
|
387
378
|
}
|
388
379
|
},
|
389
380
|
};
|