ui.shipaid.com 0.2.23 → 0.3.0-beta.2
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/dist/it-0759ce74.js +40 -0
- package/dist/widget.es.js +562 -245
- package/dist/widget.iife.js +52 -48
- package/dist/widget.umd.js +52 -48
- package/dist-types/src/shipaid-widget.d.ts +7 -2
- package/package.json +15 -14
package/dist/widget.iife.js
CHANGED
|
@@ -24,29 +24,50 @@ var ShipAidWidget=function(t){"use strict";
|
|
|
24
24
|
* Copyright 2019 Google LLC
|
|
25
25
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
26
26
|
*/
|
|
27
|
-
const n=window,a=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,
|
|
27
|
+
const n=window,a=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),d=new WeakMap;let p=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==l)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(a&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=d.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&d.set(e,t))}return t}toString(){return this.cssText}};const h=(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 p(i,t,l)},c=a?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new p("string"==typeof t?t:t+"",void 0,l))(e)})(t):t
|
|
28
28
|
/**
|
|
29
29
|
* @license
|
|
30
30
|
* Copyright 2017 Google LLC
|
|
31
31
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
-
*/;var u;const f=window,
|
|
32
|
+
*/;var u;const f=window,g=f.trustedTypes,v=g?g.emptyScript:"",m=f.reactiveElementPolyfillSupport,_={toAttribute(t,e){switch(e){case Boolean:t=t?v: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}},y=(t,e)=>e!==t&&(e==e||t==t),C={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:y};let $=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}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=C){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)||C}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!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(c(t))}else void 0!==t&&e.push(c(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}u(){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)=>{a?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=n.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=C){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:_).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:_;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||y)(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
|
|
38
|
+
var b;$.finalized=!0,$.elementProperties=new Map,$.elementStyles=[],$.shadowRootOptions={mode:"open"},null==m||m({ReactiveElement:$}),(null!==(u=f.reactiveElementVersions)&&void 0!==u?u:f.reactiveElementVersions=[]).push("1.6.1");const w=window,A=w.trustedTypes,L=A?A.createPolicy("lit-html",{createHTML:t=>t}):void 0,S=`lit$${(Math.random()+"").slice(9)}$`,x="?"+S,E=`<${x}>`,P=document,z=(t="")=>P.createComment(t),k=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,U=/>/g,N=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),j=/'/g,R=/"/g,I=/^(?:script|style|textarea|title)$/i,W=(V=1,(t,...e)=>({_$litType$:V,strings:t,values:e})),H=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),q=new WeakMap,B=P.createTreeWalker(P,129,null,!1);var V;class F{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[l,d]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=M;for(let l=0;l<i;l++){const e=t[l];let i,a,d=-1,p=0;for(;p<e.length&&(n.lastIndex=p,a=n.exec(e),null!==a);)p=n.lastIndex,n===M?"!--"===a[1]?n=O:void 0!==a[1]?n=U:void 0!==a[2]?(I.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=N):void 0!==a[3]&&(n=N):n===N?">"===a[0]?(n=null!=r?r:M,d=-1):void 0===a[1]?d=-2:(d=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?N:'"'===a[3]?R:j):n===R||n===j?n=N:n===O||n===U?n=M:(n=N,r=void 0);const h=n===N&&t[l+1].startsWith("/>")?" ":"";s+=n===M?e+E:d>=0?(o.push(i),e.slice(0,d)+"$lit$"+e.slice(d)+S+h):e+S+(-2===d?(o.push(void 0),l):h)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==L?L.createHTML(a):a,o]})(t,e);if(this.el=F.createElement(l,i),B.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=B.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(S)){const i=d[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(S),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?Q:"?"===e[1]?X:"@"===e[1]?tt:K})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(I.test(o.tagName)){const t=o.textContent.split(S),e=t.length-1;if(e>0){o.textContent=A?A.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],z()),B.nextNode(),a.push({type:2,index:++r});o.append(t[e],z())}}}else if(8===o.nodeType)if(o.data===x)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(S,t+1));)a.push({type:7,index:r}),t+=S.length-1}r++}}static createElement(t,e){const i=P.createElement("template");return i.innerHTML=t,i}}function Z(t,e,i=t,o){var r,s,n,a;if(e===H)return e;let l=void 0!==o?null===(r=i._$Co)||void 0===r?void 0:r[o]:i._$Cl;const d=k(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==d&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===d?l=void 0:(l=new d(t),l._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Co)&&void 0!==n?n:a._$Co=[])[o]=l:i._$Cl=l),void 0!==l&&(e=Z(t,l._$AS(t,e.values),l,o)),e}class G{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:P).importNode(i,!0);B.currentNode=r;let s=B.nextNode(),n=0,a=0,l=o[0];for(;void 0!==l;){if(n===l.index){let e;2===l.type?e=new J(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new et(s,this,t)),this.u.push(e),l=o[++a]}n!==(null==l?void 0:l.index)&&(s=B.nextNode(),n++)}return r}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class J{constructor(t,e,i,o){var r;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cm=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._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),k(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==H&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==D&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=F.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.p(i);else{const t=new G(r,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=q.get(t.strings);return void 0===e&&q.set(t.strings,e=new F(t)),e}k(t){T(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 J(this.O(z()),this.O(z()),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._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class K{constructor(t,e,i,o,r){this.type=1,this._$AH=D,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=D}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=Z(this,t,e,0),s=!k(t)||t!==this._$AH&&t!==H,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Z(this,o[i+n],e,n),a===H&&(a=this._$AH[n]),s||(s=!k(a)||a!==this._$AH[n]),a===D?t=D:t!==D&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.j(t)}j(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Q extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===D?void 0:t}}const Y=A?A.emptyScript:"";class X extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==D?this.element.setAttribute(this.name,Y):this.element.removeAttribute(this.name)}}class tt extends K{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=Z(this,t,e,0))&&void 0!==i?i:D)===H)return;const o=this._$AH,r=t===D&&o!==D||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==D&&(o===D||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 et{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){Z(this,t)}}const it=w.litHtmlPolyfillSupport;null==it||it(F,J),(null!==(b=w.litHtmlVersions)&&void 0!==b?b:w.litHtmlVersions=[]).push("2.6.1");const ot=(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 J(e.insertBefore(z(),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 rt,st;
|
|
43
|
+
*/var rt,st;let nt=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=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._$Dt=ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return H}};nt.finalized=!0,nt._$litElement$=!0,null===(rt=globalThis.litElementHydrateSupport)||void 0===rt||rt.call(globalThis,{LitElement:nt});const at=globalThis.litElementPolyfillSupport;null==at||at({LitElement:nt}),(null!==(st=globalThis.litElementVersions)&&void 0!==st?st:globalThis.litElementVersions=[]).push("3.2.0");const lt="langChanged";function dt(t,e,i){return Object.entries(ht(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[ ]*${e}[ ]*}}`,"gm"),String(ht(i)))),t)}function pt(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 ht(t){return"function"==typeof t?t():t}let ct={loader:()=>Promise.resolve({}),empty:t=>`[${t}]`,lookup:pt,interpolate:dt,translationCache:{}};function ut(t,e,i=ct){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=t,strings:i.strings=e},window.dispatchEvent(new CustomEvent(lt,{detail:o}))}
|
|
44
|
+
/**
|
|
45
|
+
* @license
|
|
46
|
+
* Copyright 2017 Google LLC
|
|
47
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
|
+
*/
|
|
49
|
+
const ft=2;class gt{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
|
+
/**
|
|
51
|
+
* @license
|
|
52
|
+
* Copyright 2020 Google LLC
|
|
53
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
+
*/const vt=(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),vt(s,e);return!0},mt=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))},_t=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),$t(e)}};
|
|
55
|
+
/**
|
|
56
|
+
* @license
|
|
57
|
+
* Copyright 2017 Google LLC
|
|
58
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
+
*/function yt(t){void 0!==this._$AN?(mt(this),this._$AM=t,_t(this)):this._$AM=t}function Ct(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++)vt(o[s],!1),mt(o[s]);else null!=o&&(vt(o,!1),mt(o));else vt(this,t)}const $t=t=>{var e,i,o,r;t.type==ft&&(null!==(e=(o=t)._$AP)&&void 0!==e||(o._$AP=Ct),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=yt))};class bt extends gt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),_t(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&&(vt(this,t),mt(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 wt extends bt{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(lt,i,e),()=>window.removeEventListener(lt,i)}(this.langChanged.bind(this)))}unsubscribe(){null!=this.langChangedSubscription&&this.langChangedSubscription()}disconnected(){this.unsubscribe()}reconnected(){this.subscribe()}}const At=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends wt{render(t,e,i){return this.renderValue((()=>function(t,e,i=ct){let o=i.translationCache[t]||(i.translationCache[t]=i.lookup(t,i)||i.empty(t,i));return null!=(e=null!=e?ht(e):null)?i.interpolate(o,e,i):o}(t,e,i)))}});
|
|
60
|
+
/**
|
|
61
|
+
* @license
|
|
62
|
+
* Copyright 2017 Google LLC
|
|
63
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
|
+
*/class Lt extends gt{constructor(t){if(super(t),this.it=D,t.type!==ft)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this._t=void 0,this.it=t;if(t===H)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Lt.directiveName="unsafeHTML",Lt.resultType=1;const St="__registered_effects";function xt(t){const e=t;if(e[St])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[St]={index:0,count:0,effects:[]},i.updated=t=>(e[St].index=0,o(t)),e}function Et(t,e,i){const o=function(t,e){const i=xt(t),{index:o,count:r}=i[St];return o===r?(i[St].index++,i[St].count++,i[St].effects.push(e),e):(i[St].index++,i[St].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
|
|
44
65
|
/**
|
|
45
66
|
* @license
|
|
46
67
|
* Copyright 2021 Google LLC
|
|
47
68
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
69
|
*/
|
|
49
|
-
function
|
|
70
|
+
function Pt(t,e,i){return t?e():null==i?void 0:i()}const zt=h`
|
|
50
71
|
:host {
|
|
51
72
|
--shipaid-primary: #002bd6;
|
|
52
73
|
--shipaid-secondary: #0076ff;
|
|
@@ -178,47 +199,30 @@ function ht(t,e,i){return t?e():null==i?void 0:i()}const ct=h`
|
|
|
178
199
|
font-size: var(--shipaid-font-sm);
|
|
179
200
|
color: var(--shipaid-text);
|
|
180
201
|
}
|
|
181
|
-
`;var
|
|
202
|
+
`;var kt=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,Mt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?Tt(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&&kt(e,i,s),s};let Ot=class extends nt{constructor(){super(...arguments),this.active=!1}handleClosePopup(){const t=new Event("close");this.dispatchEvent(t)}render(){return W`
|
|
182
203
|
<div class=${`shipaid-popup ${this.active&&"active"}`}>
|
|
183
204
|
<button
|
|
184
205
|
type="button"
|
|
185
206
|
class="popup-close"
|
|
186
207
|
@click=${this.handleClosePopup}
|
|
187
208
|
>
|
|
188
|
-
|
|
209
|
+
${At("learn-more-popup.close")}
|
|
189
210
|
</button>
|
|
190
|
-
<p class="popup-title"
|
|
211
|
+
<p class="popup-title">${At("learn-more-popup.title")}</p>
|
|
191
212
|
<p>
|
|
192
|
-
|
|
213
|
+
${At("learn-more-popup.subtitle")}
|
|
193
214
|
</p>
|
|
194
215
|
<img
|
|
195
216
|
src="https://res.cloudinary.com/dxyz34kfj/image/upload/v1660782754/shipaid-image_hoz6k8.jpg"
|
|
196
217
|
alt="shipaid protected parcel"
|
|
197
218
|
class="popup-top-image"
|
|
198
219
|
/>
|
|
199
|
-
<p class="popup-title"
|
|
220
|
+
<p class="popup-title">${At("learn-more-popup.disclaimer.title")}</p>
|
|
200
221
|
<p>
|
|
201
|
-
|
|
202
|
-
at your doorstep safely. Things happen! We help the brand you are purchasing
|
|
203
|
-
from replace the product you ordered in the chance of an issue in transit.
|
|
204
|
-
If you encounter an issue, simply reach out to the brand and they will
|
|
205
|
-
get it resolved as soon as possible.
|
|
222
|
+
${At("learn-more-popup.disclaimer.subtitle")}
|
|
206
223
|
</p>
|
|
207
224
|
<p class="popup-disclaimer">
|
|
208
|
-
|
|
209
|
-
and Privacy Policy. You are not obligated to purchase this guarantee.
|
|
210
|
-
This guarantee is NOT insurance and does not provide indemnification against
|
|
211
|
-
loss, damage, or liability arising from a contingent or unknown event,
|
|
212
|
-
but rather, through ShipAid brands provide a delivery guarantee whereby
|
|
213
|
-
if the product you ordered is not delivered in satisfactory condition,
|
|
214
|
-
the brand from which you ordered the product may replace the product
|
|
215
|
-
free of charge. ShipAid does not provide any products or services directly
|
|
216
|
-
to consumers, but instead provides a service that allow brands to facilitate
|
|
217
|
-
product replacement to their customers. Purchasing this guarantee does not
|
|
218
|
-
mean that you will automatically be reimbursed for any product or shipping
|
|
219
|
-
costs because the resolution process and decision for compensation is strictly
|
|
220
|
-
decided by the brand you a purchasing from. The brand will require proof
|
|
221
|
-
of damage or undelivered product.
|
|
225
|
+
${At("learn-more-popup.disclaimer.text")}
|
|
222
226
|
</p>
|
|
223
227
|
<div class="popup-footer">
|
|
224
228
|
<div class="footer-links">
|
|
@@ -227,14 +231,14 @@ function ht(t,e,i){return t?e():null==i?void 0:i()}const ct=h`
|
|
|
227
231
|
target="_blank"
|
|
228
232
|
rel="noreferrer"
|
|
229
233
|
>
|
|
230
|
-
|
|
234
|
+
${At("learn-more-popup.links.terms")}
|
|
231
235
|
</a>
|
|
232
236
|
<a
|
|
233
237
|
href="https://www.shipaid.com/privacy-policy"
|
|
234
238
|
target="_blank"
|
|
235
239
|
rel="noreferrer"
|
|
236
240
|
>
|
|
237
|
-
|
|
241
|
+
${At("learn-more-popup.links.privacy")}
|
|
238
242
|
</a>
|
|
239
243
|
</div>
|
|
240
244
|
<div class="footer-date">
|
|
@@ -242,7 +246,7 @@ function ht(t,e,i){return t?e():null==i?void 0:i()}const ct=h`
|
|
|
242
246
|
</div>
|
|
243
247
|
</div>
|
|
244
248
|
</div>
|
|
245
|
-
`}};
|
|
249
|
+
`}};Ot.styles=zt,Mt([o({type:Boolean,attribute:!0})],Ot.prototype,"active",2),Ot=Mt([e("shipaid-popup-learn-more")],Ot);const Ut="Loading ShipAid Widget...",Nt="Delivery Guarantee",jt="in case of Loss, Damage or Theft",Rt={button:"Powered by"},It={add:"Add",remove:"Remove",loading:"Loading..."},Wt={loading:Ut,title:Nt,description:jt,footer:Rt,actions:It,"learn-more-popup":{close:"Close",title:"Delivery Guarantee",subtitle:"We empower your favorite brands to offer a delivery guarantee because every order is precious!",disclaimer:{title:"Shop Worry-Free",subtitle:"Brands and shipment carriers cannot always guarantee your order will arrive at your doorstep safely. Things happen! We help the brand you are purchasing from replace the product you ordered in the chance of an issue in transit. If you encounter an issue, simply reach out to the brand and they will get it resolved as soon as possible.",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"}}},Ht=Object.freeze(Object.defineProperty({__proto__:null,actions:It,default:Wt,description:jt,footer:Rt,loading:Ut,title:Nt},Symbol.toStringTag,{value:"Module"})),Dt=h`
|
|
246
250
|
:host {
|
|
247
251
|
--shipaid-primary: #002bd6;
|
|
248
252
|
--shipaid-secondary: #0076ff;
|
|
@@ -388,14 +392,14 @@ function ht(t,e,i){return t?e():null==i?void 0:i()}const ct=h`
|
|
|
388
392
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
389
393
|
height: 9px;
|
|
390
394
|
}
|
|
391
|
-
`,
|
|
395
|
+
`,qt=W`
|
|
392
396
|
<svg viewBox="0 0 453 511" version="1.1" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
393
397
|
<g transform="matrix(1,0,0,1,-29.4375,-0.984384)">
|
|
394
398
|
<path d="M468.297,67.385L262.417,2C258.177,0.646 253.63,0.646 249.391,2L43.51,67.385C35.188,69.708 29.438,77.318 29.438,85.979C32.302,157.156 52.266,370.036 52.266,370.036C52.906,378.188 57.297,385.568 64.167,390.01L248.807,509.156C253.12,511.943 258.688,511.943 263.005,509.156L447.641,390.01C454.51,385.568 458.901,378.188 459.542,370.036C459.542,370.036 479.51,157.156 482.37,85.979C482.37,77.318 476.625,69.708 468.297,67.385" style="fill:rgb(47,52,61);fill-rule:nonzero;"/>
|
|
395
399
|
<path d="M256.01,120.969C286.193,120.969 314.057,130.87 336.536,147.604L309.406,174.656C294.073,164.573 275.729,158.708 256.01,158.708C229.141,158.708 204.823,169.604 187.214,187.198C169.615,204.797 158.719,229.125 158.719,255.995C158.719,282.865 169.615,307.182 187.214,324.792C204.813,342.406 229.141,353.286 256.01,353.286C282.88,353.286 307.208,342.406 324.807,324.792C342.406,307.193 353.297,282.865 353.297,255.995C353.297,251.818 353.036,247.719 352.526,243.688L383.859,212.458C388.51,226.115 391.036,240.766 391.036,255.995C391.036,293.286 375.927,327.047 351.49,351.479C327.057,375.911 293.302,391.021 256.01,391.021C218.729,391.021 184.964,375.911 160.526,351.479C136.094,327.047 120.984,293.286 120.984,255.995C120.984,218.719 136.094,184.948 160.526,160.516C184.964,136.083 218.719,120.969 256.01,120.969ZM218.141,220.906L253.615,259.729L354.844,158.813L381.375,185.484L252.396,314.068L190.422,246.255L218.13,220.906L218.141,220.906Z" style="fill:white;fill-rule:nonzero;"/>
|
|
396
400
|
</g>
|
|
397
401
|
</svg>
|
|
398
|
-
`,
|
|
402
|
+
`,Bt=W`
|
|
399
403
|
<svg
|
|
400
404
|
viewBox="0 0 384 383.999986"
|
|
401
405
|
preserveAspectRatio="xMidYMid meet"
|
|
@@ -437,7 +441,7 @@ function ht(t,e,i){return t?e():null==i?void 0:i()}const ct=h`
|
|
|
437
441
|
/>
|
|
438
442
|
</g>
|
|
439
443
|
</svg>
|
|
440
|
-
`,
|
|
444
|
+
`,Vt=W`
|
|
441
445
|
<svg
|
|
442
446
|
viewBox="0 0 423 62"
|
|
443
447
|
version="1.1"
|
|
@@ -519,45 +523,45 @@ function ht(t,e,i){return t?e():null==i?void 0:i()}const ct=h`
|
|
|
519
523
|
/>
|
|
520
524
|
</g>
|
|
521
525
|
</svg>
|
|
522
|
-
`;var
|
|
526
|
+
`;var Ft=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(Ft||{}),Zt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,Jt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?Gt(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&&Zt(e,i,s),s};const Kt=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.")}},Qt=t=>console.warn(`[ShipAid] ${t}`),Yt=t=>console.error(`[ShipAid] ${t}`),Xt="shipaid-protection",te=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>Ht)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>le)).then((t=>t.default))});var ee;ee={loader:async t=>{if("en"===t)return Wt;const e=Reflect.get(te,`./lang/${t}.json`);return e?await e():Wt}},ct=Object.assign(Object.assign({},ct),ee),t.ShipAidWidget=class extends nt{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._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>Kt(t),post:(t,e)=>Kt(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")?(Qt("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(Ft.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){var e,i,o,r,s,n;if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing store settings.");const a=null==(e=this._store)?void 0:e.protectionSettings;if(!a||!this._protectionProduct)throw new Error("Tried to find protection variant, but protection settings for this store are missing.");const l=Array.isArray(null==(i=this._store)?void 0:i.excludedProductSkus)?null==(o=this._store)?void 0:o.excludedProductSkus.map((t=>t.trim())):[],d=((null==(r=t.items)?void 0:r.reduce(((t,e)=>{if(!e.sku)return t;return l.some((t=>t===e.sku.trim()))?t-e.final_line_price:t}),t.total_price))??t.total_price)-((null==(s=t.items)?void 0:s.filter((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))})))??[]).reduce(((t,e)=>t+e.final_line_price),0);if("FIXED"===a.protectionType){if("number"!=typeof a.defaultFee)throw new Error("Missing default fee amount.");if(!(null==(n=a.rules)?void 0:n.length))return a.defaultFee;const t=d/100,e=a.rules.sort(((t,e)=>t.rangeLower&&e.rangeLower?t.rangeLower-e.rangeLower:0)).find((e=>{const i=Boolean(e.rangeLower&&e.rangeLower<t);return e.rangeUpper?i&&e.rangeUpper>=t:i}));return"number"==typeof(null==e?void 0:e.fee)?e.fee:a.defaultFee}if("PERCENTAGE"===a.protectionType){const t=d*a.percentage/100;return t>=a.minimumFee?t:a.minimumFee}throw new Error("No protection type handler found for this store.")}_findProtectionVariant(t){var e,i,o,r;if(!(null==(e=this._store)?void 0:e.protectionSettings)||!(null==(o=null==(i=this._protectionProduct)?void 0:i.variants)?void 0:o.length))throw new Error("Missing product and variants from protection settings.");const s=null==(r=this._protectionProduct)?void 0:r.variants.flatMap((t=>{if(!t||!t.price)return[];const e=Number(t.price);return[{...t,formattedPrice:e}]})).sort(((t,e)=>t.formattedPrice-e.formattedPrice)),n=s.find((e=>e.formattedPrice>=t));return n||s[s.length-1]}_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 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 Yt(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 Yt(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){Yt(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){Yt(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}learnMorePopupTemplate(){return W`
|
|
523
527
|
<shipaid-popup-learn-more ?active=${"learn-more"===this._popup} @close=${()=>{this._popup=null}}></shipaid-popup-learn-more>
|
|
524
|
-
`}promptTemplate(){var t;return
|
|
528
|
+
`}promptTemplate(){var t;return W`
|
|
525
529
|
<div class="shipaid-prompt">
|
|
526
530
|
<div class="prompt-product">
|
|
527
531
|
<div class="prompt-product-image">
|
|
528
|
-
${
|
|
532
|
+
${Pt(this._hasProtectionInCart,(()=>qt),(()=>Bt))}
|
|
529
533
|
</div>
|
|
530
534
|
<div class="prompt-product-details">
|
|
531
535
|
<p class="prompt-product-details-title">
|
|
532
|
-
<slot name="title"
|
|
536
|
+
<slot name="title">${At("title")}</slot>
|
|
533
537
|
</p>
|
|
534
538
|
<p class="prompt-product-details-description">
|
|
535
|
-
<slot name="subtitle"
|
|
539
|
+
<slot name="subtitle">${At("description")}</slot>
|
|
536
540
|
</p>
|
|
537
541
|
</div>
|
|
538
542
|
<div class="prompt-product-actions">
|
|
539
543
|
<p class="prompt-product-actions-price">
|
|
540
544
|
${(null==(t=this._protectionVariant)?void 0:t.price)&&this._currencyFormat(this._protectionVariant.price)}
|
|
541
545
|
</p>
|
|
542
|
-
${
|
|
546
|
+
${Pt(!this.disableActions,(()=>W`
|
|
543
547
|
<button
|
|
544
548
|
class="prompt-product-actions-button"
|
|
545
549
|
@click=${this._updateProtection}
|
|
546
550
|
?disabled=${this._state.loading}
|
|
547
551
|
>
|
|
548
|
-
${this._state.loading?"
|
|
552
|
+
${this._state.loading?At("actions.loading"):this._hasProtectionInCart?At("actions.remove"):W`+ ${At("actions.add")}`}
|
|
549
553
|
</button>
|
|
550
554
|
`))}
|
|
551
555
|
</div>
|
|
552
556
|
</div>
|
|
553
|
-
${
|
|
557
|
+
${Pt(this._state.error,(()=>W`<p class="error">${this._state.error}</p>`))}
|
|
554
558
|
<div class="prompt-footer">
|
|
555
559
|
<a
|
|
556
560
|
class="prompt-footer-badge"
|
|
557
561
|
@click=${()=>{this._popup="learn-more"}}
|
|
558
562
|
>
|
|
559
|
-
<span
|
|
560
|
-
${
|
|
563
|
+
<span>${At("footer.button")}</span>
|
|
564
|
+
${Vt}
|
|
561
565
|
</a>
|
|
562
566
|
<button
|
|
563
567
|
class="prompt-footer-about"
|
|
@@ -567,8 +571,8 @@ function ht(t,e,i){return t?e():null==i?void 0:i()}const ct=h`
|
|
|
567
571
|
</button>
|
|
568
572
|
</div>
|
|
569
573
|
</div>
|
|
570
|
-
`}render(){return
|
|
574
|
+
`}async connectedCallback(){super.connectedCallback(),await async function(t,e=ct){const i=await e.loader(t,e);e.translationCache={},ut(t,i,e)}(this.lang),this.hasLoadedStrings=!0}render(){return Et(this,(async()=>{var t,e;const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i);try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(o){return Yt(o.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(Ft.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(Xt)||(sessionStorage.setItem(Xt,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))):(Qt("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(Qt("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(Qt("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),Et(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 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 Yt("No matching protection variant found.");if(!r)return;if(n.id===r.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}},l=await this._fetch.post("/cart/update.js",a);await this._handleRefresh(l)}),[this._store,this._cart]),ot(this.learnMorePopupTemplate(),document.body),W`
|
|
571
575
|
<div class="shipaid">
|
|
572
|
-
${
|
|
576
|
+
${Pt(this._hasFinishedSetup,(()=>{var t;return Pt(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>this.promptTemplate()),(()=>D))}),(()=>W`<p><slot name="loading" default>${At("loading")}</slot></p>`))}
|
|
573
577
|
</div>
|
|
574
|
-
`}},t.ShipAidWidget.styles=
|
|
578
|
+
`}},t.ShipAidWidget.styles=Dt,Jt([o({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),Jt([o({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),Jt([o({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),Jt([o({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),Jt([o({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),Jt([o({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),Jt([r()],t.ShipAidWidget.prototype,"_storeDomain",2),Jt([r()],t.ShipAidWidget.prototype,"_store",2),Jt([r()],t.ShipAidWidget.prototype,"_cart",2),Jt([r()],t.ShipAidWidget.prototype,"_protectionProduct",2),Jt([r()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),Jt([r()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),Jt([r()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),Jt([r()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),Jt([r()],t.ShipAidWidget.prototype,"_protectionCartItem",2),Jt([r()],t.ShipAidWidget.prototype,"_protectionVariant",2),Jt([r()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),Jt([r()],t.ShipAidWidget.prototype,"_state",2),Jt([r()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=Jt([e("shipaid-widget")],t.ShipAidWidget);const ie="Caricamento del widget ShipAid...",oe="Garanzia di consegna",re="in caso di Perdita, Danno o Furto",se={button:"Offerto da"},ne={add:"Aggiungere",remove:"Rimuovere",loading:"Caricamento ..."},ae={loading:ie,title:oe,description:re,footer:se,actions:ne,"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:{title:"Acquista senza preoccupazioni",subtitle:"I marchi e i corrieri non possono sempre garantire che il tuo ordine arrivi a casa tua in sicurezza. Le cose accadono! Aiutiamo il marchio da cui stai acquistando a sostituire il prodotto che hai ordinato in caso di problemi durante il trasporto. Se riscontri un problema, contatta semplicemente il marchio e lo risolveranno il prima possibile.",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:ne,default:ae,description:re,footer:se,loading:ie,title:oe},Symbol.toStringTag,{value:"Module"}));return Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
|