@blotoutio/providers-shop-gpt-sdk 1.2.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/index.cjs.js +732 -329
  2. package/index.js +732 -329
  3. package/index.mjs +732 -329
  4. package/package.json +1 -1
package/index.js CHANGED
@@ -385,6 +385,7 @@ var ProvidersShopGptSdk = (function () {
385
385
  message: data.message,
386
386
  products: (_a = data.products) === null || _a === void 0 ? void 0 : _a.filter((item) => !!item).map((item) => ({ ...item, quantity: 1 })),
387
387
  chatTitle: data.chatTitle,
388
+ welcomePrompts: data.welcomePrompts,
388
389
  };
389
390
  };
390
391
  const fetchChatHistory = async (threadId) => {
@@ -491,7 +492,7 @@ var ProvidersShopGptSdk = (function () {
491
492
  // exit if not in top window
492
493
  return;
493
494
  }
494
- const { enabled, devMode, merchantUrl, profiles, productHandles, targetPath, uiMode, } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
495
+ const { enabled, devMode, merchantUrl, profiles, productHandles, targetPath, uiMode, brandName, quickPrompts, merchantImage, } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
495
496
  let shouldShowUI = enabled;
496
497
  if (!enabled && hasPreviewKey()) {
497
498
  logger.log('Enabling UI in preview mode');
@@ -517,6 +518,9 @@ var ProvidersShopGptSdk = (function () {
517
518
  profiles,
518
519
  productHandles,
519
520
  path: targetPath,
521
+ brandName,
522
+ quickPrompts,
523
+ merchantImage,
520
524
  });
521
525
  }
522
526
  };
@@ -550,7 +554,7 @@ var ProvidersShopGptSdk = (function () {
550
554
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
551
555
  PERFORMANCE OF THIS SOFTWARE.
552
556
  ***************************************************************************** */
553
- /* global Reflect, Promise, SuppressedError, Symbol */
557
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
554
558
 
555
559
 
556
560
  function __decorate(decorators, target, key, desc) {
@@ -574,60 +578,53 @@ var ProvidersShopGptSdk = (function () {
574
578
  * Copyright 2019 Google LLC
575
579
  * SPDX-License-Identifier: BSD-3-Clause
576
580
  */
577
- 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$2=Symbol(),o$5=new WeakMap;let n$4 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$2)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$2),i$3=(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$2)},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;
581
+ const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$5=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$5=t=>new n$3("string"==typeof t?t:t+"",void 0,s$1),i$4=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$1)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t;
578
582
 
579
583
  /**
580
584
  * @license
581
585
  * Copyright 2017 Google LLC
582
586
  * SPDX-License-Identifier: BSD-3-Clause
583
- */const{is:i$2,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$2(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");
587
+ */const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:r$4,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$4,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$3(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let b$1 = class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$6(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$4(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}};b$1.elementStyles=[],b$1.shadowRootOptions={mode:"open"},b$1[d$1("elementProperties")]=new Map,b$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b$1}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
584
588
 
585
589
  /**
586
590
  * @license
587
591
  * Copyright 2017 Google LLC
588
592
  * SPDX-License-Identifier: BSD-3-Clause
589
593
  */
590
- const t$3=globalThis,i$1=t$3.trustedTypes,s$1=i$1?i$1.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),w=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),A=new WeakMap,E=r$4.createTreeWalker(r$4,129);function C(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const P=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":"",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 [C(t,l+(t[s]||"<?>")+(2===i?"</svg>":"")),o]};class V{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]=P(t,s);if(this.el=V.createElement(f,n),E.currentNode=this.el.content,2===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=E.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]?k:"?"===e[1]?H:"@"===e[1]?I:R}),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$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),E.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 N(t,i,s=t,e){if(i===w)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=N(t,h._$AS(t,i.values),h,e)),i}class S{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);E.currentNode=e;let h=E.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new M(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new L(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=E.nextNode(),o++);}return E.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 M{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=T,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=N(this,t,i),c(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==w&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t));}_(t){this._$AH!==T&&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=V.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new S(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 V(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 M(this.S(l()),this.S(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 R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=T,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=T;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=N(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==w,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=N(this,e[s+n],i,n),r===w&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===T?t=T:t!==T&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class k extends R{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===T?void 0:t;}}class H extends R{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==T);}}class I extends R{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=N(this,t,i,0)??T)===w)return;const s=this._$AH,e=t===T&&s!==T||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==T&&(s===T||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 L{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){N(this,t);}}const Z=t$3.litHtmlPolyfillSupport;Z?.(V,M),(t$3.litHtmlVersions??=[]).push("3.1.3");const j=(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 M(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
594
+ const t$1=globalThis,i$2=t$1.trustedTypes,s=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$3="?"+h,n$1=`<${o$3}>`,r$3=document,l=()=>r$3.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$3.createTreeWalker(r$3,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$5+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$5)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$2?i$2.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$3)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$3.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$3).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$3,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$3.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.2.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
591
595
 
592
596
  /**
593
597
  * @license
594
598
  * Copyright 2017 Google LLC
595
599
  * SPDX-License-Identifier: BSD-3-Clause
596
- */class s 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 i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=j(i,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return w}}s._$litElement$=!0,s[("finalized")]=!0,globalThis.litElementHydrateSupport?.({LitElement:s});const r$3=globalThis.litElementPolyfillSupport;r$3?.({LitElement:s});(globalThis.litElementVersions??=[]).push("4.0.5");
600
+ */let r$2 = class r extends b$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}};r$2._$litElement$=!0,r$2["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r$2});const i$1=globalThis.litElementPolyfillSupport;i$1?.({LitElement:r$2});(globalThis.litElementVersions??=[]).push("4.1.1");
597
601
 
598
602
  /**
599
603
  * @license
600
604
  * Copyright 2017 Google LLC
601
605
  * SPDX-License-Identifier: BSD-3-Clause
602
- */
603
- const t$2=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
606
+ */const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.P(o,void 0,t),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
604
607
 
605
608
  /**
606
609
  * @license
607
610
  * Copyright 2017 Google LLC
608
611
  * SPDX-License-Identifier: BSD-3-Clause
609
- */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)}
610
-
611
- /**
612
- * @license
613
- * Copyright 2017 Google LLC
614
- * SPDX-License-Identifier: BSD-3-Clause
615
- */function r$1(r){return n$1({...r,state:!0,attribute:!1})}
612
+ */function r(r){return n({...r,state:!0,attribute:!1})}
616
613
 
617
614
  /**
618
615
  * @license
619
616
  * Copyright 2017 Google LLC
620
617
  * SPDX-License-Identifier: BSD-3-Clause
621
618
  */
622
- const e$5=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
619
+ const e$4=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
623
620
 
624
621
  /**
625
622
  * @license
626
623
  * Copyright 2017 Google LLC
627
624
  * SPDX-License-Identifier: BSD-3-Clause
628
- */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)}})}}
625
+ */function e$3(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}="object"==typeof s?n:i??(()=>{const t=Symbol();return {get(){return this[t]},set(e){this[t]=e;}}})();return e$4(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return e$4(n,s,{get(){return o(this)}})}}
629
626
 
630
- const scrollBarStyles = i$3 `
627
+ const scrollBarStyles = i$4 `
631
628
  ::-webkit-scrollbar {
632
629
  width: 20px;
633
630
  }
@@ -647,7 +644,7 @@ var ProvidersShopGptSdk = (function () {
647
644
  background-color: #a8bbbf;
648
645
  }
649
646
  `;
650
- const shopGPTStyles = i$3 `
647
+ const shopGPTStyles = i$4 `
651
648
  ${scrollBarStyles}
652
649
 
653
650
  * {
@@ -711,6 +708,35 @@ var ProvidersShopGptSdk = (function () {
711
708
  align-items: center;
712
709
  box-shadow: 0 0 4px 1px #ffffff;
713
710
  }
711
+
712
+ .chatbot-hover-text {
713
+ position: absolute;
714
+ color: #172a41;
715
+ padding: 8px;
716
+ white-space: nowrap;
717
+ font-size: 16px;
718
+ line-height: 21px;
719
+ opacity: 0;
720
+ transition: opacity 0.2s;
721
+ pointer-events: none;
722
+
723
+ top: calc(0% - 30%);
724
+ right: calc(100% + 5px);
725
+
726
+ border-radius: 5px 5px 0px;
727
+ background: #ffcc81;
728
+ box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
729
+ 0px 2px 4px -1px rgba(0, 0, 0, 0.06);
730
+
731
+ font-weight: 400;
732
+ line-height: 150%;
733
+ }
734
+
735
+ &:hover {
736
+ .chatbot-hover-text {
737
+ opacity: 1;
738
+ }
739
+ }
714
740
  }
715
741
 
716
742
  .mobile-version {
@@ -758,13 +784,13 @@ var ProvidersShopGptSdk = (function () {
758
784
  * Copyright 2017 Google LLC
759
785
  * SPDX-License-Identifier: BSD-3-Clause
760
786
  */
761
- 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)}}
787
+ const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$2=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
762
788
 
763
789
  /**
764
790
  * @license
765
791
  * Copyright 2018 Google LLC
766
792
  * SPDX-License-Identifier: BSD-3-Clause
767
- */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 w}});
793
+ */const e$1=e$2(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return T}});
768
794
 
769
795
  /**
770
796
  * @license
@@ -844,7 +870,7 @@ var ProvidersShopGptSdk = (function () {
844
870
  <path d="M90.323 25.7117C90.2401 25.7117 90.1986 25.7117 90.1669 25.7281C90.1391 25.7424 90.1165 25.7653 90.1022 25.7934C90.0861 25.8255 90.0861 25.8674 90.0861 25.9512V26.9203H89.7359C89.6558 26.9203 89.6148 26.9205 89.5836 26.9366C89.5558 26.9509 89.5331 26.9738 89.5189 27.002C89.5028 27.034 89.5028 27.0759 89.5028 27.1597V27.717C89.5028 27.8008 89.5028 27.8427 89.5189 27.8748C89.5331 27.9029 89.5558 27.9258 89.5836 27.9402C89.6153 27.9565 89.6568 27.9565 89.7397 27.9565H90.0861V32.1113H90.0847C90.0843 32.1182 90.0838 32.1251 90.0835 32.1319C90.0841 32.1478 90.085 32.1637 90.0861 32.1795V32.2192L90.0883 32.2191C90.1341 33.0885 90.844 33.7701 91.7052 33.7715C91.8727 33.7713 92.0388 33.745 92.1978 33.6936C92.2668 33.6713 92.321 33.5887 92.3208 33.5154L92.3225 32.749C92.3226 32.7376 92.3205 32.7194 92.3176 32.7084C92.317 32.7064 92.3165 32.7043 92.3159 32.7022C92.3113 32.6856 92.297 32.6611 92.283 32.651C92.2793 32.6484 92.2311 32.6207 92.1908 32.6453C92.1477 32.6656 92.147 32.6659 92.1463 32.6662C92.1353 32.6715 92.0981 32.6856 92.0807 32.6958C91.9299 32.7603 91.9074 32.7589 91.8631 32.7651C91.8328 32.7694 91.8023 32.7716 91.7716 32.7716C91.7139 32.7716 91.6565 32.7639 91.6007 32.7488C91.5449 32.7337 91.4914 32.7113 91.4414 32.6821C91.4146 32.6643 91.3891 32.6445 91.3652 32.623C91.3511 32.613 91.3375 32.6024 91.3243 32.5912C91.3176 32.5863 91.3111 32.5812 91.3046 32.576C91.3029 32.5738 91.3012 32.5715 91.2995 32.5692C91.1797 32.456 91.1115 32.2977 91.1112 32.1319C91.1116 32.1265 91.1121 32.1212 91.1127 32.1158C91.1122 32.1118 91.1116 32.1079 91.1112 32.1039V27.9565H92.0702C92.1531 27.9565 92.1946 27.9565 92.2262 27.9402C92.2541 27.9258 92.2767 27.9029 92.2909 27.8748C92.3071 27.8427 92.3071 27.8008 92.3071 27.717V27.1597C92.3071 27.0759 92.3071 27.034 92.2909 27.002C92.2767 26.9738 92.2541 26.9509 92.2262 26.9366C92.1946 26.9203 92.1531 26.9203 92.0702 26.9203H91.1112V25.9512C91.1112 25.8674 91.1112 25.8255 91.095 25.7934C91.0808 25.7653 91.0582 25.7424 91.0303 25.7281C90.9986 25.7117 90.9572 25.7117 90.8743 25.7117H90.323Z" fill="#F25C2B"/>
845
871
  </svg>`;
846
872
 
847
- const chatThreadsStyles = i$3 `
873
+ const chatThreadsStyles = i$4 `
848
874
  :host {
849
875
  padding: 24px 24px 21px;
850
876
  font-family: 'Inter', sans-serif;
@@ -919,11 +945,35 @@ var ProvidersShopGptSdk = (function () {
919
945
  color: #677c95;
920
946
  font-weight: 500;
921
947
  text-transform: uppercase;
922
- margin: 0 0 12px;
948
+ margin: 0;
923
949
  max-height: 18px;
924
950
  padding-left: 12px;
925
951
  }
926
952
 
953
+ .trash-icon {
954
+ display: flex;
955
+ padding: 2px;
956
+ border-radius: 5px;
957
+ cursor: pointer;
958
+ align-items: center;
959
+ justify-content: center;
960
+
961
+ &:hover {
962
+ background: #dc3545;
963
+
964
+ path {
965
+ fill: white;
966
+ }
967
+ }
968
+ }
969
+
970
+ .title-wrapper {
971
+ display: flex;
972
+ justify-content: space-between;
973
+ align-items: center;
974
+ margin: 0 0 12px;
975
+ }
976
+
927
977
  .threads {
928
978
  flex: 1;
929
979
  overflow-y: auto;
@@ -936,17 +986,6 @@ var ProvidersShopGptSdk = (function () {
936
986
 
937
987
  .trash-icon {
938
988
  display: none;
939
- padding: 2px;
940
- cursor: pointer;
941
-
942
- &:hover {
943
- border-radius: 5px;
944
- background: #dc3545;
945
-
946
- path {
947
- fill: white;
948
- }
949
- }
950
989
  }
951
990
 
952
991
  &:hover {
@@ -995,15 +1034,13 @@ var ProvidersShopGptSdk = (function () {
995
1034
  }
996
1035
  `;
997
1036
 
998
- let LoadSpinner =
999
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1000
- class LoadSpinner extends s {
1037
+ class LoadSpinner extends r$2 {
1001
1038
  render() {
1002
1039
  return x ` <div class="loader"><div class="spinner"></div></div> `;
1003
1040
  }
1004
- };
1041
+ }
1005
1042
  LoadSpinner.styles = [
1006
- i$3 `
1043
+ i$4 `
1007
1044
  .loader {
1008
1045
  display: flex;
1009
1046
  flex: 1;
@@ -1035,14 +1072,15 @@ var ProvidersShopGptSdk = (function () {
1035
1072
  }
1036
1073
  `,
1037
1074
  ];
1038
- LoadSpinner = __decorate([
1039
- t$2('load-spinner')
1040
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1041
- ], LoadSpinner);
1042
-
1043
- let ChatThreads =
1044
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1045
- class ChatThreads extends s {
1075
+ if (!customElements.get('load-spinner')) {
1076
+ customElements.define('load-spinner', LoadSpinner);
1077
+ }
1078
+
1079
+ class ChatThreads extends r$2 {
1080
+ constructor() {
1081
+ super(...arguments);
1082
+ this.deleteAllThreads = false;
1083
+ }
1046
1084
  getDomain() {
1047
1085
  var _a;
1048
1086
  if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
@@ -1051,6 +1089,14 @@ var ProvidersShopGptSdk = (function () {
1051
1089
  return `https://${this.merchantUrl}`;
1052
1090
  }
1053
1091
  handleThreadDelete() {
1092
+ if (this.deleteAllThreads) {
1093
+ this.dispatchEvent(new CustomEvent('delete-all-threads', {
1094
+ composed: true,
1095
+ bubbles: true,
1096
+ }));
1097
+ this.deleteAllThreads = false;
1098
+ return;
1099
+ }
1054
1100
  if (!this.deleteThreadId) {
1055
1101
  return;
1056
1102
  }
@@ -1070,12 +1116,27 @@ var ProvidersShopGptSdk = (function () {
1070
1116
  }
1071
1117
  return x `
1072
1118
  <div class="history">
1073
- <p class="title">History</p>
1119
+ <div class="title-wrapper">
1120
+ <p class="title">History</p>
1121
+ ${this.chatThreads.size
1122
+ ? x `<div
1123
+ class="trash-icon"
1124
+ @click=${() => {
1125
+ if (this.isLoading || this.isTyping) {
1126
+ return;
1127
+ }
1128
+ this.deleteAllThreads = true;
1129
+ }}
1130
+ >
1131
+ ${trashIcon}
1132
+ </div>`
1133
+ : E}
1134
+ </div>
1074
1135
  ${this.chatThreads.size
1075
1136
  ? x `<div class="threads">
1076
1137
  ${o$1(this.chatThreads.values(), (thread) => x `
1077
1138
  <div
1078
- class=${e$2({
1139
+ class=${e$1({
1079
1140
  'thread-wrapper': true,
1080
1141
  active: this.selectedThreadId === thread.threadId,
1081
1142
  disabled: this.isTyping,
@@ -1106,7 +1167,7 @@ var ProvidersShopGptSdk = (function () {
1106
1167
  </div>
1107
1168
  `)}
1108
1169
  </div>`
1109
- : T}
1170
+ : E}
1110
1171
  </div>
1111
1172
  `;
1112
1173
  }
@@ -1128,55 +1189,69 @@ var ProvidersShopGptSdk = (function () {
1128
1189
  ${this.getDomain().replace('https://', '')}
1129
1190
  </a>
1130
1191
  </div>`
1131
- : T}
1132
- ${this.deleteThreadId
1192
+ : E}
1193
+ ${this.deleteThreadId || this.deleteAllThreads
1133
1194
  ? x `
1134
1195
  <confirm-dialog
1135
1196
  @accept=${this.handleThreadDelete}
1136
- @decline=${() => (this.deleteThreadId = '')}
1197
+ @decline=${() => {
1198
+ this.deleteThreadId = '';
1199
+ this.deleteAllThreads = false;
1200
+ }}
1137
1201
  >
1138
- <h2 slot="title">Delete Thread?</h2>
1202
+ <h2 slot="title">
1203
+ ${this.deleteAllThreads
1204
+ ? 'Delete Entire Chat History?'
1205
+ : 'Delete Chat?'}
1206
+ </h2>
1139
1207
  <p slot="content">
1140
1208
  This action cannot be undone. Are you sure you want to delete
1141
- <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
1209
+ ${this.deleteAllThreads
1210
+ ? ' the entire chat history'
1211
+ : x `<b
1212
+ >"${this.chatThreads.get(this.deleteThreadId).title}"</b
1213
+ >`}?
1142
1214
  </p>
1143
1215
  </confirm-dialog>
1144
1216
  `
1145
- : T}
1217
+ : E}
1146
1218
  `;
1147
1219
  }
1148
- };
1220
+ }
1149
1221
  ChatThreads.styles = [chatThreadsStyles];
1150
1222
  __decorate([
1151
- n$1({ type: Object }),
1223
+ n({ type: Object }),
1152
1224
  __metadata("design:type", Map)
1153
1225
  ], ChatThreads.prototype, "chatThreads", void 0);
1154
1226
  __decorate([
1155
- n$1({ type: String }),
1227
+ n({ type: String }),
1156
1228
  __metadata("design:type", Object)
1157
1229
  ], ChatThreads.prototype, "merchantUrl", void 0);
1158
1230
  __decorate([
1159
- n$1({ type: Boolean }),
1231
+ n({ type: Boolean }),
1160
1232
  __metadata("design:type", Boolean)
1161
1233
  ], ChatThreads.prototype, "isLoading", void 0);
1162
1234
  __decorate([
1163
- n$1({ type: Boolean }),
1235
+ n({ type: Boolean }),
1164
1236
  __metadata("design:type", Boolean)
1165
1237
  ], ChatThreads.prototype, "isTyping", void 0);
1166
1238
  __decorate([
1167
- n$1({ type: String }),
1239
+ n({ type: String }),
1168
1240
  __metadata("design:type", String)
1169
1241
  ], ChatThreads.prototype, "selectedThreadId", void 0);
1170
1242
  __decorate([
1171
- r$1(),
1243
+ r(),
1172
1244
  __metadata("design:type", String)
1173
1245
  ], ChatThreads.prototype, "deleteThreadId", void 0);
1174
- ChatThreads = __decorate([
1175
- t$2('chat-threads')
1176
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1177
- ], ChatThreads);
1246
+ __decorate([
1247
+ r(),
1248
+ __metadata("design:type", Object)
1249
+ ], ChatThreads.prototype, "deleteAllThreads", void 0);
1250
+ if (!customElements.get('chat-threads')) {
1251
+ customElements.define('chat-threads', ChatThreads);
1252
+ }
1178
1253
 
1179
- const productsSectionStyles = i$3 `
1254
+ const productsSectionStyles = i$4 `
1180
1255
  :host {
1181
1256
  padding: 24px 16px;
1182
1257
  background-color: #fff;
@@ -1212,9 +1287,14 @@ var ProvidersShopGptSdk = (function () {
1212
1287
  justify-content: center;
1213
1288
  height: 100%;
1214
1289
  }
1290
+
1291
+ .merchant-image {
1292
+ width: 100%;
1293
+ object-fit: contain;
1294
+ }
1215
1295
  `;
1216
1296
 
1217
- const productItemStyles = i$3 `
1297
+ const productItemStyles = i$4 `
1218
1298
  :host {
1219
1299
  font-family: 'Inter', sans-serif;
1220
1300
  font-size: 16px;
@@ -1357,9 +1437,7 @@ var ProvidersShopGptSdk = (function () {
1357
1437
  }
1358
1438
  `;
1359
1439
 
1360
- let ProductItem =
1361
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1362
- class ProductItem extends s {
1440
+ class ProductItem extends r$2 {
1363
1441
  getLocalPrice(price) {
1364
1442
  if (!this.siteCurrency) {
1365
1443
  return price;
@@ -1367,6 +1445,16 @@ var ProvidersShopGptSdk = (function () {
1367
1445
  const localPrice = parseFloat(price) * this.siteCurrency.rate;
1368
1446
  return formatMoney(localPrice, this.siteCurrency.currency);
1369
1447
  }
1448
+ getComparedAtPrice(comparedAtPrice, price) {
1449
+ if (!comparedAtPrice ||
1450
+ comparedAtPrice === price ||
1451
+ parseFloat(comparedAtPrice) <= parseFloat(price)) {
1452
+ return E;
1453
+ }
1454
+ return x `<p class="price-compared">
1455
+ ${this.getLocalPrice(comparedAtPrice)}
1456
+ </p>`;
1457
+ }
1370
1458
  redirect(url) {
1371
1459
  var _a;
1372
1460
  if (!url) {
@@ -1375,8 +1463,8 @@ var ProvidersShopGptSdk = (function () {
1375
1463
  (_a = open(url, '_blank')) === null || _a === void 0 ? void 0 : _a.focus();
1376
1464
  }
1377
1465
  renderVariantTitles() {
1378
- if (!this.product.hasVariantsThatRequiresComponents) {
1379
- return T;
1466
+ if (this.product.hasOnlyDefaultVariant) {
1467
+ return E;
1380
1468
  }
1381
1469
  return this.product.variants[0].selectedOptions.map((option) => x `
1382
1470
  <p class="product-variation-details">${option.name}: ${option.value}</p>
@@ -1400,13 +1488,7 @@ var ProvidersShopGptSdk = (function () {
1400
1488
  </p>
1401
1489
  ${this.renderVariantTitles()}
1402
1490
  <div class="prices">
1403
- ${this.product.variants[0].comparedAtPrice &&
1404
- this.product.variants[0].comparedAtPrice !==
1405
- this.product.variants[0].price
1406
- ? x `<p class="price-compared">
1407
- ${this.getLocalPrice(this.product.variants[0].comparedAtPrice)}
1408
- </p>`
1409
- : T}
1491
+ ${this.getComparedAtPrice(this.product.variants[0].comparedAtPrice, this.product.variants[0].price)}
1410
1492
  <p>${this.getLocalPrice(this.product.variants[0].price)}</p>
1411
1493
  </div>
1412
1494
  <button
@@ -1419,22 +1501,21 @@ var ProvidersShopGptSdk = (function () {
1419
1501
  </div>
1420
1502
  `;
1421
1503
  }
1422
- };
1504
+ }
1423
1505
  ProductItem.styles = [productItemStyles];
1424
1506
  __decorate([
1425
- n$1({ type: Object }),
1507
+ n({ type: Object }),
1426
1508
  __metadata("design:type", Object)
1427
1509
  ], ProductItem.prototype, "product", void 0);
1428
1510
  __decorate([
1429
- n$1({ type: Object }),
1511
+ n({ type: Object }),
1430
1512
  __metadata("design:type", Object)
1431
1513
  ], ProductItem.prototype, "siteCurrency", void 0);
1432
- ProductItem = __decorate([
1433
- t$2('product-item')
1434
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1435
- ], ProductItem);
1514
+ if (!customElements.get('product-item')) {
1515
+ customElements.define('product-item', ProductItem);
1516
+ }
1436
1517
 
1437
- const productsListStyles = i$3 `
1518
+ const productsListStyles = i$4 `
1438
1519
  .products::-webkit-scrollbar {
1439
1520
  display: none;
1440
1521
  }
@@ -1460,6 +1541,8 @@ var ProvidersShopGptSdk = (function () {
1460
1541
  gap: 24px;
1461
1542
  overflow-x: auto;
1462
1543
  scrollbar-width: none;
1544
+ margin-left: -10px;
1545
+ padding-left: 10px;
1463
1546
  }
1464
1547
 
1465
1548
  .scroll-btns {
@@ -1494,19 +1577,34 @@ var ProvidersShopGptSdk = (function () {
1494
1577
  }
1495
1578
  `;
1496
1579
 
1497
- let ProductsList =
1498
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1499
- class ProductsList extends s {
1580
+ class ProductsList extends r$2 {
1581
+ constructor() {
1582
+ super(...arguments);
1583
+ this.showButtons = true;
1584
+ this.updateButtonsState = () => {
1585
+ if (!this.leftBtnEle || !this.productsEle || !this.rightBtnEle) {
1586
+ return;
1587
+ }
1588
+ const { scrollWidth, clientWidth } = this.productsEle;
1589
+ this.showButtons = scrollWidth > clientWidth;
1590
+ this.leftBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft === 0);
1591
+ const maxScroll = this.productsEle.scrollWidth - this.productsEle.clientWidth;
1592
+ this.rightBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft >= maxScroll - 1);
1593
+ };
1594
+ }
1500
1595
  connectedCallback() {
1501
1596
  super.connectedCallback();
1597
+ this.updateButtonsState();
1598
+ window.addEventListener('resize', this.updateButtonsState);
1502
1599
  }
1503
- updateButtonsState() {
1504
- if (!this.leftBtnEle || !this.productsEle || !this.rightBtnEle) {
1505
- return;
1600
+ disconnectedCallback() {
1601
+ window.removeEventListener('resize', this.updateButtonsState);
1602
+ super.disconnectedCallback();
1603
+ }
1604
+ updated(_changedProperties) {
1605
+ if (_changedProperties.has('products')) {
1606
+ this.updateButtonsState();
1506
1607
  }
1507
- this.leftBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft === 0);
1508
- const maxScroll = this.productsEle.scrollWidth - this.productsEle.clientWidth;
1509
- this.rightBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft >= maxScroll - 1);
1510
1608
  }
1511
1609
  scrollToLeft(e) {
1512
1610
  var _a;
@@ -1520,14 +1618,14 @@ var ProvidersShopGptSdk = (function () {
1520
1618
  }
1521
1619
  render() {
1522
1620
  if (!this.products.length) {
1523
- return T;
1621
+ return E;
1524
1622
  }
1525
1623
  return x `
1526
1624
  <div class="products-wrapper">
1527
1625
  <div class="products" @scroll=${this.updateButtonsState}>
1528
1626
  ${o$1(this.products, (product) => x `
1529
1627
  <div
1530
- class=${e$2({
1628
+ class=${e$1({
1531
1629
  'product-container': true,
1532
1630
  modal: this.viewType === 'modal',
1533
1631
  })}
@@ -1539,60 +1637,71 @@ var ProvidersShopGptSdk = (function () {
1539
1637
  </div>
1540
1638
  `)}
1541
1639
  </div>
1542
- <div class="scroll-btns">
1543
- <div class="left-btn disabled" @click=${this.scrollToLeft}>
1544
- ${leftBtn}
1545
- </div>
1546
- <div class="right-btn" @click=${this.scrollToRight}>${rightBtn}</div>
1547
- </div>
1640
+ ${this.showButtons
1641
+ ? x ` <div class="scroll-btns">
1642
+ <div class="left-btn disabled" @click=${this.scrollToLeft}>
1643
+ ${leftBtn}
1644
+ </div>
1645
+ <div class="right-btn" @click=${this.scrollToRight}>
1646
+ ${rightBtn}
1647
+ </div>
1648
+ </div>`
1649
+ : E}
1548
1650
  </div>
1549
1651
  `;
1550
1652
  }
1551
- };
1653
+ }
1552
1654
  ProductsList.styles = [productsListStyles];
1553
1655
  __decorate([
1554
- n$1({ type: Array }),
1656
+ n({ type: Array }),
1555
1657
  __metadata("design:type", Array)
1556
1658
  ], ProductsList.prototype, "products", void 0);
1557
1659
  __decorate([
1558
- n$1({ type: Object }),
1660
+ n({ type: Object }),
1559
1661
  __metadata("design:type", Object)
1560
1662
  ], ProductsList.prototype, "siteCurrency", void 0);
1561
1663
  __decorate([
1562
- e$4('.left-btn'),
1664
+ r(),
1665
+ __metadata("design:type", Object)
1666
+ ], ProductsList.prototype, "showButtons", void 0);
1667
+ __decorate([
1668
+ e$3('.left-btn'),
1563
1669
  __metadata("design:type", Object)
1564
1670
  ], ProductsList.prototype, "leftBtnEle", void 0);
1565
1671
  __decorate([
1566
- e$4('.right-btn'),
1672
+ e$3('.right-btn'),
1567
1673
  __metadata("design:type", Object)
1568
1674
  ], ProductsList.prototype, "rightBtnEle", void 0);
1569
1675
  __decorate([
1570
- e$4('.products'),
1676
+ e$3('.products'),
1571
1677
  __metadata("design:type", Object)
1572
1678
  ], ProductsList.prototype, "productsEle", void 0);
1573
- ProductsList = __decorate([
1574
- t$2('products-list')
1575
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1576
- ], ProductsList);
1577
-
1578
- let ProductsSection =
1579
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1580
- class ProductsSection extends s {
1679
+ if (!customElements.get('products-list')) {
1680
+ customElements.define('products-list', ProductsList);
1681
+ }
1682
+
1683
+ class ProductsSection extends r$2 {
1581
1684
  connectedCallback() {
1582
1685
  super.connectedCallback();
1583
1686
  }
1687
+ renderMerchantImage() {
1688
+ if (this.merchantImage) {
1689
+ return x ` <img class="merchant-image" src=${this.merchantImage} /> `;
1690
+ }
1691
+ return x `
1692
+ <div>${searchIcon}</div>
1693
+ <p>
1694
+ Start exploring by typing your query in the search bar on the right.
1695
+ </p>
1696
+ `;
1697
+ }
1584
1698
  render() {
1585
- if (this.isLoadingHistory) {
1699
+ if (this.isLoadingHistory || this.isLoadingThreads) {
1586
1700
  return x ` <load-spinner></load-spinner> `;
1587
1701
  }
1588
1702
  if (!this.products.length) {
1589
1703
  return x `
1590
- <div class="no-products">
1591
- <div>${searchIcon}</div>
1592
- <p>
1593
- Start exploring by typing your query in the search bar on the right.
1594
- </p>
1595
- </div>
1704
+ <div class="no-products">${this.renderMerchantImage()}</div>
1596
1705
  `;
1597
1706
  }
1598
1707
  const topResult = this.products[0];
@@ -1616,38 +1725,45 @@ var ProvidersShopGptSdk = (function () {
1616
1725
  </div>
1617
1726
  `;
1618
1727
  }
1619
- };
1728
+ }
1620
1729
  ProductsSection.styles = [productsSectionStyles];
1621
1730
  __decorate([
1622
- n$1({ type: Array }),
1731
+ n({ type: String }),
1732
+ __metadata("design:type", Object)
1733
+ ], ProductsSection.prototype, "merchantImage", void 0);
1734
+ __decorate([
1735
+ n({ type: Array }),
1623
1736
  __metadata("design:type", Array)
1624
1737
  ], ProductsSection.prototype, "products", void 0);
1625
1738
  __decorate([
1626
- n$1({ type: Boolean }),
1739
+ n({ type: Boolean }),
1627
1740
  __metadata("design:type", Boolean)
1628
1741
  ], ProductsSection.prototype, "isLoadingHistory", void 0);
1629
1742
  __decorate([
1630
- n$1({ type: Object }),
1743
+ n({ type: Object }),
1631
1744
  __metadata("design:type", Object)
1632
1745
  ], ProductsSection.prototype, "siteCurrency", void 0);
1633
1746
  __decorate([
1634
- e$4('.left-btn'),
1747
+ n({ type: Boolean }),
1748
+ __metadata("design:type", Boolean)
1749
+ ], ProductsSection.prototype, "isLoadingThreads", void 0);
1750
+ __decorate([
1751
+ e$3('.left-btn'),
1635
1752
  __metadata("design:type", Object)
1636
1753
  ], ProductsSection.prototype, "leftBtnEle", void 0);
1637
1754
  __decorate([
1638
- e$4('.right-btn'),
1755
+ e$3('.right-btn'),
1639
1756
  __metadata("design:type", Object)
1640
1757
  ], ProductsSection.prototype, "rightBtnEle", void 0);
1641
1758
  __decorate([
1642
- e$4('.products'),
1759
+ e$3('.products'),
1643
1760
  __metadata("design:type", Object)
1644
1761
  ], ProductsSection.prototype, "productsEle", void 0);
1645
- ProductsSection = __decorate([
1646
- t$2('products-section')
1647
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1648
- ], ProductsSection);
1762
+ if (!customElements.get('products-section')) {
1763
+ customElements.define('products-section', ProductsSection);
1764
+ }
1649
1765
 
1650
- const chatSectionStyles = i$3 `
1766
+ const chatSectionStyles = i$4 `
1651
1767
  :host {
1652
1768
  font-family: 'Inter', sans-serif;
1653
1769
  font-size: 16px;
@@ -1825,6 +1941,20 @@ var ProvidersShopGptSdk = (function () {
1825
1941
  gap: 28px;
1826
1942
  padding-bottom: 10px;
1827
1943
  margin-bottom: -10px;
1944
+ margin-right: -10px;
1945
+ padding-right: 10px;
1946
+ margin-left: -10px;
1947
+ padding-left: 10px;
1948
+ background: linear-gradient(#f7f8fa80, #f7f8fa80),
1949
+ var(--shopgpt-merchant-img-url);
1950
+ background-position: center;
1951
+ background-repeat: no-repeat;
1952
+ background-size: contain;
1953
+
1954
+ &.loading {
1955
+ justify-content: center;
1956
+ align-items: center;
1957
+ }
1828
1958
 
1829
1959
  .message:last-child {
1830
1960
  margin-top: 10px;
@@ -1995,7 +2125,7 @@ var ProvidersShopGptSdk = (function () {
1995
2125
  .prompts {
1996
2126
  display: flex;
1997
2127
  justify-content: center;
1998
- gap: 23px 10px;
2128
+ gap: 10px;
1999
2129
  flex-wrap: wrap;
2000
2130
 
2001
2131
  .prompt {
@@ -2031,13 +2161,19 @@ var ProvidersShopGptSdk = (function () {
2031
2161
  0px 20px 20px 0px rgba(0, 0, 0, 0.08);
2032
2162
  border-radius: 0px 0px 10px 10px;
2033
2163
 
2034
- h2 {
2035
- padding: 10px 16px;
2036
- color: #172a41;
2037
- font-size: 16px;
2038
- font-weight: 700;
2039
- line-height: 20px;
2164
+ .title-wrapper {
2165
+ display: flex;
2166
+ justify-content: space-between;
2167
+ align-items: center;
2040
2168
  border-bottom: 1px solid #dbe2eb;
2169
+ padding: 10px 16px;
2170
+
2171
+ h2 {
2172
+ color: #172a41;
2173
+ font-size: 16px;
2174
+ font-weight: 700;
2175
+ line-height: 20px;
2176
+ }
2041
2177
  }
2042
2178
 
2043
2179
  .thread-titles-wrapper {
@@ -2121,7 +2257,7 @@ var ProvidersShopGptSdk = (function () {
2121
2257
  <path d="M18 7.05L16.95 6L12 10.95L7.05 6L6 7.05L10.95 12L6 16.95L7.05 18L12 13.05L16.95 18L18 16.95L13.05 12L18 7.05Z" fill="white"/>
2122
2258
  </svg>`;
2123
2259
 
2124
- const personalizeDialogStyles = i$3 `
2260
+ const personalizeDialogStyles = i$4 `
2125
2261
  :host {
2126
2262
  font-family: 'Inter', sans-serif;
2127
2263
  font-size: 16px;
@@ -2359,9 +2495,7 @@ var ProvidersShopGptSdk = (function () {
2359
2495
  <path fill-rule="evenodd" clip-rule="evenodd" d="M21 7C22.7306 7 24.4223 7.51318 25.8612 8.47464C27.3002 9.4361 28.4217 10.8027 29.084 12.4015C29.7462 14.0004 29.9195 15.7597 29.5819 17.457C29.2443 19.1544 28.4109 20.7135 27.1872 21.9372C25.9635 23.1609 24.4044 23.9942 22.707 24.3319C21.0097 24.6695 19.2504 24.4962 17.6515 23.8339C16.0527 23.1717 14.6861 22.0502 13.7246 20.6112C12.7632 19.1723 12.25 17.4806 12.25 15.75C12.25 13.4294 13.1719 11.2038 14.8128 9.56282C16.4538 7.92187 18.6794 7 21 7ZM21 3.5C18.5772 3.5 16.2088 4.21845 14.1943 5.5645C12.1798 6.91054 10.6097 8.82373 9.68248 11.0621C8.75531 13.3005 8.51272 15.7636 8.98539 18.1399C9.45805 20.5161 10.6248 22.6989 12.3379 24.4121C14.0511 26.1252 16.2339 27.2919 18.6101 27.7646C20.9864 28.2373 23.4495 27.9947 25.6879 27.0675C27.9263 26.1403 29.8395 24.5702 31.1855 22.5557C32.5316 20.5412 33.25 18.1728 33.25 15.75C33.25 12.5011 31.9594 9.38526 29.6621 7.08794C27.3647 4.79062 24.2489 3.5 21 3.5ZM56 24.5H49V17.5H45.5V24.5H38.5V28H45.5V35H49V28H56V24.5ZM35 52.5H38.5V43.75C38.5 40.5011 37.2094 37.3853 34.9121 35.0879C32.6147 32.7906 29.4989 31.5 26.25 31.5H15.75C12.5011 31.5 9.38526 32.7906 7.08794 35.0879C4.79062 37.3853 3.5 40.5011 3.5 43.75V52.5H7V43.75C7 41.4294 7.92187 39.2038 9.56282 37.5628C11.2038 35.9219 13.4294 35 15.75 35H26.25C28.5706 35 30.7962 35.9219 32.4372 37.5628C34.0781 39.2038 35 41.4294 35 43.75V52.5Z" fill="#172A41"/>
2360
2496
  </svg>`;
2361
2497
 
2362
- let PersonalizeDialog =
2363
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2364
- class PersonalizeDialog extends s {
2498
+ class PersonalizeDialog extends r$2 {
2365
2499
  constructor() {
2366
2500
  super(...arguments);
2367
2501
  this.isLoading = false;
@@ -2384,7 +2518,7 @@ var ProvidersShopGptSdk = (function () {
2384
2518
  return this.selectProductHandle();
2385
2519
  }
2386
2520
  }
2387
- return T;
2521
+ return E;
2388
2522
  };
2389
2523
  }
2390
2524
  showModal() {
@@ -2568,7 +2702,7 @@ var ProvidersShopGptSdk = (function () {
2568
2702
  : 'Select Product'}
2569
2703
  </div>
2570
2704
  <ul class="dropdown-list">
2571
- ${(_a = this.defaultProductHandles) === null || _a === void 0 ? void 0 : _a.map((productHandle) => x `<li
2705
+ ${(_a = this.defaultProductHandles) === null || _a === void 0 ? void 0 : _a.map((productHandle) => x ` <li
2572
2706
  class="dropdown-item"
2573
2707
  @click=${() => {
2574
2708
  this.productHandle = productHandle;
@@ -2580,10 +2714,10 @@ var ProvidersShopGptSdk = (function () {
2580
2714
  </ul>
2581
2715
  </div>
2582
2716
  ${this.productHandle
2583
- ? x `<button class="finish-btn" @click=${this.handleSubmit}>
2717
+ ? x ` <button class="finish-btn" @click=${this.handleSubmit}>
2584
2718
  Finish
2585
2719
  </button>`
2586
- : T}
2720
+ : E}
2587
2721
  `;
2588
2722
  }
2589
2723
  render() {
@@ -2591,10 +2725,10 @@ var ProvidersShopGptSdk = (function () {
2591
2725
  <dialog>
2592
2726
  <div class="dialog-title">
2593
2727
  ${this.state !== 'profile-type'
2594
- ? x `<div class="back-btn btn" @click=${this.handleBackStep}>
2728
+ ? x ` <div class="back-btn btn" @click=${this.handleBackStep}>
2595
2729
  ${backBtn}
2596
2730
  </div>`
2597
- : T}
2731
+ : E}
2598
2732
  <h2>Personalize your search</h2>
2599
2733
  <div class="close-btn btn" @click=${() => this.dialogModal.close()}>
2600
2734
  ${closeBtn}
@@ -2604,75 +2738,174 @@ var ProvidersShopGptSdk = (function () {
2604
2738
  </dialog>
2605
2739
  `;
2606
2740
  }
2607
- };
2741
+ }
2608
2742
  PersonalizeDialog.styles = [personalizeDialogStyles];
2609
2743
  __decorate([
2610
- e$4('dialog'),
2744
+ e$3('dialog'),
2611
2745
  __metadata("design:type", HTMLDialogElement)
2612
2746
  ], PersonalizeDialog.prototype, "dialogModal", void 0);
2613
2747
  __decorate([
2614
- e$4('.dropdown-list'),
2748
+ e$3('.dropdown-list'),
2615
2749
  __metadata("design:type", HTMLUListElement)
2616
2750
  ], PersonalizeDialog.prototype, "dropdownList", void 0);
2617
2751
  __decorate([
2618
- e$4('.dropdown-trigger'),
2752
+ e$3('.dropdown-trigger'),
2619
2753
  __metadata("design:type", HTMLDivElement)
2620
2754
  ], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
2621
2755
  __decorate([
2622
- n$1({ type: Array }),
2756
+ n({ type: Array }),
2623
2757
  __metadata("design:type", Array)
2624
2758
  ], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
2625
2759
  __decorate([
2626
- n$1({ type: Array }),
2760
+ n({ type: Array }),
2627
2761
  __metadata("design:type", Array)
2628
2762
  ], PersonalizeDialog.prototype, "defaultProfiles", void 0);
2629
2763
  __decorate([
2630
- n$1({ type: Boolean }),
2631
- __metadata("design:type", Boolean)
2764
+ n({ type: Boolean }),
2765
+ __metadata("design:type", Object)
2632
2766
  ], PersonalizeDialog.prototype, "isLoading", void 0);
2633
2767
  __decorate([
2634
- n$1({ type: String }),
2768
+ n({ type: String }),
2635
2769
  __metadata("design:type", Object)
2636
2770
  ], PersonalizeDialog.prototype, "state", void 0);
2637
2771
  __decorate([
2638
- n$1({ type: String }),
2772
+ n({ type: String }),
2639
2773
  __metadata("design:type", Object)
2640
2774
  ], PersonalizeDialog.prototype, "profileType", void 0);
2641
2775
  __decorate([
2642
- n$1({ type: String }),
2776
+ n({ type: String }),
2643
2777
  __metadata("design:type", Object)
2644
2778
  ], PersonalizeDialog.prototype, "selectedProfile", void 0);
2645
2779
  __decorate([
2646
- n$1({ type: String }),
2780
+ n({ type: String }),
2647
2781
  __metadata("design:type", Object)
2648
2782
  ], PersonalizeDialog.prototype, "visitorType", void 0);
2649
2783
  __decorate([
2650
- n$1({ type: String }),
2784
+ n({ type: String }),
2651
2785
  __metadata("design:type", Object)
2652
2786
  ], PersonalizeDialog.prototype, "productHandle", void 0);
2653
- PersonalizeDialog = __decorate([
2654
- t$2('personalize-dialog')
2655
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2656
- ], PersonalizeDialog);
2787
+ if (!customElements.get('personalize-dialog')) {
2788
+ customElements.define('personalize-dialog', PersonalizeDialog);
2789
+ }
2657
2790
 
2658
2791
  /**
2659
2792
  * @license
2660
2793
  * Copyright 2017 Google LLC
2661
2794
  * SPDX-License-Identifier: BSD-3-Clause
2662
- */let e$1 = class e extends i{constructor(i){if(super(i),this.it=T,i.type!==t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===T||null==r)return this._t=void 0,this.it=r;if(r===w)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);
2663
-
2664
- 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,"")}
2795
+ */class e extends i{constructor(i){if(super(i),this.it=E,i.type!==t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===E||null==r)return this._t=void 0,this.it=r;if(r===T)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o=e$2(e);
2796
+
2797
+ const markdown = (text) => {
2798
+ let src = text;
2799
+ const rx_space = /\t|\r|\uf8ff/g;
2800
+ const rx_hr = /^([*\-=_] *){3,}$/gm;
2801
+ const rx_blockquote = /\n *> *([^]*?)(?=(\n|$){2})/g;
2802
+ const rx_list = /\n( *)(?:[*\-+]|((\d+)|([a-z])|[A-Z])[.)]) +([^]*?)(?=(\n|$){2})/g;
2803
+ const rx_listjoin = /<\/(ol|ul)>\n\n<\1>/g;
2804
+ const rx_highlight = /(^|[^A-Za-z\d\\])(([*_])|(~)|(\^)|(--)|(\+\+)|`)(\2?)([^<]*?)\2\8(?!\2)(?=\W|_|$)/g;
2805
+ const rx_code = /\n((```|~~~).*\n?([^]*?)\n?\2|(( {4}.*?\n)+))/g;
2806
+ const rx_link = /((!?)\[(.*?)\]\((.*?)( ".*")?\)|\\([\\`*_{}[\]()#+\-.!~]))/g;
2807
+ const rx_table = /\n(( *\|.*?\| *\n)+)/g;
2808
+ const rx_thead = /^.*\n( *\|( *:?-+:?-+:? *\|)* *\n|)/;
2809
+ const rx_row = /.*\n/g;
2810
+ const rx_cell = /\|(.*?[^\\])\|/g;
2811
+ const rx_heading = /(?=^|>|\n)([>\s]*?)(#{1,6}) (.*?)( #*)? *(?=\n|$)/g;
2812
+ const rx_para = /(?=^|>|\n)\s*\n+([^<]+?)\n+\s*(?=\n|<|$)/g;
2813
+ const rx_stash = /-\d+\uf8ff/g;
2814
+ const stash = {};
2815
+ let si = 0;
2816
+ function replace(rex, fn) {
2817
+ src = src.replace(rex, fn);
2818
+ }
2819
+ function element(tag, content) {
2820
+ return `<${tag}>${content}</${tag}>`;
2821
+ }
2822
+ function blockquote(src) {
2823
+ return src.replace(rx_blockquote, (_, content) => {
2824
+ return element('blockquote', blockquote(highlight(content.replace(/^ *> */gm, ''))));
2825
+ });
2826
+ }
2827
+ function list(src) {
2828
+ return src.replace(rx_list, (all, ind, ol, num, low, content) => {
2829
+ const entry = element('li', highlight(content
2830
+ .split(new RegExp(`\n ?${ind}(?:(?:\\d+|[a-zA-Z])[.)]|[*\\-+]) +`, 'g'))
2831
+ .map(list)
2832
+ .join('</li><li>')));
2833
+ return `\n${ol
2834
+ ? `<ol start="${num
2835
+ ? ol + '">'
2836
+ : `${parseInt(ol, 36) - 9}" style="list-style-type:${low ? 'low' : 'upp'}er-alpha">`}${entry}</ol>`
2837
+ : element('ul', entry)}`;
2838
+ });
2839
+ }
2840
+ function highlight(src) {
2841
+ return src.replace(rx_highlight, function (all, _, p1, emp, sub, sup, small, big, p2, content) {
2842
+ return (_ +
2843
+ element(emp
2844
+ ? p2
2845
+ ? 'strong'
2846
+ : 'em'
2847
+ : sub
2848
+ ? p2
2849
+ ? 's'
2850
+ : 'sub'
2851
+ : sup
2852
+ ? 'sup'
2853
+ : small
2854
+ ? 'small'
2855
+ : big
2856
+ ? 'big'
2857
+ : 'code', highlight(content)));
2858
+ });
2859
+ }
2860
+ src = `\n${src}\n`;
2861
+ replace(rx_space, ' ');
2862
+ src = blockquote(src);
2863
+ replace(rx_hr, '<hr/>');
2864
+ src = list(src);
2865
+ replace(rx_listjoin, '');
2866
+ replace(rx_code, (_, p1, p2, p3, p4) => {
2867
+ stash[--si] = element('pre', element('code', p3 || p4.replace(/^ {4}/gm, '')));
2868
+ return `${si}\uf8ff`;
2869
+ });
2870
+ replace(rx_link, (_, p1, p2, p3, p4, p5, p6) => {
2871
+ stash[--si] = p4
2872
+ ? p2
2873
+ ? `<img src="${p4}" alt="${p3}"/>`
2874
+ : `<a href="${p4}">${highlight(p3)}</a>`
2875
+ : p6;
2876
+ return `${si}\uf8ff`;
2877
+ });
2878
+ replace(rx_table, (_, table) => {
2879
+ var _a;
2880
+ const sep = ((_a = table.match(rx_thead)) === null || _a === void 0 ? void 0 : _a[1]) || '';
2881
+ return `\n${element('table', table.replace(rx_row, (row, ri) => {
2882
+ return row === sep
2883
+ ? ''
2884
+ : element('tr', row.replace(rx_cell, (_, cell, ci) => ci
2885
+ ? element(sep && !ri ? 'th' : 'td', highlight(cell || ''))
2886
+ : ''));
2887
+ }))}`;
2888
+ });
2889
+ replace(rx_heading, (_, prefix, p1, p2) => {
2890
+ return prefix + element(`h${p1.length}`, highlight(p2));
2891
+ });
2892
+ replace(rx_para, (_, content) => {
2893
+ return element('p', highlight(content));
2894
+ });
2895
+ replace(rx_stash, (all) => stash[parseInt(all)]);
2896
+ return src.trim();
2897
+ };
2665
2898
 
2666
- let MarkdownRenderer =
2667
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2668
- class MarkdownRenderer extends s {
2899
+ class MarkdownRenderer extends r$2 {
2669
2900
  render() {
2670
- const slotContent = this.innerHTML.trim();
2671
- const parsedContent = t(slotContent);
2672
- return o(parsedContent);
2901
+ // Remove lit markers from slot content
2902
+ const slotContent = this.innerHTML
2903
+ .trim()
2904
+ .replace(/<!--\?lit\$[\d$]+-->/g, '');
2905
+ return o(markdown(slotContent));
2673
2906
  }
2674
- };
2675
- MarkdownRenderer.styles = i$3 `
2907
+ }
2908
+ MarkdownRenderer.styles = i$4 `
2676
2909
  :host {
2677
2910
  font-family: 'Inter', sans-serif;
2678
2911
  font-size: 16px;
@@ -2683,14 +2916,11 @@ var ProvidersShopGptSdk = (function () {
2683
2916
  }
2684
2917
  }
2685
2918
  `;
2686
- MarkdownRenderer = __decorate([
2687
- t$2('markdown-renderer')
2688
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2689
- ], MarkdownRenderer);
2690
-
2691
- let TooltipComponent =
2692
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2693
- class TooltipComponent extends s {
2919
+ if (!customElements.get('markdown-renderer')) {
2920
+ customElements.define('markdown-renderer', MarkdownRenderer);
2921
+ }
2922
+
2923
+ class TooltipComponent extends r$2 {
2694
2924
  constructor() {
2695
2925
  super(...arguments);
2696
2926
  this.position = 'bottom-left';
@@ -2702,18 +2932,18 @@ var ProvidersShopGptSdk = (function () {
2702
2932
  <div class="tooltip ${this.position}">${this.text}</div>
2703
2933
  `;
2704
2934
  }
2705
- };
2935
+ }
2706
2936
  TooltipComponent.styles = [
2707
- i$3 `
2937
+ i$4 `
2708
2938
  :host {
2709
2939
  position: relative;
2710
2940
  display: inline-block;
2711
2941
  }
2942
+
2712
2943
  .tooltip {
2713
2944
  position: absolute;
2714
2945
  color: #172a41;
2715
2946
  padding: 4px 8px;
2716
- border-radius: 4px;
2717
2947
  white-space: nowrap;
2718
2948
  font-size: 12px;
2719
2949
  opacity: 0;
@@ -2729,57 +2959,70 @@ var ProvidersShopGptSdk = (function () {
2729
2959
  font-weight: 400;
2730
2960
  line-height: 150%;
2731
2961
  }
2962
+
2732
2963
  :host(:hover) .tooltip {
2733
2964
  opacity: 1;
2734
2965
  }
2966
+
2735
2967
  .top-center {
2736
2968
  bottom: calc(100% + 2px);
2737
2969
  left: 50%;
2738
2970
  transform: translateX(-50%);
2739
2971
  }
2972
+
2740
2973
  .top-left {
2741
2974
  bottom: calc(100% + 2px);
2742
2975
  left: 0;
2743
2976
  }
2977
+
2744
2978
  .top-right {
2745
2979
  bottom: calc(100% + 2px);
2746
2980
  right: 0;
2747
2981
  }
2982
+
2748
2983
  .bottom-center {
2749
2984
  top: calc(100% + 2px);
2750
2985
  left: 50%;
2751
2986
  transform: translateX(-50%);
2752
2987
  }
2988
+
2753
2989
  .bottom-left {
2754
2990
  top: calc(100% + 2px);
2755
2991
  left: 0;
2756
2992
  }
2993
+
2757
2994
  .bottom-right {
2758
2995
  top: calc(100% + 2px);
2759
2996
  right: 0;
2760
2997
  }
2998
+
2761
2999
  .left-center {
2762
3000
  right: calc(100% + 2px);
2763
3001
  top: 50%;
2764
3002
  transform: translateY(-50%);
2765
3003
  }
3004
+
2766
3005
  .left-top {
2767
3006
  right: calc(100% + 2px);
2768
3007
  top: 0;
2769
3008
  }
3009
+
2770
3010
  .left-bottom {
2771
3011
  right: calc(100% + 2px);
2772
3012
  bottom: 0;
2773
3013
  }
3014
+
2774
3015
  .right-center {
2775
3016
  left: calc(100% + 2px);
2776
3017
  top: 50%;
2777
3018
  transform: translateY(-50%);
2778
3019
  }
3020
+
2779
3021
  .right-top {
2780
3022
  left: calc(100% + 2px);
2781
3023
  top: 0;
2782
3024
  }
3025
+
2783
3026
  .right-bottom {
2784
3027
  left: calc(100% + 2px);
2785
3028
  bottom: 0;
@@ -2787,19 +3030,18 @@ var ProvidersShopGptSdk = (function () {
2787
3030
  `,
2788
3031
  ];
2789
3032
  __decorate([
2790
- n$1({ type: String }),
3033
+ n({ type: String }),
2791
3034
  __metadata("design:type", String)
2792
3035
  ], TooltipComponent.prototype, "position", void 0);
2793
3036
  __decorate([
2794
- n$1({ type: String }),
2795
- __metadata("design:type", String)
3037
+ n({ type: String }),
3038
+ __metadata("design:type", Object)
2796
3039
  ], TooltipComponent.prototype, "text", void 0);
2797
- TooltipComponent = __decorate([
2798
- t$2('tooltip-component')
2799
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2800
- ], TooltipComponent);
3040
+ if (!customElements.get('tooltip-component')) {
3041
+ customElements.define('tooltip-component', TooltipComponent);
3042
+ }
2801
3043
 
2802
- const confirmDialogStyles = i$3 `
3044
+ const confirmDialogStyles = i$4 `
2803
3045
  :host {
2804
3046
  font-family: 'Inter', sans-serif;
2805
3047
  font-size: 16px;
@@ -2878,9 +3120,7 @@ var ProvidersShopGptSdk = (function () {
2878
3120
  }
2879
3121
  `;
2880
3122
 
2881
- let ConfirmDialog =
2882
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2883
- class ConfirmDialog extends s {
3123
+ class ConfirmDialog extends r$2 {
2884
3124
  onAcceptClick(e) {
2885
3125
  e.preventDefault();
2886
3126
  this.dispatchEvent(new CustomEvent('accept', {
@@ -2913,19 +3153,17 @@ var ProvidersShopGptSdk = (function () {
2913
3153
  </div>
2914
3154
  `;
2915
3155
  }
2916
- };
3156
+ }
2917
3157
  ConfirmDialog.styles = [confirmDialogStyles];
2918
- ConfirmDialog = __decorate([
2919
- t$2('confirm-dialog')
2920
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2921
- ], ConfirmDialog);
2922
-
2923
- let ChatSection =
2924
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2925
- class ChatSection extends s {
3158
+ if (!customElements.get('confirm-dialog')) {
3159
+ customElements.define('confirm-dialog', ConfirmDialog);
3160
+ }
3161
+
3162
+ class ChatSection extends r$2 {
2926
3163
  constructor() {
2927
3164
  super(...arguments);
2928
3165
  this.showChatThreads = false;
3166
+ this.deleteAllThreads = false;
2929
3167
  this.userQuery = '';
2930
3168
  }
2931
3169
  scrollToBottom() {
@@ -2950,6 +3188,14 @@ var ProvidersShopGptSdk = (function () {
2950
3188
  await this.processMessage(e, message);
2951
3189
  }
2952
3190
  handleThreadDelete() {
3191
+ if (this.deleteAllThreads) {
3192
+ this.dispatchEvent(new CustomEvent('delete-all-threads', {
3193
+ composed: true,
3194
+ bubbles: true,
3195
+ }));
3196
+ this.deleteAllThreads = false;
3197
+ return;
3198
+ }
2953
3199
  if (!this.deleteThreadId) {
2954
3200
  return;
2955
3201
  }
@@ -2961,7 +3207,7 @@ var ProvidersShopGptSdk = (function () {
2961
3207
  this.deleteThreadId = '';
2962
3208
  }
2963
3209
  typingIndicator() {
2964
- return x `<div class="typing-dots">
3210
+ return x ` <div class="typing-dots">
2965
3211
  <div class="dot"></div>
2966
3212
  <div class="dot"></div>
2967
3213
  <div class="dot"></div>
@@ -2977,8 +3223,8 @@ var ProvidersShopGptSdk = (function () {
2977
3223
  </div>
2978
3224
  <div>
2979
3225
  ${message.message
2980
- ? x `<markdown-renderer>${message.message}</markdown-renderer>`
2981
- : T}
3226
+ ? x ` <markdown-renderer>${message.message}</markdown-renderer>`
3227
+ : E}
2982
3228
  ${this.viewType !== 'modal' && ((_a = message.products) === null || _a === void 0 ? void 0 : _a[0])
2983
3229
  ? x `
2984
3230
  <span class="line"></span>
@@ -2989,27 +3235,29 @@ var ProvidersShopGptSdk = (function () {
2989
3235
  ></product-item>
2990
3236
  </div>
2991
3237
  `
2992
- : T}
3238
+ : E}
2993
3239
  </div>
2994
3240
  </div>
2995
3241
  ${this.viewType === 'modal' && message.products
2996
- ? x `<products-list
3242
+ ? x ` <products-list
2997
3243
  .products=${message.products}
2998
3244
  .siteCurrency=${this.siteCurrency}
2999
3245
  .viewType=${this.viewType}
3000
3246
  ></products-list>`
3001
- : T}
3247
+ : E}
3002
3248
  </div>
3003
3249
  `;
3004
3250
  }
3005
3251
  chatWindow() {
3006
- if (this.isLoadingHistory) {
3007
- return x ` <load-spinner></load-spinner> `;
3252
+ if (this.isLoadingHistory || this.isLoadingThreads) {
3253
+ return x `<div class="messages loading">
3254
+ <load-spinner></load-spinner>
3255
+ </div>`;
3008
3256
  }
3009
3257
  return x `
3010
3258
  <div class="messages">
3011
3259
  ${this.isTyping
3012
- ? x `<div class="message bot">
3260
+ ? x ` <div class="message bot">
3013
3261
  <div>
3014
3262
  <div class="bot-icon">${botIcon}</div>
3015
3263
  </div>
@@ -3021,7 +3269,7 @@ var ProvidersShopGptSdk = (function () {
3021
3269
  sender: 'bot',
3022
3270
  message: "Uh-oh! Looks like I tripped over some alpha-stage wires. Things are still a bit wobbly here, buy hey, that's what testing is for, Let's try that again; or feel free to throw another challenge my way!",
3023
3271
  })
3024
- : T}
3272
+ : E}
3025
3273
  ${this.messages.map((message) => {
3026
3274
  if (message.sender === 'bot') {
3027
3275
  return this.botMessage(message);
@@ -3034,11 +3282,10 @@ var ProvidersShopGptSdk = (function () {
3034
3282
  </div>
3035
3283
  <div>
3036
3284
  <p>
3037
- Welcome to the personalized search! How can we help?
3038
- <br />
3039
- <br />
3040
- Type your search query or select one of the prompts to get
3041
- started:
3285
+ Hi,
3286
+ ${this.brandName ? x `Welcome to ${this.brandName}.` : E}
3287
+ I'm here to help you find the perfect product? What are you
3288
+ looking to resolve today?
3042
3289
  </p>
3043
3290
  </div>
3044
3291
  </div>
@@ -3046,14 +3293,20 @@ var ProvidersShopGptSdk = (function () {
3046
3293
  `;
3047
3294
  }
3048
3295
  quickPrompts() {
3049
- var _a;
3050
- if (((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId) || this.messages.length) {
3051
- return T;
3296
+ if (this.isLoadingHistory || this.isTyping || this.isLoadingThreads) {
3297
+ return E;
3298
+ }
3299
+ const prompts = this.messages.length
3300
+ ? this.messages[0].welcomePrompts
3301
+ : this.prompts
3302
+ ? this.prompts.split(',').map((prompt) => prompt.trim())
3303
+ : ['Best Selling Items', 'Hot Sales'];
3304
+ if (!prompts) {
3305
+ return E;
3052
3306
  }
3053
- const defaultPrompts = ['Best Selling Items', 'Hot Sales'];
3054
3307
  return x `
3055
3308
  <div class="prompts btn">
3056
- ${defaultPrompts.map((prompt) => x `
3309
+ ${prompts.map((prompt) => x `
3057
3310
  <div
3058
3311
  class="prompt"
3059
3312
  @click=${(e) => this.processMessage(e, prompt)}
@@ -3120,8 +3373,8 @@ var ProvidersShopGptSdk = (function () {
3120
3373
  <span class="context-type-value"> ${profileType} </span>
3121
3374
  </div>
3122
3375
  ${userDetails
3123
- ? x `<div class="context user-details">${userDetails}</div>`
3124
- : T}
3376
+ ? x ` <div class="context user-details">${userDetails}</div>`
3377
+ : E}
3125
3378
  </div>
3126
3379
  <div>
3127
3380
  <div class="context">
@@ -3129,10 +3382,10 @@ var ProvidersShopGptSdk = (function () {
3129
3382
  <span class="context-type-value">${visitationType}</span>
3130
3383
  </div>
3131
3384
  ${devContext.productHandle
3132
- ? x `<div class="context product-handle">
3385
+ ? x ` <div class="context product-handle">
3133
3386
  ${devContext.productHandle}
3134
3387
  </div>`
3135
- : T}
3388
+ : E}
3136
3389
  </div>
3137
3390
  </div>
3138
3391
  `;
@@ -3157,10 +3410,10 @@ var ProvidersShopGptSdk = (function () {
3157
3410
  </tooltip-component>
3158
3411
  <tooltip-component
3159
3412
  .position=${'bottom-right'}
3160
- .text=${'Your Search History'}
3413
+ .text=${'Search History'}
3161
3414
  >
3162
3415
  <button
3163
- class=${e$2({
3416
+ class=${e$1({
3164
3417
  btn: true,
3165
3418
  'btn-icon': true,
3166
3419
  'threads-btn': true,
@@ -3228,15 +3481,31 @@ var ProvidersShopGptSdk = (function () {
3228
3481
  }
3229
3482
  renderChatThreads() {
3230
3483
  if (!this.chatThreads || !this.showChatThreads) {
3231
- return T;
3484
+ return E;
3232
3485
  }
3233
- return x `<div id="modal-chat-threads">
3486
+ return x ` <div id="modal-chat-threads">
3234
3487
  <div class="chat-threads">
3235
- <h2>Your Search History</h2>
3488
+ <div class="title-wrapper">
3489
+ <h2>Search History</h2>
3490
+ ${this.chatThreads.size
3491
+ ? x `<div
3492
+ class="trash-icon"
3493
+ @click=${() => {
3494
+ if (this.isTyping) {
3495
+ return;
3496
+ }
3497
+ this.deleteAllThreads = true;
3498
+ this.showChatThreads = false;
3499
+ }}
3500
+ >
3501
+ ${trashIcon}
3502
+ </div>`
3503
+ : E}
3504
+ </div>
3236
3505
  <div class="thread-titles-wrapper">
3237
3506
  ${o$1(this.chatThreads.values(), (thread) => x `
3238
3507
  <div
3239
- class=${e$2({
3508
+ class=${e$1({
3240
3509
  'thread-title': true,
3241
3510
  disabled: this.isTyping,
3242
3511
  })}
@@ -3276,10 +3545,17 @@ var ProvidersShopGptSdk = (function () {
3276
3545
  </div>`;
3277
3546
  }
3278
3547
  render() {
3548
+ if (this.merchantImage) {
3549
+ // set the merchant image as a css variable
3550
+ this.style.setProperty('--shopgpt-merchant-img-url', `url('${this.merchantImage}')`);
3551
+ }
3552
+ else {
3553
+ this.style.removeProperty('--shopgpt-merchant-img-url');
3554
+ }
3279
3555
  return x `
3280
3556
  <div class="chat-header">${this.contextButton()}</div>
3281
3557
  <div
3282
- class=${e$2({
3558
+ class=${e$1({
3283
3559
  'chatbot-section': true,
3284
3560
  'modal-view': this.viewType === 'modal',
3285
3561
  })}
@@ -3293,7 +3569,7 @@ var ProvidersShopGptSdk = (function () {
3293
3569
  placeholder="Type your search here..."
3294
3570
  />
3295
3571
  <button
3296
- class=${e$2({
3572
+ class=${e$1({
3297
3573
  btn: true,
3298
3574
  modal: this.viewType === 'modal',
3299
3575
  })}
@@ -3310,96 +3586,128 @@ var ProvidersShopGptSdk = (function () {
3310
3586
  .defaultProfiles=${this.profiles}
3311
3587
  ></personalize-dialog>
3312
3588
  ${this.renderChatThreads()}
3313
- ${this.deleteThreadId
3589
+ ${this.deleteThreadId || this.deleteAllThreads
3314
3590
  ? x `
3315
3591
  <confirm-dialog
3316
3592
  @accept=${this.handleThreadDelete}
3317
- @decline=${() => (this.deleteThreadId = '')}
3593
+ @decline=${() => {
3594
+ this.deleteThreadId = '';
3595
+ this.deleteAllThreads = false;
3596
+ }}
3318
3597
  >
3319
- <h2 slot="title">Delete Thread?</h2>
3598
+ <h2 slot="title">
3599
+ ${this.deleteAllThreads
3600
+ ? 'Delete Entire Chat History?'
3601
+ : 'Delete Chat?'}
3602
+ </h2>
3320
3603
  <p slot="content">
3321
3604
  This action cannot be undone. Are you sure you want to delete
3322
- <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
3605
+ ${this.deleteAllThreads
3606
+ ? ' the entire chat history'
3607
+ : x `<b
3608
+ >"${this.chatThreads.get(this.deleteThreadId)
3609
+ .title}"</b
3610
+ >`}?
3323
3611
  </p>
3324
3612
  </confirm-dialog>
3325
3613
  `
3326
- : T}
3614
+ : E}
3327
3615
  `;
3328
3616
  }
3329
- };
3617
+ }
3330
3618
  ChatSection.styles = [chatSectionStyles];
3331
3619
  __decorate([
3332
- n$1({ type: Object }),
3620
+ n({ type: String }),
3621
+ __metadata("design:type", Object)
3622
+ ], ChatSection.prototype, "merchantImage", void 0);
3623
+ __decorate([
3624
+ n({ type: String }),
3625
+ __metadata("design:type", Object)
3626
+ ], ChatSection.prototype, "brandName", void 0);
3627
+ __decorate([
3628
+ n({ type: String }),
3629
+ __metadata("design:type", Object)
3630
+ ], ChatSection.prototype, "prompts", void 0);
3631
+ __decorate([
3632
+ n({ type: Boolean }),
3633
+ __metadata("design:type", Boolean)
3634
+ ], ChatSection.prototype, "isLoadingThreads", void 0);
3635
+ __decorate([
3636
+ n({ type: Object }),
3333
3637
  __metadata("design:type", Map)
3334
3638
  ], ChatSection.prototype, "chatThreads", void 0);
3335
3639
  __decorate([
3336
- r$1(),
3640
+ r(),
3337
3641
  __metadata("design:type", String)
3338
3642
  ], ChatSection.prototype, "deleteThreadId", void 0);
3339
3643
  __decorate([
3340
- n$1({ type: Boolean }),
3341
- __metadata("design:type", Boolean)
3644
+ n({ type: Boolean }),
3645
+ __metadata("design:type", Object)
3342
3646
  ], ChatSection.prototype, "showChatThreads", void 0);
3343
3647
  __decorate([
3344
- n$1({ type: Boolean }),
3648
+ n({ type: Boolean }),
3345
3649
  __metadata("design:type", Boolean)
3346
3650
  ], ChatSection.prototype, "isLoadingHistory", void 0);
3347
3651
  __decorate([
3348
- n$1({ type: Boolean }),
3652
+ n({ type: Boolean }),
3349
3653
  __metadata("design:type", Object)
3350
3654
  ], ChatSection.prototype, "devMode", void 0);
3351
3655
  __decorate([
3352
- n$1({ type: Boolean }),
3656
+ n({ type: Boolean }),
3353
3657
  __metadata("design:type", Boolean)
3354
3658
  ], ChatSection.prototype, "isTyping", void 0);
3355
3659
  __decorate([
3356
- n$1({ type: Boolean }),
3660
+ n({ type: Boolean }),
3357
3661
  __metadata("design:type", Boolean)
3358
3662
  ], ChatSection.prototype, "isFailed", void 0);
3359
3663
  __decorate([
3360
- n$1({ type: Array }),
3664
+ n({ type: Array }),
3361
3665
  __metadata("design:type", Array)
3362
3666
  ], ChatSection.prototype, "messages", void 0);
3363
3667
  __decorate([
3364
- n$1({ type: Array }),
3668
+ n({ type: Array }),
3365
3669
  __metadata("design:type", Array)
3366
3670
  ], ChatSection.prototype, "profiles", void 0);
3367
3671
  __decorate([
3368
- n$1({ type: Array }),
3672
+ n({ type: Array }),
3369
3673
  __metadata("design:type", Array)
3370
3674
  ], ChatSection.prototype, "productHandles", void 0);
3371
3675
  __decorate([
3372
- n$1({ type: Object }),
3676
+ n({ type: Object }),
3373
3677
  __metadata("design:type", Object)
3374
3678
  ], ChatSection.prototype, "thread", void 0);
3375
3679
  __decorate([
3376
- n$1({ type: Object }),
3680
+ n({ type: Object }),
3377
3681
  __metadata("design:type", Object)
3378
3682
  ], ChatSection.prototype, "siteCurrency", void 0);
3379
3683
  __decorate([
3380
- e$4('.context-container'),
3684
+ r(),
3685
+ __metadata("design:type", Object)
3686
+ ], ChatSection.prototype, "deleteAllThreads", void 0);
3687
+ __decorate([
3688
+ e$3('.context-container'),
3381
3689
  __metadata("design:type", Object)
3382
3690
  ], ChatSection.prototype, "contextContainerElement", void 0);
3383
3691
  __decorate([
3384
- e$4('.chat-window'),
3692
+ e$3('.chat-window'),
3385
3693
  __metadata("design:type", Object)
3386
3694
  ], ChatSection.prototype, "chatWindowElement", void 0);
3387
3695
  __decorate([
3388
- e$4('personalize-dialog'),
3696
+ e$3('personalize-dialog'),
3389
3697
  __metadata("design:type", Object)
3390
3698
  ], ChatSection.prototype, "personalizeDialogElement", void 0);
3391
3699
  __decorate([
3392
- n$1({ type: String }),
3393
- __metadata("design:type", String)
3700
+ n({ type: String }),
3701
+ __metadata("design:type", Object)
3394
3702
  ], ChatSection.prototype, "userQuery", void 0);
3395
- ChatSection = __decorate([
3396
- t$2('chat-section')
3397
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3398
- ], ChatSection);
3703
+ if (!customElements.get('chat-section')) {
3704
+ customElements.define('chat-section', ChatSection);
3705
+ }
3399
3706
 
3400
3707
  const DIALOG_DELAY = 1000;
3708
+ const LATEST_THREAD_LOAD_DAYS = 14;
3401
3709
  const normalizePath = (path) => path.replace(/\/$/, '');
3402
- let ShopGPT = class ShopGPT extends s {
3710
+ class ShopGPT extends r$2 {
3403
3711
  constructor() {
3404
3712
  super(...arguments);
3405
3713
  this.modalState = 'close';
@@ -3411,6 +3719,18 @@ var ProvidersShopGptSdk = (function () {
3411
3719
  this.products = [];
3412
3720
  this.messages = [];
3413
3721
  this.chatThreads = new Map();
3722
+ this.loadData = async () => {
3723
+ if (!this.shopGPTAPI) {
3724
+ return;
3725
+ }
3726
+ await this.loadChatThreads();
3727
+ this.selectLatestThread();
3728
+ };
3729
+ this.onPopState = () => {
3730
+ var _a;
3731
+ this.modalState = 'close';
3732
+ (_a = this.shopGPTDialog) === null || _a === void 0 ? void 0 : _a.close();
3733
+ };
3414
3734
  this.submitQuery = (message) => {
3415
3735
  if (!message) {
3416
3736
  return;
@@ -3434,14 +3754,14 @@ var ProvidersShopGptSdk = (function () {
3434
3754
  }
3435
3755
  this.init();
3436
3756
  }
3757
+ disconnectedCallback() {
3758
+ window.removeEventListener('edgetag-initialized', this.loadData);
3759
+ window.removeEventListener('popstate', this.onPopState);
3760
+ super.disconnectedCallback();
3761
+ }
3437
3762
  init() {
3438
- window.addEventListener('edgetag-initialized', async () => {
3439
- if (!this.shopGPTAPI) {
3440
- return;
3441
- }
3442
- await this.loadChatThreads();
3443
- await this.loadInitialQuery();
3444
- });
3763
+ window.addEventListener('edgetag-initialized', this.loadData);
3764
+ window.addEventListener('popstate', this.onPopState);
3445
3765
  if (!this.uiMode || this.uiMode === 'overlay') {
3446
3766
  delay(DIALOG_DELAY).then(() => {
3447
3767
  var _a;
@@ -3456,6 +3776,19 @@ var ProvidersShopGptSdk = (function () {
3456
3776
  });
3457
3777
  }
3458
3778
  }
3779
+ setChatTitle(threadId, title) {
3780
+ if (!title || !threadId) {
3781
+ return;
3782
+ }
3783
+ const thread = this.chatThreads.get(threadId);
3784
+ if (thread) {
3785
+ this.chatThreads.set(thread.threadId, {
3786
+ ...thread,
3787
+ title,
3788
+ });
3789
+ this.chatThreads = new Map(this.chatThreads);
3790
+ }
3791
+ }
3459
3792
  async loadInitialQuery() {
3460
3793
  var _a;
3461
3794
  if (!this.selectedThreadId) {
@@ -3468,14 +3801,26 @@ var ProvidersShopGptSdk = (function () {
3468
3801
  if (!thread) {
3469
3802
  return;
3470
3803
  }
3804
+ const searchParam = new URLSearchParams(window.location.search);
3805
+ const fromAd = searchParam.get('shopGPT') === '1';
3471
3806
  const productHandle = this.devMode
3472
3807
  ? (_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.productHandle
3473
- : this.storeAPI.getCurrentProductHandle();
3808
+ : fromAd
3809
+ ? this.storeAPI.getCurrentProductHandle()
3810
+ : undefined;
3474
3811
  try {
3475
3812
  this.isTyping = true;
3476
3813
  const reply = await this.shopGPTAPI.processQuery('', thread.threadId, productHandle);
3814
+ if (reply.chatTitle) {
3815
+ this.setChatTitle(this.selectedThreadId, reply.chatTitle);
3816
+ }
3477
3817
  this.messages = [
3478
- { sender: 'bot', message: reply.message, products: reply.products },
3818
+ {
3819
+ sender: 'bot',
3820
+ message: reply.message,
3821
+ products: reply.products,
3822
+ welcomePrompts: reply.welcomePrompts,
3823
+ },
3479
3824
  ...this.messages,
3480
3825
  ];
3481
3826
  this.products = reply.products || [];
@@ -3501,8 +3846,24 @@ var ProvidersShopGptSdk = (function () {
3501
3846
  this.isLoadingThreads = false;
3502
3847
  }
3503
3848
  }
3849
+ selectLatestThread() {
3850
+ const cutoffTime = Date.now() - LATEST_THREAD_LOAD_DAYS * 24 * 60 * 60 * 1000;
3851
+ // If the latest thread is not older than cutoff we should load the thread
3852
+ let latestThread;
3853
+ for (const thread of this.chatThreads.values()) {
3854
+ if (thread.createdAt >= cutoffTime &&
3855
+ (!latestThread || latestThread.createdAt < thread.createdAt)) {
3856
+ latestThread = thread;
3857
+ }
3858
+ }
3859
+ if (latestThread) {
3860
+ this.setSelectedThreadId(latestThread.threadId);
3861
+ }
3862
+ else if (!this.devMode) {
3863
+ this.createChatThread({ title: '' }, true);
3864
+ }
3865
+ }
3504
3866
  async loadHistory(threadId) {
3505
- var _a, _b, _c;
3506
3867
  try {
3507
3868
  if (!threadId) {
3508
3869
  this.messages = [];
@@ -3511,22 +3872,24 @@ var ProvidersShopGptSdk = (function () {
3511
3872
  }
3512
3873
  this.isLoadingHistory = true;
3513
3874
  const data = await this.shopGPTAPI.fetchChatHistory(threadId);
3875
+ let latestAvailableProducts = [];
3514
3876
  this.messages = data.map((message) => {
3515
3877
  var _a;
3516
- return ({
3878
+ const products = (_a = message.products) === null || _a === void 0 ? void 0 : _a.map((product) => ({
3879
+ ...product,
3880
+ quantity: 1,
3881
+ }));
3882
+ if (!latestAvailableProducts.length && (products === null || products === void 0 ? void 0 : products.length)) {
3883
+ latestAvailableProducts = products;
3884
+ }
3885
+ return {
3517
3886
  message: message.message,
3518
3887
  sender: message.sender,
3519
- products: (_a = message.products) === null || _a === void 0 ? void 0 : _a.map((product) => ({
3520
- ...product,
3521
- quantity: 1,
3522
- })),
3523
- });
3888
+ products,
3889
+ welcomePrompts: message.welcomePrompts,
3890
+ };
3524
3891
  });
3525
- this.products =
3526
- (_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) => ({
3527
- ...product,
3528
- quantity: 1,
3529
- }))) !== null && _c !== void 0 ? _c : [];
3892
+ this.products = latestAvailableProducts;
3530
3893
  }
3531
3894
  catch (e) {
3532
3895
  logger.error(e);
@@ -3567,6 +3930,21 @@ var ProvidersShopGptSdk = (function () {
3567
3930
  this.shopGPTAPI
3568
3931
  .deleteSingleThread(threadId)
3569
3932
  .then(this.loadChatThreads.bind(this))
3933
+ .then(() => {
3934
+ if (this.selectedThreadId === threadId) {
3935
+ this.setSelectedThreadId('');
3936
+ }
3937
+ })
3938
+ .catch(logger.error)
3939
+ .finally(() => (this.isLoadingThreads = false));
3940
+ }
3941
+ handleAllThreadsDelete(e) {
3942
+ e.stopPropagation();
3943
+ this.isLoadingThreads = true;
3944
+ this.shopGPTAPI
3945
+ .deleteAllThreads()
3946
+ .then(this.loadChatThreads.bind(this))
3947
+ .then(() => this.setSelectedThreadId(''))
3570
3948
  .catch(logger.error)
3571
3949
  .finally(() => (this.isLoadingThreads = false));
3572
3950
  }
@@ -3585,21 +3963,20 @@ var ProvidersShopGptSdk = (function () {
3585
3963
  return;
3586
3964
  }
3587
3965
  if (reply.chatTitle) {
3588
- // Alternatively we can fetch the chatThreads once again which would cost another network request
3589
- const thread = this.chatThreads.get(this.selectedThreadId);
3590
- if (thread) {
3591
- this.chatThreads.set(thread.threadId, {
3592
- ...thread,
3593
- title: reply.chatTitle,
3594
- });
3595
- this.chatThreads = new Map(this.chatThreads);
3596
- }
3966
+ this.setChatTitle(this.selectedThreadId, reply.chatTitle);
3597
3967
  }
3598
3968
  this.messages = [
3599
- { sender: 'bot', message: reply.message, products: reply.products },
3969
+ {
3970
+ sender: 'bot',
3971
+ message: reply.message,
3972
+ products: reply.products,
3973
+ welcomePrompts: reply.welcomePrompts,
3974
+ },
3600
3975
  ...this.messages,
3601
3976
  ];
3602
- this.products = reply.products || [];
3977
+ if (reply.products && reply.products.length > 0) {
3978
+ this.products = reply.products;
3979
+ }
3603
3980
  }
3604
3981
  catch (err) {
3605
3982
  logger.error(err);
@@ -3624,6 +4001,7 @@ var ProvidersShopGptSdk = (function () {
3624
4001
  <dialog
3625
4002
  id="shop-gpt-dialog-overlay"
3626
4003
  @delete-thread=${this.handleThreadDelete}
4004
+ @delete-all-threads=${this.handleAllThreadsDelete}
3627
4005
  >
3628
4006
  <div class="mobile-version">
3629
4007
  Please switch to the desktop version for the best experience.
@@ -3638,11 +4016,15 @@ var ProvidersShopGptSdk = (function () {
3638
4016
  .merchantUrl=${this.merchantUrl}
3639
4017
  ></chat-threads>
3640
4018
  <products-section
4019
+ .merchantImage=${this.merchantImage}
3641
4020
  .products=${this.products}
3642
4021
  .isLoadingHistory=${this.isLoadingHistory}
3643
4022
  .siteCurrency=${this.getSiteCurrency()}
4023
+ .isLoadingThreads=${this.isLoadingThreads}
3644
4024
  ></products-section>
3645
4025
  <chat-section
4026
+ .prompts=${this.quickPrompts}
4027
+ .brandName=${this.brandName}
3646
4028
  .isFailed=${this.isFailed}
3647
4029
  .isLoadingHistory=${this.isLoadingHistory}
3648
4030
  .isTyping=${this.isTyping}
@@ -3655,6 +4037,7 @@ var ProvidersShopGptSdk = (function () {
3655
4037
  .productHandles=${this.productHandles}
3656
4038
  .profiles=${this.profiles}
3657
4039
  .viewType=${'overlay'}
4040
+ .isLoadingThreads=${this.isLoadingThreads}
3658
4041
  ></chat-section>
3659
4042
  </div>
3660
4043
  </dialog>
@@ -3666,7 +4049,7 @@ var ProvidersShopGptSdk = (function () {
3666
4049
  this.modalState = 'close';
3667
4050
  };
3668
4051
  if (this.modalState === 'close') {
3669
- return x `<div class="chatbot-widget">
4052
+ return x ` <div class="chatbot-widget">
3670
4053
  <button
3671
4054
  @click=${(e) => {
3672
4055
  e.preventDefault();
@@ -3675,11 +4058,18 @@ var ProvidersShopGptSdk = (function () {
3675
4058
  >
3676
4059
  ${chatIcon}
3677
4060
  </button>
4061
+ <div class="chatbot-hover-text">What are you looking for today?</div>
3678
4062
  </div>`;
3679
4063
  }
3680
4064
  return x `
3681
- <div id="shop-gpt-modal" @delete-thread=${this.handleThreadDelete}>
4065
+ <div
4066
+ id="shop-gpt-modal"
4067
+ @delete-thread=${this.handleThreadDelete}
4068
+ @delete-all-threads=${this.handleAllThreadsDelete}
4069
+ >
3682
4070
  <chat-section
4071
+ .prompts=${this.quickPrompts}
4072
+ .brandName=${this.brandName}
3683
4073
  .isFailed=${this.isFailed}
3684
4074
  .isLoadingHistory=${this.isLoadingHistory}
3685
4075
  .isTyping=${this.isTyping}
@@ -3695,55 +4085,57 @@ var ProvidersShopGptSdk = (function () {
3695
4085
  .closeModal=${closeModal}
3696
4086
  .setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
3697
4087
  .chatThreads=${this.chatThreads}
4088
+ .isLoadingThreads=${this.isLoadingThreads}
4089
+ .merchantImage=${this.merchantImage}
3698
4090
  ></chat-section>
3699
4091
  </div>
3700
4092
  `;
3701
4093
  }
3702
- };
4094
+ }
3703
4095
  ShopGPT.styles = [shopGPTStyles];
3704
4096
  __decorate([
3705
- e$4('#shop-gpt-dialog-overlay'),
4097
+ e$3('#shop-gpt-dialog-overlay'),
3706
4098
  __metadata("design:type", Object)
3707
4099
  ], ShopGPT.prototype, "shopGPTDialog", void 0);
3708
4100
  __decorate([
3709
- n$1({ type: String }),
4101
+ n({ type: String }),
3710
4102
  __metadata("design:type", String)
3711
4103
  ], ShopGPT.prototype, "modalState", void 0);
3712
4104
  __decorate([
3713
- n$1({ type: Boolean }),
3714
- __metadata("design:type", Boolean)
4105
+ n({ type: Boolean }),
4106
+ __metadata("design:type", Object)
3715
4107
  ], ShopGPT.prototype, "isLoadingHistory", void 0);
3716
4108
  __decorate([
3717
- n$1({ type: Boolean }),
3718
- __metadata("design:type", Boolean)
4109
+ n({ type: Boolean }),
4110
+ __metadata("design:type", Object)
3719
4111
  ], ShopGPT.prototype, "isLoadingThreads", void 0);
3720
4112
  __decorate([
3721
- n$1({ type: Boolean }),
3722
- __metadata("design:type", Boolean)
4113
+ n({ type: Boolean }),
4114
+ __metadata("design:type", Object)
3723
4115
  ], ShopGPT.prototype, "isTyping", void 0);
3724
4116
  __decorate([
3725
- n$1({ type: Boolean }),
3726
- __metadata("design:type", Boolean)
4117
+ n({ type: Boolean }),
4118
+ __metadata("design:type", Object)
3727
4119
  ], ShopGPT.prototype, "isFailed", void 0);
3728
4120
  __decorate([
3729
- n$1({ type: String }),
3730
- __metadata("design:type", String)
4121
+ n({ type: String }),
4122
+ __metadata("design:type", Object)
3731
4123
  ], ShopGPT.prototype, "selectedThreadId", void 0);
3732
4124
  __decorate([
3733
- n$1({ type: Array }),
4125
+ n({ type: Array }),
3734
4126
  __metadata("design:type", Array)
3735
4127
  ], ShopGPT.prototype, "products", void 0);
3736
4128
  __decorate([
3737
- n$1({ type: Array }),
4129
+ n({ type: Array }),
3738
4130
  __metadata("design:type", Array)
3739
4131
  ], ShopGPT.prototype, "messages", void 0);
3740
4132
  __decorate([
3741
- n$1({ type: Object }),
4133
+ n({ type: Object }),
3742
4134
  __metadata("design:type", Map)
3743
4135
  ], ShopGPT.prototype, "chatThreads", void 0);
3744
- ShopGPT = __decorate([
3745
- t$2('shop-gpt')
3746
- ], ShopGPT);
4136
+ if (!customElements.get('shop-gpt')) {
4137
+ customElements.define('shop-gpt', ShopGPT);
4138
+ }
3747
4139
 
3748
4140
  var _a, _b;
3749
4141
  var _c;
@@ -3764,8 +4156,19 @@ var ProvidersShopGptSdk = (function () {
3764
4156
  shopGPT.productHandles = params.productHandles;
3765
4157
  shopGPT.uiMode = params.uiMode;
3766
4158
  shopGPT.path = params.path;
4159
+ shopGPT.brandName = params.brandName;
4160
+ shopGPT.quickPrompts = params.quickPrompts;
4161
+ shopGPT.merchantImage = params.merchantImage;
3767
4162
  document.body.append(shopGPT);
3768
4163
  },
4164
+ destroy() {
4165
+ if (!shopGPT) {
4166
+ return;
4167
+ }
4168
+ shopGPT.remove();
4169
+ shopGPT = undefined;
4170
+ delete window[registryKey];
4171
+ },
3769
4172
  });
3770
4173
  }
3771
4174