@blotoutio/providers-shop-gpt-sdk 1.3.0 → 1.5.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.
Files changed (4) hide show
  1. package/index.cjs.js +579 -263
  2. package/index.js +579 -263
  3. package/index.mjs +579 -263
  4. package/package.json +1 -1
package/index.js CHANGED
@@ -303,6 +303,7 @@ var ProvidersShopGptSdk = (function () {
303
303
  new Set(isoCountries.keys());
304
304
 
305
305
  const packageName = 'shopGPT';
306
+ const DEFAULT_MAX_THREAD_AGE = 14;
306
307
  const previewKeyName = 'previewShopGPT';
307
308
 
308
309
  const canLog = () => {
@@ -385,6 +386,7 @@ var ProvidersShopGptSdk = (function () {
385
386
  message: data.message,
386
387
  products: (_a = data.products) === null || _a === void 0 ? void 0 : _a.filter((item) => !!item).map((item) => ({ ...item, quantity: 1 })),
387
388
  chatTitle: data.chatTitle,
389
+ welcomePrompts: data.welcomePrompts,
388
390
  };
389
391
  };
390
392
  const fetchChatHistory = async (threadId) => {
@@ -491,7 +493,7 @@ var ProvidersShopGptSdk = (function () {
491
493
  // exit if not in top window
492
494
  return;
493
495
  }
494
- const { enabled, devMode, merchantUrl, profiles, productHandles, targetPath, uiMode, brandName, quickPrompts, merchantImage, } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
496
+ const { enabled, devMode, merchantUrl, profiles, productHandles, targetPath, uiMode, brandName, quickPrompts, merchantImage, latestThreadLoad, } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
495
497
  let shouldShowUI = enabled;
496
498
  if (!enabled && hasPreviewKey()) {
497
499
  logger.log('Enabling UI in preview mode');
@@ -520,6 +522,7 @@ var ProvidersShopGptSdk = (function () {
520
522
  brandName,
521
523
  quickPrompts,
522
524
  merchantImage,
525
+ latestThreadLoad: latestThreadLoad !== null && latestThreadLoad !== void 0 ? latestThreadLoad : DEFAULT_MAX_THREAD_AGE,
523
526
  });
524
527
  }
525
528
  };
@@ -577,58 +580,51 @@ var ProvidersShopGptSdk = (function () {
577
580
  * Copyright 2019 Google LLC
578
581
  * SPDX-License-Identifier: BSD-3-Clause
579
582
  */
580
- const t$4=globalThis,e$8=t$4.ShadowRoot&&(void 0===t$4.ShadyCSS||t$4.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$5=new WeakMap;let n$4 = 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$8&&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$6=t=>new n$4("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$4(o,t,s$1)},S$1=(s,o)=>{if(e$8)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$4.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$8?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$6(e)})(t):t;
583
+ 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
584
 
582
585
  /**
583
586
  * @license
584
587
  * Copyright 2017 Google LLC
585
588
  * SPDX-License-Identifier: BSD-3-Clause
586
- */const{is:i$3,defineProperty:e$7,getOwnPropertyDescriptor:r$5,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$4,getPrototypeOf:n$3}=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$7(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$5(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$3(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");
589
+ */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
590
 
588
591
  /**
589
592
  * @license
590
593
  * Copyright 2017 Google LLC
591
594
  * SPDX-License-Identifier: BSD-3-Clause
592
595
  */
593
- const t$3=globalThis,i$2=t$3.trustedTypes,s=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$6="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$3="?"+h,n$2=`<${o$3}>`,r$4=document,l=()=>r$4.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$4.createTreeWalker(r$4,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$2:d>=0?(o.push(a),s.slice(0,d)+e$6+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$6)){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$4.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$4).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$4,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$4.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$3.litHtmlPolyfillSupport;j?.(N,R),(t$3.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};
596
+ 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
597
 
595
598
  /**
596
599
  * @license
597
600
  * Copyright 2017 Google LLC
598
601
  * SPDX-License-Identifier: BSD-3-Clause
599
- */let r$3 = 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$3._$litElement$=!0,r$3["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r$3});const i$1=globalThis.litElementPolyfillSupport;i$1?.({LitElement:r$3});(globalThis.litElementVersions??=[]).push("4.1.1");
602
+ */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
603
 
601
604
  /**
602
605
  * @license
603
606
  * Copyright 2017 Google LLC
604
607
  * 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);};
608
+ */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
609
 
608
610
  /**
609
611
  * @license
610
612
  * Copyright 2017 Google LLC
611
613
  * SPDX-License-Identifier: BSD-3-Clause
612
- */const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$2=(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$1(t){return (e,o)=>"object"==typeof o?r$2(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)}
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})}
614
+ */function r(r){return n({...r,state:!0,attribute:!1})}
619
615
 
620
616
  /**
621
617
  * @license
622
618
  * Copyright 2017 Google LLC
623
619
  * SPDX-License-Identifier: BSD-3-Clause
624
620
  */
625
- const e$5=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
621
+ const e$4=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
626
622
 
627
623
  /**
628
624
  * @license
629
625
  * Copyright 2017 Google LLC
630
626
  * SPDX-License-Identifier: BSD-3-Clause
631
- */function e$4(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$5(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$5(n,s,{get(){return o(this)}})}}
627
+ */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
628
 
633
629
  const scrollBarStyles = i$4 `
634
630
  ::-webkit-scrollbar {
@@ -714,6 +710,35 @@ var ProvidersShopGptSdk = (function () {
714
710
  align-items: center;
715
711
  box-shadow: 0 0 4px 1px #ffffff;
716
712
  }
713
+
714
+ .chatbot-hover-text {
715
+ position: absolute;
716
+ color: #172a41;
717
+ padding: 8px;
718
+ white-space: nowrap;
719
+ font-size: 16px;
720
+ line-height: 21px;
721
+ opacity: 0;
722
+ transition: opacity 0.2s;
723
+ pointer-events: none;
724
+
725
+ top: calc(0% - 30%);
726
+ right: calc(100% + 5px);
727
+
728
+ border-radius: 5px 5px 0px;
729
+ background: #ffcc81;
730
+ box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
731
+ 0px 2px 4px -1px rgba(0, 0, 0, 0.06);
732
+
733
+ font-weight: 400;
734
+ line-height: 150%;
735
+ }
736
+
737
+ &:hover {
738
+ .chatbot-hover-text {
739
+ opacity: 1;
740
+ }
741
+ }
717
742
  }
718
743
 
719
744
  .mobile-version {
@@ -761,13 +786,13 @@ var ProvidersShopGptSdk = (function () {
761
786
  * Copyright 2017 Google LLC
762
787
  * SPDX-License-Identifier: BSD-3-Clause
763
788
  */
764
- const t$1={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$3=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)}}
789
+ 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
790
 
766
791
  /**
767
792
  * @license
768
793
  * Copyright 2018 Google LLC
769
794
  * SPDX-License-Identifier: BSD-3-Clause
770
- */const e$2=e$3(class extends i{constructor(t){if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||t.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}});
795
+ */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
796
 
772
797
  /**
773
798
  * @license
@@ -922,11 +947,35 @@ var ProvidersShopGptSdk = (function () {
922
947
  color: #677c95;
923
948
  font-weight: 500;
924
949
  text-transform: uppercase;
925
- margin: 0 0 12px;
950
+ margin: 0;
926
951
  max-height: 18px;
927
952
  padding-left: 12px;
928
953
  }
929
954
 
955
+ .trash-icon {
956
+ display: flex;
957
+ padding: 2px;
958
+ border-radius: 5px;
959
+ cursor: pointer;
960
+ align-items: center;
961
+ justify-content: center;
962
+
963
+ &:hover {
964
+ background: #dc3545;
965
+
966
+ path {
967
+ fill: white;
968
+ }
969
+ }
970
+ }
971
+
972
+ .title-wrapper {
973
+ display: flex;
974
+ justify-content: space-between;
975
+ align-items: center;
976
+ margin: 0 0 12px;
977
+ }
978
+
930
979
  .threads {
931
980
  flex: 1;
932
981
  overflow-y: auto;
@@ -939,17 +988,6 @@ var ProvidersShopGptSdk = (function () {
939
988
 
940
989
  .trash-icon {
941
990
  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
991
  }
954
992
 
955
993
  &:hover {
@@ -998,13 +1036,11 @@ var ProvidersShopGptSdk = (function () {
998
1036
  }
999
1037
  `;
1000
1038
 
1001
- let LoadSpinner =
1002
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1003
- class LoadSpinner extends r$3 {
1039
+ class LoadSpinner extends r$2 {
1004
1040
  render() {
1005
1041
  return x ` <div class="loader"><div class="spinner"></div></div> `;
1006
1042
  }
1007
- };
1043
+ }
1008
1044
  LoadSpinner.styles = [
1009
1045
  i$4 `
1010
1046
  .loader {
@@ -1038,14 +1074,15 @@ var ProvidersShopGptSdk = (function () {
1038
1074
  }
1039
1075
  `,
1040
1076
  ];
1041
- LoadSpinner = __decorate([
1042
- t$2('load-spinner')
1043
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1044
- ], LoadSpinner);
1045
-
1046
- let ChatThreads =
1047
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1048
- class ChatThreads extends r$3 {
1077
+ if (!customElements.get('load-spinner')) {
1078
+ customElements.define('load-spinner', LoadSpinner);
1079
+ }
1080
+
1081
+ class ChatThreads extends r$2 {
1082
+ constructor() {
1083
+ super(...arguments);
1084
+ this.deleteAllThreads = false;
1085
+ }
1049
1086
  getDomain() {
1050
1087
  var _a;
1051
1088
  if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
@@ -1054,6 +1091,14 @@ var ProvidersShopGptSdk = (function () {
1054
1091
  return `https://${this.merchantUrl}`;
1055
1092
  }
1056
1093
  handleThreadDelete() {
1094
+ if (this.deleteAllThreads) {
1095
+ this.dispatchEvent(new CustomEvent('delete-all-threads', {
1096
+ composed: true,
1097
+ bubbles: true,
1098
+ }));
1099
+ this.deleteAllThreads = false;
1100
+ return;
1101
+ }
1057
1102
  if (!this.deleteThreadId) {
1058
1103
  return;
1059
1104
  }
@@ -1073,12 +1118,27 @@ var ProvidersShopGptSdk = (function () {
1073
1118
  }
1074
1119
  return x `
1075
1120
  <div class="history">
1076
- <p class="title">History</p>
1121
+ <div class="title-wrapper">
1122
+ <p class="title">History</p>
1123
+ ${this.chatThreads.size
1124
+ ? x `<div
1125
+ class="trash-icon"
1126
+ @click=${() => {
1127
+ if (this.isLoading || this.isTyping) {
1128
+ return;
1129
+ }
1130
+ this.deleteAllThreads = true;
1131
+ }}
1132
+ >
1133
+ ${trashIcon}
1134
+ </div>`
1135
+ : E}
1136
+ </div>
1077
1137
  ${this.chatThreads.size
1078
1138
  ? x `<div class="threads">
1079
1139
  ${o$1(this.chatThreads.values(), (thread) => x `
1080
1140
  <div
1081
- class=${e$2({
1141
+ class=${e$1({
1082
1142
  'thread-wrapper': true,
1083
1143
  active: this.selectedThreadId === thread.threadId,
1084
1144
  disabled: this.isTyping,
@@ -1132,52 +1192,66 @@ var ProvidersShopGptSdk = (function () {
1132
1192
  </a>
1133
1193
  </div>`
1134
1194
  : E}
1135
- ${this.deleteThreadId
1195
+ ${this.deleteThreadId || this.deleteAllThreads
1136
1196
  ? x `
1137
1197
  <confirm-dialog
1138
1198
  @accept=${this.handleThreadDelete}
1139
- @decline=${() => (this.deleteThreadId = '')}
1199
+ @decline=${() => {
1200
+ this.deleteThreadId = '';
1201
+ this.deleteAllThreads = false;
1202
+ }}
1140
1203
  >
1141
- <h2 slot="title">Delete Chat?</h2>
1204
+ <h2 slot="title">
1205
+ ${this.deleteAllThreads
1206
+ ? 'Delete Entire Chat History?'
1207
+ : 'Delete Chat?'}
1208
+ </h2>
1142
1209
  <p slot="content">
1143
1210
  This action cannot be undone. Are you sure you want to delete
1144
- <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
1211
+ ${this.deleteAllThreads
1212
+ ? ' the entire chat history'
1213
+ : x `<b
1214
+ >"${this.chatThreads.get(this.deleteThreadId).title}"</b
1215
+ >`}?
1145
1216
  </p>
1146
1217
  </confirm-dialog>
1147
1218
  `
1148
1219
  : E}
1149
1220
  `;
1150
1221
  }
1151
- };
1222
+ }
1152
1223
  ChatThreads.styles = [chatThreadsStyles];
1153
1224
  __decorate([
1154
- n$1({ type: Object }),
1225
+ n({ type: Object }),
1155
1226
  __metadata("design:type", Map)
1156
1227
  ], ChatThreads.prototype, "chatThreads", void 0);
1157
1228
  __decorate([
1158
- n$1({ type: String }),
1229
+ n({ type: String }),
1159
1230
  __metadata("design:type", Object)
1160
1231
  ], ChatThreads.prototype, "merchantUrl", void 0);
1161
1232
  __decorate([
1162
- n$1({ type: Boolean }),
1233
+ n({ type: Boolean }),
1163
1234
  __metadata("design:type", Boolean)
1164
1235
  ], ChatThreads.prototype, "isLoading", void 0);
1165
1236
  __decorate([
1166
- n$1({ type: Boolean }),
1237
+ n({ type: Boolean }),
1167
1238
  __metadata("design:type", Boolean)
1168
1239
  ], ChatThreads.prototype, "isTyping", void 0);
1169
1240
  __decorate([
1170
- n$1({ type: String }),
1241
+ n({ type: String }),
1171
1242
  __metadata("design:type", String)
1172
1243
  ], ChatThreads.prototype, "selectedThreadId", void 0);
1173
1244
  __decorate([
1174
- r$1(),
1245
+ r(),
1175
1246
  __metadata("design:type", String)
1176
1247
  ], ChatThreads.prototype, "deleteThreadId", void 0);
1177
- ChatThreads = __decorate([
1178
- t$2('chat-threads')
1179
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1180
- ], ChatThreads);
1248
+ __decorate([
1249
+ r(),
1250
+ __metadata("design:type", Object)
1251
+ ], ChatThreads.prototype, "deleteAllThreads", void 0);
1252
+ if (!customElements.get('chat-threads')) {
1253
+ customElements.define('chat-threads', ChatThreads);
1254
+ }
1181
1255
 
1182
1256
  const productsSectionStyles = i$4 `
1183
1257
  :host {
@@ -1365,9 +1439,7 @@ var ProvidersShopGptSdk = (function () {
1365
1439
  }
1366
1440
  `;
1367
1441
 
1368
- let ProductItem =
1369
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1370
- class ProductItem extends r$3 {
1442
+ class ProductItem extends r$2 {
1371
1443
  getLocalPrice(price) {
1372
1444
  if (!this.siteCurrency) {
1373
1445
  return price;
@@ -1375,6 +1447,16 @@ var ProvidersShopGptSdk = (function () {
1375
1447
  const localPrice = parseFloat(price) * this.siteCurrency.rate;
1376
1448
  return formatMoney(localPrice, this.siteCurrency.currency);
1377
1449
  }
1450
+ getComparedAtPrice(comparedAtPrice, price) {
1451
+ if (!comparedAtPrice ||
1452
+ comparedAtPrice === price ||
1453
+ parseFloat(comparedAtPrice) <= parseFloat(price)) {
1454
+ return E;
1455
+ }
1456
+ return x `<p class="price-compared">
1457
+ ${this.getLocalPrice(comparedAtPrice)}
1458
+ </p>`;
1459
+ }
1378
1460
  redirect(url) {
1379
1461
  var _a;
1380
1462
  if (!url) {
@@ -1408,13 +1490,7 @@ var ProvidersShopGptSdk = (function () {
1408
1490
  </p>
1409
1491
  ${this.renderVariantTitles()}
1410
1492
  <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}
1493
+ ${this.getComparedAtPrice(this.product.variants[0].comparedAtPrice, this.product.variants[0].price)}
1418
1494
  <p>${this.getLocalPrice(this.product.variants[0].price)}</p>
1419
1495
  </div>
1420
1496
  <button
@@ -1427,20 +1503,19 @@ var ProvidersShopGptSdk = (function () {
1427
1503
  </div>
1428
1504
  `;
1429
1505
  }
1430
- };
1506
+ }
1431
1507
  ProductItem.styles = [productItemStyles];
1432
1508
  __decorate([
1433
- n$1({ type: Object }),
1509
+ n({ type: Object }),
1434
1510
  __metadata("design:type", Object)
1435
1511
  ], ProductItem.prototype, "product", void 0);
1436
1512
  __decorate([
1437
- n$1({ type: Object }),
1513
+ n({ type: Object }),
1438
1514
  __metadata("design:type", Object)
1439
1515
  ], ProductItem.prototype, "siteCurrency", void 0);
1440
- ProductItem = __decorate([
1441
- t$2('product-item')
1442
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1443
- ], ProductItem);
1516
+ if (!customElements.get('product-item')) {
1517
+ customElements.define('product-item', ProductItem);
1518
+ }
1444
1519
 
1445
1520
  const productsListStyles = i$4 `
1446
1521
  .products::-webkit-scrollbar {
@@ -1468,6 +1543,8 @@ var ProvidersShopGptSdk = (function () {
1468
1543
  gap: 24px;
1469
1544
  overflow-x: auto;
1470
1545
  scrollbar-width: none;
1546
+ margin-left: -10px;
1547
+ padding-left: 10px;
1471
1548
  }
1472
1549
 
1473
1550
  .scroll-btns {
@@ -1502,21 +1579,23 @@ var ProvidersShopGptSdk = (function () {
1502
1579
  }
1503
1580
  `;
1504
1581
 
1505
- let ProductsList =
1506
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1507
- class ProductsList extends r$3 {
1582
+ class ProductsList extends r$2 {
1508
1583
  constructor() {
1509
1584
  super(...arguments);
1510
1585
  this.showButtons = true;
1511
1586
  this.updateButtonsState = () => {
1512
- if (!this.leftBtnEle || !this.productsEle || !this.rightBtnEle) {
1587
+ if (!this.productsEle) {
1513
1588
  return;
1514
1589
  }
1515
1590
  const { scrollWidth, clientWidth } = this.productsEle;
1516
1591
  this.showButtons = scrollWidth > clientWidth;
1517
- this.leftBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft === 0);
1592
+ if (this.leftBtnEle) {
1593
+ this.leftBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft === 0);
1594
+ }
1518
1595
  const maxScroll = this.productsEle.scrollWidth - this.productsEle.clientWidth;
1519
- this.rightBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft >= maxScroll - 1);
1596
+ if (this.rightBtnEle) {
1597
+ this.rightBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft >= maxScroll - 1);
1598
+ }
1520
1599
  };
1521
1600
  }
1522
1601
  connectedCallback() {
@@ -1552,7 +1631,7 @@ var ProvidersShopGptSdk = (function () {
1552
1631
  <div class="products" @scroll=${this.updateButtonsState}>
1553
1632
  ${o$1(this.products, (product) => x `
1554
1633
  <div
1555
- class=${e$2({
1634
+ class=${e$1({
1556
1635
  'product-container': true,
1557
1636
  modal: this.viewType === 'modal',
1558
1637
  })}
@@ -1577,40 +1656,37 @@ var ProvidersShopGptSdk = (function () {
1577
1656
  </div>
1578
1657
  `;
1579
1658
  }
1580
- };
1659
+ }
1581
1660
  ProductsList.styles = [productsListStyles];
1582
1661
  __decorate([
1583
- n$1({ type: Array }),
1662
+ n({ type: Array }),
1584
1663
  __metadata("design:type", Array)
1585
1664
  ], ProductsList.prototype, "products", void 0);
1586
1665
  __decorate([
1587
- n$1({ type: Object }),
1666
+ n({ type: Object }),
1588
1667
  __metadata("design:type", Object)
1589
1668
  ], ProductsList.prototype, "siteCurrency", void 0);
1590
1669
  __decorate([
1591
- r$1(),
1670
+ r(),
1592
1671
  __metadata("design:type", Object)
1593
1672
  ], ProductsList.prototype, "showButtons", void 0);
1594
1673
  __decorate([
1595
- e$4('.left-btn'),
1674
+ e$3('.left-btn'),
1596
1675
  __metadata("design:type", Object)
1597
1676
  ], ProductsList.prototype, "leftBtnEle", void 0);
1598
1677
  __decorate([
1599
- e$4('.right-btn'),
1678
+ e$3('.right-btn'),
1600
1679
  __metadata("design:type", Object)
1601
1680
  ], ProductsList.prototype, "rightBtnEle", void 0);
1602
1681
  __decorate([
1603
- e$4('.products'),
1682
+ e$3('.products'),
1604
1683
  __metadata("design:type", Object)
1605
1684
  ], ProductsList.prototype, "productsEle", void 0);
1606
- ProductsList = __decorate([
1607
- t$2('products-list')
1608
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1609
- ], ProductsList);
1610
-
1611
- let ProductsSection =
1612
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1613
- class ProductsSection extends r$3 {
1685
+ if (!customElements.get('products-list')) {
1686
+ customElements.define('products-list', ProductsList);
1687
+ }
1688
+
1689
+ class ProductsSection extends r$2 {
1614
1690
  connectedCallback() {
1615
1691
  super.connectedCallback();
1616
1692
  }
@@ -1626,7 +1702,7 @@ var ProvidersShopGptSdk = (function () {
1626
1702
  `;
1627
1703
  }
1628
1704
  render() {
1629
- if (this.isLoadingHistory) {
1705
+ if (this.isLoadingHistory || this.isLoadingThreads) {
1630
1706
  return x ` <load-spinner></load-spinner> `;
1631
1707
  }
1632
1708
  if (!this.products.length) {
@@ -1655,40 +1731,43 @@ var ProvidersShopGptSdk = (function () {
1655
1731
  </div>
1656
1732
  `;
1657
1733
  }
1658
- };
1734
+ }
1659
1735
  ProductsSection.styles = [productsSectionStyles];
1660
1736
  __decorate([
1661
- n$1({ type: String }),
1737
+ n({ type: String }),
1662
1738
  __metadata("design:type", Object)
1663
1739
  ], ProductsSection.prototype, "merchantImage", void 0);
1664
1740
  __decorate([
1665
- n$1({ type: Array }),
1741
+ n({ type: Array }),
1666
1742
  __metadata("design:type", Array)
1667
1743
  ], ProductsSection.prototype, "products", void 0);
1668
1744
  __decorate([
1669
- n$1({ type: Boolean }),
1745
+ n({ type: Boolean }),
1670
1746
  __metadata("design:type", Boolean)
1671
1747
  ], ProductsSection.prototype, "isLoadingHistory", void 0);
1672
1748
  __decorate([
1673
- n$1({ type: Object }),
1749
+ n({ type: Object }),
1674
1750
  __metadata("design:type", Object)
1675
1751
  ], ProductsSection.prototype, "siteCurrency", void 0);
1676
1752
  __decorate([
1677
- e$4('.left-btn'),
1753
+ n({ type: Boolean }),
1754
+ __metadata("design:type", Boolean)
1755
+ ], ProductsSection.prototype, "isLoadingThreads", void 0);
1756
+ __decorate([
1757
+ e$3('.left-btn'),
1678
1758
  __metadata("design:type", Object)
1679
1759
  ], ProductsSection.prototype, "leftBtnEle", void 0);
1680
1760
  __decorate([
1681
- e$4('.right-btn'),
1761
+ e$3('.right-btn'),
1682
1762
  __metadata("design:type", Object)
1683
1763
  ], ProductsSection.prototype, "rightBtnEle", void 0);
1684
1764
  __decorate([
1685
- e$4('.products'),
1765
+ e$3('.products'),
1686
1766
  __metadata("design:type", Object)
1687
1767
  ], ProductsSection.prototype, "productsEle", void 0);
1688
- ProductsSection = __decorate([
1689
- t$2('products-section')
1690
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1691
- ], ProductsSection);
1768
+ if (!customElements.get('products-section')) {
1769
+ customElements.define('products-section', ProductsSection);
1770
+ }
1692
1771
 
1693
1772
  const chatSectionStyles = i$4 `
1694
1773
  :host {
@@ -1868,6 +1947,20 @@ var ProvidersShopGptSdk = (function () {
1868
1947
  gap: 28px;
1869
1948
  padding-bottom: 10px;
1870
1949
  margin-bottom: -10px;
1950
+ margin-right: -10px;
1951
+ padding-right: 10px;
1952
+ margin-left: -10px;
1953
+ padding-left: 10px;
1954
+ background: linear-gradient(#f7f8fa80, #f7f8fa80),
1955
+ var(--shopgpt-merchant-img-url);
1956
+ background-position: center;
1957
+ background-repeat: no-repeat;
1958
+ background-size: contain;
1959
+
1960
+ &.loading {
1961
+ justify-content: center;
1962
+ align-items: center;
1963
+ }
1871
1964
 
1872
1965
  .message:last-child {
1873
1966
  margin-top: 10px;
@@ -2038,7 +2131,7 @@ var ProvidersShopGptSdk = (function () {
2038
2131
  .prompts {
2039
2132
  display: flex;
2040
2133
  justify-content: center;
2041
- gap: 23px 10px;
2134
+ gap: 10px;
2042
2135
  flex-wrap: wrap;
2043
2136
 
2044
2137
  .prompt {
@@ -2074,13 +2167,19 @@ var ProvidersShopGptSdk = (function () {
2074
2167
  0px 20px 20px 0px rgba(0, 0, 0, 0.08);
2075
2168
  border-radius: 0px 0px 10px 10px;
2076
2169
 
2077
- h2 {
2078
- padding: 10px 16px;
2079
- color: #172a41;
2080
- font-size: 16px;
2081
- font-weight: 700;
2082
- line-height: 20px;
2170
+ .title-wrapper {
2171
+ display: flex;
2172
+ justify-content: space-between;
2173
+ align-items: center;
2083
2174
  border-bottom: 1px solid #dbe2eb;
2175
+ padding: 10px 16px;
2176
+
2177
+ h2 {
2178
+ color: #172a41;
2179
+ font-size: 16px;
2180
+ font-weight: 700;
2181
+ line-height: 20px;
2182
+ }
2084
2183
  }
2085
2184
 
2086
2185
  .thread-titles-wrapper {
@@ -2402,9 +2501,7 @@ var ProvidersShopGptSdk = (function () {
2402
2501
  <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
2502
  </svg>`;
2404
2503
 
2405
- let PersonalizeDialog =
2406
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2407
- class PersonalizeDialog extends r$3 {
2504
+ class PersonalizeDialog extends r$2 {
2408
2505
  constructor() {
2409
2506
  super(...arguments);
2410
2507
  this.isLoading = false;
@@ -2647,74 +2744,173 @@ var ProvidersShopGptSdk = (function () {
2647
2744
  </dialog>
2648
2745
  `;
2649
2746
  }
2650
- };
2747
+ }
2651
2748
  PersonalizeDialog.styles = [personalizeDialogStyles];
2652
2749
  __decorate([
2653
- e$4('dialog'),
2750
+ e$3('dialog'),
2654
2751
  __metadata("design:type", HTMLDialogElement)
2655
2752
  ], PersonalizeDialog.prototype, "dialogModal", void 0);
2656
2753
  __decorate([
2657
- e$4('.dropdown-list'),
2754
+ e$3('.dropdown-list'),
2658
2755
  __metadata("design:type", HTMLUListElement)
2659
2756
  ], PersonalizeDialog.prototype, "dropdownList", void 0);
2660
2757
  __decorate([
2661
- e$4('.dropdown-trigger'),
2758
+ e$3('.dropdown-trigger'),
2662
2759
  __metadata("design:type", HTMLDivElement)
2663
2760
  ], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
2664
2761
  __decorate([
2665
- n$1({ type: Array }),
2762
+ n({ type: Array }),
2666
2763
  __metadata("design:type", Array)
2667
2764
  ], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
2668
2765
  __decorate([
2669
- n$1({ type: Array }),
2766
+ n({ type: Array }),
2670
2767
  __metadata("design:type", Array)
2671
2768
  ], PersonalizeDialog.prototype, "defaultProfiles", void 0);
2672
2769
  __decorate([
2673
- n$1({ type: Boolean }),
2770
+ n({ type: Boolean }),
2674
2771
  __metadata("design:type", Object)
2675
2772
  ], PersonalizeDialog.prototype, "isLoading", void 0);
2676
2773
  __decorate([
2677
- n$1({ type: String }),
2774
+ n({ type: String }),
2678
2775
  __metadata("design:type", Object)
2679
2776
  ], PersonalizeDialog.prototype, "state", void 0);
2680
2777
  __decorate([
2681
- n$1({ type: String }),
2778
+ n({ type: String }),
2682
2779
  __metadata("design:type", Object)
2683
2780
  ], PersonalizeDialog.prototype, "profileType", void 0);
2684
2781
  __decorate([
2685
- n$1({ type: String }),
2782
+ n({ type: String }),
2686
2783
  __metadata("design:type", Object)
2687
2784
  ], PersonalizeDialog.prototype, "selectedProfile", void 0);
2688
2785
  __decorate([
2689
- n$1({ type: String }),
2786
+ n({ type: String }),
2690
2787
  __metadata("design:type", Object)
2691
2788
  ], PersonalizeDialog.prototype, "visitorType", void 0);
2692
2789
  __decorate([
2693
- n$1({ type: String }),
2790
+ n({ type: String }),
2694
2791
  __metadata("design:type", Object)
2695
2792
  ], PersonalizeDialog.prototype, "productHandle", void 0);
2696
- PersonalizeDialog = __decorate([
2697
- t$2('personalize-dialog')
2698
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2699
- ], PersonalizeDialog);
2793
+ if (!customElements.get('personalize-dialog')) {
2794
+ customElements.define('personalize-dialog', PersonalizeDialog);
2795
+ }
2700
2796
 
2701
2797
  /**
2702
2798
  * @license
2703
2799
  * Copyright 2017 Google LLC
2704
2800
  * SPDX-License-Identifier: BSD-3-Clause
2705
- */let e$1 = class e extends i{constructor(i){if(super(i),this.it=E,i.type!==t$1.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$1.directiveName="unsafeHTML",e$1.resultType=1;const o=e$3(e$1);
2706
-
2707
- var e={"":["<em>","</em>"],_:["<strong>","</strong>"],"*":["<strong>","</strong>"],"~":["<s>","</s>"],"\n":["<br />"]," ":["<br />"],"-":["<hr />"]};function n(e){return e.replace(RegExp("^"+(e.match(/^(\t| )+/)||"")[0],"gm"),"")}function r(e){return (e+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t(a,c){var o,l,g,s,p,u=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,m=[],h="",i=c||{},d=0;function f(n){var r=e[n[1]||""],t=m[m.length-1]==n;return r?r[1]?(t?m.pop():m.push(n),r[0|t]):r[0]:n}function $(){for(var e="";m.length;)e+=f(m[m.length-1]);return e}for(a=a.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(e,n,r){return i[n.toLowerCase()]=r,""}).replace(/^\n+|\n+$/g,"");g=u.exec(a);)l=a.substring(d,g.index),d=u.lastIndex,o=g[0],l.match(/[^\\](\\\\)*\\$/)||((p=g[3]||g[4])?o='<pre class="code '+(g[4]?"poetry":g[2].toLowerCase())+'"><code'+(g[2]?' class="language-'+g[2].toLowerCase()+'"':"")+">"+n(r(p).replace(/^\n+|\n+$/g,""))+"</code></pre>":(p=g[6])?(p.match(/\./)&&(g[5]=g[5].replace(/^\d+/gm,"")),s=t(n(g[5].replace(/^\s*[>*+.-]/gm,""))),">"==p?p="blockquote":(p=p.match(/\./)?"ol":"ul",s=s.replace(/^(.*)(\n|$)/gm,"<li>$1</li>")),o="<"+p+">"+s+"</"+p+">"):g[8]?o='<img src="'+r(g[8])+'" alt="'+r(g[7])+'">':g[10]?(h=h.replace("<a>",'<a href="'+r(g[11]||i[l.toLowerCase()])+'">'),o=$()+"</a>"):g[9]?o="<a>":g[12]||g[14]?o="<"+(p="h"+(g[14]?g[14].length:g[13]>"="?1:2))+">"+t(g[12]||g[15],i)+"</"+p+">":g[16]?o="<code>"+r(g[16])+"</code>":(g[17]||g[1])&&(o=f(g[17]||"--"))),h+=l,h+=o;return (h+a.substring(d)+$()).replace(/^\n+|\n+$/g,"")}
2801
+ */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);
2802
+
2803
+ const markdown = (text) => {
2804
+ let src = text;
2805
+ const rx_space = /\t|\r|\uf8ff/g;
2806
+ const rx_hr = /^([*\-=_] *){3,}$/gm;
2807
+ const rx_blockquote = /\n *> *([^]*?)(?=(\n|$){2})/g;
2808
+ const rx_list = /\n( *)(?:[*\-+]|((\d+)|([a-z])|[A-Z])[.)]) +([^]*?)(?=(\n|$){2})/g;
2809
+ const rx_listjoin = /<\/(ol|ul)>\n\n<\1>/g;
2810
+ const rx_highlight = /(^|[^A-Za-z\d\\])(([*_])|(~)|(\^)|(--)|(\+\+)|`)(\2?)([^<]*?)\2\8(?!\2)(?=\W|_|$)/g;
2811
+ const rx_code = /\n((```|~~~).*\n?([^]*?)\n?\2|(( {4}.*?\n)+))/g;
2812
+ const rx_link = /((!?)\[(.*?)\]\((.*?)( ".*")?\)|\\([\\`*_{}[\]()#+\-.!~]))/g;
2813
+ const rx_table = /\n(( *\|.*?\| *\n)+)/g;
2814
+ const rx_thead = /^.*\n( *\|( *:?-+:?-+:? *\|)* *\n|)/;
2815
+ const rx_row = /.*\n/g;
2816
+ const rx_cell = /\|(.*?[^\\])\|/g;
2817
+ const rx_heading = /(?=^|>|\n)([>\s]*?)(#{1,6}) (.*?)( #*)? *(?=\n|$)/g;
2818
+ const rx_para = /(?=^|>|\n)\s*\n+([^<]+?)\n+\s*(?=\n|<|$)/g;
2819
+ const rx_stash = /-\d+\uf8ff/g;
2820
+ const stash = {};
2821
+ let si = 0;
2822
+ function replace(rex, fn) {
2823
+ src = src.replace(rex, fn);
2824
+ }
2825
+ function element(tag, content) {
2826
+ return `<${tag}>${content}</${tag}>`;
2827
+ }
2828
+ function blockquote(src) {
2829
+ return src.replace(rx_blockquote, (_, content) => {
2830
+ return element('blockquote', blockquote(highlight(content.replace(/^ *> */gm, ''))));
2831
+ });
2832
+ }
2833
+ function list(src) {
2834
+ return src.replace(rx_list, (all, ind, ol, num, low, content) => {
2835
+ const entry = element('li', highlight(content
2836
+ .split(new RegExp(`\n ?${ind}(?:(?:\\d+|[a-zA-Z])[.)]|[*\\-+]) +`, 'g'))
2837
+ .map(list)
2838
+ .join('</li><li>')));
2839
+ return `\n${ol
2840
+ ? `<ol start="${num
2841
+ ? ol + '">'
2842
+ : `${parseInt(ol, 36) - 9}" style="list-style-type:${low ? 'low' : 'upp'}er-alpha">`}${entry}</ol>`
2843
+ : element('ul', entry)}`;
2844
+ });
2845
+ }
2846
+ function highlight(src) {
2847
+ return src.replace(rx_highlight, function (all, _, p1, emp, sub, sup, small, big, p2, content) {
2848
+ return (_ +
2849
+ element(emp
2850
+ ? p2
2851
+ ? 'strong'
2852
+ : 'em'
2853
+ : sub
2854
+ ? p2
2855
+ ? 's'
2856
+ : 'sub'
2857
+ : sup
2858
+ ? 'sup'
2859
+ : small
2860
+ ? 'small'
2861
+ : big
2862
+ ? 'big'
2863
+ : 'code', highlight(content)));
2864
+ });
2865
+ }
2866
+ src = `\n${src}\n`;
2867
+ replace(rx_space, ' ');
2868
+ src = blockquote(src);
2869
+ replace(rx_hr, '<hr/>');
2870
+ src = list(src);
2871
+ replace(rx_listjoin, '');
2872
+ replace(rx_code, (_, p1, p2, p3, p4) => {
2873
+ stash[--si] = element('pre', element('code', p3 || p4.replace(/^ {4}/gm, '')));
2874
+ return `${si}\uf8ff`;
2875
+ });
2876
+ replace(rx_link, (_, p1, p2, p3, p4, p5, p6) => {
2877
+ stash[--si] = p4
2878
+ ? p2
2879
+ ? `<img src="${p4}" alt="${p3}"/>`
2880
+ : `<a href="${p4}">${highlight(p3)}</a>`
2881
+ : p6;
2882
+ return `${si}\uf8ff`;
2883
+ });
2884
+ replace(rx_table, (_, table) => {
2885
+ var _a;
2886
+ const sep = ((_a = table.match(rx_thead)) === null || _a === void 0 ? void 0 : _a[1]) || '';
2887
+ return `\n${element('table', table.replace(rx_row, (row, ri) => {
2888
+ return row === sep
2889
+ ? ''
2890
+ : element('tr', row.replace(rx_cell, (_, cell, ci) => ci
2891
+ ? element(sep && !ri ? 'th' : 'td', highlight(cell || ''))
2892
+ : ''));
2893
+ }))}`;
2894
+ });
2895
+ replace(rx_heading, (_, prefix, p1, p2) => {
2896
+ return prefix + element(`h${p1.length}`, highlight(p2));
2897
+ });
2898
+ replace(rx_para, (_, content) => {
2899
+ return element('p', highlight(content));
2900
+ });
2901
+ replace(rx_stash, (all) => stash[parseInt(all)]);
2902
+ return src.trim();
2903
+ };
2708
2904
 
2709
- let MarkdownRenderer =
2710
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2711
- class MarkdownRenderer extends r$3 {
2905
+ class MarkdownRenderer extends r$2 {
2712
2906
  render() {
2713
- const slotContent = this.innerHTML.trim();
2714
- const parsedContent = t(slotContent);
2715
- return o(parsedContent);
2907
+ // Remove lit markers from slot content
2908
+ const slotContent = this.innerHTML
2909
+ .trim()
2910
+ .replace(/<!--\?lit\$[\d$]+-->/g, '');
2911
+ return o(markdown(slotContent));
2716
2912
  }
2717
- };
2913
+ }
2718
2914
  MarkdownRenderer.styles = i$4 `
2719
2915
  :host {
2720
2916
  font-family: 'Inter', sans-serif;
@@ -2726,14 +2922,11 @@ var ProvidersShopGptSdk = (function () {
2726
2922
  }
2727
2923
  }
2728
2924
  `;
2729
- MarkdownRenderer = __decorate([
2730
- t$2('markdown-renderer')
2731
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2732
- ], MarkdownRenderer);
2733
-
2734
- let TooltipComponent =
2735
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2736
- class TooltipComponent extends r$3 {
2925
+ if (!customElements.get('markdown-renderer')) {
2926
+ customElements.define('markdown-renderer', MarkdownRenderer);
2927
+ }
2928
+
2929
+ class TooltipComponent extends r$2 {
2737
2930
  constructor() {
2738
2931
  super(...arguments);
2739
2932
  this.position = 'bottom-left';
@@ -2745,7 +2938,7 @@ var ProvidersShopGptSdk = (function () {
2745
2938
  <div class="tooltip ${this.position}">${this.text}</div>
2746
2939
  `;
2747
2940
  }
2748
- };
2941
+ }
2749
2942
  TooltipComponent.styles = [
2750
2943
  i$4 `
2751
2944
  :host {
@@ -2757,7 +2950,6 @@ var ProvidersShopGptSdk = (function () {
2757
2950
  position: absolute;
2758
2951
  color: #172a41;
2759
2952
  padding: 4px 8px;
2760
- border-radius: 4px;
2761
2953
  white-space: nowrap;
2762
2954
  font-size: 12px;
2763
2955
  opacity: 0;
@@ -2844,17 +3036,16 @@ var ProvidersShopGptSdk = (function () {
2844
3036
  `,
2845
3037
  ];
2846
3038
  __decorate([
2847
- n$1({ type: String }),
3039
+ n({ type: String }),
2848
3040
  __metadata("design:type", String)
2849
3041
  ], TooltipComponent.prototype, "position", void 0);
2850
3042
  __decorate([
2851
- n$1({ type: String }),
3043
+ n({ type: String }),
2852
3044
  __metadata("design:type", Object)
2853
3045
  ], TooltipComponent.prototype, "text", void 0);
2854
- TooltipComponent = __decorate([
2855
- t$2('tooltip-component')
2856
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2857
- ], TooltipComponent);
3046
+ if (!customElements.get('tooltip-component')) {
3047
+ customElements.define('tooltip-component', TooltipComponent);
3048
+ }
2858
3049
 
2859
3050
  const confirmDialogStyles = i$4 `
2860
3051
  :host {
@@ -2935,9 +3126,7 @@ var ProvidersShopGptSdk = (function () {
2935
3126
  }
2936
3127
  `;
2937
3128
 
2938
- let ConfirmDialog =
2939
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2940
- class ConfirmDialog extends r$3 {
3129
+ class ConfirmDialog extends r$2 {
2941
3130
  onAcceptClick(e) {
2942
3131
  e.preventDefault();
2943
3132
  this.dispatchEvent(new CustomEvent('accept', {
@@ -2970,19 +3159,17 @@ var ProvidersShopGptSdk = (function () {
2970
3159
  </div>
2971
3160
  `;
2972
3161
  }
2973
- };
3162
+ }
2974
3163
  ConfirmDialog.styles = [confirmDialogStyles];
2975
- ConfirmDialog = __decorate([
2976
- t$2('confirm-dialog')
2977
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2978
- ], ConfirmDialog);
2979
-
2980
- let ChatSection =
2981
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2982
- class ChatSection extends r$3 {
3164
+ if (!customElements.get('confirm-dialog')) {
3165
+ customElements.define('confirm-dialog', ConfirmDialog);
3166
+ }
3167
+
3168
+ class ChatSection extends r$2 {
2983
3169
  constructor() {
2984
3170
  super(...arguments);
2985
3171
  this.showChatThreads = false;
3172
+ this.deleteAllThreads = false;
2986
3173
  this.userQuery = '';
2987
3174
  }
2988
3175
  scrollToBottom() {
@@ -3007,6 +3194,14 @@ var ProvidersShopGptSdk = (function () {
3007
3194
  await this.processMessage(e, message);
3008
3195
  }
3009
3196
  handleThreadDelete() {
3197
+ if (this.deleteAllThreads) {
3198
+ this.dispatchEvent(new CustomEvent('delete-all-threads', {
3199
+ composed: true,
3200
+ bubbles: true,
3201
+ }));
3202
+ this.deleteAllThreads = false;
3203
+ return;
3204
+ }
3010
3205
  if (!this.deleteThreadId) {
3011
3206
  return;
3012
3207
  }
@@ -3060,8 +3255,10 @@ var ProvidersShopGptSdk = (function () {
3060
3255
  `;
3061
3256
  }
3062
3257
  chatWindow() {
3063
- if (this.isLoadingHistory) {
3064
- return x ` <load-spinner></load-spinner> `;
3258
+ if (this.isLoadingHistory || this.isLoadingThreads) {
3259
+ return x `<div class="messages loading">
3260
+ <load-spinner></load-spinner>
3261
+ </div>`;
3065
3262
  }
3066
3263
  return x `
3067
3264
  <div class="messages">
@@ -3102,16 +3299,20 @@ var ProvidersShopGptSdk = (function () {
3102
3299
  `;
3103
3300
  }
3104
3301
  quickPrompts() {
3105
- var _a;
3106
- if (((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId) || this.messages.length) {
3302
+ if (this.isLoadingHistory || this.isTyping || this.isLoadingThreads) {
3303
+ return E;
3304
+ }
3305
+ const prompts = this.messages.length
3306
+ ? this.messages[0].welcomePrompts
3307
+ : this.prompts
3308
+ ? this.prompts.split(',').map((prompt) => prompt.trim())
3309
+ : ['Best Sellers'];
3310
+ if (!prompts) {
3107
3311
  return E;
3108
3312
  }
3109
- const defaultPrompts = this.prompts
3110
- ? this.prompts.split(',').map((prompt) => prompt.trim())
3111
- : ['Best Selling Items', 'Hot Sales'];
3112
3313
  return x `
3113
3314
  <div class="prompts btn">
3114
- ${defaultPrompts.map((prompt) => x `
3315
+ ${prompts.map((prompt) => x `
3115
3316
  <div
3116
3317
  class="prompt"
3117
3318
  @click=${(e) => this.processMessage(e, prompt)}
@@ -3215,10 +3416,10 @@ var ProvidersShopGptSdk = (function () {
3215
3416
  </tooltip-component>
3216
3417
  <tooltip-component
3217
3418
  .position=${'bottom-right'}
3218
- .text=${'Your Search History'}
3419
+ .text=${'Search History'}
3219
3420
  >
3220
3421
  <button
3221
- class=${e$2({
3422
+ class=${e$1({
3222
3423
  btn: true,
3223
3424
  'btn-icon': true,
3224
3425
  'threads-btn': true,
@@ -3290,11 +3491,27 @@ var ProvidersShopGptSdk = (function () {
3290
3491
  }
3291
3492
  return x ` <div id="modal-chat-threads">
3292
3493
  <div class="chat-threads">
3293
- <h2>Your Search History</h2>
3494
+ <div class="title-wrapper">
3495
+ <h2>Search History</h2>
3496
+ ${this.chatThreads.size
3497
+ ? x `<div
3498
+ class="trash-icon"
3499
+ @click=${() => {
3500
+ if (this.isTyping) {
3501
+ return;
3502
+ }
3503
+ this.deleteAllThreads = true;
3504
+ this.showChatThreads = false;
3505
+ }}
3506
+ >
3507
+ ${trashIcon}
3508
+ </div>`
3509
+ : E}
3510
+ </div>
3294
3511
  <div class="thread-titles-wrapper">
3295
3512
  ${o$1(this.chatThreads.values(), (thread) => x `
3296
3513
  <div
3297
- class=${e$2({
3514
+ class=${e$1({
3298
3515
  'thread-title': true,
3299
3516
  disabled: this.isTyping,
3300
3517
  })}
@@ -3334,10 +3551,17 @@ var ProvidersShopGptSdk = (function () {
3334
3551
  </div>`;
3335
3552
  }
3336
3553
  render() {
3554
+ if (this.merchantImage) {
3555
+ // set the merchant image as a css variable
3556
+ this.style.setProperty('--shopgpt-merchant-img-url', `url('${this.merchantImage}')`);
3557
+ }
3558
+ else {
3559
+ this.style.removeProperty('--shopgpt-merchant-img-url');
3560
+ }
3337
3561
  return x `
3338
3562
  <div class="chat-header">${this.contextButton()}</div>
3339
3563
  <div
3340
- class=${e$2({
3564
+ class=${e$1({
3341
3565
  'chatbot-section': true,
3342
3566
  'modal-view': this.viewType === 'modal',
3343
3567
  })}
@@ -3351,7 +3575,7 @@ var ProvidersShopGptSdk = (function () {
3351
3575
  placeholder="Type your search here..."
3352
3576
  />
3353
3577
  <button
3354
- class=${e$2({
3578
+ class=${e$1({
3355
3579
  btn: true,
3356
3580
  modal: this.viewType === 'modal',
3357
3581
  })}
@@ -3368,107 +3592,130 @@ var ProvidersShopGptSdk = (function () {
3368
3592
  .defaultProfiles=${this.profiles}
3369
3593
  ></personalize-dialog>
3370
3594
  ${this.renderChatThreads()}
3371
- ${this.deleteThreadId
3595
+ ${this.deleteThreadId || this.deleteAllThreads
3372
3596
  ? x `
3373
3597
  <confirm-dialog
3374
3598
  @accept=${this.handleThreadDelete}
3375
- @decline=${() => (this.deleteThreadId = '')}
3599
+ @decline=${() => {
3600
+ this.deleteThreadId = '';
3601
+ this.deleteAllThreads = false;
3602
+ }}
3376
3603
  >
3377
- <h2 slot="title">Delete Chat?</h2>
3604
+ <h2 slot="title">
3605
+ ${this.deleteAllThreads
3606
+ ? 'Delete Entire Chat History?'
3607
+ : 'Delete Chat?'}
3608
+ </h2>
3378
3609
  <p slot="content">
3379
3610
  This action cannot be undone. Are you sure you want to delete
3380
- <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
3611
+ ${this.deleteAllThreads
3612
+ ? ' the entire chat history'
3613
+ : x `<b
3614
+ >"${this.chatThreads.get(this.deleteThreadId)
3615
+ .title}"</b
3616
+ >`}?
3381
3617
  </p>
3382
3618
  </confirm-dialog>
3383
3619
  `
3384
3620
  : E}
3385
3621
  `;
3386
3622
  }
3387
- };
3623
+ }
3388
3624
  ChatSection.styles = [chatSectionStyles];
3389
3625
  __decorate([
3390
- n$1({ type: String }),
3626
+ n({ type: String }),
3627
+ __metadata("design:type", Object)
3628
+ ], ChatSection.prototype, "merchantImage", void 0);
3629
+ __decorate([
3630
+ n({ type: String }),
3391
3631
  __metadata("design:type", Object)
3392
3632
  ], ChatSection.prototype, "brandName", void 0);
3393
3633
  __decorate([
3394
- n$1({ type: String }),
3634
+ n({ type: String }),
3395
3635
  __metadata("design:type", Object)
3396
3636
  ], ChatSection.prototype, "prompts", void 0);
3397
3637
  __decorate([
3398
- n$1({ type: Object }),
3638
+ n({ type: Boolean }),
3639
+ __metadata("design:type", Boolean)
3640
+ ], ChatSection.prototype, "isLoadingThreads", void 0);
3641
+ __decorate([
3642
+ n({ type: Object }),
3399
3643
  __metadata("design:type", Map)
3400
3644
  ], ChatSection.prototype, "chatThreads", void 0);
3401
3645
  __decorate([
3402
- r$1(),
3646
+ r(),
3403
3647
  __metadata("design:type", String)
3404
3648
  ], ChatSection.prototype, "deleteThreadId", void 0);
3405
3649
  __decorate([
3406
- n$1({ type: Boolean }),
3650
+ n({ type: Boolean }),
3407
3651
  __metadata("design:type", Object)
3408
3652
  ], ChatSection.prototype, "showChatThreads", void 0);
3409
3653
  __decorate([
3410
- n$1({ type: Boolean }),
3654
+ n({ type: Boolean }),
3411
3655
  __metadata("design:type", Boolean)
3412
3656
  ], ChatSection.prototype, "isLoadingHistory", void 0);
3413
3657
  __decorate([
3414
- n$1({ type: Boolean }),
3658
+ n({ type: Boolean }),
3415
3659
  __metadata("design:type", Object)
3416
3660
  ], ChatSection.prototype, "devMode", void 0);
3417
3661
  __decorate([
3418
- n$1({ type: Boolean }),
3662
+ n({ type: Boolean }),
3419
3663
  __metadata("design:type", Boolean)
3420
3664
  ], ChatSection.prototype, "isTyping", void 0);
3421
3665
  __decorate([
3422
- n$1({ type: Boolean }),
3666
+ n({ type: Boolean }),
3423
3667
  __metadata("design:type", Boolean)
3424
3668
  ], ChatSection.prototype, "isFailed", void 0);
3425
3669
  __decorate([
3426
- n$1({ type: Array }),
3670
+ n({ type: Array }),
3427
3671
  __metadata("design:type", Array)
3428
3672
  ], ChatSection.prototype, "messages", void 0);
3429
3673
  __decorate([
3430
- n$1({ type: Array }),
3674
+ n({ type: Array }),
3431
3675
  __metadata("design:type", Array)
3432
3676
  ], ChatSection.prototype, "profiles", void 0);
3433
3677
  __decorate([
3434
- n$1({ type: Array }),
3678
+ n({ type: Array }),
3435
3679
  __metadata("design:type", Array)
3436
3680
  ], ChatSection.prototype, "productHandles", void 0);
3437
3681
  __decorate([
3438
- n$1({ type: Object }),
3682
+ n({ type: Object }),
3439
3683
  __metadata("design:type", Object)
3440
3684
  ], ChatSection.prototype, "thread", void 0);
3441
3685
  __decorate([
3442
- n$1({ type: Object }),
3686
+ n({ type: Object }),
3443
3687
  __metadata("design:type", Object)
3444
3688
  ], ChatSection.prototype, "siteCurrency", void 0);
3445
3689
  __decorate([
3446
- e$4('.context-container'),
3690
+ r(),
3691
+ __metadata("design:type", Object)
3692
+ ], ChatSection.prototype, "deleteAllThreads", void 0);
3693
+ __decorate([
3694
+ e$3('.context-container'),
3447
3695
  __metadata("design:type", Object)
3448
3696
  ], ChatSection.prototype, "contextContainerElement", void 0);
3449
3697
  __decorate([
3450
- e$4('.chat-window'),
3698
+ e$3('.chat-window'),
3451
3699
  __metadata("design:type", Object)
3452
3700
  ], ChatSection.prototype, "chatWindowElement", void 0);
3453
3701
  __decorate([
3454
- e$4('personalize-dialog'),
3702
+ e$3('personalize-dialog'),
3455
3703
  __metadata("design:type", Object)
3456
3704
  ], ChatSection.prototype, "personalizeDialogElement", void 0);
3457
3705
  __decorate([
3458
- n$1({ type: String }),
3706
+ n({ type: String }),
3459
3707
  __metadata("design:type", Object)
3460
3708
  ], ChatSection.prototype, "userQuery", void 0);
3461
- ChatSection = __decorate([
3462
- t$2('chat-section')
3463
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3464
- ], ChatSection);
3709
+ if (!customElements.get('chat-section')) {
3710
+ customElements.define('chat-section', ChatSection);
3711
+ }
3465
3712
 
3466
3713
  const DIALOG_DELAY = 1000;
3467
- const LATEST_THREAD_LOAD_DAYS = 14;
3468
3714
  const normalizePath = (path) => path.replace(/\/$/, '');
3469
- let ShopGPT = class ShopGPT extends r$3 {
3715
+ class ShopGPT extends r$2 {
3470
3716
  constructor() {
3471
3717
  super(...arguments);
3718
+ this.latestThreadLoad = DEFAULT_MAX_THREAD_AGE;
3472
3719
  this.modalState = 'close';
3473
3720
  this.isLoadingHistory = false;
3474
3721
  this.isLoadingThreads = false;
@@ -3483,9 +3730,13 @@ var ProvidersShopGptSdk = (function () {
3483
3730
  return;
3484
3731
  }
3485
3732
  await this.loadChatThreads();
3486
- await this.loadInitialQuery();
3487
3733
  this.selectLatestThread();
3488
3734
  };
3735
+ this.onPopState = () => {
3736
+ var _a;
3737
+ this.modalState = 'close';
3738
+ (_a = this.shopGPTDialog) === null || _a === void 0 ? void 0 : _a.close();
3739
+ };
3489
3740
  this.submitQuery = (message) => {
3490
3741
  if (!message) {
3491
3742
  return;
@@ -3511,10 +3762,12 @@ var ProvidersShopGptSdk = (function () {
3511
3762
  }
3512
3763
  disconnectedCallback() {
3513
3764
  window.removeEventListener('edgetag-initialized', this.loadData);
3765
+ window.removeEventListener('popstate', this.onPopState);
3514
3766
  super.disconnectedCallback();
3515
3767
  }
3516
3768
  init() {
3517
3769
  window.addEventListener('edgetag-initialized', this.loadData);
3770
+ window.addEventListener('popstate', this.onPopState);
3518
3771
  if (!this.uiMode || this.uiMode === 'overlay') {
3519
3772
  delay(DIALOG_DELAY).then(() => {
3520
3773
  var _a;
@@ -3529,6 +3782,19 @@ var ProvidersShopGptSdk = (function () {
3529
3782
  });
3530
3783
  }
3531
3784
  }
3785
+ setChatTitle(threadId, title) {
3786
+ if (!title || !threadId) {
3787
+ return;
3788
+ }
3789
+ const thread = this.chatThreads.get(threadId);
3790
+ if (thread) {
3791
+ this.chatThreads.set(thread.threadId, {
3792
+ ...thread,
3793
+ title,
3794
+ });
3795
+ this.chatThreads = new Map(this.chatThreads);
3796
+ }
3797
+ }
3532
3798
  async loadInitialQuery() {
3533
3799
  var _a;
3534
3800
  if (!this.selectedThreadId) {
@@ -3541,14 +3807,26 @@ var ProvidersShopGptSdk = (function () {
3541
3807
  if (!thread) {
3542
3808
  return;
3543
3809
  }
3810
+ const searchParam = new URLSearchParams(window.location.search);
3811
+ const fromAd = searchParam.get('shopGPT') === '1';
3544
3812
  const productHandle = this.devMode
3545
3813
  ? (_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.productHandle
3546
- : this.storeAPI.getCurrentProductHandle();
3814
+ : fromAd
3815
+ ? this.storeAPI.getCurrentProductHandle()
3816
+ : undefined;
3547
3817
  try {
3548
3818
  this.isTyping = true;
3549
3819
  const reply = await this.shopGPTAPI.processQuery('', thread.threadId, productHandle);
3820
+ if (reply.chatTitle) {
3821
+ this.setChatTitle(this.selectedThreadId, reply.chatTitle);
3822
+ }
3550
3823
  this.messages = [
3551
- { sender: 'bot', message: reply.message, products: reply.products },
3824
+ {
3825
+ sender: 'bot',
3826
+ message: reply.message,
3827
+ products: reply.products,
3828
+ welcomePrompts: reply.welcomePrompts,
3829
+ },
3552
3830
  ...this.messages,
3553
3831
  ];
3554
3832
  this.products = reply.products || [];
@@ -3575,10 +3853,7 @@ var ProvidersShopGptSdk = (function () {
3575
3853
  }
3576
3854
  }
3577
3855
  selectLatestThread() {
3578
- if (!this.devMode) {
3579
- return;
3580
- }
3581
- const cutoffTime = Date.now() - LATEST_THREAD_LOAD_DAYS * 24 * 60 * 60 * 1000;
3856
+ const cutoffTime = Date.now() - this.latestThreadLoad * 24 * 60 * 60 * 1000;
3582
3857
  // If the latest thread is not older than cutoff we should load the thread
3583
3858
  let latestThread;
3584
3859
  for (const thread of this.chatThreads.values()) {
@@ -3590,9 +3865,11 @@ var ProvidersShopGptSdk = (function () {
3590
3865
  if (latestThread) {
3591
3866
  this.setSelectedThreadId(latestThread.threadId);
3592
3867
  }
3868
+ else if (!this.devMode) {
3869
+ this.createChatThread({ title: '' }, true);
3870
+ }
3593
3871
  }
3594
3872
  async loadHistory(threadId) {
3595
- var _a, _b, _c;
3596
3873
  try {
3597
3874
  if (!threadId) {
3598
3875
  this.messages = [];
@@ -3601,22 +3878,24 @@ var ProvidersShopGptSdk = (function () {
3601
3878
  }
3602
3879
  this.isLoadingHistory = true;
3603
3880
  const data = await this.shopGPTAPI.fetchChatHistory(threadId);
3881
+ let latestAvailableProducts = [];
3604
3882
  this.messages = data.map((message) => {
3605
3883
  var _a;
3606
- return ({
3884
+ const products = (_a = message.products) === null || _a === void 0 ? void 0 : _a.map((product) => ({
3885
+ ...product,
3886
+ quantity: 1,
3887
+ }));
3888
+ if (!latestAvailableProducts.length && (products === null || products === void 0 ? void 0 : products.length)) {
3889
+ latestAvailableProducts = products;
3890
+ }
3891
+ return {
3607
3892
  message: message.message,
3608
3893
  sender: message.sender,
3609
- products: (_a = message.products) === null || _a === void 0 ? void 0 : _a.map((product) => ({
3610
- ...product,
3611
- quantity: 1,
3612
- })),
3613
- });
3894
+ products,
3895
+ welcomePrompts: message.welcomePrompts,
3896
+ };
3614
3897
  });
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 : [];
3898
+ this.products = latestAvailableProducts;
3620
3899
  }
3621
3900
  catch (e) {
3622
3901
  logger.error(e);
@@ -3657,6 +3936,21 @@ var ProvidersShopGptSdk = (function () {
3657
3936
  this.shopGPTAPI
3658
3937
  .deleteSingleThread(threadId)
3659
3938
  .then(this.loadChatThreads.bind(this))
3939
+ .then(() => {
3940
+ if (this.selectedThreadId === threadId) {
3941
+ this.setSelectedThreadId('');
3942
+ }
3943
+ })
3944
+ .catch(logger.error)
3945
+ .finally(() => (this.isLoadingThreads = false));
3946
+ }
3947
+ handleAllThreadsDelete(e) {
3948
+ e.stopPropagation();
3949
+ this.isLoadingThreads = true;
3950
+ this.shopGPTAPI
3951
+ .deleteAllThreads()
3952
+ .then(this.loadChatThreads.bind(this))
3953
+ .then(() => this.setSelectedThreadId(''))
3660
3954
  .catch(logger.error)
3661
3955
  .finally(() => (this.isLoadingThreads = false));
3662
3956
  }
@@ -3675,21 +3969,20 @@ var ProvidersShopGptSdk = (function () {
3675
3969
  return;
3676
3970
  }
3677
3971
  if (reply.chatTitle) {
3678
- // Alternatively we can fetch the chatThreads once again which would cost another network request
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
- }
3972
+ this.setChatTitle(this.selectedThreadId, reply.chatTitle);
3687
3973
  }
3688
3974
  this.messages = [
3689
- { sender: 'bot', message: reply.message, products: reply.products },
3975
+ {
3976
+ sender: 'bot',
3977
+ message: reply.message,
3978
+ products: reply.products,
3979
+ welcomePrompts: reply.welcomePrompts,
3980
+ },
3690
3981
  ...this.messages,
3691
3982
  ];
3692
- this.products = reply.products || [];
3983
+ if (reply.products && reply.products.length > 0) {
3984
+ this.products = reply.products;
3985
+ }
3693
3986
  }
3694
3987
  catch (err) {
3695
3988
  logger.error(err);
@@ -3714,6 +4007,7 @@ var ProvidersShopGptSdk = (function () {
3714
4007
  <dialog
3715
4008
  id="shop-gpt-dialog-overlay"
3716
4009
  @delete-thread=${this.handleThreadDelete}
4010
+ @delete-all-threads=${this.handleAllThreadsDelete}
3717
4011
  >
3718
4012
  <div class="mobile-version">
3719
4013
  Please switch to the desktop version for the best experience.
@@ -3732,6 +4026,7 @@ var ProvidersShopGptSdk = (function () {
3732
4026
  .products=${this.products}
3733
4027
  .isLoadingHistory=${this.isLoadingHistory}
3734
4028
  .siteCurrency=${this.getSiteCurrency()}
4029
+ .isLoadingThreads=${this.isLoadingThreads}
3735
4030
  ></products-section>
3736
4031
  <chat-section
3737
4032
  .prompts=${this.quickPrompts}
@@ -3748,6 +4043,7 @@ var ProvidersShopGptSdk = (function () {
3748
4043
  .productHandles=${this.productHandles}
3749
4044
  .profiles=${this.profiles}
3750
4045
  .viewType=${'overlay'}
4046
+ .isLoadingThreads=${this.isLoadingThreads}
3751
4047
  ></chat-section>
3752
4048
  </div>
3753
4049
  </dialog>
@@ -3768,10 +4064,15 @@ var ProvidersShopGptSdk = (function () {
3768
4064
  >
3769
4065
  ${chatIcon}
3770
4066
  </button>
4067
+ <div class="chatbot-hover-text">What are you looking for today?</div>
3771
4068
  </div>`;
3772
4069
  }
3773
4070
  return x `
3774
- <div id="shop-gpt-modal" @delete-thread=${this.handleThreadDelete}>
4071
+ <div
4072
+ id="shop-gpt-modal"
4073
+ @delete-thread=${this.handleThreadDelete}
4074
+ @delete-all-threads=${this.handleAllThreadsDelete}
4075
+ >
3775
4076
  <chat-section
3776
4077
  .prompts=${this.quickPrompts}
3777
4078
  .brandName=${this.brandName}
@@ -3790,55 +4091,61 @@ var ProvidersShopGptSdk = (function () {
3790
4091
  .closeModal=${closeModal}
3791
4092
  .setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
3792
4093
  .chatThreads=${this.chatThreads}
4094
+ .isLoadingThreads=${this.isLoadingThreads}
4095
+ .merchantImage=${this.merchantImage}
3793
4096
  ></chat-section>
3794
4097
  </div>
3795
4098
  `;
3796
4099
  }
3797
- };
4100
+ }
3798
4101
  ShopGPT.styles = [shopGPTStyles];
3799
4102
  __decorate([
3800
- e$4('#shop-gpt-dialog-overlay'),
4103
+ n({ type: Number }),
4104
+ __metadata("design:type", Number)
4105
+ ], ShopGPT.prototype, "latestThreadLoad", void 0);
4106
+ __decorate([
4107
+ e$3('#shop-gpt-dialog-overlay'),
3801
4108
  __metadata("design:type", Object)
3802
4109
  ], ShopGPT.prototype, "shopGPTDialog", void 0);
3803
4110
  __decorate([
3804
- n$1({ type: String }),
4111
+ n({ type: String }),
3805
4112
  __metadata("design:type", String)
3806
4113
  ], ShopGPT.prototype, "modalState", void 0);
3807
4114
  __decorate([
3808
- n$1({ type: Boolean }),
4115
+ n({ type: Boolean }),
3809
4116
  __metadata("design:type", Object)
3810
4117
  ], ShopGPT.prototype, "isLoadingHistory", void 0);
3811
4118
  __decorate([
3812
- n$1({ type: Boolean }),
4119
+ n({ type: Boolean }),
3813
4120
  __metadata("design:type", Object)
3814
4121
  ], ShopGPT.prototype, "isLoadingThreads", void 0);
3815
4122
  __decorate([
3816
- n$1({ type: Boolean }),
4123
+ n({ type: Boolean }),
3817
4124
  __metadata("design:type", Object)
3818
4125
  ], ShopGPT.prototype, "isTyping", void 0);
3819
4126
  __decorate([
3820
- n$1({ type: Boolean }),
4127
+ n({ type: Boolean }),
3821
4128
  __metadata("design:type", Object)
3822
4129
  ], ShopGPT.prototype, "isFailed", void 0);
3823
4130
  __decorate([
3824
- n$1({ type: String }),
4131
+ n({ type: String }),
3825
4132
  __metadata("design:type", Object)
3826
4133
  ], ShopGPT.prototype, "selectedThreadId", void 0);
3827
4134
  __decorate([
3828
- n$1({ type: Array }),
4135
+ n({ type: Array }),
3829
4136
  __metadata("design:type", Array)
3830
4137
  ], ShopGPT.prototype, "products", void 0);
3831
4138
  __decorate([
3832
- n$1({ type: Array }),
4139
+ n({ type: Array }),
3833
4140
  __metadata("design:type", Array)
3834
4141
  ], ShopGPT.prototype, "messages", void 0);
3835
4142
  __decorate([
3836
- n$1({ type: Object }),
4143
+ n({ type: Object }),
3837
4144
  __metadata("design:type", Map)
3838
4145
  ], ShopGPT.prototype, "chatThreads", void 0);
3839
- ShopGPT = __decorate([
3840
- t$2('shop-gpt')
3841
- ], ShopGPT);
4146
+ if (!customElements.get('shop-gpt')) {
4147
+ customElements.define('shop-gpt', ShopGPT);
4148
+ }
3842
4149
 
3843
4150
  var _a, _b;
3844
4151
  var _c;
@@ -3862,8 +4169,17 @@ var ProvidersShopGptSdk = (function () {
3862
4169
  shopGPT.brandName = params.brandName;
3863
4170
  shopGPT.quickPrompts = params.quickPrompts;
3864
4171
  shopGPT.merchantImage = params.merchantImage;
4172
+ shopGPT.latestThreadLoad = params.latestThreadLoad;
3865
4173
  document.body.append(shopGPT);
3866
4174
  },
4175
+ destroy() {
4176
+ if (!shopGPT) {
4177
+ return;
4178
+ }
4179
+ shopGPT.remove();
4180
+ shopGPT = undefined;
4181
+ delete window[registryKey];
4182
+ },
3867
4183
  });
3868
4184
  }
3869
4185