rerobe-js-orm 3.0.13 → 3.0.15
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/ProductCollection/ProductCollectionFromFormState.js +1 -0
- package/lib/form-states/Product/ProductFormState.js +8 -1
- package/lib/form-states/ProductCollection/ProductCollectionFormState.js +9 -0
- package/lib/models/Order.js +6 -0
- package/lib/models/Product.js +6 -0
- package/lib/models/ProductCollection.d.ts +1 -0
- package/lib/models/ProductCollection.js +9 -0
- package/lib/models/User.js +6 -0
- package/lib/types/product-collection-types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ class ProductCollectionFromFormState extends ProductCollectionFactory_1.default
|
|
|
19
19
|
description: fs.fields.description.inputValue || '',
|
|
20
20
|
type: fs.fields.type.selectedValue || '',
|
|
21
21
|
imgUrl: fs.fields.imgUrl.inputValue || '',
|
|
22
|
+
imageUrls: fs.fields.imageUrls.selectedValues || [],
|
|
22
23
|
refinements: fs.fields.refinements.selectedValue || {},
|
|
23
24
|
tags: fs.fields.tags.selectedValues || [],
|
|
24
25
|
collectionId,
|
|
@@ -573,13 +573,20 @@ class ProductFormState extends FormState_1.default {
|
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
if (fieldKey === 'condition') {
|
|
576
|
+
let selectedOptions = [];
|
|
577
|
+
if (this.props.condition) {
|
|
578
|
+
selectedOptions = [{ label: this.props.condition, value: this.props.condition, description: '' }];
|
|
579
|
+
if (!options.map((o) => o.value).includes(this.props.condition)) {
|
|
580
|
+
options.splice(0, 0, ...selectedOptions);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
576
583
|
if ((_p = (_o = this.opts) === null || _o === void 0 ? void 0 : _o.conditions) === null || _p === void 0 ? void 0 : _p.length) {
|
|
577
584
|
const conditionsOptions = this.opts.conditions.map((t) => ({
|
|
578
585
|
label: t.label || '',
|
|
579
586
|
value: t.value || '',
|
|
580
587
|
description: t.description || '',
|
|
581
588
|
}));
|
|
582
|
-
options = this.utilities.uniqObjArray(conditionsOptions, 'value');
|
|
589
|
+
options = this.utilities.uniqObjArray([...selectedOptions, ...conditionsOptions], 'value');
|
|
583
590
|
}
|
|
584
591
|
onChangeHandler = (val) => this.conditionSelectHandler(val);
|
|
585
592
|
}
|
|
@@ -16,6 +16,7 @@ class ProductCollectionFormState extends FormState_1.default {
|
|
|
16
16
|
this.fields.description = this.fieldFactory('textInput', 'description');
|
|
17
17
|
this.fields.type = this.fieldFactory('singleSelect', 'type');
|
|
18
18
|
this.fields.imgUrl = this.fieldFactory('textInput', 'imgUrl');
|
|
19
|
+
this.fields.imageUrls = this.fieldFactory('multiSelect', 'imageUrls', []);
|
|
19
20
|
this.fields.refinements = this.fieldFactory('singleSelect', 'refinements');
|
|
20
21
|
this.fields.tags = this.fieldFactory('multiSelect', 'tags', []);
|
|
21
22
|
this.fields.collectionId = this.fieldFactory('textInput', 'collectionId');
|
|
@@ -65,6 +66,14 @@ class ProductCollectionFormState extends FormState_1.default {
|
|
|
65
66
|
}
|
|
66
67
|
valid = true;
|
|
67
68
|
}
|
|
69
|
+
if (fieldKey === 'imageUrls') {
|
|
70
|
+
if (this.props.imageUrls) {
|
|
71
|
+
if (Array.isArray(this.props.imageUrls)) {
|
|
72
|
+
selectedValues = this.props.imageUrls;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
valid = true;
|
|
76
|
+
}
|
|
68
77
|
return {
|
|
69
78
|
options,
|
|
70
79
|
selectedValues,
|
package/lib/models/Order.js
CHANGED
package/lib/models/Product.js
CHANGED
|
@@ -16,6 +16,7 @@ class ProductCollection extends Base_1.default {
|
|
|
16
16
|
this.refinements = (props === null || props === void 0 ? void 0 : props.refinements) || {};
|
|
17
17
|
this.tags = (props === null || props === void 0 ? void 0 : props.tags) || [];
|
|
18
18
|
this.collectionId = (props === null || props === void 0 ? void 0 : props.collectionId) || '';
|
|
19
|
+
this.imageUrls = (props === null || props === void 0 ? void 0 : props.imageUrls) || [];
|
|
19
20
|
}
|
|
20
21
|
toObj() {
|
|
21
22
|
const productCollectionObj = {
|
|
@@ -31,6 +32,7 @@ class ProductCollection extends Base_1.default {
|
|
|
31
32
|
refinements: this.refinements,
|
|
32
33
|
tags: this.tags,
|
|
33
34
|
collectionId: this.collectionId,
|
|
35
|
+
imageUrls: this.imageUrls,
|
|
34
36
|
};
|
|
35
37
|
return productCollectionObj;
|
|
36
38
|
}
|
|
@@ -79,10 +81,16 @@ class ProductCollection extends Base_1.default {
|
|
|
79
81
|
type: 'string',
|
|
80
82
|
},
|
|
81
83
|
{
|
|
84
|
+
// deprecate soon, will be migrated into imageUrls
|
|
82
85
|
facet: false,
|
|
83
86
|
name: 'imgUrl',
|
|
84
87
|
type: 'string',
|
|
85
88
|
},
|
|
89
|
+
{
|
|
90
|
+
facet: false,
|
|
91
|
+
name: 'imageUrls',
|
|
92
|
+
type: 'string[]',
|
|
93
|
+
},
|
|
86
94
|
{
|
|
87
95
|
facet: true,
|
|
88
96
|
optional: true,
|
|
@@ -208,6 +216,7 @@ class ProductCollection extends Base_1.default {
|
|
|
208
216
|
'refinements.statusRefinement': this.utilities.sanitzeStringArr(this.refinements.statusRefinement),
|
|
209
217
|
'refinements.salesChannelRefinement': this.utilities.sanitzeStringArr(this.refinements.salesChannelRefinement),
|
|
210
218
|
tags: this.utilities.sanitzeStringArr(this.tags),
|
|
219
|
+
imageUrls: this.utilities.sanitzeStringArr(this.imageUrls),
|
|
211
220
|
collectionId: this.utilities.sanitizeString(this.collectionId),
|
|
212
221
|
};
|
|
213
222
|
return stagedObj;
|
package/lib/models/User.js
CHANGED
|
@@ -48,6 +48,7 @@ declare type ProductCollectionType = {
|
|
|
48
48
|
refinements: ProductRefinements;
|
|
49
49
|
tags: string[];
|
|
50
50
|
collectionId: string;
|
|
51
|
+
imageUrls: string[];
|
|
51
52
|
};
|
|
52
53
|
declare type CompleteProductCollection = ProductCollectionType & {
|
|
53
54
|
[key: string]: any;
|
|
@@ -61,6 +62,7 @@ declare type ProductCollectionFormFields = {
|
|
|
61
62
|
imgUrl: TextInputFormField<string>;
|
|
62
63
|
refinements: SingleSelectFormField<ProductRefinements>;
|
|
63
64
|
tags: MultiSelectFormField<string>;
|
|
65
|
+
imageUrls: MultiSelectFormField<string>;
|
|
64
66
|
collectionId: TextInputFormField<string>;
|
|
65
67
|
};
|
|
66
68
|
declare type TypesenseProductCollectionObj = {
|
|
@@ -89,5 +91,6 @@ declare type TypesenseProductCollectionObj = {
|
|
|
89
91
|
'refinements.statusRefinement': string[];
|
|
90
92
|
'refinements.salesChannelRefinement': string[];
|
|
91
93
|
tags: string[];
|
|
94
|
+
imageUrls: string[];
|
|
92
95
|
collectionId: string;
|
|
93
96
|
};
|