@reactionary/hcl 0.9.12 → 0.9.14
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/capabilities/analytics.capability.js +98 -0
- package/capabilities/company.capability.js +307 -0
- package/capabilities/personalization-profile.capability.js +85 -0
- package/capabilities/product-associations.capability.js +117 -0
- package/capabilities/product-list.capability.js +665 -0
- package/capabilities/product-recommendations.capability.js +143 -0
- package/capabilities/store.capability.js +72 -0
- package/core/initialize.js +148 -2
- package/factories/company/company.factory.js +77 -0
- package/factories/index.js +6 -0
- package/factories/personalization-profile/personalization-profile.factory.js +16 -0
- package/factories/product-associations/product-associations.factory.js +16 -0
- package/factories/product-list/product-list.factory.js +158 -0
- package/factories/product-recommendations/product-recommendations.factory.js +17 -0
- package/factories/store/store.factory.js +18 -0
- package/index.js +7 -0
- package/package.json +2 -2
- package/schema/capabilities.schema.js +16 -2
- package/schema/configuration.schema.js +37 -1
- package/src/capabilities/analytics.capability.d.ts +17 -0
- package/src/capabilities/company.capability.d.ts +26 -0
- package/src/capabilities/personalization-profile.capability.d.ts +19 -0
- package/src/capabilities/product-associations.capability.d.ts +22 -0
- package/src/capabilities/product-list.capability.d.ts +42 -0
- package/src/capabilities/product-recommendations.capability.d.ts +29 -0
- package/src/capabilities/store.capability.d.ts +13 -0
- package/src/core/initialize.types.d.ts +7 -1
- package/src/factories/company/company.factory.d.ts +11 -0
- package/src/factories/index.d.ts +6 -0
- package/src/factories/personalization-profile/personalization-profile.factory.d.ts +11 -0
- package/src/factories/product-associations/product-associations.factory.d.ts +8 -0
- package/src/factories/product-list/product-list.factory.d.ts +40 -0
- package/src/factories/product-recommendations/product-recommendations.factory.d.ts +12 -0
- package/src/factories/store/store.factory.d.ts +8 -0
- package/src/index.d.ts +7 -0
- package/src/schema/capabilities.schema.d.ts +45 -1
- package/src/schema/configuration.schema.d.ts +24 -0
- package/src/schema/hcl.schema.d.ts +277 -1
- package/src/test/test-utils.d.ts +4 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class HclProductRecommendationsFactory {
|
|
2
|
+
productRecommendationSchema;
|
|
3
|
+
constructor(productRecommendationSchema) {
|
|
4
|
+
this.productRecommendationSchema = productRecommendationSchema;
|
|
5
|
+
}
|
|
6
|
+
parseRecommendation(_context, data) {
|
|
7
|
+
const key = data.activityData.partNumber ?? data.activityData.contentId ?? "";
|
|
8
|
+
return this.productRecommendationSchema.parse({
|
|
9
|
+
recommendationIdentifier: { key, algorithm: data.algorithm },
|
|
10
|
+
recommendationReturnType: "idOnly",
|
|
11
|
+
product: { key }
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
HclProductRecommendationsFactory
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class HclStoreFactory {
|
|
2
|
+
storeSchema;
|
|
3
|
+
constructor(storeSchema) {
|
|
4
|
+
this.storeSchema = storeSchema;
|
|
5
|
+
}
|
|
6
|
+
parseStore(_context, data) {
|
|
7
|
+
const name = data.Description?.[0]?.displayStoreName ?? data.storeName ?? data.uniqueID;
|
|
8
|
+
const result = {
|
|
9
|
+
identifier: { key: data.uniqueID },
|
|
10
|
+
name,
|
|
11
|
+
fulfillmentCenter: { key: data.uniqueID }
|
|
12
|
+
};
|
|
13
|
+
return this.storeSchema.parse(result);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
HclStoreFactory
|
|
18
|
+
};
|
package/index.js
CHANGED
|
@@ -17,3 +17,10 @@ export * from "./capabilities/identity.capability.js";
|
|
|
17
17
|
export * from "./capabilities/profile.capability.js";
|
|
18
18
|
export * from "./capabilities/order.capability.js";
|
|
19
19
|
export * from "./capabilities/order-search.capability.js";
|
|
20
|
+
export * from "./capabilities/analytics.capability.js";
|
|
21
|
+
export * from "./capabilities/product-associations.capability.js";
|
|
22
|
+
export * from "./capabilities/product-recommendations.capability.js";
|
|
23
|
+
export * from "./capabilities/personalization-profile.capability.js";
|
|
24
|
+
export * from "./capabilities/company.capability.js";
|
|
25
|
+
export * from "./capabilities/store.capability.js";
|
|
26
|
+
export * from "./capabilities/product-list.capability.js";
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/hcl",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@reactionary/core": "0.9.
|
|
8
|
+
"@reactionary/core": "0.9.14",
|
|
9
9
|
"debug": "^4.4.3",
|
|
10
10
|
"zod": "4.1.9"
|
|
11
11
|
},
|
|
@@ -9,26 +9,40 @@ const HclCapabilitiesSchema = CapabilitiesSchema.pick({
|
|
|
9
9
|
cart: true,
|
|
10
10
|
checkout: true,
|
|
11
11
|
category: true,
|
|
12
|
+
company: true,
|
|
12
13
|
product: true,
|
|
13
14
|
price: true,
|
|
14
15
|
inventory: true,
|
|
15
16
|
identity: true,
|
|
16
17
|
productSearch: true,
|
|
18
|
+
productList: true,
|
|
17
19
|
profile: true,
|
|
18
20
|
order: true,
|
|
19
|
-
orderSearch: true
|
|
21
|
+
orderSearch: true,
|
|
22
|
+
analytics: true,
|
|
23
|
+
productAssociations: true,
|
|
24
|
+
productRecommendations: true,
|
|
25
|
+
personalizationProfile: true,
|
|
26
|
+
store: true
|
|
20
27
|
}).extend({
|
|
21
28
|
cart: OverridableCapabilitySchema.optional(),
|
|
22
29
|
checkout: OverridableCapabilitySchema.optional(),
|
|
23
30
|
category: OverridableCapabilitySchema.optional(),
|
|
31
|
+
company: OverridableCapabilitySchema.optional(),
|
|
24
32
|
product: OverridableCapabilitySchema.optional(),
|
|
25
33
|
price: OverridableCapabilitySchema.optional(),
|
|
26
34
|
inventory: OverridableCapabilitySchema.optional(),
|
|
27
35
|
identity: OverridableCapabilitySchema.optional(),
|
|
28
36
|
productSearch: OverridableCapabilitySchema.optional(),
|
|
37
|
+
productList: OverridableCapabilitySchema.optional(),
|
|
29
38
|
profile: OverridableCapabilitySchema.optional(),
|
|
30
39
|
order: OverridableCapabilitySchema.optional(),
|
|
31
|
-
orderSearch: OverridableCapabilitySchema.optional()
|
|
40
|
+
orderSearch: OverridableCapabilitySchema.optional(),
|
|
41
|
+
analytics: OverridableCapabilitySchema.optional(),
|
|
42
|
+
productAssociations: OverridableCapabilitySchema.optional(),
|
|
43
|
+
productRecommendations: OverridableCapabilitySchema.optional(),
|
|
44
|
+
personalizationProfile: OverridableCapabilitySchema.optional(),
|
|
45
|
+
store: OverridableCapabilitySchema.optional()
|
|
32
46
|
}).partial();
|
|
33
47
|
export {
|
|
34
48
|
HclCapabilitiesSchema
|
|
@@ -37,7 +37,43 @@ const HclConfigurationSchema = z.looseObject({
|
|
|
37
37
|
*/
|
|
38
38
|
priceRuleId: z.string().optional().meta({
|
|
39
39
|
description: "Price rule ID for /display_price WCS calls. Optional \u2014 the server uses its default rule when absent."
|
|
40
|
-
})
|
|
40
|
+
}),
|
|
41
|
+
/**
|
|
42
|
+
* Maps Reactionary association types to the HCL `associationCodeType` values
|
|
43
|
+
* returned in `merchandisingAssociations` on product detail responses.
|
|
44
|
+
* Override to match custom HCL store configuration.
|
|
45
|
+
*/
|
|
46
|
+
associationTypes: z.looseObject({
|
|
47
|
+
accessories: z.array(z.string()).default(["ACCESSORY"]),
|
|
48
|
+
spareparts: z.array(z.string()).default(["SPAREPART"]),
|
|
49
|
+
replacements: z.array(z.string()).default(["REPLACEMENT"])
|
|
50
|
+
}).default(() => ({
|
|
51
|
+
accessories: ["ACCESSORY"],
|
|
52
|
+
spareparts: ["SPAREPART"],
|
|
53
|
+
replacements: ["REPLACEMENT"]
|
|
54
|
+
})),
|
|
55
|
+
/**
|
|
56
|
+
* Names of HCL marketing spots used for product recommendation algorithms.
|
|
57
|
+
* Each algorithm calls the corresponding named espot via the WCS Transaction Service.
|
|
58
|
+
* These espots must be configured in HCL Commerce to return catalog entry data.
|
|
59
|
+
*/
|
|
60
|
+
espotNames: z.looseObject({
|
|
61
|
+
frequentlyBoughtTogether: z.string().default("Reactionary_FrequentlyBoughtTogether"),
|
|
62
|
+
similar: z.string().default("Reactionary_SimilarProducts"),
|
|
63
|
+
related: z.string().default("Reactionary_RelatedProducts"),
|
|
64
|
+
trendingInCategory: z.string().default("Reactionary_TrendingInCategory"),
|
|
65
|
+
popular: z.string().default("Reactionary_Popular"),
|
|
66
|
+
topPicks: z.string().default("Reactionary_TopPicks"),
|
|
67
|
+
alsoViewed: z.string().default("Reactionary_AlsoViewed")
|
|
68
|
+
}).default(() => ({
|
|
69
|
+
frequentlyBoughtTogether: "Reactionary_FrequentlyBoughtTogether",
|
|
70
|
+
similar: "Reactionary_SimilarProducts",
|
|
71
|
+
related: "Reactionary_RelatedProducts",
|
|
72
|
+
trendingInCategory: "Reactionary_TrendingInCategory",
|
|
73
|
+
popular: "Reactionary_Popular",
|
|
74
|
+
topPicks: "Reactionary_TopPicks",
|
|
75
|
+
alsoViewed: "Reactionary_AlsoViewed"
|
|
76
|
+
}))
|
|
41
77
|
});
|
|
42
78
|
export {
|
|
43
79
|
HclConfigurationSchema
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnalyticsCapability, type AnalyticsMutation, type AnalyticsMutationProductAddToCartEvent, type AnalyticsMutationProductDetailsViewEvent, type AnalyticsMutationProductSummaryClickEvent, type AnalyticsMutationProductSummaryViewEvent, type AnalyticsMutationPurchaseEvent, type AnalyticsResult, type Cache, type RequestContext } from '@reactionary/core';
|
|
2
|
+
import type { HclConfiguration } from '../schema/configuration.schema.js';
|
|
3
|
+
import type { HclClient } from '../core/client.js';
|
|
4
|
+
export declare class HclAnalyticsCapability extends AnalyticsCapability {
|
|
5
|
+
protected readonly config: HclConfiguration;
|
|
6
|
+
protected readonly client: HclClient;
|
|
7
|
+
constructor(cache: Cache, context: RequestContext, config: HclConfiguration, client: HclClient);
|
|
8
|
+
track(event: AnalyticsMutation): Promise<AnalyticsResult>;
|
|
9
|
+
protected processProductSummaryView(event: AnalyticsMutationProductSummaryViewEvent): Promise<AnalyticsResult>;
|
|
10
|
+
protected processProductSummaryClick(event: AnalyticsMutationProductSummaryClickEvent): Promise<AnalyticsResult>;
|
|
11
|
+
protected processProductDetailsView(event: AnalyticsMutationProductDetailsViewEvent): Promise<AnalyticsResult>;
|
|
12
|
+
protected processProductAddToCart(event: AnalyticsMutationProductAddToCartEvent): Promise<AnalyticsResult>;
|
|
13
|
+
protected processPurchase(event: AnalyticsMutationPurchaseEvent): Promise<AnalyticsResult>;
|
|
14
|
+
protected fireEvent(extra: Record<string, string>): Promise<void>;
|
|
15
|
+
protected getEventUrl(): string;
|
|
16
|
+
protected getEventBody(extra: Record<string, string>): Record<string, string>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Address, type Cache, CompanyCapability, type CompanyFactory, type CompanyFactoryOutput, type CompanyFactoryWithOutput, type CompanyMutationAddShippingAddress, type CompanyMutationMakeShippingAddressDefault, type CompanyMutationRemoveShippingAddress, type CompanyMutationUpdateShippingAddress, type CompanyPaginatedList, type CompanyQueryById, type CompanyQueryList, type NotFoundError, type RequestContext, type Result } from '@reactionary/core';
|
|
2
|
+
import type { HclConfiguration } from '../schema/configuration.schema.js';
|
|
3
|
+
import type { HclClient } from '../core/client.js';
|
|
4
|
+
import type { HclCompanyFactory } from '../factories/company/company.factory.js';
|
|
5
|
+
import type { HclOrganizationItem, HclWcsOrgContact } from '../schema/hcl.schema.js';
|
|
6
|
+
export declare class HclCompanyCapability<TFactory extends CompanyFactory = HclCompanyFactory> extends CompanyCapability {
|
|
7
|
+
protected readonly config: HclConfiguration;
|
|
8
|
+
protected readonly client: HclClient;
|
|
9
|
+
protected readonly factory: CompanyFactoryWithOutput<TFactory>;
|
|
10
|
+
constructor(cache: Cache, context: RequestContext, config: HclConfiguration, client: HclClient, factory: CompanyFactoryWithOutput<TFactory>);
|
|
11
|
+
getById(payload: CompanyQueryById): Promise<Result<CompanyFactoryOutput<TFactory>>>;
|
|
12
|
+
listCompanies(payload: CompanyQueryList): Promise<Result<CompanyPaginatedList>>;
|
|
13
|
+
addShippingAddress(payload: CompanyMutationAddShippingAddress): Promise<Result<CompanyFactoryOutput<TFactory>, NotFoundError>>;
|
|
14
|
+
updateShippingAddress(payload: CompanyMutationUpdateShippingAddress): Promise<Result<CompanyFactoryOutput<TFactory>, NotFoundError>>;
|
|
15
|
+
removeShippingAddress(payload: CompanyMutationRemoveShippingAddress): Promise<Result<CompanyFactoryOutput<TFactory>, NotFoundError>>;
|
|
16
|
+
makeShippingAddressDefault(payload: CompanyMutationMakeShippingAddressDefault): Promise<Result<CompanyFactoryOutput<TFactory>, NotFoundError>>;
|
|
17
|
+
protected getOrganizationUrl(orgId: string): string;
|
|
18
|
+
protected getOrganizationDetailsParams(): URLSearchParams;
|
|
19
|
+
protected getOrganizationListUrl(): string;
|
|
20
|
+
protected getOrganizationListParams(query: CompanyQueryList): URLSearchParams;
|
|
21
|
+
protected getUpdateOrganizationUrl(orgId: string): string;
|
|
22
|
+
protected getUpdateOrganizationBody(org: HclOrganizationItem, addressBook: HclWcsOrgContact[]): Record<string, unknown>;
|
|
23
|
+
protected fetchOrganization(orgId: string): Promise<HclOrganizationItem | undefined>;
|
|
24
|
+
protected fetchOrganizationOrThrow(orgId: string): Promise<HclOrganizationItem>;
|
|
25
|
+
protected toOrgContact(address: Address): HclWcsOrgContact;
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PersonalizationProfileCapability, type Cache, type NotFoundError, type PersonalizationProfileFactory, type PersonalizationProfileFactoryOutput, type PersonalizationProfileFactoryWithOutput, type PersonalizationProfileQueryGetProfile, type RequestContext, type Result } from '@reactionary/core';
|
|
2
|
+
import type { HclConfiguration } from '../schema/configuration.schema.js';
|
|
3
|
+
import type { HclClient } from '../core/client.js';
|
|
4
|
+
import type { HclPersonalizationProfileFactory } from '../factories/personalization-profile/personalization-profile.factory.js';
|
|
5
|
+
export declare class HclPersonalizationProfileCapability<TFactory extends PersonalizationProfileFactory = HclPersonalizationProfileFactory> extends PersonalizationProfileCapability<PersonalizationProfileFactoryOutput<TFactory>> {
|
|
6
|
+
protected readonly config: HclConfiguration;
|
|
7
|
+
protected readonly client: HclClient;
|
|
8
|
+
protected readonly factory: PersonalizationProfileFactoryWithOutput<TFactory>;
|
|
9
|
+
constructor(cache: Cache, context: RequestContext, config: HclConfiguration, client: HclClient, factory: PersonalizationProfileFactoryWithOutput<TFactory>);
|
|
10
|
+
getPersonalizationProfile(_payload: PersonalizationProfileQueryGetProfile): Promise<Result<PersonalizationProfileFactoryOutput<TFactory>, NotFoundError>>;
|
|
11
|
+
/**
|
|
12
|
+
* Calls the WCS segment API to retrieve the customer segments for the given
|
|
13
|
+
* personalization ID. Returns an empty array when the API call fails or
|
|
14
|
+
* returns no segment data.
|
|
15
|
+
*/
|
|
16
|
+
protected fetchSegments(personalizationId: string): Promise<string[]>;
|
|
17
|
+
protected getSegmentsUrl(): string;
|
|
18
|
+
protected getSegmentsParams(personalizationId: string): URLSearchParams;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ProductAssociationsCapability, type Cache, type ProductAssociationsFactory, type ProductAssociationsFactoryOutput, type ProductAssociationsFactoryWithOutput, type ProductAssociationsGetAccessoriesQuery, type ProductAssociationsGetReplacementsQuery, type ProductAssociationsGetSparepartsQuery, type RequestContext, type Result } from '@reactionary/core';
|
|
2
|
+
import type { HclConfiguration } from '../schema/configuration.schema.js';
|
|
3
|
+
import type { HclClient } from '../core/client.js';
|
|
4
|
+
import type { HclAssociation } from '../schema/hcl.schema.js';
|
|
5
|
+
import type { HclProductAssociationsFactory } from '../factories/product-associations/product-associations.factory.js';
|
|
6
|
+
export declare class HclProductAssociationsCapability<TFactory extends ProductAssociationsFactory = HclProductAssociationsFactory> extends ProductAssociationsCapability<ProductAssociationsFactoryOutput<TFactory>> {
|
|
7
|
+
protected readonly config: HclConfiguration;
|
|
8
|
+
protected readonly client: HclClient;
|
|
9
|
+
protected readonly factory: ProductAssociationsFactoryWithOutput<TFactory>;
|
|
10
|
+
constructor(cache: Cache, context: RequestContext, config: HclConfiguration, client: HclClient, factory: ProductAssociationsFactoryWithOutput<TFactory>);
|
|
11
|
+
getAccessories(query: ProductAssociationsGetAccessoriesQuery): Promise<Result<ProductAssociationsFactoryOutput<TFactory>[]>>;
|
|
12
|
+
getSpareparts(query: ProductAssociationsGetSparepartsQuery): Promise<Result<ProductAssociationsFactoryOutput<TFactory>[]>>;
|
|
13
|
+
getReplacements(query: ProductAssociationsGetReplacementsQuery): Promise<Result<ProductAssociationsFactoryOutput<TFactory>[]>>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetches the product detail for the given part number and returns the
|
|
16
|
+
* `merchandisingAssociations` filtered to the requested association types,
|
|
17
|
+
* capped at `maxCount`.
|
|
18
|
+
*/
|
|
19
|
+
protected fetchAssociations(partNumber: string, types: string[], maxCount: number): Promise<HclAssociation[]>;
|
|
20
|
+
protected getProductsUrl(): string;
|
|
21
|
+
protected getProductsParams(partNumber: string): URLSearchParams;
|
|
22
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Cache, ProductListCapability, type ProductListFactory, type ProductListFactoryItemOutput, type ProductListFactoryItemPaginatedOutput, type ProductListFactoryListOutput, type ProductListFactoryListPaginatedOutput, type ProductListFactoryWithOutput, type ProductListItemMutationCreate, type ProductListItemMutationDelete, type ProductListItemMutationUpdate, type ProductListItemsQuery, type ProductListMutationCreate, type ProductListMutationDelete, type ProductListMutationUpdate, type ProductListQuery, type ProductListQueryById, type RequestContext, type Result } from '@reactionary/core';
|
|
2
|
+
import type { HclConfiguration } from '../schema/configuration.schema.js';
|
|
3
|
+
import type { HclClient } from '../core/client.js';
|
|
4
|
+
import type { HclProductListFactory, HclRequisitionListFactoryExtension } from '../factories/product-list/product-list.factory.js';
|
|
5
|
+
export declare class HclProductListCapability<TFactory extends ProductListFactory = HclProductListFactory> extends ProductListCapability<ProductListFactoryListOutput<TFactory>, ProductListFactoryItemOutput<TFactory>, ProductListFactoryListPaginatedOutput<TFactory>, ProductListFactoryItemPaginatedOutput<TFactory>> {
|
|
6
|
+
protected readonly config: HclConfiguration;
|
|
7
|
+
protected readonly client: HclClient;
|
|
8
|
+
protected readonly factory: ProductListFactoryWithOutput<TFactory>;
|
|
9
|
+
constructor(cache: Cache, context: RequestContext, config: HclConfiguration, client: HclClient, factory: ProductListFactoryWithOutput<TFactory>);
|
|
10
|
+
/**
|
|
11
|
+
* Returns the factory cast to include the HCL-specific requisition list parse methods.
|
|
12
|
+
* Subclasses can override this if they provide a custom factory.
|
|
13
|
+
*/
|
|
14
|
+
protected get requisitionFactory(): ProductListFactoryWithOutput<TFactory> & HclRequisitionListFactoryExtension;
|
|
15
|
+
getById(payload: ProductListQueryById): Promise<Result<ProductListFactoryListOutput<TFactory>>>;
|
|
16
|
+
queryLists(query: ProductListQuery): Promise<Result<ProductListFactoryListPaginatedOutput<TFactory>>>;
|
|
17
|
+
addList(mutation: ProductListMutationCreate): Promise<Result<ProductListFactoryListOutput<TFactory>>>;
|
|
18
|
+
updateList(mutation: ProductListMutationUpdate): Promise<Result<ProductListFactoryListOutput<TFactory>>>;
|
|
19
|
+
deleteList(mutation: ProductListMutationDelete): Promise<Result<void>>;
|
|
20
|
+
queryListItems(query: ProductListItemsQuery): Promise<Result<ProductListFactoryItemPaginatedOutput<TFactory>>>;
|
|
21
|
+
addItem(mutation: ProductListItemMutationCreate): Promise<Result<ProductListFactoryItemOutput<TFactory>>>;
|
|
22
|
+
updateItem(mutation: ProductListItemMutationUpdate): Promise<Result<ProductListFactoryItemOutput<TFactory>>>;
|
|
23
|
+
deleteItem(mutation: ProductListItemMutationDelete): Promise<Result<void>>;
|
|
24
|
+
protected getWishlistsUrl(): string;
|
|
25
|
+
protected getWishlistUrl(listId: string): string;
|
|
26
|
+
protected getWishlistItemsUrl(listId: string): string;
|
|
27
|
+
protected getWishlistItemUrl(listId: string, itemId: string): string;
|
|
28
|
+
protected getWishlistItemsParams(query: ProductListItemsQuery): URLSearchParams;
|
|
29
|
+
protected getCreateWishlistBody(mutation: ProductListMutationCreate): Record<string, unknown>;
|
|
30
|
+
protected getUpdateWishlistBody(mutation: ProductListMutationUpdate): Record<string, unknown>;
|
|
31
|
+
protected getAddItemParams(): URLSearchParams;
|
|
32
|
+
protected getAddItemBody(mutation: ProductListItemMutationCreate): Record<string, unknown>;
|
|
33
|
+
protected getRequisitionListsUrl(): string;
|
|
34
|
+
protected getRequisitionListUrl(listId: string): string;
|
|
35
|
+
protected getRequisitionListItemsUrl(listId: string): string;
|
|
36
|
+
protected getRequisitionListItemUrl(listId: string, itemId: string): string;
|
|
37
|
+
protected getRequisitionListItemsParams(query: ProductListItemsQuery): URLSearchParams;
|
|
38
|
+
protected getCreateRequisitionListBody(mutation: ProductListMutationCreate): Record<string, unknown>;
|
|
39
|
+
protected getUpdateRequisitionListBody(mutation: ProductListMutationUpdate): Record<string, unknown>;
|
|
40
|
+
protected getRequisitionAddItemParams(): URLSearchParams;
|
|
41
|
+
protected getRequisitionAddItemBody(mutation: ProductListItemMutationCreate): Record<string, unknown>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ProductRecommendationsCapability, type Cache, type ProductRecommendation, type ProductRecommendationAlgorithmAlsoViewedProductsQuery, type ProductRecommendationAlgorithmFrequentlyBoughtTogetherQuery, type ProductRecommendationAlgorithmPopuplarProductsQuery, type ProductRecommendationAlgorithmRelatedProductsQuery, type ProductRecommendationAlgorithmSimilarProductsQuery, type ProductRecommendationAlgorithmTopPicksProductsQuery, type ProductRecommendationAlgorithmTrendingInCategoryQuery, type ProductRecommendationsByCollectionQuery, type ProductRecommendationsFactory, type ProductRecommendationsFactoryWithOutput, type RequestContext, type Result } from '@reactionary/core';
|
|
2
|
+
import type { HclConfiguration } from '../schema/configuration.schema.js';
|
|
3
|
+
import type { HclClient } from '../core/client.js';
|
|
4
|
+
import type { HclProductRecommendationsFactory } from '../factories/product-recommendations/product-recommendations.factory.js';
|
|
5
|
+
export declare class HclProductRecommendationsCapability<TFactory extends ProductRecommendationsFactory = HclProductRecommendationsFactory> extends ProductRecommendationsCapability {
|
|
6
|
+
protected readonly config: HclConfiguration;
|
|
7
|
+
protected readonly client: HclClient;
|
|
8
|
+
protected readonly factory: ProductRecommendationsFactoryWithOutput<TFactory>;
|
|
9
|
+
constructor(cache: Cache, context: RequestContext, config: HclConfiguration, client: HclClient, factory: ProductRecommendationsFactoryWithOutput<TFactory>);
|
|
10
|
+
getRecommendations(...args: Parameters<ProductRecommendationsCapability['getRecommendations']>): Promise<Result<ProductRecommendation[]>>;
|
|
11
|
+
getCollection(query: ProductRecommendationsByCollectionQuery): Promise<Result<ProductRecommendation[]>>;
|
|
12
|
+
protected getFrequentlyBoughtTogetherRecommendations(query: ProductRecommendationAlgorithmFrequentlyBoughtTogetherQuery): Promise<ProductRecommendation[]>;
|
|
13
|
+
protected getSimilarProductsRecommendations(query: ProductRecommendationAlgorithmSimilarProductsQuery): Promise<ProductRecommendation[]>;
|
|
14
|
+
protected getRelatedProductsRecommendations(query: ProductRecommendationAlgorithmRelatedProductsQuery): Promise<ProductRecommendation[]>;
|
|
15
|
+
protected getTrendingInCategoryRecommendations(query: ProductRecommendationAlgorithmTrendingInCategoryQuery): Promise<ProductRecommendation[]>;
|
|
16
|
+
protected getPopularProductsRecommendations(query: ProductRecommendationAlgorithmPopuplarProductsQuery): Promise<ProductRecommendation[]>;
|
|
17
|
+
protected getTopPicksProductsRecommendations(query: ProductRecommendationAlgorithmTopPicksProductsQuery): Promise<ProductRecommendation[]>;
|
|
18
|
+
protected getAlsoViewedProductsRecommendations(query: ProductRecommendationAlgorithmAlsoViewedProductsQuery): Promise<ProductRecommendation[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Calls an HCL marketing spot (espot) by name and maps its catalog entry
|
|
21
|
+
* activity data to `ProductRecommendation[]` using the factory.
|
|
22
|
+
*
|
|
23
|
+
* Returns an empty array when the espot is not found (404) or returns no
|
|
24
|
+
* catalog entry data — allowing teams to configure only the espots they need.
|
|
25
|
+
*/
|
|
26
|
+
protected fetchEspot(name: string, algorithm: string, params?: Record<string, string | undefined>): Promise<ProductRecommendation[]>;
|
|
27
|
+
protected getEspotUrl(name: string): string;
|
|
28
|
+
protected getEspotParams(params: Record<string, string | undefined>): URLSearchParams;
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Cache, type RequestContext, type Result, StoreCapability, type StoreFactory, type StoreFactoryOutput, type StoreFactoryWithOutput, type StoreQueryByProximity } from '@reactionary/core';
|
|
2
|
+
import type { HclConfiguration } from '../schema/configuration.schema.js';
|
|
3
|
+
import type { HclClient } from '../core/client.js';
|
|
4
|
+
import type { HclStoreFactory } from '../factories/store/store.factory.js';
|
|
5
|
+
export declare class HclStoreCapability<TFactory extends StoreFactory = HclStoreFactory> extends StoreCapability<StoreFactoryOutput<TFactory>> {
|
|
6
|
+
protected readonly config: HclConfiguration;
|
|
7
|
+
protected readonly client: HclClient;
|
|
8
|
+
protected readonly factory: StoreFactoryWithOutput<TFactory>;
|
|
9
|
+
constructor(cache: Cache, context: RequestContext, config: HclConfiguration, client: HclClient, factory: StoreFactoryWithOutput<TFactory>);
|
|
10
|
+
queryByProximity(payload: StoreQueryByProximity): Promise<Result<StoreFactoryOutput<TFactory>[]>>;
|
|
11
|
+
protected getStoreLocatorUrl(payload: StoreQueryByProximity): string;
|
|
12
|
+
protected getStoreLocatorParams(payload: StoreQueryByProximity): URLSearchParams;
|
|
13
|
+
}
|
|
@@ -2,16 +2,19 @@ import type { ClientFromCapabilities } from '@reactionary/core';
|
|
|
2
2
|
import type { HclCapabilities } from '../schema/capabilities.schema.js';
|
|
3
3
|
import type { HclCartCapability } from '../capabilities/cart.capability.js';
|
|
4
4
|
import type { HclCheckoutCapability } from '../capabilities/checkout.capability.js';
|
|
5
|
+
import type { HclCompanyCapability } from '../capabilities/company.capability.js';
|
|
5
6
|
import type { HclProductCapability } from '../capabilities/product.capability.js';
|
|
6
7
|
import type { HclCategoryCapability } from '../capabilities/category.capability.js';
|
|
7
8
|
import type { HclProductSearchCapability } from '../capabilities/product-search.capability.js';
|
|
8
9
|
import type { HclPriceCapability } from '../capabilities/price.capability.js';
|
|
9
10
|
import type { HclInventoryCapability } from '../capabilities/inventory.capability.js';
|
|
10
11
|
import type { HclIdentityCapability } from '../capabilities/identity.capability.js';
|
|
12
|
+
import type { HclProductListCapability } from '../capabilities/product-list.capability.js';
|
|
11
13
|
import type { HclProfileCapability } from '../capabilities/profile.capability.js';
|
|
12
14
|
import type { HclOrderCapability } from '../capabilities/order.capability.js';
|
|
13
15
|
import type { HclOrderSearchCapability } from '../capabilities/order-search.capability.js';
|
|
14
|
-
type
|
|
16
|
+
import type { HclStoreCapability } from '../capabilities/store.capability.js';
|
|
17
|
+
type OverridableCapabilityKey = 'product' | 'productSearch' | 'cart' | 'checkout' | 'category' | 'company' | 'price' | 'inventory' | 'identity' | 'productList' | 'profile' | 'order' | 'orderSearch' | 'store';
|
|
15
18
|
type EnabledCapability<TCapability> = TCapability extends {
|
|
16
19
|
enabled: true;
|
|
17
20
|
} ? true : false;
|
|
@@ -28,12 +31,15 @@ type DefaultCapabilityMap = {
|
|
|
28
31
|
cart: HclCartCapability;
|
|
29
32
|
checkout: HclCheckoutCapability;
|
|
30
33
|
category: HclCategoryCapability;
|
|
34
|
+
company: HclCompanyCapability;
|
|
31
35
|
price: HclPriceCapability;
|
|
32
36
|
inventory: HclInventoryCapability;
|
|
33
37
|
identity: HclIdentityCapability;
|
|
38
|
+
productList: HclProductListCapability;
|
|
34
39
|
profile: HclProfileCapability;
|
|
35
40
|
order: HclOrderCapability;
|
|
36
41
|
orderSearch: HclOrderSearchCapability;
|
|
42
|
+
store: HclStoreCapability;
|
|
37
43
|
};
|
|
38
44
|
type CapabilityImplementationMap<T extends HclCapabilities> = {
|
|
39
45
|
[K in OverridableCapabilityKey]: ExtractCapabilityImplementation<T[K], DefaultCapabilityMap[K]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as z from 'zod';
|
|
2
|
+
import type { Address, AnyCompanyPaginatedListSchema, AnyCompanySchema, CompanyFactory, CompanyQueryList, CompanySchema, CompanyPaginatedListSchema, RequestContext } from '@reactionary/core';
|
|
3
|
+
import type { HclOrganizationItem, HclOrganizationListResponse, HclWcsOrgContact } from '../../schema/hcl.schema.js';
|
|
4
|
+
export declare class HclCompanyFactory<TCompanySchema extends AnyCompanySchema = typeof CompanySchema, TCompanyPaginatedListSchema extends AnyCompanyPaginatedListSchema = typeof CompanyPaginatedListSchema> implements CompanyFactory<TCompanySchema, TCompanyPaginatedListSchema> {
|
|
5
|
+
readonly companySchema: TCompanySchema;
|
|
6
|
+
readonly companyPaginatedListSchema: TCompanyPaginatedListSchema;
|
|
7
|
+
constructor(companySchema: TCompanySchema, companyPaginatedListSchema: TCompanyPaginatedListSchema);
|
|
8
|
+
parseCompany(_context: RequestContext, data: HclOrganizationItem): z.output<TCompanySchema>;
|
|
9
|
+
parseCompanyPaginatedList(context: RequestContext, data: HclOrganizationListResponse, _query: CompanyQueryList): z.output<TCompanyPaginatedListSchema>;
|
|
10
|
+
protected parseOrgContact(contact: HclWcsOrgContact, defaultNickName: string): Address;
|
|
11
|
+
}
|
package/src/factories/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './cart/cart.factory.js';
|
|
2
2
|
export * from './checkout/checkout.factory.js';
|
|
3
|
+
export * from './company/company.factory.js';
|
|
3
4
|
export * from './product/product.factory.js';
|
|
4
5
|
export * from './category/category.factory.js';
|
|
5
6
|
export * from './product-search/product-search.factory.js';
|
|
@@ -9,3 +10,8 @@ export * from './identity/identity.factory.js';
|
|
|
9
10
|
export * from './profile/profile.factory.js';
|
|
10
11
|
export * from './order/order.factory.js';
|
|
11
12
|
export * from './order-search/order-search.factory.js';
|
|
13
|
+
export * from './product-associations/product-associations.factory.js';
|
|
14
|
+
export * from './product-list/product-list.factory.js';
|
|
15
|
+
export * from './product-recommendations/product-recommendations.factory.js';
|
|
16
|
+
export * from './personalization-profile/personalization-profile.factory.js';
|
|
17
|
+
export * from './store/store.factory.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AnyPersonalizationProfileSchema, PersonalizationProfileFactory, PersonalizationProfileSchema, RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
export interface HclPersonalizationProfileData {
|
|
4
|
+
personalizationId: string;
|
|
5
|
+
segments: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare class HclPersonalizationProfileFactory<TPersonalizationProfileSchema extends AnyPersonalizationProfileSchema = typeof PersonalizationProfileSchema> implements PersonalizationProfileFactory<TPersonalizationProfileSchema> {
|
|
8
|
+
readonly personalizationProfileSchema: TPersonalizationProfileSchema;
|
|
9
|
+
constructor(personalizationProfileSchema: TPersonalizationProfileSchema);
|
|
10
|
+
parsePersonalizationProfile(_context: RequestContext, data: HclPersonalizationProfileData): z.output<TPersonalizationProfileSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnyProductAssociationSchema, ProductAssociationSchema, ProductAssociationsFactory, RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
import type { HclAssociation } from '../../schema/hcl.schema.js';
|
|
4
|
+
export declare class HclProductAssociationsFactory<TProductAssociationSchema extends AnyProductAssociationSchema = typeof ProductAssociationSchema> implements ProductAssociationsFactory<TProductAssociationSchema> {
|
|
5
|
+
readonly productAssociationSchema: TProductAssociationSchema;
|
|
6
|
+
constructor(productAssociationSchema: TProductAssociationSchema);
|
|
7
|
+
parseAssociation(_context: RequestContext, data: HclAssociation): z.output<TProductAssociationSchema>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type * as z from 'zod';
|
|
2
|
+
import type { AnyProductListItemPaginatedSchema, AnyProductListItemSchema, AnyProductListPaginatedSchema, AnyProductListSchema, ProductListFactory, ProductListIdentifier, ProductListItemPaginatedResultsSchema, ProductListItemSchema, ProductListItemsQuery, ProductListPaginatedResultsSchema, ProductListQuery, ProductListSchema, RequestContext } from '@reactionary/core';
|
|
3
|
+
import type { HclRequisitionList, HclRequisitionListDetailResponse, HclRequisitionListItem, HclRequisitionListResponse, HclWishlist, HclWishlistItem, HclWishlistItemResponse, HclWishlistListResponse } from '../../schema/hcl.schema.js';
|
|
4
|
+
/** Passed to parseProductListItem so it can include the parent list reference. */
|
|
5
|
+
export interface HclProductListItemInput {
|
|
6
|
+
item: HclWishlistItem;
|
|
7
|
+
list: ProductListIdentifier;
|
|
8
|
+
}
|
|
9
|
+
/** Passed to parseRequisitionListItem so it can include the parent list reference. */
|
|
10
|
+
export interface HclRequisitionListItemInput {
|
|
11
|
+
item: HclRequisitionListItem;
|
|
12
|
+
list: ProductListIdentifier;
|
|
13
|
+
}
|
|
14
|
+
/** Extension interface implemented by HclProductListFactory for requisition list parsing. */
|
|
15
|
+
export interface HclRequisitionListFactoryExtension {
|
|
16
|
+
parseRequisitionList(context: RequestContext, data: HclRequisitionList): unknown;
|
|
17
|
+
parseRequisitionListItem(context: RequestContext, data: HclRequisitionListItemInput): unknown;
|
|
18
|
+
parseRequisitionListPaginatedResult(context: RequestContext, data: HclRequisitionListResponse, query: ProductListQuery): unknown;
|
|
19
|
+
parseRequisitionListItemPaginatedResult(context: RequestContext, data: HclRequisitionListDetailResponse, query: ProductListItemsQuery): unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Encode a listType and user description into HCL's description field.
|
|
23
|
+
* Format: `{type}:{description}` — e.g. `favorite:My list` or `wish:`
|
|
24
|
+
*/
|
|
25
|
+
export declare function encodeWishlistType(type: string, description: string | undefined): string;
|
|
26
|
+
export declare class HclProductListFactory<TProductListSchema extends AnyProductListSchema = typeof ProductListSchema, TProductListItemSchema extends AnyProductListItemSchema = typeof ProductListItemSchema, TProductListPaginatedSchema extends AnyProductListPaginatedSchema = typeof ProductListPaginatedResultsSchema, TProductListItemPaginatedSchema extends AnyProductListItemPaginatedSchema = typeof ProductListItemPaginatedResultsSchema> implements ProductListFactory<TProductListSchema, TProductListItemSchema, TProductListPaginatedSchema, TProductListItemPaginatedSchema> {
|
|
27
|
+
readonly productListSchema: TProductListSchema;
|
|
28
|
+
readonly productListItemSchema: TProductListItemSchema;
|
|
29
|
+
readonly productListPaginatedSchema: TProductListPaginatedSchema;
|
|
30
|
+
readonly productListItemPaginatedSchema: TProductListItemPaginatedSchema;
|
|
31
|
+
constructor(productListSchema: TProductListSchema, productListItemSchema: TProductListItemSchema, productListPaginatedSchema: TProductListPaginatedSchema, productListItemPaginatedSchema: TProductListItemPaginatedSchema);
|
|
32
|
+
parseProductList(_context: RequestContext, data: HclWishlist): z.output<TProductListSchema>;
|
|
33
|
+
parseProductListItem(_context: RequestContext, data: HclProductListItemInput): z.output<TProductListItemSchema>;
|
|
34
|
+
parseProductListPaginatedResult(context: RequestContext, data: HclWishlistListResponse, query: ProductListQuery): z.output<TProductListPaginatedSchema>;
|
|
35
|
+
parseProductListItemPaginatedResult(context: RequestContext, data: HclWishlistItemResponse, query: ProductListItemsQuery): z.output<TProductListItemPaginatedSchema>;
|
|
36
|
+
parseRequisitionList(_context: RequestContext, data: HclRequisitionList): z.output<TProductListSchema>;
|
|
37
|
+
parseRequisitionListItem(_context: RequestContext, data: HclRequisitionListItemInput): z.output<TProductListItemSchema>;
|
|
38
|
+
parseRequisitionListPaginatedResult(context: RequestContext, data: HclRequisitionListResponse, query: ProductListQuery): z.output<TProductListPaginatedSchema>;
|
|
39
|
+
parseRequisitionListItemPaginatedResult(context: RequestContext, data: HclRequisitionListDetailResponse, query: ProductListItemsQuery): z.output<TProductListItemPaginatedSchema>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AnyProductRecommendationSchema, ProductRecommendationSchema, ProductRecommendationsFactory, RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
import type { HclEspotActivityData } from '../../schema/hcl.schema.js';
|
|
4
|
+
export interface HclEspotRecommendationData {
|
|
5
|
+
activityData: HclEspotActivityData;
|
|
6
|
+
algorithm: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class HclProductRecommendationsFactory<TProductRecommendationSchema extends AnyProductRecommendationSchema = typeof ProductRecommendationSchema> implements ProductRecommendationsFactory<TProductRecommendationSchema> {
|
|
9
|
+
readonly productRecommendationSchema: TProductRecommendationSchema;
|
|
10
|
+
constructor(productRecommendationSchema: TProductRecommendationSchema);
|
|
11
|
+
parseRecommendation(_context: RequestContext, data: HclEspotRecommendationData): z.output<TProductRecommendationSchema>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as z from 'zod';
|
|
2
|
+
import type { AnyStoreSchema, RequestContext, StoreFactory, StoreSchema } from '@reactionary/core';
|
|
3
|
+
import type { HclPhysicalStore } from '../../schema/hcl.schema.js';
|
|
4
|
+
export declare class HclStoreFactory<TStoreSchema extends AnyStoreSchema = typeof StoreSchema> implements StoreFactory<TStoreSchema> {
|
|
5
|
+
readonly storeSchema: TStoreSchema;
|
|
6
|
+
constructor(storeSchema: TStoreSchema);
|
|
7
|
+
parseStore(_context: RequestContext, data: HclPhysicalStore): z.output<TStoreSchema>;
|
|
8
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -17,3 +17,10 @@ export * from './capabilities/identity.capability.js';
|
|
|
17
17
|
export * from './capabilities/profile.capability.js';
|
|
18
18
|
export * from './capabilities/order.capability.js';
|
|
19
19
|
export * from './capabilities/order-search.capability.js';
|
|
20
|
+
export * from './capabilities/analytics.capability.js';
|
|
21
|
+
export * from './capabilities/product-associations.capability.js';
|
|
22
|
+
export * from './capabilities/product-recommendations.capability.js';
|
|
23
|
+
export * from './capabilities/personalization-profile.capability.js';
|
|
24
|
+
export * from './capabilities/company.capability.js';
|
|
25
|
+
export * from './capabilities/store.capability.js';
|
|
26
|
+
export * from './capabilities/product-list.capability.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Cache, RequestContext, CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, CheckoutFactory, CheckoutFactoryWithOutput, CheckoutCapability, IdentityFactory, IdentityFactoryWithOutput, IdentityCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, OrderFactory, OrderFactoryWithOutput, OrderCapability, OrderSearchFactory, OrderSearchFactoryWithOutput, OrderSearchCapability, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductFactory, ProductFactoryWithOutput, ProductCapability, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability, ProfileFactory, ProfileFactoryWithOutput, ProfileCapability } from '@reactionary/core';
|
|
1
|
+
import type { Cache, RequestContext, AnalyticsCapability, CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, CheckoutFactory, CheckoutFactoryWithOutput, CheckoutCapability, CompanyCapability, CompanyFactory, CompanyFactoryWithOutput, IdentityFactory, IdentityFactoryWithOutput, IdentityCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, OrderFactory, OrderFactoryWithOutput, OrderCapability, OrderSearchFactory, OrderSearchFactoryWithOutput, OrderSearchCapability, PersonalizationProfileCapability, PersonalizationProfileFactory, PersonalizationProfileFactoryWithOutput, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductAssociationsCapability, ProductAssociationsFactory, ProductAssociationsFactoryWithOutput, ProductFactory, ProductFactoryWithOutput, ProductCapability, ProductListCapability, ProductListFactory, ProductListFactoryWithOutput, ProductRecommendationsCapability, ProductRecommendationsFactory, ProductRecommendationsFactoryWithOutput, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability, ProfileFactory, ProfileFactoryWithOutput, ProfileCapability, StoreCapability, StoreFactory, StoreFactoryWithOutput } from '@reactionary/core';
|
|
2
2
|
import type { HclConfiguration } from './configuration.schema.js';
|
|
3
3
|
import type { HclClient } from '../core/client.js';
|
|
4
4
|
import * as z from 'zod';
|
|
@@ -18,6 +18,11 @@ export declare const HclCapabilitiesSchema: z.ZodObject<{
|
|
|
18
18
|
factory: z.ZodOptional<z.ZodUnknown>;
|
|
19
19
|
capability: z.ZodOptional<z.ZodUnknown>;
|
|
20
20
|
}, z.core.$loose>>>;
|
|
21
|
+
company: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
22
|
+
enabled: z.ZodBoolean;
|
|
23
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
24
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
25
|
+
}, z.core.$loose>>>;
|
|
21
26
|
product: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
22
27
|
enabled: z.ZodBoolean;
|
|
23
28
|
factory: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -43,6 +48,11 @@ export declare const HclCapabilitiesSchema: z.ZodObject<{
|
|
|
43
48
|
factory: z.ZodOptional<z.ZodUnknown>;
|
|
44
49
|
capability: z.ZodOptional<z.ZodUnknown>;
|
|
45
50
|
}, z.core.$loose>>>;
|
|
51
|
+
productList: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
52
|
+
enabled: z.ZodBoolean;
|
|
53
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
54
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
55
|
+
}, z.core.$loose>>>;
|
|
46
56
|
profile: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
47
57
|
enabled: z.ZodBoolean;
|
|
48
58
|
factory: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -58,6 +68,31 @@ export declare const HclCapabilitiesSchema: z.ZodObject<{
|
|
|
58
68
|
factory: z.ZodOptional<z.ZodUnknown>;
|
|
59
69
|
capability: z.ZodOptional<z.ZodUnknown>;
|
|
60
70
|
}, z.core.$loose>>>;
|
|
71
|
+
analytics: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
72
|
+
enabled: z.ZodBoolean;
|
|
73
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
74
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
75
|
+
}, z.core.$loose>>>;
|
|
76
|
+
productAssociations: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
77
|
+
enabled: z.ZodBoolean;
|
|
78
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
79
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
80
|
+
}, z.core.$loose>>>;
|
|
81
|
+
productRecommendations: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
82
|
+
enabled: z.ZodBoolean;
|
|
83
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
84
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
85
|
+
}, z.core.$loose>>>;
|
|
86
|
+
personalizationProfile: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
87
|
+
enabled: z.ZodBoolean;
|
|
88
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
89
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
90
|
+
}, z.core.$loose>>>;
|
|
91
|
+
store: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
92
|
+
enabled: z.ZodBoolean;
|
|
93
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
94
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
95
|
+
}, z.core.$loose>>>;
|
|
61
96
|
}, z.core.$loose>;
|
|
62
97
|
export type HclCapabilities = z.infer<typeof HclCapabilitiesSchema>;
|
|
63
98
|
export interface HclCapabilityFactoryArgs {
|
|
@@ -85,3 +120,12 @@ export type HclIdentityCapabilityConfig = HclCapabilityConfig<IdentityFactoryWit
|
|
|
85
120
|
export type HclProfileCapabilityConfig = HclCapabilityConfig<ProfileFactoryWithOutput<ProfileFactory>, ProfileCapability>;
|
|
86
121
|
export type HclOrderCapabilityConfig = HclCapabilityConfig<OrderFactoryWithOutput<OrderFactory>, OrderCapability>;
|
|
87
122
|
export type HclOrderSearchCapabilityConfig = HclCapabilityConfig<OrderSearchFactoryWithOutput<OrderSearchFactory>, OrderSearchCapability>;
|
|
123
|
+
/** Analytics does not use a factory — the capability writes events directly. */
|
|
124
|
+
export type HclAnalyticsCapabilityConfig = HclCapabilityConfig<never, AnalyticsCapability>;
|
|
125
|
+
export type HclProductAssociationsCapabilityConfig = HclCapabilityConfig<ProductAssociationsFactoryWithOutput<ProductAssociationsFactory>, ProductAssociationsCapability>;
|
|
126
|
+
/** Product recommendations uses a factory to parse espot activity data into recommendations. */
|
|
127
|
+
export type HclProductRecommendationsCapabilityConfig = HclCapabilityConfig<ProductRecommendationsFactoryWithOutput<ProductRecommendationsFactory>, ProductRecommendationsCapability>;
|
|
128
|
+
export type HclPersonalizationProfileCapabilityConfig = HclCapabilityConfig<PersonalizationProfileFactoryWithOutput<PersonalizationProfileFactory>, PersonalizationProfileCapability>;
|
|
129
|
+
export type HclCompanyCapabilityConfig = HclCapabilityConfig<CompanyFactoryWithOutput<CompanyFactory>, CompanyCapability>;
|
|
130
|
+
export type HclStoreCapabilityConfig = HclCapabilityConfig<StoreFactoryWithOutput<StoreFactory>, StoreCapability>;
|
|
131
|
+
export type HclProductListCapabilityConfig = HclCapabilityConfig<ProductListFactoryWithOutput<ProductListFactory>, ProductListCapability>;
|
|
@@ -21,5 +21,29 @@ export declare const HclConfigurationSchema: z.ZodObject<{
|
|
|
21
21
|
* In Karkkainen this is '10003'.
|
|
22
22
|
*/
|
|
23
23
|
priceRuleId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
/**
|
|
25
|
+
* Maps Reactionary association types to the HCL `associationCodeType` values
|
|
26
|
+
* returned in `merchandisingAssociations` on product detail responses.
|
|
27
|
+
* Override to match custom HCL store configuration.
|
|
28
|
+
*/
|
|
29
|
+
associationTypes: z.ZodDefault<z.ZodObject<{
|
|
30
|
+
accessories: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
31
|
+
spareparts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
32
|
+
replacements: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
33
|
+
}, z.core.$loose>>;
|
|
34
|
+
/**
|
|
35
|
+
* Names of HCL marketing spots used for product recommendation algorithms.
|
|
36
|
+
* Each algorithm calls the corresponding named espot via the WCS Transaction Service.
|
|
37
|
+
* These espots must be configured in HCL Commerce to return catalog entry data.
|
|
38
|
+
*/
|
|
39
|
+
espotNames: z.ZodDefault<z.ZodObject<{
|
|
40
|
+
frequentlyBoughtTogether: z.ZodDefault<z.ZodString>;
|
|
41
|
+
similar: z.ZodDefault<z.ZodString>;
|
|
42
|
+
related: z.ZodDefault<z.ZodString>;
|
|
43
|
+
trendingInCategory: z.ZodDefault<z.ZodString>;
|
|
44
|
+
popular: z.ZodDefault<z.ZodString>;
|
|
45
|
+
topPicks: z.ZodDefault<z.ZodString>;
|
|
46
|
+
alsoViewed: z.ZodDefault<z.ZodString>;
|
|
47
|
+
}, z.core.$loose>>;
|
|
24
48
|
}, z.core.$loose>;
|
|
25
49
|
export type HclConfiguration = z.infer<typeof HclConfigurationSchema>;
|