@reactionary/provider-commercetools 0.2.18 → 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.18",
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.18",
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",
@@ -44,19 +44,20 @@ class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
44
44
  }
45
45
  if (payload.search.orderStatus) {
46
46
  const orderStatusWhere = payload.search.orderStatus.map((x) => {
47
+ let mappedStatus = "Open";
47
48
  if (x === "AwaitingPayment") {
48
- return `Open`;
49
+ mappedStatus = `Open`;
49
50
  }
50
51
  if (x === "ReleasedToFulfillment") {
51
- return `Confirmed`;
52
+ mappedStatus = `Confirmed`;
52
53
  }
53
54
  if (x === "Shipped") {
54
- return `Completed`;
55
+ mappedStatus = `Complete`;
55
56
  }
56
57
  if (x === "Cancelled") {
57
- return `Cancelled`;
58
+ mappedStatus = `Cancelled`;
58
59
  }
59
- return `orderState="${x}"`;
60
+ return `orderState="${mappedStatus}"`;
60
61
  }).join(" OR ");
61
62
  where.push(orderStatusWhere);
62
63
  }
@@ -122,7 +123,12 @@ class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
122
123
  if ((body.shipmentState === "Shipped" || body.shipmentState === "Delivered") && body.orderState === "Completed") {
123
124
  orderStatus = "Shipped";
124
125
  }
125
- const inventoryStatus = body.shipmentState;
126
+ let inventoryStatus;
127
+ if (orderStatus === "Shipped") {
128
+ inventoryStatus = "Allocated";
129
+ } else {
130
+ inventoryStatus = "NotAllocated";
131
+ }
126
132
  const totalAmount = {
127
133
  currency: body.totalPrice ? body.totalPrice.currencyCode : this.context.languageContext.currencyCode,
128
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";