rerobe-js-orm 2.4.99 → 2.5.0
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.
|
@@ -4,7 +4,7 @@ const OrderFactory_1 = require("./OrderFactory");
|
|
|
4
4
|
const Order_1 = require("../../models/Order");
|
|
5
5
|
class OrderFromFormState extends OrderFactory_1.default {
|
|
6
6
|
createOrder(fs) {
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
8
8
|
const currencyCode = fs.fields.currencyCode.inputValue || 'SEK';
|
|
9
9
|
const customer = fs.fields.customer.selectedValue || {};
|
|
10
10
|
const firstName = fs.fields.firstName.inputValue;
|
|
@@ -22,9 +22,10 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
22
22
|
currencyCode: fs.fields.currencyCode.inputValue,
|
|
23
23
|
statusUrl: ((_h = fs.props) === null || _h === void 0 ? void 0 : _h.statusUrl) || '',
|
|
24
24
|
processedAt: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.processedAt) || new Date().toUTCString(),
|
|
25
|
+
fulfillmentLocations: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.fulfillmentLocations) || [],
|
|
25
26
|
financialStatus: fs.fields.financialStatus.selectedValue,
|
|
26
27
|
fulfillmentStatus: fs.fields.fulfillmentStatus.selectedValue,
|
|
27
|
-
fulfillments: ((
|
|
28
|
+
fulfillments: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.fulfillments) || [],
|
|
28
29
|
shippingAddress: fs.fields.shippingAddress.selectedValue || {
|
|
29
30
|
id: '',
|
|
30
31
|
address1: '',
|
|
@@ -35,7 +36,7 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
35
36
|
province: '',
|
|
36
37
|
zip: '',
|
|
37
38
|
},
|
|
38
|
-
shippingDiscountAllocations: ((
|
|
39
|
+
shippingDiscountAllocations: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.shippingDiscountAllocations) || [],
|
|
39
40
|
shippingLine: fs.fields.shippingLine
|
|
40
41
|
? fs.fields.shippingLine.selectedValue
|
|
41
42
|
: {
|
|
@@ -56,9 +57,9 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
56
57
|
originalTotalPrice: { amount: fs.fields.originalTotalPrice.inputValue || 0, currencyCode },
|
|
57
58
|
lineItems: fs.fields.lineItems.selectedValues || [],
|
|
58
59
|
cancelReason: fs.fields.cancelReason.selectedValue || '',
|
|
59
|
-
canceledAt: ((
|
|
60
|
-
customerUrl: ((
|
|
61
|
-
discountApplications: ((
|
|
60
|
+
canceledAt: ((_o = fs.props) === null || _o === void 0 ? void 0 : _o.canceledAt) || '',
|
|
61
|
+
customerUrl: ((_p = fs.props) === null || _p === void 0 ? void 0 : _p.customerUrl) || '',
|
|
62
|
+
discountApplications: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.discountApplications) || [],
|
|
62
63
|
physicalLocation: fs.fields.physicalLocation.selectedValue || {
|
|
63
64
|
id: '',
|
|
64
65
|
activatable: true,
|
|
@@ -77,7 +78,7 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
77
78
|
},
|
|
78
79
|
notes: fs.fields.notes.inputValue || '',
|
|
79
80
|
userId: (customer === null || customer === void 0 ? void 0 : customer.uid) || '',
|
|
80
|
-
customerName: ((
|
|
81
|
+
customerName: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.customerName) ||
|
|
81
82
|
(customer.displayName ? customer.displayName : '') ||
|
|
82
83
|
(customer.firstName && customer.lastName ? `${customer.firstName} ${customer.lastName}` : '') ||
|
|
83
84
|
(firstName && lastName ? `${firstName} ${lastName}` : ''),
|
|
@@ -85,9 +86,9 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
85
86
|
phone: (customer === null || customer === void 0 ? void 0 : customer.phone) || fs.fields.phone.inputValue || '',
|
|
86
87
|
paymentMethod: fs.fields.paymentMethod.selectedValue || '',
|
|
87
88
|
paymentDetails: fs.fields.paymentDetails.selectedValue || {},
|
|
88
|
-
merchantId: ((
|
|
89
|
+
merchantId: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.merchantId) || '',
|
|
89
90
|
tags: fs.fields.tags.selectedValues || [],
|
|
90
|
-
refunds: ((
|
|
91
|
+
refunds: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.refunds) || [],
|
|
91
92
|
};
|
|
92
93
|
return new Order_1.default(Object.assign({}, orderAttributes));
|
|
93
94
|
}
|
package/lib/models/Order.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export default class Order extends Base {
|
|
|
45
45
|
currencyCode: string;
|
|
46
46
|
statusUrl: string;
|
|
47
47
|
processedAt: string;
|
|
48
|
+
fulfillmentLocations: FulfillmentLocationItem[];
|
|
48
49
|
financialStatus: FinancialStatusTypes | string;
|
|
49
50
|
fulfillmentStatus: FulfillmentStatusTypes | string;
|
|
50
51
|
fulfillments: FulfillmentAdmin[];
|
package/lib/models/Order.js
CHANGED
|
@@ -17,6 +17,7 @@ class Order extends Base_1.default {
|
|
|
17
17
|
this.financialStatus = (props === null || props === void 0 ? void 0 : props.financialStatus)
|
|
18
18
|
? props === null || props === void 0 ? void 0 : props.financialStatus.toUpperCase()
|
|
19
19
|
: Order.FINANCIAL_TYPES.pending;
|
|
20
|
+
this.fulfillmentLocations = (props === null || props === void 0 ? void 0 : props.fulfillmentLocations) || [];
|
|
20
21
|
this.fulfillmentStatus = (props === null || props === void 0 ? void 0 : props.fulfillmentStatus)
|
|
21
22
|
? props === null || props === void 0 ? void 0 : props.fulfillmentStatus.toUpperCase()
|
|
22
23
|
: Order.FULFILLMENT_TYPES.unfulfilled;
|
|
@@ -116,6 +117,7 @@ class Order extends Base_1.default {
|
|
|
116
117
|
processedAt: this.processedAt,
|
|
117
118
|
statusUrl: this.statusUrl,
|
|
118
119
|
financialStatus: this.financialStatus,
|
|
120
|
+
fulfillmentLocations: this.fulfillmentLocations,
|
|
119
121
|
fulfillmentStatus: this.fulfillmentStatus,
|
|
120
122
|
fulfillments: this.fulfillments,
|
|
121
123
|
salesChannel: this.salesChannel,
|
|
@@ -26,6 +26,7 @@ declare type ReRobeOrderObj = {
|
|
|
26
26
|
discountApplications?: DiscountApplication[];
|
|
27
27
|
statusUrl?: string;
|
|
28
28
|
processedAt?: string;
|
|
29
|
+
fulfillmentLocations?: FulfillmentLocationItem[];
|
|
29
30
|
financialStatus?: FinancialStatusTypes | string;
|
|
30
31
|
fulfillmentStatus?: FulfillmentStatusTypes | string;
|
|
31
32
|
fulfillments?: FulfillmentAdmin[];
|
|
@@ -336,6 +337,12 @@ declare type OrderLocation = {
|
|
|
336
337
|
name?: string;
|
|
337
338
|
shipsInventory?: boolean;
|
|
338
339
|
};
|
|
340
|
+
declare type FulfillmentLocationItem = {
|
|
341
|
+
location: LocationInput;
|
|
342
|
+
productsIds: string[];
|
|
343
|
+
shippingRateName?: string;
|
|
344
|
+
shippingPrice?: string | number;
|
|
345
|
+
};
|
|
339
346
|
declare type Fulfillment = {
|
|
340
347
|
fulfillmentLineItems: FulfillmentLineItemConnection;
|
|
341
348
|
trackingCompany: string;
|
|
@@ -619,6 +626,7 @@ declare type CompleteRefund = OrderRefund & {
|
|
|
619
626
|
};
|
|
620
627
|
declare type OrderAttributesFormFields = {
|
|
621
628
|
currencyCode: TextInputFormField<string>;
|
|
629
|
+
fulfillmentLocations: MultiSelectFormField<FulfillmentLocationItem>;
|
|
622
630
|
financialStatus: SingleSelectFormField<FinancialStatusTypes>;
|
|
623
631
|
fulfillmentStatus: SingleSelectFormField<FulfillmentStatusTypes>;
|
|
624
632
|
fulfillments: MultiSelectFormField<FulfillmentAdmin>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rerobe-js-orm",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "ReRobe's Javascript ORM Framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build": "tsc",
|
|
11
11
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
12
12
|
"lint": "tslint -p tsconfig.json",
|
|
13
|
-
"prepare": "npm run build",
|
|
13
|
+
"prepare": "npm run clean && npm run build && npm run test",
|
|
14
14
|
"prepublishOnly": "npm test && npm run lint",
|
|
15
15
|
"preversion": "npm run lint",
|
|
16
16
|
"version": "npm run format && git add -A src",
|