rerobe-js-orm 2.4.65 → 2.4.66
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/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 -3
- package/lib/form-states/Product/ProductFormState.js +3 -0
- 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 +2 -0
- package/lib/helpers/OrderHelpers.js +21 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- 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-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;
|
|
@@ -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,11 +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, quantityCancel: number, unitOrderDiscountAmount: number): RefundLineItem;
|
|
9
|
+
getUpdatedRefundLineItem(lineItem: ReRobeOrderLineItem, quantityRefund: number | string, quantityCancel: number | string, unitOrderDiscountAmount: number): RefundLineItem;
|
|
10
10
|
refundLineItemChangeHandler(val: {
|
|
11
11
|
lineItemLike: ReRobeOrderLineItem | RefundLineItem;
|
|
12
|
-
quantityRefund: number;
|
|
13
|
-
quantityCancel: number;
|
|
12
|
+
quantityRefund: number | string;
|
|
13
|
+
quantityCancel: number | string;
|
|
14
14
|
unitOrderDiscount: number;
|
|
15
15
|
}): void;
|
|
16
16
|
private fieldFactory;
|
|
@@ -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();
|
|
@@ -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;
|
|
@@ -7,4 +7,6 @@ export default class OrderHelpers {
|
|
|
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
|
}
|
|
@@ -163,5 +163,26 @@ class OrderHelpers {
|
|
|
163
163
|
preparedOrder.canceledItems = lineItemsWithQuantityInfo.filter(({ canceledQuantity }) => canceledQuantity > 0);
|
|
164
164
|
return preparedOrder;
|
|
165
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
|
+
}
|
|
166
187
|
}
|
|
167
188
|
exports.default = OrderHelpers;
|
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/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';
|
|
@@ -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 {
|