rerobe-js-orm 2.4.71 → 2.4.72

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;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
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;
@@ -17,13 +17,14 @@ class OrderFromFormState extends OrderFactory_1.default {
17
17
  documentId: ((_c = fs.props) === null || _c === void 0 ? void 0 : _c.documentId) || '',
18
18
  name: ((_d = fs.props) === null || _d === void 0 ? void 0 : _d.name) || '',
19
19
  orderNumber: (_e = fs.props) === null || _e === void 0 ? void 0 : _e.orderNumber,
20
- state: ((_f = fs.props) === null || _f === void 0 ? void 0 : _f.state) || Order_1.default.ORDER_STATES.draft,
20
+ ribbnOrderNumber: (_f = fs.props) === null || _f === void 0 ? void 0 : _f.ribbnOrderNumber,
21
+ state: ((_g = fs.props) === null || _g === void 0 ? void 0 : _g.state) || Order_1.default.ORDER_STATES.draft,
21
22
  currencyCode: fs.fields.currencyCode.inputValue,
22
- statusUrl: ((_g = fs.props) === null || _g === void 0 ? void 0 : _g.statusUrl) || '',
23
- processedAt: ((_h = fs.props) === null || _h === void 0 ? void 0 : _h.processedAt) || new Date().toUTCString(),
23
+ statusUrl: ((_h = fs.props) === null || _h === void 0 ? void 0 : _h.statusUrl) || '',
24
+ processedAt: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.processedAt) || new Date().toUTCString(),
24
25
  financialStatus: fs.fields.financialStatus.selectedValue,
25
26
  fulfillmentStatus: fs.fields.fulfillmentStatus.selectedValue,
26
- fulfillments: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.fulfillments) || [],
27
+ fulfillments: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.fulfillments) || [],
27
28
  shippingAddress: fs.fields.shippingAddress.selectedValue || {
28
29
  id: '',
29
30
  address1: '',
@@ -34,7 +35,7 @@ class OrderFromFormState extends OrderFactory_1.default {
34
35
  province: '',
35
36
  zip: '',
36
37
  },
37
- shippingDiscountAllocations: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.shippingDiscountAllocations) || [],
38
+ shippingDiscountAllocations: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.shippingDiscountAllocations) || [],
38
39
  shippingLine: fs.fields.shippingLine
39
40
  ? fs.fields.shippingLine.selectedValue
40
41
  : {
@@ -55,9 +56,9 @@ class OrderFromFormState extends OrderFactory_1.default {
55
56
  originalTotalPrice: { amount: fs.fields.originalTotalPrice.inputValue || 0, currencyCode },
56
57
  lineItems: fs.fields.lineItems.selectedValues || [],
57
58
  cancelReason: fs.fields.cancelReason.selectedValue || '',
58
- canceledAt: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.canceledAt) || '',
59
- customerUrl: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.customerUrl) || '',
60
- discountApplications: ((_o = fs.props) === null || _o === void 0 ? void 0 : _o.discountApplications) || [],
59
+ canceledAt: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.canceledAt) || '',
60
+ customerUrl: ((_o = fs.props) === null || _o === void 0 ? void 0 : _o.customerUrl) || '',
61
+ discountApplications: ((_p = fs.props) === null || _p === void 0 ? void 0 : _p.discountApplications) || [],
61
62
  physicalLocation: fs.fields.physicalLocation.selectedValue || {
62
63
  id: '',
63
64
  activatable: true,
@@ -76,7 +77,7 @@ class OrderFromFormState extends OrderFactory_1.default {
76
77
  },
77
78
  notes: fs.fields.notes.inputValue || '',
78
79
  userId: (customer === null || customer === void 0 ? void 0 : customer.uid) || '',
79
- customerName: ((_p = fs.props) === null || _p === void 0 ? void 0 : _p.customerName) ||
80
+ customerName: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.customerName) ||
80
81
  (customer.displayName ? customer.displayName : '') ||
81
82
  (customer.firstName && customer.lastName ? `${customer.firstName} ${customer.lastName}` : '') ||
82
83
  (firstName && lastName ? `${firstName} ${lastName}` : ''),
@@ -84,9 +85,9 @@ class OrderFromFormState extends OrderFactory_1.default {
84
85
  phone: (customer === null || customer === void 0 ? void 0 : customer.phone) || fs.fields.phone.inputValue || '',
85
86
  paymentMethod: fs.fields.paymentMethod.selectedValue || '',
86
87
  paymentDetails: fs.fields.paymentDetails.selectedValue || {},
87
- merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '',
88
+ merchantId: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.merchantId) || '',
88
89
  tags: fs.fields.tags.selectedValues || [],
89
- refunds: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.refunds) || [],
90
+ refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [],
90
91
  };
91
92
  return new Order_1.default(Object.assign({}, orderAttributes));
92
93
  }
@@ -46,6 +46,7 @@ class ProductFromFormState extends ProductFactory_1.default {
46
46
  shoeSize: props.fields.shoeSize.selectedValue,
47
47
  measurements: props.fields.measurements.selectedValue || {},
48
48
  featuredCollections: props.fields.featuredCollections.selectedValues || [],
49
+ tags: props.fields.tags.selectedValues || [],
49
50
  };
50
51
  const consignmentAttributes = {
51
52
  previousSellers: props.fields.previousSellers.selectedValues,
@@ -71,6 +71,7 @@ class ProductFormState extends FormState_1.default {
71
71
  this.fields.rfidTag = this.fieldFactory('textInput', 'rfidTag');
72
72
  this.fields.locationIds = this.fieldFactory('multiSelect', 'locationIds');
73
73
  this.fields.featuredCollections = this.fieldFactory('multiSelect', 'featuredCollections');
74
+ this.fields.tags = this.fieldFactory('multiSelect', 'tags');
74
75
  }
75
76
  autoCreateTitle() {
76
77
  return this.createProduct().autoCreateTitle();
@@ -508,6 +509,16 @@ class ProductFormState extends FormState_1.default {
508
509
  }
509
510
  hidden = this.props.productStyle.length < 1;
510
511
  }
512
+ if (fieldKey === 'tags') {
513
+ if (this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length > 0) {
514
+ this.props.tags.forEach((tag) => {
515
+ if (!options.map((o) => o.value).includes(tag)) {
516
+ options.splice(0, 0, { label: tag, value: tag });
517
+ }
518
+ });
519
+ }
520
+ hidden = Boolean(this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length < 1);
521
+ }
511
522
  if (fieldKey === 'clothingSize') {
512
523
  if (this.props.gender === 'Woman') {
513
524
  options = [
@@ -50,6 +50,7 @@ class Product extends Base_1.default {
50
50
  condition: (props === null || props === void 0 ? void 0 : props.condition) || '',
51
51
  measurements: (props === null || props === void 0 ? void 0 : props.measurements) || {},
52
52
  featuredCollections: (props === null || props === void 0 ? void 0 : props.featuredCollections) || [],
53
+ tags: (props === null || props === void 0 ? void 0 : props.tags) || [],
53
54
  };
54
55
  this.consignmentAttributes = {
55
56
  sellRequestImageUrls: (props === null || props === void 0 ? void 0 : props.sellRequestImageUrls) || [],
@@ -39,6 +39,7 @@ declare type ProductFilterAttributes = {
39
39
  shoeSize: string;
40
40
  measurements: Measurements;
41
41
  featuredCollections?: string[];
42
+ tags?: string[];
42
43
  };
43
44
  declare type ProductConsignmentAttributes = {
44
45
  sellRequestImageUrls: string[];
@@ -138,6 +139,7 @@ declare type ProductFilterAttributesFormFields = {
138
139
  productStyle: MultiSelectFormField<string>;
139
140
  shoeSize: SingleSelectFormField<string>;
140
141
  featuredCollections: MultiSelectFormField<string>;
142
+ tags: MultiSelectFormField<string>;
141
143
  };
142
144
  declare type ProductConsignmentAttributesFormFields = {
143
145
  previousSellers: MultiSelectFormField<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.4.71",
3
+ "version": "2.4.72",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",