rerobe-js-orm 2.4.86 → 2.4.90
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 -4
- package/lib/factories/Product/ProductFromFormState.js +1 -1
- package/lib/form-states/Product/ProductFormState.d.ts +1 -0
- package/lib/form-states/Product/ProductFormState.js +12 -6
- package/lib/form-states/Product/options.d.ts +4 -0
- package/lib/form-states/Product/options.js +8 -1
- package/lib/models/Merchant.d.ts +1 -0
- package/lib/models/Merchant.js +2 -0
- package/lib/models/Product.js +27 -3
- package/lib/types/merchant-types.d.ts +1 -0
- package/lib/types/rerobe-product-types.d.ts +5 -3
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ 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, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
8
8
|
const merchantAttributes = {
|
|
9
9
|
id: ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.id) || '',
|
|
10
10
|
name: fs.fields.name.inputValue,
|
|
@@ -27,10 +27,11 @@ class MerchantFromFormState extends MerchantFactory_1.default {
|
|
|
27
27
|
numOrders: (_f = fs.props) === null || _f === void 0 ? void 0 : _f.numOrders,
|
|
28
28
|
numProducts: (_g = fs.props) === null || _g === void 0 ? void 0 : _g.numProducts,
|
|
29
29
|
orderTags: (_h = fs.props) === null || _h === void 0 ? void 0 : _h.orderTags,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
productTags: (_j = fs.props) === null || _j === void 0 ? void 0 : _j.productTags,
|
|
31
|
+
theme: (_k = fs.props) === null || _k === void 0 ? void 0 : _k.theme,
|
|
32
|
+
webshopTenantId: (_l = fs.props) === null || _l === void 0 ? void 0 : _l.webshopTenantId,
|
|
32
33
|
webhooks: fs.fields.webhooks.selectedValues,
|
|
33
|
-
sharedSecret: (
|
|
34
|
+
sharedSecret: (_m = fs.props) === null || _m === void 0 ? void 0 : _m.sharedSecret,
|
|
34
35
|
};
|
|
35
36
|
return new Merchant_1.default(Object.assign({}, merchantAttributes));
|
|
36
37
|
}
|
|
@@ -22,7 +22,7 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
22
22
|
weight: props.fields.weight.inputValue,
|
|
23
23
|
variantId: ((_j = props.props) === null || _j === void 0 ? void 0 : _j.variantId) || '',
|
|
24
24
|
reservedBy: ((_k = props.props) === null || _k === void 0 ? void 0 : _k.reservedBy) || [],
|
|
25
|
-
|
|
25
|
+
options: props.fields.options.selectedValue,
|
|
26
26
|
costPerItem: props.fields.costPerItem.inputValue,
|
|
27
27
|
compareAtPrice: props.fields.compareAtPrice.inputValue,
|
|
28
28
|
quantity: props.fields.quantity.inputValue,
|
|
@@ -20,7 +20,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
20
20
|
valid: false,
|
|
21
21
|
onChangeHandler: (fileArr) => this.multiSelectMediaChangeHandler('officialFilesToUpload', fileArr),
|
|
22
22
|
};
|
|
23
|
-
this.fields.
|
|
23
|
+
this.fields.options = this.fieldFactory('singleSelect', 'options', options_1.productOptions);
|
|
24
24
|
this.fields.costPerItem = this.fieldFactory('textInput', 'costPerItem');
|
|
25
25
|
this.fields.compareAtPrice = this.fieldFactory('textInput', 'compareAtPrice');
|
|
26
26
|
this.fields.quantity = this.fieldFactory('textInput', 'quantity');
|
|
@@ -465,6 +465,10 @@ class ProductFormState extends FormState_1.default {
|
|
|
465
465
|
selectedValue = this.props[fieldKey] || {};
|
|
466
466
|
valid = Object.keys(this.props[fieldKey]).length > 0;
|
|
467
467
|
}
|
|
468
|
+
if (fieldKey === 'options') {
|
|
469
|
+
selectedValue = this.props[fieldKey] || {};
|
|
470
|
+
valid = Object.keys(this.props[fieldKey]).length > 0;
|
|
471
|
+
}
|
|
468
472
|
if (fieldKey === 'gender') {
|
|
469
473
|
onChangeHandler = (val) => this.genderSelectHandler(val);
|
|
470
474
|
}
|
|
@@ -531,13 +535,15 @@ class ProductFormState extends FormState_1.default {
|
|
|
531
535
|
hidden = this.props.productStyle.length < 1;
|
|
532
536
|
}
|
|
533
537
|
if (fieldKey === 'tags') {
|
|
538
|
+
let selectedTagOptions = [];
|
|
534
539
|
if (this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length > 0) {
|
|
535
|
-
this.props.tags.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
});
|
|
540
|
+
selectedTagOptions = this.props.tags.map((t) => ({ label: t, value: t }));
|
|
541
|
+
}
|
|
542
|
+
let tagOptions = [];
|
|
543
|
+
if (this.opts && this.opts.tags && this.opts.tags.length > 0) {
|
|
544
|
+
tagOptions = this.opts.tags.map((t) => ({ label: t, value: t }));
|
|
540
545
|
}
|
|
546
|
+
options = this.utilities.uniqObjArray([...selectedTagOptions, ...tagOptions], 'value');
|
|
541
547
|
hidden = Boolean(this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length < 1);
|
|
542
548
|
}
|
|
543
549
|
if (fieldKey === 'featuredCollections') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.productIsOnSaleOptions = exports.discountTypeOptions = exports.conditionTypeOptions = 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.clothingSizeOptions = exports.statusOptions = exports.publishTypeOptions = exports.availableForSaleOptions = void 0;
|
|
3
|
+
exports.productOptions = exports.productIsOnSaleOptions = exports.discountTypeOptions = exports.conditionTypeOptions = 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.clothingSizeOptions = exports.statusOptions = exports.publishTypeOptions = exports.availableForSaleOptions = void 0;
|
|
4
4
|
const availableForSaleOptions = [
|
|
5
5
|
{
|
|
6
6
|
label: 'Zero',
|
|
@@ -3453,3 +3453,10 @@ const productIsOnSaleOptions = [
|
|
|
3453
3453
|
},
|
|
3454
3454
|
];
|
|
3455
3455
|
exports.productIsOnSaleOptions = productIsOnSaleOptions;
|
|
3456
|
+
const productOptions = [
|
|
3457
|
+
{ value: 'size', label: 'Size' },
|
|
3458
|
+
{ value: 'color', label: 'Color' },
|
|
3459
|
+
{ value: 'style', label: 'Style' },
|
|
3460
|
+
{ value: 'material', label: 'Material' },
|
|
3461
|
+
];
|
|
3462
|
+
exports.productOptions = productOptions;
|
package/lib/models/Merchant.d.ts
CHANGED
package/lib/models/Merchant.js
CHANGED
|
@@ -34,6 +34,7 @@ class Merchant extends Base_1.default {
|
|
|
34
34
|
this.numOrders = (props === null || props === void 0 ? void 0 : props.numOrders) || 0;
|
|
35
35
|
this.numProducts = (props === null || props === void 0 ? void 0 : props.numProducts) || 0;
|
|
36
36
|
this.orderTags = (props === null || props === void 0 ? void 0 : props.orderTags) || [];
|
|
37
|
+
this.productTags = (props === null || props === void 0 ? void 0 : props.productTags) || [];
|
|
37
38
|
this.theme = (props === null || props === void 0 ? void 0 : props.theme) || {
|
|
38
39
|
layoutType: 'StandardNavLayout',
|
|
39
40
|
bgColor: '#fff',
|
|
@@ -74,6 +75,7 @@ class Merchant extends Base_1.default {
|
|
|
74
75
|
numOrders: this.numOrders,
|
|
75
76
|
numProducts: this.numProducts,
|
|
76
77
|
orderTags: this.orderTags,
|
|
78
|
+
productTags: this.productTags,
|
|
77
79
|
theme: this.theme,
|
|
78
80
|
webshopTenantId: this.webshopTenantId,
|
|
79
81
|
webhooks: this.webhooks,
|
package/lib/models/Product.js
CHANGED
|
@@ -23,7 +23,7 @@ class Product extends Base_1.default {
|
|
|
23
23
|
vendorName: (props === null || props === void 0 ? void 0 : props.vendorName) || '',
|
|
24
24
|
variantId: (props === null || props === void 0 ? void 0 : props.variantId) || '',
|
|
25
25
|
reservedBy: (props === null || props === void 0 ? void 0 : props.reservedBy) || [],
|
|
26
|
-
|
|
26
|
+
options: (props === null || props === void 0 ? void 0 : props.options) || {},
|
|
27
27
|
costPerItem: (props === null || props === void 0 ? void 0 : props.costPerItem) || '',
|
|
28
28
|
compareAtPrice: (props === null || props === void 0 ? void 0 : props.compareAtPrice) || '',
|
|
29
29
|
quantity: (props === null || props === void 0 ? void 0 : props.quantity) || 0,
|
|
@@ -254,6 +254,7 @@ class Product extends Base_1.default {
|
|
|
254
254
|
tags: this.utilities.sanitzeStringArr(this.filterAttributes.tags),
|
|
255
255
|
title: this.utilities.sanitizeString(this.attributes.title),
|
|
256
256
|
vendorName: this.utilities.sanitizeString(this.attributes.vendorName),
|
|
257
|
+
vendorId: this.utilities.sanitizeString(this.attributes.vendorId),
|
|
257
258
|
createdAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.createdAtTimestamp),
|
|
258
259
|
updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.updatedAtTimestamp),
|
|
259
260
|
sellRequestReviewTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.sellRequestReviewTimestamp),
|
|
@@ -276,12 +277,15 @@ class Product extends Base_1.default {
|
|
|
276
277
|
sellerSelfRejectTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.sellerSelfRejectTimestamp),
|
|
277
278
|
liquidationRequestedTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.liquidationRequestedTimestamp),
|
|
278
279
|
sellerLiquidatedTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.sellerLiquidatedTimestamp),
|
|
280
|
+
selectedForClearance: this.utilities.sanitizeString(this.consignmentAttributes.selectedForClearance),
|
|
279
281
|
availableForSale: !!this.attributes.availableForSale,
|
|
280
282
|
color: this.utilities.sanitizeString(this.filterAttributes.color),
|
|
281
283
|
description: this.utilities.sanitizeString(this.attributes.description),
|
|
282
284
|
discountType: this.utilities.sanitizeString(this.consignmentAttributes.discountType),
|
|
283
285
|
discountValue: this.utilities.sanitizeNumber(this.consignmentAttributes.discountValue, 0),
|
|
284
286
|
id: this.utilities.sanitizeString(this.filterAttributes.documentId),
|
|
287
|
+
documentId: this.utilities.sanitizeString(this.filterAttributes.documentId),
|
|
288
|
+
shopifyId: this.utilities.sanitizeString(this.attributes.shopifyId),
|
|
285
289
|
gender: this.utilities.sanitizeString(this.filterAttributes.gender),
|
|
286
290
|
handle: this.utilities.sanitizeString(this.attributes.handle),
|
|
287
291
|
imageUrls: this.utilities.sanitzeStringArr(this.attributes.imageUrls),
|
|
@@ -403,7 +407,7 @@ class Product extends Base_1.default {
|
|
|
403
407
|
return acc;
|
|
404
408
|
}, '');
|
|
405
409
|
}
|
|
406
|
-
generateSchemaForTypesense(name = '
|
|
410
|
+
generateSchemaForTypesense(name = 'prod_products_20210108') {
|
|
407
411
|
return {
|
|
408
412
|
default_sorting_field: 'createdAtTimestamp',
|
|
409
413
|
fields: [
|
|
@@ -537,6 +541,11 @@ class Product extends Base_1.default {
|
|
|
537
541
|
name: 'vendorName',
|
|
538
542
|
type: 'string',
|
|
539
543
|
},
|
|
544
|
+
{
|
|
545
|
+
facet: true,
|
|
546
|
+
name: 'vendorId',
|
|
547
|
+
type: 'string',
|
|
548
|
+
},
|
|
540
549
|
{
|
|
541
550
|
facet: false,
|
|
542
551
|
optional: true,
|
|
@@ -554,10 +563,15 @@ class Product extends Base_1.default {
|
|
|
554
563
|
type: 'int32',
|
|
555
564
|
},
|
|
556
565
|
{
|
|
557
|
-
facet:
|
|
566
|
+
facet: true,
|
|
558
567
|
name: 'availableForSale',
|
|
559
568
|
type: 'bool',
|
|
560
569
|
},
|
|
570
|
+
{
|
|
571
|
+
facet: true,
|
|
572
|
+
name: 'selectedForClearance',
|
|
573
|
+
type: 'string',
|
|
574
|
+
},
|
|
561
575
|
{
|
|
562
576
|
facet: true,
|
|
563
577
|
name: 'color',
|
|
@@ -585,6 +599,16 @@ class Product extends Base_1.default {
|
|
|
585
599
|
name: 'id',
|
|
586
600
|
type: 'string',
|
|
587
601
|
},
|
|
602
|
+
{
|
|
603
|
+
facet: false,
|
|
604
|
+
name: 'documentId',
|
|
605
|
+
type: 'string',
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
facet: false,
|
|
609
|
+
name: 'shopifyId',
|
|
610
|
+
type: 'string',
|
|
611
|
+
},
|
|
588
612
|
{
|
|
589
613
|
facet: true,
|
|
590
614
|
name: 'gender',
|
|
@@ -15,7 +15,7 @@ declare type ProductAttributes = {
|
|
|
15
15
|
vendorName?: string;
|
|
16
16
|
variantId: string;
|
|
17
17
|
reservedBy: string[];
|
|
18
|
-
|
|
18
|
+
options?: ProductOptions | null;
|
|
19
19
|
costPerItem?: string;
|
|
20
20
|
compareAtPrice?: string;
|
|
21
21
|
quantity?: number | string;
|
|
@@ -140,7 +140,7 @@ declare type ProductAttributesFormFields = {
|
|
|
140
140
|
price: TextInputFormField<string>;
|
|
141
141
|
weight: TextInputFormField<string>;
|
|
142
142
|
officialFilesToUpload: MultiMediaSelectFormField;
|
|
143
|
-
|
|
143
|
+
options: SingleSelectFormField<ProductOptions>;
|
|
144
144
|
costPerItem: TextInputFormField<string>;
|
|
145
145
|
compareAtPrice: TextInputFormField<string>;
|
|
146
146
|
quantity: TextInputFormField<string | number>;
|
|
@@ -199,7 +199,7 @@ interface ParamsForBuildProductInputObjForShopify {
|
|
|
199
199
|
productShopifyId?: string;
|
|
200
200
|
}
|
|
201
201
|
declare type ConditionTypes = 'NEW' | 'USED';
|
|
202
|
-
declare type
|
|
202
|
+
declare type ProductOptions = {
|
|
203
203
|
size?: string[];
|
|
204
204
|
color?: string[];
|
|
205
205
|
material?: string[];
|
|
@@ -256,6 +256,7 @@ declare type TypesenseProductObj = {
|
|
|
256
256
|
tags: string[];
|
|
257
257
|
title: string;
|
|
258
258
|
vendorName: string;
|
|
259
|
+
vendorId: string;
|
|
259
260
|
createdAtTimestamp: number;
|
|
260
261
|
updatedAtTimestamp: number;
|
|
261
262
|
sellRequestReviewTimestamp: number;
|
|
@@ -284,6 +285,7 @@ declare type TypesenseProductObj = {
|
|
|
284
285
|
discountType: string;
|
|
285
286
|
discountValue: number;
|
|
286
287
|
id: string;
|
|
288
|
+
documentId: string;
|
|
287
289
|
gender: string;
|
|
288
290
|
handle: string;
|
|
289
291
|
imageUrls: string[];
|