rerobe-js-orm 3.6.1 → 3.6.2

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 (((_c = this.props) === null || _c === void 0 ? void 0 : _c.shippingType) === order_constants_1.SHIPPING_TYPES.localPickUp &&
161
- ((_d = this.props) === null || _d === void 0 ? void 0 : _d.fulfillmentLocations) &&
162
- ((_e = this.props.fulfillmentLocations[0]) === null || _e === void 0 ? void 0 : _e.location)) {
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 ((_g = (_f = this.opts) === null || _f === void 0 ? void 0 : _f.pickupLocationOptions) === null || _g === void 0 ? void 0 : _g.length) {
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: ((_h = this.props) === null || _h === void 0 ? void 0 : _h.fulfillmentLocations) || [],
178
+ productsLocationsMapping: ((_j = this.props) === null || _j === void 0 ? void 0 : _j.fulfillmentLocations) || [],
175
179
  description: '',
176
- price: ((_k = (_j = this.props) === null || _j === void 0 ? void 0 : _j.totalShippingPrice) === null || _k === void 0 ? void 0 : _k.amount) || 0,
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: ((_m = (_l = this.props) === null || _l === void 0 ? void 0 : _l.totalPricePresentment) === null || _m === void 0 ? void 0 : _m.currencyCode) || '',
183
- discountTitlePresentment: ((_p = (_o = this.props) === null || _o === void 0 ? void 0 : _o.appliedDiscount) === null || _p === void 0 ? void 0 : _p.title) || '',
184
- subtotalPricePresentment: ((_q = this.props) === null || _q === void 0 ? void 0 : _q.subtotalPricePresentment) || { amount: 0 },
185
- totalDiscountPresentment: ((_r = this.props) === null || _r === void 0 ? void 0 : _r.totalDiscountPresentment) || { amount: 0 },
186
- totalShippingPricePresentment: ((_s = this.props) === null || _s === void 0 ? void 0 : _s.totalShippingPricePresentment) || { amount: 0 },
187
- totalPricePresentment: ((_t = this.props) === null || _t === void 0 ? void 0 : _t.totalPricePresentment) || { amount: 0 },
188
- totalRefundedPresentment: ((_u = this.props) === null || _u === void 0 ? void 0 : _u.totalRefundedPresentment) || { amount: 0 },
189
- totalTaxPresentment: ((_v = this.props) === null || _v === void 0 ? void 0 : _v.totalTaxPresentment) || { amount: 0 },
190
- creditDiscountPresentment: ((_w = this.props) === null || _w === void 0 ? void 0 : _w.creditDiscountPresentment) || { amount: 0 },
191
- saleDiscountPresentment: ((_x = this.props) === null || _x === void 0 ? void 0 : _x.saleDiscountPresentment) || { amount: 0 },
192
- additionalDiscountPresentment: ((_y = this.props) === null || _y === void 0 ? void 0 : _y.additionalDiscountPresentment) || { amount: 0 },
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 ((_0 = (_z = this.opts) === null || _z === void 0 ? void 0 : _z.shippingTypeOptions) === null || _0 === void 0 ? void 0 : _0.length) {
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
  }
@@ -66,6 +66,7 @@ export default class Order extends Base {
66
66
  totalPrice: Money;
67
67
  totalRefunded: Money;
68
68
  totalShippingPrice: Money;
69
+ taxTitle: string;
69
70
  totalTax: Money;
70
71
  originalTotalPrice: Money;
71
72
  lineItems: ReRobeOrderLineItem[];
@@ -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() : '';
@@ -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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.6.1",
3
+ "version": "3.6.2",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",