rerobe-js-orm 2.4.63 → 2.4.67
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/FormState/ProductCollection/ProductCollectionFormStateFactory.d.ts +5 -0
- package/lib/factories/FormState/ProductCollection/ProductCollectionFormStateFactory.js +10 -0
- package/lib/factories/Order/RefundFromFormState.js +4 -1
- package/lib/factories/Product/ProductFromFormState.js +9 -7
- package/lib/factories/ProductCollection/ProductCollectionFactory.d.ts +5 -0
- package/lib/factories/ProductCollection/ProductCollectionFactory.js +6 -0
- package/lib/factories/ProductCollection/ProductCollectionFromFormState.d.ts +5 -0
- package/lib/factories/ProductCollection/ProductCollectionFromFormState.js +19 -0
- package/lib/form-states/Order/RefundFormState.d.ts +3 -1
- package/lib/form-states/Order/RefundFormState.js +24 -29
- package/lib/form-states/Product/ProductFormState.js +4 -1
- package/lib/form-states/ProductCollection/ProductCollectionFormState.d.ts +13 -0
- package/lib/form-states/ProductCollection/ProductCollectionFormState.js +51 -0
- package/lib/helpers/OrderHelpers.d.ts +4 -2
- package/lib/helpers/OrderHelpers.js +66 -12
- package/lib/helpers/ReRobeProductHelpers.js +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/models/Order.d.ts +1 -0
- package/lib/models/Order.js +1 -0
- package/lib/models/Product.js +2 -0
- package/lib/models/ProductCollection.d.ts +13 -0
- package/lib/models/ProductCollection.js +30 -0
- package/lib/types/product-collection-types.d.ts +43 -0
- package/lib/types/product-collection-types.js +13 -0
- package/lib/types/rerobe-order-types.d.ts +15 -6
- package/lib/types/rerobe-product-types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import FormStateFactory from '../FormStateFactory';
|
|
2
|
+
import ProductCollectionFormState from '../../../form-states/ProductCollection/ProductCollectionFormState';
|
|
3
|
+
export default class ProductCollectionFormStateFactory extends FormStateFactory {
|
|
4
|
+
createFormState(props?: any, opts?: any): ProductCollectionFormState;
|
|
5
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const FormStateFactory_1 = require("../FormStateFactory");
|
|
4
|
+
const ProductCollectionFormState_1 = require("../../../form-states/ProductCollection/ProductCollectionFormState");
|
|
5
|
+
class ProductCollectionFormStateFactory extends FormStateFactory_1.default {
|
|
6
|
+
createFormState(props, opts) {
|
|
7
|
+
return new ProductCollectionFormState_1.default(props);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = ProductCollectionFormStateFactory;
|
|
@@ -10,6 +10,9 @@ class RefundFromFormState extends RefundFactory_1.default {
|
|
|
10
10
|
currencyCode = ((_a = fs.fields.refundLineItems.selectedValues[0].subtotalRefund) === null || _a === void 0 ? void 0 : _a.currencyCode) || '';
|
|
11
11
|
}
|
|
12
12
|
const subtotalRefundedAmount = fs.fields.subtotalRefunded.inputValue;
|
|
13
|
+
const preparedRefundLineItems = !fs.fields.refundLineItems.selectedValues.length
|
|
14
|
+
? []
|
|
15
|
+
: fs.fields.refundLineItems.selectedValues.filter(({ quantityRefund, quantityCancel }) => quantityRefund + quantityCancel > 0);
|
|
13
16
|
const refundAttributes = {
|
|
14
17
|
documentId: ((_b = fs.props) === null || _b === void 0 ? void 0 : _b.documentId) || '',
|
|
15
18
|
totalRefunded: { amount: fs.fields.totalRefunded.inputValue || 0, currencyCode },
|
|
@@ -17,7 +20,7 @@ class RefundFromFormState extends RefundFactory_1.default {
|
|
|
17
20
|
refundDiscount: { amount: fs.fields.refundDiscount.inputValue || 0, currencyCode },
|
|
18
21
|
refundShipping: { amount: fs.fields.refundShipping.inputValue || 0, currencyCode },
|
|
19
22
|
totalTax: { amount: fs.fields.totalTax.inputValue || 0, currencyCode },
|
|
20
|
-
refundLineItems:
|
|
23
|
+
refundLineItems: preparedRefundLineItems,
|
|
21
24
|
note: fs.fields.note.inputValue || '',
|
|
22
25
|
};
|
|
23
26
|
return new Refund_1.default(Object.assign({}, refundAttributes));
|
|
@@ -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
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
8
8
|
const productAttributes = {
|
|
9
9
|
availableForSale: props.fields.availableForSale.selectedValue,
|
|
10
10
|
description: props.fields.description.inputValue,
|
|
@@ -28,10 +28,10 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
28
28
|
quantity: props.fields.quantity.inputValue,
|
|
29
29
|
merchants: ((_l = props.props) === null || _l === void 0 ? void 0 : _l.merchants) || [],
|
|
30
30
|
editorAuthorizations: props.fields.editorAuthorizations.selectedValue,
|
|
31
|
-
rfidTag:
|
|
31
|
+
rfidTag: props.fields.rfidTag.inputValue || '',
|
|
32
32
|
};
|
|
33
33
|
const productFilterAttributes = {
|
|
34
|
-
documentId: (
|
|
34
|
+
documentId: (_m = props.props) === null || _m === void 0 ? void 0 : _m.documentId,
|
|
35
35
|
brand: props.fields.brand.selectedValue,
|
|
36
36
|
clothingSize: props.fields.clothingSize.selectedValues,
|
|
37
37
|
color: props.fields.color.selectedValue,
|
|
@@ -45,10 +45,11 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
45
45
|
productStyle: props.fields.productStyle.selectedValues,
|
|
46
46
|
shoeSize: props.fields.shoeSize.selectedValue,
|
|
47
47
|
measurements: props.fields.measurements.selectedValue || {},
|
|
48
|
+
featuredCollections: props.fields.featuredCollections.selectedValues || [],
|
|
48
49
|
};
|
|
49
50
|
const consignmentAttributes = {
|
|
50
51
|
previousSellers: props.fields.previousSellers.selectedValues,
|
|
51
|
-
sellRequestId: ((
|
|
52
|
+
sellRequestId: ((_o = props.props) === null || _o === void 0 ? void 0 : _o.sellRequestId) || '',
|
|
52
53
|
publishType: props.fields.publishType.selectedValue,
|
|
53
54
|
conditionRemarks: props.fields.conditionRemarks.inputValue,
|
|
54
55
|
productRemarks: props.fields.productRemarks.inputValue,
|
|
@@ -61,18 +62,19 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
61
62
|
nextAvailableSeason: props.fields.nextAvailableSeason.selectedValue,
|
|
62
63
|
notesForProductionTeam: props.fields.notesForProductionTeam.inputValue,
|
|
63
64
|
reviewedBy: props.fields.reviewedBy.selectedValue,
|
|
64
|
-
sellRequestImageUrls: ((
|
|
65
|
+
sellRequestImageUrls: ((_p = props.props) === null || _p === void 0 ? void 0 : _p.sellRequestImageUrls) || [],
|
|
65
66
|
dateSold: props.fields.dateSold.selectedValue || '',
|
|
66
67
|
dateInQualityControl: props.fields.dateInQualityControl.selectedValue || '',
|
|
67
68
|
dateInPendingPublication: props.fields.dateInPendingPublication.selectedValue || '',
|
|
68
69
|
dateListedOnline: props.fields.dateListedOnline.selectedValue || '',
|
|
69
70
|
salesChannel: props.fields.salesChannel.selectedValues || [],
|
|
70
71
|
sizeComment: props.fields.sizeComment.selectedValue,
|
|
71
|
-
salePrice: ((
|
|
72
|
+
salePrice: ((_q = props.props) === null || _q === void 0 ? void 0 : _q.salePrice) || '',
|
|
72
73
|
isOnSale: props.fields.isOnSale.selectedValue || '',
|
|
73
74
|
discountType: props.fields.discountType.selectedValue || '',
|
|
74
75
|
discountValue: props.fields.discountValue.inputValue || '',
|
|
75
|
-
selectedForClearance: ((
|
|
76
|
+
selectedForClearance: ((_r = props.props) === null || _r === void 0 ? void 0 : _r.selectedForClearance) || '',
|
|
77
|
+
locationIds: props.fields.locationIds.selectedValues || [],
|
|
76
78
|
};
|
|
77
79
|
return new Product_1.default(Object.assign(Object.assign(Object.assign({}, productAttributes), productFilterAttributes), consignmentAttributes));
|
|
78
80
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Base from '../../Base';
|
|
2
|
+
import ProductCollectionFormState from '../../form-states/ProductCollection/ProductCollectionFormState';
|
|
3
|
+
export default abstract class ProductCollectionFactory extends Base {
|
|
4
|
+
abstract createProductCollection(refund: ProductCollectionFormState): ProductCollectionType;
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import ProductCollectionFormState from '../../form-states/ProductCollection/ProductCollectionFormState';
|
|
2
|
+
import ProductCollectionFactory from './ProductCollectionFactory';
|
|
3
|
+
export default class ProductCollectionFromFormState extends ProductCollectionFactory {
|
|
4
|
+
createProductCollection(fs: ProductCollectionFormState): ProductCollectionType;
|
|
5
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ProductCollectionFactory_1 = require("./ProductCollectionFactory");
|
|
4
|
+
const ProductCollection_1 = require("../../models/ProductCollection");
|
|
5
|
+
class ProductCollectionFromFormState extends ProductCollectionFactory_1.default {
|
|
6
|
+
createProductCollection(fs) {
|
|
7
|
+
const productCollectionAttributes = {
|
|
8
|
+
preTitle: fs.fields.preTitle.inputValue || '',
|
|
9
|
+
title: fs.fields.title.inputValue || '',
|
|
10
|
+
subTitle: fs.fields.subTitle.inputValue || '',
|
|
11
|
+
description: fs.fields.description.inputValue || '',
|
|
12
|
+
type: fs.fields.type.selectedValue || '',
|
|
13
|
+
imgUrl: fs.fields.imgUrl.inputValue || '',
|
|
14
|
+
refinements: fs.fields.refinements.selectedValue || {},
|
|
15
|
+
};
|
|
16
|
+
return new ProductCollection_1.default(Object.assign({}, productCollectionAttributes));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = ProductCollectionFromFormState;
|
|
@@ -6,9 +6,11 @@ export default class RefundFormState extends FormState {
|
|
|
6
6
|
constructor(props?: any);
|
|
7
7
|
createRefund(): Refund;
|
|
8
8
|
updateTotalRefunded(): void;
|
|
9
|
+
getUpdatedRefundLineItem(lineItem: ReRobeOrderLineItem, quantityRefund: number | string, quantityCancel: number | string, unitOrderDiscountAmount: number): RefundLineItem;
|
|
9
10
|
refundLineItemChangeHandler(val: {
|
|
10
11
|
lineItemLike: ReRobeOrderLineItem | RefundLineItem;
|
|
11
|
-
|
|
12
|
+
quantityRefund: number | string;
|
|
13
|
+
quantityCancel: number | string;
|
|
12
14
|
unitOrderDiscount: number;
|
|
13
15
|
}): void;
|
|
14
16
|
private fieldFactory;
|
|
@@ -25,54 +25,49 @@ class RefundFormState extends FormState_1.default {
|
|
|
25
25
|
Number(this.fields.refundShipping.inputValue) +
|
|
26
26
|
Number(this.fields.totalTax.inputValue)).toFixed(2);
|
|
27
27
|
}
|
|
28
|
+
getUpdatedRefundLineItem(lineItem, quantityRefund, quantityCancel, unitOrderDiscountAmount) {
|
|
29
|
+
var _a;
|
|
30
|
+
const lineItemPriceAmount = Number((_a = lineItem.originalUnitPrice) === null || _a === void 0 ? void 0 : _a.amount);
|
|
31
|
+
const quantityRefundValue = Number(quantityRefund || 0);
|
|
32
|
+
const quantityCancelValue = Number(quantityCancel || 0);
|
|
33
|
+
const discountTotalRefundAmount = Number(unitOrderDiscountAmount * (quantityRefundValue + quantityCancelValue));
|
|
34
|
+
const subtotalRefundWithoutDiscount = Number((lineItemPriceAmount - unitOrderDiscountAmount) * quantityRefundValue);
|
|
35
|
+
const subtotalCanceledWithoutDiscount = Number((lineItemPriceAmount - unitOrderDiscountAmount) * quantityCancelValue);
|
|
36
|
+
return {
|
|
37
|
+
lineItem,
|
|
38
|
+
quantityRefund: quantityRefundValue,
|
|
39
|
+
quantityCancel: quantityCancelValue,
|
|
40
|
+
discountRefund: Object.assign(Object.assign({}, lineItem.originalUnitPrice), { amount: discountTotalRefundAmount }),
|
|
41
|
+
subtotalRefund: Object.assign(Object.assign({}, lineItem.originalUnitPrice), { amount: subtotalRefundWithoutDiscount }),
|
|
42
|
+
subtotalCanceled: Object.assign(Object.assign({}, lineItem.originalUnitPrice), { amount: subtotalCanceledWithoutDiscount }),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
28
45
|
refundLineItemChangeHandler(val) {
|
|
29
|
-
var _a, _b;
|
|
30
46
|
const currentLineItems = this.fields.refundLineItems.selectedValues;
|
|
31
47
|
const unitOrderDiscountAmount = val.unitOrderDiscount || 0;
|
|
32
48
|
// Add new product to line items
|
|
33
49
|
if (val.lineItemLike.productId) {
|
|
34
50
|
const lineItem = val.lineItemLike;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const subtotalLineItem = Number(Number((_a = lineItem.originalUnitPrice) === null || _a === void 0 ? void 0 : _a.amount) * quantity);
|
|
38
|
-
const lineItemToUpdate = {
|
|
39
|
-
lineItem,
|
|
40
|
-
quantityRefund: quantity,
|
|
41
|
-
discountRefund: Object.assign(Object.assign({}, lineItem.originalUnitPrice), { amount: discountRefundAmount }),
|
|
42
|
-
subtotalRefund: Object.assign(Object.assign({}, lineItem.originalUnitPrice), { amount: subtotalLineItem - discountRefundAmount }),
|
|
43
|
-
};
|
|
44
|
-
this.fields.refundLineItems.selectedValues = [...currentLineItems, lineItemToUpdate];
|
|
51
|
+
const newRefundLineItem = this.getUpdatedRefundLineItem(lineItem, val.quantityRefund, val.quantityCancel, unitOrderDiscountAmount);
|
|
52
|
+
this.fields.refundLineItems.selectedValues = [...currentLineItems, newRefundLineItem];
|
|
45
53
|
}
|
|
46
54
|
// Update quantity of a line item
|
|
47
|
-
if (val.
|
|
55
|
+
if ((val.quantityRefund || val.quantityCancel) && val.lineItemLike.lineItem) {
|
|
48
56
|
const refundLineItem = val.lineItemLike;
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const subtotalLineItem = Number(Number((_b = refundLineItem.lineItem.originalUnitPrice) === null || _b === void 0 ? void 0 : _b.amount) * quantity);
|
|
52
|
-
const updatedLineItem = {
|
|
53
|
-
lineItem: refundLineItem.lineItem,
|
|
54
|
-
quantityRefund: quantity,
|
|
55
|
-
discountRefund: Object.assign(Object.assign({}, refundLineItem.lineItem.originalTotalPrice), { amount: discountRefundAmount }),
|
|
56
|
-
subtotalRefund: Object.assign(Object.assign({}, refundLineItem.lineItem.originalTotalPrice), { amount: subtotalLineItem }),
|
|
57
|
-
};
|
|
57
|
+
const { lineItem, quantityRefund: prevQuantityRefund, quantityCancel: prevQuantityCancel } = refundLineItem;
|
|
58
|
+
const updatedRefundLineItem = this.getUpdatedRefundLineItem(lineItem, val.quantityRefund || prevQuantityRefund, val.quantityCancel || prevQuantityCancel, unitOrderDiscountAmount);
|
|
58
59
|
const lineItemToUpdateIndex = currentLineItems.findIndex((li) => li.lineItem.productId === refundLineItem.lineItem.productId);
|
|
59
60
|
const lineItemsClone = [...currentLineItems];
|
|
60
|
-
lineItemsClone.splice(lineItemToUpdateIndex, 1,
|
|
61
|
+
lineItemsClone.splice(lineItemToUpdateIndex, 1, updatedRefundLineItem);
|
|
61
62
|
this.fields.refundLineItems.selectedValues = lineItemsClone;
|
|
62
63
|
}
|
|
63
|
-
// Remove a line item
|
|
64
|
-
if (val.lineItemLike.quantityRefund && !val.quantity) {
|
|
65
|
-
const refundLineItem = val.lineItemLike;
|
|
66
|
-
const newLineItems = currentLineItems.filter((li) => li.lineItem.productId !== refundLineItem.lineItem.productId);
|
|
67
|
-
this.fields.refundLineItems.selectedValues = newLineItems;
|
|
68
|
-
}
|
|
69
64
|
// Update discount price
|
|
70
65
|
this.fields.refundDiscount.inputValue = this.fields.refundLineItems.selectedValues
|
|
71
66
|
.map((item) => { var _a; return Number((_a = item.discountRefund) === null || _a === void 0 ? void 0 : _a.amount); })
|
|
72
67
|
.reduce((a, b) => a + b, 0);
|
|
73
68
|
// Update subtotal price
|
|
74
69
|
this.fields.subtotalRefunded.inputValue = this.fields.refundLineItems.selectedValues
|
|
75
|
-
.map((item) => { var _a; return Number((_a = item.
|
|
70
|
+
.map((item) => { var _a; return Number(Number((_a = item.lineItem.originalUnitPrice) === null || _a === void 0 ? void 0 : _a.amount) * (item.quantityRefund + item.quantityCancel)); })
|
|
76
71
|
.reduce((a, b) => a + b, 0);
|
|
77
72
|
// Update total price
|
|
78
73
|
this.updateTotalRefunded();
|
|
@@ -68,6 +68,9 @@ class ProductFormState extends FormState_1.default {
|
|
|
68
68
|
this.fields.editorAuthorizations = this.fieldFactory('singleSelect', 'editorAuthorizations', Object.keys(new Product_1.default().toObj()).map((v) => ({ label: this.utilities.startCase(v), value: v })));
|
|
69
69
|
this.fields.vendorId = this.fieldFactory('singleSelect', 'vendorId');
|
|
70
70
|
this.fields.vendorName = this.fieldFactory('singleSelect', 'vendorName');
|
|
71
|
+
this.fields.rfidTag = this.fieldFactory('textInput', 'rfidTag');
|
|
72
|
+
this.fields.locationIds = this.fieldFactory('multiSelect', 'locationIds');
|
|
73
|
+
this.fields.featuredCollections = this.fieldFactory('multiSelect', 'featuredCollections');
|
|
71
74
|
}
|
|
72
75
|
autoCreateTitle() {
|
|
73
76
|
return this.createProduct().autoCreateTitle();
|
|
@@ -604,7 +607,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
604
607
|
onChangeHandler = (val) => this.priceInputChangeHandler(val);
|
|
605
608
|
}
|
|
606
609
|
if (fieldKey === 'reRobeCommission') {
|
|
607
|
-
inputValue = this.props[fieldKey] || '0.
|
|
610
|
+
inputValue = this.props[fieldKey] || '0.5';
|
|
608
611
|
valid = true;
|
|
609
612
|
}
|
|
610
613
|
if (fieldKey === 'discountValue') {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import FormState from '../FormState';
|
|
2
|
+
import ProductCollection from '../../models/ProductCollection';
|
|
3
|
+
export default class ProductCollectionFormState extends FormState {
|
|
4
|
+
fields: ProductCollectionFormFields;
|
|
5
|
+
props: CompleteProductCollection;
|
|
6
|
+
opts: {
|
|
7
|
+
productAttrOptions: ProductAttrRefinementsOptions[];
|
|
8
|
+
productAttrValuesOptions: string[];
|
|
9
|
+
};
|
|
10
|
+
constructor(props?: any, opts?: any);
|
|
11
|
+
createProductCollection(): ProductCollection;
|
|
12
|
+
private fieldFactory;
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const FormState_1 = require("../FormState");
|
|
4
|
+
const ProductCollection_1 = require("../../models/ProductCollection");
|
|
5
|
+
const ProductCollectionFromFormState_1 = require("../../factories/ProductCollection/ProductCollectionFromFormState");
|
|
6
|
+
class ProductCollectionFormState extends FormState_1.default {
|
|
7
|
+
constructor(props, opts) {
|
|
8
|
+
super();
|
|
9
|
+
this.props = new ProductCollection_1.default(props).toObj();
|
|
10
|
+
this.opts = opts;
|
|
11
|
+
this.fields.preTitle = this.fieldFactory('textInput', 'preTitle');
|
|
12
|
+
this.fields.title = this.fieldFactory('textInput', 'title');
|
|
13
|
+
this.fields.subTitle = this.fieldFactory('textInput', 'subTitle');
|
|
14
|
+
this.fields.description = this.fieldFactory('textInput', 'description');
|
|
15
|
+
this.fields.type = this.fieldFactory('singleSelect', 'type');
|
|
16
|
+
this.fields.imgUrl = this.fieldFactory('textInput', 'imgUrl');
|
|
17
|
+
this.fields.refinements = this.fieldFactory('singleSelect', 'refinements');
|
|
18
|
+
}
|
|
19
|
+
createProductCollection() {
|
|
20
|
+
const productCollectionFactory = new ProductCollectionFromFormState_1.default();
|
|
21
|
+
return productCollectionFactory.createProductCollection(this);
|
|
22
|
+
}
|
|
23
|
+
fieldFactory(fieldType, fieldKey, fieldOptions) {
|
|
24
|
+
if (fieldType === 'singleSelect') {
|
|
25
|
+
const options = fieldOptions || [];
|
|
26
|
+
const selectedValue = this.props[fieldKey] || '';
|
|
27
|
+
const valid = !!this.props[fieldKey];
|
|
28
|
+
const onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, String(val));
|
|
29
|
+
return {
|
|
30
|
+
options,
|
|
31
|
+
selectedValue,
|
|
32
|
+
valid,
|
|
33
|
+
onChangeHandler,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (fieldType === 'textInput') {
|
|
37
|
+
const inputValue = this.props[fieldKey] || '';
|
|
38
|
+
const valid = !!this.props[fieldKey];
|
|
39
|
+
const onChangeHandler = (val) => this.textInputChangeHandler(fieldKey, String(val));
|
|
40
|
+
return {
|
|
41
|
+
inputValue,
|
|
42
|
+
valid,
|
|
43
|
+
onChangeHandler,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
valid: false,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = ProductCollectionFormState;
|
|
@@ -4,7 +4,9 @@ export default class OrderHelpers {
|
|
|
4
4
|
getPaymentTypeUsingTags(tags: string | null | undefined): string | null;
|
|
5
5
|
getSalesChannelUsingTags(tags: string | null | undefined): string | null;
|
|
6
6
|
buildLineItemFromProduct(product: CompleteProduct, currencyCode: string, quantity?: number): ReRobeOrderLineItem;
|
|
7
|
-
|
|
7
|
+
toFixedPointPrice(price: number | string): string;
|
|
8
8
|
getAmountSumByField(array: OrderRefund[], fieldKey: string): number;
|
|
9
|
-
|
|
9
|
+
getOrderInfoWithRefundsAndFulfillments(order: CompleteOrder): OrderWithRefundsAndFulfillmentsInfoObj;
|
|
10
|
+
getUpdatedOrderObjWithRefunds(orderObj: CompleteOrder, refundObj: OrderRefund): CompleteOrder;
|
|
11
|
+
getUpdatedOrderObjWithFulfillment(orderObj: CompleteOrder, fulfillmentObj: FulfillmentAdmin, totalUnfulfilledItems: number): CompleteOrder;
|
|
10
12
|
}
|
|
@@ -77,17 +77,19 @@ class OrderHelpers {
|
|
|
77
77
|
productId: product.documentId,
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
toFixedPointPrice(price) {
|
|
81
81
|
return Number(price).toFixed(2);
|
|
82
82
|
}
|
|
83
83
|
getAmountSumByField(array, fieldKey) {
|
|
84
84
|
return array.map((item) => Number(item[fieldKey].amount)).reduce((a, b) => a + b, 0);
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
getOrderInfoWithRefundsAndFulfillments(order) {
|
|
87
87
|
var _a;
|
|
88
|
-
const orderRefunds = order.refunds
|
|
88
|
+
const orderRefunds = order.refunds ? [...order.refunds] : [];
|
|
89
|
+
const orderFulfillment = order.fulfillments ? [...order.fulfillments] : [];
|
|
89
90
|
const preparedOrder = {
|
|
90
91
|
documentId: order.documentId || '',
|
|
92
|
+
name: order.name || '',
|
|
91
93
|
currencyCode: order.currencyCode,
|
|
92
94
|
fulfillmentStatus: order.fulfillmentStatus || '',
|
|
93
95
|
totalDiscount: order.totalDiscount ? Object.assign({}, order.totalDiscount) : { amount: 0 },
|
|
@@ -96,12 +98,37 @@ class OrderHelpers {
|
|
|
96
98
|
totalRefunded: order.totalRefunded ? Object.assign({}, order.totalRefunded) : { amount: 0 },
|
|
97
99
|
totalShippingPrice: order.totalShippingPrice ? Object.assign({}, order.totalShippingPrice) : { amount: 0 },
|
|
98
100
|
totalPrice: order.totalPrice ? Object.assign({}, order.totalPrice) : { amount: 0 },
|
|
99
|
-
|
|
101
|
+
activeLineItems: !order.lineItems || !order.lineItems.length
|
|
102
|
+
? []
|
|
103
|
+
: order.lineItems.map((item) => (Object.assign(Object.assign({}, item), { unfulfilledQuantity: Number(item.quantity), fulfilledQuantity: 0, refundedQuantity: 0, canceledQuantity: 0 }))),
|
|
100
104
|
discountType: 'Custom discount',
|
|
101
105
|
shippingRate: 'Custom shipping rate',
|
|
106
|
+
unfulfilledItems: [],
|
|
107
|
+
fulfilledItems: [],
|
|
102
108
|
refundedItems: [],
|
|
103
|
-
|
|
109
|
+
canceledItems: [],
|
|
110
|
+
refunds: orderRefunds,
|
|
104
111
|
};
|
|
112
|
+
if (!preparedOrder.activeLineItems.length) {
|
|
113
|
+
return preparedOrder;
|
|
114
|
+
}
|
|
115
|
+
if (orderFulfillment.length) {
|
|
116
|
+
preparedOrder.activeLineItems = preparedOrder.activeLineItems.map((item) => {
|
|
117
|
+
const currentItem = item.productId;
|
|
118
|
+
const fulfilledWithRefundedQuantity = orderFulfillment.reduce((result, { fulfillmentLineItems }) => {
|
|
119
|
+
if (fulfillmentLineItems.length) {
|
|
120
|
+
const fulfillmentProdItem = fulfillmentLineItems.find((fli) => fli.lineItem.productId === currentItem);
|
|
121
|
+
if (fulfillmentProdItem) {
|
|
122
|
+
result = result + Number(fulfillmentProdItem.quantity);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}, 0);
|
|
127
|
+
return Object.assign(Object.assign({}, item), { unfulfilledQuantity: item.unfulfilledQuantity - fulfilledWithRefundedQuantity, fulfilledQuantity: fulfilledWithRefundedQuantity });
|
|
128
|
+
});
|
|
129
|
+
preparedOrder.fulfilledItems = preparedOrder.activeLineItems.filter(({ fulfilledQuantity }) => fulfilledQuantity > 0);
|
|
130
|
+
}
|
|
131
|
+
preparedOrder.unfulfilledItems = preparedOrder.activeLineItems.filter(({ unfulfilledQuantity }) => unfulfilledQuantity > 0);
|
|
105
132
|
if (!orderRefunds.length) {
|
|
106
133
|
return preparedOrder;
|
|
107
134
|
}
|
|
@@ -113,22 +140,49 @@ class OrderHelpers {
|
|
|
113
140
|
Number(((_a = order.totalShippingPrice) === null || _a === void 0 ? void 0 : _a.amount) || 0) - this.getAmountSumByField(orderRefunds, 'refundShipping');
|
|
114
141
|
preparedOrder.totalPrice.amount =
|
|
115
142
|
Number(order.totalPrice.amount) - this.getAmountSumByField(orderRefunds, 'totalRefunded');
|
|
116
|
-
const
|
|
143
|
+
const lineItemsWithQuantityInfo = preparedOrder.activeLineItems.map((item) => {
|
|
117
144
|
const currentItem = item.productId;
|
|
118
|
-
const
|
|
145
|
+
const refundedAndCanceledQuantity = orderRefunds.reduce((result, { refundLineItems }) => {
|
|
119
146
|
if (refundLineItems.length) {
|
|
120
147
|
const refundProdItem = refundLineItems.find(({ lineItem }) => lineItem.productId === currentItem);
|
|
121
148
|
if (refundProdItem) {
|
|
122
|
-
result = result + Number(refundProdItem.quantityRefund);
|
|
149
|
+
result.refundedQuantity = result.refundedQuantity + Number(refundProdItem.quantityRefund);
|
|
150
|
+
result.canceledQuantity = result.canceledQuantity + Number(refundProdItem.quantityCancel);
|
|
123
151
|
}
|
|
124
152
|
}
|
|
125
153
|
return result;
|
|
126
|
-
}, 0);
|
|
127
|
-
|
|
154
|
+
}, { refundedQuantity: 0, canceledQuantity: 0 });
|
|
155
|
+
// 3. fulfilledQuantity = (sum of order.fulfillment) - refundedQuantity
|
|
156
|
+
// 4. quantity = unfulfilled quantity (prev quantity - sum of order.fulfillment) - cancelled
|
|
157
|
+
return Object.assign(Object.assign(Object.assign({}, item), { fulfilledQuantity: Number(item.fulfilledQuantity) - refundedAndCanceledQuantity.refundedQuantity, unfulfilledQuantity: Number(item.unfulfilledQuantity) - refundedAndCanceledQuantity.canceledQuantity }), refundedAndCanceledQuantity);
|
|
128
158
|
});
|
|
129
|
-
preparedOrder.
|
|
130
|
-
preparedOrder.
|
|
159
|
+
preparedOrder.activeLineItems = lineItemsWithQuantityInfo.filter(({ unfulfilledQuantity, fulfilledQuantity }) => unfulfilledQuantity + fulfilledQuantity > 0);
|
|
160
|
+
preparedOrder.unfulfilledItems = lineItemsWithQuantityInfo.filter(({ unfulfilledQuantity }) => unfulfilledQuantity > 0);
|
|
161
|
+
preparedOrder.fulfilledItems = lineItemsWithQuantityInfo.filter(({ fulfilledQuantity }) => fulfilledQuantity > 0);
|
|
162
|
+
preparedOrder.refundedItems = lineItemsWithQuantityInfo.filter(({ refundedQuantity }) => refundedQuantity > 0);
|
|
163
|
+
preparedOrder.canceledItems = lineItemsWithQuantityInfo.filter(({ canceledQuantity }) => canceledQuantity > 0);
|
|
131
164
|
return preparedOrder;
|
|
132
165
|
}
|
|
166
|
+
getUpdatedOrderObjWithRefunds(orderObj, refundObj) {
|
|
167
|
+
const updatedOrder = Object.assign(Object.assign({}, orderObj), { refunds: orderObj.refunds ? [...orderObj.refunds] : [], totalRefunded: orderObj.totalRefunded ? Object.assign({}, orderObj.totalRefunded) : { amount: 0 } });
|
|
168
|
+
const totalRefundedAmount = Number(updatedOrder.totalRefunded.amount) + Number(refundObj.totalRefunded.amount);
|
|
169
|
+
updatedOrder.refunds = [...updatedOrder.refunds, Object.assign({}, refundObj)];
|
|
170
|
+
updatedOrder.totalRefunded.amount = Number(totalRefundedAmount).toFixed(2);
|
|
171
|
+
updatedOrder.financialStatus =
|
|
172
|
+
Number(orderObj.totalPrice.amount) - totalRefundedAmount > 0 ? 'PARTIALLY_REFUNDED' : 'REFUNDED';
|
|
173
|
+
return updatedOrder;
|
|
174
|
+
}
|
|
175
|
+
getUpdatedOrderObjWithFulfillment(orderObj, fulfillmentObj, totalUnfulfilledItems) {
|
|
176
|
+
const updatedOrder = Object.assign(Object.assign({}, orderObj), { fulfillments: orderObj.fulfillments ? [...orderObj.fulfillments] : [] });
|
|
177
|
+
const fulfilledItemsQuantity = !fulfillmentObj.fulfillmentLineItems.length
|
|
178
|
+
? 0
|
|
179
|
+
: fulfillmentObj.fulfillmentLineItems
|
|
180
|
+
.map(({ quantity }) => Number(quantity))
|
|
181
|
+
.reduce((a, b) => a + b, 0);
|
|
182
|
+
updatedOrder.fulfillments = [...updatedOrder.fulfillments, fulfillmentObj];
|
|
183
|
+
updatedOrder.fulfillmentStatus =
|
|
184
|
+
totalUnfulfilledItems - fulfilledItemsQuantity > 0 ? 'PARTIALLY_FULFILLED' : 'FULFILLED';
|
|
185
|
+
return updatedOrder;
|
|
186
|
+
}
|
|
133
187
|
}
|
|
134
188
|
exports.default = OrderHelpers;
|
|
@@ -23,7 +23,7 @@ class ReRobeProductHelpers {
|
|
|
23
23
|
static buildReRobeEarnings(arrayLike) {
|
|
24
24
|
const products = Array.isArray(arrayLike) ? arrayLike : [arrayLike];
|
|
25
25
|
return products.reduce((acc, cur) => {
|
|
26
|
-
const commission = cur.reRobeCommission ? Number(cur.reRobeCommission) : 0.
|
|
26
|
+
const commission = cur.reRobeCommission ? Number(cur.reRobeCommission) : 0.5;
|
|
27
27
|
const priceToUse = cur.isOnSale === 'yes' && cur.salePrice ? cur.salePrice : cur.price;
|
|
28
28
|
const listingPrice = Number(Number(priceToUse) <= 1 ? cur.suggestedResalePrice : priceToUse);
|
|
29
29
|
const inventoryValue = acc[0] + listingPrice;
|
|
@@ -172,6 +172,7 @@ class ReRobeProductHelpers {
|
|
|
172
172
|
<br>
|
|
173
173
|
Vi har 14 dagars öppet köp från då din order har packats och levererats till dig. Returer är endast giltiga om prislappen sitter kvar, samt att varan är i samma skick som när du köpte den. Om du vill returnera något till oss, se till att kontakta vårt kundtjänst team på help@rerobe.se för att begära en förbetald, spårbar fraktetikett. Observera att vi inte accepterar returer som skickas utan vår fraktsedel.
|
|
174
174
|
<br>
|
|
175
|
+
<br>
|
|
175
176
|
Returavgiften är 63 SEK. Detta kommer att dras från ditt ursprungliga köp när vi har tagit emot den returnerade varan.
|
|
176
177
|
</p>
|
|
177
178
|
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import ProductFromShopifyJSClientJSONDoc from './factories/Product/ProductFromSh
|
|
|
2
2
|
import ProductFromAlgoliaJSONDoc from './factories/Product/ProductFromAlgoliaJSONDoc';
|
|
3
3
|
import ProductFromShopifyWebhookJSONDoc from './factories/Product/ProductFromShopifyWebhookJSONDoc';
|
|
4
4
|
import ProductFormStateFactory from './factories/FormState/Product/ProductFormStateFactory';
|
|
5
|
+
import ProductCollectionFormState from './form-states/ProductCollection/ProductCollectionFormState';
|
|
5
6
|
import SellRequestFormStateFactory from './factories/FormState/SellRequest/SellRequestFormStateFactory';
|
|
6
7
|
import PickUpFormStateFactory from './factories/FormState/PickUp/PickUpFormStateFactory';
|
|
7
8
|
import UserFormStateFactory from './factories/FormState/User/UserFormStateFactory';
|
|
@@ -31,4 +32,4 @@ import WebhookFormState from './form-states/Merchant/WebhookFormState';
|
|
|
31
32
|
import ReRobeProductHelpers from './helpers/ReRobeProductHelpers';
|
|
32
33
|
import AnalyticsHelpers from './helpers/AnalyticsHelpers';
|
|
33
34
|
import OrderHelpers from './helpers/OrderHelpers';
|
|
34
|
-
export { ProductFromAlgoliaJSONDoc, ProductFromShopifyWebhookJSONDoc, ProductFromShopifyJSClientJSONDoc, ProductFormStateFactory, SellRequestFormStateFactory, PickUpFormStateFactory, AddressFormStateFactory, UserFormStateFactory, UserFromShopifyWebhookJSONDoc, UserFromAuthTemplateMethod, DraftOrderFromMirakl, DraftOrderFromApp, ChatRoomFromNewUserSignUp, KlarnaSessionFactory, Product, ProductStateManager, Order, OrderFromShopifyWebhook, OrderFromShopifyAdminApi, OrderFromShopifyStorefrontApi, OrderFromApp, OrderFormStateFactory, RefundFormStateFactory, PayoutAccount, PayoutAccountFormState, Merchant, MerchantFormState, MerchantFormStateFactory, ReRobeProductHelpers, User, AnalyticsHelpers, OrderHelpers, WebhookFormState, };
|
|
35
|
+
export { ProductFromAlgoliaJSONDoc, ProductFromShopifyWebhookJSONDoc, ProductFromShopifyJSClientJSONDoc, ProductFormStateFactory, ProductCollectionFormState, SellRequestFormStateFactory, PickUpFormStateFactory, AddressFormStateFactory, UserFormStateFactory, UserFromShopifyWebhookJSONDoc, UserFromAuthTemplateMethod, DraftOrderFromMirakl, DraftOrderFromApp, ChatRoomFromNewUserSignUp, KlarnaSessionFactory, Product, ProductStateManager, Order, OrderFromShopifyWebhook, OrderFromShopifyAdminApi, OrderFromShopifyStorefrontApi, OrderFromApp, OrderFormStateFactory, RefundFormStateFactory, PayoutAccount, PayoutAccountFormState, Merchant, MerchantFormState, MerchantFormStateFactory, ReRobeProductHelpers, User, AnalyticsHelpers, OrderHelpers, WebhookFormState, };
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebhookFormState = exports.OrderHelpers = exports.AnalyticsHelpers = exports.User = exports.ReRobeProductHelpers = exports.MerchantFormStateFactory = exports.MerchantFormState = exports.Merchant = exports.PayoutAccountFormState = exports.PayoutAccount = exports.RefundFormStateFactory = exports.OrderFormStateFactory = exports.OrderFromApp = exports.OrderFromShopifyStorefrontApi = exports.OrderFromShopifyAdminApi = exports.OrderFromShopifyWebhook = exports.Order = exports.ProductStateManager = exports.Product = exports.KlarnaSessionFactory = exports.ChatRoomFromNewUserSignUp = exports.DraftOrderFromApp = exports.DraftOrderFromMirakl = exports.UserFromAuthTemplateMethod = exports.UserFromShopifyWebhookJSONDoc = exports.UserFormStateFactory = exports.AddressFormStateFactory = exports.PickUpFormStateFactory = exports.SellRequestFormStateFactory = exports.ProductFormStateFactory = exports.ProductFromShopifyJSClientJSONDoc = exports.ProductFromShopifyWebhookJSONDoc = exports.ProductFromAlgoliaJSONDoc = void 0;
|
|
3
|
+
exports.WebhookFormState = exports.OrderHelpers = exports.AnalyticsHelpers = exports.User = exports.ReRobeProductHelpers = exports.MerchantFormStateFactory = exports.MerchantFormState = exports.Merchant = exports.PayoutAccountFormState = exports.PayoutAccount = exports.RefundFormStateFactory = exports.OrderFormStateFactory = exports.OrderFromApp = exports.OrderFromShopifyStorefrontApi = exports.OrderFromShopifyAdminApi = exports.OrderFromShopifyWebhook = exports.Order = exports.ProductStateManager = exports.Product = exports.KlarnaSessionFactory = exports.ChatRoomFromNewUserSignUp = exports.DraftOrderFromApp = exports.DraftOrderFromMirakl = exports.UserFromAuthTemplateMethod = exports.UserFromShopifyWebhookJSONDoc = exports.UserFormStateFactory = exports.AddressFormStateFactory = exports.PickUpFormStateFactory = exports.SellRequestFormStateFactory = exports.ProductCollectionFormState = exports.ProductFormStateFactory = exports.ProductFromShopifyJSClientJSONDoc = exports.ProductFromShopifyWebhookJSONDoc = exports.ProductFromAlgoliaJSONDoc = void 0;
|
|
4
4
|
const ProductFromShopifyJSClientJSONDoc_1 = require("./factories/Product/ProductFromShopifyJSClientJSONDoc");
|
|
5
5
|
exports.ProductFromShopifyJSClientJSONDoc = ProductFromShopifyJSClientJSONDoc_1.default;
|
|
6
6
|
const ProductFromAlgoliaJSONDoc_1 = require("./factories/Product/ProductFromAlgoliaJSONDoc");
|
|
@@ -9,6 +9,8 @@ const ProductFromShopifyWebhookJSONDoc_1 = require("./factories/Product/ProductF
|
|
|
9
9
|
exports.ProductFromShopifyWebhookJSONDoc = ProductFromShopifyWebhookJSONDoc_1.default;
|
|
10
10
|
const ProductFormStateFactory_1 = require("./factories/FormState/Product/ProductFormStateFactory");
|
|
11
11
|
exports.ProductFormStateFactory = ProductFormStateFactory_1.default;
|
|
12
|
+
const ProductCollectionFormState_1 = require("./form-states/ProductCollection/ProductCollectionFormState");
|
|
13
|
+
exports.ProductCollectionFormState = ProductCollectionFormState_1.default;
|
|
12
14
|
const SellRequestFormStateFactory_1 = require("./factories/FormState/SellRequest/SellRequestFormStateFactory");
|
|
13
15
|
exports.SellRequestFormStateFactory = SellRequestFormStateFactory_1.default;
|
|
14
16
|
const PickUpFormStateFactory_1 = require("./factories/FormState/PickUp/PickUpFormStateFactory");
|
package/lib/models/Order.d.ts
CHANGED
package/lib/models/Order.js
CHANGED
package/lib/models/Product.js
CHANGED
|
@@ -49,6 +49,7 @@ class Product extends Base_1.default {
|
|
|
49
49
|
priceRange: (props === null || props === void 0 ? void 0 : props.priceRange) || '',
|
|
50
50
|
condition: (props === null || props === void 0 ? void 0 : props.condition) || '',
|
|
51
51
|
measurements: (props === null || props === void 0 ? void 0 : props.measurements) || {},
|
|
52
|
+
featuredCollections: (props === null || props === void 0 ? void 0 : props.featuredCollections) || [],
|
|
52
53
|
};
|
|
53
54
|
this.consignmentAttributes = {
|
|
54
55
|
sellRequestImageUrls: (props === null || props === void 0 ? void 0 : props.sellRequestImageUrls) || [],
|
|
@@ -77,6 +78,7 @@ class Product extends Base_1.default {
|
|
|
77
78
|
discountType: (props === null || props === void 0 ? void 0 : props.discountType) || '',
|
|
78
79
|
discountValue: (props === null || props === void 0 ? void 0 : props.discountValue) || '',
|
|
79
80
|
selectedForClearance: (props === null || props === void 0 ? void 0 : props.selectedForClearance) || '',
|
|
81
|
+
locationIds: (props === null || props === void 0 ? void 0 : props.locationIds) || [],
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
toPartialObj() {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Base from '../Base';
|
|
2
|
+
export default class ProductCollection extends Base {
|
|
3
|
+
documentId: string;
|
|
4
|
+
preTitle: string;
|
|
5
|
+
title: string;
|
|
6
|
+
subTitle: string;
|
|
7
|
+
description: string;
|
|
8
|
+
type: CollectionType;
|
|
9
|
+
imgUrl: string;
|
|
10
|
+
refinements: ProductRefinements;
|
|
11
|
+
constructor(props?: any);
|
|
12
|
+
toObj(): ProductCollectionType;
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Base_1 = require("../Base");
|
|
4
|
+
class ProductCollection extends Base_1.default {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super();
|
|
7
|
+
this.documentId = (props === null || props === void 0 ? void 0 : props.documentId) || '';
|
|
8
|
+
this.preTitle = (props === null || props === void 0 ? void 0 : props.preTitle) || '';
|
|
9
|
+
this.title = (props === null || props === void 0 ? void 0 : props.title) || '';
|
|
10
|
+
this.subTitle = (props === null || props === void 0 ? void 0 : props.subTitle) || '';
|
|
11
|
+
this.description = (props === null || props === void 0 ? void 0 : props.description) || '';
|
|
12
|
+
this.type = (props === null || props === void 0 ? void 0 : props.type) || 'AUTOMATED';
|
|
13
|
+
this.imgUrl = (props === null || props === void 0 ? void 0 : props.imgUrl) || '';
|
|
14
|
+
this.refinements = (props === null || props === void 0 ? void 0 : props.refinements) || {};
|
|
15
|
+
}
|
|
16
|
+
toObj() {
|
|
17
|
+
const productCollectionObj = {
|
|
18
|
+
documentId: this.documentId,
|
|
19
|
+
preTitle: this.preTitle,
|
|
20
|
+
title: this.title,
|
|
21
|
+
subTitle: this.subTitle,
|
|
22
|
+
description: this.description,
|
|
23
|
+
type: this.type,
|
|
24
|
+
imgUrl: this.imgUrl,
|
|
25
|
+
refinements: this.refinements,
|
|
26
|
+
};
|
|
27
|
+
return productCollectionObj;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.default = ProductCollection;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare type ProductAttrRefinementsOptions = 'brand' | 'clothingSize' | 'color' | 'condition' | 'gender' | 'jeanSize' | 'materialComposition' | 'priceRange' | 'productCategory' | 'productType' | 'productStyle' | 'shoeSize';
|
|
2
|
+
interface Refinements {
|
|
3
|
+
featuredCollections?: string;
|
|
4
|
+
}
|
|
5
|
+
interface ProductRefinements extends Refinements {
|
|
6
|
+
brandRefinement?: string[];
|
|
7
|
+
clothingSizeRefinement?: string[];
|
|
8
|
+
colorRefinement?: string[];
|
|
9
|
+
conditionRefinement?: string[];
|
|
10
|
+
genderRefinement?: string[];
|
|
11
|
+
jeanSizeRefinement?: string[];
|
|
12
|
+
materialCompositionRefinement?: string[];
|
|
13
|
+
priceRangeRefinement?: string[];
|
|
14
|
+
productCategoryRefinement?: string[];
|
|
15
|
+
productTypeRefinement?: string[];
|
|
16
|
+
productStyleRefinement?: string[];
|
|
17
|
+
shoeSizeRefinement?: string[];
|
|
18
|
+
}
|
|
19
|
+
declare type CollectionType = 'AUTOMATED' | 'MANUAL';
|
|
20
|
+
declare type ProductCollectionType = {
|
|
21
|
+
createdAt?: string;
|
|
22
|
+
updatedAt?: string;
|
|
23
|
+
documentId?: string;
|
|
24
|
+
preTitle: string;
|
|
25
|
+
title: string;
|
|
26
|
+
subTitle: string;
|
|
27
|
+
description: string;
|
|
28
|
+
type: CollectionType;
|
|
29
|
+
imgUrl: string;
|
|
30
|
+
refinements: ProductRefinements;
|
|
31
|
+
};
|
|
32
|
+
declare type CompleteProductCollection = ProductCollectionType & {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
declare type ProductCollectionFormFields = {
|
|
36
|
+
preTitle: TextInputFormField<string>;
|
|
37
|
+
title: TextInputFormField<string>;
|
|
38
|
+
subTitle: TextInputFormField<string>;
|
|
39
|
+
description: TextInputFormField<string>;
|
|
40
|
+
type: SingleSelectFormField<CollectionType>;
|
|
41
|
+
imgUrl: TextInputFormField<string>;
|
|
42
|
+
refinements: SingleSelectFormField<ProductRefinements>;
|
|
43
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// //from shopify product collection
|
|
3
|
+
// type ComparisonOptions =
|
|
4
|
+
// | 'IS_EQUAL_TO'
|
|
5
|
+
// | 'IS_NOT_EQUAL_TO'
|
|
6
|
+
// | 'IS_GREATER_THAN'
|
|
7
|
+
// | 'IS_LESS_THAN'
|
|
8
|
+
// | 'STARTS_WITH'
|
|
9
|
+
// | 'ENDS_WITH'
|
|
10
|
+
// | 'CONTAINS'
|
|
11
|
+
// | 'DOES_NOT_CONTAINS'
|
|
12
|
+
// | 'IS_EMPTY'
|
|
13
|
+
// | 'IS_NOT_EMPTY';
|
|
@@ -62,8 +62,9 @@ declare type ReRobeOrderObj = {
|
|
|
62
62
|
createdAt?: string;
|
|
63
63
|
updatedAt?: string;
|
|
64
64
|
};
|
|
65
|
-
declare type
|
|
65
|
+
declare type OrderWithRefundsAndFulfillmentsInfoObj = {
|
|
66
66
|
documentId?: string;
|
|
67
|
+
name?: string;
|
|
67
68
|
currencyCode: string;
|
|
68
69
|
fulfillmentStatus?: FulfillmentStatusTypes | string;
|
|
69
70
|
totalDiscount: Money;
|
|
@@ -72,11 +73,14 @@ declare type OrderWithRefundsInfoObj = {
|
|
|
72
73
|
totalShippingPrice?: Money;
|
|
73
74
|
totalTax?: Money;
|
|
74
75
|
subtotalPrice: Money;
|
|
75
|
-
lineItems: ReRobeOrderLineItem[];
|
|
76
76
|
discountType: string;
|
|
77
77
|
shippingRate: string;
|
|
78
|
-
|
|
78
|
+
refunds: OrderRefund[];
|
|
79
|
+
activeLineItems: ReRobeOrderLineItem[];
|
|
80
|
+
unfulfilledItems: ReRobeOrderLineItem[];
|
|
81
|
+
fulfilledItems: ReRobeOrderLineItem[];
|
|
79
82
|
refundedItems: ReRobeOrderLineItem[];
|
|
83
|
+
canceledItems: ReRobeOrderLineItem[];
|
|
80
84
|
};
|
|
81
85
|
declare type OrderInput = {
|
|
82
86
|
id?: string | null;
|
|
@@ -201,7 +205,10 @@ interface ReRobeOrderLineItem extends OrderLineItem {
|
|
|
201
205
|
brand?: string | null;
|
|
202
206
|
productId?: string | null;
|
|
203
207
|
shopifyProductId?: string | number | null;
|
|
204
|
-
refundedQuantity?: number;
|
|
208
|
+
refundedQuantity?: number | string;
|
|
209
|
+
canceledQuantity?: number | string;
|
|
210
|
+
fulfilledQuantity?: number | string;
|
|
211
|
+
unfulfilledQuantity?: number | string;
|
|
205
212
|
}
|
|
206
213
|
declare type OrderLineItemConnection = {
|
|
207
214
|
edges: OrderLineItemEdge[];
|
|
@@ -301,8 +308,10 @@ declare type OrderRefund = {
|
|
|
301
308
|
declare type RefundLineItem = {
|
|
302
309
|
lineItem: ReRobeOrderLineItem;
|
|
303
310
|
quantityRefund: number;
|
|
311
|
+
quantityCancel: number;
|
|
304
312
|
discountRefund?: Money;
|
|
305
313
|
subtotalRefund?: Money;
|
|
314
|
+
subtotalCanceled?: Money;
|
|
306
315
|
};
|
|
307
316
|
declare type TaxLine = {
|
|
308
317
|
title: string;
|
|
@@ -336,7 +345,7 @@ declare type FulfillmentLineItemEdge = {
|
|
|
336
345
|
node: FulfillmentLineItem;
|
|
337
346
|
};
|
|
338
347
|
declare type FulfillmentLineItem = {
|
|
339
|
-
lineItem:
|
|
348
|
+
lineItem: ReRobeOrderLineItem;
|
|
340
349
|
quantity: number;
|
|
341
350
|
};
|
|
342
351
|
declare type FulfillmentAdmin = {
|
|
@@ -346,7 +355,7 @@ declare type FulfillmentAdmin = {
|
|
|
346
355
|
displayStatus?: FulfillmentDisplayStatusTypes;
|
|
347
356
|
deliveredAt?: string;
|
|
348
357
|
estimatedDeliveryAt?: string;
|
|
349
|
-
fulfillmentLineItems: FulfillmentLineItemConnection;
|
|
358
|
+
fulfillmentLineItems: FulfillmentLineItem[] | FulfillmentLineItemConnection;
|
|
350
359
|
inTransitAt?: string;
|
|
351
360
|
location?: OrderLocation;
|
|
352
361
|
order?: ShopifyAdminOrderObj;
|
|
@@ -38,6 +38,7 @@ declare type ProductFilterAttributes = {
|
|
|
38
38
|
productStyle: string[];
|
|
39
39
|
shoeSize: string;
|
|
40
40
|
measurements: Measurements;
|
|
41
|
+
featuredCollections?: string[];
|
|
41
42
|
};
|
|
42
43
|
declare type ProductConsignmentAttributes = {
|
|
43
44
|
sellRequestImageUrls: string[];
|
|
@@ -66,6 +67,7 @@ declare type ProductConsignmentAttributes = {
|
|
|
66
67
|
discountType: string;
|
|
67
68
|
discountValue: string;
|
|
68
69
|
selectedForClearance: string;
|
|
70
|
+
locationIds?: string[];
|
|
69
71
|
};
|
|
70
72
|
declare type TranslatableAttributes = {
|
|
71
73
|
description: string;
|
|
@@ -120,6 +122,7 @@ declare type ProductAttributesFormFields = {
|
|
|
120
122
|
editorAuthorizations: SingleSelectFormField<EditorAuthorization>;
|
|
121
123
|
vendorId: SingleSelectFormField<string>;
|
|
122
124
|
vendorName: SingleSelectFormField<string>;
|
|
125
|
+
rfidTag: TextInputFormField<string>;
|
|
123
126
|
};
|
|
124
127
|
declare type ProductFilterAttributesFormFields = {
|
|
125
128
|
brand: SingleSelectFormField<string>;
|
|
@@ -134,6 +137,7 @@ declare type ProductFilterAttributesFormFields = {
|
|
|
134
137
|
productType: SingleSelectFormField<string>;
|
|
135
138
|
productStyle: MultiSelectFormField<string>;
|
|
136
139
|
shoeSize: SingleSelectFormField<string>;
|
|
140
|
+
featuredCollections: MultiSelectFormField<string>;
|
|
137
141
|
};
|
|
138
142
|
declare type ProductConsignmentAttributesFormFields = {
|
|
139
143
|
previousSellers: MultiSelectFormField<string>;
|
|
@@ -159,6 +163,7 @@ declare type ProductConsignmentAttributesFormFields = {
|
|
|
159
163
|
isOnSale: SingleSelectFormField<string>;
|
|
160
164
|
discountType: SingleSelectFormField<string>;
|
|
161
165
|
discountValue: TextInputFormField<string>;
|
|
166
|
+
locationIds: MultiSelectFormField<string>;
|
|
162
167
|
};
|
|
163
168
|
declare type ProductFormFields = ProductAttributesFormFields & ProductFilterAttributesFormFields & ProductConsignmentAttributesFormFields;
|
|
164
169
|
interface ParamsForBuildProductInputObjForShopify {
|