rerobe-js-orm 3.0.21 → 3.0.23
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.
- package/lib/factories/Product/ProductFromFormState.js +1 -0
- package/lib/form-states/Product/ProductFormState.d.ts +1 -1
- package/lib/form-states/Product/ProductFormState.js +16 -6
- package/lib/form-states/Product/options.d.ts +5 -0
- package/lib/form-states/Product/options.js +66 -1
- package/lib/models/Product.js +8 -0
- package/lib/types/rerobe-product-types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
37
37
|
const productFilterAttributes = {
|
|
38
38
|
documentId: (_o = props.props) === null || _o === void 0 ? void 0 : _o.documentId,
|
|
39
39
|
brand: props.fields.brand.selectedValue,
|
|
40
|
+
sizeCategory: props.fields.sizeCategory.selectedValue,
|
|
40
41
|
size: props.fields.size.selectedValue,
|
|
41
42
|
clothingSize: props.fields.clothingSize.selectedValues,
|
|
42
43
|
jeanSize: props.fields.jeanSize.selectedValue,
|
|
@@ -32,7 +32,6 @@ export default class ProductFormState extends FormState {
|
|
|
32
32
|
autoCreateDescription(): string;
|
|
33
33
|
createProduct(): Product;
|
|
34
34
|
private priceInputChangeHandler;
|
|
35
|
-
private setGenderFromPassedOptions;
|
|
36
35
|
private genderSelectHandler;
|
|
37
36
|
private geWeightArray;
|
|
38
37
|
private findWeightRange;
|
|
@@ -42,6 +41,7 @@ export default class ProductFormState extends FormState {
|
|
|
42
41
|
private productCategorySelectHandler;
|
|
43
42
|
private productTypeSelectHandler;
|
|
44
43
|
private setPriceRangeFromPrice;
|
|
44
|
+
private setGenderFromPassedOptions;
|
|
45
45
|
private setProductCategoreisFromGender;
|
|
46
46
|
private setProductTypesFromCategory;
|
|
47
47
|
private setProductTypesFromPassedOptions;
|
|
@@ -29,6 +29,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
29
29
|
this.fields.measurements = this.fieldFactory('singleSelect', 'measurements');
|
|
30
30
|
// ProductFilterAttributesFormFields
|
|
31
31
|
this.fields.brand = this.fieldFactory('singleSelect', 'brand', options_1.brands);
|
|
32
|
+
this.fields.sizeCategory = this.fieldFactory('singleSelect', 'sizeCategory', options_1.sizeCategoryOptions);
|
|
32
33
|
this.fields.size = this.fieldFactory('singleSelect', 'size', options_1.clothingSizeOptions);
|
|
33
34
|
this.fields.color = this.fieldFactory('singleSelect', 'color', options_1.colors);
|
|
34
35
|
this.fields.condition = this.fieldFactory('singleSelect', 'condition', options_1.conditions);
|
|
@@ -99,12 +100,6 @@ class ProductFormState extends FormState_1.default {
|
|
|
99
100
|
// Recalculates salePrice
|
|
100
101
|
this.props.salePrice = this.calculateSalePrice();
|
|
101
102
|
}
|
|
102
|
-
setGenderFromPassedOptions() {
|
|
103
|
-
if (this.opts && this.opts.taxonomy && Object.keys(this.opts.taxonomy).length > 0) {
|
|
104
|
-
return Object.keys(this.opts.taxonomy).map((t) => ({ label: t, value: t }));
|
|
105
|
-
}
|
|
106
|
-
return options_1.gender;
|
|
107
|
-
}
|
|
108
103
|
genderSelectHandler(value) {
|
|
109
104
|
// Mutate gender selectedValue and valid prop
|
|
110
105
|
this.fields.gender.selectedValue = value;
|
|
@@ -260,6 +255,12 @@ class ProductFormState extends FormState_1.default {
|
|
|
260
255
|
}
|
|
261
256
|
return '1000+';
|
|
262
257
|
}
|
|
258
|
+
setGenderFromPassedOptions() {
|
|
259
|
+
if (this.opts && this.opts.taxonomy && Object.keys(this.opts.taxonomy).length > 0) {
|
|
260
|
+
return Object.keys(this.opts.taxonomy).map((t) => ({ label: t, value: t }));
|
|
261
|
+
}
|
|
262
|
+
return options_1.gender;
|
|
263
|
+
}
|
|
263
264
|
setProductCategoreisFromGender(genderSelected) {
|
|
264
265
|
let productCategoryOptions = [];
|
|
265
266
|
if (this.opts && this.opts.taxonomy && Object.keys(this.opts.taxonomy).length > 0 && genderSelected) {
|
|
@@ -605,6 +606,15 @@ class ProductFormState extends FormState_1.default {
|
|
|
605
606
|
}
|
|
606
607
|
}
|
|
607
608
|
}
|
|
609
|
+
if (fieldKey === 'sizeCategory') {
|
|
610
|
+
let selectedOptions = [];
|
|
611
|
+
if (this.props.sizeCategory) {
|
|
612
|
+
selectedOptions = [{ label: this.props.sizeCategory, value: this.props.sizeCategory }];
|
|
613
|
+
if (!options.map((o) => o.value).includes(this.props.sizeCategory)) {
|
|
614
|
+
options.splice(0, 0, ...selectedOptions);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
608
618
|
if (fieldKey === 'primaryAgeCategory') {
|
|
609
619
|
let selectedPrimaryAgeCategoryOptions = [];
|
|
610
620
|
if (this.props.primaryAgeCategory) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.minorDefectOptions = exports.majorDefectOptions = exports.productOptions = exports.productIsOnSaleOptions = exports.discountTypeOptions = exports.salesChannelOptions = exports.unisexJewelry = exports.mensJewelry = exports.jewelry = exports.unisexAccessories = exports.mensAccessories = exports.accessories = exports.unisexBags = exports.mensBags = exports.bags = exports.weightUnits = exports.productWeightRanges = exports.unisexShoes = exports.mensShoes = exports.shoes = exports.unisexClothing = exports.mensClothing = exports.clothing = exports.productCategories = exports.clothingMaterials = exports.shoeSizes = exports.jeanSizes = exports.gender = exports.conditions = exports.colors = exports.brands = exports.sizeCommentOptions = exports.manClothingSizeOptions = exports.womanClothingSizeOptions = exports.clothingSizeOptions = exports.sizeOptions = exports.statusOptions = exports.publishTypeOptions = exports.availableForSaleOptions = void 0;
|
|
3
|
+
exports.sizeCategoryOptions = exports.minorDefectOptions = exports.majorDefectOptions = exports.productOptions = exports.productIsOnSaleOptions = exports.discountTypeOptions = exports.salesChannelOptions = exports.unisexJewelry = exports.mensJewelry = exports.jewelry = exports.unisexAccessories = exports.mensAccessories = exports.accessories = exports.unisexBags = exports.mensBags = exports.bags = exports.weightUnits = exports.productWeightRanges = exports.unisexShoes = exports.mensShoes = exports.shoes = exports.unisexClothing = exports.mensClothing = exports.clothing = exports.productCategories = exports.clothingMaterials = exports.shoeSizes = exports.jeanSizes = exports.gender = exports.conditions = exports.colors = exports.brands = exports.sizeCommentOptions = exports.manClothingSizeOptions = exports.womanClothingSizeOptions = exports.clothingSizeOptions = exports.sizeOptions = exports.statusOptions = exports.publishTypeOptions = exports.availableForSaleOptions = void 0;
|
|
4
4
|
const product_constants_1 = require("../../constants/product-constants");
|
|
5
5
|
const lodash_1 = require("lodash");
|
|
6
6
|
const availableForSaleOptions = [
|
|
@@ -34,6 +34,71 @@ const statusOptions = Object.values(product_constants_1.PRODUCT_STATES).map((val
|
|
|
34
34
|
value: val,
|
|
35
35
|
}));
|
|
36
36
|
exports.statusOptions = statusOptions;
|
|
37
|
+
const sizeCategoryOptions = [
|
|
38
|
+
{
|
|
39
|
+
label: 'Suits & Blazers',
|
|
40
|
+
value: 'Suits & Blazers',
|
|
41
|
+
measurementFields: ['chestCircumference', 'waistCircumference', 'length', 'shoulderWidth', 'sleeveLength'],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Bottoms',
|
|
45
|
+
value: 'Bottoms',
|
|
46
|
+
measurementFields: ['waistCircumference', 'innerLeg', 'outerLeg', 'footCircumference'],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: 'Shirts',
|
|
50
|
+
value: 'Shirts',
|
|
51
|
+
measurementFields: ['neckCircumference', 'collarLength', 'sleeveLength', 'chestCircumference'],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'Coats',
|
|
55
|
+
value: 'Coats',
|
|
56
|
+
measurementFields: ['chestCircumference', 'waistCircumference', 'length', 'shoulderWidth', 'sleeveLength'],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: 'Shoes',
|
|
60
|
+
value: 'Shoes',
|
|
61
|
+
measurementFields: ['footLength', 'footWidth', 'heelHeight', 'shaftHeight', 'calfCircumference'],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: 'Dresses',
|
|
65
|
+
value: 'Dresses',
|
|
66
|
+
measurementFields: [
|
|
67
|
+
'bustCircumference',
|
|
68
|
+
'waistCircumference',
|
|
69
|
+
'hipCircumference',
|
|
70
|
+
'length',
|
|
71
|
+
'shoulderWidth',
|
|
72
|
+
'sleeveLength',
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: 'Hats',
|
|
77
|
+
value: 'Hats',
|
|
78
|
+
measurementFields: ['headCircumference', 'brimWidth', 'crownHeight'],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: 'Gloves',
|
|
82
|
+
value: 'Gloves',
|
|
83
|
+
measurementFields: ['handLength', 'handCircumference', 'fingerLength'],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
label: 'Accessories',
|
|
87
|
+
value: 'Accessories',
|
|
88
|
+
measurementFields: ['width', 'height', 'depth'],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: 'Eyewear',
|
|
92
|
+
value: 'Eyewear',
|
|
93
|
+
measurementFields: ['lensWidth', 'bridgeWidth', 'templeLength'],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: 'General Items',
|
|
97
|
+
value: 'General Items',
|
|
98
|
+
measurementFields: ['width', 'height', 'depth'],
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
exports.sizeCategoryOptions = sizeCategoryOptions;
|
|
37
102
|
const sizeOptions = [
|
|
38
103
|
{
|
|
39
104
|
label: 'No Size',
|
package/lib/models/Product.js
CHANGED
|
@@ -44,6 +44,7 @@ class Product extends Base_1.default {
|
|
|
44
44
|
jeanSize: (props === null || props === void 0 ? void 0 : props.jeanSize) || '',
|
|
45
45
|
shoeSize: (props === null || props === void 0 ? void 0 : props.shoeSize) || '',
|
|
46
46
|
size: (props === null || props === void 0 ? void 0 : props.size) || '',
|
|
47
|
+
sizeCategory: (props === null || props === void 0 ? void 0 : props.sizeCategory) || '',
|
|
47
48
|
productCategory: (props === null || props === void 0 ? void 0 : props.productCategory) || '',
|
|
48
49
|
productType: (props === null || props === void 0 ? void 0 : props.productType) || '',
|
|
49
50
|
productStyle: (props === null || props === void 0 ? void 0 : props.productStyle) || [],
|
|
@@ -284,6 +285,7 @@ class Product extends Base_1.default {
|
|
|
284
285
|
compareAtPrice: this.utilities.sanitizeNumber(this.attributes.compareAtPrice),
|
|
285
286
|
costPerItem: this.utilities.sanitizeNumber(this.attributes.costPerItem),
|
|
286
287
|
priceRange: this.utilities.sanitizeString(this.filterAttributes.priceRange),
|
|
288
|
+
sizeCategory: this.utilities.sanitizeString(this.filterAttributes.sizeCategory),
|
|
287
289
|
productCategory: this.utilities.sanitizeString(this.filterAttributes.productCategory),
|
|
288
290
|
productType: this.utilities.sanitizeString(this.filterAttributes.productType),
|
|
289
291
|
productStyle: this.utilities.sanitzeStringArr(this.filterAttributes.productStyle),
|
|
@@ -561,6 +563,12 @@ class Product extends Base_1.default {
|
|
|
561
563
|
name: 'priceRange',
|
|
562
564
|
type: 'string',
|
|
563
565
|
},
|
|
566
|
+
{
|
|
567
|
+
facet: true,
|
|
568
|
+
optional: true,
|
|
569
|
+
name: 'sizeCategory',
|
|
570
|
+
type: 'string',
|
|
571
|
+
},
|
|
564
572
|
{
|
|
565
573
|
facet: true,
|
|
566
574
|
name: 'productCategory',
|
|
@@ -39,6 +39,7 @@ declare type ProductFilterAttributes = {
|
|
|
39
39
|
gender: string;
|
|
40
40
|
materialComposition: MaterialComposition;
|
|
41
41
|
priceRange: string;
|
|
42
|
+
sizeCategory: string;
|
|
42
43
|
productCategory: string;
|
|
43
44
|
productType: string;
|
|
44
45
|
productStyle: string[];
|
|
@@ -169,6 +170,7 @@ declare type ProductFilterAttributesFormFields = {
|
|
|
169
170
|
gender: SingleSelectFormField<string>;
|
|
170
171
|
materialComposition: SingleSelectFormField<MaterialComposition>;
|
|
171
172
|
priceRange: TextInputFormField<string>;
|
|
173
|
+
sizeCategory: SingleSelectFormField<string>;
|
|
172
174
|
productCategory: SingleSelectFormField<string>;
|
|
173
175
|
productType: SingleSelectFormField<string>;
|
|
174
176
|
productStyle: MultiSelectFormField<string>;
|
|
@@ -257,6 +259,7 @@ declare type TypesenseProductObj = {
|
|
|
257
259
|
compareAtPrice: number;
|
|
258
260
|
costPerItem: number;
|
|
259
261
|
priceRange: string;
|
|
262
|
+
sizeCategory: string;
|
|
260
263
|
productCategory: string;
|
|
261
264
|
productType: string;
|
|
262
265
|
productStyle: string[];
|