@magicx-eng/ai-autocomplete-angular 0.32.6 → 0.34.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 +24 -1
- package/esm2020/lib/ai-autocomplete/ai-autocomplete.component.mjs +21 -3
- package/esm2020/lib/controller/ai-autocomplete.controller.mjs +11 -1
- package/esm2020/lib/internal/product-strip/product-strip.component.mjs +2 -14
- package/esm2020/lib/shared/types.mjs +1 -1
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs +32 -18
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs +31 -15
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/lib/ai-autocomplete/ai-autocomplete.component.d.ts +16 -2
- package/lib/ai-autocomplete/ai-autocomplete.component.d.ts.map +1 -1
- package/lib/controller/ai-autocomplete.controller.d.ts +6 -0
- package/lib/controller/ai-autocomplete.controller.d.ts.map +1 -1
- package/lib/internal/product-strip/product-strip.component.d.ts +0 -4
- package/lib/internal/product-strip/product-strip.component.d.ts.map +1 -1
- package/lib/shared/types.d.ts +15 -1
- package/lib/shared/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -334,19 +334,7 @@ class ProductStripComponent {
|
|
|
334
334
|
*/
|
|
335
335
|
this.focusChange = new EventEmitter();
|
|
336
336
|
this.detachWheel = null;
|
|
337
|
-
|
|
338
|
-
* Identity *and* content: a same-id result whose fields changed must
|
|
339
|
-
* re-render rather than reuse the previous card's bindings.
|
|
340
|
-
*/
|
|
341
|
-
this.trackByProduct = (_, product) => [
|
|
342
|
-
product.id,
|
|
343
|
-
product.title,
|
|
344
|
-
product.url ?? "",
|
|
345
|
-
product.imageUrl ?? "",
|
|
346
|
-
product.price ?? "",
|
|
347
|
-
product.vendor ?? "",
|
|
348
|
-
product.available === false ? "sold-out" : "",
|
|
349
|
-
].join("\0");
|
|
337
|
+
this.trackByProduct = (_, product) => product.id;
|
|
350
338
|
}
|
|
351
339
|
ngOnChanges() {
|
|
352
340
|
const sources = new Map(this.products.map((product) => [product.id, productImageSources$1(product.imageUrl)]));
|
|
@@ -1537,6 +1525,16 @@ class AIAutocompleteController {
|
|
|
1537
1525
|
return;
|
|
1538
1526
|
this.core.showNextMonth();
|
|
1539
1527
|
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Runs mapProducts synchronously on the shown items again without a request.
|
|
1530
|
+
* Keeps the same cards while updating their content.
|
|
1531
|
+
* Does nothing without mapProducts or with a custom products integration.
|
|
1532
|
+
*/
|
|
1533
|
+
refreshProducts() {
|
|
1534
|
+
if (this.isDestroyed)
|
|
1535
|
+
return;
|
|
1536
|
+
this.core.refreshProducts();
|
|
1537
|
+
}
|
|
1540
1538
|
// === Lifecycle ===
|
|
1541
1539
|
/**
|
|
1542
1540
|
* Apply runtime changes to a subset of options. Event callbacks
|
|
@@ -2116,6 +2114,7 @@ class AIAutocompleteComponent {
|
|
|
2116
2114
|
apiConfig: this.apiConfig,
|
|
2117
2115
|
additionalContext: this.additionalContext,
|
|
2118
2116
|
language: this.language,
|
|
2117
|
+
productId: this.productId,
|
|
2119
2118
|
visitorId: this.visitorId,
|
|
2120
2119
|
optionOverrides: this.optionOverrides,
|
|
2121
2120
|
maskCompletedText: this.maskCompletedText,
|
|
@@ -2127,6 +2126,7 @@ class AIAutocompleteComponent {
|
|
|
2127
2126
|
showProducts: this.showProducts,
|
|
2128
2127
|
source: "full-sdk",
|
|
2129
2128
|
products: this.products,
|
|
2129
|
+
mapProducts: this.mapProducts,
|
|
2130
2130
|
value: this.value,
|
|
2131
2131
|
completedParams: this.completedParams,
|
|
2132
2132
|
onSubmit: (result) => this.handleSubmit(result),
|
|
@@ -2202,6 +2202,7 @@ class AIAutocompleteComponent {
|
|
|
2202
2202
|
if (changes["apiConfig"] ||
|
|
2203
2203
|
changes["additionalContext"] ||
|
|
2204
2204
|
changes["language"] ||
|
|
2205
|
+
changes["productId"] ||
|
|
2205
2206
|
changes["visitorId"] ||
|
|
2206
2207
|
changes["optionOverrides"] ||
|
|
2207
2208
|
changes["dropdownTrigger"] ||
|
|
@@ -2209,11 +2210,13 @@ class AIAutocompleteComponent {
|
|
|
2209
2210
|
changes["closeDropdownOnBlur"] ||
|
|
2210
2211
|
changes["showNonTappableOptions"] ||
|
|
2211
2212
|
changes["showProducts"] ||
|
|
2212
|
-
changes["products"]
|
|
2213
|
+
changes["products"] ||
|
|
2214
|
+
changes["mapProducts"]) {
|
|
2213
2215
|
this.controller.update({
|
|
2214
2216
|
apiConfig: this.apiConfig,
|
|
2215
2217
|
additionalContext: this.additionalContext,
|
|
2216
2218
|
language: this.language,
|
|
2219
|
+
productId: this.productId,
|
|
2217
2220
|
visitorId: this.visitorId,
|
|
2218
2221
|
optionOverrides: this.optionOverrides,
|
|
2219
2222
|
dropdownTrigger: this.dropdownTrigger,
|
|
@@ -2224,6 +2227,7 @@ class AIAutocompleteComponent {
|
|
|
2224
2227
|
// Same reference on an unrelated change is a no-op in the core; only a
|
|
2225
2228
|
// genuinely swapped (or removed) integration clears the strip.
|
|
2226
2229
|
products: this.products,
|
|
2230
|
+
mapProducts: this.mapProducts,
|
|
2227
2231
|
});
|
|
2228
2232
|
}
|
|
2229
2233
|
if (changes["mode"]) {
|
|
@@ -2248,6 +2252,14 @@ class AIAutocompleteComponent {
|
|
|
2248
2252
|
blur() {
|
|
2249
2253
|
this.editorRef?.nativeElement.blur();
|
|
2250
2254
|
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Runs mapProducts synchronously on the shown items again without a request.
|
|
2257
|
+
* Keeps the same cards while updating their content.
|
|
2258
|
+
* Does nothing without mapProducts or with a custom products integration.
|
|
2259
|
+
*/
|
|
2260
|
+
refreshProducts() {
|
|
2261
|
+
this.controller?.refreshProducts();
|
|
2262
|
+
}
|
|
2251
2263
|
/** Clear all state, rotate session, and re-fetch. */
|
|
2252
2264
|
reset() {
|
|
2253
2265
|
this.controller?.reset();
|
|
@@ -2411,7 +2423,7 @@ class AIAutocompleteComponent {
|
|
|
2411
2423
|
}
|
|
2412
2424
|
}
|
|
2413
2425
|
AIAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2414
|
-
AIAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIAutocompleteComponent, isStandalone: true, selector: "ai-autocomplete", inputs: { apiConfig: "apiConfig", additionalContext: "additionalContext", language: "language", 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: [
|
|
2426
|
+
AIAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIAutocompleteComponent, isStandalone: true, selector: "ai-autocomplete", inputs: { apiConfig: "apiConfig", additionalContext: "additionalContext", language: "language", productId: "productId", 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", mapProducts: "mapProducts", submitButton: "submitButton", resetOnSubmit: "resetOnSubmit" }, outputs: { submitted: "submitted", resultChange: "resultChange", errored: "errored", valueChange: "valueChange", completedParamsChange: "completedParamsChange", focused: "focused", blurred: "blurred", productSelect: "productSelect" }, providers: [
|
|
2415
2427
|
{
|
|
2416
2428
|
provide: NG_VALUE_ACCESSOR,
|
|
2417
2429
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
@@ -2441,6 +2453,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2441
2453
|
type: Input
|
|
2442
2454
|
}], language: [{
|
|
2443
2455
|
type: Input
|
|
2456
|
+
}], productId: [{
|
|
2457
|
+
type: Input
|
|
2444
2458
|
}], visitorId: [{
|
|
2445
2459
|
type: Input
|
|
2446
2460
|
}], optionOverrides: [{
|
|
@@ -2489,6 +2503,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2489
2503
|
type: Input
|
|
2490
2504
|
}], products: [{
|
|
2491
2505
|
type: Input
|
|
2506
|
+
}], mapProducts: [{
|
|
2507
|
+
type: Input
|
|
2492
2508
|
}], submitButton: [{
|
|
2493
2509
|
type: Input
|
|
2494
2510
|
}], resetOnSubmit: [{
|