rerobe-js-orm 3.7.6 → 3.7.8

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.
@@ -84,6 +84,7 @@ class ProductFromFormState extends ProductFactory_1.default {
84
84
  inventoryLocations: props.fields.inventoryLocations.selectedValues || [],
85
85
  majorDefects: props.fields.majorDefects.selectedValues || [],
86
86
  minorDefects: props.fields.minorDefects.selectedValues || [],
87
+ careInstructions: props.fields.careInstructions.inputValue || '',
87
88
  };
88
89
  const timestampAttributes = {
89
90
  createdAtTimestamp: (_u = props.props) === null || _u === void 0 ? void 0 : _u.createdAtTimestamp,
@@ -34,18 +34,19 @@ class ProductFormState extends FormState_1.default {
34
34
  this.fields.size = this.fieldFactory('singleSelect', 'size', options_1.clothingSizeOptions);
35
35
  this.fields.color = this.fieldFactory('singleSelect', 'color', options_1.colors);
36
36
  this.fields.condition = this.fieldFactory('singleSelect', 'condition', options_1.conditions);
37
- this.fields.majorDefects = this.fieldFactory('multiSelect', 'majorDefects', options_1.majorDefectOptions);
38
- this.fields.minorDefects = this.fieldFactory('multiSelect', 'minorDefects', options_1.minorDefectOptions);
39
37
  this.fields.gender = this.fieldFactory('singleSelect', 'gender', options_1.genderOptions);
40
38
  this.fields.materialComposition = this.fieldFactory('singleSelect', 'materialComposition', options_1.clothingMaterials);
41
39
  this.fields.priceRange = this.fieldFactory('textInput', 'priceRange');
42
40
  this.fields.productCategory = this.fieldFactory('singleSelect', 'productCategory', options_1.productCategories);
43
41
  this.fields.productType = this.fieldFactory('singleSelect', 'productType');
44
42
  this.fields.productStyle = this.fieldFactory('multiSelect', 'productStyle');
43
+ this.fields.careInstructions = this.fieldFactory('textInput', 'careInstructions');
45
44
  // Deprecated soon
46
45
  this.fields.clothingSize = this.fieldFactory('multiSelect', 'clothingSize', options_1.clothingSizeOptions);
47
46
  this.fields.shoeSize = this.fieldFactory('singleSelect', 'shoeSize', options_1.shoeSizes);
48
47
  this.fields.jeanSize = this.fieldFactory('singleSelect', 'jeanSize', options_1.jeanSizes);
48
+ this.fields.majorDefects = this.fieldFactory('multiSelect', 'majorDefects', options_1.majorDefectOptions);
49
+ this.fields.minorDefects = this.fieldFactory('multiSelect', 'minorDefects', options_1.minorDefectOptions);
49
50
  // ProductConsignmentAttributesFormFields
50
51
  this.fields.publishType = this.fieldFactory('singleSelect', 'publishType', options_1.publishTypeOptions);
51
52
  this.fields.conditionRemarks = this.fieldFactory('textInput', 'conditionRemarks');
@@ -740,6 +741,7 @@ class ProductFormState extends FormState_1.default {
740
741
  }
741
742
  hidden = this.props.productCategory !== 'Clothing' || this.props.productType === 'Jeans';
742
743
  }
744
+ // ToDo: Deprecate
743
745
  if (fieldKey === 'majorDefects') {
744
746
  let selectedMajorDefectsOptions = [];
745
747
  if (this.props.majorDefects && Array.isArray(this.props.majorDefects) && this.props.majorDefects.length > 0) {
@@ -751,6 +753,7 @@ class ProductFormState extends FormState_1.default {
751
753
  }
752
754
  options = this.utilities.uniqObjArray([...selectedMajorDefectsOptions, ...majorDefectsOptions], 'value');
753
755
  }
756
+ // ToDo: Deprecate
754
757
  if (fieldKey === 'minorDefects') {
755
758
  let selectedMinorDefectsOptions = [];
756
759
  if (this.props.minorDefects && Array.isArray(this.props.minorDefects) && this.props.minorDefects.length > 0) {
@@ -12,6 +12,25 @@ export default class Product extends Base {
12
12
  toProductInputObjForShopifyV2(locationId: string, weightUnit?: string): any[];
13
13
  toObjForTextTranslation(): TranslatableAttributes;
14
14
  toObjForTypesense(): TypesenseProductObj;
15
+ buildUpdatedFieldsForSalesChannel(): {
16
+ title: string;
17
+ description: string;
18
+ price: string;
19
+ gender: string;
20
+ productCategory: string;
21
+ productType: string;
22
+ productStyle: string[];
23
+ brand: string;
24
+ color: string;
25
+ size: string;
26
+ materialComposition: MaterialComposition;
27
+ salePrice: string;
28
+ isOnSale: string;
29
+ discountType: string;
30
+ discountValue: string;
31
+ selectedForClearance: string;
32
+ status: string;
33
+ };
15
34
  updateSelfFromTranslatedTextArray(translatedTextArray?: string[]): void;
16
35
  autoCreateTitle(): string;
17
36
  autoCreateMetaDataTitle(): string;
@@ -86,6 +86,7 @@ class Product extends Base_1.default {
86
86
  inventoryLocations: this.validateInventoryLocation(props === null || props === void 0 ? void 0 : props.inventoryLocations) || [],
87
87
  majorDefects: (props === null || props === void 0 ? void 0 : props.majorDefects) || [],
88
88
  minorDefects: (props === null || props === void 0 ? void 0 : props.minorDefects) || [],
89
+ careInstructions: (props === null || props === void 0 ? void 0 : props.careInstructions) || '',
89
90
  };
90
91
  this.timestampAttributes = {
91
92
  createdAtTimestamp: (props === null || props === void 0 ? void 0 : props.createdAtTimestamp) ? Number(props === null || props === void 0 ? void 0 : props.createdAtTimestamp) : null,
@@ -379,6 +380,27 @@ class Product extends Base_1.default {
379
380
  });
380
381
  return stagedObj;
381
382
  }
383
+ buildUpdatedFieldsForSalesChannel() {
384
+ return {
385
+ title: this.attributes.title,
386
+ description: this.attributes.description,
387
+ price: this.attributes.price,
388
+ gender: this.filterAttributes.gender,
389
+ productCategory: this.filterAttributes.productCategory,
390
+ productType: this.filterAttributes.productType,
391
+ productStyle: this.filterAttributes.productStyle,
392
+ brand: this.filterAttributes.brand,
393
+ color: this.filterAttributes.color,
394
+ size: this.filterAttributes.size,
395
+ materialComposition: this.filterAttributes.materialComposition,
396
+ salePrice: this.consignmentAttributes.salePrice,
397
+ isOnSale: this.consignmentAttributes.isOnSale,
398
+ discountType: this.consignmentAttributes.discountType,
399
+ discountValue: this.consignmentAttributes.discountValue,
400
+ selectedForClearance: this.consignmentAttributes.selectedForClearance,
401
+ status: this.consignmentAttributes.status,
402
+ };
403
+ }
382
404
  updateSelfFromTranslatedTextArray(translatedTextArray = []) {
383
405
  const checkFieldTranslated = (val) => {
384
406
  return val !== this.FIELD_NOT_TRANSLATABLE_KEY;
@@ -469,13 +491,11 @@ class Product extends Base_1.default {
469
491
  var _a;
470
492
  const { compareAtPrice } = this.attributes;
471
493
  const { color, productCategory, productType, productStyle, condition, gender, size } = this.filterAttributes;
472
- const { productRemarks, conditionRemarks, purchasePrice, yearPurchased, sizeComment, majorDefects, minorDefects } = this.consignmentAttributes;
494
+ const { productRemarks, conditionRemarks, purchasePrice, yearPurchased, sizeComment, careInstructions } = this.consignmentAttributes;
473
495
  const measurements = this.measurementsJoinedString(this.filterAttributes.measurements);
474
496
  const materials = this.materialCompJoinedString();
475
497
  const fit = ((_a = options_1.sizeCommentOptions.find((option) => option.value === sizeComment)) === null || _a === void 0 ? void 0 : _a.label) || '';
476
498
  const joinedProductStyle = productStyle.join(', ');
477
- const joinedMajorDefects = majorDefects.join(', ');
478
- const joinedMinorDefects = minorDefects.join(', ');
479
499
  const numberFormatter = new Intl.NumberFormat(locale, {
480
500
  style: 'currency',
481
501
  currency,
@@ -527,8 +547,7 @@ class Product extends Base_1.default {
527
547
  title: 'Additional Remarks',
528
548
  attributes: [
529
549
  productRemarks && `${t('Remarks')}: ${t(productRemarks)}`,
530
- majorDefects.length > 0 && `${t('Major Defects')}: ${t(joinedMajorDefects)}`,
531
- minorDefects.length > 0 && `${t('Minor Defects')}: ${t(joinedMinorDefects)}`,
550
+ careInstructions && `${t('Care instrutions')}: ${t(careInstructions)}`,
532
551
  ].filter(Boolean),
533
552
  },
534
553
  ];
@@ -77,6 +77,7 @@ type ProductConsignmentAttributes = {
77
77
  inventoryLocations: InventoryLocation[];
78
78
  majorDefects: string[];
79
79
  minorDefects: string[];
80
+ careInstructions: string;
80
81
  };
81
82
  type ProductTimestampAttributes = {
82
83
  createdAtTimestamp: number | null;
@@ -211,6 +212,7 @@ type ProductConsignmentAttributesFormFields = {
211
212
  inventoryLocations: MultiSelectFormField<InventoryLocation>;
212
213
  majorDefects: MultiSelectFormField<string>;
213
214
  minorDefects: MultiSelectFormField<string>;
215
+ careInstructions: TextInputFormField<string>;
214
216
  };
215
217
  type ProductFormFields = ProductAttributesFormFields & ProductFilterAttributesFormFields & ProductConsignmentAttributesFormFields;
216
218
  interface ParamsForBuildProductInputObjForShopify {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.7.6",
3
+ "version": "3.7.8",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",