rerobe-js-orm 2.4.68 → 2.4.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ const FormStateFactory_1 = require("../FormStateFactory");
4
4
  const ProductCollectionFormState_1 = require("../../../form-states/ProductCollection/ProductCollectionFormState");
5
5
  class ProductCollectionFormStateFactory extends FormStateFactory_1.default {
6
6
  createFormState(props, opts) {
7
- return new ProductCollectionFormState_1.default(props);
7
+ return new ProductCollectionFormState_1.default(props, opts);
8
8
  }
9
9
  }
10
10
  exports.default = ProductCollectionFormStateFactory;
@@ -4,7 +4,7 @@ const OrderFactory_1 = require("./OrderFactory");
4
4
  const Order_1 = require("../../models/Order");
5
5
  class OrderFromFormState extends OrderFactory_1.default {
6
6
  createOrder(fs) {
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, _s;
8
8
  const currencyCode = fs.fields.currencyCode.inputValue || 'SEK';
9
9
  const customer = fs.fields.customer.selectedValue || {};
10
10
  const firstName = fs.fields.firstName.inputValue;
@@ -17,13 +17,14 @@ class OrderFromFormState extends OrderFactory_1.default {
17
17
  documentId: ((_c = fs.props) === null || _c === void 0 ? void 0 : _c.documentId) || '',
18
18
  name: ((_d = fs.props) === null || _d === void 0 ? void 0 : _d.name) || '',
19
19
  orderNumber: (_e = fs.props) === null || _e === void 0 ? void 0 : _e.orderNumber,
20
- state: ((_f = fs.props) === null || _f === void 0 ? void 0 : _f.state) || Order_1.default.ORDER_STATES.draft,
20
+ ribbnOrderNumber: (_f = fs.props) === null || _f === void 0 ? void 0 : _f.ribbnOrderNumber,
21
+ state: ((_g = fs.props) === null || _g === void 0 ? void 0 : _g.state) || Order_1.default.ORDER_STATES.draft,
21
22
  currencyCode: fs.fields.currencyCode.inputValue,
22
- statusUrl: ((_g = fs.props) === null || _g === void 0 ? void 0 : _g.statusUrl) || '',
23
- processedAt: ((_h = fs.props) === null || _h === void 0 ? void 0 : _h.processedAt) || new Date().toUTCString(),
23
+ statusUrl: ((_h = fs.props) === null || _h === void 0 ? void 0 : _h.statusUrl) || '',
24
+ processedAt: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.processedAt) || new Date().toUTCString(),
24
25
  financialStatus: fs.fields.financialStatus.selectedValue,
25
26
  fulfillmentStatus: fs.fields.fulfillmentStatus.selectedValue,
26
- fulfillments: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.fulfillments) || [],
27
+ fulfillments: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.fulfillments) || [],
27
28
  shippingAddress: fs.fields.shippingAddress.selectedValue || {
28
29
  id: '',
29
30
  address1: '',
@@ -34,7 +35,7 @@ class OrderFromFormState extends OrderFactory_1.default {
34
35
  province: '',
35
36
  zip: '',
36
37
  },
37
- shippingDiscountAllocations: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.shippingDiscountAllocations) || [],
38
+ shippingDiscountAllocations: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.shippingDiscountAllocations) || [],
38
39
  shippingLine: fs.fields.shippingLine
39
40
  ? fs.fields.shippingLine.selectedValue
40
41
  : {
@@ -55,9 +56,9 @@ class OrderFromFormState extends OrderFactory_1.default {
55
56
  originalTotalPrice: { amount: fs.fields.originalTotalPrice.inputValue || 0, currencyCode },
56
57
  lineItems: fs.fields.lineItems.selectedValues || [],
57
58
  cancelReason: fs.fields.cancelReason.selectedValue || '',
58
- canceledAt: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.canceledAt) || '',
59
- customerUrl: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.customerUrl) || '',
60
- discountApplications: ((_o = fs.props) === null || _o === void 0 ? void 0 : _o.discountApplications) || [],
59
+ canceledAt: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.canceledAt) || '',
60
+ customerUrl: ((_o = fs.props) === null || _o === void 0 ? void 0 : _o.customerUrl) || '',
61
+ discountApplications: ((_p = fs.props) === null || _p === void 0 ? void 0 : _p.discountApplications) || [],
61
62
  physicalLocation: fs.fields.physicalLocation.selectedValue || {
62
63
  id: '',
63
64
  activatable: true,
@@ -76,7 +77,7 @@ class OrderFromFormState extends OrderFactory_1.default {
76
77
  },
77
78
  notes: fs.fields.notes.inputValue || '',
78
79
  userId: (customer === null || customer === void 0 ? void 0 : customer.uid) || '',
79
- customerName: ((_p = fs.props) === null || _p === void 0 ? void 0 : _p.customerName) ||
80
+ customerName: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.customerName) ||
80
81
  (customer.displayName ? customer.displayName : '') ||
81
82
  (customer.firstName && customer.lastName ? `${customer.firstName} ${customer.lastName}` : '') ||
82
83
  (firstName && lastName ? `${firstName} ${lastName}` : ''),
@@ -84,9 +85,9 @@ class OrderFromFormState extends OrderFactory_1.default {
84
85
  phone: (customer === null || customer === void 0 ? void 0 : customer.phone) || fs.fields.phone.inputValue || '',
85
86
  paymentMethod: fs.fields.paymentMethod.selectedValue || '',
86
87
  paymentDetails: fs.fields.paymentDetails.selectedValue || {},
87
- merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '',
88
+ merchantId: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.merchantId) || '',
88
89
  tags: fs.fields.tags.selectedValues || [],
89
- refunds: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.refunds) || [],
90
+ refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [],
90
91
  };
91
92
  return new Order_1.default(Object.assign({}, orderAttributes));
92
93
  }
@@ -46,6 +46,7 @@ class ProductFromFormState extends ProductFactory_1.default {
46
46
  shoeSize: props.fields.shoeSize.selectedValue,
47
47
  measurements: props.fields.measurements.selectedValue || {},
48
48
  featuredCollections: props.fields.featuredCollections.selectedValues || [],
49
+ tags: props.fields.tags.selectedValues || [],
49
50
  };
50
51
  const consignmentAttributes = {
51
52
  previousSellers: props.fields.previousSellers.selectedValues,
@@ -2,9 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ProductCollectionFactory_1 = require("./ProductCollectionFactory");
4
4
  const ProductCollection_1 = require("../../models/ProductCollection");
5
+ // @ts-ignore
6
+ const lodash_1 = require("lodash");
5
7
  class ProductCollectionFromFormState extends ProductCollectionFactory_1.default {
6
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
+ }
7
14
  const productCollectionAttributes = {
15
+ documentId: ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.documentId) || '',
8
16
  preTitle: fs.fields.preTitle.inputValue || '',
9
17
  title: fs.fields.title.inputValue || '',
10
18
  subTitle: fs.fields.subTitle.inputValue || '',
@@ -12,6 +20,8 @@ class ProductCollectionFromFormState extends ProductCollectionFactory_1.default
12
20
  type: fs.fields.type.selectedValue || '',
13
21
  imgUrl: fs.fields.imgUrl.inputValue || '',
14
22
  refinements: fs.fields.refinements.selectedValue || {},
23
+ tags: fs.fields.tags.selectedValues || [],
24
+ collectionId,
15
25
  };
16
26
  return new ProductCollection_1.default(Object.assign({}, productCollectionAttributes));
17
27
  }
@@ -71,6 +71,7 @@ class ProductFormState extends FormState_1.default {
71
71
  this.fields.rfidTag = this.fieldFactory('textInput', 'rfidTag');
72
72
  this.fields.locationIds = this.fieldFactory('multiSelect', 'locationIds');
73
73
  this.fields.featuredCollections = this.fieldFactory('multiSelect', 'featuredCollections');
74
+ this.fields.tags = this.fieldFactory('multiSelect', 'tags');
74
75
  }
75
76
  autoCreateTitle() {
76
77
  return this.createProduct().autoCreateTitle();
@@ -508,6 +509,16 @@ class ProductFormState extends FormState_1.default {
508
509
  }
509
510
  hidden = this.props.productStyle.length < 1;
510
511
  }
512
+ if (fieldKey === 'tags') {
513
+ if (this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length > 0) {
514
+ this.props.tags.forEach((tag) => {
515
+ if (!options.map((o) => o.value).includes(tag)) {
516
+ options.splice(0, 0, { label: tag, value: tag });
517
+ }
518
+ });
519
+ }
520
+ hidden = Boolean(this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length < 1);
521
+ }
511
522
  if (fieldKey === 'clothingSize') {
512
523
  if (this.props.gender === 'Woman') {
513
524
  options = [
@@ -4,8 +4,7 @@ export default class ProductCollectionFormState extends FormState {
4
4
  fields: ProductCollectionFormFields;
5
5
  props: CompleteProductCollection;
6
6
  opts: {
7
- productAttrOptions: ProductAttrRefinementsOptions[];
8
- productAttrValuesOptions: string[];
7
+ tagOptions: string[];
9
8
  };
10
9
  constructor(props?: any, opts?: any);
11
10
  createProductCollection(): ProductCollection;
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const FormState_1 = require("../FormState");
4
4
  const ProductCollection_1 = require("../../models/ProductCollection");
5
5
  const ProductCollectionFromFormState_1 = require("../../factories/ProductCollection/ProductCollectionFromFormState");
6
+ // @ts-ignore
7
+ const lodash_1 = require("lodash");
6
8
  class ProductCollectionFormState extends FormState_1.default {
7
9
  constructor(props, opts) {
8
10
  super();
@@ -15,17 +17,19 @@ class ProductCollectionFormState extends FormState_1.default {
15
17
  this.fields.type = this.fieldFactory('singleSelect', 'type');
16
18
  this.fields.imgUrl = this.fieldFactory('textInput', 'imgUrl');
17
19
  this.fields.refinements = this.fieldFactory('singleSelect', 'refinements');
20
+ this.fields.tags = this.fieldFactory('multiSelect', 'tags', []);
21
+ this.fields.collectionId = this.fieldFactory('textInput', 'collectionId');
18
22
  }
19
23
  createProductCollection() {
20
24
  const productCollectionFactory = new ProductCollectionFromFormState_1.default();
21
25
  return productCollectionFactory.createProductCollection(this);
22
26
  }
23
27
  fieldFactory(fieldType, fieldKey, fieldOptions) {
28
+ let options = fieldOptions || [];
24
29
  if (fieldType === 'singleSelect') {
25
- const options = fieldOptions || [];
26
30
  const selectedValue = this.props[fieldKey] || '';
27
31
  const valid = !!this.props[fieldKey];
28
- const onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, String(val));
32
+ const onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
29
33
  return {
30
34
  options,
31
35
  selectedValue,
@@ -36,13 +40,38 @@ class ProductCollectionFormState extends FormState_1.default {
36
40
  if (fieldType === 'textInput') {
37
41
  const inputValue = this.props[fieldKey] || '';
38
42
  const valid = !!this.props[fieldKey];
39
- const onChangeHandler = (val) => this.textInputChangeHandler(fieldKey, String(val));
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
+ }
40
47
  return {
41
48
  inputValue,
42
49
  valid,
43
50
  onChangeHandler,
44
51
  };
45
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
+ }
46
75
  return {
47
76
  valid: false,
48
77
  };
@@ -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;
package/lib/index.d.ts CHANGED
@@ -2,7 +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 ProductCollectionFormState from './form-states/ProductCollection/ProductCollectionFormState';
5
+ import ProductCollectionFormStateFactory from './factories/FormState/ProductCollection/ProductCollectionFormStateFactory';
6
+ import ProductCollectionHelpers from './helpers/ProductCollectionHelpers';
6
7
  import SellRequestFormStateFactory from './factories/FormState/SellRequest/SellRequestFormStateFactory';
7
8
  import PickUpFormStateFactory from './factories/FormState/PickUp/PickUpFormStateFactory';
8
9
  import UserFormStateFactory from './factories/FormState/User/UserFormStateFactory';
@@ -32,4 +33,4 @@ import WebhookFormState from './form-states/Merchant/WebhookFormState';
32
33
  import ReRobeProductHelpers from './helpers/ReRobeProductHelpers';
33
34
  import AnalyticsHelpers from './helpers/AnalyticsHelpers';
34
35
  import OrderHelpers from './helpers/OrderHelpers';
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, };
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.ProductCollectionFormState = 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,8 +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 ProductCollectionFormState_1 = require("./form-states/ProductCollection/ProductCollectionFormState");
13
- exports.ProductCollectionFormState = ProductCollectionFormState_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;
14
16
  const SellRequestFormStateFactory_1 = require("./factories/FormState/SellRequest/SellRequestFormStateFactory");
15
17
  exports.SellRequestFormStateFactory = SellRequestFormStateFactory_1.default;
16
18
  const PickUpFormStateFactory_1 = require("./factories/FormState/PickUp/PickUpFormStateFactory");
@@ -50,6 +50,7 @@ class Product extends Base_1.default {
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
52
  featuredCollections: (props === null || props === void 0 ? void 0 : props.featuredCollections) || [],
53
+ tags: (props === null || props === void 0 ? void 0 : props.tags) || [],
53
54
  };
54
55
  this.consignmentAttributes = {
55
56
  sellRequestImageUrls: (props === null || props === void 0 ? void 0 : props.sellRequestImageUrls) || [],
@@ -8,6 +8,8 @@ export default class ProductCollection extends Base {
8
8
  type: CollectionType;
9
9
  imgUrl: string;
10
10
  refinements: ProductRefinements;
11
+ tags: string[];
12
+ collectionId: string;
11
13
  constructor(props?: any);
12
14
  toObj(): ProductCollectionType;
13
15
  }
@@ -4,7 +4,7 @@ const Base_1 = require("../Base");
4
4
  class ProductCollection extends Base_1.default {
5
5
  constructor(props) {
6
6
  super();
7
- this.documentId = (props === null || props === void 0 ? void 0 : props.documentId) || '';
7
+ this.documentId = (props === null || props === void 0 ? void 0 : props.documentId) || this.utilities.makeRandId(28);
8
8
  this.preTitle = (props === null || props === void 0 ? void 0 : props.preTitle) || '';
9
9
  this.title = (props === null || props === void 0 ? void 0 : props.title) || '';
10
10
  this.subTitle = (props === null || props === void 0 ? void 0 : props.subTitle) || '';
@@ -12,6 +12,8 @@ class ProductCollection extends Base_1.default {
12
12
  this.type = (props === null || props === void 0 ? void 0 : props.type) || 'AUTOMATED';
13
13
  this.imgUrl = (props === null || props === void 0 ? void 0 : props.imgUrl) || '';
14
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) || '';
15
17
  }
16
18
  toObj() {
17
19
  const productCollectionObj = {
@@ -23,6 +25,8 @@ class ProductCollection extends Base_1.default {
23
25
  type: this.type,
24
26
  imgUrl: this.imgUrl,
25
27
  refinements: this.refinements,
28
+ tags: this.tags,
29
+ collectionId: this.collectionId,
26
30
  };
27
31
  return productCollectionObj;
28
32
  }
@@ -1,8 +1,22 @@
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 {
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 {
6
20
  brandRefinement?: string[];
7
21
  clothingSizeRefinement?: string[];
8
22
  colorRefinement?: string[];
@@ -15,6 +29,8 @@ interface ProductRefinements extends Refinements {
15
29
  productTypeRefinement?: string[];
16
30
  productStyleRefinement?: string[];
17
31
  shoeSizeRefinement?: string[];
32
+ statusRefinement?: string[];
33
+ salesChannelRefinement?: string[];
18
34
  }
19
35
  declare type CollectionType = 'AUTOMATED' | 'MANUAL';
20
36
  declare type ProductCollectionType = {
@@ -28,6 +44,8 @@ declare type ProductCollectionType = {
28
44
  type: CollectionType;
29
45
  imgUrl: string;
30
46
  refinements: ProductRefinements;
47
+ tags: string[];
48
+ collectionId: string;
31
49
  };
32
50
  declare type CompleteProductCollection = ProductCollectionType & {
33
51
  [key: string]: any;
@@ -40,4 +58,6 @@ declare type ProductCollectionFormFields = {
40
58
  type: SingleSelectFormField<CollectionType>;
41
59
  imgUrl: TextInputFormField<string>;
42
60
  refinements: SingleSelectFormField<ProductRefinements>;
61
+ tags: MultiSelectFormField<string>;
62
+ collectionId: TextInputFormField<string>;
43
63
  };
@@ -39,6 +39,7 @@ declare type ProductFilterAttributes = {
39
39
  shoeSize: string;
40
40
  measurements: Measurements;
41
41
  featuredCollections?: string[];
42
+ tags?: string[];
42
43
  };
43
44
  declare type ProductConsignmentAttributes = {
44
45
  sellRequestImageUrls: string[];
@@ -138,6 +139,7 @@ declare type ProductFilterAttributesFormFields = {
138
139
  productStyle: MultiSelectFormField<string>;
139
140
  shoeSize: SingleSelectFormField<string>;
140
141
  featuredCollections: MultiSelectFormField<string>;
142
+ tags: MultiSelectFormField<string>;
141
143
  };
142
144
  declare type ProductConsignmentAttributesFormFields = {
143
145
  previousSellers: MultiSelectFormField<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.4.68",
3
+ "version": "2.4.72",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -14,7 +14,8 @@
14
14
  "prepublishOnly": "npm test && npm run lint",
15
15
  "preversion": "npm run lint",
16
16
  "version": "npm run format && git add -A src",
17
- "postversion": "git push && git push --tags"
17
+ "postversion": "git push && git push --tags",
18
+ "clean": "npm run format && npm run lint"
18
19
  },
19
20
  "repository": {
20
21
  "type": "git",