@magicx-eng/ai-autocomplete-vanilla 0.55.0 → 0.57.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/README.md +67 -1
- package/dist/index.d.mts +139 -5
- package/dist/index.d.ts +139 -5
- package/dist/index.js +203 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +203 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ A framework-agnostic vanilla JS/TypeScript library that provides a guided AI-pow
|
|
|
15
15
|
- **Keyboard navigation** — arrow keys, enter to submit, tab to autocomplete, backspace to un-bold the last completed param
|
|
16
16
|
- **Client-side filtering** — instant substring filtering on every keystroke
|
|
17
17
|
- **Datepicker** — date parameters are answered with a calendar instead of an option list. Click a day or navigate with the arrow keys; the date is committed the way it would be written — `Tuesday` for a date inside the next week, `March 23` for one later this year, `March 23 2027` for another year. Tapping a committed date re-opens the calendar on the month that text names now — for a weekday name, that is the next such day, not the one originally picked. A date-range parameter gets the same calendar answered in two clicks, committed as one range.
|
|
18
|
+
- **Time picker** — time parameters are answered with a time wheel instead of an option list: three wheels (hour, minutes in fives, AM/PM) and a Done button. Scroll or tap the wheels, or press ↑ / ↓ in the input to move the time five minutes; Enter or Done commits it, written as `7:30 PM`. Tapping a committed time re-opens the wheel on it.
|
|
18
19
|
- **Option overrides** — supply the options for a parameter yourself: a fixed list, a computed one, or one fetched from your own search endpoint as the user types
|
|
19
20
|
- **Product strip** — the dropdown renders a horizontal row of product cards below the options, filled by default with the items the `/suggest` response reports as matching the query; plug in your own product search instead with `products`, or turn the strip off with `showProducts: false`
|
|
20
21
|
- **Catalog report** — every response says which of the query's constraints the catalog applied, which it had to drop, and how many items are left, on `customFields` / `custom_fields`
|
|
@@ -208,7 +209,8 @@ new AIAutocomplete(container, {
|
|
|
208
209
|
|
|
209
210
|
Each server item becomes a `Product` with `id` (the item's stable id), `title`,
|
|
210
211
|
`price` (the item's lowest price, verbatim as the catalog spells it — the
|
|
211
|
-
currency is yours to add), `
|
|
212
|
+
currency is yours to add), `compareAtPrice` (the price before a markdown, on a
|
|
213
|
+
discounted item only, struck through beside the price), `vendor`, `imageUrl`, and a `url`: the item's own
|
|
212
214
|
`item_url` when the uploaded catalog named one (absolute or root-relative;
|
|
213
215
|
anything else is ignored), else a **relative** `/products/{handle}` — the right
|
|
214
216
|
link for a Shopify widget running on the storefront itself — opened on the
|
|
@@ -427,6 +429,7 @@ type Product = {
|
|
|
427
429
|
url?: string; // absent = a card with no link (still activatable)
|
|
428
430
|
imageUrl?: string | null; // null uses the configured productImageFallback
|
|
429
431
|
price?: string; // pre-formatted by you
|
|
432
|
+
compareAtPrice?: string; // the price before a markdown; struck through beside price
|
|
430
433
|
vendor?: string;
|
|
431
434
|
available?: boolean; // false shows a "Sold out" badge
|
|
432
435
|
};
|
|
@@ -584,6 +587,60 @@ the prose. Re-editing one re-opens the calendar with both ends marked.
|
|
|
584
587
|
a new query, so suggestions refresh as the user types — useful when someone
|
|
585
588
|
would rather describe what they want than pick a day.
|
|
586
589
|
|
|
590
|
+
### Time picker
|
|
591
|
+
|
|
592
|
+
When the next parameter is a time, the dropdown shows a time wheel instead of a
|
|
593
|
+
list of options. As with dates, which parameters are times is the server's call:
|
|
594
|
+
one whose `type` is `time` gets the wheel, and one without it keeps its option
|
|
595
|
+
list, however time-like its options look.
|
|
596
|
+
|
|
597
|
+
Nothing is required to switch it on. The options the server still sends for a
|
|
598
|
+
time parameter are never shown, but they choose where the wheel opens: on the
|
|
599
|
+
middle of the times suggested (`6 PM`, `7 PM`, `8 PM` opens on 7:00 PM), or on
|
|
600
|
+
the next whole hour when there are none.
|
|
601
|
+
|
|
602
|
+
**What the user can do**
|
|
603
|
+
|
|
604
|
+
| Input | Result |
|
|
605
|
+
|---|---|
|
|
606
|
+
| Scroll or tap a wheel | Turns that wheel; the time on the top rows is the time. Commits nothing |
|
|
607
|
+
| <kbd>↓</kbd> / <kbd>↑</kbd> in the input | Moves the time 5 minutes later / earlier |
|
|
608
|
+
| <kbd>Enter</kbd> | Commits the time — once the wheel has been moved. Until then it is only a suggestion, and Enter submits as usual |
|
|
609
|
+
| Done | Commits the time |
|
|
610
|
+
| <kbd>Esc</kbd> | Puts a moved wheel back on its suggested time |
|
|
611
|
+
| <kbd>→</kbd> at the end of the input | Skips the parameter, same as any other pill |
|
|
612
|
+
|
|
613
|
+
**The committed value** is written the way a person would write it, always in
|
|
614
|
+
English: `7:30 PM`, `12:05 AM`. It arrives as an ordinary completed parameter
|
|
615
|
+
(bold in the input, in `completed_params` on submit) with the server's lead-in
|
|
616
|
+
before it when there is one (`at 7:30 PM`). The exact time is also recorded on
|
|
617
|
+
the parameter's `metadata` as 24-hour `HH:MM` under the `TIME_META_KEY` key
|
|
618
|
+
(`aiaTime`), so you never have to parse the prose:
|
|
619
|
+
|
|
620
|
+
```ts
|
|
621
|
+
import { parseTime, TIME_META_KEY } from "@magicx-eng/ai-autocomplete-vanilla";
|
|
622
|
+
|
|
623
|
+
const time = param.metadata?.[TIME_META_KEY]; // "19:30"
|
|
624
|
+
const minutes = parseTime(param.text); // 1170 — minutes since midnight, or null
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
**Re-editing** a committed time re-opens the wheel on it.
|
|
628
|
+
|
|
629
|
+
**Typing** while the wheel is open does not filter anything. As with the
|
|
630
|
+
calendar, the text is treated as a new query.
|
|
631
|
+
|
|
632
|
+
### Multiple selections
|
|
633
|
+
|
|
634
|
+
- A suggestion with `type: { kind: "multi_select" }` shows checkbox options and a Done button.
|
|
635
|
+
- Select rows to toggle values. Typing filters the options and keeps the current picks.
|
|
636
|
+
- Done joins the picks in selection order with the UI language's word for "and".
|
|
637
|
+
- Each value has its own `completed_params` entry. The input shows one chip for the group.
|
|
638
|
+
- Remove the group chip to change the answer. Group chips do not open for editing.
|
|
639
|
+
- Done without picks skips the question. Typing a phrase with no matching options closes the question and keeps that phrase.
|
|
640
|
+
- Space toggles the highlighted row when nothing is typed for the question. Enter commits the picks, or selects the highlighted row when no values are picked.
|
|
641
|
+
- Headless integrations can call `toggleMultiSelectOption(option)` and `commitMultiSelect()`.
|
|
642
|
+
- `multiSelectView.picked` contains the selected option texts. The view is null outside a multi_select question.
|
|
643
|
+
|
|
587
644
|
---
|
|
588
645
|
|
|
589
646
|
## Tier 2: Dropdown Only
|
|
@@ -959,6 +1016,8 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
|
|
|
959
1016
|
| `--aia-product-placeholder-image` | storefront pictogram | storefront pictogram | The pictogram used by `productImageFallback: "image"` (the default) when an image URL is missing, blank or fails to load. Defaults to a two-tone storefront inlined as a data URI. Set any `url(...)` to swap it; it is centered and contained over `--aia-product-media-bg`. Does not affect `"initial"` tiles. |
|
|
960
1017
|
| `--aia-product-title-color` | `--aia-option-color-selected` | `--aia-option-color-selected` | Product title text. Follows the option colors by default, so theming the panel moves suggestions and products together. |
|
|
961
1018
|
| `--aia-product-price-color` | `--aia-option-color-selected` | `--aia-option-color-selected` | Product price text. |
|
|
1019
|
+
| `--aia-product-compare-at-color` | `currentColor` | `currentColor` | The struck price before a markdown. Defaults to the price's colour. |
|
|
1020
|
+
| `--aia-product-compare-at-opacity` | `0.6` | `0.6` | How far the struck price is dimmed. |
|
|
962
1021
|
| `--aia-product-vendor-color` | `--aia-option-color` | `--aia-option-color` | Product vendor line. |
|
|
963
1022
|
| `--aia-product-focus-ring` | `--aia-option-color-selected` | `--aia-option-color-selected` | Focus ring drawn on a keyboard-focused card. |
|
|
964
1023
|
| `--aia-products-label-color` | `--aia-option-color` | `--aia-option-color` | "Products" section label. |
|
|
@@ -975,6 +1034,12 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
|
|
|
975
1034
|
| `--aia-date-today-ring` | `--aia-option-color` | `--aia-option-color` | Outline drawn around today's date. |
|
|
976
1035
|
| `--aia-date-selected-bg` | white at 12% | white at 12% | Fill behind the date a re-edited parameter already holds. |
|
|
977
1036
|
| `--aia-date-range-bg` | white at 6% | white at 6% | Band across the days between the two ends of a picked date range. The ends themselves use `--aia-date-selected-bg`. |
|
|
1037
|
+
| `--aia-time-panel-width` | `240px` | `240px` | Max width of the whole dropdown panel while the time wheel is up. |
|
|
1038
|
+
| `--aia-time-font-size` | `15px` | `15px` | The time wheel's numbers and its `:` separator. |
|
|
1039
|
+
| `--aia-time-band-bg` | white at 8% | white at 8% | The band behind the wheels' top rows — the chosen time. |
|
|
1040
|
+
| `--aia-time-done-bg` | white at 10% | white at 10% | The time wheel's Done button. |
|
|
1041
|
+
| `--aia-time-done-bg-hover` | white at 16% | white at 16% | The Done button on hover. |
|
|
1042
|
+
| `--aia-time-done-color` | `--aia-option-color-selected` | `--aia-option-color-selected` | The Done button's text. |
|
|
978
1043
|
| `--aia-skeleton-bg` | `rgba(189, 189, 189, 0.083)` | `#1a1b1d` | Fill color for the loading skeleton bars and the masked text in cached pills/options, and of the option and chip image tiles while their picture loads (unless `--aia-option-image-bg` / `--aia-chip-image-bg` are set). |
|
|
979
1044
|
|
|
980
1045
|
### Per-mode Overrides
|
|
@@ -1024,6 +1089,7 @@ For styling beyond the CSS variables, target these stable `data-aia-*` attribute
|
|
|
1024
1089
|
| `[data-aia-scroll-arrow]` | The "more below" arrow on the dropdown — carries `data-aia-visible` while shown |
|
|
1025
1090
|
| `[data-aia-dropdown]` | The dropdown root (listbox). Carries `data-aia-has-products` while the product strip has cards, and `data-aia-fit` while it is fitted to a short screen (see [Short screens](#short-screens)). |
|
|
1026
1091
|
| `[data-aia-datepicker]` | The calendar, rendered in place of the option list for a date parameter |
|
|
1092
|
+
| `[data-aia-time-wheel]` | The time wheel, rendered in place of the option list for a time parameter |
|
|
1027
1093
|
| `[data-aia-date-month]` | The "March 2026" header label |
|
|
1028
1094
|
| `[data-aia-date-prev]` / `[data-aia-date-next]` | The month arrows |
|
|
1029
1095
|
| `[data-aia-date-grid]` | The 7-column grid of day cells |
|
package/dist/index.d.mts
CHANGED
|
@@ -70,12 +70,12 @@ interface SuggestionOption {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* The value type of a parameter — which picker it needs. The server sends it
|
|
73
|
-
* for every date
|
|
74
|
-
* from its options.
|
|
73
|
+
* for every date, date-range or time parameter; a parameter without one is
|
|
74
|
+
* answered from its options.
|
|
75
75
|
*/
|
|
76
76
|
interface SuggestionType {
|
|
77
77
|
/** `traditional_autocomplete` marks a suggestion whose options complete the word being typed; it is never a pill. */
|
|
78
|
-
kind: "string" | "numeric" | "date" | "date_range" | "boolean" | "traditional_autocomplete";
|
|
78
|
+
kind: "string" | "numeric" | "date" | "date_range" | "time" | "multi_select" | "boolean" | "traditional_autocomplete";
|
|
79
79
|
/** How a date is written, e.g. "DD/MM/YYYY". */
|
|
80
80
|
date_format?: string;
|
|
81
81
|
/** What joins the two dates of a range, e.g. " to ". */
|
|
@@ -234,6 +234,12 @@ interface MatchedItem {
|
|
|
234
234
|
* The strip formats it with `currency` when the item has one.
|
|
235
235
|
*/
|
|
236
236
|
price?: string;
|
|
237
|
+
/**
|
|
238
|
+
* The item's price before a markdown, as the catalog's number ("160.00").
|
|
239
|
+
* Present only on a discounted item, always above `price`, and always the
|
|
240
|
+
* same variant's as `price`. The strip strikes it through beside the price.
|
|
241
|
+
*/
|
|
242
|
+
compare_at_price?: string;
|
|
237
243
|
/** ISO 4217 currency code. Absent when unknown. */
|
|
238
244
|
currency?: string;
|
|
239
245
|
vendor?: string;
|
|
@@ -308,6 +314,8 @@ interface CustomFieldsReport {
|
|
|
308
314
|
items: MatchedItems;
|
|
309
315
|
}
|
|
310
316
|
interface CompletedParamState extends CompletedParam {
|
|
317
|
+
/** Client-only identity for values committed together. */
|
|
318
|
+
group?: string;
|
|
311
319
|
id: string;
|
|
312
320
|
text: string;
|
|
313
321
|
/** The originating option's `value` (see {@link SuggestionOption.value}), carried over so `toWireParam` can send it instead of the shortened `text`. */
|
|
@@ -381,6 +389,7 @@ type Segment = {
|
|
|
381
389
|
type: "completed";
|
|
382
390
|
value: string;
|
|
383
391
|
param: CompletedParamState;
|
|
392
|
+
params?: CompletedParamState[];
|
|
384
393
|
} | {
|
|
385
394
|
type: "identified";
|
|
386
395
|
value: string;
|
|
@@ -472,6 +481,13 @@ interface Product {
|
|
|
472
481
|
* A custom integration (`opts.products`) supplies its own text.
|
|
473
482
|
*/
|
|
474
483
|
price?: string;
|
|
484
|
+
/**
|
|
485
|
+
* The price before a markdown, as display text, struck through beside
|
|
486
|
+
* `price`. Shown only when `price` is set too. The built-in strip sets it
|
|
487
|
+
* from the server's `compare_at_price`, formatted like the price; a custom
|
|
488
|
+
* integration supplies its own text and decides when an item is discounted.
|
|
489
|
+
*/
|
|
490
|
+
compareAtPrice?: string;
|
|
475
491
|
vendor?: string;
|
|
476
492
|
/**
|
|
477
493
|
* `false` marks the card sold out: a "Sold out" badge over the image, and
|
|
@@ -668,10 +684,18 @@ declare function cellDay(option: SuggestionOption | undefined): number | null;
|
|
|
668
684
|
* options, or type to filter them. `"date"` ignores the options entirely and
|
|
669
685
|
* renders a calendar instead. `"date-range"` renders the same calendar,
|
|
670
686
|
* answered in two taps — a start and an end — and committed as one span.
|
|
687
|
+
* `"time"` ignores the options the same way and renders the time wheel.
|
|
671
688
|
*/
|
|
672
|
-
type FormatType = "options" | "date" | "date-range";
|
|
689
|
+
type FormatType = "options" | "date" | "date-range" | "time";
|
|
673
690
|
/** Whether this format is answered by a calendar rather than by a list. */
|
|
674
691
|
declare function isCalendarFormat(format: FormatType): boolean;
|
|
692
|
+
/**
|
|
693
|
+
* Whether this format is answered by a picker the SDK draws (a calendar or the
|
|
694
|
+
* time wheel) rather than by the suggestion's options. The server still sends
|
|
695
|
+
* options for such a pill, so anything that reasons about options — filtering,
|
|
696
|
+
* exact-match promotion, the request gates, telemetry — has to ask this first.
|
|
697
|
+
*/
|
|
698
|
+
declare function isPickerFormat(format: FormatType): boolean;
|
|
675
699
|
/**
|
|
676
700
|
* Decide how a parameter should be answered — from the value type the server
|
|
677
701
|
* names on it, and nothing else.
|
|
@@ -690,6 +714,70 @@ declare function resolveFormatType(source: {
|
|
|
690
714
|
type?: SuggestionType;
|
|
691
715
|
} | undefined | null): FormatType;
|
|
692
716
|
|
|
717
|
+
/**
|
|
718
|
+
* Time-of-day helpers for the time wheel.
|
|
719
|
+
*
|
|
720
|
+
* A time is carried as minutes since midnight (0–1439) everywhere inside the
|
|
721
|
+
* SDK. It is turned into text only at the edges: the wheel's labels, and the
|
|
722
|
+
* committed answer, which is written the way a person would write it ("7:30
|
|
723
|
+
* PM") — always in English, like the datepicker's committed dates, so the value
|
|
724
|
+
* a consumer receives has one vocabulary everywhere. The exact value rides
|
|
725
|
+
* along on the completed param's `metadata` as `HH:MM` under
|
|
726
|
+
* {@link TIME_META_KEY}, so nobody has to parse the prose back.
|
|
727
|
+
*/
|
|
728
|
+
/** `metadata` key holding a committed time as 24-hour `HH:MM`. */
|
|
729
|
+
declare const TIME_META_KEY = "aiaTime";
|
|
730
|
+
/** The minute wheel's step. A time between steps snaps to the nearest one. */
|
|
731
|
+
declare const TIME_STEP_MINUTES = 5;
|
|
732
|
+
type TimePeriod = "AM" | "PM";
|
|
733
|
+
/** A time split the way the wheels show it. */
|
|
734
|
+
interface TimeParts {
|
|
735
|
+
/** 1–12. */
|
|
736
|
+
hour: number;
|
|
737
|
+
/** 0–59. */
|
|
738
|
+
minute: number;
|
|
739
|
+
period: TimePeriod;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* What the time wheel shows: the time on its top row, and whether the user has
|
|
743
|
+
* moved it. An untouched wheel is only a suggestion, so Enter in the input
|
|
744
|
+
* still submits; a touched one is an answer in progress, so Enter commits it.
|
|
745
|
+
*/
|
|
746
|
+
interface TimeView {
|
|
747
|
+
minutes: number;
|
|
748
|
+
touched: boolean;
|
|
749
|
+
}
|
|
750
|
+
/** "7:30 PM", "12:05 AM". */
|
|
751
|
+
declare function formatTime(minutes: number): string;
|
|
752
|
+
/** 24-hour `HH:MM` — the exact value stored under {@link TIME_META_KEY}. */
|
|
753
|
+
declare function isoTime(minutes: number): string;
|
|
754
|
+
/**
|
|
755
|
+
* Read a time a person or a server wrote: "7 PM", "7:30pm", "7:30 p.m.",
|
|
756
|
+
* "19:30", "noon", "midnight". Null for anything else — never a guess, so
|
|
757
|
+
* "7" alone (morning or evening?) is null.
|
|
758
|
+
*/
|
|
759
|
+
declare function parseTime(text: string | null | undefined): number | null;
|
|
760
|
+
/**
|
|
761
|
+
* The option a committed time is answered with. It goes through the same
|
|
762
|
+
* `selectOption` path as a tapped option, so lead-ins, re-edit and the
|
|
763
|
+
* follow-up request all behave exactly as they do for any other answer.
|
|
764
|
+
*/
|
|
765
|
+
declare function buildTimeOption(minutes: number): SuggestionOption;
|
|
766
|
+
/** One wheel row's height in px. Must match `--aia-time-row-height` in every stylesheet copy. */
|
|
767
|
+
declare const TIME_WHEEL_ROW_HEIGHT = 30;
|
|
768
|
+
type TimeWheelColumn = "hour" | "minute" | "period";
|
|
769
|
+
declare const TIME_WHEEL_COLUMNS: readonly TimeWheelColumn[];
|
|
770
|
+
interface TimeWheelRow {
|
|
771
|
+
label: string;
|
|
772
|
+
}
|
|
773
|
+
declare function timeWheelRows(column: TimeWheelColumn): readonly TimeWheelRow[];
|
|
774
|
+
/** The row `minutes` puts on top of `column`. */
|
|
775
|
+
declare function timeWheelIndex(column: TimeWheelColumn, minutes: number): number;
|
|
776
|
+
/** The time after `column` is turned to row `index`, the other two wheels unchanged. */
|
|
777
|
+
declare function withTimeWheelIndex(column: TimeWheelColumn, minutes: number, index: number): number;
|
|
778
|
+
/** The row a column scrolled to `scrollTop` has settled on. */
|
|
779
|
+
declare function timeWheelIndexFromScroll(column: TimeWheelColumn, scrollTop: number): number;
|
|
780
|
+
|
|
693
781
|
/**
|
|
694
782
|
* Raw, user/network/internal-driven fields. The store holds *only* these —
|
|
695
783
|
* derived state is recomputed lazily on read. See {@link CoreDerivedState}.
|
|
@@ -856,6 +944,24 @@ interface CoreInputState {
|
|
|
856
944
|
iso: string;
|
|
857
945
|
key: string;
|
|
858
946
|
} | null;
|
|
947
|
+
/**
|
|
948
|
+
* The time the user has moved the time wheel to, as minutes since midnight,
|
|
949
|
+
* or null while it still shows its suggested starting time. Surfaces to
|
|
950
|
+
* readers as the derived `timeView`.
|
|
951
|
+
*
|
|
952
|
+
* `key` scopes it to the pill it was set for, exactly like `dateViewMonth`
|
|
953
|
+
* (see `dateViewKey`): a stale key is ignored, so the next time pill opens on
|
|
954
|
+
* its own starting time without any flow having to reset this.
|
|
955
|
+
*/
|
|
956
|
+
timeDraft: {
|
|
957
|
+
minutes: number;
|
|
958
|
+
key: string;
|
|
959
|
+
} | null;
|
|
960
|
+
/** Picks for the active question, scoped by dateViewKey. */
|
|
961
|
+
multiSelectDraft: {
|
|
962
|
+
picked: string[];
|
|
963
|
+
key: string;
|
|
964
|
+
} | null;
|
|
859
965
|
/**
|
|
860
966
|
* Set while the user is picking a date for a span the server identified as
|
|
861
967
|
* one — "september 5th" in "fly to vegas on september 5th".
|
|
@@ -934,6 +1040,15 @@ interface CoreDerivedState {
|
|
|
934
1040
|
* first. The calendars paint the span between it and the highlighted cell.
|
|
935
1041
|
*/
|
|
936
1042
|
dateRangeStart: string | null;
|
|
1043
|
+
/**
|
|
1044
|
+
* What the time wheel shows. Null unless `activeFormatType` is `"time"`.
|
|
1045
|
+
* `touched` is false while it still shows its suggested starting time.
|
|
1046
|
+
*/
|
|
1047
|
+
timeView: TimeView | null;
|
|
1048
|
+
/** Selected option texts in pick order. Null outside a multi_select question. */
|
|
1049
|
+
multiSelectView: {
|
|
1050
|
+
picked: string[];
|
|
1051
|
+
} | null;
|
|
937
1052
|
placeholderText: string;
|
|
938
1053
|
/**
|
|
939
1054
|
* The phrase the active pill's options are filtered by — what the user has
|
|
@@ -1439,6 +1554,22 @@ declare class AIAutocomplete {
|
|
|
1439
1554
|
* its own default month with nothing having to clear this.
|
|
1440
1555
|
*/
|
|
1441
1556
|
private pageDateView;
|
|
1557
|
+
/**
|
|
1558
|
+
* Move the time wheel to `minutes` past midnight, snapped to its 5-minute
|
|
1559
|
+
* step. No-op unless a time pill is active. Moving the wheel commits nothing:
|
|
1560
|
+
* `commitTime` (the wheel's Done button, or Enter in the input once the wheel
|
|
1561
|
+
* has been moved) answers the pill.
|
|
1562
|
+
*/
|
|
1563
|
+
setTime(minutes: number): void;
|
|
1564
|
+
/** Move the time wheel by `delta` minutes (ArrowDown / ArrowUp step by 5). No-op unless a time pill is active. */
|
|
1565
|
+
stepTime(delta: number): void;
|
|
1566
|
+
/** Toggle an option without completing the question or sending a request. */
|
|
1567
|
+
toggleMultiSelectOption(option: SuggestionOption): void;
|
|
1568
|
+
/** Complete the selected values, or skip the question when no values are selected. */
|
|
1569
|
+
commitMultiSelect(): void;
|
|
1570
|
+
private finishMultiSelect;
|
|
1571
|
+
/** Answer the active time pill with the time on the wheel. */
|
|
1572
|
+
commitTime(): void;
|
|
1442
1573
|
/**
|
|
1443
1574
|
* Skip the currently active pill (always index 0 of the actionable
|
|
1444
1575
|
* suggestions) and promote the next pill to active. Invoked by ArrowRight at
|
|
@@ -2263,6 +2394,7 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
|
|
|
2263
2394
|
|
|
2264
2395
|
declare const en: {
|
|
2265
2396
|
language: string;
|
|
2397
|
+
and: string;
|
|
2266
2398
|
proceed: string;
|
|
2267
2399
|
select: string;
|
|
2268
2400
|
skipHint: string;
|
|
@@ -2274,6 +2406,8 @@ declare const en: {
|
|
|
2274
2406
|
submit: string;
|
|
2275
2407
|
scrollArrow: string;
|
|
2276
2408
|
keepTyping: string;
|
|
2409
|
+
done: string;
|
|
2410
|
+
timeLabel: string;
|
|
2277
2411
|
};
|
|
2278
2412
|
type UIStrings = typeof en;
|
|
2279
2413
|
declare function uiStringsFor(language?: string): UIStrings;
|
|
@@ -2736,4 +2870,4 @@ declare const SMART_SUGGESTION_SPARKLE_SVG: string;
|
|
|
2736
2870
|
/** True when some pill is a question the shopper can decline. */
|
|
2737
2871
|
declare function hasSkippablePill(suggestions: Suggestion[]): boolean;
|
|
2738
2872
|
|
|
2739
|
-
export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type CurrencyOptions, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, OPTION_IMAGE_WIDTH, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, SMART_SUGGESTION_SPARKLE_SVG, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, type TaskKind, type TextPart, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withoutTraditionalAutocomplete };
|
|
2873
|
+
export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type CurrencyOptions, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, OPTION_IMAGE_WIDTH, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, SMART_SUGGESTION_SPARKLE_SVG, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, TIME_META_KEY, TIME_STEP_MINUTES, TIME_WHEEL_COLUMNS, TIME_WHEEL_ROW_HEIGHT, type TaskKind, type TextPart, type TimeParts, type TimePeriod, type TimeView, type TimeWheelColumn, type TimeWheelRow, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, buildTimeOption, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, isoTime, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, parseTime, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|
package/dist/index.d.ts
CHANGED
|
@@ -70,12 +70,12 @@ interface SuggestionOption {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* The value type of a parameter — which picker it needs. The server sends it
|
|
73
|
-
* for every date
|
|
74
|
-
* from its options.
|
|
73
|
+
* for every date, date-range or time parameter; a parameter without one is
|
|
74
|
+
* answered from its options.
|
|
75
75
|
*/
|
|
76
76
|
interface SuggestionType {
|
|
77
77
|
/** `traditional_autocomplete` marks a suggestion whose options complete the word being typed; it is never a pill. */
|
|
78
|
-
kind: "string" | "numeric" | "date" | "date_range" | "boolean" | "traditional_autocomplete";
|
|
78
|
+
kind: "string" | "numeric" | "date" | "date_range" | "time" | "multi_select" | "boolean" | "traditional_autocomplete";
|
|
79
79
|
/** How a date is written, e.g. "DD/MM/YYYY". */
|
|
80
80
|
date_format?: string;
|
|
81
81
|
/** What joins the two dates of a range, e.g. " to ". */
|
|
@@ -234,6 +234,12 @@ interface MatchedItem {
|
|
|
234
234
|
* The strip formats it with `currency` when the item has one.
|
|
235
235
|
*/
|
|
236
236
|
price?: string;
|
|
237
|
+
/**
|
|
238
|
+
* The item's price before a markdown, as the catalog's number ("160.00").
|
|
239
|
+
* Present only on a discounted item, always above `price`, and always the
|
|
240
|
+
* same variant's as `price`. The strip strikes it through beside the price.
|
|
241
|
+
*/
|
|
242
|
+
compare_at_price?: string;
|
|
237
243
|
/** ISO 4217 currency code. Absent when unknown. */
|
|
238
244
|
currency?: string;
|
|
239
245
|
vendor?: string;
|
|
@@ -308,6 +314,8 @@ interface CustomFieldsReport {
|
|
|
308
314
|
items: MatchedItems;
|
|
309
315
|
}
|
|
310
316
|
interface CompletedParamState extends CompletedParam {
|
|
317
|
+
/** Client-only identity for values committed together. */
|
|
318
|
+
group?: string;
|
|
311
319
|
id: string;
|
|
312
320
|
text: string;
|
|
313
321
|
/** The originating option's `value` (see {@link SuggestionOption.value}), carried over so `toWireParam` can send it instead of the shortened `text`. */
|
|
@@ -381,6 +389,7 @@ type Segment = {
|
|
|
381
389
|
type: "completed";
|
|
382
390
|
value: string;
|
|
383
391
|
param: CompletedParamState;
|
|
392
|
+
params?: CompletedParamState[];
|
|
384
393
|
} | {
|
|
385
394
|
type: "identified";
|
|
386
395
|
value: string;
|
|
@@ -472,6 +481,13 @@ interface Product {
|
|
|
472
481
|
* A custom integration (`opts.products`) supplies its own text.
|
|
473
482
|
*/
|
|
474
483
|
price?: string;
|
|
484
|
+
/**
|
|
485
|
+
* The price before a markdown, as display text, struck through beside
|
|
486
|
+
* `price`. Shown only when `price` is set too. The built-in strip sets it
|
|
487
|
+
* from the server's `compare_at_price`, formatted like the price; a custom
|
|
488
|
+
* integration supplies its own text and decides when an item is discounted.
|
|
489
|
+
*/
|
|
490
|
+
compareAtPrice?: string;
|
|
475
491
|
vendor?: string;
|
|
476
492
|
/**
|
|
477
493
|
* `false` marks the card sold out: a "Sold out" badge over the image, and
|
|
@@ -668,10 +684,18 @@ declare function cellDay(option: SuggestionOption | undefined): number | null;
|
|
|
668
684
|
* options, or type to filter them. `"date"` ignores the options entirely and
|
|
669
685
|
* renders a calendar instead. `"date-range"` renders the same calendar,
|
|
670
686
|
* answered in two taps — a start and an end — and committed as one span.
|
|
687
|
+
* `"time"` ignores the options the same way and renders the time wheel.
|
|
671
688
|
*/
|
|
672
|
-
type FormatType = "options" | "date" | "date-range";
|
|
689
|
+
type FormatType = "options" | "date" | "date-range" | "time";
|
|
673
690
|
/** Whether this format is answered by a calendar rather than by a list. */
|
|
674
691
|
declare function isCalendarFormat(format: FormatType): boolean;
|
|
692
|
+
/**
|
|
693
|
+
* Whether this format is answered by a picker the SDK draws (a calendar or the
|
|
694
|
+
* time wheel) rather than by the suggestion's options. The server still sends
|
|
695
|
+
* options for such a pill, so anything that reasons about options — filtering,
|
|
696
|
+
* exact-match promotion, the request gates, telemetry — has to ask this first.
|
|
697
|
+
*/
|
|
698
|
+
declare function isPickerFormat(format: FormatType): boolean;
|
|
675
699
|
/**
|
|
676
700
|
* Decide how a parameter should be answered — from the value type the server
|
|
677
701
|
* names on it, and nothing else.
|
|
@@ -690,6 +714,70 @@ declare function resolveFormatType(source: {
|
|
|
690
714
|
type?: SuggestionType;
|
|
691
715
|
} | undefined | null): FormatType;
|
|
692
716
|
|
|
717
|
+
/**
|
|
718
|
+
* Time-of-day helpers for the time wheel.
|
|
719
|
+
*
|
|
720
|
+
* A time is carried as minutes since midnight (0–1439) everywhere inside the
|
|
721
|
+
* SDK. It is turned into text only at the edges: the wheel's labels, and the
|
|
722
|
+
* committed answer, which is written the way a person would write it ("7:30
|
|
723
|
+
* PM") — always in English, like the datepicker's committed dates, so the value
|
|
724
|
+
* a consumer receives has one vocabulary everywhere. The exact value rides
|
|
725
|
+
* along on the completed param's `metadata` as `HH:MM` under
|
|
726
|
+
* {@link TIME_META_KEY}, so nobody has to parse the prose back.
|
|
727
|
+
*/
|
|
728
|
+
/** `metadata` key holding a committed time as 24-hour `HH:MM`. */
|
|
729
|
+
declare const TIME_META_KEY = "aiaTime";
|
|
730
|
+
/** The minute wheel's step. A time between steps snaps to the nearest one. */
|
|
731
|
+
declare const TIME_STEP_MINUTES = 5;
|
|
732
|
+
type TimePeriod = "AM" | "PM";
|
|
733
|
+
/** A time split the way the wheels show it. */
|
|
734
|
+
interface TimeParts {
|
|
735
|
+
/** 1–12. */
|
|
736
|
+
hour: number;
|
|
737
|
+
/** 0–59. */
|
|
738
|
+
minute: number;
|
|
739
|
+
period: TimePeriod;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* What the time wheel shows: the time on its top row, and whether the user has
|
|
743
|
+
* moved it. An untouched wheel is only a suggestion, so Enter in the input
|
|
744
|
+
* still submits; a touched one is an answer in progress, so Enter commits it.
|
|
745
|
+
*/
|
|
746
|
+
interface TimeView {
|
|
747
|
+
minutes: number;
|
|
748
|
+
touched: boolean;
|
|
749
|
+
}
|
|
750
|
+
/** "7:30 PM", "12:05 AM". */
|
|
751
|
+
declare function formatTime(minutes: number): string;
|
|
752
|
+
/** 24-hour `HH:MM` — the exact value stored under {@link TIME_META_KEY}. */
|
|
753
|
+
declare function isoTime(minutes: number): string;
|
|
754
|
+
/**
|
|
755
|
+
* Read a time a person or a server wrote: "7 PM", "7:30pm", "7:30 p.m.",
|
|
756
|
+
* "19:30", "noon", "midnight". Null for anything else — never a guess, so
|
|
757
|
+
* "7" alone (morning or evening?) is null.
|
|
758
|
+
*/
|
|
759
|
+
declare function parseTime(text: string | null | undefined): number | null;
|
|
760
|
+
/**
|
|
761
|
+
* The option a committed time is answered with. It goes through the same
|
|
762
|
+
* `selectOption` path as a tapped option, so lead-ins, re-edit and the
|
|
763
|
+
* follow-up request all behave exactly as they do for any other answer.
|
|
764
|
+
*/
|
|
765
|
+
declare function buildTimeOption(minutes: number): SuggestionOption;
|
|
766
|
+
/** One wheel row's height in px. Must match `--aia-time-row-height` in every stylesheet copy. */
|
|
767
|
+
declare const TIME_WHEEL_ROW_HEIGHT = 30;
|
|
768
|
+
type TimeWheelColumn = "hour" | "minute" | "period";
|
|
769
|
+
declare const TIME_WHEEL_COLUMNS: readonly TimeWheelColumn[];
|
|
770
|
+
interface TimeWheelRow {
|
|
771
|
+
label: string;
|
|
772
|
+
}
|
|
773
|
+
declare function timeWheelRows(column: TimeWheelColumn): readonly TimeWheelRow[];
|
|
774
|
+
/** The row `minutes` puts on top of `column`. */
|
|
775
|
+
declare function timeWheelIndex(column: TimeWheelColumn, minutes: number): number;
|
|
776
|
+
/** The time after `column` is turned to row `index`, the other two wheels unchanged. */
|
|
777
|
+
declare function withTimeWheelIndex(column: TimeWheelColumn, minutes: number, index: number): number;
|
|
778
|
+
/** The row a column scrolled to `scrollTop` has settled on. */
|
|
779
|
+
declare function timeWheelIndexFromScroll(column: TimeWheelColumn, scrollTop: number): number;
|
|
780
|
+
|
|
693
781
|
/**
|
|
694
782
|
* Raw, user/network/internal-driven fields. The store holds *only* these —
|
|
695
783
|
* derived state is recomputed lazily on read. See {@link CoreDerivedState}.
|
|
@@ -856,6 +944,24 @@ interface CoreInputState {
|
|
|
856
944
|
iso: string;
|
|
857
945
|
key: string;
|
|
858
946
|
} | null;
|
|
947
|
+
/**
|
|
948
|
+
* The time the user has moved the time wheel to, as minutes since midnight,
|
|
949
|
+
* or null while it still shows its suggested starting time. Surfaces to
|
|
950
|
+
* readers as the derived `timeView`.
|
|
951
|
+
*
|
|
952
|
+
* `key` scopes it to the pill it was set for, exactly like `dateViewMonth`
|
|
953
|
+
* (see `dateViewKey`): a stale key is ignored, so the next time pill opens on
|
|
954
|
+
* its own starting time without any flow having to reset this.
|
|
955
|
+
*/
|
|
956
|
+
timeDraft: {
|
|
957
|
+
minutes: number;
|
|
958
|
+
key: string;
|
|
959
|
+
} | null;
|
|
960
|
+
/** Picks for the active question, scoped by dateViewKey. */
|
|
961
|
+
multiSelectDraft: {
|
|
962
|
+
picked: string[];
|
|
963
|
+
key: string;
|
|
964
|
+
} | null;
|
|
859
965
|
/**
|
|
860
966
|
* Set while the user is picking a date for a span the server identified as
|
|
861
967
|
* one — "september 5th" in "fly to vegas on september 5th".
|
|
@@ -934,6 +1040,15 @@ interface CoreDerivedState {
|
|
|
934
1040
|
* first. The calendars paint the span between it and the highlighted cell.
|
|
935
1041
|
*/
|
|
936
1042
|
dateRangeStart: string | null;
|
|
1043
|
+
/**
|
|
1044
|
+
* What the time wheel shows. Null unless `activeFormatType` is `"time"`.
|
|
1045
|
+
* `touched` is false while it still shows its suggested starting time.
|
|
1046
|
+
*/
|
|
1047
|
+
timeView: TimeView | null;
|
|
1048
|
+
/** Selected option texts in pick order. Null outside a multi_select question. */
|
|
1049
|
+
multiSelectView: {
|
|
1050
|
+
picked: string[];
|
|
1051
|
+
} | null;
|
|
937
1052
|
placeholderText: string;
|
|
938
1053
|
/**
|
|
939
1054
|
* The phrase the active pill's options are filtered by — what the user has
|
|
@@ -1439,6 +1554,22 @@ declare class AIAutocomplete {
|
|
|
1439
1554
|
* its own default month with nothing having to clear this.
|
|
1440
1555
|
*/
|
|
1441
1556
|
private pageDateView;
|
|
1557
|
+
/**
|
|
1558
|
+
* Move the time wheel to `minutes` past midnight, snapped to its 5-minute
|
|
1559
|
+
* step. No-op unless a time pill is active. Moving the wheel commits nothing:
|
|
1560
|
+
* `commitTime` (the wheel's Done button, or Enter in the input once the wheel
|
|
1561
|
+
* has been moved) answers the pill.
|
|
1562
|
+
*/
|
|
1563
|
+
setTime(minutes: number): void;
|
|
1564
|
+
/** Move the time wheel by `delta` minutes (ArrowDown / ArrowUp step by 5). No-op unless a time pill is active. */
|
|
1565
|
+
stepTime(delta: number): void;
|
|
1566
|
+
/** Toggle an option without completing the question or sending a request. */
|
|
1567
|
+
toggleMultiSelectOption(option: SuggestionOption): void;
|
|
1568
|
+
/** Complete the selected values, or skip the question when no values are selected. */
|
|
1569
|
+
commitMultiSelect(): void;
|
|
1570
|
+
private finishMultiSelect;
|
|
1571
|
+
/** Answer the active time pill with the time on the wheel. */
|
|
1572
|
+
commitTime(): void;
|
|
1442
1573
|
/**
|
|
1443
1574
|
* Skip the currently active pill (always index 0 of the actionable
|
|
1444
1575
|
* suggestions) and promote the next pill to active. Invoked by ArrowRight at
|
|
@@ -2263,6 +2394,7 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
|
|
|
2263
2394
|
|
|
2264
2395
|
declare const en: {
|
|
2265
2396
|
language: string;
|
|
2397
|
+
and: string;
|
|
2266
2398
|
proceed: string;
|
|
2267
2399
|
select: string;
|
|
2268
2400
|
skipHint: string;
|
|
@@ -2274,6 +2406,8 @@ declare const en: {
|
|
|
2274
2406
|
submit: string;
|
|
2275
2407
|
scrollArrow: string;
|
|
2276
2408
|
keepTyping: string;
|
|
2409
|
+
done: string;
|
|
2410
|
+
timeLabel: string;
|
|
2277
2411
|
};
|
|
2278
2412
|
type UIStrings = typeof en;
|
|
2279
2413
|
declare function uiStringsFor(language?: string): UIStrings;
|
|
@@ -2736,4 +2870,4 @@ declare const SMART_SUGGESTION_SPARKLE_SVG: string;
|
|
|
2736
2870
|
/** True when some pill is a question the shopper can decline. */
|
|
2737
2871
|
declare function hasSkippablePill(suggestions: Suggestion[]): boolean;
|
|
2738
2872
|
|
|
2739
|
-
export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type CurrencyOptions, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, OPTION_IMAGE_WIDTH, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, SMART_SUGGESTION_SPARKLE_SVG, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, type TaskKind, type TextPart, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withoutTraditionalAutocomplete };
|
|
2873
|
+
export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type CurrencyOptions, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, OPTION_IMAGE_WIDTH, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, SMART_SUGGESTION_SPARKLE_SVG, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, TIME_META_KEY, TIME_STEP_MINUTES, TIME_WHEEL_COLUMNS, TIME_WHEEL_ROW_HEIGHT, type TaskKind, type TextPart, type TimeParts, type TimePeriod, type TimeView, type TimeWheelColumn, type TimeWheelRow, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, buildTimeOption, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, isoTime, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, parseTime, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|