rerobe-js-orm 4.1.1 → 4.1.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.
|
@@ -30,13 +30,13 @@ class ProductFormState extends FormState_1.default {
|
|
|
30
30
|
this.fields.measurements = this.fieldFactory('singleSelect', 'measurements');
|
|
31
31
|
// ProductFilterAttributesFormFields
|
|
32
32
|
this.fields.brand = this.fieldFactory('singleSelect', 'brand', options_1.brands);
|
|
33
|
+
this.fields.color = this.fieldFactory('singleSelect', 'color', options_1.colors);
|
|
34
|
+
this.fields.condition = this.fieldFactory('singleSelect', 'condition', options_1.conditions);
|
|
35
|
+
this.fields.gender = this.fieldFactory('singleSelect', 'gender', options_1.genderOptions);
|
|
33
36
|
this.fields.measurementCategory = this.fieldFactory('singleSelect', 'measurementCategory', options_1.measurementCategoryOptions);
|
|
34
37
|
this.fields.size = this.fieldFactory('singleSelect', 'size', options_1.clothingSizeOptions);
|
|
35
38
|
this.fields.standardSize = this.fieldFactory('singleSelect', 'standardSize', options_1.clothingSizeOptions);
|
|
36
39
|
this.fields.internationalSize = this.fieldFactory('singleSelect', 'internationalSize', []);
|
|
37
|
-
this.fields.color = this.fieldFactory('singleSelect', 'color', options_1.colors);
|
|
38
|
-
this.fields.condition = this.fieldFactory('singleSelect', 'condition', options_1.conditions);
|
|
39
|
-
this.fields.gender = this.fieldFactory('singleSelect', 'gender', options_1.genderOptions);
|
|
40
40
|
this.fields.materialComposition = this.fieldFactory('singleSelect', 'materialComposition', options_1.clothingMaterials);
|
|
41
41
|
this.fields.priceRange = this.fieldFactory('textInput', 'priceRange');
|
|
42
42
|
this.fields.productCategory = this.fieldFactory('singleSelect', 'productCategory', options_1.productCategories);
|
|
@@ -436,11 +436,12 @@ class ProductFormState extends FormState_1.default {
|
|
|
436
436
|
return options;
|
|
437
437
|
}
|
|
438
438
|
measurementCategorySelectHandler(value) {
|
|
439
|
+
var _a;
|
|
439
440
|
// Mutate measurementCategory selectedValue and valid prop
|
|
440
441
|
this.fields.measurementCategory.selectedValue = value;
|
|
441
442
|
this.fields.measurementCategory.valid = !!value;
|
|
442
443
|
// Update standardSize fields based on new measurementCategory value and selected gender
|
|
443
|
-
this.fields.standardSize.options = this.setStandardSizeOptionsFromGenderAndMeasurementCategory(value, this.fields.gender.selectedValue);
|
|
444
|
+
this.fields.standardSize.options = this.setStandardSizeOptionsFromGenderAndMeasurementCategory(value, ((_a = this.fields.gender) === null || _a === void 0 ? void 0 : _a.selectedValue) || '');
|
|
444
445
|
this.fields.standardSize.hidden = !value;
|
|
445
446
|
this.fields.standardSize.valid = false;
|
|
446
447
|
this.fields.standardSize.selectedValue = '';
|
|
@@ -451,17 +452,12 @@ class ProductFormState extends FormState_1.default {
|
|
|
451
452
|
this.fields.internationalSize.hidden = !value;
|
|
452
453
|
}
|
|
453
454
|
setStandardSizeOptionsFromGenderAndMeasurementCategory(measurementCategory, genderSelected) {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
'L',
|
|
461
|
-
'XL',
|
|
462
|
-
'XXL',
|
|
463
|
-
'3XL',
|
|
464
|
-
].map((v) => ({ label: v, value: v, internationalSizes: [] }));
|
|
455
|
+
const standardSizeOptions = ['One Size', 'Adjustable', 'XS', 'S', 'M', 'L', 'XL', 'XXL', '3XL'];
|
|
456
|
+
let options = standardSizeOptions.map((v) => ({
|
|
457
|
+
label: v,
|
|
458
|
+
value: v,
|
|
459
|
+
internationalSizes: [],
|
|
460
|
+
}));
|
|
465
461
|
if (measurementCategory &&
|
|
466
462
|
genderSelected &&
|
|
467
463
|
this.opts &&
|
|
@@ -469,7 +465,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
469
465
|
Object.keys(this.opts.sizeTaxonomy).length > 0) {
|
|
470
466
|
const t = this.opts.sizeTaxonomy;
|
|
471
467
|
const { [genderSelected]: { [measurementCategory]: standardSizeArr = [] } = {} } = t;
|
|
472
|
-
options = standardSizeArr;
|
|
468
|
+
options = standardSizeArr.length > 0 ? standardSizeArr : options;
|
|
473
469
|
}
|
|
474
470
|
let selectedStandardSizeOptions = [];
|
|
475
471
|
if (this.props.standardSize) {
|
|
@@ -483,25 +479,28 @@ class ProductFormState extends FormState_1.default {
|
|
|
483
479
|
return options;
|
|
484
480
|
}
|
|
485
481
|
standardSizeSelectHandler(value) {
|
|
482
|
+
var _a;
|
|
486
483
|
// Mutate standardSize selectedValue and valid prop
|
|
487
484
|
this.fields.standardSize.selectedValue = value;
|
|
488
485
|
this.fields.standardSize.valid = !!value;
|
|
489
486
|
// Update internationalSizes fields based on selected value and measurementCategory selected
|
|
490
487
|
// and resets other props
|
|
491
|
-
this.fields.internationalSize.options = this.setInternationalSizeOptionsFromPassedOptions(this.fields.measurementCategory.selectedValue, value);
|
|
488
|
+
this.fields.internationalSize.options = this.setInternationalSizeOptionsFromPassedOptions(((_a = this.fields.measurementCategory) === null || _a === void 0 ? void 0 : _a.selectedValue) || '', value);
|
|
492
489
|
this.fields.internationalSize.selectedValue = '';
|
|
493
490
|
this.fields.internationalSize.valid = false;
|
|
494
491
|
this.fields.internationalSize.hidden = false;
|
|
495
492
|
}
|
|
496
493
|
setInternationalSizeOptionsFromPassedOptions(measurementCategory, standardSize) {
|
|
494
|
+
var _a;
|
|
497
495
|
let options = [];
|
|
498
496
|
if (this.opts &&
|
|
499
497
|
this.opts.sizeTaxonomy &&
|
|
500
498
|
Object.keys(this.opts.sizeTaxonomy).length > 0 &&
|
|
501
499
|
measurementCategory &&
|
|
502
|
-
standardSize
|
|
500
|
+
standardSize &&
|
|
501
|
+
this.fields.gender) {
|
|
503
502
|
const t = this.opts.sizeTaxonomy;
|
|
504
|
-
const genderSelected = this.fields.gender.selectedValue;
|
|
503
|
+
const genderSelected = ((_a = this.fields.gender) === null || _a === void 0 ? void 0 : _a.selectedValue) || '';
|
|
505
504
|
const { [genderSelected]: { [measurementCategory]: standardSizeArr = [] } = {} } = t;
|
|
506
505
|
const [sSize] = standardSizeArr.filter((p) => p.value === standardSize);
|
|
507
506
|
if (sSize) {
|
package/lib/models/Product.js
CHANGED
|
@@ -293,7 +293,7 @@ class Product extends Base_1.default {
|
|
|
293
293
|
brand: this.utilities.sanitizeString(this.filterAttributes.brand),
|
|
294
294
|
size: this.utilities.sanitizeString(this.filterAttributes.size),
|
|
295
295
|
standardSize: this.utilities.sanitizeString(this.filterAttributes.standardSize),
|
|
296
|
-
internationalSize: this.utilities.sanitizeString(this.filterAttributes.
|
|
296
|
+
internationalSize: this.utilities.sanitizeString(this.filterAttributes.internationalSize),
|
|
297
297
|
clothingSize: this.utilities.sanitzeStringArr(this.filterAttributes.clothingSize),
|
|
298
298
|
jeanSize: this.utilities.sanitizeString(this.filterAttributes.jeanSize),
|
|
299
299
|
shoeSize: this.utilities.sanitizeString(this.filterAttributes.shoeSize),
|