@reactionary/provider-commercetools 0.0.69 → 0.0.71

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  import { ClientBuilder } from "@commercetools/ts-client";
2
- import { createApiBuilderFromCtpClient } from "@commercetools/platform-sdk";
2
+ import {
3
+ createApiBuilderFromCtpClient
4
+ } from "@commercetools/platform-sdk";
3
5
  import { randomUUID } from "crypto";
4
6
  import {
5
7
  AnonymousIdentitySchema,
@@ -22,13 +24,29 @@ class CommercetoolsClient {
22
24
  }
23
25
  return this.client;
24
26
  }
27
+ async getAdminClient() {
28
+ if (!this.adminClient) {
29
+ this.adminClient = this.createAdminClient();
30
+ }
31
+ return this.adminClient;
32
+ }
33
+ async createAdminClient() {
34
+ let builder = this.createBaseClientBuilder();
35
+ builder = builder.withAnonymousSessionFlow({
36
+ credentials: {
37
+ clientId: this.config.clientId,
38
+ clientSecret: this.config.clientSecret
39
+ },
40
+ host: this.config.authUrl,
41
+ projectKey: this.config.projectKey
42
+ });
43
+ return createApiBuilderFromCtpClient(builder.build());
44
+ }
25
45
  async createClient() {
26
46
  let session = await this.cache.get();
27
47
  const isNewSession = !session || !session.refreshToken;
28
48
  if (isNewSession) {
29
- console.log("creating new session...");
30
49
  await this.becomeGuest();
31
- console.log("new session created!");
32
50
  session = await this.cache.get();
33
51
  }
34
52
  let builder = this.createBaseClientBuilder();
@@ -6,7 +6,8 @@ import {
6
6
  ProductSchema,
7
7
  CategorySchema,
8
8
  CheckoutSchema,
9
- ProductSearchResultItemSchema
9
+ ProductSearchResultItemSchema,
10
+ ProfileSchema
10
11
  } from "@reactionary/core";
11
12
  import { CommercetoolsCapabilitiesSchema } from "../schema/capabilities.schema.js";
12
13
  import { CommercetoolsSearchProvider } from "../providers/product-search.provider.js";
@@ -17,7 +18,7 @@ import { CommercetoolsCartProvider } from "../providers/cart.provider.js";
17
18
  import { CommercetoolsInventoryProvider } from "../providers/inventory.provider.js";
18
19
  import { CommercetoolsPriceProvider } from "../providers/price.provider.js";
19
20
  import { CommercetoolsCategoryProvider } from "../providers/category.provider.js";
20
- import { CommercetoolsCheckoutProvider } from "../providers/index.js";
21
+ import { CommercetoolsCheckoutProvider, CommercetoolsProfileProvider } from "../providers/index.js";
21
22
  import { CommercetoolsClient } from "./client.js";
22
23
  function withCommercetoolsCapabilities(configuration, capabilities) {
23
24
  return (cache, context) => {
@@ -28,6 +29,9 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
28
29
  if (caps.product) {
29
30
  client.product = new CommercetoolsProductProvider(config, ProductSchema, cache, context, commercetoolsClient);
30
31
  }
32
+ if (caps.profile) {
33
+ client.profile = new CommercetoolsProfileProvider(config, ProfileSchema, cache, context, commercetoolsClient);
34
+ }
31
35
  if (caps.productSearch) {
32
36
  client.productSearch = new CommercetoolsSearchProvider(config, ProductSearchResultItemSchema, cache, context, commercetoolsClient);
33
37
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@reactionary/provider-commercetools",
3
- "version": "0.0.69",
3
+ "version": "0.0.71",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.0.69",
7
+ "@reactionary/core": "0.0.71",
8
8
  "debug": "^4.4.3",
9
9
  "zod": "4.1.9",
10
10
  "@commercetools/ts-client": "^4.2.1",
@@ -1,4 +1,15 @@
1
- import { CartItemSchema, CartProvider } from "@reactionary/core";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import { CartIdentifierSchema, CartItemSchema, CartMutationApplyCouponSchema, CartMutationChangeCurrencySchema, CartMutationCheckoutSchema, CartMutationDeleteCartSchema, CartMutationItemAddSchema, CartMutationItemQuantityChangeSchema, CartMutationItemRemoveSchema, CartMutationRemoveCouponSchema, CartMutationSetBillingAddressSchema, CartMutationSetShippingInfoSchema, CartProvider, CartQueryByIdSchema, CartSchema, OrderIdentifierSchema, Reactionary } from "@reactionary/core";
2
13
  import {
3
14
  CommercetoolsCartIdentifierSchema,
4
15
  CommercetoolsOrderIdentifierSchema
@@ -353,6 +364,77 @@ class CommercetoolsCartProvider extends CartProvider {
353
364
  return this.assert(result);
354
365
  }
355
366
  }
367
+ __decorateClass([
368
+ Reactionary({
369
+ inputSchema: CartQueryByIdSchema,
370
+ outputSchema: CartSchema
371
+ })
372
+ ], CommercetoolsCartProvider.prototype, "getById", 1);
373
+ __decorateClass([
374
+ Reactionary({
375
+ inputSchema: CartMutationItemAddSchema,
376
+ outputSchema: CartSchema
377
+ })
378
+ ], CommercetoolsCartProvider.prototype, "add", 1);
379
+ __decorateClass([
380
+ Reactionary({
381
+ inputSchema: CartMutationItemRemoveSchema,
382
+ outputSchema: CartSchema
383
+ })
384
+ ], CommercetoolsCartProvider.prototype, "remove", 1);
385
+ __decorateClass([
386
+ Reactionary({
387
+ inputSchema: CartMutationItemQuantityChangeSchema,
388
+ outputSchema: CartSchema
389
+ })
390
+ ], CommercetoolsCartProvider.prototype, "changeQuantity", 1);
391
+ __decorateClass([
392
+ Reactionary({
393
+ outputSchema: CartIdentifierSchema
394
+ })
395
+ ], CommercetoolsCartProvider.prototype, "getActiveCartId", 1);
396
+ __decorateClass([
397
+ Reactionary({
398
+ inputSchema: CartMutationDeleteCartSchema,
399
+ outputSchema: CartSchema
400
+ })
401
+ ], CommercetoolsCartProvider.prototype, "deleteCart", 1);
402
+ __decorateClass([
403
+ Reactionary({
404
+ inputSchema: CartMutationSetShippingInfoSchema,
405
+ outputSchema: CartSchema
406
+ })
407
+ ], CommercetoolsCartProvider.prototype, "setShippingInfo", 1);
408
+ __decorateClass([
409
+ Reactionary({
410
+ inputSchema: CartMutationSetBillingAddressSchema,
411
+ outputSchema: CartSchema
412
+ })
413
+ ], CommercetoolsCartProvider.prototype, "setBillingAddress", 1);
414
+ __decorateClass([
415
+ Reactionary({
416
+ inputSchema: CartMutationApplyCouponSchema,
417
+ outputSchema: CartSchema
418
+ })
419
+ ], CommercetoolsCartProvider.prototype, "applyCouponCode", 1);
420
+ __decorateClass([
421
+ Reactionary({
422
+ inputSchema: CartMutationRemoveCouponSchema,
423
+ outputSchema: CartSchema
424
+ })
425
+ ], CommercetoolsCartProvider.prototype, "removeCouponCode", 1);
426
+ __decorateClass([
427
+ Reactionary({
428
+ inputSchema: CartMutationCheckoutSchema,
429
+ outputSchema: OrderIdentifierSchema
430
+ })
431
+ ], CommercetoolsCartProvider.prototype, "checkout", 1);
432
+ __decorateClass([
433
+ Reactionary({
434
+ inputSchema: CartMutationChangeCurrencySchema,
435
+ outputSchema: CartSchema
436
+ })
437
+ ], CommercetoolsCartProvider.prototype, "changeCurrency", 1);
356
438
  export {
357
439
  CommercetoolsCartProvider
358
440
  };
@@ -1,4 +1,27 @@
1
- import { CategoryProvider, createPaginatedResponseSchema } from "@reactionary/core";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ CategoryPaginatedResultSchema,
14
+ CategoryProvider,
15
+ CategoryQueryByIdSchema,
16
+ CategoryQueryBySlugSchema,
17
+ CategoryQueryForBreadcrumbSchema,
18
+ CategoryQueryForChildCategoriesSchema,
19
+ CategoryQueryForTopCategoriesSchema,
20
+ CategorySchema,
21
+ createPaginatedResponseSchema,
22
+ Reactionary
23
+ } from "@reactionary/core";
24
+ import z from "zod";
2
25
  class CommercetoolsCategoryProvider extends CategoryProvider {
3
26
  constructor(config, schema, cache, context, client) {
4
27
  super(schema, cache, context);
@@ -9,12 +32,6 @@ class CommercetoolsCategoryProvider extends CategoryProvider {
9
32
  const client = await this.client.getClient();
10
33
  return client.withProjectKey({ projectKey: this.config.projectKey }).categories();
11
34
  }
12
- /**
13
- * Look it up by the category ID (key in commercetools), and if not there, return a placeholder.
14
- * @param id
15
- * @param session
16
- * @returns
17
- */
18
35
  async getById(payload) {
19
36
  const client = await this.getClient();
20
37
  try {
@@ -27,12 +44,6 @@ class CommercetoolsCategoryProvider extends CategoryProvider {
27
44
  return dummyCategory;
28
45
  }
29
46
  }
30
- /**
31
- * Resolve the category by slug, in the users current locale.
32
- * @param slug
33
- * @param session
34
- * @returns
35
- */
36
47
  async getBySlug(payload) {
37
48
  const client = await this.getClient();
38
49
  try {
@@ -54,13 +65,6 @@ class CommercetoolsCategoryProvider extends CategoryProvider {
54
65
  return null;
55
66
  }
56
67
  }
57
- /**
58
- * Returns the breadcrumb path to the category, i.e. all parents up to the root.
59
- * The returned order is from root to leaf.
60
- * @param id
61
- * @param session
62
- * @returns
63
- */
64
68
  async getBreadcrumbPathToCategory(payload) {
65
69
  const client = await this.getClient();
66
70
  const path = [];
@@ -77,24 +81,15 @@ class CommercetoolsCategoryProvider extends CategoryProvider {
77
81
  path.push(parsedAnc);
78
82
  }
79
83
  }
80
- ;
81
84
  path.push(category);
82
85
  } catch (error) {
83
- console.error(`Error fetching category path for ${payload.id.key}:`, error);
86
+ console.error(
87
+ `Error fetching category path for ${payload.id.key}:`,
88
+ error
89
+ );
84
90
  }
85
91
  return path;
86
92
  }
87
- /**
88
- * Returns a page of child categories for the given parent category ID.
89
- * You must provide the pagination options to control the size of the result set.
90
- * If you expect your frontend will load many many categories, consider adding a "load more" button, or lazy load the next page.
91
- *
92
- * This is cached by ID + page number + page size + locale + store
93
- * @param id
94
- * @param paginationOptions
95
- * @param session
96
- * @returns
97
- */
98
93
  async findChildCategories(payload) {
99
94
  const client = await this.getClient();
100
95
  try {
@@ -111,12 +106,21 @@ class CommercetoolsCategoryProvider extends CategoryProvider {
111
106
  }).execute();
112
107
  const result = this.parsePaginatedResult(response.body);
113
108
  result.meta = {
114
- cache: { hit: false, key: this.generateCacheKeyPaginatedResult("children-of-" + payload.parentId.key, result) },
109
+ cache: {
110
+ hit: false,
111
+ key: this.generateCacheKeyPaginatedResult(
112
+ "children-of-" + payload.parentId.key,
113
+ result
114
+ )
115
+ },
115
116
  placeholder: false
116
117
  };
117
118
  return result;
118
119
  } catch (error) {
119
- console.error(`Error fetching category path for ${payload.parentId.key}:`, error);
120
+ console.error(
121
+ `Error fetching category path for ${payload.parentId.key}:`,
122
+ error
123
+ );
120
124
  }
121
125
  return createPaginatedResponseSchema(this.schema).parse({});
122
126
  }
@@ -134,7 +138,10 @@ class CommercetoolsCategoryProvider extends CategoryProvider {
134
138
  }).execute();
135
139
  const result = this.parsePaginatedResult(response.body);
136
140
  result.meta = {
137
- cache: { hit: false, key: this.generateCacheKeyPaginatedResult("top", result) },
141
+ cache: {
142
+ hit: false,
143
+ key: this.generateCacheKeyPaginatedResult("top", result)
144
+ },
138
145
  placeholder: false
139
146
  };
140
147
  return result;
@@ -144,9 +151,9 @@ class CommercetoolsCategoryProvider extends CategoryProvider {
144
151
  return createPaginatedResponseSchema(this.schema).parse({});
145
152
  }
146
153
  /**
147
- * Handler for parsing a response from a remote provider and converting it
148
- * into the typed domain model.
149
- */
154
+ * Handler for parsing a response from a remote provider and converting it
155
+ * into the typed domain model.
156
+ */
150
157
  parseSingle(_body) {
151
158
  const body = _body;
152
159
  const languageContext = this.context.languageContext;
@@ -187,6 +194,36 @@ class CommercetoolsCategoryProvider extends CategoryProvider {
187
194
  return result;
188
195
  }
189
196
  }
197
+ __decorateClass([
198
+ Reactionary({
199
+ inputSchema: CategoryQueryByIdSchema,
200
+ outputSchema: CategorySchema
201
+ })
202
+ ], CommercetoolsCategoryProvider.prototype, "getById", 1);
203
+ __decorateClass([
204
+ Reactionary({
205
+ inputSchema: CategoryQueryBySlugSchema,
206
+ outputSchema: CategorySchema.nullable()
207
+ })
208
+ ], CommercetoolsCategoryProvider.prototype, "getBySlug", 1);
209
+ __decorateClass([
210
+ Reactionary({
211
+ inputSchema: CategoryQueryForBreadcrumbSchema,
212
+ outputSchema: z.array(CategorySchema)
213
+ })
214
+ ], CommercetoolsCategoryProvider.prototype, "getBreadcrumbPathToCategory", 1);
215
+ __decorateClass([
216
+ Reactionary({
217
+ inputSchema: CategoryQueryForChildCategoriesSchema,
218
+ outputSchema: CategoryPaginatedResultSchema
219
+ })
220
+ ], CommercetoolsCategoryProvider.prototype, "findChildCategories", 1);
221
+ __decorateClass([
222
+ Reactionary({
223
+ inputSchema: CategoryQueryForTopCategoriesSchema,
224
+ outputSchema: CategoryPaginatedResultSchema
225
+ })
226
+ ], CommercetoolsCategoryProvider.prototype, "findTopCategories", 1);
190
227
  export {
191
228
  CommercetoolsCategoryProvider
192
229
  };
@@ -1,13 +1,37 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
1
12
  import {
2
13
  AddressSchema,
3
14
  CheckoutItemSchema,
15
+ CheckoutMutationAddPaymentInstructionSchema,
16
+ CheckoutMutationFinalizeCheckoutSchema,
17
+ CheckoutMutationInitiateCheckoutSchema,
18
+ CheckoutMutationRemovePaymentInstructionSchema,
19
+ CheckoutMutationSetShippingAddressSchema,
20
+ CheckoutMutationSetShippingInstructionSchema,
4
21
  CheckoutProvider,
22
+ CheckoutQueryByIdSchema,
23
+ CheckoutQueryForAvailablePaymentMethodsSchema,
24
+ CheckoutQueryForAvailableShippingMethodsSchema,
25
+ CheckoutSchema,
5
26
  PaymentInstructionIdentifierSchema,
6
27
  PaymentInstructionSchema,
7
28
  PaymentMethodIdentifierSchema,
29
+ PaymentMethodSchema,
30
+ Reactionary,
8
31
  ShippingInstructionSchema,
9
32
  ShippingMethodSchema
10
33
  } from "@reactionary/core";
34
+ import z from "zod";
11
35
  import {
12
36
  CommercetoolsCartIdentifierSchema,
13
37
  CommercetoolsCheckoutIdentifierSchema
@@ -38,7 +62,7 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
38
62
  }
39
63
  async initiateCheckoutForCart(payload) {
40
64
  const client = await this.getClient();
41
- const cart = await client.carts.withId({ ID: payload.cart.key }).get().execute();
65
+ const cart = await client.carts.withId({ ID: payload.cart.identifier.key }).get().execute();
42
66
  const replicationResponse = await client.carts.replicate().post({
43
67
  body: {
44
68
  reference: {
@@ -55,7 +79,7 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
55
79
  key: "reactionaryCheckout"
56
80
  },
57
81
  fields: {
58
- commerceToolsCartId: payload.cart.key
82
+ commerceToolsCartId: payload.cart.identifier.key
59
83
  }
60
84
  }
61
85
  ];
@@ -165,9 +189,7 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
165
189
  return result;
166
190
  }
167
191
  async getAvailablePaymentMethods(payload) {
168
- const staticMethods = this.getStaticPaymentMethods(
169
- payload.checkout
170
- );
192
+ const staticMethods = this.getStaticPaymentMethods(payload.checkout);
171
193
  const dynamicMethods = [];
172
194
  return [...staticMethods, ...dynamicMethods];
173
195
  }
@@ -216,14 +238,10 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
216
238
  }
217
239
  async removePaymentInstruction(payload) {
218
240
  const client = await this.getClient();
219
- const checkout = await this.getById(
220
- { identifier: payload.checkout }
221
- );
241
+ const checkout = await this.getById({ identifier: payload.checkout });
222
242
  return checkout;
223
243
  }
224
244
  async setShippingInstruction(payload) {
225
- const client = await this.getClient();
226
- const ctId = payload.checkout;
227
245
  const actions = [];
228
246
  actions.push({
229
247
  action: "setShippingMethod",
@@ -253,9 +271,7 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
253
271
  );
254
272
  }
255
273
  async finalizeCheckout(payload) {
256
- const checkout = await this.getById(
257
- { identifier: payload.checkout }
258
- );
274
+ const checkout = await this.getById({ identifier: payload.checkout });
259
275
  if (!checkout || !checkout.readyForFinalization) {
260
276
  throw new CheckoutNotReadyForFinalizationError(payload.checkout);
261
277
  }
@@ -267,9 +283,7 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
267
283
  version: ctId.version
268
284
  }
269
285
  }).execute();
270
- return this.getById(
271
- { identifier: payload.checkout }
272
- );
286
+ return this.getById({ identifier: payload.checkout });
273
287
  }
274
288
  async applyActions(checkout, actions) {
275
289
  const client = await this.getClient();
@@ -287,7 +301,8 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
287
301
  if (response.error) {
288
302
  console.error(response.error);
289
303
  }
290
- return this.parseSingle(response.body);
304
+ const p = this.parseSingle(response.body);
305
+ return p;
291
306
  } catch (e) {
292
307
  console.error("Error applying actions to cart:", e);
293
308
  throw e;
@@ -318,9 +333,7 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
318
333
  version: 0
319
334
  });
320
335
  if (remote.shippingAddress) {
321
- result.shippingAddress = this.parseAddress(
322
- remote.shippingAddress
323
- );
336
+ result.shippingAddress = this.parseAddress(remote.shippingAddress);
324
337
  }
325
338
  if (remote.billingAddress) {
326
339
  result.billingAddress = this.parseAddress(remote.billingAddress);
@@ -328,9 +341,7 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
328
341
  result.shippingInstruction = this.parseShippingInstruction(remote);
329
342
  for (const p of remote.paymentInfo?.payments || []) {
330
343
  if (p.obj) {
331
- result.paymentInstructions.push(
332
- this.parsePaymentInstruction(p.obj)
333
- );
344
+ result.paymentInstructions.push(this.parsePaymentInstruction(p.obj));
334
345
  }
335
346
  }
336
347
  const grandTotal = remote.totalPrice.centAmount || 0;
@@ -482,6 +493,60 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
482
493
  return shippingInstruction;
483
494
  }
484
495
  }
496
+ __decorateClass([
497
+ Reactionary({
498
+ inputSchema: CheckoutMutationInitiateCheckoutSchema,
499
+ outputSchema: CheckoutSchema
500
+ })
501
+ ], CommercetoolsCheckoutProvider.prototype, "initiateCheckoutForCart", 1);
502
+ __decorateClass([
503
+ Reactionary({
504
+ inputSchema: CheckoutQueryByIdSchema,
505
+ outputSchema: CheckoutSchema.nullable()
506
+ })
507
+ ], CommercetoolsCheckoutProvider.prototype, "getById", 1);
508
+ __decorateClass([
509
+ Reactionary({
510
+ inputSchema: CheckoutMutationSetShippingAddressSchema,
511
+ outputSchema: CheckoutSchema
512
+ })
513
+ ], CommercetoolsCheckoutProvider.prototype, "setShippingAddress", 1);
514
+ __decorateClass([
515
+ Reactionary({
516
+ inputSchema: CheckoutQueryForAvailableShippingMethodsSchema,
517
+ outputSchema: z.array(ShippingMethodSchema)
518
+ })
519
+ ], CommercetoolsCheckoutProvider.prototype, "getAvailableShippingMethods", 1);
520
+ __decorateClass([
521
+ Reactionary({
522
+ inputSchema: CheckoutQueryForAvailablePaymentMethodsSchema,
523
+ outputSchema: z.array(PaymentMethodSchema)
524
+ })
525
+ ], CommercetoolsCheckoutProvider.prototype, "getAvailablePaymentMethods", 1);
526
+ __decorateClass([
527
+ Reactionary({
528
+ inputSchema: CheckoutMutationAddPaymentInstructionSchema,
529
+ outputSchema: CheckoutSchema
530
+ })
531
+ ], CommercetoolsCheckoutProvider.prototype, "addPaymentInstruction", 1);
532
+ __decorateClass([
533
+ Reactionary({
534
+ inputSchema: CheckoutMutationRemovePaymentInstructionSchema,
535
+ outputSchema: CheckoutSchema
536
+ })
537
+ ], CommercetoolsCheckoutProvider.prototype, "removePaymentInstruction", 1);
538
+ __decorateClass([
539
+ Reactionary({
540
+ inputSchema: CheckoutMutationSetShippingInstructionSchema,
541
+ outputSchema: CheckoutSchema
542
+ })
543
+ ], CommercetoolsCheckoutProvider.prototype, "setShippingInstruction", 1);
544
+ __decorateClass([
545
+ Reactionary({
546
+ inputSchema: CheckoutMutationFinalizeCheckoutSchema,
547
+ outputSchema: CheckoutSchema
548
+ })
549
+ ], CommercetoolsCheckoutProvider.prototype, "finalizeCheckout", 1);
485
550
  export {
486
551
  CheckoutNotReadyForFinalizationError,
487
552
  CommercetoolsCheckoutProvider
@@ -1,5 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
1
12
  import {
2
- IdentityProvider
13
+ IdentityProvider,
14
+ Reactionary,
15
+ IdentityQuerySelfSchema,
16
+ IdentitySchema,
17
+ IdentityMutationRegisterSchema,
18
+ IdentityMutationLoginSchema
3
19
  } from "@reactionary/core";
4
20
  class CommercetoolsIdentityProvider extends IdentityProvider {
5
21
  constructor(config, schema, cache, context, client) {
@@ -30,6 +46,29 @@ class CommercetoolsIdentityProvider extends IdentityProvider {
30
46
  return identity;
31
47
  }
32
48
  }
49
+ __decorateClass([
50
+ Reactionary({
51
+ inputSchema: IdentityQuerySelfSchema,
52
+ outputSchema: IdentitySchema
53
+ })
54
+ ], CommercetoolsIdentityProvider.prototype, "getSelf", 1);
55
+ __decorateClass([
56
+ Reactionary({
57
+ inputSchema: IdentityMutationLoginSchema,
58
+ outputSchema: IdentitySchema
59
+ })
60
+ ], CommercetoolsIdentityProvider.prototype, "login", 1);
61
+ __decorateClass([
62
+ Reactionary({
63
+ outputSchema: IdentitySchema
64
+ })
65
+ ], CommercetoolsIdentityProvider.prototype, "logout", 1);
66
+ __decorateClass([
67
+ Reactionary({
68
+ inputSchema: IdentityMutationRegisterSchema,
69
+ outputSchema: IdentitySchema
70
+ })
71
+ ], CommercetoolsIdentityProvider.prototype, "register", 1);
33
72
  export {
34
73
  CommercetoolsIdentityProvider
35
74
  };
@@ -1,4 +1,15 @@
1
- import { InventoryProvider } from "@reactionary/core";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import { InventoryProvider, InventoryQueryBySKUSchema, InventorySchema, Reactionary } from "@reactionary/core";
2
13
  class CommercetoolsInventoryProvider extends InventoryProvider {
3
14
  constructor(config, schema, cache, context, client) {
4
15
  super(schema, cache, context);
@@ -49,6 +60,12 @@ class CommercetoolsInventoryProvider extends InventoryProvider {
49
60
  return this.assert(model);
50
61
  }
51
62
  }
63
+ __decorateClass([
64
+ Reactionary({
65
+ inputSchema: InventoryQueryBySKUSchema,
66
+ outputSchema: InventorySchema
67
+ })
68
+ ], CommercetoolsInventoryProvider.prototype, "getBySKU", 1);
52
69
  export {
53
70
  CommercetoolsInventoryProvider
54
71
  };
@@ -1,4 +1,15 @@
1
- import { OrderItemSchema, OrderProvider } from "@reactionary/core";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import { OrderItemSchema, OrderProvider, OrderQueryByIdSchema, OrderSchema, Reactionary } from "@reactionary/core";
2
13
  import { CommercetoolsOrderIdentifierSchema } from "../schema/commercetools.schema.js";
3
14
  class CommercetoolsOrderProvider extends OrderProvider {
4
15
  constructor(config, schema, cache, context, client) {
@@ -111,6 +122,12 @@ class CommercetoolsOrderProvider extends OrderProvider {
111
122
  return this.assert(result);
112
123
  }
113
124
  }
125
+ __decorateClass([
126
+ Reactionary({
127
+ inputSchema: OrderQueryByIdSchema,
128
+ outputSchema: OrderSchema
129
+ })
130
+ ], CommercetoolsOrderProvider.prototype, "getById", 1);
114
131
  export {
115
132
  CommercetoolsOrderProvider
116
133
  };
@@ -1,4 +1,22 @@
1
- import { PriceProvider, TieredPriceSchema } from "@reactionary/core";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ PriceProvider,
14
+ PriceQueryBySkuSchema,
15
+ PriceSchema,
16
+ Reactionary,
17
+ TieredPriceSchema
18
+ } from "@reactionary/core";
19
+ import z from "zod";
2
20
  class CommercetoolsPriceProvider extends PriceProvider {
3
21
  constructor(config, schema, cache, context, client) {
4
22
  super(schema, cache, context);
@@ -6,40 +24,30 @@ class CommercetoolsPriceProvider extends PriceProvider {
6
24
  this.client = client;
7
25
  }
8
26
  async getClient() {
9
- const client = await this.client.getClient();
10
- return client.withProjectKey({ projectKey: this.config.projectKey }).productProjections();
27
+ const client = await this.client.getAdminClient();
28
+ return client.withProjectKey({ projectKey: this.config.projectKey });
11
29
  }
12
30
  async getBySKUs(payload) {
31
+ throw new Error("Unsupported!");
32
+ }
33
+ async getBySKU(payload) {
13
34
  const client = await this.getClient();
14
35
  const channels = await this.getChannels();
15
- const response = await client.get({
36
+ const response = await client.productProjections().get({
16
37
  queryArgs: {
17
38
  staged: false,
18
39
  priceCountry: this.context.taxJurisdiction.countryCode,
19
40
  priceCustomerGroup: void 0,
20
- // FIXME: Hardcoded value for testing, for now...
21
- priceChannel: "7293d166-27a3-4136-b7c5-7b4dc3cfce40",
41
+ // FIXME: Hardcoded value
42
+ priceChannel: "ee6e75e9-c9ab-4e2f-85f1-d8c734d0cb86",
22
43
  priceCurrency: this.context.languageContext.currencyCode,
23
44
  where: "variants(sku in (:skus)) OR (masterVariant(sku in (:skus))) ",
24
- "var.skus": payload.map((p) => p.variant.sku),
25
- limit: payload.length
45
+ "var.skus": [payload.variant.sku],
46
+ limit: 1
26
47
  }
27
48
  }).execute();
28
- console.log("response: ", response.body);
29
- const result = [];
30
- const allReturnedVariants = [...response.body.results.map((x) => x.variants).flat(), ...response.body.results.map((x) => x.masterVariant).flat()];
31
- for (const p of payload) {
32
- const foundSku = allReturnedVariants.find((v) => v.sku === p.variant.sku);
33
- if (!foundSku) {
34
- result.push(this.createEmptyPriceResult(p.variant.sku));
35
- } else {
36
- result.push(this.parseSingle(foundSku));
37
- }
38
- }
39
- return result;
40
- }
41
- async getBySKU(payload) {
42
- return this.getBySKUs([payload]).then((r) => r[0]);
49
+ const sku = response.body.results[0].masterVariant;
50
+ return this.parseSingle(sku);
43
51
  }
44
52
  parseSingle(_body) {
45
53
  const body = _body;
@@ -76,19 +84,31 @@ class CommercetoolsPriceProvider extends PriceProvider {
76
84
  return this.assert(base);
77
85
  }
78
86
  async getChannels() {
79
- if (!(this.context.session["commercetools"] && this.context.session["commercetools"].offerChannelGUID && this.context.session["commercetools"].listChannelGUID)) {
80
- this.context.session["commercetools"] = {
81
- ...this.context.session["commercetools"],
82
- offerChannelGUID: void 0,
83
- listChannelGUID: void 0
84
- };
85
- }
87
+ const adminClient = await this.client.getAdminClient();
88
+ const offerPriceChannelPromise = adminClient.withProjectKey({ projectKey: this.config.projectKey }).channels().withKey({ key: "Offer Price" }).get().execute();
89
+ const listPriceChannelPromise = adminClient.withProjectKey({ projectKey: this.config.projectKey }).channels().withKey({ key: "List Price" }).get().execute();
90
+ const [offerChannel, listChannel] = await Promise.all([
91
+ offerPriceChannelPromise,
92
+ listPriceChannelPromise
93
+ ]);
86
94
  return {
87
- offerChannelGUID: this.context.session["commercetools"].offerChannelGUID,
88
- listChannelGUID: this.context.session["commercetools"].listChannelGUID
95
+ offer: offerChannel.body.id,
96
+ list: listChannel.body.id
89
97
  };
90
98
  }
91
99
  }
100
+ __decorateClass([
101
+ Reactionary({
102
+ inputSchema: z.array(PriceQueryBySkuSchema),
103
+ outputSchema: z.array(PriceSchema)
104
+ })
105
+ ], CommercetoolsPriceProvider.prototype, "getBySKUs", 1);
106
+ __decorateClass([
107
+ Reactionary({
108
+ inputSchema: PriceQueryBySkuSchema,
109
+ outputSchema: PriceSchema
110
+ })
111
+ ], CommercetoolsPriceProvider.prototype, "getBySKU", 1);
92
112
  export {
93
113
  CommercetoolsPriceProvider
94
114
  };
@@ -1,4 +1,15 @@
1
- import { createPaginatedResponseSchema, FacetIdentifierSchema, FacetValueIdentifierSchema, ImageSchema, ProductOptionIdentifierSchema, ProductSearchProvider, ProductSearchResultFacetSchema, ProductSearchResultFacetValueSchema, ProductSearchResultItemVariantSchema, ProductVariantIdentifierSchema, ProductVariantOptionSchema } from "@reactionary/core";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import { createPaginatedResponseSchema, FacetIdentifierSchema, FacetValueIdentifierSchema, ImageSchema, ProductOptionIdentifierSchema, ProductSearchProvider, ProductSearchQueryByTermSchema, ProductSearchResultFacetSchema, ProductSearchResultFacetValueSchema, ProductSearchResultItemVariantSchema, ProductSearchResultSchema, ProductVariantIdentifierSchema, ProductVariantOptionSchema, Reactionary } from "@reactionary/core";
2
13
  import createDebug from "debug";
3
14
  const debug = createDebug("reactionary:commercetools:search");
4
15
  class CommercetoolsSearchProvider extends ProductSearchProvider {
@@ -118,6 +129,12 @@ class CommercetoolsSearchProvider extends ProductSearchProvider {
118
129
  });
119
130
  }
120
131
  }
132
+ __decorateClass([
133
+ Reactionary({
134
+ inputSchema: ProductSearchQueryByTermSchema,
135
+ outputSchema: ProductSearchResultSchema
136
+ })
137
+ ], CommercetoolsSearchProvider.prototype, "queryByTerm", 1);
121
138
  export {
122
139
  CommercetoolsSearchProvider
123
140
  };
@@ -1,3 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
1
12
  import {
2
13
  ImageSchema,
3
14
  ProductAttributeIdentifierSchema,
@@ -5,8 +16,13 @@ import {
5
16
  ProductAttributeValueIdentifierSchema,
6
17
  ProductAttributeValueSchema,
7
18
  ProductProvider,
19
+ ProductQueryByIdSchema,
20
+ ProductQueryBySKUSchema,
21
+ ProductQueryBySlugSchema,
22
+ ProductSchema,
8
23
  ProductVariantIdentifierSchema,
9
- ProductVariantSchema
24
+ ProductVariantSchema,
25
+ Reactionary
10
26
  } from "@reactionary/core";
11
27
  class CommercetoolsProductProvider extends ProductProvider {
12
28
  constructor(config, schema, cache, context, client) {
@@ -75,12 +91,14 @@ class CommercetoolsProductProvider extends ProductProvider {
75
91
  sku: variant.sku
76
92
  }),
77
93
  images: [
78
- ...(variant.images || []).map((img) => ImageSchema.parse({
79
- sourceUrl: img.url,
80
- altText: img.label || "",
81
- width: img.dimensions?.w,
82
- height: img.dimensions?.h
83
- }))
94
+ ...(variant.images || []).map(
95
+ (img) => ImageSchema.parse({
96
+ sourceUrl: img.url,
97
+ altText: img.label || "",
98
+ width: img.dimensions?.w,
99
+ height: img.dimensions?.h
100
+ })
101
+ )
84
102
  ]
85
103
  });
86
104
  return result;
@@ -92,9 +110,7 @@ class CommercetoolsProductProvider extends ProductProvider {
92
110
  }),
93
111
  group: "",
94
112
  name: attr.name,
95
- values: [
96
- this.parseAttributeValue(attr)
97
- ]
113
+ values: [this.parseAttributeValue(attr)]
98
114
  });
99
115
  return result;
100
116
  }
@@ -120,6 +136,24 @@ class CommercetoolsProductProvider extends ProductProvider {
120
136
  return attrVal;
121
137
  }
122
138
  }
139
+ __decorateClass([
140
+ Reactionary({
141
+ inputSchema: ProductQueryByIdSchema,
142
+ outputSchema: ProductSchema
143
+ })
144
+ ], CommercetoolsProductProvider.prototype, "getById", 1);
145
+ __decorateClass([
146
+ Reactionary({
147
+ inputSchema: ProductQueryBySlugSchema,
148
+ outputSchema: ProductSchema.nullable()
149
+ })
150
+ ], CommercetoolsProductProvider.prototype, "getBySlug", 1);
151
+ __decorateClass([
152
+ Reactionary({
153
+ inputSchema: ProductQueryBySKUSchema,
154
+ outputSchema: ProductSchema
155
+ })
156
+ ], CommercetoolsProductProvider.prototype, "getBySKU", 1);
123
157
  export {
124
158
  CommercetoolsProductProvider
125
159
  };
@@ -1,4 +1,21 @@
1
- import { ProfileProvider } from "@reactionary/core";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ ProfileMutationUpdateSchema,
14
+ ProfileProvider,
15
+ ProfileQuerySelfSchema,
16
+ ProfileSchema,
17
+ Reactionary
18
+ } from "@reactionary/core";
2
19
  class CommercetoolsProfileProvider extends ProfileProvider {
3
20
  constructor(config, schema, cache, context, client) {
4
21
  super(schema, cache, context);
@@ -25,6 +42,18 @@ class CommercetoolsProfileProvider extends ProfileProvider {
25
42
  return model;
26
43
  }
27
44
  }
45
+ __decorateClass([
46
+ Reactionary({
47
+ inputSchema: ProfileQuerySelfSchema,
48
+ outputSchema: ProfileSchema
49
+ })
50
+ ], CommercetoolsProfileProvider.prototype, "getSelf", 1);
51
+ __decorateClass([
52
+ Reactionary({
53
+ inputSchema: ProfileMutationUpdateSchema,
54
+ outputSchema: ProfileSchema
55
+ })
56
+ ], CommercetoolsProfileProvider.prototype, "update", 1);
28
57
  export {
29
58
  CommercetoolsProfileProvider
30
59
  };
@@ -1,4 +1,16 @@
1
- import { StoreProvider } from "@reactionary/core";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import { Reactionary, StoreProvider, StoreQueryByProximitySchema, StoreSchema } from "@reactionary/core";
13
+ import z from "zod";
2
14
  class CommercetoolsStoreProvider extends StoreProvider {
3
15
  constructor(config, schema, cache, context, client) {
4
16
  super(schema, cache, context);
@@ -37,6 +49,12 @@ class CommercetoolsStoreProvider extends StoreProvider {
37
49
  return model;
38
50
  }
39
51
  }
52
+ __decorateClass([
53
+ Reactionary({
54
+ inputSchema: StoreQueryByProximitySchema,
55
+ outputSchema: z.array(StoreSchema)
56
+ })
57
+ ], CommercetoolsStoreProvider.prototype, "queryByProximity", 1);
40
58
  export {
41
59
  CommercetoolsStoreProvider
42
60
  };
@@ -9,7 +9,8 @@ const CommercetoolsCapabilitiesSchema = CapabilitiesSchema.pick({
9
9
  inventory: true,
10
10
  price: true,
11
11
  category: true,
12
- store: true
12
+ store: true,
13
+ profile: true
13
14
  }).partial();
14
15
  export {
15
16
  CommercetoolsCapabilitiesSchema
@@ -8,8 +8,11 @@ export declare class CommercetoolsClient {
8
8
  protected context: RequestContext;
9
9
  protected cache: RequestContextTokenCache;
10
10
  protected client: Promise<ApiRoot> | undefined;
11
+ protected adminClient: Promise<ApiRoot> | undefined;
11
12
  constructor(config: CommercetoolsConfiguration, context: RequestContext);
12
13
  getClient(): Promise<ApiRoot>;
14
+ getAdminClient(): Promise<ApiRoot>;
15
+ protected createAdminClient(): Promise<ApiRoot>;
13
16
  protected createClient(): Promise<ApiRoot>;
14
17
  register(username: string, password: string): Promise<{
15
18
  [x: string]: unknown;
@@ -1,4 +1,4 @@
1
- import type { Cache, ProductProvider, ProductSearchProvider, IdentityProvider, CartProvider, InventoryProvider, PriceProvider, CategoryProvider, StoreProvider, CheckoutProvider, OrderProvider, RequestContext } from "@reactionary/core";
1
+ import type { Cache, ProductProvider, ProductSearchProvider, IdentityProvider, CartProvider, InventoryProvider, PriceProvider, CategoryProvider, StoreProvider, CheckoutProvider, OrderProvider, RequestContext, ProfileProvider } from "@reactionary/core";
2
2
  import { type CommercetoolsCapabilities } from "../schema/capabilities.schema.js";
3
3
  import { type CommercetoolsConfiguration } from "../schema/configuration.schema.js";
4
4
  type CommercetoolsProviderSet<T extends CommercetoolsCapabilities> = (T['cart'] extends true ? {
@@ -19,6 +19,8 @@ type CommercetoolsProviderSet<T extends CommercetoolsCapabilities> = (T['cart']
19
19
  store: StoreProvider;
20
20
  } : object) & (T['order'] extends true ? {
21
21
  order: OrderProvider;
22
+ } : object) & (T['profile'] extends true ? {
23
+ profile: ProfileProvider;
22
24
  } : object) & (T['checkout'] extends true ? {
23
25
  checkout: CheckoutProvider;
24
26
  } : object);
@@ -1,9 +1,9 @@
1
- import { CategoryProvider } from "@reactionary/core";
2
- import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext, Cache, Category } from "@reactionary/core";
3
- import type z from "zod";
4
- import type { CommercetoolsConfiguration } from "../schema/configuration.schema.js";
5
- import type { ByProjectKeyCategoriesRequestBuilder } from "@commercetools/platform-sdk";
6
- import type { CommercetoolsClient } from "../core/client.js";
1
+ import { CategoryProvider } from '@reactionary/core';
2
+ import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext, Cache, Category } from '@reactionary/core';
3
+ import z from 'zod';
4
+ import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
5
+ import type { ByProjectKeyCategoriesRequestBuilder } from '@commercetools/platform-sdk';
6
+ import type { CommercetoolsClient } from '../core/client.js';
7
7
  export declare class CommercetoolsCategoryProvider<T extends Category = Category> extends CategoryProvider<T> {
8
8
  protected config: CommercetoolsConfiguration;
9
9
  protected client: CommercetoolsClient;
@@ -11,24 +11,15 @@ export declare class CommercetoolsCategoryProvider<T extends Category = Category
11
11
  protected getClient(): Promise<ByProjectKeyCategoriesRequestBuilder>;
12
12
  /**
13
13
  * Look it up by the category ID (key in commercetools), and if not there, return a placeholder.
14
- * @param id
15
- * @param session
16
- * @returns
17
14
  */
18
15
  getById(payload: CategoryQueryById): Promise<T>;
19
16
  /**
20
17
  * Resolve the category by slug, in the users current locale.
21
- * @param slug
22
- * @param session
23
- * @returns
24
18
  */
25
19
  getBySlug(payload: CategoryQueryBySlug): Promise<T | null>;
26
20
  /**
27
21
  * Returns the breadcrumb path to the category, i.e. all parents up to the root.
28
22
  * The returned order is from root to leaf.
29
- * @param id
30
- * @param session
31
- * @returns
32
23
  */
33
24
  getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<T[]>;
34
25
  /**
@@ -37,10 +28,6 @@ export declare class CommercetoolsCategoryProvider<T extends Category = Category
37
28
  * If you expect your frontend will load many many categories, consider adding a "load more" button, or lazy load the next page.
38
29
  *
39
30
  * This is cached by ID + page number + page size + locale + store
40
- * @param id
41
- * @param paginationOptions
42
- * @param session
43
- * @returns
44
31
  */
45
32
  findChildCategories(payload: CategoryQueryForChildCategories): Promise<{
46
33
  meta: {
@@ -75,9 +62,9 @@ export declare class CommercetoolsCategoryProvider<T extends Category = Category
75
62
  items: T[];
76
63
  }>;
77
64
  /**
78
- * Handler for parsing a response from a remote provider and converting it
79
- * into the typed domain model.
80
- */
65
+ * Handler for parsing a response from a remote provider and converting it
66
+ * into the typed domain model.
67
+ */
81
68
  protected parseSingle(_body: unknown): T;
82
69
  protected parsePaginatedResult(_body: unknown): {
83
70
  meta: {
@@ -1,6 +1,6 @@
1
1
  import type { Cache, Checkout, RequestContext, PaymentMethod, ShippingMethod, CheckoutMutationInitiateCheckout, CheckoutMutationSetShippingAddress, CheckoutMutationFinalizeCheckout, CheckoutMutationAddPaymentInstruction, CheckoutMutationRemovePaymentInstruction, CheckoutMutationSetShippingInstruction, CheckoutQueryById, CheckoutQueryForAvailablePaymentMethods, CheckoutQueryForAvailableShippingMethods, CheckoutIdentifier, ShippingInstruction, PaymentInstruction } from '@reactionary/core';
2
2
  import { CheckoutProvider } from '@reactionary/core';
3
- import type z from 'zod';
3
+ import z from 'zod';
4
4
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
5
5
  import type { MyCartUpdateAction } from '@commercetools/platform-sdk';
6
6
  import type { Address as CTAddress, Payment as CTPayment, Cart as CTCart } from '@commercetools/platform-sdk';
@@ -1,18 +1,18 @@
1
1
  import { PriceProvider } from '@reactionary/core';
2
2
  import type { PriceQueryBySku, RequestContext, Price, Cache } from '@reactionary/core';
3
- import type z from 'zod';
3
+ import z from 'zod';
4
4
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
5
5
  import type { CommercetoolsClient } from '../core/client.js';
6
6
  export declare class CommercetoolsPriceProvider<T extends Price = Price> extends PriceProvider<T> {
7
7
  protected config: CommercetoolsConfiguration;
8
8
  protected client: CommercetoolsClient;
9
9
  constructor(config: CommercetoolsConfiguration, schema: z.ZodType<T>, cache: Cache, context: RequestContext, client: CommercetoolsClient);
10
- protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyProductProjectionsRequestBuilder>;
10
+ protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
11
11
  getBySKUs(payload: PriceQueryBySku[]): Promise<T[]>;
12
12
  getBySKU(payload: PriceQueryBySku): Promise<T>;
13
13
  protected parseSingle(_body: unknown): T;
14
14
  protected getChannels(): Promise<{
15
- offerChannelGUID: any;
16
- listChannelGUID: any;
15
+ offer: string;
16
+ list: string;
17
17
  }>;
18
18
  }
@@ -1,6 +1,6 @@
1
1
  import type { RequestContext, Cache, StoreQueryByProximity } from '@reactionary/core';
2
2
  import { StoreProvider } from '@reactionary/core';
3
- import type z from 'zod';
3
+ import z from 'zod';
4
4
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
5
5
  import type { Channel } from '@commercetools/platform-sdk';
6
6
  import type { Store } from '@reactionary/core';
@@ -8,6 +8,7 @@ export declare const CommercetoolsCapabilitiesSchema: z.ZodObject<{
8
8
  category: z.ZodOptional<z.ZodBoolean>;
9
9
  checkout: z.ZodOptional<z.ZodBoolean>;
10
10
  order: z.ZodOptional<z.ZodBoolean>;
11
+ profile: z.ZodOptional<z.ZodBoolean>;
11
12
  store: z.ZodOptional<z.ZodBoolean>;
12
13
  productSearch: z.ZodOptional<z.ZodBoolean>;
13
14
  }, z.core.$loose>;