@reactionary/provider-commercetools 0.1.13 → 0.2.2
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/core/client.js +3 -38
- package/package.json +2 -2
- package/providers/cart.provider.js +36 -29
- package/providers/category.provider.js +32 -76
- package/providers/checkout.provider.js +17 -41
- package/providers/identity.provider.js +6 -5
- package/providers/inventory.provider.js +8 -18
- package/providers/order.provider.js +7 -12
- package/providers/price.provider.js +3 -8
- package/providers/product-search.provider.js +5 -22
- package/providers/product.provider.js +33 -36
- package/providers/profile.provider.js +322 -19
- package/providers/store.provider.js +3 -11
- package/src/core/client.d.ts +0 -25
- package/src/providers/cart.provider.d.ts +10 -10
- package/src/providers/category.provider.d.ts +8 -76
- package/src/providers/checkout.provider.d.ts +10 -17
- package/src/providers/identity.provider.d.ts +5 -5
- package/src/providers/inventory.provider.d.ts +2 -2
- package/src/providers/order.provider.d.ts +2 -2
- package/src/providers/price.provider.d.ts +3 -3
- package/src/providers/product-search.provider.d.ts +3 -24
- package/src/providers/product.provider.d.ts +5 -4
- package/src/providers/profile.provider.d.ts +19 -4
- package/src/providers/store.provider.d.ts +2 -2
- package/src/schema/capabilities.schema.d.ts +3 -3
- package/src/schema/commercetools.schema.d.ts +0 -7
- package/src/schema/configuration.schema.d.ts +0 -7
package/src/core/client.d.ts
CHANGED
|
@@ -16,15 +16,6 @@ export declare class CommercetoolsClient {
|
|
|
16
16
|
protected createClient(): Promise<ApiRoot>;
|
|
17
17
|
register(username: string, password: string): Promise<{
|
|
18
18
|
[x: string]: unknown;
|
|
19
|
-
meta: {
|
|
20
|
-
[x: string]: unknown;
|
|
21
|
-
cache: {
|
|
22
|
-
[x: string]: unknown;
|
|
23
|
-
hit: boolean;
|
|
24
|
-
key: string;
|
|
25
|
-
};
|
|
26
|
-
placeholder: boolean;
|
|
27
|
-
};
|
|
28
19
|
id: {
|
|
29
20
|
[x: string]: unknown;
|
|
30
21
|
userId: string;
|
|
@@ -33,15 +24,6 @@ export declare class CommercetoolsClient {
|
|
|
33
24
|
}>;
|
|
34
25
|
login(username: string, password: string): Promise<{
|
|
35
26
|
[x: string]: unknown;
|
|
36
|
-
meta: {
|
|
37
|
-
[x: string]: unknown;
|
|
38
|
-
cache: {
|
|
39
|
-
[x: string]: unknown;
|
|
40
|
-
hit: boolean;
|
|
41
|
-
key: string;
|
|
42
|
-
};
|
|
43
|
-
placeholder: boolean;
|
|
44
|
-
};
|
|
45
27
|
id: {
|
|
46
28
|
[x: string]: unknown;
|
|
47
29
|
userId: string;
|
|
@@ -49,13 +31,6 @@ export declare class CommercetoolsClient {
|
|
|
49
31
|
type: "Registered";
|
|
50
32
|
}>;
|
|
51
33
|
logout(): Promise<{
|
|
52
|
-
meta: {
|
|
53
|
-
cache: {
|
|
54
|
-
hit: false;
|
|
55
|
-
key: string;
|
|
56
|
-
};
|
|
57
|
-
placeholder: false;
|
|
58
|
-
};
|
|
59
34
|
type: "Anonymous";
|
|
60
35
|
}>;
|
|
61
36
|
introspect(): Promise<AnonymousIdentity | GuestIdentity | RegisteredIdentity>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CartProvider } from '@reactionary/core';
|
|
2
|
-
import type { CartItem, CartMutationItemAdd, CartMutationItemQuantityChange, CartMutationItemRemove, CartQueryById, CartIdentifier, CartMutationApplyCoupon, CartMutationDeleteCart, CartMutationRemoveCoupon, CartMutationChangeCurrency, RequestContext, Cart, Cache } from '@reactionary/core';
|
|
2
|
+
import type { CartItem, CartMutationItemAdd, CartMutationItemQuantityChange, CartMutationItemRemove, CartQueryById, CartIdentifier, CartMutationApplyCoupon, CartMutationDeleteCart, CartMutationRemoveCoupon, CartMutationChangeCurrency, RequestContext, Cart, Cache, Result, NotFoundError } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { Cart as CTCart, LineItem, MyCartUpdateAction } from '@commercetools/platform-sdk';
|
|
5
5
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
@@ -7,15 +7,15 @@ export declare class CommercetoolsCartProvider extends CartProvider {
|
|
|
7
7
|
protected config: CommercetoolsConfiguration;
|
|
8
8
|
protected client: CommercetoolsClient;
|
|
9
9
|
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
|
|
10
|
-
getById(payload: CartQueryById): Promise<Cart
|
|
11
|
-
add(payload: CartMutationItemAdd): Promise<Cart
|
|
12
|
-
remove(payload: CartMutationItemRemove): Promise<Cart
|
|
13
|
-
changeQuantity(payload: CartMutationItemQuantityChange): Promise<Cart
|
|
14
|
-
getActiveCartId(): Promise<CartIdentifier
|
|
15
|
-
deleteCart(payload: CartMutationDeleteCart): Promise<
|
|
16
|
-
applyCouponCode(payload: CartMutationApplyCoupon): Promise<Cart
|
|
17
|
-
removeCouponCode(payload: CartMutationRemoveCoupon): Promise<Cart
|
|
18
|
-
changeCurrency(payload: CartMutationChangeCurrency): Promise<Cart
|
|
10
|
+
getById(payload: CartQueryById): Promise<Result<Cart, NotFoundError>>;
|
|
11
|
+
add(payload: CartMutationItemAdd): Promise<Result<Cart>>;
|
|
12
|
+
remove(payload: CartMutationItemRemove): Promise<Result<Cart>>;
|
|
13
|
+
changeQuantity(payload: CartMutationItemQuantityChange): Promise<Result<Cart>>;
|
|
14
|
+
getActiveCartId(): Promise<Result<CartIdentifier, NotFoundError>>;
|
|
15
|
+
deleteCart(payload: CartMutationDeleteCart): Promise<Result<void>>;
|
|
16
|
+
applyCouponCode(payload: CartMutationApplyCoupon): Promise<Result<Cart>>;
|
|
17
|
+
removeCouponCode(payload: CartMutationRemoveCoupon): Promise<Result<Cart>>;
|
|
18
|
+
changeCurrency(payload: CartMutationChangeCurrency): Promise<Result<Cart>>;
|
|
19
19
|
protected createCart(): Promise<CartIdentifier>;
|
|
20
20
|
protected applyActions(cart: CartIdentifier, actions: MyCartUpdateAction[]): Promise<Cart>;
|
|
21
21
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CategoryProvider } from '@reactionary/core';
|
|
2
|
-
import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext, Cache, Category } from '@reactionary/core';
|
|
2
|
+
import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext, Cache, Category, Result, NotFoundError } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { ByProjectKeyCategoriesRequestBuilder } from '@commercetools/platform-sdk';
|
|
5
5
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
@@ -11,16 +11,16 @@ export declare class CommercetoolsCategoryProvider extends CategoryProvider {
|
|
|
11
11
|
/**
|
|
12
12
|
* Look it up by the category ID (key in commercetools), and if not there, return a placeholder.
|
|
13
13
|
*/
|
|
14
|
-
getById(payload: CategoryQueryById): Promise<Category
|
|
14
|
+
getById(payload: CategoryQueryById): Promise<Result<Category, NotFoundError>>;
|
|
15
15
|
/**
|
|
16
16
|
* Resolve the category by slug, in the users current locale.
|
|
17
17
|
*/
|
|
18
|
-
getBySlug(payload: CategoryQueryBySlug): Promise<Category
|
|
18
|
+
getBySlug(payload: CategoryQueryBySlug): Promise<Result<Category, NotFoundError>>;
|
|
19
19
|
/**
|
|
20
20
|
* Returns the breadcrumb path to the category, i.e. all parents up to the root.
|
|
21
21
|
* The returned order is from root to leaf.
|
|
22
22
|
*/
|
|
23
|
-
getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<Category[]
|
|
23
|
+
getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<Result<Category[]>>;
|
|
24
24
|
/**
|
|
25
25
|
* Returns a page of child categories for the given parent category ID.
|
|
26
26
|
* You must provide the pagination options to control the size of the result set.
|
|
@@ -28,26 +28,12 @@ export declare class CommercetoolsCategoryProvider extends CategoryProvider {
|
|
|
28
28
|
*
|
|
29
29
|
* This is cached by ID + page number + page size + locale + store
|
|
30
30
|
*/
|
|
31
|
-
findChildCategories(payload: CategoryQueryForChildCategories): Promise<{
|
|
32
|
-
meta: {
|
|
33
|
-
cache: {
|
|
34
|
-
hit: false;
|
|
35
|
-
key: string;
|
|
36
|
-
};
|
|
37
|
-
placeholder: false;
|
|
38
|
-
};
|
|
31
|
+
findChildCategories(payload: CategoryQueryForChildCategories): Promise<import("@reactionary/core").Ok<{
|
|
39
32
|
pageNumber: number;
|
|
40
33
|
pageSize: number;
|
|
41
34
|
totalCount: number;
|
|
42
35
|
totalPages: number;
|
|
43
36
|
items: {
|
|
44
|
-
meta: {
|
|
45
|
-
cache: {
|
|
46
|
-
hit: boolean;
|
|
47
|
-
key: string;
|
|
48
|
-
};
|
|
49
|
-
placeholder: boolean;
|
|
50
|
-
};
|
|
51
37
|
identifier: {
|
|
52
38
|
key: string;
|
|
53
39
|
};
|
|
@@ -64,40 +50,13 @@ export declare class CommercetoolsCategoryProvider extends CategoryProvider {
|
|
|
64
50
|
key: string;
|
|
65
51
|
} | undefined;
|
|
66
52
|
}[];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
meta: {
|
|
70
|
-
cache: {
|
|
71
|
-
hit: false;
|
|
72
|
-
key: string;
|
|
73
|
-
};
|
|
74
|
-
placeholder: true;
|
|
75
|
-
};
|
|
76
|
-
pageNumber: number;
|
|
77
|
-
pageSize: number;
|
|
78
|
-
totalCount: number;
|
|
79
|
-
totalPages: number;
|
|
80
|
-
}>;
|
|
81
|
-
findTopCategories(payload: CategoryQueryForTopCategories): Promise<{
|
|
82
|
-
meta: {
|
|
83
|
-
cache: {
|
|
84
|
-
hit: false;
|
|
85
|
-
key: string;
|
|
86
|
-
};
|
|
87
|
-
placeholder: false;
|
|
88
|
-
};
|
|
53
|
+
}>>;
|
|
54
|
+
findTopCategories(payload: CategoryQueryForTopCategories): Promise<import("@reactionary/core").Ok<{
|
|
89
55
|
pageNumber: number;
|
|
90
56
|
pageSize: number;
|
|
91
57
|
totalCount: number;
|
|
92
58
|
totalPages: number;
|
|
93
59
|
items: {
|
|
94
|
-
meta: {
|
|
95
|
-
cache: {
|
|
96
|
-
hit: boolean;
|
|
97
|
-
key: string;
|
|
98
|
-
};
|
|
99
|
-
placeholder: boolean;
|
|
100
|
-
};
|
|
101
60
|
identifier: {
|
|
102
61
|
key: string;
|
|
103
62
|
};
|
|
@@ -114,45 +73,18 @@ export declare class CommercetoolsCategoryProvider extends CategoryProvider {
|
|
|
114
73
|
key: string;
|
|
115
74
|
} | undefined;
|
|
116
75
|
}[];
|
|
117
|
-
}
|
|
118
|
-
items: never[];
|
|
119
|
-
meta: {
|
|
120
|
-
cache: {
|
|
121
|
-
hit: false;
|
|
122
|
-
key: string;
|
|
123
|
-
};
|
|
124
|
-
placeholder: true;
|
|
125
|
-
};
|
|
126
|
-
pageNumber: number;
|
|
127
|
-
pageSize: number;
|
|
128
|
-
totalCount: number;
|
|
129
|
-
totalPages: number;
|
|
130
|
-
}>;
|
|
76
|
+
}>>;
|
|
131
77
|
/**
|
|
132
78
|
* Handler for parsing a response from a remote provider and converting it
|
|
133
79
|
* into the typed domain model.
|
|
134
80
|
*/
|
|
135
81
|
protected parseSingle(_body: unknown): Category;
|
|
136
82
|
protected parsePaginatedResult(_body: unknown): {
|
|
137
|
-
meta: {
|
|
138
|
-
cache: {
|
|
139
|
-
hit: false;
|
|
140
|
-
key: string;
|
|
141
|
-
};
|
|
142
|
-
placeholder: false;
|
|
143
|
-
};
|
|
144
83
|
pageNumber: number;
|
|
145
84
|
pageSize: number;
|
|
146
85
|
totalCount: number;
|
|
147
86
|
totalPages: number;
|
|
148
87
|
items: {
|
|
149
|
-
meta: {
|
|
150
|
-
cache: {
|
|
151
|
-
hit: boolean;
|
|
152
|
-
key: string;
|
|
153
|
-
};
|
|
154
|
-
placeholder: boolean;
|
|
155
|
-
};
|
|
156
88
|
identifier: {
|
|
157
89
|
key: string;
|
|
158
90
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address as CTAddress, Cart as CTCart, Payment as CTPayment, LineItem, MyCartUpdateAction } from '@commercetools/platform-sdk';
|
|
2
|
-
import type { Address, Cache, Checkout, CheckoutIdentifier, CheckoutItem, CheckoutMutationAddPaymentInstruction, CheckoutMutationFinalizeCheckout, CheckoutMutationInitiateCheckout, CheckoutMutationRemovePaymentInstruction, CheckoutMutationSetShippingAddress, CheckoutMutationSetShippingInstruction, CheckoutQueryById, CheckoutQueryForAvailablePaymentMethods, CheckoutQueryForAvailableShippingMethods, CostBreakDown, PaymentInstruction, PaymentMethod, RequestContext, ShippingInstruction, ShippingMethod } from '@reactionary/core';
|
|
2
|
+
import type { Address, Cache, Checkout, CheckoutIdentifier, CheckoutItem, CheckoutMutationAddPaymentInstruction, CheckoutMutationFinalizeCheckout, CheckoutMutationInitiateCheckout, CheckoutMutationRemovePaymentInstruction, CheckoutMutationSetShippingAddress, CheckoutMutationSetShippingInstruction, CheckoutQueryById, CheckoutQueryForAvailablePaymentMethods, CheckoutQueryForAvailableShippingMethods, CostBreakDown, NotFoundError, PaymentInstruction, PaymentMethod, RequestContext, Result, ShippingInstruction, ShippingMethod } from '@reactionary/core';
|
|
3
3
|
import { CheckoutProvider } from '@reactionary/core';
|
|
4
4
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
5
5
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
@@ -17,15 +17,15 @@ export declare class CommercetoolsCheckoutProvider extends CheckoutProvider {
|
|
|
17
17
|
shippingMethods: import("@commercetools/platform-sdk").ByProjectKeyShippingMethodsRequestBuilder;
|
|
18
18
|
orders: import("@commercetools/platform-sdk").ByProjectKeyMeOrdersRequestBuilder;
|
|
19
19
|
}>;
|
|
20
|
-
initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Checkout
|
|
21
|
-
getById(payload: CheckoutQueryById): Promise<Checkout
|
|
22
|
-
setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Checkout
|
|
23
|
-
getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<ShippingMethod[]
|
|
24
|
-
getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<PaymentMethod[]
|
|
25
|
-
addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Checkout
|
|
26
|
-
removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Checkout
|
|
27
|
-
setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Checkout
|
|
28
|
-
finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Checkout
|
|
20
|
+
initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Result<Checkout>>;
|
|
21
|
+
getById(payload: CheckoutQueryById): Promise<Result<Checkout, NotFoundError>>;
|
|
22
|
+
setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Result<Checkout>>;
|
|
23
|
+
getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<Result<ShippingMethod[]>>;
|
|
24
|
+
getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<Result<PaymentMethod[]>>;
|
|
25
|
+
addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Result<Checkout>>;
|
|
26
|
+
removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Result<Checkout>>;
|
|
27
|
+
setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Result<Checkout>>;
|
|
28
|
+
finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Result<Checkout>>;
|
|
29
29
|
protected applyActions(checkout: CheckoutIdentifier, actions: MyCartUpdateAction[]): Promise<Checkout>;
|
|
30
30
|
/**
|
|
31
31
|
* Extension point, to allow filtering the options, or adding new ones, like invoicing for b2b.
|
|
@@ -49,13 +49,6 @@ export declare class CommercetoolsCheckoutProvider extends CheckoutProvider {
|
|
|
49
49
|
identifier: {
|
|
50
50
|
nickName: string;
|
|
51
51
|
};
|
|
52
|
-
meta: {
|
|
53
|
-
cache: {
|
|
54
|
-
hit: false;
|
|
55
|
-
key: string;
|
|
56
|
-
};
|
|
57
|
-
placeholder: false;
|
|
58
|
-
};
|
|
59
52
|
region: string;
|
|
60
53
|
};
|
|
61
54
|
protected parseShippingInstruction(remote: CTCart): ShippingInstruction | undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type Identity, type IdentityMutationLogin, type IdentityQuerySelf, type RequestContext, type Cache, IdentityProvider, type IdentityMutationRegister } from '@reactionary/core';
|
|
1
|
+
import { type Identity, type IdentityMutationLogin, type IdentityQuerySelf, type RequestContext, type Cache, IdentityProvider, type IdentityMutationRegister, type Result } from '@reactionary/core';
|
|
2
2
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
3
3
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
4
4
|
export declare class CommercetoolsIdentityProvider extends IdentityProvider {
|
|
5
5
|
protected config: CommercetoolsConfiguration;
|
|
6
6
|
protected client: CommercetoolsClient;
|
|
7
7
|
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
|
|
8
|
-
getSelf(payload: IdentityQuerySelf): Promise<Identity
|
|
9
|
-
login(payload: IdentityMutationLogin): Promise<Identity
|
|
10
|
-
logout(payload: Record<string, never>): Promise<Identity
|
|
11
|
-
register(payload: IdentityMutationRegister): Promise<Identity
|
|
8
|
+
getSelf(payload: IdentityQuerySelf): Promise<Result<Identity>>;
|
|
9
|
+
login(payload: IdentityMutationLogin): Promise<Result<Identity>>;
|
|
10
|
+
logout(payload: Record<string, never>): Promise<Result<Identity>>;
|
|
11
|
+
register(payload: IdentityMutationRegister): Promise<Result<Identity>>;
|
|
12
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Inventory, RequestContext, Cache, InventoryQueryBySKU } from '@reactionary/core';
|
|
1
|
+
import type { Inventory, RequestContext, Cache, InventoryQueryBySKU, Result, NotFoundError } from '@reactionary/core';
|
|
2
2
|
import { InventoryProvider } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { InventoryEntry } from '@commercetools/platform-sdk';
|
|
@@ -8,6 +8,6 @@ export declare class CommercetoolsInventoryProvider extends InventoryProvider {
|
|
|
8
8
|
protected client: CommercetoolsClient;
|
|
9
9
|
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
|
|
10
10
|
protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
|
|
11
|
-
getBySKU(payload: InventoryQueryBySKU): Promise<Inventory
|
|
11
|
+
getBySKU(payload: InventoryQueryBySKU): Promise<Result<Inventory, NotFoundError>>;
|
|
12
12
|
protected parseSingle(body: InventoryEntry): Inventory;
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestContext, Cache, Order, OrderQueryById } from '@reactionary/core';
|
|
1
|
+
import type { RequestContext, Cache, Order, OrderQueryById, Result, NotFoundError } from '@reactionary/core';
|
|
2
2
|
import { OrderProvider } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
@@ -7,6 +7,6 @@ export declare class CommercetoolsOrderProvider extends OrderProvider {
|
|
|
7
7
|
protected client: CommercetoolsClient;
|
|
8
8
|
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
|
|
9
9
|
protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyMeOrdersRequestBuilder>;
|
|
10
|
-
getById(payload: OrderQueryById): Promise<Order
|
|
10
|
+
getById(payload: OrderQueryById): Promise<Result<Order, NotFoundError>>;
|
|
11
11
|
protected parseSingle(_body: unknown): Order;
|
|
12
12
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { PriceProvider } from '@reactionary/core';
|
|
2
|
-
import type { RequestContext, Price, Cache, CustomerPriceQuery, ListPriceQuery } from '@reactionary/core';
|
|
2
|
+
import type { RequestContext, Price, Cache, CustomerPriceQuery, ListPriceQuery, Result } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
5
5
|
export declare class CommercetoolsPriceProvider extends PriceProvider {
|
|
6
6
|
protected config: CommercetoolsConfiguration;
|
|
7
7
|
protected client: CommercetoolsClient;
|
|
8
8
|
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
|
|
9
|
-
getCustomerPrice(payload: CustomerPriceQuery): Promise<Price
|
|
10
|
-
getListPrice(payload: ListPriceQuery): Promise<Price
|
|
9
|
+
getCustomerPrice(payload: CustomerPriceQuery): Promise<Result<Price>>;
|
|
10
|
+
getListPrice(payload: ListPriceQuery): Promise<Result<Price>>;
|
|
11
11
|
protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
|
|
12
12
|
protected parseSingle(_body: unknown, options?: {
|
|
13
13
|
includeDiscounts: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProductSearchFacetResult as CTProductSearchFacetResult, ProductVariant as CTProductVariant, ProductPagedSearchResponse, ProductProjection, ProductSearchFacetExpression } from '@commercetools/platform-sdk';
|
|
2
|
-
import type { Cache, FacetIdentifier, FacetValueIdentifier, ProductSearchQueryByTerm, ProductSearchQueryCreateNavigationFilter, ProductSearchResult, ProductSearchResultFacet, ProductSearchResultFacetValue, ProductSearchResultItemVariant, RequestContext } from '@reactionary/core';
|
|
2
|
+
import type { Cache, FacetIdentifier, FacetValueIdentifier, ProductSearchQueryByTerm, ProductSearchQueryCreateNavigationFilter, ProductSearchResult, ProductSearchResultFacet, ProductSearchResultFacetValue, ProductSearchResultItemVariant, RequestContext, Result } from '@reactionary/core';
|
|
3
3
|
import { ProductSearchProvider } from '@reactionary/core';
|
|
4
4
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
5
5
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
@@ -74,8 +74,8 @@ export declare class CommercetoolsSearchProvider extends ProductSearchProvider {
|
|
|
74
74
|
})[];
|
|
75
75
|
} | undefined>;
|
|
76
76
|
protected getFacetsToReturn(payload: ProductSearchQueryByTerm): Promise<ProductSearchFacetExpression[]>;
|
|
77
|
-
createCategoryNavigationFilter(payload: ProductSearchQueryCreateNavigationFilter): Promise<FacetValueIdentifier
|
|
78
|
-
queryByTerm(payload: ProductSearchQueryByTerm): Promise<ProductSearchResult
|
|
77
|
+
createCategoryNavigationFilter(payload: ProductSearchQueryCreateNavigationFilter): Promise<Result<FacetValueIdentifier>>;
|
|
78
|
+
queryByTerm(payload: ProductSearchQueryByTerm): Promise<Result<ProductSearchResult>>;
|
|
79
79
|
protected patchCategoryFacetValues(result: ProductSearchResult): Promise<void>;
|
|
80
80
|
protected parseSingle(body: ProductProjection): {
|
|
81
81
|
identifier: {
|
|
@@ -109,13 +109,6 @@ export declare class CommercetoolsSearchProvider extends ProductSearchProvider {
|
|
|
109
109
|
};
|
|
110
110
|
} | undefined;
|
|
111
111
|
}[];
|
|
112
|
-
meta: {
|
|
113
|
-
cache: {
|
|
114
|
-
hit: false;
|
|
115
|
-
key: string;
|
|
116
|
-
};
|
|
117
|
-
placeholder: false;
|
|
118
|
-
};
|
|
119
112
|
};
|
|
120
113
|
protected parsePaginatedResult(body: ProductPagedSearchResponse, query: ProductSearchQueryByTerm): {
|
|
121
114
|
identifier: {
|
|
@@ -138,25 +131,11 @@ export declare class CommercetoolsSearchProvider extends ProductSearchProvider {
|
|
|
138
131
|
key: string;
|
|
139
132
|
} | undefined;
|
|
140
133
|
};
|
|
141
|
-
meta: {
|
|
142
|
-
cache: {
|
|
143
|
-
hit: false;
|
|
144
|
-
key: string;
|
|
145
|
-
};
|
|
146
|
-
placeholder: false;
|
|
147
|
-
};
|
|
148
134
|
pageNumber: number;
|
|
149
135
|
pageSize: number;
|
|
150
136
|
totalCount: number;
|
|
151
137
|
totalPages: number;
|
|
152
138
|
items: {
|
|
153
|
-
meta: {
|
|
154
|
-
cache: {
|
|
155
|
-
hit: boolean;
|
|
156
|
-
key: string;
|
|
157
|
-
};
|
|
158
|
-
placeholder: boolean;
|
|
159
|
-
};
|
|
160
139
|
identifier: {
|
|
161
140
|
key: string;
|
|
162
141
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { ProductProvider } from '@reactionary/core';
|
|
2
2
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
3
3
|
import type { ProductProjection, ProductVariant as CTProductVariant, Attribute as CTAttribute } from '@commercetools/platform-sdk';
|
|
4
|
-
import type { Product, ProductVariant, ProductQueryById, ProductQueryBySKU, ProductQueryBySlug, RequestContext, ProductAttribute, ProductAttributeValue } from '@reactionary/core';
|
|
4
|
+
import type { Product, ProductVariant, ProductQueryById, ProductQueryBySKU, ProductQueryBySlug, RequestContext, ProductAttribute, ProductAttributeValue, Result } from '@reactionary/core';
|
|
5
5
|
import type { Cache } from '@reactionary/core';
|
|
6
6
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
7
|
+
import type { NotFoundError } from '@reactionary/core';
|
|
7
8
|
export declare class CommercetoolsProductProvider extends ProductProvider {
|
|
8
9
|
protected config: CommercetoolsConfiguration;
|
|
9
10
|
protected client: CommercetoolsClient;
|
|
10
11
|
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
|
|
11
12
|
protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyProductProjectionsRequestBuilder>;
|
|
12
|
-
getById(payload: ProductQueryById): Promise<Product
|
|
13
|
-
getBySlug(payload: ProductQueryBySlug): Promise<Product
|
|
14
|
-
getBySKU(payload: ProductQueryBySKU): Promise<Product
|
|
13
|
+
getById(payload: ProductQueryById): Promise<Result<Product>>;
|
|
14
|
+
getBySlug(payload: ProductQueryBySlug): Promise<Result<Product, NotFoundError>>;
|
|
15
|
+
getBySKU(payload: ProductQueryBySKU): Promise<Result<Product>>;
|
|
15
16
|
protected parseSingle(data: ProductProjection): Product;
|
|
16
17
|
/**
|
|
17
18
|
* Return true, if the attribute is a defining attribute (ie an option)
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
import type { Profile, ProfileMutationUpdate, ProfileQuerySelf, RequestContext } from '@reactionary/core';
|
|
1
|
+
import type { Profile, ProfileMutationAddShippingAddress, ProfileMutationMakeShippingAddressDefault, ProfileMutationRemoveShippingAddress, ProfileMutationSetBillingAddress, ProfileMutationUpdate, ProfileQuerySelf, RequestContext, Result, NotFoundError, Address, ProfileMutationUpdateShippingAddress } from '@reactionary/core';
|
|
2
2
|
import { ProfileProvider } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { Cache } from '@reactionary/core';
|
|
5
|
-
import type { Customer } from '@commercetools/platform-sdk';
|
|
5
|
+
import type { Customer, Address as CTAddress } from '@commercetools/platform-sdk';
|
|
6
6
|
import type { CommercetoolsClient } from '../core/client.js';
|
|
7
7
|
export declare class CommercetoolsProfileProvider extends ProfileProvider {
|
|
8
8
|
protected config: CommercetoolsConfiguration;
|
|
9
9
|
protected client: CommercetoolsClient;
|
|
10
10
|
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
|
|
11
11
|
protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
getById(payload: ProfileQuerySelf): Promise<Result<Profile, NotFoundError>>;
|
|
13
|
+
addShippingAddress(payload: ProfileMutationAddShippingAddress): Promise<Result<Profile, NotFoundError>>;
|
|
14
|
+
updateShippingAddress(payload: ProfileMutationUpdateShippingAddress): Promise<Result<Profile, NotFoundError>>;
|
|
15
|
+
removeShippingAddress(payload: ProfileMutationRemoveShippingAddress): Promise<Result<Profile, NotFoundError>>;
|
|
16
|
+
makeShippingAddressDefault(payload: ProfileMutationMakeShippingAddressDefault): Promise<Result<Profile, NotFoundError>>;
|
|
17
|
+
setBillingAddress(payload: ProfileMutationSetBillingAddress): Promise<Result<Profile, NotFoundError>>;
|
|
18
|
+
update(payload: ProfileMutationUpdate): Promise<Result<Profile, NotFoundError>>;
|
|
19
|
+
protected parseAddress(address: CTAddress): Address;
|
|
14
20
|
protected parseSingle(body: Customer): Profile;
|
|
21
|
+
protected createCTAddressDraft(address: Address): CTAddress;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if an address only contains phone information and lacks essential address fields.
|
|
24
|
+
* An address is considered incomplete if it exists but has no firstName, lastName, streetName,
|
|
25
|
+
* streetNumber, or city.
|
|
26
|
+
* @param address - The address to check, or undefined
|
|
27
|
+
* @returns true if the address exists but lacks essential fields, false otherwise (including when address is undefined)
|
|
28
|
+
*/
|
|
29
|
+
protected isIncompleteAddress(address: CTAddress | undefined): boolean;
|
|
15
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestContext, Cache, StoreQueryByProximity, Store } from '@reactionary/core';
|
|
1
|
+
import type { RequestContext, Cache, StoreQueryByProximity, Store, Result } from '@reactionary/core';
|
|
2
2
|
import { StoreProvider } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { Channel } from '@commercetools/platform-sdk';
|
|
@@ -8,6 +8,6 @@ export declare class CommercetoolsStoreProvider extends StoreProvider {
|
|
|
8
8
|
protected client: CommercetoolsClient;
|
|
9
9
|
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
|
|
10
10
|
protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
|
|
11
|
-
queryByProximity(payload: StoreQueryByProximity): Promise<Array<Store
|
|
11
|
+
queryByProximity(payload: StoreQueryByProximity): Promise<Result<Array<Store>>>;
|
|
12
12
|
protected parseSingle(body: Channel): Store;
|
|
13
13
|
}
|
|
@@ -2,14 +2,14 @@ import type { z } from 'zod';
|
|
|
2
2
|
export declare const CommercetoolsCapabilitiesSchema: z.ZodObject<{
|
|
3
3
|
price: z.ZodOptional<z.ZodBoolean>;
|
|
4
4
|
product: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
-
identity: z.ZodOptional<z.ZodBoolean>;
|
|
6
5
|
cart: z.ZodOptional<z.ZodBoolean>;
|
|
7
6
|
checkout: z.ZodOptional<z.ZodBoolean>;
|
|
8
7
|
order: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
-
|
|
8
|
+
identity: z.ZodOptional<z.ZodBoolean>;
|
|
10
9
|
inventory: z.ZodOptional<z.ZodBoolean>;
|
|
11
10
|
category: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
-
store: z.ZodOptional<z.ZodBoolean>;
|
|
13
11
|
profile: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
store: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
productSearch: z.ZodOptional<z.ZodBoolean>;
|
|
14
14
|
}, z.core.$loose>;
|
|
15
15
|
export type CommercetoolsCapabilities = z.infer<typeof CommercetoolsCapabilitiesSchema>;
|
|
@@ -18,13 +18,6 @@ export declare const CommercetoolsResolveCategoryQueryByIdSchema: z.ZodObject<{
|
|
|
18
18
|
id: z.ZodString;
|
|
19
19
|
}, z.core.$strip>;
|
|
20
20
|
export declare const CommercetoolsCategoryLookupSchema: z.ZodObject<{
|
|
21
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
22
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
23
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
24
|
-
key: z.ZodDefault<z.ZodString>;
|
|
25
|
-
}, z.core.$loose>>;
|
|
26
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
-
}, z.core.$loose>>;
|
|
28
21
|
id: z.ZodString;
|
|
29
22
|
key: z.ZodOptional<z.ZodString>;
|
|
30
23
|
name: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
@@ -7,13 +7,6 @@ export declare const CommercetoolsConfigurationSchema: z.ZodObject<{
|
|
|
7
7
|
clientSecret: z.ZodString;
|
|
8
8
|
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
9
9
|
paymentMethods: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
11
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
12
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
-
key: z.ZodDefault<z.ZodString>;
|
|
14
|
-
}, z.core.$loose>>;
|
|
15
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
-
}, z.core.$loose>>;
|
|
17
10
|
identifier: z.ZodObject<{
|
|
18
11
|
method: z.ZodString;
|
|
19
12
|
name: z.ZodString;
|