@magicx-eng/ai-autocomplete-vanilla 0.72.2 → 0.73.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 +3 -2
- package/REFERENCE.md +2 -2
- package/dist/index.d.mts +49 -10
- package/dist/index.d.ts +49 -10
- package/dist/index.js +34 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,6 +110,7 @@ const ac = new AIAutocomplete(container, {
|
|
|
110
110
|
closeDropdownOnBlur: true, // false = keep dropdown open even when input loses focus
|
|
111
111
|
prependPlaceholder: true, // false = show the starting state's lead-in text as a hint only; a picked option is not written after it
|
|
112
112
|
showNonTappableOptions: true, // false = hide non-tappable options from the dropdown
|
|
113
|
+
allOption: false, // true = lead a plain question with an All row that skips it
|
|
113
114
|
locationSearch: true, // false = a location field takes typed text only, no lookups
|
|
114
115
|
showSkipButton: true, // false = hide the pill bar's "skip" button (trailing edge)
|
|
115
116
|
showOptionIcons: true, // false = render option rows as text only (no icons)
|
|
@@ -530,9 +531,9 @@ Pressing <kbd>→</kbd> at the end of the input dismisses the active pill. The d
|
|
|
530
531
|
{ placeholder: "", parameter: "goal", text: "skipped", kind: null }
|
|
531
532
|
```
|
|
532
533
|
|
|
533
|
-
Skipped entries are appended after the filled params (they have no position in the query) and are deduped by parameter. A skip is dropped if a param of the same parameter ends up filled anyway. Skipping the last available pill triggers an immediate request so the server can suggest something else; earlier skips ride along on the next request. `reset()` clears them.
|
|
534
|
+
Skipped entries are appended after the filled params (they have no position in the query) and are deduped by parameter. A skip is dropped if a param of the same parameter ends up filled anyway. Skipping the last available pill triggers an immediate request so the server can suggest something else; earlier skips ride along on the next request. `reset()` clears them, as does clearing the search back to the starting state.
|
|
534
535
|
|
|
535
|
-
> **Reading `state.skippedParams` directly:** the array
|
|
536
|
+
> **Reading `state.skippedParams` directly:** the array lasts until `reset()` or a cleared search. The "drop a skip whose parameter got filled" rule is applied when the payload is built, not by pruning the array — so if the user skips `goal` and later fills one, the raw array still holds the `goal` entry. That's deliberate: the filter self-heals if they then delete that param's text, where pruning would discard the signal for good. Apply the same rule yourself with the exported `withSkippedParams(completedParams, skippedParams)`.
|
|
536
537
|
|
|
537
538
|
### Event Subscription
|
|
538
539
|
|
package/REFERENCE.md
CHANGED
|
@@ -289,7 +289,7 @@ fully under your control. (Angular additionally runs its own `href`
|
|
|
289
289
|
sanitiser, so unrecognised schemes like `myapp://…` are rewritten to
|
|
290
290
|
`unsafe:…` in that package only.)
|
|
291
291
|
|
|
292
|
-
**Accessibility.** The strip is a `role="group"` labelled "
|
|
292
|
+
**Accessibility.** The strip is a `role="group"` labelled "Items" (in English; other languages keep their own words); each card
|
|
293
293
|
is a `role="option"` in the tab order, activated with Enter or Space, with a
|
|
294
294
|
visible focus ring. Tabbing into the strip does not close the panel. The row
|
|
295
295
|
scrolls horizontally by trackpad, wheel, touch and keyboard; the page never
|
|
@@ -579,7 +579,7 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
|
|
|
579
579
|
| `--aia-product-compare-at-opacity` | `0.6` | `0.6` | How far the struck price is dimmed. |
|
|
580
580
|
| `--aia-product-vendor-color` | `--aia-option-color` | `--aia-option-color` | Product vendor line. |
|
|
581
581
|
| `--aia-product-focus-ring` | `--aia-option-color-selected` | `--aia-option-color-selected` | Focus ring drawn on a keyboard-focused card. |
|
|
582
|
-
| `--aia-products-label-color` | `--aia-option-color` | `--aia-option-color` | "
|
|
582
|
+
| `--aia-products-label-color` | `--aia-option-color` | `--aia-option-color` | "Items" section label. |
|
|
583
583
|
| `--aia-product-title-font-size` | `8.4px` | `8.4px` | Product title font size. |
|
|
584
584
|
| `--aia-product-price-font-size` | `7.7px` | `7.7px` | Product price font size. |
|
|
585
585
|
| `--aia-product-vendor-font-size` | `7px` | `7px` | Product vendor font size. |
|
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,16 @@ interface CompletedParam {
|
|
|
7
7
|
}
|
|
8
8
|
interface SuggestionOption {
|
|
9
9
|
text: string;
|
|
10
|
+
/**
|
|
11
|
+
* Client-only: the All row the SDK puts first when `allOption` is on.
|
|
12
|
+
* Picking it skips the question, keeping every option.
|
|
13
|
+
*/
|
|
14
|
+
selectsAll?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Client-only: the pictures the All row's tile shows together (two to
|
|
17
|
+
* four), the first options' own. `image_url` holds the first.
|
|
18
|
+
*/
|
|
19
|
+
imageCollage?: string[];
|
|
10
20
|
/**
|
|
11
21
|
* The option's real, matchable value — present when the option has a
|
|
12
22
|
* separate matchable value from its display `text` (e.g. a hierarchical
|
|
@@ -91,6 +101,12 @@ interface SuggestionType {
|
|
|
91
101
|
unit?: string;
|
|
92
102
|
}
|
|
93
103
|
interface Suggestion {
|
|
104
|
+
/**
|
|
105
|
+
* Client-only: set on the questions of an answer that arrived while
|
|
106
|
+
* `allOption` was on (never the starting state's), so this question leads
|
|
107
|
+
* with an All option.
|
|
108
|
+
*/
|
|
109
|
+
leadsWithAll?: boolean;
|
|
94
110
|
parameter: string;
|
|
95
111
|
text: string;
|
|
96
112
|
required: boolean;
|
|
@@ -364,6 +380,11 @@ interface CompletedParamState extends CompletedParam {
|
|
|
364
380
|
suggestionValueType?: SuggestionType;
|
|
365
381
|
/** Source suggestion's `text` — used by re-edit mode to render the dropdown pill. */
|
|
366
382
|
suggestionPlaceholder: string;
|
|
383
|
+
/**
|
|
384
|
+
* The Smart Suggestion's own header ("Smart Suggestion"), kept for a pick from that list so
|
|
385
|
+
* re-edit draws the list again under it; `suggestionPlaceholder` holds the pill's parameter label.
|
|
386
|
+
*/
|
|
387
|
+
suggestionHeader?: string;
|
|
367
388
|
/**
|
|
368
389
|
* Source suggestion's `icon` / `icon_svg` (see {@link Suggestion.icon_svg}),
|
|
369
390
|
* carried so the `optionOverrides` options asked again in re-edit draw the
|
|
@@ -398,11 +419,13 @@ interface CompletedParamState extends CompletedParam {
|
|
|
398
419
|
* `text: "skipped"`, no placeholder) only when a request or a submit result is
|
|
399
420
|
* built. See `withSkippedParams`.
|
|
400
421
|
*
|
|
401
|
-
* The array is
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
422
|
+
* The array is cleared by `reset()` and when the input returns to the
|
|
423
|
+
* starting state (nothing picked, at most the lead-in typed); otherwise it is
|
|
424
|
+
* append-only — a skip is filtered out at build time when a param of its type
|
|
425
|
+
* ended up filled, not pruned here. That's deliberate: the filter self-heals
|
|
426
|
+
* if the user later deletes that param's text and the search still holds
|
|
427
|
+
* something else (the skip reappears in the payload), where pruning would
|
|
428
|
+
* have discarded the signal permanently. Consumers reading this array directly
|
|
406
429
|
* should apply the same filter — `withSkippedParams` is exported for it.
|
|
407
430
|
*/
|
|
408
431
|
interface SkippedParamState {
|
|
@@ -915,9 +938,10 @@ interface CoreInputState {
|
|
|
915
938
|
* Suggestions the user dismissed with the skip key (→). Held apart from
|
|
916
939
|
* `completedParams` because they have no text in the input; folded into the
|
|
917
940
|
* wire `completed_params` array (as `text: "skipped"`) on every request and
|
|
918
|
-
* on the submit result.
|
|
919
|
-
*
|
|
920
|
-
*
|
|
941
|
+
* on the submit result. Cleared by `reset()` and when the input returns to
|
|
942
|
+
* the starting state (nothing picked, at most the lead-in typed);
|
|
943
|
+
* otherwise append-only — see {@link SkippedParamState} for why skips of a
|
|
944
|
+
* since-filled type are filtered at build time rather than pruned here.
|
|
921
945
|
*/
|
|
922
946
|
skippedParams: SkippedParamState[];
|
|
923
947
|
/**
|
|
@@ -1376,6 +1400,13 @@ interface CoreOptions {
|
|
|
1376
1400
|
prependPlaceholder?: boolean;
|
|
1377
1401
|
/** When true (default), non-tappable options are rendered in the dropdown alongside tappable ones. Set to false to hide them entirely. */
|
|
1378
1402
|
showNonTappableOptions?: boolean;
|
|
1403
|
+
/**
|
|
1404
|
+
* When true, a plain question of two or more options past the starting
|
|
1405
|
+
* state leads with an All option, pictured with the first options'
|
|
1406
|
+
* pictures; picking it skips the question. The price question, which
|
|
1407
|
+
* declines the bound with its own "any price", gets none. Default false.
|
|
1408
|
+
*/
|
|
1409
|
+
allOption?: boolean;
|
|
1379
1410
|
/**
|
|
1380
1411
|
* When true (default), a location parameter without options searches the
|
|
1381
1412
|
* server's location search (cities, addresses, landmarks) as the user types
|
|
@@ -3009,6 +3040,8 @@ declare const en: {
|
|
|
3009
3040
|
scrollArrow: string;
|
|
3010
3041
|
keepTyping: string;
|
|
3011
3042
|
done: string;
|
|
3043
|
+
/** The first option of a question, which answers it with every option: the question is skipped. */
|
|
3044
|
+
allOption: string;
|
|
3012
3045
|
timeLabel: string;
|
|
3013
3046
|
locationSearch: string;
|
|
3014
3047
|
locationNoResults: string;
|
|
@@ -3050,7 +3083,7 @@ declare function uiStringsFor(language?: string): UIStrings;
|
|
|
3050
3083
|
* reserved fade band when there is one (below-mode with the footer), and
|
|
3051
3084
|
* floats a small gap above the grid's edge in layouts that zero the band
|
|
3052
3085
|
* (`optionsPosition="above"`). When a product strip follows the grid it
|
|
3053
|
-
* instead centres itself on the strip's "
|
|
3086
|
+
* instead centres itself on the strip's "Items" label row — the label
|
|
3054
3087
|
* carries `data-aia-products-label` for this — so it sits on the seam
|
|
3055
3088
|
* between the two sections rather than over the last visible option row
|
|
3056
3089
|
* (2026-09-14, from the Shopify storefront). A new
|
|
@@ -3459,6 +3492,12 @@ interface SubmitResultExtras {
|
|
|
3459
3492
|
*/
|
|
3460
3493
|
declare function buildSubmitResult(text: string, completedParams: CompletedParamState[], skippedParams?: SkippedParamState[], extras?: SubmitResultExtras): AutocompleteResult;
|
|
3461
3494
|
|
|
3495
|
+
/**
|
|
3496
|
+
* The question re-edit asks of a completed param: its own suggestion, from the cached metadata.
|
|
3497
|
+
* A pick from the Smart Suggestion list is asked again as that list, under its header, so its
|
|
3498
|
+
* rows keep the parameter each one answers.
|
|
3499
|
+
*/
|
|
3500
|
+
declare function editingSuggestion(editing: CompletedParamState): Suggestion;
|
|
3462
3501
|
/** True for the suggestion whose options complete the word being typed. */
|
|
3463
3502
|
declare function isTraditionalAutocompleteSuggestion(suggestion: Suggestion | undefined | null): boolean;
|
|
3464
3503
|
/** True for a suggestion drawn with the Smart Suggestion header: the traditional autocomplete one, or a question the server marks. */
|
|
@@ -3475,4 +3514,4 @@ declare const SMART_SUGGESTION_SPARKLE_SVG: string;
|
|
|
3475
3514
|
/** True when some pill is a question the shopper can decline. */
|
|
3476
3515
|
declare function hasSkippablePill(suggestions: Suggestion[]): boolean;
|
|
3477
3516
|
|
|
3478
|
-
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, EDITOR_GROW_MS, type ExpressedFilter, type FilterOp, type FormatType, HINT_ATTR, HINT_EL_ATTR, HINT_HOLD_MS, type IdentifiedParam, type IdentifiedParamState, type InputItem, LOCATION_META_KEY, LOCATION_MIN_QUERY, type LocationPlace, type LocationStatus, type LocationView, type LooseDateOptions, MULTI_DONE_FIT_VAR, MULTI_SELECT_TOGGLE_MIN_PX, MULTI_SELECT_TOGGLE_SLOP_PX, 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, PANEL_ENTER_DELAY_MS, PANEL_ENTER_MS, PANEL_GHOST_CLASS, PANEL_GLIDE_MS, PANEL_LEAVE_MS, 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 SelectOptionOptions, type SkippedParamState, type StartingHintOption, 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, attachChipRemove, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildLocationOption, buildQuery, buildSubmitResult, buildTimeOption, cancelStartingHint, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateFloorFor, dateSelectionFor, destroyPanelMorph, extractPlainText, findMultiSelectDone, fitMultiSelectDone, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatPlace, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, inPanelGhost, isCalendarFormat, isDimmedDay, isMultiSelectToggleTap, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, isoTime, keepCaretOnChip, labelTraditionalAutocomplete, locationEndpointFor, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, notePanelMorphHeight, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, panelMorphGlide, panelMorphKey, panelMorphTargetHeight, parseDate, parseLooseDate, parseLooseDateRange, parseTime, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, queryLive, releasePanelHug, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, settlePanelMorph, shopifyImageSrc, startingHintOptions, syncPanelHug, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, watchEditorHeight, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|
|
3517
|
+
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, EDITOR_GROW_MS, type ExpressedFilter, type FilterOp, type FormatType, HINT_ATTR, HINT_EL_ATTR, HINT_HOLD_MS, type IdentifiedParam, type IdentifiedParamState, type InputItem, LOCATION_META_KEY, LOCATION_MIN_QUERY, type LocationPlace, type LocationStatus, type LocationView, type LooseDateOptions, MULTI_DONE_FIT_VAR, MULTI_SELECT_TOGGLE_MIN_PX, MULTI_SELECT_TOGGLE_SLOP_PX, 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, PANEL_ENTER_DELAY_MS, PANEL_ENTER_MS, PANEL_GHOST_CLASS, PANEL_GLIDE_MS, PANEL_LEAVE_MS, 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 SelectOptionOptions, type SkippedParamState, type StartingHintOption, 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, attachChipRemove, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildLocationOption, buildQuery, buildSubmitResult, buildTimeOption, cancelStartingHint, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateFloorFor, dateSelectionFor, destroyPanelMorph, editingSuggestion, extractPlainText, findMultiSelectDone, fitMultiSelectDone, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatPlace, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, inPanelGhost, isCalendarFormat, isDimmedDay, isMultiSelectToggleTap, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, isoTime, keepCaretOnChip, labelTraditionalAutocomplete, locationEndpointFor, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, notePanelMorphHeight, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, panelMorphGlide, panelMorphKey, panelMorphTargetHeight, parseDate, parseLooseDate, parseLooseDateRange, parseTime, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, queryLive, releasePanelHug, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, settlePanelMorph, shopifyImageSrc, startingHintOptions, syncPanelHug, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, watchEditorHeight, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,16 @@ interface CompletedParam {
|
|
|
7
7
|
}
|
|
8
8
|
interface SuggestionOption {
|
|
9
9
|
text: string;
|
|
10
|
+
/**
|
|
11
|
+
* Client-only: the All row the SDK puts first when `allOption` is on.
|
|
12
|
+
* Picking it skips the question, keeping every option.
|
|
13
|
+
*/
|
|
14
|
+
selectsAll?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Client-only: the pictures the All row's tile shows together (two to
|
|
17
|
+
* four), the first options' own. `image_url` holds the first.
|
|
18
|
+
*/
|
|
19
|
+
imageCollage?: string[];
|
|
10
20
|
/**
|
|
11
21
|
* The option's real, matchable value — present when the option has a
|
|
12
22
|
* separate matchable value from its display `text` (e.g. a hierarchical
|
|
@@ -91,6 +101,12 @@ interface SuggestionType {
|
|
|
91
101
|
unit?: string;
|
|
92
102
|
}
|
|
93
103
|
interface Suggestion {
|
|
104
|
+
/**
|
|
105
|
+
* Client-only: set on the questions of an answer that arrived while
|
|
106
|
+
* `allOption` was on (never the starting state's), so this question leads
|
|
107
|
+
* with an All option.
|
|
108
|
+
*/
|
|
109
|
+
leadsWithAll?: boolean;
|
|
94
110
|
parameter: string;
|
|
95
111
|
text: string;
|
|
96
112
|
required: boolean;
|
|
@@ -364,6 +380,11 @@ interface CompletedParamState extends CompletedParam {
|
|
|
364
380
|
suggestionValueType?: SuggestionType;
|
|
365
381
|
/** Source suggestion's `text` — used by re-edit mode to render the dropdown pill. */
|
|
366
382
|
suggestionPlaceholder: string;
|
|
383
|
+
/**
|
|
384
|
+
* The Smart Suggestion's own header ("Smart Suggestion"), kept for a pick from that list so
|
|
385
|
+
* re-edit draws the list again under it; `suggestionPlaceholder` holds the pill's parameter label.
|
|
386
|
+
*/
|
|
387
|
+
suggestionHeader?: string;
|
|
367
388
|
/**
|
|
368
389
|
* Source suggestion's `icon` / `icon_svg` (see {@link Suggestion.icon_svg}),
|
|
369
390
|
* carried so the `optionOverrides` options asked again in re-edit draw the
|
|
@@ -398,11 +419,13 @@ interface CompletedParamState extends CompletedParam {
|
|
|
398
419
|
* `text: "skipped"`, no placeholder) only when a request or a submit result is
|
|
399
420
|
* built. See `withSkippedParams`.
|
|
400
421
|
*
|
|
401
|
-
* The array is
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
422
|
+
* The array is cleared by `reset()` and when the input returns to the
|
|
423
|
+
* starting state (nothing picked, at most the lead-in typed); otherwise it is
|
|
424
|
+
* append-only — a skip is filtered out at build time when a param of its type
|
|
425
|
+
* ended up filled, not pruned here. That's deliberate: the filter self-heals
|
|
426
|
+
* if the user later deletes that param's text and the search still holds
|
|
427
|
+
* something else (the skip reappears in the payload), where pruning would
|
|
428
|
+
* have discarded the signal permanently. Consumers reading this array directly
|
|
406
429
|
* should apply the same filter — `withSkippedParams` is exported for it.
|
|
407
430
|
*/
|
|
408
431
|
interface SkippedParamState {
|
|
@@ -915,9 +938,10 @@ interface CoreInputState {
|
|
|
915
938
|
* Suggestions the user dismissed with the skip key (→). Held apart from
|
|
916
939
|
* `completedParams` because they have no text in the input; folded into the
|
|
917
940
|
* wire `completed_params` array (as `text: "skipped"`) on every request and
|
|
918
|
-
* on the submit result.
|
|
919
|
-
*
|
|
920
|
-
*
|
|
941
|
+
* on the submit result. Cleared by `reset()` and when the input returns to
|
|
942
|
+
* the starting state (nothing picked, at most the lead-in typed);
|
|
943
|
+
* otherwise append-only — see {@link SkippedParamState} for why skips of a
|
|
944
|
+
* since-filled type are filtered at build time rather than pruned here.
|
|
921
945
|
*/
|
|
922
946
|
skippedParams: SkippedParamState[];
|
|
923
947
|
/**
|
|
@@ -1376,6 +1400,13 @@ interface CoreOptions {
|
|
|
1376
1400
|
prependPlaceholder?: boolean;
|
|
1377
1401
|
/** When true (default), non-tappable options are rendered in the dropdown alongside tappable ones. Set to false to hide them entirely. */
|
|
1378
1402
|
showNonTappableOptions?: boolean;
|
|
1403
|
+
/**
|
|
1404
|
+
* When true, a plain question of two or more options past the starting
|
|
1405
|
+
* state leads with an All option, pictured with the first options'
|
|
1406
|
+
* pictures; picking it skips the question. The price question, which
|
|
1407
|
+
* declines the bound with its own "any price", gets none. Default false.
|
|
1408
|
+
*/
|
|
1409
|
+
allOption?: boolean;
|
|
1379
1410
|
/**
|
|
1380
1411
|
* When true (default), a location parameter without options searches the
|
|
1381
1412
|
* server's location search (cities, addresses, landmarks) as the user types
|
|
@@ -3009,6 +3040,8 @@ declare const en: {
|
|
|
3009
3040
|
scrollArrow: string;
|
|
3010
3041
|
keepTyping: string;
|
|
3011
3042
|
done: string;
|
|
3043
|
+
/** The first option of a question, which answers it with every option: the question is skipped. */
|
|
3044
|
+
allOption: string;
|
|
3012
3045
|
timeLabel: string;
|
|
3013
3046
|
locationSearch: string;
|
|
3014
3047
|
locationNoResults: string;
|
|
@@ -3050,7 +3083,7 @@ declare function uiStringsFor(language?: string): UIStrings;
|
|
|
3050
3083
|
* reserved fade band when there is one (below-mode with the footer), and
|
|
3051
3084
|
* floats a small gap above the grid's edge in layouts that zero the band
|
|
3052
3085
|
* (`optionsPosition="above"`). When a product strip follows the grid it
|
|
3053
|
-
* instead centres itself on the strip's "
|
|
3086
|
+
* instead centres itself on the strip's "Items" label row — the label
|
|
3054
3087
|
* carries `data-aia-products-label` for this — so it sits on the seam
|
|
3055
3088
|
* between the two sections rather than over the last visible option row
|
|
3056
3089
|
* (2026-09-14, from the Shopify storefront). A new
|
|
@@ -3459,6 +3492,12 @@ interface SubmitResultExtras {
|
|
|
3459
3492
|
*/
|
|
3460
3493
|
declare function buildSubmitResult(text: string, completedParams: CompletedParamState[], skippedParams?: SkippedParamState[], extras?: SubmitResultExtras): AutocompleteResult;
|
|
3461
3494
|
|
|
3495
|
+
/**
|
|
3496
|
+
* The question re-edit asks of a completed param: its own suggestion, from the cached metadata.
|
|
3497
|
+
* A pick from the Smart Suggestion list is asked again as that list, under its header, so its
|
|
3498
|
+
* rows keep the parameter each one answers.
|
|
3499
|
+
*/
|
|
3500
|
+
declare function editingSuggestion(editing: CompletedParamState): Suggestion;
|
|
3462
3501
|
/** True for the suggestion whose options complete the word being typed. */
|
|
3463
3502
|
declare function isTraditionalAutocompleteSuggestion(suggestion: Suggestion | undefined | null): boolean;
|
|
3464
3503
|
/** True for a suggestion drawn with the Smart Suggestion header: the traditional autocomplete one, or a question the server marks. */
|
|
@@ -3475,4 +3514,4 @@ declare const SMART_SUGGESTION_SPARKLE_SVG: string;
|
|
|
3475
3514
|
/** True when some pill is a question the shopper can decline. */
|
|
3476
3515
|
declare function hasSkippablePill(suggestions: Suggestion[]): boolean;
|
|
3477
3516
|
|
|
3478
|
-
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, EDITOR_GROW_MS, type ExpressedFilter, type FilterOp, type FormatType, HINT_ATTR, HINT_EL_ATTR, HINT_HOLD_MS, type IdentifiedParam, type IdentifiedParamState, type InputItem, LOCATION_META_KEY, LOCATION_MIN_QUERY, type LocationPlace, type LocationStatus, type LocationView, type LooseDateOptions, MULTI_DONE_FIT_VAR, MULTI_SELECT_TOGGLE_MIN_PX, MULTI_SELECT_TOGGLE_SLOP_PX, 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, PANEL_ENTER_DELAY_MS, PANEL_ENTER_MS, PANEL_GHOST_CLASS, PANEL_GLIDE_MS, PANEL_LEAVE_MS, 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 SelectOptionOptions, type SkippedParamState, type StartingHintOption, 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, attachChipRemove, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildLocationOption, buildQuery, buildSubmitResult, buildTimeOption, cancelStartingHint, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateFloorFor, dateSelectionFor, destroyPanelMorph, extractPlainText, findMultiSelectDone, fitMultiSelectDone, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatPlace, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, inPanelGhost, isCalendarFormat, isDimmedDay, isMultiSelectToggleTap, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, isoTime, keepCaretOnChip, labelTraditionalAutocomplete, locationEndpointFor, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, notePanelMorphHeight, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, panelMorphGlide, panelMorphKey, panelMorphTargetHeight, parseDate, parseLooseDate, parseLooseDateRange, parseTime, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, queryLive, releasePanelHug, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, settlePanelMorph, shopifyImageSrc, startingHintOptions, syncPanelHug, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, watchEditorHeight, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|
|
3517
|
+
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, EDITOR_GROW_MS, type ExpressedFilter, type FilterOp, type FormatType, HINT_ATTR, HINT_EL_ATTR, HINT_HOLD_MS, type IdentifiedParam, type IdentifiedParamState, type InputItem, LOCATION_META_KEY, LOCATION_MIN_QUERY, type LocationPlace, type LocationStatus, type LocationView, type LooseDateOptions, MULTI_DONE_FIT_VAR, MULTI_SELECT_TOGGLE_MIN_PX, MULTI_SELECT_TOGGLE_SLOP_PX, 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, PANEL_ENTER_DELAY_MS, PANEL_ENTER_MS, PANEL_GHOST_CLASS, PANEL_GLIDE_MS, PANEL_LEAVE_MS, 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 SelectOptionOptions, type SkippedParamState, type StartingHintOption, 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, attachChipRemove, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildLocationOption, buildQuery, buildSubmitResult, buildTimeOption, cancelStartingHint, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateFloorFor, dateSelectionFor, destroyPanelMorph, editingSuggestion, extractPlainText, findMultiSelectDone, fitMultiSelectDone, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatPlace, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, inPanelGhost, isCalendarFormat, isDimmedDay, isMultiSelectToggleTap, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, isoTime, keepCaretOnChip, labelTraditionalAutocomplete, locationEndpointFor, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, notePanelMorphHeight, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, panelMorphGlide, panelMorphKey, panelMorphTargetHeight, parseDate, parseLooseDate, parseLooseDateRange, parseTime, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, queryLive, releasePanelHug, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, settlePanelMorph, shopifyImageSrc, startingHintOptions, syncPanelHug, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, watchEditorHeight, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|