@blotoutio/providers-shop-gpt-sdk 1.11.5 → 1.12.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 +44 -17
- package/index.js +44 -17
- package/index.mjs +44 -17
- package/package.json +1 -1
package/index.cjs.js
CHANGED
@@ -969,6 +969,7 @@ const init = (params) => {
|
|
969
969
|
nudge,
|
970
970
|
sessionId: (_b = params.session) === null || _b === void 0 ? void 0 : _b.sessionId,
|
971
971
|
loadUIManually,
|
972
|
+
userId: params.userId,
|
972
973
|
});
|
973
974
|
const searchParams = new URLSearchParams(window.location.search);
|
974
975
|
const hasSource = searchParams.get('utm_source') === 'shopgpt';
|
@@ -1063,32 +1064,32 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
1063
1064
|
* Copyright 2019 Google LLC
|
1064
1065
|
* SPDX-License-Identifier: BSD-3-Clause
|
1065
1066
|
*/
|
1066
|
-
const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$
|
1067
|
+
const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$6=new WeakMap;let n$3 = 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$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$6.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$6.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$4=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
1067
1068
|
|
1068
1069
|
/**
|
1069
1070
|
* @license
|
1070
1071
|
* Copyright 2017 Google LLC
|
1071
1072
|
* SPDX-License-Identifier: BSD-3-Clause
|
1072
|
-
*/const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:
|
1073
|
+
*/const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$5,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$3(t,s),b$1={attribute:!0,type:String,converter:u$1,reflect:!1,useDefault:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y 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=b$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$6(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$5(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);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),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),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=h.fromAttribute(s,t.type)??this._$Ej?.get(e)??null,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){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){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}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._$EM();}catch(s){throw t=!1,this._$EM(),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);}_$EM(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.0");
|
1073
1074
|
|
1074
1075
|
/**
|
1075
1076
|
* @license
|
1076
1077
|
* Copyright 2017 Google LLC
|
1077
1078
|
* SPDX-License-Identifier: BSD-3-Clause
|
1078
1079
|
*/
|
1079
|
-
const t$1=globalThis,i$2=t$1.trustedTypes,s=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$
|
1080
|
+
const t$1=globalThis,i$2=t$1.trustedTypes,s$1=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$4="?"+h,n$1=`<${o$4}>`,r$2=document,l=()=>r$2.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$2.createTreeWalker(r$2,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$5+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$5)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$2?i$2.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$4)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$2.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$2).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$2,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.0");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
1080
1081
|
|
1081
1082
|
/**
|
1082
1083
|
* @license
|
1083
1084
|
* Copyright 2017 Google LLC
|
1084
1085
|
* SPDX-License-Identifier: BSD-3-Clause
|
1085
|
-
*/let
|
1086
|
+
*/const s=globalThis;let i$1 = class i extends y$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 r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}};i$1._$litElement$=!0,i$1["finalized"]=!0,s.litElementHydrateSupport?.({LitElement:i$1});const o$3=s.litElementPolyfillSupport;o$3?.({LitElement:i$1});(s.litElementVersions??=[]).push("4.2.0");
|
1086
1087
|
|
1087
1088
|
/**
|
1088
1089
|
* @license
|
1089
1090
|
* Copyright 2017 Google LLC
|
1090
1091
|
* SPDX-License-Identifier: BSD-3-Clause
|
1091
|
-
*/const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.
|
1092
|
+
*/const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=!0),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.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
1092
1093
|
|
1093
1094
|
/**
|
1094
1095
|
* @license
|
@@ -1567,7 +1568,7 @@ const chatThreadsStyles = i$4 `
|
|
1567
1568
|
}
|
1568
1569
|
`;
|
1569
1570
|
|
1570
|
-
class LoadSpinner extends
|
1571
|
+
class LoadSpinner extends i$1 {
|
1571
1572
|
render() {
|
1572
1573
|
return x ` <div class="loader"><div class="spinner"></div></div> `;
|
1573
1574
|
}
|
@@ -1609,7 +1610,7 @@ if (!customElements.get('load-spinner')) {
|
|
1609
1610
|
customElements.define('load-spinner', LoadSpinner);
|
1610
1611
|
}
|
1611
1612
|
|
1612
|
-
class ChatThreads extends
|
1613
|
+
class ChatThreads extends i$1 {
|
1613
1614
|
constructor() {
|
1614
1615
|
super(...arguments);
|
1615
1616
|
this.deleteAllThreads = false;
|
@@ -1998,7 +1999,7 @@ const productItemStyles = i$4 `
|
|
1998
1999
|
}
|
1999
2000
|
`;
|
2000
2001
|
|
2001
|
-
class ProductItem extends
|
2002
|
+
class ProductItem extends i$1 {
|
2002
2003
|
getLocalPrice(price) {
|
2003
2004
|
if (!this.siteCurrency) {
|
2004
2005
|
return price;
|
@@ -2023,6 +2024,7 @@ class ProductItem extends r$2 {
|
|
2023
2024
|
const link = new URL(url);
|
2024
2025
|
link.searchParams.set('utm_source', 'shopgpt');
|
2025
2026
|
link.searchParams.set('utm_medium', 'chat');
|
2027
|
+
link.searchParams.set('et_u_id', this.userId);
|
2026
2028
|
open(link, '_self');
|
2027
2029
|
}
|
2028
2030
|
renderVariantTitles() {
|
@@ -2093,6 +2095,10 @@ __decorate([
|
|
2093
2095
|
n({ type: Number }),
|
2094
2096
|
__metadata("design:type", Number)
|
2095
2097
|
], ProductItem.prototype, "rank", void 0);
|
2098
|
+
__decorate([
|
2099
|
+
n({ type: String }),
|
2100
|
+
__metadata("design:type", String)
|
2101
|
+
], ProductItem.prototype, "userId", void 0);
|
2096
2102
|
if (!customElements.get('product-item')) {
|
2097
2103
|
customElements.define('product-item', ProductItem);
|
2098
2104
|
}
|
@@ -2159,7 +2165,7 @@ const productsListStyles = i$4 `
|
|
2159
2165
|
}
|
2160
2166
|
`;
|
2161
2167
|
|
2162
|
-
class ProductsList extends
|
2168
|
+
class ProductsList extends i$1 {
|
2163
2169
|
constructor() {
|
2164
2170
|
super(...arguments);
|
2165
2171
|
this.showButtons = true;
|
@@ -2222,6 +2228,7 @@ class ProductsList extends r$2 {
|
|
2222
2228
|
.product=${product}
|
2223
2229
|
.siteCurrency=${this.siteCurrency}
|
2224
2230
|
.rank=${index + 1}
|
2231
|
+
.userId=${this.userId}
|
2225
2232
|
></product-item>
|
2226
2233
|
</div>
|
2227
2234
|
`)}
|
@@ -2257,6 +2264,10 @@ __decorate([
|
|
2257
2264
|
n({ type: String }),
|
2258
2265
|
__metadata("design:type", String)
|
2259
2266
|
], ProductsList.prototype, "response", void 0);
|
2267
|
+
__decorate([
|
2268
|
+
n({ type: String }),
|
2269
|
+
__metadata("design:type", String)
|
2270
|
+
], ProductsList.prototype, "userId", void 0);
|
2260
2271
|
__decorate([
|
2261
2272
|
r(),
|
2262
2273
|
__metadata("design:type", Object)
|
@@ -2277,7 +2288,7 @@ if (!customElements.get('products-list')) {
|
|
2277
2288
|
customElements.define('products-list', ProductsList);
|
2278
2289
|
}
|
2279
2290
|
|
2280
|
-
class ProductsSection extends
|
2291
|
+
class ProductsSection extends i$1 {
|
2281
2292
|
constructor() {
|
2282
2293
|
super(...arguments);
|
2283
2294
|
this.isStylesheetInjected = false;
|
@@ -2325,6 +2336,7 @@ class ProductsSection extends r$2 {
|
|
2325
2336
|
.product=${topResult}
|
2326
2337
|
.siteCurrency=${this.siteCurrency}
|
2327
2338
|
.rank=${1}
|
2339
|
+
.userId=${this.userId}
|
2328
2340
|
></product-item>
|
2329
2341
|
</div>
|
2330
2342
|
<span class="line"></span>
|
@@ -2336,6 +2348,7 @@ class ProductsSection extends r$2 {
|
|
2336
2348
|
.products=${others}
|
2337
2349
|
.siteCurrency=${this.siteCurrency}
|
2338
2350
|
.viewType=${'overlay'}
|
2351
|
+
.userId=${this.userId}
|
2339
2352
|
></products-list>
|
2340
2353
|
</div>
|
2341
2354
|
`;
|
@@ -2382,6 +2395,10 @@ __decorate([
|
|
2382
2395
|
n({ type: Array }),
|
2383
2396
|
__metadata("design:type", Array)
|
2384
2397
|
], ProductsSection.prototype, "messages", void 0);
|
2398
|
+
__decorate([
|
2399
|
+
n({ type: String }),
|
2400
|
+
__metadata("design:type", String)
|
2401
|
+
], ProductsSection.prototype, "userId", void 0);
|
2385
2402
|
if (!customElements.get('products-section')) {
|
2386
2403
|
customElements.define('products-section', ProductsSection);
|
2387
2404
|
}
|
@@ -3193,7 +3210,7 @@ const profilePlusIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="56" he
|
|
3193
3210
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M21 7C22.7306 7 24.4223 7.51318 25.8612 8.47464C27.3002 9.4361 28.4217 10.8027 29.084 12.4015C29.7462 14.0004 29.9195 15.7597 29.5819 17.457C29.2443 19.1544 28.4109 20.7135 27.1872 21.9372C25.9635 23.1609 24.4044 23.9942 22.707 24.3319C21.0097 24.6695 19.2504 24.4962 17.6515 23.8339C16.0527 23.1717 14.6861 22.0502 13.7246 20.6112C12.7632 19.1723 12.25 17.4806 12.25 15.75C12.25 13.4294 13.1719 11.2038 14.8128 9.56282C16.4538 7.92187 18.6794 7 21 7ZM21 3.5C18.5772 3.5 16.2088 4.21845 14.1943 5.5645C12.1798 6.91054 10.6097 8.82373 9.68248 11.0621C8.75531 13.3005 8.51272 15.7636 8.98539 18.1399C9.45805 20.5161 10.6248 22.6989 12.3379 24.4121C14.0511 26.1252 16.2339 27.2919 18.6101 27.7646C20.9864 28.2373 23.4495 27.9947 25.6879 27.0675C27.9263 26.1403 29.8395 24.5702 31.1855 22.5557C32.5316 20.5412 33.25 18.1728 33.25 15.75C33.25 12.5011 31.9594 9.38526 29.6621 7.08794C27.3647 4.79062 24.2489 3.5 21 3.5ZM56 24.5H49V17.5H45.5V24.5H38.5V28H45.5V35H49V28H56V24.5ZM35 52.5H38.5V43.75C38.5 40.5011 37.2094 37.3853 34.9121 35.0879C32.6147 32.7906 29.4989 31.5 26.25 31.5H15.75C12.5011 31.5 9.38526 32.7906 7.08794 35.0879C4.79062 37.3853 3.5 40.5011 3.5 43.75V52.5H7V43.75C7 41.4294 7.92187 39.2038 9.56282 37.5628C11.2038 35.9219 13.4294 35 15.75 35H26.25C28.5706 35 30.7962 35.9219 32.4372 37.5628C34.0781 39.2038 35 41.4294 35 43.75V52.5Z" fill="#172A41"/>
|
3194
3211
|
</svg>`;
|
3195
3212
|
|
3196
|
-
class PersonalizeDialog extends
|
3213
|
+
class PersonalizeDialog extends i$1 {
|
3197
3214
|
constructor() {
|
3198
3215
|
super(...arguments);
|
3199
3216
|
this.isLoading = false;
|
@@ -3594,7 +3611,7 @@ const markdown = (text) => {
|
|
3594
3611
|
return src.trim();
|
3595
3612
|
};
|
3596
3613
|
|
3597
|
-
class MarkdownRenderer extends
|
3614
|
+
class MarkdownRenderer extends i$1 {
|
3598
3615
|
constructor() {
|
3599
3616
|
super(...arguments);
|
3600
3617
|
this.content = '';
|
@@ -3622,7 +3639,7 @@ if (!customElements.get('markdown-renderer')) {
|
|
3622
3639
|
customElements.define('markdown-renderer', MarkdownRenderer);
|
3623
3640
|
}
|
3624
3641
|
|
3625
|
-
class TooltipComponent extends
|
3642
|
+
class TooltipComponent extends i$1 {
|
3626
3643
|
constructor() {
|
3627
3644
|
super(...arguments);
|
3628
3645
|
this.position = 'bottom-left';
|
@@ -3822,7 +3839,7 @@ const confirmDialogStyles = i$4 `
|
|
3822
3839
|
}
|
3823
3840
|
`;
|
3824
3841
|
|
3825
|
-
class ConfirmDialog extends
|
3842
|
+
class ConfirmDialog extends i$1 {
|
3826
3843
|
onAcceptClick(e) {
|
3827
3844
|
e.preventDefault();
|
3828
3845
|
this.dispatchEvent(new CustomEvent('accept', {
|
@@ -3983,7 +4000,7 @@ const feedbackDialogStyles = i$4 `
|
|
3983
4000
|
}
|
3984
4001
|
`;
|
3985
4002
|
|
3986
|
-
class FeedbackDialog extends
|
4003
|
+
class FeedbackDialog extends i$1 {
|
3987
4004
|
dispatchFeedbackEvent(feedback) {
|
3988
4005
|
this.dispatchEvent(new CustomEvent('submit-feedback', {
|
3989
4006
|
detail: {
|
@@ -4077,7 +4094,7 @@ if (!customElements.get('feedback-dialog')) {
|
|
4077
4094
|
customElements.define('feedback-dialog', FeedbackDialog);
|
4078
4095
|
}
|
4079
4096
|
|
4080
|
-
class ChatSection extends
|
4097
|
+
class ChatSection extends i$1 {
|
4081
4098
|
constructor() {
|
4082
4099
|
super(...arguments);
|
4083
4100
|
this.showChatThreads = false;
|
@@ -4212,6 +4229,7 @@ class ChatSection extends r$2 {
|
|
4212
4229
|
.product=${message.products[0]}
|
4213
4230
|
.siteCurrency=${this.siteCurrency}
|
4214
4231
|
.rank=${1}
|
4232
|
+
.userId=${this.userId}
|
4215
4233
|
></product-item>
|
4216
4234
|
</div>
|
4217
4235
|
`
|
@@ -4225,6 +4243,7 @@ class ChatSection extends r$2 {
|
|
4225
4243
|
.products=${message.products}
|
4226
4244
|
.siteCurrency=${this.siteCurrency}
|
4227
4245
|
.viewType=${this.viewType}
|
4246
|
+
.userId=${this.userId}
|
4228
4247
|
></products-list>`
|
4229
4248
|
: E}
|
4230
4249
|
${message.messageId && (queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId)
|
@@ -4810,6 +4829,10 @@ __decorate([
|
|
4810
4829
|
n({ type: Boolean }),
|
4811
4830
|
__metadata("design:type", Boolean)
|
4812
4831
|
], ChatSection.prototype, "fromAd", void 0);
|
4832
|
+
__decorate([
|
4833
|
+
n({ type: String }),
|
4834
|
+
__metadata("design:type", String)
|
4835
|
+
], ChatSection.prototype, "userId", void 0);
|
4813
4836
|
if (!customElements.get('chat-section')) {
|
4814
4837
|
customElements.define('chat-section', ChatSection);
|
4815
4838
|
}
|
@@ -4876,7 +4899,7 @@ const soothingWaterDropSound = 'data:audio/mpeg;base64,SUQzBAAAAAAAa1RQRTEAAAAaA
|
|
4876
4899
|
|
4877
4900
|
const DIALOG_DELAY = 1000;
|
4878
4901
|
const normalizePath = (path) => path.replace(/\/$/, '');
|
4879
|
-
class ShopGPT extends
|
4902
|
+
class ShopGPT extends i$1 {
|
4880
4903
|
constructor() {
|
4881
4904
|
super(...arguments);
|
4882
4905
|
this.isStylesheetInjected = false;
|
@@ -5375,6 +5398,7 @@ class ShopGPT extends r$2 {
|
|
5375
5398
|
.siteCurrency=${this.getSiteCurrency()}
|
5376
5399
|
.isLoadingThreads=${this.isLoadingThreads}
|
5377
5400
|
.css=${this.css}
|
5401
|
+
.userId=${this.userId}
|
5378
5402
|
></products-section>
|
5379
5403
|
<chat-section
|
5380
5404
|
.prompts=${this.quickPrompts}
|
@@ -5397,6 +5421,7 @@ class ShopGPT extends r$2 {
|
|
5397
5421
|
.botIconUrl=${this.botIconUrl}
|
5398
5422
|
.css=${this.css}
|
5399
5423
|
.fromAd=${this.isFromAd()}
|
5424
|
+
.userId=${this.userId}
|
5400
5425
|
></chat-section>
|
5401
5426
|
</div>
|
5402
5427
|
</dialog>
|
@@ -5470,6 +5495,7 @@ class ShopGPT extends r$2 {
|
|
5470
5495
|
.botIconUrl=${this.botIconUrl}
|
5471
5496
|
.css=${this.css}
|
5472
5497
|
.fromAd=${this.isFromAd()}
|
5498
|
+
.userId=${this.userId}
|
5473
5499
|
></chat-section>
|
5474
5500
|
</div>
|
5475
5501
|
`;
|
@@ -5617,6 +5643,7 @@ if (typeof window != 'undefined' && typeof document != 'undefined') {
|
|
5617
5643
|
shopGPT.nudge = params.nudge;
|
5618
5644
|
shopGPT.sessionId = params.sessionId;
|
5619
5645
|
shopGPT.loadUIManually = params.loadUIManually;
|
5646
|
+
shopGPT.userId = params.userId;
|
5620
5647
|
},
|
5621
5648
|
loadUI() {
|
5622
5649
|
if (!shopGPT) {
|
package/index.js
CHANGED
@@ -970,6 +970,7 @@ var ProvidersShopGptSdk = (function () {
|
|
970
970
|
nudge,
|
971
971
|
sessionId: (_b = params.session) === null || _b === void 0 ? void 0 : _b.sessionId,
|
972
972
|
loadUIManually,
|
973
|
+
userId: params.userId,
|
973
974
|
});
|
974
975
|
const searchParams = new URLSearchParams(window.location.search);
|
975
976
|
const hasSource = searchParams.get('utm_source') === 'shopgpt';
|
@@ -1064,32 +1065,32 @@ var ProvidersShopGptSdk = (function () {
|
|
1064
1065
|
* Copyright 2019 Google LLC
|
1065
1066
|
* SPDX-License-Identifier: BSD-3-Clause
|
1066
1067
|
*/
|
1067
|
-
const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$
|
1068
|
+
const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$6=new WeakMap;let n$3 = 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$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$6.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$6.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$4=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
1068
1069
|
|
1069
1070
|
/**
|
1070
1071
|
* @license
|
1071
1072
|
* Copyright 2017 Google LLC
|
1072
1073
|
* SPDX-License-Identifier: BSD-3-Clause
|
1073
|
-
*/const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:
|
1074
|
+
*/const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$5,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$3(t,s),b$1={attribute:!0,type:String,converter:u$1,reflect:!1,useDefault:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y 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=b$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$6(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$5(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);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),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),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=h.fromAttribute(s,t.type)??this._$Ej?.get(e)??null,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){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){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}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._$EM();}catch(s){throw t=!1,this._$EM(),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);}_$EM(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.0");
|
1074
1075
|
|
1075
1076
|
/**
|
1076
1077
|
* @license
|
1077
1078
|
* Copyright 2017 Google LLC
|
1078
1079
|
* SPDX-License-Identifier: BSD-3-Clause
|
1079
1080
|
*/
|
1080
|
-
const t$1=globalThis,i$2=t$1.trustedTypes,s=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$
|
1081
|
+
const t$1=globalThis,i$2=t$1.trustedTypes,s$1=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$4="?"+h,n$1=`<${o$4}>`,r$2=document,l=()=>r$2.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$2.createTreeWalker(r$2,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$5+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$5)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$2?i$2.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$4)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$2.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$2).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$2,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.0");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
1081
1082
|
|
1082
1083
|
/**
|
1083
1084
|
* @license
|
1084
1085
|
* Copyright 2017 Google LLC
|
1085
1086
|
* SPDX-License-Identifier: BSD-3-Clause
|
1086
|
-
*/let
|
1087
|
+
*/const s=globalThis;let i$1 = class i extends y$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 r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}};i$1._$litElement$=!0,i$1["finalized"]=!0,s.litElementHydrateSupport?.({LitElement:i$1});const o$3=s.litElementPolyfillSupport;o$3?.({LitElement:i$1});(s.litElementVersions??=[]).push("4.2.0");
|
1087
1088
|
|
1088
1089
|
/**
|
1089
1090
|
* @license
|
1090
1091
|
* Copyright 2017 Google LLC
|
1091
1092
|
* SPDX-License-Identifier: BSD-3-Clause
|
1092
|
-
*/const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.
|
1093
|
+
*/const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=!0),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.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
1093
1094
|
|
1094
1095
|
/**
|
1095
1096
|
* @license
|
@@ -1568,7 +1569,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1568
1569
|
}
|
1569
1570
|
`;
|
1570
1571
|
|
1571
|
-
class LoadSpinner extends
|
1572
|
+
class LoadSpinner extends i$1 {
|
1572
1573
|
render() {
|
1573
1574
|
return x ` <div class="loader"><div class="spinner"></div></div> `;
|
1574
1575
|
}
|
@@ -1610,7 +1611,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1610
1611
|
customElements.define('load-spinner', LoadSpinner);
|
1611
1612
|
}
|
1612
1613
|
|
1613
|
-
class ChatThreads extends
|
1614
|
+
class ChatThreads extends i$1 {
|
1614
1615
|
constructor() {
|
1615
1616
|
super(...arguments);
|
1616
1617
|
this.deleteAllThreads = false;
|
@@ -1999,7 +2000,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1999
2000
|
}
|
2000
2001
|
`;
|
2001
2002
|
|
2002
|
-
class ProductItem extends
|
2003
|
+
class ProductItem extends i$1 {
|
2003
2004
|
getLocalPrice(price) {
|
2004
2005
|
if (!this.siteCurrency) {
|
2005
2006
|
return price;
|
@@ -2024,6 +2025,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2024
2025
|
const link = new URL(url);
|
2025
2026
|
link.searchParams.set('utm_source', 'shopgpt');
|
2026
2027
|
link.searchParams.set('utm_medium', 'chat');
|
2028
|
+
link.searchParams.set('et_u_id', this.userId);
|
2027
2029
|
open(link, '_self');
|
2028
2030
|
}
|
2029
2031
|
renderVariantTitles() {
|
@@ -2094,6 +2096,10 @@ var ProvidersShopGptSdk = (function () {
|
|
2094
2096
|
n({ type: Number }),
|
2095
2097
|
__metadata("design:type", Number)
|
2096
2098
|
], ProductItem.prototype, "rank", void 0);
|
2099
|
+
__decorate([
|
2100
|
+
n({ type: String }),
|
2101
|
+
__metadata("design:type", String)
|
2102
|
+
], ProductItem.prototype, "userId", void 0);
|
2097
2103
|
if (!customElements.get('product-item')) {
|
2098
2104
|
customElements.define('product-item', ProductItem);
|
2099
2105
|
}
|
@@ -2160,7 +2166,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2160
2166
|
}
|
2161
2167
|
`;
|
2162
2168
|
|
2163
|
-
class ProductsList extends
|
2169
|
+
class ProductsList extends i$1 {
|
2164
2170
|
constructor() {
|
2165
2171
|
super(...arguments);
|
2166
2172
|
this.showButtons = true;
|
@@ -2223,6 +2229,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2223
2229
|
.product=${product}
|
2224
2230
|
.siteCurrency=${this.siteCurrency}
|
2225
2231
|
.rank=${index + 1}
|
2232
|
+
.userId=${this.userId}
|
2226
2233
|
></product-item>
|
2227
2234
|
</div>
|
2228
2235
|
`)}
|
@@ -2258,6 +2265,10 @@ var ProvidersShopGptSdk = (function () {
|
|
2258
2265
|
n({ type: String }),
|
2259
2266
|
__metadata("design:type", String)
|
2260
2267
|
], ProductsList.prototype, "response", void 0);
|
2268
|
+
__decorate([
|
2269
|
+
n({ type: String }),
|
2270
|
+
__metadata("design:type", String)
|
2271
|
+
], ProductsList.prototype, "userId", void 0);
|
2261
2272
|
__decorate([
|
2262
2273
|
r(),
|
2263
2274
|
__metadata("design:type", Object)
|
@@ -2278,7 +2289,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2278
2289
|
customElements.define('products-list', ProductsList);
|
2279
2290
|
}
|
2280
2291
|
|
2281
|
-
class ProductsSection extends
|
2292
|
+
class ProductsSection extends i$1 {
|
2282
2293
|
constructor() {
|
2283
2294
|
super(...arguments);
|
2284
2295
|
this.isStylesheetInjected = false;
|
@@ -2326,6 +2337,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2326
2337
|
.product=${topResult}
|
2327
2338
|
.siteCurrency=${this.siteCurrency}
|
2328
2339
|
.rank=${1}
|
2340
|
+
.userId=${this.userId}
|
2329
2341
|
></product-item>
|
2330
2342
|
</div>
|
2331
2343
|
<span class="line"></span>
|
@@ -2337,6 +2349,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2337
2349
|
.products=${others}
|
2338
2350
|
.siteCurrency=${this.siteCurrency}
|
2339
2351
|
.viewType=${'overlay'}
|
2352
|
+
.userId=${this.userId}
|
2340
2353
|
></products-list>
|
2341
2354
|
</div>
|
2342
2355
|
`;
|
@@ -2383,6 +2396,10 @@ var ProvidersShopGptSdk = (function () {
|
|
2383
2396
|
n({ type: Array }),
|
2384
2397
|
__metadata("design:type", Array)
|
2385
2398
|
], ProductsSection.prototype, "messages", void 0);
|
2399
|
+
__decorate([
|
2400
|
+
n({ type: String }),
|
2401
|
+
__metadata("design:type", String)
|
2402
|
+
], ProductsSection.prototype, "userId", void 0);
|
2386
2403
|
if (!customElements.get('products-section')) {
|
2387
2404
|
customElements.define('products-section', ProductsSection);
|
2388
2405
|
}
|
@@ -3194,7 +3211,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3194
3211
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M21 7C22.7306 7 24.4223 7.51318 25.8612 8.47464C27.3002 9.4361 28.4217 10.8027 29.084 12.4015C29.7462 14.0004 29.9195 15.7597 29.5819 17.457C29.2443 19.1544 28.4109 20.7135 27.1872 21.9372C25.9635 23.1609 24.4044 23.9942 22.707 24.3319C21.0097 24.6695 19.2504 24.4962 17.6515 23.8339C16.0527 23.1717 14.6861 22.0502 13.7246 20.6112C12.7632 19.1723 12.25 17.4806 12.25 15.75C12.25 13.4294 13.1719 11.2038 14.8128 9.56282C16.4538 7.92187 18.6794 7 21 7ZM21 3.5C18.5772 3.5 16.2088 4.21845 14.1943 5.5645C12.1798 6.91054 10.6097 8.82373 9.68248 11.0621C8.75531 13.3005 8.51272 15.7636 8.98539 18.1399C9.45805 20.5161 10.6248 22.6989 12.3379 24.4121C14.0511 26.1252 16.2339 27.2919 18.6101 27.7646C20.9864 28.2373 23.4495 27.9947 25.6879 27.0675C27.9263 26.1403 29.8395 24.5702 31.1855 22.5557C32.5316 20.5412 33.25 18.1728 33.25 15.75C33.25 12.5011 31.9594 9.38526 29.6621 7.08794C27.3647 4.79062 24.2489 3.5 21 3.5ZM56 24.5H49V17.5H45.5V24.5H38.5V28H45.5V35H49V28H56V24.5ZM35 52.5H38.5V43.75C38.5 40.5011 37.2094 37.3853 34.9121 35.0879C32.6147 32.7906 29.4989 31.5 26.25 31.5H15.75C12.5011 31.5 9.38526 32.7906 7.08794 35.0879C4.79062 37.3853 3.5 40.5011 3.5 43.75V52.5H7V43.75C7 41.4294 7.92187 39.2038 9.56282 37.5628C11.2038 35.9219 13.4294 35 15.75 35H26.25C28.5706 35 30.7962 35.9219 32.4372 37.5628C34.0781 39.2038 35 41.4294 35 43.75V52.5Z" fill="#172A41"/>
|
3195
3212
|
</svg>`;
|
3196
3213
|
|
3197
|
-
class PersonalizeDialog extends
|
3214
|
+
class PersonalizeDialog extends i$1 {
|
3198
3215
|
constructor() {
|
3199
3216
|
super(...arguments);
|
3200
3217
|
this.isLoading = false;
|
@@ -3595,7 +3612,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3595
3612
|
return src.trim();
|
3596
3613
|
};
|
3597
3614
|
|
3598
|
-
class MarkdownRenderer extends
|
3615
|
+
class MarkdownRenderer extends i$1 {
|
3599
3616
|
constructor() {
|
3600
3617
|
super(...arguments);
|
3601
3618
|
this.content = '';
|
@@ -3623,7 +3640,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3623
3640
|
customElements.define('markdown-renderer', MarkdownRenderer);
|
3624
3641
|
}
|
3625
3642
|
|
3626
|
-
class TooltipComponent extends
|
3643
|
+
class TooltipComponent extends i$1 {
|
3627
3644
|
constructor() {
|
3628
3645
|
super(...arguments);
|
3629
3646
|
this.position = 'bottom-left';
|
@@ -3823,7 +3840,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3823
3840
|
}
|
3824
3841
|
`;
|
3825
3842
|
|
3826
|
-
class ConfirmDialog extends
|
3843
|
+
class ConfirmDialog extends i$1 {
|
3827
3844
|
onAcceptClick(e) {
|
3828
3845
|
e.preventDefault();
|
3829
3846
|
this.dispatchEvent(new CustomEvent('accept', {
|
@@ -3984,7 +4001,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3984
4001
|
}
|
3985
4002
|
`;
|
3986
4003
|
|
3987
|
-
class FeedbackDialog extends
|
4004
|
+
class FeedbackDialog extends i$1 {
|
3988
4005
|
dispatchFeedbackEvent(feedback) {
|
3989
4006
|
this.dispatchEvent(new CustomEvent('submit-feedback', {
|
3990
4007
|
detail: {
|
@@ -4078,7 +4095,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
4078
4095
|
customElements.define('feedback-dialog', FeedbackDialog);
|
4079
4096
|
}
|
4080
4097
|
|
4081
|
-
class ChatSection extends
|
4098
|
+
class ChatSection extends i$1 {
|
4082
4099
|
constructor() {
|
4083
4100
|
super(...arguments);
|
4084
4101
|
this.showChatThreads = false;
|
@@ -4213,6 +4230,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
4213
4230
|
.product=${message.products[0]}
|
4214
4231
|
.siteCurrency=${this.siteCurrency}
|
4215
4232
|
.rank=${1}
|
4233
|
+
.userId=${this.userId}
|
4216
4234
|
></product-item>
|
4217
4235
|
</div>
|
4218
4236
|
`
|
@@ -4226,6 +4244,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
4226
4244
|
.products=${message.products}
|
4227
4245
|
.siteCurrency=${this.siteCurrency}
|
4228
4246
|
.viewType=${this.viewType}
|
4247
|
+
.userId=${this.userId}
|
4229
4248
|
></products-list>`
|
4230
4249
|
: E}
|
4231
4250
|
${message.messageId && (queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId)
|
@@ -4811,6 +4830,10 @@ ${this.comment ? this.comment : E}</textarea
|
|
4811
4830
|
n({ type: Boolean }),
|
4812
4831
|
__metadata("design:type", Boolean)
|
4813
4832
|
], ChatSection.prototype, "fromAd", void 0);
|
4833
|
+
__decorate([
|
4834
|
+
n({ type: String }),
|
4835
|
+
__metadata("design:type", String)
|
4836
|
+
], ChatSection.prototype, "userId", void 0);
|
4814
4837
|
if (!customElements.get('chat-section')) {
|
4815
4838
|
customElements.define('chat-section', ChatSection);
|
4816
4839
|
}
|
@@ -4877,7 +4900,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
4877
4900
|
|
4878
4901
|
const DIALOG_DELAY = 1000;
|
4879
4902
|
const normalizePath = (path) => path.replace(/\/$/, '');
|
4880
|
-
class ShopGPT extends
|
4903
|
+
class ShopGPT extends i$1 {
|
4881
4904
|
constructor() {
|
4882
4905
|
super(...arguments);
|
4883
4906
|
this.isStylesheetInjected = false;
|
@@ -5376,6 +5399,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5376
5399
|
.siteCurrency=${this.getSiteCurrency()}
|
5377
5400
|
.isLoadingThreads=${this.isLoadingThreads}
|
5378
5401
|
.css=${this.css}
|
5402
|
+
.userId=${this.userId}
|
5379
5403
|
></products-section>
|
5380
5404
|
<chat-section
|
5381
5405
|
.prompts=${this.quickPrompts}
|
@@ -5398,6 +5422,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5398
5422
|
.botIconUrl=${this.botIconUrl}
|
5399
5423
|
.css=${this.css}
|
5400
5424
|
.fromAd=${this.isFromAd()}
|
5425
|
+
.userId=${this.userId}
|
5401
5426
|
></chat-section>
|
5402
5427
|
</div>
|
5403
5428
|
</dialog>
|
@@ -5471,6 +5496,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5471
5496
|
.botIconUrl=${this.botIconUrl}
|
5472
5497
|
.css=${this.css}
|
5473
5498
|
.fromAd=${this.isFromAd()}
|
5499
|
+
.userId=${this.userId}
|
5474
5500
|
></chat-section>
|
5475
5501
|
</div>
|
5476
5502
|
`;
|
@@ -5618,6 +5644,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5618
5644
|
shopGPT.nudge = params.nudge;
|
5619
5645
|
shopGPT.sessionId = params.sessionId;
|
5620
5646
|
shopGPT.loadUIManually = params.loadUIManually;
|
5647
|
+
shopGPT.userId = params.userId;
|
5621
5648
|
},
|
5622
5649
|
loadUI() {
|
5623
5650
|
if (!shopGPT) {
|
package/index.mjs
CHANGED
@@ -967,6 +967,7 @@ const init = (params) => {
|
|
967
967
|
nudge,
|
968
968
|
sessionId: (_b = params.session) === null || _b === void 0 ? void 0 : _b.sessionId,
|
969
969
|
loadUIManually,
|
970
|
+
userId: params.userId,
|
970
971
|
});
|
971
972
|
const searchParams = new URLSearchParams(window.location.search);
|
972
973
|
const hasSource = searchParams.get('utm_source') === 'shopgpt';
|
@@ -1061,32 +1062,32 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
1061
1062
|
* Copyright 2019 Google LLC
|
1062
1063
|
* SPDX-License-Identifier: BSD-3-Clause
|
1063
1064
|
*/
|
1064
|
-
const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$
|
1065
|
+
const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$6=new WeakMap;let n$3 = 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$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$6.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$6.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$4=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
1065
1066
|
|
1066
1067
|
/**
|
1067
1068
|
* @license
|
1068
1069
|
* Copyright 2017 Google LLC
|
1069
1070
|
* SPDX-License-Identifier: BSD-3-Clause
|
1070
|
-
*/const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:
|
1071
|
+
*/const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$5,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$3(t,s),b$1={attribute:!0,type:String,converter:u$1,reflect:!1,useDefault:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y 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=b$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$6(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$5(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);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),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),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=h.fromAttribute(s,t.type)??this._$Ej?.get(e)??null,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){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){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}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._$EM();}catch(s){throw t=!1,this._$EM(),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);}_$EM(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.0");
|
1071
1072
|
|
1072
1073
|
/**
|
1073
1074
|
* @license
|
1074
1075
|
* Copyright 2017 Google LLC
|
1075
1076
|
* SPDX-License-Identifier: BSD-3-Clause
|
1076
1077
|
*/
|
1077
|
-
const t$1=globalThis,i$2=t$1.trustedTypes,s=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$
|
1078
|
+
const t$1=globalThis,i$2=t$1.trustedTypes,s$1=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$4="?"+h,n$1=`<${o$4}>`,r$2=document,l=()=>r$2.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$2.createTreeWalker(r$2,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$5+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$5)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$2?i$2.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$4)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$2.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$2).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$2,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.0");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
1078
1079
|
|
1079
1080
|
/**
|
1080
1081
|
* @license
|
1081
1082
|
* Copyright 2017 Google LLC
|
1082
1083
|
* SPDX-License-Identifier: BSD-3-Clause
|
1083
|
-
*/let
|
1084
|
+
*/const s=globalThis;let i$1 = class i extends y$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 r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}};i$1._$litElement$=!0,i$1["finalized"]=!0,s.litElementHydrateSupport?.({LitElement:i$1});const o$3=s.litElementPolyfillSupport;o$3?.({LitElement:i$1});(s.litElementVersions??=[]).push("4.2.0");
|
1084
1085
|
|
1085
1086
|
/**
|
1086
1087
|
* @license
|
1087
1088
|
* Copyright 2017 Google LLC
|
1088
1089
|
* SPDX-License-Identifier: BSD-3-Clause
|
1089
|
-
*/const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.
|
1090
|
+
*/const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=!0),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.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
1090
1091
|
|
1091
1092
|
/**
|
1092
1093
|
* @license
|
@@ -1565,7 +1566,7 @@ const chatThreadsStyles = i$4 `
|
|
1565
1566
|
}
|
1566
1567
|
`;
|
1567
1568
|
|
1568
|
-
class LoadSpinner extends
|
1569
|
+
class LoadSpinner extends i$1 {
|
1569
1570
|
render() {
|
1570
1571
|
return x ` <div class="loader"><div class="spinner"></div></div> `;
|
1571
1572
|
}
|
@@ -1607,7 +1608,7 @@ if (!customElements.get('load-spinner')) {
|
|
1607
1608
|
customElements.define('load-spinner', LoadSpinner);
|
1608
1609
|
}
|
1609
1610
|
|
1610
|
-
class ChatThreads extends
|
1611
|
+
class ChatThreads extends i$1 {
|
1611
1612
|
constructor() {
|
1612
1613
|
super(...arguments);
|
1613
1614
|
this.deleteAllThreads = false;
|
@@ -1996,7 +1997,7 @@ const productItemStyles = i$4 `
|
|
1996
1997
|
}
|
1997
1998
|
`;
|
1998
1999
|
|
1999
|
-
class ProductItem extends
|
2000
|
+
class ProductItem extends i$1 {
|
2000
2001
|
getLocalPrice(price) {
|
2001
2002
|
if (!this.siteCurrency) {
|
2002
2003
|
return price;
|
@@ -2021,6 +2022,7 @@ class ProductItem extends r$2 {
|
|
2021
2022
|
const link = new URL(url);
|
2022
2023
|
link.searchParams.set('utm_source', 'shopgpt');
|
2023
2024
|
link.searchParams.set('utm_medium', 'chat');
|
2025
|
+
link.searchParams.set('et_u_id', this.userId);
|
2024
2026
|
open(link, '_self');
|
2025
2027
|
}
|
2026
2028
|
renderVariantTitles() {
|
@@ -2091,6 +2093,10 @@ __decorate([
|
|
2091
2093
|
n({ type: Number }),
|
2092
2094
|
__metadata("design:type", Number)
|
2093
2095
|
], ProductItem.prototype, "rank", void 0);
|
2096
|
+
__decorate([
|
2097
|
+
n({ type: String }),
|
2098
|
+
__metadata("design:type", String)
|
2099
|
+
], ProductItem.prototype, "userId", void 0);
|
2094
2100
|
if (!customElements.get('product-item')) {
|
2095
2101
|
customElements.define('product-item', ProductItem);
|
2096
2102
|
}
|
@@ -2157,7 +2163,7 @@ const productsListStyles = i$4 `
|
|
2157
2163
|
}
|
2158
2164
|
`;
|
2159
2165
|
|
2160
|
-
class ProductsList extends
|
2166
|
+
class ProductsList extends i$1 {
|
2161
2167
|
constructor() {
|
2162
2168
|
super(...arguments);
|
2163
2169
|
this.showButtons = true;
|
@@ -2220,6 +2226,7 @@ class ProductsList extends r$2 {
|
|
2220
2226
|
.product=${product}
|
2221
2227
|
.siteCurrency=${this.siteCurrency}
|
2222
2228
|
.rank=${index + 1}
|
2229
|
+
.userId=${this.userId}
|
2223
2230
|
></product-item>
|
2224
2231
|
</div>
|
2225
2232
|
`)}
|
@@ -2255,6 +2262,10 @@ __decorate([
|
|
2255
2262
|
n({ type: String }),
|
2256
2263
|
__metadata("design:type", String)
|
2257
2264
|
], ProductsList.prototype, "response", void 0);
|
2265
|
+
__decorate([
|
2266
|
+
n({ type: String }),
|
2267
|
+
__metadata("design:type", String)
|
2268
|
+
], ProductsList.prototype, "userId", void 0);
|
2258
2269
|
__decorate([
|
2259
2270
|
r(),
|
2260
2271
|
__metadata("design:type", Object)
|
@@ -2275,7 +2286,7 @@ if (!customElements.get('products-list')) {
|
|
2275
2286
|
customElements.define('products-list', ProductsList);
|
2276
2287
|
}
|
2277
2288
|
|
2278
|
-
class ProductsSection extends
|
2289
|
+
class ProductsSection extends i$1 {
|
2279
2290
|
constructor() {
|
2280
2291
|
super(...arguments);
|
2281
2292
|
this.isStylesheetInjected = false;
|
@@ -2323,6 +2334,7 @@ class ProductsSection extends r$2 {
|
|
2323
2334
|
.product=${topResult}
|
2324
2335
|
.siteCurrency=${this.siteCurrency}
|
2325
2336
|
.rank=${1}
|
2337
|
+
.userId=${this.userId}
|
2326
2338
|
></product-item>
|
2327
2339
|
</div>
|
2328
2340
|
<span class="line"></span>
|
@@ -2334,6 +2346,7 @@ class ProductsSection extends r$2 {
|
|
2334
2346
|
.products=${others}
|
2335
2347
|
.siteCurrency=${this.siteCurrency}
|
2336
2348
|
.viewType=${'overlay'}
|
2349
|
+
.userId=${this.userId}
|
2337
2350
|
></products-list>
|
2338
2351
|
</div>
|
2339
2352
|
`;
|
@@ -2380,6 +2393,10 @@ __decorate([
|
|
2380
2393
|
n({ type: Array }),
|
2381
2394
|
__metadata("design:type", Array)
|
2382
2395
|
], ProductsSection.prototype, "messages", void 0);
|
2396
|
+
__decorate([
|
2397
|
+
n({ type: String }),
|
2398
|
+
__metadata("design:type", String)
|
2399
|
+
], ProductsSection.prototype, "userId", void 0);
|
2383
2400
|
if (!customElements.get('products-section')) {
|
2384
2401
|
customElements.define('products-section', ProductsSection);
|
2385
2402
|
}
|
@@ -3191,7 +3208,7 @@ const profilePlusIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="56" he
|
|
3191
3208
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M21 7C22.7306 7 24.4223 7.51318 25.8612 8.47464C27.3002 9.4361 28.4217 10.8027 29.084 12.4015C29.7462 14.0004 29.9195 15.7597 29.5819 17.457C29.2443 19.1544 28.4109 20.7135 27.1872 21.9372C25.9635 23.1609 24.4044 23.9942 22.707 24.3319C21.0097 24.6695 19.2504 24.4962 17.6515 23.8339C16.0527 23.1717 14.6861 22.0502 13.7246 20.6112C12.7632 19.1723 12.25 17.4806 12.25 15.75C12.25 13.4294 13.1719 11.2038 14.8128 9.56282C16.4538 7.92187 18.6794 7 21 7ZM21 3.5C18.5772 3.5 16.2088 4.21845 14.1943 5.5645C12.1798 6.91054 10.6097 8.82373 9.68248 11.0621C8.75531 13.3005 8.51272 15.7636 8.98539 18.1399C9.45805 20.5161 10.6248 22.6989 12.3379 24.4121C14.0511 26.1252 16.2339 27.2919 18.6101 27.7646C20.9864 28.2373 23.4495 27.9947 25.6879 27.0675C27.9263 26.1403 29.8395 24.5702 31.1855 22.5557C32.5316 20.5412 33.25 18.1728 33.25 15.75C33.25 12.5011 31.9594 9.38526 29.6621 7.08794C27.3647 4.79062 24.2489 3.5 21 3.5ZM56 24.5H49V17.5H45.5V24.5H38.5V28H45.5V35H49V28H56V24.5ZM35 52.5H38.5V43.75C38.5 40.5011 37.2094 37.3853 34.9121 35.0879C32.6147 32.7906 29.4989 31.5 26.25 31.5H15.75C12.5011 31.5 9.38526 32.7906 7.08794 35.0879C4.79062 37.3853 3.5 40.5011 3.5 43.75V52.5H7V43.75C7 41.4294 7.92187 39.2038 9.56282 37.5628C11.2038 35.9219 13.4294 35 15.75 35H26.25C28.5706 35 30.7962 35.9219 32.4372 37.5628C34.0781 39.2038 35 41.4294 35 43.75V52.5Z" fill="#172A41"/>
|
3192
3209
|
</svg>`;
|
3193
3210
|
|
3194
|
-
class PersonalizeDialog extends
|
3211
|
+
class PersonalizeDialog extends i$1 {
|
3195
3212
|
constructor() {
|
3196
3213
|
super(...arguments);
|
3197
3214
|
this.isLoading = false;
|
@@ -3592,7 +3609,7 @@ const markdown = (text) => {
|
|
3592
3609
|
return src.trim();
|
3593
3610
|
};
|
3594
3611
|
|
3595
|
-
class MarkdownRenderer extends
|
3612
|
+
class MarkdownRenderer extends i$1 {
|
3596
3613
|
constructor() {
|
3597
3614
|
super(...arguments);
|
3598
3615
|
this.content = '';
|
@@ -3620,7 +3637,7 @@ if (!customElements.get('markdown-renderer')) {
|
|
3620
3637
|
customElements.define('markdown-renderer', MarkdownRenderer);
|
3621
3638
|
}
|
3622
3639
|
|
3623
|
-
class TooltipComponent extends
|
3640
|
+
class TooltipComponent extends i$1 {
|
3624
3641
|
constructor() {
|
3625
3642
|
super(...arguments);
|
3626
3643
|
this.position = 'bottom-left';
|
@@ -3820,7 +3837,7 @@ const confirmDialogStyles = i$4 `
|
|
3820
3837
|
}
|
3821
3838
|
`;
|
3822
3839
|
|
3823
|
-
class ConfirmDialog extends
|
3840
|
+
class ConfirmDialog extends i$1 {
|
3824
3841
|
onAcceptClick(e) {
|
3825
3842
|
e.preventDefault();
|
3826
3843
|
this.dispatchEvent(new CustomEvent('accept', {
|
@@ -3981,7 +3998,7 @@ const feedbackDialogStyles = i$4 `
|
|
3981
3998
|
}
|
3982
3999
|
`;
|
3983
4000
|
|
3984
|
-
class FeedbackDialog extends
|
4001
|
+
class FeedbackDialog extends i$1 {
|
3985
4002
|
dispatchFeedbackEvent(feedback) {
|
3986
4003
|
this.dispatchEvent(new CustomEvent('submit-feedback', {
|
3987
4004
|
detail: {
|
@@ -4075,7 +4092,7 @@ if (!customElements.get('feedback-dialog')) {
|
|
4075
4092
|
customElements.define('feedback-dialog', FeedbackDialog);
|
4076
4093
|
}
|
4077
4094
|
|
4078
|
-
class ChatSection extends
|
4095
|
+
class ChatSection extends i$1 {
|
4079
4096
|
constructor() {
|
4080
4097
|
super(...arguments);
|
4081
4098
|
this.showChatThreads = false;
|
@@ -4210,6 +4227,7 @@ class ChatSection extends r$2 {
|
|
4210
4227
|
.product=${message.products[0]}
|
4211
4228
|
.siteCurrency=${this.siteCurrency}
|
4212
4229
|
.rank=${1}
|
4230
|
+
.userId=${this.userId}
|
4213
4231
|
></product-item>
|
4214
4232
|
</div>
|
4215
4233
|
`
|
@@ -4223,6 +4241,7 @@ class ChatSection extends r$2 {
|
|
4223
4241
|
.products=${message.products}
|
4224
4242
|
.siteCurrency=${this.siteCurrency}
|
4225
4243
|
.viewType=${this.viewType}
|
4244
|
+
.userId=${this.userId}
|
4226
4245
|
></products-list>`
|
4227
4246
|
: E}
|
4228
4247
|
${message.messageId && (queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId)
|
@@ -4808,6 +4827,10 @@ __decorate([
|
|
4808
4827
|
n({ type: Boolean }),
|
4809
4828
|
__metadata("design:type", Boolean)
|
4810
4829
|
], ChatSection.prototype, "fromAd", void 0);
|
4830
|
+
__decorate([
|
4831
|
+
n({ type: String }),
|
4832
|
+
__metadata("design:type", String)
|
4833
|
+
], ChatSection.prototype, "userId", void 0);
|
4811
4834
|
if (!customElements.get('chat-section')) {
|
4812
4835
|
customElements.define('chat-section', ChatSection);
|
4813
4836
|
}
|
@@ -4874,7 +4897,7 @@ const soothingWaterDropSound = 'data:audio/mpeg;base64,SUQzBAAAAAAAa1RQRTEAAAAaA
|
|
4874
4897
|
|
4875
4898
|
const DIALOG_DELAY = 1000;
|
4876
4899
|
const normalizePath = (path) => path.replace(/\/$/, '');
|
4877
|
-
class ShopGPT extends
|
4900
|
+
class ShopGPT extends i$1 {
|
4878
4901
|
constructor() {
|
4879
4902
|
super(...arguments);
|
4880
4903
|
this.isStylesheetInjected = false;
|
@@ -5373,6 +5396,7 @@ class ShopGPT extends r$2 {
|
|
5373
5396
|
.siteCurrency=${this.getSiteCurrency()}
|
5374
5397
|
.isLoadingThreads=${this.isLoadingThreads}
|
5375
5398
|
.css=${this.css}
|
5399
|
+
.userId=${this.userId}
|
5376
5400
|
></products-section>
|
5377
5401
|
<chat-section
|
5378
5402
|
.prompts=${this.quickPrompts}
|
@@ -5395,6 +5419,7 @@ class ShopGPT extends r$2 {
|
|
5395
5419
|
.botIconUrl=${this.botIconUrl}
|
5396
5420
|
.css=${this.css}
|
5397
5421
|
.fromAd=${this.isFromAd()}
|
5422
|
+
.userId=${this.userId}
|
5398
5423
|
></chat-section>
|
5399
5424
|
</div>
|
5400
5425
|
</dialog>
|
@@ -5468,6 +5493,7 @@ class ShopGPT extends r$2 {
|
|
5468
5493
|
.botIconUrl=${this.botIconUrl}
|
5469
5494
|
.css=${this.css}
|
5470
5495
|
.fromAd=${this.isFromAd()}
|
5496
|
+
.userId=${this.userId}
|
5471
5497
|
></chat-section>
|
5472
5498
|
</div>
|
5473
5499
|
`;
|
@@ -5615,6 +5641,7 @@ if (typeof window != 'undefined' && typeof document != 'undefined') {
|
|
5615
5641
|
shopGPT.nudge = params.nudge;
|
5616
5642
|
shopGPT.sessionId = params.sessionId;
|
5617
5643
|
shopGPT.loadUIManually = params.loadUIManually;
|
5644
|
+
shopGPT.userId = params.userId;
|
5618
5645
|
},
|
5619
5646
|
loadUI() {
|
5620
5647
|
if (!shopGPT) {
|