@blotoutio/providers-shop-gpt-sdk 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +629 -141
- package/index.js +629 -141
- package/index.mjs +629 -141
- package/package.json +1 -1
package/index.cjs.js
CHANGED
@@ -429,11 +429,34 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
|
|
429
429
|
const data = (await response.json());
|
430
430
|
return data;
|
431
431
|
};
|
432
|
+
const deleteSingleThread = async (threadId) => {
|
433
|
+
const response = await fetchImpl(getURL('/thread'), {
|
434
|
+
method: 'DELETE',
|
435
|
+
headers: getHeaders(),
|
436
|
+
credentials: 'include',
|
437
|
+
body: JSON.stringify({ threadId }),
|
438
|
+
});
|
439
|
+
if (!response.ok) {
|
440
|
+
throw new Error(`Failed to delete chat threads - ${response.status}: ${await response.text()}`);
|
441
|
+
}
|
442
|
+
};
|
443
|
+
const deleteAllThreads = async () => {
|
444
|
+
const response = await fetchImpl(getURL('/delete-threads'), {
|
445
|
+
method: 'DELETE',
|
446
|
+
headers: getHeaders(),
|
447
|
+
credentials: 'include',
|
448
|
+
});
|
449
|
+
if (!response.ok) {
|
450
|
+
throw new Error(`Failed to delete all chat threads - ${response.status}: ${await response.text()}`);
|
451
|
+
}
|
452
|
+
};
|
432
453
|
return {
|
433
454
|
processQuery,
|
434
455
|
fetchChatHistory,
|
435
456
|
fetchChatThreads,
|
436
457
|
createChatThread,
|
458
|
+
deleteSingleThread,
|
459
|
+
deleteAllThreads,
|
437
460
|
};
|
438
461
|
};
|
439
462
|
|
@@ -550,52 +573,58 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
550
573
|
* Copyright 2019 Google LLC
|
551
574
|
* SPDX-License-Identifier: BSD-3-Clause
|
552
575
|
*/
|
553
|
-
const t$
|
576
|
+
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;
|
554
577
|
|
555
578
|
/**
|
556
579
|
* @license
|
557
580
|
* Copyright 2017 Google LLC
|
558
581
|
* SPDX-License-Identifier: BSD-3-Clause
|
559
|
-
*/const{is:i$2,defineProperty:e$
|
582
|
+
*/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");
|
560
583
|
|
561
584
|
/**
|
562
585
|
* @license
|
563
586
|
* Copyright 2017 Google LLC
|
564
587
|
* SPDX-License-Identifier: BSD-3-Clause
|
565
588
|
*/
|
566
|
-
const t$
|
589
|
+
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};
|
567
590
|
|
568
591
|
/**
|
569
592
|
* @license
|
570
593
|
* Copyright 2017 Google LLC
|
571
594
|
* SPDX-License-Identifier: BSD-3-Clause
|
572
|
-
*/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$
|
595
|
+
*/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");
|
573
596
|
|
574
597
|
/**
|
575
598
|
* @license
|
576
599
|
* Copyright 2017 Google LLC
|
577
600
|
* SPDX-License-Identifier: BSD-3-Clause
|
578
601
|
*/
|
579
|
-
const t$
|
602
|
+
const t$2=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
580
603
|
|
581
604
|
/**
|
582
605
|
* @license
|
583
606
|
* Copyright 2017 Google LLC
|
584
607
|
* SPDX-License-Identifier: BSD-3-Clause
|
585
|
-
*/const o$
|
608
|
+
*/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)}
|
609
|
+
|
610
|
+
/**
|
611
|
+
* @license
|
612
|
+
* Copyright 2017 Google LLC
|
613
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
614
|
+
*/function r$1(r){return n$1({...r,state:!0,attribute:!1})}
|
586
615
|
|
587
616
|
/**
|
588
617
|
* @license
|
589
618
|
* Copyright 2017 Google LLC
|
590
619
|
* SPDX-License-Identifier: BSD-3-Clause
|
591
620
|
*/
|
592
|
-
const e$
|
621
|
+
const e$5=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
593
622
|
|
594
623
|
/**
|
595
624
|
* @license
|
596
625
|
* Copyright 2017 Google LLC
|
597
626
|
* SPDX-License-Identifier: BSD-3-Clause
|
598
|
-
*/function e$
|
627
|
+
*/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)}})}}
|
599
628
|
|
600
629
|
const scrollBarStyles = i$3 `
|
601
630
|
::-webkit-scrollbar {
|
@@ -728,20 +757,20 @@ const shopGPTStyles = i$3 `
|
|
728
757
|
* Copyright 2017 Google LLC
|
729
758
|
* SPDX-License-Identifier: BSD-3-Clause
|
730
759
|
*/
|
731
|
-
const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$
|
760
|
+
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)}}
|
732
761
|
|
733
762
|
/**
|
734
763
|
* @license
|
735
764
|
* Copyright 2018 Google LLC
|
736
765
|
* SPDX-License-Identifier: BSD-3-Clause
|
737
|
-
*/const e=e$
|
766
|
+
*/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}});
|
738
767
|
|
739
768
|
/**
|
740
769
|
* @license
|
741
770
|
* Copyright 2021 Google LLC
|
742
771
|
* SPDX-License-Identifier: BSD-3-Clause
|
743
772
|
*/
|
744
|
-
function*o(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++);}}
|
773
|
+
function*o$1(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++);}}
|
745
774
|
|
746
775
|
const sendFilledIcon = b `
|
747
776
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
@@ -755,6 +784,9 @@ const sendFilledIcon = b `
|
|
755
784
|
</defs>
|
756
785
|
</svg>
|
757
786
|
`;
|
787
|
+
const trashIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
788
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.75 1.125H11.25V2.25H6.75V1.125ZM2.25 3.375V4.5H3.375V15.75C3.375 16.0484 3.49353 16.3345 3.7045 16.5455C3.91548 16.7565 4.20163 16.875 4.5 16.875H13.5C13.7984 16.875 14.0845 16.7565 14.2955 16.5455C14.5065 16.3345 14.625 16.0484 14.625 15.75V4.5H15.75V3.375H2.25ZM4.5 15.75V4.5H13.5V15.75H4.5ZM6.75 6.75H7.875V13.5H6.75V6.75ZM10.125 6.75H11.25V13.5H10.125V6.75Z" fill="#A3B2C6"/>
|
789
|
+
</svg>`;
|
758
790
|
const chatIcon = b `<svg focusable="false" preserveAspectRatio="xMidYMid meet" fill="currentColor" width="16" height="16" viewBox="0 0 32 32" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M16 19a6.9908 6.9908 0 01-5.833-3.1287l1.666-1.1074a5.0007 5.0007 0 008.334 0l1.666 1.1074A6.9908 6.9908 0 0116 19zM20 8a2 2 0 102 2A1.9806 1.9806 0 0020 8zM12 8a2 2 0 102 2A1.9806 1.9806 0 0012 8z"></path><path d="M17.7358,30,16,29l4-7h6a1.9966,1.9966,0,0,0,2-2V6a1.9966,1.9966,0,0,0-2-2H6A1.9966,1.9966,0,0,0,4,6V20a1.9966,1.9966,0,0,0,2,2h9v2H6a3.9993,3.9993,0,0,1-4-4V6A3.9988,3.9988,0,0,1,6,2H26a3.9988,3.9988,0,0,1,4,4V20a3.9993,3.9993,0,0,1-4,4H21.1646Z"></path></svg>`;
|
759
791
|
const botIcon = b `
|
760
792
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="18" viewBox="0 0 12 18" fill="none">
|
@@ -895,6 +927,37 @@ const chatThreadsStyles = i$3 `
|
|
895
927
|
flex: 1;
|
896
928
|
overflow-y: auto;
|
897
929
|
overflow-x: hidden;
|
930
|
+
|
931
|
+
.thread-wrapper {
|
932
|
+
display: flex;
|
933
|
+
justify-content: space-between;
|
934
|
+
align-items: center;
|
935
|
+
|
936
|
+
.trash-icon {
|
937
|
+
display: none;
|
938
|
+
padding: 2px;
|
939
|
+
cursor: pointer;
|
940
|
+
|
941
|
+
&:hover {
|
942
|
+
border-radius: 5px;
|
943
|
+
background: #dc3545;
|
944
|
+
|
945
|
+
path {
|
946
|
+
fill: white;
|
947
|
+
}
|
948
|
+
}
|
949
|
+
}
|
950
|
+
|
951
|
+
&:hover {
|
952
|
+
background: #f1f4f880;
|
953
|
+
|
954
|
+
.trash-icon {
|
955
|
+
display: flex;
|
956
|
+
justify-content: center;
|
957
|
+
align-items: center;
|
958
|
+
}
|
959
|
+
}
|
960
|
+
}
|
898
961
|
}
|
899
962
|
|
900
963
|
.thread-title {
|
@@ -904,12 +967,12 @@ const chatThreadsStyles = i$3 `
|
|
904
967
|
cursor: pointer;
|
905
968
|
}
|
906
969
|
|
907
|
-
.thread-
|
970
|
+
.thread-wrapper.active {
|
908
971
|
border-radius: 5px;
|
909
972
|
background: #f1f4f8;
|
910
973
|
}
|
911
974
|
|
912
|
-
.thread-
|
975
|
+
.thread-wrapper.disabled {
|
913
976
|
cursor: not-allowed;
|
914
977
|
}
|
915
978
|
}
|
@@ -972,13 +1035,31 @@ LoadSpinner.styles = [
|
|
972
1035
|
`,
|
973
1036
|
];
|
974
1037
|
LoadSpinner = __decorate([
|
975
|
-
t$
|
1038
|
+
t$2('load-spinner')
|
976
1039
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
977
1040
|
], LoadSpinner);
|
978
1041
|
|
979
1042
|
let ChatThreads =
|
980
1043
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
981
1044
|
class ChatThreads extends s {
|
1045
|
+
getDomain() {
|
1046
|
+
var _a;
|
1047
|
+
if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
|
1048
|
+
return this.merchantUrl;
|
1049
|
+
}
|
1050
|
+
return `https://${this.merchantUrl}`;
|
1051
|
+
}
|
1052
|
+
handleThreadDelete() {
|
1053
|
+
if (!this.deleteThreadId) {
|
1054
|
+
return;
|
1055
|
+
}
|
1056
|
+
this.dispatchEvent(new CustomEvent('delete-thread', {
|
1057
|
+
detail: { threadId: this.deleteThreadId },
|
1058
|
+
composed: true,
|
1059
|
+
bubbles: true,
|
1060
|
+
}));
|
1061
|
+
this.deleteThreadId = '';
|
1062
|
+
}
|
982
1063
|
renderChatThreads() {
|
983
1064
|
if (this.isLoading) {
|
984
1065
|
return x `<div class="history">
|
@@ -991,21 +1072,36 @@ class ChatThreads extends s {
|
|
991
1072
|
<p class="title">History</p>
|
992
1073
|
${this.chatThreads.size
|
993
1074
|
? x `<div class="threads">
|
994
|
-
${o(this.chatThreads.values(), (thread) => x `
|
1075
|
+
${o$1(this.chatThreads.values(), (thread) => x `
|
995
1076
|
<div
|
996
|
-
class=${e({
|
997
|
-
'thread-
|
1077
|
+
class=${e$2({
|
1078
|
+
'thread-wrapper': true,
|
998
1079
|
active: this.selectedThreadId === thread.threadId,
|
999
1080
|
disabled: this.isTyping,
|
1000
1081
|
})}
|
1001
|
-
|
1082
|
+
>
|
1083
|
+
<div
|
1084
|
+
class="thread-title"
|
1085
|
+
@click=${async () => {
|
1002
1086
|
if (this.isLoading || this.isTyping) {
|
1003
1087
|
return;
|
1004
1088
|
}
|
1005
1089
|
await this.setSelectedThreadId(thread.threadId);
|
1006
1090
|
}}
|
1007
|
-
|
1008
|
-
|
1091
|
+
>
|
1092
|
+
${thread.title || 'New Search'}
|
1093
|
+
</div>
|
1094
|
+
<div
|
1095
|
+
class="trash-icon"
|
1096
|
+
@click=${() => {
|
1097
|
+
if (this.isLoading || this.isTyping) {
|
1098
|
+
return;
|
1099
|
+
}
|
1100
|
+
this.deleteThreadId = thread.threadId;
|
1101
|
+
}}
|
1102
|
+
>
|
1103
|
+
${trashIcon}
|
1104
|
+
</div>
|
1009
1105
|
</div>
|
1010
1106
|
`)}
|
1011
1107
|
</div>`
|
@@ -1013,13 +1109,6 @@ class ChatThreads extends s {
|
|
1013
1109
|
</div>
|
1014
1110
|
`;
|
1015
1111
|
}
|
1016
|
-
getDomain() {
|
1017
|
-
var _a;
|
1018
|
-
if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
|
1019
|
-
return this.merchantUrl;
|
1020
|
-
}
|
1021
|
-
return `https://${this.merchantUrl}`;
|
1022
|
-
}
|
1023
1112
|
render() {
|
1024
1113
|
return x `
|
1025
1114
|
<div class="shop-gpt-icon">${shopGPTIcon}</div>
|
@@ -1039,32 +1128,50 @@ class ChatThreads extends s {
|
|
1039
1128
|
</a>
|
1040
1129
|
</div>`
|
1041
1130
|
: T}
|
1131
|
+
${this.deleteThreadId
|
1132
|
+
? x `
|
1133
|
+
<confirm-dialog
|
1134
|
+
@accept=${this.handleThreadDelete}
|
1135
|
+
@decline=${() => (this.deleteThreadId = '')}
|
1136
|
+
>
|
1137
|
+
<h2 slot="title">Delete Thread?</h2>
|
1138
|
+
<p slot="content">
|
1139
|
+
This action cannot be undone. Are you sure you want to delete
|
1140
|
+
<b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
|
1141
|
+
</p>
|
1142
|
+
</confirm-dialog>
|
1143
|
+
`
|
1144
|
+
: T}
|
1042
1145
|
`;
|
1043
1146
|
}
|
1044
1147
|
};
|
1045
1148
|
ChatThreads.styles = [chatThreadsStyles];
|
1046
1149
|
__decorate([
|
1047
|
-
n({ type: Object }),
|
1150
|
+
n$1({ type: Object }),
|
1048
1151
|
__metadata("design:type", Map)
|
1049
1152
|
], ChatThreads.prototype, "chatThreads", void 0);
|
1050
1153
|
__decorate([
|
1051
|
-
n({ type: String }),
|
1154
|
+
n$1({ type: String }),
|
1052
1155
|
__metadata("design:type", Object)
|
1053
1156
|
], ChatThreads.prototype, "merchantUrl", void 0);
|
1054
1157
|
__decorate([
|
1055
|
-
n({ type: Boolean }),
|
1158
|
+
n$1({ type: Boolean }),
|
1056
1159
|
__metadata("design:type", Boolean)
|
1057
1160
|
], ChatThreads.prototype, "isLoading", void 0);
|
1058
1161
|
__decorate([
|
1059
|
-
n({ type: Boolean }),
|
1162
|
+
n$1({ type: Boolean }),
|
1060
1163
|
__metadata("design:type", Boolean)
|
1061
1164
|
], ChatThreads.prototype, "isTyping", void 0);
|
1062
1165
|
__decorate([
|
1063
|
-
n({ type: String }),
|
1166
|
+
n$1({ type: String }),
|
1064
1167
|
__metadata("design:type", String)
|
1065
1168
|
], ChatThreads.prototype, "selectedThreadId", void 0);
|
1169
|
+
__decorate([
|
1170
|
+
r$1(),
|
1171
|
+
__metadata("design:type", String)
|
1172
|
+
], ChatThreads.prototype, "deleteThreadId", void 0);
|
1066
1173
|
ChatThreads = __decorate([
|
1067
|
-
t$
|
1174
|
+
t$2('chat-threads')
|
1068
1175
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1069
1176
|
], ChatThreads);
|
1070
1177
|
|
@@ -1266,6 +1373,14 @@ class ProductItem extends s {
|
|
1266
1373
|
}
|
1267
1374
|
(_a = open(url, '_blank')) === null || _a === void 0 ? void 0 : _a.focus();
|
1268
1375
|
}
|
1376
|
+
renderVariantTitles() {
|
1377
|
+
if (!this.product.hasVariantsThatRequiresComponents) {
|
1378
|
+
return T;
|
1379
|
+
}
|
1380
|
+
return this.product.variants[0].selectedOptions.map((option) => x `
|
1381
|
+
<p class="product-variation-details">${option.name}: ${option.value}</p>
|
1382
|
+
`);
|
1383
|
+
}
|
1269
1384
|
render() {
|
1270
1385
|
return x `
|
1271
1386
|
<div class="product">
|
@@ -1282,11 +1397,7 @@ class ProductItem extends s {
|
|
1282
1397
|
>
|
1283
1398
|
${this.product.title}
|
1284
1399
|
</p>
|
1285
|
-
${this.
|
1286
|
-
<p class="product-variation-details">
|
1287
|
-
${option.name}: ${option.value}
|
1288
|
-
</p>
|
1289
|
-
`)}
|
1400
|
+
${this.renderVariantTitles()}
|
1290
1401
|
<div class="prices">
|
1291
1402
|
${this.product.variants[0].comparedAtPrice &&
|
1292
1403
|
this.product.variants[0].comparedAtPrice !==
|
@@ -1310,15 +1421,15 @@ class ProductItem extends s {
|
|
1310
1421
|
};
|
1311
1422
|
ProductItem.styles = [productItemStyles];
|
1312
1423
|
__decorate([
|
1313
|
-
n({ type: Object }),
|
1424
|
+
n$1({ type: Object }),
|
1314
1425
|
__metadata("design:type", Object)
|
1315
1426
|
], ProductItem.prototype, "product", void 0);
|
1316
1427
|
__decorate([
|
1317
|
-
n({ type: Object }),
|
1428
|
+
n$1({ type: Object }),
|
1318
1429
|
__metadata("design:type", Object)
|
1319
1430
|
], ProductItem.prototype, "siteCurrency", void 0);
|
1320
1431
|
ProductItem = __decorate([
|
1321
|
-
t$
|
1432
|
+
t$2('product-item')
|
1322
1433
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1323
1434
|
], ProductItem);
|
1324
1435
|
|
@@ -1413,9 +1524,9 @@ class ProductsList extends s {
|
|
1413
1524
|
return x `
|
1414
1525
|
<div class="products-wrapper">
|
1415
1526
|
<div class="products" @scroll=${this.updateButtonsState}>
|
1416
|
-
${o(this.products, (product) => x `
|
1527
|
+
${o$1(this.products, (product) => x `
|
1417
1528
|
<div
|
1418
|
-
class=${e({
|
1529
|
+
class=${e$2({
|
1419
1530
|
'product-container': true,
|
1420
1531
|
modal: this.viewType === 'modal',
|
1421
1532
|
})}
|
@@ -1439,27 +1550,27 @@ class ProductsList extends s {
|
|
1439
1550
|
};
|
1440
1551
|
ProductsList.styles = [productsListStyles];
|
1441
1552
|
__decorate([
|
1442
|
-
n({ type: Array }),
|
1553
|
+
n$1({ type: Array }),
|
1443
1554
|
__metadata("design:type", Array)
|
1444
1555
|
], ProductsList.prototype, "products", void 0);
|
1445
1556
|
__decorate([
|
1446
|
-
n({ type: Object }),
|
1557
|
+
n$1({ type: Object }),
|
1447
1558
|
__metadata("design:type", Object)
|
1448
1559
|
], ProductsList.prototype, "siteCurrency", void 0);
|
1449
1560
|
__decorate([
|
1450
|
-
e$
|
1561
|
+
e$4('.left-btn'),
|
1451
1562
|
__metadata("design:type", Object)
|
1452
1563
|
], ProductsList.prototype, "leftBtnEle", void 0);
|
1453
1564
|
__decorate([
|
1454
|
-
e$
|
1565
|
+
e$4('.right-btn'),
|
1455
1566
|
__metadata("design:type", Object)
|
1456
1567
|
], ProductsList.prototype, "rightBtnEle", void 0);
|
1457
1568
|
__decorate([
|
1458
|
-
e$
|
1569
|
+
e$4('.products'),
|
1459
1570
|
__metadata("design:type", Object)
|
1460
1571
|
], ProductsList.prototype, "productsEle", void 0);
|
1461
1572
|
ProductsList = __decorate([
|
1462
|
-
t$
|
1573
|
+
t$2('products-list')
|
1463
1574
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1464
1575
|
], ProductsList);
|
1465
1576
|
|
@@ -1507,31 +1618,31 @@ class ProductsSection extends s {
|
|
1507
1618
|
};
|
1508
1619
|
ProductsSection.styles = [productsSectionStyles];
|
1509
1620
|
__decorate([
|
1510
|
-
n({ type: Array }),
|
1621
|
+
n$1({ type: Array }),
|
1511
1622
|
__metadata("design:type", Array)
|
1512
1623
|
], ProductsSection.prototype, "products", void 0);
|
1513
1624
|
__decorate([
|
1514
|
-
n({ type: Boolean }),
|
1625
|
+
n$1({ type: Boolean }),
|
1515
1626
|
__metadata("design:type", Boolean)
|
1516
1627
|
], ProductsSection.prototype, "isLoadingHistory", void 0);
|
1517
1628
|
__decorate([
|
1518
|
-
n({ type: Object }),
|
1629
|
+
n$1({ type: Object }),
|
1519
1630
|
__metadata("design:type", Object)
|
1520
1631
|
], ProductsSection.prototype, "siteCurrency", void 0);
|
1521
1632
|
__decorate([
|
1522
|
-
e$
|
1633
|
+
e$4('.left-btn'),
|
1523
1634
|
__metadata("design:type", Object)
|
1524
1635
|
], ProductsSection.prototype, "leftBtnEle", void 0);
|
1525
1636
|
__decorate([
|
1526
|
-
e$
|
1637
|
+
e$4('.right-btn'),
|
1527
1638
|
__metadata("design:type", Object)
|
1528
1639
|
], ProductsSection.prototype, "rightBtnEle", void 0);
|
1529
1640
|
__decorate([
|
1530
|
-
e$
|
1641
|
+
e$4('.products'),
|
1531
1642
|
__metadata("design:type", Object)
|
1532
1643
|
], ProductsSection.prototype, "productsEle", void 0);
|
1533
1644
|
ProductsSection = __decorate([
|
1534
|
-
t$
|
1645
|
+
t$2('products-section')
|
1535
1646
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1536
1647
|
], ProductsSection);
|
1537
1648
|
|
@@ -1572,6 +1683,9 @@ const chatSectionStyles = i$3 `
|
|
1572
1683
|
font-weight: 600;
|
1573
1684
|
line-height: 21px;
|
1574
1685
|
text-transform: capitalize;
|
1686
|
+
white-space: nowrap;
|
1687
|
+
overflow: hidden;
|
1688
|
+
text-overflow: ellipsis;
|
1575
1689
|
}
|
1576
1690
|
|
1577
1691
|
.btn-context {
|
@@ -1710,6 +1824,10 @@ const chatSectionStyles = i$3 `
|
|
1710
1824
|
gap: 28px;
|
1711
1825
|
padding-bottom: 10px;
|
1712
1826
|
margin-bottom: -10px;
|
1827
|
+
|
1828
|
+
.message:last-child {
|
1829
|
+
margin-top: 10px;
|
1830
|
+
}
|
1713
1831
|
}
|
1714
1832
|
|
1715
1833
|
.message {
|
@@ -1927,15 +2045,28 @@ const chatSectionStyles = i$3 `
|
|
1927
2045
|
}
|
1928
2046
|
|
1929
2047
|
.thread-title {
|
2048
|
+
display: flex;
|
2049
|
+
justify-content: space-between;
|
1930
2050
|
padding: 10px 16px;
|
1931
2051
|
color: #4e647f;
|
1932
|
-
font-size: 14px;
|
1933
|
-
font-weight: 400;
|
1934
|
-
line-height: 20px;
|
1935
2052
|
cursor: pointer;
|
1936
2053
|
|
2054
|
+
p {
|
2055
|
+
font-size: 14px;
|
2056
|
+
font-weight: 400;
|
2057
|
+
line-height: 20px;
|
2058
|
+
}
|
2059
|
+
|
2060
|
+
.trash-icon {
|
2061
|
+
display: none;
|
2062
|
+
}
|
2063
|
+
|
1937
2064
|
&:hover {
|
1938
2065
|
background: #f1f4f8;
|
2066
|
+
|
2067
|
+
.trash-icon {
|
2068
|
+
display: flex;
|
2069
|
+
}
|
1939
2070
|
}
|
1940
2071
|
}
|
1941
2072
|
|
@@ -1944,6 +2075,23 @@ const chatSectionStyles = i$3 `
|
|
1944
2075
|
}
|
1945
2076
|
}
|
1946
2077
|
|
2078
|
+
.trash-icon {
|
2079
|
+
display: flex;
|
2080
|
+
justify-content: center;
|
2081
|
+
align-items: center;
|
2082
|
+
padding: 2px;
|
2083
|
+
cursor: pointer;
|
2084
|
+
|
2085
|
+
&:hover {
|
2086
|
+
border-radius: 5px;
|
2087
|
+
background: #dc3545;
|
2088
|
+
|
2089
|
+
path {
|
2090
|
+
fill: white;
|
2091
|
+
}
|
2092
|
+
}
|
2093
|
+
}
|
2094
|
+
|
1947
2095
|
.chat-threads-background {
|
1948
2096
|
position: absolute;
|
1949
2097
|
top: 78px;
|
@@ -1962,6 +2110,16 @@ const capitalizeEachWord = (str) => {
|
|
1962
2110
|
return str === null || str === void 0 ? void 0 : str.replace(/^\w/, (char) => char.toUpperCase());
|
1963
2111
|
};
|
1964
2112
|
|
2113
|
+
const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2114
|
+
<path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
|
2115
|
+
</svg>`;
|
2116
|
+
const timerBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2117
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.16652 20.7304C7.89323 21.8842 9.9233 22.5 12 22.5C14.7848 22.5 17.4555 21.3938 19.4246 19.4246C21.3938 17.4555 22.5 14.7848 22.5 12C22.5 9.9233 21.8842 7.89323 20.7304 6.16652C19.5767 4.4398 17.9368 3.09399 16.0182 2.29927C14.0996 1.50455 11.9884 1.29661 9.95156 1.70176C7.91476 2.1069 6.04383 3.10693 4.57538 4.57538C3.10693 6.04383 2.1069 7.91476 1.70176 9.95156C1.29661 11.9884 1.50455 14.0996 2.29927 16.0182C3.09399 17.9368 4.4398 19.5767 6.16652 20.7304ZM6.99987 4.51678C8.47992 3.52785 10.22 3 12 3C14.387 3 16.6761 3.94822 18.364 5.63604C20.0518 7.32387 21 9.61306 21 12C21 13.78 20.4722 15.5201 19.4832 17.0001C18.4943 18.4802 17.0887 19.6337 15.4442 20.3149C13.7996 20.9961 11.99 21.1743 10.2442 20.8271C8.49836 20.4798 6.89472 19.6226 5.63604 18.364C4.37737 17.1053 3.5202 15.5016 3.17294 13.7558C2.82567 12.01 3.0039 10.2004 3.68509 8.55585C4.36628 6.91132 5.51983 5.50571 6.99987 4.51678ZM11.25 12.3075L15.4425 16.5L16.5 15.4425L12.75 11.685V5.25H11.25V12.3075Z" fill="white"/>
|
2118
|
+
</svg>`;
|
2119
|
+
const crossBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2120
|
+
<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"/>
|
2121
|
+
</svg>`;
|
2122
|
+
|
1965
2123
|
const personalizeDialogStyles = i$3 `
|
1966
2124
|
:host {
|
1967
2125
|
font-family: 'Inter', sans-serif;
|
@@ -2448,63 +2606,318 @@ class PersonalizeDialog extends s {
|
|
2448
2606
|
};
|
2449
2607
|
PersonalizeDialog.styles = [personalizeDialogStyles];
|
2450
2608
|
__decorate([
|
2451
|
-
e$
|
2609
|
+
e$4('dialog'),
|
2452
2610
|
__metadata("design:type", HTMLDialogElement)
|
2453
2611
|
], PersonalizeDialog.prototype, "dialogModal", void 0);
|
2454
2612
|
__decorate([
|
2455
|
-
e$
|
2613
|
+
e$4('.dropdown-list'),
|
2456
2614
|
__metadata("design:type", HTMLUListElement)
|
2457
2615
|
], PersonalizeDialog.prototype, "dropdownList", void 0);
|
2458
2616
|
__decorate([
|
2459
|
-
e$
|
2617
|
+
e$4('.dropdown-trigger'),
|
2460
2618
|
__metadata("design:type", HTMLDivElement)
|
2461
2619
|
], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
|
2462
2620
|
__decorate([
|
2463
|
-
n({ type: Array }),
|
2621
|
+
n$1({ type: Array }),
|
2464
2622
|
__metadata("design:type", Array)
|
2465
2623
|
], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
|
2466
2624
|
__decorate([
|
2467
|
-
n({ type: Array }),
|
2625
|
+
n$1({ type: Array }),
|
2468
2626
|
__metadata("design:type", Array)
|
2469
2627
|
], PersonalizeDialog.prototype, "defaultProfiles", void 0);
|
2470
2628
|
__decorate([
|
2471
|
-
n({ type: Boolean }),
|
2629
|
+
n$1({ type: Boolean }),
|
2472
2630
|
__metadata("design:type", Boolean)
|
2473
2631
|
], PersonalizeDialog.prototype, "isLoading", void 0);
|
2474
2632
|
__decorate([
|
2475
|
-
n({ type: String }),
|
2633
|
+
n$1({ type: String }),
|
2476
2634
|
__metadata("design:type", Object)
|
2477
2635
|
], PersonalizeDialog.prototype, "state", void 0);
|
2478
2636
|
__decorate([
|
2479
|
-
n({ type: String }),
|
2637
|
+
n$1({ type: String }),
|
2480
2638
|
__metadata("design:type", Object)
|
2481
2639
|
], PersonalizeDialog.prototype, "profileType", void 0);
|
2482
2640
|
__decorate([
|
2483
|
-
n({ type: String }),
|
2641
|
+
n$1({ type: String }),
|
2484
2642
|
__metadata("design:type", Object)
|
2485
2643
|
], PersonalizeDialog.prototype, "selectedProfile", void 0);
|
2486
2644
|
__decorate([
|
2487
|
-
n({ type: String }),
|
2645
|
+
n$1({ type: String }),
|
2488
2646
|
__metadata("design:type", Object)
|
2489
2647
|
], PersonalizeDialog.prototype, "visitorType", void 0);
|
2490
2648
|
__decorate([
|
2491
|
-
n({ type: String }),
|
2649
|
+
n$1({ type: String }),
|
2492
2650
|
__metadata("design:type", Object)
|
2493
2651
|
], PersonalizeDialog.prototype, "productHandle", void 0);
|
2494
2652
|
PersonalizeDialog = __decorate([
|
2495
|
-
t$
|
2653
|
+
t$2('personalize-dialog')
|
2496
2654
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2497
2655
|
], PersonalizeDialog);
|
2498
2656
|
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2657
|
+
/**
|
2658
|
+
* @license
|
2659
|
+
* Copyright 2017 Google LLC
|
2660
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
2661
|
+
*/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);
|
2662
|
+
|
2663
|
+
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,""").replace(/</g,"<").replace(/>/g,">")}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,"")}
|
2664
|
+
|
2665
|
+
let MarkdownRenderer =
|
2666
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2667
|
+
class MarkdownRenderer extends s {
|
2668
|
+
render() {
|
2669
|
+
const slotContent = this.innerHTML.trim();
|
2670
|
+
const parsedContent = t(slotContent);
|
2671
|
+
return o(parsedContent);
|
2672
|
+
}
|
2673
|
+
};
|
2674
|
+
MarkdownRenderer.styles = i$3 `
|
2675
|
+
:host {
|
2676
|
+
font-family: 'Inter', sans-serif;
|
2677
|
+
font-size: 16px;
|
2678
|
+
font-weight: 400;
|
2679
|
+
|
2680
|
+
p {
|
2681
|
+
margin: 0;
|
2682
|
+
}
|
2683
|
+
}
|
2684
|
+
`;
|
2685
|
+
MarkdownRenderer = __decorate([
|
2686
|
+
t$2('markdown-renderer')
|
2687
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2688
|
+
], MarkdownRenderer);
|
2689
|
+
|
2690
|
+
let TooltipComponent =
|
2691
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2692
|
+
class TooltipComponent extends s {
|
2693
|
+
constructor() {
|
2694
|
+
super(...arguments);
|
2695
|
+
this.position = 'bottom-left';
|
2696
|
+
this.text = '';
|
2697
|
+
}
|
2698
|
+
render() {
|
2699
|
+
return x `
|
2700
|
+
<slot></slot>
|
2701
|
+
<div class="tooltip ${this.position}">${this.text}</div>
|
2702
|
+
`;
|
2703
|
+
}
|
2704
|
+
};
|
2705
|
+
TooltipComponent.styles = [
|
2706
|
+
i$3 `
|
2707
|
+
:host {
|
2708
|
+
position: relative;
|
2709
|
+
display: inline-block;
|
2710
|
+
}
|
2711
|
+
.tooltip {
|
2712
|
+
position: absolute;
|
2713
|
+
color: #172a41;
|
2714
|
+
padding: 4px 8px;
|
2715
|
+
border-radius: 4px;
|
2716
|
+
white-space: nowrap;
|
2717
|
+
font-size: 12px;
|
2718
|
+
opacity: 0;
|
2719
|
+
transition: opacity 0.2s;
|
2720
|
+
pointer-events: none;
|
2721
|
+
|
2722
|
+
border-radius: 5px;
|
2723
|
+
background: #ffcc81;
|
2724
|
+
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
2725
|
+
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
2726
|
+
|
2727
|
+
font-style: normal;
|
2728
|
+
font-weight: 400;
|
2729
|
+
line-height: 150%;
|
2730
|
+
}
|
2731
|
+
:host(:hover) .tooltip {
|
2732
|
+
opacity: 1;
|
2733
|
+
}
|
2734
|
+
.top-center {
|
2735
|
+
bottom: calc(100% + 2px);
|
2736
|
+
left: 50%;
|
2737
|
+
transform: translateX(-50%);
|
2738
|
+
}
|
2739
|
+
.top-left {
|
2740
|
+
bottom: calc(100% + 2px);
|
2741
|
+
left: 0;
|
2742
|
+
}
|
2743
|
+
.top-right {
|
2744
|
+
bottom: calc(100% + 2px);
|
2745
|
+
right: 0;
|
2746
|
+
}
|
2747
|
+
.bottom-center {
|
2748
|
+
top: calc(100% + 2px);
|
2749
|
+
left: 50%;
|
2750
|
+
transform: translateX(-50%);
|
2751
|
+
}
|
2752
|
+
.bottom-left {
|
2753
|
+
top: calc(100% + 2px);
|
2754
|
+
left: 0;
|
2755
|
+
}
|
2756
|
+
.bottom-right {
|
2757
|
+
top: calc(100% + 2px);
|
2758
|
+
right: 0;
|
2759
|
+
}
|
2760
|
+
.left-center {
|
2761
|
+
right: calc(100% + 2px);
|
2762
|
+
top: 50%;
|
2763
|
+
transform: translateY(-50%);
|
2764
|
+
}
|
2765
|
+
.left-top {
|
2766
|
+
right: calc(100% + 2px);
|
2767
|
+
top: 0;
|
2768
|
+
}
|
2769
|
+
.left-bottom {
|
2770
|
+
right: calc(100% + 2px);
|
2771
|
+
bottom: 0;
|
2772
|
+
}
|
2773
|
+
.right-center {
|
2774
|
+
left: calc(100% + 2px);
|
2775
|
+
top: 50%;
|
2776
|
+
transform: translateY(-50%);
|
2777
|
+
}
|
2778
|
+
.right-top {
|
2779
|
+
left: calc(100% + 2px);
|
2780
|
+
top: 0;
|
2781
|
+
}
|
2782
|
+
.right-bottom {
|
2783
|
+
left: calc(100% + 2px);
|
2784
|
+
bottom: 0;
|
2785
|
+
}
|
2786
|
+
`,
|
2787
|
+
];
|
2788
|
+
__decorate([
|
2789
|
+
n$1({ type: String }),
|
2790
|
+
__metadata("design:type", String)
|
2791
|
+
], TooltipComponent.prototype, "position", void 0);
|
2792
|
+
__decorate([
|
2793
|
+
n$1({ type: String }),
|
2794
|
+
__metadata("design:type", String)
|
2795
|
+
], TooltipComponent.prototype, "text", void 0);
|
2796
|
+
TooltipComponent = __decorate([
|
2797
|
+
t$2('tooltip-component')
|
2798
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2799
|
+
], TooltipComponent);
|
2800
|
+
|
2801
|
+
const confirmDialogStyles = i$3 `
|
2802
|
+
:host {
|
2803
|
+
font-family: 'Inter', sans-serif;
|
2804
|
+
font-size: 16px;
|
2805
|
+
font-weight: 400;
|
2806
|
+
|
2807
|
+
display: flex;
|
2808
|
+
position: absolute;
|
2809
|
+
top: 0;
|
2810
|
+
left: 0;
|
2811
|
+
width: 100%;
|
2812
|
+
height: 100%;
|
2813
|
+
background: #00000050;
|
2814
|
+
}
|
2815
|
+
|
2816
|
+
.modal {
|
2817
|
+
width: 75%;
|
2818
|
+
max-width: 350px;
|
2819
|
+
background: #fff;
|
2820
|
+
padding: 16px;
|
2821
|
+
margin: auto;
|
2822
|
+
|
2823
|
+
border-radius: 10px;
|
2824
|
+
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
2825
|
+
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
2826
|
+
|
2827
|
+
z-index: 2000;
|
2828
|
+
}
|
2829
|
+
|
2830
|
+
::slotted([slot='title']) {
|
2831
|
+
margin-bottom: 8px !important;
|
2832
|
+
color: #172a41;
|
2833
|
+
font-size: 18px;
|
2834
|
+
font-weight: 700;
|
2835
|
+
line-height: 150%;
|
2836
|
+
}
|
2837
|
+
|
2838
|
+
::slotted([slot='content']) {
|
2839
|
+
color: #4e647f;
|
2840
|
+
line-height: 150%;
|
2841
|
+
}
|
2842
|
+
|
2843
|
+
.button-wrapper {
|
2844
|
+
margin-top: 12px;
|
2845
|
+
display: flex;
|
2846
|
+
gap: 12px;
|
2847
|
+
|
2848
|
+
.btn {
|
2849
|
+
justify-self: stretch;
|
2850
|
+
padding: 10px;
|
2851
|
+
cursor: pointer;
|
2852
|
+
text-align: center;
|
2853
|
+
width: 100%;
|
2854
|
+
border: 0;
|
2855
|
+
color: #fff;
|
2856
|
+
line-height: 150%;
|
2857
|
+
text-transform: capitalize;
|
2858
|
+
}
|
2859
|
+
|
2860
|
+
.accept-btn {
|
2861
|
+
border-radius: 5px;
|
2862
|
+
background: #dc3545;
|
2863
|
+
|
2864
|
+
&:hover {
|
2865
|
+
background: rgb(176, 62, 25);
|
2866
|
+
}
|
2867
|
+
}
|
2868
|
+
|
2869
|
+
.decline-btn {
|
2870
|
+
border-radius: 5px;
|
2871
|
+
background: #4e647f;
|
2872
|
+
|
2873
|
+
&:hover {
|
2874
|
+
background: rgb(57, 77, 102);
|
2875
|
+
}
|
2876
|
+
}
|
2877
|
+
}
|
2878
|
+
`;
|
2879
|
+
|
2880
|
+
let ConfirmDialog =
|
2881
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2882
|
+
class ConfirmDialog extends s {
|
2883
|
+
onAcceptClick(e) {
|
2884
|
+
e.preventDefault();
|
2885
|
+
this.dispatchEvent(new CustomEvent('accept', {
|
2886
|
+
composed: true,
|
2887
|
+
}));
|
2888
|
+
}
|
2889
|
+
onCancelClick(e) {
|
2890
|
+
e.preventDefault();
|
2891
|
+
this.dispatchEvent(new CustomEvent('decline', {
|
2892
|
+
composed: true,
|
2893
|
+
}));
|
2894
|
+
}
|
2895
|
+
render() {
|
2896
|
+
return x `
|
2897
|
+
<div class="modal">
|
2898
|
+
<slot name="title"></slot>
|
2899
|
+
<slot name="content"></slot>
|
2900
|
+
<div class="button-wrapper">
|
2901
|
+
<slot name="accept-btn">
|
2902
|
+
<button class="btn accept-btn" @click=${this.onAcceptClick}>
|
2903
|
+
Delete
|
2904
|
+
</button>
|
2905
|
+
</slot>
|
2906
|
+
<slot name="decline-btn">
|
2907
|
+
<button class="btn decline-btn" @click=${this.onCancelClick}>
|
2908
|
+
Cancel
|
2909
|
+
</button>
|
2910
|
+
</slot>
|
2911
|
+
</div>
|
2912
|
+
</div>
|
2913
|
+
`;
|
2914
|
+
}
|
2915
|
+
};
|
2916
|
+
ConfirmDialog.styles = [confirmDialogStyles];
|
2917
|
+
ConfirmDialog = __decorate([
|
2918
|
+
t$2('confirm-dialog')
|
2919
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2920
|
+
], ConfirmDialog);
|
2508
2921
|
|
2509
2922
|
let ChatSection =
|
2510
2923
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
@@ -2535,6 +2948,17 @@ class ChatSection extends s {
|
|
2535
2948
|
this.userQuery = '';
|
2536
2949
|
await this.processMessage(e, message);
|
2537
2950
|
}
|
2951
|
+
handleThreadDelete() {
|
2952
|
+
if (!this.deleteThreadId) {
|
2953
|
+
return;
|
2954
|
+
}
|
2955
|
+
this.dispatchEvent(new CustomEvent('delete-thread', {
|
2956
|
+
detail: { threadId: this.deleteThreadId },
|
2957
|
+
composed: true,
|
2958
|
+
bubbles: true,
|
2959
|
+
}));
|
2960
|
+
this.deleteThreadId = '';
|
2961
|
+
}
|
2538
2962
|
typingIndicator() {
|
2539
2963
|
return x `<div class="typing-dots">
|
2540
2964
|
<div class="dot"></div>
|
@@ -2551,7 +2975,9 @@ class ChatSection extends s {
|
|
2551
2975
|
<div class="bot-icon">${botIcon}</div>
|
2552
2976
|
</div>
|
2553
2977
|
<div>
|
2554
|
-
${message.message
|
2978
|
+
${message.message
|
2979
|
+
? x `<markdown-renderer>${message.message}</markdown-renderer>`
|
2980
|
+
: T}
|
2555
2981
|
${this.viewType !== 'modal' && ((_a = message.products) === null || _a === void 0 ? void 0 : _a[0])
|
2556
2982
|
? x `
|
2557
2983
|
<span class="line"></span>
|
@@ -2716,37 +3142,49 @@ class ChatSection extends s {
|
|
2716
3142
|
<div>${botIcon}</div>
|
2717
3143
|
<h2>${((_a = this.thread) === null || _a === void 0 ? void 0 : _a.title) || 'New Search'}</h2>
|
2718
3144
|
<div class="btns-wrapper">
|
2719
|
-
<
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
3145
|
+
<tooltip-component .position=${'bottom-right'} .text=${'New Chat'}>
|
3146
|
+
<button
|
3147
|
+
class="btn btn-icon new-search-btn"
|
3148
|
+
@click=${(e) => {
|
2723
3149
|
var _a;
|
2724
|
-
|
3150
|
+
e.preventDefault();
|
3151
|
+
(_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, '');
|
2725
3152
|
}}
|
3153
|
+
>
|
3154
|
+
${plusBtn}
|
3155
|
+
</button>
|
3156
|
+
</tooltip-component>
|
3157
|
+
<tooltip-component
|
3158
|
+
.position=${'bottom-right'}
|
3159
|
+
.text=${'Your Search History'}
|
2726
3160
|
>
|
2727
|
-
|
2728
|
-
|
2729
|
-
<button
|
2730
|
-
class=${e({
|
3161
|
+
<button
|
3162
|
+
class=${e$2({
|
2731
3163
|
btn: true,
|
2732
3164
|
'btn-icon': true,
|
2733
3165
|
'threads-btn': true,
|
2734
3166
|
active: this.showChatThreads,
|
2735
3167
|
})}
|
2736
|
-
|
2737
|
-
|
3168
|
+
@click=${(e) => {
|
3169
|
+
e.preventDefault();
|
2738
3170
|
this.showChatThreads = !this.showChatThreads;
|
2739
3171
|
}}
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
3172
|
+
>
|
3173
|
+
${timerBtn}
|
3174
|
+
</button>
|
3175
|
+
</tooltip-component>
|
3176
|
+
<tooltip-component .position=${'bottom-right'} .text=${'Close Chat'}>
|
3177
|
+
<button
|
3178
|
+
class="btn btn-icon close-btn"
|
3179
|
+
@click=${(e) => {
|
3180
|
+
var _a;
|
3181
|
+
e.preventDefault();
|
3182
|
+
(_a = this.closeModal) === null || _a === void 0 ? void 0 : _a.call(this);
|
3183
|
+
}}
|
3184
|
+
>
|
3185
|
+
${crossBtn}
|
3186
|
+
</button>
|
3187
|
+
</tooltip-component>
|
2750
3188
|
</div>
|
2751
3189
|
`;
|
2752
3190
|
}
|
@@ -2795,23 +3233,38 @@ class ChatSection extends s {
|
|
2795
3233
|
<div class="chat-threads">
|
2796
3234
|
<h2>Your Search History</h2>
|
2797
3235
|
<div class="thread-titles-wrapper">
|
2798
|
-
${o(this.chatThreads.values(), (thread) => x `
|
2799
|
-
<
|
2800
|
-
class=${e({
|
3236
|
+
${o$1(this.chatThreads.values(), (thread) => x `
|
3237
|
+
<div
|
3238
|
+
class=${e$2({
|
2801
3239
|
'thread-title': true,
|
2802
3240
|
disabled: this.isTyping,
|
2803
3241
|
})}
|
2804
|
-
|
3242
|
+
>
|
3243
|
+
<p
|
3244
|
+
@click=${() => {
|
2805
3245
|
var _a;
|
2806
3246
|
if (this.isTyping) {
|
2807
3247
|
return;
|
2808
3248
|
}
|
2809
3249
|
this.showChatThreads = false;
|
2810
|
-
|
3250
|
+
(_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, thread.threadId);
|
2811
3251
|
}}
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
3252
|
+
>
|
3253
|
+
${thread.title || 'New Search'}
|
3254
|
+
</p>
|
3255
|
+
<div
|
3256
|
+
class="trash-icon"
|
3257
|
+
@click=${() => {
|
3258
|
+
if (this.isTyping) {
|
3259
|
+
return;
|
3260
|
+
}
|
3261
|
+
this.deleteThreadId = thread.threadId;
|
3262
|
+
this.showChatThreads = false;
|
3263
|
+
}}
|
3264
|
+
>
|
3265
|
+
${trashIcon}
|
3266
|
+
</div>
|
3267
|
+
</div>
|
2815
3268
|
`)}
|
2816
3269
|
</div>
|
2817
3270
|
</div>
|
@@ -2825,7 +3278,7 @@ class ChatSection extends s {
|
|
2825
3278
|
return x `
|
2826
3279
|
<div class="chat-header">${this.contextButton()}</div>
|
2827
3280
|
<div
|
2828
|
-
class=${e({
|
3281
|
+
class=${e$2({
|
2829
3282
|
'chatbot-section': true,
|
2830
3283
|
'modal-view': this.viewType === 'modal',
|
2831
3284
|
})}
|
@@ -2839,7 +3292,7 @@ class ChatSection extends s {
|
|
2839
3292
|
placeholder="Type your search here..."
|
2840
3293
|
/>
|
2841
3294
|
<button
|
2842
|
-
class=${e({
|
3295
|
+
class=${e$2({
|
2843
3296
|
btn: true,
|
2844
3297
|
modal: this.viewType === 'modal',
|
2845
3298
|
})}
|
@@ -2856,72 +3309,90 @@ class ChatSection extends s {
|
|
2856
3309
|
.defaultProfiles=${this.profiles}
|
2857
3310
|
></personalize-dialog>
|
2858
3311
|
${this.renderChatThreads()}
|
3312
|
+
${this.deleteThreadId
|
3313
|
+
? x `
|
3314
|
+
<confirm-dialog
|
3315
|
+
@accept=${this.handleThreadDelete}
|
3316
|
+
@decline=${() => (this.deleteThreadId = '')}
|
3317
|
+
>
|
3318
|
+
<h2 slot="title">Delete Thread?</h2>
|
3319
|
+
<p slot="content">
|
3320
|
+
This action cannot be undone. Are you sure you want to delete
|
3321
|
+
<b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
|
3322
|
+
</p>
|
3323
|
+
</confirm-dialog>
|
3324
|
+
`
|
3325
|
+
: T}
|
2859
3326
|
`;
|
2860
3327
|
}
|
2861
3328
|
};
|
2862
3329
|
ChatSection.styles = [chatSectionStyles];
|
2863
3330
|
__decorate([
|
2864
|
-
n({ type: Object }),
|
3331
|
+
n$1({ type: Object }),
|
2865
3332
|
__metadata("design:type", Map)
|
2866
3333
|
], ChatSection.prototype, "chatThreads", void 0);
|
2867
3334
|
__decorate([
|
2868
|
-
|
3335
|
+
r$1(),
|
3336
|
+
__metadata("design:type", String)
|
3337
|
+
], ChatSection.prototype, "deleteThreadId", void 0);
|
3338
|
+
__decorate([
|
3339
|
+
n$1({ type: Boolean }),
|
2869
3340
|
__metadata("design:type", Boolean)
|
2870
3341
|
], ChatSection.prototype, "showChatThreads", void 0);
|
2871
3342
|
__decorate([
|
2872
|
-
n({ type: Boolean }),
|
3343
|
+
n$1({ type: Boolean }),
|
2873
3344
|
__metadata("design:type", Boolean)
|
2874
3345
|
], ChatSection.prototype, "isLoadingHistory", void 0);
|
2875
3346
|
__decorate([
|
2876
|
-
n({ type: Boolean }),
|
3347
|
+
n$1({ type: Boolean }),
|
2877
3348
|
__metadata("design:type", Object)
|
2878
3349
|
], ChatSection.prototype, "devMode", void 0);
|
2879
3350
|
__decorate([
|
2880
|
-
n({ type: Boolean }),
|
3351
|
+
n$1({ type: Boolean }),
|
2881
3352
|
__metadata("design:type", Boolean)
|
2882
3353
|
], ChatSection.prototype, "isTyping", void 0);
|
2883
3354
|
__decorate([
|
2884
|
-
n({ type: Boolean }),
|
3355
|
+
n$1({ type: Boolean }),
|
2885
3356
|
__metadata("design:type", Boolean)
|
2886
3357
|
], ChatSection.prototype, "isFailed", void 0);
|
2887
3358
|
__decorate([
|
2888
|
-
n({ type: Array }),
|
3359
|
+
n$1({ type: Array }),
|
2889
3360
|
__metadata("design:type", Array)
|
2890
3361
|
], ChatSection.prototype, "messages", void 0);
|
2891
3362
|
__decorate([
|
2892
|
-
n({ type: Array }),
|
3363
|
+
n$1({ type: Array }),
|
2893
3364
|
__metadata("design:type", Array)
|
2894
3365
|
], ChatSection.prototype, "profiles", void 0);
|
2895
3366
|
__decorate([
|
2896
|
-
n({ type: Array }),
|
3367
|
+
n$1({ type: Array }),
|
2897
3368
|
__metadata("design:type", Array)
|
2898
3369
|
], ChatSection.prototype, "productHandles", void 0);
|
2899
3370
|
__decorate([
|
2900
|
-
n({ type: Object }),
|
3371
|
+
n$1({ type: Object }),
|
2901
3372
|
__metadata("design:type", Object)
|
2902
3373
|
], ChatSection.prototype, "thread", void 0);
|
2903
3374
|
__decorate([
|
2904
|
-
n({ type: Object }),
|
3375
|
+
n$1({ type: Object }),
|
2905
3376
|
__metadata("design:type", Object)
|
2906
3377
|
], ChatSection.prototype, "siteCurrency", void 0);
|
2907
3378
|
__decorate([
|
2908
|
-
e$
|
3379
|
+
e$4('.context-container'),
|
2909
3380
|
__metadata("design:type", Object)
|
2910
3381
|
], ChatSection.prototype, "contextContainerElement", void 0);
|
2911
3382
|
__decorate([
|
2912
|
-
e$
|
3383
|
+
e$4('.chat-window'),
|
2913
3384
|
__metadata("design:type", Object)
|
2914
3385
|
], ChatSection.prototype, "chatWindowElement", void 0);
|
2915
3386
|
__decorate([
|
2916
|
-
e$
|
3387
|
+
e$4('personalize-dialog'),
|
2917
3388
|
__metadata("design:type", Object)
|
2918
3389
|
], ChatSection.prototype, "personalizeDialogElement", void 0);
|
2919
3390
|
__decorate([
|
2920
|
-
n({ type: String }),
|
3391
|
+
n$1({ type: String }),
|
2921
3392
|
__metadata("design:type", String)
|
2922
3393
|
], ChatSection.prototype, "userQuery", void 0);
|
2923
3394
|
ChatSection = __decorate([
|
2924
|
-
t$
|
3395
|
+
t$2('chat-section')
|
2925
3396
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2926
3397
|
], ChatSection);
|
2927
3398
|
|
@@ -3084,6 +3555,20 @@ let ShopGPT = class ShopGPT extends s {
|
|
3084
3555
|
logger.error(e);
|
3085
3556
|
}
|
3086
3557
|
}
|
3558
|
+
handleThreadDelete(e) {
|
3559
|
+
e.stopPropagation();
|
3560
|
+
this.isLoadingThreads = true;
|
3561
|
+
const threadId = e.detail.threadId;
|
3562
|
+
if (!threadId) {
|
3563
|
+
logger.error('ThreadId is missing to delete the thread!');
|
3564
|
+
return;
|
3565
|
+
}
|
3566
|
+
this.shopGPTAPI
|
3567
|
+
.deleteSingleThread(threadId)
|
3568
|
+
.then(this.loadChatThreads.bind(this))
|
3569
|
+
.catch(logger.error)
|
3570
|
+
.finally(() => (this.isLoadingThreads = false));
|
3571
|
+
}
|
3087
3572
|
async sendMessageToServer(e, message) {
|
3088
3573
|
e.preventDefault();
|
3089
3574
|
e.stopPropagation();
|
@@ -3135,7 +3620,10 @@ let ShopGPT = class ShopGPT extends s {
|
|
3135
3620
|
overlayMode() {
|
3136
3621
|
const thread = this.chatThreads.get(this.selectedThreadId);
|
3137
3622
|
return x `
|
3138
|
-
<dialog
|
3623
|
+
<dialog
|
3624
|
+
id="shop-gpt-dialog-overlay"
|
3625
|
+
@delete-thread=${this.handleThreadDelete}
|
3626
|
+
>
|
3139
3627
|
<div class="mobile-version">
|
3140
3628
|
Please switch to the desktop version for the best experience.
|
3141
3629
|
</div>
|
@@ -3189,7 +3677,7 @@ let ShopGPT = class ShopGPT extends s {
|
|
3189
3677
|
</div>`;
|
3190
3678
|
}
|
3191
3679
|
return x `
|
3192
|
-
<div id="shop-gpt-modal">
|
3680
|
+
<div id="shop-gpt-modal" @delete-thread=${this.handleThreadDelete}>
|
3193
3681
|
<chat-section
|
3194
3682
|
.isFailed=${this.isFailed}
|
3195
3683
|
.isLoadingHistory=${this.isLoadingHistory}
|
@@ -3213,47 +3701,47 @@ let ShopGPT = class ShopGPT extends s {
|
|
3213
3701
|
};
|
3214
3702
|
ShopGPT.styles = [shopGPTStyles];
|
3215
3703
|
__decorate([
|
3216
|
-
e$
|
3704
|
+
e$4('#shop-gpt-dialog-overlay'),
|
3217
3705
|
__metadata("design:type", Object)
|
3218
3706
|
], ShopGPT.prototype, "shopGPTDialog", void 0);
|
3219
3707
|
__decorate([
|
3220
|
-
n({ type: String }),
|
3708
|
+
n$1({ type: String }),
|
3221
3709
|
__metadata("design:type", String)
|
3222
3710
|
], ShopGPT.prototype, "modalState", void 0);
|
3223
3711
|
__decorate([
|
3224
|
-
n({ type: Boolean }),
|
3712
|
+
n$1({ type: Boolean }),
|
3225
3713
|
__metadata("design:type", Boolean)
|
3226
3714
|
], ShopGPT.prototype, "isLoadingHistory", void 0);
|
3227
3715
|
__decorate([
|
3228
|
-
n({ type: Boolean }),
|
3716
|
+
n$1({ type: Boolean }),
|
3229
3717
|
__metadata("design:type", Boolean)
|
3230
3718
|
], ShopGPT.prototype, "isLoadingThreads", void 0);
|
3231
3719
|
__decorate([
|
3232
|
-
n({ type: Boolean }),
|
3720
|
+
n$1({ type: Boolean }),
|
3233
3721
|
__metadata("design:type", Boolean)
|
3234
3722
|
], ShopGPT.prototype, "isTyping", void 0);
|
3235
3723
|
__decorate([
|
3236
|
-
n({ type: Boolean }),
|
3724
|
+
n$1({ type: Boolean }),
|
3237
3725
|
__metadata("design:type", Boolean)
|
3238
3726
|
], ShopGPT.prototype, "isFailed", void 0);
|
3239
3727
|
__decorate([
|
3240
|
-
n({ type: String }),
|
3728
|
+
n$1({ type: String }),
|
3241
3729
|
__metadata("design:type", String)
|
3242
3730
|
], ShopGPT.prototype, "selectedThreadId", void 0);
|
3243
3731
|
__decorate([
|
3244
|
-
n({ type: Array }),
|
3732
|
+
n$1({ type: Array }),
|
3245
3733
|
__metadata("design:type", Array)
|
3246
3734
|
], ShopGPT.prototype, "products", void 0);
|
3247
3735
|
__decorate([
|
3248
|
-
n({ type: Array }),
|
3736
|
+
n$1({ type: Array }),
|
3249
3737
|
__metadata("design:type", Array)
|
3250
3738
|
], ShopGPT.prototype, "messages", void 0);
|
3251
3739
|
__decorate([
|
3252
|
-
n({ type: Object }),
|
3740
|
+
n$1({ type: Object }),
|
3253
3741
|
__metadata("design:type", Map)
|
3254
3742
|
], ShopGPT.prototype, "chatThreads", void 0);
|
3255
3743
|
ShopGPT = __decorate([
|
3256
|
-
t$
|
3744
|
+
t$2('shop-gpt')
|
3257
3745
|
], ShopGPT);
|
3258
3746
|
|
3259
3747
|
var _a, _b;
|