@blotoutio/providers-evo-search-sdk 1.52.1 → 1.53.1
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 +117 -86
- package/index.js +117 -86
- package/index.mjs +117 -86
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -794,7 +794,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
794
794
|
* Copyright 2019 Google LLC
|
|
795
795
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
796
796
|
*/
|
|
797
|
-
const t$
|
|
797
|
+
const t$1=globalThis,e$4=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=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$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$5=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$4)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t;
|
|
798
798
|
|
|
799
799
|
/**
|
|
800
800
|
* @license
|
|
@@ -807,7 +807,7 @@ const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.na
|
|
|
807
807
|
* Copyright 2017 Google LLC
|
|
808
808
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
809
809
|
*/
|
|
810
|
-
const t
|
|
810
|
+
const t=globalThis,i$1=t=>t,s$1=t.trustedTypes,e$2=s$1?s$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,h="$lit$",o$2=`lit$${Math.random().toFixed(9).slice(2)}$`,n$2="?"+o$2,r$3=`<${n$2}>`,l=document,c=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,d=t=>u(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$2?e$2.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?"!--"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p):void 0!==u[3]&&(c=p):c===p?">"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith("/>")?" ":"";l+=c===v?s+r$3:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o$2+x):s+o$2+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h)){const i=v[a++],s=r.getAttribute(t).split(o$2),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$2)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$2),i=t.length-1;if(i>0){r.textContent=s$1?s$1.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c());}}}else if(8===r.nodeType)if(r.data===n$2)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$2,t+1));)d.push({type:7,index:l}),t+=o$2.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(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=M(t,h._$AS(t,i.values),h,e)),i}class R{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??l).importNode(i,!0);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,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 k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,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=M(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(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!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.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=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(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 k(this.O(c()),this.O(c()),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,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){const s=i$1(t).nextSibling;i$1(t).remove(),t=s;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,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=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=M(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||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){M(this,t);}}const B=t.litHtmlPolyfillSupport;B?.(S,k),(t.litHtmlVersions??=[]).push("3.3.2");const D=(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 k(i.insertBefore(c(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
811
811
|
|
|
812
812
|
/**
|
|
813
813
|
* @license
|
|
@@ -815,13 +815,6 @@ const t$1=globalThis,i$1=t=>t,s$1=t$1.trustedTypes,e$2=s$1?s$1.createPolicy("lit
|
|
|
815
815
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
816
816
|
*/const s=globalThis;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=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return E}}i._$litElement$=!0,i["finalized"]=!0,s.litElementHydrateSupport?.({LitElement:i});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.2");
|
|
817
817
|
|
|
818
|
-
/**
|
|
819
|
-
* @license
|
|
820
|
-
* Copyright 2017 Google LLC
|
|
821
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
822
|
-
*/
|
|
823
|
-
const t=t=>(e,o)=>{void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
|
|
824
|
-
|
|
825
818
|
/**
|
|
826
819
|
* @license
|
|
827
820
|
* Copyright 2017 Google LLC
|
|
@@ -879,6 +872,20 @@ function createProcessedStylesheet(cssText) {
|
|
|
879
872
|
}
|
|
880
873
|
// Default stylesheet for standalone lit-ui-kit usage (no namespace context).
|
|
881
874
|
const defaultStylesheet = createProcessedStylesheet(css_248z);
|
|
875
|
+
/**
|
|
876
|
+
* The processed Tailwind CSS text from this bundle. Each SDK bundle gets a
|
|
877
|
+
* different value because their PostCSS configs differ (e.g. rem-to-px).
|
|
878
|
+
* Import this and pass it to `registerStylesheet` in your SDK entry point.
|
|
879
|
+
*/
|
|
880
|
+
const twStyleText = css_248z;
|
|
881
|
+
/**
|
|
882
|
+
* Register a namespaced stylesheet. Components inside an ancestor element with
|
|
883
|
+
* `data-tw-namespace="<namespace>"` will adopt this stylesheet instead of the
|
|
884
|
+
* default one.
|
|
885
|
+
*/
|
|
886
|
+
function registerStylesheet(namespace, cssText) {
|
|
887
|
+
getRegistry().set(namespace, createProcessedStylesheet(cssText));
|
|
888
|
+
}
|
|
882
889
|
/**
|
|
883
890
|
* Namespace resolution — walks up through shadow DOM boundaries to find the
|
|
884
891
|
* nearest ancestor with a `data-tw-namespace` attribute.
|
|
@@ -5502,8 +5509,8 @@ __decorate([
|
|
|
5502
5509
|
e('.search-input'),
|
|
5503
5510
|
__metadata("design:type", HTMLInputElement)
|
|
5504
5511
|
], SearchBox.prototype, "searchInput", void 0);
|
|
5505
|
-
if (!customElements.get('
|
|
5506
|
-
customElements.define('
|
|
5512
|
+
if (!customElements.get('evs-box')) {
|
|
5513
|
+
customElements.define('evs-box', SearchBox);
|
|
5507
5514
|
}
|
|
5508
5515
|
|
|
5509
5516
|
const trendingSearchesStyles = i$3 `
|
|
@@ -5635,8 +5642,8 @@ __decorate([
|
|
|
5635
5642
|
n$1({ type: String }),
|
|
5636
5643
|
__metadata("design:type", Object)
|
|
5637
5644
|
], TrendingSearches.prototype, "trendingTitle", void 0);
|
|
5638
|
-
if (!customElements.get('trending
|
|
5639
|
-
customElements.define('trending
|
|
5645
|
+
if (!customElements.get('evs-trending')) {
|
|
5646
|
+
customElements.define('evs-trending', TrendingSearches);
|
|
5640
5647
|
}
|
|
5641
5648
|
|
|
5642
5649
|
const productCardStyles = i$3 `
|
|
@@ -5845,8 +5852,8 @@ __decorate([
|
|
|
5845
5852
|
n$1({ type: String }),
|
|
5846
5853
|
__metadata("design:type", Object)
|
|
5847
5854
|
], ProductCard.prototype, "userId", void 0);
|
|
5848
|
-
if (!customElements.get('product-card')) {
|
|
5849
|
-
customElements.define('product-card', ProductCard);
|
|
5855
|
+
if (!customElements.get('evs-product-card')) {
|
|
5856
|
+
customElements.define('evs-product-card', ProductCard);
|
|
5850
5857
|
}
|
|
5851
5858
|
|
|
5852
5859
|
const handpickedProductsStyles = i$3 `
|
|
@@ -5908,7 +5915,7 @@ const handpickedProductsStyles = i$3 `
|
|
|
5908
5915
|
display: none;
|
|
5909
5916
|
}
|
|
5910
5917
|
|
|
5911
|
-
.products-carousel product-card {
|
|
5918
|
+
.products-carousel evs-product-card {
|
|
5912
5919
|
flex-shrink: 0;
|
|
5913
5920
|
width: 10em;
|
|
5914
5921
|
}
|
|
@@ -6041,11 +6048,11 @@ class HandpickedProducts extends ElementWithStylesheet {
|
|
|
6041
6048
|
|
|
6042
6049
|
<div class="products-carousel" @scroll=${this.updateScrollButtons}>
|
|
6043
6050
|
${this.products.map((product) => b `
|
|
6044
|
-
<product-card
|
|
6051
|
+
<evs-product-card
|
|
6045
6052
|
.css=${this.css}
|
|
6046
6053
|
.product=${product}
|
|
6047
6054
|
.userId=${this.userId}
|
|
6048
|
-
></product-card>
|
|
6055
|
+
></evs-product-card>
|
|
6049
6056
|
`)}
|
|
6050
6057
|
</div>
|
|
6051
6058
|
|
|
@@ -6099,8 +6106,8 @@ __decorate([
|
|
|
6099
6106
|
r$1(),
|
|
6100
6107
|
__metadata("design:type", Object)
|
|
6101
6108
|
], HandpickedProducts.prototype, "canScrollRight", void 0);
|
|
6102
|
-
if (!customElements.get('handpicked
|
|
6103
|
-
customElements.define('handpicked
|
|
6109
|
+
if (!customElements.get('evs-handpicked')) {
|
|
6110
|
+
customElements.define('evs-handpicked', HandpickedProducts);
|
|
6104
6111
|
}
|
|
6105
6112
|
|
|
6106
6113
|
const searchDropdownStyles = i$3 `
|
|
@@ -6364,8 +6371,8 @@ __decorate([
|
|
|
6364
6371
|
r$1(),
|
|
6365
6372
|
__metadata("design:type", Object)
|
|
6366
6373
|
], SearchDropdown.prototype, "selectedIndex", void 0);
|
|
6367
|
-
if (!customElements.get('
|
|
6368
|
-
customElements.define('
|
|
6374
|
+
if (!customElements.get('evs-dropdown')) {
|
|
6375
|
+
customElements.define('evs-dropdown', SearchDropdown);
|
|
6369
6376
|
}
|
|
6370
6377
|
|
|
6371
6378
|
const searchWidgetStyles = i$3 `
|
|
@@ -6440,7 +6447,7 @@ const searchWidgetStyles = i$3 `
|
|
|
6440
6447
|
}
|
|
6441
6448
|
`;
|
|
6442
6449
|
|
|
6443
|
-
|
|
6450
|
+
class SearchWidget extends ElementWithStylesheet {
|
|
6444
6451
|
constructor() {
|
|
6445
6452
|
super(...arguments);
|
|
6446
6453
|
this.placeholder = 'Search...';
|
|
@@ -6465,10 +6472,7 @@ let SearchWidget = class SearchWidget extends ElementWithStylesheet {
|
|
|
6465
6472
|
}
|
|
6466
6473
|
focusSearchBox() {
|
|
6467
6474
|
var _a;
|
|
6468
|
-
|
|
6469
|
-
if (searchBox) {
|
|
6470
|
-
searchBox.focusInput();
|
|
6471
|
-
}
|
|
6475
|
+
(_a = this.searchBox) === null || _a === void 0 ? void 0 : _a.focusInput();
|
|
6472
6476
|
}
|
|
6473
6477
|
handleSearchInput(e) {
|
|
6474
6478
|
const { query } = e.detail;
|
|
@@ -6620,7 +6624,7 @@ let SearchWidget = class SearchWidget extends ElementWithStylesheet {
|
|
|
6620
6624
|
<div class="search-widget-container">
|
|
6621
6625
|
<!-- Search Box Wrapper -->
|
|
6622
6626
|
<div class="search-box-wrapper">
|
|
6623
|
-
<
|
|
6627
|
+
<evs-box
|
|
6624
6628
|
.css=${this.css}
|
|
6625
6629
|
.query=${this.searchQuery}
|
|
6626
6630
|
placeholder=${this.placeholder}
|
|
@@ -6629,33 +6633,33 @@ let SearchWidget = class SearchWidget extends ElementWithStylesheet {
|
|
|
6629
6633
|
@search-input=${this.handleSearchInput}
|
|
6630
6634
|
@search-submit=${this.handleSearchSubmit}
|
|
6631
6635
|
@search-close=${this.handleSearchClose}
|
|
6632
|
-
></
|
|
6636
|
+
></evs-box>
|
|
6633
6637
|
</div>
|
|
6634
6638
|
|
|
6635
6639
|
<div class="content-container">
|
|
6636
6640
|
${this.dropdownVisible
|
|
6637
6641
|
? b `
|
|
6638
|
-
<
|
|
6642
|
+
<evs-dropdown
|
|
6639
6643
|
.css=${this.css}
|
|
6640
6644
|
.suggestions=${this.suggestions}
|
|
6641
6645
|
.query=${this.searchQuery}
|
|
6642
6646
|
.loading=${this.dropdownLoading}
|
|
6643
6647
|
.visible=${this.dropdownVisible}
|
|
6644
6648
|
@suggestion-click=${this.handleSuggestionClick}
|
|
6645
|
-
></
|
|
6649
|
+
></evs-dropdown>
|
|
6646
6650
|
`
|
|
6647
6651
|
: this.trendingSearches.length > 0
|
|
6648
6652
|
? b `
|
|
6649
|
-
<trending
|
|
6653
|
+
<evs-trending
|
|
6650
6654
|
.css=${this.css}
|
|
6651
6655
|
.searches=${this.trendingSearches}
|
|
6652
6656
|
.trendingTitle=${this.trendingSearchesTitle}
|
|
6653
6657
|
@trending-search-click=${this.handleTrendingSearchClick}
|
|
6654
|
-
></trending
|
|
6658
|
+
></evs-trending>
|
|
6655
6659
|
`
|
|
6656
6660
|
: ''}
|
|
6657
6661
|
|
|
6658
|
-
<handpicked
|
|
6662
|
+
<evs-handpicked
|
|
6659
6663
|
.css=${this.css}
|
|
6660
6664
|
.products=${this.dropdownVisible && this.searchProducts.length > 0
|
|
6661
6665
|
? this.searchProducts
|
|
@@ -6664,12 +6668,12 @@ let SearchWidget = class SearchWidget extends ElementWithStylesheet {
|
|
|
6664
6668
|
this.searchProducts.length > 0}
|
|
6665
6669
|
.trendingTitle=${this.handpickedProductsTitle}
|
|
6666
6670
|
.userId=${this.userId}
|
|
6667
|
-
></handpicked
|
|
6671
|
+
></evs-handpicked>
|
|
6668
6672
|
</div>
|
|
6669
6673
|
</div>
|
|
6670
6674
|
`;
|
|
6671
6675
|
}
|
|
6672
|
-
}
|
|
6676
|
+
}
|
|
6673
6677
|
SearchWidget.styles = searchWidgetStyles;
|
|
6674
6678
|
__decorate([
|
|
6675
6679
|
n$1({ type: String }),
|
|
@@ -6727,11 +6731,12 @@ __decorate([
|
|
|
6727
6731
|
r$1(),
|
|
6728
6732
|
__metadata("design:type", Object)
|
|
6729
6733
|
], SearchWidget.prototype, "isHandlingSuggestionClick", void 0);
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6734
|
+
__decorate([
|
|
6735
|
+
e('evs-box'),
|
|
6736
|
+
__metadata("design:type", SearchBox)
|
|
6737
|
+
], SearchWidget.prototype, "searchBox", void 0);
|
|
6738
|
+
if (!customElements.get('evs-widget')) {
|
|
6739
|
+
customElements.define('evs-widget', SearchWidget);
|
|
6735
6740
|
}
|
|
6736
6741
|
|
|
6737
6742
|
const scrollBarStyles = i$3 `
|
|
@@ -6776,6 +6781,11 @@ const evoSearchStyles = i$3 `
|
|
|
6776
6781
|
width: 100vw;
|
|
6777
6782
|
height: 100vh;
|
|
6778
6783
|
z-index: 9999;
|
|
6784
|
+
display: none;
|
|
6785
|
+
}
|
|
6786
|
+
|
|
6787
|
+
:host([open]) {
|
|
6788
|
+
display: block;
|
|
6779
6789
|
}
|
|
6780
6790
|
|
|
6781
6791
|
* {
|
|
@@ -6799,7 +6809,10 @@ const evoSearchStyles = i$3 `
|
|
|
6799
6809
|
}
|
|
6800
6810
|
`;
|
|
6801
6811
|
|
|
6802
|
-
|
|
6812
|
+
// Register EvoSearch's Tailwind stylesheet so child components adopt it instead
|
|
6813
|
+
// of another SDK's sheet when multiple Blotout providers load on the same page.
|
|
6814
|
+
registerStylesheet('evo-search', twStyleText);
|
|
6815
|
+
class EvoSearch extends ElementWithStylesheet {
|
|
6803
6816
|
constructor() {
|
|
6804
6817
|
super(...arguments);
|
|
6805
6818
|
this.open = false;
|
|
@@ -6855,7 +6868,7 @@ let EvoSearch = class EvoSearch extends ElementWithStylesheet {
|
|
|
6855
6868
|
}
|
|
6856
6869
|
return b `
|
|
6857
6870
|
<div class="overlay-backdrop" @click=${this.handleBackdropClick}>
|
|
6858
|
-
<
|
|
6871
|
+
<evs-widget
|
|
6859
6872
|
.css=${this.css}
|
|
6860
6873
|
.trendingSearches=${this.trendingSearches}
|
|
6861
6874
|
.handpickedProducts=${this.handpickedProducts}
|
|
@@ -6886,14 +6899,14 @@ let EvoSearch = class EvoSearch extends ElementWithStylesheet {
|
|
|
6886
6899
|
}}
|
|
6887
6900
|
@product-click=${this.handleProductClick}
|
|
6888
6901
|
@search-close=${this.handleClose}
|
|
6889
|
-
></
|
|
6902
|
+
></evs-widget>
|
|
6890
6903
|
</div>
|
|
6891
6904
|
`;
|
|
6892
6905
|
}
|
|
6893
|
-
}
|
|
6906
|
+
}
|
|
6894
6907
|
EvoSearch.styles = evoSearchStyles;
|
|
6895
6908
|
__decorate([
|
|
6896
|
-
n$1({ type: Boolean }),
|
|
6909
|
+
n$1({ type: Boolean, reflect: true }),
|
|
6897
6910
|
__metadata("design:type", Object)
|
|
6898
6911
|
], EvoSearch.prototype, "open", void 0);
|
|
6899
6912
|
__decorate([
|
|
@@ -6916,16 +6929,45 @@ __decorate([
|
|
|
6916
6929
|
n$1({ type: Object }),
|
|
6917
6930
|
__metadata("design:type", Object)
|
|
6918
6931
|
], EvoSearch.prototype, "uiPreferences", void 0);
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
], EvoSearch);
|
|
6922
|
-
if (!customElements.get('evo-search')) {
|
|
6923
|
-
customElements.define('evo-search', EvoSearch);
|
|
6932
|
+
if (!customElements.get('evs-search')) {
|
|
6933
|
+
customElements.define('evs-search', EvoSearch);
|
|
6924
6934
|
}
|
|
6925
6935
|
|
|
6926
6936
|
var _a, _b;
|
|
6927
6937
|
var _c;
|
|
6928
6938
|
let evoSearch;
|
|
6939
|
+
let trendingController;
|
|
6940
|
+
let trendingFetched = false;
|
|
6941
|
+
const tryFetchTrending = (target) => {
|
|
6942
|
+
if (!target.api || trendingFetched || trendingController) {
|
|
6943
|
+
return;
|
|
6944
|
+
}
|
|
6945
|
+
const controller = new AbortController();
|
|
6946
|
+
trendingController = controller;
|
|
6947
|
+
target.api
|
|
6948
|
+
.trending(controller.signal)
|
|
6949
|
+
.then((data) => {
|
|
6950
|
+
var _a, _b, _c, _d;
|
|
6951
|
+
trendingFetched = true;
|
|
6952
|
+
if (data.trending && data.trending.length > 0) {
|
|
6953
|
+
target.trendingSearches = data.trending;
|
|
6954
|
+
}
|
|
6955
|
+
if (data.recommended_products && data.recommended_products.length > 0) {
|
|
6956
|
+
target.handpickedProducts = data.recommended_products.map(mapAPIProductToSDKProduct);
|
|
6957
|
+
}
|
|
6958
|
+
logger.info(`EvoSearch: Loaded ${(_b = (_a = data.trending) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0} trending, ${(_d = (_c = data.recommended_products) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0} products`);
|
|
6959
|
+
})
|
|
6960
|
+
.catch((error) => {
|
|
6961
|
+
if (error instanceof Error && error.name === 'AbortError')
|
|
6962
|
+
return;
|
|
6963
|
+
logger.error('EvoSearch: Failed to fetch trending', error);
|
|
6964
|
+
})
|
|
6965
|
+
.finally(() => {
|
|
6966
|
+
if (trendingController === controller) {
|
|
6967
|
+
trendingController = undefined;
|
|
6968
|
+
}
|
|
6969
|
+
});
|
|
6970
|
+
};
|
|
6929
6971
|
if (typeof window != 'undefined' && typeof document != 'undefined') {
|
|
6930
6972
|
(_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
|
|
6931
6973
|
(_b = (_c = window[registryKey]).ui) !== null && _b !== void 0 ? _b : (_c.ui = {
|
|
@@ -6934,30 +6976,35 @@ if (typeof window != 'undefined' && typeof document != 'undefined') {
|
|
|
6934
6976
|
logger.log('EvoSearch already initialized');
|
|
6935
6977
|
return;
|
|
6936
6978
|
}
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
loadUI() {
|
|
6946
|
-
if (!evoSearch) {
|
|
6947
|
-
logger.error('EvoSearch not initialized!');
|
|
6948
|
-
return;
|
|
6979
|
+
const newEvoSearch = document.createElement('evs-search');
|
|
6980
|
+
newEvoSearch.uiPreferences = params === null || params === void 0 ? void 0 : params.uiPreferences;
|
|
6981
|
+
newEvoSearch.userId = params === null || params === void 0 ? void 0 : params.userId;
|
|
6982
|
+
newEvoSearch.trendingSearches = (params === null || params === void 0 ? void 0 : params.trendingSearches) || [];
|
|
6983
|
+
newEvoSearch.handpickedProducts = (params === null || params === void 0 ? void 0 : params.handpickedProducts) || [];
|
|
6984
|
+
newEvoSearch.api = params === null || params === void 0 ? void 0 : params.api;
|
|
6985
|
+
if (document.body) {
|
|
6986
|
+
document.body.append(newEvoSearch);
|
|
6949
6987
|
}
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6988
|
+
else {
|
|
6989
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
6990
|
+
// Race guard: destroy() may have superseded this instance between init() and DOMContentLoaded.
|
|
6991
|
+
if (evoSearch !== newEvoSearch)
|
|
6992
|
+
return;
|
|
6993
|
+
document.body.append(newEvoSearch);
|
|
6994
|
+
}, { once: true });
|
|
6953
6995
|
}
|
|
6954
|
-
|
|
6955
|
-
|
|
6996
|
+
tryFetchTrending(newEvoSearch);
|
|
6997
|
+
// Assign last so any throw above leaves `evoSearch` undefined and future init() retries can recover.
|
|
6998
|
+
evoSearch = newEvoSearch;
|
|
6999
|
+
logger.info('EvoSearch initialized');
|
|
6956
7000
|
},
|
|
6957
7001
|
destroy() {
|
|
6958
7002
|
if (!evoSearch) {
|
|
6959
7003
|
return;
|
|
6960
7004
|
}
|
|
7005
|
+
trendingController === null || trendingController === void 0 ? void 0 : trendingController.abort();
|
|
7006
|
+
trendingController = undefined;
|
|
7007
|
+
trendingFetched = false;
|
|
6961
7008
|
evoSearch.remove();
|
|
6962
7009
|
evoSearch = undefined;
|
|
6963
7010
|
resetRegistry();
|
|
@@ -6970,26 +7017,10 @@ if (typeof window != 'undefined' && typeof document != 'undefined') {
|
|
|
6970
7017
|
}
|
|
6971
7018
|
if (!evoSearch.parentNode) {
|
|
6972
7019
|
document.body.append(evoSearch);
|
|
6973
|
-
if (evoSearch.api && evoSearch.trendingSearches.length === 0) {
|
|
6974
|
-
evoSearch.api
|
|
6975
|
-
.trending()
|
|
6976
|
-
.then((data) => {
|
|
6977
|
-
if (data.trending && data.trending.length > 0) {
|
|
6978
|
-
evoSearch.trendingSearches = data.trending;
|
|
6979
|
-
}
|
|
6980
|
-
if (data.recommended_products &&
|
|
6981
|
-
data.recommended_products.length > 0) {
|
|
6982
|
-
evoSearch.handpickedProducts = data.recommended_products.map(mapAPIProductToSDKProduct);
|
|
6983
|
-
}
|
|
6984
|
-
logger.info(`EvoSearch: Loaded ${data.trending.length} trending, ${data.recommended_products.length} products`);
|
|
6985
|
-
})
|
|
6986
|
-
.catch((error) => {
|
|
6987
|
-
logger.error('EvoSearch: Failed to fetch trending', error);
|
|
6988
|
-
});
|
|
6989
|
-
}
|
|
6990
7020
|
}
|
|
6991
|
-
evoSearch
|
|
7021
|
+
tryFetchTrending(evoSearch);
|
|
6992
7022
|
evoSearch.open = true;
|
|
7023
|
+
evoSearch.style.display = '';
|
|
6993
7024
|
logger.info('EvoSearch shown');
|
|
6994
7025
|
},
|
|
6995
7026
|
hide() {
|