rerobe-js-orm 2.4.65 → 2.4.69

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.
Files changed (29) hide show
  1. package/lib/factories/FormState/ProductCollection/ProductCollectionFormStateFactory.d.ts +5 -0
  2. package/lib/factories/FormState/ProductCollection/ProductCollectionFormStateFactory.js +10 -0
  3. package/lib/factories/Order/OrderFromApp.js +3 -1
  4. package/lib/factories/Product/ProductFromFormState.js +9 -7
  5. package/lib/factories/ProductCollection/ProductCollectionFactory.d.ts +5 -0
  6. package/lib/factories/ProductCollection/ProductCollectionFactory.js +6 -0
  7. package/lib/factories/ProductCollection/ProductCollectionFromFormState.d.ts +5 -0
  8. package/lib/factories/ProductCollection/ProductCollectionFromFormState.js +29 -0
  9. package/lib/form-states/Order/RefundFormState.d.ts +3 -3
  10. package/lib/form-states/Product/ProductFormState.js +4 -1
  11. package/lib/form-states/ProductCollection/ProductCollectionFormState.d.ts +12 -0
  12. package/lib/form-states/ProductCollection/ProductCollectionFormState.js +80 -0
  13. package/lib/helpers/OrderHelpers.d.ts +2 -0
  14. package/lib/helpers/OrderHelpers.js +21 -0
  15. package/lib/helpers/ProductCollectionHelpers.d.ts +4 -0
  16. package/lib/helpers/ProductCollectionHelpers.js +27 -0
  17. package/lib/helpers/ReRobeProductHelpers.js +1 -1
  18. package/lib/index.d.ts +3 -1
  19. package/lib/index.js +5 -1
  20. package/lib/models/Order.d.ts +1 -0
  21. package/lib/models/Order.js +2 -0
  22. package/lib/models/Product.js +2 -0
  23. package/lib/models/ProductCollection.d.ts +15 -0
  24. package/lib/models/ProductCollection.js +34 -0
  25. package/lib/types/product-collection-types.d.ts +63 -0
  26. package/lib/types/product-collection-types.js +13 -0
  27. package/lib/types/rerobe-order-types.d.ts +3 -0
  28. package/lib/types/rerobe-product-types.d.ts +5 -0
  29. 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;
@@ -6,7 +6,7 @@ const OrderHelpers_1 = require("../../helpers/OrderHelpers");
6
6
  const orderHelpers = new OrderHelpers_1.default();
7
7
  class OrderFromApp extends OrderFactory_1.default {
8
8
  createOrder(order) {
9
- const { id, orderNumber, amount, currencyCode = 'SEK', shippingDetails, appliedDiscount, products, paymentType, paymentMethod, shippingType, shopifyId, shopifyOrderNumber, state, userId, email, salesChannel, tags, paymentDetails, financialStatus, fulfillmentStatus, } = order;
9
+ const { id, orderNumber, amount, currencyCode = 'SEK', shippingDetails, appliedDiscount, products, paymentType, paymentMethod, shippingType, shopifyId, ribbnOrderNumber, shopifyOrderNumber, state, userId, email, customerName, salesChannel, tags, paymentDetails, financialStatus, fulfillmentStatus, } = order;
10
10
  let discount = 0;
11
11
  let shippingFee = 0;
12
12
  let subTotal = 0;
@@ -52,12 +52,14 @@ class OrderFromApp extends OrderFactory_1.default {
52
52
  paymentType: paymentType ? this.utilities.constantCase(paymentType) : Order_1.default.PAYMENT_TYPES.creditCard,
53
53
  shippingType: shippingType ? this.utilities.constantCase(shippingType) : Order_1.default.SHIPPING_TYPES.localPickUp,
54
54
  shopifyId,
55
+ ribbnOrderNumber,
55
56
  shopifyOrderNumber,
56
57
  shippingAddress: shippingDetails && shippingDetails.deliveryAddress ? shippingDetails.deliveryAddress : null,
57
58
  lineItems,
58
59
  state,
59
60
  userId,
60
61
  email,
62
+ customerName,
61
63
  paymentDetails,
62
64
  tags,
63
65
  salesChannel,
@@ -4,7 +4,7 @@ const ProductFactory_1 = require("./ProductFactory");
4
4
  const Product_1 = require("../../models/Product");
5
5
  class ProductFromFormState extends ProductFactory_1.default {
6
6
  createProduct(props) {
7
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
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: ((_m = props.props) === null || _m === void 0 ? void 0 : _m.rfidTag) || '',
31
+ rfidTag: props.fields.rfidTag.inputValue || '',
32
32
  };
33
33
  const productFilterAttributes = {
34
- documentId: (_o = props.props) === null || _o === void 0 ? void 0 : _o.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: ((_p = props.props) === null || _p === void 0 ? void 0 : _p.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: ((_q = props.props) === null || _q === void 0 ? void 0 : _q.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: ((_r = props.props) === null || _r === void 0 ? void 0 : _r.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: ((_s = props.props) === null || _s === void 0 ? void 0 : _s.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,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Base_1 = require("../../Base");
4
+ class ProductCollectionFactory extends Base_1.default {
5
+ }
6
+ exports.default = ProductCollectionFactory;
@@ -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,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ProductCollectionFactory_1 = require("./ProductCollectionFactory");
4
+ const ProductCollection_1 = require("../../models/ProductCollection");
5
+ // @ts-ignore
6
+ const lodash_1 = require("lodash");
7
+ class ProductCollectionFromFormState extends ProductCollectionFactory_1.default {
8
+ createProductCollection(fs) {
9
+ var _a;
10
+ let collectionId = fs.fields.collectionId.inputValue;
11
+ if (!collectionId) {
12
+ collectionId = lodash_1.camelCase(fs.fields.title.inputValue) + new Date().toISOString().split('T')[0];
13
+ }
14
+ const productCollectionAttributes = {
15
+ documentId: ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.documentId) || '',
16
+ preTitle: fs.fields.preTitle.inputValue || '',
17
+ title: fs.fields.title.inputValue || '',
18
+ subTitle: fs.fields.subTitle.inputValue || '',
19
+ description: fs.fields.description.inputValue || '',
20
+ type: fs.fields.type.selectedValue || '',
21
+ imgUrl: fs.fields.imgUrl.inputValue || '',
22
+ refinements: fs.fields.refinements.selectedValue || {},
23
+ tags: fs.fields.tags.selectedValues || [],
24
+ collectionId,
25
+ };
26
+ return new ProductCollection_1.default(Object.assign({}, productCollectionAttributes));
27
+ }
28
+ }
29
+ 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();
@@ -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.35';
610
+ inputValue = this.props[fieldKey] || '0.5';
608
611
  valid = true;
609
612
  }
610
613
  if (fieldKey === 'discountValue') {
@@ -0,0 +1,12 @@
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
+ tagOptions: string[];
8
+ };
9
+ constructor(props?: any, opts?: any);
10
+ createProductCollection(): ProductCollection;
11
+ private fieldFactory;
12
+ }
@@ -0,0 +1,80 @@
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
+ // @ts-ignore
7
+ const lodash_1 = require("lodash");
8
+ class ProductCollectionFormState extends FormState_1.default {
9
+ constructor(props, opts) {
10
+ super();
11
+ this.props = new ProductCollection_1.default(props).toObj();
12
+ this.opts = opts;
13
+ this.fields.preTitle = this.fieldFactory('textInput', 'preTitle');
14
+ this.fields.title = this.fieldFactory('textInput', 'title');
15
+ this.fields.subTitle = this.fieldFactory('textInput', 'subTitle');
16
+ this.fields.description = this.fieldFactory('textInput', 'description');
17
+ this.fields.type = this.fieldFactory('singleSelect', 'type');
18
+ this.fields.imgUrl = this.fieldFactory('textInput', 'imgUrl');
19
+ this.fields.refinements = this.fieldFactory('singleSelect', 'refinements');
20
+ this.fields.tags = this.fieldFactory('multiSelect', 'tags', []);
21
+ this.fields.collectionId = this.fieldFactory('textInput', 'collectionId');
22
+ }
23
+ createProductCollection() {
24
+ const productCollectionFactory = new ProductCollectionFromFormState_1.default();
25
+ return productCollectionFactory.createProductCollection(this);
26
+ }
27
+ fieldFactory(fieldType, fieldKey, fieldOptions) {
28
+ let options = fieldOptions || [];
29
+ if (fieldType === 'singleSelect') {
30
+ const selectedValue = this.props[fieldKey] || '';
31
+ const valid = !!this.props[fieldKey];
32
+ const onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
33
+ return {
34
+ options,
35
+ selectedValue,
36
+ valid,
37
+ onChangeHandler,
38
+ };
39
+ }
40
+ if (fieldType === 'textInput') {
41
+ const inputValue = this.props[fieldKey] || '';
42
+ const valid = !!this.props[fieldKey];
43
+ let onChangeHandler = (val) => this.textInputChangeHandler(fieldKey, String(val));
44
+ if (fieldKey === 'collectionId') {
45
+ onChangeHandler = (val) => this.textInputChangeHandler(fieldKey, lodash_1.camelCase(String(val)));
46
+ }
47
+ return {
48
+ inputValue,
49
+ valid,
50
+ onChangeHandler,
51
+ };
52
+ }
53
+ if (fieldType === 'multiSelect') {
54
+ let selectedValues = [];
55
+ let valid = true;
56
+ const onChangeHandler = (val) => this.multiSelectChangeHandler(fieldKey, val);
57
+ if (fieldKey === 'tags') {
58
+ if (this.props.tags) {
59
+ if (Array.isArray(this.props.tags)) {
60
+ selectedValues = this.props.tags;
61
+ }
62
+ }
63
+ if (this.opts && this.opts.tagOptions && this.opts.tagOptions.length > 0) {
64
+ options = this.utilities.uniqObjArray([...options, ...this.opts.tagOptions.map((t) => ({ label: t, value: t }))], 'value');
65
+ }
66
+ valid = true;
67
+ }
68
+ return {
69
+ options,
70
+ selectedValues,
71
+ valid,
72
+ onChangeHandler,
73
+ };
74
+ }
75
+ return {
76
+ valid: false,
77
+ };
78
+ }
79
+ }
80
+ 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;
@@ -0,0 +1,4 @@
1
+ export default class ProductCollectionHelpers {
2
+ getFiltersByCollectionConditions(collectionRefinementsVal: ProductRefinements): FiltersObj;
3
+ getCollectionRefinementsFromFilters(filtersList: FiltersObj): ProductRefinements;
4
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class ProductCollectionHelpers {
4
+ getFiltersByCollectionConditions(collectionRefinementsVal) {
5
+ if (!collectionRefinementsVal && !Object.keys(collectionRefinementsVal).length) {
6
+ return {};
7
+ }
8
+ return Object.keys(collectionRefinementsVal).reduce((result, key) => {
9
+ const keyName = key.replace('Refinement', '');
10
+ result[keyName] = collectionRefinementsVal[key];
11
+ return result;
12
+ }, {});
13
+ }
14
+ getCollectionRefinementsFromFilters(filtersList) {
15
+ if (!filtersList && !Object.keys(filtersList).length) {
16
+ return {};
17
+ }
18
+ return Object.keys(filtersList).reduce((result, key) => {
19
+ if (!filtersList[key].length) {
20
+ return result;
21
+ }
22
+ result[`${key}Refinement`] = [...filtersList[key]];
23
+ return result;
24
+ }, {});
25
+ }
26
+ }
27
+ exports.default = ProductCollectionHelpers;
@@ -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.35;
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;
package/lib/index.d.ts CHANGED
@@ -2,6 +2,8 @@ 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 ProductCollectionFormStateFactory from './factories/FormState/ProductCollection/ProductCollectionFormStateFactory';
6
+ import ProductCollectionHelpers from './helpers/ProductCollectionHelpers';
5
7
  import SellRequestFormStateFactory from './factories/FormState/SellRequest/SellRequestFormStateFactory';
6
8
  import PickUpFormStateFactory from './factories/FormState/PickUp/PickUpFormStateFactory';
7
9
  import UserFormStateFactory from './factories/FormState/User/UserFormStateFactory';
@@ -31,4 +33,4 @@ import WebhookFormState from './form-states/Merchant/WebhookFormState';
31
33
  import ReRobeProductHelpers from './helpers/ReRobeProductHelpers';
32
34
  import AnalyticsHelpers from './helpers/AnalyticsHelpers';
33
35
  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, };
36
+ export { ProductFromAlgoliaJSONDoc, ProductFromShopifyWebhookJSONDoc, ProductFromShopifyJSClientJSONDoc, ProductFormStateFactory, ProductCollectionFormStateFactory, ProductCollectionHelpers, 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.ProductCollectionHelpers = exports.ProductCollectionFormStateFactory = 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,10 @@ 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 ProductCollectionFormStateFactory_1 = require("./factories/FormState/ProductCollection/ProductCollectionFormStateFactory");
13
+ exports.ProductCollectionFormStateFactory = ProductCollectionFormStateFactory_1.default;
14
+ const ProductCollectionHelpers_1 = require("./helpers/ProductCollectionHelpers");
15
+ exports.ProductCollectionHelpers = ProductCollectionHelpers_1.default;
12
16
  const SellRequestFormStateFactory_1 = require("./factories/FormState/SellRequest/SellRequestFormStateFactory");
13
17
  exports.SellRequestFormStateFactory = SellRequestFormStateFactory_1.default;
14
18
  const PickUpFormStateFactory_1 = require("./factories/FormState/PickUp/PickUpFormStateFactory");
@@ -55,6 +55,7 @@ export default class Order extends Base {
55
55
  shippingType: ReRobeShippingAndDeliveryTypes;
56
56
  shopifyId: string | null;
57
57
  shopifyOrderNumber: number | null;
58
+ ribbnOrderNumber: number | null;
58
59
  subtotalPrice: Money;
59
60
  tags: string[] | string | null;
60
61
  totalDiscount: Money;
@@ -49,6 +49,7 @@ class Order extends Base_1.default {
49
49
  this.shippingType = (props === null || props === void 0 ? void 0 : props.shippingType) || Order.SHIPPING_TYPES.localPickUp;
50
50
  this.shopifyId = (props === null || props === void 0 ? void 0 : props.shopifyId) || null;
51
51
  this.shopifyOrderNumber = (props === null || props === void 0 ? void 0 : props.shopifyOrderNumber) || null;
52
+ this.ribbnOrderNumber = (props === null || props === void 0 ? void 0 : props.ribbnOrderNumber) || null;
52
53
  this.subtotalPrice = (props === null || props === void 0 ? void 0 : props.subtotalPrice) || {
53
54
  amount: 0,
54
55
  };
@@ -124,6 +125,7 @@ class Order extends Base_1.default {
124
125
  shippingType: this.shippingType,
125
126
  shopifyId: this.shopifyId,
126
127
  shopifyOrderNumber: this.shopifyOrderNumber,
128
+ ribbnOrderNumber: this.ribbnOrderNumber,
127
129
  subtotalPrice: this.subtotalPrice,
128
130
  tags: this.tags,
129
131
  totalDiscount: this.totalDiscount,
@@ -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,15 @@
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
+ tags: string[];
12
+ collectionId: string;
13
+ constructor(props?: any);
14
+ toObj(): ProductCollectionType;
15
+ }
@@ -0,0 +1,34 @@
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
+ this.tags = (props === null || props === void 0 ? void 0 : props.tags) || [];
16
+ this.collectionId = (props === null || props === void 0 ? void 0 : props.collectionId) || '';
17
+ }
18
+ toObj() {
19
+ const productCollectionObj = {
20
+ documentId: this.documentId,
21
+ preTitle: this.preTitle,
22
+ title: this.title,
23
+ subTitle: this.subTitle,
24
+ description: this.description,
25
+ type: this.type,
26
+ imgUrl: this.imgUrl,
27
+ refinements: this.refinements,
28
+ tags: this.tags,
29
+ collectionId: this.collectionId,
30
+ };
31
+ return productCollectionObj;
32
+ }
33
+ }
34
+ exports.default = ProductCollection;
@@ -0,0 +1,63 @@
1
+ declare type ProductAttrRefinementsOptions = 'brand' | 'clothingSize' | 'color' | 'condition' | 'gender' | 'jeanSize' | 'materialComposition' | 'priceRange' | 'productCategory' | 'productType' | 'productStyle' | 'shoeSize' | 'status' | 'salesChannel';
2
+ declare type FiltersOptions = 'brandRefinement' | 'clothingSizeRefinement' | 'colorRefinement' | 'conditionRefinement' | 'genderRefinement' | 'jeanSizeRefinement' | 'materialCompositionRefinement' | 'priceRangeRefinement' | 'productCategoryRefinement' | 'productTypeRefinement' | 'productStyleRefinement' | 'shoeSizeRefinement' | 'statusRefinement' | 'salesChannelRefinement';
3
+ declare type FiltersObj = {
4
+ brand?: string[];
5
+ clothingSize?: string[];
6
+ color?: string[];
7
+ condition?: string[];
8
+ gender?: string[];
9
+ jeanSize?: string[];
10
+ materialComposition?: string[];
11
+ priceRange?: string[];
12
+ productCategory?: string[];
13
+ productType?: string[];
14
+ productStyle?: string[];
15
+ shoeSize?: string[];
16
+ status?: string[];
17
+ salesChannel?: string[];
18
+ };
19
+ interface ProductRefinements {
20
+ brandRefinement?: string[];
21
+ clothingSizeRefinement?: string[];
22
+ colorRefinement?: string[];
23
+ conditionRefinement?: string[];
24
+ genderRefinement?: string[];
25
+ jeanSizeRefinement?: string[];
26
+ materialCompositionRefinement?: string[];
27
+ priceRangeRefinement?: string[];
28
+ productCategoryRefinement?: string[];
29
+ productTypeRefinement?: string[];
30
+ productStyleRefinement?: string[];
31
+ shoeSizeRefinement?: string[];
32
+ statusRefinement?: string[];
33
+ salesChannelRefinement?: string[];
34
+ }
35
+ declare type CollectionType = 'AUTOMATED' | 'MANUAL';
36
+ declare type ProductCollectionType = {
37
+ createdAt?: string;
38
+ updatedAt?: string;
39
+ documentId?: string;
40
+ preTitle: string;
41
+ title: string;
42
+ subTitle: string;
43
+ description: string;
44
+ type: CollectionType;
45
+ imgUrl: string;
46
+ refinements: ProductRefinements;
47
+ tags: string[];
48
+ collectionId: string;
49
+ };
50
+ declare type CompleteProductCollection = ProductCollectionType & {
51
+ [key: string]: any;
52
+ };
53
+ declare type ProductCollectionFormFields = {
54
+ preTitle: TextInputFormField<string>;
55
+ title: TextInputFormField<string>;
56
+ subTitle: TextInputFormField<string>;
57
+ description: TextInputFormField<string>;
58
+ type: SingleSelectFormField<CollectionType>;
59
+ imgUrl: TextInputFormField<string>;
60
+ refinements: SingleSelectFormField<ProductRefinements>;
61
+ tags: MultiSelectFormField<string>;
62
+ collectionId: TextInputFormField<string>;
63
+ };
@@ -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';
@@ -39,6 +39,7 @@ declare type ReRobeOrderObj = {
39
39
  shippingType: ReRobeShippingAndDeliveryTypes | string;
40
40
  shopifyId?: string | null;
41
41
  shopifyOrderNumber?: number | null;
42
+ ribbnOrderNumber?: number | null;
42
43
  subtotalPrice: Money;
43
44
  tags?: string[] | string | null;
44
45
  totalDiscount: Money;
@@ -95,10 +96,12 @@ declare type OrderInput = {
95
96
  products: CompleteProduct[];
96
97
  appliedDiscount?: AppliedDiscount;
97
98
  shopifyId?: string | null;
99
+ ribbnOrderNumber?: number | null;
98
100
  shopifyOrderNumber?: number | null;
99
101
  state?: ReRobeOrderStates | string | null;
100
102
  userId?: string | null;
101
103
  email?: string | null;
104
+ customerName?: string | null;
102
105
  tags?: string[];
103
106
  salesChannel?: SalesChannels | string | null;
104
107
  paymentDetails?: PaymentDetails | null;
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.4.65",
3
+ "version": "2.4.69",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",