rerobe-js-orm 4.2.5 → 4.2.6

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.
@@ -80,7 +80,7 @@ class Utilities {
80
80
  }
81
81
  sanitizeMillisTimeStamp(t) {
82
82
  if (t && typeof t === 'number') {
83
- return t;
83
+ return Math.max(t, 0);
84
84
  }
85
85
  if (t && typeof t === 'string') {
86
86
  const result = Date.parse(t);
@@ -60,11 +60,11 @@ export default class Product extends Base {
60
60
  label: string;
61
61
  value: string;
62
62
  }[];
63
+ sanitizeCommission(): number;
63
64
  private materialCompTagsArrayForShopify;
64
65
  private materialCompJoinedString;
65
66
  private measurementsJoinedString;
66
67
  private convertMaterialCompJoinedStrToObj;
67
68
  private sanitizeMaterialComp;
68
- private sanitizeCommission;
69
69
  private validateInventoryLocation;
70
70
  }
@@ -316,7 +316,7 @@ class Product extends Base_1.default {
316
316
  productCategory: this.utilities.sanitizeString(this.filterAttributes.productCategory),
317
317
  productType: this.utilities.sanitizeString(this.filterAttributes.productType),
318
318
  productStyle: this.utilities.sanitzeStringArr(this.filterAttributes.productStyle),
319
- calculatedCommission: this.utilities.sanitizeNumber(calculatedCommission),
319
+ calculatedCommission: this.utilities.sanitizeNumber(calculatedCommission, this.sanitizeCommission()),
320
320
  reRobeCommission: this.sanitizeCommission(),
321
321
  rfidTag: this.utilities.sanitizeString(this.attributes.rfidTag),
322
322
  sku: this.utilities.sanitizeString(this.attributes.sku),
@@ -1000,6 +1000,12 @@ class Product extends Base_1.default {
1000
1000
  value: key,
1001
1001
  };
1002
1002
  }
1003
+ if (key === 'size') {
1004
+ return {
1005
+ label: 'Label Size',
1006
+ value: key,
1007
+ };
1008
+ }
1003
1009
  if (key === 'gender') {
1004
1010
  return {
1005
1011
  label: this.utilities.humanize('primarySegment'),
@@ -1017,9 +1023,18 @@ class Product extends Base_1.default {
1017
1023
  value: key,
1018
1024
  };
1019
1025
  })
1020
- .filter((obj) => ![...restrictedKeys, ...systemManagedKeys, ...configurableAfterCreationKeys, ...obsoleteKeys].includes(obj.value));
1026
+ .filter((obj) => ![
1027
+ ...restrictedKeys,
1028
+ ...systemManagedKeys,
1029
+ ...configurableAfterCreationKeys,
1030
+ ...obsoleteKeys,
1031
+ ...timestampAttributeKeys,
1032
+ ].includes(obj.value));
1021
1033
  return options;
1022
1034
  }
1035
+ sanitizeCommission() {
1036
+ return parseFloat(ReRobeProductHelpers_1.default.commissionFixer(this.consignmentAttributes.reRobeCommission));
1037
+ }
1023
1038
  materialCompTagsArrayForShopify() {
1024
1039
  return Object.keys(this.filterAttributes.materialComposition).reduce((acc, cur, idx) => {
1025
1040
  acc.push(`${cur} ${Object.values(this.filterAttributes.materialComposition)[idx]}`);
@@ -1087,16 +1102,6 @@ class Product extends Base_1.default {
1087
1102
  }
1088
1103
  return materialComp;
1089
1104
  }
1090
- sanitizeCommission() {
1091
- const com = this.consignmentAttributes.reRobeCommission;
1092
- if (Number.isNaN(parseFloat(String(com)))) {
1093
- return 0.5;
1094
- }
1095
- if (parseFloat(String(com)) <= 1) {
1096
- return parseFloat(String(com));
1097
- }
1098
- return parseFloat(String(com)) / 100;
1099
- }
1100
1105
  validateInventoryLocation(locationLike) {
1101
1106
  if (locationLike && Array.isArray(locationLike) && locationLike.length > 0) {
1102
1107
  return locationLike
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",