@reactionary/provider-commercetools 0.2.14 → 0.2.16

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@reactionary/provider-commercetools",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.2.14",
7
+ "@reactionary/core": "0.2.16",
8
8
  "debug": "^4.4.3",
9
9
  "zod": "4.1.9",
10
10
  "@commercetools/ts-client": "^4.2.1",
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -441,17 +440,12 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
441
440
  return result;
442
441
  }
443
442
  isReadyForFinalization(price, paymentInstructions, billingAddress, shippingAddress, shippingInstruction) {
444
- if (!billingAddress)
445
- return false;
446
- if (!shippingInstruction)
447
- return false;
448
- if (!shippingAddress && !shippingInstruction.pickupPoint)
449
- return false;
450
- if (paymentInstructions.length === 0)
451
- return false;
443
+ if (!billingAddress) return false;
444
+ if (!shippingInstruction) return false;
445
+ if (!shippingAddress && !shippingInstruction.pickupPoint) return false;
446
+ if (paymentInstructions.length === 0) return false;
452
447
  const authorizedPayments = paymentInstructions.filter((pi) => pi.status === "authorized").map((x) => x.amount.value).reduce((a, b) => a + b, 0);
453
- if (price.grandTotal.value !== authorizedPayments)
454
- return false;
448
+ if (price.grandTotal.value !== authorizedPayments) return false;
455
449
  return true;
456
450
  }
457
451
  parsePaymentInstruction(remote) {
@@ -508,8 +502,7 @@ class CommercetoolsCheckoutProvider extends CheckoutProvider {
508
502
  };
509
503
  }
510
504
  parseShippingInstruction(remote) {
511
- if (!remote.shippingInfo)
512
- return void 0;
505
+ if (!remote.shippingInfo) return void 0;
513
506
  const instructions = remote.custom?.fields["shippingInstruction"] || "";
514
507
  const consentForUnattendedDelivery = remote.custom?.fields["consentForUnattendedDelivery"] === "true" || false;
515
508
  const pickupPoint = remote.custom?.fields["pickupPointId"] || "";
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import { InventoryProvider, InventoryQueryBySKUSchema, InventorySchema, Reactionary, success, error } from "@reactionary/core";
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -41,8 +40,8 @@ class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
41
40
  where.push(`lineItems(variant(sku="${partNumber}"))`);
42
41
  }
43
42
  }
44
- if (payload.search.userId) {
45
- where.push(`customerId="${payload.search.userId}"`);
43
+ if (payload.search.user && payload.search.user.userId) {
44
+ where.push(`customerId="${payload.search.user.userId}"`);
46
45
  }
47
46
  if (payload.search.orderStatus) {
48
47
  const orderStatusWhere = payload.search.orderStatus.map((x) => {
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import { OrderProvider, OrderQueryByIdSchema, OrderSchema, Reactionary, success, error } from "@reactionary/core";
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import {
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import { Reactionary, StoreProvider, StoreQueryByProximitySchema, StoreSchema, success, error } from "@reactionary/core";
@@ -61,7 +61,7 @@ export declare class CommercetoolsOrderSearchProvider extends OrderSearchProvide
61
61
  };
62
62
  partNumber?: string[] | undefined;
63
63
  orderStatus?: ("AwaitingPayment" | "ReleasedToFulfillment" | "Shipped" | "Cancelled")[] | undefined;
64
- userId?: {
64
+ user?: {
65
65
  userId: string;
66
66
  } | undefined;
67
67
  startDate?: string | undefined;