ui.shipaid.com 0.3.6 → 0.3.7
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 +4 -0
- package/dist/widget.es.js +164 -162
- package/dist/widget.iife.js +54 -52
- package/dist/widget.umd.js +54 -52
- package/dist-types/widget/src/components/learn-more-popup.d.ts +1 -1
- package/package.json +1 -1
- package/dist-types/src/assets/icons.d.ts +0 -3
- package/dist-types/src/assets/learn-more-styles.d.ts +0 -2
- package/dist-types/src/assets/styles.d.ts +0 -2
- package/dist-types/src/components/learn-more-popup.d.ts +0 -8
- package/dist-types/src/shipaid-widget.d.ts +0 -97
- package/dist-types/types/shipaid.d.ts +0 -57
- package/dist-types/types/shopify.d.ts +0 -151
- package/dist-types/types/widget.d.ts +0 -13
package/dist/widget.iife.js
CHANGED
|
@@ -3,71 +3,71 @@ var ShipAidWidget=function(t){"use strict";const e={calculateProtectionTotal:fun
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/var i,o},o=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
|
|
6
|
+
*/var i,o},o=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},r=(t,e,i)=>{e.constructor.createProperty(i,t)};
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/function
|
|
11
|
+
*/function s(t){return(e,i)=>void 0!==i?r(t,e,i):o(t,e)}
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/function
|
|
16
|
+
*/function n(t){return s({...t,state:!0})}
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
|
19
19
|
* Copyright 2021 Google LLC
|
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
-
*/var
|
|
21
|
+
*/var a;null===(a=window.HTMLSlotElement)||void 0===a||a.prototype.assignedElements;
|
|
22
22
|
/**
|
|
23
23
|
* @license
|
|
24
24
|
* Copyright 2019 Google LLC
|
|
25
25
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
26
26
|
*/
|
|
27
|
-
const
|
|
27
|
+
const d=window,l=d.ShadowRoot&&(void 0===d.ShadyCSS||d.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,p=Symbol(),c=new WeakMap;let h=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==p)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(l&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=c.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&c.set(e,t))}return t}toString(){return this.cssText}};const u=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new h(i,t,p)},f=l?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new h("string"==typeof t?t:t+"",void 0,p))(e)})(t):t
|
|
28
28
|
/**
|
|
29
29
|
* @license
|
|
30
30
|
* Copyright 2017 Google LLC
|
|
31
31
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
-
*/;var
|
|
32
|
+
*/;var v;const g=window,m=g.trustedTypes,_=m?m.emptyScript:"",y=g.reactiveElementPolyfillSupport,b={toAttribute(t,e){switch(e){case Boolean:t=t?_: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}},w=(t,e)=>e!==t&&(e==e||t==t),$={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:w},C="finalized";let A=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=$){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)||$}static finalize(){if(this.hasOwnProperty(C))return!1;this[C]=!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(f(t))}else void 0!==t&&e.push(f(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)=>{l?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=d.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=$){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:b).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:b;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||w)(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 C
|
|
38
|
+
var S;A[C]=!0,A.elementProperties=new Map,A.elementStyles=[],A.shadowRootOptions={mode:"open"},null==y||y({ReactiveElement:A}),(null!==(v=g.reactiveElementVersions)&&void 0!==v?v:g.reactiveElementVersions=[]).push("1.6.3");const x=window,E=x.trustedTypes,P=E?E.createPolicy("lit-html",{createHTML:t=>t}):void 0,L="$lit$",z=`lit$${(Math.random()+"").slice(9)}$`,M="?"+z,k=`<${M}>`,T=document,O=()=>T.createComment(""),N=t=>null===t||"object"!=typeof t&&"function"!=typeof t,U=Array.isArray,I="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,q=/>/g,W=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,D=/"/g,V=/^(?:script|style|textarea|title)$/i,B=(J=1,(t,...e)=>({_$litType$:J,strings:t,values:e})),F=Symbol.for("lit-noChange"),Z=Symbol.for("lit-nothing"),Y=new WeakMap,G=T.createTreeWalker(T,129,null,!1);var J;function K(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 n=t.length-1,a=this.parts,[d,l]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=R;for(let a=0;a<i;a++){const e=t[a];let i,d,l=-1,p=0;for(;p<e.length&&(n.lastIndex=p,d=n.exec(e),null!==d);)p=n.lastIndex,n===R?"!--"===d[1]?n=j:void 0!==d[1]?n=q:void 0!==d[2]?(V.test(d[2])&&(r=RegExp("</"+d[2],"g")),n=W):void 0!==d[3]&&(n=W):n===W?">"===d[0]?(n=null!=r?r:R,l=-1):void 0===d[1]?l=-2:(l=n.lastIndex-d[2].length,i=d[1],n=void 0===d[3]?W:'"'===d[3]?D:H):n===D||n===H?n=W:n===j||n===q?n=R:(n=W,r=void 0);const c=n===W&&t[a+1].startsWith("/>")?" ":"";s+=n===R?e+k:l>=0?(o.push(i),e.slice(0,l)+L+e.slice(l)+z+c):e+z+(-2===l?(o.push(void 0),a):c)}return[K(t,s+(t[i]||"<?>")+(2===e?"</svg>":"")),o]})(t,e);if(this.el=Q.createElement(d,i),G.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=G.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith(L)||e.startsWith(z)){const i=l[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+L).split(z),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?ot:"?"===e[1]?st:"@"===e[1]?nt:it})}else a.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=E?E.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],O()),G.nextNode(),a.push({type:2,index:++r});o.append(t[e],O())}}}else if(8===o.nodeType)if(o.data===M)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(z,t+1));)a.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,n,a;if(e===F)return e;let d=void 0!==o?null===(r=i._$Co)||void 0===r?void 0:r[o]:i._$Cl;const l=N(e)?void 0:e._$litDirective$;return(null==d?void 0:d.constructor)!==l&&(null===(s=null==d?void 0:d._$AO)||void 0===s||s.call(d,!1),void 0===l?d=void 0:(d=new l(t),d._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Co)&&void 0!==n?n:a._$Co=[])[o]=d:i._$Cl=d),void 0!==d&&(e=X(t,d._$AS(t,e.values),d,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);G.currentNode=r;let s=G.nextNode(),n=0,a=0,d=o[0];for(;void 0!==d;){if(n===d.index){let e;2===d.type?e=new et(s,s.nextSibling,this,t):1===d.type?e=new d.ctor(s,d.name,d.strings,this,t):6===d.type&&(e=new at(s,this,t)),this._$AV.push(e),d=o[++a]}n!==(null==d?void 0:d.index)&&(s=G.nextNode(),n++)}return G.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=Z,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),N(t)?t===Z||null==t||""===t?(this._$AH!==Z&&this._$AR(),this._$AH=Z):t!==this._$AH&&t!==F&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>U(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!==Z&&N(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(K(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=Y.get(t.strings);return void 0===e&&Y.set(t.strings,e=new Q(t)),e}T(t){U(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(O()),this.k(O()),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=Z,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=Z}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=!N(t)||t!==this._$AH&&t!==F,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=X(this,o[i+n],e,n),a===F&&(a=this._$AH[n]),s||(s=!N(a)||a!==this._$AH[n]),a===Z?t=Z:t!==Z&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.j(t)}j(t){t===Z?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===Z?void 0:t}}const rt=E?E.emptyScript:"";class st extends it{constructor(){super(...arguments),this.type=4}j(t){t&&t!==Z?this.element.setAttribute(this.name,rt):this.element.removeAttribute(this.name)}}class nt 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:Z)===F)return;const o=this._$AH,r=t===Z&&o!==Z||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==Z&&(o===Z||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 at{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 dt=x.litHtmlPolyfillSupport;null==dt||dt(Q,et),(null!==(S=x.litHtmlVersions)&&void 0!==S?S:x.litHtmlVersions=[]).push("2.8.0");const lt=(t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new et(e.insertBefore(O(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n};
|
|
39
39
|
/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
-
*/var
|
|
43
|
+
*/var pt,ct;let ht=class extends A{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=lt(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 F}};ht.finalized=!0,ht._$litElement$=!0,null===(pt=globalThis.litElementHydrateSupport)||void 0===pt||pt.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 ft="langChanged";function vt(t,e,i){return Object.entries(mt(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[ ]*${e}[ ]*}}`,"gm"),String(mt(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 mt(t){return"function"==typeof t?t():t}let _t={loader:()=>Promise.resolve({}),empty:t=>`[${t}]`,lookup:gt,interpolate:vt,translationCache:{}};function yt(t,e,i=_t){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=t,strings:i.strings=e},window.dispatchEvent(new CustomEvent(ft,{detail:o}))}
|
|
44
44
|
/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2017 Google LLC
|
|
47
47
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
48
|
*/
|
|
49
|
-
const
|
|
49
|
+
const bt=2;class wt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
50
50
|
/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2020 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const
|
|
54
|
+
*/const $t=(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),$t(s,e);return!0},Ct=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))},At=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),Et(e)}};
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2017 Google LLC
|
|
58
58
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
-
*/function
|
|
59
|
+
*/function St(t){void 0!==this._$AN?(Ct(this),this._$AM=t,At(this)):this._$AM=t}function xt(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++)$t(o[s],!1),Ct(o[s]);else null!=o&&($t(o,!1),Ct(o));else $t(this,t)}const Et=t=>{var e,i,o,r;t.type==bt&&(null!==(e=(o=t)._$AP)&&void 0!==e||(o._$AP=xt),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=St))};class Pt extends wt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),At(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&&($t(this,t),Ct(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 Lt 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(ft,i,e),()=>window.removeEventListener(ft,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 Lt{render(t,e,i){return this.renderValue((()=>function(t,e,i=_t){let o=i.translationCache[t]||(i.translationCache[t]=i.lookup(t,i)||i.empty(t,i));return null!=(e=null!=e?mt(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
|
|
64
|
+
*/class Mt extends wt{constructor(t){if(super(t),this.et=Z,t.type!==bt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===Z||null==t)return this.ft=void 0,this.et=t;if(t===F)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 Ot(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 Nt(t,e,i){return t?e():null==i?void 0:i()}const Ut=u`
|
|
71
71
|
:host {
|
|
72
72
|
--shipaid-primary: #0056d6;
|
|
73
73
|
--shipaid-secondary: #0076ff;
|
|
@@ -267,7 +267,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
267
267
|
background: transparent;
|
|
268
268
|
z-index: -1;
|
|
269
269
|
}
|
|
270
|
-
`,
|
|
270
|
+
`,It=B`
|
|
271
271
|
<svg
|
|
272
272
|
version="1.0"
|
|
273
273
|
viewBox="0 0 500.000000 500.000000"
|
|
@@ -286,7 +286,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
286
286
|
/>
|
|
287
287
|
</g>
|
|
288
288
|
</svg>
|
|
289
|
-
`,
|
|
289
|
+
`,Rt=B`
|
|
290
290
|
<svg
|
|
291
291
|
version="1.0"
|
|
292
292
|
width="500.000000pt"
|
|
@@ -307,7 +307,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
307
307
|
/>
|
|
308
308
|
</g>
|
|
309
309
|
</svg>
|
|
310
|
-
`,
|
|
310
|
+
`,jt=B`
|
|
311
311
|
<svg
|
|
312
312
|
viewBox="0 0 423 62"
|
|
313
313
|
version="1.1"
|
|
@@ -389,7 +389,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
389
389
|
/>
|
|
390
390
|
</g>
|
|
391
391
|
</svg>
|
|
392
|
-
`,
|
|
392
|
+
`,qt=B`
|
|
393
393
|
<svg
|
|
394
394
|
version="1.0"
|
|
395
395
|
viewBox="0 0 500.000000 500.000000"
|
|
@@ -414,7 +414,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
414
414
|
/>
|
|
415
415
|
</g>
|
|
416
416
|
</svg>
|
|
417
|
-
`,
|
|
417
|
+
`,Wt=B`
|
|
418
418
|
<svg
|
|
419
419
|
version="1.0"
|
|
420
420
|
viewBox="0 0 500.000000 500.000000"
|
|
@@ -433,7 +433,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
433
433
|
/>
|
|
434
434
|
</g>
|
|
435
435
|
</svg>
|
|
436
|
-
`,
|
|
436
|
+
`,Ht=B`
|
|
437
437
|
<svg
|
|
438
438
|
version="1.0"
|
|
439
439
|
viewBox="0 0 500.000000 500.000000"
|
|
@@ -458,7 +458,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
458
458
|
/>
|
|
459
459
|
</g>
|
|
460
460
|
</svg>
|
|
461
|
-
`,
|
|
461
|
+
`,Dt=B`
|
|
462
462
|
<svg
|
|
463
463
|
xmlns="http://www.w3.org/2000/svg"
|
|
464
464
|
version="1.0"
|
|
@@ -484,7 +484,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
484
484
|
/>
|
|
485
485
|
</g>
|
|
486
486
|
</svg>
|
|
487
|
-
`;var
|
|
487
|
+
`;var Vt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,Ft=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?Bt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&Vt(e,i,s),s};let Zt=class extends ht{constructor(){super(...arguments),this.active=!1}handleClosePopup(){const t=new Event("close");this.dispatchEvent(t)}render(){return B`
|
|
488
488
|
<div class=${`shipaid-popup ${this.active&&"active"}`}>
|
|
489
489
|
<div class="blocker" @click=${this.handleClosePopup}></div>
|
|
490
490
|
<button
|
|
@@ -492,30 +492,30 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
492
492
|
class="popup-close"
|
|
493
493
|
@click=${this.handleClosePopup}
|
|
494
494
|
>
|
|
495
|
-
${
|
|
495
|
+
${zt("learn-more-popup.close")}
|
|
496
496
|
</button>
|
|
497
|
-
<div class="popup-logo">${
|
|
498
|
-
<p class="popup-title">${
|
|
497
|
+
<div class="popup-logo">${jt}</div>
|
|
498
|
+
<p class="popup-title">${zt("learn-more-popup.title")}</p>
|
|
499
499
|
<div class="popup-disclaimer-subtitle">
|
|
500
|
-
<div class="popup-icon">${
|
|
501
|
-
<p>${
|
|
500
|
+
<div class="popup-icon">${qt}</div>
|
|
501
|
+
<p>${zt("learn-more-popup.disclaimer.subtitle-enable")}</p>
|
|
502
502
|
</div>
|
|
503
503
|
<div class="popup-disclaimer-subtitle">
|
|
504
|
-
<div class="popup-icon">${
|
|
505
|
-
<p>${
|
|
504
|
+
<div class="popup-icon">${Wt}</div>
|
|
505
|
+
<p>${zt("learn-more-popup.disclaimer.subtitle-monitor")}</p>
|
|
506
506
|
</div>
|
|
507
507
|
<div class="popup-disclaimer-subtitle">
|
|
508
|
-
<div class="popup-icon-b">${
|
|
509
|
-
<p>${
|
|
508
|
+
<div class="popup-icon-b">${Dt}</div>
|
|
509
|
+
<p>${zt("learn-more-popup.disclaimer.subtitle-notify")}</p>
|
|
510
510
|
</div>
|
|
511
511
|
<div class="popup-disclaimer-subtitle">
|
|
512
|
-
<div class="popup-icon-bell">${
|
|
512
|
+
<div class="popup-icon-bell">${Ht}</div>
|
|
513
513
|
<p>
|
|
514
|
-
${
|
|
514
|
+
${zt("learn-more-popup.disclaimer.subtitle-resolution")}
|
|
515
515
|
</p>
|
|
516
516
|
</div>
|
|
517
517
|
<p class="popup-disclaimer">
|
|
518
|
-
${
|
|
518
|
+
${zt("learn-more-popup.disclaimer.text")}
|
|
519
519
|
</p>
|
|
520
520
|
<hr class="popup-divider" />
|
|
521
521
|
<div class="popup-footer">
|
|
@@ -525,14 +525,14 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
525
525
|
target="_blank"
|
|
526
526
|
rel="noreferrer"
|
|
527
527
|
>
|
|
528
|
-
${
|
|
528
|
+
${zt("learn-more-popup.links.terms")}
|
|
529
529
|
</a>
|
|
530
530
|
<a
|
|
531
531
|
href="https://www.shipaid.com/privacy-policy"
|
|
532
532
|
target="_blank"
|
|
533
533
|
rel="noreferrer"
|
|
534
534
|
>
|
|
535
|
-
${
|
|
535
|
+
${zt("learn-more-popup.links.privacy")}
|
|
536
536
|
</a>
|
|
537
537
|
</div>
|
|
538
538
|
<div class="footer-date">
|
|
@@ -544,7 +544,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
544
544
|
</div>
|
|
545
545
|
</div>
|
|
546
546
|
</div>
|
|
547
|
-
`}};
|
|
547
|
+
`}};Zt.styles=Ut,Ft([s({type:Boolean,attribute:!0})],Zt.prototype,"active",2),Zt=Ft([i("shipaid-popup-learn-more")],Zt);const Yt="Loading ShipAid Widget...",Gt="Delivery Guarantee",Jt="in case of Loss, Damage or Theft",Kt={button:"Powered by"},Qt={add:"Add",remove:"Remove",loading:"Loading..."},Xt={loading:Yt,title:Gt,description:Jt,footer:Kt,actions:Qt,"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"}}},te=Object.freeze(Object.defineProperty({__proto__:null,actions:Qt,default:Xt,description:Jt,footer:Kt,loading:Yt,title:Gt},Symbol.toStringTag,{value:"Module"})),ee=u`
|
|
548
548
|
:host {
|
|
549
549
|
--shipaid-primary: #002bd6;
|
|
550
550
|
--shipaid-secondary: #0076ff;
|
|
@@ -616,8 +616,10 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
616
616
|
position: relative;
|
|
617
617
|
}
|
|
618
618
|
.shipaid-prompt .prompt-product .prompt-product-image svg {
|
|
619
|
-
height: 35px;
|
|
620
|
-
|
|
619
|
+
height: var(--shipaid-logo-height, 35px);
|
|
620
|
+
max-height: var(--shipaid-logo-max-height, 35px);
|
|
621
|
+
width: var(--shipaid-logo-width, auto);
|
|
622
|
+
max-width: var(--shipaid-logo-max-width, 50px);
|
|
621
623
|
}
|
|
622
624
|
.shipaid-prompt
|
|
623
625
|
.prompt-product
|
|
@@ -697,48 +699,48 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
697
699
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
698
700
|
height: 9px;
|
|
699
701
|
}
|
|
700
|
-
`;var
|
|
702
|
+
`;var ie=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(ie||{}),oe=Object.defineProperty,re=Object.getOwnPropertyDescriptor,se=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?re(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&oe(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.")}},ae=t=>console.warn(`[ShipAid] ${t}`),de=t=>console.error(`[ShipAid] ${t}`),le="shipaid-protection",pe=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>te)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>_e)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>Se)).then((t=>t.default))});var ce;ce={loader:async t=>{if("en"===t)return Xt;const e=Reflect.get(pe,`./lang/${t}.json`);return e?await e():Xt}},_t=Object.assign(Object.assign({},_t),ce),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.lang="en",this.currency=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)}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")?(ae("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==(e=this._store)?void 0:e.currency)||(null==(o=null==(i=window.Shopify)?void 0:i.currency)?void 0:o.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(ie.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 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(n){throw console.error(n),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 n=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))})),a=null==(r=this._cart)?void 0:r.items[n];if(this._hasProtectionInCart=!!a,1===this._cart.item_count&&a)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 B`
|
|
701
703
|
<shipaid-popup-learn-more
|
|
702
704
|
?active=${"learn-more"===this._popup}
|
|
703
705
|
@close=${()=>{this._popup=null}}
|
|
704
706
|
></shipaid-popup-learn-more>
|
|
705
|
-
`}promptTemplate(){var t;return
|
|
707
|
+
`}promptTemplate(){var t;return B`
|
|
706
708
|
<div class="shipaid-prompt">
|
|
707
709
|
<div class="prompt-product">
|
|
708
710
|
<div class="prompt-product-image">
|
|
709
|
-
${
|
|
711
|
+
${Nt(this._hasProtectionInCart,(()=>Rt),(()=>It))}
|
|
710
712
|
</div>
|
|
711
713
|
<div class="prompt-product-details">
|
|
712
714
|
<p class="prompt-product-details-title">
|
|
713
|
-
<slot name="title">${
|
|
715
|
+
<slot name="title">${zt("title")}</slot>
|
|
714
716
|
</p>
|
|
715
717
|
<p class="prompt-product-details-description">
|
|
716
|
-
<slot name="subtitle">${
|
|
718
|
+
<slot name="subtitle">${zt("description")}</slot>
|
|
717
719
|
</p>
|
|
718
720
|
</div>
|
|
719
721
|
<div class="prompt-product-actions">
|
|
720
722
|
<p class="prompt-product-actions-price">
|
|
721
723
|
${(null==(t=this._protectionVariant)?void 0:t.price)&&this._currencyFormat(this._protectionVariant.price)}
|
|
722
724
|
</p>
|
|
723
|
-
${
|
|
725
|
+
${Nt(!this.disableActions,(()=>B`
|
|
724
726
|
<button
|
|
725
727
|
class="prompt-product-actions-button"
|
|
726
728
|
@click=${this._updateProtection}
|
|
727
729
|
?disabled=${this._state.loading}
|
|
728
730
|
>
|
|
729
|
-
${this._state.loading?
|
|
731
|
+
${this._state.loading?zt("actions.loading"):this._hasProtectionInCart?zt("actions.remove"):B`+ ${zt("actions.add")}`}
|
|
730
732
|
</button>
|
|
731
733
|
`))}
|
|
732
734
|
</div>
|
|
733
735
|
</div>
|
|
734
|
-
${
|
|
736
|
+
${Nt(this._state.error,(()=>B`<p class="error">${this._state.error}</p>`))}
|
|
735
737
|
<div class="prompt-footer">
|
|
736
738
|
<a
|
|
737
739
|
class="prompt-footer-badge"
|
|
738
740
|
@click=${()=>{this._popup="learn-more"}}
|
|
739
741
|
>
|
|
740
|
-
<span>${
|
|
741
|
-
${
|
|
742
|
+
<span>${zt("footer.button")}</span>
|
|
743
|
+
${jt}
|
|
742
744
|
<button
|
|
743
745
|
class="prompt-footer-about"
|
|
744
746
|
@click=${()=>{this._popup="learn-more"}}
|
|
@@ -748,10 +750,10 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
|
|
|
748
750
|
</a>
|
|
749
751
|
</div>
|
|
750
752
|
</div>
|
|
751
|
-
`}async connectedCallback(){super.connectedCallback(),await async function(t,e=
|
|
753
|
+
`}async connectedCallback(){super.connectedCallback(),await async function(t,e=_t){const i=await e.loader(t,e);e.translationCache={},yt(t,i,e)}(this.lang),this.hasLoadedStrings=!0}render(){return Ot(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(ie.LOADED,this._store),setTimeout((async()=>{var t,e,i;(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&(null==(e=this._cart)?void 0:e.item_count)&&(sessionStorage.getItem(le)||(sessionStorage.setItem(le,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(i=this._cart)?void 0:i.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()}),500),localStorage.setItem(`polling-shipaid-protection_${this.intervalId}`,`${this.intervalId}`))))):(ae("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ae("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ae("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),Ot(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),n=this._findProtectionVariant(s);if(this._protectionVariant=n,!(null==n?void 0:n.id))return this._shouldShowWidget=!1,void de("No matching protection variant found.");if(!r)return;if(n.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 await this._handleRefresh(e)}const a={updates:{[r.variant_id]:0,[n.id]:1}},d=await this._fetch.post("/cart/update.js",a);await this._handleRefresh(d)}),[this._store,this._cart]),lt(this.learnMorePopupTemplate(),document.body),B`
|
|
752
754
|
<div class="shipaid">
|
|
753
|
-
${
|
|
754
|
-
<slot name="loading" default>${
|
|
755
|
+
${Nt(this._hasFinishedSetup,(()=>{var t;return Nt(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>this.promptTemplate()),(()=>Z))}),(()=>B`<p>
|
|
756
|
+
<slot name="loading" default>${zt("loading")}</slot>
|
|
755
757
|
</p>`))}
|
|
756
758
|
</div>
|
|
757
|
-
`}},t.ShipAidWidget.styles=
|
|
759
|
+
`}},t.ShipAidWidget.styles=ee,se([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),se([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),se([s({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),se([s({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),se([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),se([s({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),se([n()],t.ShipAidWidget.prototype,"_storeDomain",2),se([n()],t.ShipAidWidget.prototype,"_store",2),se([n()],t.ShipAidWidget.prototype,"_cart",2),se([n()],t.ShipAidWidget.prototype,"_protectionProduct",2),se([n()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),se([n()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),se([n()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),se([n()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),se([n()],t.ShipAidWidget.prototype,"_protectionCartItem",2),se([n()],t.ShipAidWidget.prototype,"_protectionVariant",2),se([n()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),se([n()],t.ShipAidWidget.prototype,"intervalId",2),se([n()],t.ShipAidWidget.prototype,"_state",2),se([n()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=se([i("shipaid-widget")],t.ShipAidWidget);const he="Caricamento del widget ShipAid...",ue="Garanzia di consegna",fe="in caso di Perdita, Danno o Furto",ve={button:"Offerto da"},ge={add:"Aggiungere",remove:"Rimuovere",loading:"Caricamento ..."},me={loading:he,title:ue,description:fe,footer:ve,actions:ge,"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"}}},_e=Object.freeze(Object.defineProperty({__proto__:null,actions:ge,default:me,description:fe,footer:ve,loading:he,title:ue},Symbol.toStringTag,{value:"Module"})),ye="Carregando o widget ShipAid...",be="Garantia de entrega",we="em caso de Perda, Danos ou Roubo",$e={button:"Distribuído por"},Ce={add:"Adicionar",remove:"Remover",loading:"Carregando..."},Ae={loading:ye,title:be,description:we,footer:$e,actions:Ce,"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"}}},Se=Object.freeze(Object.defineProperty({__proto__:null,actions:Ce,default:Ae,description:we,footer:$e,loading:ye,title:be},Symbol.toStringTag,{value:"Module"}));return Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
|