@magicx-eng/ai-autocomplete-angular 0.32.5 → 0.33.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 +22 -0
- package/esm2020/lib/ai-autocomplete/ai-autocomplete.component.mjs +16 -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 +27 -18
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs +26 -15
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/lib/ai-autocomplete/ai-autocomplete.component.d.ts +9 -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 +8 -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
|
|
@@ -2127,6 +2125,7 @@ class AIAutocompleteComponent {
|
|
|
2127
2125
|
showProducts: this.showProducts,
|
|
2128
2126
|
source: "full-sdk",
|
|
2129
2127
|
products: this.products,
|
|
2128
|
+
mapProducts: this.mapProducts,
|
|
2130
2129
|
value: this.value,
|
|
2131
2130
|
completedParams: this.completedParams,
|
|
2132
2131
|
onSubmit: (result) => this.handleSubmit(result),
|
|
@@ -2209,7 +2208,8 @@ class AIAutocompleteComponent {
|
|
|
2209
2208
|
changes["closeDropdownOnBlur"] ||
|
|
2210
2209
|
changes["showNonTappableOptions"] ||
|
|
2211
2210
|
changes["showProducts"] ||
|
|
2212
|
-
changes["products"]
|
|
2211
|
+
changes["products"] ||
|
|
2212
|
+
changes["mapProducts"]) {
|
|
2213
2213
|
this.controller.update({
|
|
2214
2214
|
apiConfig: this.apiConfig,
|
|
2215
2215
|
additionalContext: this.additionalContext,
|
|
@@ -2224,6 +2224,7 @@ class AIAutocompleteComponent {
|
|
|
2224
2224
|
// Same reference on an unrelated change is a no-op in the core; only a
|
|
2225
2225
|
// genuinely swapped (or removed) integration clears the strip.
|
|
2226
2226
|
products: this.products,
|
|
2227
|
+
mapProducts: this.mapProducts,
|
|
2227
2228
|
});
|
|
2228
2229
|
}
|
|
2229
2230
|
if (changes["mode"]) {
|
|
@@ -2248,6 +2249,14 @@ class AIAutocompleteComponent {
|
|
|
2248
2249
|
blur() {
|
|
2249
2250
|
this.editorRef?.nativeElement.blur();
|
|
2250
2251
|
}
|
|
2252
|
+
/**
|
|
2253
|
+
* Runs mapProducts synchronously on the shown items again without a request.
|
|
2254
|
+
* Keeps the same cards while updating their content.
|
|
2255
|
+
* Does nothing without mapProducts or with a custom products integration.
|
|
2256
|
+
*/
|
|
2257
|
+
refreshProducts() {
|
|
2258
|
+
this.controller?.refreshProducts();
|
|
2259
|
+
}
|
|
2251
2260
|
/** Clear all state, rotate session, and re-fetch. */
|
|
2252
2261
|
reset() {
|
|
2253
2262
|
this.controller?.reset();
|
|
@@ -2411,7 +2420,7 @@ class AIAutocompleteComponent {
|
|
|
2411
2420
|
}
|
|
2412
2421
|
}
|
|
2413
2422
|
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: [
|
|
2423
|
+
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", 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
2424
|
{
|
|
2416
2425
|
provide: NG_VALUE_ACCESSOR,
|
|
2417
2426
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
@@ -2489,6 +2498,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2489
2498
|
type: Input
|
|
2490
2499
|
}], products: [{
|
|
2491
2500
|
type: Input
|
|
2501
|
+
}], mapProducts: [{
|
|
2502
|
+
type: Input
|
|
2492
2503
|
}], submitButton: [{
|
|
2493
2504
|
type: Input
|
|
2494
2505
|
}], resetOnSubmit: [{
|