rerobe-js-orm 3.0.6 → 3.0.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.
- package/lib/factories/Merchant/MerchantFromFormState.js +5 -15
- package/lib/factories/Product/ProductFromFormState.js +3 -2
- package/lib/form-states/Merchant/MerchantFormState.js +16 -3
- package/lib/form-states/Product/ProductFormState.d.ts +1 -0
- package/lib/form-states/Product/ProductFormState.js +38 -11
- package/lib/form-states/Product/options.d.ts +4 -0
- package/lib/form-states/Product/options.js +40 -1
- package/lib/models/Merchant.d.ts +2 -1
- package/lib/models/Merchant.js +29 -2
- package/lib/models/Product.js +7 -0
- package/lib/types/merchant-types.d.ts +17 -7
- package/lib/types/rerobe-product-types.d.ts +7 -4
- package/package.json +1 -1
|
@@ -4,9 +4,8 @@ const MerchantFactory_1 = require("./MerchantFactory");
|
|
|
4
4
|
const Merchant_1 = require("../../models/Merchant");
|
|
5
5
|
class MerchantFromFormState extends MerchantFactory_1.default {
|
|
6
6
|
createMerchant(fs) {
|
|
7
|
-
var _a
|
|
8
|
-
const
|
|
9
|
-
id: ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.id) || '',
|
|
7
|
+
var _a;
|
|
8
|
+
const MerchantMutableData = {
|
|
10
9
|
name: fs.fields.name.inputValue,
|
|
11
10
|
type: fs.fields.type.selectedValue,
|
|
12
11
|
contactEmail: fs.fields.contactEmail.inputValue,
|
|
@@ -18,22 +17,13 @@ class MerchantFromFormState extends MerchantFactory_1.default {
|
|
|
18
17
|
currency: fs.fields.currency.selectedValue,
|
|
19
18
|
timeZone: fs.fields.timeZone.selectedValue,
|
|
20
19
|
unitSystem: fs.fields.unitSystem.selectedValue,
|
|
21
|
-
paymentTier: fs.fields.paymentTier.selectedValue,
|
|
22
20
|
defaultWeightUnit: fs.fields.defaultWeightUnit.selectedValue,
|
|
23
|
-
defaultLocation: (
|
|
24
|
-
documentId: (_c = fs.props) === null || _c === void 0 ? void 0 : _c.documentId,
|
|
25
|
-
numCustomers: (_d = fs.props) === null || _d === void 0 ? void 0 : _d.numCustomers,
|
|
26
|
-
numFiles: (_e = fs.props) === null || _e === void 0 ? void 0 : _e.numFiles,
|
|
27
|
-
numOrders: (_f = fs.props) === null || _f === void 0 ? void 0 : _f.numOrders,
|
|
28
|
-
numProducts: (_g = fs.props) === null || _g === void 0 ? void 0 : _g.numProducts,
|
|
29
|
-
webshopTenantId: (_h = fs.props) === null || _h === void 0 ? void 0 : _h.webshopTenantId,
|
|
21
|
+
defaultLocation: (_a = fs.props) === null || _a === void 0 ? void 0 : _a.defaultLocation,
|
|
30
22
|
webhooks: fs.fields.webhooks.selectedValues,
|
|
31
|
-
sharedSecret: (_j = fs.props) === null || _j === void 0 ? void 0 : _j.sharedSecret,
|
|
32
|
-
ribbnId: fs.fields.ribbnId.inputValue,
|
|
33
23
|
primaryDomain: fs.fields.primaryDomain.inputValue,
|
|
34
|
-
|
|
24
|
+
socialLinks: fs.fields.socialLinks.selectedValue,
|
|
35
25
|
};
|
|
36
|
-
return new Merchant_1.default(Object.assign({},
|
|
26
|
+
return new Merchant_1.default(Object.assign(Object.assign({}, fs.props), MerchantMutableData));
|
|
37
27
|
}
|
|
38
28
|
}
|
|
39
29
|
exports.default = MerchantFromFormState;
|
|
@@ -33,17 +33,18 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
33
33
|
const productFilterAttributes = {
|
|
34
34
|
documentId: (_m = props.props) === null || _m === void 0 ? void 0 : _m.documentId,
|
|
35
35
|
brand: props.fields.brand.selectedValue,
|
|
36
|
+
size: props.fields.size.selectedValue,
|
|
36
37
|
clothingSize: props.fields.clothingSize.selectedValues,
|
|
38
|
+
jeanSize: props.fields.jeanSize.selectedValue,
|
|
39
|
+
shoeSize: props.fields.shoeSize.selectedValue,
|
|
37
40
|
color: props.fields.color.selectedValue,
|
|
38
41
|
condition: props.fields.condition.selectedValue,
|
|
39
42
|
gender: props.fields.gender.selectedValue,
|
|
40
|
-
jeanSize: props.fields.jeanSize.selectedValue,
|
|
41
43
|
materialComposition: props.fields.materialComposition.selectedValue,
|
|
42
44
|
priceRange: props.fields.priceRange.inputValue,
|
|
43
45
|
productCategory: props.fields.productCategory.selectedValue,
|
|
44
46
|
productType: props.fields.productType.selectedValue,
|
|
45
47
|
productStyle: props.fields.productStyle.selectedValues,
|
|
46
|
-
shoeSize: props.fields.shoeSize.selectedValue,
|
|
47
48
|
measurements: props.fields.measurements.selectedValue || {},
|
|
48
49
|
featuredCollections: props.fields.featuredCollections.selectedValues || [],
|
|
49
50
|
tags: props.fields.tags.selectedValues || [],
|
|
@@ -10,7 +10,6 @@ class MerchantFormState extends FormState_1.default {
|
|
|
10
10
|
this.props = new Merchant_1.default(props).toObj();
|
|
11
11
|
this.fields.name = this.fieldFactory('textInput', 'name');
|
|
12
12
|
this.fields.type = this.fieldFactory('singleSelect', 'type', options_1.merchantTypeOptions);
|
|
13
|
-
this.fields.paymentTier = this.fieldFactory('singleSelect', 'paymentTier', options_1.paymentTierOptions);
|
|
14
13
|
this.fields.contactEmail = this.fieldFactory('textInput', 'contactEmail');
|
|
15
14
|
this.fields.senderEmail = this.fieldFactory('textInput', 'senderEmail');
|
|
16
15
|
this.fields.industry = this.fieldFactory('singleSelect', 'industry', options_1.industryOptions);
|
|
@@ -22,8 +21,8 @@ class MerchantFormState extends FormState_1.default {
|
|
|
22
21
|
this.fields.unitSystem = this.fieldFactory('singleSelect', 'unitSystem', options_1.unitSystemOptions);
|
|
23
22
|
this.fields.defaultWeightUnit = this.fieldFactory('singleSelect', 'defaultWeightUnit');
|
|
24
23
|
this.fields.webhooks = this.fieldFactory('multiSelect', 'webhooks');
|
|
25
|
-
this.fields.ribbnId = this.fieldFactory('textInput', 'ribbnId');
|
|
26
24
|
this.fields.primaryDomain = this.fieldFactory('textInput', 'primaryDomain');
|
|
25
|
+
this.fields.socialLinks = this.fieldFactory('singleSelect', 'socialLinks');
|
|
27
26
|
}
|
|
28
27
|
createMerchant() {
|
|
29
28
|
const merchantFactory = new MerchantFromFormState_1.default();
|
|
@@ -31,7 +30,7 @@ class MerchantFormState extends FormState_1.default {
|
|
|
31
30
|
}
|
|
32
31
|
fieldFactory(fieldType, fieldKey, fieldOptions) {
|
|
33
32
|
const options = fieldOptions || [];
|
|
34
|
-
if (fieldType === 'textInput' && fieldKey !== 'address' && fieldKey !== 'webhooks') {
|
|
33
|
+
if (fieldType === 'textInput' && fieldKey !== 'address' && fieldKey !== 'webhooks' && fieldKey !== 'socialLinks') {
|
|
35
34
|
const inputValue = this.props[fieldKey] || '';
|
|
36
35
|
const valid = !!this.props[fieldKey];
|
|
37
36
|
let onChangeHandler = (val) => this.textInputChangeHandler(fieldKey, String(val));
|
|
@@ -87,6 +86,20 @@ class MerchantFormState extends FormState_1.default {
|
|
|
87
86
|
!!Object.keys(this.props.address).length &&
|
|
88
87
|
!!Object.values(this.props.address).filter((item) => !!item).length;
|
|
89
88
|
}
|
|
89
|
+
else if (fieldKey === 'socialLinks') {
|
|
90
|
+
selectedValue = this.props.socialLinks || {
|
|
91
|
+
facebook: '',
|
|
92
|
+
instagram: '',
|
|
93
|
+
linkedIn: '',
|
|
94
|
+
twitter: '',
|
|
95
|
+
pintrest: '',
|
|
96
|
+
tiktok: '',
|
|
97
|
+
};
|
|
98
|
+
valid =
|
|
99
|
+
!!this.props.socialLinks &&
|
|
100
|
+
!!Object.keys(this.props.socialLinks).length &&
|
|
101
|
+
!!Object.values(this.props.socialLinks).filter((item) => !!item).length;
|
|
102
|
+
}
|
|
90
103
|
else if (fieldKey === 'unitSystem') {
|
|
91
104
|
onChangeHandler = (val) => this.unitSystemSelectHandler(val);
|
|
92
105
|
selectedValue = this.props[fieldKey] || '';
|
|
@@ -27,19 +27,21 @@ class ProductFormState extends FormState_1.default {
|
|
|
27
27
|
this.fields.measurements = this.fieldFactory('singleSelect', 'measurements');
|
|
28
28
|
// ProductFilterAttributesFormFields
|
|
29
29
|
this.fields.brand = this.fieldFactory('singleSelect', 'brand', options_1.brands);
|
|
30
|
-
this.fields.
|
|
30
|
+
this.fields.size = this.fieldFactory('singleSelect', 'size', options_1.clothingSizeOptions);
|
|
31
31
|
this.fields.color = this.fieldFactory('singleSelect', 'color', options_1.colors);
|
|
32
32
|
this.fields.condition = this.fieldFactory('singleSelect', 'condition', options_1.conditions);
|
|
33
33
|
this.fields.majorDefects = this.fieldFactory('multiSelect', 'majorDefects', options_1.majorDefectOptions);
|
|
34
34
|
this.fields.minorDefects = this.fieldFactory('multiSelect', 'minorDefects', options_1.minorDefectOptions);
|
|
35
35
|
this.fields.gender = this.fieldFactory('singleSelect', 'gender', options_1.gender);
|
|
36
|
-
this.fields.jeanSize = this.fieldFactory('singleSelect', 'jeanSize', options_1.jeanSizes);
|
|
37
36
|
this.fields.materialComposition = this.fieldFactory('singleSelect', 'materialComposition', options_1.clothingMaterials);
|
|
38
37
|
this.fields.priceRange = this.fieldFactory('textInput', 'priceRange');
|
|
39
38
|
this.fields.productCategory = this.fieldFactory('singleSelect', 'productCategory', options_1.productCategories);
|
|
40
39
|
this.fields.productType = this.fieldFactory('singleSelect', 'productType');
|
|
41
40
|
this.fields.productStyle = this.fieldFactory('multiSelect', 'productStyle');
|
|
41
|
+
// Deprecated soon
|
|
42
|
+
this.fields.clothingSize = this.fieldFactory('multiSelect', 'clothingSize', options_1.clothingSizeOptions);
|
|
42
43
|
this.fields.shoeSize = this.fieldFactory('singleSelect', 'shoeSize', options_1.shoeSizes);
|
|
44
|
+
this.fields.jeanSize = this.fieldFactory('singleSelect', 'jeanSize', options_1.jeanSizes);
|
|
43
45
|
// ProductConsignmentAttributesFormFields
|
|
44
46
|
this.fields.previousSellers = this.fieldFactory('multiSelect', 'previousSellers');
|
|
45
47
|
this.fields.publishType = this.fieldFactory('singleSelect', 'publishType', options_1.publishTypeOptions);
|
|
@@ -141,6 +143,10 @@ class ProductFormState extends FormState_1.default {
|
|
|
141
143
|
this.fields.shoeSize.hidden = true;
|
|
142
144
|
this.fields.shoeSize.valid = false;
|
|
143
145
|
this.fields.shoeSize.selectedValue = '';
|
|
146
|
+
// Reset size fields except options
|
|
147
|
+
this.fields.size.hidden = false;
|
|
148
|
+
this.fields.size.valid = false;
|
|
149
|
+
this.fields.size.selectedValue = '';
|
|
144
150
|
}
|
|
145
151
|
conditionSelectHandler(value) {
|
|
146
152
|
// Mutate condition selectedValue and valid prop
|
|
@@ -176,6 +182,10 @@ class ProductFormState extends FormState_1.default {
|
|
|
176
182
|
this.fields.shoeSize.hidden = true;
|
|
177
183
|
this.fields.shoeSize.selectedValue = '';
|
|
178
184
|
this.fields.shoeSize.valid = false;
|
|
185
|
+
// Reset Size
|
|
186
|
+
this.fields.size.hidden = false;
|
|
187
|
+
this.fields.size.selectedValue = '';
|
|
188
|
+
this.fields.size.valid = false;
|
|
179
189
|
}
|
|
180
190
|
productTypeSelectHandler(value) {
|
|
181
191
|
// Mutate productType selectedValue and valid prop
|
|
@@ -199,6 +209,10 @@ class ProductFormState extends FormState_1.default {
|
|
|
199
209
|
this.fields.shoeSize.selectedValue = '';
|
|
200
210
|
this.fields.shoeSize.valid = false;
|
|
201
211
|
this.fields.shoeSize.hidden = !value || this.fields.productCategory.selectedValue !== 'Shoes';
|
|
212
|
+
// Reset size
|
|
213
|
+
this.fields.size.selectedValue = '';
|
|
214
|
+
this.fields.size.valid = false;
|
|
215
|
+
this.fields.size.hidden = false;
|
|
202
216
|
}
|
|
203
217
|
setPriceRangeFromPrice(value) {
|
|
204
218
|
if (Number(value) > 0 && Number(value) <= 500) {
|
|
@@ -413,7 +427,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
413
427
|
}
|
|
414
428
|
}
|
|
415
429
|
fieldFactory(fieldType, fieldKey, fieldOptions) {
|
|
416
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
430
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
417
431
|
let options = fieldOptions || [];
|
|
418
432
|
let hidden = false;
|
|
419
433
|
if (fieldType === 'singleSelect') {
|
|
@@ -477,6 +491,19 @@ class ProductFormState extends FormState_1.default {
|
|
|
477
491
|
hidden = !this.props.productCategory;
|
|
478
492
|
onChangeHandler = (val) => this.productTypeSelectHandler(val);
|
|
479
493
|
}
|
|
494
|
+
if (fieldKey === 'size') {
|
|
495
|
+
let selectedSizeOptions = [];
|
|
496
|
+
if (this.props.size) {
|
|
497
|
+
selectedSizeOptions = [{ label: this.props.size, value: this.props.size }];
|
|
498
|
+
if (!options.map((o) => o.value).includes(this.props.size)) {
|
|
499
|
+
options.splice(0, 0, ...selectedSizeOptions);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if ((_b = (_a = this.opts) === null || _a === void 0 ? void 0 : _a.sizes) === null || _b === void 0 ? void 0 : _b.length) {
|
|
503
|
+
const sizesOptions = this.opts.sizes.map((t) => ({ label: t, value: t }));
|
|
504
|
+
options = this.utilities.uniqObjArray([...selectedSizeOptions, ...sizesOptions], 'value');
|
|
505
|
+
}
|
|
506
|
+
}
|
|
480
507
|
if (fieldKey === 'jeanSize') {
|
|
481
508
|
hidden = this.props.productCategory !== 'Clothing' || this.props.productType !== 'Jeans';
|
|
482
509
|
let selectedJeanSizeOptions = [];
|
|
@@ -486,7 +513,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
486
513
|
options.splice(0, 0, ...selectedJeanSizeOptions);
|
|
487
514
|
}
|
|
488
515
|
}
|
|
489
|
-
if ((
|
|
516
|
+
if ((_d = (_c = this.opts) === null || _c === void 0 ? void 0 : _c.jeanSizes) === null || _d === void 0 ? void 0 : _d.length) {
|
|
490
517
|
const jeanSizesOptions = this.opts.jeanSizes.map((t) => ({ label: t, value: t }));
|
|
491
518
|
options = this.utilities.uniqObjArray([...selectedJeanSizeOptions, ...jeanSizesOptions], 'value');
|
|
492
519
|
}
|
|
@@ -500,7 +527,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
500
527
|
options.splice(0, 0, ...selectedShoeSizeOptions);
|
|
501
528
|
}
|
|
502
529
|
}
|
|
503
|
-
if ((
|
|
530
|
+
if ((_f = (_e = this.opts) === null || _e === void 0 ? void 0 : _e.shoeSizes) === null || _f === void 0 ? void 0 : _f.length) {
|
|
504
531
|
const shoeSizesOptions = this.opts.shoeSizes.map((t) => ({ label: t, value: t }));
|
|
505
532
|
options = this.utilities.uniqObjArray([...selectedShoeSizeOptions, ...shoeSizesOptions], 'value');
|
|
506
533
|
}
|
|
@@ -513,7 +540,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
513
540
|
options.splice(0, 0, ...selectedBrandOptions);
|
|
514
541
|
}
|
|
515
542
|
}
|
|
516
|
-
if ((
|
|
543
|
+
if ((_h = (_g = this.opts) === null || _g === void 0 ? void 0 : _g.brands) === null || _h === void 0 ? void 0 : _h.length) {
|
|
517
544
|
const brandsOptions = this.opts.brands.map((t) => ({ label: t, value: t }));
|
|
518
545
|
options = this.utilities.uniqObjArray([...selectedBrandOptions, ...brandsOptions], 'value');
|
|
519
546
|
}
|
|
@@ -526,13 +553,13 @@ class ProductFormState extends FormState_1.default {
|
|
|
526
553
|
options.splice(0, 0, ...selectedColorOptions);
|
|
527
554
|
}
|
|
528
555
|
}
|
|
529
|
-
if ((
|
|
556
|
+
if ((_k = (_j = this.opts) === null || _j === void 0 ? void 0 : _j.colors) === null || _k === void 0 ? void 0 : _k.length) {
|
|
530
557
|
const colorsOptions = this.opts.colors.map((t) => ({ label: t, value: t }));
|
|
531
558
|
options = this.utilities.uniqObjArray([...selectedColorOptions, ...colorsOptions], 'value');
|
|
532
559
|
}
|
|
533
560
|
}
|
|
534
561
|
if (fieldKey === 'condition') {
|
|
535
|
-
if ((
|
|
562
|
+
if ((_m = (_l = this.opts) === null || _l === void 0 ? void 0 : _l.conditions) === null || _m === void 0 ? void 0 : _m.length) {
|
|
536
563
|
const conditionsOptions = this.opts.conditions.map((t) => ({
|
|
537
564
|
label: t.label || '',
|
|
538
565
|
value: t.value || '',
|
|
@@ -587,7 +614,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
587
614
|
if (this.props.gender === 'Man') {
|
|
588
615
|
options = options_1.manClothingSizeOptions;
|
|
589
616
|
}
|
|
590
|
-
if ((
|
|
617
|
+
if ((_p = (_o = this.opts) === null || _o === void 0 ? void 0 : _o.clothingSizes) === null || _p === void 0 ? void 0 : _p.length) {
|
|
591
618
|
const clothingSizesOptions = this.opts.clothingSizes.map((t) => ({ label: t, value: t }));
|
|
592
619
|
options = this.utilities.uniqObjArray(clothingSizesOptions, 'value');
|
|
593
620
|
}
|
|
@@ -599,7 +626,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
599
626
|
selectedMajorDefectsOptions = this.props.majorDefects.map((t) => ({ label: t, value: t }));
|
|
600
627
|
}
|
|
601
628
|
let majorDefectsOptions = [];
|
|
602
|
-
if ((
|
|
629
|
+
if ((_r = (_q = this.opts) === null || _q === void 0 ? void 0 : _q.majorDefects) === null || _r === void 0 ? void 0 : _r.length) {
|
|
603
630
|
majorDefectsOptions = this.opts.majorDefects.map((t) => ({ label: t, value: t }));
|
|
604
631
|
}
|
|
605
632
|
options = this.utilities.uniqObjArray([...selectedMajorDefectsOptions, ...majorDefectsOptions], 'value');
|
|
@@ -610,7 +637,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
610
637
|
selectedMinorDefectsOptions = this.props.minorDefects.map((t) => ({ label: t, value: t }));
|
|
611
638
|
}
|
|
612
639
|
let minorDefectsOptions = [];
|
|
613
|
-
if ((
|
|
640
|
+
if ((_t = (_s = this.opts) === null || _s === void 0 ? void 0 : _s.minorDefects) === null || _t === void 0 ? void 0 : _t.length) {
|
|
614
641
|
minorDefectsOptions = this.opts.minorDefects.map((t) => ({ label: t, value: t }));
|
|
615
642
|
}
|
|
616
643
|
options = this.utilities.uniqObjArray([...selectedMinorDefectsOptions, ...minorDefectsOptions], 'value');
|
|
@@ -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.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.statusOptions = exports.publishTypeOptions = exports.availableForSaleOptions = void 0;
|
|
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.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,45 @@ const statusOptions = Object.values(product_constants_1.PRODUCT_STATES).map((val
|
|
|
34
34
|
value: val,
|
|
35
35
|
}));
|
|
36
36
|
exports.statusOptions = statusOptions;
|
|
37
|
+
const sizeOptions = [
|
|
38
|
+
{
|
|
39
|
+
label: 'No Size',
|
|
40
|
+
value: 'No Size',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: 'XXS',
|
|
44
|
+
value: 'XXS',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: 'XS',
|
|
48
|
+
value: 'XS',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: 'S',
|
|
52
|
+
value: 'S',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: 'M',
|
|
56
|
+
value: 'M',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: 'L',
|
|
60
|
+
value: 'L',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: 'XL',
|
|
64
|
+
value: 'XL',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: 'XXL',
|
|
68
|
+
value: 'XXL',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: 'XXXL',
|
|
72
|
+
value: 'XXXL',
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
exports.sizeOptions = sizeOptions;
|
|
37
76
|
const clothingSizeOptions = [
|
|
38
77
|
{
|
|
39
78
|
label: 'No Size',
|
package/lib/models/Merchant.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ export default class Merchant extends Base {
|
|
|
37
37
|
productDelete: string;
|
|
38
38
|
};
|
|
39
39
|
name: string;
|
|
40
|
-
id: string;
|
|
41
40
|
type: MerchantTypes | string;
|
|
42
41
|
paymentTier: RibbnPaymentTiers | string;
|
|
43
42
|
contactEmail: string;
|
|
@@ -62,6 +61,8 @@ export default class Merchant extends Base {
|
|
|
62
61
|
ribbnId: string;
|
|
63
62
|
primaryDomain: string;
|
|
64
63
|
webshopHomePageId: string;
|
|
64
|
+
socialLinks: SocialLinksType | null;
|
|
65
65
|
constructor(props?: any);
|
|
66
66
|
toObj(): MerchantObj;
|
|
67
|
+
toMerchantMutableData(): MerchantMutableData;
|
|
67
68
|
}
|
package/lib/models/Merchant.js
CHANGED
|
@@ -5,7 +5,6 @@ class Merchant extends Base_1.default {
|
|
|
5
5
|
constructor(props) {
|
|
6
6
|
super();
|
|
7
7
|
this.name = (props === null || props === void 0 ? void 0 : props.name) || '';
|
|
8
|
-
this.id = (props === null || props === void 0 ? void 0 : props.id) || '';
|
|
9
8
|
this.type = (props === null || props === void 0 ? void 0 : props.type) || Merchant.MERCHANT_TYPES.individual;
|
|
10
9
|
this.paymentTier = (props === null || props === void 0 ? void 0 : props.paymentTier) || Merchant.PAYMENT_TIERS.free;
|
|
11
10
|
this.contactEmail = (props === null || props === void 0 ? void 0 : props.contactEmail) || '';
|
|
@@ -39,11 +38,18 @@ class Merchant extends Base_1.default {
|
|
|
39
38
|
this.ribbnId = (props === null || props === void 0 ? void 0 : props.ribbnId) || '';
|
|
40
39
|
this.primaryDomain = (props === null || props === void 0 ? void 0 : props.primaryDomain) || '';
|
|
41
40
|
this.webshopHomePageId = (props === null || props === void 0 ? void 0 : props.webshopHomePageId) || 'home';
|
|
41
|
+
this.socialLinks = (props === null || props === void 0 ? void 0 : props.socialLinks) || {
|
|
42
|
+
facebook: '',
|
|
43
|
+
instagram: '',
|
|
44
|
+
linkedIn: '',
|
|
45
|
+
twitter: '',
|
|
46
|
+
pintrest: '',
|
|
47
|
+
tiktok: '',
|
|
48
|
+
};
|
|
42
49
|
}
|
|
43
50
|
toObj() {
|
|
44
51
|
return {
|
|
45
52
|
name: this.name,
|
|
46
|
-
id: this.id,
|
|
47
53
|
type: this.type,
|
|
48
54
|
paymentTier: this.paymentTier,
|
|
49
55
|
contactEmail: this.contactEmail,
|
|
@@ -68,6 +74,27 @@ class Merchant extends Base_1.default {
|
|
|
68
74
|
ribbnId: this.ribbnId,
|
|
69
75
|
primaryDomain: this.primaryDomain,
|
|
70
76
|
webshopHomePageId: this.webshopHomePageId,
|
|
77
|
+
socialLinks: this.socialLinks,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
toMerchantMutableData() {
|
|
81
|
+
return {
|
|
82
|
+
name: this.name,
|
|
83
|
+
type: this.type,
|
|
84
|
+
contactEmail: this.contactEmail,
|
|
85
|
+
senderEmail: this.senderEmail,
|
|
86
|
+
industry: this.industry,
|
|
87
|
+
legalName: this.legalName,
|
|
88
|
+
phone: this.phone,
|
|
89
|
+
address: this.address,
|
|
90
|
+
currency: this.currency,
|
|
91
|
+
timeZone: this.timeZone,
|
|
92
|
+
unitSystem: this.unitSystem,
|
|
93
|
+
defaultWeightUnit: this.defaultWeightUnit,
|
|
94
|
+
defaultLocation: this.defaultLocation,
|
|
95
|
+
primaryDomain: this.primaryDomain,
|
|
96
|
+
webhooks: this.webhooks,
|
|
97
|
+
socialLinks: this.socialLinks,
|
|
71
98
|
};
|
|
72
99
|
}
|
|
73
100
|
}
|
package/lib/models/Product.js
CHANGED
|
@@ -42,6 +42,7 @@ class Product extends Base_1.default {
|
|
|
42
42
|
clothingSize: (props === null || props === void 0 ? void 0 : props.clothingSize) || [],
|
|
43
43
|
jeanSize: (props === null || props === void 0 ? void 0 : props.jeanSize) || '',
|
|
44
44
|
shoeSize: (props === null || props === void 0 ? void 0 : props.shoeSize) || '',
|
|
45
|
+
size: (props === null || props === void 0 ? void 0 : props.size) || '',
|
|
45
46
|
productCategory: (props === null || props === void 0 ? void 0 : props.productCategory) || '',
|
|
46
47
|
productType: (props === null || props === void 0 ? void 0 : props.productType) || '',
|
|
47
48
|
productStyle: (props === null || props === void 0 ? void 0 : props.productStyle) || [],
|
|
@@ -279,6 +280,7 @@ class Product extends Base_1.default {
|
|
|
279
280
|
toObjForTypesense() {
|
|
280
281
|
const stagedObj = {
|
|
281
282
|
brand: this.utilities.sanitizeString(this.filterAttributes.brand),
|
|
283
|
+
size: this.utilities.sanitizeString(this.filterAttributes.size),
|
|
282
284
|
clothingSize: this.utilities.sanitzeStringArr(this.filterAttributes.clothingSize),
|
|
283
285
|
jeanSize: this.utilities.sanitizeString(this.filterAttributes.jeanSize),
|
|
284
286
|
shoeSize: this.utilities.sanitizeString(this.filterAttributes.shoeSize),
|
|
@@ -472,6 +474,11 @@ class Product extends Base_1.default {
|
|
|
472
474
|
name: 'brand',
|
|
473
475
|
type: 'string',
|
|
474
476
|
},
|
|
477
|
+
{
|
|
478
|
+
facet: true,
|
|
479
|
+
name: 'size',
|
|
480
|
+
type: 'string',
|
|
481
|
+
},
|
|
475
482
|
{
|
|
476
483
|
facet: true,
|
|
477
484
|
name: 'clothingSize',
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
declare type
|
|
1
|
+
declare type SocialLinksType = {
|
|
2
|
+
facebook: string;
|
|
3
|
+
instagram: string;
|
|
4
|
+
linkedIn: string;
|
|
5
|
+
twitter: string;
|
|
6
|
+
pintrest: string;
|
|
7
|
+
tiktok: string;
|
|
8
|
+
};
|
|
9
|
+
declare type MerchantMutableData = {
|
|
2
10
|
name: string;
|
|
3
|
-
id: string;
|
|
4
11
|
type: MerchantTypes | string;
|
|
5
|
-
paymentTier: RibbnPaymentTiers | string;
|
|
6
12
|
contactEmail: string;
|
|
7
13
|
senderEmail: string;
|
|
8
14
|
industry: MerchantIndustryTypes | string | null;
|
|
@@ -14,18 +20,23 @@ declare type MerchantObj = {
|
|
|
14
20
|
unitSystem: UnitSystemTypes | string | null;
|
|
15
21
|
defaultWeightUnit: MetricWeightTypes | ImperialWeightTypes | string | null;
|
|
16
22
|
defaultLocation: string;
|
|
23
|
+
primaryDomain: string;
|
|
24
|
+
webhooks: MerchantWebHook[];
|
|
25
|
+
socialLinks: SocialLinksType | null;
|
|
26
|
+
};
|
|
27
|
+
declare type MerchantSystemOnlyMutableData = {
|
|
28
|
+
paymentTier: RibbnPaymentTiers | string;
|
|
17
29
|
documentId: string;
|
|
18
30
|
numCustomers: number;
|
|
19
31
|
numFiles: number;
|
|
20
32
|
numOrders: number;
|
|
21
33
|
numProducts: number;
|
|
22
|
-
webhooks: MerchantWebHook[];
|
|
23
34
|
webshopTenantId: string;
|
|
24
35
|
sharedSecret: string;
|
|
25
36
|
ribbnId: string;
|
|
26
|
-
primaryDomain: string;
|
|
27
37
|
webshopHomePageId: string;
|
|
28
38
|
};
|
|
39
|
+
declare type MerchantObj = MerchantMutableData & MerchantSystemOnlyMutableData;
|
|
29
40
|
declare type MerchantTypes = 'INDIVIDUAL' | 'BUSINESS';
|
|
30
41
|
declare type RibbnPaymentTiers = 'FREE' | 'TIER_ONE';
|
|
31
42
|
declare type MerchantIndustryTypes = 'BEAUTY' | 'CLOTHING' | 'ELECTRONICS' | 'FURNITURE' | 'HANDCRAFTS' | 'JEWELRY' | 'SPORTS' | 'TOYS' | 'OTHER';
|
|
@@ -52,7 +63,6 @@ declare type MerchantWebHook = {
|
|
|
52
63
|
declare type MerchantFormFields = {
|
|
53
64
|
name: TextInputFormField<string>;
|
|
54
65
|
type: SingleSelectFormField<string>;
|
|
55
|
-
paymentTier: SingleSelectFormField<string>;
|
|
56
66
|
contactEmail: TextInputFormField<string>;
|
|
57
67
|
senderEmail: TextInputFormField<string>;
|
|
58
68
|
industry: SingleSelectFormField<string>;
|
|
@@ -64,8 +74,8 @@ declare type MerchantFormFields = {
|
|
|
64
74
|
unitSystem: SingleSelectFormField<string>;
|
|
65
75
|
defaultWeightUnit: SingleSelectFormField<string>;
|
|
66
76
|
webhooks: MultiSelectFormField<MerchantWebHook>;
|
|
67
|
-
ribbnId: TextInputFormField<string>;
|
|
68
77
|
primaryDomain: TextInputFormField<string>;
|
|
78
|
+
socialLinks: SingleSelectFormField<SocialLinksType>;
|
|
69
79
|
};
|
|
70
80
|
declare type WebhookFormFields = {
|
|
71
81
|
event: SingleSelectFormField<string>;
|
|
@@ -26,17 +26,18 @@ declare type ProductAttributes = {
|
|
|
26
26
|
declare type ProductFilterAttributes = {
|
|
27
27
|
documentId: string;
|
|
28
28
|
brand: string;
|
|
29
|
+
size: string;
|
|
29
30
|
clothingSize: string[];
|
|
31
|
+
shoeSize: string;
|
|
32
|
+
jeanSize: string;
|
|
30
33
|
color: string;
|
|
31
34
|
condition: string;
|
|
32
35
|
gender: string;
|
|
33
|
-
jeanSize: string;
|
|
34
36
|
materialComposition: MaterialComposition;
|
|
35
37
|
priceRange: string;
|
|
36
38
|
productCategory: string;
|
|
37
39
|
productType: string;
|
|
38
40
|
productStyle: string[];
|
|
39
|
-
shoeSize: string;
|
|
40
41
|
measurements: Measurements;
|
|
41
42
|
featuredCollections?: string[];
|
|
42
43
|
tags?: string[];
|
|
@@ -156,17 +157,18 @@ declare type ProductAttributesFormFields = {
|
|
|
156
157
|
};
|
|
157
158
|
declare type ProductFilterAttributesFormFields = {
|
|
158
159
|
brand: SingleSelectFormField<string>;
|
|
160
|
+
size: SingleSelectFormField<string>;
|
|
159
161
|
clothingSize: MultiSelectFormField<string>;
|
|
162
|
+
jeanSize: SingleSelectFormField<string>;
|
|
163
|
+
shoeSize: SingleSelectFormField<string>;
|
|
160
164
|
color: SingleSelectFormField<string>;
|
|
161
165
|
condition: SingleSelectFormField<string>;
|
|
162
166
|
gender: SingleSelectFormField<string>;
|
|
163
|
-
jeanSize: SingleSelectFormField<string>;
|
|
164
167
|
materialComposition: SingleSelectFormField<MaterialComposition>;
|
|
165
168
|
priceRange: TextInputFormField<string>;
|
|
166
169
|
productCategory: SingleSelectFormField<string>;
|
|
167
170
|
productType: SingleSelectFormField<string>;
|
|
168
171
|
productStyle: MultiSelectFormField<string>;
|
|
169
|
-
shoeSize: SingleSelectFormField<string>;
|
|
170
172
|
featuredCollections: MultiSelectFormField<string>;
|
|
171
173
|
tags: MultiSelectFormField<string>;
|
|
172
174
|
};
|
|
@@ -239,6 +241,7 @@ declare type InventoryLocation = {
|
|
|
239
241
|
};
|
|
240
242
|
declare type TypesenseProductObj = {
|
|
241
243
|
brand: string;
|
|
244
|
+
size: string;
|
|
242
245
|
clothingSize: string[];
|
|
243
246
|
jeanSize: string;
|
|
244
247
|
shoeSize: string;
|