@reactionary/source 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.
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reactionary/examples-node",
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",
8
- "@reactionary/provider-commercetools": "0.2.18",
9
- "@reactionary/provider-algolia": "0.2.18",
10
- "@reactionary/provider-medusa": "0.2.18",
11
- "@reactionary/provider-meilisearch": "0.2.18"
7
+ "@reactionary/core": "0.2.19",
8
+ "@reactionary/provider-commercetools": "0.2.19",
9
+ "@reactionary/provider-algolia": "0.2.19",
10
+ "@reactionary/provider-medusa": "0.2.19",
11
+ "@reactionary/provider-meilisearch": "0.2.19"
12
12
  },
13
13
  "type": "module"
14
14
  }
@@ -10,7 +10,7 @@ const testData = {
10
10
  email: 'eileen.harvey@example.com',
11
11
  };
12
12
 
13
- describe.each([PrimaryProvider.MEILISEARCH])(
13
+ describe.each([PrimaryProvider.COMMERCETOOLS, PrimaryProvider.MEILISEARCH])(
14
14
  'Order Search Capability - %s',
15
15
  (provider) => {
16
16
  let client: ReturnType<typeof createClient>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/source",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -77,19 +77,20 @@ export class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
77
77
 
78
78
  if (payload.search.orderStatus) {
79
79
  const orderStatusWhere = payload.search.orderStatus.map(x => {
80
+ let mappedStatus = 'Open';
80
81
  if (x === 'AwaitingPayment') {
81
- return `Open`
82
+ mappedStatus = `Open`
82
83
  }
83
84
  if (x === 'ReleasedToFulfillment') {
84
- return `Confirmed`
85
+ mappedStatus = `Confirmed`
85
86
  }
86
87
  if (x === 'Shipped') {
87
- return `Completed`
88
+ mappedStatus = `Complete`
88
89
  }
89
90
  if (x === 'Cancelled') {
90
- return `Cancelled`
91
+ mappedStatus = `Cancelled`
91
92
  }
92
- return `orderState="${x}"`
93
+ return `orderState="${mappedStatus}"`
93
94
  }).join(' OR ');
94
95
  where.push(orderStatusWhere);
95
96
  }
@@ -173,7 +174,14 @@ export class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
173
174
  ) {
174
175
  orderStatus = 'Shipped';
175
176
  }
176
- const inventoryStatus = body.shipmentState as OrderSearchResultItem['inventoryStatus'];
177
+ let inventoryStatus: OrderSearchResultItem['inventoryStatus'];
178
+
179
+ if (orderStatus === 'Shipped') {
180
+ inventoryStatus = 'Allocated'
181
+ } else {
182
+ inventoryStatus = 'NotAllocated'
183
+ }
184
+
177
185
  const totalAmount: MonetaryAmount = {
178
186
  currency: body.totalPrice ? body.totalPrice.currencyCode as Currency : this.context.languageContext.currencyCode,
179
187
  value: body.totalPrice ? body.totalPrice.centAmount / 100 : 0