@reactionary/provider-commercetools 0.2.17 → 0.2.19

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.17",
3
+ "version": "0.2.19",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.2.17",
7
+ "@reactionary/core": "0.2.19",
8
8
  "debug": "^4.4.3",
9
9
  "zod": "4.1.9",
10
10
  "@commercetools/ts-client": "^4.2.1",
@@ -41,23 +41,23 @@ class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
41
41
  }
42
42
  }
43
43
  if (payload.search.user && payload.search.user.userId) {
44
- where.push(`customerId="${payload.search.user.userId}"`);
45
44
  }
46
45
  if (payload.search.orderStatus) {
47
46
  const orderStatusWhere = payload.search.orderStatus.map((x) => {
47
+ let mappedStatus = "Open";
48
48
  if (x === "AwaitingPayment") {
49
- return `Open`;
49
+ mappedStatus = `Open`;
50
50
  }
51
51
  if (x === "ReleasedToFulfillment") {
52
- return `Confirmed`;
52
+ mappedStatus = `Confirmed`;
53
53
  }
54
54
  if (x === "Shipped") {
55
- return `Completed`;
55
+ mappedStatus = `Complete`;
56
56
  }
57
57
  if (x === "Cancelled") {
58
- return `Cancelled`;
58
+ mappedStatus = `Cancelled`;
59
59
  }
60
- return `orderState="${x}"`;
60
+ return `orderState="${mappedStatus}"`;
61
61
  }).join(" OR ");
62
62
  where.push(orderStatusWhere);
63
63
  }
@@ -123,7 +123,12 @@ class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
123
123
  if ((body.shipmentState === "Shipped" || body.shipmentState === "Delivered") && body.orderState === "Completed") {
124
124
  orderStatus = "Shipped";
125
125
  }
126
- const inventoryStatus = body.shipmentState;
126
+ let inventoryStatus;
127
+ if (orderStatus === "Shipped") {
128
+ inventoryStatus = "Allocated";
129
+ } else {
130
+ inventoryStatus = "NotAllocated";
131
+ }
127
132
  const totalAmount = {
128
133
  currency: body.totalPrice ? body.totalPrice.currencyCode : this.context.languageContext.currencyCode,
129
134
  value: body.totalPrice ? body.totalPrice.centAmount / 100 : 0
@@ -45,7 +45,7 @@ export declare class CommercetoolsOrderSearchProvider extends OrderSearchProvide
45
45
  };
46
46
  orderDate: string;
47
47
  orderStatus: "AwaitingPayment" | "ReleasedToFulfillment" | "Shipped";
48
- inventoryStatus: "NotAllocated" | "Allocated" | "Backordered" | "Preordered";
48
+ inventoryStatus: "NotAllocated" | "Allocated";
49
49
  totalAmount: {
50
50
  value: number;
51
51
  currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TVD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VED" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XAG" | "XAU" | "XBA" | "XBB" | "XBC" | "XBD" | "XCD" | "XDR" | "XOF" | "XPD" | "XPF" | "XPT" | "XSU" | "XTS" | "XUA" | "XXX" | "YER" | "ZAR" | "ZMW" | "ZWL";