@blotoutio/providers-shop-gpt-sdk 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +562 -257
- package/index.js +562 -257
- package/index.mjs +562 -257
- package/package.json +1 -1
package/index.cjs.js
CHANGED
@@ -384,6 +384,7 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
|
|
384
384
|
message: data.message,
|
385
385
|
products: (_a = data.products) === null || _a === void 0 ? void 0 : _a.filter((item) => !!item).map((item) => ({ ...item, quantity: 1 })),
|
386
386
|
chatTitle: data.chatTitle,
|
387
|
+
welcomePrompts: data.welcomePrompts,
|
387
388
|
};
|
388
389
|
};
|
389
390
|
const fetchChatHistory = async (threadId) => {
|
@@ -576,58 +577,51 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
576
577
|
* Copyright 2019 Google LLC
|
577
578
|
* SPDX-License-Identifier: BSD-3-Clause
|
578
579
|
*/
|
579
|
-
const t$
|
580
|
+
const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$5=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$5=t=>new n$3("string"==typeof t?t:t+"",void 0,s$1),i$4=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$1)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t;
|
580
581
|
|
581
582
|
/**
|
582
583
|
* @license
|
583
584
|
* Copyright 2017 Google LLC
|
584
585
|
* SPDX-License-Identifier: BSD-3-Clause
|
585
|
-
*/const{is:i$3,defineProperty:e$
|
586
|
+
*/const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:r$4,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$4,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$3(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let b$1 = class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$6(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$4(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}};b$1.elementStyles=[],b$1.shadowRootOptions={mode:"open"},b$1[d$1("elementProperties")]=new Map,b$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b$1}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
|
586
587
|
|
587
588
|
/**
|
588
589
|
* @license
|
589
590
|
* Copyright 2017 Google LLC
|
590
591
|
* SPDX-License-Identifier: BSD-3-Clause
|
591
592
|
*/
|
592
|
-
const t$
|
593
|
+
const t$1=globalThis,i$2=t$1.trustedTypes,s=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$3="?"+h,n$1=`<${o$3}>`,r$3=document,l=()=>r$3.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$3.createTreeWalker(r$3,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$5+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$5)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$2?i$2.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$3)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$3.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$3).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$3,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$3.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.2.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
593
594
|
|
594
595
|
/**
|
595
596
|
* @license
|
596
597
|
* Copyright 2017 Google LLC
|
597
598
|
* SPDX-License-Identifier: BSD-3-Clause
|
598
|
-
*/let r$
|
599
|
+
*/let r$2 = class r extends b$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}};r$2._$litElement$=!0,r$2["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r$2});const i$1=globalThis.litElementPolyfillSupport;i$1?.({LitElement:r$2});(globalThis.litElementVersions??=[]).push("4.1.1");
|
599
600
|
|
600
601
|
/**
|
601
602
|
* @license
|
602
603
|
* Copyright 2017 Google LLC
|
603
604
|
* SPDX-License-Identifier: BSD-3-Clause
|
604
|
-
*/
|
605
|
-
const t$2=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
605
|
+
*/const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.P(o,void 0,t),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
606
606
|
|
607
607
|
/**
|
608
608
|
* @license
|
609
609
|
* Copyright 2017 Google LLC
|
610
610
|
* SPDX-License-Identifier: BSD-3-Clause
|
611
|
-
*/
|
612
|
-
|
613
|
-
/**
|
614
|
-
* @license
|
615
|
-
* Copyright 2017 Google LLC
|
616
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
617
|
-
*/function r$1(r){return n$1({...r,state:!0,attribute:!1})}
|
611
|
+
*/function r(r){return n({...r,state:!0,attribute:!1})}
|
618
612
|
|
619
613
|
/**
|
620
614
|
* @license
|
621
615
|
* Copyright 2017 Google LLC
|
622
616
|
* SPDX-License-Identifier: BSD-3-Clause
|
623
617
|
*/
|
624
|
-
const e$
|
618
|
+
const e$4=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
625
619
|
|
626
620
|
/**
|
627
621
|
* @license
|
628
622
|
* Copyright 2017 Google LLC
|
629
623
|
* SPDX-License-Identifier: BSD-3-Clause
|
630
|
-
*/function e$
|
624
|
+
*/function e$3(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}="object"==typeof s?n:i??(()=>{const t=Symbol();return {get(){return this[t]},set(e){this[t]=e;}}})();return e$4(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return e$4(n,s,{get(){return o(this)}})}}
|
631
625
|
|
632
626
|
const scrollBarStyles = i$4 `
|
633
627
|
::-webkit-scrollbar {
|
@@ -713,6 +707,35 @@ const shopGPTStyles = i$4 `
|
|
713
707
|
align-items: center;
|
714
708
|
box-shadow: 0 0 4px 1px #ffffff;
|
715
709
|
}
|
710
|
+
|
711
|
+
.chatbot-hover-text {
|
712
|
+
position: absolute;
|
713
|
+
color: #172a41;
|
714
|
+
padding: 8px;
|
715
|
+
white-space: nowrap;
|
716
|
+
font-size: 16px;
|
717
|
+
line-height: 21px;
|
718
|
+
opacity: 0;
|
719
|
+
transition: opacity 0.2s;
|
720
|
+
pointer-events: none;
|
721
|
+
|
722
|
+
top: calc(0% - 30%);
|
723
|
+
right: calc(100% + 5px);
|
724
|
+
|
725
|
+
border-radius: 5px 5px 0px;
|
726
|
+
background: #ffcc81;
|
727
|
+
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
728
|
+
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
729
|
+
|
730
|
+
font-weight: 400;
|
731
|
+
line-height: 150%;
|
732
|
+
}
|
733
|
+
|
734
|
+
&:hover {
|
735
|
+
.chatbot-hover-text {
|
736
|
+
opacity: 1;
|
737
|
+
}
|
738
|
+
}
|
716
739
|
}
|
717
740
|
|
718
741
|
.mobile-version {
|
@@ -760,13 +783,13 @@ const shopGPTStyles = i$4 `
|
|
760
783
|
* Copyright 2017 Google LLC
|
761
784
|
* SPDX-License-Identifier: BSD-3-Clause
|
762
785
|
*/
|
763
|
-
const t
|
786
|
+
const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$2=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
764
787
|
|
765
788
|
/**
|
766
789
|
* @license
|
767
790
|
* Copyright 2018 Google LLC
|
768
791
|
* SPDX-License-Identifier: BSD-3-Clause
|
769
|
-
*/const e$
|
792
|
+
*/const e$1=e$2(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return T}});
|
770
793
|
|
771
794
|
/**
|
772
795
|
* @license
|
@@ -921,11 +944,35 @@ const chatThreadsStyles = i$4 `
|
|
921
944
|
color: #677c95;
|
922
945
|
font-weight: 500;
|
923
946
|
text-transform: uppercase;
|
924
|
-
margin: 0
|
947
|
+
margin: 0;
|
925
948
|
max-height: 18px;
|
926
949
|
padding-left: 12px;
|
927
950
|
}
|
928
951
|
|
952
|
+
.trash-icon {
|
953
|
+
display: flex;
|
954
|
+
padding: 2px;
|
955
|
+
border-radius: 5px;
|
956
|
+
cursor: pointer;
|
957
|
+
align-items: center;
|
958
|
+
justify-content: center;
|
959
|
+
|
960
|
+
&:hover {
|
961
|
+
background: #dc3545;
|
962
|
+
|
963
|
+
path {
|
964
|
+
fill: white;
|
965
|
+
}
|
966
|
+
}
|
967
|
+
}
|
968
|
+
|
969
|
+
.title-wrapper {
|
970
|
+
display: flex;
|
971
|
+
justify-content: space-between;
|
972
|
+
align-items: center;
|
973
|
+
margin: 0 0 12px;
|
974
|
+
}
|
975
|
+
|
929
976
|
.threads {
|
930
977
|
flex: 1;
|
931
978
|
overflow-y: auto;
|
@@ -938,17 +985,6 @@ const chatThreadsStyles = i$4 `
|
|
938
985
|
|
939
986
|
.trash-icon {
|
940
987
|
display: none;
|
941
|
-
padding: 2px;
|
942
|
-
cursor: pointer;
|
943
|
-
|
944
|
-
&:hover {
|
945
|
-
border-radius: 5px;
|
946
|
-
background: #dc3545;
|
947
|
-
|
948
|
-
path {
|
949
|
-
fill: white;
|
950
|
-
}
|
951
|
-
}
|
952
988
|
}
|
953
989
|
|
954
990
|
&:hover {
|
@@ -997,13 +1033,11 @@ const chatThreadsStyles = i$4 `
|
|
997
1033
|
}
|
998
1034
|
`;
|
999
1035
|
|
1000
|
-
|
1001
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1002
|
-
class LoadSpinner extends r$3 {
|
1036
|
+
class LoadSpinner extends r$2 {
|
1003
1037
|
render() {
|
1004
1038
|
return x ` <div class="loader"><div class="spinner"></div></div> `;
|
1005
1039
|
}
|
1006
|
-
}
|
1040
|
+
}
|
1007
1041
|
LoadSpinner.styles = [
|
1008
1042
|
i$4 `
|
1009
1043
|
.loader {
|
@@ -1037,14 +1071,15 @@ LoadSpinner.styles = [
|
|
1037
1071
|
}
|
1038
1072
|
`,
|
1039
1073
|
];
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1074
|
+
if (!customElements.get('load-spinner')) {
|
1075
|
+
customElements.define('load-spinner', LoadSpinner);
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
class ChatThreads extends r$2 {
|
1079
|
+
constructor() {
|
1080
|
+
super(...arguments);
|
1081
|
+
this.deleteAllThreads = false;
|
1082
|
+
}
|
1048
1083
|
getDomain() {
|
1049
1084
|
var _a;
|
1050
1085
|
if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
|
@@ -1053,6 +1088,14 @@ class ChatThreads extends r$3 {
|
|
1053
1088
|
return `https://${this.merchantUrl}`;
|
1054
1089
|
}
|
1055
1090
|
handleThreadDelete() {
|
1091
|
+
if (this.deleteAllThreads) {
|
1092
|
+
this.dispatchEvent(new CustomEvent('delete-all-threads', {
|
1093
|
+
composed: true,
|
1094
|
+
bubbles: true,
|
1095
|
+
}));
|
1096
|
+
this.deleteAllThreads = false;
|
1097
|
+
return;
|
1098
|
+
}
|
1056
1099
|
if (!this.deleteThreadId) {
|
1057
1100
|
return;
|
1058
1101
|
}
|
@@ -1072,12 +1115,27 @@ class ChatThreads extends r$3 {
|
|
1072
1115
|
}
|
1073
1116
|
return x `
|
1074
1117
|
<div class="history">
|
1075
|
-
<
|
1118
|
+
<div class="title-wrapper">
|
1119
|
+
<p class="title">History</p>
|
1120
|
+
${this.chatThreads.size
|
1121
|
+
? x `<div
|
1122
|
+
class="trash-icon"
|
1123
|
+
@click=${() => {
|
1124
|
+
if (this.isLoading || this.isTyping) {
|
1125
|
+
return;
|
1126
|
+
}
|
1127
|
+
this.deleteAllThreads = true;
|
1128
|
+
}}
|
1129
|
+
>
|
1130
|
+
${trashIcon}
|
1131
|
+
</div>`
|
1132
|
+
: E}
|
1133
|
+
</div>
|
1076
1134
|
${this.chatThreads.size
|
1077
1135
|
? x `<div class="threads">
|
1078
1136
|
${o$1(this.chatThreads.values(), (thread) => x `
|
1079
1137
|
<div
|
1080
|
-
class=${e$
|
1138
|
+
class=${e$1({
|
1081
1139
|
'thread-wrapper': true,
|
1082
1140
|
active: this.selectedThreadId === thread.threadId,
|
1083
1141
|
disabled: this.isTyping,
|
@@ -1131,52 +1189,66 @@ class ChatThreads extends r$3 {
|
|
1131
1189
|
</a>
|
1132
1190
|
</div>`
|
1133
1191
|
: E}
|
1134
|
-
${this.deleteThreadId
|
1192
|
+
${this.deleteThreadId || this.deleteAllThreads
|
1135
1193
|
? x `
|
1136
1194
|
<confirm-dialog
|
1137
1195
|
@accept=${this.handleThreadDelete}
|
1138
|
-
@decline=${() =>
|
1196
|
+
@decline=${() => {
|
1197
|
+
this.deleteThreadId = '';
|
1198
|
+
this.deleteAllThreads = false;
|
1199
|
+
}}
|
1139
1200
|
>
|
1140
|
-
<h2 slot="title">
|
1201
|
+
<h2 slot="title">
|
1202
|
+
${this.deleteAllThreads
|
1203
|
+
? 'Delete Entire Chat History?'
|
1204
|
+
: 'Delete Chat?'}
|
1205
|
+
</h2>
|
1141
1206
|
<p slot="content">
|
1142
1207
|
This action cannot be undone. Are you sure you want to delete
|
1143
|
-
|
1208
|
+
${this.deleteAllThreads
|
1209
|
+
? ' the entire chat history'
|
1210
|
+
: x `<b
|
1211
|
+
>"${this.chatThreads.get(this.deleteThreadId).title}"</b
|
1212
|
+
>`}?
|
1144
1213
|
</p>
|
1145
1214
|
</confirm-dialog>
|
1146
1215
|
`
|
1147
1216
|
: E}
|
1148
1217
|
`;
|
1149
1218
|
}
|
1150
|
-
}
|
1219
|
+
}
|
1151
1220
|
ChatThreads.styles = [chatThreadsStyles];
|
1152
1221
|
__decorate([
|
1153
|
-
n
|
1222
|
+
n({ type: Object }),
|
1154
1223
|
__metadata("design:type", Map)
|
1155
1224
|
], ChatThreads.prototype, "chatThreads", void 0);
|
1156
1225
|
__decorate([
|
1157
|
-
n
|
1226
|
+
n({ type: String }),
|
1158
1227
|
__metadata("design:type", Object)
|
1159
1228
|
], ChatThreads.prototype, "merchantUrl", void 0);
|
1160
1229
|
__decorate([
|
1161
|
-
n
|
1230
|
+
n({ type: Boolean }),
|
1162
1231
|
__metadata("design:type", Boolean)
|
1163
1232
|
], ChatThreads.prototype, "isLoading", void 0);
|
1164
1233
|
__decorate([
|
1165
|
-
n
|
1234
|
+
n({ type: Boolean }),
|
1166
1235
|
__metadata("design:type", Boolean)
|
1167
1236
|
], ChatThreads.prototype, "isTyping", void 0);
|
1168
1237
|
__decorate([
|
1169
|
-
n
|
1238
|
+
n({ type: String }),
|
1170
1239
|
__metadata("design:type", String)
|
1171
1240
|
], ChatThreads.prototype, "selectedThreadId", void 0);
|
1172
1241
|
__decorate([
|
1173
|
-
r
|
1242
|
+
r(),
|
1174
1243
|
__metadata("design:type", String)
|
1175
1244
|
], ChatThreads.prototype, "deleteThreadId", void 0);
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
], ChatThreads);
|
1245
|
+
__decorate([
|
1246
|
+
r(),
|
1247
|
+
__metadata("design:type", Object)
|
1248
|
+
], ChatThreads.prototype, "deleteAllThreads", void 0);
|
1249
|
+
if (!customElements.get('chat-threads')) {
|
1250
|
+
customElements.define('chat-threads', ChatThreads);
|
1251
|
+
}
|
1180
1252
|
|
1181
1253
|
const productsSectionStyles = i$4 `
|
1182
1254
|
:host {
|
@@ -1364,9 +1436,7 @@ const productItemStyles = i$4 `
|
|
1364
1436
|
}
|
1365
1437
|
`;
|
1366
1438
|
|
1367
|
-
|
1368
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1369
|
-
class ProductItem extends r$3 {
|
1439
|
+
class ProductItem extends r$2 {
|
1370
1440
|
getLocalPrice(price) {
|
1371
1441
|
if (!this.siteCurrency) {
|
1372
1442
|
return price;
|
@@ -1374,6 +1444,16 @@ class ProductItem extends r$3 {
|
|
1374
1444
|
const localPrice = parseFloat(price) * this.siteCurrency.rate;
|
1375
1445
|
return formatMoney(localPrice, this.siteCurrency.currency);
|
1376
1446
|
}
|
1447
|
+
getComparedAtPrice(comparedAtPrice, price) {
|
1448
|
+
if (!comparedAtPrice ||
|
1449
|
+
comparedAtPrice === price ||
|
1450
|
+
parseFloat(comparedAtPrice) <= parseFloat(price)) {
|
1451
|
+
return E;
|
1452
|
+
}
|
1453
|
+
return x `<p class="price-compared">
|
1454
|
+
${this.getLocalPrice(comparedAtPrice)}
|
1455
|
+
</p>`;
|
1456
|
+
}
|
1377
1457
|
redirect(url) {
|
1378
1458
|
var _a;
|
1379
1459
|
if (!url) {
|
@@ -1407,13 +1487,7 @@ class ProductItem extends r$3 {
|
|
1407
1487
|
</p>
|
1408
1488
|
${this.renderVariantTitles()}
|
1409
1489
|
<div class="prices">
|
1410
|
-
${this.product.variants[0].comparedAtPrice
|
1411
|
-
this.product.variants[0].comparedAtPrice !==
|
1412
|
-
this.product.variants[0].price
|
1413
|
-
? x `<p class="price-compared">
|
1414
|
-
${this.getLocalPrice(this.product.variants[0].comparedAtPrice)}
|
1415
|
-
</p>`
|
1416
|
-
: E}
|
1490
|
+
${this.getComparedAtPrice(this.product.variants[0].comparedAtPrice, this.product.variants[0].price)}
|
1417
1491
|
<p>${this.getLocalPrice(this.product.variants[0].price)}</p>
|
1418
1492
|
</div>
|
1419
1493
|
<button
|
@@ -1426,20 +1500,19 @@ class ProductItem extends r$3 {
|
|
1426
1500
|
</div>
|
1427
1501
|
`;
|
1428
1502
|
}
|
1429
|
-
}
|
1503
|
+
}
|
1430
1504
|
ProductItem.styles = [productItemStyles];
|
1431
1505
|
__decorate([
|
1432
|
-
n
|
1506
|
+
n({ type: Object }),
|
1433
1507
|
__metadata("design:type", Object)
|
1434
1508
|
], ProductItem.prototype, "product", void 0);
|
1435
1509
|
__decorate([
|
1436
|
-
n
|
1510
|
+
n({ type: Object }),
|
1437
1511
|
__metadata("design:type", Object)
|
1438
1512
|
], ProductItem.prototype, "siteCurrency", void 0);
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
], ProductItem);
|
1513
|
+
if (!customElements.get('product-item')) {
|
1514
|
+
customElements.define('product-item', ProductItem);
|
1515
|
+
}
|
1443
1516
|
|
1444
1517
|
const productsListStyles = i$4 `
|
1445
1518
|
.products::-webkit-scrollbar {
|
@@ -1467,6 +1540,8 @@ const productsListStyles = i$4 `
|
|
1467
1540
|
gap: 24px;
|
1468
1541
|
overflow-x: auto;
|
1469
1542
|
scrollbar-width: none;
|
1543
|
+
margin-left: -10px;
|
1544
|
+
padding-left: 10px;
|
1470
1545
|
}
|
1471
1546
|
|
1472
1547
|
.scroll-btns {
|
@@ -1501,9 +1576,7 @@ const productsListStyles = i$4 `
|
|
1501
1576
|
}
|
1502
1577
|
`;
|
1503
1578
|
|
1504
|
-
|
1505
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1506
|
-
class ProductsList extends r$3 {
|
1579
|
+
class ProductsList extends r$2 {
|
1507
1580
|
constructor() {
|
1508
1581
|
super(...arguments);
|
1509
1582
|
this.showButtons = true;
|
@@ -1551,7 +1624,7 @@ class ProductsList extends r$3 {
|
|
1551
1624
|
<div class="products" @scroll=${this.updateButtonsState}>
|
1552
1625
|
${o$1(this.products, (product) => x `
|
1553
1626
|
<div
|
1554
|
-
class=${e$
|
1627
|
+
class=${e$1({
|
1555
1628
|
'product-container': true,
|
1556
1629
|
modal: this.viewType === 'modal',
|
1557
1630
|
})}
|
@@ -1576,40 +1649,37 @@ class ProductsList extends r$3 {
|
|
1576
1649
|
</div>
|
1577
1650
|
`;
|
1578
1651
|
}
|
1579
|
-
}
|
1652
|
+
}
|
1580
1653
|
ProductsList.styles = [productsListStyles];
|
1581
1654
|
__decorate([
|
1582
|
-
n
|
1655
|
+
n({ type: Array }),
|
1583
1656
|
__metadata("design:type", Array)
|
1584
1657
|
], ProductsList.prototype, "products", void 0);
|
1585
1658
|
__decorate([
|
1586
|
-
n
|
1659
|
+
n({ type: Object }),
|
1587
1660
|
__metadata("design:type", Object)
|
1588
1661
|
], ProductsList.prototype, "siteCurrency", void 0);
|
1589
1662
|
__decorate([
|
1590
|
-
r
|
1663
|
+
r(),
|
1591
1664
|
__metadata("design:type", Object)
|
1592
1665
|
], ProductsList.prototype, "showButtons", void 0);
|
1593
1666
|
__decorate([
|
1594
|
-
e$
|
1667
|
+
e$3('.left-btn'),
|
1595
1668
|
__metadata("design:type", Object)
|
1596
1669
|
], ProductsList.prototype, "leftBtnEle", void 0);
|
1597
1670
|
__decorate([
|
1598
|
-
e$
|
1671
|
+
e$3('.right-btn'),
|
1599
1672
|
__metadata("design:type", Object)
|
1600
1673
|
], ProductsList.prototype, "rightBtnEle", void 0);
|
1601
1674
|
__decorate([
|
1602
|
-
e$
|
1675
|
+
e$3('.products'),
|
1603
1676
|
__metadata("design:type", Object)
|
1604
1677
|
], ProductsList.prototype, "productsEle", void 0);
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
let ProductsSection =
|
1611
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1612
|
-
class ProductsSection extends r$3 {
|
1678
|
+
if (!customElements.get('products-list')) {
|
1679
|
+
customElements.define('products-list', ProductsList);
|
1680
|
+
}
|
1681
|
+
|
1682
|
+
class ProductsSection extends r$2 {
|
1613
1683
|
connectedCallback() {
|
1614
1684
|
super.connectedCallback();
|
1615
1685
|
}
|
@@ -1625,7 +1695,7 @@ class ProductsSection extends r$3 {
|
|
1625
1695
|
`;
|
1626
1696
|
}
|
1627
1697
|
render() {
|
1628
|
-
if (this.isLoadingHistory) {
|
1698
|
+
if (this.isLoadingHistory || this.isLoadingThreads) {
|
1629
1699
|
return x ` <load-spinner></load-spinner> `;
|
1630
1700
|
}
|
1631
1701
|
if (!this.products.length) {
|
@@ -1654,40 +1724,43 @@ class ProductsSection extends r$3 {
|
|
1654
1724
|
</div>
|
1655
1725
|
`;
|
1656
1726
|
}
|
1657
|
-
}
|
1727
|
+
}
|
1658
1728
|
ProductsSection.styles = [productsSectionStyles];
|
1659
1729
|
__decorate([
|
1660
|
-
n
|
1730
|
+
n({ type: String }),
|
1661
1731
|
__metadata("design:type", Object)
|
1662
1732
|
], ProductsSection.prototype, "merchantImage", void 0);
|
1663
1733
|
__decorate([
|
1664
|
-
n
|
1734
|
+
n({ type: Array }),
|
1665
1735
|
__metadata("design:type", Array)
|
1666
1736
|
], ProductsSection.prototype, "products", void 0);
|
1667
1737
|
__decorate([
|
1668
|
-
n
|
1738
|
+
n({ type: Boolean }),
|
1669
1739
|
__metadata("design:type", Boolean)
|
1670
1740
|
], ProductsSection.prototype, "isLoadingHistory", void 0);
|
1671
1741
|
__decorate([
|
1672
|
-
n
|
1742
|
+
n({ type: Object }),
|
1673
1743
|
__metadata("design:type", Object)
|
1674
1744
|
], ProductsSection.prototype, "siteCurrency", void 0);
|
1675
1745
|
__decorate([
|
1676
|
-
|
1746
|
+
n({ type: Boolean }),
|
1747
|
+
__metadata("design:type", Boolean)
|
1748
|
+
], ProductsSection.prototype, "isLoadingThreads", void 0);
|
1749
|
+
__decorate([
|
1750
|
+
e$3('.left-btn'),
|
1677
1751
|
__metadata("design:type", Object)
|
1678
1752
|
], ProductsSection.prototype, "leftBtnEle", void 0);
|
1679
1753
|
__decorate([
|
1680
|
-
e$
|
1754
|
+
e$3('.right-btn'),
|
1681
1755
|
__metadata("design:type", Object)
|
1682
1756
|
], ProductsSection.prototype, "rightBtnEle", void 0);
|
1683
1757
|
__decorate([
|
1684
|
-
e$
|
1758
|
+
e$3('.products'),
|
1685
1759
|
__metadata("design:type", Object)
|
1686
1760
|
], ProductsSection.prototype, "productsEle", void 0);
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
], ProductsSection);
|
1761
|
+
if (!customElements.get('products-section')) {
|
1762
|
+
customElements.define('products-section', ProductsSection);
|
1763
|
+
}
|
1691
1764
|
|
1692
1765
|
const chatSectionStyles = i$4 `
|
1693
1766
|
:host {
|
@@ -1867,6 +1940,20 @@ const chatSectionStyles = i$4 `
|
|
1867
1940
|
gap: 28px;
|
1868
1941
|
padding-bottom: 10px;
|
1869
1942
|
margin-bottom: -10px;
|
1943
|
+
margin-right: -10px;
|
1944
|
+
padding-right: 10px;
|
1945
|
+
margin-left: -10px;
|
1946
|
+
padding-left: 10px;
|
1947
|
+
background: linear-gradient(#f7f8fa80, #f7f8fa80),
|
1948
|
+
var(--shopgpt-merchant-img-url);
|
1949
|
+
background-position: center;
|
1950
|
+
background-repeat: no-repeat;
|
1951
|
+
background-size: contain;
|
1952
|
+
|
1953
|
+
&.loading {
|
1954
|
+
justify-content: center;
|
1955
|
+
align-items: center;
|
1956
|
+
}
|
1870
1957
|
|
1871
1958
|
.message:last-child {
|
1872
1959
|
margin-top: 10px;
|
@@ -2037,7 +2124,7 @@ const chatSectionStyles = i$4 `
|
|
2037
2124
|
.prompts {
|
2038
2125
|
display: flex;
|
2039
2126
|
justify-content: center;
|
2040
|
-
gap:
|
2127
|
+
gap: 10px;
|
2041
2128
|
flex-wrap: wrap;
|
2042
2129
|
|
2043
2130
|
.prompt {
|
@@ -2073,13 +2160,19 @@ const chatSectionStyles = i$4 `
|
|
2073
2160
|
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
2074
2161
|
border-radius: 0px 0px 10px 10px;
|
2075
2162
|
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
2080
|
-
font-weight: 700;
|
2081
|
-
line-height: 20px;
|
2163
|
+
.title-wrapper {
|
2164
|
+
display: flex;
|
2165
|
+
justify-content: space-between;
|
2166
|
+
align-items: center;
|
2082
2167
|
border-bottom: 1px solid #dbe2eb;
|
2168
|
+
padding: 10px 16px;
|
2169
|
+
|
2170
|
+
h2 {
|
2171
|
+
color: #172a41;
|
2172
|
+
font-size: 16px;
|
2173
|
+
font-weight: 700;
|
2174
|
+
line-height: 20px;
|
2175
|
+
}
|
2083
2176
|
}
|
2084
2177
|
|
2085
2178
|
.thread-titles-wrapper {
|
@@ -2401,9 +2494,7 @@ const profilePlusIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="56" he
|
|
2401
2494
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M21 7C22.7306 7 24.4223 7.51318 25.8612 8.47464C27.3002 9.4361 28.4217 10.8027 29.084 12.4015C29.7462 14.0004 29.9195 15.7597 29.5819 17.457C29.2443 19.1544 28.4109 20.7135 27.1872 21.9372C25.9635 23.1609 24.4044 23.9942 22.707 24.3319C21.0097 24.6695 19.2504 24.4962 17.6515 23.8339C16.0527 23.1717 14.6861 22.0502 13.7246 20.6112C12.7632 19.1723 12.25 17.4806 12.25 15.75C12.25 13.4294 13.1719 11.2038 14.8128 9.56282C16.4538 7.92187 18.6794 7 21 7ZM21 3.5C18.5772 3.5 16.2088 4.21845 14.1943 5.5645C12.1798 6.91054 10.6097 8.82373 9.68248 11.0621C8.75531 13.3005 8.51272 15.7636 8.98539 18.1399C9.45805 20.5161 10.6248 22.6989 12.3379 24.4121C14.0511 26.1252 16.2339 27.2919 18.6101 27.7646C20.9864 28.2373 23.4495 27.9947 25.6879 27.0675C27.9263 26.1403 29.8395 24.5702 31.1855 22.5557C32.5316 20.5412 33.25 18.1728 33.25 15.75C33.25 12.5011 31.9594 9.38526 29.6621 7.08794C27.3647 4.79062 24.2489 3.5 21 3.5ZM56 24.5H49V17.5H45.5V24.5H38.5V28H45.5V35H49V28H56V24.5ZM35 52.5H38.5V43.75C38.5 40.5011 37.2094 37.3853 34.9121 35.0879C32.6147 32.7906 29.4989 31.5 26.25 31.5H15.75C12.5011 31.5 9.38526 32.7906 7.08794 35.0879C4.79062 37.3853 3.5 40.5011 3.5 43.75V52.5H7V43.75C7 41.4294 7.92187 39.2038 9.56282 37.5628C11.2038 35.9219 13.4294 35 15.75 35H26.25C28.5706 35 30.7962 35.9219 32.4372 37.5628C34.0781 39.2038 35 41.4294 35 43.75V52.5Z" fill="#172A41"/>
|
2402
2495
|
</svg>`;
|
2403
2496
|
|
2404
|
-
|
2405
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2406
|
-
class PersonalizeDialog extends r$3 {
|
2497
|
+
class PersonalizeDialog extends r$2 {
|
2407
2498
|
constructor() {
|
2408
2499
|
super(...arguments);
|
2409
2500
|
this.isLoading = false;
|
@@ -2646,74 +2737,173 @@ class PersonalizeDialog extends r$3 {
|
|
2646
2737
|
</dialog>
|
2647
2738
|
`;
|
2648
2739
|
}
|
2649
|
-
}
|
2740
|
+
}
|
2650
2741
|
PersonalizeDialog.styles = [personalizeDialogStyles];
|
2651
2742
|
__decorate([
|
2652
|
-
e$
|
2743
|
+
e$3('dialog'),
|
2653
2744
|
__metadata("design:type", HTMLDialogElement)
|
2654
2745
|
], PersonalizeDialog.prototype, "dialogModal", void 0);
|
2655
2746
|
__decorate([
|
2656
|
-
e$
|
2747
|
+
e$3('.dropdown-list'),
|
2657
2748
|
__metadata("design:type", HTMLUListElement)
|
2658
2749
|
], PersonalizeDialog.prototype, "dropdownList", void 0);
|
2659
2750
|
__decorate([
|
2660
|
-
e$
|
2751
|
+
e$3('.dropdown-trigger'),
|
2661
2752
|
__metadata("design:type", HTMLDivElement)
|
2662
2753
|
], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
|
2663
2754
|
__decorate([
|
2664
|
-
n
|
2755
|
+
n({ type: Array }),
|
2665
2756
|
__metadata("design:type", Array)
|
2666
2757
|
], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
|
2667
2758
|
__decorate([
|
2668
|
-
n
|
2759
|
+
n({ type: Array }),
|
2669
2760
|
__metadata("design:type", Array)
|
2670
2761
|
], PersonalizeDialog.prototype, "defaultProfiles", void 0);
|
2671
2762
|
__decorate([
|
2672
|
-
n
|
2763
|
+
n({ type: Boolean }),
|
2673
2764
|
__metadata("design:type", Object)
|
2674
2765
|
], PersonalizeDialog.prototype, "isLoading", void 0);
|
2675
2766
|
__decorate([
|
2676
|
-
n
|
2767
|
+
n({ type: String }),
|
2677
2768
|
__metadata("design:type", Object)
|
2678
2769
|
], PersonalizeDialog.prototype, "state", void 0);
|
2679
2770
|
__decorate([
|
2680
|
-
n
|
2771
|
+
n({ type: String }),
|
2681
2772
|
__metadata("design:type", Object)
|
2682
2773
|
], PersonalizeDialog.prototype, "profileType", void 0);
|
2683
2774
|
__decorate([
|
2684
|
-
n
|
2775
|
+
n({ type: String }),
|
2685
2776
|
__metadata("design:type", Object)
|
2686
2777
|
], PersonalizeDialog.prototype, "selectedProfile", void 0);
|
2687
2778
|
__decorate([
|
2688
|
-
n
|
2779
|
+
n({ type: String }),
|
2689
2780
|
__metadata("design:type", Object)
|
2690
2781
|
], PersonalizeDialog.prototype, "visitorType", void 0);
|
2691
2782
|
__decorate([
|
2692
|
-
n
|
2783
|
+
n({ type: String }),
|
2693
2784
|
__metadata("design:type", Object)
|
2694
2785
|
], PersonalizeDialog.prototype, "productHandle", void 0);
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
], PersonalizeDialog);
|
2786
|
+
if (!customElements.get('personalize-dialog')) {
|
2787
|
+
customElements.define('personalize-dialog', PersonalizeDialog);
|
2788
|
+
}
|
2699
2789
|
|
2700
2790
|
/**
|
2701
2791
|
* @license
|
2702
2792
|
* Copyright 2017 Google LLC
|
2703
2793
|
* SPDX-License-Identifier: BSD-3-Clause
|
2704
|
-
*/
|
2705
|
-
|
2706
|
-
|
2794
|
+
*/class e extends i{constructor(i){if(super(i),this.it=E,i.type!==t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===E||null==r)return this._t=void 0,this.it=r;if(r===T)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o=e$2(e);
|
2795
|
+
|
2796
|
+
const markdown = (text) => {
|
2797
|
+
let src = text;
|
2798
|
+
const rx_space = /\t|\r|\uf8ff/g;
|
2799
|
+
const rx_hr = /^([*\-=_] *){3,}$/gm;
|
2800
|
+
const rx_blockquote = /\n *> *([^]*?)(?=(\n|$){2})/g;
|
2801
|
+
const rx_list = /\n( *)(?:[*\-+]|((\d+)|([a-z])|[A-Z])[.)]) +([^]*?)(?=(\n|$){2})/g;
|
2802
|
+
const rx_listjoin = /<\/(ol|ul)>\n\n<\1>/g;
|
2803
|
+
const rx_highlight = /(^|[^A-Za-z\d\\])(([*_])|(~)|(\^)|(--)|(\+\+)|`)(\2?)([^<]*?)\2\8(?!\2)(?=\W|_|$)/g;
|
2804
|
+
const rx_code = /\n((```|~~~).*\n?([^]*?)\n?\2|(( {4}.*?\n)+))/g;
|
2805
|
+
const rx_link = /((!?)\[(.*?)\]\((.*?)( ".*")?\)|\\([\\`*_{}[\]()#+\-.!~]))/g;
|
2806
|
+
const rx_table = /\n(( *\|.*?\| *\n)+)/g;
|
2807
|
+
const rx_thead = /^.*\n( *\|( *:?-+:?-+:? *\|)* *\n|)/;
|
2808
|
+
const rx_row = /.*\n/g;
|
2809
|
+
const rx_cell = /\|(.*?[^\\])\|/g;
|
2810
|
+
const rx_heading = /(?=^|>|\n)([>\s]*?)(#{1,6}) (.*?)( #*)? *(?=\n|$)/g;
|
2811
|
+
const rx_para = /(?=^|>|\n)\s*\n+([^<]+?)\n+\s*(?=\n|<|$)/g;
|
2812
|
+
const rx_stash = /-\d+\uf8ff/g;
|
2813
|
+
const stash = {};
|
2814
|
+
let si = 0;
|
2815
|
+
function replace(rex, fn) {
|
2816
|
+
src = src.replace(rex, fn);
|
2817
|
+
}
|
2818
|
+
function element(tag, content) {
|
2819
|
+
return `<${tag}>${content}</${tag}>`;
|
2820
|
+
}
|
2821
|
+
function blockquote(src) {
|
2822
|
+
return src.replace(rx_blockquote, (_, content) => {
|
2823
|
+
return element('blockquote', blockquote(highlight(content.replace(/^ *> */gm, ''))));
|
2824
|
+
});
|
2825
|
+
}
|
2826
|
+
function list(src) {
|
2827
|
+
return src.replace(rx_list, (all, ind, ol, num, low, content) => {
|
2828
|
+
const entry = element('li', highlight(content
|
2829
|
+
.split(new RegExp(`\n ?${ind}(?:(?:\\d+|[a-zA-Z])[.)]|[*\\-+]) +`, 'g'))
|
2830
|
+
.map(list)
|
2831
|
+
.join('</li><li>')));
|
2832
|
+
return `\n${ol
|
2833
|
+
? `<ol start="${num
|
2834
|
+
? ol + '">'
|
2835
|
+
: `${parseInt(ol, 36) - 9}" style="list-style-type:${low ? 'low' : 'upp'}er-alpha">`}${entry}</ol>`
|
2836
|
+
: element('ul', entry)}`;
|
2837
|
+
});
|
2838
|
+
}
|
2839
|
+
function highlight(src) {
|
2840
|
+
return src.replace(rx_highlight, function (all, _, p1, emp, sub, sup, small, big, p2, content) {
|
2841
|
+
return (_ +
|
2842
|
+
element(emp
|
2843
|
+
? p2
|
2844
|
+
? 'strong'
|
2845
|
+
: 'em'
|
2846
|
+
: sub
|
2847
|
+
? p2
|
2848
|
+
? 's'
|
2849
|
+
: 'sub'
|
2850
|
+
: sup
|
2851
|
+
? 'sup'
|
2852
|
+
: small
|
2853
|
+
? 'small'
|
2854
|
+
: big
|
2855
|
+
? 'big'
|
2856
|
+
: 'code', highlight(content)));
|
2857
|
+
});
|
2858
|
+
}
|
2859
|
+
src = `\n${src}\n`;
|
2860
|
+
replace(rx_space, ' ');
|
2861
|
+
src = blockquote(src);
|
2862
|
+
replace(rx_hr, '<hr/>');
|
2863
|
+
src = list(src);
|
2864
|
+
replace(rx_listjoin, '');
|
2865
|
+
replace(rx_code, (_, p1, p2, p3, p4) => {
|
2866
|
+
stash[--si] = element('pre', element('code', p3 || p4.replace(/^ {4}/gm, '')));
|
2867
|
+
return `${si}\uf8ff`;
|
2868
|
+
});
|
2869
|
+
replace(rx_link, (_, p1, p2, p3, p4, p5, p6) => {
|
2870
|
+
stash[--si] = p4
|
2871
|
+
? p2
|
2872
|
+
? `<img src="${p4}" alt="${p3}"/>`
|
2873
|
+
: `<a href="${p4}">${highlight(p3)}</a>`
|
2874
|
+
: p6;
|
2875
|
+
return `${si}\uf8ff`;
|
2876
|
+
});
|
2877
|
+
replace(rx_table, (_, table) => {
|
2878
|
+
var _a;
|
2879
|
+
const sep = ((_a = table.match(rx_thead)) === null || _a === void 0 ? void 0 : _a[1]) || '';
|
2880
|
+
return `\n${element('table', table.replace(rx_row, (row, ri) => {
|
2881
|
+
return row === sep
|
2882
|
+
? ''
|
2883
|
+
: element('tr', row.replace(rx_cell, (_, cell, ci) => ci
|
2884
|
+
? element(sep && !ri ? 'th' : 'td', highlight(cell || ''))
|
2885
|
+
: ''));
|
2886
|
+
}))}`;
|
2887
|
+
});
|
2888
|
+
replace(rx_heading, (_, prefix, p1, p2) => {
|
2889
|
+
return prefix + element(`h${p1.length}`, highlight(p2));
|
2890
|
+
});
|
2891
|
+
replace(rx_para, (_, content) => {
|
2892
|
+
return element('p', highlight(content));
|
2893
|
+
});
|
2894
|
+
replace(rx_stash, (all) => stash[parseInt(all)]);
|
2895
|
+
return src.trim();
|
2896
|
+
};
|
2707
2897
|
|
2708
|
-
|
2709
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2710
|
-
class MarkdownRenderer extends r$3 {
|
2898
|
+
class MarkdownRenderer extends r$2 {
|
2711
2899
|
render() {
|
2712
|
-
|
2713
|
-
const
|
2714
|
-
|
2900
|
+
// Remove lit markers from slot content
|
2901
|
+
const slotContent = this.innerHTML
|
2902
|
+
.trim()
|
2903
|
+
.replace(/<!--\?lit\$[\d$]+-->/g, '');
|
2904
|
+
return o(markdown(slotContent));
|
2715
2905
|
}
|
2716
|
-
}
|
2906
|
+
}
|
2717
2907
|
MarkdownRenderer.styles = i$4 `
|
2718
2908
|
:host {
|
2719
2909
|
font-family: 'Inter', sans-serif;
|
@@ -2725,14 +2915,11 @@ MarkdownRenderer.styles = i$4 `
|
|
2725
2915
|
}
|
2726
2916
|
}
|
2727
2917
|
`;
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
let TooltipComponent =
|
2734
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2735
|
-
class TooltipComponent extends r$3 {
|
2918
|
+
if (!customElements.get('markdown-renderer')) {
|
2919
|
+
customElements.define('markdown-renderer', MarkdownRenderer);
|
2920
|
+
}
|
2921
|
+
|
2922
|
+
class TooltipComponent extends r$2 {
|
2736
2923
|
constructor() {
|
2737
2924
|
super(...arguments);
|
2738
2925
|
this.position = 'bottom-left';
|
@@ -2744,7 +2931,7 @@ class TooltipComponent extends r$3 {
|
|
2744
2931
|
<div class="tooltip ${this.position}">${this.text}</div>
|
2745
2932
|
`;
|
2746
2933
|
}
|
2747
|
-
}
|
2934
|
+
}
|
2748
2935
|
TooltipComponent.styles = [
|
2749
2936
|
i$4 `
|
2750
2937
|
:host {
|
@@ -2756,7 +2943,6 @@ TooltipComponent.styles = [
|
|
2756
2943
|
position: absolute;
|
2757
2944
|
color: #172a41;
|
2758
2945
|
padding: 4px 8px;
|
2759
|
-
border-radius: 4px;
|
2760
2946
|
white-space: nowrap;
|
2761
2947
|
font-size: 12px;
|
2762
2948
|
opacity: 0;
|
@@ -2843,17 +3029,16 @@ TooltipComponent.styles = [
|
|
2843
3029
|
`,
|
2844
3030
|
];
|
2845
3031
|
__decorate([
|
2846
|
-
n
|
3032
|
+
n({ type: String }),
|
2847
3033
|
__metadata("design:type", String)
|
2848
3034
|
], TooltipComponent.prototype, "position", void 0);
|
2849
3035
|
__decorate([
|
2850
|
-
n
|
3036
|
+
n({ type: String }),
|
2851
3037
|
__metadata("design:type", Object)
|
2852
3038
|
], TooltipComponent.prototype, "text", void 0);
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
], TooltipComponent);
|
3039
|
+
if (!customElements.get('tooltip-component')) {
|
3040
|
+
customElements.define('tooltip-component', TooltipComponent);
|
3041
|
+
}
|
2857
3042
|
|
2858
3043
|
const confirmDialogStyles = i$4 `
|
2859
3044
|
:host {
|
@@ -2934,9 +3119,7 @@ const confirmDialogStyles = i$4 `
|
|
2934
3119
|
}
|
2935
3120
|
`;
|
2936
3121
|
|
2937
|
-
|
2938
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2939
|
-
class ConfirmDialog extends r$3 {
|
3122
|
+
class ConfirmDialog extends r$2 {
|
2940
3123
|
onAcceptClick(e) {
|
2941
3124
|
e.preventDefault();
|
2942
3125
|
this.dispatchEvent(new CustomEvent('accept', {
|
@@ -2969,19 +3152,17 @@ class ConfirmDialog extends r$3 {
|
|
2969
3152
|
</div>
|
2970
3153
|
`;
|
2971
3154
|
}
|
2972
|
-
}
|
3155
|
+
}
|
2973
3156
|
ConfirmDialog.styles = [confirmDialogStyles];
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
2978
|
-
|
2979
|
-
let ChatSection =
|
2980
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2981
|
-
class ChatSection extends r$3 {
|
3157
|
+
if (!customElements.get('confirm-dialog')) {
|
3158
|
+
customElements.define('confirm-dialog', ConfirmDialog);
|
3159
|
+
}
|
3160
|
+
|
3161
|
+
class ChatSection extends r$2 {
|
2982
3162
|
constructor() {
|
2983
3163
|
super(...arguments);
|
2984
3164
|
this.showChatThreads = false;
|
3165
|
+
this.deleteAllThreads = false;
|
2985
3166
|
this.userQuery = '';
|
2986
3167
|
}
|
2987
3168
|
scrollToBottom() {
|
@@ -3006,6 +3187,14 @@ class ChatSection extends r$3 {
|
|
3006
3187
|
await this.processMessage(e, message);
|
3007
3188
|
}
|
3008
3189
|
handleThreadDelete() {
|
3190
|
+
if (this.deleteAllThreads) {
|
3191
|
+
this.dispatchEvent(new CustomEvent('delete-all-threads', {
|
3192
|
+
composed: true,
|
3193
|
+
bubbles: true,
|
3194
|
+
}));
|
3195
|
+
this.deleteAllThreads = false;
|
3196
|
+
return;
|
3197
|
+
}
|
3009
3198
|
if (!this.deleteThreadId) {
|
3010
3199
|
return;
|
3011
3200
|
}
|
@@ -3059,8 +3248,10 @@ class ChatSection extends r$3 {
|
|
3059
3248
|
`;
|
3060
3249
|
}
|
3061
3250
|
chatWindow() {
|
3062
|
-
if (this.isLoadingHistory) {
|
3063
|
-
return x
|
3251
|
+
if (this.isLoadingHistory || this.isLoadingThreads) {
|
3252
|
+
return x `<div class="messages loading">
|
3253
|
+
<load-spinner></load-spinner>
|
3254
|
+
</div>`;
|
3064
3255
|
}
|
3065
3256
|
return x `
|
3066
3257
|
<div class="messages">
|
@@ -3101,16 +3292,20 @@ class ChatSection extends r$3 {
|
|
3101
3292
|
`;
|
3102
3293
|
}
|
3103
3294
|
quickPrompts() {
|
3104
|
-
|
3105
|
-
|
3295
|
+
if (this.isLoadingHistory || this.isTyping || this.isLoadingThreads) {
|
3296
|
+
return E;
|
3297
|
+
}
|
3298
|
+
const prompts = this.messages.length
|
3299
|
+
? this.messages[0].welcomePrompts
|
3300
|
+
: this.prompts
|
3301
|
+
? this.prompts.split(',').map((prompt) => prompt.trim())
|
3302
|
+
: ['Best Selling Items', 'Hot Sales'];
|
3303
|
+
if (!prompts) {
|
3106
3304
|
return E;
|
3107
3305
|
}
|
3108
|
-
const defaultPrompts = this.prompts
|
3109
|
-
? this.prompts.split(',').map((prompt) => prompt.trim())
|
3110
|
-
: ['Best Selling Items', 'Hot Sales'];
|
3111
3306
|
return x `
|
3112
3307
|
<div class="prompts btn">
|
3113
|
-
${
|
3308
|
+
${prompts.map((prompt) => x `
|
3114
3309
|
<div
|
3115
3310
|
class="prompt"
|
3116
3311
|
@click=${(e) => this.processMessage(e, prompt)}
|
@@ -3214,10 +3409,10 @@ class ChatSection extends r$3 {
|
|
3214
3409
|
</tooltip-component>
|
3215
3410
|
<tooltip-component
|
3216
3411
|
.position=${'bottom-right'}
|
3217
|
-
.text=${'
|
3412
|
+
.text=${'Search History'}
|
3218
3413
|
>
|
3219
3414
|
<button
|
3220
|
-
class=${e$
|
3415
|
+
class=${e$1({
|
3221
3416
|
btn: true,
|
3222
3417
|
'btn-icon': true,
|
3223
3418
|
'threads-btn': true,
|
@@ -3289,11 +3484,27 @@ class ChatSection extends r$3 {
|
|
3289
3484
|
}
|
3290
3485
|
return x ` <div id="modal-chat-threads">
|
3291
3486
|
<div class="chat-threads">
|
3292
|
-
<
|
3487
|
+
<div class="title-wrapper">
|
3488
|
+
<h2>Search History</h2>
|
3489
|
+
${this.chatThreads.size
|
3490
|
+
? x `<div
|
3491
|
+
class="trash-icon"
|
3492
|
+
@click=${() => {
|
3493
|
+
if (this.isTyping) {
|
3494
|
+
return;
|
3495
|
+
}
|
3496
|
+
this.deleteAllThreads = true;
|
3497
|
+
this.showChatThreads = false;
|
3498
|
+
}}
|
3499
|
+
>
|
3500
|
+
${trashIcon}
|
3501
|
+
</div>`
|
3502
|
+
: E}
|
3503
|
+
</div>
|
3293
3504
|
<div class="thread-titles-wrapper">
|
3294
3505
|
${o$1(this.chatThreads.values(), (thread) => x `
|
3295
3506
|
<div
|
3296
|
-
class=${e$
|
3507
|
+
class=${e$1({
|
3297
3508
|
'thread-title': true,
|
3298
3509
|
disabled: this.isTyping,
|
3299
3510
|
})}
|
@@ -3333,10 +3544,17 @@ class ChatSection extends r$3 {
|
|
3333
3544
|
</div>`;
|
3334
3545
|
}
|
3335
3546
|
render() {
|
3547
|
+
if (this.merchantImage) {
|
3548
|
+
// set the merchant image as a css variable
|
3549
|
+
this.style.setProperty('--shopgpt-merchant-img-url', `url('${this.merchantImage}')`);
|
3550
|
+
}
|
3551
|
+
else {
|
3552
|
+
this.style.removeProperty('--shopgpt-merchant-img-url');
|
3553
|
+
}
|
3336
3554
|
return x `
|
3337
3555
|
<div class="chat-header">${this.contextButton()}</div>
|
3338
3556
|
<div
|
3339
|
-
class=${e$
|
3557
|
+
class=${e$1({
|
3340
3558
|
'chatbot-section': true,
|
3341
3559
|
'modal-view': this.viewType === 'modal',
|
3342
3560
|
})}
|
@@ -3350,7 +3568,7 @@ class ChatSection extends r$3 {
|
|
3350
3568
|
placeholder="Type your search here..."
|
3351
3569
|
/>
|
3352
3570
|
<button
|
3353
|
-
class=${e$
|
3571
|
+
class=${e$1({
|
3354
3572
|
btn: true,
|
3355
3573
|
modal: this.viewType === 'modal',
|
3356
3574
|
})}
|
@@ -3367,105 +3585,128 @@ class ChatSection extends r$3 {
|
|
3367
3585
|
.defaultProfiles=${this.profiles}
|
3368
3586
|
></personalize-dialog>
|
3369
3587
|
${this.renderChatThreads()}
|
3370
|
-
${this.deleteThreadId
|
3588
|
+
${this.deleteThreadId || this.deleteAllThreads
|
3371
3589
|
? x `
|
3372
3590
|
<confirm-dialog
|
3373
3591
|
@accept=${this.handleThreadDelete}
|
3374
|
-
@decline=${() =>
|
3592
|
+
@decline=${() => {
|
3593
|
+
this.deleteThreadId = '';
|
3594
|
+
this.deleteAllThreads = false;
|
3595
|
+
}}
|
3375
3596
|
>
|
3376
|
-
<h2 slot="title">
|
3597
|
+
<h2 slot="title">
|
3598
|
+
${this.deleteAllThreads
|
3599
|
+
? 'Delete Entire Chat History?'
|
3600
|
+
: 'Delete Chat?'}
|
3601
|
+
</h2>
|
3377
3602
|
<p slot="content">
|
3378
3603
|
This action cannot be undone. Are you sure you want to delete
|
3379
|
-
|
3604
|
+
${this.deleteAllThreads
|
3605
|
+
? ' the entire chat history'
|
3606
|
+
: x `<b
|
3607
|
+
>"${this.chatThreads.get(this.deleteThreadId)
|
3608
|
+
.title}"</b
|
3609
|
+
>`}?
|
3380
3610
|
</p>
|
3381
3611
|
</confirm-dialog>
|
3382
3612
|
`
|
3383
3613
|
: E}
|
3384
3614
|
`;
|
3385
3615
|
}
|
3386
|
-
}
|
3616
|
+
}
|
3387
3617
|
ChatSection.styles = [chatSectionStyles];
|
3388
3618
|
__decorate([
|
3389
|
-
n
|
3619
|
+
n({ type: String }),
|
3620
|
+
__metadata("design:type", Object)
|
3621
|
+
], ChatSection.prototype, "merchantImage", void 0);
|
3622
|
+
__decorate([
|
3623
|
+
n({ type: String }),
|
3390
3624
|
__metadata("design:type", Object)
|
3391
3625
|
], ChatSection.prototype, "brandName", void 0);
|
3392
3626
|
__decorate([
|
3393
|
-
n
|
3627
|
+
n({ type: String }),
|
3394
3628
|
__metadata("design:type", Object)
|
3395
3629
|
], ChatSection.prototype, "prompts", void 0);
|
3396
3630
|
__decorate([
|
3397
|
-
n
|
3631
|
+
n({ type: Boolean }),
|
3632
|
+
__metadata("design:type", Boolean)
|
3633
|
+
], ChatSection.prototype, "isLoadingThreads", void 0);
|
3634
|
+
__decorate([
|
3635
|
+
n({ type: Object }),
|
3398
3636
|
__metadata("design:type", Map)
|
3399
3637
|
], ChatSection.prototype, "chatThreads", void 0);
|
3400
3638
|
__decorate([
|
3401
|
-
r
|
3639
|
+
r(),
|
3402
3640
|
__metadata("design:type", String)
|
3403
3641
|
], ChatSection.prototype, "deleteThreadId", void 0);
|
3404
3642
|
__decorate([
|
3405
|
-
n
|
3643
|
+
n({ type: Boolean }),
|
3406
3644
|
__metadata("design:type", Object)
|
3407
3645
|
], ChatSection.prototype, "showChatThreads", void 0);
|
3408
3646
|
__decorate([
|
3409
|
-
n
|
3647
|
+
n({ type: Boolean }),
|
3410
3648
|
__metadata("design:type", Boolean)
|
3411
3649
|
], ChatSection.prototype, "isLoadingHistory", void 0);
|
3412
3650
|
__decorate([
|
3413
|
-
n
|
3651
|
+
n({ type: Boolean }),
|
3414
3652
|
__metadata("design:type", Object)
|
3415
3653
|
], ChatSection.prototype, "devMode", void 0);
|
3416
3654
|
__decorate([
|
3417
|
-
n
|
3655
|
+
n({ type: Boolean }),
|
3418
3656
|
__metadata("design:type", Boolean)
|
3419
3657
|
], ChatSection.prototype, "isTyping", void 0);
|
3420
3658
|
__decorate([
|
3421
|
-
n
|
3659
|
+
n({ type: Boolean }),
|
3422
3660
|
__metadata("design:type", Boolean)
|
3423
3661
|
], ChatSection.prototype, "isFailed", void 0);
|
3424
3662
|
__decorate([
|
3425
|
-
n
|
3663
|
+
n({ type: Array }),
|
3426
3664
|
__metadata("design:type", Array)
|
3427
3665
|
], ChatSection.prototype, "messages", void 0);
|
3428
3666
|
__decorate([
|
3429
|
-
n
|
3667
|
+
n({ type: Array }),
|
3430
3668
|
__metadata("design:type", Array)
|
3431
3669
|
], ChatSection.prototype, "profiles", void 0);
|
3432
3670
|
__decorate([
|
3433
|
-
n
|
3671
|
+
n({ type: Array }),
|
3434
3672
|
__metadata("design:type", Array)
|
3435
3673
|
], ChatSection.prototype, "productHandles", void 0);
|
3436
3674
|
__decorate([
|
3437
|
-
n
|
3675
|
+
n({ type: Object }),
|
3438
3676
|
__metadata("design:type", Object)
|
3439
3677
|
], ChatSection.prototype, "thread", void 0);
|
3440
3678
|
__decorate([
|
3441
|
-
n
|
3679
|
+
n({ type: Object }),
|
3442
3680
|
__metadata("design:type", Object)
|
3443
3681
|
], ChatSection.prototype, "siteCurrency", void 0);
|
3444
3682
|
__decorate([
|
3445
|
-
|
3683
|
+
r(),
|
3684
|
+
__metadata("design:type", Object)
|
3685
|
+
], ChatSection.prototype, "deleteAllThreads", void 0);
|
3686
|
+
__decorate([
|
3687
|
+
e$3('.context-container'),
|
3446
3688
|
__metadata("design:type", Object)
|
3447
3689
|
], ChatSection.prototype, "contextContainerElement", void 0);
|
3448
3690
|
__decorate([
|
3449
|
-
e$
|
3691
|
+
e$3('.chat-window'),
|
3450
3692
|
__metadata("design:type", Object)
|
3451
3693
|
], ChatSection.prototype, "chatWindowElement", void 0);
|
3452
3694
|
__decorate([
|
3453
|
-
e$
|
3695
|
+
e$3('personalize-dialog'),
|
3454
3696
|
__metadata("design:type", Object)
|
3455
3697
|
], ChatSection.prototype, "personalizeDialogElement", void 0);
|
3456
3698
|
__decorate([
|
3457
|
-
n
|
3699
|
+
n({ type: String }),
|
3458
3700
|
__metadata("design:type", Object)
|
3459
3701
|
], ChatSection.prototype, "userQuery", void 0);
|
3460
|
-
|
3461
|
-
|
3462
|
-
|
3463
|
-
], ChatSection);
|
3702
|
+
if (!customElements.get('chat-section')) {
|
3703
|
+
customElements.define('chat-section', ChatSection);
|
3704
|
+
}
|
3464
3705
|
|
3465
3706
|
const DIALOG_DELAY = 1000;
|
3466
3707
|
const LATEST_THREAD_LOAD_DAYS = 14;
|
3467
3708
|
const normalizePath = (path) => path.replace(/\/$/, '');
|
3468
|
-
|
3709
|
+
class ShopGPT extends r$2 {
|
3469
3710
|
constructor() {
|
3470
3711
|
super(...arguments);
|
3471
3712
|
this.modalState = 'close';
|
@@ -3482,9 +3723,13 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3482
3723
|
return;
|
3483
3724
|
}
|
3484
3725
|
await this.loadChatThreads();
|
3485
|
-
await this.loadInitialQuery();
|
3486
3726
|
this.selectLatestThread();
|
3487
3727
|
};
|
3728
|
+
this.onPopState = () => {
|
3729
|
+
var _a;
|
3730
|
+
this.modalState = 'close';
|
3731
|
+
(_a = this.shopGPTDialog) === null || _a === void 0 ? void 0 : _a.close();
|
3732
|
+
};
|
3488
3733
|
this.submitQuery = (message) => {
|
3489
3734
|
if (!message) {
|
3490
3735
|
return;
|
@@ -3510,10 +3755,12 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3510
3755
|
}
|
3511
3756
|
disconnectedCallback() {
|
3512
3757
|
window.removeEventListener('edgetag-initialized', this.loadData);
|
3758
|
+
window.removeEventListener('popstate', this.onPopState);
|
3513
3759
|
super.disconnectedCallback();
|
3514
3760
|
}
|
3515
3761
|
init() {
|
3516
3762
|
window.addEventListener('edgetag-initialized', this.loadData);
|
3763
|
+
window.addEventListener('popstate', this.onPopState);
|
3517
3764
|
if (!this.uiMode || this.uiMode === 'overlay') {
|
3518
3765
|
delay(DIALOG_DELAY).then(() => {
|
3519
3766
|
var _a;
|
@@ -3528,6 +3775,19 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3528
3775
|
});
|
3529
3776
|
}
|
3530
3777
|
}
|
3778
|
+
setChatTitle(threadId, title) {
|
3779
|
+
if (!title || !threadId) {
|
3780
|
+
return;
|
3781
|
+
}
|
3782
|
+
const thread = this.chatThreads.get(threadId);
|
3783
|
+
if (thread) {
|
3784
|
+
this.chatThreads.set(thread.threadId, {
|
3785
|
+
...thread,
|
3786
|
+
title,
|
3787
|
+
});
|
3788
|
+
this.chatThreads = new Map(this.chatThreads);
|
3789
|
+
}
|
3790
|
+
}
|
3531
3791
|
async loadInitialQuery() {
|
3532
3792
|
var _a;
|
3533
3793
|
if (!this.selectedThreadId) {
|
@@ -3540,14 +3800,26 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3540
3800
|
if (!thread) {
|
3541
3801
|
return;
|
3542
3802
|
}
|
3803
|
+
const searchParam = new URLSearchParams(window.location.search);
|
3804
|
+
const fromAd = searchParam.get('shopGPT') === '1';
|
3543
3805
|
const productHandle = this.devMode
|
3544
3806
|
? (_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.productHandle
|
3545
|
-
:
|
3807
|
+
: fromAd
|
3808
|
+
? this.storeAPI.getCurrentProductHandle()
|
3809
|
+
: undefined;
|
3546
3810
|
try {
|
3547
3811
|
this.isTyping = true;
|
3548
3812
|
const reply = await this.shopGPTAPI.processQuery('', thread.threadId, productHandle);
|
3813
|
+
if (reply.chatTitle) {
|
3814
|
+
this.setChatTitle(this.selectedThreadId, reply.chatTitle);
|
3815
|
+
}
|
3549
3816
|
this.messages = [
|
3550
|
-
{
|
3817
|
+
{
|
3818
|
+
sender: 'bot',
|
3819
|
+
message: reply.message,
|
3820
|
+
products: reply.products,
|
3821
|
+
welcomePrompts: reply.welcomePrompts,
|
3822
|
+
},
|
3551
3823
|
...this.messages,
|
3552
3824
|
];
|
3553
3825
|
this.products = reply.products || [];
|
@@ -3574,9 +3846,6 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3574
3846
|
}
|
3575
3847
|
}
|
3576
3848
|
selectLatestThread() {
|
3577
|
-
if (!this.devMode) {
|
3578
|
-
return;
|
3579
|
-
}
|
3580
3849
|
const cutoffTime = Date.now() - LATEST_THREAD_LOAD_DAYS * 24 * 60 * 60 * 1000;
|
3581
3850
|
// If the latest thread is not older than cutoff we should load the thread
|
3582
3851
|
let latestThread;
|
@@ -3589,9 +3858,11 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3589
3858
|
if (latestThread) {
|
3590
3859
|
this.setSelectedThreadId(latestThread.threadId);
|
3591
3860
|
}
|
3861
|
+
else if (!this.devMode) {
|
3862
|
+
this.createChatThread({ title: '' }, true);
|
3863
|
+
}
|
3592
3864
|
}
|
3593
3865
|
async loadHistory(threadId) {
|
3594
|
-
var _a, _b, _c;
|
3595
3866
|
try {
|
3596
3867
|
if (!threadId) {
|
3597
3868
|
this.messages = [];
|
@@ -3600,22 +3871,24 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3600
3871
|
}
|
3601
3872
|
this.isLoadingHistory = true;
|
3602
3873
|
const data = await this.shopGPTAPI.fetchChatHistory(threadId);
|
3874
|
+
let latestAvailableProducts = [];
|
3603
3875
|
this.messages = data.map((message) => {
|
3604
3876
|
var _a;
|
3605
|
-
|
3877
|
+
const products = (_a = message.products) === null || _a === void 0 ? void 0 : _a.map((product) => ({
|
3878
|
+
...product,
|
3879
|
+
quantity: 1,
|
3880
|
+
}));
|
3881
|
+
if (!latestAvailableProducts.length && (products === null || products === void 0 ? void 0 : products.length)) {
|
3882
|
+
latestAvailableProducts = products;
|
3883
|
+
}
|
3884
|
+
return {
|
3606
3885
|
message: message.message,
|
3607
3886
|
sender: message.sender,
|
3608
|
-
products
|
3609
|
-
|
3610
|
-
|
3611
|
-
})),
|
3612
|
-
});
|
3887
|
+
products,
|
3888
|
+
welcomePrompts: message.welcomePrompts,
|
3889
|
+
};
|
3613
3890
|
});
|
3614
|
-
this.products =
|
3615
|
-
(_c = (_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.products) === null || _b === void 0 ? void 0 : _b.map((product) => ({
|
3616
|
-
...product,
|
3617
|
-
quantity: 1,
|
3618
|
-
}))) !== null && _c !== void 0 ? _c : [];
|
3891
|
+
this.products = latestAvailableProducts;
|
3619
3892
|
}
|
3620
3893
|
catch (e) {
|
3621
3894
|
logger.error(e);
|
@@ -3656,6 +3929,21 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3656
3929
|
this.shopGPTAPI
|
3657
3930
|
.deleteSingleThread(threadId)
|
3658
3931
|
.then(this.loadChatThreads.bind(this))
|
3932
|
+
.then(() => {
|
3933
|
+
if (this.selectedThreadId === threadId) {
|
3934
|
+
this.setSelectedThreadId('');
|
3935
|
+
}
|
3936
|
+
})
|
3937
|
+
.catch(logger.error)
|
3938
|
+
.finally(() => (this.isLoadingThreads = false));
|
3939
|
+
}
|
3940
|
+
handleAllThreadsDelete(e) {
|
3941
|
+
e.stopPropagation();
|
3942
|
+
this.isLoadingThreads = true;
|
3943
|
+
this.shopGPTAPI
|
3944
|
+
.deleteAllThreads()
|
3945
|
+
.then(this.loadChatThreads.bind(this))
|
3946
|
+
.then(() => this.setSelectedThreadId(''))
|
3659
3947
|
.catch(logger.error)
|
3660
3948
|
.finally(() => (this.isLoadingThreads = false));
|
3661
3949
|
}
|
@@ -3674,21 +3962,20 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3674
3962
|
return;
|
3675
3963
|
}
|
3676
3964
|
if (reply.chatTitle) {
|
3677
|
-
|
3678
|
-
const thread = this.chatThreads.get(this.selectedThreadId);
|
3679
|
-
if (thread) {
|
3680
|
-
this.chatThreads.set(thread.threadId, {
|
3681
|
-
...thread,
|
3682
|
-
title: reply.chatTitle,
|
3683
|
-
});
|
3684
|
-
this.chatThreads = new Map(this.chatThreads);
|
3685
|
-
}
|
3965
|
+
this.setChatTitle(this.selectedThreadId, reply.chatTitle);
|
3686
3966
|
}
|
3687
3967
|
this.messages = [
|
3688
|
-
{
|
3968
|
+
{
|
3969
|
+
sender: 'bot',
|
3970
|
+
message: reply.message,
|
3971
|
+
products: reply.products,
|
3972
|
+
welcomePrompts: reply.welcomePrompts,
|
3973
|
+
},
|
3689
3974
|
...this.messages,
|
3690
3975
|
];
|
3691
|
-
|
3976
|
+
if (reply.products && reply.products.length > 0) {
|
3977
|
+
this.products = reply.products;
|
3978
|
+
}
|
3692
3979
|
}
|
3693
3980
|
catch (err) {
|
3694
3981
|
logger.error(err);
|
@@ -3713,6 +4000,7 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3713
4000
|
<dialog
|
3714
4001
|
id="shop-gpt-dialog-overlay"
|
3715
4002
|
@delete-thread=${this.handleThreadDelete}
|
4003
|
+
@delete-all-threads=${this.handleAllThreadsDelete}
|
3716
4004
|
>
|
3717
4005
|
<div class="mobile-version">
|
3718
4006
|
Please switch to the desktop version for the best experience.
|
@@ -3731,6 +4019,7 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3731
4019
|
.products=${this.products}
|
3732
4020
|
.isLoadingHistory=${this.isLoadingHistory}
|
3733
4021
|
.siteCurrency=${this.getSiteCurrency()}
|
4022
|
+
.isLoadingThreads=${this.isLoadingThreads}
|
3734
4023
|
></products-section>
|
3735
4024
|
<chat-section
|
3736
4025
|
.prompts=${this.quickPrompts}
|
@@ -3747,6 +4036,7 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3747
4036
|
.productHandles=${this.productHandles}
|
3748
4037
|
.profiles=${this.profiles}
|
3749
4038
|
.viewType=${'overlay'}
|
4039
|
+
.isLoadingThreads=${this.isLoadingThreads}
|
3750
4040
|
></chat-section>
|
3751
4041
|
</div>
|
3752
4042
|
</dialog>
|
@@ -3767,10 +4057,15 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3767
4057
|
>
|
3768
4058
|
${chatIcon}
|
3769
4059
|
</button>
|
4060
|
+
<div class="chatbot-hover-text">What are you looking for today?</div>
|
3770
4061
|
</div>`;
|
3771
4062
|
}
|
3772
4063
|
return x `
|
3773
|
-
<div
|
4064
|
+
<div
|
4065
|
+
id="shop-gpt-modal"
|
4066
|
+
@delete-thread=${this.handleThreadDelete}
|
4067
|
+
@delete-all-threads=${this.handleAllThreadsDelete}
|
4068
|
+
>
|
3774
4069
|
<chat-section
|
3775
4070
|
.prompts=${this.quickPrompts}
|
3776
4071
|
.brandName=${this.brandName}
|
@@ -3789,55 +4084,57 @@ let ShopGPT = class ShopGPT extends r$3 {
|
|
3789
4084
|
.closeModal=${closeModal}
|
3790
4085
|
.setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
|
3791
4086
|
.chatThreads=${this.chatThreads}
|
4087
|
+
.isLoadingThreads=${this.isLoadingThreads}
|
4088
|
+
.merchantImage=${this.merchantImage}
|
3792
4089
|
></chat-section>
|
3793
4090
|
</div>
|
3794
4091
|
`;
|
3795
4092
|
}
|
3796
|
-
}
|
4093
|
+
}
|
3797
4094
|
ShopGPT.styles = [shopGPTStyles];
|
3798
4095
|
__decorate([
|
3799
|
-
e$
|
4096
|
+
e$3('#shop-gpt-dialog-overlay'),
|
3800
4097
|
__metadata("design:type", Object)
|
3801
4098
|
], ShopGPT.prototype, "shopGPTDialog", void 0);
|
3802
4099
|
__decorate([
|
3803
|
-
n
|
4100
|
+
n({ type: String }),
|
3804
4101
|
__metadata("design:type", String)
|
3805
4102
|
], ShopGPT.prototype, "modalState", void 0);
|
3806
4103
|
__decorate([
|
3807
|
-
n
|
4104
|
+
n({ type: Boolean }),
|
3808
4105
|
__metadata("design:type", Object)
|
3809
4106
|
], ShopGPT.prototype, "isLoadingHistory", void 0);
|
3810
4107
|
__decorate([
|
3811
|
-
n
|
4108
|
+
n({ type: Boolean }),
|
3812
4109
|
__metadata("design:type", Object)
|
3813
4110
|
], ShopGPT.prototype, "isLoadingThreads", void 0);
|
3814
4111
|
__decorate([
|
3815
|
-
n
|
4112
|
+
n({ type: Boolean }),
|
3816
4113
|
__metadata("design:type", Object)
|
3817
4114
|
], ShopGPT.prototype, "isTyping", void 0);
|
3818
4115
|
__decorate([
|
3819
|
-
n
|
4116
|
+
n({ type: Boolean }),
|
3820
4117
|
__metadata("design:type", Object)
|
3821
4118
|
], ShopGPT.prototype, "isFailed", void 0);
|
3822
4119
|
__decorate([
|
3823
|
-
n
|
4120
|
+
n({ type: String }),
|
3824
4121
|
__metadata("design:type", Object)
|
3825
4122
|
], ShopGPT.prototype, "selectedThreadId", void 0);
|
3826
4123
|
__decorate([
|
3827
|
-
n
|
4124
|
+
n({ type: Array }),
|
3828
4125
|
__metadata("design:type", Array)
|
3829
4126
|
], ShopGPT.prototype, "products", void 0);
|
3830
4127
|
__decorate([
|
3831
|
-
n
|
4128
|
+
n({ type: Array }),
|
3832
4129
|
__metadata("design:type", Array)
|
3833
4130
|
], ShopGPT.prototype, "messages", void 0);
|
3834
4131
|
__decorate([
|
3835
|
-
n
|
4132
|
+
n({ type: Object }),
|
3836
4133
|
__metadata("design:type", Map)
|
3837
4134
|
], ShopGPT.prototype, "chatThreads", void 0);
|
3838
|
-
|
3839
|
-
|
3840
|
-
|
4135
|
+
if (!customElements.get('shop-gpt')) {
|
4136
|
+
customElements.define('shop-gpt', ShopGPT);
|
4137
|
+
}
|
3841
4138
|
|
3842
4139
|
var _a, _b;
|
3843
4140
|
var _c;
|
@@ -3863,6 +4160,14 @@ if (typeof window != 'undefined' && typeof document != 'undefined') {
|
|
3863
4160
|
shopGPT.merchantImage = params.merchantImage;
|
3864
4161
|
document.body.append(shopGPT);
|
3865
4162
|
},
|
4163
|
+
destroy() {
|
4164
|
+
if (!shopGPT) {
|
4165
|
+
return;
|
4166
|
+
}
|
4167
|
+
shopGPT.remove();
|
4168
|
+
shopGPT = undefined;
|
4169
|
+
delete window[registryKey];
|
4170
|
+
},
|
3866
4171
|
});
|
3867
4172
|
}
|
3868
4173
|
|