@reactionary/commercetools 0.6.3
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 +11 -0
- package/capabilities/cart.capability.js +324 -0
- package/capabilities/category.capability.js +198 -0
- package/capabilities/checkout.capability.js +374 -0
- package/capabilities/identity.capability.js +95 -0
- package/capabilities/index.js +15 -0
- package/capabilities/inventory.capability.js +63 -0
- package/capabilities/order-search.capability.js +106 -0
- package/capabilities/order.capability.js +48 -0
- package/capabilities/price.capability.js +114 -0
- package/capabilities/product-associations.capability.js +120 -0
- package/capabilities/product-list.capability.js +393 -0
- package/capabilities/product-reviews.capability.js +193 -0
- package/capabilities/product-search.capability.js +297 -0
- package/capabilities/product.capability.js +103 -0
- package/capabilities/profile.capability.js +337 -0
- package/capabilities/store.capability.js +51 -0
- package/core/capability-descriptors.js +274 -0
- package/core/client.js +318 -0
- package/core/initialize.js +47 -0
- package/core/initialize.types.js +8 -0
- package/core/token-cache.js +36 -0
- package/factories/cart/cart.factory.js +110 -0
- package/factories/category/category.factory.js +40 -0
- package/factories/checkout/checkout-initializer-overrides.example.js +67 -0
- package/factories/checkout/checkout.factory.js +235 -0
- package/factories/identity/identity.factory.js +14 -0
- package/factories/inventory/inventory.factory.js +30 -0
- package/factories/order/order.factory.js +114 -0
- package/factories/order-search/order-search.factory.js +68 -0
- package/factories/price/price.factory.js +52 -0
- package/factories/product/product-capability-custom-method-only.example.js +38 -0
- package/factories/product/product-capability-schema-signature-extension.example.js +46 -0
- package/factories/product/product-factory-baseline.example.js +10 -0
- package/factories/product/product-factory-schema-and-parse-extension.example.js +25 -0
- package/factories/product/product-factory-schema-extension.example.js +18 -0
- package/factories/product/product-initializer-factory-extension.example.js +33 -0
- package/factories/product/product.factory.js +151 -0
- package/factories/product/utils.example.js +8 -0
- package/factories/product-associations/product-associations.factory.js +63 -0
- package/factories/product-list/product-list.factory.js +65 -0
- package/factories/product-reviews/product-reviews.factory.js +42 -0
- package/factories/product-search/product-search.factory.js +114 -0
- package/factories/profile/profile.factory.js +62 -0
- package/factories/store/store.factory.js +29 -0
- package/index.js +28 -0
- package/package.json +17 -0
- package/schema/capabilities.schema.js +46 -0
- package/schema/commercetools.schema.js +30 -0
- package/schema/configuration.schema.js +19 -0
- package/schema/session.schema.js +9 -0
- package/src/capabilities/cart.capability.d.ts +34 -0
- package/src/capabilities/category.capability.d.ts +47 -0
- package/src/capabilities/checkout.capability.d.ts +39 -0
- package/src/capabilities/identity.capability.d.ts +14 -0
- package/src/capabilities/index.d.ts +15 -0
- package/src/capabilities/inventory.capability.d.ts +13 -0
- package/src/capabilities/order-search.capability.d.ts +13 -0
- package/src/capabilities/order.capability.d.ts +13 -0
- package/src/capabilities/price.capability.d.ts +18 -0
- package/src/capabilities/product-associations.capability.d.ts +17 -0
- package/src/capabilities/product-list.capability.d.ts +29 -0
- package/src/capabilities/product-reviews.capability.d.ts +18 -0
- package/src/capabilities/product-search.capability.d.ts +82 -0
- package/src/capabilities/product.capability.d.ts +17 -0
- package/src/capabilities/profile.capability.d.ts +30 -0
- package/src/capabilities/store.capability.d.ts +13 -0
- package/src/core/capability-descriptors.d.ts +16 -0
- package/src/core/client.d.ts +55 -0
- package/src/core/initialize.d.ts +5 -0
- package/src/core/initialize.types.d.ts +118 -0
- package/src/core/token-cache.d.ts +9 -0
- package/src/factories/cart/cart.factory.d.ts +14 -0
- package/src/factories/category/category.factory.d.ts +11 -0
- package/src/factories/checkout/checkout-initializer-overrides.example.d.ts +1 -0
- package/src/factories/checkout/checkout.factory.d.ts +18 -0
- package/src/factories/identity/identity.factory.d.ts +8 -0
- package/src/factories/inventory/inventory.factory.d.ts +9 -0
- package/src/factories/order/order.factory.d.ts +9 -0
- package/src/factories/order-search/order-search.factory.d.ts +11 -0
- package/src/factories/price/price.factory.d.ts +11 -0
- package/src/factories/product/product-capability-custom-method-only.example.d.ts +1 -0
- package/src/factories/product/product-capability-schema-signature-extension.example.d.ts +1 -0
- package/src/factories/product/product-factory-baseline.example.d.ts +1 -0
- package/src/factories/product/product-factory-schema-and-parse-extension.example.d.ts +1 -0
- package/src/factories/product/product-factory-schema-extension.example.d.ts +1 -0
- package/src/factories/product/product-initializer-factory-extension.example.d.ts +1 -0
- package/src/factories/product/product.factory.d.ts +18 -0
- package/src/factories/product/utils.example.d.ts +4 -0
- package/src/factories/product-associations/product-associations.factory.d.ts +15 -0
- package/src/factories/product-list/product-list.factory.d.ts +17 -0
- package/src/factories/product-reviews/product-reviews.factory.d.ts +14 -0
- package/src/factories/product-search/product-search.factory.d.ts +13 -0
- package/src/factories/profile/profile.factory.d.ts +11 -0
- package/src/factories/store/store.factory.d.ts +9 -0
- package/src/index.d.ts +28 -0
- package/src/schema/capabilities.schema.d.ts +104 -0
- package/src/schema/commercetools.schema.d.ts +30 -0
- package/src/schema/configuration.schema.d.ts +30 -0
- package/src/schema/session.schema.d.ts +7 -0
- package/src/test/client-builder-merge-extensions.example.d.ts +1 -0
- package/src/test/test-utils.d.ts +27 -0
- package/test/client-builder-merge-extensions.example.js +94 -0
- package/test/test-utils.js +27 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { CartFactory, CategoryFactory, CheckoutFactory, ClientFromCapabilities, IdentityFactory, InventoryFactory, OrderFactory, OrderSearchFactory, PriceFactory, ProductAssociationsFactory, ProductFactory, ProductListFactory, ProductReviewsFactory, ProductSearchFactory, ProfileFactory, StoreFactory } from '@reactionary/core';
|
|
2
|
+
import type { CommercetoolsCapabilities } from '../schema/capabilities.schema.js';
|
|
3
|
+
import type { OverridableCapabilityKey } from './capability-descriptors.js';
|
|
4
|
+
import type { CommercetoolsCartFactory } from '../factories/cart/cart.factory.js';
|
|
5
|
+
import type { CommercetoolsCategoryFactory } from '../factories/category/category.factory.js';
|
|
6
|
+
import type { CommercetoolsCheckoutFactory } from '../factories/checkout/checkout.factory.js';
|
|
7
|
+
import type { CommercetoolsIdentityFactory } from '../factories/identity/identity.factory.js';
|
|
8
|
+
import type { CommercetoolsInventoryFactory } from '../factories/inventory/inventory.factory.js';
|
|
9
|
+
import type { CommercetoolsOrderFactory } from '../factories/order/order.factory.js';
|
|
10
|
+
import type { CommercetoolsOrderSearchFactory } from '../factories/order-search/order-search.factory.js';
|
|
11
|
+
import type { CommercetoolsPriceFactory } from '../factories/price/price.factory.js';
|
|
12
|
+
import type { CommercetoolsProductAssociationsFactory } from '../factories/product-associations/product-associations.factory.js';
|
|
13
|
+
import type { CommercetoolsProductFactory } from '../factories/product/product.factory.js';
|
|
14
|
+
import type { CommercetoolsProductListFactory } from '../factories/product-list/product-list.factory.js';
|
|
15
|
+
import type { CommercetoolsProductReviewsFactory } from '../factories/product-reviews/product-reviews.factory.js';
|
|
16
|
+
import type { CommercetoolsProductSearchFactory } from '../factories/product-search/product-search.factory.js';
|
|
17
|
+
import type { CommercetoolsProfileFactory } from '../factories/profile/profile.factory.js';
|
|
18
|
+
import type { CommercetoolsStoreFactory } from '../factories/store/store.factory.js';
|
|
19
|
+
import type { CommercetoolsCartCapability } from '../capabilities/cart.capability.js';
|
|
20
|
+
import type { CommercetoolsCategoryCapability } from '../capabilities/category.capability.js';
|
|
21
|
+
import type { CommercetoolsCheckoutCapability } from '../capabilities/checkout.capability.js';
|
|
22
|
+
import type { CommercetoolsIdentityCapability } from '../capabilities/identity.capability.js';
|
|
23
|
+
import type { CommercetoolsInventoryCapability } from '../capabilities/inventory.capability.js';
|
|
24
|
+
import type { CommercetoolsOrderSearchCapability } from '../capabilities/order-search.capability.js';
|
|
25
|
+
import type { CommercetoolsOrderCapability } from '../capabilities/order.capability.js';
|
|
26
|
+
import type { CommercetoolsPriceCapability } from '../capabilities/price.capability.js';
|
|
27
|
+
import type { CommercetoolsProductAssociationsCapability } from '../capabilities/product-associations.capability.js';
|
|
28
|
+
import type { CommercetoolsProductListCapability } from '../capabilities/product-list.capability.js';
|
|
29
|
+
import type { CommercetoolsProductCapability } from '../capabilities/product.capability.js';
|
|
30
|
+
import type { CommercetoolsProductReviewsCapability } from '../capabilities/product-reviews.capability.js';
|
|
31
|
+
import type { CommercetoolsProductSearchCapability } from '../capabilities/product-search.capability.js';
|
|
32
|
+
import type { CommercetoolsProfileCapability } from '../capabilities/profile.capability.js';
|
|
33
|
+
import type { CommercetoolsStoreCapability } from '../capabilities/store.capability.js';
|
|
34
|
+
type EnabledCapability<TCapability> = TCapability extends {
|
|
35
|
+
enabled: true;
|
|
36
|
+
} ? true : false;
|
|
37
|
+
type NormalizeConfiguredCapabilities<T extends CommercetoolsCapabilities> = Omit<T, OverridableCapabilityKey> & {
|
|
38
|
+
[K in OverridableCapabilityKey]?: EnabledCapability<T[K]>;
|
|
39
|
+
};
|
|
40
|
+
type ExtractCapabilityFactory<TCapability, TContract, TDefaultFactory> = TCapability extends {
|
|
41
|
+
enabled: true;
|
|
42
|
+
factory?: infer TFactory;
|
|
43
|
+
} ? TFactory extends TContract ? TFactory : TDefaultFactory : TDefaultFactory;
|
|
44
|
+
type ExtractCapabilityImplementation<TCapability, TDefaultCapability> = TCapability extends {
|
|
45
|
+
enabled: true;
|
|
46
|
+
capability?: infer TCapabilityFactory;
|
|
47
|
+
} ? TCapabilityFactory extends (...args: any[]) => infer TResolvedCapability ? TResolvedCapability : TDefaultCapability : TDefaultCapability;
|
|
48
|
+
type FactoryContractMap = {
|
|
49
|
+
product: ProductFactory;
|
|
50
|
+
productSearch: ProductSearchFactory;
|
|
51
|
+
productAssociations: ProductAssociationsFactory;
|
|
52
|
+
productReviews: ProductReviewsFactory;
|
|
53
|
+
productList: ProductListFactory;
|
|
54
|
+
identity: IdentityFactory;
|
|
55
|
+
cart: CartFactory;
|
|
56
|
+
checkout: CheckoutFactory;
|
|
57
|
+
order: OrderFactory;
|
|
58
|
+
orderSearch: OrderSearchFactory;
|
|
59
|
+
inventory: InventoryFactory;
|
|
60
|
+
price: PriceFactory;
|
|
61
|
+
category: CategoryFactory;
|
|
62
|
+
store: StoreFactory;
|
|
63
|
+
profile: ProfileFactory;
|
|
64
|
+
};
|
|
65
|
+
type DefaultFactoryMap = {
|
|
66
|
+
product: CommercetoolsProductFactory;
|
|
67
|
+
productSearch: CommercetoolsProductSearchFactory;
|
|
68
|
+
productAssociations: CommercetoolsProductAssociationsFactory;
|
|
69
|
+
productReviews: CommercetoolsProductReviewsFactory;
|
|
70
|
+
productList: CommercetoolsProductListFactory;
|
|
71
|
+
identity: CommercetoolsIdentityFactory;
|
|
72
|
+
cart: CommercetoolsCartFactory;
|
|
73
|
+
checkout: CommercetoolsCheckoutFactory;
|
|
74
|
+
order: CommercetoolsOrderFactory;
|
|
75
|
+
orderSearch: CommercetoolsOrderSearchFactory;
|
|
76
|
+
inventory: CommercetoolsInventoryFactory;
|
|
77
|
+
price: CommercetoolsPriceFactory;
|
|
78
|
+
category: CommercetoolsCategoryFactory;
|
|
79
|
+
store: CommercetoolsStoreFactory;
|
|
80
|
+
profile: CommercetoolsProfileFactory;
|
|
81
|
+
};
|
|
82
|
+
type ResolvedFactoryMap<T extends CommercetoolsCapabilities> = {
|
|
83
|
+
[K in OverridableCapabilityKey]: ExtractCapabilityFactory<T[K], FactoryContractMap[K], DefaultFactoryMap[K]>;
|
|
84
|
+
};
|
|
85
|
+
type DefaultCapabilityMap<T extends CommercetoolsCapabilities> = {
|
|
86
|
+
product: CommercetoolsProductCapability<ResolvedFactoryMap<T>['product']>;
|
|
87
|
+
productSearch: CommercetoolsProductSearchCapability<ResolvedFactoryMap<T>['productSearch']>;
|
|
88
|
+
productAssociations: CommercetoolsProductAssociationsCapability<ResolvedFactoryMap<T>['productAssociations']>;
|
|
89
|
+
productReviews: CommercetoolsProductReviewsCapability<ResolvedFactoryMap<T>['productReviews']>;
|
|
90
|
+
productList: CommercetoolsProductListCapability<ResolvedFactoryMap<T>['productList']>;
|
|
91
|
+
identity: CommercetoolsIdentityCapability<ResolvedFactoryMap<T>['identity']>;
|
|
92
|
+
cart: CommercetoolsCartCapability<ResolvedFactoryMap<T>['cart']>;
|
|
93
|
+
checkout: CommercetoolsCheckoutCapability<ResolvedFactoryMap<T>['checkout']>;
|
|
94
|
+
order: CommercetoolsOrderCapability<ResolvedFactoryMap<T>['order']>;
|
|
95
|
+
orderSearch: CommercetoolsOrderSearchCapability<ResolvedFactoryMap<T>['orderSearch']>;
|
|
96
|
+
inventory: CommercetoolsInventoryCapability<ResolvedFactoryMap<T>['inventory']>;
|
|
97
|
+
price: CommercetoolsPriceCapability<ResolvedFactoryMap<T>['price']>;
|
|
98
|
+
category: CommercetoolsCategoryCapability<ResolvedFactoryMap<T>['category']>;
|
|
99
|
+
store: CommercetoolsStoreCapability<ResolvedFactoryMap<T>['store']>;
|
|
100
|
+
profile: CommercetoolsProfileCapability<ResolvedFactoryMap<T>['profile']>;
|
|
101
|
+
};
|
|
102
|
+
type CapabilityImplementationMap<T extends CommercetoolsCapabilities> = {
|
|
103
|
+
[K in OverridableCapabilityKey]: ExtractCapabilityImplementation<T[K], DefaultCapabilityMap<T>[K]>;
|
|
104
|
+
};
|
|
105
|
+
type EnabledCapabilityOverrideMap<T extends CommercetoolsCapabilities> = {
|
|
106
|
+
[K in OverridableCapabilityKey as T[K] extends {
|
|
107
|
+
enabled: true;
|
|
108
|
+
} ? K : never]: CapabilityImplementationMap<T>[K];
|
|
109
|
+
};
|
|
110
|
+
export type CommercetoolsClientFromCapabilities<T extends CommercetoolsCapabilities> = Omit<ClientFromCapabilities<NormalizeConfiguredCapabilities<T>>, OverridableCapabilityKey> & EnabledCapabilityOverrideMap<T>;
|
|
111
|
+
export declare function resolveCapabilityWithFactory<TFactory, TResolvedCapability, TCapabilityArgs>(capability: {
|
|
112
|
+
factory?: TFactory;
|
|
113
|
+
capability?: (args: TCapabilityArgs) => TResolvedCapability;
|
|
114
|
+
} | undefined, defaults: {
|
|
115
|
+
factory: TFactory;
|
|
116
|
+
capability: (args: TCapabilityArgs) => TResolvedCapability;
|
|
117
|
+
}, buildCapabilityArgs: (factory: TFactory) => TCapabilityArgs): TResolvedCapability;
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TokenCache, TokenCacheOptions, TokenStore } from "@commercetools/ts-client";
|
|
2
|
+
import type { RequestContext } from "@reactionary/core";
|
|
3
|
+
export declare class RequestContextTokenCache implements TokenCache {
|
|
4
|
+
protected context: RequestContext;
|
|
5
|
+
protected sessionProviderKey: string;
|
|
6
|
+
constructor(context: RequestContext, sessionProviderKey: string);
|
|
7
|
+
get(tokenCacheOptions?: TokenCacheOptions): Promise<TokenStore | undefined>;
|
|
8
|
+
set(cache: TokenStore, tokenCacheOptions?: TokenCacheOptions): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Cart as CTCart, LineItem } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { CartIdentifierSchema, CartSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyCartIdentifierSchema, type AnyCartSchema, type CartFactory, type CartItem, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsCartFactory<TCartSchema extends AnyCartSchema = typeof CartSchema, TCartIdentifierSchema extends AnyCartIdentifierSchema = typeof CartIdentifierSchema> implements CartFactory<TCartSchema, TCartIdentifierSchema> {
|
|
6
|
+
readonly cartSchema: TCartSchema;
|
|
7
|
+
readonly cartIdentifierSchema: TCartIdentifierSchema;
|
|
8
|
+
constructor(cartSchema: TCartSchema, cartIdentifierSchema: TCartIdentifierSchema);
|
|
9
|
+
parseCartIdentifier(_context: RequestContext, data: {
|
|
10
|
+
key?: string;
|
|
11
|
+
}): z.output<TCartIdentifierSchema>;
|
|
12
|
+
parseCart(context: RequestContext, data: CTCart): z.output<TCartSchema>;
|
|
13
|
+
protected parseCartItem(lineItem: LineItem): CartItem;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Category as CTCategory, CategoryPagedQueryResponse } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { CategoryPaginatedResultSchema, CategorySchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyCategoryPaginatedResultSchema, type AnyCategorySchema, type CategoryFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsCategoryFactory<TCategorySchema extends AnyCategorySchema = typeof CategorySchema, TCategoryPaginatedSchema extends AnyCategoryPaginatedResultSchema = typeof CategoryPaginatedResultSchema> implements CategoryFactory<TCategorySchema, TCategoryPaginatedSchema> {
|
|
6
|
+
readonly categorySchema: TCategorySchema;
|
|
7
|
+
readonly categoryPaginatedResultSchema: TCategoryPaginatedSchema;
|
|
8
|
+
constructor(categorySchema: TCategorySchema, categoryPaginatedResultSchema: TCategoryPaginatedSchema);
|
|
9
|
+
parseCategory(context: RequestContext, data: CTCategory): z.output<TCategorySchema>;
|
|
10
|
+
parseCategoryPaginatedResult(context: RequestContext, data: CategoryPagedQueryResponse): z.output<TCategoryPaginatedSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Address as CTAddress, Cart as CTCart, LineItem, Payment as CTPayment, ShippingMethod as CTShippingMethod } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { CheckoutSchema, PaymentMethodSchema, ShippingMethodSchema } from '@reactionary/core';
|
|
3
|
+
import { type Address, type AnyCheckoutSchema, type AnyPaymentMethodSchema, type AnyShippingMethodSchema, type CheckoutFactory, type CheckoutItem, type CostBreakDown, type PaymentInstruction, type PaymentMethod, type RequestContext, type ShippingInstruction } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsCheckoutFactory<TCheckoutSchema extends AnyCheckoutSchema = typeof CheckoutSchema, TShippingMethodSchema extends AnyShippingMethodSchema = typeof ShippingMethodSchema, TPaymentMethodSchema extends AnyPaymentMethodSchema = typeof PaymentMethodSchema> implements CheckoutFactory<TCheckoutSchema, TShippingMethodSchema, TPaymentMethodSchema> {
|
|
6
|
+
readonly checkoutSchema: TCheckoutSchema;
|
|
7
|
+
readonly shippingMethodSchema: TShippingMethodSchema;
|
|
8
|
+
readonly paymentMethodSchema: TPaymentMethodSchema;
|
|
9
|
+
constructor(checkoutSchema: TCheckoutSchema, shippingMethodSchema: TShippingMethodSchema, paymentMethodSchema: TPaymentMethodSchema);
|
|
10
|
+
parseCheckout(context: RequestContext, data: CTCart): z.output<TCheckoutSchema>;
|
|
11
|
+
parseShippingMethod(context: RequestContext, data: CTShippingMethod): z.output<TShippingMethodSchema>;
|
|
12
|
+
parsePaymentMethod(_context: RequestContext, data: PaymentMethod): z.output<TPaymentMethodSchema>;
|
|
13
|
+
protected parseCheckoutItem(remoteItem: LineItem): CheckoutItem;
|
|
14
|
+
protected isReadyForFinalization(price: CostBreakDown, paymentInstructions: PaymentInstruction[], billingAddress?: Address, shippingAddress?: Address, shippingInstruction?: ShippingInstruction): boolean;
|
|
15
|
+
protected parsePaymentInstruction(context: RequestContext, data: CTPayment): PaymentInstruction;
|
|
16
|
+
protected parseAddress(data: CTAddress): Address;
|
|
17
|
+
protected parseShippingInstruction(data: CTCart): ShippingInstruction | undefined;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IdentitySchema } from '@reactionary/core';
|
|
2
|
+
import { type AnyIdentitySchema, type IdentityFactory, type RequestContext } from '@reactionary/core';
|
|
3
|
+
import type * as z from 'zod';
|
|
4
|
+
export declare class CommercetoolsIdentityFactory<TIdentitySchema extends AnyIdentitySchema = typeof IdentitySchema> implements IdentityFactory<TIdentitySchema> {
|
|
5
|
+
readonly identitySchema: TIdentitySchema;
|
|
6
|
+
constructor(identitySchema: TIdentitySchema);
|
|
7
|
+
parseIdentity(_context: RequestContext, data: unknown): z.output<TIdentitySchema>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InventoryEntry } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { InventorySchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyInventorySchema, type InventoryFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsInventoryFactory<TInventorySchema extends AnyInventorySchema = typeof InventorySchema> implements InventoryFactory<TInventorySchema> {
|
|
6
|
+
readonly inventorySchema: TInventorySchema;
|
|
7
|
+
constructor(inventorySchema: TInventorySchema);
|
|
8
|
+
parseInventory(_context: RequestContext, data: InventoryEntry): z.output<TInventorySchema>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Order as CTOrder } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { OrderSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyOrderSchema, type OrderFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsOrderFactory<TOrderSchema extends AnyOrderSchema = typeof OrderSchema> implements OrderFactory<TOrderSchema> {
|
|
6
|
+
readonly orderSchema: TOrderSchema;
|
|
7
|
+
constructor(orderSchema: TOrderSchema);
|
|
8
|
+
parseOrder(_context: RequestContext, data: CTOrder): z.output<TOrderSchema>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Address as CTAddress, Order as CTOrder, OrderPagedQueryResponse } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { OrderSearchResultSchema } from '@reactionary/core';
|
|
3
|
+
import { type Address, type AnyOrderSearchResultSchema, type OrderSearchFactory, type OrderSearchQueryByTerm, type OrderSearchResultItem, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsOrderSearchFactory<TOrderSearchResultSchema extends AnyOrderSearchResultSchema = typeof OrderSearchResultSchema> implements OrderSearchFactory<TOrderSearchResultSchema> {
|
|
6
|
+
readonly orderSearchResultSchema: TOrderSearchResultSchema;
|
|
7
|
+
constructor(orderSearchResultSchema: TOrderSearchResultSchema);
|
|
8
|
+
parseOrderSearchResult(context: RequestContext, data: OrderPagedQueryResponse, query: OrderSearchQueryByTerm): z.output<TOrderSearchResultSchema>;
|
|
9
|
+
protected parseAddress(data: CTAddress): Address;
|
|
10
|
+
protected parseOrderSearchItem(context: RequestContext, data: CTOrder): OrderSearchResultItem;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { PriceSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyPriceSchema, type PriceFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsPriceFactory<TPriceSchema extends AnyPriceSchema = typeof PriceSchema> implements PriceFactory<TPriceSchema> {
|
|
6
|
+
readonly priceSchema: TPriceSchema;
|
|
7
|
+
constructor(priceSchema: TPriceSchema);
|
|
8
|
+
parsePrice(context: RequestContext, data: CTProductVariant, options?: {
|
|
9
|
+
includeDiscounts: boolean;
|
|
10
|
+
}): z.output<TPriceSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AnyProductSchema, type ProductFactory, type ProductVariant, type RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
import type { ProductProjection, ProductVariant as CTProductVariant, Attribute as CTAttribute } from '@commercetools/platform-sdk';
|
|
4
|
+
import type { ProductAttribute, ProductAttributeValue, ProductSchema } from '@reactionary/core';
|
|
5
|
+
export declare class CommercetoolsProductFactory<TProductSchema extends AnyProductSchema = typeof ProductSchema> implements ProductFactory<TProductSchema> {
|
|
6
|
+
readonly productSchema: TProductSchema;
|
|
7
|
+
constructor(productSchema: TProductSchema);
|
|
8
|
+
parseProduct(context: RequestContext, data: ProductProjection): z.output<TProductSchema>;
|
|
9
|
+
/**
|
|
10
|
+
* Return true, if the attribute is a defining attribute (ie an option)
|
|
11
|
+
* @param attr a variant attribute
|
|
12
|
+
* @returns true if the attribute is an option
|
|
13
|
+
*/
|
|
14
|
+
protected isVariantAttributeAnOption(attr: CTAttribute): boolean;
|
|
15
|
+
protected parseVariant(context: RequestContext, variant: CTProductVariant, product: ProductProjection): ProductVariant;
|
|
16
|
+
protected parseAttribute(context: RequestContext, attr: CTAttribute): ProductAttribute;
|
|
17
|
+
protected parseAttributeValue(context: RequestContext, attr: CTAttribute): ProductAttributeValue;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProductProjection, ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProductAssociationSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyProductAssociationSchema, type ProductAssociationsFactory, type ProductSearchResultItem, type ProductSearchResultItemVariant, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProductAssociationsFactory<TProductAssociationSchema extends AnyProductAssociationSchema = typeof ProductAssociationSchema> implements ProductAssociationsFactory<TProductAssociationSchema> {
|
|
6
|
+
readonly productAssociationSchema: TProductAssociationSchema;
|
|
7
|
+
constructor(productAssociationSchema: TProductAssociationSchema);
|
|
8
|
+
parseAssociation(context: RequestContext, data: {
|
|
9
|
+
sourceProductKey: string;
|
|
10
|
+
relation: 'accessory' | 'sparepart' | 'replacement';
|
|
11
|
+
product: ProductProjection;
|
|
12
|
+
}): z.output<TProductAssociationSchema>;
|
|
13
|
+
protected parseSearchResultItem(context: RequestContext, data: ProductProjection): ProductSearchResultItem;
|
|
14
|
+
protected parseVariant(context: RequestContext, variant: CTProductVariant, product: ProductProjection): ProductSearchResultItemVariant;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ShoppingList, ShoppingListLineItem } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProductListItemPaginatedResultsSchema, ProductListItemSchema, ProductListPaginatedResultsSchema, ProductListSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyProductListItemPaginatedSchema, type AnyProductListItemSchema, type AnyProductListPaginatedSchema, type AnyProductListSchema, type ProductList, type ProductListFactory, type ProductListIdentifier, type ProductListItem, type ProductListItemPaginatedResult, type ProductListPaginatedResult, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProductListFactory<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> {
|
|
6
|
+
readonly productListSchema: TProductListSchema;
|
|
7
|
+
readonly productListItemSchema: TProductListItemSchema;
|
|
8
|
+
readonly productListPaginatedSchema: TProductListPaginatedSchema;
|
|
9
|
+
readonly productListItemPaginatedSchema: TProductListItemPaginatedSchema;
|
|
10
|
+
constructor(productListSchema: TProductListSchema, productListItemSchema: TProductListItemSchema, productListPaginatedSchema: TProductListPaginatedSchema, productListItemPaginatedSchema: TProductListItemPaginatedSchema);
|
|
11
|
+
parseProductList(_context: RequestContext, data: ProductList): z.output<TProductListSchema>;
|
|
12
|
+
parseProductListItem(_context: RequestContext, data: ProductListItem): z.output<TProductListItemSchema>;
|
|
13
|
+
parseProductListPaginatedResult(_context: RequestContext, data: ProductListPaginatedResult): z.output<TProductListPaginatedSchema>;
|
|
14
|
+
parseProductListItemPaginatedResult(_context: RequestContext, data: ProductListItemPaginatedResult): z.output<TProductListItemPaginatedSchema>;
|
|
15
|
+
parseListFromCommercetools(list: ShoppingList): z.output<TProductListSchema>;
|
|
16
|
+
parseListItemFromCommercetools(listIdentifier: ProductListIdentifier, lineItem: ShoppingListLineItem): z.output<TProductListItemSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Review as CTReview } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProductRatingSummarySchema, ProductReviewPaginatedResultSchema, ProductReviewSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyProductRatingSummarySchema, type AnyProductReviewPaginatedSchema, type AnyProductReviewSchema, type ProductRatingSummary, type ProductReview, type ProductReviewPaginatedResult, type ProductReviewsFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProductReviewsFactory<TRatingSummarySchema extends AnyProductRatingSummarySchema = typeof ProductRatingSummarySchema, TReviewSchema extends AnyProductReviewSchema = typeof ProductReviewSchema, TReviewPaginatedSchema extends AnyProductReviewPaginatedSchema = typeof ProductReviewPaginatedResultSchema> implements ProductReviewsFactory<TRatingSummarySchema, TReviewSchema, TReviewPaginatedSchema> {
|
|
6
|
+
readonly ratingSummarySchema: TRatingSummarySchema;
|
|
7
|
+
readonly reviewSchema: TReviewSchema;
|
|
8
|
+
readonly reviewPaginatedSchema: TReviewPaginatedSchema;
|
|
9
|
+
constructor(ratingSummarySchema: TRatingSummarySchema, reviewSchema: TReviewSchema, reviewPaginatedSchema: TReviewPaginatedSchema);
|
|
10
|
+
parseRatingSummary(_context: RequestContext, data: ProductRatingSummary): z.output<TRatingSummarySchema>;
|
|
11
|
+
parseReview(_context: RequestContext, data: ProductReview): z.output<TReviewSchema>;
|
|
12
|
+
parseReviewPaginatedResult(_context: RequestContext, data: ProductReviewPaginatedResult): z.output<TReviewPaginatedSchema>;
|
|
13
|
+
parseReviewFromCommercetools(_context: RequestContext, review: CTReview, productKey: string): z.output<TReviewSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProductPagedSearchResponse, ProductProjection, ProductSearchFacetResult as CTProductSearchFacetResult, ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProductSearchResultSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyProductSearchResultSchema, type FacetIdentifier, type FacetValueIdentifier, type ProductSearchFactory, type ProductSearchQueryByTerm, type ProductSearchResultFacet, type ProductSearchResultFacetValue, type ProductSearchResultItem, type ProductSearchResultItemVariant, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProductSearchFactory<TProductSearchResultSchema extends AnyProductSearchResultSchema = typeof ProductSearchResultSchema> implements ProductSearchFactory<TProductSearchResultSchema> {
|
|
6
|
+
readonly productSearchResultSchema: TProductSearchResultSchema;
|
|
7
|
+
constructor(productSearchResultSchema: TProductSearchResultSchema);
|
|
8
|
+
parseSearchResult(context: RequestContext, data: ProductPagedSearchResponse, query: ProductSearchQueryByTerm): z.output<TProductSearchResultSchema>;
|
|
9
|
+
protected parseSingle(context: RequestContext, data: ProductProjection): ProductSearchResultItem;
|
|
10
|
+
protected parseFacet(facetIdentifier: FacetIdentifier, facet: CTProductSearchFacetResult): ProductSearchResultFacet;
|
|
11
|
+
protected parseFacetValue(facetValueIdentifier: FacetValueIdentifier, label: string, count: number): ProductSearchResultFacetValue;
|
|
12
|
+
protected parseVariant(context: RequestContext, variant: CTProductVariant, product: ProductProjection): ProductSearchResultItemVariant;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Address as CTAddress, Customer } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProfileSchema } from '@reactionary/core';
|
|
3
|
+
import { type Address, type AnyProfileSchema, type ProfileFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProfileFactory<TProfileSchema extends AnyProfileSchema = typeof ProfileSchema> implements ProfileFactory<TProfileSchema> {
|
|
6
|
+
readonly profileSchema: TProfileSchema;
|
|
7
|
+
constructor(profileSchema: TProfileSchema);
|
|
8
|
+
parseProfile(_context: RequestContext, data: Customer): z.output<TProfileSchema>;
|
|
9
|
+
protected parseAddress(address: CTAddress): Address;
|
|
10
|
+
protected isIncompleteAddress(address: CTAddress | undefined): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Channel } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { StoreSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyStoreSchema, type RequestContext, type StoreFactory } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsStoreFactory<TStoreSchema extends AnyStoreSchema = typeof StoreSchema> implements StoreFactory<TStoreSchema> {
|
|
6
|
+
readonly storeSchema: TStoreSchema;
|
|
7
|
+
constructor(storeSchema: TStoreSchema);
|
|
8
|
+
parseStore(_context: RequestContext, data: Channel): z.output<TStoreSchema>;
|
|
9
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export * from './core/client.js';
|
|
2
|
+
export * from './core/initialize.js';
|
|
3
|
+
export * from './capabilities/cart.capability.js';
|
|
4
|
+
export * from './capabilities/identity.capability.js';
|
|
5
|
+
export * from './capabilities/inventory.capability.js';
|
|
6
|
+
export * from './capabilities/order-search.capability.js';
|
|
7
|
+
export * from './capabilities/price.capability.js';
|
|
8
|
+
export * from './capabilities/product-associations.capability.js';
|
|
9
|
+
export * from './capabilities/product.capability.js';
|
|
10
|
+
export * from './capabilities/product-reviews.capability.js';
|
|
11
|
+
export * from './capabilities/product-search.capability.js';
|
|
12
|
+
export * from './factories/product/product.factory.js';
|
|
13
|
+
export * from './factories/checkout/checkout.factory.js';
|
|
14
|
+
export * from './factories/product-search/product-search.factory.js';
|
|
15
|
+
export * from './factories/inventory/inventory.factory.js';
|
|
16
|
+
export * from './factories/price/price.factory.js';
|
|
17
|
+
export * from './factories/store/store.factory.js';
|
|
18
|
+
export * from './factories/order/order.factory.js';
|
|
19
|
+
export * from './factories/category/category.factory.js';
|
|
20
|
+
export * from './factories/cart/cart.factory.js';
|
|
21
|
+
export * from './factories/profile/profile.factory.js';
|
|
22
|
+
export * from './factories/order-search/order-search.factory.js';
|
|
23
|
+
export * from './factories/product-associations/product-associations.factory.js';
|
|
24
|
+
export * from './factories/product-reviews/product-reviews.factory.js';
|
|
25
|
+
export * from './factories/product-list/product-list.factory.js';
|
|
26
|
+
export * from './factories/identity/identity.factory.js';
|
|
27
|
+
export * from './schema/capabilities.schema.js';
|
|
28
|
+
export * from './schema/configuration.schema.js';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Cache, CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, CheckoutFactory, CheckoutFactoryWithOutput, CheckoutCapability, IdentityFactory, IdentityFactoryWithOutput, IdentityCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, OrderFactory, OrderFactoryWithOutput, OrderCapability, OrderSearchFactory, OrderSearchFactoryWithOutput, OrderSearchCapability, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductAssociationsFactory, ProductAssociationsFactoryWithOutput, ProductAssociationsCapability, ProductFactory, ProductFactoryWithOutput, ProductListFactory, ProductListFactoryWithOutput, ProductListCapability, ProductCapability, ProductReviewsFactory, ProductReviewsFactoryWithOutput, ProductReviewsCapability, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability, ProfileFactory, ProfileFactoryWithOutput, ProfileCapability, RequestContext, StoreFactory, StoreFactoryWithOutput, StoreCapability } from '@reactionary/core';
|
|
2
|
+
import type { CommercetoolsAPI } from '../core/client.js';
|
|
3
|
+
import type { CommercetoolsConfiguration } from './configuration.schema.js';
|
|
4
|
+
import * as z from 'zod';
|
|
5
|
+
export declare const CommercetoolsCapabilitiesSchema: z.ZodObject<{
|
|
6
|
+
productSearch: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
7
|
+
enabled: z.ZodBoolean;
|
|
8
|
+
}, z.core.$loose>>>;
|
|
9
|
+
productAssociations: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
10
|
+
enabled: z.ZodBoolean;
|
|
11
|
+
}, z.core.$loose>>>;
|
|
12
|
+
productReviews: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
13
|
+
enabled: z.ZodBoolean;
|
|
14
|
+
}, z.core.$loose>>>;
|
|
15
|
+
productList: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
16
|
+
enabled: z.ZodBoolean;
|
|
17
|
+
}, z.core.$loose>>>;
|
|
18
|
+
identity: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
19
|
+
enabled: z.ZodBoolean;
|
|
20
|
+
}, z.core.$loose>>>;
|
|
21
|
+
cart: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
22
|
+
enabled: z.ZodBoolean;
|
|
23
|
+
}, z.core.$loose>>>;
|
|
24
|
+
order: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
25
|
+
enabled: z.ZodBoolean;
|
|
26
|
+
}, z.core.$loose>>>;
|
|
27
|
+
orderSearch: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
28
|
+
enabled: z.ZodBoolean;
|
|
29
|
+
}, z.core.$loose>>>;
|
|
30
|
+
inventory: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
31
|
+
enabled: z.ZodBoolean;
|
|
32
|
+
}, z.core.$loose>>>;
|
|
33
|
+
price: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
34
|
+
enabled: z.ZodBoolean;
|
|
35
|
+
}, z.core.$loose>>>;
|
|
36
|
+
category: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
37
|
+
enabled: z.ZodBoolean;
|
|
38
|
+
}, z.core.$loose>>>;
|
|
39
|
+
store: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
40
|
+
enabled: z.ZodBoolean;
|
|
41
|
+
}, z.core.$loose>>>;
|
|
42
|
+
profile: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
43
|
+
enabled: z.ZodBoolean;
|
|
44
|
+
}, z.core.$loose>>>;
|
|
45
|
+
product: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
46
|
+
enabled: z.ZodBoolean;
|
|
47
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
48
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
49
|
+
}, z.core.$loose>>>;
|
|
50
|
+
checkout: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
51
|
+
enabled: z.ZodBoolean;
|
|
52
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
53
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
54
|
+
}, z.core.$loose>>>;
|
|
55
|
+
}, z.core.$loose>;
|
|
56
|
+
export interface CommercetoolsCapabilityFactoryArgs<TFactory> {
|
|
57
|
+
cache: Cache;
|
|
58
|
+
context: RequestContext;
|
|
59
|
+
config: CommercetoolsConfiguration;
|
|
60
|
+
commercetoolsApi: CommercetoolsAPI;
|
|
61
|
+
factory: TFactory;
|
|
62
|
+
}
|
|
63
|
+
export interface CommercetoolsCapabilityConfig<TFactory, TCapability> {
|
|
64
|
+
factory?: TFactory;
|
|
65
|
+
capability?: (args: CommercetoolsCapabilityFactoryArgs<TFactory>) => TCapability;
|
|
66
|
+
}
|
|
67
|
+
type EnabledCapabilityConfig<TFactory, TCapability> = {
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
} & CommercetoolsCapabilityConfig<TFactory, TCapability>;
|
|
70
|
+
export type CommercetoolsProductCapabilityConfig<TFactory extends ProductFactory = ProductFactory, TCapability extends ProductCapability = ProductCapability> = CommercetoolsCapabilityConfig<ProductFactoryWithOutput<TFactory>, TCapability>;
|
|
71
|
+
export type CommercetoolsCheckoutCapabilityConfig<TFactory extends CheckoutFactory = CheckoutFactory, TCapability extends CheckoutCapability = CheckoutCapability> = CommercetoolsCapabilityConfig<CheckoutFactoryWithOutput<TFactory>, TCapability>;
|
|
72
|
+
export type CommercetoolsProductSearchCapabilityConfig = CommercetoolsCapabilityConfig<ProductSearchFactoryWithOutput<ProductSearchFactory>, ProductSearchCapability>;
|
|
73
|
+
export type CommercetoolsProductAssociationsCapabilityConfig = CommercetoolsCapabilityConfig<ProductAssociationsFactoryWithOutput<ProductAssociationsFactory>, ProductAssociationsCapability>;
|
|
74
|
+
export type CommercetoolsProductReviewsCapabilityConfig = CommercetoolsCapabilityConfig<ProductReviewsFactoryWithOutput<ProductReviewsFactory>, ProductReviewsCapability>;
|
|
75
|
+
export type CommercetoolsProductListCapabilityConfig = CommercetoolsCapabilityConfig<ProductListFactoryWithOutput<ProductListFactory>, ProductListCapability>;
|
|
76
|
+
export type CommercetoolsIdentityCapabilityConfig = CommercetoolsCapabilityConfig<IdentityFactoryWithOutput<IdentityFactory>, IdentityCapability>;
|
|
77
|
+
export type CommercetoolsCartCapabilityConfig = CommercetoolsCapabilityConfig<CartFactoryWithOutput<CartFactory>, CartCapability>;
|
|
78
|
+
export type CommercetoolsInventoryCapabilityConfig = CommercetoolsCapabilityConfig<InventoryFactoryWithOutput<InventoryFactory>, InventoryCapability>;
|
|
79
|
+
export type CommercetoolsPriceCapabilityConfig = CommercetoolsCapabilityConfig<PriceFactoryWithOutput<PriceFactory>, PriceCapability>;
|
|
80
|
+
export type CommercetoolsCategoryCapabilityConfig = CommercetoolsCapabilityConfig<CategoryFactoryWithOutput<CategoryFactory>, CategoryCapability>;
|
|
81
|
+
export type CommercetoolsStoreCapabilityConfig = CommercetoolsCapabilityConfig<StoreFactoryWithOutput<StoreFactory>, StoreCapability>;
|
|
82
|
+
export type CommercetoolsProfileCapabilityConfig = CommercetoolsCapabilityConfig<ProfileFactoryWithOutput<ProfileFactory>, ProfileCapability>;
|
|
83
|
+
export type CommercetoolsOrderCapabilityConfig = CommercetoolsCapabilityConfig<OrderFactoryWithOutput<OrderFactory>, OrderCapability>;
|
|
84
|
+
export type CommercetoolsOrderSearchCapabilityConfig = CommercetoolsCapabilityConfig<OrderSearchFactoryWithOutput<OrderSearchFactory>, OrderSearchCapability>;
|
|
85
|
+
export type CommercetoolsCapabilityConfigMap<TProductFactory extends ProductFactory = ProductFactory, TProductCapability extends ProductCapability = ProductCapability, TCheckoutFactory extends CheckoutFactory = CheckoutFactory, TCheckoutCapability extends CheckoutCapability = CheckoutCapability> = {
|
|
86
|
+
product: EnabledCapabilityConfig<ProductFactoryWithOutput<TProductFactory>, TProductCapability>;
|
|
87
|
+
checkout: EnabledCapabilityConfig<CheckoutFactoryWithOutput<TCheckoutFactory>, TCheckoutCapability>;
|
|
88
|
+
productSearch: EnabledCapabilityConfig<ProductSearchFactoryWithOutput<ProductSearchFactory>, ProductSearchCapability>;
|
|
89
|
+
productAssociations: EnabledCapabilityConfig<ProductAssociationsFactoryWithOutput<ProductAssociationsFactory>, ProductAssociationsCapability>;
|
|
90
|
+
productReviews: EnabledCapabilityConfig<ProductReviewsFactoryWithOutput<ProductReviewsFactory>, ProductReviewsCapability>;
|
|
91
|
+
productList: EnabledCapabilityConfig<ProductListFactoryWithOutput<ProductListFactory>, ProductListCapability>;
|
|
92
|
+
identity: EnabledCapabilityConfig<IdentityFactoryWithOutput<IdentityFactory>, IdentityCapability>;
|
|
93
|
+
cart: EnabledCapabilityConfig<CartFactoryWithOutput<CartFactory>, CartCapability>;
|
|
94
|
+
inventory: EnabledCapabilityConfig<InventoryFactoryWithOutput<InventoryFactory>, InventoryCapability>;
|
|
95
|
+
price: EnabledCapabilityConfig<PriceFactoryWithOutput<PriceFactory>, PriceCapability>;
|
|
96
|
+
category: EnabledCapabilityConfig<CategoryFactoryWithOutput<CategoryFactory>, CategoryCapability>;
|
|
97
|
+
store: EnabledCapabilityConfig<StoreFactoryWithOutput<StoreFactory>, StoreCapability>;
|
|
98
|
+
profile: EnabledCapabilityConfig<ProfileFactoryWithOutput<ProfileFactory>, ProfileCapability>;
|
|
99
|
+
order: EnabledCapabilityConfig<OrderFactoryWithOutput<OrderFactory>, OrderCapability>;
|
|
100
|
+
orderSearch: EnabledCapabilityConfig<OrderSearchFactoryWithOutput<OrderSearchFactory>, OrderSearchCapability>;
|
|
101
|
+
};
|
|
102
|
+
type CommercetoolsCapabilitiesBase = z.infer<typeof CommercetoolsCapabilitiesSchema>;
|
|
103
|
+
export type CommercetoolsCapabilities<TProductFactory extends ProductFactory = ProductFactory, TProductCapability extends ProductCapability = ProductCapability, TCheckoutFactory extends CheckoutFactory = CheckoutFactory, TCheckoutCapability extends CheckoutCapability = CheckoutCapability> = Omit<CommercetoolsCapabilitiesBase, keyof CommercetoolsCapabilityConfigMap<TProductFactory, TProductCapability, TCheckoutFactory, TCheckoutCapability>> & Partial<CommercetoolsCapabilityConfigMap<TProductFactory, TProductCapability, TCheckoutFactory, TCheckoutCapability>>;
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export declare const CommercetoolsCartIdentifierSchema: z.ZodObject<{
|
|
3
|
+
key: z.ZodString;
|
|
4
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
}, z.core.$loose>;
|
|
6
|
+
export declare const CommercetoolsOrderIdentifierSchema: z.ZodObject<{
|
|
7
|
+
key: z.ZodString;
|
|
8
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
}, z.core.$loose>;
|
|
10
|
+
export declare const CommercetoolsCheckoutIdentifierSchema: z.ZodObject<{
|
|
11
|
+
key: z.ZodString;
|
|
12
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
13
|
+
}, z.core.$loose>;
|
|
14
|
+
export declare const CommercetoolsResolveCategoryQueryByKeySchema: z.ZodObject<{
|
|
15
|
+
key: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare const CommercetoolsResolveCategoryQueryByIdSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const CommercetoolsCategoryLookupSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
key: z.ZodOptional<z.ZodString>;
|
|
23
|
+
name: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
24
|
+
}, z.core.$loose>;
|
|
25
|
+
export type CommercetoolsCheckoutIdentifier = z.infer<typeof CommercetoolsCheckoutIdentifierSchema>;
|
|
26
|
+
export type CommercetoolsCartIdentifier = z.infer<typeof CommercetoolsCartIdentifierSchema>;
|
|
27
|
+
export type CommercetoolsOrderIdentifier = z.infer<typeof CommercetoolsOrderIdentifierSchema>;
|
|
28
|
+
export type CommercetoolsResolveCategoryQueryByKey = z.infer<typeof CommercetoolsResolveCategoryQueryByKeySchema>;
|
|
29
|
+
export type CommercetoolsResolveCategoryQueryById = z.infer<typeof CommercetoolsResolveCategoryQueryByIdSchema>;
|
|
30
|
+
export type CommercetoolsCategoryLookup = z.infer<typeof CommercetoolsCategoryLookupSchema>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const CommercetoolsConfigurationSchema: z.ZodObject<{
|
|
3
|
+
projectKey: z.ZodString;
|
|
4
|
+
authUrl: z.ZodString;
|
|
5
|
+
apiUrl: z.ZodString;
|
|
6
|
+
clientId: z.ZodString;
|
|
7
|
+
clientSecret: z.ZodString;
|
|
8
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
9
|
+
adminClientId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
adminClientSecret: z.ZodOptional<z.ZodString>;
|
|
11
|
+
paymentMethods: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
+
identifier: z.ZodObject<{
|
|
13
|
+
method: z.ZodString;
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
paymentProcessor: z.ZodString;
|
|
16
|
+
}, z.core.$loose>;
|
|
17
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
sourceUrl: z.ZodDefault<z.ZodString>;
|
|
19
|
+
altText: z.ZodDefault<z.ZodString>;
|
|
20
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
}, z.core.$loose>>;
|
|
23
|
+
description: z.ZodString;
|
|
24
|
+
isPunchOut: z.ZodBoolean;
|
|
25
|
+
}, z.core.$loose>>>>;
|
|
26
|
+
facetFieldsForSearch: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
27
|
+
listPriceChannelKey: z.ZodOptional<z.ZodString>;
|
|
28
|
+
customerPriceChannelKey: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$loose>;
|
|
30
|
+
export type CommercetoolsConfiguration = z.infer<typeof CommercetoolsConfigurationSchema>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const CommercetoolsSessionSchema: z.ZodObject<{
|
|
3
|
+
token: z.ZodDefault<z.ZodString>;
|
|
4
|
+
refreshToken: z.ZodOptional<z.ZodString>;
|
|
5
|
+
expirationTime: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
export type CommercetoolsSession = z.infer<typeof CommercetoolsSessionSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare function getCommercetoolsTestConfiguration(): {
|
|
2
|
+
apiUrl: string;
|
|
3
|
+
authUrl: string;
|
|
4
|
+
clientId: string;
|
|
5
|
+
clientSecret: string;
|
|
6
|
+
projectKey: string;
|
|
7
|
+
scopes: string[];
|
|
8
|
+
paymentMethods: {
|
|
9
|
+
[x: string]: unknown;
|
|
10
|
+
identifier: {
|
|
11
|
+
[x: string]: unknown;
|
|
12
|
+
method: string;
|
|
13
|
+
name: string;
|
|
14
|
+
paymentProcessor: string;
|
|
15
|
+
};
|
|
16
|
+
description: string;
|
|
17
|
+
isPunchOut: boolean;
|
|
18
|
+
logo?: {
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
sourceUrl: string;
|
|
21
|
+
altText: string;
|
|
22
|
+
width?: number | undefined;
|
|
23
|
+
height?: number | undefined;
|
|
24
|
+
} | undefined;
|
|
25
|
+
}[];
|
|
26
|
+
facetFieldsForSearch: never[];
|
|
27
|
+
};
|