@reactionary/hcl 0.9.11 → 0.9.13

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.
Files changed (39) hide show
  1. package/capabilities/analytics.capability.js +98 -0
  2. package/capabilities/order-search.capability.js +79 -0
  3. package/capabilities/order.capability.js +62 -0
  4. package/capabilities/personalization-profile.capability.js +85 -0
  5. package/capabilities/product-associations.capability.js +117 -0
  6. package/capabilities/product-recommendations.capability.js +143 -0
  7. package/capabilities/profile.capability.js +215 -0
  8. package/core/initialize.js +136 -2
  9. package/factories/index.js +6 -0
  10. package/factories/order/order.factory.js +124 -0
  11. package/factories/order-search/order-search.factory.js +59 -0
  12. package/factories/personalization-profile/personalization-profile.factory.js +16 -0
  13. package/factories/product-associations/product-associations.factory.js +16 -0
  14. package/factories/product-recommendations/product-recommendations.factory.js +17 -0
  15. package/factories/profile/profile.factory.js +49 -0
  16. package/index.js +7 -0
  17. package/package.json +2 -2
  18. package/schema/capabilities.schema.js +16 -2
  19. package/schema/configuration.schema.js +37 -1
  20. package/src/capabilities/analytics.capability.d.ts +17 -0
  21. package/src/capabilities/order-search.capability.d.ts +13 -0
  22. package/src/capabilities/order.capability.d.ts +13 -0
  23. package/src/capabilities/personalization-profile.capability.d.ts +19 -0
  24. package/src/capabilities/product-associations.capability.d.ts +22 -0
  25. package/src/capabilities/product-recommendations.capability.d.ts +29 -0
  26. package/src/capabilities/profile.capability.d.ts +31 -0
  27. package/src/core/initialize.types.d.ts +7 -1
  28. package/src/factories/index.d.ts +6 -0
  29. package/src/factories/order/order.factory.d.ts +11 -0
  30. package/src/factories/order-search/order-search.factory.d.ts +9 -0
  31. package/src/factories/personalization-profile/personalization-profile.factory.d.ts +11 -0
  32. package/src/factories/product-associations/product-associations.factory.d.ts +8 -0
  33. package/src/factories/product-recommendations/product-recommendations.factory.d.ts +12 -0
  34. package/src/factories/profile/profile.factory.d.ts +9 -0
  35. package/src/index.d.ts +7 -0
  36. package/src/schema/capabilities.schema.d.ts +45 -1
  37. package/src/schema/configuration.schema.d.ts +24 -0
  38. package/src/schema/hcl.schema.d.ts +122 -1
  39. package/src/test/test-utils.d.ts +4 -1
@@ -0,0 +1,98 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ AnalyticsCapability,
14
+ AnalyticsMutationSchema,
15
+ AnalyticsResultSchema,
16
+ Reactionary
17
+ } from "@reactionary/core";
18
+ import { SESSION_KEY_PERSONALIZATION_ID } from "../core/session-keys.js";
19
+ class HclAnalyticsCapability extends AnalyticsCapability {
20
+ constructor(cache, context, config, client) {
21
+ super(cache, context);
22
+ this.config = config;
23
+ this.client = client;
24
+ }
25
+ async track(event) {
26
+ return super.track(event);
27
+ }
28
+ async processProductSummaryView(event) {
29
+ try {
30
+ for (const product of event.products) {
31
+ await this.fireEvent({ productId: product.key });
32
+ }
33
+ return this.accepted();
34
+ } catch {
35
+ return this.rejected();
36
+ }
37
+ }
38
+ async processProductSummaryClick(event) {
39
+ try {
40
+ await this.fireEvent({ productId: event.product.key });
41
+ return this.accepted();
42
+ } catch {
43
+ return this.rejected();
44
+ }
45
+ }
46
+ async processProductDetailsView(event) {
47
+ try {
48
+ await this.fireEvent({ productId: event.product.key });
49
+ return this.accepted();
50
+ } catch {
51
+ return this.rejected();
52
+ }
53
+ }
54
+ async processProductAddToCart(event) {
55
+ try {
56
+ await this.fireEvent({ productId: event.product.key });
57
+ return this.accepted();
58
+ } catch {
59
+ return this.rejected();
60
+ }
61
+ }
62
+ async processPurchase(event) {
63
+ try {
64
+ for (const item of event.order.items) {
65
+ await this.fireEvent({ productId: item.variant.sku });
66
+ }
67
+ return this.accepted();
68
+ } catch {
69
+ return this.rejected();
70
+ }
71
+ }
72
+ async fireEvent(extra) {
73
+ await this.client.callPost(
74
+ this.getEventUrl(),
75
+ this.getEventBody(extra)
76
+ );
77
+ }
78
+ getEventUrl() {
79
+ return `${this.client.transactionBaseUrl}/event`;
80
+ }
81
+ getEventBody(extra) {
82
+ const personalizationID = this.context.session[SESSION_KEY_PERSONALIZATION_ID];
83
+ const body = { ...extra };
84
+ if (personalizationID) {
85
+ body["personalizationID"] = personalizationID;
86
+ }
87
+ return body;
88
+ }
89
+ }
90
+ __decorateClass([
91
+ Reactionary({
92
+ inputSchema: AnalyticsMutationSchema,
93
+ outputSchema: AnalyticsResultSchema
94
+ })
95
+ ], HclAnalyticsCapability.prototype, "track", 1);
96
+ export {
97
+ HclAnalyticsCapability
98
+ };
@@ -0,0 +1,79 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ OrderSearchCapability,
14
+ OrderSearchQueryByTermSchema,
15
+ OrderSearchResultSchema,
16
+ Reactionary,
17
+ success
18
+ } from "@reactionary/core";
19
+ import createDebug from "debug";
20
+ const debug = createDebug("reactionary:hcl:order-search");
21
+ const ALL_HISTORY_STATUSES = "C,S,X,R,D,M,G,F";
22
+ function coreStatusToWcs(status) {
23
+ switch (status) {
24
+ case "Shipped":
25
+ return "S";
26
+ case "Cancelled":
27
+ return "X,R,D";
28
+ case "ReleasedToFulfillment":
29
+ return "M,G,F";
30
+ case "AwaitingPayment":
31
+ return "C";
32
+ }
33
+ }
34
+ class HclOrderSearchCapability extends OrderSearchCapability {
35
+ config;
36
+ client;
37
+ factory;
38
+ constructor(cache, context, config, client, factory) {
39
+ super(cache, context);
40
+ this.config = config;
41
+ this.client = client;
42
+ this.factory = factory;
43
+ }
44
+ async queryByTerm(payload) {
45
+ const { pageSize, pageNumber } = payload.search.paginationOptions;
46
+ const wcsStatuses = payload.search.orderStatus?.length ? payload.search.orderStatus.map(coreStatusToWcs).join(",") : ALL_HISTORY_STATUSES;
47
+ debug(
48
+ "queryByTerm statuses=%s page=%d/%d",
49
+ wcsStatuses,
50
+ pageNumber,
51
+ pageSize
52
+ );
53
+ const data = await this.client.callGet(
54
+ this.orderByStatusUrl(wcsStatuses),
55
+ this.orderByStatusParams(pageSize, (pageNumber - 1) * pageSize)
56
+ );
57
+ return success(
58
+ this.factory.parseOrderSearchResult(this.context, data, payload)
59
+ );
60
+ }
61
+ orderByStatusUrl(statuses) {
62
+ return `${this.client.transactionBaseUrl}/order/byStatus/${encodeURIComponent(statuses)}`;
63
+ }
64
+ orderByStatusParams(maxResults, startIndex) {
65
+ return new URLSearchParams({
66
+ maxResults: String(maxResults),
67
+ startIndex: String(startIndex)
68
+ });
69
+ }
70
+ }
71
+ __decorateClass([
72
+ Reactionary({
73
+ inputSchema: OrderSearchQueryByTermSchema,
74
+ outputSchema: OrderSearchResultSchema
75
+ })
76
+ ], HclOrderSearchCapability.prototype, "queryByTerm", 1);
77
+ export {
78
+ HclOrderSearchCapability
79
+ };
@@ -0,0 +1,62 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ OrderCapability,
14
+ OrderQueryByIdSchema,
15
+ OrderSchema,
16
+ Reactionary,
17
+ error,
18
+ success
19
+ } from "@reactionary/core";
20
+ import createDebug from "debug";
21
+ const debug = createDebug("reactionary:hcl:order");
22
+ class HclOrderCapability extends OrderCapability {
23
+ config;
24
+ client;
25
+ factory;
26
+ constructor(cache, context, config, client, factory) {
27
+ super(cache, context);
28
+ this.config = config;
29
+ this.client = client;
30
+ this.factory = factory;
31
+ }
32
+ async getById(payload) {
33
+ debug("getById %s", payload.order.key);
34
+ const data = await this.client.callGet(
35
+ this.orderUrl(payload.order.key),
36
+ this.orderParams(),
37
+ { allowUndefined: true }
38
+ );
39
+ if (!data) {
40
+ return error({
41
+ type: "NotFound",
42
+ identifier: payload.order
43
+ });
44
+ }
45
+ return success(this.factory.parseOrder(this.context, data));
46
+ }
47
+ orderUrl(orderId) {
48
+ return `${this.client.transactionBaseUrl}/order/${encodeURIComponent(orderId)}`;
49
+ }
50
+ orderParams() {
51
+ return new URLSearchParams({ profileName: "IBM_getOrderDetailsByOrderId" });
52
+ }
53
+ }
54
+ __decorateClass([
55
+ Reactionary({
56
+ inputSchema: OrderQueryByIdSchema,
57
+ outputSchema: OrderSchema
58
+ })
59
+ ], HclOrderCapability.prototype, "getById", 1);
60
+ export {
61
+ HclOrderCapability
62
+ };
@@ -0,0 +1,85 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ PersonalizationProfileCapability,
14
+ PersonalizationProfileQueryGetProfileSchema,
15
+ PersonalizationProfileSchema,
16
+ Reactionary,
17
+ success
18
+ } from "@reactionary/core";
19
+ import { SESSION_KEY_PERSONALIZATION_ID } from "../core/session-keys.js";
20
+ class HclPersonalizationProfileCapability extends PersonalizationProfileCapability {
21
+ constructor(cache, context, config, client, factory) {
22
+ super(cache, context);
23
+ this.config = config;
24
+ this.client = client;
25
+ this.factory = factory;
26
+ }
27
+ async getPersonalizationProfile(_payload) {
28
+ const personalizationId = this.context.session[SESSION_KEY_PERSONALIZATION_ID];
29
+ if (!personalizationId) {
30
+ return success(
31
+ this.factory.parsePersonalizationProfile(this.context, {
32
+ personalizationId: "anonymous",
33
+ segments: []
34
+ })
35
+ );
36
+ }
37
+ const segments = await this.fetchSegments(personalizationId);
38
+ return success(
39
+ this.factory.parsePersonalizationProfile(this.context, {
40
+ personalizationId,
41
+ segments
42
+ })
43
+ );
44
+ }
45
+ /**
46
+ * Calls the WCS segment API to retrieve the customer segments for the given
47
+ * personalization ID. Returns an empty array when the API call fails or
48
+ * returns no segment data.
49
+ */
50
+ async fetchSegments(personalizationId) {
51
+ try {
52
+ const response = await this.client.callGet(
53
+ this.getSegmentsUrl(),
54
+ this.getSegmentsParams(personalizationId),
55
+ { allowUndefined: true }
56
+ );
57
+ if (!response?.MemberGroup) {
58
+ return [];
59
+ }
60
+ return response.MemberGroup.map((g) => g.displayName?.value).filter(
61
+ (name) => name !== void 0 && name.length > 0
62
+ );
63
+ } catch {
64
+ return [];
65
+ }
66
+ }
67
+ getSegmentsUrl() {
68
+ return `${this.client.transactionBaseUrl}/segment`;
69
+ }
70
+ getSegmentsParams(personalizationId) {
71
+ const params = new URLSearchParams();
72
+ params.set("q", "byPersonalizationId");
73
+ params.set("qPersonalizationId", personalizationId);
74
+ return params;
75
+ }
76
+ }
77
+ __decorateClass([
78
+ Reactionary({
79
+ inputSchema: PersonalizationProfileQueryGetProfileSchema,
80
+ outputSchema: PersonalizationProfileSchema
81
+ })
82
+ ], HclPersonalizationProfileCapability.prototype, "getPersonalizationProfile", 1);
83
+ export {
84
+ HclPersonalizationProfileCapability
85
+ };
@@ -0,0 +1,117 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ ProductAssociationsCapability,
14
+ ProductAssociationSchema,
15
+ ProductAssociationsGetAccessoriesQuerySchema,
16
+ ProductAssociationsGetSparepartsQuerySchema,
17
+ ProductAssociationsGetReplacementsQuerySchema,
18
+ Reactionary,
19
+ success
20
+ } from "@reactionary/core";
21
+ import * as z from "zod";
22
+ class HclProductAssociationsCapability extends ProductAssociationsCapability {
23
+ constructor(cache, context, config, client, factory) {
24
+ super(cache, context);
25
+ this.config = config;
26
+ this.client = client;
27
+ this.factory = factory;
28
+ }
29
+ async getAccessories(query) {
30
+ const associations = await this.fetchAssociations(
31
+ query.forProduct.key,
32
+ this.config.associationTypes.accessories,
33
+ query.numberOfAccessories
34
+ );
35
+ return success(
36
+ associations.map((a) => this.factory.parseAssociation(this.context, a))
37
+ );
38
+ }
39
+ async getSpareparts(query) {
40
+ const associations = await this.fetchAssociations(
41
+ query.forProduct.key,
42
+ this.config.associationTypes.spareparts,
43
+ query.numberOfSpareparts
44
+ );
45
+ return success(
46
+ associations.map((a) => this.factory.parseAssociation(this.context, a))
47
+ );
48
+ }
49
+ async getReplacements(query) {
50
+ const associations = await this.fetchAssociations(
51
+ query.forProduct.key,
52
+ this.config.associationTypes.replacements,
53
+ query.numberOfReplacements
54
+ );
55
+ return success(
56
+ associations.map((a) => this.factory.parseAssociation(this.context, a))
57
+ );
58
+ }
59
+ /**
60
+ * Fetches the product detail for the given part number and returns the
61
+ * `merchandisingAssociations` filtered to the requested association types,
62
+ * capped at `maxCount`.
63
+ */
64
+ async fetchAssociations(partNumber, types, maxCount) {
65
+ const response = await this.client.callGet(
66
+ this.getProductsUrl(),
67
+ this.getProductsParams(partNumber)
68
+ );
69
+ const product = (response.contents ?? response.catalogEntryView ?? [])[0];
70
+ if (!product?.merchandisingAssociations) {
71
+ return [];
72
+ }
73
+ return product.merchandisingAssociations.filter(
74
+ (a) => a.associationCodeType && types.includes(a.associationCodeType)
75
+ ).slice(0, maxCount);
76
+ }
77
+ getProductsUrl() {
78
+ return `${this.client.catalogBaseUrl}/api/v2/products`;
79
+ }
80
+ getProductsParams(partNumber) {
81
+ const params = new URLSearchParams();
82
+ params.set("storeId", this.config.storeId);
83
+ params.append("partNumber", partNumber);
84
+ params.set("profileName", this.config.profiles.product);
85
+ return params;
86
+ }
87
+ }
88
+ __decorateClass([
89
+ Reactionary({
90
+ inputSchema: ProductAssociationsGetAccessoriesQuerySchema,
91
+ outputSchema: z.array(ProductAssociationSchema),
92
+ cache: true,
93
+ cacheTimeToLiveInSeconds: 300,
94
+ currencyDependentCaching: false
95
+ })
96
+ ], HclProductAssociationsCapability.prototype, "getAccessories", 1);
97
+ __decorateClass([
98
+ Reactionary({
99
+ inputSchema: ProductAssociationsGetSparepartsQuerySchema,
100
+ outputSchema: z.array(ProductAssociationSchema),
101
+ cache: true,
102
+ cacheTimeToLiveInSeconds: 300,
103
+ currencyDependentCaching: false
104
+ })
105
+ ], HclProductAssociationsCapability.prototype, "getSpareparts", 1);
106
+ __decorateClass([
107
+ Reactionary({
108
+ inputSchema: ProductAssociationsGetReplacementsQuerySchema,
109
+ outputSchema: z.array(ProductAssociationSchema),
110
+ cache: true,
111
+ cacheTimeToLiveInSeconds: 300,
112
+ currencyDependentCaching: false
113
+ })
114
+ ], HclProductAssociationsCapability.prototype, "getReplacements", 1);
115
+ export {
116
+ HclProductAssociationsCapability
117
+ };
@@ -0,0 +1,143 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ ProductRecommendationsCapability,
14
+ ProductRecommendationsQuerySchema,
15
+ ProductRecommendationsByCollectionQuerySchema,
16
+ Reactionary,
17
+ success
18
+ } from "@reactionary/core";
19
+ class HclProductRecommendationsCapability extends ProductRecommendationsCapability {
20
+ constructor(cache, context, config, client, factory) {
21
+ super(cache, context);
22
+ this.config = config;
23
+ this.client = client;
24
+ this.factory = factory;
25
+ }
26
+ getRecommendations(...args) {
27
+ return super.getRecommendations(...args);
28
+ }
29
+ async getCollection(query) {
30
+ const params = {
31
+ productId: query.sourceProduct?.[0]?.key,
32
+ categoryId: query.sourceCategory?.key,
33
+ count: String(query.numberOfRecommendations)
34
+ };
35
+ const recommendations = await this.fetchEspot(
36
+ query.collectionName,
37
+ query.collectionName,
38
+ params
39
+ );
40
+ return success(recommendations.slice(0, query.numberOfRecommendations));
41
+ }
42
+ async getFrequentlyBoughtTogetherRecommendations(query) {
43
+ return this.fetchEspot(
44
+ this.config.espotNames.frequentlyBoughtTogether,
45
+ "frequentlyBoughtTogether",
46
+ {
47
+ productId: query.sourceProduct.key,
48
+ count: String(query.numberOfRecommendations)
49
+ }
50
+ );
51
+ }
52
+ async getSimilarProductsRecommendations(query) {
53
+ return this.fetchEspot(this.config.espotNames.similar, "similar", {
54
+ productId: query.sourceProduct.key,
55
+ count: String(query.numberOfRecommendations)
56
+ });
57
+ }
58
+ async getRelatedProductsRecommendations(query) {
59
+ return this.fetchEspot(this.config.espotNames.related, "related", {
60
+ productId: query.sourceProduct.key,
61
+ count: String(query.numberOfRecommendations)
62
+ });
63
+ }
64
+ async getTrendingInCategoryRecommendations(query) {
65
+ return this.fetchEspot(
66
+ this.config.espotNames.trendingInCategory,
67
+ "trendingInCategory",
68
+ {
69
+ categoryId: query.sourceCategory.key,
70
+ count: String(query.numberOfRecommendations)
71
+ }
72
+ );
73
+ }
74
+ async getPopularProductsRecommendations(query) {
75
+ return this.fetchEspot(this.config.espotNames.popular, "popular", {
76
+ count: String(query.numberOfRecommendations)
77
+ });
78
+ }
79
+ async getTopPicksProductsRecommendations(query) {
80
+ return this.fetchEspot(this.config.espotNames.topPicks, "topPicks", {
81
+ count: String(query.numberOfRecommendations)
82
+ });
83
+ }
84
+ async getAlsoViewedProductsRecommendations(query) {
85
+ return this.fetchEspot(this.config.espotNames.alsoViewed, "alsoViewed", {
86
+ productId: query.sourceProduct.key,
87
+ count: String(query.numberOfRecommendations)
88
+ });
89
+ }
90
+ /**
91
+ * Calls an HCL marketing spot (espot) by name and maps its catalog entry
92
+ * activity data to `ProductRecommendation[]` using the factory.
93
+ *
94
+ * Returns an empty array when the espot is not found (404) or returns no
95
+ * catalog entry data — allowing teams to configure only the espots they need.
96
+ */
97
+ async fetchEspot(name, algorithm, params = {}) {
98
+ const response = await this.client.callGet(
99
+ this.getEspotUrl(name),
100
+ this.getEspotParams(params),
101
+ { allowUndefined: true }
102
+ );
103
+ if (!response) {
104
+ return [];
105
+ }
106
+ const activities = response.MarketingSpotData?.[0]?.baseMarketingSpotActivityData ?? [];
107
+ return activities.filter(
108
+ (a) => a.baseMarketingSpotDataType === "CatalogEntry" || a.baseMarketingSpotDataType === "CatalogEntryId"
109
+ ).map(
110
+ (a) => this.factory.parseRecommendation(this.context, {
111
+ activityData: a,
112
+ algorithm
113
+ })
114
+ ).filter((r) => r.product.key !== "");
115
+ }
116
+ getEspotUrl(name) {
117
+ return `${this.client.transactionBaseUrl}/espot/${encodeURIComponent(name)}`;
118
+ }
119
+ getEspotParams(params) {
120
+ const searchParams = new URLSearchParams();
121
+ const count = params["count"];
122
+ if (count)
123
+ searchParams.set("DM_DisplayProducts", count);
124
+ if (params["productId"])
125
+ searchParams.set("productId", params["productId"]);
126
+ if (params["categoryId"])
127
+ searchParams.set("categoryId", params["categoryId"]);
128
+ return searchParams;
129
+ }
130
+ }
131
+ __decorateClass([
132
+ Reactionary({
133
+ inputSchema: ProductRecommendationsQuerySchema
134
+ })
135
+ ], HclProductRecommendationsCapability.prototype, "getRecommendations", 1);
136
+ __decorateClass([
137
+ Reactionary({
138
+ inputSchema: ProductRecommendationsByCollectionQuerySchema
139
+ })
140
+ ], HclProductRecommendationsCapability.prototype, "getCollection", 1);
141
+ export {
142
+ HclProductRecommendationsCapability
143
+ };