@reactionary/source 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.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/examples-node",
|
|
3
|
-
"version": "0.2.
|
|
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.
|
|
8
|
-
"@reactionary/provider-commercetools": "0.2.
|
|
9
|
-
"@reactionary/provider-algolia": "0.2.
|
|
10
|
-
"@reactionary/provider-medusa": "0.2.
|
|
11
|
-
"@reactionary/provider-meilisearch": "0.2.
|
|
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
|
@@ -71,24 +71,26 @@ export class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (payload.search.user && payload.search.user.userId) {
|
|
74
|
-
|
|
74
|
+
|
|
75
|
+
// where.push(`customerId="${payload.search.user.userId}"`);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
if (payload.search.orderStatus) {
|
|
78
79
|
const orderStatusWhere = payload.search.orderStatus.map(x => {
|
|
80
|
+
let mappedStatus = 'Open';
|
|
79
81
|
if (x === 'AwaitingPayment') {
|
|
80
|
-
|
|
82
|
+
mappedStatus = `Open`
|
|
81
83
|
}
|
|
82
84
|
if (x === 'ReleasedToFulfillment') {
|
|
83
|
-
|
|
85
|
+
mappedStatus = `Confirmed`
|
|
84
86
|
}
|
|
85
87
|
if (x === 'Shipped') {
|
|
86
|
-
|
|
88
|
+
mappedStatus = `Complete`
|
|
87
89
|
}
|
|
88
90
|
if (x === 'Cancelled') {
|
|
89
|
-
|
|
91
|
+
mappedStatus = `Cancelled`
|
|
90
92
|
}
|
|
91
|
-
return `orderState="${
|
|
93
|
+
return `orderState="${mappedStatus}"`
|
|
92
94
|
}).join(' OR ');
|
|
93
95
|
where.push(orderStatusWhere);
|
|
94
96
|
}
|
|
@@ -172,7 +174,14 @@ export class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
|
|
|
172
174
|
) {
|
|
173
175
|
orderStatus = 'Shipped';
|
|
174
176
|
}
|
|
175
|
-
|
|
177
|
+
let inventoryStatus: OrderSearchResultItem['inventoryStatus'];
|
|
178
|
+
|
|
179
|
+
if (orderStatus === 'Shipped') {
|
|
180
|
+
inventoryStatus = 'Allocated'
|
|
181
|
+
} else {
|
|
182
|
+
inventoryStatus = 'NotAllocated'
|
|
183
|
+
}
|
|
184
|
+
|
|
176
185
|
const totalAmount: MonetaryAmount = {
|
|
177
186
|
currency: body.totalPrice ? body.totalPrice.currencyCode as Currency : this.context.languageContext.currencyCode,
|
|
178
187
|
value: body.totalPrice ? body.totalPrice.centAmount / 100 : 0
|