@magicx-eng/ai-autocomplete-vanilla 0.53.0 → 0.53.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 +2 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -166,6 +166,7 @@ ac.destroy(); // Remove DOM, listeners, timers
|
|
|
166
166
|
ac.setMode("dark"); // Switch color mode
|
|
167
167
|
ac.update({ animations: false, optionsPosition: "above" });
|
|
168
168
|
ac.selectProduct(product); // Emit onProductSelect (Tier 3 / custom strips)
|
|
169
|
+
ac.prepareSubmit(); // Prepare the typed word before your own button builds a result
|
|
169
170
|
ac.getResult(); // The AutocompleteResult as it stands right now
|
|
170
171
|
ac.getRequestId(); // The latest applied /suggest request ID, or null
|
|
171
172
|
```
|
|
@@ -689,6 +690,7 @@ unsub();
|
|
|
689
690
|
| `removeLastParam()` | Remove the last completed param from state. The text stays in the input as plain text. |
|
|
690
691
|
| `clearNewParamId()` | Clear shimmer animation state. |
|
|
691
692
|
| `reset()` | Clear all state, re-fetch initial suggestions, and start a new session (rotates `session_id`). Call this after handling submit. |
|
|
693
|
+
| `prepareSubmit()` | Call before building a submit result from your own button. A typed word that equals exactly one completion candidate becomes a completed param, the same as Enter. Read the updated state with `getState()` to build the result. |
|
|
692
694
|
| `recordSubmit(result)` | Record a submit from a button you render. Enter and the built-in button are recorded for you; call this once per submit from your own button. |
|
|
693
695
|
| `setValue(text)` | Set text (controlled mode). Text set this way is not reported as the user starting a search. |
|
|
694
696
|
| `prefillText(text)` | Fill the field with text the user did not type — e.g. a query carried over from the previous page — and handle it like typing: suggestions are fetched and the text is recognized. Not reported as the user starting a search. |
|
package/dist/index.d.mts
CHANGED
|
@@ -1375,6 +1375,12 @@ declare class AIAutocomplete {
|
|
|
1375
1375
|
* highlight the keyboard has since moved elsewhere is left alone.
|
|
1376
1376
|
*/
|
|
1377
1377
|
clearHighlight(index: number): void;
|
|
1378
|
+
/**
|
|
1379
|
+
* Call before you build a submit result from your own button.
|
|
1380
|
+
* A typed word that equals exactly one completion candidate becomes a completed param, the same as Enter.
|
|
1381
|
+
* Read the updated state with `getState()` to build the result.
|
|
1382
|
+
*/
|
|
1383
|
+
prepareSubmit(): void;
|
|
1378
1384
|
/**
|
|
1379
1385
|
* Records a submit in telemetry. The SDK does this itself when it runs the
|
|
1380
1386
|
* submit (Enter, or Tier 1's button); call it only from a submit path you
|
package/dist/index.d.ts
CHANGED
|
@@ -1375,6 +1375,12 @@ declare class AIAutocomplete {
|
|
|
1375
1375
|
* highlight the keyboard has since moved elsewhere is left alone.
|
|
1376
1376
|
*/
|
|
1377
1377
|
clearHighlight(index: number): void;
|
|
1378
|
+
/**
|
|
1379
|
+
* Call before you build a submit result from your own button.
|
|
1380
|
+
* A typed word that equals exactly one completion candidate becomes a completed param, the same as Enter.
|
|
1381
|
+
* Read the updated state with `getState()` to build the result.
|
|
1382
|
+
*/
|
|
1383
|
+
prepareSubmit(): void;
|
|
1378
1384
|
/**
|
|
1379
1385
|
* Records a submit in telemetry. The SDK does this itself when it runs the
|
|
1380
1386
|
* submit (Enter, or Tier 1's button); call it only from a submit path you
|