rerobe-js-orm 4.6.4 → 4.6.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.
|
@@ -4,44 +4,45 @@ 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, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36;
|
|
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, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37;
|
|
8
8
|
const productAttributes = {
|
|
9
9
|
availableForSale: props.fields.availableForSale.selectedValue,
|
|
10
10
|
description: props.fields.description.inputValue,
|
|
11
11
|
handle: props.fields.handle.inputValue || '',
|
|
12
12
|
shopifyId: ((_a = props.props) === null || _a === void 0 ? void 0 : _a.shopifyId) || '',
|
|
13
|
+
traderaId: ((_b = props.props) === null || _b === void 0 ? void 0 : _b.traderaId) || '',
|
|
13
14
|
title: props.fields.title.inputValue,
|
|
14
|
-
coverPhotoUrl: ((
|
|
15
|
-
imageUrls: ((
|
|
16
|
-
imageUrlsForAI: ((
|
|
15
|
+
coverPhotoUrl: ((_c = props.props) === null || _c === void 0 ? void 0 : _c.coverPhotoUrl) || '',
|
|
16
|
+
imageUrls: ((_d = props.props) === null || _d === void 0 ? void 0 : _d.imageUrls) || [],
|
|
17
|
+
imageUrlsForAI: ((_e = props.props) === null || _e === void 0 ? void 0 : _e.imageUrlsForAI) || [],
|
|
17
18
|
price: props.fields.price.inputValue,
|
|
18
19
|
isTaxable: props.fields.isTaxable.selectedValue,
|
|
19
20
|
productClass: props.fields.productClass.selectedValue,
|
|
20
|
-
createdAt: ((
|
|
21
|
-
updatedAt: ((
|
|
22
|
-
publishedAt: ((
|
|
23
|
-
vendorId: props.fields.vendorId.selectedValue || ((
|
|
21
|
+
createdAt: ((_f = props.props) === null || _f === void 0 ? void 0 : _f.createdAt) || new Date().toUTCString(), // ToDo look into different timestamp
|
|
22
|
+
updatedAt: ((_g = props.props) === null || _g === void 0 ? void 0 : _g.updatedAt) || new Date().toUTCString(), // ToDo look into different timestamp
|
|
23
|
+
publishedAt: ((_h = props.props) === null || _h === void 0 ? void 0 : _h.publishedAt) || new Date().toUTCString(),
|
|
24
|
+
vendorId: props.fields.vendorId.selectedValue || ((_j = props.props) === null || _j === void 0 ? void 0 : _j.vendorId) || '',
|
|
24
25
|
vendorName: props.fields.vendorName.selectedValue || '',
|
|
25
26
|
weight: props.fields.weight.inputValue,
|
|
26
27
|
weightRange: props.fields.weightRange.selectedValue || '',
|
|
27
28
|
weightUnit: props.fields.weightUnit.selectedValue || '',
|
|
28
|
-
variantId: ((
|
|
29
|
-
reservedBy: ((
|
|
29
|
+
variantId: ((_k = props.props) === null || _k === void 0 ? void 0 : _k.variantId) || '',
|
|
30
|
+
reservedBy: ((_l = props.props) === null || _l === void 0 ? void 0 : _l.reservedBy) || [],
|
|
30
31
|
options: props.fields.options.selectedValue,
|
|
31
|
-
variantInventory: ((
|
|
32
|
+
variantInventory: ((_m = props.fields.variantInventory) === null || _m === void 0 ? void 0 : _m.selectedValues) || [],
|
|
32
33
|
costPerItem: props.fields.costPerItem.inputValue,
|
|
33
34
|
compareAtPrice: props.fields.compareAtPrice.inputValue,
|
|
34
35
|
quantity: props.fields.quantity.inputValue,
|
|
35
|
-
merchants: ((
|
|
36
|
-
merchantId: ((
|
|
36
|
+
merchants: ((_o = props.props) === null || _o === void 0 ? void 0 : _o.merchants) || [],
|
|
37
|
+
merchantId: ((_p = props.props) === null || _p === void 0 ? void 0 : _p.merchantId) || '',
|
|
37
38
|
editorAuthorizations: props.fields.editorAuthorizations.selectedValue,
|
|
38
39
|
rfidTag: props.fields.rfidTag.inputValue || '',
|
|
39
40
|
sku: props.fields.sku.inputValue || '',
|
|
40
|
-
metaDataDescription: ((
|
|
41
|
-
metaDataTitle: ((
|
|
41
|
+
metaDataDescription: ((_q = props.fields.metaDataDescription) === null || _q === void 0 ? void 0 : _q.inputValue) || '',
|
|
42
|
+
metaDataTitle: ((_r = props.fields.metaDataTitle) === null || _r === void 0 ? void 0 : _r.inputValue) || '',
|
|
42
43
|
};
|
|
43
44
|
const productFilterAttributes = {
|
|
44
|
-
documentId: (
|
|
45
|
+
documentId: (_s = props.props) === null || _s === void 0 ? void 0 : _s.documentId,
|
|
45
46
|
brand: props.fields.brand.selectedValue,
|
|
46
47
|
measurementCategory: props.fields.measurementCategory.selectedValue,
|
|
47
48
|
size: props.fields.size.selectedValue,
|
|
@@ -62,11 +63,11 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
62
63
|
featuredCollections: props.fields.featuredCollections.selectedValues || [],
|
|
63
64
|
primaryAgeCategory: props.fields.primaryAgeCategory.selectedValue || '',
|
|
64
65
|
tags: props.fields.tags.selectedValues || [],
|
|
65
|
-
systemTags: ((
|
|
66
|
-
stockStatus: ((
|
|
66
|
+
systemTags: ((_t = props.props) === null || _t === void 0 ? void 0 : _t.systemTags) || [],
|
|
67
|
+
stockStatus: ((_u = props.props) === null || _u === void 0 ? void 0 : _u.stockStatus) || '',
|
|
67
68
|
};
|
|
68
69
|
const consignmentAttributes = {
|
|
69
|
-
sellRequestId: ((
|
|
70
|
+
sellRequestId: ((_v = props.props) === null || _v === void 0 ? void 0 : _v.sellRequestId) || '',
|
|
70
71
|
publishType: props.fields.publishType.selectedValue,
|
|
71
72
|
conditionRemarks: props.fields.conditionRemarks.inputValue,
|
|
72
73
|
productRemarks: props.fields.productRemarks.inputValue,
|
|
@@ -79,14 +80,14 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
79
80
|
nextAvailableSeason: props.fields.nextAvailableSeason.selectedValue,
|
|
80
81
|
notesForProductionTeam: props.fields.notesForProductionTeam.inputValue,
|
|
81
82
|
reviewedBy: props.fields.reviewedBy.selectedValue,
|
|
82
|
-
sellRequestImageUrls: ((
|
|
83
|
+
sellRequestImageUrls: ((_w = props.props) === null || _w === void 0 ? void 0 : _w.sellRequestImageUrls) || [],
|
|
83
84
|
salesChannel: props.fields.salesChannel.selectedValues || [],
|
|
84
85
|
sizeComment: props.fields.sizeComment.selectedValue,
|
|
85
|
-
salePrice: ((
|
|
86
|
+
salePrice: ((_x = props.props) === null || _x === void 0 ? void 0 : _x.salePrice) || '',
|
|
86
87
|
isOnSale: props.fields.isOnSale.selectedValue || '',
|
|
87
88
|
discountType: props.fields.discountType.selectedValue || '',
|
|
88
89
|
discountValue: props.fields.discountValue.inputValue || '',
|
|
89
|
-
selectedForClearance: ((
|
|
90
|
+
selectedForClearance: ((_y = props.props) === null || _y === void 0 ? void 0 : _y.selectedForClearance) || '',
|
|
90
91
|
locationIds: props.fields.locationIds.selectedValues || [],
|
|
91
92
|
inventoryLocations: props.fields.inventoryLocations.selectedValues || [],
|
|
92
93
|
majorDefects: props.fields.majorDefects.selectedValues || [], // ToDo: Deprecate
|
|
@@ -94,47 +95,47 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
94
95
|
careInstructions: props.fields.careInstructions.inputValue || '',
|
|
95
96
|
};
|
|
96
97
|
const timestampAttributes = {
|
|
97
|
-
createdAtTimestamp: (
|
|
98
|
-
updatedAtTimestamp: (
|
|
99
|
-
sellRequestReviewTimestamp: (
|
|
100
|
-
sellRequestReviewDraftTimestamp: (
|
|
101
|
-
rejectedTimestamp: (
|
|
102
|
-
holdTimestamp: (
|
|
103
|
-
acceptedTimestamp: (
|
|
104
|
-
sellerToDropOffTimestamp: (
|
|
105
|
-
sellerToShipTimestamp: (
|
|
106
|
-
sellerToGetPickUpTimestamp: (
|
|
107
|
-
qualityControlTimestamp: (
|
|
108
|
-
pendingPublicationTimestamp: (
|
|
109
|
-
listedTimestamp: (
|
|
110
|
-
clearanceTimestamp: (
|
|
111
|
-
reservedTimestamp: (
|
|
112
|
-
soldTimestamp: (
|
|
113
|
-
returnedTimestamp: (
|
|
114
|
-
soldSellerSelfPayTimestamp: (
|
|
115
|
-
soldSellerPayoutProcessingTimestamp: (
|
|
116
|
-
soldSellerPayoutFailedTimestamp: (
|
|
117
|
-
soldSellerToBePaidTimestamp: (
|
|
118
|
-
soldSellerPaidTimestamp: (
|
|
119
|
-
sellerSelfRejectTimestamp: (
|
|
120
|
-
liquidationRequestedTimestamp: (
|
|
121
|
-
sellerLiquidatedTimestamp: (
|
|
122
|
-
archivedTimestamp: (
|
|
123
|
-
liquidationReadyTimestamp: (
|
|
124
|
-
sellerDonatedTimestamp: (
|
|
125
|
-
merchantDonatedTimestamp: (
|
|
126
|
-
draftTimestamp: (
|
|
127
|
-
hiddenTimestamp: (
|
|
128
|
-
bookedTimestamp: (
|
|
129
|
-
openTimestamp: (
|
|
130
|
-
stockTakeFirstTimestamp: (
|
|
131
|
-
stockTakeLatestTimestamp: (
|
|
132
|
-
stockStatusTimestamp: (
|
|
98
|
+
createdAtTimestamp: (_z = props.props) === null || _z === void 0 ? void 0 : _z.createdAtTimestamp,
|
|
99
|
+
updatedAtTimestamp: (_0 = props.props) === null || _0 === void 0 ? void 0 : _0.updatedAtTimestamp,
|
|
100
|
+
sellRequestReviewTimestamp: (_1 = props.props) === null || _1 === void 0 ? void 0 : _1.sellRequestReviewTimestamp,
|
|
101
|
+
sellRequestReviewDraftTimestamp: (_2 = props.props) === null || _2 === void 0 ? void 0 : _2.sellRequestReviewDraftTimestamp,
|
|
102
|
+
rejectedTimestamp: (_3 = props.props) === null || _3 === void 0 ? void 0 : _3.rejectedTimestamp,
|
|
103
|
+
holdTimestamp: (_4 = props.props) === null || _4 === void 0 ? void 0 : _4.holdTimestamp,
|
|
104
|
+
acceptedTimestamp: (_5 = props.props) === null || _5 === void 0 ? void 0 : _5.acceptedTimestamp,
|
|
105
|
+
sellerToDropOffTimestamp: (_6 = props.props) === null || _6 === void 0 ? void 0 : _6.sellerToDropOffTimestamp,
|
|
106
|
+
sellerToShipTimestamp: (_7 = props.props) === null || _7 === void 0 ? void 0 : _7.sellerToShipTimestamp,
|
|
107
|
+
sellerToGetPickUpTimestamp: (_8 = props.props) === null || _8 === void 0 ? void 0 : _8.sellerToGetPickUpTimestamp,
|
|
108
|
+
qualityControlTimestamp: (_9 = props.props) === null || _9 === void 0 ? void 0 : _9.qualityControlTimestamp,
|
|
109
|
+
pendingPublicationTimestamp: (_10 = props.props) === null || _10 === void 0 ? void 0 : _10.pendingPublicationTimestamp,
|
|
110
|
+
listedTimestamp: (_11 = props.props) === null || _11 === void 0 ? void 0 : _11.listedTimestamp,
|
|
111
|
+
clearanceTimestamp: (_12 = props.props) === null || _12 === void 0 ? void 0 : _12.clearanceTimestamp,
|
|
112
|
+
reservedTimestamp: (_13 = props.props) === null || _13 === void 0 ? void 0 : _13.reservedTimestamp,
|
|
113
|
+
soldTimestamp: (_14 = props.props) === null || _14 === void 0 ? void 0 : _14.soldTimestamp,
|
|
114
|
+
returnedTimestamp: (_15 = props.props) === null || _15 === void 0 ? void 0 : _15.returnedTimestamp,
|
|
115
|
+
soldSellerSelfPayTimestamp: (_16 = props.props) === null || _16 === void 0 ? void 0 : _16.soldSellerSelfPayTimestamp,
|
|
116
|
+
soldSellerPayoutProcessingTimestamp: (_17 = props.props) === null || _17 === void 0 ? void 0 : _17.soldSellerPayoutProcessingTimestamp,
|
|
117
|
+
soldSellerPayoutFailedTimestamp: (_18 = props.props) === null || _18 === void 0 ? void 0 : _18.soldSellerPayoutFailedTimestamp,
|
|
118
|
+
soldSellerToBePaidTimestamp: (_19 = props.props) === null || _19 === void 0 ? void 0 : _19.soldSellerToBePaidTimestamp,
|
|
119
|
+
soldSellerPaidTimestamp: (_20 = props.props) === null || _20 === void 0 ? void 0 : _20.soldSellerPaidTimestamp,
|
|
120
|
+
sellerSelfRejectTimestamp: (_21 = props.props) === null || _21 === void 0 ? void 0 : _21.sellerSelfRejectTimestamp,
|
|
121
|
+
liquidationRequestedTimestamp: (_22 = props.props) === null || _22 === void 0 ? void 0 : _22.liquidationRequestedTimestamp,
|
|
122
|
+
sellerLiquidatedTimestamp: (_23 = props.props) === null || _23 === void 0 ? void 0 : _23.sellerLiquidatedTimestamp,
|
|
123
|
+
archivedTimestamp: (_24 = props.props) === null || _24 === void 0 ? void 0 : _24.archivedTimestamp,
|
|
124
|
+
liquidationReadyTimestamp: (_25 = props.props) === null || _25 === void 0 ? void 0 : _25.liquidationReadyTimestamp,
|
|
125
|
+
sellerDonatedTimestamp: (_26 = props.props) === null || _26 === void 0 ? void 0 : _26.sellerDonatedTimestamp,
|
|
126
|
+
merchantDonatedTimestamp: (_27 = props.props) === null || _27 === void 0 ? void 0 : _27.merchantDonatedTimestamp,
|
|
127
|
+
draftTimestamp: (_28 = props.props) === null || _28 === void 0 ? void 0 : _28.draftTimestamp,
|
|
128
|
+
hiddenTimestamp: (_29 = props.props) === null || _29 === void 0 ? void 0 : _29.hiddenTimestamp,
|
|
129
|
+
bookedTimestamp: (_30 = props.props) === null || _30 === void 0 ? void 0 : _30.bookedTimestamp,
|
|
130
|
+
openTimestamp: (_31 = props.props) === null || _31 === void 0 ? void 0 : _31.openTimestamp,
|
|
131
|
+
stockTakeFirstTimestamp: (_32 = props.props) === null || _32 === void 0 ? void 0 : _32.stockTakeFirstTimestamp,
|
|
132
|
+
stockTakeLatestTimestamp: (_33 = props.props) === null || _33 === void 0 ? void 0 : _33.stockTakeLatestTimestamp,
|
|
133
|
+
stockStatusTimestamp: (_34 = props.props) === null || _34 === void 0 ? void 0 : _34.stockStatusTimestamp,
|
|
133
134
|
};
|
|
134
135
|
const payoutAttributes = {
|
|
135
|
-
payoutMethod: (
|
|
136
|
-
payoutSystem: (
|
|
137
|
-
payoutReference: (
|
|
136
|
+
payoutMethod: (_35 = props.props) === null || _35 === void 0 ? void 0 : _35.payoutMethod,
|
|
137
|
+
payoutSystem: (_36 = props.props) === null || _36 === void 0 ? void 0 : _36.payoutSystem,
|
|
138
|
+
payoutReference: (_37 = props.props) === null || _37 === void 0 ? void 0 : _37.payoutReference,
|
|
138
139
|
};
|
|
139
140
|
return new Product_1.default(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, productAttributes), productFilterAttributes), consignmentAttributes), timestampAttributes), payoutAttributes));
|
|
140
141
|
}
|
package/lib/models/Product.js
CHANGED
|
@@ -16,6 +16,7 @@ class Product extends Base_1.default {
|
|
|
16
16
|
imageUrlsForAI: this.utilities.sanitzeStringArr(props === null || props === void 0 ? void 0 : props.imageUrlsForAI),
|
|
17
17
|
price: (props === null || props === void 0 ? void 0 : props.price) || '',
|
|
18
18
|
shopifyId: (props === null || props === void 0 ? void 0 : props.shopifyId) || '',
|
|
19
|
+
traderaId: (props === null || props === void 0 ? void 0 : props.traderaId) || '',
|
|
19
20
|
handle: (props === null || props === void 0 ? void 0 : props.handle) || '',
|
|
20
21
|
availableForSale: !!(props === null || props === void 0 ? void 0 : props.availableForSale),
|
|
21
22
|
createdAt: (props === null || props === void 0 ? void 0 : props.createdAt) || '',
|
|
@@ -497,6 +498,14 @@ class Product extends Base_1.default {
|
|
|
497
498
|
rfidTag: this.utilities.sanitizeString(this.attributes.rfidTag),
|
|
498
499
|
sku: this.utilities.sanitizeString(this.attributes.sku),
|
|
499
500
|
salesChannel: this.utilities.sanitzeStringArr(this.consignmentAttributes.salesChannel),
|
|
501
|
+
thirdPartySalesChannels: (() => {
|
|
502
|
+
const channels = [];
|
|
503
|
+
if (this.attributes.shopifyId)
|
|
504
|
+
channels.push('shopify');
|
|
505
|
+
if (this.attributes.traderaId)
|
|
506
|
+
channels.push('tradera');
|
|
507
|
+
return channels;
|
|
508
|
+
})(),
|
|
500
509
|
status: this.utilities.sanitizeString(this.consignmentAttributes.status),
|
|
501
510
|
tags: this.utilities.sanitzeStringArr(this.filterAttributes.tags),
|
|
502
511
|
systemTags: this.utilities.sanitzeStringArr(this.filterAttributes.systemTags),
|
|
@@ -556,6 +565,7 @@ class Product extends Base_1.default {
|
|
|
556
565
|
id: this.utilities.sanitizeString(this.filterAttributes.documentId),
|
|
557
566
|
documentId: this.utilities.sanitizeString(this.filterAttributes.documentId),
|
|
558
567
|
shopifyId: this.utilities.sanitizeString(this.attributes.shopifyId),
|
|
568
|
+
traderaId: this.utilities.sanitizeString(this.attributes.traderaId),
|
|
559
569
|
gender: this.utilities.sanitizeString(this.filterAttributes.gender),
|
|
560
570
|
handle: this.utilities.sanitizeString(this.attributes.handle),
|
|
561
571
|
imageUrls: this.utilities.sanitzeStringArr(this.attributes.imageUrls),
|
|
@@ -1042,6 +1052,12 @@ class Product extends Base_1.default {
|
|
|
1042
1052
|
name: 'salesChannel',
|
|
1043
1053
|
type: 'string[]',
|
|
1044
1054
|
},
|
|
1055
|
+
{
|
|
1056
|
+
facet: true,
|
|
1057
|
+
optional: true,
|
|
1058
|
+
name: 'thirdPartySalesChannels',
|
|
1059
|
+
type: 'string[]',
|
|
1060
|
+
},
|
|
1045
1061
|
{
|
|
1046
1062
|
facet: true,
|
|
1047
1063
|
name: 'status',
|
|
@@ -1137,6 +1153,12 @@ class Product extends Base_1.default {
|
|
|
1137
1153
|
name: 'shopifyId',
|
|
1138
1154
|
type: 'string',
|
|
1139
1155
|
},
|
|
1156
|
+
{
|
|
1157
|
+
facet: false,
|
|
1158
|
+
optional: true,
|
|
1159
|
+
name: 'traderaId',
|
|
1160
|
+
type: 'string',
|
|
1161
|
+
},
|
|
1140
1162
|
{
|
|
1141
1163
|
facet: true,
|
|
1142
1164
|
name: 'gender',
|
|
@@ -3,6 +3,7 @@ type ProductAttributes = {
|
|
|
3
3
|
description: string;
|
|
4
4
|
handle: string;
|
|
5
5
|
shopifyId: string;
|
|
6
|
+
traderaId?: string;
|
|
6
7
|
title: string;
|
|
7
8
|
coverPhotoUrl: string;
|
|
8
9
|
imageUrls: string[];
|
|
@@ -325,6 +326,7 @@ type TypesenseProductObj = {
|
|
|
325
326
|
rfidTag: string;
|
|
326
327
|
sku: string;
|
|
327
328
|
salesChannel: string[];
|
|
329
|
+
thirdPartySalesChannels: string[];
|
|
328
330
|
status: string;
|
|
329
331
|
tags: string[];
|
|
330
332
|
systemTags: string[];
|
|
@@ -392,6 +394,8 @@ type TypesenseProductObj = {
|
|
|
392
394
|
payoutSystem: 'STRIPE' | 'MANUAL_TRANSFER' | 'RIBBN_CREDITS' | null;
|
|
393
395
|
payoutReference: string;
|
|
394
396
|
productClass: string;
|
|
397
|
+
shopifyId: string;
|
|
398
|
+
traderaId: string;
|
|
395
399
|
[key: string]: any;
|
|
396
400
|
};
|
|
397
401
|
type GoogleMerchantCenterProductObj = {
|