@magicx-eng/ai-autocomplete-vanilla 0.81.3 → 0.82.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 +17 -46
- package/REFERENCE.md +117 -2
- package/dist/index.d.mts +31 -3
- package/dist/index.d.ts +31 -3
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -273,7 +273,7 @@ A suggestion with `type: { kind: "multi_select" }` shows checkbox options and a
|
|
|
273
273
|
|
|
274
274
|
### Location search
|
|
275
275
|
|
|
276
|
-
A location parameter the server sends without options gets a search field that looks up any city or address through the
|
|
276
|
+
A location parameter the server sends without options gets a search field that looks up any city or address through the location search endpoint (the hosted service's by default). If `apiConfig.endpoint` points at a proxy with its own path, set `apiConfig.locationEndpoint` too. `locationSearch: false` takes typed text only, and an `optionOverrides` entry for the parameter replaces the search. Details: [REFERENCE.md](https://unpkg.com/@magicx-eng/ai-autocomplete-vanilla/REFERENCE.md), under "Location search"; to replace every endpoint, see "Using your own server" there.
|
|
277
277
|
|
|
278
278
|
## Tier 2: Dropdown Only
|
|
279
279
|
|
|
@@ -477,9 +477,16 @@ A discriminated union: `APIKeyConfig | AccessTokenConfig`.
|
|
|
477
477
|
endpoint: "https://api.ai-autocomplete.com/api/suggest", // optional, this is the default
|
|
478
478
|
appIdentifier: "my-app", // optional
|
|
479
479
|
headers: { "X-Custom": "v" }, // optional
|
|
480
|
+
// Optional; each defaults to the endpoint's sibling (…/suggest → …/locations/autocomplete,
|
|
481
|
+
// …/telemetry/events, …/starting-state). Set them when endpoint does not end in /suggest.
|
|
482
|
+
locationEndpoint: "https://search.example.com/v1/places",
|
|
483
|
+
telemetryEndpoint: "https://search.example.com/v1/events",
|
|
484
|
+
startingStateEndpoint: "https://search.example.com/v1/start",
|
|
480
485
|
}
|
|
481
486
|
```
|
|
482
487
|
|
|
488
|
+
Every endpoint is replaceable, so the SDK can talk to your own server: see "Using your own server" in [REFERENCE.md](https://unpkg.com/@magicx-eng/ai-autocomplete-vanilla/REFERENCE.md).
|
|
489
|
+
|
|
483
490
|
#### Access Token Mode
|
|
484
491
|
|
|
485
492
|
```ts
|
|
@@ -637,50 +644,7 @@ On a phone or tablet, the shopper can put the keyboard away to see the whole dro
|
|
|
637
644
|
|
|
638
645
|
### Selector Hooks
|
|
639
646
|
|
|
640
|
-
For styling beyond the CSS variables,
|
|
641
|
-
|
|
642
|
-
| Attribute | Element |
|
|
643
|
-
|---|---|
|
|
644
|
-
| `[data-aia-input-wrapper]` | Wrapper around the editor area and the submit button — one of the two roots the SDK isolates from page CSS (the dropdown is the other) |
|
|
645
|
-
| `[data-aia-editor]` | Editor area wrapping the contentEditable + inline pill list |
|
|
646
|
-
| `[data-aia-input]` | The contentEditable `<div>` that owns typed text and bold completed params. Replaces the previous `[data-aia-textarea]` selector. |
|
|
647
|
-
| `[data-aia-pill-list-container]` | Inline sibling of the editor that holds unfilled-suggestion pills |
|
|
648
|
-
| `[data-aia-submit]` | Submit button |
|
|
649
|
-
| `[data-aia-pill]` | Each unfilled-suggestion pill |
|
|
650
|
-
| `[data-aia-pillbar]` | Pill bar container inside the dropdown |
|
|
651
|
-
| `[data-aia-pill-scroll]` | Scrollable pill region inside the bar — carries the horizontal scroll and right-edge fade mask |
|
|
652
|
-
| `[data-aia-skip]` | The pill bar's "skip" button: at the header's trailing edge, or alone at the end of a skip-only row. Tune via `--aia-skip-font-size` / `--aia-skip-color` / `--aia-skip-color-hover` / `--aia-skip-hover-bg` |
|
|
653
|
-
| `[data-aia-hint-el]` | The empty box's hint: the lead-in and the first starting options, one at a time. Tune via `--aia-hint-color` / `--aia-hint-font-weight` / `--aia-hint-icon-opacity` |
|
|
654
|
-
| `[data-aia-option]` | Each suggestion option |
|
|
655
|
-
| `[data-aia-scroll-arrow]` | The "more below" arrow on the dropdown — carries `data-aia-visible` while shown |
|
|
656
|
-
| `[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)). |
|
|
657
|
-
| `[data-aia-datepicker]` | The calendar, rendered in place of the option list for a date parameter |
|
|
658
|
-
| `[data-aia-time-wheel]` | The time wheel, rendered in place of the option list for a time parameter |
|
|
659
|
-
| `[data-aia-location]` | The location search, rendered in place of the option list for a location parameter without options (`[data-aia-location-input]` is its field, `[data-aia-location-row]` each place) |
|
|
660
|
-
| `[data-aia-date-month]` | The "March 2026" header label |
|
|
661
|
-
| `[data-aia-date-prev]` / `[data-aia-date-next]` | The month arrows |
|
|
662
|
-
| `[data-aia-date-grid]` | The 7-column grid of day cells |
|
|
663
|
-
| `[data-aia-date-cell]` | Each day cell. Also carries `[data-aia-option]`, so option-level styling applies to both bodies |
|
|
664
|
-
| `[data-aia-products]` | Product strip section (label + row) |
|
|
665
|
-
| `[data-aia-products-row]` | The horizontally scrolling row of cards |
|
|
666
|
-
| `[data-aia-product]` | Each product card |
|
|
667
|
-
| `[data-aia-product-placeholder]` | Media tile showing the placeholder pictogram (`productImageFallback: "image"`) after a missing/blank URL or load error. The existing hook is unchanged. |
|
|
668
|
-
| `[data-aia-product-initial]` | The media tile itself when it shows the title initial (`productImageFallback: "initial"`). Decorative (`aria-hidden="true"`); target it to style the background, color, font size and border radius. |
|
|
669
|
-
|
|
670
|
-
Completed params render as inline `<strong>` elements inside the editor. Override their weight with `[data-aia-input] strong { font-weight: 700; }` — a selector that names the editor wins without `!important`, while a bare `strong { … }` page rule is kept out by the isolation reset.
|
|
671
|
-
|
|
672
|
-
The vanilla core also exposes stable BEM class names (`magicx-aia-*`); both can be used.
|
|
673
|
-
|
|
674
|
-
```css
|
|
675
|
-
/* Solid (non-glass) dropdown */
|
|
676
|
-
#my-autocomplete [data-aia-dropdown] {
|
|
677
|
-
background: #fff;
|
|
678
|
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
|
679
|
-
backdrop-filter: none;
|
|
680
|
-
}
|
|
681
|
-
```
|
|
682
|
-
|
|
683
|
-
---
|
|
647
|
+
For styling beyond the CSS variables, the stable `data-aia-*` attributes to target are listed in [REFERENCE.md](https://unpkg.com/@magicx-eng/ai-autocomplete-vanilla/REFERENCE.md), under "Selector hooks".
|
|
684
648
|
|
|
685
649
|
## Sessions
|
|
686
650
|
|
|
@@ -763,4 +727,11 @@ Tier 3 exposes the pieces: `state.optionQuery` is the phrase, and `state.isSearc
|
|
|
763
727
|
|
|
764
728
|
## License
|
|
765
729
|
|
|
766
|
-
MIT.
|
|
730
|
+
The SDK in this repository is licensed under the [MIT License](./LICENSE).
|
|
731
|
+
|
|
732
|
+
By default the SDK sends requests to the hosted Intent-1 service operated by
|
|
733
|
+
MagicX. That server call is modular: every endpoint is configurable, and the
|
|
734
|
+
default can be replaced with a self-hosted or third-party server (see
|
|
735
|
+
["Using your own server"](./REFERENCE.md#using-your-own-server)).
|
|
736
|
+
|
|
737
|
+
The hosted Intent-1 service is a separate service, governed by MagicX's own [Terms & Conditions](https://ai-autocomplete.com/legal/terms), not by the SDK's license. The MIT license covers the SDK code only. No rights in the hosted service or in any server-side method are granted through it.
|
package/REFERENCE.md
CHANGED
|
@@ -644,8 +644,8 @@ locations is the server's call: it marks them `type: { kind: "location" }`.
|
|
|
644
644
|
- **With options** (a catalog with a `city` field, say), it is an ordinary
|
|
645
645
|
option list. Nothing changes.
|
|
646
646
|
- **Without options**, the dropdown shows a search field instead. Typing in it
|
|
647
|
-
searches places through the
|
|
648
|
-
|
|
647
|
+
searches places through the location search endpoint and
|
|
648
|
+
lists what it finds; any city, address or landmark can be picked.
|
|
649
649
|
What the user types in the main input is searched there too, cut to its
|
|
650
650
|
place-name end ("going to paris" searches "paris"; "to san fran" searches
|
|
651
651
|
"san fran"). Typing in the field itself takes over until it loses focus, and
|
|
@@ -849,6 +849,53 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
|
|
|
849
849
|
|
|
850
850
|
Tokens for the option thumbnail, the item count and the chip's picture (the README's "Option pictures and counts" note describes what each draws). The tile is sized by `--aia-option-image-size` (40px), rounded by `--aia-option-image-radius` (12px), spaced by `--aia-option-image-gap` (12px) and filled by `--aia-option-image-bg` (default: `--aia-skeleton-bg`) as a placeholder until its picture loads (or if the picture fails); a loaded picture is scaled to fit rather than cropped and sits on the dropdown's background, and one narrower than the tile is rounded on its own corners by `--aia-option-picture-radius` (6px); in a grid with pictures, an icon row draws its glyph at `--aia-option-tile-icon-size` (1.5em) so it holds the picture column; the count reads `--aia-option-count-font-size` (12px), `--aia-option-count-color` and `--aia-option-count-opacity` (0.6); the chip's tile reads `--aia-chip-image-size` (1.25em of the chip's font), `--aia-chip-image-radius` (4px) and `--aia-chip-image-bg` (default: `--aia-skeleton-bg`), the placeholder fill shown until the picture loads; a loaded picture narrower than the tile narrows it to the picture's own width, so the radius rounds the picture.
|
|
851
851
|
|
|
852
|
+
## Selector hooks
|
|
853
|
+
|
|
854
|
+
For styling beyond the CSS variables, target these stable `data-aia-*` attributes:
|
|
855
|
+
|
|
856
|
+
| Attribute | Element |
|
|
857
|
+
|---|---|
|
|
858
|
+
| `[data-aia-input-wrapper]` | Wrapper around the editor area and the submit button — one of the two roots the SDK isolates from page CSS (the dropdown is the other) |
|
|
859
|
+
| `[data-aia-editor]` | Editor area wrapping the contentEditable + inline pill list |
|
|
860
|
+
| `[data-aia-input]` | The contentEditable `<div>` that owns typed text and bold completed params. Replaces the previous `[data-aia-textarea]` selector. |
|
|
861
|
+
| `[data-aia-pill-list-container]` | Inline sibling of the editor that holds unfilled-suggestion pills |
|
|
862
|
+
| `[data-aia-submit]` | Submit button |
|
|
863
|
+
| `[data-aia-pill]` | Each unfilled-suggestion pill |
|
|
864
|
+
| `[data-aia-pillbar]` | Pill bar container inside the dropdown |
|
|
865
|
+
| `[data-aia-pill-scroll]` | Scrollable pill region inside the bar — carries the horizontal scroll and right-edge fade mask |
|
|
866
|
+
| `[data-aia-skip]` | The pill bar's "skip" button: at the header's trailing edge, or alone at the end of a skip-only row. Tune via `--aia-skip-font-size` / `--aia-skip-color` / `--aia-skip-color-hover` / `--aia-skip-hover-bg` |
|
|
867
|
+
| `[data-aia-hint-el]` | The empty box's hint: the lead-in and the first starting options, one at a time. Tune via `--aia-hint-color` / `--aia-hint-font-weight` / `--aia-hint-icon-opacity` |
|
|
868
|
+
| `[data-aia-option]` | Each suggestion option |
|
|
869
|
+
| `[data-aia-scroll-arrow]` | The "more below" arrow on the dropdown — carries `data-aia-visible` while shown |
|
|
870
|
+
| `[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](./README.md#short-screens)). |
|
|
871
|
+
| `[data-aia-datepicker]` | The calendar, rendered in place of the option list for a date parameter |
|
|
872
|
+
| `[data-aia-time-wheel]` | The time wheel, rendered in place of the option list for a time parameter |
|
|
873
|
+
| `[data-aia-location]` | The location search, rendered in place of the option list for a location parameter without options (`[data-aia-location-input]` is its field, `[data-aia-location-row]` each place) |
|
|
874
|
+
| `[data-aia-date-month]` | The "March 2026" header label |
|
|
875
|
+
| `[data-aia-date-prev]` / `[data-aia-date-next]` | The month arrows |
|
|
876
|
+
| `[data-aia-date-grid]` | The 7-column grid of day cells |
|
|
877
|
+
| `[data-aia-date-cell]` | Each day cell. Also carries `[data-aia-option]`, so option-level styling applies to both bodies |
|
|
878
|
+
| `[data-aia-products]` | Product strip section (label + row) |
|
|
879
|
+
| `[data-aia-products-row]` | The horizontally scrolling row of cards |
|
|
880
|
+
| `[data-aia-product]` | Each product card |
|
|
881
|
+
| `[data-aia-product-placeholder]` | Media tile showing the placeholder pictogram (`productImageFallback: "image"`) after a missing/blank URL or load error. The existing hook is unchanged. |
|
|
882
|
+
| `[data-aia-product-initial]` | The media tile itself when it shows the title initial (`productImageFallback: "initial"`). Decorative (`aria-hidden="true"`); target it to style the background, color, font size and border radius. |
|
|
883
|
+
|
|
884
|
+
Completed params render as inline `<strong>` elements inside the editor. Override their weight with `[data-aia-input] strong { font-weight: 700; }` — a selector that names the editor wins without `!important`, while a bare `strong { … }` page rule is kept out by the isolation reset.
|
|
885
|
+
|
|
886
|
+
The vanilla core also exposes stable BEM class names (`magicx-aia-*`); both can be used.
|
|
887
|
+
|
|
888
|
+
```css
|
|
889
|
+
/* Solid (non-glass) dropdown */
|
|
890
|
+
#my-autocomplete [data-aia-dropdown] {
|
|
891
|
+
background: #fff;
|
|
892
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
|
893
|
+
backdrop-filter: none;
|
|
894
|
+
}
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
---
|
|
898
|
+
|
|
852
899
|
## Visitor id kept by the SDK
|
|
853
900
|
|
|
854
901
|
Without `visitorId`, the SDK can keep the id for you. Pass `analyticsConsent` so it knows the visitor's choice: `true` (allowed), `false` (declined), or `undefined` (not answered yet). Once allowed, it keeps a UUID v4 in the first-party cookie `aia_vid` for a year, renewed on use; declined, it removes that cookie. This needs the feature to be enabled for your account, and nothing is stored without `analyticsConsent`.
|
|
@@ -883,3 +930,71 @@ onSubmit: (result) => {
|
|
|
883
930
|
```
|
|
884
931
|
|
|
885
932
|
The id of the last search the current tab handed off (a submit or a product pick) is also kept in `sessionStorage` under `aia:last-search`, as `{ id, at }`, where `at` is when it was handed off, in milliseconds since the epoch.
|
|
933
|
+
|
|
934
|
+
## Using your own server
|
|
935
|
+
|
|
936
|
+
By default the SDK sends its requests to the hosted Intent-1 service. Every
|
|
937
|
+
endpoint is replaceable through `apiConfig`, so the widget can talk to your own
|
|
938
|
+
server, a proxy, or a third-party service instead.
|
|
939
|
+
|
|
940
|
+
| Request | Method and URL | Option | Default |
|
|
941
|
+
|---|---|---|---|
|
|
942
|
+
| Suggestions | `POST {endpoint}` | `endpoint` | the hosted service's `…/api/suggest` |
|
|
943
|
+
| Starting state (only with `productId`) | `GET {base}/{productId}/{language}` | `startingStateEndpoint` (the base) | beside `endpoint`: `…/starting-state` |
|
|
944
|
+
| Location search | `POST {locationEndpoint}` | `locationEndpoint` | beside `endpoint`: `…/locations/autocomplete` |
|
|
945
|
+
| Telemetry events | `POST {telemetryEndpoint}` | `telemetryEndpoint` | beside `endpoint`: `…/telemetry/events` |
|
|
946
|
+
|
|
947
|
+
On the hosted service, the starting state is served from its CDN host
|
|
948
|
+
(`cdn.ai-autocomplete.com`) rather than the API host, so an allowlist for the
|
|
949
|
+
default setup (a Content Security Policy's `connect-src`, say) needs both.
|
|
950
|
+
|
|
951
|
+
"Beside `endpoint`" means the `/suggest` at the end of the endpoint's path is
|
|
952
|
+
replaced, keeping its origin, any path prefix and query
|
|
953
|
+
(`https://search.example.com/v1/suggest` → `https://search.example.com/v1/telemetry/events`).
|
|
954
|
+
When `endpoint` does not end in `/suggest` and one of the other options is not
|
|
955
|
+
set, that request is not sent:
|
|
956
|
+
|
|
957
|
+
- **Telemetry:** no events are sent.
|
|
958
|
+
- **Starting state:** it is asked for with an ordinary suggestion request (empty query) instead.
|
|
959
|
+
- **Location search:** the field takes typed text only.
|
|
960
|
+
|
|
961
|
+
```js
|
|
962
|
+
new AIAutocomplete(document.querySelector("#search"), {
|
|
963
|
+
apiConfig: {
|
|
964
|
+
endpoint: "https://search.example.com/v1/complete",
|
|
965
|
+
// Needed because the endpoint above does not end in /suggest:
|
|
966
|
+
telemetryEndpoint: "https://search.example.com/v1/events",
|
|
967
|
+
startingStateEndpoint: "https://search.example.com/v1/start",
|
|
968
|
+
locationEndpoint: "https://search.example.com/v1/places",
|
|
969
|
+
},
|
|
970
|
+
});
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
The suggestion, location search and telemetry requests carry the same
|
|
974
|
+
headers: `Content-Type: application/json`, your `apiConfig.headers`,
|
|
975
|
+
`X-App-Identifier` when `appIdentifier` is set, and an `Authorization` header
|
|
976
|
+
from your API key or access token. The starting-state GET carries none of
|
|
977
|
+
them (no custom headers and no `Authorization`), so it can be served from a
|
|
978
|
+
cache; as a plain GET it still sends the page's cookies to a same-origin
|
|
979
|
+
endpoint. With your own
|
|
980
|
+
endpoint, the SDK opens no connection to the hosted service's hosts, including
|
|
981
|
+
the image CDN it otherwise warms up; images load from whatever URLs your
|
|
982
|
+
responses carry.
|
|
983
|
+
|
|
984
|
+
What each request sends and expects:
|
|
985
|
+
|
|
986
|
+
- **Suggestions:** the request body is `AutocompleteRequest` and the response
|
|
987
|
+
`AutocompleteResponse`, both exported as types by
|
|
988
|
+
`@magicx-eng/ai-autocomplete-vanilla`. The response's optional `custom_fields`
|
|
989
|
+
block is described in [The catalog report](#the-catalog-report-customfields).
|
|
990
|
+
- **Starting state:** the response is the same `AutocompleteResponse`; see
|
|
991
|
+
[Starting state](#starting-state). `{language}` is the lowercase primary
|
|
992
|
+
language subtag (`es` for `es-MX`), or `zh-TW` for Traditional Chinese; the
|
|
993
|
+
segment is left off when the language tag has no usable subtag.
|
|
994
|
+
- **Location search:** the body is `{ query, session_token, language }` and the
|
|
995
|
+
response `{ places: [{ id, name, secondary? }] }` (the `LocationPlace` type).
|
|
996
|
+
A 404 turns the search off for the rest of the session; see
|
|
997
|
+
[Location search](#location-search).
|
|
998
|
+
- **Telemetry:** a fire-and-forget body of `source`, `session_id`, `type`, `at`
|
|
999
|
+
and `query_data`, plus `visitor_id`, `search_id`, `request_id` and
|
|
1000
|
+
`language` when known. The response is ignored.
|
package/dist/index.d.mts
CHANGED
|
@@ -119,7 +119,11 @@ interface Suggestion {
|
|
|
119
119
|
required: boolean;
|
|
120
120
|
options?: SuggestionOption[];
|
|
121
121
|
type?: SuggestionType;
|
|
122
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* How the options relate to the typed text, when the server says: true
|
|
124
|
+
* when they complete the last typed word, false when they follow the typed
|
|
125
|
+
* text. Absent when the server does not say.
|
|
126
|
+
*/
|
|
123
127
|
completes_word?: boolean;
|
|
124
128
|
/**
|
|
125
129
|
* Asks for the Smart Suggestion look (sparkle and shimmer) on an ordinary
|
|
@@ -516,13 +520,36 @@ type Segment = {
|
|
|
516
520
|
};
|
|
517
521
|
type AppearanceMode = "light" | "dark" | "auto";
|
|
518
522
|
interface APIConfigBase {
|
|
523
|
+
/**
|
|
524
|
+
* Where suggestion requests go. Defaults to the hosted Intent-1 service's
|
|
525
|
+
* suggestion endpoint (`…/api/suggest`). Point it at your own
|
|
526
|
+
* server or proxy to replace it. When it ends in `/suggest`, the telemetry,
|
|
527
|
+
* starting-state and location search endpoints default to its siblings;
|
|
528
|
+
* otherwise set each of them, or that request is not sent (see each option).
|
|
529
|
+
*/
|
|
519
530
|
endpoint?: string;
|
|
520
531
|
/**
|
|
521
532
|
* Where the location search lives. Defaults to the `endpoint`'s sibling
|
|
522
533
|
* `…/locations/autocomplete` (`/api/suggest` → `/api/locations/autocomplete`).
|
|
523
|
-
* Set it when `endpoint` points at a proxy with its own path
|
|
534
|
+
* Set it when `endpoint` points at a proxy with its own path; without it,
|
|
535
|
+
* such an endpoint has no location search and the field takes typed text.
|
|
524
536
|
*/
|
|
525
537
|
locationEndpoint?: string;
|
|
538
|
+
/**
|
|
539
|
+
* Where telemetry events are POSTed. Defaults to the `endpoint`'s sibling
|
|
540
|
+
* `…/telemetry/events` (`/api/suggest` → `/api/telemetry/events`). Set it
|
|
541
|
+
* when `endpoint` does not end in `/suggest`; without it, no telemetry is
|
|
542
|
+
* sent for such an endpoint.
|
|
543
|
+
*/
|
|
544
|
+
telemetryEndpoint?: string;
|
|
545
|
+
/**
|
|
546
|
+
* The base a product's starting state is read from with a GET, before
|
|
547
|
+
* `/{productId}` and the language path (`…/starting-state/{productId}/es`).
|
|
548
|
+
* Defaults to the `endpoint`'s sibling `…/starting-state`. Set it when
|
|
549
|
+
* `endpoint` does not end in `/suggest`; without it, the starting state is
|
|
550
|
+
* asked for with an ordinary suggestion request. Used only with `productId`.
|
|
551
|
+
*/
|
|
552
|
+
startingStateEndpoint?: string;
|
|
526
553
|
appIdentifier?: string;
|
|
527
554
|
headers?: Record<string, string>;
|
|
528
555
|
}
|
|
@@ -3622,7 +3649,8 @@ declare function uiStringsFor(language?: string): UIStrings;
|
|
|
3622
3649
|
* option group (`data-aia-group` on the grid changed) keeps the arrow hidden
|
|
3623
3650
|
* until the rows' entrance animation has settled, because a row mid-rise
|
|
3624
3651
|
* still extends the scrollable area and would flash the arrow on.
|
|
3625
|
-
* - The controller listens for the grid's own `scroll` and size changes
|
|
3652
|
+
* - The controller listens for the grid's own `scroll` and for size changes of
|
|
3653
|
+
* the grid and the dropdown itself.
|
|
3626
3654
|
* - `destroy()` when the grid or dropdown goes away.
|
|
3627
3655
|
*/
|
|
3628
3656
|
declare const SCROLL_ARROW_CLASS = "magicx-aia-scroll-arrow";
|
package/dist/index.d.ts
CHANGED
|
@@ -119,7 +119,11 @@ interface Suggestion {
|
|
|
119
119
|
required: boolean;
|
|
120
120
|
options?: SuggestionOption[];
|
|
121
121
|
type?: SuggestionType;
|
|
122
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* How the options relate to the typed text, when the server says: true
|
|
124
|
+
* when they complete the last typed word, false when they follow the typed
|
|
125
|
+
* text. Absent when the server does not say.
|
|
126
|
+
*/
|
|
123
127
|
completes_word?: boolean;
|
|
124
128
|
/**
|
|
125
129
|
* Asks for the Smart Suggestion look (sparkle and shimmer) on an ordinary
|
|
@@ -516,13 +520,36 @@ type Segment = {
|
|
|
516
520
|
};
|
|
517
521
|
type AppearanceMode = "light" | "dark" | "auto";
|
|
518
522
|
interface APIConfigBase {
|
|
523
|
+
/**
|
|
524
|
+
* Where suggestion requests go. Defaults to the hosted Intent-1 service's
|
|
525
|
+
* suggestion endpoint (`…/api/suggest`). Point it at your own
|
|
526
|
+
* server or proxy to replace it. When it ends in `/suggest`, the telemetry,
|
|
527
|
+
* starting-state and location search endpoints default to its siblings;
|
|
528
|
+
* otherwise set each of them, or that request is not sent (see each option).
|
|
529
|
+
*/
|
|
519
530
|
endpoint?: string;
|
|
520
531
|
/**
|
|
521
532
|
* Where the location search lives. Defaults to the `endpoint`'s sibling
|
|
522
533
|
* `…/locations/autocomplete` (`/api/suggest` → `/api/locations/autocomplete`).
|
|
523
|
-
* Set it when `endpoint` points at a proxy with its own path
|
|
534
|
+
* Set it when `endpoint` points at a proxy with its own path; without it,
|
|
535
|
+
* such an endpoint has no location search and the field takes typed text.
|
|
524
536
|
*/
|
|
525
537
|
locationEndpoint?: string;
|
|
538
|
+
/**
|
|
539
|
+
* Where telemetry events are POSTed. Defaults to the `endpoint`'s sibling
|
|
540
|
+
* `…/telemetry/events` (`/api/suggest` → `/api/telemetry/events`). Set it
|
|
541
|
+
* when `endpoint` does not end in `/suggest`; without it, no telemetry is
|
|
542
|
+
* sent for such an endpoint.
|
|
543
|
+
*/
|
|
544
|
+
telemetryEndpoint?: string;
|
|
545
|
+
/**
|
|
546
|
+
* The base a product's starting state is read from with a GET, before
|
|
547
|
+
* `/{productId}` and the language path (`…/starting-state/{productId}/es`).
|
|
548
|
+
* Defaults to the `endpoint`'s sibling `…/starting-state`. Set it when
|
|
549
|
+
* `endpoint` does not end in `/suggest`; without it, the starting state is
|
|
550
|
+
* asked for with an ordinary suggestion request. Used only with `productId`.
|
|
551
|
+
*/
|
|
552
|
+
startingStateEndpoint?: string;
|
|
526
553
|
appIdentifier?: string;
|
|
527
554
|
headers?: Record<string, string>;
|
|
528
555
|
}
|
|
@@ -3622,7 +3649,8 @@ declare function uiStringsFor(language?: string): UIStrings;
|
|
|
3622
3649
|
* option group (`data-aia-group` on the grid changed) keeps the arrow hidden
|
|
3623
3650
|
* until the rows' entrance animation has settled, because a row mid-rise
|
|
3624
3651
|
* still extends the scrollable area and would flash the arrow on.
|
|
3625
|
-
* - The controller listens for the grid's own `scroll` and size changes
|
|
3652
|
+
* - The controller listens for the grid's own `scroll` and for size changes of
|
|
3653
|
+
* the grid and the dropdown itself.
|
|
3626
3654
|
* - `destroy()` when the grid or dropdown goes away.
|
|
3627
3655
|
*/
|
|
3628
3656
|
declare const SCROLL_ARROW_CLASS = "magicx-aia-scroll-arrow";
|