@magicx-eng/ai-autocomplete-vanilla 0.79.0 → 0.80.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 +27 -22
- package/REFERENCE.md +123 -1
- package/dist/index.d.mts +259 -5
- package/dist/index.d.ts +259 -5
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -288,6 +288,12 @@ interface ExpressedFilter {
|
|
|
288
288
|
parameter: string;
|
|
289
289
|
value: string;
|
|
290
290
|
op: FilterOp;
|
|
291
|
+
/**
|
|
292
|
+
* Filters with the same group came from one typed word ("fleece" read as a
|
|
293
|
+
* material and as a category). One of them is enough. Absent on a filter
|
|
294
|
+
* that has no alternatives.
|
|
295
|
+
*/
|
|
296
|
+
or_group?: string;
|
|
291
297
|
}
|
|
292
298
|
/**
|
|
293
299
|
* One catalog item the query narrowed down to, in the shape needed to render
|
|
@@ -382,6 +388,11 @@ interface CustomFieldsReport {
|
|
|
382
388
|
*/
|
|
383
389
|
dropped_filters: ExpressedFilter[];
|
|
384
390
|
items: MatchedItems;
|
|
391
|
+
/**
|
|
392
|
+
* The text part of the search, the words besides `applied_filters`. Send it
|
|
393
|
+
* as the text query of a site's own results page. It can be empty.
|
|
394
|
+
*/
|
|
395
|
+
search_query?: string;
|
|
385
396
|
}
|
|
386
397
|
interface CompletedParamState extends CompletedParam {
|
|
387
398
|
/** Client-only identity for values committed together. */
|
|
@@ -674,6 +685,16 @@ interface AutocompleteResult {
|
|
|
674
685
|
* when that response carried the block; see {@link CustomFieldsReport}.
|
|
675
686
|
*/
|
|
676
687
|
custom_fields?: CustomFieldsReport;
|
|
688
|
+
/**
|
|
689
|
+
* Present, and true, when `custom_fields` does not answer this query: the
|
|
690
|
+
* block came from the answer to an earlier query (the request for this one
|
|
691
|
+
* has not come back yet), or from an answer that only completes the word
|
|
692
|
+
* being typed and read no filters from the query. Read `applied_filters`
|
|
693
|
+
* and `items` only when it is absent. With `awaitAnswerOnSubmit` on, a
|
|
694
|
+
* submit never carries it: the block answers the submitted query or is left
|
|
695
|
+
* out.
|
|
696
|
+
*/
|
|
697
|
+
custom_fields_stale?: true;
|
|
677
698
|
}
|
|
678
699
|
|
|
679
700
|
/** A calendar month on screen. `month` is 0-based, matching `Date#getMonth`. */
|
|
@@ -1445,6 +1466,30 @@ interface CoreOptions {
|
|
|
1445
1466
|
dropdownTrigger?: "auto" | "manual" | "hidden";
|
|
1446
1467
|
/** When true (default), the dropdown closes when the input loses focus. Set to false to keep it open whenever options are available, regardless of focus. */
|
|
1447
1468
|
closeDropdownOnBlur?: boolean;
|
|
1469
|
+
/**
|
|
1470
|
+
* Whether picking an option puts focus in the input. Default `"auto"`:
|
|
1471
|
+
* where the pointer hovers (a desktop) the input is focused with the caret
|
|
1472
|
+
* after the new chip; on a touch device it is not, and a tapped pick blurs
|
|
1473
|
+
* it, so the keyboard goes away and the next question's options are in
|
|
1474
|
+
* view. The dropdown stays open, and a tap on the input or on a chip brings
|
|
1475
|
+
* the keyboard back. A pick made from the keyboard (Enter) keeps focus
|
|
1476
|
+
* everywhere. `"always"` focuses on every device, which keeps the keyboard
|
|
1477
|
+
* up on a phone. `"never"`: a pick never focuses the input. On a touch
|
|
1478
|
+
* device a tapped pick still puts the keyboard away, as with `"auto"`.
|
|
1479
|
+
*/
|
|
1480
|
+
focusInputOnSelect?: "auto" | "always" | "never";
|
|
1481
|
+
/**
|
|
1482
|
+
* Whether anything is offered before the shopper types. Default `true`: the
|
|
1483
|
+
* starting state (its opening question, lead-in text and items) is requested
|
|
1484
|
+
* on mount and whenever the input is empty again, and shows when the input
|
|
1485
|
+
* has focus. Set to `false` to request and show nothing while the input is
|
|
1486
|
+
* empty: no starting-state request (by its URL or as an empty query), a
|
|
1487
|
+
* closed dropdown, and no lead-in or hint in the box. From the first typed
|
|
1488
|
+
* character everything works as usual. `autoFocus` only decides whether the
|
|
1489
|
+
* input takes focus on mount, and `dropdownTrigger` also hides the
|
|
1490
|
+
* suggestions for typed text; this option hides only the starting state.
|
|
1491
|
+
*/
|
|
1492
|
+
startingState?: boolean;
|
|
1448
1493
|
/**
|
|
1449
1494
|
* Whether the starting state's lead-in text is put in front of the first
|
|
1450
1495
|
* answer. Default `true`: the text shows in the empty input and picking an
|
|
@@ -1567,6 +1612,28 @@ interface CoreOptions {
|
|
|
1567
1612
|
* all of it off: nothing is marked, and every press calls your handler.
|
|
1568
1613
|
*/
|
|
1569
1614
|
submitProgress?: boolean;
|
|
1615
|
+
/**
|
|
1616
|
+
* When true, a submit (Enter, the submit button, See all results) whose
|
|
1617
|
+
* `custom_fields` do not answer the submitted query first gets the full
|
|
1618
|
+
* answer for it, then calls `onSubmit` with that answer's `custom_fields`,
|
|
1619
|
+
* `identified_params` and `is_ready`. That is the case when the shopper
|
|
1620
|
+
* submits while the dropdown shows completions of the word being typed, or
|
|
1621
|
+
* before the request for the latest text came back. The submit shows as in
|
|
1622
|
+
* progress (`isSubmitting`) while it waits, a second submit is ignored, and
|
|
1623
|
+
* typing, tapping an option or a product, or pressing elsewhere cancels it
|
|
1624
|
+
* without calling `onSubmit`. The wait is bounded by
|
|
1625
|
+
* `submitAnswerTimeoutMs`: when no answer came in time, or the request
|
|
1626
|
+
* failed, `onSubmit` is called once with no `custom_fields` key, never with
|
|
1627
|
+
* an earlier query's block, so treat a missing block as "no filters known".
|
|
1628
|
+
* Default: false, where `onSubmit` is called at once and a block that does
|
|
1629
|
+
* not answer the query is marked `custom_fields_stale: true`.
|
|
1630
|
+
*/
|
|
1631
|
+
awaitAnswerOnSubmit?: boolean;
|
|
1632
|
+
/**
|
|
1633
|
+
* The longest a submit waits for its answer, in milliseconds, with
|
|
1634
|
+
* `awaitAnswerOnSubmit` on or through `awaitSubmitResult()`. Default: 2500.
|
|
1635
|
+
*/
|
|
1636
|
+
submitAnswerTimeoutMs?: number;
|
|
1570
1637
|
/**
|
|
1571
1638
|
* How the product strip lays its cards out. `"row"` (the default) is a
|
|
1572
1639
|
* horizontally scrolling shelf of cards. `"list"` stacks the same cards as
|
|
@@ -1661,6 +1728,11 @@ interface CoreOptions {
|
|
|
1661
1728
|
* its own `domRefs.input` when re-edit / Backspace flows need to park the
|
|
1662
1729
|
* caret at a specific plain-text offset. Wrappers that own the DOM (React,
|
|
1663
1730
|
* etc.) must provide this — vanilla "full" mode falls back to `domRefs`.
|
|
1731
|
+
* Not called after a pick where a pick does not focus the field
|
|
1732
|
+
* (`focusInputOnSelect`: a touch-primary device by default), unless the
|
|
1733
|
+
* field still holds focus because the pick was made from the keyboard. A
|
|
1734
|
+
* `setCursor` that focuses would raise the keyboard over the next
|
|
1735
|
+
* question's options.
|
|
1664
1736
|
* @internal
|
|
1665
1737
|
*/
|
|
1666
1738
|
setCursor?: (offset: number) => void;
|
|
@@ -1670,13 +1742,21 @@ interface CoreOptions {
|
|
|
1670
1742
|
declare const MULTI_SELECT_TOGGLE_SLOP_PX = 10;
|
|
1671
1743
|
/** The checkbox zone is never narrower than this, measured from the row's leading edge. */
|
|
1672
1744
|
declare const MULTI_SELECT_TOGGLE_MIN_PX = 44;
|
|
1673
|
-
/** Passed with an option pick to say how
|
|
1745
|
+
/** Passed with an option pick to say how it was made. */
|
|
1674
1746
|
interface SelectOptionOptions {
|
|
1675
1747
|
/**
|
|
1676
1748
|
* In a multi_select question: answer now with this option (plus any already
|
|
1677
1749
|
* ticked) instead of only ticking it and waiting for Done. Ignored elsewhere.
|
|
1678
1750
|
*/
|
|
1679
1751
|
commit?: boolean;
|
|
1752
|
+
/**
|
|
1753
|
+
* The pick comes from the keyboard, not from a tap. The field then keeps
|
|
1754
|
+
* focus on a touch device, where a tapped pick blurs it to put the keyboard
|
|
1755
|
+
* away (see `focusInputOnSelect`). A pick made while a key press or a
|
|
1756
|
+
* pointer-less click is being handled is read this way without the hint;
|
|
1757
|
+
* pass it for one made later (after a timer or a request).
|
|
1758
|
+
*/
|
|
1759
|
+
fromKeyboard?: boolean;
|
|
1680
1760
|
}
|
|
1681
1761
|
/**
|
|
1682
1762
|
* Whether a click on a multi_select row landed in its checkbox zone.
|
|
@@ -1720,6 +1800,12 @@ declare class AIAutocomplete {
|
|
|
1720
1800
|
private keyboardController;
|
|
1721
1801
|
private pillsController;
|
|
1722
1802
|
private holdOpen;
|
|
1803
|
+
/** Keystrokes being handled (see `typed`). */
|
|
1804
|
+
private typing;
|
|
1805
|
+
/** Picks in progress (see `pick`). */
|
|
1806
|
+
private picking;
|
|
1807
|
+
/** The last click or key press seen on the document (see `onDocumentInput`). */
|
|
1808
|
+
private lastInput;
|
|
1723
1809
|
private productsController;
|
|
1724
1810
|
private optionSource;
|
|
1725
1811
|
private reEdit;
|
|
@@ -1783,6 +1869,16 @@ declare class AIAutocomplete {
|
|
|
1783
1869
|
private readonly emitSubmit;
|
|
1784
1870
|
/** The submit in progress, if any: see `CoreInputState.isSubmitting`. */
|
|
1785
1871
|
private readonly submitHold;
|
|
1872
|
+
/**
|
|
1873
|
+
* The submit waiting for the answer to its own query, if any
|
|
1874
|
+
* (`awaitAnswerOnSubmit`, `awaitSubmitResult()`). A change to that query
|
|
1875
|
+
* that is not the SDK's own ends the wait.
|
|
1876
|
+
*/
|
|
1877
|
+
private answerWait;
|
|
1878
|
+
/** True while the SDK itself edits the query a submit waits for (it ends the typed word). */
|
|
1879
|
+
private settlingSubmit;
|
|
1880
|
+
/** Listens for the shopper moving on while a submit waits for its answer. */
|
|
1881
|
+
private readonly answerHold;
|
|
1786
1882
|
/** The product selection in progress, if any: see `selectingProductId`. */
|
|
1787
1883
|
private readonly productHold;
|
|
1788
1884
|
/**
|
|
@@ -1897,6 +1993,66 @@ declare class AIAutocomplete {
|
|
|
1897
1993
|
* the editor to be focused afterwards.
|
|
1898
1994
|
*/
|
|
1899
1995
|
private scheduleSetCursor;
|
|
1996
|
+
/**
|
|
1997
|
+
* Whether a pick puts focus in the field (`focusInputOnSelect`): by default
|
|
1998
|
+
* yes where the pointer hovers, no on a touch-primary device. For wrappers
|
|
1999
|
+
* that own the input.
|
|
2000
|
+
*/
|
|
2001
|
+
focusesInputOnSelect(): boolean;
|
|
2002
|
+
/**
|
|
2003
|
+
* The caret after a picked option has become a chip. As `scheduleSetCursor`
|
|
2004
|
+
* where a pick focuses the field. Where it does not (a touch-primary device
|
|
2005
|
+
* by default), the field is left unfocused, so the keyboard stays down.
|
|
2006
|
+
*
|
|
2007
|
+
* In "headless" mode that means `setCursor` is not called for such a pick
|
|
2008
|
+
* unless the field still holds focus (an answer given from the keyboard).
|
|
2009
|
+
* A wrapper's `setCursor` focuses its input, and the core is the one that
|
|
2010
|
+
* knows the call came from a pick.
|
|
2011
|
+
*/
|
|
2012
|
+
private schedulePickCursor;
|
|
2013
|
+
/**
|
|
2014
|
+
* Run a pick (an answer, a tick, a skip) as one step for the held-open
|
|
2015
|
+
* panel, and put the keyboard away at the end of it where a pick does not
|
|
2016
|
+
* focus the field. Every public route to a pick goes through here; they
|
|
2017
|
+
* nest, and only the outermost one puts the keyboard away.
|
|
2018
|
+
*/
|
|
2019
|
+
private pick;
|
|
2020
|
+
/**
|
|
2021
|
+
* Run a keystroke's work. A pick it makes (Enter on an option, a space that
|
|
2022
|
+
* picks a place, → to skip) is made from the keyboard, which the shopper is
|
|
2023
|
+
* still using: the field keeps focus on every device.
|
|
2024
|
+
*/
|
|
2025
|
+
private typed;
|
|
2026
|
+
/**
|
|
2027
|
+
* Keeps, ahead of every handler, the click or key press now being
|
|
2028
|
+
* dispatched, so a pick made during it can be told from a tap.
|
|
2029
|
+
*/
|
|
2030
|
+
private onDocumentInput;
|
|
2031
|
+
/**
|
|
2032
|
+
* The event being dispatched right now came from the keyboard: any
|
|
2033
|
+
* `keydown`, and a click that carries no click count (`detail === 0`: Enter
|
|
2034
|
+
* or Space on a focused row or button, or assistive activation with no
|
|
2035
|
+
* pointer, the same reading `isMultiSelectToggleTap` makes). A pick made
|
|
2036
|
+
* during it is a keyboard pick and keeps focus, whichever route it takes
|
|
2037
|
+
* (an option row, the All row, skip, Done, a calendar day, a place, a
|
|
2038
|
+
* host's own key handler) and whichever package draws it. An event whose
|
|
2039
|
+
* dispatch is over (`eventPhase` back at 0) says nothing: a pick made later,
|
|
2040
|
+
* from a timer or a response, is judged on its own.
|
|
2041
|
+
*/
|
|
2042
|
+
private keyboardInputInFlight;
|
|
2043
|
+
private watchDocumentInput;
|
|
2044
|
+
/**
|
|
2045
|
+
* On a touch-primary device where a pick does not focus the field
|
|
2046
|
+
* (`focusInputOnSelect` "auto" or "never"), a tapped pick puts the keyboard
|
|
2047
|
+
* away: the field that holds it is blurred, so the next question's options
|
|
2048
|
+
* are not under it. Only while the widget counts as focused, so the element
|
|
2049
|
+
* blurred is the widget's own field (the editor, the location search field,
|
|
2050
|
+
* or the input a Tier 2 / headless integration reports focus for).
|
|
2051
|
+
*
|
|
2052
|
+
* The panel is latched open before the blur, never in reaction to it
|
|
2053
|
+
* (`HoldOpenController.holdThroughBlur`).
|
|
2054
|
+
*/
|
|
2055
|
+
private releaseKeyboardAfterPick;
|
|
1900
2056
|
clearNewParamId(): void;
|
|
1901
2057
|
/**
|
|
1902
2058
|
* Open the calendar for a span the server identified as a date.
|
|
@@ -1939,9 +2095,28 @@ declare class AIAutocomplete {
|
|
|
1939
2095
|
* A typed word that equals exactly one completion candidate becomes a completed param, the same as Enter.
|
|
1940
2096
|
* A typed value the response returned with no pill yet (`state: "need_confirmation"`) joins `identifiedParams` here, if the text has not changed since that response.
|
|
1941
2097
|
* It is in no earlier state read, so a submit that skips this call leaves it out.
|
|
1942
|
-
* Read the updated state with `getState()` to build the result
|
|
2098
|
+
* Read the updated state with `getState()` to build the result, or wait for
|
|
2099
|
+
* the answer to it with `awaitSubmitResult()`: the `customFields` in state
|
|
2100
|
+
* are the last response's, which may answer an earlier query.
|
|
1943
2101
|
*/
|
|
1944
2102
|
prepareSubmit(): void;
|
|
2103
|
+
/**
|
|
2104
|
+
* The result to submit from your own button, with `custom_fields` that
|
|
2105
|
+
* answer it. It prepares the submit as `prepareSubmit()` does. When the
|
|
2106
|
+
* stored answer is not a full answer to the query as it now stands (the
|
|
2107
|
+
* dropdown shows completions of the word being typed, or the request for the
|
|
2108
|
+
* latest text has not come back), it gets that answer first, for up to
|
|
2109
|
+
* `submitAnswerTimeoutMs`, showing the submit as in progress
|
|
2110
|
+
* (`isSubmitting`) meanwhile.
|
|
2111
|
+
*
|
|
2112
|
+
* Resolves to the result: with the answer's `custom_fields`,
|
|
2113
|
+
* `identified_params` and `is_ready`, or with no `custom_fields` key when
|
|
2114
|
+
* no answer came in time or the request failed. Resolves to null when there
|
|
2115
|
+
* is nothing to submit: the shopper changed the input, tapped a product or
|
|
2116
|
+
* pressed elsewhere while it waited, or a submit is already in progress.
|
|
2117
|
+
* Works whatever `awaitAnswerOnSubmit` is set to.
|
|
2118
|
+
*/
|
|
2119
|
+
awaitSubmitResult(): Promise<AutocompleteResult | null>;
|
|
1945
2120
|
/**
|
|
1946
2121
|
* Records a submit in telemetry. The SDK does this itself when it runs the
|
|
1947
2122
|
* submit (Enter, or Tier 1's button); call it only from a submit path you
|
|
@@ -2121,6 +2296,7 @@ declare class AIAutocomplete {
|
|
|
2121
2296
|
* pills would otherwise cost a round-trip each.
|
|
2122
2297
|
*/
|
|
2123
2298
|
skipActivePill(): void;
|
|
2299
|
+
private skipActive;
|
|
2124
2300
|
handleKeyDown(e: KeyboardEvent): void;
|
|
2125
2301
|
setFocused(focused: boolean): void;
|
|
2126
2302
|
/**
|
|
@@ -2149,6 +2325,31 @@ declare class AIAutocomplete {
|
|
|
2149
2325
|
/** Returns the latest applied /suggest request ID, or null before a response or after reset. */
|
|
2150
2326
|
getRequestId(): string | null;
|
|
2151
2327
|
private buildResult;
|
|
2328
|
+
/** The query as it stands, with no catalog report: none that answers it is known. */
|
|
2329
|
+
private buildResultWithoutAnswer;
|
|
2330
|
+
/** Ends the typed word for a submit. The edit is the SDK's own: a waiting submit goes on. */
|
|
2331
|
+
private settleSubmit;
|
|
2332
|
+
/**
|
|
2333
|
+
* Runs a submit the SDK starts: Enter, the submit button, See all results.
|
|
2334
|
+
* With `awaitAnswerOnSubmit`, the handlers are called once the answer to
|
|
2335
|
+
* the submitted query is in, or the wait for it is over.
|
|
2336
|
+
*/
|
|
2337
|
+
private runSubmit;
|
|
2338
|
+
/**
|
|
2339
|
+
* Calls `done` with the result to submit once the store holds a full answer
|
|
2340
|
+
* to the query as it stands after the typed word ended: at once when it
|
|
2341
|
+
* already does, else after the request for it. `done` gets the result
|
|
2342
|
+
* without `custom_fields` when the wait timed out or the request failed,
|
|
2343
|
+
* and null when the wait was cancelled.
|
|
2344
|
+
*/
|
|
2345
|
+
private withSubmitAnswer;
|
|
2346
|
+
/**
|
|
2347
|
+
* Asks for the answer to the submitted query until the store holds it. An
|
|
2348
|
+
* answer can itself change the query (it promotes a typed exact match, and
|
|
2349
|
+
* the typed word is ended again after it), so the next round asks about the
|
|
2350
|
+
* query as it then stands. Gives up after {@link SUBMIT_ANSWER_ROUNDS}.
|
|
2351
|
+
*/
|
|
2352
|
+
private pursueSubmitAnswer;
|
|
2152
2353
|
get listboxId(): string;
|
|
2153
2354
|
get isReady(): boolean;
|
|
2154
2355
|
/**
|
|
@@ -2168,6 +2369,7 @@ declare class AIAutocomplete {
|
|
|
2168
2369
|
refreshProducts(): void;
|
|
2169
2370
|
update(opts: CoreUpdateOptions): void;
|
|
2170
2371
|
selectOption(option: SuggestionOption, how?: SelectOptionOptions): void;
|
|
2372
|
+
private select;
|
|
2171
2373
|
private applyOption;
|
|
2172
2374
|
private startSelectionAnimationTimer;
|
|
2173
2375
|
private resolveVisitorId;
|
|
@@ -2189,6 +2391,12 @@ declare class AIAutocomplete {
|
|
|
2189
2391
|
* for is no longer on screen: the input changed, or the products did.
|
|
2190
2392
|
*/
|
|
2191
2393
|
private subscribeHandoffHolds;
|
|
2394
|
+
/**
|
|
2395
|
+
* Cancels a submit waiting for its answer once the query it waits for is
|
|
2396
|
+
* no longer the one in the input. The SDK's own changes to it (ending the
|
|
2397
|
+
* typed word, an answer promoting an exact match) are followed instead.
|
|
2398
|
+
*/
|
|
2399
|
+
private syncAnswerWait;
|
|
2192
2400
|
private subscribeVisibleImpression;
|
|
2193
2401
|
/**
|
|
2194
2402
|
* Records what a response put on screen: pills and their options in display
|
|
@@ -2821,6 +3029,46 @@ declare const EDITOR_GROW_MS = 340;
|
|
|
2821
3029
|
*/
|
|
2822
3030
|
declare function watchEditorHeight(editor: HTMLElement): () => void;
|
|
2823
3031
|
|
|
3032
|
+
/**
|
|
3033
|
+
* The one answer to "is this a touch-primary device?": the held-open panel
|
|
3034
|
+
* and the focus rule after a pick both ask here, so they cannot disagree.
|
|
3035
|
+
* Its answer is live, so a device that changes its main pointer is followed.
|
|
3036
|
+
* An engine that cannot say (no `matchMedia`, or one that throws, as some
|
|
3037
|
+
* embedded webviews do) is not touch: everything then behaves as on a desktop.
|
|
3038
|
+
*/
|
|
3039
|
+
declare function isTouchPrimary(): boolean;
|
|
3040
|
+
/** `focusInputOnSelect`: whether a pick puts focus in the field. */
|
|
3041
|
+
type FocusInputOnSelect = "auto" | "always" | "never";
|
|
3042
|
+
/**
|
|
3043
|
+
* Resolve `focusInputOnSelect`. `"auto"` (the default) focuses the field
|
|
3044
|
+
* where the pointer hovers and not on a touch-primary device, whose keyboard
|
|
3045
|
+
* would come up over the next question's options.
|
|
3046
|
+
*/
|
|
3047
|
+
declare function focusesInputOnSelect(mode: FocusInputOnSelect | undefined): boolean;
|
|
3048
|
+
/**
|
|
3049
|
+
* Where focus goes once a picked option has become a chip. Shared by the
|
|
3050
|
+
* three Tier 1 editors (vanilla `renderInput`, React
|
|
3051
|
+
* `useContentEditableEditor`, Angular `aiaEditorHost`).
|
|
3052
|
+
*
|
|
3053
|
+
* With `refocus` (see `focusesInputOnSelect`) the editor takes focus and the
|
|
3054
|
+
* caret goes to `offset`, right after the new chip. Without it the editor is
|
|
3055
|
+
* left as it is: a tapped pick has already had its field blurred by the core,
|
|
3056
|
+
* so the keyboard is away and stays away. No caret is placed either, since
|
|
3057
|
+
* setting a selection inside a contentEditable focuses it (Chrome). An editor
|
|
3058
|
+
* that still holds focus was answered from the keyboard (Enter on an option),
|
|
3059
|
+
* which the shopper is using: it keeps focus and gets its caret.
|
|
3060
|
+
*/
|
|
3061
|
+
declare function settlePickFocus(input: HTMLElement, offset: number, refocus: boolean): void;
|
|
3062
|
+
/**
|
|
3063
|
+
* Focus the editor for a click on its wrapper. On a touch-primary device an
|
|
3064
|
+
* editor that held no caret gets it at the end of the text: after a pick that left
|
|
3065
|
+
* the keyboard away the editor has none (see `dropCaretIn`), and a bare
|
|
3066
|
+
* `focus()` on a contentEditable puts it at the start. A tap on the text
|
|
3067
|
+
* itself has already placed the caret by the time the click arrives, and
|
|
3068
|
+
* keeps it.
|
|
3069
|
+
*/
|
|
3070
|
+
declare function focusEditorFromTap(input: HTMLElement): void;
|
|
3071
|
+
|
|
2824
3072
|
/**
|
|
2825
3073
|
* A mouse wheel over the product strip scrolls it sideways.
|
|
2826
3074
|
*
|
|
@@ -3518,8 +3766,8 @@ declare const HANDOFF_NOT_HANDLED: unique symbol;
|
|
|
3518
3766
|
*/
|
|
3519
3767
|
declare const SCHEMA_VERSION = "1.0";
|
|
3520
3768
|
|
|
3521
|
-
/** Base URL for the
|
|
3522
|
-
declare const ATTRIBUTION_URL = "https://ai-
|
|
3769
|
+
/** Base URL for the Intent-1 attribution link in the dropdown footer. */
|
|
3770
|
+
declare const ATTRIBUTION_URL = "https://magicx.ai/intent-1";
|
|
3523
3771
|
/**
|
|
3524
3772
|
* Builds the attribution link URL, appending a `utm_source` query param derived
|
|
3525
3773
|
* from the current page's hostname. This lets analytics attribute the referral to
|
|
@@ -3736,6 +3984,12 @@ interface SubmitResultExtras {
|
|
|
3736
3984
|
* rather than null when no catalog was read.
|
|
3737
3985
|
*/
|
|
3738
3986
|
customFields?: CustomFieldsReport | null;
|
|
3987
|
+
/**
|
|
3988
|
+
* The block does not answer this query: it came from an answer to an
|
|
3989
|
+
* earlier query, or from one that only completes the word being typed.
|
|
3990
|
+
* Marks the result `custom_fields_stale: true`. Default: false.
|
|
3991
|
+
*/
|
|
3992
|
+
customFieldsStale?: boolean;
|
|
3739
3993
|
}
|
|
3740
3994
|
/**
|
|
3741
3995
|
* Builds the `AutocompleteResult` handed to `onSubmit` and `onResult`: the
|
|
@@ -3771,4 +4025,4 @@ declare const SMART_SUGGESTION_SPARKLE_SVG: string;
|
|
|
3771
4025
|
/** True when some pill is a question the shopper can decline. */
|
|
3772
4026
|
declare function hasSkippablePill(suggestions: Suggestion[]): boolean;
|
|
3773
4027
|
|
|
3774
|
-
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, HANDOFF_NOT_HANDLED, HINT_ATTR, HINT_EL_ATTR, HINT_HOLD_MS, type IdentifiedParam, type IdentifiedParamState, type InputItem, LAST_SEARCH_KEY, 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, dropdownPillsFor, 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, pointerMayHighlight, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, queryLive, releasePanelHug, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, settlePanelMorph, shopifyImageSrc, startingHintOptions, syncHighlightScroll, syncPanelHug, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, watchEditorHeight, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|
|
4028
|
+
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 FocusInputOnSelect, type FormatType, HANDOFF_NOT_HANDLED, HINT_ATTR, HINT_EL_ATTR, HINT_HOLD_MS, type IdentifiedParam, type IdentifiedParamState, type InputItem, LAST_SEARCH_KEY, 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, dropdownPillsFor, editingSuggestion, extractPlainText, findMultiSelectDone, fitMultiSelectDone, focusEditorFromTap, focusesInputOnSelect, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatPlace, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, inPanelGhost, isCalendarFormat, isDimmedDay, isMultiSelectToggleTap, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTouchPrimary, 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, pointerMayHighlight, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, queryLive, releasePanelHug, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, settlePanelMorph, settlePickFocus, shopifyImageSrc, startingHintOptions, syncHighlightScroll, syncPanelHug, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, watchEditorHeight, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|