rerobe-js-orm 3.9.3 → 3.9.5
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/constants/product-constants.d.ts +26 -18
- package/lib/constants/product-constants.js +6 -1
- package/lib/factories/Product/ProductFromFormState.js +33 -32
- package/lib/form-states/Product/options.d.ts +8 -0
- package/lib/form-states/Product/options.js +34 -1
- package/lib/models/Product.d.ts +1 -1
- package/lib/models/Product.js +32 -1
- package/lib/types/rerobe-product-types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -29,6 +29,14 @@ export namespace ADMIN_ACTION_DRIVEN_STATES {
|
|
|
29
29
|
const sellerLiquidated: string;
|
|
30
30
|
const availableInStore: string;
|
|
31
31
|
}
|
|
32
|
+
export namespace ADMIN_SIMPLIFIED_STATES {
|
|
33
|
+
const draft_1: string;
|
|
34
|
+
export { draft_1 as draft };
|
|
35
|
+
const pendingPublication_1: string;
|
|
36
|
+
export { pendingPublication_1 as pendingPublication };
|
|
37
|
+
const listed_1: string;
|
|
38
|
+
export { listed_1 as listed };
|
|
39
|
+
}
|
|
32
40
|
export namespace SYSTEM_DRIVEN_STATES {
|
|
33
41
|
const sold: string;
|
|
34
42
|
const returned: string;
|
|
@@ -60,18 +68,18 @@ export namespace PRODUCT_STATES {
|
|
|
60
68
|
export { rejected_1 as rejected };
|
|
61
69
|
const hold_1: string;
|
|
62
70
|
export { hold_1 as hold };
|
|
63
|
-
const
|
|
64
|
-
export {
|
|
71
|
+
const draft_2: string;
|
|
72
|
+
export { draft_2 as draft };
|
|
65
73
|
const accepted_1: string;
|
|
66
74
|
export { accepted_1 as accepted };
|
|
67
75
|
const qualityControl_1: string;
|
|
68
76
|
export { qualityControl_1 as qualityControl };
|
|
69
|
-
const
|
|
70
|
-
export {
|
|
77
|
+
const pendingPublication_2: string;
|
|
78
|
+
export { pendingPublication_2 as pendingPublication };
|
|
71
79
|
const merchantDonated_1: string;
|
|
72
80
|
export { merchantDonated_1 as merchantDonated };
|
|
73
|
-
const
|
|
74
|
-
export {
|
|
81
|
+
const listed_2: string;
|
|
82
|
+
export { listed_2 as listed };
|
|
75
83
|
const clearance_1: string;
|
|
76
84
|
export { clearance_1 as clearance };
|
|
77
85
|
const soldSellerToBePaid_1: string;
|
|
@@ -106,8 +114,8 @@ export namespace PRODUCT_STATE_LABELS {
|
|
|
106
114
|
export { sellRequestReviewDraft_2 as sellRequestReviewDraft };
|
|
107
115
|
const rejected_2: string;
|
|
108
116
|
export { rejected_2 as rejected };
|
|
109
|
-
const
|
|
110
|
-
export {
|
|
117
|
+
const draft_3: string;
|
|
118
|
+
export { draft_3 as draft };
|
|
111
119
|
const accepted_2: string;
|
|
112
120
|
export { accepted_2 as accepted };
|
|
113
121
|
const sellerToDropOff_2: string;
|
|
@@ -118,10 +126,10 @@ export namespace PRODUCT_STATE_LABELS {
|
|
|
118
126
|
export { sellerToGetPickUp_2 as sellerToGetPickUp };
|
|
119
127
|
const qualityControl_2: string;
|
|
120
128
|
export { qualityControl_2 as qualityControl };
|
|
121
|
-
const
|
|
122
|
-
export {
|
|
123
|
-
const
|
|
124
|
-
export {
|
|
129
|
+
const pendingPublication_3: string;
|
|
130
|
+
export { pendingPublication_3 as pendingPublication };
|
|
131
|
+
const listed_3: string;
|
|
132
|
+
export { listed_3 as listed };
|
|
125
133
|
const hold_2: string;
|
|
126
134
|
export { hold_2 as hold };
|
|
127
135
|
const clearance_2: string;
|
|
@@ -166,8 +174,8 @@ export namespace PRODUCT_STATE_LABELS_ADMIN_VIEW {
|
|
|
166
174
|
export { sellRequestReviewDraft_3 as sellRequestReviewDraft };
|
|
167
175
|
const rejected_3: string;
|
|
168
176
|
export { rejected_3 as rejected };
|
|
169
|
-
const
|
|
170
|
-
export {
|
|
177
|
+
const draft_4: string;
|
|
178
|
+
export { draft_4 as draft };
|
|
171
179
|
const accepted_3: string;
|
|
172
180
|
export { accepted_3 as accepted };
|
|
173
181
|
const sellerToDropOff_3: string;
|
|
@@ -178,10 +186,10 @@ export namespace PRODUCT_STATE_LABELS_ADMIN_VIEW {
|
|
|
178
186
|
export { sellerToGetPickUp_3 as sellerToGetPickUp };
|
|
179
187
|
const qualityControl_3: string;
|
|
180
188
|
export { qualityControl_3 as qualityControl };
|
|
181
|
-
const
|
|
182
|
-
export {
|
|
183
|
-
const
|
|
184
|
-
export {
|
|
189
|
+
const pendingPublication_4: string;
|
|
190
|
+
export { pendingPublication_4 as pendingPublication };
|
|
191
|
+
const listed_4: string;
|
|
192
|
+
export { listed_4 as listed };
|
|
185
193
|
const hold_3: string;
|
|
186
194
|
export { hold_3 as hold };
|
|
187
195
|
const clearance_3: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MEASUREMENT_FIELDS_DICT = exports.MEASUREMENT_CATEGORY = exports.PRODUCT_STATE_LABELS_ADMIN_VIEW = exports.PRODUCT_STATE_LABELS = exports.PRODUCT_STATES = exports.SYSTEM_DRIVEN_STATES = exports.ADMIN_ACTION_DRIVEN_STATES = exports.ADMIN_DRIVEN_STATES = exports.SELLER_DRIVEN_STATES = void 0;
|
|
3
|
+
exports.MEASUREMENT_FIELDS_DICT = exports.MEASUREMENT_CATEGORY = exports.PRODUCT_STATE_LABELS_ADMIN_VIEW = exports.PRODUCT_STATE_LABELS = exports.PRODUCT_STATES = exports.SYSTEM_DRIVEN_STATES = exports.ADMIN_SIMPLIFIED_STATES = exports.ADMIN_ACTION_DRIVEN_STATES = exports.ADMIN_DRIVEN_STATES = exports.SELLER_DRIVEN_STATES = void 0;
|
|
4
4
|
exports.SELLER_DRIVEN_STATES = {
|
|
5
5
|
archived: 'ARCHIVED',
|
|
6
6
|
sellerDonated: 'SELLER_DONATED',
|
|
@@ -31,6 +31,11 @@ exports.ADMIN_ACTION_DRIVEN_STATES = {
|
|
|
31
31
|
sellerLiquidated: 'SELLER_LIQUIDATED',
|
|
32
32
|
availableInStore: 'AVAILABLE_IN_STORE',
|
|
33
33
|
}; // 7
|
|
34
|
+
exports.ADMIN_SIMPLIFIED_STATES = {
|
|
35
|
+
draft: 'DRAFT',
|
|
36
|
+
pendingPublication: 'PENDING_PUBLICATION',
|
|
37
|
+
listed: 'LISTED',
|
|
38
|
+
};
|
|
34
39
|
exports.SYSTEM_DRIVEN_STATES = {
|
|
35
40
|
sold: 'SOLD',
|
|
36
41
|
returned: 'RETURNED',
|
|
@@ -4,7 +4,7 @@ const ProductFactory_1 = require("./ProductFactory");
|
|
|
4
4
|
const Product_1 = require("../../models/Product");
|
|
5
5
|
class ProductFromFormState extends ProductFactory_1.default {
|
|
6
6
|
createProduct(props) {
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20;
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
|
|
8
8
|
const productAttributes = {
|
|
9
9
|
availableForSale: props.fields.availableForSale.selectedValue,
|
|
10
10
|
description: props.fields.description.inputValue,
|
|
@@ -57,9 +57,10 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
57
57
|
featuredCollections: props.fields.featuredCollections.selectedValues || [],
|
|
58
58
|
primaryAgeCategory: props.fields.primaryAgeCategory.selectedValue || '',
|
|
59
59
|
tags: props.fields.tags.selectedValues || [],
|
|
60
|
+
systemTags: ((_q = props.props) === null || _q === void 0 ? void 0 : _q.systemTags) || [],
|
|
60
61
|
};
|
|
61
62
|
const consignmentAttributes = {
|
|
62
|
-
sellRequestId: ((
|
|
63
|
+
sellRequestId: ((_r = props.props) === null || _r === void 0 ? void 0 : _r.sellRequestId) || '',
|
|
63
64
|
publishType: props.fields.publishType.selectedValue,
|
|
64
65
|
conditionRemarks: props.fields.conditionRemarks.inputValue,
|
|
65
66
|
productRemarks: props.fields.productRemarks.inputValue,
|
|
@@ -72,14 +73,14 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
72
73
|
nextAvailableSeason: props.fields.nextAvailableSeason.selectedValue,
|
|
73
74
|
notesForProductionTeam: props.fields.notesForProductionTeam.inputValue,
|
|
74
75
|
reviewedBy: props.fields.reviewedBy.selectedValue,
|
|
75
|
-
sellRequestImageUrls: ((
|
|
76
|
+
sellRequestImageUrls: ((_s = props.props) === null || _s === void 0 ? void 0 : _s.sellRequestImageUrls) || [],
|
|
76
77
|
salesChannel: props.fields.salesChannel.selectedValues || [],
|
|
77
78
|
sizeComment: props.fields.sizeComment.selectedValue,
|
|
78
|
-
salePrice: ((
|
|
79
|
+
salePrice: ((_t = props.props) === null || _t === void 0 ? void 0 : _t.salePrice) || '',
|
|
79
80
|
isOnSale: props.fields.isOnSale.selectedValue || '',
|
|
80
81
|
discountType: props.fields.discountType.selectedValue || '',
|
|
81
82
|
discountValue: props.fields.discountValue.inputValue || '',
|
|
82
|
-
selectedForClearance: ((
|
|
83
|
+
selectedForClearance: ((_u = props.props) === null || _u === void 0 ? void 0 : _u.selectedForClearance) || '',
|
|
83
84
|
locationIds: props.fields.locationIds.selectedValues || [],
|
|
84
85
|
inventoryLocations: props.fields.inventoryLocations.selectedValues || [],
|
|
85
86
|
majorDefects: props.fields.majorDefects.selectedValues || [],
|
|
@@ -87,33 +88,33 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
87
88
|
careInstructions: props.fields.careInstructions.inputValue || '',
|
|
88
89
|
};
|
|
89
90
|
const timestampAttributes = {
|
|
90
|
-
createdAtTimestamp: (
|
|
91
|
-
updatedAtTimestamp: (
|
|
92
|
-
sellRequestReviewTimestamp: (
|
|
93
|
-
sellRequestReviewDraftTimestamp: (
|
|
94
|
-
rejectedTimestamp: (
|
|
95
|
-
holdTimestamp: (
|
|
96
|
-
acceptedTimestamp: (
|
|
97
|
-
sellerToDropOffTimestamp: (
|
|
98
|
-
sellerToShipTimestamp: (
|
|
99
|
-
sellerToGetPickUpTimestamp: (
|
|
100
|
-
qualityControlTimestamp: (
|
|
101
|
-
pendingPublicationTimestamp: (
|
|
102
|
-
listedTimestamp: (
|
|
103
|
-
clearanceTimestamp: (
|
|
104
|
-
reservedTimestamp: (
|
|
105
|
-
soldTimestamp: (
|
|
106
|
-
returnedTimestamp: (
|
|
107
|
-
soldSellerToBePaidTimestamp: (
|
|
108
|
-
soldSellerPaidTimestamp: (
|
|
109
|
-
sellerSelfRejectTimestamp: (
|
|
110
|
-
liquidationRequestedTimestamp: (
|
|
111
|
-
sellerLiquidatedTimestamp: (
|
|
112
|
-
archivedTimestamp: (
|
|
113
|
-
liquidationReadyTimestamp: (
|
|
114
|
-
sellerDonatedTimestamp: (
|
|
115
|
-
merchantDonatedTimestamp: (
|
|
116
|
-
draftTimestamp: (
|
|
91
|
+
createdAtTimestamp: (_v = props.props) === null || _v === void 0 ? void 0 : _v.createdAtTimestamp,
|
|
92
|
+
updatedAtTimestamp: (_w = props.props) === null || _w === void 0 ? void 0 : _w.updatedAtTimestamp,
|
|
93
|
+
sellRequestReviewTimestamp: (_x = props.props) === null || _x === void 0 ? void 0 : _x.sellRequestReviewTimestamp,
|
|
94
|
+
sellRequestReviewDraftTimestamp: (_y = props.props) === null || _y === void 0 ? void 0 : _y.sellRequestReviewDraftTimestamp,
|
|
95
|
+
rejectedTimestamp: (_z = props.props) === null || _z === void 0 ? void 0 : _z.rejectedTimestamp,
|
|
96
|
+
holdTimestamp: (_0 = props.props) === null || _0 === void 0 ? void 0 : _0.holdTimestamp,
|
|
97
|
+
acceptedTimestamp: (_1 = props.props) === null || _1 === void 0 ? void 0 : _1.acceptedTimestamp,
|
|
98
|
+
sellerToDropOffTimestamp: (_2 = props.props) === null || _2 === void 0 ? void 0 : _2.sellerToDropOffTimestamp,
|
|
99
|
+
sellerToShipTimestamp: (_3 = props.props) === null || _3 === void 0 ? void 0 : _3.sellerToShipTimestamp,
|
|
100
|
+
sellerToGetPickUpTimestamp: (_4 = props.props) === null || _4 === void 0 ? void 0 : _4.sellerToGetPickUpTimestamp,
|
|
101
|
+
qualityControlTimestamp: (_5 = props.props) === null || _5 === void 0 ? void 0 : _5.qualityControlTimestamp,
|
|
102
|
+
pendingPublicationTimestamp: (_6 = props.props) === null || _6 === void 0 ? void 0 : _6.pendingPublicationTimestamp,
|
|
103
|
+
listedTimestamp: (_7 = props.props) === null || _7 === void 0 ? void 0 : _7.listedTimestamp,
|
|
104
|
+
clearanceTimestamp: (_8 = props.props) === null || _8 === void 0 ? void 0 : _8.clearanceTimestamp,
|
|
105
|
+
reservedTimestamp: (_9 = props.props) === null || _9 === void 0 ? void 0 : _9.reservedTimestamp,
|
|
106
|
+
soldTimestamp: (_10 = props.props) === null || _10 === void 0 ? void 0 : _10.soldTimestamp,
|
|
107
|
+
returnedTimestamp: (_11 = props.props) === null || _11 === void 0 ? void 0 : _11.returnedTimestamp,
|
|
108
|
+
soldSellerToBePaidTimestamp: (_12 = props.props) === null || _12 === void 0 ? void 0 : _12.soldSellerToBePaidTimestamp,
|
|
109
|
+
soldSellerPaidTimestamp: (_13 = props.props) === null || _13 === void 0 ? void 0 : _13.soldSellerPaidTimestamp,
|
|
110
|
+
sellerSelfRejectTimestamp: (_14 = props.props) === null || _14 === void 0 ? void 0 : _14.sellerSelfRejectTimestamp,
|
|
111
|
+
liquidationRequestedTimestamp: (_15 = props.props) === null || _15 === void 0 ? void 0 : _15.liquidationRequestedTimestamp,
|
|
112
|
+
sellerLiquidatedTimestamp: (_16 = props.props) === null || _16 === void 0 ? void 0 : _16.sellerLiquidatedTimestamp,
|
|
113
|
+
archivedTimestamp: (_17 = props.props) === null || _17 === void 0 ? void 0 : _17.archivedTimestamp,
|
|
114
|
+
liquidationReadyTimestamp: (_18 = props.props) === null || _18 === void 0 ? void 0 : _18.liquidationReadyTimestamp,
|
|
115
|
+
sellerDonatedTimestamp: (_19 = props.props) === null || _19 === void 0 ? void 0 : _19.sellerDonatedTimestamp,
|
|
116
|
+
merchantDonatedTimestamp: (_20 = props.props) === null || _20 === void 0 ? void 0 : _20.merchantDonatedTimestamp,
|
|
117
|
+
draftTimestamp: (_21 = props.props) === null || _21 === void 0 ? void 0 : _21.draftTimestamp,
|
|
117
118
|
};
|
|
118
119
|
return new Product_1.default(Object.assign(Object.assign(Object.assign(Object.assign({}, productAttributes), productFilterAttributes), consignmentAttributes), timestampAttributes));
|
|
119
120
|
}
|
|
@@ -192,3 +192,11 @@ export const measurementCategoryOptions: {
|
|
|
192
192
|
value: string;
|
|
193
193
|
measurementFields: string[];
|
|
194
194
|
}[];
|
|
195
|
+
export const adminStatusOptions: {
|
|
196
|
+
label: any;
|
|
197
|
+
value: string;
|
|
198
|
+
}[];
|
|
199
|
+
export const adminStatusOptionsSimplified: {
|
|
200
|
+
label: any;
|
|
201
|
+
value: string;
|
|
202
|
+
}[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.measurementCategoryOptions = exports.minorDefectOptions = exports.majorDefectOptions = exports.productOptions = exports.productYesNoOptions = 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.genderOptions = 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.adminStatusOptionsSimplified = exports.adminStatusOptions = exports.measurementCategoryOptions = exports.minorDefectOptions = exports.majorDefectOptions = exports.productOptions = exports.productYesNoOptions = 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.genderOptions = 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,39 @@ const statusOptions = Object.values(product_constants_1.PRODUCT_STATES).map((val
|
|
|
34
34
|
value: val,
|
|
35
35
|
}));
|
|
36
36
|
exports.statusOptions = statusOptions;
|
|
37
|
+
const productspecialStatusMappings = {
|
|
38
|
+
SELL_REQUEST_REVIEW: 'Sell Request',
|
|
39
|
+
ACCEPTED: 'Accepted',
|
|
40
|
+
REJECTED: 'Rejected',
|
|
41
|
+
HOLD: 'On Hold',
|
|
42
|
+
LISTED: 'Listed',
|
|
43
|
+
RESERVED: 'Reserved',
|
|
44
|
+
QUALITY_CONTROL: 'Quality Control',
|
|
45
|
+
AT_HOME_PICK_UP: 'Pick Up',
|
|
46
|
+
PENDING_PUBLICATION: 'Pending Publication',
|
|
47
|
+
SOLD: 'Sold - Return Period Open',
|
|
48
|
+
SOLD_SELLER_TO_BE_PAID: 'Sold - To Be Paid',
|
|
49
|
+
SOLD_SELLER_PAID: 'Sold - Seller Paid',
|
|
50
|
+
SELL_REQUEST_REVIEW_DRAFT: 'Review Draft',
|
|
51
|
+
DROP_OFF_AT_REROBE: 'Drop Off',
|
|
52
|
+
SELLER_SELF_REJECT: 'Self Rejected',
|
|
53
|
+
MERCHANT_DONATED: 'Donated',
|
|
54
|
+
};
|
|
55
|
+
function defaultFormat(status) {
|
|
56
|
+
if (!status)
|
|
57
|
+
return '';
|
|
58
|
+
return status
|
|
59
|
+
.replace(/_/g, ' ')
|
|
60
|
+
.toLowerCase()
|
|
61
|
+
.replace(/\b[a-z]/g, (char) => char.toUpperCase());
|
|
62
|
+
}
|
|
63
|
+
function adminStatusPretty(status) {
|
|
64
|
+
return productspecialStatusMappings[status] || defaultFormat(status);
|
|
65
|
+
}
|
|
66
|
+
const adminStatusOptions = Object.values(Object.assign(Object.assign({}, product_constants_1.ADMIN_ACTION_DRIVEN_STATES), product_constants_1.ADMIN_DRIVEN_STATES)).map((v) => ({ label: adminStatusPretty(v), value: v }));
|
|
67
|
+
exports.adminStatusOptions = adminStatusOptions;
|
|
68
|
+
const adminStatusOptionsSimplified = Object.values(Object.assign({}, product_constants_1.ADMIN_SIMPLIFIED_STATES)).map((v) => ({ label: adminStatusPretty(v), value: v }));
|
|
69
|
+
exports.adminStatusOptionsSimplified = adminStatusOptionsSimplified;
|
|
37
70
|
const measurementCategoryOptions = [
|
|
38
71
|
{
|
|
39
72
|
label: 'Accessories',
|
package/lib/models/Product.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export default class Product extends Base {
|
|
|
11
11
|
toProductInputObjForShopify(location?: string): any;
|
|
12
12
|
toProductInputObjForShopifyV2(locationId: string, weightUnit?: string): any[];
|
|
13
13
|
toObjForTextTranslation(): TranslatableAttributes;
|
|
14
|
-
toObjForTypesense(): TypesenseProductObj;
|
|
14
|
+
toObjForTypesense(isCanonicalMerchant?: boolean): TypesenseProductObj;
|
|
15
15
|
buildUpdatedFieldsForSalesChannel(): {
|
|
16
16
|
title: string;
|
|
17
17
|
description: string;
|
package/lib/models/Product.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const Base_1 = require("../Base");
|
|
4
4
|
const product_constants_1 = require("../constants/product-constants");
|
|
5
5
|
const options_1 = require("../form-states/Product/options");
|
|
6
|
+
const ReRobeProductHelpers_1 = require("../helpers/ReRobeProductHelpers");
|
|
6
7
|
class Product extends Base_1.default {
|
|
7
8
|
constructor(props) {
|
|
8
9
|
super();
|
|
@@ -59,6 +60,7 @@ class Product extends Base_1.default {
|
|
|
59
60
|
featuredCollections: this.utilities.sanitzeStringArr(props === null || props === void 0 ? void 0 : props.featuredCollections),
|
|
60
61
|
primaryAgeCategory: (props === null || props === void 0 ? void 0 : props.primaryAgeCategory) || '',
|
|
61
62
|
tags: this.utilities.sanitzeStringArr(props === null || props === void 0 ? void 0 : props.tags) || [],
|
|
63
|
+
systemTags: this.utilities.sanitzeStringArr(props === null || props === void 0 ? void 0 : props.systemTags) || [],
|
|
62
64
|
};
|
|
63
65
|
this.consignmentAttributes = {
|
|
64
66
|
sellRequestImageUrls: (props === null || props === void 0 ? void 0 : props.sellRequestImageUrls) || [],
|
|
@@ -276,10 +278,14 @@ class Product extends Base_1.default {
|
|
|
276
278
|
condition: this.filterAttributes.condition || this.FIELD_NOT_TRANSLATABLE_KEY,
|
|
277
279
|
};
|
|
278
280
|
}
|
|
279
|
-
toObjForTypesense() {
|
|
281
|
+
toObjForTypesense(isCanonicalMerchant = false) {
|
|
280
282
|
var _a, _b;
|
|
281
283
|
const createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.createdAtTimestamp);
|
|
282
284
|
const { createdAtHour, createdAtDay, createdAtMonth, createdAtYear } = this.utilities.formatTimestamp(createdAtTimestamp);
|
|
285
|
+
const [priceSold, commissionFee, productionFee, fulfillmentFee] = ReRobeProductHelpers_1.default.buildReRobeEarningsV2(this.toObj(), isCanonicalMerchant);
|
|
286
|
+
const merchantValue = commissionFee + productionFee + fulfillmentFee;
|
|
287
|
+
const sellerValue = priceSold - merchantValue;
|
|
288
|
+
const calculatedCommission = merchantValue / priceSold;
|
|
283
289
|
const stagedObj = {
|
|
284
290
|
brand: this.utilities.sanitizeString(this.filterAttributes.brand),
|
|
285
291
|
size: this.utilities.sanitizeString(this.filterAttributes.size),
|
|
@@ -294,6 +300,8 @@ class Product extends Base_1.default {
|
|
|
294
300
|
merchants: this.utilities.sanitzeStringArr(this.attributes.merchants),
|
|
295
301
|
merchantId: this.utilities.sanitizeString(this.attributes.merchantId),
|
|
296
302
|
price: this.utilities.sanitizeNumber(this.attributes.price),
|
|
303
|
+
merchantValue: this.utilities.sanitizeNumber(merchantValue),
|
|
304
|
+
sellerValue: this.utilities.sanitizeNumber(sellerValue),
|
|
297
305
|
suggestedResalePrice: this.utilities.sanitizeNumber(this.consignmentAttributes.suggestedResalePrice),
|
|
298
306
|
salePrice: this.utilities.sanitizeNumber(this.consignmentAttributes.salePrice),
|
|
299
307
|
compareAtPrice: this.utilities.sanitizeNumber(this.attributes.compareAtPrice),
|
|
@@ -303,12 +311,14 @@ class Product extends Base_1.default {
|
|
|
303
311
|
productCategory: this.utilities.sanitizeString(this.filterAttributes.productCategory),
|
|
304
312
|
productType: this.utilities.sanitizeString(this.filterAttributes.productType),
|
|
305
313
|
productStyle: this.utilities.sanitzeStringArr(this.filterAttributes.productStyle),
|
|
314
|
+
calculatedCommission: this.utilities.sanitizeNumber(calculatedCommission),
|
|
306
315
|
reRobeCommission: this.sanitizeCommission(),
|
|
307
316
|
rfidTag: this.utilities.sanitizeString(this.attributes.rfidTag),
|
|
308
317
|
sku: this.utilities.sanitizeString(this.attributes.sku),
|
|
309
318
|
salesChannel: this.utilities.sanitzeStringArr(this.consignmentAttributes.salesChannel),
|
|
310
319
|
status: this.utilities.sanitizeString(this.consignmentAttributes.status),
|
|
311
320
|
tags: this.utilities.sanitzeStringArr(this.filterAttributes.tags),
|
|
321
|
+
systemTags: this.utilities.sanitzeStringArr(this.filterAttributes.systemTags),
|
|
312
322
|
title: this.utilities.sanitizeString(this.attributes.title),
|
|
313
323
|
vendorName: this.utilities.sanitizeString(this.attributes.vendorName),
|
|
314
324
|
vendorId: this.utilities.sanitizeString(this.attributes.vendorId),
|
|
@@ -677,6 +687,21 @@ class Product extends Base_1.default {
|
|
|
677
687
|
name: 'price',
|
|
678
688
|
type: 'float',
|
|
679
689
|
},
|
|
690
|
+
{
|
|
691
|
+
facet: true,
|
|
692
|
+
name: 'merchantValue',
|
|
693
|
+
type: 'float',
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
facet: true,
|
|
697
|
+
name: 'sellerValue',
|
|
698
|
+
type: 'float',
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
facet: true,
|
|
702
|
+
name: 'calculatedCommission',
|
|
703
|
+
type: 'float',
|
|
704
|
+
},
|
|
680
705
|
{
|
|
681
706
|
facet: true,
|
|
682
707
|
optional: true,
|
|
@@ -761,6 +786,12 @@ class Product extends Base_1.default {
|
|
|
761
786
|
name: 'tags',
|
|
762
787
|
type: 'string[]',
|
|
763
788
|
},
|
|
789
|
+
{
|
|
790
|
+
facet: true,
|
|
791
|
+
optional: true,
|
|
792
|
+
name: 'systemTags',
|
|
793
|
+
type: 'string[]',
|
|
794
|
+
},
|
|
764
795
|
{
|
|
765
796
|
facet: false,
|
|
766
797
|
name: 'title',
|
|
@@ -50,6 +50,7 @@ type ProductFilterAttributes = {
|
|
|
50
50
|
featuredCollections?: string[];
|
|
51
51
|
primaryAgeCategory: string;
|
|
52
52
|
tags?: string[];
|
|
53
|
+
systemTags?: string[];
|
|
53
54
|
};
|
|
54
55
|
type ProductConsignmentAttributes = {
|
|
55
56
|
sellRequestImageUrls: string[];
|
|
@@ -267,6 +268,8 @@ type TypesenseProductObj = {
|
|
|
267
268
|
merchants: string[];
|
|
268
269
|
merchantId: string;
|
|
269
270
|
price: number;
|
|
271
|
+
merchantValue: number;
|
|
272
|
+
sellerValue: number;
|
|
270
273
|
suggestedResalePrice: number;
|
|
271
274
|
salePrice: number;
|
|
272
275
|
compareAtPrice: number;
|
|
@@ -277,11 +280,13 @@ type TypesenseProductObj = {
|
|
|
277
280
|
productType: string;
|
|
278
281
|
productStyle: string[];
|
|
279
282
|
reRobeCommission: number;
|
|
283
|
+
calculatedCommission: number;
|
|
280
284
|
rfidTag: string;
|
|
281
285
|
sku: string;
|
|
282
286
|
salesChannel: string[];
|
|
283
287
|
status: string;
|
|
284
288
|
tags: string[];
|
|
289
|
+
systemTags: string[];
|
|
285
290
|
title: string;
|
|
286
291
|
vendorName: string;
|
|
287
292
|
vendorId: string;
|