@blotoutio/providers-evo-search-sdk 1.65.2 → 1.66.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.mjs CHANGED
@@ -1,3 +1,23 @@
1
+ // When the Search tab offers Ask AI alongside its results. `always`: on every
2
+ // result set (the default — the tab pill alone doesn't read as an offer).
3
+ // `weak`: only when retrieval had no lexical anchor, i.e. the response's
4
+ // `signals.bm25` is false, so the products on screen are a semantic guess.
5
+ // `never`: the search results never mention Ask AI (the zero-result recovery
6
+ // CTA is unaffected — that one is a dead end, not a nudge).
7
+ // The tuple is the single source of truth: the API payload enum, the worker's
8
+ // write validator and the manifest coercion all derive from it, so adding a
9
+ // mode can't leave one layer rejecting it.
10
+ // Default on: the segmented tab pill alone doesn't read as an offer, which is
11
+ // the whole reason the nudge exists. Merchants dial it back to 'weak'/'never'.
12
+ const DEFAULT_ASK_NUDGE_MODE = 'always';
13
+ // Merchant-authored label for the nudge. `{query}` is substituted with the
14
+ // shopper's search terms; a label without the token renders verbatim, which is
15
+ // the escape hatch for merchants who don't want the query echoed back.
16
+ // Substitution happens through Lit text bindings, so the query is escaped —
17
+ // never interpolate this into markup.
18
+ const ASK_NUDGE_QUERY_TOKEN = '{query}';
19
+ const DEFAULT_ASK_NUDGE_LABEL = `Ask AI about ${ASK_NUDGE_QUERY_TOKEN}`;
20
+
1
21
  /**
2
22
  * Known ad-network click ID query parameters and the human-readable provider
3
23
  * label each one maps to. Used by the CDN worker to resolve `inSessionTouch`
@@ -628,7 +648,7 @@ const setStoredSearchMode = (mode) => {
628
648
  const searchSessionKeyName = 'evoSearchSession';
629
649
  const SEARCH_SESSION_VERSION = 1;
630
650
  const getStoredSearchSession = () => {
631
- var _a, _b, _c, _d, _e, _f, _g;
651
+ var _a, _b, _c, _d, _e, _f, _g, _h;
632
652
  try {
633
653
  const raw = sessionStorage.getItem(searchSessionKeyName);
634
654
  if (!raw) {
@@ -650,10 +670,12 @@ const getStoredSearchSession = () => {
650
670
  suggestions: (_a = parsed.suggestions) !== null && _a !== void 0 ? _a : [],
651
671
  products: (_b = parsed.products) !== null && _b !== void 0 ? _b : [],
652
672
  collections: (_c = parsed.collections) !== null && _c !== void 0 ? _c : [],
653
- askAnswer: (_d = parsed.askAnswer) !== null && _d !== void 0 ? _d : '',
654
- askEvidence: (_e = parsed.askEvidence) !== null && _e !== void 0 ? _e : null,
655
- askFollowUps: (_f = parsed.askFollowUps) !== null && _f !== void 0 ? _f : [],
656
- askCitedTitles: (_g = parsed.askCitedTitles) !== null && _g !== void 0 ? _g : [],
673
+ // Absent on pre-nudge snapshots — true matches the widget's own default.
674
+ hadLexicalMatch: (_d = parsed.hadLexicalMatch) !== null && _d !== void 0 ? _d : true,
675
+ askAnswer: (_e = parsed.askAnswer) !== null && _e !== void 0 ? _e : '',
676
+ askEvidence: (_f = parsed.askEvidence) !== null && _f !== void 0 ? _f : null,
677
+ askFollowUps: (_g = parsed.askFollowUps) !== null && _g !== void 0 ? _g : [],
678
+ askCitedTitles: (_h = parsed.askCitedTitles) !== null && _h !== void 0 ? _h : [],
657
679
  };
658
680
  }
659
681
  catch {
@@ -1427,6 +1449,7 @@ const init = (params) => {
1427
1449
  const tag = ({ data }) => {
1428
1450
  try {
1429
1451
  return {
1452
+ sdkVersion: "1.66.0" || '',
1430
1453
  searchQuery: data['searchQuery'],
1431
1454
  searchResults: data['searchResults'],
1432
1455
  timestamp: Date.now(),
@@ -1435,6 +1458,7 @@ const tag = ({ data }) => {
1435
1458
  catch (err) {
1436
1459
  console.error(`EvoSearch SDK: Tagging failed - ${err}`);
1437
1460
  return {
1461
+ sdkVersion: "1.66.0" ,
1438
1462
  timestamp: Date.now(),
1439
1463
  };
1440
1464
  }
@@ -7564,12 +7588,12 @@ const stateBlockStyles = i$6 `
7564
7588
 
7565
7589
  /* The AI rescue is the primary recovery on a dead-end search. */
7566
7590
  .chip-ask {
7567
- background: var(--evosearch-ask-accent, #2563eb);
7591
+ background: var(--evosearch-ask-accent, #7c3aed);
7568
7592
  color: #ffffff;
7569
7593
  }
7570
7594
 
7571
7595
  .chip-ask:hover {
7572
- background: var(--evosearch-ask-accent, #2563eb);
7596
+ background: var(--evosearch-ask-accent, #7c3aed);
7573
7597
  filter: brightness(0.95);
7574
7598
  }
7575
7599
 
@@ -7838,7 +7862,7 @@ const searchWidgetStyles = i$6 `
7838
7862
  /* Ask mode swaps the active accent; everything inside the container reads
7839
7863
  var(--evosearch-mode-accent) (custom props inherit to evs-box + cards). */
7840
7864
  .search-widget-container[data-mode='ask'] {
7841
- --evosearch-mode-accent: var(--evosearch-ask-accent, #2563eb);
7865
+ --evosearch-mode-accent: var(--evosearch-ask-accent, #7c3aed);
7842
7866
  }
7843
7867
 
7844
7868
  /* The theme font reaches form controls (which don't inherit it by default). */
@@ -8088,6 +8112,12 @@ const searchWidgetStyles = i$6 `
8088
8112
  max-height: 0;
8089
8113
  opacity: 0;
8090
8114
  pointer-events: none;
8115
+ /* The collapsed row is still a .body child, so the sibling rule above gives
8116
+ it a top margin AND another to whatever follows — 2.25em of dead space
8117
+ stacked around a zero-height element, which reads as a broken gap between
8118
+ the nudge and the results heading. Drop its own margin so the only gap
8119
+ left is the single one the next section is entitled to. */
8120
+ margin-top: 0;
8091
8121
  }
8092
8122
 
8093
8123
  /* inline-block (not flex) so the typed span and the bold completion stay on
@@ -8215,9 +8245,6 @@ const searchWidgetStyles = i$6 `
8215
8245
 
8216
8246
  /* Segmented Results/AI toggle — replaces the "Search with AI" CTA once an
8217
8247
  answer is in memory, letting the shopper flip between the two views. */
8218
- /* Dual-tone segmented control: two equal halves with a thumb that slides
8219
- between them (driven by the container's data-mode). The thumb is neutral
8220
- under Search and gains an amethyst→indigo wash under Ask AI. */
8221
8248
  /* Compact segmented control living inside the search bar. Two equal halves
8222
8249
  (grid 1fr 1fr) sized to their content so the sliding thumb stays aligned
8223
8250
  at 50%; flex:0 0 auto keeps it from stretching in the header row. */
@@ -8269,13 +8296,17 @@ const searchWidgetStyles = i$6 `
8269
8296
  .search-widget-container[data-mode='ask'] .view-toggle::before {
8270
8297
  transform: translateX(100%);
8271
8298
  border-radius: 0 999px 999px 0;
8272
- background: linear-gradient(
8273
- 135deg,
8274
- rgba(147, 51, 234, 0.12),
8275
- rgba(99, 102, 241, 0.1)
8276
- ),
8277
- #ffffff;
8278
- box-shadow: 0 1px 4px rgba(76, 29, 149, 0.2),
8299
+ background: color-mix(
8300
+ in srgb,
8301
+ var(--evosearch-ask-accent, #7c3aed) 10%,
8302
+ #ffffff
8303
+ );
8304
+ box-shadow: 0 1px 4px
8305
+ color-mix(
8306
+ in srgb,
8307
+ var(--evosearch-ask-accent, #7c3aed) 22%,
8308
+ transparent
8309
+ ),
8279
8310
  inset 0 -0.5px 0.5px rgba(10, 13, 18, 0.08);
8280
8311
  }
8281
8312
 
@@ -8311,11 +8342,13 @@ const searchWidgetStyles = i$6 `
8311
8342
  }
8312
8343
 
8313
8344
  .view-toggle-search:focus-visible {
8314
- box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.3);
8345
+ box-shadow: 0 0 0 3px
8346
+ color-mix(in srgb, var(--evosearch-accent, #e0590b) 30%, transparent);
8315
8347
  }
8316
8348
 
8317
8349
  .view-toggle-ai:focus-visible {
8318
- box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.3);
8350
+ box-shadow: 0 0 0 3px
8351
+ color-mix(in srgb, var(--evosearch-ask-accent, #7c3aed) 30%, transparent);
8319
8352
  }
8320
8353
 
8321
8354
  .view-toggle-search:hover:not(.is-active) {
@@ -8323,16 +8356,19 @@ const searchWidgetStyles = i$6 `
8323
8356
  }
8324
8357
 
8325
8358
  .view-toggle-ai:hover:not(.is-active) {
8326
- color: #9333ea;
8359
+ color: var(--evosearch-ask-accent, #7c3aed);
8327
8360
  }
8328
8361
 
8329
- /* Search vs Ask each carry their own accent when active — one coherent system. */
8362
+ /* Each half carries its own accent when active: Search the brand accent, Ask
8363
+ the --evosearch-ask-accent that state-block, the ask-answer rule and the
8364
+ follow-up chips already use — so one colour means "AI" everywhere rather
8365
+ than the toggle inventing a second one. */
8330
8366
  .view-toggle-search.is-active {
8331
- color: var(--evosearch-accent, #ea580c);
8367
+ color: var(--evosearch-accent, #e0590b);
8332
8368
  }
8333
8369
 
8334
8370
  .view-toggle-ai.is-active {
8335
- color: #9333ea;
8371
+ color: var(--evosearch-ask-accent, #7c3aed);
8336
8372
  }
8337
8373
 
8338
8374
  .view-toggle-btn bt-lucide-icon,
@@ -8341,7 +8377,7 @@ const searchWidgetStyles = i$6 `
8341
8377
  }
8342
8378
 
8343
8379
  .ask-answer {
8344
- border-left: 3px solid var(--evosearch-mode-accent, #2563eb);
8380
+ border-left: 3px solid var(--evosearch-mode-accent, #7c3aed);
8345
8381
  padding: 0 0 0 0.75em;
8346
8382
  line-height: 1.5;
8347
8383
  min-height: 1.5em;
@@ -8397,8 +8433,8 @@ const searchWidgetStyles = i$6 `
8397
8433
 
8398
8434
  .ask-starter-chip:hover {
8399
8435
  background: #fcfdfb;
8400
- border-color: var(--evosearch-ask-accent, #2563eb);
8401
- color: var(--evosearch-ask-accent, #2563eb);
8436
+ border-color: var(--evosearch-ask-accent, #7c3aed);
8437
+ color: var(--evosearch-ask-accent, #7c3aed);
8402
8438
  }
8403
8439
 
8404
8440
  .ask-starter-chip:active {
@@ -8496,6 +8532,89 @@ const searchWidgetStyles = i$6 `
8496
8532
  color: rgba(26, 28, 24, 0.6);
8497
8533
  }
8498
8534
 
8535
+ /* The Ask AI offer: a filled band leading the results column, directly under
8536
+ the search bar. It is the first thing in .body, so it is read before the
8537
+ grid is scanned rather than after it disappoints — and it can never be
8538
+ stranded in whitespace under a short result row. */
8539
+ .ask-nudge {
8540
+ appearance: none;
8541
+ display: flex;
8542
+ align-items: center;
8543
+ gap: 0.5em;
8544
+ width: 100%;
8545
+ padding: 0.625em 0.875em;
8546
+ border: 1px solid
8547
+ color-mix(in srgb, var(--evosearch-ask-accent, #7c3aed) 28%, transparent);
8548
+ border-radius: 0.625em;
8549
+ background: color-mix(
8550
+ in srgb,
8551
+ var(--evosearch-ask-accent, #7c3aed) 6%,
8552
+ #ffffff
8553
+ );
8554
+ color: var(--evosearch-ask-accent, #7c3aed);
8555
+ font-size: 0.8125em;
8556
+ font-weight: 600;
8557
+ text-align: left;
8558
+ cursor: pointer;
8559
+ transition: background 0.15s ease, border-color 0.15s ease;
8560
+ }
8561
+
8562
+ .ask-nudge:hover {
8563
+ background: color-mix(
8564
+ in srgb,
8565
+ var(--evosearch-ask-accent, #7c3aed) 11%,
8566
+ #ffffff
8567
+ );
8568
+ border-color: color-mix(
8569
+ in srgb,
8570
+ var(--evosearch-ask-accent, #7c3aed) 42%,
8571
+ transparent
8572
+ );
8573
+ }
8574
+
8575
+ /* The label takes the slack so the trailing arrow sits hard right, and a
8576
+ merchant-authored label that outruns the band ellipsises instead of
8577
+ wrapping it onto a third line. */
8578
+ .ask-nudge-text {
8579
+ flex: 1 1 auto;
8580
+ min-width: 0;
8581
+ overflow: hidden;
8582
+ text-overflow: ellipsis;
8583
+ white-space: nowrap;
8584
+ }
8585
+
8586
+ @supports (background-clip: text) or (-webkit-background-clip: text) {
8587
+ .ask-nudge-text {
8588
+ background: linear-gradient(
8589
+ 100deg,
8590
+ var(--evosearch-ask-accent, #7c3aed),
8591
+ var(--evosearch-ask-accent-alt, #6366f1)
8592
+ );
8593
+ -webkit-background-clip: text;
8594
+ background-clip: text;
8595
+ color: transparent;
8596
+ }
8597
+ }
8598
+
8599
+ /* Amethyst→indigo sweep on the label so the offer reads as generative rather
8600
+ than as a plain link. Guarded by @supports because the fallback for an
8601
+ unsupported background-clip is transparent text, i.e. an invisible CTA —
8602
+ outside the query the solid ask accent from .ask-nudge stands. The sparkle
8603
+ and arrow icons keep currentColor: gradient-filling icon strokes at 14px
8604
+ muddies them, and the solid accent still reads as the same family. */
8605
+ @supports (background-clip: text) or (-webkit-background-clip: text) {
8606
+ .ask-nudge > span {
8607
+ background: linear-gradient(
8608
+ 100deg,
8609
+ var(--evosearch-ask-accent, #7c3aed),
8610
+ var(--evosearch-ask-accent-alt, #6366f1)
8611
+ );
8612
+ -webkit-background-clip: text;
8613
+ background-clip: text;
8614
+ color: transparent;
8615
+ }
8616
+ }
8617
+
8499
8618
  .ask-followups {
8500
8619
  display: flex;
8501
8620
  flex-wrap: wrap;
@@ -8521,6 +8640,7 @@ const searchWidgetStyles = i$6 `
8521
8640
  .chip:focus-visible,
8522
8641
  .chip-remove:focus-visible,
8523
8642
  .suggestion:focus-visible,
8643
+ .ask-nudge:focus-visible,
8524
8644
  .view-toggle-btn:focus-visible,
8525
8645
  .bar-dismiss:focus-visible,
8526
8646
  .ask-starter-chip:focus-visible,
@@ -8537,7 +8657,7 @@ const searchWidgetStyles = i$6 `
8537
8657
  gap: 0.45em;
8538
8658
  border: 0;
8539
8659
  border-radius: 999px;
8540
- background: var(--evosearch-ask-accent, #2563eb);
8660
+ background: var(--evosearch-ask-accent, #7c3aed);
8541
8661
  color: #ffffff;
8542
8662
  font-size: 0.8125em;
8543
8663
  font-weight: 600;
@@ -8633,6 +8753,11 @@ class SearchWidget extends ElementWithStylesheet {
8633
8753
  this.suggestions = [];
8634
8754
  this.searchProducts = [];
8635
8755
  this.searchCollections = [];
8756
+ // Whether the current results had a lexical (BM25) anchor. False means the
8757
+ // grid is a purely semantic guess, which is what `askNudge: 'weak'` targets.
8758
+ // Defaults true so a worker that omits `signals` is treated as a normal
8759
+ // match rather than silently nudging on every query.
8760
+ this.hadLexicalMatch = true;
8636
8761
  this.recents = [];
8637
8762
  this.loading = false;
8638
8763
  this.hasError = false;
@@ -9215,7 +9340,7 @@ class SearchWidget extends ElementWithStylesheet {
9215
9340
  }));
9216
9341
  }
9217
9342
  async performAutocomplete(query) {
9218
- var _a;
9343
+ var _a, _b;
9219
9344
  const generation = ++this.requestGeneration;
9220
9345
  this.hasError = false;
9221
9346
  try {
@@ -9235,6 +9360,7 @@ class SearchWidget extends ElementWithStylesheet {
9235
9360
  this.suggestions = processed.suggestions;
9236
9361
  this.searchProducts = processed.products;
9237
9362
  this.searchCollections = (_a = response.collections) !== null && _a !== void 0 ? _a : [];
9363
+ this.hadLexicalMatch = ((_b = response.signals) === null || _b === void 0 ? void 0 : _b.bm25) !== false;
9238
9364
  this.debouncedQuery = query;
9239
9365
  this.loading = false;
9240
9366
  if (this.finalizeOnRender) {
@@ -9374,6 +9500,7 @@ class SearchWidget extends ElementWithStylesheet {
9374
9500
  this.showSuggestions = false;
9375
9501
  this.searchProducts = [];
9376
9502
  this.searchCollections = [];
9503
+ this.hadLexicalMatch = true;
9377
9504
  this.activeSuggestionIndex = -1;
9378
9505
  // Ask mode renders from a separate state set, so clearing the query alone
9379
9506
  // leaves the previous answer/evidence on screen. Reset it too and abort any
@@ -9475,6 +9602,7 @@ class SearchWidget extends ElementWithStylesheet {
9475
9602
  suggestions: this.suggestions,
9476
9603
  products: this.searchProducts,
9477
9604
  collections: this.searchCollections,
9605
+ hadLexicalMatch: this.hadLexicalMatch,
9478
9606
  askAnswer: this.askAnswer,
9479
9607
  askEvidence: this.askEvidence,
9480
9608
  askFollowUps: this.askFollowUps,
@@ -9495,6 +9623,9 @@ class SearchWidget extends ElementWithStylesheet {
9495
9623
  this.suggestions = snap.suggestions;
9496
9624
  this.searchProducts = snap.products;
9497
9625
  this.searchCollections = snap.collections;
9626
+ // Restored too, or a purely semantic result set would look like a lexical
9627
+ // match after a reopen and wrongly suppress the `weak` nudge.
9628
+ this.hadLexicalMatch = snap.hadLexicalMatch;
9498
9629
  // The restored query was already a real search in its first life; don't let
9499
9630
  // the settle/finalize path re-count it as a new one.
9500
9631
  this.lastFinalizedQuery = snap.query.trim().toLowerCase();
@@ -9540,7 +9671,11 @@ class SearchWidget extends ElementWithStylesheet {
9540
9671
  ${this.renderMain()}
9541
9672
  `;
9542
9673
  }
9674
+ // The nudge leads the column — directly under the search bar, above the
9675
+ // typeahead chips and the grid — so it is seen before the results are
9676
+ // scanned rather than after they disappoint.
9543
9677
  return b `
9678
+ ${this.shouldShowAskNudge() ? this.renderAskNudge() : A}
9544
9679
  ${this.cachedRailSections.map((section) => this.renderColumnSection(section))}
9545
9680
  ${this.renderMain()}
9546
9681
  `;
@@ -9931,25 +10066,12 @@ class SearchWidget extends ElementWithStylesheet {
9931
10066
  height="14"
9932
10067
  viewBox="0 0 24 24"
9933
10068
  fill="none"
9934
- stroke=${isAi ? 'url(#aiGrad)' : 'currentColor'}
10069
+ stroke="currentColor"
9935
10070
  stroke-width="2.2"
9936
10071
  stroke-linecap="round"
9937
10072
  stroke-linejoin="round"
9938
10073
  aria-hidden="true"
9939
10074
  >
9940
- <defs>
9941
- <linearGradient
9942
- id="aiGrad"
9943
- x1="0"
9944
- y1="0"
9945
- x2="24"
9946
- y2="24"
9947
- gradientUnits="userSpaceOnUse"
9948
- >
9949
- <stop offset="0" stop-color="#9333EA"></stop>
9950
- <stop offset="1" stop-color="#6366F1"></stop>
9951
- </linearGradient>
9952
- </defs>
9953
10075
  <path
9954
10076
  d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"
9955
10077
  ></path>
@@ -10007,6 +10129,80 @@ class SearchWidget extends ElementWithStylesheet {
10007
10129
  </div>
10008
10130
  `;
10009
10131
  }
10132
+ // Whether the Ask AI offer belongs on screen right now. Lifted out of the
10133
+ // render so `renderColumn` can place the band above everything in the body
10134
+ // while still keeping the "real search results exist" conditions that only
10135
+ // renderMain used to know about.
10136
+ shouldShowAskNudge() {
10137
+ var _a, _b;
10138
+ if (!this.askActive || this.mode === 'ask') {
10139
+ return false;
10140
+ }
10141
+ const mode = (_b = (_a = this.uiPreferences) === null || _a === void 0 ? void 0 : _a.askNudge) !== null && _b !== void 0 ? _b : DEFAULT_ASK_NUDGE_MODE;
10142
+ if (mode === 'never' || (mode === 'weak' && this.hadLexicalMatch)) {
10143
+ return false;
10144
+ }
10145
+ // Never on the handpicked/empty state (no query to hand over), mid-load
10146
+ // (nothing to be unhappy with yet), on an error, or on the no-match state —
10147
+ // that one carries its own recovery CTA already. Collections count as
10148
+ // results: the same pair renderMain's `noMatches` tests, so a
10149
+ // collections-only match keeps the nudge rather than reading as empty.
10150
+ return (this.debouncedQuery.trim().length > 0 &&
10151
+ !this.loading &&
10152
+ !this.hasError &&
10153
+ (this.searchProducts.length > 0 || this.searchCollections.length > 0));
10154
+ }
10155
+ // Substitute the merchant's `{query}` token. Returned as separate strings so
10156
+ // Lit renders them as text bindings and escapes the shopper's query; never
10157
+ // build markup from this.
10158
+ askNudgeLabelParts(query) {
10159
+ var _a, _b;
10160
+ const label = ((_b = (_a = this.uiPreferences) === null || _a === void 0 ? void 0 : _a.askNudgeLabel) === null || _b === void 0 ? void 0 : _b.trim()) || DEFAULT_ASK_NUDGE_LABEL;
10161
+ return label.split(ASK_NUDGE_QUERY_TOKEN).join(`"${query}"`);
10162
+ }
10163
+ // Offer Ask AI above the results the shopper is about to scan. The tab pill
10164
+ // is too quiet to read as an offer, and the zero-result CTA never fires for
10165
+ // these queries by definition — this is the only place the offer lands while
10166
+ // the shopper still has the query in their head.
10167
+ renderAskNudge() {
10168
+ const query = this.debouncedQuery.trim();
10169
+ const label = this.askNudgeLabelParts(query);
10170
+ return b `
10171
+ <button
10172
+ type="button"
10173
+ class="ask-nudge"
10174
+ @click=${() => this.handleAskNudgeClick(query)}
10175
+ >
10176
+ <bt-lucide-icon
10177
+ name="sparkles"
10178
+ width="14"
10179
+ height="14"
10180
+ stroke="currentColor"
10181
+ stroke-width="1.5"
10182
+ ></bt-lucide-icon>
10183
+ <span class="ask-nudge-text">${label}</span>
10184
+ <bt-lucide-icon
10185
+ name="arrowRight"
10186
+ width="14"
10187
+ height="14"
10188
+ stroke="currentColor"
10189
+ stroke-width="1.5"
10190
+ ></bt-lucide-icon>
10191
+ </button>
10192
+ `;
10193
+ }
10194
+ // Same destination as the zero-result CTA: flip to Ask and run the query the
10195
+ // shopper already typed, so the words carry over verbatim.
10196
+ handleAskNudgeClick(query) {
10197
+ this.mode = 'ask';
10198
+ setStoredSearchMode('ask');
10199
+ // Reuse a held answer for this exact query, like the view toggle does —
10200
+ // re-submitting would open a second billed generation for the same words.
10201
+ const hasAnswer = this.askLoading || this.askAnswer.length > 0 || this.askEvidence !== null;
10202
+ if (!hasAnswer || this.lastAskedQuery !== query) {
10203
+ this.handleAskSubmit(query);
10204
+ }
10205
+ }
10010
10206
  renderMain() {
10011
10207
  var _a, _b, _c;
10012
10208
  const askInitial = this.mode === 'ask' &&
@@ -10222,6 +10418,10 @@ __decorate([
10222
10418
  r$1(),
10223
10419
  __metadata("design:type", Array)
10224
10420
  ], SearchWidget.prototype, "searchCollections", void 0);
10421
+ __decorate([
10422
+ r$1(),
10423
+ __metadata("design:type", Object)
10424
+ ], SearchWidget.prototype, "hadLexicalMatch", void 0);
10225
10425
  __decorate([
10226
10426
  r$1(),
10227
10427
  __metadata("design:type", Array)
@@ -10281,7 +10481,15 @@ const evoSearchStyles = i$6 `
10281
10481
  --evosearch-primary: #3a3d36;
10282
10482
  --evosearch-secondary: #6b6f64;
10283
10483
  --evosearch-accent: #e0590b;
10284
- --evosearch-ask-accent: #2563eb;
10484
+ /* Violet, not blue. The previous #2563eb read as a generic link colour, so
10485
+ every AI affordance looked like plain navigation. Violet is distinct from
10486
+ the brand accent AND from ordinary links, so "this is the AI" is legible
10487
+ without a second signal. Drives the mode toggle, the results nudge, the
10488
+ ask-answer rule, the follow-up chips and the state-block CTA. */
10489
+ --evosearch-ask-accent: #7c3aed;
10490
+ /* Paired end-stop for the gradient treatments (nudge label, toggle thumb).
10491
+ Same amethyst→indigo sweep the toggle icon used before it was unified. */
10492
+ --evosearch-ask-accent-alt: #6366f1;
10285
10493
  --evosearch-mode-accent: var(--evosearch-accent);
10286
10494
  --evosearch-white: #ffffff;
10287
10495
  --evosearch-border: #d6d8cf;
@@ -10357,6 +10565,25 @@ class EvoSearch extends ElementWithStylesheet {
10357
10565
  this.handpickedProducts = [];
10358
10566
  this.featuredCollections = [];
10359
10567
  this.askAiEnabled = false;
10568
+ // Host-page scroll locks (body-scroll-lock and friends) cancel every
10569
+ // document-level touchmove they didn't whitelist, which kills touch
10570
+ // scrolling inside the widget on iOS. Keep widget touches out of their
10571
+ // reach; never preventDefault, or we'd kill the scroll ourselves.
10572
+ // Known gap: a lock registered with { capture: true } runs before the
10573
+ // event reaches this host, so stopPropagation can't shield against it.
10574
+ this.touchmoveListener = (event) => event.stopPropagation();
10575
+ }
10576
+ connectedCallback() {
10577
+ super.connectedCallback();
10578
+ // Passive: this handler only stops propagation, and a blocking touchmove
10579
+ // listener would keep the widget's own scrolling off the compositor.
10580
+ this.addEventListener('touchmove', this.touchmoveListener, {
10581
+ passive: true,
10582
+ });
10583
+ }
10584
+ disconnectedCallback() {
10585
+ this.removeEventListener('touchmove', this.touchmoveListener);
10586
+ super.disconnectedCallback();
10360
10587
  }
10361
10588
  updated(changedProperties) {
10362
10589
  var _a;
@@ -10556,7 +10783,7 @@ const tryFetchTrending = (target) => {
10556
10783
  // Runtime Ask AI config. Unlike trending (fetched once per session), this is
10557
10784
  // fetched on every open so a merchant's dashboard change takes effect without
10558
10785
  // a reload — there is no session-fetched latch, only an in-flight guard to
10559
- // dedupe concurrent opens. `askStarters`/`askAiEnabled` apply live.
10786
+ // dedupe concurrent opens. `askStarters`/`askAiEnabled`/`askNudge`(+label) apply live.
10560
10787
  const tryFetchConfig = (target) => {
10561
10788
  if (!target.api || configController) {
10562
10789
  return;
@@ -10574,6 +10801,13 @@ const tryFetchConfig = (target) => {
10574
10801
  ...(data.askStarters !== undefined
10575
10802
  ? { askStarters: data.askStarters }
10576
10803
  : {}),
10804
+ // Only overlay what the worker actually sent: during a deploy window
10805
+ // a new SDK can hit an old `/config` that omits these, and writing
10806
+ // undefined would drop the manifest-seeded value.
10807
+ ...(data.askNudge !== undefined ? { askNudge: data.askNudge } : {}),
10808
+ ...(data.askNudgeLabel !== undefined
10809
+ ? { askNudgeLabel: data.askNudgeLabel }
10810
+ : {}),
10577
10811
  };
10578
10812
  }
10579
10813
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-evo-search-sdk",
3
- "version": "1.65.2",
3
+ "version": "1.66.0",
4
4
  "description": "Evo Search SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",