rerobe-js-orm 3.6.1 → 3.6.3
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.
|
@@ -98,7 +98,7 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
98
98
|
fulfillmentStatus: fs.fields.fulfillmentStatus.selectedValue,
|
|
99
99
|
statusUrl: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.statusUrl) || '',
|
|
100
100
|
};
|
|
101
|
-
const orderAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, totalPricesAttr), presentmentTotalPricesAttr), discountsAttr), shippingAndLocationAttr), customerAttr), statusesAttr), { id: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.id) || '', documentId: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.documentId) || '', name: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.name) || '', orderNumber: (_o = fs.props) === null || _o === void 0 ? void 0 : _o.orderNumber, ribbnOrderNumber: (_p = fs.props) === null || _p === void 0 ? void 0 : _p.ribbnOrderNumber, merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '', currencyCode: fs.fields.currencyCode.inputValue, lineItems: fs.fields.lineItems.selectedValues || [], fulfillments: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.fulfillments) || [], refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [], paymentType: fs.fields.paymentType.selectedValue, paymentMethod: fs.fields.paymentMethod.selectedValue || '', paymentDetails: fs.fields.paymentDetails.selectedValue || {}, notes: fs.fields.notes.inputValue || '', tags: fs.fields.tags.selectedValues || [], cancelReason: fs.fields.cancelReason.selectedValue || '', canceledAt: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.canceledAt) || '', processedAt: ((_u = fs.props) === null || _u === void 0 ? void 0 : _u.processedAt) || new Date().toUTCString(), adjustments: ((_v = fs.props) === null || _v === void 0 ? void 0 : _v.adjustments) || [], createdAtTimestamp: 0, updatedAtTimestamp: 0, createdByUserId: ((_w = fs.props) === null || _w === void 0 ? void 0 : _w.createdByUserId) || '' });
|
|
101
|
+
const orderAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, totalPricesAttr), presentmentTotalPricesAttr), discountsAttr), shippingAndLocationAttr), customerAttr), statusesAttr), { id: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.id) || '', documentId: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.documentId) || '', name: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.name) || '', orderNumber: (_o = fs.props) === null || _o === void 0 ? void 0 : _o.orderNumber, ribbnOrderNumber: (_p = fs.props) === null || _p === void 0 ? void 0 : _p.ribbnOrderNumber, merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '', currencyCode: fs.fields.currencyCode.inputValue, lineItems: fs.fields.lineItems.selectedValues || [], fulfillments: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.fulfillments) || [], refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [], paymentType: fs.fields.paymentType.selectedValue, paymentMethod: fs.fields.paymentMethod.selectedValue || '', paymentDetails: fs.fields.paymentDetails.selectedValue || {}, notes: fs.fields.notes.inputValue || '', tags: fs.fields.tags.selectedValues || [], cancelReason: fs.fields.cancelReason.selectedValue || '', canceledAt: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.canceledAt) || '', processedAt: ((_u = fs.props) === null || _u === void 0 ? void 0 : _u.processedAt) || new Date().toUTCString(), adjustments: ((_v = fs.props) === null || _v === void 0 ? void 0 : _v.adjustments) || [], createdAtTimestamp: 0, updatedAtTimestamp: 0, createdByUserId: ((_w = fs.props) === null || _w === void 0 ? void 0 : _w.createdByUserId) || '', taxTitle: fs.fields.taxTitle.inputValue || '' });
|
|
102
102
|
return new Order_1.default(Object.assign({}, orderAttributes));
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -40,6 +40,7 @@ class OrderFormState extends FormState_1.default {
|
|
|
40
40
|
this.fields.subTotalWithSalePriceIncluded = this.fieldFactory('textInput', 'subTotalWithSalePriceIncluded');
|
|
41
41
|
this.fields.subTotalWithShipping = this.fieldFactory('textInput', 'subTotalWithShipping');
|
|
42
42
|
this.fields.discountTitle = this.fieldFactory('textInput', 'discountTitle');
|
|
43
|
+
this.fields.taxTitle = this.fieldFactory('textInput', 'taxTitle');
|
|
43
44
|
this.fields.creditDiscount = this.fieldFactory('textInput', 'creditDiscount');
|
|
44
45
|
this.fields.saleDiscount = this.fieldFactory('textInput', 'saleDiscount');
|
|
45
46
|
this.fields.availableCredit = this.fieldFactory('textInput', 'availableCredit');
|
|
@@ -108,7 +109,7 @@ class OrderFormState extends FormState_1.default {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
fieldFactory(fieldType, fieldKey, fieldOptions) {
|
|
111
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
112
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
112
113
|
let options = fieldOptions || [];
|
|
113
114
|
const hidden = false;
|
|
114
115
|
if (fieldType === 'textInput') {
|
|
@@ -124,6 +125,9 @@ class OrderFormState extends FormState_1.default {
|
|
|
124
125
|
if (fieldKey === 'discountTitle') {
|
|
125
126
|
inputValue = ((_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.appliedDiscount) === null || _b === void 0 ? void 0 : _b.title) || '';
|
|
126
127
|
}
|
|
128
|
+
if (fieldKey === 'taxTitle') {
|
|
129
|
+
inputValue = ((_c = this.props) === null || _c === void 0 ? void 0 : _c.taxTitle) || '';
|
|
130
|
+
}
|
|
127
131
|
if (fieldKey === 'subtotalPrice' ||
|
|
128
132
|
fieldKey === 'totalPrice' ||
|
|
129
133
|
fieldKey === 'totalDiscount' ||
|
|
@@ -157,39 +161,39 @@ class OrderFormState extends FormState_1.default {
|
|
|
157
161
|
let selectedValue = this.props[fieldKey] || '';
|
|
158
162
|
let onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
|
|
159
163
|
if (fieldKey === 'pickupLocation') {
|
|
160
|
-
if (((
|
|
161
|
-
((
|
|
162
|
-
((
|
|
164
|
+
if (((_d = this.props) === null || _d === void 0 ? void 0 : _d.shippingType) === order_constants_1.SHIPPING_TYPES.localPickUp &&
|
|
165
|
+
((_e = this.props) === null || _e === void 0 ? void 0 : _e.fulfillmentLocations) &&
|
|
166
|
+
((_f = this.props.fulfillmentLocations[0]) === null || _f === void 0 ? void 0 : _f.location)) {
|
|
163
167
|
const location = this.props.fulfillmentLocations[0].location;
|
|
164
168
|
const locationId = location.locationId || location.documentId || '';
|
|
165
169
|
selectedValue = locationId;
|
|
166
170
|
options = [{ label: location.address1 ? this.utilities.getAddressLabel(location) : '', value: locationId }];
|
|
167
171
|
}
|
|
168
|
-
if ((
|
|
172
|
+
if ((_h = (_g = this.opts) === null || _g === void 0 ? void 0 : _g.pickupLocationOptions) === null || _h === void 0 ? void 0 : _h.length) {
|
|
169
173
|
options = this.utilities.uniqObjArray([...options, ...this.opts.pickupLocationOptions], 'value');
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
176
|
if (fieldKey === 'shippingInfo') {
|
|
173
177
|
selectedValue = {
|
|
174
|
-
productsLocationsMapping: ((
|
|
178
|
+
productsLocationsMapping: ((_j = this.props) === null || _j === void 0 ? void 0 : _j.fulfillmentLocations) || [],
|
|
175
179
|
description: '',
|
|
176
|
-
price: ((
|
|
180
|
+
price: ((_l = (_k = this.props) === null || _k === void 0 ? void 0 : _k.totalShippingPrice) === null || _l === void 0 ? void 0 : _l.amount) || 0,
|
|
177
181
|
disabled: false,
|
|
178
182
|
};
|
|
179
183
|
}
|
|
180
184
|
if (fieldKey === 'presentmentData') {
|
|
181
185
|
selectedValue = {
|
|
182
|
-
presentmentCurrencyCode: ((
|
|
183
|
-
discountTitlePresentment: ((
|
|
184
|
-
subtotalPricePresentment: ((
|
|
185
|
-
totalDiscountPresentment: ((
|
|
186
|
-
totalShippingPricePresentment: ((
|
|
187
|
-
totalPricePresentment: ((
|
|
188
|
-
totalRefundedPresentment: ((
|
|
189
|
-
totalTaxPresentment: ((
|
|
190
|
-
creditDiscountPresentment: ((
|
|
191
|
-
saleDiscountPresentment: ((
|
|
192
|
-
additionalDiscountPresentment: ((
|
|
186
|
+
presentmentCurrencyCode: ((_o = (_m = this.props) === null || _m === void 0 ? void 0 : _m.totalPricePresentment) === null || _o === void 0 ? void 0 : _o.currencyCode) || '',
|
|
187
|
+
discountTitlePresentment: ((_q = (_p = this.props) === null || _p === void 0 ? void 0 : _p.appliedDiscount) === null || _q === void 0 ? void 0 : _q.title) || '',
|
|
188
|
+
subtotalPricePresentment: ((_r = this.props) === null || _r === void 0 ? void 0 : _r.subtotalPricePresentment) || { amount: 0 },
|
|
189
|
+
totalDiscountPresentment: ((_s = this.props) === null || _s === void 0 ? void 0 : _s.totalDiscountPresentment) || { amount: 0 },
|
|
190
|
+
totalShippingPricePresentment: ((_t = this.props) === null || _t === void 0 ? void 0 : _t.totalShippingPricePresentment) || { amount: 0 },
|
|
191
|
+
totalPricePresentment: ((_u = this.props) === null || _u === void 0 ? void 0 : _u.totalPricePresentment) || { amount: 0 },
|
|
192
|
+
totalRefundedPresentment: ((_v = this.props) === null || _v === void 0 ? void 0 : _v.totalRefundedPresentment) || { amount: 0 },
|
|
193
|
+
totalTaxPresentment: ((_w = this.props) === null || _w === void 0 ? void 0 : _w.totalTaxPresentment) || { amount: 0 },
|
|
194
|
+
creditDiscountPresentment: ((_x = this.props) === null || _x === void 0 ? void 0 : _x.creditDiscountPresentment) || { amount: 0 },
|
|
195
|
+
saleDiscountPresentment: ((_y = this.props) === null || _y === void 0 ? void 0 : _y.saleDiscountPresentment) || { amount: 0 },
|
|
196
|
+
additionalDiscountPresentment: ((_z = this.props) === null || _z === void 0 ? void 0 : _z.additionalDiscountPresentment) || { amount: 0 },
|
|
193
197
|
};
|
|
194
198
|
}
|
|
195
199
|
if (fieldKey === 'customer') {
|
|
@@ -209,7 +213,7 @@ class OrderFormState extends FormState_1.default {
|
|
|
209
213
|
}
|
|
210
214
|
const valid = !!this.props[fieldKey];
|
|
211
215
|
if (fieldKey === 'shippingType') {
|
|
212
|
-
if ((
|
|
216
|
+
if ((_1 = (_0 = this.opts) === null || _0 === void 0 ? void 0 : _0.shippingTypeOptions) === null || _1 === void 0 ? void 0 : _1.length) {
|
|
213
217
|
options = this.utilities.uniqObjArray(this.opts.shippingTypeOptions, 'value');
|
|
214
218
|
}
|
|
215
219
|
}
|
package/lib/models/Order.d.ts
CHANGED
package/lib/models/Order.js
CHANGED
|
@@ -61,6 +61,7 @@ class Order extends Base_1.default {
|
|
|
61
61
|
this.totalRefunded = (props === null || props === void 0 ? void 0 : props.totalRefunded) || { amount: 0 };
|
|
62
62
|
this.totalShippingPrice = (props === null || props === void 0 ? void 0 : props.totalShippingPrice) || { amount: 0 };
|
|
63
63
|
this.totalTax = (props === null || props === void 0 ? void 0 : props.totalTax) || { amount: 0 };
|
|
64
|
+
this.taxTitle = (props === null || props === void 0 ? void 0 : props.taxTitle) || '';
|
|
64
65
|
this.originalTotalPrice = (props === null || props === void 0 ? void 0 : props.originalTotalPrice) || { amount: 0 };
|
|
65
66
|
this.lineItems = (props === null || props === void 0 ? void 0 : props.lineItems) || [];
|
|
66
67
|
this.cancelReason = (props === null || props === void 0 ? void 0 : props.cancelReason) ? props === null || props === void 0 ? void 0 : props.cancelReason.toUpperCase() : '';
|
|
@@ -160,6 +161,7 @@ class Order extends Base_1.default {
|
|
|
160
161
|
totalRefunded: this.totalRefunded,
|
|
161
162
|
totalShippingPrice: this.totalShippingPrice,
|
|
162
163
|
totalTax: this.totalTax,
|
|
164
|
+
taxTitle: this.taxTitle,
|
|
163
165
|
originalTotalPrice: this.originalTotalPrice,
|
|
164
166
|
lineItems: this.lineItems,
|
|
165
167
|
cancelReason: this.cancelReason,
|
|
@@ -53,6 +53,7 @@ type ReRobeOrderObj = {
|
|
|
53
53
|
totalRefunded?: Money;
|
|
54
54
|
totalShippingPrice?: Money;
|
|
55
55
|
totalTax?: Money;
|
|
56
|
+
taxTitle?: string;
|
|
56
57
|
originalTotalPrice?: Money;
|
|
57
58
|
cancelReason?: CancelReasonTypes | string | null;
|
|
58
59
|
canceledAt?: string;
|
|
@@ -782,6 +783,7 @@ type OrderAttributesFormFields = {
|
|
|
782
783
|
subTotalWithSalePriceIncluded: TextInputFormField<string | number>;
|
|
783
784
|
subTotalWithShipping: TextInputFormField<string | number>;
|
|
784
785
|
discountTitle: TextInputFormField<string>;
|
|
786
|
+
taxTitle: TextInputFormField<string>;
|
|
785
787
|
creditDiscount: TextInputFormField<string | number>;
|
|
786
788
|
saleDiscount: TextInputFormField<string | number>;
|
|
787
789
|
availableCredit: TextInputFormField<string | number>;
|