@blotoutio/providers-shop-gpt-sdk 1.1.0 → 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 +633 -143
- package/index.js +633 -143
- package/index.mjs +633 -143
- package/package.json +1 -1
package/index.mjs
CHANGED
@@ -427,11 +427,34 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
|
|
427
427
|
const data = (await response.json());
|
428
428
|
return data;
|
429
429
|
};
|
430
|
+
const deleteSingleThread = async (threadId) => {
|
431
|
+
const response = await fetchImpl(getURL('/thread'), {
|
432
|
+
method: 'DELETE',
|
433
|
+
headers: getHeaders(),
|
434
|
+
credentials: 'include',
|
435
|
+
body: JSON.stringify({ threadId }),
|
436
|
+
});
|
437
|
+
if (!response.ok) {
|
438
|
+
throw new Error(`Failed to delete chat threads - ${response.status}: ${await response.text()}`);
|
439
|
+
}
|
440
|
+
};
|
441
|
+
const deleteAllThreads = async () => {
|
442
|
+
const response = await fetchImpl(getURL('/delete-threads'), {
|
443
|
+
method: 'DELETE',
|
444
|
+
headers: getHeaders(),
|
445
|
+
credentials: 'include',
|
446
|
+
});
|
447
|
+
if (!response.ok) {
|
448
|
+
throw new Error(`Failed to delete all chat threads - ${response.status}: ${await response.text()}`);
|
449
|
+
}
|
450
|
+
};
|
430
451
|
return {
|
431
452
|
processQuery,
|
432
453
|
fetchChatHistory,
|
433
454
|
fetchChatThreads,
|
434
455
|
createChatThread,
|
456
|
+
deleteSingleThread,
|
457
|
+
deleteAllThreads,
|
435
458
|
};
|
436
459
|
};
|
437
460
|
|
@@ -548,52 +571,58 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
548
571
|
* Copyright 2019 Google LLC
|
549
572
|
* SPDX-License-Identifier: BSD-3-Clause
|
550
573
|
*/
|
551
|
-
const t$
|
574
|
+
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;
|
552
575
|
|
553
576
|
/**
|
554
577
|
* @license
|
555
578
|
* Copyright 2017 Google LLC
|
556
579
|
* SPDX-License-Identifier: BSD-3-Clause
|
557
|
-
*/const{is:i$2,defineProperty:e$
|
580
|
+
*/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");
|
558
581
|
|
559
582
|
/**
|
560
583
|
* @license
|
561
584
|
* Copyright 2017 Google LLC
|
562
585
|
* SPDX-License-Identifier: BSD-3-Clause
|
563
586
|
*/
|
564
|
-
const t$
|
587
|
+
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};
|
565
588
|
|
566
589
|
/**
|
567
590
|
* @license
|
568
591
|
* Copyright 2017 Google LLC
|
569
592
|
* SPDX-License-Identifier: BSD-3-Clause
|
570
|
-
*/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$
|
593
|
+
*/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");
|
571
594
|
|
572
595
|
/**
|
573
596
|
* @license
|
574
597
|
* Copyright 2017 Google LLC
|
575
598
|
* SPDX-License-Identifier: BSD-3-Clause
|
576
599
|
*/
|
577
|
-
const t$
|
600
|
+
const t$2=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
578
601
|
|
579
602
|
/**
|
580
603
|
* @license
|
581
604
|
* Copyright 2017 Google LLC
|
582
605
|
* SPDX-License-Identifier: BSD-3-Clause
|
583
|
-
*/const o$
|
606
|
+
*/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)}
|
607
|
+
|
608
|
+
/**
|
609
|
+
* @license
|
610
|
+
* Copyright 2017 Google LLC
|
611
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
612
|
+
*/function r$1(r){return n$1({...r,state:!0,attribute:!1})}
|
584
613
|
|
585
614
|
/**
|
586
615
|
* @license
|
587
616
|
* Copyright 2017 Google LLC
|
588
617
|
* SPDX-License-Identifier: BSD-3-Clause
|
589
618
|
*/
|
590
|
-
const e$
|
619
|
+
const e$5=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
591
620
|
|
592
621
|
/**
|
593
622
|
* @license
|
594
623
|
* Copyright 2017 Google LLC
|
595
624
|
* SPDX-License-Identifier: BSD-3-Clause
|
596
|
-
*/function e$
|
625
|
+
*/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)}})}}
|
597
626
|
|
598
627
|
const scrollBarStyles = i$3 `
|
599
628
|
::-webkit-scrollbar {
|
@@ -643,7 +672,6 @@ const shopGPTStyles = i$3 `
|
|
643
672
|
bottom: 28px;
|
644
673
|
height: 80%;
|
645
674
|
width: 35%;
|
646
|
-
min-height: 620px;
|
647
675
|
min-width: 475px;
|
648
676
|
border-radius: 10px;
|
649
677
|
overflow: hidden;
|
@@ -727,20 +755,20 @@ const shopGPTStyles = i$3 `
|
|
727
755
|
* Copyright 2017 Google LLC
|
728
756
|
* SPDX-License-Identifier: BSD-3-Clause
|
729
757
|
*/
|
730
|
-
const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$
|
758
|
+
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)}}
|
731
759
|
|
732
760
|
/**
|
733
761
|
* @license
|
734
762
|
* Copyright 2018 Google LLC
|
735
763
|
* SPDX-License-Identifier: BSD-3-Clause
|
736
|
-
*/const e=e$
|
764
|
+
*/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}});
|
737
765
|
|
738
766
|
/**
|
739
767
|
* @license
|
740
768
|
* Copyright 2021 Google LLC
|
741
769
|
* SPDX-License-Identifier: BSD-3-Clause
|
742
770
|
*/
|
743
|
-
function*o(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++);}}
|
771
|
+
function*o$1(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++);}}
|
744
772
|
|
745
773
|
const sendFilledIcon = b `
|
746
774
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
@@ -754,6 +782,9 @@ const sendFilledIcon = b `
|
|
754
782
|
</defs>
|
755
783
|
</svg>
|
756
784
|
`;
|
785
|
+
const trashIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
786
|
+
<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"/>
|
787
|
+
</svg>`;
|
757
788
|
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>`;
|
758
789
|
const botIcon = b `
|
759
790
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="18" viewBox="0 0 12 18" fill="none">
|
@@ -894,6 +925,37 @@ const chatThreadsStyles = i$3 `
|
|
894
925
|
flex: 1;
|
895
926
|
overflow-y: auto;
|
896
927
|
overflow-x: hidden;
|
928
|
+
|
929
|
+
.thread-wrapper {
|
930
|
+
display: flex;
|
931
|
+
justify-content: space-between;
|
932
|
+
align-items: center;
|
933
|
+
|
934
|
+
.trash-icon {
|
935
|
+
display: none;
|
936
|
+
padding: 2px;
|
937
|
+
cursor: pointer;
|
938
|
+
|
939
|
+
&:hover {
|
940
|
+
border-radius: 5px;
|
941
|
+
background: #dc3545;
|
942
|
+
|
943
|
+
path {
|
944
|
+
fill: white;
|
945
|
+
}
|
946
|
+
}
|
947
|
+
}
|
948
|
+
|
949
|
+
&:hover {
|
950
|
+
background: #f1f4f880;
|
951
|
+
|
952
|
+
.trash-icon {
|
953
|
+
display: flex;
|
954
|
+
justify-content: center;
|
955
|
+
align-items: center;
|
956
|
+
}
|
957
|
+
}
|
958
|
+
}
|
897
959
|
}
|
898
960
|
|
899
961
|
.thread-title {
|
@@ -903,12 +965,12 @@ const chatThreadsStyles = i$3 `
|
|
903
965
|
cursor: pointer;
|
904
966
|
}
|
905
967
|
|
906
|
-
.thread-
|
968
|
+
.thread-wrapper.active {
|
907
969
|
border-radius: 5px;
|
908
970
|
background: #f1f4f8;
|
909
971
|
}
|
910
972
|
|
911
|
-
.thread-
|
973
|
+
.thread-wrapper.disabled {
|
912
974
|
cursor: not-allowed;
|
913
975
|
}
|
914
976
|
}
|
@@ -971,13 +1033,31 @@ LoadSpinner.styles = [
|
|
971
1033
|
`,
|
972
1034
|
];
|
973
1035
|
LoadSpinner = __decorate([
|
974
|
-
t$
|
1036
|
+
t$2('load-spinner')
|
975
1037
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
976
1038
|
], LoadSpinner);
|
977
1039
|
|
978
1040
|
let ChatThreads =
|
979
1041
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
980
1042
|
class ChatThreads extends s {
|
1043
|
+
getDomain() {
|
1044
|
+
var _a;
|
1045
|
+
if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
|
1046
|
+
return this.merchantUrl;
|
1047
|
+
}
|
1048
|
+
return `https://${this.merchantUrl}`;
|
1049
|
+
}
|
1050
|
+
handleThreadDelete() {
|
1051
|
+
if (!this.deleteThreadId) {
|
1052
|
+
return;
|
1053
|
+
}
|
1054
|
+
this.dispatchEvent(new CustomEvent('delete-thread', {
|
1055
|
+
detail: { threadId: this.deleteThreadId },
|
1056
|
+
composed: true,
|
1057
|
+
bubbles: true,
|
1058
|
+
}));
|
1059
|
+
this.deleteThreadId = '';
|
1060
|
+
}
|
981
1061
|
renderChatThreads() {
|
982
1062
|
if (this.isLoading) {
|
983
1063
|
return x `<div class="history">
|
@@ -990,21 +1070,36 @@ class ChatThreads extends s {
|
|
990
1070
|
<p class="title">History</p>
|
991
1071
|
${this.chatThreads.size
|
992
1072
|
? x `<div class="threads">
|
993
|
-
${o(this.chatThreads.values(), (thread) => x `
|
1073
|
+
${o$1(this.chatThreads.values(), (thread) => x `
|
994
1074
|
<div
|
995
|
-
class=${e({
|
996
|
-
'thread-
|
1075
|
+
class=${e$2({
|
1076
|
+
'thread-wrapper': true,
|
997
1077
|
active: this.selectedThreadId === thread.threadId,
|
998
1078
|
disabled: this.isTyping,
|
999
1079
|
})}
|
1000
|
-
|
1080
|
+
>
|
1081
|
+
<div
|
1082
|
+
class="thread-title"
|
1083
|
+
@click=${async () => {
|
1001
1084
|
if (this.isLoading || this.isTyping) {
|
1002
1085
|
return;
|
1003
1086
|
}
|
1004
1087
|
await this.setSelectedThreadId(thread.threadId);
|
1005
1088
|
}}
|
1006
|
-
|
1007
|
-
|
1089
|
+
>
|
1090
|
+
${thread.title || 'New Search'}
|
1091
|
+
</div>
|
1092
|
+
<div
|
1093
|
+
class="trash-icon"
|
1094
|
+
@click=${() => {
|
1095
|
+
if (this.isLoading || this.isTyping) {
|
1096
|
+
return;
|
1097
|
+
}
|
1098
|
+
this.deleteThreadId = thread.threadId;
|
1099
|
+
}}
|
1100
|
+
>
|
1101
|
+
${trashIcon}
|
1102
|
+
</div>
|
1008
1103
|
</div>
|
1009
1104
|
`)}
|
1010
1105
|
</div>`
|
@@ -1012,13 +1107,6 @@ class ChatThreads extends s {
|
|
1012
1107
|
</div>
|
1013
1108
|
`;
|
1014
1109
|
}
|
1015
|
-
getDomain() {
|
1016
|
-
var _a;
|
1017
|
-
if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
|
1018
|
-
return this.merchantUrl;
|
1019
|
-
}
|
1020
|
-
return `https://${this.merchantUrl}`;
|
1021
|
-
}
|
1022
1110
|
render() {
|
1023
1111
|
return x `
|
1024
1112
|
<div class="shop-gpt-icon">${shopGPTIcon}</div>
|
@@ -1038,32 +1126,50 @@ class ChatThreads extends s {
|
|
1038
1126
|
</a>
|
1039
1127
|
</div>`
|
1040
1128
|
: T}
|
1129
|
+
${this.deleteThreadId
|
1130
|
+
? x `
|
1131
|
+
<confirm-dialog
|
1132
|
+
@accept=${this.handleThreadDelete}
|
1133
|
+
@decline=${() => (this.deleteThreadId = '')}
|
1134
|
+
>
|
1135
|
+
<h2 slot="title">Delete Thread?</h2>
|
1136
|
+
<p slot="content">
|
1137
|
+
This action cannot be undone. Are you sure you want to delete
|
1138
|
+
<b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
|
1139
|
+
</p>
|
1140
|
+
</confirm-dialog>
|
1141
|
+
`
|
1142
|
+
: T}
|
1041
1143
|
`;
|
1042
1144
|
}
|
1043
1145
|
};
|
1044
1146
|
ChatThreads.styles = [chatThreadsStyles];
|
1045
1147
|
__decorate([
|
1046
|
-
n({ type: Object }),
|
1148
|
+
n$1({ type: Object }),
|
1047
1149
|
__metadata("design:type", Map)
|
1048
1150
|
], ChatThreads.prototype, "chatThreads", void 0);
|
1049
1151
|
__decorate([
|
1050
|
-
n({ type: String }),
|
1152
|
+
n$1({ type: String }),
|
1051
1153
|
__metadata("design:type", Object)
|
1052
1154
|
], ChatThreads.prototype, "merchantUrl", void 0);
|
1053
1155
|
__decorate([
|
1054
|
-
n({ type: Boolean }),
|
1156
|
+
n$1({ type: Boolean }),
|
1055
1157
|
__metadata("design:type", Boolean)
|
1056
1158
|
], ChatThreads.prototype, "isLoading", void 0);
|
1057
1159
|
__decorate([
|
1058
|
-
n({ type: Boolean }),
|
1160
|
+
n$1({ type: Boolean }),
|
1059
1161
|
__metadata("design:type", Boolean)
|
1060
1162
|
], ChatThreads.prototype, "isTyping", void 0);
|
1061
1163
|
__decorate([
|
1062
|
-
n({ type: String }),
|
1164
|
+
n$1({ type: String }),
|
1063
1165
|
__metadata("design:type", String)
|
1064
1166
|
], ChatThreads.prototype, "selectedThreadId", void 0);
|
1167
|
+
__decorate([
|
1168
|
+
r$1(),
|
1169
|
+
__metadata("design:type", String)
|
1170
|
+
], ChatThreads.prototype, "deleteThreadId", void 0);
|
1065
1171
|
ChatThreads = __decorate([
|
1066
|
-
t$
|
1172
|
+
t$2('chat-threads')
|
1067
1173
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1068
1174
|
], ChatThreads);
|
1069
1175
|
|
@@ -1265,6 +1371,14 @@ class ProductItem extends s {
|
|
1265
1371
|
}
|
1266
1372
|
(_a = open(url, '_blank')) === null || _a === void 0 ? void 0 : _a.focus();
|
1267
1373
|
}
|
1374
|
+
renderVariantTitles() {
|
1375
|
+
if (!this.product.hasVariantsThatRequiresComponents) {
|
1376
|
+
return T;
|
1377
|
+
}
|
1378
|
+
return this.product.variants[0].selectedOptions.map((option) => x `
|
1379
|
+
<p class="product-variation-details">${option.name}: ${option.value}</p>
|
1380
|
+
`);
|
1381
|
+
}
|
1268
1382
|
render() {
|
1269
1383
|
return x `
|
1270
1384
|
<div class="product">
|
@@ -1281,11 +1395,7 @@ class ProductItem extends s {
|
|
1281
1395
|
>
|
1282
1396
|
${this.product.title}
|
1283
1397
|
</p>
|
1284
|
-
${this.
|
1285
|
-
<p class="product-variation-details">
|
1286
|
-
${option.name}: ${option.value}
|
1287
|
-
</p>
|
1288
|
-
`)}
|
1398
|
+
${this.renderVariantTitles()}
|
1289
1399
|
<div class="prices">
|
1290
1400
|
${this.product.variants[0].comparedAtPrice &&
|
1291
1401
|
this.product.variants[0].comparedAtPrice !==
|
@@ -1309,15 +1419,15 @@ class ProductItem extends s {
|
|
1309
1419
|
};
|
1310
1420
|
ProductItem.styles = [productItemStyles];
|
1311
1421
|
__decorate([
|
1312
|
-
n({ type: Object }),
|
1422
|
+
n$1({ type: Object }),
|
1313
1423
|
__metadata("design:type", Object)
|
1314
1424
|
], ProductItem.prototype, "product", void 0);
|
1315
1425
|
__decorate([
|
1316
|
-
n({ type: Object }),
|
1426
|
+
n$1({ type: Object }),
|
1317
1427
|
__metadata("design:type", Object)
|
1318
1428
|
], ProductItem.prototype, "siteCurrency", void 0);
|
1319
1429
|
ProductItem = __decorate([
|
1320
|
-
t$
|
1430
|
+
t$2('product-item')
|
1321
1431
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1322
1432
|
], ProductItem);
|
1323
1433
|
|
@@ -1406,12 +1516,15 @@ class ProductsList extends s {
|
|
1406
1516
|
(_a = this.productsEle) === null || _a === void 0 ? void 0 : _a.scrollBy({ left: 186, behavior: 'smooth' });
|
1407
1517
|
}
|
1408
1518
|
render() {
|
1519
|
+
if (!this.products.length) {
|
1520
|
+
return T;
|
1521
|
+
}
|
1409
1522
|
return x `
|
1410
1523
|
<div class="products-wrapper">
|
1411
1524
|
<div class="products" @scroll=${this.updateButtonsState}>
|
1412
|
-
${o(this.products, (product) => x `
|
1525
|
+
${o$1(this.products, (product) => x `
|
1413
1526
|
<div
|
1414
|
-
class=${e({
|
1527
|
+
class=${e$2({
|
1415
1528
|
'product-container': true,
|
1416
1529
|
modal: this.viewType === 'modal',
|
1417
1530
|
})}
|
@@ -1435,27 +1548,27 @@ class ProductsList extends s {
|
|
1435
1548
|
};
|
1436
1549
|
ProductsList.styles = [productsListStyles];
|
1437
1550
|
__decorate([
|
1438
|
-
n({ type: Array }),
|
1551
|
+
n$1({ type: Array }),
|
1439
1552
|
__metadata("design:type", Array)
|
1440
1553
|
], ProductsList.prototype, "products", void 0);
|
1441
1554
|
__decorate([
|
1442
|
-
n({ type: Object }),
|
1555
|
+
n$1({ type: Object }),
|
1443
1556
|
__metadata("design:type", Object)
|
1444
1557
|
], ProductsList.prototype, "siteCurrency", void 0);
|
1445
1558
|
__decorate([
|
1446
|
-
e$
|
1559
|
+
e$4('.left-btn'),
|
1447
1560
|
__metadata("design:type", Object)
|
1448
1561
|
], ProductsList.prototype, "leftBtnEle", void 0);
|
1449
1562
|
__decorate([
|
1450
|
-
e$
|
1563
|
+
e$4('.right-btn'),
|
1451
1564
|
__metadata("design:type", Object)
|
1452
1565
|
], ProductsList.prototype, "rightBtnEle", void 0);
|
1453
1566
|
__decorate([
|
1454
|
-
e$
|
1567
|
+
e$4('.products'),
|
1455
1568
|
__metadata("design:type", Object)
|
1456
1569
|
], ProductsList.prototype, "productsEle", void 0);
|
1457
1570
|
ProductsList = __decorate([
|
1458
|
-
t$
|
1571
|
+
t$2('products-list')
|
1459
1572
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1460
1573
|
], ProductsList);
|
1461
1574
|
|
@@ -1503,31 +1616,31 @@ class ProductsSection extends s {
|
|
1503
1616
|
};
|
1504
1617
|
ProductsSection.styles = [productsSectionStyles];
|
1505
1618
|
__decorate([
|
1506
|
-
n({ type: Array }),
|
1619
|
+
n$1({ type: Array }),
|
1507
1620
|
__metadata("design:type", Array)
|
1508
1621
|
], ProductsSection.prototype, "products", void 0);
|
1509
1622
|
__decorate([
|
1510
|
-
n({ type: Boolean }),
|
1623
|
+
n$1({ type: Boolean }),
|
1511
1624
|
__metadata("design:type", Boolean)
|
1512
1625
|
], ProductsSection.prototype, "isLoadingHistory", void 0);
|
1513
1626
|
__decorate([
|
1514
|
-
n({ type: Object }),
|
1627
|
+
n$1({ type: Object }),
|
1515
1628
|
__metadata("design:type", Object)
|
1516
1629
|
], ProductsSection.prototype, "siteCurrency", void 0);
|
1517
1630
|
__decorate([
|
1518
|
-
e$
|
1631
|
+
e$4('.left-btn'),
|
1519
1632
|
__metadata("design:type", Object)
|
1520
1633
|
], ProductsSection.prototype, "leftBtnEle", void 0);
|
1521
1634
|
__decorate([
|
1522
|
-
e$
|
1635
|
+
e$4('.right-btn'),
|
1523
1636
|
__metadata("design:type", Object)
|
1524
1637
|
], ProductsSection.prototype, "rightBtnEle", void 0);
|
1525
1638
|
__decorate([
|
1526
|
-
e$
|
1639
|
+
e$4('.products'),
|
1527
1640
|
__metadata("design:type", Object)
|
1528
1641
|
], ProductsSection.prototype, "productsEle", void 0);
|
1529
1642
|
ProductsSection = __decorate([
|
1530
|
-
t$
|
1643
|
+
t$2('products-section')
|
1531
1644
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1532
1645
|
], ProductsSection);
|
1533
1646
|
|
@@ -1568,6 +1681,9 @@ const chatSectionStyles = i$3 `
|
|
1568
1681
|
font-weight: 600;
|
1569
1682
|
line-height: 21px;
|
1570
1683
|
text-transform: capitalize;
|
1684
|
+
white-space: nowrap;
|
1685
|
+
overflow: hidden;
|
1686
|
+
text-overflow: ellipsis;
|
1571
1687
|
}
|
1572
1688
|
|
1573
1689
|
.btn-context {
|
@@ -1706,6 +1822,10 @@ const chatSectionStyles = i$3 `
|
|
1706
1822
|
gap: 28px;
|
1707
1823
|
padding-bottom: 10px;
|
1708
1824
|
margin-bottom: -10px;
|
1825
|
+
|
1826
|
+
.message:last-child {
|
1827
|
+
margin-top: 10px;
|
1828
|
+
}
|
1709
1829
|
}
|
1710
1830
|
|
1711
1831
|
.message {
|
@@ -1923,15 +2043,28 @@ const chatSectionStyles = i$3 `
|
|
1923
2043
|
}
|
1924
2044
|
|
1925
2045
|
.thread-title {
|
2046
|
+
display: flex;
|
2047
|
+
justify-content: space-between;
|
1926
2048
|
padding: 10px 16px;
|
1927
2049
|
color: #4e647f;
|
1928
|
-
font-size: 14px;
|
1929
|
-
font-weight: 400;
|
1930
|
-
line-height: 20px;
|
1931
2050
|
cursor: pointer;
|
1932
2051
|
|
2052
|
+
p {
|
2053
|
+
font-size: 14px;
|
2054
|
+
font-weight: 400;
|
2055
|
+
line-height: 20px;
|
2056
|
+
}
|
2057
|
+
|
2058
|
+
.trash-icon {
|
2059
|
+
display: none;
|
2060
|
+
}
|
2061
|
+
|
1933
2062
|
&:hover {
|
1934
2063
|
background: #f1f4f8;
|
2064
|
+
|
2065
|
+
.trash-icon {
|
2066
|
+
display: flex;
|
2067
|
+
}
|
1935
2068
|
}
|
1936
2069
|
}
|
1937
2070
|
|
@@ -1940,6 +2073,23 @@ const chatSectionStyles = i$3 `
|
|
1940
2073
|
}
|
1941
2074
|
}
|
1942
2075
|
|
2076
|
+
.trash-icon {
|
2077
|
+
display: flex;
|
2078
|
+
justify-content: center;
|
2079
|
+
align-items: center;
|
2080
|
+
padding: 2px;
|
2081
|
+
cursor: pointer;
|
2082
|
+
|
2083
|
+
&:hover {
|
2084
|
+
border-radius: 5px;
|
2085
|
+
background: #dc3545;
|
2086
|
+
|
2087
|
+
path {
|
2088
|
+
fill: white;
|
2089
|
+
}
|
2090
|
+
}
|
2091
|
+
}
|
2092
|
+
|
1943
2093
|
.chat-threads-background {
|
1944
2094
|
position: absolute;
|
1945
2095
|
top: 78px;
|
@@ -1958,6 +2108,16 @@ const capitalizeEachWord = (str) => {
|
|
1958
2108
|
return str === null || str === void 0 ? void 0 : str.replace(/^\w/, (char) => char.toUpperCase());
|
1959
2109
|
};
|
1960
2110
|
|
2111
|
+
const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2112
|
+
<path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
|
2113
|
+
</svg>`;
|
2114
|
+
const timerBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2115
|
+
<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"/>
|
2116
|
+
</svg>`;
|
2117
|
+
const crossBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2118
|
+
<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"/>
|
2119
|
+
</svg>`;
|
2120
|
+
|
1961
2121
|
const personalizeDialogStyles = i$3 `
|
1962
2122
|
:host {
|
1963
2123
|
font-family: 'Inter', sans-serif;
|
@@ -2444,63 +2604,318 @@ class PersonalizeDialog extends s {
|
|
2444
2604
|
};
|
2445
2605
|
PersonalizeDialog.styles = [personalizeDialogStyles];
|
2446
2606
|
__decorate([
|
2447
|
-
e$
|
2607
|
+
e$4('dialog'),
|
2448
2608
|
__metadata("design:type", HTMLDialogElement)
|
2449
2609
|
], PersonalizeDialog.prototype, "dialogModal", void 0);
|
2450
2610
|
__decorate([
|
2451
|
-
e$
|
2611
|
+
e$4('.dropdown-list'),
|
2452
2612
|
__metadata("design:type", HTMLUListElement)
|
2453
2613
|
], PersonalizeDialog.prototype, "dropdownList", void 0);
|
2454
2614
|
__decorate([
|
2455
|
-
e$
|
2615
|
+
e$4('.dropdown-trigger'),
|
2456
2616
|
__metadata("design:type", HTMLDivElement)
|
2457
2617
|
], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
|
2458
2618
|
__decorate([
|
2459
|
-
n({ type: Array }),
|
2619
|
+
n$1({ type: Array }),
|
2460
2620
|
__metadata("design:type", Array)
|
2461
2621
|
], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
|
2462
2622
|
__decorate([
|
2463
|
-
n({ type: Array }),
|
2623
|
+
n$1({ type: Array }),
|
2464
2624
|
__metadata("design:type", Array)
|
2465
2625
|
], PersonalizeDialog.prototype, "defaultProfiles", void 0);
|
2466
2626
|
__decorate([
|
2467
|
-
n({ type: Boolean }),
|
2627
|
+
n$1({ type: Boolean }),
|
2468
2628
|
__metadata("design:type", Boolean)
|
2469
2629
|
], PersonalizeDialog.prototype, "isLoading", void 0);
|
2470
2630
|
__decorate([
|
2471
|
-
n({ type: String }),
|
2631
|
+
n$1({ type: String }),
|
2472
2632
|
__metadata("design:type", Object)
|
2473
2633
|
], PersonalizeDialog.prototype, "state", void 0);
|
2474
2634
|
__decorate([
|
2475
|
-
n({ type: String }),
|
2635
|
+
n$1({ type: String }),
|
2476
2636
|
__metadata("design:type", Object)
|
2477
2637
|
], PersonalizeDialog.prototype, "profileType", void 0);
|
2478
2638
|
__decorate([
|
2479
|
-
n({ type: String }),
|
2639
|
+
n$1({ type: String }),
|
2480
2640
|
__metadata("design:type", Object)
|
2481
2641
|
], PersonalizeDialog.prototype, "selectedProfile", void 0);
|
2482
2642
|
__decorate([
|
2483
|
-
n({ type: String }),
|
2643
|
+
n$1({ type: String }),
|
2484
2644
|
__metadata("design:type", Object)
|
2485
2645
|
], PersonalizeDialog.prototype, "visitorType", void 0);
|
2486
2646
|
__decorate([
|
2487
|
-
n({ type: String }),
|
2647
|
+
n$1({ type: String }),
|
2488
2648
|
__metadata("design:type", Object)
|
2489
2649
|
], PersonalizeDialog.prototype, "productHandle", void 0);
|
2490
2650
|
PersonalizeDialog = __decorate([
|
2491
|
-
t$
|
2651
|
+
t$2('personalize-dialog')
|
2492
2652
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2493
2653
|
], PersonalizeDialog);
|
2494
2654
|
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2655
|
+
/**
|
2656
|
+
* @license
|
2657
|
+
* Copyright 2017 Google LLC
|
2658
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
2659
|
+
*/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);
|
2660
|
+
|
2661
|
+
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,"")}
|
2662
|
+
|
2663
|
+
let MarkdownRenderer =
|
2664
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2665
|
+
class MarkdownRenderer extends s {
|
2666
|
+
render() {
|
2667
|
+
const slotContent = this.innerHTML.trim();
|
2668
|
+
const parsedContent = t(slotContent);
|
2669
|
+
return o(parsedContent);
|
2670
|
+
}
|
2671
|
+
};
|
2672
|
+
MarkdownRenderer.styles = i$3 `
|
2673
|
+
:host {
|
2674
|
+
font-family: 'Inter', sans-serif;
|
2675
|
+
font-size: 16px;
|
2676
|
+
font-weight: 400;
|
2677
|
+
|
2678
|
+
p {
|
2679
|
+
margin: 0;
|
2680
|
+
}
|
2681
|
+
}
|
2682
|
+
`;
|
2683
|
+
MarkdownRenderer = __decorate([
|
2684
|
+
t$2('markdown-renderer')
|
2685
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2686
|
+
], MarkdownRenderer);
|
2687
|
+
|
2688
|
+
let TooltipComponent =
|
2689
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2690
|
+
class TooltipComponent extends s {
|
2691
|
+
constructor() {
|
2692
|
+
super(...arguments);
|
2693
|
+
this.position = 'bottom-left';
|
2694
|
+
this.text = '';
|
2695
|
+
}
|
2696
|
+
render() {
|
2697
|
+
return x `
|
2698
|
+
<slot></slot>
|
2699
|
+
<div class="tooltip ${this.position}">${this.text}</div>
|
2700
|
+
`;
|
2701
|
+
}
|
2702
|
+
};
|
2703
|
+
TooltipComponent.styles = [
|
2704
|
+
i$3 `
|
2705
|
+
:host {
|
2706
|
+
position: relative;
|
2707
|
+
display: inline-block;
|
2708
|
+
}
|
2709
|
+
.tooltip {
|
2710
|
+
position: absolute;
|
2711
|
+
color: #172a41;
|
2712
|
+
padding: 4px 8px;
|
2713
|
+
border-radius: 4px;
|
2714
|
+
white-space: nowrap;
|
2715
|
+
font-size: 12px;
|
2716
|
+
opacity: 0;
|
2717
|
+
transition: opacity 0.2s;
|
2718
|
+
pointer-events: none;
|
2719
|
+
|
2720
|
+
border-radius: 5px;
|
2721
|
+
background: #ffcc81;
|
2722
|
+
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
2723
|
+
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
2724
|
+
|
2725
|
+
font-style: normal;
|
2726
|
+
font-weight: 400;
|
2727
|
+
line-height: 150%;
|
2728
|
+
}
|
2729
|
+
:host(:hover) .tooltip {
|
2730
|
+
opacity: 1;
|
2731
|
+
}
|
2732
|
+
.top-center {
|
2733
|
+
bottom: calc(100% + 2px);
|
2734
|
+
left: 50%;
|
2735
|
+
transform: translateX(-50%);
|
2736
|
+
}
|
2737
|
+
.top-left {
|
2738
|
+
bottom: calc(100% + 2px);
|
2739
|
+
left: 0;
|
2740
|
+
}
|
2741
|
+
.top-right {
|
2742
|
+
bottom: calc(100% + 2px);
|
2743
|
+
right: 0;
|
2744
|
+
}
|
2745
|
+
.bottom-center {
|
2746
|
+
top: calc(100% + 2px);
|
2747
|
+
left: 50%;
|
2748
|
+
transform: translateX(-50%);
|
2749
|
+
}
|
2750
|
+
.bottom-left {
|
2751
|
+
top: calc(100% + 2px);
|
2752
|
+
left: 0;
|
2753
|
+
}
|
2754
|
+
.bottom-right {
|
2755
|
+
top: calc(100% + 2px);
|
2756
|
+
right: 0;
|
2757
|
+
}
|
2758
|
+
.left-center {
|
2759
|
+
right: calc(100% + 2px);
|
2760
|
+
top: 50%;
|
2761
|
+
transform: translateY(-50%);
|
2762
|
+
}
|
2763
|
+
.left-top {
|
2764
|
+
right: calc(100% + 2px);
|
2765
|
+
top: 0;
|
2766
|
+
}
|
2767
|
+
.left-bottom {
|
2768
|
+
right: calc(100% + 2px);
|
2769
|
+
bottom: 0;
|
2770
|
+
}
|
2771
|
+
.right-center {
|
2772
|
+
left: calc(100% + 2px);
|
2773
|
+
top: 50%;
|
2774
|
+
transform: translateY(-50%);
|
2775
|
+
}
|
2776
|
+
.right-top {
|
2777
|
+
left: calc(100% + 2px);
|
2778
|
+
top: 0;
|
2779
|
+
}
|
2780
|
+
.right-bottom {
|
2781
|
+
left: calc(100% + 2px);
|
2782
|
+
bottom: 0;
|
2783
|
+
}
|
2784
|
+
`,
|
2785
|
+
];
|
2786
|
+
__decorate([
|
2787
|
+
n$1({ type: String }),
|
2788
|
+
__metadata("design:type", String)
|
2789
|
+
], TooltipComponent.prototype, "position", void 0);
|
2790
|
+
__decorate([
|
2791
|
+
n$1({ type: String }),
|
2792
|
+
__metadata("design:type", String)
|
2793
|
+
], TooltipComponent.prototype, "text", void 0);
|
2794
|
+
TooltipComponent = __decorate([
|
2795
|
+
t$2('tooltip-component')
|
2796
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2797
|
+
], TooltipComponent);
|
2798
|
+
|
2799
|
+
const confirmDialogStyles = i$3 `
|
2800
|
+
:host {
|
2801
|
+
font-family: 'Inter', sans-serif;
|
2802
|
+
font-size: 16px;
|
2803
|
+
font-weight: 400;
|
2804
|
+
|
2805
|
+
display: flex;
|
2806
|
+
position: absolute;
|
2807
|
+
top: 0;
|
2808
|
+
left: 0;
|
2809
|
+
width: 100%;
|
2810
|
+
height: 100%;
|
2811
|
+
background: #00000050;
|
2812
|
+
}
|
2813
|
+
|
2814
|
+
.modal {
|
2815
|
+
width: 75%;
|
2816
|
+
max-width: 350px;
|
2817
|
+
background: #fff;
|
2818
|
+
padding: 16px;
|
2819
|
+
margin: auto;
|
2820
|
+
|
2821
|
+
border-radius: 10px;
|
2822
|
+
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
2823
|
+
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
2824
|
+
|
2825
|
+
z-index: 2000;
|
2826
|
+
}
|
2827
|
+
|
2828
|
+
::slotted([slot='title']) {
|
2829
|
+
margin-bottom: 8px !important;
|
2830
|
+
color: #172a41;
|
2831
|
+
font-size: 18px;
|
2832
|
+
font-weight: 700;
|
2833
|
+
line-height: 150%;
|
2834
|
+
}
|
2835
|
+
|
2836
|
+
::slotted([slot='content']) {
|
2837
|
+
color: #4e647f;
|
2838
|
+
line-height: 150%;
|
2839
|
+
}
|
2840
|
+
|
2841
|
+
.button-wrapper {
|
2842
|
+
margin-top: 12px;
|
2843
|
+
display: flex;
|
2844
|
+
gap: 12px;
|
2845
|
+
|
2846
|
+
.btn {
|
2847
|
+
justify-self: stretch;
|
2848
|
+
padding: 10px;
|
2849
|
+
cursor: pointer;
|
2850
|
+
text-align: center;
|
2851
|
+
width: 100%;
|
2852
|
+
border: 0;
|
2853
|
+
color: #fff;
|
2854
|
+
line-height: 150%;
|
2855
|
+
text-transform: capitalize;
|
2856
|
+
}
|
2857
|
+
|
2858
|
+
.accept-btn {
|
2859
|
+
border-radius: 5px;
|
2860
|
+
background: #dc3545;
|
2861
|
+
|
2862
|
+
&:hover {
|
2863
|
+
background: rgb(176, 62, 25);
|
2864
|
+
}
|
2865
|
+
}
|
2866
|
+
|
2867
|
+
.decline-btn {
|
2868
|
+
border-radius: 5px;
|
2869
|
+
background: #4e647f;
|
2870
|
+
|
2871
|
+
&:hover {
|
2872
|
+
background: rgb(57, 77, 102);
|
2873
|
+
}
|
2874
|
+
}
|
2875
|
+
}
|
2876
|
+
`;
|
2877
|
+
|
2878
|
+
let ConfirmDialog =
|
2879
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2880
|
+
class ConfirmDialog extends s {
|
2881
|
+
onAcceptClick(e) {
|
2882
|
+
e.preventDefault();
|
2883
|
+
this.dispatchEvent(new CustomEvent('accept', {
|
2884
|
+
composed: true,
|
2885
|
+
}));
|
2886
|
+
}
|
2887
|
+
onCancelClick(e) {
|
2888
|
+
e.preventDefault();
|
2889
|
+
this.dispatchEvent(new CustomEvent('decline', {
|
2890
|
+
composed: true,
|
2891
|
+
}));
|
2892
|
+
}
|
2893
|
+
render() {
|
2894
|
+
return x `
|
2895
|
+
<div class="modal">
|
2896
|
+
<slot name="title"></slot>
|
2897
|
+
<slot name="content"></slot>
|
2898
|
+
<div class="button-wrapper">
|
2899
|
+
<slot name="accept-btn">
|
2900
|
+
<button class="btn accept-btn" @click=${this.onAcceptClick}>
|
2901
|
+
Delete
|
2902
|
+
</button>
|
2903
|
+
</slot>
|
2904
|
+
<slot name="decline-btn">
|
2905
|
+
<button class="btn decline-btn" @click=${this.onCancelClick}>
|
2906
|
+
Cancel
|
2907
|
+
</button>
|
2908
|
+
</slot>
|
2909
|
+
</div>
|
2910
|
+
</div>
|
2911
|
+
`;
|
2912
|
+
}
|
2913
|
+
};
|
2914
|
+
ConfirmDialog.styles = [confirmDialogStyles];
|
2915
|
+
ConfirmDialog = __decorate([
|
2916
|
+
t$2('confirm-dialog')
|
2917
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2918
|
+
], ConfirmDialog);
|
2504
2919
|
|
2505
2920
|
let ChatSection =
|
2506
2921
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
@@ -2531,6 +2946,17 @@ class ChatSection extends s {
|
|
2531
2946
|
this.userQuery = '';
|
2532
2947
|
await this.processMessage(e, message);
|
2533
2948
|
}
|
2949
|
+
handleThreadDelete() {
|
2950
|
+
if (!this.deleteThreadId) {
|
2951
|
+
return;
|
2952
|
+
}
|
2953
|
+
this.dispatchEvent(new CustomEvent('delete-thread', {
|
2954
|
+
detail: { threadId: this.deleteThreadId },
|
2955
|
+
composed: true,
|
2956
|
+
bubbles: true,
|
2957
|
+
}));
|
2958
|
+
this.deleteThreadId = '';
|
2959
|
+
}
|
2534
2960
|
typingIndicator() {
|
2535
2961
|
return x `<div class="typing-dots">
|
2536
2962
|
<div class="dot"></div>
|
@@ -2547,7 +2973,9 @@ class ChatSection extends s {
|
|
2547
2973
|
<div class="bot-icon">${botIcon}</div>
|
2548
2974
|
</div>
|
2549
2975
|
<div>
|
2550
|
-
${message.message
|
2976
|
+
${message.message
|
2977
|
+
? x `<markdown-renderer>${message.message}</markdown-renderer>`
|
2978
|
+
: T}
|
2551
2979
|
${this.viewType !== 'modal' && ((_a = message.products) === null || _a === void 0 ? void 0 : _a[0])
|
2552
2980
|
? x `
|
2553
2981
|
<span class="line"></span>
|
@@ -2712,37 +3140,49 @@ class ChatSection extends s {
|
|
2712
3140
|
<div>${botIcon}</div>
|
2713
3141
|
<h2>${((_a = this.thread) === null || _a === void 0 ? void 0 : _a.title) || 'New Search'}</h2>
|
2714
3142
|
<div class="btns-wrapper">
|
2715
|
-
<
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
3143
|
+
<tooltip-component .position=${'bottom-right'} .text=${'New Chat'}>
|
3144
|
+
<button
|
3145
|
+
class="btn btn-icon new-search-btn"
|
3146
|
+
@click=${(e) => {
|
2719
3147
|
var _a;
|
2720
|
-
|
3148
|
+
e.preventDefault();
|
3149
|
+
(_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, '');
|
2721
3150
|
}}
|
3151
|
+
>
|
3152
|
+
${plusBtn}
|
3153
|
+
</button>
|
3154
|
+
</tooltip-component>
|
3155
|
+
<tooltip-component
|
3156
|
+
.position=${'bottom-right'}
|
3157
|
+
.text=${'Your Search History'}
|
2722
3158
|
>
|
2723
|
-
|
2724
|
-
|
2725
|
-
<button
|
2726
|
-
class=${e({
|
3159
|
+
<button
|
3160
|
+
class=${e$2({
|
2727
3161
|
btn: true,
|
2728
3162
|
'btn-icon': true,
|
2729
3163
|
'threads-btn': true,
|
2730
3164
|
active: this.showChatThreads,
|
2731
3165
|
})}
|
2732
|
-
|
2733
|
-
|
3166
|
+
@click=${(e) => {
|
3167
|
+
e.preventDefault();
|
2734
3168
|
this.showChatThreads = !this.showChatThreads;
|
2735
3169
|
}}
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
3170
|
+
>
|
3171
|
+
${timerBtn}
|
3172
|
+
</button>
|
3173
|
+
</tooltip-component>
|
3174
|
+
<tooltip-component .position=${'bottom-right'} .text=${'Close Chat'}>
|
3175
|
+
<button
|
3176
|
+
class="btn btn-icon close-btn"
|
3177
|
+
@click=${(e) => {
|
3178
|
+
var _a;
|
3179
|
+
e.preventDefault();
|
3180
|
+
(_a = this.closeModal) === null || _a === void 0 ? void 0 : _a.call(this);
|
3181
|
+
}}
|
3182
|
+
>
|
3183
|
+
${crossBtn}
|
3184
|
+
</button>
|
3185
|
+
</tooltip-component>
|
2746
3186
|
</div>
|
2747
3187
|
`;
|
2748
3188
|
}
|
@@ -2791,23 +3231,38 @@ class ChatSection extends s {
|
|
2791
3231
|
<div class="chat-threads">
|
2792
3232
|
<h2>Your Search History</h2>
|
2793
3233
|
<div class="thread-titles-wrapper">
|
2794
|
-
${o(this.chatThreads.values(), (thread) => x `
|
2795
|
-
<
|
2796
|
-
class=${e({
|
3234
|
+
${o$1(this.chatThreads.values(), (thread) => x `
|
3235
|
+
<div
|
3236
|
+
class=${e$2({
|
2797
3237
|
'thread-title': true,
|
2798
3238
|
disabled: this.isTyping,
|
2799
3239
|
})}
|
2800
|
-
|
3240
|
+
>
|
3241
|
+
<p
|
3242
|
+
@click=${() => {
|
2801
3243
|
var _a;
|
2802
3244
|
if (this.isTyping) {
|
2803
3245
|
return;
|
2804
3246
|
}
|
2805
3247
|
this.showChatThreads = false;
|
2806
|
-
|
3248
|
+
(_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, thread.threadId);
|
2807
3249
|
}}
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
3250
|
+
>
|
3251
|
+
${thread.title || 'New Search'}
|
3252
|
+
</p>
|
3253
|
+
<div
|
3254
|
+
class="trash-icon"
|
3255
|
+
@click=${() => {
|
3256
|
+
if (this.isTyping) {
|
3257
|
+
return;
|
3258
|
+
}
|
3259
|
+
this.deleteThreadId = thread.threadId;
|
3260
|
+
this.showChatThreads = false;
|
3261
|
+
}}
|
3262
|
+
>
|
3263
|
+
${trashIcon}
|
3264
|
+
</div>
|
3265
|
+
</div>
|
2811
3266
|
`)}
|
2812
3267
|
</div>
|
2813
3268
|
</div>
|
@@ -2821,7 +3276,7 @@ class ChatSection extends s {
|
|
2821
3276
|
return x `
|
2822
3277
|
<div class="chat-header">${this.contextButton()}</div>
|
2823
3278
|
<div
|
2824
|
-
class=${e({
|
3279
|
+
class=${e$2({
|
2825
3280
|
'chatbot-section': true,
|
2826
3281
|
'modal-view': this.viewType === 'modal',
|
2827
3282
|
})}
|
@@ -2835,7 +3290,7 @@ class ChatSection extends s {
|
|
2835
3290
|
placeholder="Type your search here..."
|
2836
3291
|
/>
|
2837
3292
|
<button
|
2838
|
-
class=${e({
|
3293
|
+
class=${e$2({
|
2839
3294
|
btn: true,
|
2840
3295
|
modal: this.viewType === 'modal',
|
2841
3296
|
})}
|
@@ -2852,72 +3307,90 @@ class ChatSection extends s {
|
|
2852
3307
|
.defaultProfiles=${this.profiles}
|
2853
3308
|
></personalize-dialog>
|
2854
3309
|
${this.renderChatThreads()}
|
3310
|
+
${this.deleteThreadId
|
3311
|
+
? x `
|
3312
|
+
<confirm-dialog
|
3313
|
+
@accept=${this.handleThreadDelete}
|
3314
|
+
@decline=${() => (this.deleteThreadId = '')}
|
3315
|
+
>
|
3316
|
+
<h2 slot="title">Delete Thread?</h2>
|
3317
|
+
<p slot="content">
|
3318
|
+
This action cannot be undone. Are you sure you want to delete
|
3319
|
+
<b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
|
3320
|
+
</p>
|
3321
|
+
</confirm-dialog>
|
3322
|
+
`
|
3323
|
+
: T}
|
2855
3324
|
`;
|
2856
3325
|
}
|
2857
3326
|
};
|
2858
3327
|
ChatSection.styles = [chatSectionStyles];
|
2859
3328
|
__decorate([
|
2860
|
-
n({ type: Object }),
|
3329
|
+
n$1({ type: Object }),
|
2861
3330
|
__metadata("design:type", Map)
|
2862
3331
|
], ChatSection.prototype, "chatThreads", void 0);
|
2863
3332
|
__decorate([
|
2864
|
-
|
3333
|
+
r$1(),
|
3334
|
+
__metadata("design:type", String)
|
3335
|
+
], ChatSection.prototype, "deleteThreadId", void 0);
|
3336
|
+
__decorate([
|
3337
|
+
n$1({ type: Boolean }),
|
2865
3338
|
__metadata("design:type", Boolean)
|
2866
3339
|
], ChatSection.prototype, "showChatThreads", void 0);
|
2867
3340
|
__decorate([
|
2868
|
-
n({ type: Boolean }),
|
3341
|
+
n$1({ type: Boolean }),
|
2869
3342
|
__metadata("design:type", Boolean)
|
2870
3343
|
], ChatSection.prototype, "isLoadingHistory", void 0);
|
2871
3344
|
__decorate([
|
2872
|
-
n({ type: Boolean }),
|
3345
|
+
n$1({ type: Boolean }),
|
2873
3346
|
__metadata("design:type", Object)
|
2874
3347
|
], ChatSection.prototype, "devMode", void 0);
|
2875
3348
|
__decorate([
|
2876
|
-
n({ type: Boolean }),
|
3349
|
+
n$1({ type: Boolean }),
|
2877
3350
|
__metadata("design:type", Boolean)
|
2878
3351
|
], ChatSection.prototype, "isTyping", void 0);
|
2879
3352
|
__decorate([
|
2880
|
-
n({ type: Boolean }),
|
3353
|
+
n$1({ type: Boolean }),
|
2881
3354
|
__metadata("design:type", Boolean)
|
2882
3355
|
], ChatSection.prototype, "isFailed", void 0);
|
2883
3356
|
__decorate([
|
2884
|
-
n({ type: Array }),
|
3357
|
+
n$1({ type: Array }),
|
2885
3358
|
__metadata("design:type", Array)
|
2886
3359
|
], ChatSection.prototype, "messages", void 0);
|
2887
3360
|
__decorate([
|
2888
|
-
n({ type: Array }),
|
3361
|
+
n$1({ type: Array }),
|
2889
3362
|
__metadata("design:type", Array)
|
2890
3363
|
], ChatSection.prototype, "profiles", void 0);
|
2891
3364
|
__decorate([
|
2892
|
-
n({ type: Array }),
|
3365
|
+
n$1({ type: Array }),
|
2893
3366
|
__metadata("design:type", Array)
|
2894
3367
|
], ChatSection.prototype, "productHandles", void 0);
|
2895
3368
|
__decorate([
|
2896
|
-
n({ type: Object }),
|
3369
|
+
n$1({ type: Object }),
|
2897
3370
|
__metadata("design:type", Object)
|
2898
3371
|
], ChatSection.prototype, "thread", void 0);
|
2899
3372
|
__decorate([
|
2900
|
-
n({ type: Object }),
|
3373
|
+
n$1({ type: Object }),
|
2901
3374
|
__metadata("design:type", Object)
|
2902
3375
|
], ChatSection.prototype, "siteCurrency", void 0);
|
2903
3376
|
__decorate([
|
2904
|
-
e$
|
3377
|
+
e$4('.context-container'),
|
2905
3378
|
__metadata("design:type", Object)
|
2906
3379
|
], ChatSection.prototype, "contextContainerElement", void 0);
|
2907
3380
|
__decorate([
|
2908
|
-
e$
|
3381
|
+
e$4('.chat-window'),
|
2909
3382
|
__metadata("design:type", Object)
|
2910
3383
|
], ChatSection.prototype, "chatWindowElement", void 0);
|
2911
3384
|
__decorate([
|
2912
|
-
e$
|
3385
|
+
e$4('personalize-dialog'),
|
2913
3386
|
__metadata("design:type", Object)
|
2914
3387
|
], ChatSection.prototype, "personalizeDialogElement", void 0);
|
2915
3388
|
__decorate([
|
2916
|
-
n({ type: String }),
|
3389
|
+
n$1({ type: String }),
|
2917
3390
|
__metadata("design:type", String)
|
2918
3391
|
], ChatSection.prototype, "userQuery", void 0);
|
2919
3392
|
ChatSection = __decorate([
|
2920
|
-
t$
|
3393
|
+
t$2('chat-section')
|
2921
3394
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2922
3395
|
], ChatSection);
|
2923
3396
|
|
@@ -2945,7 +3418,7 @@ let ShopGPT = class ShopGPT extends s {
|
|
2945
3418
|
}
|
2946
3419
|
connectedCallback() {
|
2947
3420
|
super.connectedCallback();
|
2948
|
-
if (this.uiMode === 'overlay') {
|
3421
|
+
if (!this.uiMode || this.uiMode === 'overlay') {
|
2949
3422
|
if (!this.path) {
|
2950
3423
|
return;
|
2951
3424
|
}
|
@@ -3080,6 +3553,20 @@ let ShopGPT = class ShopGPT extends s {
|
|
3080
3553
|
logger.error(e);
|
3081
3554
|
}
|
3082
3555
|
}
|
3556
|
+
handleThreadDelete(e) {
|
3557
|
+
e.stopPropagation();
|
3558
|
+
this.isLoadingThreads = true;
|
3559
|
+
const threadId = e.detail.threadId;
|
3560
|
+
if (!threadId) {
|
3561
|
+
logger.error('ThreadId is missing to delete the thread!');
|
3562
|
+
return;
|
3563
|
+
}
|
3564
|
+
this.shopGPTAPI
|
3565
|
+
.deleteSingleThread(threadId)
|
3566
|
+
.then(this.loadChatThreads.bind(this))
|
3567
|
+
.catch(logger.error)
|
3568
|
+
.finally(() => (this.isLoadingThreads = false));
|
3569
|
+
}
|
3083
3570
|
async sendMessageToServer(e, message) {
|
3084
3571
|
e.preventDefault();
|
3085
3572
|
e.stopPropagation();
|
@@ -3131,7 +3618,10 @@ let ShopGPT = class ShopGPT extends s {
|
|
3131
3618
|
overlayMode() {
|
3132
3619
|
const thread = this.chatThreads.get(this.selectedThreadId);
|
3133
3620
|
return x `
|
3134
|
-
<dialog
|
3621
|
+
<dialog
|
3622
|
+
id="shop-gpt-dialog-overlay"
|
3623
|
+
@delete-thread=${this.handleThreadDelete}
|
3624
|
+
>
|
3135
3625
|
<div class="mobile-version">
|
3136
3626
|
Please switch to the desktop version for the best experience.
|
3137
3627
|
</div>
|
@@ -3185,7 +3675,7 @@ let ShopGPT = class ShopGPT extends s {
|
|
3185
3675
|
</div>`;
|
3186
3676
|
}
|
3187
3677
|
return x `
|
3188
|
-
<div id="shop-gpt-modal">
|
3678
|
+
<div id="shop-gpt-modal" @delete-thread=${this.handleThreadDelete}>
|
3189
3679
|
<chat-section
|
3190
3680
|
.isFailed=${this.isFailed}
|
3191
3681
|
.isLoadingHistory=${this.isLoadingHistory}
|
@@ -3209,47 +3699,47 @@ let ShopGPT = class ShopGPT extends s {
|
|
3209
3699
|
};
|
3210
3700
|
ShopGPT.styles = [shopGPTStyles];
|
3211
3701
|
__decorate([
|
3212
|
-
e$
|
3702
|
+
e$4('#shop-gpt-dialog-overlay'),
|
3213
3703
|
__metadata("design:type", Object)
|
3214
3704
|
], ShopGPT.prototype, "shopGPTDialog", void 0);
|
3215
3705
|
__decorate([
|
3216
|
-
n({ type: String }),
|
3706
|
+
n$1({ type: String }),
|
3217
3707
|
__metadata("design:type", String)
|
3218
3708
|
], ShopGPT.prototype, "modalState", void 0);
|
3219
3709
|
__decorate([
|
3220
|
-
n({ type: Boolean }),
|
3710
|
+
n$1({ type: Boolean }),
|
3221
3711
|
__metadata("design:type", Boolean)
|
3222
3712
|
], ShopGPT.prototype, "isLoadingHistory", void 0);
|
3223
3713
|
__decorate([
|
3224
|
-
n({ type: Boolean }),
|
3714
|
+
n$1({ type: Boolean }),
|
3225
3715
|
__metadata("design:type", Boolean)
|
3226
3716
|
], ShopGPT.prototype, "isLoadingThreads", void 0);
|
3227
3717
|
__decorate([
|
3228
|
-
n({ type: Boolean }),
|
3718
|
+
n$1({ type: Boolean }),
|
3229
3719
|
__metadata("design:type", Boolean)
|
3230
3720
|
], ShopGPT.prototype, "isTyping", void 0);
|
3231
3721
|
__decorate([
|
3232
|
-
n({ type: Boolean }),
|
3722
|
+
n$1({ type: Boolean }),
|
3233
3723
|
__metadata("design:type", Boolean)
|
3234
3724
|
], ShopGPT.prototype, "isFailed", void 0);
|
3235
3725
|
__decorate([
|
3236
|
-
n({ type: String }),
|
3726
|
+
n$1({ type: String }),
|
3237
3727
|
__metadata("design:type", String)
|
3238
3728
|
], ShopGPT.prototype, "selectedThreadId", void 0);
|
3239
3729
|
__decorate([
|
3240
|
-
n({ type: Array }),
|
3730
|
+
n$1({ type: Array }),
|
3241
3731
|
__metadata("design:type", Array)
|
3242
3732
|
], ShopGPT.prototype, "products", void 0);
|
3243
3733
|
__decorate([
|
3244
|
-
n({ type: Array }),
|
3734
|
+
n$1({ type: Array }),
|
3245
3735
|
__metadata("design:type", Array)
|
3246
3736
|
], ShopGPT.prototype, "messages", void 0);
|
3247
3737
|
__decorate([
|
3248
|
-
n({ type: Object }),
|
3738
|
+
n$1({ type: Object }),
|
3249
3739
|
__metadata("design:type", Map)
|
3250
3740
|
], ShopGPT.prototype, "chatThreads", void 0);
|
3251
3741
|
ShopGPT = __decorate([
|
3252
|
-
t$
|
3742
|
+
t$2('shop-gpt')
|
3253
3743
|
], ShopGPT);
|
3254
3744
|
|
3255
3745
|
var _a, _b;
|