ui.shipaid.com 0.0.2 → 0.0.5
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/ui.shipaid.com.es.js +156 -225
- package/dist/ui.shipaid.com.iife.js +193 -0
- package/dist/ui.shipaid.com.umd.js +193 -0
- package/package.json +4 -2
- package/dist/style.css +0 -1
|
@@ -1,107 +1,156 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var ft=Object.defineProperty,_t=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var mt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable;var Z=(s,t,e)=>t in s?ft(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,C=(s,t)=>{for(var e in t||(t={}))mt.call(t,e)&&Z(s,e,t[e]);if(K)for(var e of K(t))gt.call(t,e)&&Z(s,e,t[e]);return s},P=(s,t)=>_t(s,$t(t));/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const yt=s=>t=>typeof t=="function"?((e,i)=>(window.customElements.define(e,i),i))(s,t):((e,i)=>{const{kind:r,elements:o}=i;return{kind:r,elements:o,finisher(n){window.customElements.define(e,n)}}})(s,t);/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/const At=(s,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?P(C({},t),{finisher(e){e.createProperty(t.key,s)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,s)}};function wt(s){return(t,e)=>e!==void 0?((i,r,o)=>{r.constructor.createProperty(o,i)})(s,t,e):At(s,t)}/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2017 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/function g(s){return wt(P(C({},s),{state:!0}))}/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2021 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*/var D;((D=window.HTMLSlotElement)===null||D===void 0?void 0:D.prototype.assignedElements)!=null;/**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright 2019 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
+
*/const z=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,L=Symbol(),G=new Map;class Q{constructor(t,e){if(this._$cssResult$=!0,e!==L)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=G.get(this.cssText);return z&&t===void 0&&(G.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const Et=s=>new Q(typeof s=="string"?s:s+"",L),bt=(s,...t)=>{const e=s.length===1?s[0]:t.reduce((i,r,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[o+1],s[0]);return new Q(e,L)},St=(s,t)=>{z?s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),r=window.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,s.appendChild(i)})},X=z?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return Et(e)})(s):s;/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2017 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*/var j;const Y=window.trustedTypes,xt=Y?Y.emptyScript:"",tt=window.reactiveElementPolyfillSupport,V={toAttribute(s,t){switch(t){case Boolean:s=s?xt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},et=(s,t)=>t!==s&&(t==t||s==s),B={attribute:!0,type:String,converter:V,reflect:!1,hasChanged:et};class A extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;(e=this.l)!==null&&e!==void 0||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const r=this._$Eh(i,e);r!==void 0&&(this._$Eu.set(r,i),t.push(r))}),t}static createProperty(t,e=B){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=typeof t=="symbol"?Symbol():"__"+t,r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Object.defineProperty(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(r){const o=this[t];this[e]=r,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||B}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const r of i)this.createProperty(r,e[r])}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 r of i)e.unshift(X(r))}else t!==void 0&&e.push(X(t));return e}static _$Eh(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Em(),this.requestUpdate(),(t=this.constructor.l)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$Eg)!==null&&e!==void 0?e:this._$Eg=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$Eg)===null||e===void 0||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return St(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$Eg)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$Eg)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e,i=B){var r,o;const n=this.constructor._$Eh(t,i);if(n!==void 0&&i.reflect===!0){const l=((o=(r=i.converter)===null||r===void 0?void 0:r.toAttribute)!==null&&o!==void 0?o:V.toAttribute)(e,i.type);this._$Ei=t,l==null?this.removeAttribute(n):this.setAttribute(n,l),this._$Ei=null}}_$AK(t,e){var i,r,o;const n=this.constructor,l=n._$Eu.get(t);if(l!==void 0&&this._$Ei!==l){const a=n.getPropertyOptions(l),h=a.converter,u=(o=(r=(i=h)===null||i===void 0?void 0:i.fromAttribute)!==null&&r!==void 0?r:typeof h=="function"?h:null)!==null&&o!==void 0?o:V.fromAttribute;this._$Ei=l,this[l]=u(e,a.type),this._$Ei=null}}requestUpdate(t,e,i){let r=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||et)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Ei!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):r=!1),!this.isUpdatePending&&r&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach((r,o)=>this[o]=r),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$Eg)===null||t===void 0||t.forEach(r=>{var o;return(o=r.hostUpdate)===null||o===void 0?void 0:o.call(r)}),this.update(i)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$Eg)===null||e===void 0||e.forEach(i=>{var r;return(r=i.hostUpdated)===null||r===void 0?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$ES(i,this[i],e)),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}A.finalized=!0,A.elementProperties=new Map,A.elementStyles=[],A.shadowRootOptions={mode:"open"},tt==null||tt({ReactiveElement:A}),((j=globalThis.reactiveElementVersions)!==null&&j!==void 0?j:globalThis.reactiveElementVersions=[]).push("1.3.0");/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright 2017 Google LLC
|
|
28
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
+
*/var q;const w=globalThis.trustedTypes,it=w?w.createPolicy("lit-html",{createHTML:s=>s}):void 0,$=`lit$${(Math.random()+"").slice(9)}$`,st="?"+$,Ct=`<${st}>`,E=document,U=(s="")=>E.createComment(s),T=s=>s===null||typeof s!="object"&&typeof s!="function",rt=Array.isArray,Pt=s=>{var t;return rt(s)||typeof((t=s)===null||t===void 0?void 0:t[Symbol.iterator])=="function"},N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ot=/-->/g,nt=/>/g,y=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,at=/'/g,ht=/"/g,lt=/^(?:script|style|textarea|title)$/i,Ut=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),F=Ut(1),b=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ct=new WeakMap,Tt=(s,t,e)=>{var i,r;const o=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let n=o._$litPart$;if(n===void 0){const l=(r=e==null?void 0:e.renderBefore)!==null&&r!==void 0?r:null;o._$litPart$=n=new O(t.insertBefore(U(),l),l,void 0,e!=null?e:{})}return n._$AI(s),n},S=E.createTreeWalker(E,129,null,!1),Nt=(s,t)=>{const e=s.length-1,i=[];let r,o=t===2?"<svg>":"",n=N;for(let a=0;a<e;a++){const h=s[a];let u,c,d=-1,v=0;for(;v<h.length&&(n.lastIndex=v,c=n.exec(h),c!==null);)v=n.lastIndex,n===N?c[1]==="!--"?n=ot:c[1]!==void 0?n=nt:c[2]!==void 0?(lt.test(c[2])&&(r=RegExp("</"+c[2],"g")),n=y):c[3]!==void 0&&(n=y):n===y?c[0]===">"?(n=r!=null?r:N,d=-1):c[1]===void 0?d=-2:(d=n.lastIndex-c[2].length,u=c[1],n=c[3]===void 0?y:c[3]==='"'?ht:at):n===ht||n===at?n=y:n===ot||n===nt?n=N:(n=y,r=void 0);const k=n===y&&s[a+1].startsWith("/>")?" ":"";o+=n===N?h+Ct:d>=0?(i.push(u),h.slice(0,d)+"$lit$"+h.slice(d)+$+k):h+$+(d===-2?(i.push(void 0),a):k)}const l=o+(s[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return[it!==void 0?it.createHTML(l):l,i]};class I{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let o=0,n=0;const l=t.length-1,a=this.parts,[h,u]=Nt(t,e);if(this.el=I.createElement(h,i),S.currentNode=this.el.content,e===2){const c=this.el.content,d=c.firstChild;d.remove(),c.append(...d.childNodes)}for(;(r=S.nextNode())!==null&&a.length<l;){if(r.nodeType===1){if(r.hasAttributes()){const c=[];for(const d of r.getAttributeNames())if(d.endsWith("$lit$")||d.startsWith($)){const v=u[n++];if(c.push(d),v!==void 0){const k=r.getAttribute(v.toLowerCase()+"$lit$").split($),M=/([.?@])?(.*)/.exec(v);a.push({type:1,index:o,name:M[2],strings:k,ctor:M[1]==="."?It:M[1]==="?"?kt:M[1]==="@"?Mt:R})}else a.push({type:6,index:o})}for(const d of c)r.removeAttribute(d)}if(lt.test(r.tagName)){const c=r.textContent.split($),d=c.length-1;if(d>0){r.textContent=w?w.emptyScript:"";for(let v=0;v<d;v++)r.append(c[v],U()),S.nextNode(),a.push({type:2,index:++o});r.append(c[d],U())}}}else if(r.nodeType===8)if(r.data===st)a.push({type:2,index:o});else{let c=-1;for(;(c=r.data.indexOf($,c+1))!==-1;)a.push({type:7,index:o}),c+=$.length-1}o++}}static createElement(t,e){const i=E.createElement("template");return i.innerHTML=t,i}}function x(s,t,e=s,i){var r,o,n,l;if(t===b)return t;let a=i!==void 0?(r=e._$Cl)===null||r===void 0?void 0:r[i]:e._$Cu;const h=T(t)?void 0:t._$litDirective$;return(a==null?void 0:a.constructor)!==h&&((o=a==null?void 0:a._$AO)===null||o===void 0||o.call(a,!1),h===void 0?a=void 0:(a=new h(s),a._$AT(s,e,i)),i!==void 0?((n=(l=e)._$Cl)!==null&&n!==void 0?n:l._$Cl=[])[i]=a:e._$Cu=a),a!==void 0&&(t=x(s,a._$AS(s,t.values),a,i)),t}class Ht{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:r}=this._$AD,o=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:E).importNode(i,!0);S.currentNode=o;let n=S.nextNode(),l=0,a=0,h=r[0];for(;h!==void 0;){if(l===h.index){let u;h.type===2?u=new O(n,n.nextSibling,this,t):h.type===1?u=new h.ctor(n,h.name,h.strings,this,t):h.type===6&&(u=new Rt(n,this,t)),this.v.push(u),h=r[++a]}l!==(h==null?void 0:h.index)&&(n=S.nextNode(),l++)}return o}m(t){let e=0;for(const i of this.v)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class O{constructor(t,e,i,r){var o;this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cg=(o=r==null?void 0:r.isConnected)===null||o===void 0||o}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=x(this,t,e),T(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==b&&this.$(t):t._$litType$!==void 0?this.T(t):t.nodeType!==void 0?this.k(t):Pt(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==p&&T(this._$AH)?this._$AA.nextSibling.data=t:this.k(E.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=I.createElement(r.h,this.options)),r);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===o)this._$AH.m(i);else{const n=new Ht(o,this),l=n.p(this.options);n.m(i),this.k(l),this._$AH=n}}_$AC(t){let e=ct.get(t.strings);return e===void 0&&ct.set(t.strings,e=new I(t)),e}S(t){rt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const o of t)r===e.length?e.push(i=new O(this.A(U()),this.A(U()),this,this.options)):i=e[r],i._$AI(o),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){const r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cg=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class R{constructor(t,e,i,r,o){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=p}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,r){const o=this.strings;let n=!1;if(o===void 0)t=x(this,t,e,0),n=!T(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else{const l=t;let a,h;for(t=o[0],a=0;a<o.length-1;a++)h=x(this,l[i+a],e,a),h===b&&(h=this._$AH[a]),n||(n=!T(h)||h!==this._$AH[a]),h===p?t=p:t!==p&&(t+=(h!=null?h:"")+o[a+1]),this._$AH[a]=h}n&&!r&&this.C(t)}C(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}}class It extends R{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===p?void 0:t}}const Ot=w?w.emptyScript:"";class kt extends R{constructor(){super(...arguments),this.type=4}C(t){t&&t!==p?this.element.setAttribute(this.name,Ot):this.element.removeAttribute(this.name)}}class Mt extends R{constructor(t,e,i,r,o){super(t,e,i,r,o),this.type=5}_$AI(t,e=this){var i;if((t=(i=x(this,t,e,0))!==null&&i!==void 0?i:p)===b)return;const r=this._$AH,o=t===p&&r!==p||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==p&&(r===p||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}}class Rt{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=window.litHtmlPolyfillSupport;dt==null||dt(I,O),((q=globalThis.litHtmlVersions)!==null&&q!==void 0?q:globalThis.litHtmlVersions=[]).push("2.2.0");/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2017 Google LLC
|
|
32
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
+
*/var W,J;class H extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=Tt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Dt)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Dt)===null||t===void 0||t.setConnected(!1)}render(){return b}}H.finalized=!0,H._$litElement$=!0,(W=globalThis.litElementHydrateSupport)===null||W===void 0||W.call(globalThis,{LitElement:H});const pt=globalThis.litElementPolyfillSupport;pt==null||pt({LitElement:H}),((J=globalThis.litElementVersions)!==null&&J!==void 0?J:globalThis.litElementVersions=[]).push("3.2.0");function Dt(s){if(!s.dispatchEvent||!s.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return s}const _="__registered_effects";function zt(s){const t=s;if(t[_])return t;const e=Dt(s),i=e.updated;return t[_]={index:0,count:0,effects:[]},e.updated=r=>(t[_].index=0,i(r)),t}function Lt(s,t){const e=zt(s),{index:i,count:r}=e[_];return i===r?(e[_].index++,e[_].count++,e[_].effects.push(t),t):(e[_].index++,e[_].effects[i])}function ut(s,t,e){const i=Lt(s,{on:t,observe:["__initial__dirty"]});i.observe.some((r,o)=>e[o]!==r)&&i.on(),i.observe=e}const jt=(s,t)=>ut(s,t,[]);/**
|
|
34
|
+
* @license
|
|
35
|
+
* Copyright 2021 Google LLC
|
|
36
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
|
+
*/function Vt(s,t,e){return s?t():e==null?void 0:e()}var Bt=bt`
|
|
38
|
+
.shipaid-prompt {
|
|
39
|
+
--shipaid-primary: #002bd6;
|
|
40
|
+
--shipaid-secondary: #0076ff;
|
|
41
|
+
--shipaid-text: #000000;
|
|
42
|
+
--shipaid-text-muted: #cccccc;
|
|
43
|
+
--shipaid-text-grey: #aaaaaa;
|
|
44
|
+
--shipaid-light-grey: #ebecf0;
|
|
45
|
+
--shipaid-font: 'Lato', sans-serif;
|
|
46
|
+
--shipaid-font-sm: 14px;
|
|
47
|
+
--shipaid-font-base: 16px;
|
|
48
|
+
--shipaid-font-lg: 18px;
|
|
49
|
+
--shipaid-font-regular: 400;
|
|
50
|
+
--shipaid-font-heavy: 700;
|
|
51
|
+
|
|
52
|
+
width: 400px;
|
|
53
|
+
font-family: var(--shipaid-font);
|
|
54
|
+
font-size: var(--shipaid-font-base);
|
|
55
|
+
color: var(--shipaid-text);
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 1rem;
|
|
59
|
+
margin: 2rem 0 2rem auto;
|
|
60
|
+
|
|
61
|
+
p, a {
|
|
62
|
+
margin: 0;
|
|
63
|
+
line-height: 1;
|
|
16
64
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
useOnce(this, async () => {
|
|
79
|
-
var _a2, _b2;
|
|
80
|
-
const [apiData, cartData] = await Promise.all([this._fetchShipAidData(), this._fetchCart()]);
|
|
81
|
-
this._store = apiData;
|
|
82
|
-
this._cart = cartData;
|
|
83
|
-
const isProductInCart = (_b2 = (_a2 = cartData.items) == null ? void 0 : _a2.some((item) => item.variant_id === apiData.productVariantNumericId)) != null ? _b2 : false;
|
|
84
|
-
this._hasProtectionInCart = isProductInCart;
|
|
85
|
-
this._hasFinishedSetup = true;
|
|
86
|
-
this._dispatchEvent("shipaid-loaded", apiData);
|
|
87
|
-
});
|
|
88
|
-
useEffect(this, () => {
|
|
89
|
-
var _a2, _b2, _c, _d;
|
|
90
|
-
if (!((_a2 = this._cart) == null ? void 0 : _a2.items))
|
|
91
|
-
return;
|
|
92
|
-
const protectionProductIndex = (_c = (_b2 = this._cart) == null ? void 0 : _b2.items) == null ? void 0 : _c.findIndex((item) => {
|
|
93
|
-
var _a3;
|
|
94
|
-
return item.variant_id === ((_a3 = this._store) == null ? void 0 : _a3.productVariantNumericId);
|
|
95
|
-
});
|
|
96
|
-
const protectionProduct = (_d = this._cart) == null ? void 0 : _d.items[protectionProductIndex];
|
|
97
|
-
this._hasProtectionInCart = !!protectionProduct;
|
|
98
|
-
if (protectionProduct) {
|
|
99
|
-
this._protectionProduct = __spreadProps(__spreadValues({}, protectionProduct), { index: protectionProductIndex, position: protectionProductIndex + 1 });
|
|
65
|
+
|
|
66
|
+
.prompt-title {
|
|
67
|
+
text-align: center;
|
|
68
|
+
font-size: var(--shipaid-font-lg);
|
|
69
|
+
font-weight: var(--shipaid-font-heavy);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.prompt-product {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: row;
|
|
75
|
+
gap: 2rem;
|
|
76
|
+
height: 55px;
|
|
77
|
+
margin-top: 1rem;
|
|
78
|
+
|
|
79
|
+
.prompt-product-details {
|
|
80
|
+
.prompt-product-details-title {
|
|
81
|
+
font-size: var(--shipaid-font-base);
|
|
82
|
+
font-weight: var(--shipaid-font-heavy);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.prompt-product-details-description {
|
|
86
|
+
font-size: var(--shipaid-font-sm);
|
|
87
|
+
margin-top: 1rem;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.prompt-product-actions {
|
|
92
|
+
margin-left: auto;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
justify-content: space-between;
|
|
96
|
+
text-align: right;
|
|
97
|
+
|
|
98
|
+
.prompt-product-actions-price {
|
|
99
|
+
color: var(--shipaid-text-muted);
|
|
100
|
+
font-size: var(--shipaid-font-base);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.prompt-product-actions-button {
|
|
104
|
+
background-color: transparent;
|
|
105
|
+
border: none;
|
|
106
|
+
color: var(--shipaid-primary);
|
|
107
|
+
text-transform: uppercase;
|
|
108
|
+
font-weight: var(--shipaid-font-heavy);
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.prompt-footer {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
justify-content: space-between;
|
|
118
|
+
align-items: center;
|
|
119
|
+
margin-top: 1rem;
|
|
120
|
+
|
|
121
|
+
.prompt-footer-about {
|
|
122
|
+
color: var(--shipaid-text-grey);
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
text-decoration: underline;
|
|
125
|
+
font-size: var(--shipaid-font-sm);
|
|
100
126
|
}
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
|
|
128
|
+
.prompt-footer-badge {
|
|
129
|
+
background-color: var(--shipaid-light-grey);
|
|
130
|
+
color: var(--shipaid-text);
|
|
131
|
+
padding: 0.5rem 1.5rem;
|
|
132
|
+
border-radius: 30px;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
text-decoration: none;
|
|
135
|
+
font-size: var(--shipaid-font-sm);
|
|
136
|
+
|
|
137
|
+
.ship {
|
|
138
|
+
text-transform: uppercase;
|
|
139
|
+
color: var(--shipaid-secondary);
|
|
140
|
+
font-weight: var(--shipaid-font-heavy);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.aid {
|
|
144
|
+
text-transform: uppercase;
|
|
145
|
+
color: var(--shipaid-text-grey);
|
|
146
|
+
font-weight: var(--shipaid-font-heavy);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
`,qt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,m=(s,t,e,i)=>{for(var r=i>1?void 0:i?Ft(t,e):t,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(i?n(t,e,r):n(r))||r);return i&&r&&qt(t,e,r),r},Wt=(s=>(s.LOADED="shipaid-loaded",s.STATUS_UPDATE="shipaid-protection-status",s))(Wt||{});const Jt=s=>{var t,e,i,r,o;return new Intl.NumberFormat((e=(t=window.Shopify)==null?void 0:t.locale)!=null?e:void 0,{currency:(o=(r=(i=window.Shopify)==null?void 0:i.currency)==null?void 0:r.active)!=null?o:"USD",style:"currency"}).format(s)},vt=async(s,t)=>{try{const e=await fetch(s,t);if(!e.ok)throw new Error(await e.text());return await e.json()}catch(e){throw console.error(e),new Error("Failed to complete fetch request.")}};let f=class extends H{constructor(){super(...arguments);var s;this._storeDomain=(s=window.Shopify)==null?void 0:s.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._fetch={get:t=>vt(t),post:(t,e)=>vt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t,e;jt(this,async()=>{var n,l;const[i,r]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=i,this._cart=r;const o=(l=(n=r.items)==null?void 0:n.some(a=>a.variant_id===i.productVariantNumericId))!=null?l:!1;this._hasProtectionInCart=o,this._hasFinishedSetup=!0,this._dispatchEvent("shipaid-loaded",i)}),ut(this,()=>{var o,n,l,a;if(!((o=this._cart)!=null&&o.items))return;const i=(l=(n=this._cart)==null?void 0:n.items)==null?void 0:l.findIndex(h=>{var u;return h.variant_id===((u=this._store)==null?void 0:u.productVariantNumericId)}),r=(a=this._cart)==null?void 0:a.items[i];this._hasProtectionInCart=!!r,r&&(this._protectionProduct=P(C({},r),{index:i,position:i+1}))},[this._store,this._cart]);const s=F`
|
|
103
152
|
<div class="shipaid-prompt">
|
|
104
|
-
<p class="prompt-title">${this._hasProtectionInCart
|
|
153
|
+
<p class="prompt-title">${this._hasProtectionInCart?"Active":"Inactive"}</p>
|
|
105
154
|
<div class="prompt-product">
|
|
106
155
|
<!-- <div class="prompt-product-image">
|
|
107
156
|
<img src="" alt="ShipAid logo" />
|
|
@@ -111,9 +160,9 @@ let ShipAidWidget = class extends LitElement {
|
|
|
111
160
|
<p class="prompt-product-details-description">Resolve shipping issues care-free</p>
|
|
112
161
|
</div>
|
|
113
162
|
<div class="prompt-product-actions">
|
|
114
|
-
<p class="prompt-product-actions-price">${
|
|
163
|
+
<p class="prompt-product-actions-price">${Jt((e=(t=this._store)==null?void 0:t.productPrice)!=null?e:0)}</p>
|
|
115
164
|
<button class="prompt-product-actions-button" @click=${this._updateProtection} ?disabled=${this._state.loading}>
|
|
116
|
-
${this._state.loading
|
|
165
|
+
${this._state.loading?"Loading...":this._hasProtectionInCart?"Remove":"+ Add"}
|
|
117
166
|
</button>
|
|
118
167
|
</div>
|
|
119
168
|
</div>
|
|
@@ -126,30 +175,9 @@ let ShipAidWidget = class extends LitElement {
|
|
|
126
175
|
</a>
|
|
127
176
|
</div>
|
|
128
177
|
</div>
|
|
129
|
-
`;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
`;
|
|
133
|
-
}
|
|
134
|
-
_dispatchEvent(event, detail = {}) {
|
|
135
|
-
this.dispatchEvent(new CustomEvent(event, { bubbles: true, composed: true, detail }));
|
|
136
|
-
}
|
|
137
|
-
_setState(state2, message) {
|
|
138
|
-
this._state = {
|
|
139
|
-
loading: state2 === "loading",
|
|
140
|
-
success: state2 === "success",
|
|
141
|
-
error: state2 === "error" ? message || true : false
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
async _updateProtection() {
|
|
145
|
-
return this._hasProtectionInCart ? this.removeProtection() : this.addProtection();
|
|
146
|
-
}
|
|
147
|
-
async _fetchShipAidData() {
|
|
148
|
-
try {
|
|
149
|
-
if (!this._storeDomain)
|
|
150
|
-
throw new Error("Missing store domain - cannot continue.");
|
|
151
|
-
const variables = { store: this._storeDomain };
|
|
152
|
-
const query = `query StoreByDomain($store: String!) {
|
|
178
|
+
`;return F`
|
|
179
|
+
${Vt(this._hasFinishedSetup&&this._store,()=>s,()=>F`<p>Loading...</p>`)}
|
|
180
|
+
`}_dispatchEvent(s,t={}){this.dispatchEvent(new CustomEvent(s,{bubbles:!0,composed:!0,detail:t}))}_setState(s,t){this._state={loading:s==="loading",success:s==="success",error:s==="error"?t||!0:!1}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){try{if(!this._storeDomain)throw new Error("Missing store domain - cannot continue.");const s={store:this._storeDomain},t=`query StoreByDomain($store: String!) {
|
|
153
181
|
store(store: $store) {
|
|
154
182
|
store
|
|
155
183
|
productId
|
|
@@ -157,101 +185,4 @@ let ShipAidWidget = class extends LitElement {
|
|
|
157
185
|
productVariantNumericId
|
|
158
186
|
productPrice
|
|
159
187
|
}
|
|
160
|
-
}
|
|
161
|
-
const { data } = await this._fetch.post("http://localhost:1337/v1/graphql", { query, variables });
|
|
162
|
-
if (!data.store)
|
|
163
|
-
throw new Error(`Could not find a store for ${this._storeDomain}`);
|
|
164
|
-
if (!data.store.productVariantNumericId)
|
|
165
|
-
throw new Error("Missing variant ID for ShipAid product.");
|
|
166
|
-
return data.store;
|
|
167
|
-
} catch (error) {
|
|
168
|
-
console.error(error);
|
|
169
|
-
throw new Error(`Could not find a store for ${this._storeDomain}`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
async _fetchCart() {
|
|
173
|
-
try {
|
|
174
|
-
const cart = await this._fetch.get("/cart.js");
|
|
175
|
-
return cart;
|
|
176
|
-
} catch (error) {
|
|
177
|
-
console.error(error);
|
|
178
|
-
throw new Error("Could not fetch cart for current domain.");
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
hasProtection() {
|
|
182
|
-
return this._hasProtectionInCart;
|
|
183
|
-
}
|
|
184
|
-
async addProtection() {
|
|
185
|
-
var _a, _b;
|
|
186
|
-
try {
|
|
187
|
-
if (!((_a = this._store) == null ? void 0 : _a.productVariantNumericId))
|
|
188
|
-
throw new Error("Store has not been loaded.");
|
|
189
|
-
if (!((_b = this._cart) == null ? void 0 : _b.items))
|
|
190
|
-
throw new Error("Cart has not been loaded.");
|
|
191
|
-
this._setState("loading");
|
|
192
|
-
const payload = {
|
|
193
|
-
id: this._store.productVariantNumericId,
|
|
194
|
-
quantity: 1
|
|
195
|
-
};
|
|
196
|
-
const cartItem = await this._fetch.post("/cart/add.js", payload);
|
|
197
|
-
const updatedCart = __spreadProps(__spreadValues({}, this._cart), {
|
|
198
|
-
items: [cartItem, ...this._cart.items]
|
|
199
|
-
});
|
|
200
|
-
this._cart = updatedCart;
|
|
201
|
-
this._setState("success");
|
|
202
|
-
this._dispatchEvent("shipaid-protection-status", { protection: true, cart: updatedCart, lineItem: cartItem });
|
|
203
|
-
} catch (err) {
|
|
204
|
-
const error = err;
|
|
205
|
-
console.error(error);
|
|
206
|
-
this._setState("error", "Failed to add protection to cart - please try again, or contact us for help.");
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
async removeProtection() {
|
|
210
|
-
var _a;
|
|
211
|
-
try {
|
|
212
|
-
if (!((_a = this._store) == null ? void 0 : _a.productVariantNumericId))
|
|
213
|
-
throw new Error("Store has not been loaded.");
|
|
214
|
-
if (!this._protectionProduct)
|
|
215
|
-
throw new Error("Protection product not found.");
|
|
216
|
-
this._setState("loading");
|
|
217
|
-
const payload = {
|
|
218
|
-
id: this._protectionProduct.key,
|
|
219
|
-
quantity: 0
|
|
220
|
-
};
|
|
221
|
-
const cart = await this._fetch.post("/cart/change.js", payload);
|
|
222
|
-
this._dispatchEvent("shipaid-protection-status", { protection: false, cart, lineItem: this._protectionProduct });
|
|
223
|
-
this._cart = cart;
|
|
224
|
-
this._setState("success");
|
|
225
|
-
} catch (err) {
|
|
226
|
-
const error = err;
|
|
227
|
-
console.error(error);
|
|
228
|
-
this._setState("error", "Failed to add protection to cart - please try again, or contact us for help.");
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
ShipAidWidget.styles = styles;
|
|
233
|
-
__decorateClass([
|
|
234
|
-
state()
|
|
235
|
-
], ShipAidWidget.prototype, "_storeDomain", 2);
|
|
236
|
-
__decorateClass([
|
|
237
|
-
state()
|
|
238
|
-
], ShipAidWidget.prototype, "_store", 2);
|
|
239
|
-
__decorateClass([
|
|
240
|
-
state()
|
|
241
|
-
], ShipAidWidget.prototype, "_cart", 2);
|
|
242
|
-
__decorateClass([
|
|
243
|
-
state()
|
|
244
|
-
], ShipAidWidget.prototype, "_hasFinishedSetup", 2);
|
|
245
|
-
__decorateClass([
|
|
246
|
-
state()
|
|
247
|
-
], ShipAidWidget.prototype, "_hasProtectionInCart", 2);
|
|
248
|
-
__decorateClass([
|
|
249
|
-
state()
|
|
250
|
-
], ShipAidWidget.prototype, "_protectionProduct", 2);
|
|
251
|
-
__decorateClass([
|
|
252
|
-
state()
|
|
253
|
-
], ShipAidWidget.prototype, "_state", 2);
|
|
254
|
-
ShipAidWidget = __decorateClass([
|
|
255
|
-
customElement("shipaid-widget")
|
|
256
|
-
], ShipAidWidget);
|
|
257
|
-
export { ShipAidWidget };
|
|
188
|
+
}`,{data:e}=await this._fetch.post("http://localhost:1337/v1/graphql",{query:t,variables:s});if(!e.store)throw new Error(`Could not find a store for ${this._storeDomain}`);if(!e.store.productVariantNumericId)throw new Error("Missing variant ID for ShipAid product.");return e.store}catch(s){throw console.error(s),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(s){throw console.error(s),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async addProtection(){var s,t;try{if(!((s=this._store)!=null&&s.productVariantNumericId))throw new Error("Store has not been loaded.");if(!((t=this._cart)!=null&&t.items))throw new Error("Cart has not been loaded.");this._setState("loading");const e={id:this._store.productVariantNumericId,quantity:1},i=await this._fetch.post("/cart/add.js",e),r=P(C({},this._cart),{items:[i,...this._cart.items]});this._cart=r,this._setState("success"),this._dispatchEvent("shipaid-protection-status",{protection:!0,cart:r,lineItem:i})}catch(e){console.error(e),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){var s;try{if(!((s=this._store)!=null&&s.productVariantNumericId))throw new Error("Store has not been loaded.");if(!this._protectionProduct)throw new Error("Protection product not found.");this._setState("loading");const t={id:this._protectionProduct.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);this._dispatchEvent("shipaid-protection-status",{protection:!1,cart:e,lineItem:this._protectionProduct}),this._cart=e,this._setState("success")}catch(t){console.error(t),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}};f.styles=Bt,m([g()],f.prototype,"_storeDomain",2),m([g()],f.prototype,"_store",2),m([g()],f.prototype,"_cart",2),m([g()],f.prototype,"_hasFinishedSetup",2),m([g()],f.prototype,"_hasProtectionInCart",2),m([g()],f.prototype,"_protectionProduct",2),m([g()],f.prototype,"_state",2),f=m([yt("shipaid-widget")],f);export{f as ShipAidWidget};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var Vt=Object.defineProperty,Bt=Object.defineProperties,qt=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,_t=(t,e,i)=>e in t?Vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,k=(t,e)=>{for(var i in e||(e={}))Ft.call(e,i)&&_t(t,i,e[i]);if(ft)for(var i of ft(e))Jt.call(e,i)&&_t(t,i,e[i]);return t},M=(t,e)=>Bt(t,qt(e)),ShipAidWidget=function(t){"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2017 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/const e=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?M(k({},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)}};
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright 2017 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @license
|
|
14
|
+
* Copyright 2017 Google LLC
|
|
15
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
+
*/
|
|
17
|
+
function i(t){return function(t){return(i,s)=>{return void 0!==s?(r=t,o=s,void i.constructor.createProperty(o,r)):e(t,i);var r,o}}(M(k({},t),{state:!0}))}
|
|
18
|
+
/**
|
|
19
|
+
* @license
|
|
20
|
+
* Copyright 2021 Google LLC
|
|
21
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
+
*/var s;null===(s=window.HTMLSlotElement)||void 0===s||s.prototype.assignedElements;
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2019 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/
|
|
28
|
+
const r=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),n=new Map;class a{constructor(t,e){if(this._$cssResult$=!0,e!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=n.get(this.cssText);return r&&void 0===t&&(n.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const l=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new a("string"==typeof t?t:t+"",o))(e)})(t):t
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2017 Google LLC
|
|
32
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
+
*/;var h;const d=window.trustedTypes,c=d?d.emptyScript:"",p=window.reactiveElementPolyfillSupport,u={toAttribute(t,e){switch(e){case Boolean:t=t?c: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{i=null}}return i}},v=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:v};class _ extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Eh(i,e);void 0!==s&&(this._$Eu.set(s,i),t.push(s))})),t}static createProperty(t,e=f){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,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const r=this[t];this[e]=s,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=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(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).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._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.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)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),s=window.litNonce;void 0!==s&&i.setAttribute("nonce",s),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._$Eg)||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._$Eg)||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)}_$ES(t,e,i=f){var s,r;const o=this.constructor._$Eh(t,i);if(void 0!==o&&!0===i.reflect){const n=(null!==(r=null===(s=i.converter)||void 0===s?void 0:s.toAttribute)&&void 0!==r?r:u.toAttribute)(e,i.type);this._$Ei=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$Ei=null}}_$AK(t,e){var i,s,r;const o=this.constructor,n=o._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=o.getPropertyOptions(n),a=t.converter,l=null!==(r=null!==(s=null===(i=a)||void 0===i?void 0:i.fromAttribute)&&void 0!==s?s:"function"==typeof a?a:null)&&void 0!==r?r:u.fromAttribute;this._$Ei=n,this[n]=l(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||v)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}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._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Eg)||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._$EU()}catch(s){throw e=!1,this._$EU(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
|
|
34
|
+
/**
|
|
35
|
+
* @license
|
|
36
|
+
* Copyright 2017 Google LLC
|
|
37
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
|
+
*/
|
|
39
|
+
var m;_.finalized=!0,_.elementProperties=new Map,_.elementStyles=[],_.shadowRootOptions={mode:"open"},null==p||p({ReactiveElement:_}),(null!==(h=globalThis.reactiveElementVersions)&&void 0!==h?h:globalThis.reactiveElementVersions=[]).push("1.3.0");const g=globalThis.trustedTypes,$=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,y=`lit$${(Math.random()+"").slice(9)}$`,A="?"+y,w=`<${A}>`,b=document,S=(t="")=>b.createComment(t),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,x=Array.isArray,C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,U=/>/g,O=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,T=/'/g,N=/"/g,H=/^(?:script|style|textarea|title)$/i,I=(L=1,(t,...e)=>({_$litType$:L,strings:t,values:e})),R=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),j=new WeakMap,z=b.createTreeWalker(b,129,null,!1);var L;class V{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,o=0;const n=t.length-1,a=this.parts,[l,h]=((t,e)=>{const i=t.length-1,s=[];let r,o=2===e?"<svg>":"",n=C;for(let l=0;l<i;l++){const e=t[l];let i,a,h=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===C?"!--"===a[1]?n=P:void 0!==a[1]?n=U:void 0!==a[2]?(H.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=O):void 0!==a[3]&&(n=O):n===O?">"===a[0]?(n=null!=r?r:C,h=-1):void 0===a[1]?h=-2:(h=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?O:'"'===a[3]?N:T):n===N||n===T?n=O:n===P||n===U?n=C:(n=O,r=void 0);const c=n===O&&t[l+1].startsWith("/>")?" ":"";o+=n===C?e+w:h>=0?(s.push(i),e.slice(0,h)+"$lit$"+e.slice(h)+y+c):e+y+(-2===h?(s.push(void 0),l):c)}const a=o+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==$?$.createHTML(a):a,s]})(t,e);if(this.el=V.createElement(l,i),z.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=z.nextNode())&&a.length<n;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(y)){const i=h[o++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+"$lit$").split(y),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?J:"?"===e[1]?Z:"@"===e[1]?G:F})}else a.push({type:6,index:r})}for(const e of t)s.removeAttribute(e)}if(H.test(s.tagName)){const t=s.textContent.split(y),e=t.length-1;if(e>0){s.textContent=g?g.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],S()),z.nextNode(),a.push({type:2,index:++r});s.append(t[e],S())}}}else if(8===s.nodeType)if(s.data===A)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(y,t+1));)a.push({type:7,index:r}),t+=y.length-1}r++}}static createElement(t,e){const i=b.createElement("template");return i.innerHTML=t,i}}function W(t,e,i=t,s){var r,o,n,a;if(e===R)return e;let l=void 0!==s?null===(r=i._$Cl)||void 0===r?void 0:r[s]:i._$Cu;const h=E(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(o=null==l?void 0:l._$AO)||void 0===o||o.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,s)),void 0!==s?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[s]=l:i._$Cu=l),void 0!==l&&(e=W(t,l._$AS(t,e.values),l,s)),e}class B{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:s}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:b).importNode(i,!0);z.currentNode=r;let o=z.nextNode(),n=0,a=0,l=s[0];for(;void 0!==l;){if(n===l.index){let e;2===l.type?e=new q(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new Q(o,this,t)),this.v.push(e),l=s[++a]}n!==(null==l?void 0:l.index)&&(o=z.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class q{constructor(t,e,i,s){var r;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cg=null===(r=null==s?void 0:s.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._$Cg}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=W(this,t,e),E(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==R&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return x(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==D&&E(this._$AH)?this._$AA.nextSibling.data=t:this.k(b.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new B(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=j.get(t.strings);return void 0===e&&j.set(t.strings,e=new V(t)),e}S(t){x(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const r of t)s===e.length?e.push(i=new q(this.A(S()),this.A(S()),this,this.options)):i=e[s],i._$AI(r),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$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._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class F{constructor(t,e,i,s,r){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,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,s){const r=this.strings;let o=!1;if(void 0===r)t=W(this,t,e,0),o=!E(t)||t!==this._$AH&&t!==R,o&&(this._$AH=t);else{const s=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=W(this,s[i+n],e,n),a===R&&(a=this._$AH[n]),o||(o=!E(a)||a!==this._$AH[n]),a===D?t=D:t!==D&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}o&&!s&&this.C(t)}C(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class J extends F{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===D?void 0:t}}const K=g?g.emptyScript:"";class Z extends F{constructor(){super(...arguments),this.type=4}C(t){t&&t!==D?this.element.setAttribute(this.name,K):this.element.removeAttribute(this.name)}}class G extends F{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=W(this,t,e,0))&&void 0!==i?i:D)===R)return;const s=this._$AH,r=t===D&&s!==D||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==D&&(s===D||r);r&&this.element.removeEventListener(this.name,this,s),o&&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 Q{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){W(this,t)}}const X=window.litHtmlPolyfillSupport;
|
|
40
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2017 Google LLC
|
|
43
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
+
*/
|
|
45
|
+
var Y,tt;null==X||X(V,q),(null!==(m=globalThis.litHtmlVersions)&&void 0!==m?m:globalThis.litHtmlVersions=[]).push("2.2.0");class et 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=((t,e,i)=>{var s,r;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let n=o._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;o._$litPart$=n=new q(e.insertBefore(S(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(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 R}}et.finalized=!0,et._$litElement$=!0,null===(Y=globalThis.litElementHydrateSupport)||void 0===Y||Y.call(globalThis,{LitElement:et});const it=globalThis.litElementPolyfillSupport;null==it||it({LitElement:et}),(null!==(tt=globalThis.litElementVersions)&&void 0!==tt?tt:globalThis.litElementVersions=[]).push("3.2.0");const st="__registered_effects";function rt(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),s=i.updated;return e[st]={index:0,count:0,effects:[]},i.updated=t=>(e[st].index=0,s(t)),e}function ot(t,e,i){const s=function(t,e){const i=rt(t),{index:s,count:r}=i[st];return s===r?(i[st].index++,i[st].count++,i[st].effects.push(e),e):(i[st].index++,i[st].effects[s])}(t,{on:e,observe:["__initial__dirty"]});s.observe.some(((t,e)=>i[e]!==t))&&s.on(),s.observe=i}var nt=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>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[s+1]),t[0]);return new a(i,o)})`
|
|
46
|
+
.shipaid-prompt {
|
|
47
|
+
--shipaid-primary: #002bd6;
|
|
48
|
+
--shipaid-secondary: #0076ff;
|
|
49
|
+
--shipaid-text: #000000;
|
|
50
|
+
--shipaid-text-muted: #cccccc;
|
|
51
|
+
--shipaid-text-grey: #aaaaaa;
|
|
52
|
+
--shipaid-light-grey: #ebecf0;
|
|
53
|
+
--shipaid-font: 'Lato', sans-serif;
|
|
54
|
+
--shipaid-font-sm: 14px;
|
|
55
|
+
--shipaid-font-base: 16px;
|
|
56
|
+
--shipaid-font-lg: 18px;
|
|
57
|
+
--shipaid-font-regular: 400;
|
|
58
|
+
--shipaid-font-heavy: 700;
|
|
59
|
+
|
|
60
|
+
width: 400px;
|
|
61
|
+
font-family: var(--shipaid-font);
|
|
62
|
+
font-size: var(--shipaid-font-base);
|
|
63
|
+
color: var(--shipaid-text);
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
gap: 1rem;
|
|
67
|
+
margin: 2rem 0 2rem auto;
|
|
68
|
+
|
|
69
|
+
p, a {
|
|
70
|
+
margin: 0;
|
|
71
|
+
line-height: 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.prompt-title {
|
|
75
|
+
text-align: center;
|
|
76
|
+
font-size: var(--shipaid-font-lg);
|
|
77
|
+
font-weight: var(--shipaid-font-heavy);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.prompt-product {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: row;
|
|
83
|
+
gap: 2rem;
|
|
84
|
+
height: 55px;
|
|
85
|
+
margin-top: 1rem;
|
|
86
|
+
|
|
87
|
+
.prompt-product-details {
|
|
88
|
+
.prompt-product-details-title {
|
|
89
|
+
font-size: var(--shipaid-font-base);
|
|
90
|
+
font-weight: var(--shipaid-font-heavy);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.prompt-product-details-description {
|
|
94
|
+
font-size: var(--shipaid-font-sm);
|
|
95
|
+
margin-top: 1rem;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.prompt-product-actions {
|
|
100
|
+
margin-left: auto;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
justify-content: space-between;
|
|
104
|
+
text-align: right;
|
|
105
|
+
|
|
106
|
+
.prompt-product-actions-price {
|
|
107
|
+
color: var(--shipaid-text-muted);
|
|
108
|
+
font-size: var(--shipaid-font-base);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.prompt-product-actions-button {
|
|
112
|
+
background-color: transparent;
|
|
113
|
+
border: none;
|
|
114
|
+
color: var(--shipaid-primary);
|
|
115
|
+
text-transform: uppercase;
|
|
116
|
+
font-weight: var(--shipaid-font-heavy);
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.prompt-footer {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: row;
|
|
125
|
+
justify-content: space-between;
|
|
126
|
+
align-items: center;
|
|
127
|
+
margin-top: 1rem;
|
|
128
|
+
|
|
129
|
+
.prompt-footer-about {
|
|
130
|
+
color: var(--shipaid-text-grey);
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
text-decoration: underline;
|
|
133
|
+
font-size: var(--shipaid-font-sm);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.prompt-footer-badge {
|
|
137
|
+
background-color: var(--shipaid-light-grey);
|
|
138
|
+
color: var(--shipaid-text);
|
|
139
|
+
padding: 0.5rem 1.5rem;
|
|
140
|
+
border-radius: 30px;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
text-decoration: none;
|
|
143
|
+
font-size: var(--shipaid-font-sm);
|
|
144
|
+
|
|
145
|
+
.ship {
|
|
146
|
+
text-transform: uppercase;
|
|
147
|
+
color: var(--shipaid-secondary);
|
|
148
|
+
font-weight: var(--shipaid-font-heavy);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.aid {
|
|
152
|
+
text-transform: uppercase;
|
|
153
|
+
color: var(--shipaid-text-grey);
|
|
154
|
+
font-weight: var(--shipaid-font-heavy);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
`,at=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,ht=(t,e,i,s)=>{for(var r,o=s>1?void 0:s?lt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s?r(e,i,o):r(o))||o);return s&&o&&at(e,i,o),o},dt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(dt||{});const ct=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.")}};return t.ShipAidWidget=class extends et{constructor(){var t;super(...arguments),this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._fetch={get:t=>ct(t),post:(t,e)=>ct(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t,e;((t,e)=>{ot(t,e,[]);
|
|
160
|
+
/**
|
|
161
|
+
* @license
|
|
162
|
+
* Copyright 2021 Google LLC
|
|
163
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
164
|
+
*/})(this,(async()=>{var t,e;const[i,s]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=i,this._cart=s;const r=null!=(e=null==(t=s.items)?void 0:t.some((t=>t.variant_id===i.productVariantNumericId)))&&e;this._hasProtectionInCart=r,this._hasFinishedSetup=!0,this._dispatchEvent("shipaid-loaded",i)})),ot(this,(()=>{var t,e,i,s;if(null==(t=this._cart)||!t.items)return;const r=null==(i=null==(e=this._cart)?void 0:e.items)?void 0:i.findIndex((t=>{var e;return t.variant_id===(null==(e=this._store)?void 0:e.productVariantNumericId)})),o=null==(s=this._cart)?void 0:s.items[r];this._hasProtectionInCart=!!o,o&&(this._protectionProduct=M(k({},o),{index:r,position:r+1}))}),[this._store,this._cart]);const i=I`
|
|
165
|
+
<div class="shipaid-prompt">
|
|
166
|
+
<p class="prompt-title">${this._hasProtectionInCart?"Active":"Inactive"}</p>
|
|
167
|
+
<div class="prompt-product">
|
|
168
|
+
<!-- <div class="prompt-product-image">
|
|
169
|
+
<img src="" alt="ShipAid logo" />
|
|
170
|
+
</div> -->
|
|
171
|
+
<div class="prompt-product-details">
|
|
172
|
+
<p class="prompt-product-details-title">Instant Package Protection</p>
|
|
173
|
+
<p class="prompt-product-details-description">Resolve shipping issues care-free</p>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="prompt-product-actions">
|
|
176
|
+
<p class="prompt-product-actions-price">${(t=>{var e,i,s,r,o;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:null!=(o=null==(r=null==(s=window.Shopify)?void 0:s.currency)?void 0:r.active)?o:"USD",style:"currency"}).format(t)})(null!=(e=null==(t=this._store)?void 0:t.productPrice)?e:0)}</p>
|
|
177
|
+
<button class="prompt-product-actions-button" @click=${this._updateProtection} ?disabled=${this._state.loading}>
|
|
178
|
+
${this._state.loading?"Loading...":this._hasProtectionInCart?"Remove":"+ Add"}
|
|
179
|
+
</button>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="prompt-footer">
|
|
183
|
+
<b class="prompt-footer-about" href="/">Learn More</b>
|
|
184
|
+
<a class="prompt-footer-badge" href="/">
|
|
185
|
+
<span>Powered by</span>
|
|
186
|
+
<span class="ship">Ship</span>
|
|
187
|
+
<span class="aid">Aid</span>
|
|
188
|
+
</a>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
`;return I`
|
|
192
|
+
${function(t,e,i){return t?e():null==i?void 0:i()}(this._hasFinishedSetup&&this._store,(()=>i),(()=>I`<p>Loading...</p>`))}
|
|
193
|
+
`}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}_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(){try{if(!this._storeDomain)throw new Error("Missing store domain - cannot continue.");const t={store:this._storeDomain},e="query StoreByDomain($store: String!) {\n store(store: $store) {\n store\n productId\n productVariantId\n productVariantNumericId\n productPrice\n }\n }",{data:i}=await this._fetch.post("http://localhost:1337/v1/graphql",{query:e,variables:t});if(!i.store)throw new Error(`Could not find a store for ${this._storeDomain}`);if(!i.store.productVariantNumericId)throw new Error("Missing variant ID for ShipAid product.");return i.store}catch(L){throw console.error(L),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(L){throw console.error(L),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async addProtection(){var t,e;try{if(null==(t=this._store)||!t.productVariantNumericId)throw new Error("Store has not been loaded.");if(null==(e=this._cart)||!e.items)throw new Error("Cart has not been loaded.");this._setState("loading");const i={id:this._store.productVariantNumericId,quantity:1},s=await this._fetch.post("/cart/add.js",i),r=M(k({},this._cart),{items:[s,...this._cart.items]});this._cart=r,this._setState("success"),this._dispatchEvent("shipaid-protection-status",{protection:!0,cart:r,lineItem:s})}catch(i){console.error(i),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){var t;try{if(null==(t=this._store)||!t.productVariantNumericId)throw new Error("Store has not been loaded.");if(!this._protectionProduct)throw new Error("Protection product not found.");this._setState("loading");const e={id:this._protectionProduct.key,quantity:0},i=await this._fetch.post("/cart/change.js",e);this._dispatchEvent("shipaid-protection-status",{protection:!1,cart:i,lineItem:this._protectionProduct}),this._cart=i,this._setState("success")}catch(e){console.error(e),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}},t.ShipAidWidget.styles=nt,ht([i()],t.ShipAidWidget.prototype,"_storeDomain",2),ht([i()],t.ShipAidWidget.prototype,"_store",2),ht([i()],t.ShipAidWidget.prototype,"_cart",2),ht([i()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),ht([i()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),ht([i()],t.ShipAidWidget.prototype,"_protectionProduct",2),ht([i()],t.ShipAidWidget.prototype,"_state",2),t.ShipAidWidget=ht([(t=>e=>{return"function"==typeof e?(i=t,s=e,window.customElements.define(i,s),s):((t,e)=>{const{kind:i,elements:s}=e;return{kind:i,elements:s,finisher(e){window.customElements.define(t,e)}}})(t,e);var i,s})("shipaid-widget")],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),t}({});
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var Vt=Object.defineProperty,Bt=Object.defineProperties,qt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,_t=(t,e,i)=>e in t?Vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,k=(t,e)=>{for(var i in e||(e={}))Ft.call(e,i)&&_t(t,i,e[i]);if(vt)for(var i of vt(e))Jt.call(e,i)&&_t(t,i,e[i]);return t},M=(t,e)=>Bt(t,qt(e));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShipAidWidget={})}(this,(function(t){"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2017 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/const e=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?M(k({},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)}};
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright 2017 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @license
|
|
14
|
+
* Copyright 2017 Google LLC
|
|
15
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
+
*/
|
|
17
|
+
function i(t){return function(t){return(i,s)=>{return void 0!==s?(r=t,o=s,void i.constructor.createProperty(o,r)):e(t,i);var r,o}}(M(k({},t),{state:!0}))}
|
|
18
|
+
/**
|
|
19
|
+
* @license
|
|
20
|
+
* Copyright 2021 Google LLC
|
|
21
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
+
*/var s;null===(s=window.HTMLSlotElement)||void 0===s||s.prototype.assignedElements;
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2019 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/
|
|
28
|
+
const r=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),n=new Map;class a{constructor(t,e){if(this._$cssResult$=!0,e!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=n.get(this.cssText);return r&&void 0===t&&(n.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const l=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new a("string"==typeof t?t:t+"",o))(e)})(t):t
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2017 Google LLC
|
|
32
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
+
*/;var h;const d=window.trustedTypes,c=d?d.emptyScript:"",p=window.reactiveElementPolyfillSupport,u={toAttribute(t,e){switch(e){case Boolean:t=t?c: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{i=null}}return i}},v=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:v};class _ extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Eh(i,e);void 0!==s&&(this._$Eu.set(s,i),t.push(s))})),t}static createProperty(t,e=f){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,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const r=this[t];this[e]=s,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=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(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).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._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.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)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),s=window.litNonce;void 0!==s&&i.setAttribute("nonce",s),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._$Eg)||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._$Eg)||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)}_$ES(t,e,i=f){var s,r;const o=this.constructor._$Eh(t,i);if(void 0!==o&&!0===i.reflect){const n=(null!==(r=null===(s=i.converter)||void 0===s?void 0:s.toAttribute)&&void 0!==r?r:u.toAttribute)(e,i.type);this._$Ei=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$Ei=null}}_$AK(t,e){var i,s,r;const o=this.constructor,n=o._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=o.getPropertyOptions(n),a=t.converter,l=null!==(r=null!==(s=null===(i=a)||void 0===i?void 0:i.fromAttribute)&&void 0!==s?s:"function"==typeof a?a:null)&&void 0!==r?r:u.fromAttribute;this._$Ei=n,this[n]=l(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||v)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}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._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Eg)||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._$EU()}catch(s){throw e=!1,this._$EU(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
|
|
34
|
+
/**
|
|
35
|
+
* @license
|
|
36
|
+
* Copyright 2017 Google LLC
|
|
37
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
|
+
*/
|
|
39
|
+
var m;_.finalized=!0,_.elementProperties=new Map,_.elementStyles=[],_.shadowRootOptions={mode:"open"},null==p||p({ReactiveElement:_}),(null!==(h=globalThis.reactiveElementVersions)&&void 0!==h?h:globalThis.reactiveElementVersions=[]).push("1.3.0");const g=globalThis.trustedTypes,y=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,$=`lit$${(Math.random()+"").slice(9)}$`,A="?"+$,b=`<${A}>`,w=document,S=(t="")=>w.createComment(t),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,x=Array.isArray,C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,U=/>/g,T=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,O=/'/g,N=/"/g,H=/^(?:script|style|textarea|title)$/i,I=(L=1,(t,...e)=>({_$litType$:L,strings:t,values:e})),R=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),j=new WeakMap,z=w.createTreeWalker(w,129,null,!1);var L;class V{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,o=0;const n=t.length-1,a=this.parts,[l,h]=((t,e)=>{const i=t.length-1,s=[];let r,o=2===e?"<svg>":"",n=C;for(let l=0;l<i;l++){const e=t[l];let i,a,h=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===C?"!--"===a[1]?n=P:void 0!==a[1]?n=U:void 0!==a[2]?(H.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=T):void 0!==a[3]&&(n=T):n===T?">"===a[0]?(n=null!=r?r:C,h=-1):void 0===a[1]?h=-2:(h=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?T:'"'===a[3]?N:O):n===N||n===O?n=T:n===P||n===U?n=C:(n=T,r=void 0);const c=n===T&&t[l+1].startsWith("/>")?" ":"";o+=n===C?e+b:h>=0?(s.push(i),e.slice(0,h)+"$lit$"+e.slice(h)+$+c):e+$+(-2===h?(s.push(void 0),l):c)}const a=o+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==y?y.createHTML(a):a,s]})(t,e);if(this.el=V.createElement(l,i),z.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=z.nextNode())&&a.length<n;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith($)){const i=h[o++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+"$lit$").split($),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?J:"?"===e[1]?Z:"@"===e[1]?G:F})}else a.push({type:6,index:r})}for(const e of t)s.removeAttribute(e)}if(H.test(s.tagName)){const t=s.textContent.split($),e=t.length-1;if(e>0){s.textContent=g?g.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],S()),z.nextNode(),a.push({type:2,index:++r});s.append(t[e],S())}}}else if(8===s.nodeType)if(s.data===A)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf($,t+1));)a.push({type:7,index:r}),t+=$.length-1}r++}}static createElement(t,e){const i=w.createElement("template");return i.innerHTML=t,i}}function W(t,e,i=t,s){var r,o,n,a;if(e===R)return e;let l=void 0!==s?null===(r=i._$Cl)||void 0===r?void 0:r[s]:i._$Cu;const h=E(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(o=null==l?void 0:l._$AO)||void 0===o||o.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,s)),void 0!==s?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[s]=l:i._$Cu=l),void 0!==l&&(e=W(t,l._$AS(t,e.values),l,s)),e}class B{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:s}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:w).importNode(i,!0);z.currentNode=r;let o=z.nextNode(),n=0,a=0,l=s[0];for(;void 0!==l;){if(n===l.index){let e;2===l.type?e=new q(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new Q(o,this,t)),this.v.push(e),l=s[++a]}n!==(null==l?void 0:l.index)&&(o=z.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class q{constructor(t,e,i,s){var r;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cg=null===(r=null==s?void 0:s.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._$Cg}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=W(this,t,e),E(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==R&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return x(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==D&&E(this._$AH)?this._$AA.nextSibling.data=t:this.k(w.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new B(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=j.get(t.strings);return void 0===e&&j.set(t.strings,e=new V(t)),e}S(t){x(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const r of t)s===e.length?e.push(i=new q(this.A(S()),this.A(S()),this,this.options)):i=e[s],i._$AI(r),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$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._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class F{constructor(t,e,i,s,r){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,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,s){const r=this.strings;let o=!1;if(void 0===r)t=W(this,t,e,0),o=!E(t)||t!==this._$AH&&t!==R,o&&(this._$AH=t);else{const s=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=W(this,s[i+n],e,n),a===R&&(a=this._$AH[n]),o||(o=!E(a)||a!==this._$AH[n]),a===D?t=D:t!==D&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}o&&!s&&this.C(t)}C(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class J extends F{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===D?void 0:t}}const K=g?g.emptyScript:"";class Z extends F{constructor(){super(...arguments),this.type=4}C(t){t&&t!==D?this.element.setAttribute(this.name,K):this.element.removeAttribute(this.name)}}class G extends F{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=W(this,t,e,0))&&void 0!==i?i:D)===R)return;const s=this._$AH,r=t===D&&s!==D||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==D&&(s===D||r);r&&this.element.removeEventListener(this.name,this,s),o&&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 Q{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){W(this,t)}}const X=window.litHtmlPolyfillSupport;
|
|
40
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2017 Google LLC
|
|
43
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
+
*/
|
|
45
|
+
var Y,tt;null==X||X(V,q),(null!==(m=globalThis.litHtmlVersions)&&void 0!==m?m:globalThis.litHtmlVersions=[]).push("2.2.0");class et 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=((t,e,i)=>{var s,r;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let n=o._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;o._$litPart$=n=new q(e.insertBefore(S(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(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 R}}et.finalized=!0,et._$litElement$=!0,null===(Y=globalThis.litElementHydrateSupport)||void 0===Y||Y.call(globalThis,{LitElement:et});const it=globalThis.litElementPolyfillSupport;null==it||it({LitElement:et}),(null!==(tt=globalThis.litElementVersions)&&void 0!==tt?tt:globalThis.litElementVersions=[]).push("3.2.0");const st="__registered_effects";function rt(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),s=i.updated;return e[st]={index:0,count:0,effects:[]},i.updated=t=>(e[st].index=0,s(t)),e}function ot(t,e,i){const s=function(t,e){const i=rt(t),{index:s,count:r}=i[st];return s===r?(i[st].index++,i[st].count++,i[st].effects.push(e),e):(i[st].index++,i[st].effects[s])}(t,{on:e,observe:["__initial__dirty"]});s.observe.some(((t,e)=>i[e]!==t))&&s.on(),s.observe=i}var nt=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>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[s+1]),t[0]);return new a(i,o)})`
|
|
46
|
+
.shipaid-prompt {
|
|
47
|
+
--shipaid-primary: #002bd6;
|
|
48
|
+
--shipaid-secondary: #0076ff;
|
|
49
|
+
--shipaid-text: #000000;
|
|
50
|
+
--shipaid-text-muted: #cccccc;
|
|
51
|
+
--shipaid-text-grey: #aaaaaa;
|
|
52
|
+
--shipaid-light-grey: #ebecf0;
|
|
53
|
+
--shipaid-font: 'Lato', sans-serif;
|
|
54
|
+
--shipaid-font-sm: 14px;
|
|
55
|
+
--shipaid-font-base: 16px;
|
|
56
|
+
--shipaid-font-lg: 18px;
|
|
57
|
+
--shipaid-font-regular: 400;
|
|
58
|
+
--shipaid-font-heavy: 700;
|
|
59
|
+
|
|
60
|
+
width: 400px;
|
|
61
|
+
font-family: var(--shipaid-font);
|
|
62
|
+
font-size: var(--shipaid-font-base);
|
|
63
|
+
color: var(--shipaid-text);
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
gap: 1rem;
|
|
67
|
+
margin: 2rem 0 2rem auto;
|
|
68
|
+
|
|
69
|
+
p, a {
|
|
70
|
+
margin: 0;
|
|
71
|
+
line-height: 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.prompt-title {
|
|
75
|
+
text-align: center;
|
|
76
|
+
font-size: var(--shipaid-font-lg);
|
|
77
|
+
font-weight: var(--shipaid-font-heavy);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.prompt-product {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: row;
|
|
83
|
+
gap: 2rem;
|
|
84
|
+
height: 55px;
|
|
85
|
+
margin-top: 1rem;
|
|
86
|
+
|
|
87
|
+
.prompt-product-details {
|
|
88
|
+
.prompt-product-details-title {
|
|
89
|
+
font-size: var(--shipaid-font-base);
|
|
90
|
+
font-weight: var(--shipaid-font-heavy);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.prompt-product-details-description {
|
|
94
|
+
font-size: var(--shipaid-font-sm);
|
|
95
|
+
margin-top: 1rem;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.prompt-product-actions {
|
|
100
|
+
margin-left: auto;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
justify-content: space-between;
|
|
104
|
+
text-align: right;
|
|
105
|
+
|
|
106
|
+
.prompt-product-actions-price {
|
|
107
|
+
color: var(--shipaid-text-muted);
|
|
108
|
+
font-size: var(--shipaid-font-base);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.prompt-product-actions-button {
|
|
112
|
+
background-color: transparent;
|
|
113
|
+
border: none;
|
|
114
|
+
color: var(--shipaid-primary);
|
|
115
|
+
text-transform: uppercase;
|
|
116
|
+
font-weight: var(--shipaid-font-heavy);
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.prompt-footer {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: row;
|
|
125
|
+
justify-content: space-between;
|
|
126
|
+
align-items: center;
|
|
127
|
+
margin-top: 1rem;
|
|
128
|
+
|
|
129
|
+
.prompt-footer-about {
|
|
130
|
+
color: var(--shipaid-text-grey);
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
text-decoration: underline;
|
|
133
|
+
font-size: var(--shipaid-font-sm);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.prompt-footer-badge {
|
|
137
|
+
background-color: var(--shipaid-light-grey);
|
|
138
|
+
color: var(--shipaid-text);
|
|
139
|
+
padding: 0.5rem 1.5rem;
|
|
140
|
+
border-radius: 30px;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
text-decoration: none;
|
|
143
|
+
font-size: var(--shipaid-font-sm);
|
|
144
|
+
|
|
145
|
+
.ship {
|
|
146
|
+
text-transform: uppercase;
|
|
147
|
+
color: var(--shipaid-secondary);
|
|
148
|
+
font-weight: var(--shipaid-font-heavy);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.aid {
|
|
152
|
+
text-transform: uppercase;
|
|
153
|
+
color: var(--shipaid-text-grey);
|
|
154
|
+
font-weight: var(--shipaid-font-heavy);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
`,at=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,ht=(t,e,i,s)=>{for(var r,o=s>1?void 0:s?lt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(s?r(e,i,o):r(o))||o);return s&&o&&at(e,i,o),o},dt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(dt||{});const ct=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.")}};t.ShipAidWidget=class extends et{constructor(){var t;super(...arguments),this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._fetch={get:t=>ct(t),post:(t,e)=>ct(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t,e;((t,e)=>{ot(t,e,[]);
|
|
160
|
+
/**
|
|
161
|
+
* @license
|
|
162
|
+
* Copyright 2021 Google LLC
|
|
163
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
164
|
+
*/})(this,(async()=>{var t,e;const[i,s]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=i,this._cart=s;const r=null!=(e=null==(t=s.items)?void 0:t.some((t=>t.variant_id===i.productVariantNumericId)))&&e;this._hasProtectionInCart=r,this._hasFinishedSetup=!0,this._dispatchEvent("shipaid-loaded",i)})),ot(this,(()=>{var t,e,i,s;if(null==(t=this._cart)||!t.items)return;const r=null==(i=null==(e=this._cart)?void 0:e.items)?void 0:i.findIndex((t=>{var e;return t.variant_id===(null==(e=this._store)?void 0:e.productVariantNumericId)})),o=null==(s=this._cart)?void 0:s.items[r];this._hasProtectionInCart=!!o,o&&(this._protectionProduct=M(k({},o),{index:r,position:r+1}))}),[this._store,this._cart]);const i=I`
|
|
165
|
+
<div class="shipaid-prompt">
|
|
166
|
+
<p class="prompt-title">${this._hasProtectionInCart?"Active":"Inactive"}</p>
|
|
167
|
+
<div class="prompt-product">
|
|
168
|
+
<!-- <div class="prompt-product-image">
|
|
169
|
+
<img src="" alt="ShipAid logo" />
|
|
170
|
+
</div> -->
|
|
171
|
+
<div class="prompt-product-details">
|
|
172
|
+
<p class="prompt-product-details-title">Instant Package Protection</p>
|
|
173
|
+
<p class="prompt-product-details-description">Resolve shipping issues care-free</p>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="prompt-product-actions">
|
|
176
|
+
<p class="prompt-product-actions-price">${(t=>{var e,i,s,r,o;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:null!=(o=null==(r=null==(s=window.Shopify)?void 0:s.currency)?void 0:r.active)?o:"USD",style:"currency"}).format(t)})(null!=(e=null==(t=this._store)?void 0:t.productPrice)?e:0)}</p>
|
|
177
|
+
<button class="prompt-product-actions-button" @click=${this._updateProtection} ?disabled=${this._state.loading}>
|
|
178
|
+
${this._state.loading?"Loading...":this._hasProtectionInCart?"Remove":"+ Add"}
|
|
179
|
+
</button>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="prompt-footer">
|
|
183
|
+
<b class="prompt-footer-about" href="/">Learn More</b>
|
|
184
|
+
<a class="prompt-footer-badge" href="/">
|
|
185
|
+
<span>Powered by</span>
|
|
186
|
+
<span class="ship">Ship</span>
|
|
187
|
+
<span class="aid">Aid</span>
|
|
188
|
+
</a>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
`;return I`
|
|
192
|
+
${function(t,e,i){return t?e():null==i?void 0:i()}(this._hasFinishedSetup&&this._store,(()=>i),(()=>I`<p>Loading...</p>`))}
|
|
193
|
+
`}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}_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(){try{if(!this._storeDomain)throw new Error("Missing store domain - cannot continue.");const t={store:this._storeDomain},e="query StoreByDomain($store: String!) {\n store(store: $store) {\n store\n productId\n productVariantId\n productVariantNumericId\n productPrice\n }\n }",{data:i}=await this._fetch.post("http://localhost:1337/v1/graphql",{query:e,variables:t});if(!i.store)throw new Error(`Could not find a store for ${this._storeDomain}`);if(!i.store.productVariantNumericId)throw new Error("Missing variant ID for ShipAid product.");return i.store}catch(L){throw console.error(L),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(L){throw console.error(L),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async addProtection(){var t,e;try{if(null==(t=this._store)||!t.productVariantNumericId)throw new Error("Store has not been loaded.");if(null==(e=this._cart)||!e.items)throw new Error("Cart has not been loaded.");this._setState("loading");const i={id:this._store.productVariantNumericId,quantity:1},s=await this._fetch.post("/cart/add.js",i),r=M(k({},this._cart),{items:[s,...this._cart.items]});this._cart=r,this._setState("success"),this._dispatchEvent("shipaid-protection-status",{protection:!0,cart:r,lineItem:s})}catch(i){console.error(i),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){var t;try{if(null==(t=this._store)||!t.productVariantNumericId)throw new Error("Store has not been loaded.");if(!this._protectionProduct)throw new Error("Protection product not found.");this._setState("loading");const e={id:this._protectionProduct.key,quantity:0},i=await this._fetch.post("/cart/change.js",e);this._dispatchEvent("shipaid-protection-status",{protection:!1,cart:i,lineItem:this._protectionProduct}),this._cart=i,this._setState("success")}catch(e){console.error(e),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}},t.ShipAidWidget.styles=nt,ht([i()],t.ShipAidWidget.prototype,"_storeDomain",2),ht([i()],t.ShipAidWidget.prototype,"_store",2),ht([i()],t.ShipAidWidget.prototype,"_cart",2),ht([i()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),ht([i()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),ht([i()],t.ShipAidWidget.prototype,"_protectionProduct",2),ht([i()],t.ShipAidWidget.prototype,"_state",2),t.ShipAidWidget=ht([(t=>e=>{return"function"==typeof e?(i=t,s=e,window.customElements.define(i,s),s):((t,e)=>{const{kind:i,elements:s}=e;return{kind:i,elements:s,finisher(e){window.customElements.define(t,e)}}})(t,e);var i,s})("shipaid-widget")],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui.shipaid.com",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"main": "dist/ui.shipaid.com.
|
|
4
|
+
"version": "0.0.5",
|
|
5
|
+
"main": "dist/ui.shipaid.com.umd.js",
|
|
6
|
+
"unpkg": "dist/ui.shipaid.com.iife.js",
|
|
6
7
|
"module": "dist/ui.shipaid.com.es.js",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./dist/ui.shipaid.com.es.js"
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
"eslint-plugin-lit-a11y": "^2.2.0",
|
|
34
35
|
"eslint-plugin-node": "^11.1.0",
|
|
35
36
|
"eslint-plugin-promise": "^5.2.0",
|
|
37
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
36
38
|
"rollup-plugin-postcss-lit": "^2.0.0",
|
|
37
39
|
"sass": "^1.49.9",
|
|
38
40
|
"typescript": "^4.6.2",
|
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.shipaid-prompt{--shipaid-primary: #002bd6;--shipaid-secondary: #0076ff;--shipaid-text: #000000;--shipaid-text-muted: #cccccc;--shipaid-text-grey: #aaaaaa;--shipaid-light-grey: #ebecf0;--shipaid-font: "Lato", sans-serif;--shipaid-font-sm: 14px;--shipaid-font-base: 16px;--shipaid-font-lg: 18px;--shipaid-font-regular: 400;--shipaid-font-heavy: 700;width:400px;font-family:var(--shipaid-font);font-size:var(--shipaid-font-base);color:var(--shipaid-text);display:flex;flex-direction:column;gap:1rem;margin:2rem 0 2rem auto}.shipaid-prompt p,.shipaid-prompt a{margin:0;line-height:1}.shipaid-prompt .prompt-title{text-align:center;font-size:var(--shipaid-font-lg);font-weight:var(--shipaid-font-heavy)}.shipaid-prompt .prompt-product{display:flex;flex-direction:row;gap:2rem;height:55px;margin-top:1rem}.shipaid-prompt .prompt-product .prompt-product-details .prompt-product-details-title{font-size:var(--shipaid-font-base);font-weight:var(--shipaid-font-heavy)}.shipaid-prompt .prompt-product .prompt-product-details .prompt-product-details-description{font-size:var(--shipaid-font-sm);margin-top:1rem}.shipaid-prompt .prompt-product .prompt-product-actions{margin-left:auto;display:flex;flex-direction:column;justify-content:space-between;text-align:right}.shipaid-prompt .prompt-product .prompt-product-actions .prompt-product-actions-price{color:var(--shipaid-text-muted);font-size:var(--shipaid-font-base)}.shipaid-prompt .prompt-product .prompt-product-actions .prompt-product-actions-button{background-color:transparent;border:none;color:var(--shipaid-primary);text-transform:uppercase;font-weight:var(--shipaid-font-heavy);cursor:pointer}.shipaid-prompt .prompt-footer{display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-top:1rem}.shipaid-prompt .prompt-footer .prompt-footer-about{color:var(--shipaid-text-grey);cursor:pointer;text-decoration:underline;font-size:var(--shipaid-font-sm)}.shipaid-prompt .prompt-footer .prompt-footer-badge{background-color:var(--shipaid-light-grey);color:var(--shipaid-text);padding:.5rem 1.5rem;border-radius:30px;cursor:pointer;text-decoration:none;font-size:var(--shipaid-font-sm)}.shipaid-prompt .prompt-footer .prompt-footer-badge .ship{text-transform:uppercase;color:var(--shipaid-secondary);font-weight:var(--shipaid-font-heavy)}.shipaid-prompt .prompt-footer .prompt-footer-badge .aid{text-transform:uppercase;color:var(--shipaid-text-grey);font-weight:var(--shipaid-font-heavy)}
|