ui.shipaid.com 0.3.14 → 0.3.16
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/README.md +1 -0
- package/dist/widget.es.js +38 -3
- package/dist/widget.iife.js +20 -20
- package/dist/widget.umd.js +20 -20
- package/dist-types/widget/src/shipaid-widget.d.ts +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,6 +139,7 @@ If you need to change any of the widget colors to suit a specific theme, there a
|
|
|
139
139
|
| `--shipaid-prompt-footer-location` | Changes the position of footer badge | `var(--shipaid-prompt-footer-location, flex-start)` |
|
|
140
140
|
| `--shipaid-prompt-product-actions-content` | Changes the spaces between price and add/remove button | `var(--shipaid-prompt-product-actions-content, space-between)` |
|
|
141
141
|
| `--shipaid-prompt-footer-topMargin` | Changes margin between header and badge footer | `var(--shipaid-prompt-footer-topMargin, 0px)` |
|
|
142
|
+
| `-shipaid-prompt-footer-display` | Changes the display option for footer | `var(-shipaid-prompt-footer-display, flex)` |
|
|
142
143
|
|
|
143
144
|
Other variables can be found [here](/widget/src/assets/styles.ts) (`/widget/src/assets/styles.ts`).
|
|
144
145
|
|
package/dist/widget.es.js
CHANGED
|
@@ -1730,7 +1730,7 @@ const styles = i$2`
|
|
|
1730
1730
|
}
|
|
1731
1731
|
.shipaid-prompt .prompt-footer {
|
|
1732
1732
|
margin-top: var(--shipaid-prompt-footer-topMargin, 0px);
|
|
1733
|
-
display: flex;
|
|
1733
|
+
display: var(--shipaid-prompt-footer-display, flex);
|
|
1734
1734
|
flex-direction: row;
|
|
1735
1735
|
justify-content: var(--shipaid-prompt-footer-location, flex-start);
|
|
1736
1736
|
align-items: center;
|
|
@@ -1800,6 +1800,7 @@ const logger = {
|
|
|
1800
1800
|
const POLL_INTERVAL_DEFAULT = 2500;
|
|
1801
1801
|
const LOCAL_STORAGE_KEY = "shipaid-protection";
|
|
1802
1802
|
const LOCAL_STORAGE_POLL_KEY = "polling-shipaid-protection";
|
|
1803
|
+
const LOCAL_STORAGE_SHIPAID_POPUP_KEY = "shipaid-protection-popup-show";
|
|
1803
1804
|
const PRODUCT_HANDLE = "shipaid-protection";
|
|
1804
1805
|
const PREVIEW_FLAG = "shipaid-test";
|
|
1805
1806
|
const StoreQuery = `query StoreByDomain ($store: String!) {
|
|
@@ -1837,6 +1838,8 @@ let ShipAidWidget = class extends s$1 {
|
|
|
1837
1838
|
this.disableActions = false;
|
|
1838
1839
|
this.pollingInterval = POLL_INTERVAL_DEFAULT;
|
|
1839
1840
|
this.disableRefresh = false;
|
|
1841
|
+
this.refreshCart = false;
|
|
1842
|
+
this.persistPopup = false;
|
|
1840
1843
|
this.lang = "en";
|
|
1841
1844
|
this.currency = void 0;
|
|
1842
1845
|
this.customerId = void 0;
|
|
@@ -1865,6 +1868,15 @@ let ShipAidWidget = class extends s$1 {
|
|
|
1865
1868
|
shouldUpdate(props) {
|
|
1866
1869
|
return this.hasLoadedStrings && super.shouldUpdate(props);
|
|
1867
1870
|
}
|
|
1871
|
+
shouldPersistPopup() {
|
|
1872
|
+
const val = localStorage.getItem(`${LOCAL_STORAGE_SHIPAID_POPUP_KEY}`);
|
|
1873
|
+
return val === "true" ? "learn-more" : null;
|
|
1874
|
+
}
|
|
1875
|
+
setPopupKey() {
|
|
1876
|
+
if (this.persistPopup) {
|
|
1877
|
+
localStorage.setItem(`${LOCAL_STORAGE_SHIPAID_POPUP_KEY}`, "true");
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1868
1880
|
/** Getter to check if we should refresh the page or not */
|
|
1869
1881
|
get shouldRefreshOnUpdate() {
|
|
1870
1882
|
if (this.disablePolling)
|
|
@@ -1887,7 +1899,7 @@ let ShipAidWidget = class extends s$1 {
|
|
|
1887
1899
|
_currencyFormat(value) {
|
|
1888
1900
|
var _a, _b, _c;
|
|
1889
1901
|
return new Intl.NumberFormat(void 0, {
|
|
1890
|
-
currency: this.currency || ((_a =
|
|
1902
|
+
currency: this.currency || ((_b = (_a = window.Shopify) == null ? void 0 : _a.currency) == null ? void 0 : _b.active) || ((_c = this._store) == null ? void 0 : _c.currency) || "USD",
|
|
1891
1903
|
style: "currency"
|
|
1892
1904
|
}).format(Number(value));
|
|
1893
1905
|
}
|
|
@@ -1898,6 +1910,10 @@ let ShipAidWidget = class extends s$1 {
|
|
|
1898
1910
|
new CustomEvent(event, { bubbles: true, composed: true, detail })
|
|
1899
1911
|
);
|
|
1900
1912
|
}
|
|
1913
|
+
_handleRefreshCart() {
|
|
1914
|
+
if (this.refreshCart)
|
|
1915
|
+
return window.location.reload();
|
|
1916
|
+
}
|
|
1901
1917
|
/** Handle cart or page refreshes */
|
|
1902
1918
|
async _handleRefresh(input) {
|
|
1903
1919
|
const isCart = Reflect.has(input, "items");
|
|
@@ -2116,10 +2132,16 @@ let ShipAidWidget = class extends s$1 {
|
|
|
2116
2132
|
}
|
|
2117
2133
|
/** Templates */
|
|
2118
2134
|
learnMorePopupTemplate() {
|
|
2135
|
+
if (this.persistPopup) {
|
|
2136
|
+
this._popup = this.shouldPersistPopup();
|
|
2137
|
+
}
|
|
2119
2138
|
return x`
|
|
2120
2139
|
<shipaid-popup-learn-more
|
|
2121
2140
|
?active=${this._popup === "learn-more"}
|
|
2122
2141
|
@close=${() => {
|
|
2142
|
+
if (this.persistPopup) {
|
|
2143
|
+
localStorage.removeItem(`${LOCAL_STORAGE_SHIPAID_POPUP_KEY}`);
|
|
2144
|
+
}
|
|
2123
2145
|
this._popup = null;
|
|
2124
2146
|
}}
|
|
2125
2147
|
></shipaid-popup-learn-more>
|
|
@@ -2172,6 +2194,9 @@ let ShipAidWidget = class extends s$1 {
|
|
|
2172
2194
|
class="prompt-footer-badge"
|
|
2173
2195
|
@click=${() => {
|
|
2174
2196
|
this._popup = "learn-more";
|
|
2197
|
+
if (this.persistPopup) {
|
|
2198
|
+
this.setPopupKey();
|
|
2199
|
+
}
|
|
2175
2200
|
}}
|
|
2176
2201
|
>
|
|
2177
2202
|
<span>${translate("footer.button")}</span>
|
|
@@ -2180,6 +2205,9 @@ let ShipAidWidget = class extends s$1 {
|
|
|
2180
2205
|
class="prompt-footer-about"
|
|
2181
2206
|
@click=${() => {
|
|
2182
2207
|
this._popup = "learn-more";
|
|
2208
|
+
if (this.persistPopup) {
|
|
2209
|
+
this.setPopupKey();
|
|
2210
|
+
}
|
|
2183
2211
|
}}
|
|
2184
2212
|
>
|
|
2185
2213
|
i
|
|
@@ -2341,6 +2369,7 @@ let ShipAidWidget = class extends s$1 {
|
|
|
2341
2369
|
"/cart/change.js",
|
|
2342
2370
|
updatePayload2
|
|
2343
2371
|
);
|
|
2372
|
+
this._handleRefreshCart();
|
|
2344
2373
|
return await this._handleRefresh(cart2);
|
|
2345
2374
|
}
|
|
2346
2375
|
const updatePayload = {
|
|
@@ -2481,7 +2510,7 @@ let ShipAidWidget = class extends s$1 {
|
|
|
2481
2510
|
}
|
|
2482
2511
|
.shipaid-prompt .prompt-footer {
|
|
2483
2512
|
margin-top: var(--shipaid-prompt-footer-topMargin, 0px);
|
|
2484
|
-
display: flex;
|
|
2513
|
+
display: var(--shipaid-prompt-footer-display, flex);
|
|
2485
2514
|
flex-direction: row;
|
|
2486
2515
|
justify-content: var(--shipaid-prompt-footer-location, flex-start);
|
|
2487
2516
|
align-items: center;
|
|
@@ -2548,6 +2577,12 @@ __decorateClass([
|
|
|
2548
2577
|
__decorateClass([
|
|
2549
2578
|
n$7({ type: Boolean, attribute: true })
|
|
2550
2579
|
], ShipAidWidget.prototype, "disableRefresh", 2);
|
|
2580
|
+
__decorateClass([
|
|
2581
|
+
n$7({ type: Boolean, attribute: true })
|
|
2582
|
+
], ShipAidWidget.prototype, "refreshCart", 2);
|
|
2583
|
+
__decorateClass([
|
|
2584
|
+
n$7({ type: Boolean, attribute: true })
|
|
2585
|
+
], ShipAidWidget.prototype, "persistPopup", 2);
|
|
2551
2586
|
__decorateClass([
|
|
2552
2587
|
n$7({ type: String, attribute: true })
|
|
2553
2588
|
], ShipAidWidget.prototype, "lang", 2);
|
package/dist/widget.iife.js
CHANGED
|
@@ -29,18 +29,18 @@ const p=window,d=p.ShadowRoot&&(void 0===p.ShadyCSS||p.ShadyCSS.nativeShadow)&&"
|
|
|
29
29
|
* @license
|
|
30
30
|
* Copyright 2017 Google LLC
|
|
31
31
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
-
*/;var f;const g=window,v=g.trustedTypes,
|
|
32
|
+
*/;var f;const g=window,v=g.trustedTypes,y=v?v.emptyScript:"",_=g.reactiveElementPolyfillSupport,C={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){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(o){i=null}}return i}},b=(t,e)=>e!==t&&(e==e||t==t),w={attribute:!0,type:String,converter:C,reflect:!1,hasChanged:b},$="finalized";let x=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const o=this._$Ep(i,e);void 0!==o&&(this._$Ev.set(o,i),t.push(o))})),t}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const r=this[t];this[e]=o,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||w}static finalize(){if(this.hasOwnProperty($))return!1;this[$]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(m(t))}else void 0!==t&&e.push(m(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{d?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=p.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=w){var o;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(o=i.converter)||void 0===o?void 0:o.toAttribute)?i.converter:C).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const o=this.constructor,r=o._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=o.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:C;this._$El=r,this[r]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||b)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(o){throw e=!1,this._$Ek(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};
|
|
33
33
|
/**
|
|
34
34
|
* @license
|
|
35
35
|
* Copyright 2017 Google LLC
|
|
36
36
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
37
|
*/
|
|
38
|
-
var A;x[$]=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},null==
|
|
38
|
+
var A;x[$]=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},null==_||_({ReactiveElement:x}),(null!==(f=g.reactiveElementVersions)&&void 0!==f?f:g.reactiveElementVersions=[]).push("1.6.3");const S=window,L=S.trustedTypes,P=L?L.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",z=`lit$${(Math.random()+"").slice(9)}$`,M="?"+z,k=`<${M}>`,T=document,I=()=>T.createComment(""),O=t=>null===t||"object"!=typeof t&&"function"!=typeof t,q=Array.isArray,N="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,R=/>/g,W=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,D=/"/g,V=/^(?:script|style|textarea|title)$/i,B=(K=1,(t,...e)=>({_$litType$:K,strings:t,values:e})),Z=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),G=new WeakMap,Y=T.createTreeWalker(T,129,null,!1);var K;function J(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(e):e}class Q{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const a=t.length-1,n=this.parts,[p,d]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",a=U;for(let n=0;n<i;n++){const e=t[n];let i,p,d=-1,l=0;for(;l<e.length&&(a.lastIndex=l,p=a.exec(e),null!==p);)l=a.lastIndex,a===U?"!--"===p[1]?a=j:void 0!==p[1]?a=R:void 0!==p[2]?(V.test(p[2])&&(r=RegExp("</"+p[2],"g")),a=W):void 0!==p[3]&&(a=W):a===W?">"===p[0]?(a=null!=r?r:U,d=-1):void 0===p[1]?d=-2:(d=a.lastIndex-p[2].length,i=p[1],a=void 0===p[3]?W:'"'===p[3]?D:H):a===D||a===H?a=W:a===j||a===R?a=U:(a=W,r=void 0);const c=a===W&&t[n+1].startsWith("/>")?" ":"";s+=a===U?e+k:d>=0?(o.push(i),e.slice(0,d)+E+e.slice(d)+z+c):e+z+(-2===d?(o.push(void 0),n):c)}return[J(t,s+(t[i]||"<?>")+(2===e?"</svg>":"")),o]})(t,e);if(this.el=Q.createElement(p,i),Y.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=Y.nextNode())&&n.length<a;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith(E)||e.startsWith(z)){const i=d[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+E).split(z),e=/([.?@])?(.*)/.exec(i);n.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?ot:"?"===e[1]?st:"@"===e[1]?at:it})}else n.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(V.test(o.tagName)){const t=o.textContent.split(z),e=t.length-1;if(e>0){o.textContent=L?L.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],I()),Y.nextNode(),n.push({type:2,index:++r});o.append(t[e],I())}}}else if(8===o.nodeType)if(o.data===M)n.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(z,t+1));)n.push({type:7,index:r}),t+=z.length-1}r++}}static createElement(t,e){const i=T.createElement("template");return i.innerHTML=t,i}}function X(t,e,i=t,o){var r,s,a,n;if(e===Z)return e;let p=void 0!==o?null===(r=i._$Co)||void 0===r?void 0:r[o]:i._$Cl;const d=O(e)?void 0:e._$litDirective$;return(null==p?void 0:p.constructor)!==d&&(null===(s=null==p?void 0:p._$AO)||void 0===s||s.call(p,!1),void 0===d?p=void 0:(p=new d(t),p._$AT(t,i,o)),void 0!==o?(null!==(a=(n=i)._$Co)&&void 0!==a?a:n._$Co=[])[o]=p:i._$Cl=p),void 0!==p&&(e=X(t,p._$AS(t,e.values),p,o)),e}class tt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:T).importNode(i,!0);Y.currentNode=r;let s=Y.nextNode(),a=0,n=0,p=o[0];for(;void 0!==p;){if(a===p.index){let e;2===p.type?e=new et(s,s.nextSibling,this,t):1===p.type?e=new p.ctor(s,p.name,p.strings,this,t):6===p.type&&(e=new nt(s,this,t)),this._$AV.push(e),p=o[++n]}a!==(null==p?void 0:p.index)&&(s=Y.nextNode(),a++)}return Y.currentNode=T,r}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class et{constructor(t,e,i,o){var r;this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cp=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),O(t)?t===F||null==t||""===t?(this._$AH!==F&&this._$AR(),this._$AH=F):t!==this._$AH&&t!==Z&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>q(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==F&&O(this._$AH)?this._$AA.nextSibling.data=t:this.$(T.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Q.createElement(J(o.h,o.h[0]),this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.v(i);else{const t=new tt(r,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new Q(t)),e}T(t){q(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new et(this.k(I()),this.k(I()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class it{constructor(t,e,i,o,r){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=F}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=X(this,t,e,0),s=!O(t)||t!==this._$AH&&t!==Z,s&&(this._$AH=t);else{const o=t;let a,n;for(t=r[0],a=0;a<r.length-1;a++)n=X(this,o[i+a],e,a),n===Z&&(n=this._$AH[a]),s||(s=!O(n)||n!==this._$AH[a]),n===F?t=F:t!==F&&(t+=(null!=n?n:"")+r[a+1]),this._$AH[a]=n}s&&!o&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class ot extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}}const rt=L?L.emptyScript:"";class st extends it{constructor(){super(...arguments),this.type=4}j(t){t&&t!==F?this.element.setAttribute(this.name,rt):this.element.removeAttribute(this.name)}}class at extends it{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=X(this,t,e,0))&&void 0!==i?i:F)===Z)return;const o=this._$AH,r=t===F&&o!==F||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==F&&(o===F||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class nt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){X(this,t)}}const pt=S.litHtmlPolyfillSupport;null==pt||pt(Q,et),(null!==(A=S.litHtmlVersions)&&void 0!==A?A:S.litHtmlVersions=[]).push("2.8.0");const dt=(t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let a=s._$litPart$;if(void 0===a){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=a=new et(e.insertBefore(I(),t),t,void 0,null!=i?i:{})}return a._$AI(t),a};
|
|
39
39
|
/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
-
*/var lt,ct;let ht=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=dt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return Z}};ht.finalized=!0,ht._$litElement$=!0,null===(lt=globalThis.litElementHydrateSupport)||void 0===lt||lt.call(globalThis,{LitElement:ht});const ut=globalThis.litElementPolyfillSupport;null==ut||ut({LitElement:ht}),(null!==(ct=globalThis.litElementVersions)&&void 0!==ct?ct:globalThis.litElementVersions=[]).push("3.3.3");const mt="langChanged";function ft(t,e,i){return Object.entries(vt(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[ ]*${e}[ ]*}}`,"gm"),String(vt(i)))),t)}function gt(t,e){const i=t.split(".");let o=e.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function vt(t){return"function"==typeof t?t():t}let
|
|
43
|
+
*/var lt,ct;let ht=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=dt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return Z}};ht.finalized=!0,ht._$litElement$=!0,null===(lt=globalThis.litElementHydrateSupport)||void 0===lt||lt.call(globalThis,{LitElement:ht});const ut=globalThis.litElementPolyfillSupport;null==ut||ut({LitElement:ht}),(null!==(ct=globalThis.litElementVersions)&&void 0!==ct?ct:globalThis.litElementVersions=[]).push("3.3.3");const mt="langChanged";function ft(t,e,i){return Object.entries(vt(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[ ]*${e}[ ]*}}`,"gm"),String(vt(i)))),t)}function gt(t,e){const i=t.split(".");let o=e.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function vt(t){return"function"==typeof t?t():t}let yt={loader:()=>Promise.resolve({}),empty:t=>`[${t}]`,lookup:gt,interpolate:ft,translationCache:{}};function _t(t,e,i=yt){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=t,strings:i.strings=e},window.dispatchEvent(new CustomEvent(mt,{detail:o}))}
|
|
44
44
|
/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2017 Google LLC
|
|
@@ -51,23 +51,23 @@ const Ct=2;class bt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i)
|
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2020 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const wt=(t,e)=>{var i,o;const r=t._$AN;if(void 0===r)return!1;for(const s of r)null===(o=(i=s)._$AO)||void 0===o||o.call(i,e,!1),wt(s,e);return!0},$t=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},xt=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),
|
|
54
|
+
*/const wt=(t,e)=>{var i,o;const r=t._$AN;if(void 0===r)return!1;for(const s of r)null===(o=(i=s)._$AO)||void 0===o||o.call(i,e,!1),wt(s,e);return!0},$t=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},xt=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),Lt(e)}};
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2017 Google LLC
|
|
58
58
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
-
*/function At(t){void 0!==this._$AN?($t(this),this._$AM=t,xt(this)):this._$AM=t}function
|
|
59
|
+
*/function At(t){void 0!==this._$AN?($t(this),this._$AM=t,xt(this)):this._$AM=t}function St(t,e=!1,i=0){const o=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(o))for(let s=i;s<o.length;s++)wt(o[s],!1),$t(o[s]);else null!=o&&(wt(o,!1),$t(o));else wt(this,t)}const Lt=t=>{var e,i,o,r;t.type==Ct&&(null!==(e=(o=t)._$AP)&&void 0!==e||(o._$AP=St),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=At))};class Pt extends bt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),xt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,o;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(o=this.disconnected)||void 0===o||o.call(this)),e&&(wt(this,t),$t(this))}setValue(t){if(void 0===this._$Ct.strings)this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class Et extends Pt{constructor(){super(...arguments),this.langChangedSubscription=null,this.getValue=()=>""}renderValue(t){return this.getValue=t,this.subscribe(),this.getValue()}langChanged(t){this.setValue(this.getValue(t))}subscribe(){null==this.langChangedSubscription&&(this.langChangedSubscription=function(t,e){const i=e=>t(e.detail);return window.addEventListener(mt,i,e),()=>window.removeEventListener(mt,i)}(this.langChanged.bind(this)))}unsubscribe(){null!=this.langChangedSubscription&&this.langChangedSubscription()}disconnected(){this.unsubscribe()}reconnected(){this.subscribe()}}const zt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Et{render(t,e,i){return this.renderValue((()=>function(t,e,i=yt){let o=i.translationCache[t]||(i.translationCache[t]=i.lookup(t,i)||i.empty(t,i));return null!=(e=null!=e?vt(e):null)?i.interpolate(o,e,i):o}(t,e,i)))}});
|
|
60
60
|
/**
|
|
61
61
|
* @license
|
|
62
62
|
* Copyright 2017 Google LLC
|
|
63
63
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
|
-
*/class Mt extends bt{constructor(t){if(super(t),this.et=F,t.type!==Ct)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===F||null==t)return this.ft=void 0,this.et=t;if(t===Z)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Mt.directiveName="unsafeHTML",Mt.resultType=1;const kt="__registered_effects";function Tt(t){const e=t;if(e[kt])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[kt]={index:0,count:0,effects:[]},i.updated=t=>(e[kt].index=0,o(t)),e}function
|
|
64
|
+
*/class Mt extends bt{constructor(t){if(super(t),this.et=F,t.type!==Ct)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===F||null==t)return this.ft=void 0,this.et=t;if(t===Z)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Mt.directiveName="unsafeHTML",Mt.resultType=1;const kt="__registered_effects";function Tt(t){const e=t;if(e[kt])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[kt]={index:0,count:0,effects:[]},i.updated=t=>(e[kt].index=0,o(t)),e}function It(t,e,i){const o=function(t,e){const i=Tt(t),{index:o,count:r}=i[kt];return o===r?(i[kt].index++,i[kt].count++,i[kt].effects.push(e),e):(i[kt].index++,i[kt].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
|
|
65
65
|
/**
|
|
66
66
|
* @license
|
|
67
67
|
* Copyright 2021 Google LLC
|
|
68
68
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
69
|
*/
|
|
70
|
-
function
|
|
70
|
+
function Ot(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
71
71
|
:host {
|
|
72
72
|
--shipaid-primary: #0056d6;
|
|
73
73
|
--shipaid-secondary: #0076ff;
|
|
@@ -632,7 +632,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
632
632
|
</div>
|
|
633
633
|
</div>
|
|
634
634
|
</div>
|
|
635
|
-
`}};Gt.styles=qt,Ft([s({type:Boolean,attribute:!0})],Gt.prototype,"active",2),Gt=Ft([i("shipaid-popup-learn-more")],Gt);const Yt="Loading ShipAid Widget...",
|
|
635
|
+
`}};Gt.styles=qt,Ft([s({type:Boolean,attribute:!0})],Gt.prototype,"active",2),Gt=Ft([i("shipaid-popup-learn-more")],Gt);const Yt="Loading ShipAid Widget...",Kt="Delivery Guarantee",Jt="in case of Loss, Damage or Theft",Qt={button:"Powered by"},Xt={add:"Add",remove:"Remove",loading:"Loading..."},te={loading:Yt,title:Kt,description:Jt,footer:Qt,actions:Xt,"learn-more-popup":{close:"Close",title:"Delivery Guarantee",disclaimer:{"subtitle-enable":"We enable your favorite brands to provide a delivery guarantee because we know that every order is precious, and things happen!","subtitle-monitor":"We continuously monitor your package and offer a convenient portal for you to track your order's progress at any moment!","subtitle-notify":"You'll be notified throughout the entire shipping process, ensuring you stay up to date every step of the way.","subtitle-resolution":"In case of any issues during transit, we offer a quick and easy method to report the problem directly to the brand, for a swift resolution.",text:"By purchasing this delivery guarantee, you agree to our Terms Of Service and Privacy Policy. You are not obligated to purchase this guarantee. This guarantee is NOT insurance and does not provide indemnification against loss, damage, or liability arising from a contingent or unknown event, but rather, through ShipAid brands provide a delivery guarantee whereby if the product you ordered is not delivered in satisfactory condition, the brand from which you ordered the product may replace the product free of charge. ShipAid does not provide any products or services directly to consumers, but instead provides a service that allow brands to facilitate product replacement to their customers. Purchasing this guarantee does not mean that you will automatically be reimbursed for any product or shipping costs because the resolution process and decision for compensation is strictly decided by the brand you a purchasing from. The brand will require proof of damage or undelivered product."},links:{terms:"Terms of Service",privacy:"Privacy Policy"}}},ee=Object.freeze(Object.defineProperty({__proto__:null,actions:Xt,default:te,description:Jt,footer:Qt,loading:Yt,title:Kt},Symbol.toStringTag,{value:"Module"})),ie=u`
|
|
636
636
|
:host {
|
|
637
637
|
--shipaid-primary: #002bd6;
|
|
638
638
|
--shipaid-secondary: #0076ff;
|
|
@@ -754,7 +754,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
754
754
|
}
|
|
755
755
|
.shipaid-prompt .prompt-footer {
|
|
756
756
|
margin-top: var(--shipaid-prompt-footer-topMargin, 0px);
|
|
757
|
-
display: flex;
|
|
757
|
+
display: var(--shipaid-prompt-footer-display, flex);
|
|
758
758
|
flex-direction: row;
|
|
759
759
|
justify-content: var(--shipaid-prompt-footer-location, flex-start);
|
|
760
760
|
align-items: center;
|
|
@@ -788,16 +788,16 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
788
788
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
789
789
|
height:var(--shipaid-footer-badge-logo-height, 9px);
|
|
790
790
|
}
|
|
791
|
-
`;var oe=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(oe||{}),re=Object.defineProperty,se=Object.getOwnPropertyDescriptor,ae=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?se(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&re(e,i,s),s};const ne=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},pe=t=>console.warn(`[ShipAid] ${t}`),de=t=>console.error(`[ShipAid] ${t}`),le="shipaid-protection",ce=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>ee)).then((t=>t.default)),"./lang/es.json":()=>Promise.resolve().then((()=>
|
|
791
|
+
`;var oe=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(oe||{}),re=Object.defineProperty,se=Object.getOwnPropertyDescriptor,ae=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?se(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&re(e,i,s),s};const ne=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},pe=t=>console.warn(`[ShipAid] ${t}`),de=t=>console.error(`[ShipAid] ${t}`),le="shipaid-protection",ce="shipaid-protection-popup-show",he=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>ee)).then((t=>t.default)),"./lang/es.json":()=>Promise.resolve().then((()=>Ce)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>Le)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>Ie)).then((t=>t.default))});var ue;ue={loader:async t=>{if("en"===t)return te;const e=Reflect.get(he,`./lang/${t}.json`);return e?await e():te}},yt=Object.assign(Object.assign({},yt),ue),t.ShipAidWidget=class extends ht{constructor(){var t,e,i;super(...arguments),this.disablePolling=!1,this.disableActions=!1,this.pollingInterval=2500,this.disableRefresh=!1,this.refreshCart=!1,this.persistPopup=!1,this.lang="en",this.currency=void 0,this.customerId=void 0,this._apiEndpoint="/apps/shipaid",this._storeDomain=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost),this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this.hasLoadedStrings=!1,this.intervalId=0,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ne(t),post:(t,e)=>ne(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}shouldUpdate(t){return this.hasLoadedStrings&&super.shouldUpdate(t)}shouldPersistPopup(){return"true"===localStorage.getItem(`${ce}`)?"learn-more":null}setPopupKey(){this.persistPopup&&localStorage.setItem(`${ce}`,"true")}get shouldRefreshOnUpdate(){return!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;const{searchParams:i}=new URL(window.location.href);return(null==(t=window.Shopify)?void 0:t.designMode)||i.has("shipaid-test")?(pe("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o;return new Intl.NumberFormat(void 0,{currency:this.currency||(null==(i=null==(e=window.Shopify)?void 0:e.currency)?void 0:i.active)||(null==(o=this._store)?void 0:o.currency)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}_handleRefreshCart(){if(this.refreshCart)return window.location.reload()}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(oe.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.calculateProtectionTotal(this._store,this._protectionProduct,t)}_findProtectionVariant(t){if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.findProtectionVariant(this._store,this._protectionProduct,t)}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i,o,r;const s=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost);if(!s)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetPollProtection\n widgetShowCart\n excludedProductSkus\n excludedCustomersIdsAutoOptIn\n protectionSettings\n }\n}",variables:{store:s}},i=await this._fetch.post(t.toString(),e);if(!i)throw new Error("Missing response for store query.");if(null==(o=i.errors)?void 0:o.length)throw new Error(i.errors[0].message);if(!(null==(r=i.data)?void 0:r.store))throw new Error("Missing store from store query response.");return i.data.store}catch(a){throw console.error(a),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw de(t.message),new Error("Could not fetch cart for current domain.")}}async _fetchProduct(){try{const{product:t}=await this._fetch.get("/products/shipaid-protection.json");return t}catch(t){throw de(t.message),new Error("Could not fetch protection product for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={quantity:1,id:this._protectionVariant.id},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._setState("success")}catch(i){de(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={quantity:0,id:this._protectionCartItem.key},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._cart=e,this._setState("success")}catch(t){de(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async attemptAddProtection(){var t,e,i,o,r,s;if(!(null==(t=this._store)?void 0:t.widgetAutoOptIn))return;if(!(null==(e=this._cart)?void 0:e.items)||!(null==(i=this._cart)?void 0:i.item_count))return;const a=null==(o=this._cart.items)?void 0:o.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),n=null==(r=this._cart)?void 0:r.items[a];if(this._hasProtectionInCart=!!n,1===this._cart.item_count&&n)return;!!sessionStorage.getItem(le)||(sessionStorage.setItem(le,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(s=this._cart)?void 0:s.item_count)&&this._store.widgetShowCart&&await this.addProtection())}learnMorePopupTemplate(){return this.persistPopup&&(this._popup=this.shouldPersistPopup()),B`
|
|
792
792
|
<shipaid-popup-learn-more
|
|
793
793
|
?active=${"learn-more"===this._popup}
|
|
794
|
-
@close=${()=>{this._popup=null}}
|
|
794
|
+
@close=${()=>{this.persistPopup&&localStorage.removeItem(`${ce}`),this._popup=null}}
|
|
795
795
|
></shipaid-popup-learn-more>
|
|
796
796
|
`}promptTemplate(){var t;return B`
|
|
797
797
|
<div class="shipaid-prompt">
|
|
798
798
|
<div class="prompt-product">
|
|
799
799
|
<div class="prompt-product-image">
|
|
800
|
-
${
|
|
800
|
+
${Ot(this._hasProtectionInCart,(()=>Ut),(()=>Nt))}
|
|
801
801
|
</div>
|
|
802
802
|
<div class="prompt-product-details">
|
|
803
803
|
<p class="prompt-product-details-title">
|
|
@@ -811,7 +811,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
811
811
|
<p class="prompt-product-actions-price">
|
|
812
812
|
${(null==(t=this._protectionVariant)?void 0:t.price)&&this._currencyFormat(this._protectionVariant.price)}
|
|
813
813
|
</p>
|
|
814
|
-
${
|
|
814
|
+
${Ot(!this.disableActions,(()=>B`
|
|
815
815
|
<button
|
|
816
816
|
class="prompt-product-actions-button"
|
|
817
817
|
@click=${this._updateProtection}
|
|
@@ -822,24 +822,24 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
822
822
|
`))}
|
|
823
823
|
</div>
|
|
824
824
|
</div>
|
|
825
|
-
${
|
|
825
|
+
${Ot(this._state.error,(()=>B`<p class="error">${this._state.error}</p>`))}
|
|
826
826
|
<div class="prompt-footer">
|
|
827
827
|
<a
|
|
828
828
|
class="prompt-footer-badge"
|
|
829
|
-
@click=${()=>{this._popup="learn-more"}}
|
|
829
|
+
@click=${()=>{this._popup="learn-more",this.persistPopup&&this.setPopupKey()}}
|
|
830
830
|
>
|
|
831
831
|
<span>${zt("footer.button")}</span>
|
|
832
832
|
${jt}
|
|
833
833
|
<button
|
|
834
834
|
class="prompt-footer-about"
|
|
835
|
-
@click=${()=>{this._popup="learn-more"}}
|
|
835
|
+
@click=${()=>{this._popup="learn-more",this.persistPopup&&this.setPopupKey()}}
|
|
836
836
|
>
|
|
837
837
|
i
|
|
838
838
|
</button>
|
|
839
839
|
</a>
|
|
840
840
|
</div>
|
|
841
841
|
</div>
|
|
842
|
-
`}async connectedCallback(){super.connectedCallback(),await async function(t,e=
|
|
842
|
+
`}async connectedCallback(){super.connectedCallback(),await async function(t,e=yt){const i=await e.loader(t,e);e.translationCache={},_t(t,i,e)}(this.lang),this.hasLoadedStrings=!0}render(){return It(this,(async()=>{var t,e,i;const o=document.createElement("link");o.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),o.setAttribute("rel","stylesheet"),document.head.appendChild(o);try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(r){return de(r.message),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(oe.LOADED,this._store),setTimeout((async()=>{var t,e,i,o;(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&(null==(e=this._cart)?void 0:e.item_count)&&(this.customerId&&this._store.excludedCustomersIdsAutoOptIn&&(null==(i=this._store.excludedCustomersIdsAutoOptIn)?void 0:i.length)&&this._store.excludedCustomersIdsAutoOptIn.includes(`gid://shopify/Customer/${this.customerId}`)||sessionStorage.getItem(le)||(sessionStorage.setItem(le,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(o=this._cart)?void 0:o.item_count)&&this._store.widgetShowCart&&await this.addProtection()))}),500),void(this.disablePolling||(setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval),(null==(i=this._store)?void 0:i.widgetPollProtection)&&!this.intervalId&&(this.intervalId=setInterval((async()=>{await this.attemptAddProtection()}),400),localStorage.setItem(`polling-shipaid-protection_${this.intervalId}`,`${this.intervalId}`))))):(pe("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(pe("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(pe("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),It(this,(async()=>{var t,e,i;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const o=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),r=null==(i=this._cart)?void 0:i.items[o];if(this._hasProtectionInCart=!!r,1===this._cart.item_count&&r){const t={id:r.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return sessionStorage.removeItem(le),await this._handleRefresh(e)}const s=await this.calculateProtectionTotal(this._cart),a=this._findProtectionVariant(s);if(this._protectionVariant=a,!(null==a?void 0:a.id))return this._shouldShowWidget=!1,void de("No matching protection variant found.");if(!r)return;if(a.id===r.variant_id){if(this._protectionCartItem={...r,index:o,position:o+1},1===r.quantity)return;const t={id:r.key,quantity:1},e=await this._fetch.post("/cart/change.js",t);return this._handleRefreshCart(),await this._handleRefresh(e)}const n={updates:{[r.variant_id]:0,[a.id]:1}},p=await this._fetch.post("/cart/update.js",n);await this._handleRefresh(p)}),[this._store,this._cart]),dt(this.learnMorePopupTemplate(),document.body),B`
|
|
843
843
|
<style>
|
|
844
844
|
:host {
|
|
845
845
|
--shipaid-primary: #002bd6;
|
|
@@ -962,7 +962,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
962
962
|
}
|
|
963
963
|
.shipaid-prompt .prompt-footer {
|
|
964
964
|
margin-top: var(--shipaid-prompt-footer-topMargin, 0px);
|
|
965
|
-
display: flex;
|
|
965
|
+
display: var(--shipaid-prompt-footer-display, flex);
|
|
966
966
|
flex-direction: row;
|
|
967
967
|
justify-content: var(--shipaid-prompt-footer-location, flex-start);
|
|
968
968
|
align-items: center;
|
|
@@ -998,8 +998,8 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
998
998
|
}
|
|
999
999
|
</style>
|
|
1000
1000
|
<div class="shipaid">
|
|
1001
|
-
${
|
|
1001
|
+
${Ot(this._hasFinishedSetup,(()=>{var t;return Ot(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>this.promptTemplate()),(()=>F))}),(()=>B`<p>
|
|
1002
1002
|
<slot name="loading" default>${zt("loading")}</slot>
|
|
1003
1003
|
</p>`))}
|
|
1004
1004
|
</div>
|
|
1005
|
-
`}},t.ShipAidWidget.styles=ie,ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),ae([s({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"customerId",2),ae([a()],t.ShipAidWidget.prototype,"_storeDomain",2),ae([a()],t.ShipAidWidget.prototype,"_store",2),ae([a()],t.ShipAidWidget.prototype,"_cart",2),ae([a()],t.ShipAidWidget.prototype,"_protectionProduct",2),ae([a()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),ae([a()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),ae([a()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),ae([a()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),ae([a()],t.ShipAidWidget.prototype,"_protectionCartItem",2),ae([a()],t.ShipAidWidget.prototype,"_protectionVariant",2),ae([a()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),ae([a()],t.ShipAidWidget.prototype,"intervalId",2),ae([a()],t.ShipAidWidget.prototype,"_state",2),ae([a()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=ae([i("shipaid-widget")],t.ShipAidWidget);const
|
|
1005
|
+
`}},t.ShipAidWidget.styles=ie,ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),ae([s({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"refreshCart",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"persistPopup",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"customerId",2),ae([a()],t.ShipAidWidget.prototype,"_storeDomain",2),ae([a()],t.ShipAidWidget.prototype,"_store",2),ae([a()],t.ShipAidWidget.prototype,"_cart",2),ae([a()],t.ShipAidWidget.prototype,"_protectionProduct",2),ae([a()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),ae([a()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),ae([a()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),ae([a()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),ae([a()],t.ShipAidWidget.prototype,"_protectionCartItem",2),ae([a()],t.ShipAidWidget.prototype,"_protectionVariant",2),ae([a()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),ae([a()],t.ShipAidWidget.prototype,"intervalId",2),ae([a()],t.ShipAidWidget.prototype,"_state",2),ae([a()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=ae([i("shipaid-widget")],t.ShipAidWidget);const me="Cargando el widget ShipAid...",fe="Garantía de entrega",ge="en caso de Pérdida, Daño o Robo",ve={button:"Energizado por"},ye={add:"Agregar",remove:"Eliminar",loading:"Cargando..."},_e={loading:me,title:fe,description:ge,footer:ve,actions:ye,"learn-more-popup":{close:"Cerca",title:"Garantía de entrega",disclaimer:{"subtitle-enable":"Permitimos que sus marcas favoritas brinden una garantía de entrega porque sabemos que cada pedido es valioso y las cosas suceden!","subtitle-monitor":"Supervisamos continuamente su paquete y le ofrecemos un portal conveniente para que pueda realizar un seguimiento del progreso de su pedido en cualquier momento.","subtitle-notify":"Se le notificará durante todo el proceso de envío, asegurándose de que esté actualizado en cada paso del camino.","subtitle-resolution":"En caso de cualquier problema durante el tránsito, ofrecemos un método rápido y fácil para informar el problema directamente a la marca, para una resolución rápida.",text:"Al comprar esta garantía de entrega, acepta nuestros Términos de servicio y Política de privacidad. Usted no está obligado a comprar esta garantía. Esta garantía NO es un seguro y no brinda indemnización por pérdida, daño o responsabilidad que surja de un evento contingente o desconocido, sino que, a través de las marcas de ShipAid, brinda una garantía de entrega mediante la cual, si el producto que ordenó no se entrega en condiciones satisfactorias, la marca desde el que ordenó el producto puede reemplazar el producto sin cargo. ShipAid no proporciona ningún producto o servicio directamente a los consumidores, sino que proporciona un servicio que permite a las marcas facilitar el reemplazo de productos a sus clientes. La compra de esta garantía no significa que se le reembolsará automáticamente cualquier producto o costo de envío porque el proceso de resolución y la decisión de compensación lo decide estrictamente la marca a la que le compra. La marca requerirá prueba de daño o producto no entregado."},links:{terms:"Términos de servicio",privacy:"Política de Privacidad"}}},Ce=Object.freeze(Object.defineProperty({__proto__:null,actions:ye,default:_e,description:ge,footer:ve,loading:me,title:fe},Symbol.toStringTag,{value:"Module"})),be="Caricamento del widget ShipAid...",we="Garanzia di consegna",$e="in caso di Perdita, Danno o Furto",xe={button:"Offerto da"},Ae={add:"Aggiungere",remove:"Rimuovere",loading:"Caricamento ..."},Se={loading:be,title:we,description:$e,footer:xe,actions:Ae,"learn-more-popup":{close:"Vicina",title:"Garanzia di consegna",subtitle:"Consentiamo ai tuoi marchi preferiti di offrire una garanzia di consegna perché ogni ordine è prezioso!",disclaimer:{"subtitle-enable":"Consentiamo ai tuoi marchi preferiti di fornire una garanzia di consegna perché sappiamo che ogni ordine è prezioso e le cose accadono!","subtitle-monitor":"Monitoriamo continuamente il tuo pacco e ti offriamo un comodo portale per monitorare lo stato di avanzamento del tuo ordine in qualsiasi momento!","subtitle-notify":"Riceverai una notifica durante l'intero processo di spedizione, assicurandoti di rimanere aggiornato in ogni fase del processo.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Acquistando questa garanzia di consegna, accetti i nostri Termini di servizio e l'Informativa sulla privacy. Non sei obbligato ad acquistare questa garanzia. Questa garanzia NON è un'assicurazione e non fornisce un indennizzo contro perdite, danni o responsabilità derivanti da un evento contingente o sconosciuto, ma piuttosto, attraverso ShipAid i marchi forniscono una garanzia di consegna in base alla quale se il prodotto ordinato non viene consegnato in condizioni soddisfacenti, il marchio da cui hai ordinato il prodotto può sostituire il prodotto gratuitamente. ShipAid non fornisce alcun prodotto o servizio direttamente ai consumatori, ma fornisce invece un servizio che consente ai marchi di facilitare la sostituzione del prodotto ai propri clienti. L'acquisto di questa garanzia non significa che verrai automaticamente rimborsato per qualsiasi prodotto o costo di spedizione perché il processo di risoluzione e la decisione per il risarcimento sono rigorosamente decisi dal marchio da cui stai acquistando. Il marchio richiederà la prova del danno o del prodotto non consegnato."},links:{terms:"Termini di servizio",privacy:"Politica sulla riservatezza"}}},Le=Object.freeze(Object.defineProperty({__proto__:null,actions:Ae,default:Se,description:$e,footer:xe,loading:be,title:we},Symbol.toStringTag,{value:"Module"})),Pe="Carregando o widget ShipAid...",Ee="Garantia de entrega",ze="em caso de Perda, Danos ou Roubo",Me={button:"Distribuído por"},ke={add:"Adicionar",remove:"Remover",loading:"Carregando..."},Te={loading:Pe,title:Ee,description:ze,footer:Me,actions:ke,"learn-more-popup":{close:"Fechar",title:"Garantia de entrega",subtitle:"Capacitamos suas marcas favoritas para oferecer uma garantia de entrega porque cada pedido é precioso!",disclaimer:{"subtitle-enable":"Permitimos que suas marcas favoritas forneçam uma garantia de entrega porque sabemos que cada pedido é precioso e as coisas acontecem!","subtitle-monitor":"Monitoramos continuamente o seu pacote e oferecemos um portal conveniente para você acompanhar o andamento do seu pedido a qualquer momento!","subtitle-notify":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Ao adquirir esta garantia de entrega, você concorda com nossos Termos de Serviço e Política de Privacidade. Esta garantia não é obrigatória, NÃO é um seguro e não fornece indenização contra perdas, danos ou responsabilidade decorrentes de um contingente ou desconhecido. Caso o produto não seja entregue em condições satisfatórias, a marca da qual você comprou pode substituí-lo gratuitamente. A ShipAid não fornece nenhum produto ou serviço diretamente aos consumidores, mas sim presta um serviço que permite às marcas facilitar a substituição do produto aos seus clientes. Adquirir esta garantia não significa que você será automaticamente reembolsado por qualquer produto ou custos de envio porque o processo de resolução e decisão de compensação é estritamente decidido pela marca que você está comprando. A marca exigirá prova de danos ou produto não entregue."},links:{terms:"Termos de serviço",privacy:"Política de Privacidade"}}},Ie=Object.freeze(Object.defineProperty({__proto__:null,actions:ke,default:Te,description:ze,footer:Me,loading:Pe,title:Ee},Symbol.toStringTag,{value:"Module"}));return Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
|
package/dist/widget.umd.js
CHANGED
|
@@ -29,18 +29,18 @@ const p=window,d=p.ShadowRoot&&(void 0===p.ShadyCSS||p.ShadyCSS.nativeShadow)&&"
|
|
|
29
29
|
* @license
|
|
30
30
|
* Copyright 2017 Google LLC
|
|
31
31
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
-
*/;var f;const g=window,v=g.trustedTypes,
|
|
32
|
+
*/;var f;const g=window,v=g.trustedTypes,y=v?v.emptyScript:"",_=g.reactiveElementPolyfillSupport,C={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){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(o){i=null}}return i}},b=(t,e)=>e!==t&&(e==e||t==t),w={attribute:!0,type:String,converter:C,reflect:!1,hasChanged:b},$="finalized";let x=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const o=this._$Ep(i,e);void 0!==o&&(this._$Ev.set(o,i),t.push(o))})),t}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const r=this[t];this[e]=o,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||w}static finalize(){if(this.hasOwnProperty($))return!1;this[$]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(m(t))}else void 0!==t&&e.push(m(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{d?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=p.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=w){var o;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(o=i.converter)||void 0===o?void 0:o.toAttribute)?i.converter:C).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const o=this.constructor,r=o._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=o.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:C;this._$El=r,this[r]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||b)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(o){throw e=!1,this._$Ek(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};
|
|
33
33
|
/**
|
|
34
34
|
* @license
|
|
35
35
|
* Copyright 2017 Google LLC
|
|
36
36
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
37
|
*/
|
|
38
|
-
var A;x[$]=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},null==
|
|
38
|
+
var A;x[$]=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},null==_||_({ReactiveElement:x}),(null!==(f=g.reactiveElementVersions)&&void 0!==f?f:g.reactiveElementVersions=[]).push("1.6.3");const S=window,L=S.trustedTypes,P=L?L.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",z=`lit$${(Math.random()+"").slice(9)}$`,M="?"+z,k=`<${M}>`,T=document,I=()=>T.createComment(""),O=t=>null===t||"object"!=typeof t&&"function"!=typeof t,q=Array.isArray,N="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,R=/>/g,W=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,D=/"/g,V=/^(?:script|style|textarea|title)$/i,B=(K=1,(t,...e)=>({_$litType$:K,strings:t,values:e})),Z=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),G=new WeakMap,Y=T.createTreeWalker(T,129,null,!1);var K;function J(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(e):e}class Q{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const a=t.length-1,n=this.parts,[p,d]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",a=U;for(let n=0;n<i;n++){const e=t[n];let i,p,d=-1,l=0;for(;l<e.length&&(a.lastIndex=l,p=a.exec(e),null!==p);)l=a.lastIndex,a===U?"!--"===p[1]?a=j:void 0!==p[1]?a=R:void 0!==p[2]?(V.test(p[2])&&(r=RegExp("</"+p[2],"g")),a=W):void 0!==p[3]&&(a=W):a===W?">"===p[0]?(a=null!=r?r:U,d=-1):void 0===p[1]?d=-2:(d=a.lastIndex-p[2].length,i=p[1],a=void 0===p[3]?W:'"'===p[3]?D:H):a===D||a===H?a=W:a===j||a===R?a=U:(a=W,r=void 0);const c=a===W&&t[n+1].startsWith("/>")?" ":"";s+=a===U?e+k:d>=0?(o.push(i),e.slice(0,d)+E+e.slice(d)+z+c):e+z+(-2===d?(o.push(void 0),n):c)}return[J(t,s+(t[i]||"<?>")+(2===e?"</svg>":"")),o]})(t,e);if(this.el=Q.createElement(p,i),Y.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=Y.nextNode())&&n.length<a;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith(E)||e.startsWith(z)){const i=d[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+E).split(z),e=/([.?@])?(.*)/.exec(i);n.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?ot:"?"===e[1]?st:"@"===e[1]?at:it})}else n.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(V.test(o.tagName)){const t=o.textContent.split(z),e=t.length-1;if(e>0){o.textContent=L?L.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],I()),Y.nextNode(),n.push({type:2,index:++r});o.append(t[e],I())}}}else if(8===o.nodeType)if(o.data===M)n.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(z,t+1));)n.push({type:7,index:r}),t+=z.length-1}r++}}static createElement(t,e){const i=T.createElement("template");return i.innerHTML=t,i}}function X(t,e,i=t,o){var r,s,a,n;if(e===Z)return e;let p=void 0!==o?null===(r=i._$Co)||void 0===r?void 0:r[o]:i._$Cl;const d=O(e)?void 0:e._$litDirective$;return(null==p?void 0:p.constructor)!==d&&(null===(s=null==p?void 0:p._$AO)||void 0===s||s.call(p,!1),void 0===d?p=void 0:(p=new d(t),p._$AT(t,i,o)),void 0!==o?(null!==(a=(n=i)._$Co)&&void 0!==a?a:n._$Co=[])[o]=p:i._$Cl=p),void 0!==p&&(e=X(t,p._$AS(t,e.values),p,o)),e}class tt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:T).importNode(i,!0);Y.currentNode=r;let s=Y.nextNode(),a=0,n=0,p=o[0];for(;void 0!==p;){if(a===p.index){let e;2===p.type?e=new et(s,s.nextSibling,this,t):1===p.type?e=new p.ctor(s,p.name,p.strings,this,t):6===p.type&&(e=new nt(s,this,t)),this._$AV.push(e),p=o[++n]}a!==(null==p?void 0:p.index)&&(s=Y.nextNode(),a++)}return Y.currentNode=T,r}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class et{constructor(t,e,i,o){var r;this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cp=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),O(t)?t===F||null==t||""===t?(this._$AH!==F&&this._$AR(),this._$AH=F):t!==this._$AH&&t!==Z&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>q(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==F&&O(this._$AH)?this._$AA.nextSibling.data=t:this.$(T.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Q.createElement(J(o.h,o.h[0]),this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.v(i);else{const t=new tt(r,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new Q(t)),e}T(t){q(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new et(this.k(I()),this.k(I()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class it{constructor(t,e,i,o,r){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=F}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=X(this,t,e,0),s=!O(t)||t!==this._$AH&&t!==Z,s&&(this._$AH=t);else{const o=t;let a,n;for(t=r[0],a=0;a<r.length-1;a++)n=X(this,o[i+a],e,a),n===Z&&(n=this._$AH[a]),s||(s=!O(n)||n!==this._$AH[a]),n===F?t=F:t!==F&&(t+=(null!=n?n:"")+r[a+1]),this._$AH[a]=n}s&&!o&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class ot extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}}const rt=L?L.emptyScript:"";class st extends it{constructor(){super(...arguments),this.type=4}j(t){t&&t!==F?this.element.setAttribute(this.name,rt):this.element.removeAttribute(this.name)}}class at extends it{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=X(this,t,e,0))&&void 0!==i?i:F)===Z)return;const o=this._$AH,r=t===F&&o!==F||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==F&&(o===F||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class nt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){X(this,t)}}const pt=S.litHtmlPolyfillSupport;null==pt||pt(Q,et),(null!==(A=S.litHtmlVersions)&&void 0!==A?A:S.litHtmlVersions=[]).push("2.8.0");const dt=(t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let a=s._$litPart$;if(void 0===a){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=a=new et(e.insertBefore(I(),t),t,void 0,null!=i?i:{})}return a._$AI(t),a};
|
|
39
39
|
/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
-
*/var lt,ct;let ht=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=dt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return Z}};ht.finalized=!0,ht._$litElement$=!0,null===(lt=globalThis.litElementHydrateSupport)||void 0===lt||lt.call(globalThis,{LitElement:ht});const ut=globalThis.litElementPolyfillSupport;null==ut||ut({LitElement:ht}),(null!==(ct=globalThis.litElementVersions)&&void 0!==ct?ct:globalThis.litElementVersions=[]).push("3.3.3");const mt="langChanged";function ft(t,e,i){return Object.entries(vt(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[ ]*${e}[ ]*}}`,"gm"),String(vt(i)))),t)}function gt(t,e){const i=t.split(".");let o=e.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function vt(t){return"function"==typeof t?t():t}let
|
|
43
|
+
*/var lt,ct;let ht=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=dt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return Z}};ht.finalized=!0,ht._$litElement$=!0,null===(lt=globalThis.litElementHydrateSupport)||void 0===lt||lt.call(globalThis,{LitElement:ht});const ut=globalThis.litElementPolyfillSupport;null==ut||ut({LitElement:ht}),(null!==(ct=globalThis.litElementVersions)&&void 0!==ct?ct:globalThis.litElementVersions=[]).push("3.3.3");const mt="langChanged";function ft(t,e,i){return Object.entries(vt(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[ ]*${e}[ ]*}}`,"gm"),String(vt(i)))),t)}function gt(t,e){const i=t.split(".");let o=e.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function vt(t){return"function"==typeof t?t():t}let yt={loader:()=>Promise.resolve({}),empty:t=>`[${t}]`,lookup:gt,interpolate:ft,translationCache:{}};function _t(t,e,i=yt){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=t,strings:i.strings=e},window.dispatchEvent(new CustomEvent(mt,{detail:o}))}
|
|
44
44
|
/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2017 Google LLC
|
|
@@ -51,23 +51,23 @@ const Ct=2;class bt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i)
|
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2020 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const wt=(t,e)=>{var i,o;const r=t._$AN;if(void 0===r)return!1;for(const s of r)null===(o=(i=s)._$AO)||void 0===o||o.call(i,e,!1),wt(s,e);return!0},$t=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},xt=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),
|
|
54
|
+
*/const wt=(t,e)=>{var i,o;const r=t._$AN;if(void 0===r)return!1;for(const s of r)null===(o=(i=s)._$AO)||void 0===o||o.call(i,e,!1),wt(s,e);return!0},$t=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},xt=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),Lt(e)}};
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2017 Google LLC
|
|
58
58
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
-
*/function At(t){void 0!==this._$AN?($t(this),this._$AM=t,xt(this)):this._$AM=t}function
|
|
59
|
+
*/function At(t){void 0!==this._$AN?($t(this),this._$AM=t,xt(this)):this._$AM=t}function St(t,e=!1,i=0){const o=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(o))for(let s=i;s<o.length;s++)wt(o[s],!1),$t(o[s]);else null!=o&&(wt(o,!1),$t(o));else wt(this,t)}const Lt=t=>{var e,i,o,r;t.type==Ct&&(null!==(e=(o=t)._$AP)&&void 0!==e||(o._$AP=St),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=At))};class Pt extends bt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),xt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,o;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(o=this.disconnected)||void 0===o||o.call(this)),e&&(wt(this,t),$t(this))}setValue(t){if(void 0===this._$Ct.strings)this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class Et extends Pt{constructor(){super(...arguments),this.langChangedSubscription=null,this.getValue=()=>""}renderValue(t){return this.getValue=t,this.subscribe(),this.getValue()}langChanged(t){this.setValue(this.getValue(t))}subscribe(){null==this.langChangedSubscription&&(this.langChangedSubscription=function(t,e){const i=e=>t(e.detail);return window.addEventListener(mt,i,e),()=>window.removeEventListener(mt,i)}(this.langChanged.bind(this)))}unsubscribe(){null!=this.langChangedSubscription&&this.langChangedSubscription()}disconnected(){this.unsubscribe()}reconnected(){this.subscribe()}}const zt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Et{render(t,e,i){return this.renderValue((()=>function(t,e,i=yt){let o=i.translationCache[t]||(i.translationCache[t]=i.lookup(t,i)||i.empty(t,i));return null!=(e=null!=e?vt(e):null)?i.interpolate(o,e,i):o}(t,e,i)))}});
|
|
60
60
|
/**
|
|
61
61
|
* @license
|
|
62
62
|
* Copyright 2017 Google LLC
|
|
63
63
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
|
-
*/class Mt extends bt{constructor(t){if(super(t),this.et=F,t.type!==Ct)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===F||null==t)return this.ft=void 0,this.et=t;if(t===Z)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Mt.directiveName="unsafeHTML",Mt.resultType=1;const kt="__registered_effects";function Tt(t){const e=t;if(e[kt])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[kt]={index:0,count:0,effects:[]},i.updated=t=>(e[kt].index=0,o(t)),e}function
|
|
64
|
+
*/class Mt extends bt{constructor(t){if(super(t),this.et=F,t.type!==Ct)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===F||null==t)return this.ft=void 0,this.et=t;if(t===Z)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Mt.directiveName="unsafeHTML",Mt.resultType=1;const kt="__registered_effects";function Tt(t){const e=t;if(e[kt])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[kt]={index:0,count:0,effects:[]},i.updated=t=>(e[kt].index=0,o(t)),e}function It(t,e,i){const o=function(t,e){const i=Tt(t),{index:o,count:r}=i[kt];return o===r?(i[kt].index++,i[kt].count++,i[kt].effects.push(e),e):(i[kt].index++,i[kt].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
|
|
65
65
|
/**
|
|
66
66
|
* @license
|
|
67
67
|
* Copyright 2021 Google LLC
|
|
68
68
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
69
|
*/
|
|
70
|
-
function
|
|
70
|
+
function Ot(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
71
71
|
:host {
|
|
72
72
|
--shipaid-primary: #0056d6;
|
|
73
73
|
--shipaid-secondary: #0076ff;
|
|
@@ -632,7 +632,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
632
632
|
</div>
|
|
633
633
|
</div>
|
|
634
634
|
</div>
|
|
635
|
-
`}};Gt.styles=qt,Ft([s({type:Boolean,attribute:!0})],Gt.prototype,"active",2),Gt=Ft([i("shipaid-popup-learn-more")],Gt);const Yt="Loading ShipAid Widget...",
|
|
635
|
+
`}};Gt.styles=qt,Ft([s({type:Boolean,attribute:!0})],Gt.prototype,"active",2),Gt=Ft([i("shipaid-popup-learn-more")],Gt);const Yt="Loading ShipAid Widget...",Kt="Delivery Guarantee",Jt="in case of Loss, Damage or Theft",Qt={button:"Powered by"},Xt={add:"Add",remove:"Remove",loading:"Loading..."},te={loading:Yt,title:Kt,description:Jt,footer:Qt,actions:Xt,"learn-more-popup":{close:"Close",title:"Delivery Guarantee",disclaimer:{"subtitle-enable":"We enable your favorite brands to provide a delivery guarantee because we know that every order is precious, and things happen!","subtitle-monitor":"We continuously monitor your package and offer a convenient portal for you to track your order's progress at any moment!","subtitle-notify":"You'll be notified throughout the entire shipping process, ensuring you stay up to date every step of the way.","subtitle-resolution":"In case of any issues during transit, we offer a quick and easy method to report the problem directly to the brand, for a swift resolution.",text:"By purchasing this delivery guarantee, you agree to our Terms Of Service and Privacy Policy. You are not obligated to purchase this guarantee. This guarantee is NOT insurance and does not provide indemnification against loss, damage, or liability arising from a contingent or unknown event, but rather, through ShipAid brands provide a delivery guarantee whereby if the product you ordered is not delivered in satisfactory condition, the brand from which you ordered the product may replace the product free of charge. ShipAid does not provide any products or services directly to consumers, but instead provides a service that allow brands to facilitate product replacement to their customers. Purchasing this guarantee does not mean that you will automatically be reimbursed for any product or shipping costs because the resolution process and decision for compensation is strictly decided by the brand you a purchasing from. The brand will require proof of damage or undelivered product."},links:{terms:"Terms of Service",privacy:"Privacy Policy"}}},ee=Object.freeze(Object.defineProperty({__proto__:null,actions:Xt,default:te,description:Jt,footer:Qt,loading:Yt,title:Kt},Symbol.toStringTag,{value:"Module"})),ie=u`
|
|
636
636
|
:host {
|
|
637
637
|
--shipaid-primary: #002bd6;
|
|
638
638
|
--shipaid-secondary: #0076ff;
|
|
@@ -754,7 +754,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
754
754
|
}
|
|
755
755
|
.shipaid-prompt .prompt-footer {
|
|
756
756
|
margin-top: var(--shipaid-prompt-footer-topMargin, 0px);
|
|
757
|
-
display: flex;
|
|
757
|
+
display: var(--shipaid-prompt-footer-display, flex);
|
|
758
758
|
flex-direction: row;
|
|
759
759
|
justify-content: var(--shipaid-prompt-footer-location, flex-start);
|
|
760
760
|
align-items: center;
|
|
@@ -788,16 +788,16 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
788
788
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
789
789
|
height:var(--shipaid-footer-badge-logo-height, 9px);
|
|
790
790
|
}
|
|
791
|
-
`;var oe=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(oe||{}),re=Object.defineProperty,se=Object.getOwnPropertyDescriptor,ae=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?se(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&re(e,i,s),s};const ne=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},pe=t=>console.warn(`[ShipAid] ${t}`),de=t=>console.error(`[ShipAid] ${t}`),le="shipaid-protection",ce=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>ee)).then((t=>t.default)),"./lang/es.json":()=>Promise.resolve().then((()=>
|
|
791
|
+
`;var oe=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(oe||{}),re=Object.defineProperty,se=Object.getOwnPropertyDescriptor,ae=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?se(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&re(e,i,s),s};const ne=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},pe=t=>console.warn(`[ShipAid] ${t}`),de=t=>console.error(`[ShipAid] ${t}`),le="shipaid-protection",ce="shipaid-protection-popup-show",he=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>ee)).then((t=>t.default)),"./lang/es.json":()=>Promise.resolve().then((()=>Ce)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>Le)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>Ie)).then((t=>t.default))});var ue;ue={loader:async t=>{if("en"===t)return te;const e=Reflect.get(he,`./lang/${t}.json`);return e?await e():te}},yt=Object.assign(Object.assign({},yt),ue),t.ShipAidWidget=class extends ht{constructor(){var t,e,i;super(...arguments),this.disablePolling=!1,this.disableActions=!1,this.pollingInterval=2500,this.disableRefresh=!1,this.refreshCart=!1,this.persistPopup=!1,this.lang="en",this.currency=void 0,this.customerId=void 0,this._apiEndpoint="/apps/shipaid",this._storeDomain=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost),this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this.hasLoadedStrings=!1,this.intervalId=0,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ne(t),post:(t,e)=>ne(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}shouldUpdate(t){return this.hasLoadedStrings&&super.shouldUpdate(t)}shouldPersistPopup(){return"true"===localStorage.getItem(`${ce}`)?"learn-more":null}setPopupKey(){this.persistPopup&&localStorage.setItem(`${ce}`,"true")}get shouldRefreshOnUpdate(){return!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;const{searchParams:i}=new URL(window.location.href);return(null==(t=window.Shopify)?void 0:t.designMode)||i.has("shipaid-test")?(pe("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o;return new Intl.NumberFormat(void 0,{currency:this.currency||(null==(i=null==(e=window.Shopify)?void 0:e.currency)?void 0:i.active)||(null==(o=this._store)?void 0:o.currency)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}_handleRefreshCart(){if(this.refreshCart)return window.location.reload()}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(oe.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.calculateProtectionTotal(this._store,this._protectionProduct,t)}_findProtectionVariant(t){if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.findProtectionVariant(this._store,this._protectionProduct,t)}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i,o,r;const s=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost);if(!s)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetPollProtection\n widgetShowCart\n excludedProductSkus\n excludedCustomersIdsAutoOptIn\n protectionSettings\n }\n}",variables:{store:s}},i=await this._fetch.post(t.toString(),e);if(!i)throw new Error("Missing response for store query.");if(null==(o=i.errors)?void 0:o.length)throw new Error(i.errors[0].message);if(!(null==(r=i.data)?void 0:r.store))throw new Error("Missing store from store query response.");return i.data.store}catch(a){throw console.error(a),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw de(t.message),new Error("Could not fetch cart for current domain.")}}async _fetchProduct(){try{const{product:t}=await this._fetch.get("/products/shipaid-protection.json");return t}catch(t){throw de(t.message),new Error("Could not fetch protection product for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={quantity:1,id:this._protectionVariant.id},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._setState("success")}catch(i){de(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={quantity:0,id:this._protectionCartItem.key},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._cart=e,this._setState("success")}catch(t){de(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async attemptAddProtection(){var t,e,i,o,r,s;if(!(null==(t=this._store)?void 0:t.widgetAutoOptIn))return;if(!(null==(e=this._cart)?void 0:e.items)||!(null==(i=this._cart)?void 0:i.item_count))return;const a=null==(o=this._cart.items)?void 0:o.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),n=null==(r=this._cart)?void 0:r.items[a];if(this._hasProtectionInCart=!!n,1===this._cart.item_count&&n)return;!!sessionStorage.getItem(le)||(sessionStorage.setItem(le,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(s=this._cart)?void 0:s.item_count)&&this._store.widgetShowCart&&await this.addProtection())}learnMorePopupTemplate(){return this.persistPopup&&(this._popup=this.shouldPersistPopup()),B`
|
|
792
792
|
<shipaid-popup-learn-more
|
|
793
793
|
?active=${"learn-more"===this._popup}
|
|
794
|
-
@close=${()=>{this._popup=null}}
|
|
794
|
+
@close=${()=>{this.persistPopup&&localStorage.removeItem(`${ce}`),this._popup=null}}
|
|
795
795
|
></shipaid-popup-learn-more>
|
|
796
796
|
`}promptTemplate(){var t;return B`
|
|
797
797
|
<div class="shipaid-prompt">
|
|
798
798
|
<div class="prompt-product">
|
|
799
799
|
<div class="prompt-product-image">
|
|
800
|
-
${
|
|
800
|
+
${Ot(this._hasProtectionInCart,(()=>Ut),(()=>Nt))}
|
|
801
801
|
</div>
|
|
802
802
|
<div class="prompt-product-details">
|
|
803
803
|
<p class="prompt-product-details-title">
|
|
@@ -811,7 +811,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
811
811
|
<p class="prompt-product-actions-price">
|
|
812
812
|
${(null==(t=this._protectionVariant)?void 0:t.price)&&this._currencyFormat(this._protectionVariant.price)}
|
|
813
813
|
</p>
|
|
814
|
-
${
|
|
814
|
+
${Ot(!this.disableActions,(()=>B`
|
|
815
815
|
<button
|
|
816
816
|
class="prompt-product-actions-button"
|
|
817
817
|
@click=${this._updateProtection}
|
|
@@ -822,24 +822,24 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
822
822
|
`))}
|
|
823
823
|
</div>
|
|
824
824
|
</div>
|
|
825
|
-
${
|
|
825
|
+
${Ot(this._state.error,(()=>B`<p class="error">${this._state.error}</p>`))}
|
|
826
826
|
<div class="prompt-footer">
|
|
827
827
|
<a
|
|
828
828
|
class="prompt-footer-badge"
|
|
829
|
-
@click=${()=>{this._popup="learn-more"}}
|
|
829
|
+
@click=${()=>{this._popup="learn-more",this.persistPopup&&this.setPopupKey()}}
|
|
830
830
|
>
|
|
831
831
|
<span>${zt("footer.button")}</span>
|
|
832
832
|
${jt}
|
|
833
833
|
<button
|
|
834
834
|
class="prompt-footer-about"
|
|
835
|
-
@click=${()=>{this._popup="learn-more"}}
|
|
835
|
+
@click=${()=>{this._popup="learn-more",this.persistPopup&&this.setPopupKey()}}
|
|
836
836
|
>
|
|
837
837
|
i
|
|
838
838
|
</button>
|
|
839
839
|
</a>
|
|
840
840
|
</div>
|
|
841
841
|
</div>
|
|
842
|
-
`}async connectedCallback(){super.connectedCallback(),await async function(t,e=
|
|
842
|
+
`}async connectedCallback(){super.connectedCallback(),await async function(t,e=yt){const i=await e.loader(t,e);e.translationCache={},_t(t,i,e)}(this.lang),this.hasLoadedStrings=!0}render(){return It(this,(async()=>{var t,e,i;const o=document.createElement("link");o.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),o.setAttribute("rel","stylesheet"),document.head.appendChild(o);try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(r){return de(r.message),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(oe.LOADED,this._store),setTimeout((async()=>{var t,e,i,o;(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&(null==(e=this._cart)?void 0:e.item_count)&&(this.customerId&&this._store.excludedCustomersIdsAutoOptIn&&(null==(i=this._store.excludedCustomersIdsAutoOptIn)?void 0:i.length)&&this._store.excludedCustomersIdsAutoOptIn.includes(`gid://shopify/Customer/${this.customerId}`)||sessionStorage.getItem(le)||(sessionStorage.setItem(le,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(o=this._cart)?void 0:o.item_count)&&this._store.widgetShowCart&&await this.addProtection()))}),500),void(this.disablePolling||(setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval),(null==(i=this._store)?void 0:i.widgetPollProtection)&&!this.intervalId&&(this.intervalId=setInterval((async()=>{await this.attemptAddProtection()}),400),localStorage.setItem(`polling-shipaid-protection_${this.intervalId}`,`${this.intervalId}`))))):(pe("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(pe("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(pe("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),It(this,(async()=>{var t,e,i;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const o=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),r=null==(i=this._cart)?void 0:i.items[o];if(this._hasProtectionInCart=!!r,1===this._cart.item_count&&r){const t={id:r.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return sessionStorage.removeItem(le),await this._handleRefresh(e)}const s=await this.calculateProtectionTotal(this._cart),a=this._findProtectionVariant(s);if(this._protectionVariant=a,!(null==a?void 0:a.id))return this._shouldShowWidget=!1,void de("No matching protection variant found.");if(!r)return;if(a.id===r.variant_id){if(this._protectionCartItem={...r,index:o,position:o+1},1===r.quantity)return;const t={id:r.key,quantity:1},e=await this._fetch.post("/cart/change.js",t);return this._handleRefreshCart(),await this._handleRefresh(e)}const n={updates:{[r.variant_id]:0,[a.id]:1}},p=await this._fetch.post("/cart/update.js",n);await this._handleRefresh(p)}),[this._store,this._cart]),dt(this.learnMorePopupTemplate(),document.body),B`
|
|
843
843
|
<style>
|
|
844
844
|
:host {
|
|
845
845
|
--shipaid-primary: #002bd6;
|
|
@@ -962,7 +962,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
962
962
|
}
|
|
963
963
|
.shipaid-prompt .prompt-footer {
|
|
964
964
|
margin-top: var(--shipaid-prompt-footer-topMargin, 0px);
|
|
965
|
-
display: flex;
|
|
965
|
+
display: var(--shipaid-prompt-footer-display, flex);
|
|
966
966
|
flex-direction: row;
|
|
967
967
|
justify-content: var(--shipaid-prompt-footer-location, flex-start);
|
|
968
968
|
align-items: center;
|
|
@@ -998,8 +998,8 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
998
998
|
}
|
|
999
999
|
</style>
|
|
1000
1000
|
<div class="shipaid">
|
|
1001
|
-
${
|
|
1001
|
+
${Ot(this._hasFinishedSetup,(()=>{var t;return Ot(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>this.promptTemplate()),(()=>F))}),(()=>B`<p>
|
|
1002
1002
|
<slot name="loading" default>${zt("loading")}</slot>
|
|
1003
1003
|
</p>`))}
|
|
1004
1004
|
</div>
|
|
1005
|
-
`}},t.ShipAidWidget.styles=ie,ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),ae([s({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"customerId",2),ae([a()],t.ShipAidWidget.prototype,"_storeDomain",2),ae([a()],t.ShipAidWidget.prototype,"_store",2),ae([a()],t.ShipAidWidget.prototype,"_cart",2),ae([a()],t.ShipAidWidget.prototype,"_protectionProduct",2),ae([a()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),ae([a()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),ae([a()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),ae([a()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),ae([a()],t.ShipAidWidget.prototype,"_protectionCartItem",2),ae([a()],t.ShipAidWidget.prototype,"_protectionVariant",2),ae([a()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),ae([a()],t.ShipAidWidget.prototype,"intervalId",2),ae([a()],t.ShipAidWidget.prototype,"_state",2),ae([a()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=ae([i("shipaid-widget")],t.ShipAidWidget);const
|
|
1005
|
+
`}},t.ShipAidWidget.styles=ie,ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),ae([s({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"refreshCart",2),ae([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"persistPopup",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),ae([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"customerId",2),ae([a()],t.ShipAidWidget.prototype,"_storeDomain",2),ae([a()],t.ShipAidWidget.prototype,"_store",2),ae([a()],t.ShipAidWidget.prototype,"_cart",2),ae([a()],t.ShipAidWidget.prototype,"_protectionProduct",2),ae([a()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),ae([a()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),ae([a()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),ae([a()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),ae([a()],t.ShipAidWidget.prototype,"_protectionCartItem",2),ae([a()],t.ShipAidWidget.prototype,"_protectionVariant",2),ae([a()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),ae([a()],t.ShipAidWidget.prototype,"intervalId",2),ae([a()],t.ShipAidWidget.prototype,"_state",2),ae([a()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=ae([i("shipaid-widget")],t.ShipAidWidget);const me="Cargando el widget ShipAid...",fe="Garantía de entrega",ge="en caso de Pérdida, Daño o Robo",ve={button:"Energizado por"},ye={add:"Agregar",remove:"Eliminar",loading:"Cargando..."},_e={loading:me,title:fe,description:ge,footer:ve,actions:ye,"learn-more-popup":{close:"Cerca",title:"Garantía de entrega",disclaimer:{"subtitle-enable":"Permitimos que sus marcas favoritas brinden una garantía de entrega porque sabemos que cada pedido es valioso y las cosas suceden!","subtitle-monitor":"Supervisamos continuamente su paquete y le ofrecemos un portal conveniente para que pueda realizar un seguimiento del progreso de su pedido en cualquier momento.","subtitle-notify":"Se le notificará durante todo el proceso de envío, asegurándose de que esté actualizado en cada paso del camino.","subtitle-resolution":"En caso de cualquier problema durante el tránsito, ofrecemos un método rápido y fácil para informar el problema directamente a la marca, para una resolución rápida.",text:"Al comprar esta garantía de entrega, acepta nuestros Términos de servicio y Política de privacidad. Usted no está obligado a comprar esta garantía. Esta garantía NO es un seguro y no brinda indemnización por pérdida, daño o responsabilidad que surja de un evento contingente o desconocido, sino que, a través de las marcas de ShipAid, brinda una garantía de entrega mediante la cual, si el producto que ordenó no se entrega en condiciones satisfactorias, la marca desde el que ordenó el producto puede reemplazar el producto sin cargo. ShipAid no proporciona ningún producto o servicio directamente a los consumidores, sino que proporciona un servicio que permite a las marcas facilitar el reemplazo de productos a sus clientes. La compra de esta garantía no significa que se le reembolsará automáticamente cualquier producto o costo de envío porque el proceso de resolución y la decisión de compensación lo decide estrictamente la marca a la que le compra. La marca requerirá prueba de daño o producto no entregado."},links:{terms:"Términos de servicio",privacy:"Política de Privacidad"}}},Ce=Object.freeze(Object.defineProperty({__proto__:null,actions:ye,default:_e,description:ge,footer:ve,loading:me,title:fe},Symbol.toStringTag,{value:"Module"})),be="Caricamento del widget ShipAid...",we="Garanzia di consegna",$e="in caso di Perdita, Danno o Furto",xe={button:"Offerto da"},Ae={add:"Aggiungere",remove:"Rimuovere",loading:"Caricamento ..."},Se={loading:be,title:we,description:$e,footer:xe,actions:Ae,"learn-more-popup":{close:"Vicina",title:"Garanzia di consegna",subtitle:"Consentiamo ai tuoi marchi preferiti di offrire una garanzia di consegna perché ogni ordine è prezioso!",disclaimer:{"subtitle-enable":"Consentiamo ai tuoi marchi preferiti di fornire una garanzia di consegna perché sappiamo che ogni ordine è prezioso e le cose accadono!","subtitle-monitor":"Monitoriamo continuamente il tuo pacco e ti offriamo un comodo portale per monitorare lo stato di avanzamento del tuo ordine in qualsiasi momento!","subtitle-notify":"Riceverai una notifica durante l'intero processo di spedizione, assicurandoti di rimanere aggiornato in ogni fase del processo.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Acquistando questa garanzia di consegna, accetti i nostri Termini di servizio e l'Informativa sulla privacy. Non sei obbligato ad acquistare questa garanzia. Questa garanzia NON è un'assicurazione e non fornisce un indennizzo contro perdite, danni o responsabilità derivanti da un evento contingente o sconosciuto, ma piuttosto, attraverso ShipAid i marchi forniscono una garanzia di consegna in base alla quale se il prodotto ordinato non viene consegnato in condizioni soddisfacenti, il marchio da cui hai ordinato il prodotto può sostituire il prodotto gratuitamente. ShipAid non fornisce alcun prodotto o servizio direttamente ai consumatori, ma fornisce invece un servizio che consente ai marchi di facilitare la sostituzione del prodotto ai propri clienti. L'acquisto di questa garanzia non significa che verrai automaticamente rimborsato per qualsiasi prodotto o costo di spedizione perché il processo di risoluzione e la decisione per il risarcimento sono rigorosamente decisi dal marchio da cui stai acquistando. Il marchio richiederà la prova del danno o del prodotto non consegnato."},links:{terms:"Termini di servizio",privacy:"Politica sulla riservatezza"}}},Le=Object.freeze(Object.defineProperty({__proto__:null,actions:Ae,default:Se,description:$e,footer:xe,loading:be,title:we},Symbol.toStringTag,{value:"Module"})),Pe="Carregando o widget ShipAid...",Ee="Garantia de entrega",ze="em caso de Perda, Danos ou Roubo",Me={button:"Distribuído por"},ke={add:"Adicionar",remove:"Remover",loading:"Carregando..."},Te={loading:Pe,title:Ee,description:ze,footer:Me,actions:ke,"learn-more-popup":{close:"Fechar",title:"Garantia de entrega",subtitle:"Capacitamos suas marcas favoritas para oferecer uma garantia de entrega porque cada pedido é precioso!",disclaimer:{"subtitle-enable":"Permitimos que suas marcas favoritas forneçam uma garantia de entrega porque sabemos que cada pedido é precioso e as coisas acontecem!","subtitle-monitor":"Monitoramos continuamente o seu pacote e oferecemos um portal conveniente para você acompanhar o andamento do seu pedido a qualquer momento!","subtitle-notify":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Ao adquirir esta garantia de entrega, você concorda com nossos Termos de Serviço e Política de Privacidade. Esta garantia não é obrigatória, NÃO é um seguro e não fornece indenização contra perdas, danos ou responsabilidade decorrentes de um contingente ou desconhecido. Caso o produto não seja entregue em condições satisfatórias, a marca da qual você comprou pode substituí-lo gratuitamente. A ShipAid não fornece nenhum produto ou serviço diretamente aos consumidores, mas sim presta um serviço que permite às marcas facilitar a substituição do produto aos seus clientes. Adquirir esta garantia não significa que você será automaticamente reembolsado por qualquer produto ou custos de envio porque o processo de resolução e decisão de compensação é estritamente decidido pela marca que você está comprando. A marca exigirá prova de danos ou produto não entregue."},links:{terms:"Termos de serviço",privacy:"Política de Privacidade"}}},Ie=Object.freeze(Object.defineProperty({__proto__:null,actions:ke,default:Te,description:ze,footer:Me,loading:Pe,title:Ee},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -14,6 +14,8 @@ export declare class ShipAidWidget extends LitElement {
|
|
|
14
14
|
disableActions: boolean;
|
|
15
15
|
pollingInterval: number;
|
|
16
16
|
disableRefresh: boolean;
|
|
17
|
+
refreshCart: boolean;
|
|
18
|
+
persistPopup: boolean;
|
|
17
19
|
lang: string;
|
|
18
20
|
currency: undefined;
|
|
19
21
|
customerId: undefined;
|
|
@@ -42,6 +44,8 @@ export declare class ShipAidWidget extends LitElement {
|
|
|
42
44
|
hasLoadedStrings: boolean;
|
|
43
45
|
intervalId: number;
|
|
44
46
|
protected shouldUpdate(props: PropertyValues): boolean;
|
|
47
|
+
protected shouldPersistPopup(): "learn-more" | null;
|
|
48
|
+
protected setPopupKey(): void;
|
|
45
49
|
/**
|
|
46
50
|
* Internal state
|
|
47
51
|
*/
|
|
@@ -57,6 +61,7 @@ export declare class ShipAidWidget extends LitElement {
|
|
|
57
61
|
private _currencyFormat;
|
|
58
62
|
/** Emit events */
|
|
59
63
|
private _dispatchEvent;
|
|
64
|
+
private _handleRefreshCart;
|
|
60
65
|
/** Handle cart or page refreshes */
|
|
61
66
|
private _handleRefresh;
|
|
62
67
|
/** Given the current order, it calculates the protection total according to the store protection settings. */
|