rerobe-js-orm 3.7.2 → 3.7.4

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.
@@ -36,9 +36,9 @@ const statusOptions = Object.values(product_constants_1.PRODUCT_STATES).map((val
36
36
  exports.statusOptions = statusOptions;
37
37
  const measurementCategoryOptions = [
38
38
  {
39
- label: 'Suits & Blazers',
40
- value: 'Suits & Blazers',
41
- measurementFields: ['chestCircumference', 'waistCircumference', 'length', 'shoulderWidth', 'sleeveLength'],
39
+ label: 'Accessories',
40
+ value: 'Accessories',
41
+ measurementFields: ['width', 'height', 'depth'],
42
42
  },
43
43
  {
44
44
  label: 'Bottoms',
@@ -51,20 +51,15 @@ const measurementCategoryOptions = [
51
51
  measurementFields: ['length', 'height', 'width', 'handDrop', 'shoulderDrop'],
52
52
  },
53
53
  {
54
- label: 'Shirts',
55
- value: 'Shirts',
56
- measurementFields: ['neckCircumference', 'collarLength', 'sleeveLength', 'chestCircumference'],
54
+ label: 'Blazers & Jackets',
55
+ value: 'Blazers & Jackets',
56
+ measurementFields: ['chestCircumference', 'waistCircumference', 'length', 'shoulderWidth', 'sleeveLength'],
57
57
  },
58
58
  {
59
59
  label: 'Coats',
60
60
  value: 'Coats',
61
61
  measurementFields: ['chestCircumference', 'waistCircumference', 'length', 'shoulderWidth', 'sleeveLength'],
62
62
  },
63
- {
64
- label: 'Shoes',
65
- value: 'Shoes',
66
- measurementFields: ['footLength', 'footWidth', 'heelHeight', 'shaftHeight', 'calfCircumference'],
67
- },
68
63
  {
69
64
  label: 'Dresses',
70
65
  value: 'Dresses',
@@ -78,9 +73,14 @@ const measurementCategoryOptions = [
78
73
  ],
79
74
  },
80
75
  {
81
- label: 'Hats',
82
- value: 'Hats',
83
- measurementFields: ['headCircumference', 'brimWidth', 'crownHeight'],
76
+ label: 'Eyewear',
77
+ value: 'Eyewear',
78
+ measurementFields: ['lensWidth', 'bridgeWidth', 'templeLength'],
79
+ },
80
+ {
81
+ label: 'General Items',
82
+ value: 'General Items',
83
+ measurementFields: ['width', 'height', 'depth'],
84
84
  },
85
85
  {
86
86
  label: 'Gloves',
@@ -88,19 +88,34 @@ const measurementCategoryOptions = [
88
88
  measurementFields: ['handLength', 'handCircumference', 'fingerLength'],
89
89
  },
90
90
  {
91
- label: 'Accessories',
92
- value: 'Accessories',
93
- measurementFields: ['width', 'height', 'depth'],
91
+ label: 'Hats',
92
+ value: 'Hats',
93
+ measurementFields: ['headCircumference', 'brimWidth', 'crownHeight'],
94
94
  },
95
95
  {
96
- label: 'Eyewear',
97
- value: 'Eyewear',
98
- measurementFields: ['lensWidth', 'bridgeWidth', 'templeLength'],
96
+ label: 'Shirts',
97
+ value: 'Shirts',
98
+ measurementFields: ['neckCircumference', 'collarLength', 'sleeveLength', 'chestCircumference'],
99
99
  },
100
100
  {
101
- label: 'General Items',
102
- value: 'General Items',
103
- measurementFields: ['width', 'height', 'depth'],
101
+ label: 'Shoes',
102
+ value: 'Shoes',
103
+ measurementFields: ['footLength', 'footWidth', 'heelHeight', 'shaftHeight', 'calfCircumference'],
104
+ },
105
+ {
106
+ label: 'Suits',
107
+ value: 'Suits',
108
+ measurementFields: [
109
+ 'chestCircumference',
110
+ 'waistCircumference',
111
+ 'length',
112
+ 'shoulderWidth',
113
+ 'sleeveLength',
114
+ 'waistCircumference',
115
+ 'innerLeg',
116
+ 'outerLeg',
117
+ 'footCircumference',
118
+ ],
104
119
  },
105
120
  ];
106
121
  exports.measurementCategoryOptions = measurementCategoryOptions;
@@ -356,8 +356,10 @@ class OrderHelpers {
356
356
  .map((item) => {
357
357
  // Determine if the product is on sale and set the price accordingly
358
358
  const price = item.product.isOnSale && item.product.clearanceTimestamp ? item.product.salePrice : item.product.price;
359
- const basePrice = Number(price || 0) * Number(item.quantity);
360
- // Apply tax if the item is taxable
359
+ let basePrice = Number(price || 0) * Number(item.quantity);
360
+ if (item.discountedPrice !== undefined) {
361
+ basePrice = Number(item.discountedPrice); // Discounted price includes quantity
362
+ }
361
363
  if (item.isTaxable && item.taxRate) {
362
364
  const taxAmount = basePrice * Number(item.taxRate); // Calculate the tax based on the base price
363
365
  return basePrice + taxAmount; // Return the total including tax
@@ -1046,7 +1046,16 @@ class Product extends Base_1.default {
1046
1046
  }
1047
1047
  validateInventoryLocation(locationLike) {
1048
1048
  if (locationLike && Array.isArray(locationLike) && locationLike.length > 0) {
1049
- return locationLike.filter((v) => v && Object.keys(v).every((e) => ['id', 'name', 'availableAmount', 'incomingAmount'].includes(e)));
1049
+ return locationLike
1050
+ .filter((v) => v && v.id && v.name)
1051
+ .map((v) => {
1052
+ return {
1053
+ id: v.id,
1054
+ name: v.name,
1055
+ availableAmount: (v === null || v === void 0 ? void 0 : v.availableAmount) || 0,
1056
+ incomingAmount: (v === null || v === void 0 ? void 0 : v.incomingAmount) || 0,
1057
+ };
1058
+ });
1050
1059
  }
1051
1060
  return [];
1052
1061
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.7.2",
3
+ "version": "3.7.4",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",