@searchstax-inc/searchstudio-ux-react 1.0.6 → 1.0.7

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.
@@ -876,7 +876,7 @@ class Wt {
876
876
  order: "",
877
877
  facets: [],
878
878
  additionalProps: []
879
- })), h(this, "$searchRelatedSearches", new D(null)), h(this, "$searchInputConfig", new D(null)), h(this, "$searchExternalPromotions", new D(null)), h(this, "$facetsTemplateData", new D(null)), h(this, "$selectedFacetsTemplateData", new D(null)), h(this, "$paginationData", new D(null)), h(this, "$searchFeedbackData", new D(null)), h(this, "$searchSortingData", new D(null)), h(this, "$searchRelatedSearchesData", new D(null)), h(this, "$searchExternalPromotionsData", new D(null)), h(this, "$cookiesDisabled", new D(null)), h(this, "$answer", new D("")), h(this, "$language", new D("en")), h(this, "currentPageValue", 1), h(this, "isAnswerWidgetCreatedValue", !1), h(this, "renderingEngineValue", W.mustache), h(this, "parsedData", new Bt(this)), h(this, "sessionId"), h(this, "sessionIdValue", null), h(this, "autoCorrect", !0), h(this, "forceNotCorrect", !1), h(this, "lastSearchValue", ""), h(this, "turnAIAnswerGenerationOn", !1), h(this, "isInfiniteScroll", !1), h(this, "firstSearchHappened", !1), h(this, "facetsWereSet", !1), this.sessionId = e, t && (this.sessionIdValue = t), this.cookieHandlingCallback(t), this.$cookiesDisabled.subscribe(() => {
879
+ })), h(this, "$searchRelatedSearches", new D(null)), h(this, "$searchInputConfig", new D(null)), h(this, "$searchExternalPromotions", new D(null)), h(this, "$facetsTemplateData", new D(null)), h(this, "$selectedFacetsTemplateData", new D(null)), h(this, "$paginationData", new D(null)), h(this, "$searchFeedbackData", new D(null)), h(this, "$searchSortingData", new D(null)), h(this, "$searchRelatedSearchesData", new D(null)), h(this, "$searchExternalPromotionsData", new D(null)), h(this, "$cookiesDisabled", new D(null)), h(this, "$answer", new D("")), h(this, "$language", new D("en")), h(this, "currentPageValue", 1), h(this, "isAnswerWidgetCreatedValue", !1), h(this, "renderingEngineValue", W.mustache), h(this, "parsedData", new Bt(this)), h(this, "sessionId"), h(this, "sessionIdValue", null), h(this, "autoCorrect", !0), h(this, "forceNotCorrect", !1), h(this, "lastSearchValue", ""), h(this, "turnAIAnswerGenerationOn", !1), h(this, "isInfiniteScroll", !1), h(this, "firstSearchHappened", !1), h(this, "facetsWereSet", !1), h(this, "searchHelper"), this.sessionId = e, t && (this.sessionIdValue = t), this.cookieHandlingCallback(t), this.$cookiesDisabled.subscribe(() => {
880
880
  this.cookieHandlingCallback(t);
881
881
  });
882
882
  }
@@ -1329,7 +1329,7 @@ class Ut {
1329
1329
  s = s.concat("fq=" + o.trim());
1330
1330
  }
1331
1331
  }
1332
- return s = s.map((a) => a.replace(/&/g, "%26").replace(/\+/g, "%2B")), console.log(s), s.length ? "&" + s.join("&") : "";
1332
+ return s = s.map((a) => a.replace(/&/g, "%26").replace(/\+/g, "%2B")), s.length ? "&" + s.join("&") : "";
1333
1333
  }
1334
1334
  getRelatedSearches(e, t, s, a) {
1335
1335
  const r = new Headers();
@@ -2760,7 +2760,7 @@ class Sa {
2760
2760
  }
2761
2761
  class Ca {
2762
2762
  constructor(e) {
2763
- h(this, "dataLayer"), h(this, "config"), h(this, "suggestAfterMinChars"), h(this, "containerId"), h(this, "currentInputValue", ""), h(this, "autosuggestResults"), h(this, "searchInput"), h(this, "actionButton"), h(this, "autosuggestContainer"), h(this, "buttonState", "search"), h(this, "selectedAutosuggestItem", -1), h(this, "suggestTrigger"), h(this, "searchTrigger"), this.dataLayer = e.dataLayer, this.config = e.config, this.searchTrigger = e.searchTrigger, this.suggestTrigger = e.suggestTrigger, this.containerId = e.containerId, this.suggestAfterMinChars = e.config.suggestAfterMinChars, this.renderMainTemplate(), this.actionButtonInit(), this.updateActionButtonState("search"), this.searchInput && (this.createAutosuggestContainer(), this.attachSubscriptions());
2763
+ h(this, "searchHelper"), h(this, "dataLayer"), h(this, "config"), h(this, "suggestAfterMinChars"), h(this, "containerId"), h(this, "currentInputValue", ""), h(this, "autosuggestResults"), h(this, "searchInput"), h(this, "actionButton"), h(this, "autosuggestContainer"), h(this, "buttonState", "search"), h(this, "selectedAutosuggestItem", -1), h(this, "suggestTrigger"), h(this, "searchTrigger"), this.dataLayer = e.dataLayer, this.config = e.config, this.searchTrigger = e.searchTrigger, this.suggestTrigger = e.suggestTrigger, this.containerId = e.containerId, this.suggestAfterMinChars = e.config.suggestAfterMinChars, this.suggestAfterMinChars === void 0 && this.getSuggestAfterValue(), this.renderMainTemplate(), this.actionButtonInit(), this.updateActionButtonState("search"), this.searchInput && (this.createAutosuggestContainer(), this.attachSubscriptions());
2764
2764
  }
2765
2765
  renderMainTemplate() {
2766
2766
  var e, t, s, a;
@@ -2788,6 +2788,15 @@ class Ca {
2788
2788
  this.resetAutosuggestSelection(), this.markActiveAutosuggestItem();
2789
2789
  }), (e = this.searchInput) == null || e.after(this.autosuggestContainer));
2790
2790
  }
2791
+ getSuggestAfterValue() {
2792
+ this.dataLayer.searchHelper && this.dataLayer.searchHelper.suggest(
2793
+ "*",
2794
+ (e) => {
2795
+ this.suggestAfterMinChars = e.metadata.minPrefixChars;
2796
+ },
2797
+ []
2798
+ );
2799
+ }
2791
2800
  actionButtonInit() {
2792
2801
  typeof document < "u" && (this.actionButton = document == null ? void 0 : document.getElementById(
2793
2802
  "searchstax-search-input-action-button"
@@ -2855,7 +2864,7 @@ class Ca {
2855
2864
  this.currentInputValue = e.target.value, t === "Enter" ? this.suggestionChosen() : t === "Escape" ? this.hideAutosuggest() : t === "ArrowUp" ? this.selectPreviousAutosuggestItem() : t === "ArrowDown" ? this.selectNextAutosuggestItem() : this.autosuggestHandling(e), this.handleSearchTermChange();
2856
2865
  }
2857
2866
  autosuggestHandling(e) {
2858
- e.target && e.target.value.length >= this.suggestAfterMinChars ? this.executeSuggest(e.target.value) : this.hideAutosuggest();
2867
+ this.suggestAfterMinChars && e.target && e.target.value.length >= this.suggestAfterMinChars ? this.executeSuggest(e.target.value) : this.hideAutosuggest();
2859
2868
  }
2860
2869
  inputPasteEvent(e) {
2861
2870
  setTimeout(() => {
@@ -3120,7 +3129,7 @@ class Ra {
3120
3129
  if (this.dataLayer = new Wt("searchstax_session_id", e.sessionId), this.renderEngine && this.dataLayer.setRenderingEngine(this.renderEngine), this.handleHooks(), e.analyticsBaseUrl && typeof window < "u" && (window.analyticsBaseUrl = e.analyticsBaseUrl, window._msq = e._msq || [], this.attachAnalyticsScript(e.analyticsSrc)), e.turnAIAnswerGenerationOn === !0 && (this.dataLayer.turnAIAnswerGenerationOn = !0), e.autoCorrect === !1 && (this.dataLayer.autoCorrect = !1), e.language && this.dataLayer.setLanguage(e.language), this.dataLayer.searchstaxConfig || (this.dataLayer.setSearchstaxConfig(e), this.searchHelper = new Ut(
3121
3130
  { ...e, sessionId: this.dataLayer.sessionId },
3122
3131
  this.dataLayer
3123
- )), ((t = e.router) == null ? void 0 : t.enabled) === void 0 || ((s = e.router) == null ? void 0 : s.enabled) === !0) {
3132
+ ), this.dataLayer.searchHelper = this.searchHelper), ((t = e.router) == null ? void 0 : t.enabled) === void 0 || ((s = e.router) == null ? void 0 : s.enabled) === !0) {
3124
3133
  this.routerEnabled = !0, this.routerHelper = new nt(
3125
3134
  e.router ? e.router : { enabled: !0 }
3126
3135
  );
@@ -3337,7 +3346,7 @@ function Ea(n) {
3337
3346
  if (a(), S.searchstax) {
3338
3347
  const o = {};
3339
3348
  n.afterAutosuggest && (o.afterAutosuggest = n.afterAutosuggest), n.beforeAutosuggest && (o.beforeAutosuggest = n.beforeAutosuggest), S.searchstax.addSearchInputWidget("searchstax-input-container", {
3340
- suggestAfterMinChars: n.suggestAfterMinChars ?? 3,
3349
+ suggestAfterMinChars: n.suggestAfterMinChars,
3341
3350
  hooks: o,
3342
3351
  templates: {
3343
3352
  mainTemplate: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@searchstax-inc/searchstudio-ux-react",
3
3
  "private": false,
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "type": "module",
6
6
  "main": "./dist/@searchstax-inc/searchstudio-ux-react.cjs",
7
7
  "module": "./dist/@searchstax-inc/searchstudio-ux-react.mjs",
@@ -22,7 +22,7 @@
22
22
  "preview": "vite preview"
23
23
  },
24
24
  "dependencies": {
25
- "@searchstax-inc/searchstudio-ux-js": "npm:@searchstax-inc/searchstudio-ux-js@^1.0.11",
25
+ "@searchstax-inc/searchstudio-ux-js": "npm:@searchstax-inc/searchstudio-ux-js@^1.0.12",
26
26
  "react": "^18.2.0",
27
27
  "react-dom": "^18.2.0"
28
28
  },