@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.js
CHANGED
@@ -385,6 +385,7 @@ var ProvidersShopGptSdk = (function () {
|
|
385
385
|
message: data.message,
|
386
386
|
products: (_a = data.products) === null || _a === void 0 ? void 0 : _a.filter((item) => !!item).map((item) => ({ ...item, quantity: 1 })),
|
387
387
|
chatTitle: data.chatTitle,
|
388
|
+
welcomePrompts: data.welcomePrompts,
|
388
389
|
};
|
389
390
|
};
|
390
391
|
const fetchChatHistory = async (threadId) => {
|
@@ -577,58 +578,51 @@ var ProvidersShopGptSdk = (function () {
|
|
577
578
|
* Copyright 2019 Google LLC
|
578
579
|
* SPDX-License-Identifier: BSD-3-Clause
|
579
580
|
*/
|
580
|
-
const t$
|
581
|
+
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;
|
581
582
|
|
582
583
|
/**
|
583
584
|
* @license
|
584
585
|
* Copyright 2017 Google LLC
|
585
586
|
* SPDX-License-Identifier: BSD-3-Clause
|
586
|
-
*/const{is:i$3,defineProperty:e$
|
587
|
+
*/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");
|
587
588
|
|
588
589
|
/**
|
589
590
|
* @license
|
590
591
|
* Copyright 2017 Google LLC
|
591
592
|
* SPDX-License-Identifier: BSD-3-Clause
|
592
593
|
*/
|
593
|
-
const t$
|
594
|
+
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};
|
594
595
|
|
595
596
|
/**
|
596
597
|
* @license
|
597
598
|
* Copyright 2017 Google LLC
|
598
599
|
* SPDX-License-Identifier: BSD-3-Clause
|
599
|
-
*/let r$
|
600
|
+
*/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");
|
600
601
|
|
601
602
|
/**
|
602
603
|
* @license
|
603
604
|
* Copyright 2017 Google LLC
|
604
605
|
* SPDX-License-Identifier: BSD-3-Clause
|
605
|
-
*/
|
606
|
-
const t$2=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
606
|
+
*/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)}
|
607
607
|
|
608
608
|
/**
|
609
609
|
* @license
|
610
610
|
* Copyright 2017 Google LLC
|
611
611
|
* SPDX-License-Identifier: BSD-3-Clause
|
612
|
-
*/
|
613
|
-
|
614
|
-
/**
|
615
|
-
* @license
|
616
|
-
* Copyright 2017 Google LLC
|
617
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
618
|
-
*/function r$1(r){return n$1({...r,state:!0,attribute:!1})}
|
612
|
+
*/function r(r){return n({...r,state:!0,attribute:!1})}
|
619
613
|
|
620
614
|
/**
|
621
615
|
* @license
|
622
616
|
* Copyright 2017 Google LLC
|
623
617
|
* SPDX-License-Identifier: BSD-3-Clause
|
624
618
|
*/
|
625
|
-
const e$
|
619
|
+
const e$4=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
626
620
|
|
627
621
|
/**
|
628
622
|
* @license
|
629
623
|
* Copyright 2017 Google LLC
|
630
624
|
* SPDX-License-Identifier: BSD-3-Clause
|
631
|
-
*/function e$
|
625
|
+
*/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)}})}}
|
632
626
|
|
633
627
|
const scrollBarStyles = i$4 `
|
634
628
|
::-webkit-scrollbar {
|
@@ -714,6 +708,35 @@ var ProvidersShopGptSdk = (function () {
|
|
714
708
|
align-items: center;
|
715
709
|
box-shadow: 0 0 4px 1px #ffffff;
|
716
710
|
}
|
711
|
+
|
712
|
+
.chatbot-hover-text {
|
713
|
+
position: absolute;
|
714
|
+
color: #172a41;
|
715
|
+
padding: 8px;
|
716
|
+
white-space: nowrap;
|
717
|
+
font-size: 16px;
|
718
|
+
line-height: 21px;
|
719
|
+
opacity: 0;
|
720
|
+
transition: opacity 0.2s;
|
721
|
+
pointer-events: none;
|
722
|
+
|
723
|
+
top: calc(0% - 30%);
|
724
|
+
right: calc(100% + 5px);
|
725
|
+
|
726
|
+
border-radius: 5px 5px 0px;
|
727
|
+
background: #ffcc81;
|
728
|
+
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
729
|
+
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
730
|
+
|
731
|
+
font-weight: 400;
|
732
|
+
line-height: 150%;
|
733
|
+
}
|
734
|
+
|
735
|
+
&:hover {
|
736
|
+
.chatbot-hover-text {
|
737
|
+
opacity: 1;
|
738
|
+
}
|
739
|
+
}
|
717
740
|
}
|
718
741
|
|
719
742
|
.mobile-version {
|
@@ -761,13 +784,13 @@ var ProvidersShopGptSdk = (function () {
|
|
761
784
|
* Copyright 2017 Google LLC
|
762
785
|
* SPDX-License-Identifier: BSD-3-Clause
|
763
786
|
*/
|
764
|
-
const t
|
787
|
+
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)}}
|
765
788
|
|
766
789
|
/**
|
767
790
|
* @license
|
768
791
|
* Copyright 2018 Google LLC
|
769
792
|
* SPDX-License-Identifier: BSD-3-Clause
|
770
|
-
*/const e$
|
793
|
+
*/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}});
|
771
794
|
|
772
795
|
/**
|
773
796
|
* @license
|
@@ -922,11 +945,35 @@ var ProvidersShopGptSdk = (function () {
|
|
922
945
|
color: #677c95;
|
923
946
|
font-weight: 500;
|
924
947
|
text-transform: uppercase;
|
925
|
-
margin: 0
|
948
|
+
margin: 0;
|
926
949
|
max-height: 18px;
|
927
950
|
padding-left: 12px;
|
928
951
|
}
|
929
952
|
|
953
|
+
.trash-icon {
|
954
|
+
display: flex;
|
955
|
+
padding: 2px;
|
956
|
+
border-radius: 5px;
|
957
|
+
cursor: pointer;
|
958
|
+
align-items: center;
|
959
|
+
justify-content: center;
|
960
|
+
|
961
|
+
&:hover {
|
962
|
+
background: #dc3545;
|
963
|
+
|
964
|
+
path {
|
965
|
+
fill: white;
|
966
|
+
}
|
967
|
+
}
|
968
|
+
}
|
969
|
+
|
970
|
+
.title-wrapper {
|
971
|
+
display: flex;
|
972
|
+
justify-content: space-between;
|
973
|
+
align-items: center;
|
974
|
+
margin: 0 0 12px;
|
975
|
+
}
|
976
|
+
|
930
977
|
.threads {
|
931
978
|
flex: 1;
|
932
979
|
overflow-y: auto;
|
@@ -939,17 +986,6 @@ var ProvidersShopGptSdk = (function () {
|
|
939
986
|
|
940
987
|
.trash-icon {
|
941
988
|
display: none;
|
942
|
-
padding: 2px;
|
943
|
-
cursor: pointer;
|
944
|
-
|
945
|
-
&:hover {
|
946
|
-
border-radius: 5px;
|
947
|
-
background: #dc3545;
|
948
|
-
|
949
|
-
path {
|
950
|
-
fill: white;
|
951
|
-
}
|
952
|
-
}
|
953
989
|
}
|
954
990
|
|
955
991
|
&:hover {
|
@@ -998,13 +1034,11 @@ var ProvidersShopGptSdk = (function () {
|
|
998
1034
|
}
|
999
1035
|
`;
|
1000
1036
|
|
1001
|
-
|
1002
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1003
|
-
class LoadSpinner extends r$3 {
|
1037
|
+
class LoadSpinner extends r$2 {
|
1004
1038
|
render() {
|
1005
1039
|
return x ` <div class="loader"><div class="spinner"></div></div> `;
|
1006
1040
|
}
|
1007
|
-
}
|
1041
|
+
}
|
1008
1042
|
LoadSpinner.styles = [
|
1009
1043
|
i$4 `
|
1010
1044
|
.loader {
|
@@ -1038,14 +1072,15 @@ var ProvidersShopGptSdk = (function () {
|
|
1038
1072
|
}
|
1039
1073
|
`,
|
1040
1074
|
];
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1075
|
+
if (!customElements.get('load-spinner')) {
|
1076
|
+
customElements.define('load-spinner', LoadSpinner);
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
class ChatThreads extends r$2 {
|
1080
|
+
constructor() {
|
1081
|
+
super(...arguments);
|
1082
|
+
this.deleteAllThreads = false;
|
1083
|
+
}
|
1049
1084
|
getDomain() {
|
1050
1085
|
var _a;
|
1051
1086
|
if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
|
@@ -1054,6 +1089,14 @@ var ProvidersShopGptSdk = (function () {
|
|
1054
1089
|
return `https://${this.merchantUrl}`;
|
1055
1090
|
}
|
1056
1091
|
handleThreadDelete() {
|
1092
|
+
if (this.deleteAllThreads) {
|
1093
|
+
this.dispatchEvent(new CustomEvent('delete-all-threads', {
|
1094
|
+
composed: true,
|
1095
|
+
bubbles: true,
|
1096
|
+
}));
|
1097
|
+
this.deleteAllThreads = false;
|
1098
|
+
return;
|
1099
|
+
}
|
1057
1100
|
if (!this.deleteThreadId) {
|
1058
1101
|
return;
|
1059
1102
|
}
|
@@ -1073,12 +1116,27 @@ var ProvidersShopGptSdk = (function () {
|
|
1073
1116
|
}
|
1074
1117
|
return x `
|
1075
1118
|
<div class="history">
|
1076
|
-
<
|
1119
|
+
<div class="title-wrapper">
|
1120
|
+
<p class="title">History</p>
|
1121
|
+
${this.chatThreads.size
|
1122
|
+
? x `<div
|
1123
|
+
class="trash-icon"
|
1124
|
+
@click=${() => {
|
1125
|
+
if (this.isLoading || this.isTyping) {
|
1126
|
+
return;
|
1127
|
+
}
|
1128
|
+
this.deleteAllThreads = true;
|
1129
|
+
}}
|
1130
|
+
>
|
1131
|
+
${trashIcon}
|
1132
|
+
</div>`
|
1133
|
+
: E}
|
1134
|
+
</div>
|
1077
1135
|
${this.chatThreads.size
|
1078
1136
|
? x `<div class="threads">
|
1079
1137
|
${o$1(this.chatThreads.values(), (thread) => x `
|
1080
1138
|
<div
|
1081
|
-
class=${e$
|
1139
|
+
class=${e$1({
|
1082
1140
|
'thread-wrapper': true,
|
1083
1141
|
active: this.selectedThreadId === thread.threadId,
|
1084
1142
|
disabled: this.isTyping,
|
@@ -1132,52 +1190,66 @@ var ProvidersShopGptSdk = (function () {
|
|
1132
1190
|
</a>
|
1133
1191
|
</div>`
|
1134
1192
|
: E}
|
1135
|
-
${this.deleteThreadId
|
1193
|
+
${this.deleteThreadId || this.deleteAllThreads
|
1136
1194
|
? x `
|
1137
1195
|
<confirm-dialog
|
1138
1196
|
@accept=${this.handleThreadDelete}
|
1139
|
-
@decline=${() =>
|
1197
|
+
@decline=${() => {
|
1198
|
+
this.deleteThreadId = '';
|
1199
|
+
this.deleteAllThreads = false;
|
1200
|
+
}}
|
1140
1201
|
>
|
1141
|
-
<h2 slot="title">
|
1202
|
+
<h2 slot="title">
|
1203
|
+
${this.deleteAllThreads
|
1204
|
+
? 'Delete Entire Chat History?'
|
1205
|
+
: 'Delete Chat?'}
|
1206
|
+
</h2>
|
1142
1207
|
<p slot="content">
|
1143
1208
|
This action cannot be undone. Are you sure you want to delete
|
1144
|
-
|
1209
|
+
${this.deleteAllThreads
|
1210
|
+
? ' the entire chat history'
|
1211
|
+
: x `<b
|
1212
|
+
>"${this.chatThreads.get(this.deleteThreadId).title}"</b
|
1213
|
+
>`}?
|
1145
1214
|
</p>
|
1146
1215
|
</confirm-dialog>
|
1147
1216
|
`
|
1148
1217
|
: E}
|
1149
1218
|
`;
|
1150
1219
|
}
|
1151
|
-
}
|
1220
|
+
}
|
1152
1221
|
ChatThreads.styles = [chatThreadsStyles];
|
1153
1222
|
__decorate([
|
1154
|
-
n
|
1223
|
+
n({ type: Object }),
|
1155
1224
|
__metadata("design:type", Map)
|
1156
1225
|
], ChatThreads.prototype, "chatThreads", void 0);
|
1157
1226
|
__decorate([
|
1158
|
-
n
|
1227
|
+
n({ type: String }),
|
1159
1228
|
__metadata("design:type", Object)
|
1160
1229
|
], ChatThreads.prototype, "merchantUrl", void 0);
|
1161
1230
|
__decorate([
|
1162
|
-
n
|
1231
|
+
n({ type: Boolean }),
|
1163
1232
|
__metadata("design:type", Boolean)
|
1164
1233
|
], ChatThreads.prototype, "isLoading", void 0);
|
1165
1234
|
__decorate([
|
1166
|
-
n
|
1235
|
+
n({ type: Boolean }),
|
1167
1236
|
__metadata("design:type", Boolean)
|
1168
1237
|
], ChatThreads.prototype, "isTyping", void 0);
|
1169
1238
|
__decorate([
|
1170
|
-
n
|
1239
|
+
n({ type: String }),
|
1171
1240
|
__metadata("design:type", String)
|
1172
1241
|
], ChatThreads.prototype, "selectedThreadId", void 0);
|
1173
1242
|
__decorate([
|
1174
|
-
r
|
1243
|
+
r(),
|
1175
1244
|
__metadata("design:type", String)
|
1176
1245
|
], ChatThreads.prototype, "deleteThreadId", void 0);
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
], ChatThreads);
|
1246
|
+
__decorate([
|
1247
|
+
r(),
|
1248
|
+
__metadata("design:type", Object)
|
1249
|
+
], ChatThreads.prototype, "deleteAllThreads", void 0);
|
1250
|
+
if (!customElements.get('chat-threads')) {
|
1251
|
+
customElements.define('chat-threads', ChatThreads);
|
1252
|
+
}
|
1181
1253
|
|
1182
1254
|
const productsSectionStyles = i$4 `
|
1183
1255
|
:host {
|
@@ -1365,9 +1437,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1365
1437
|
}
|
1366
1438
|
`;
|
1367
1439
|
|
1368
|
-
|
1369
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1370
|
-
class ProductItem extends r$3 {
|
1440
|
+
class ProductItem extends r$2 {
|
1371
1441
|
getLocalPrice(price) {
|
1372
1442
|
if (!this.siteCurrency) {
|
1373
1443
|
return price;
|
@@ -1375,6 +1445,16 @@ var ProvidersShopGptSdk = (function () {
|
|
1375
1445
|
const localPrice = parseFloat(price) * this.siteCurrency.rate;
|
1376
1446
|
return formatMoney(localPrice, this.siteCurrency.currency);
|
1377
1447
|
}
|
1448
|
+
getComparedAtPrice(comparedAtPrice, price) {
|
1449
|
+
if (!comparedAtPrice ||
|
1450
|
+
comparedAtPrice === price ||
|
1451
|
+
parseFloat(comparedAtPrice) <= parseFloat(price)) {
|
1452
|
+
return E;
|
1453
|
+
}
|
1454
|
+
return x `<p class="price-compared">
|
1455
|
+
${this.getLocalPrice(comparedAtPrice)}
|
1456
|
+
</p>`;
|
1457
|
+
}
|
1378
1458
|
redirect(url) {
|
1379
1459
|
var _a;
|
1380
1460
|
if (!url) {
|
@@ -1408,13 +1488,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1408
1488
|
</p>
|
1409
1489
|
${this.renderVariantTitles()}
|
1410
1490
|
<div class="prices">
|
1411
|
-
${this.product.variants[0].comparedAtPrice
|
1412
|
-
this.product.variants[0].comparedAtPrice !==
|
1413
|
-
this.product.variants[0].price
|
1414
|
-
? x `<p class="price-compared">
|
1415
|
-
${this.getLocalPrice(this.product.variants[0].comparedAtPrice)}
|
1416
|
-
</p>`
|
1417
|
-
: E}
|
1491
|
+
${this.getComparedAtPrice(this.product.variants[0].comparedAtPrice, this.product.variants[0].price)}
|
1418
1492
|
<p>${this.getLocalPrice(this.product.variants[0].price)}</p>
|
1419
1493
|
</div>
|
1420
1494
|
<button
|
@@ -1427,20 +1501,19 @@ var ProvidersShopGptSdk = (function () {
|
|
1427
1501
|
</div>
|
1428
1502
|
`;
|
1429
1503
|
}
|
1430
|
-
}
|
1504
|
+
}
|
1431
1505
|
ProductItem.styles = [productItemStyles];
|
1432
1506
|
__decorate([
|
1433
|
-
n
|
1507
|
+
n({ type: Object }),
|
1434
1508
|
__metadata("design:type", Object)
|
1435
1509
|
], ProductItem.prototype, "product", void 0);
|
1436
1510
|
__decorate([
|
1437
|
-
n
|
1511
|
+
n({ type: Object }),
|
1438
1512
|
__metadata("design:type", Object)
|
1439
1513
|
], ProductItem.prototype, "siteCurrency", void 0);
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
], ProductItem);
|
1514
|
+
if (!customElements.get('product-item')) {
|
1515
|
+
customElements.define('product-item', ProductItem);
|
1516
|
+
}
|
1444
1517
|
|
1445
1518
|
const productsListStyles = i$4 `
|
1446
1519
|
.products::-webkit-scrollbar {
|
@@ -1468,6 +1541,8 @@ var ProvidersShopGptSdk = (function () {
|
|
1468
1541
|
gap: 24px;
|
1469
1542
|
overflow-x: auto;
|
1470
1543
|
scrollbar-width: none;
|
1544
|
+
margin-left: -10px;
|
1545
|
+
padding-left: 10px;
|
1471
1546
|
}
|
1472
1547
|
|
1473
1548
|
.scroll-btns {
|
@@ -1502,9 +1577,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1502
1577
|
}
|
1503
1578
|
`;
|
1504
1579
|
|
1505
|
-
|
1506
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1507
|
-
class ProductsList extends r$3 {
|
1580
|
+
class ProductsList extends r$2 {
|
1508
1581
|
constructor() {
|
1509
1582
|
super(...arguments);
|
1510
1583
|
this.showButtons = true;
|
@@ -1552,7 +1625,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1552
1625
|
<div class="products" @scroll=${this.updateButtonsState}>
|
1553
1626
|
${o$1(this.products, (product) => x `
|
1554
1627
|
<div
|
1555
|
-
class=${e$
|
1628
|
+
class=${e$1({
|
1556
1629
|
'product-container': true,
|
1557
1630
|
modal: this.viewType === 'modal',
|
1558
1631
|
})}
|
@@ -1577,40 +1650,37 @@ var ProvidersShopGptSdk = (function () {
|
|
1577
1650
|
</div>
|
1578
1651
|
`;
|
1579
1652
|
}
|
1580
|
-
}
|
1653
|
+
}
|
1581
1654
|
ProductsList.styles = [productsListStyles];
|
1582
1655
|
__decorate([
|
1583
|
-
n
|
1656
|
+
n({ type: Array }),
|
1584
1657
|
__metadata("design:type", Array)
|
1585
1658
|
], ProductsList.prototype, "products", void 0);
|
1586
1659
|
__decorate([
|
1587
|
-
n
|
1660
|
+
n({ type: Object }),
|
1588
1661
|
__metadata("design:type", Object)
|
1589
1662
|
], ProductsList.prototype, "siteCurrency", void 0);
|
1590
1663
|
__decorate([
|
1591
|
-
r
|
1664
|
+
r(),
|
1592
1665
|
__metadata("design:type", Object)
|
1593
1666
|
], ProductsList.prototype, "showButtons", void 0);
|
1594
1667
|
__decorate([
|
1595
|
-
e$
|
1668
|
+
e$3('.left-btn'),
|
1596
1669
|
__metadata("design:type", Object)
|
1597
1670
|
], ProductsList.prototype, "leftBtnEle", void 0);
|
1598
1671
|
__decorate([
|
1599
|
-
e$
|
1672
|
+
e$3('.right-btn'),
|
1600
1673
|
__metadata("design:type", Object)
|
1601
1674
|
], ProductsList.prototype, "rightBtnEle", void 0);
|
1602
1675
|
__decorate([
|
1603
|
-
e$
|
1676
|
+
e$3('.products'),
|
1604
1677
|
__metadata("design:type", Object)
|
1605
1678
|
], ProductsList.prototype, "productsEle", void 0);
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
let ProductsSection =
|
1612
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1613
|
-
class ProductsSection extends r$3 {
|
1679
|
+
if (!customElements.get('products-list')) {
|
1680
|
+
customElements.define('products-list', ProductsList);
|
1681
|
+
}
|
1682
|
+
|
1683
|
+
class ProductsSection extends r$2 {
|
1614
1684
|
connectedCallback() {
|
1615
1685
|
super.connectedCallback();
|
1616
1686
|
}
|
@@ -1626,7 +1696,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1626
1696
|
`;
|
1627
1697
|
}
|
1628
1698
|
render() {
|
1629
|
-
if (this.isLoadingHistory) {
|
1699
|
+
if (this.isLoadingHistory || this.isLoadingThreads) {
|
1630
1700
|
return x ` <load-spinner></load-spinner> `;
|
1631
1701
|
}
|
1632
1702
|
if (!this.products.length) {
|
@@ -1655,40 +1725,43 @@ var ProvidersShopGptSdk = (function () {
|
|
1655
1725
|
</div>
|
1656
1726
|
`;
|
1657
1727
|
}
|
1658
|
-
}
|
1728
|
+
}
|
1659
1729
|
ProductsSection.styles = [productsSectionStyles];
|
1660
1730
|
__decorate([
|
1661
|
-
n
|
1731
|
+
n({ type: String }),
|
1662
1732
|
__metadata("design:type", Object)
|
1663
1733
|
], ProductsSection.prototype, "merchantImage", void 0);
|
1664
1734
|
__decorate([
|
1665
|
-
n
|
1735
|
+
n({ type: Array }),
|
1666
1736
|
__metadata("design:type", Array)
|
1667
1737
|
], ProductsSection.prototype, "products", void 0);
|
1668
1738
|
__decorate([
|
1669
|
-
n
|
1739
|
+
n({ type: Boolean }),
|
1670
1740
|
__metadata("design:type", Boolean)
|
1671
1741
|
], ProductsSection.prototype, "isLoadingHistory", void 0);
|
1672
1742
|
__decorate([
|
1673
|
-
n
|
1743
|
+
n({ type: Object }),
|
1674
1744
|
__metadata("design:type", Object)
|
1675
1745
|
], ProductsSection.prototype, "siteCurrency", void 0);
|
1676
1746
|
__decorate([
|
1677
|
-
|
1747
|
+
n({ type: Boolean }),
|
1748
|
+
__metadata("design:type", Boolean)
|
1749
|
+
], ProductsSection.prototype, "isLoadingThreads", void 0);
|
1750
|
+
__decorate([
|
1751
|
+
e$3('.left-btn'),
|
1678
1752
|
__metadata("design:type", Object)
|
1679
1753
|
], ProductsSection.prototype, "leftBtnEle", void 0);
|
1680
1754
|
__decorate([
|
1681
|
-
e$
|
1755
|
+
e$3('.right-btn'),
|
1682
1756
|
__metadata("design:type", Object)
|
1683
1757
|
], ProductsSection.prototype, "rightBtnEle", void 0);
|
1684
1758
|
__decorate([
|
1685
|
-
e$
|
1759
|
+
e$3('.products'),
|
1686
1760
|
__metadata("design:type", Object)
|
1687
1761
|
], ProductsSection.prototype, "productsEle", void 0);
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
], ProductsSection);
|
1762
|
+
if (!customElements.get('products-section')) {
|
1763
|
+
customElements.define('products-section', ProductsSection);
|
1764
|
+
}
|
1692
1765
|
|
1693
1766
|
const chatSectionStyles = i$4 `
|
1694
1767
|
:host {
|
@@ -1868,6 +1941,20 @@ var ProvidersShopGptSdk = (function () {
|
|
1868
1941
|
gap: 28px;
|
1869
1942
|
padding-bottom: 10px;
|
1870
1943
|
margin-bottom: -10px;
|
1944
|
+
margin-right: -10px;
|
1945
|
+
padding-right: 10px;
|
1946
|
+
margin-left: -10px;
|
1947
|
+
padding-left: 10px;
|
1948
|
+
background: linear-gradient(#f7f8fa80, #f7f8fa80),
|
1949
|
+
var(--shopgpt-merchant-img-url);
|
1950
|
+
background-position: center;
|
1951
|
+
background-repeat: no-repeat;
|
1952
|
+
background-size: contain;
|
1953
|
+
|
1954
|
+
&.loading {
|
1955
|
+
justify-content: center;
|
1956
|
+
align-items: center;
|
1957
|
+
}
|
1871
1958
|
|
1872
1959
|
.message:last-child {
|
1873
1960
|
margin-top: 10px;
|
@@ -2038,7 +2125,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2038
2125
|
.prompts {
|
2039
2126
|
display: flex;
|
2040
2127
|
justify-content: center;
|
2041
|
-
gap:
|
2128
|
+
gap: 10px;
|
2042
2129
|
flex-wrap: wrap;
|
2043
2130
|
|
2044
2131
|
.prompt {
|
@@ -2074,13 +2161,19 @@ var ProvidersShopGptSdk = (function () {
|
|
2074
2161
|
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
2075
2162
|
border-radius: 0px 0px 10px 10px;
|
2076
2163
|
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
font-weight: 700;
|
2082
|
-
line-height: 20px;
|
2164
|
+
.title-wrapper {
|
2165
|
+
display: flex;
|
2166
|
+
justify-content: space-between;
|
2167
|
+
align-items: center;
|
2083
2168
|
border-bottom: 1px solid #dbe2eb;
|
2169
|
+
padding: 10px 16px;
|
2170
|
+
|
2171
|
+
h2 {
|
2172
|
+
color: #172a41;
|
2173
|
+
font-size: 16px;
|
2174
|
+
font-weight: 700;
|
2175
|
+
line-height: 20px;
|
2176
|
+
}
|
2084
2177
|
}
|
2085
2178
|
|
2086
2179
|
.thread-titles-wrapper {
|
@@ -2402,9 +2495,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2402
2495
|
<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"/>
|
2403
2496
|
</svg>`;
|
2404
2497
|
|
2405
|
-
|
2406
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2407
|
-
class PersonalizeDialog extends r$3 {
|
2498
|
+
class PersonalizeDialog extends r$2 {
|
2408
2499
|
constructor() {
|
2409
2500
|
super(...arguments);
|
2410
2501
|
this.isLoading = false;
|
@@ -2647,74 +2738,173 @@ var ProvidersShopGptSdk = (function () {
|
|
2647
2738
|
</dialog>
|
2648
2739
|
`;
|
2649
2740
|
}
|
2650
|
-
}
|
2741
|
+
}
|
2651
2742
|
PersonalizeDialog.styles = [personalizeDialogStyles];
|
2652
2743
|
__decorate([
|
2653
|
-
e$
|
2744
|
+
e$3('dialog'),
|
2654
2745
|
__metadata("design:type", HTMLDialogElement)
|
2655
2746
|
], PersonalizeDialog.prototype, "dialogModal", void 0);
|
2656
2747
|
__decorate([
|
2657
|
-
e$
|
2748
|
+
e$3('.dropdown-list'),
|
2658
2749
|
__metadata("design:type", HTMLUListElement)
|
2659
2750
|
], PersonalizeDialog.prototype, "dropdownList", void 0);
|
2660
2751
|
__decorate([
|
2661
|
-
e$
|
2752
|
+
e$3('.dropdown-trigger'),
|
2662
2753
|
__metadata("design:type", HTMLDivElement)
|
2663
2754
|
], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
|
2664
2755
|
__decorate([
|
2665
|
-
n
|
2756
|
+
n({ type: Array }),
|
2666
2757
|
__metadata("design:type", Array)
|
2667
2758
|
], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
|
2668
2759
|
__decorate([
|
2669
|
-
n
|
2760
|
+
n({ type: Array }),
|
2670
2761
|
__metadata("design:type", Array)
|
2671
2762
|
], PersonalizeDialog.prototype, "defaultProfiles", void 0);
|
2672
2763
|
__decorate([
|
2673
|
-
n
|
2764
|
+
n({ type: Boolean }),
|
2674
2765
|
__metadata("design:type", Object)
|
2675
2766
|
], PersonalizeDialog.prototype, "isLoading", void 0);
|
2676
2767
|
__decorate([
|
2677
|
-
n
|
2768
|
+
n({ type: String }),
|
2678
2769
|
__metadata("design:type", Object)
|
2679
2770
|
], PersonalizeDialog.prototype, "state", void 0);
|
2680
2771
|
__decorate([
|
2681
|
-
n
|
2772
|
+
n({ type: String }),
|
2682
2773
|
__metadata("design:type", Object)
|
2683
2774
|
], PersonalizeDialog.prototype, "profileType", void 0);
|
2684
2775
|
__decorate([
|
2685
|
-
n
|
2776
|
+
n({ type: String }),
|
2686
2777
|
__metadata("design:type", Object)
|
2687
2778
|
], PersonalizeDialog.prototype, "selectedProfile", void 0);
|
2688
2779
|
__decorate([
|
2689
|
-
n
|
2780
|
+
n({ type: String }),
|
2690
2781
|
__metadata("design:type", Object)
|
2691
2782
|
], PersonalizeDialog.prototype, "visitorType", void 0);
|
2692
2783
|
__decorate([
|
2693
|
-
n
|
2784
|
+
n({ type: String }),
|
2694
2785
|
__metadata("design:type", Object)
|
2695
2786
|
], PersonalizeDialog.prototype, "productHandle", void 0);
|
2696
|
-
|
2697
|
-
|
2698
|
-
|
2699
|
-
], PersonalizeDialog);
|
2787
|
+
if (!customElements.get('personalize-dialog')) {
|
2788
|
+
customElements.define('personalize-dialog', PersonalizeDialog);
|
2789
|
+
}
|
2700
2790
|
|
2701
2791
|
/**
|
2702
2792
|
* @license
|
2703
2793
|
* Copyright 2017 Google LLC
|
2704
2794
|
* SPDX-License-Identifier: BSD-3-Clause
|
2705
|
-
*/
|
2706
|
-
|
2707
|
-
|
2795
|
+
*/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);
|
2796
|
+
|
2797
|
+
const markdown = (text) => {
|
2798
|
+
let src = text;
|
2799
|
+
const rx_space = /\t|\r|\uf8ff/g;
|
2800
|
+
const rx_hr = /^([*\-=_] *){3,}$/gm;
|
2801
|
+
const rx_blockquote = /\n *> *([^]*?)(?=(\n|$){2})/g;
|
2802
|
+
const rx_list = /\n( *)(?:[*\-+]|((\d+)|([a-z])|[A-Z])[.)]) +([^]*?)(?=(\n|$){2})/g;
|
2803
|
+
const rx_listjoin = /<\/(ol|ul)>\n\n<\1>/g;
|
2804
|
+
const rx_highlight = /(^|[^A-Za-z\d\\])(([*_])|(~)|(\^)|(--)|(\+\+)|`)(\2?)([^<]*?)\2\8(?!\2)(?=\W|_|$)/g;
|
2805
|
+
const rx_code = /\n((```|~~~).*\n?([^]*?)\n?\2|(( {4}.*?\n)+))/g;
|
2806
|
+
const rx_link = /((!?)\[(.*?)\]\((.*?)( ".*")?\)|\\([\\`*_{}[\]()#+\-.!~]))/g;
|
2807
|
+
const rx_table = /\n(( *\|.*?\| *\n)+)/g;
|
2808
|
+
const rx_thead = /^.*\n( *\|( *:?-+:?-+:? *\|)* *\n|)/;
|
2809
|
+
const rx_row = /.*\n/g;
|
2810
|
+
const rx_cell = /\|(.*?[^\\])\|/g;
|
2811
|
+
const rx_heading = /(?=^|>|\n)([>\s]*?)(#{1,6}) (.*?)( #*)? *(?=\n|$)/g;
|
2812
|
+
const rx_para = /(?=^|>|\n)\s*\n+([^<]+?)\n+\s*(?=\n|<|$)/g;
|
2813
|
+
const rx_stash = /-\d+\uf8ff/g;
|
2814
|
+
const stash = {};
|
2815
|
+
let si = 0;
|
2816
|
+
function replace(rex, fn) {
|
2817
|
+
src = src.replace(rex, fn);
|
2818
|
+
}
|
2819
|
+
function element(tag, content) {
|
2820
|
+
return `<${tag}>${content}</${tag}>`;
|
2821
|
+
}
|
2822
|
+
function blockquote(src) {
|
2823
|
+
return src.replace(rx_blockquote, (_, content) => {
|
2824
|
+
return element('blockquote', blockquote(highlight(content.replace(/^ *> */gm, ''))));
|
2825
|
+
});
|
2826
|
+
}
|
2827
|
+
function list(src) {
|
2828
|
+
return src.replace(rx_list, (all, ind, ol, num, low, content) => {
|
2829
|
+
const entry = element('li', highlight(content
|
2830
|
+
.split(new RegExp(`\n ?${ind}(?:(?:\\d+|[a-zA-Z])[.)]|[*\\-+]) +`, 'g'))
|
2831
|
+
.map(list)
|
2832
|
+
.join('</li><li>')));
|
2833
|
+
return `\n${ol
|
2834
|
+
? `<ol start="${num
|
2835
|
+
? ol + '">'
|
2836
|
+
: `${parseInt(ol, 36) - 9}" style="list-style-type:${low ? 'low' : 'upp'}er-alpha">`}${entry}</ol>`
|
2837
|
+
: element('ul', entry)}`;
|
2838
|
+
});
|
2839
|
+
}
|
2840
|
+
function highlight(src) {
|
2841
|
+
return src.replace(rx_highlight, function (all, _, p1, emp, sub, sup, small, big, p2, content) {
|
2842
|
+
return (_ +
|
2843
|
+
element(emp
|
2844
|
+
? p2
|
2845
|
+
? 'strong'
|
2846
|
+
: 'em'
|
2847
|
+
: sub
|
2848
|
+
? p2
|
2849
|
+
? 's'
|
2850
|
+
: 'sub'
|
2851
|
+
: sup
|
2852
|
+
? 'sup'
|
2853
|
+
: small
|
2854
|
+
? 'small'
|
2855
|
+
: big
|
2856
|
+
? 'big'
|
2857
|
+
: 'code', highlight(content)));
|
2858
|
+
});
|
2859
|
+
}
|
2860
|
+
src = `\n${src}\n`;
|
2861
|
+
replace(rx_space, ' ');
|
2862
|
+
src = blockquote(src);
|
2863
|
+
replace(rx_hr, '<hr/>');
|
2864
|
+
src = list(src);
|
2865
|
+
replace(rx_listjoin, '');
|
2866
|
+
replace(rx_code, (_, p1, p2, p3, p4) => {
|
2867
|
+
stash[--si] = element('pre', element('code', p3 || p4.replace(/^ {4}/gm, '')));
|
2868
|
+
return `${si}\uf8ff`;
|
2869
|
+
});
|
2870
|
+
replace(rx_link, (_, p1, p2, p3, p4, p5, p6) => {
|
2871
|
+
stash[--si] = p4
|
2872
|
+
? p2
|
2873
|
+
? `<img src="${p4}" alt="${p3}"/>`
|
2874
|
+
: `<a href="${p4}">${highlight(p3)}</a>`
|
2875
|
+
: p6;
|
2876
|
+
return `${si}\uf8ff`;
|
2877
|
+
});
|
2878
|
+
replace(rx_table, (_, table) => {
|
2879
|
+
var _a;
|
2880
|
+
const sep = ((_a = table.match(rx_thead)) === null || _a === void 0 ? void 0 : _a[1]) || '';
|
2881
|
+
return `\n${element('table', table.replace(rx_row, (row, ri) => {
|
2882
|
+
return row === sep
|
2883
|
+
? ''
|
2884
|
+
: element('tr', row.replace(rx_cell, (_, cell, ci) => ci
|
2885
|
+
? element(sep && !ri ? 'th' : 'td', highlight(cell || ''))
|
2886
|
+
: ''));
|
2887
|
+
}))}`;
|
2888
|
+
});
|
2889
|
+
replace(rx_heading, (_, prefix, p1, p2) => {
|
2890
|
+
return prefix + element(`h${p1.length}`, highlight(p2));
|
2891
|
+
});
|
2892
|
+
replace(rx_para, (_, content) => {
|
2893
|
+
return element('p', highlight(content));
|
2894
|
+
});
|
2895
|
+
replace(rx_stash, (all) => stash[parseInt(all)]);
|
2896
|
+
return src.trim();
|
2897
|
+
};
|
2708
2898
|
|
2709
|
-
|
2710
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2711
|
-
class MarkdownRenderer extends r$3 {
|
2899
|
+
class MarkdownRenderer extends r$2 {
|
2712
2900
|
render() {
|
2713
|
-
|
2714
|
-
const
|
2715
|
-
|
2901
|
+
// Remove lit markers from slot content
|
2902
|
+
const slotContent = this.innerHTML
|
2903
|
+
.trim()
|
2904
|
+
.replace(/<!--\?lit\$[\d$]+-->/g, '');
|
2905
|
+
return o(markdown(slotContent));
|
2716
2906
|
}
|
2717
|
-
}
|
2907
|
+
}
|
2718
2908
|
MarkdownRenderer.styles = i$4 `
|
2719
2909
|
:host {
|
2720
2910
|
font-family: 'Inter', sans-serif;
|
@@ -2726,14 +2916,11 @@ var ProvidersShopGptSdk = (function () {
|
|
2726
2916
|
}
|
2727
2917
|
}
|
2728
2918
|
`;
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
let TooltipComponent =
|
2735
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2736
|
-
class TooltipComponent extends r$3 {
|
2919
|
+
if (!customElements.get('markdown-renderer')) {
|
2920
|
+
customElements.define('markdown-renderer', MarkdownRenderer);
|
2921
|
+
}
|
2922
|
+
|
2923
|
+
class TooltipComponent extends r$2 {
|
2737
2924
|
constructor() {
|
2738
2925
|
super(...arguments);
|
2739
2926
|
this.position = 'bottom-left';
|
@@ -2745,7 +2932,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2745
2932
|
<div class="tooltip ${this.position}">${this.text}</div>
|
2746
2933
|
`;
|
2747
2934
|
}
|
2748
|
-
}
|
2935
|
+
}
|
2749
2936
|
TooltipComponent.styles = [
|
2750
2937
|
i$4 `
|
2751
2938
|
:host {
|
@@ -2757,7 +2944,6 @@ var ProvidersShopGptSdk = (function () {
|
|
2757
2944
|
position: absolute;
|
2758
2945
|
color: #172a41;
|
2759
2946
|
padding: 4px 8px;
|
2760
|
-
border-radius: 4px;
|
2761
2947
|
white-space: nowrap;
|
2762
2948
|
font-size: 12px;
|
2763
2949
|
opacity: 0;
|
@@ -2844,17 +3030,16 @@ var ProvidersShopGptSdk = (function () {
|
|
2844
3030
|
`,
|
2845
3031
|
];
|
2846
3032
|
__decorate([
|
2847
|
-
n
|
3033
|
+
n({ type: String }),
|
2848
3034
|
__metadata("design:type", String)
|
2849
3035
|
], TooltipComponent.prototype, "position", void 0);
|
2850
3036
|
__decorate([
|
2851
|
-
n
|
3037
|
+
n({ type: String }),
|
2852
3038
|
__metadata("design:type", Object)
|
2853
3039
|
], TooltipComponent.prototype, "text", void 0);
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
], TooltipComponent);
|
3040
|
+
if (!customElements.get('tooltip-component')) {
|
3041
|
+
customElements.define('tooltip-component', TooltipComponent);
|
3042
|
+
}
|
2858
3043
|
|
2859
3044
|
const confirmDialogStyles = i$4 `
|
2860
3045
|
:host {
|
@@ -2935,9 +3120,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2935
3120
|
}
|
2936
3121
|
`;
|
2937
3122
|
|
2938
|
-
|
2939
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2940
|
-
class ConfirmDialog extends r$3 {
|
3123
|
+
class ConfirmDialog extends r$2 {
|
2941
3124
|
onAcceptClick(e) {
|
2942
3125
|
e.preventDefault();
|
2943
3126
|
this.dispatchEvent(new CustomEvent('accept', {
|
@@ -2970,19 +3153,17 @@ var ProvidersShopGptSdk = (function () {
|
|
2970
3153
|
</div>
|
2971
3154
|
`;
|
2972
3155
|
}
|
2973
|
-
}
|
3156
|
+
}
|
2974
3157
|
ConfirmDialog.styles = [confirmDialogStyles];
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
2978
|
-
|
2979
|
-
|
2980
|
-
let ChatSection =
|
2981
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2982
|
-
class ChatSection extends r$3 {
|
3158
|
+
if (!customElements.get('confirm-dialog')) {
|
3159
|
+
customElements.define('confirm-dialog', ConfirmDialog);
|
3160
|
+
}
|
3161
|
+
|
3162
|
+
class ChatSection extends r$2 {
|
2983
3163
|
constructor() {
|
2984
3164
|
super(...arguments);
|
2985
3165
|
this.showChatThreads = false;
|
3166
|
+
this.deleteAllThreads = false;
|
2986
3167
|
this.userQuery = '';
|
2987
3168
|
}
|
2988
3169
|
scrollToBottom() {
|
@@ -3007,6 +3188,14 @@ var ProvidersShopGptSdk = (function () {
|
|
3007
3188
|
await this.processMessage(e, message);
|
3008
3189
|
}
|
3009
3190
|
handleThreadDelete() {
|
3191
|
+
if (this.deleteAllThreads) {
|
3192
|
+
this.dispatchEvent(new CustomEvent('delete-all-threads', {
|
3193
|
+
composed: true,
|
3194
|
+
bubbles: true,
|
3195
|
+
}));
|
3196
|
+
this.deleteAllThreads = false;
|
3197
|
+
return;
|
3198
|
+
}
|
3010
3199
|
if (!this.deleteThreadId) {
|
3011
3200
|
return;
|
3012
3201
|
}
|
@@ -3060,8 +3249,10 @@ var ProvidersShopGptSdk = (function () {
|
|
3060
3249
|
`;
|
3061
3250
|
}
|
3062
3251
|
chatWindow() {
|
3063
|
-
if (this.isLoadingHistory) {
|
3064
|
-
return x
|
3252
|
+
if (this.isLoadingHistory || this.isLoadingThreads) {
|
3253
|
+
return x `<div class="messages loading">
|
3254
|
+
<load-spinner></load-spinner>
|
3255
|
+
</div>`;
|
3065
3256
|
}
|
3066
3257
|
return x `
|
3067
3258
|
<div class="messages">
|
@@ -3102,16 +3293,20 @@ var ProvidersShopGptSdk = (function () {
|
|
3102
3293
|
`;
|
3103
3294
|
}
|
3104
3295
|
quickPrompts() {
|
3105
|
-
|
3106
|
-
|
3296
|
+
if (this.isLoadingHistory || this.isTyping || this.isLoadingThreads) {
|
3297
|
+
return E;
|
3298
|
+
}
|
3299
|
+
const prompts = this.messages.length
|
3300
|
+
? this.messages[0].welcomePrompts
|
3301
|
+
: this.prompts
|
3302
|
+
? this.prompts.split(',').map((prompt) => prompt.trim())
|
3303
|
+
: ['Best Selling Items', 'Hot Sales'];
|
3304
|
+
if (!prompts) {
|
3107
3305
|
return E;
|
3108
3306
|
}
|
3109
|
-
const defaultPrompts = this.prompts
|
3110
|
-
? this.prompts.split(',').map((prompt) => prompt.trim())
|
3111
|
-
: ['Best Selling Items', 'Hot Sales'];
|
3112
3307
|
return x `
|
3113
3308
|
<div class="prompts btn">
|
3114
|
-
${
|
3309
|
+
${prompts.map((prompt) => x `
|
3115
3310
|
<div
|
3116
3311
|
class="prompt"
|
3117
3312
|
@click=${(e) => this.processMessage(e, prompt)}
|
@@ -3215,10 +3410,10 @@ var ProvidersShopGptSdk = (function () {
|
|
3215
3410
|
</tooltip-component>
|
3216
3411
|
<tooltip-component
|
3217
3412
|
.position=${'bottom-right'}
|
3218
|
-
.text=${'
|
3413
|
+
.text=${'Search History'}
|
3219
3414
|
>
|
3220
3415
|
<button
|
3221
|
-
class=${e$
|
3416
|
+
class=${e$1({
|
3222
3417
|
btn: true,
|
3223
3418
|
'btn-icon': true,
|
3224
3419
|
'threads-btn': true,
|
@@ -3290,11 +3485,27 @@ var ProvidersShopGptSdk = (function () {
|
|
3290
3485
|
}
|
3291
3486
|
return x ` <div id="modal-chat-threads">
|
3292
3487
|
<div class="chat-threads">
|
3293
|
-
<
|
3488
|
+
<div class="title-wrapper">
|
3489
|
+
<h2>Search History</h2>
|
3490
|
+
${this.chatThreads.size
|
3491
|
+
? x `<div
|
3492
|
+
class="trash-icon"
|
3493
|
+
@click=${() => {
|
3494
|
+
if (this.isTyping) {
|
3495
|
+
return;
|
3496
|
+
}
|
3497
|
+
this.deleteAllThreads = true;
|
3498
|
+
this.showChatThreads = false;
|
3499
|
+
}}
|
3500
|
+
>
|
3501
|
+
${trashIcon}
|
3502
|
+
</div>`
|
3503
|
+
: E}
|
3504
|
+
</div>
|
3294
3505
|
<div class="thread-titles-wrapper">
|
3295
3506
|
${o$1(this.chatThreads.values(), (thread) => x `
|
3296
3507
|
<div
|
3297
|
-
class=${e$
|
3508
|
+
class=${e$1({
|
3298
3509
|
'thread-title': true,
|
3299
3510
|
disabled: this.isTyping,
|
3300
3511
|
})}
|
@@ -3334,10 +3545,17 @@ var ProvidersShopGptSdk = (function () {
|
|
3334
3545
|
</div>`;
|
3335
3546
|
}
|
3336
3547
|
render() {
|
3548
|
+
if (this.merchantImage) {
|
3549
|
+
// set the merchant image as a css variable
|
3550
|
+
this.style.setProperty('--shopgpt-merchant-img-url', `url('${this.merchantImage}')`);
|
3551
|
+
}
|
3552
|
+
else {
|
3553
|
+
this.style.removeProperty('--shopgpt-merchant-img-url');
|
3554
|
+
}
|
3337
3555
|
return x `
|
3338
3556
|
<div class="chat-header">${this.contextButton()}</div>
|
3339
3557
|
<div
|
3340
|
-
class=${e$
|
3558
|
+
class=${e$1({
|
3341
3559
|
'chatbot-section': true,
|
3342
3560
|
'modal-view': this.viewType === 'modal',
|
3343
3561
|
})}
|
@@ -3351,7 +3569,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3351
3569
|
placeholder="Type your search here..."
|
3352
3570
|
/>
|
3353
3571
|
<button
|
3354
|
-
class=${e$
|
3572
|
+
class=${e$1({
|
3355
3573
|
btn: true,
|
3356
3574
|
modal: this.viewType === 'modal',
|
3357
3575
|
})}
|
@@ -3368,105 +3586,128 @@ var ProvidersShopGptSdk = (function () {
|
|
3368
3586
|
.defaultProfiles=${this.profiles}
|
3369
3587
|
></personalize-dialog>
|
3370
3588
|
${this.renderChatThreads()}
|
3371
|
-
${this.deleteThreadId
|
3589
|
+
${this.deleteThreadId || this.deleteAllThreads
|
3372
3590
|
? x `
|
3373
3591
|
<confirm-dialog
|
3374
3592
|
@accept=${this.handleThreadDelete}
|
3375
|
-
@decline=${() =>
|
3593
|
+
@decline=${() => {
|
3594
|
+
this.deleteThreadId = '';
|
3595
|
+
this.deleteAllThreads = false;
|
3596
|
+
}}
|
3376
3597
|
>
|
3377
|
-
<h2 slot="title">
|
3598
|
+
<h2 slot="title">
|
3599
|
+
${this.deleteAllThreads
|
3600
|
+
? 'Delete Entire Chat History?'
|
3601
|
+
: 'Delete Chat?'}
|
3602
|
+
</h2>
|
3378
3603
|
<p slot="content">
|
3379
3604
|
This action cannot be undone. Are you sure you want to delete
|
3380
|
-
|
3605
|
+
${this.deleteAllThreads
|
3606
|
+
? ' the entire chat history'
|
3607
|
+
: x `<b
|
3608
|
+
>"${this.chatThreads.get(this.deleteThreadId)
|
3609
|
+
.title}"</b
|
3610
|
+
>`}?
|
3381
3611
|
</p>
|
3382
3612
|
</confirm-dialog>
|
3383
3613
|
`
|
3384
3614
|
: E}
|
3385
3615
|
`;
|
3386
3616
|
}
|
3387
|
-
}
|
3617
|
+
}
|
3388
3618
|
ChatSection.styles = [chatSectionStyles];
|
3389
3619
|
__decorate([
|
3390
|
-
n
|
3620
|
+
n({ type: String }),
|
3621
|
+
__metadata("design:type", Object)
|
3622
|
+
], ChatSection.prototype, "merchantImage", void 0);
|
3623
|
+
__decorate([
|
3624
|
+
n({ type: String }),
|
3391
3625
|
__metadata("design:type", Object)
|
3392
3626
|
], ChatSection.prototype, "brandName", void 0);
|
3393
3627
|
__decorate([
|
3394
|
-
n
|
3628
|
+
n({ type: String }),
|
3395
3629
|
__metadata("design:type", Object)
|
3396
3630
|
], ChatSection.prototype, "prompts", void 0);
|
3397
3631
|
__decorate([
|
3398
|
-
n
|
3632
|
+
n({ type: Boolean }),
|
3633
|
+
__metadata("design:type", Boolean)
|
3634
|
+
], ChatSection.prototype, "isLoadingThreads", void 0);
|
3635
|
+
__decorate([
|
3636
|
+
n({ type: Object }),
|
3399
3637
|
__metadata("design:type", Map)
|
3400
3638
|
], ChatSection.prototype, "chatThreads", void 0);
|
3401
3639
|
__decorate([
|
3402
|
-
r
|
3640
|
+
r(),
|
3403
3641
|
__metadata("design:type", String)
|
3404
3642
|
], ChatSection.prototype, "deleteThreadId", void 0);
|
3405
3643
|
__decorate([
|
3406
|
-
n
|
3644
|
+
n({ type: Boolean }),
|
3407
3645
|
__metadata("design:type", Object)
|
3408
3646
|
], ChatSection.prototype, "showChatThreads", void 0);
|
3409
3647
|
__decorate([
|
3410
|
-
n
|
3648
|
+
n({ type: Boolean }),
|
3411
3649
|
__metadata("design:type", Boolean)
|
3412
3650
|
], ChatSection.prototype, "isLoadingHistory", void 0);
|
3413
3651
|
__decorate([
|
3414
|
-
n
|
3652
|
+
n({ type: Boolean }),
|
3415
3653
|
__metadata("design:type", Object)
|
3416
3654
|
], ChatSection.prototype, "devMode", void 0);
|
3417
3655
|
__decorate([
|
3418
|
-
n
|
3656
|
+
n({ type: Boolean }),
|
3419
3657
|
__metadata("design:type", Boolean)
|
3420
3658
|
], ChatSection.prototype, "isTyping", void 0);
|
3421
3659
|
__decorate([
|
3422
|
-
n
|
3660
|
+
n({ type: Boolean }),
|
3423
3661
|
__metadata("design:type", Boolean)
|
3424
3662
|
], ChatSection.prototype, "isFailed", void 0);
|
3425
3663
|
__decorate([
|
3426
|
-
n
|
3664
|
+
n({ type: Array }),
|
3427
3665
|
__metadata("design:type", Array)
|
3428
3666
|
], ChatSection.prototype, "messages", void 0);
|
3429
3667
|
__decorate([
|
3430
|
-
n
|
3668
|
+
n({ type: Array }),
|
3431
3669
|
__metadata("design:type", Array)
|
3432
3670
|
], ChatSection.prototype, "profiles", void 0);
|
3433
3671
|
__decorate([
|
3434
|
-
n
|
3672
|
+
n({ type: Array }),
|
3435
3673
|
__metadata("design:type", Array)
|
3436
3674
|
], ChatSection.prototype, "productHandles", void 0);
|
3437
3675
|
__decorate([
|
3438
|
-
n
|
3676
|
+
n({ type: Object }),
|
3439
3677
|
__metadata("design:type", Object)
|
3440
3678
|
], ChatSection.prototype, "thread", void 0);
|
3441
3679
|
__decorate([
|
3442
|
-
n
|
3680
|
+
n({ type: Object }),
|
3443
3681
|
__metadata("design:type", Object)
|
3444
3682
|
], ChatSection.prototype, "siteCurrency", void 0);
|
3445
3683
|
__decorate([
|
3446
|
-
|
3684
|
+
r(),
|
3685
|
+
__metadata("design:type", Object)
|
3686
|
+
], ChatSection.prototype, "deleteAllThreads", void 0);
|
3687
|
+
__decorate([
|
3688
|
+
e$3('.context-container'),
|
3447
3689
|
__metadata("design:type", Object)
|
3448
3690
|
], ChatSection.prototype, "contextContainerElement", void 0);
|
3449
3691
|
__decorate([
|
3450
|
-
e$
|
3692
|
+
e$3('.chat-window'),
|
3451
3693
|
__metadata("design:type", Object)
|
3452
3694
|
], ChatSection.prototype, "chatWindowElement", void 0);
|
3453
3695
|
__decorate([
|
3454
|
-
e$
|
3696
|
+
e$3('personalize-dialog'),
|
3455
3697
|
__metadata("design:type", Object)
|
3456
3698
|
], ChatSection.prototype, "personalizeDialogElement", void 0);
|
3457
3699
|
__decorate([
|
3458
|
-
n
|
3700
|
+
n({ type: String }),
|
3459
3701
|
__metadata("design:type", Object)
|
3460
3702
|
], ChatSection.prototype, "userQuery", void 0);
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3464
|
-
], ChatSection);
|
3703
|
+
if (!customElements.get('chat-section')) {
|
3704
|
+
customElements.define('chat-section', ChatSection);
|
3705
|
+
}
|
3465
3706
|
|
3466
3707
|
const DIALOG_DELAY = 1000;
|
3467
3708
|
const LATEST_THREAD_LOAD_DAYS = 14;
|
3468
3709
|
const normalizePath = (path) => path.replace(/\/$/, '');
|
3469
|
-
|
3710
|
+
class ShopGPT extends r$2 {
|
3470
3711
|
constructor() {
|
3471
3712
|
super(...arguments);
|
3472
3713
|
this.modalState = 'close';
|
@@ -3483,9 +3724,13 @@ var ProvidersShopGptSdk = (function () {
|
|
3483
3724
|
return;
|
3484
3725
|
}
|
3485
3726
|
await this.loadChatThreads();
|
3486
|
-
await this.loadInitialQuery();
|
3487
3727
|
this.selectLatestThread();
|
3488
3728
|
};
|
3729
|
+
this.onPopState = () => {
|
3730
|
+
var _a;
|
3731
|
+
this.modalState = 'close';
|
3732
|
+
(_a = this.shopGPTDialog) === null || _a === void 0 ? void 0 : _a.close();
|
3733
|
+
};
|
3489
3734
|
this.submitQuery = (message) => {
|
3490
3735
|
if (!message) {
|
3491
3736
|
return;
|
@@ -3511,10 +3756,12 @@ var ProvidersShopGptSdk = (function () {
|
|
3511
3756
|
}
|
3512
3757
|
disconnectedCallback() {
|
3513
3758
|
window.removeEventListener('edgetag-initialized', this.loadData);
|
3759
|
+
window.removeEventListener('popstate', this.onPopState);
|
3514
3760
|
super.disconnectedCallback();
|
3515
3761
|
}
|
3516
3762
|
init() {
|
3517
3763
|
window.addEventListener('edgetag-initialized', this.loadData);
|
3764
|
+
window.addEventListener('popstate', this.onPopState);
|
3518
3765
|
if (!this.uiMode || this.uiMode === 'overlay') {
|
3519
3766
|
delay(DIALOG_DELAY).then(() => {
|
3520
3767
|
var _a;
|
@@ -3529,6 +3776,19 @@ var ProvidersShopGptSdk = (function () {
|
|
3529
3776
|
});
|
3530
3777
|
}
|
3531
3778
|
}
|
3779
|
+
setChatTitle(threadId, title) {
|
3780
|
+
if (!title || !threadId) {
|
3781
|
+
return;
|
3782
|
+
}
|
3783
|
+
const thread = this.chatThreads.get(threadId);
|
3784
|
+
if (thread) {
|
3785
|
+
this.chatThreads.set(thread.threadId, {
|
3786
|
+
...thread,
|
3787
|
+
title,
|
3788
|
+
});
|
3789
|
+
this.chatThreads = new Map(this.chatThreads);
|
3790
|
+
}
|
3791
|
+
}
|
3532
3792
|
async loadInitialQuery() {
|
3533
3793
|
var _a;
|
3534
3794
|
if (!this.selectedThreadId) {
|
@@ -3541,14 +3801,26 @@ var ProvidersShopGptSdk = (function () {
|
|
3541
3801
|
if (!thread) {
|
3542
3802
|
return;
|
3543
3803
|
}
|
3804
|
+
const searchParam = new URLSearchParams(window.location.search);
|
3805
|
+
const fromAd = searchParam.get('shopGPT') === '1';
|
3544
3806
|
const productHandle = this.devMode
|
3545
3807
|
? (_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.productHandle
|
3546
|
-
:
|
3808
|
+
: fromAd
|
3809
|
+
? this.storeAPI.getCurrentProductHandle()
|
3810
|
+
: undefined;
|
3547
3811
|
try {
|
3548
3812
|
this.isTyping = true;
|
3549
3813
|
const reply = await this.shopGPTAPI.processQuery('', thread.threadId, productHandle);
|
3814
|
+
if (reply.chatTitle) {
|
3815
|
+
this.setChatTitle(this.selectedThreadId, reply.chatTitle);
|
3816
|
+
}
|
3550
3817
|
this.messages = [
|
3551
|
-
{
|
3818
|
+
{
|
3819
|
+
sender: 'bot',
|
3820
|
+
message: reply.message,
|
3821
|
+
products: reply.products,
|
3822
|
+
welcomePrompts: reply.welcomePrompts,
|
3823
|
+
},
|
3552
3824
|
...this.messages,
|
3553
3825
|
];
|
3554
3826
|
this.products = reply.products || [];
|
@@ -3575,9 +3847,6 @@ var ProvidersShopGptSdk = (function () {
|
|
3575
3847
|
}
|
3576
3848
|
}
|
3577
3849
|
selectLatestThread() {
|
3578
|
-
if (!this.devMode) {
|
3579
|
-
return;
|
3580
|
-
}
|
3581
3850
|
const cutoffTime = Date.now() - LATEST_THREAD_LOAD_DAYS * 24 * 60 * 60 * 1000;
|
3582
3851
|
// If the latest thread is not older than cutoff we should load the thread
|
3583
3852
|
let latestThread;
|
@@ -3590,9 +3859,11 @@ var ProvidersShopGptSdk = (function () {
|
|
3590
3859
|
if (latestThread) {
|
3591
3860
|
this.setSelectedThreadId(latestThread.threadId);
|
3592
3861
|
}
|
3862
|
+
else if (!this.devMode) {
|
3863
|
+
this.createChatThread({ title: '' }, true);
|
3864
|
+
}
|
3593
3865
|
}
|
3594
3866
|
async loadHistory(threadId) {
|
3595
|
-
var _a, _b, _c;
|
3596
3867
|
try {
|
3597
3868
|
if (!threadId) {
|
3598
3869
|
this.messages = [];
|
@@ -3601,22 +3872,24 @@ var ProvidersShopGptSdk = (function () {
|
|
3601
3872
|
}
|
3602
3873
|
this.isLoadingHistory = true;
|
3603
3874
|
const data = await this.shopGPTAPI.fetchChatHistory(threadId);
|
3875
|
+
let latestAvailableProducts = [];
|
3604
3876
|
this.messages = data.map((message) => {
|
3605
3877
|
var _a;
|
3606
|
-
|
3878
|
+
const products = (_a = message.products) === null || _a === void 0 ? void 0 : _a.map((product) => ({
|
3879
|
+
...product,
|
3880
|
+
quantity: 1,
|
3881
|
+
}));
|
3882
|
+
if (!latestAvailableProducts.length && (products === null || products === void 0 ? void 0 : products.length)) {
|
3883
|
+
latestAvailableProducts = products;
|
3884
|
+
}
|
3885
|
+
return {
|
3607
3886
|
message: message.message,
|
3608
3887
|
sender: message.sender,
|
3609
|
-
products
|
3610
|
-
|
3611
|
-
|
3612
|
-
})),
|
3613
|
-
});
|
3888
|
+
products,
|
3889
|
+
welcomePrompts: message.welcomePrompts,
|
3890
|
+
};
|
3614
3891
|
});
|
3615
|
-
this.products =
|
3616
|
-
(_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) => ({
|
3617
|
-
...product,
|
3618
|
-
quantity: 1,
|
3619
|
-
}))) !== null && _c !== void 0 ? _c : [];
|
3892
|
+
this.products = latestAvailableProducts;
|
3620
3893
|
}
|
3621
3894
|
catch (e) {
|
3622
3895
|
logger.error(e);
|
@@ -3657,6 +3930,21 @@ var ProvidersShopGptSdk = (function () {
|
|
3657
3930
|
this.shopGPTAPI
|
3658
3931
|
.deleteSingleThread(threadId)
|
3659
3932
|
.then(this.loadChatThreads.bind(this))
|
3933
|
+
.then(() => {
|
3934
|
+
if (this.selectedThreadId === threadId) {
|
3935
|
+
this.setSelectedThreadId('');
|
3936
|
+
}
|
3937
|
+
})
|
3938
|
+
.catch(logger.error)
|
3939
|
+
.finally(() => (this.isLoadingThreads = false));
|
3940
|
+
}
|
3941
|
+
handleAllThreadsDelete(e) {
|
3942
|
+
e.stopPropagation();
|
3943
|
+
this.isLoadingThreads = true;
|
3944
|
+
this.shopGPTAPI
|
3945
|
+
.deleteAllThreads()
|
3946
|
+
.then(this.loadChatThreads.bind(this))
|
3947
|
+
.then(() => this.setSelectedThreadId(''))
|
3660
3948
|
.catch(logger.error)
|
3661
3949
|
.finally(() => (this.isLoadingThreads = false));
|
3662
3950
|
}
|
@@ -3675,21 +3963,20 @@ var ProvidersShopGptSdk = (function () {
|
|
3675
3963
|
return;
|
3676
3964
|
}
|
3677
3965
|
if (reply.chatTitle) {
|
3678
|
-
|
3679
|
-
const thread = this.chatThreads.get(this.selectedThreadId);
|
3680
|
-
if (thread) {
|
3681
|
-
this.chatThreads.set(thread.threadId, {
|
3682
|
-
...thread,
|
3683
|
-
title: reply.chatTitle,
|
3684
|
-
});
|
3685
|
-
this.chatThreads = new Map(this.chatThreads);
|
3686
|
-
}
|
3966
|
+
this.setChatTitle(this.selectedThreadId, reply.chatTitle);
|
3687
3967
|
}
|
3688
3968
|
this.messages = [
|
3689
|
-
{
|
3969
|
+
{
|
3970
|
+
sender: 'bot',
|
3971
|
+
message: reply.message,
|
3972
|
+
products: reply.products,
|
3973
|
+
welcomePrompts: reply.welcomePrompts,
|
3974
|
+
},
|
3690
3975
|
...this.messages,
|
3691
3976
|
];
|
3692
|
-
|
3977
|
+
if (reply.products && reply.products.length > 0) {
|
3978
|
+
this.products = reply.products;
|
3979
|
+
}
|
3693
3980
|
}
|
3694
3981
|
catch (err) {
|
3695
3982
|
logger.error(err);
|
@@ -3714,6 +4001,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3714
4001
|
<dialog
|
3715
4002
|
id="shop-gpt-dialog-overlay"
|
3716
4003
|
@delete-thread=${this.handleThreadDelete}
|
4004
|
+
@delete-all-threads=${this.handleAllThreadsDelete}
|
3717
4005
|
>
|
3718
4006
|
<div class="mobile-version">
|
3719
4007
|
Please switch to the desktop version for the best experience.
|
@@ -3732,6 +4020,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3732
4020
|
.products=${this.products}
|
3733
4021
|
.isLoadingHistory=${this.isLoadingHistory}
|
3734
4022
|
.siteCurrency=${this.getSiteCurrency()}
|
4023
|
+
.isLoadingThreads=${this.isLoadingThreads}
|
3735
4024
|
></products-section>
|
3736
4025
|
<chat-section
|
3737
4026
|
.prompts=${this.quickPrompts}
|
@@ -3748,6 +4037,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3748
4037
|
.productHandles=${this.productHandles}
|
3749
4038
|
.profiles=${this.profiles}
|
3750
4039
|
.viewType=${'overlay'}
|
4040
|
+
.isLoadingThreads=${this.isLoadingThreads}
|
3751
4041
|
></chat-section>
|
3752
4042
|
</div>
|
3753
4043
|
</dialog>
|
@@ -3768,10 +4058,15 @@ var ProvidersShopGptSdk = (function () {
|
|
3768
4058
|
>
|
3769
4059
|
${chatIcon}
|
3770
4060
|
</button>
|
4061
|
+
<div class="chatbot-hover-text">What are you looking for today?</div>
|
3771
4062
|
</div>`;
|
3772
4063
|
}
|
3773
4064
|
return x `
|
3774
|
-
<div
|
4065
|
+
<div
|
4066
|
+
id="shop-gpt-modal"
|
4067
|
+
@delete-thread=${this.handleThreadDelete}
|
4068
|
+
@delete-all-threads=${this.handleAllThreadsDelete}
|
4069
|
+
>
|
3775
4070
|
<chat-section
|
3776
4071
|
.prompts=${this.quickPrompts}
|
3777
4072
|
.brandName=${this.brandName}
|
@@ -3790,55 +4085,57 @@ var ProvidersShopGptSdk = (function () {
|
|
3790
4085
|
.closeModal=${closeModal}
|
3791
4086
|
.setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
|
3792
4087
|
.chatThreads=${this.chatThreads}
|
4088
|
+
.isLoadingThreads=${this.isLoadingThreads}
|
4089
|
+
.merchantImage=${this.merchantImage}
|
3793
4090
|
></chat-section>
|
3794
4091
|
</div>
|
3795
4092
|
`;
|
3796
4093
|
}
|
3797
|
-
}
|
4094
|
+
}
|
3798
4095
|
ShopGPT.styles = [shopGPTStyles];
|
3799
4096
|
__decorate([
|
3800
|
-
e$
|
4097
|
+
e$3('#shop-gpt-dialog-overlay'),
|
3801
4098
|
__metadata("design:type", Object)
|
3802
4099
|
], ShopGPT.prototype, "shopGPTDialog", void 0);
|
3803
4100
|
__decorate([
|
3804
|
-
n
|
4101
|
+
n({ type: String }),
|
3805
4102
|
__metadata("design:type", String)
|
3806
4103
|
], ShopGPT.prototype, "modalState", void 0);
|
3807
4104
|
__decorate([
|
3808
|
-
n
|
4105
|
+
n({ type: Boolean }),
|
3809
4106
|
__metadata("design:type", Object)
|
3810
4107
|
], ShopGPT.prototype, "isLoadingHistory", void 0);
|
3811
4108
|
__decorate([
|
3812
|
-
n
|
4109
|
+
n({ type: Boolean }),
|
3813
4110
|
__metadata("design:type", Object)
|
3814
4111
|
], ShopGPT.prototype, "isLoadingThreads", void 0);
|
3815
4112
|
__decorate([
|
3816
|
-
n
|
4113
|
+
n({ type: Boolean }),
|
3817
4114
|
__metadata("design:type", Object)
|
3818
4115
|
], ShopGPT.prototype, "isTyping", void 0);
|
3819
4116
|
__decorate([
|
3820
|
-
n
|
4117
|
+
n({ type: Boolean }),
|
3821
4118
|
__metadata("design:type", Object)
|
3822
4119
|
], ShopGPT.prototype, "isFailed", void 0);
|
3823
4120
|
__decorate([
|
3824
|
-
n
|
4121
|
+
n({ type: String }),
|
3825
4122
|
__metadata("design:type", Object)
|
3826
4123
|
], ShopGPT.prototype, "selectedThreadId", void 0);
|
3827
4124
|
__decorate([
|
3828
|
-
n
|
4125
|
+
n({ type: Array }),
|
3829
4126
|
__metadata("design:type", Array)
|
3830
4127
|
], ShopGPT.prototype, "products", void 0);
|
3831
4128
|
__decorate([
|
3832
|
-
n
|
4129
|
+
n({ type: Array }),
|
3833
4130
|
__metadata("design:type", Array)
|
3834
4131
|
], ShopGPT.prototype, "messages", void 0);
|
3835
4132
|
__decorate([
|
3836
|
-
n
|
4133
|
+
n({ type: Object }),
|
3837
4134
|
__metadata("design:type", Map)
|
3838
4135
|
], ShopGPT.prototype, "chatThreads", void 0);
|
3839
|
-
|
3840
|
-
|
3841
|
-
|
4136
|
+
if (!customElements.get('shop-gpt')) {
|
4137
|
+
customElements.define('shop-gpt', ShopGPT);
|
4138
|
+
}
|
3842
4139
|
|
3843
4140
|
var _a, _b;
|
3844
4141
|
var _c;
|
@@ -3864,6 +4161,14 @@ var ProvidersShopGptSdk = (function () {
|
|
3864
4161
|
shopGPT.merchantImage = params.merchantImage;
|
3865
4162
|
document.body.append(shopGPT);
|
3866
4163
|
},
|
4164
|
+
destroy() {
|
4165
|
+
if (!shopGPT) {
|
4166
|
+
return;
|
4167
|
+
}
|
4168
|
+
shopGPT.remove();
|
4169
|
+
shopGPT = undefined;
|
4170
|
+
delete window[registryKey];
|
4171
|
+
},
|
3867
4172
|
});
|
3868
4173
|
}
|
3869
4174
|
|