@magicx-eng/ai-autocomplete-vanilla 0.81.4 → 0.82.1
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 +18 -47
- package/REFERENCE.md +118 -2
- package/dist/index.d.mts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +23 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -232,7 +232,7 @@ Pass `onProductAddToCart` and every card that isn't sold out gets a cart button;
|
|
|
232
232
|
|
|
233
233
|
Each response that read the catalog says which of the query's constraints it applied (`applied_filters`), which it dropped (`dropped_filters`) and how many items are left (`items.total`). Read it from `customFields` on state, or from `custom_fields` on `AutocompleteResult`. `null` means no catalog was read for that response. Details: [REFERENCE.md](https://unpkg.com/@magicx-eng/ai-autocomplete-vanilla/REFERENCE.md), under "The catalog report".
|
|
234
234
|
|
|
235
|
-
When the search finds no item, `blocking_filters` names each condition whose removal finds items, with the count. The SDK
|
|
235
|
+
When the search finds no item, `blocking_filters` names each condition whose removal finds items, with the count. The SDK gives each of those chips a "×" that removes it, even with `showChipRemove` off; the chips look the same as every other chip. The chips are on state as `blockingChips`, and each carries the class `magicx-aia-segment--blocking` for a page that wants to style them.
|
|
236
236
|
|
|
237
237
|
#### Change product cards before display
|
|
238
238
|
|
|
@@ -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
|
|
@@ -818,6 +818,7 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
|
|
|
818
818
|
| `--aia-time-font-size` | `15px` | `15px` | The time wheel's numbers and its `:` separator. |
|
|
819
819
|
| `--aia-time-band-bg` | white at 8% | white at 8% | The band behind the wheels' top rows — the chosen time. |
|
|
820
820
|
| `--aia-confirm-bg` | `#262626` | `#a6a6a6` | The solid fill of a checked multi-select checkbox (and, in dark mode, of the Done buttons). |
|
|
821
|
+
| `--aia-checkbox-border` | the option text at 65% | the option text at 65% | Border of an unticked multi-select checkbox. Defaults to the option text colour so the box stays visible when the dropdown border is faint or transparent; a ticked box uses `--aia-confirm-bg`. |
|
|
821
822
|
| `--aia-confirm-bg-hover` | `#404040` | `#b8b8b8` | The Done buttons on hover in dark mode. |
|
|
822
823
|
| `--aia-confirm-color` | `#ffffff` | `#000000` | The checkbox's checkmark (and, in dark mode, the Done buttons' text). |
|
|
823
824
|
| `--aia-done-bg` / `--aia-done-bg-hover` / `--aia-done-color` | `#e4e8f0` / `#d8dde8` / `#2a3150` | `--aia-confirm-*` | The Done buttons (multi-select and time wheel). |
|
|
@@ -849,6 +850,53 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
|
|
|
849
850
|
|
|
850
851
|
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
852
|
|
|
853
|
+
## Selector hooks
|
|
854
|
+
|
|
855
|
+
For styling beyond the CSS variables, target these stable `data-aia-*` attributes:
|
|
856
|
+
|
|
857
|
+
| Attribute | Element |
|
|
858
|
+
|---|---|
|
|
859
|
+
| `[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) |
|
|
860
|
+
| `[data-aia-editor]` | Editor area wrapping the contentEditable + inline pill list |
|
|
861
|
+
| `[data-aia-input]` | The contentEditable `<div>` that owns typed text and bold completed params. Replaces the previous `[data-aia-textarea]` selector. |
|
|
862
|
+
| `[data-aia-pill-list-container]` | Inline sibling of the editor that holds unfilled-suggestion pills |
|
|
863
|
+
| `[data-aia-submit]` | Submit button |
|
|
864
|
+
| `[data-aia-pill]` | Each unfilled-suggestion pill |
|
|
865
|
+
| `[data-aia-pillbar]` | Pill bar container inside the dropdown |
|
|
866
|
+
| `[data-aia-pill-scroll]` | Scrollable pill region inside the bar — carries the horizontal scroll and right-edge fade mask |
|
|
867
|
+
| `[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` |
|
|
868
|
+
| `[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` |
|
|
869
|
+
| `[data-aia-option]` | Each suggestion option |
|
|
870
|
+
| `[data-aia-scroll-arrow]` | The "more below" arrow on the dropdown — carries `data-aia-visible` while shown |
|
|
871
|
+
| `[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)). |
|
|
872
|
+
| `[data-aia-datepicker]` | The calendar, rendered in place of the option list for a date parameter |
|
|
873
|
+
| `[data-aia-time-wheel]` | The time wheel, rendered in place of the option list for a time parameter |
|
|
874
|
+
| `[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) |
|
|
875
|
+
| `[data-aia-date-month]` | The "March 2026" header label |
|
|
876
|
+
| `[data-aia-date-prev]` / `[data-aia-date-next]` | The month arrows |
|
|
877
|
+
| `[data-aia-date-grid]` | The 7-column grid of day cells |
|
|
878
|
+
| `[data-aia-date-cell]` | Each day cell. Also carries `[data-aia-option]`, so option-level styling applies to both bodies |
|
|
879
|
+
| `[data-aia-products]` | Product strip section (label + row) |
|
|
880
|
+
| `[data-aia-products-row]` | The horizontally scrolling row of cards |
|
|
881
|
+
| `[data-aia-product]` | Each product card |
|
|
882
|
+
| `[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. |
|
|
883
|
+
| `[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. |
|
|
884
|
+
|
|
885
|
+
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.
|
|
886
|
+
|
|
887
|
+
The vanilla core also exposes stable BEM class names (`magicx-aia-*`); both can be used.
|
|
888
|
+
|
|
889
|
+
```css
|
|
890
|
+
/* Solid (non-glass) dropdown */
|
|
891
|
+
#my-autocomplete [data-aia-dropdown] {
|
|
892
|
+
background: #fff;
|
|
893
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
|
894
|
+
backdrop-filter: none;
|
|
895
|
+
}
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
---
|
|
899
|
+
|
|
852
900
|
## Visitor id kept by the SDK
|
|
853
901
|
|
|
854
902
|
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 +931,71 @@ onSubmit: (result) => {
|
|
|
883
931
|
```
|
|
884
932
|
|
|
885
933
|
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.
|
|
934
|
+
|
|
935
|
+
## Using your own server
|
|
936
|
+
|
|
937
|
+
By default the SDK sends its requests to the hosted Intent-1 service. Every
|
|
938
|
+
endpoint is replaceable through `apiConfig`, so the widget can talk to your own
|
|
939
|
+
server, a proxy, or a third-party service instead.
|
|
940
|
+
|
|
941
|
+
| Request | Method and URL | Option | Default |
|
|
942
|
+
|---|---|---|---|
|
|
943
|
+
| Suggestions | `POST {endpoint}` | `endpoint` | the hosted service's `…/api/suggest` |
|
|
944
|
+
| Starting state (only with `productId`) | `GET {base}/{productId}/{language}` | `startingStateEndpoint` (the base) | beside `endpoint`: `…/starting-state` |
|
|
945
|
+
| Location search | `POST {locationEndpoint}` | `locationEndpoint` | beside `endpoint`: `…/locations/autocomplete` |
|
|
946
|
+
| Telemetry events | `POST {telemetryEndpoint}` | `telemetryEndpoint` | beside `endpoint`: `…/telemetry/events` |
|
|
947
|
+
|
|
948
|
+
On the hosted service, the starting state is served from its CDN host
|
|
949
|
+
(`cdn.ai-autocomplete.com`) rather than the API host, so an allowlist for the
|
|
950
|
+
default setup (a Content Security Policy's `connect-src`, say) needs both.
|
|
951
|
+
|
|
952
|
+
"Beside `endpoint`" means the `/suggest` at the end of the endpoint's path is
|
|
953
|
+
replaced, keeping its origin, any path prefix and query
|
|
954
|
+
(`https://search.example.com/v1/suggest` → `https://search.example.com/v1/telemetry/events`).
|
|
955
|
+
When `endpoint` does not end in `/suggest` and one of the other options is not
|
|
956
|
+
set, that request is not sent:
|
|
957
|
+
|
|
958
|
+
- **Telemetry:** no events are sent.
|
|
959
|
+
- **Starting state:** it is asked for with an ordinary suggestion request (empty query) instead.
|
|
960
|
+
- **Location search:** the field takes typed text only.
|
|
961
|
+
|
|
962
|
+
```js
|
|
963
|
+
new AIAutocomplete(document.querySelector("#search"), {
|
|
964
|
+
apiConfig: {
|
|
965
|
+
endpoint: "https://search.example.com/v1/complete",
|
|
966
|
+
// Needed because the endpoint above does not end in /suggest:
|
|
967
|
+
telemetryEndpoint: "https://search.example.com/v1/events",
|
|
968
|
+
startingStateEndpoint: "https://search.example.com/v1/start",
|
|
969
|
+
locationEndpoint: "https://search.example.com/v1/places",
|
|
970
|
+
},
|
|
971
|
+
});
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
The suggestion, location search and telemetry requests carry the same
|
|
975
|
+
headers: `Content-Type: application/json`, your `apiConfig.headers`,
|
|
976
|
+
`X-App-Identifier` when `appIdentifier` is set, and an `Authorization` header
|
|
977
|
+
from your API key or access token. The starting-state GET carries none of
|
|
978
|
+
them (no custom headers and no `Authorization`), so it can be served from a
|
|
979
|
+
cache; as a plain GET it still sends the page's cookies to a same-origin
|
|
980
|
+
endpoint. With your own
|
|
981
|
+
endpoint, the SDK opens no connection to the hosted service's hosts, including
|
|
982
|
+
the image CDN it otherwise warms up; images load from whatever URLs your
|
|
983
|
+
responses carry.
|
|
984
|
+
|
|
985
|
+
What each request sends and expects:
|
|
986
|
+
|
|
987
|
+
- **Suggestions:** the request body is `AutocompleteRequest` and the response
|
|
988
|
+
`AutocompleteResponse`, both exported as types by
|
|
989
|
+
`@magicx-eng/ai-autocomplete-vanilla`. The response's optional `custom_fields`
|
|
990
|
+
block is described in [The catalog report](#the-catalog-report-customfields).
|
|
991
|
+
- **Starting state:** the response is the same `AutocompleteResponse`; see
|
|
992
|
+
[Starting state](#starting-state). `{language}` is the lowercase primary
|
|
993
|
+
language subtag (`es` for `es-MX`), or `zh-TW` for Traditional Chinese; the
|
|
994
|
+
segment is left off when the language tag has no usable subtag.
|
|
995
|
+
- **Location search:** the body is `{ query, session_token, language }` and the
|
|
996
|
+
response `{ places: [{ id, name, secondary? }] }` (the `LocationPlace` type).
|
|
997
|
+
A 404 turns the search off for the rest of the session; see
|
|
998
|
+
[Location search](#location-search).
|
|
999
|
+
- **Telemetry:** a fire-and-forget body of `source`, `session_id`, `type`, `at`
|
|
1000
|
+
and `query_data`, plus `visitor_id`, `search_id`, `request_id` and
|
|
1001
|
+
`language` when known. The response is ignored.
|
package/dist/index.d.mts
CHANGED
|
@@ -520,13 +520,36 @@ type Segment = {
|
|
|
520
520
|
};
|
|
521
521
|
type AppearanceMode = "light" | "dark" | "auto";
|
|
522
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
|
+
*/
|
|
523
530
|
endpoint?: string;
|
|
524
531
|
/**
|
|
525
532
|
* Where the location search lives. Defaults to the `endpoint`'s sibling
|
|
526
533
|
* `…/locations/autocomplete` (`/api/suggest` → `/api/locations/autocomplete`).
|
|
527
|
-
* 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.
|
|
528
536
|
*/
|
|
529
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;
|
|
530
553
|
appIdentifier?: string;
|
|
531
554
|
headers?: Record<string, string>;
|
|
532
555
|
}
|
|
@@ -3626,7 +3649,8 @@ declare function uiStringsFor(language?: string): UIStrings;
|
|
|
3626
3649
|
* option group (`data-aia-group` on the grid changed) keeps the arrow hidden
|
|
3627
3650
|
* until the rows' entrance animation has settled, because a row mid-rise
|
|
3628
3651
|
* still extends the scrollable area and would flash the arrow on.
|
|
3629
|
-
* - 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.
|
|
3630
3654
|
* - `destroy()` when the grid or dropdown goes away.
|
|
3631
3655
|
*/
|
|
3632
3656
|
declare const SCROLL_ARROW_CLASS = "magicx-aia-scroll-arrow";
|
package/dist/index.d.ts
CHANGED
|
@@ -520,13 +520,36 @@ type Segment = {
|
|
|
520
520
|
};
|
|
521
521
|
type AppearanceMode = "light" | "dark" | "auto";
|
|
522
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
|
+
*/
|
|
523
530
|
endpoint?: string;
|
|
524
531
|
/**
|
|
525
532
|
* Where the location search lives. Defaults to the `endpoint`'s sibling
|
|
526
533
|
* `…/locations/autocomplete` (`/api/suggest` → `/api/locations/autocomplete`).
|
|
527
|
-
* 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.
|
|
528
536
|
*/
|
|
529
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;
|
|
530
553
|
appIdentifier?: string;
|
|
531
554
|
headers?: Record<string, string>;
|
|
532
555
|
}
|
|
@@ -3626,7 +3649,8 @@ declare function uiStringsFor(language?: string): UIStrings;
|
|
|
3626
3649
|
* option group (`data-aia-group` on the grid changed) keeps the arrow hidden
|
|
3627
3650
|
* until the rows' entrance animation has settled, because a row mid-rise
|
|
3628
3651
|
* still extends the scrollable area and would flash the arrow on.
|
|
3629
|
-
* - 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.
|
|
3630
3654
|
* - `destroy()` when the grid or dropdown goes away.
|
|
3631
3655
|
*/
|
|
3632
3656
|
declare const SCROLL_ARROW_CLASS = "magicx-aia-scroll-arrow";
|