@magicx-eng/ai-autocomplete-angular 0.28.4 → 0.29.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 +9 -1
- package/esm2020/lib/ai-autocomplete/ai-autocomplete.component.mjs +16 -6
- package/esm2020/lib/controller/ai-autocomplete.controller.mjs +10 -1
- package/esm2020/lib/shared/types.mjs +1 -1
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs +24 -5
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs +24 -5
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/lib/ai-autocomplete/ai-autocomplete.component.d.ts +8 -1
- package/lib/ai-autocomplete/ai-autocomplete.component.d.ts.map +1 -1
- package/lib/controller/ai-autocomplete.controller.d.ts +5 -0
- package/lib/controller/ai-autocomplete.controller.d.ts.map +1 -1
- package/lib/shared/types.d.ts +7 -0
- package/lib/shared/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1355,6 +1355,15 @@ class AIAutocompleteController {
|
|
|
1355
1355
|
return;
|
|
1356
1356
|
this.core.reset();
|
|
1357
1357
|
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Records a submit in telemetry. Enter is recorded by the SDK; call this
|
|
1360
|
+
* from a submit button you render, so each submit is counted once.
|
|
1361
|
+
*/
|
|
1362
|
+
recordSubmit(result) {
|
|
1363
|
+
if (this.isDestroyed)
|
|
1364
|
+
return;
|
|
1365
|
+
this.core.recordSubmit(result);
|
|
1366
|
+
}
|
|
1358
1367
|
/** Pick a dropdown option (or replace the re-edited param if in re-edit mode). */
|
|
1359
1368
|
selectOption(option) {
|
|
1360
1369
|
if (this.isDestroyed)
|
|
@@ -2047,6 +2056,7 @@ class AIAutocompleteComponent {
|
|
|
2047
2056
|
this.controller = new AIAutocompleteController({
|
|
2048
2057
|
apiConfig: this.apiConfig,
|
|
2049
2058
|
additionalContext: this.additionalContext,
|
|
2059
|
+
visitorId: this.visitorId,
|
|
2050
2060
|
optionOverrides: this.optionOverrides,
|
|
2051
2061
|
maskCompletedText: this.maskCompletedText,
|
|
2052
2062
|
columns: this.columns,
|
|
@@ -2131,6 +2141,7 @@ class AIAutocompleteComponent {
|
|
|
2131
2141
|
// Reactive options
|
|
2132
2142
|
if (changes["apiConfig"] ||
|
|
2133
2143
|
changes["additionalContext"] ||
|
|
2144
|
+
changes["visitorId"] ||
|
|
2134
2145
|
changes["optionOverrides"] ||
|
|
2135
2146
|
changes["dropdownTrigger"] ||
|
|
2136
2147
|
changes["optionsPosition"] ||
|
|
@@ -2141,6 +2152,7 @@ class AIAutocompleteComponent {
|
|
|
2141
2152
|
this.controller.update({
|
|
2142
2153
|
apiConfig: this.apiConfig,
|
|
2143
2154
|
additionalContext: this.additionalContext,
|
|
2155
|
+
visitorId: this.visitorId,
|
|
2144
2156
|
optionOverrides: this.optionOverrides,
|
|
2145
2157
|
dropdownTrigger: this.dropdownTrigger,
|
|
2146
2158
|
optionsPosition: this.optionsPosition,
|
|
@@ -2273,18 +2285,23 @@ class AIAutocompleteComponent {
|
|
|
2273
2285
|
* the React component uses — so the emitted query reflects whatever's in
|
|
2274
2286
|
* the DOM right now, not a possibly-stale state snapshot.
|
|
2275
2287
|
*/
|
|
2276
|
-
|
|
2288
|
+
// `fromButton`: the SDK records an Enter submit itself before it calls back
|
|
2289
|
+
// here; a click on our own button never passes through it.
|
|
2290
|
+
handleSubmit(_result, fromButton = false) {
|
|
2277
2291
|
const editor = this.editorRef?.nativeElement;
|
|
2278
2292
|
if (!editor)
|
|
2279
2293
|
return;
|
|
2280
2294
|
const text = extractPlainText(editor);
|
|
2281
2295
|
const state = this.controller.getState();
|
|
2282
2296
|
const params = this.completedParams ?? state.completedParams;
|
|
2283
|
-
|
|
2297
|
+
const result = buildSubmitResult$1(text, params, state.skippedParams, {
|
|
2284
2298
|
identifiedParams: state.identifiedParams,
|
|
2285
2299
|
isReady: state.isReady,
|
|
2286
2300
|
customFields: state.customFields,
|
|
2287
|
-
})
|
|
2301
|
+
});
|
|
2302
|
+
if (fromButton)
|
|
2303
|
+
this.controller.recordSubmit(result);
|
|
2304
|
+
this.submitted.emit(result);
|
|
2288
2305
|
if (this.resetOnSubmit)
|
|
2289
2306
|
this.controller.reset();
|
|
2290
2307
|
}
|
|
@@ -2301,7 +2318,7 @@ class AIAutocompleteComponent {
|
|
|
2301
2318
|
completed_params: [],
|
|
2302
2319
|
identified_params: [],
|
|
2303
2320
|
is_ready: state.isReady,
|
|
2304
|
-
});
|
|
2321
|
+
}, true);
|
|
2305
2322
|
}
|
|
2306
2323
|
measurePillWrap() {
|
|
2307
2324
|
const container = this.pillContainerRef?.nativeElement;
|
|
@@ -2328,7 +2345,7 @@ class AIAutocompleteComponent {
|
|
|
2328
2345
|
}
|
|
2329
2346
|
}
|
|
2330
2347
|
AIAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2331
|
-
AIAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIAutocompleteComponent, isStandalone: true, selector: "ai-autocomplete", inputs: { apiConfig: "apiConfig", additionalContext: "additionalContext", optionOverrides: "optionOverrides", maskCompletedText: "maskCompletedText", columns: "columns", pillPlacement: "pillPlacement", mode: "mode", optionsPosition: "optionsPosition", animations: "animations", dropdownTrigger: "dropdownTrigger", closeDropdownOnBlur: "closeDropdownOnBlur", showNonTappableOptions: "showNonTappableOptions", showSkipButton: "showSkipButton", showOptionIcons: "showOptionIcons", showOptionImages: "showOptionImages", showOptionCounts: "showOptionCounts", productsLayout: "productsLayout", productImageFallback: "productImageFallback", showChipIcons: "showChipIcons", showChipImages: "showChipImages", autoFocus: "autoFocus", value: "value", completedParams: "completedParams", showProducts: "showProducts", products: "products", submitButton: "submitButton", resetOnSubmit: "resetOnSubmit" }, outputs: { submitted: "submitted", resultChange: "resultChange", errored: "errored", valueChange: "valueChange", completedParamsChange: "completedParamsChange", focused: "focused", blurred: "blurred", productSelect: "productSelect" }, providers: [
|
|
2348
|
+
AIAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIAutocompleteComponent, isStandalone: true, selector: "ai-autocomplete", inputs: { apiConfig: "apiConfig", additionalContext: "additionalContext", visitorId: "visitorId", optionOverrides: "optionOverrides", maskCompletedText: "maskCompletedText", columns: "columns", pillPlacement: "pillPlacement", mode: "mode", optionsPosition: "optionsPosition", animations: "animations", dropdownTrigger: "dropdownTrigger", closeDropdownOnBlur: "closeDropdownOnBlur", showNonTappableOptions: "showNonTappableOptions", showSkipButton: "showSkipButton", showOptionIcons: "showOptionIcons", showOptionImages: "showOptionImages", showOptionCounts: "showOptionCounts", productsLayout: "productsLayout", productImageFallback: "productImageFallback", showChipIcons: "showChipIcons", showChipImages: "showChipImages", autoFocus: "autoFocus", value: "value", completedParams: "completedParams", showProducts: "showProducts", products: "products", submitButton: "submitButton", resetOnSubmit: "resetOnSubmit" }, outputs: { submitted: "submitted", resultChange: "resultChange", errored: "errored", valueChange: "valueChange", completedParamsChange: "completedParamsChange", focused: "focused", blurred: "blurred", productSelect: "productSelect" }, providers: [
|
|
2332
2349
|
{
|
|
2333
2350
|
provide: NG_VALUE_ACCESSOR,
|
|
2334
2351
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
@@ -2356,6 +2373,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2356
2373
|
type: Input
|
|
2357
2374
|
}], additionalContext: [{
|
|
2358
2375
|
type: Input
|
|
2376
|
+
}], visitorId: [{
|
|
2377
|
+
type: Input
|
|
2359
2378
|
}], optionOverrides: [{
|
|
2360
2379
|
type: Input
|
|
2361
2380
|
}], maskCompletedText: [{
|