rerobe-js-orm 2.4.2 → 2.4.8

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 (103) hide show
  1. package/lib/factories/FormState/Address/AddressFormStateFactory.d.ts +1 -1
  2. package/lib/factories/FormState/Address/AddressFormStateFactory.js +1 -1
  3. package/lib/factories/FormState/Merchant/MerchantFormStateFactory.d.ts +1 -1
  4. package/lib/factories/FormState/Merchant/MerchantFormStateFactory.js +1 -1
  5. package/lib/factories/FormState/Order/OrderFormStateFactory.d.ts +1 -1
  6. package/lib/factories/FormState/Order/OrderFormStateFactory.js +1 -1
  7. package/lib/factories/FormState/Order/RefundFormStateFactory.d.ts +5 -0
  8. package/lib/factories/FormState/Order/RefundFormStateFactory.js +10 -0
  9. package/lib/factories/FormState/PickUp/PickUpFormStateFactory.d.ts +1 -1
  10. package/lib/factories/FormState/PickUp/PickUpFormStateFactory.js +1 -1
  11. package/lib/factories/FormState/Product/ProductFormStateFactory.d.ts +2 -2
  12. package/lib/factories/FormState/Product/ProductFormStateFactory.js +3 -3
  13. package/lib/factories/FormState/ProductCollection/ProductCollectionFormStateFactory.d.ts +5 -0
  14. package/lib/factories/FormState/ProductCollection/ProductCollectionFormStateFactory.js +10 -0
  15. package/lib/factories/FormState/SellRequest/SellRequestFormStateFactory.d.ts +1 -1
  16. package/lib/factories/FormState/SellRequest/SellRequestFormStateFactory.js +1 -1
  17. package/lib/factories/FormState/User/UserFormStateFactory.d.ts +1 -1
  18. package/lib/factories/FormState/User/UserFormStateFactory.js +1 -1
  19. package/lib/factories/Merchant/MerchantFactory.d.ts +1 -1
  20. package/lib/factories/Merchant/MerchantFromFormState.d.ts +1 -1
  21. package/lib/factories/Merchant/MerchantFromFormState.js +13 -1
  22. package/lib/factories/Order/OrderFactory.d.ts +1 -1
  23. package/lib/factories/Order/OrderFromApp.js +4 -2
  24. package/lib/factories/Order/OrderFromFormState.d.ts +1 -1
  25. package/lib/factories/Order/OrderFromFormState.js +17 -15
  26. package/lib/factories/Order/OrderFromShopifyWebhook.js +126 -10
  27. package/lib/factories/Order/RefundFactory.d.ts +5 -0
  28. package/lib/factories/Order/RefundFactory.js +6 -0
  29. package/lib/factories/Order/RefundFromFormState.d.ts +5 -0
  30. package/lib/factories/Order/RefundFromFormState.js +29 -0
  31. package/lib/factories/PayoutAccount/PayoutAccountFromFormState.d.ts +1 -1
  32. package/lib/factories/Product/ProductFactory.d.ts +1 -1
  33. package/lib/factories/Product/ProductFromFormState.d.ts +1 -1
  34. package/lib/factories/Product/ProductFromFormState.js +29 -3
  35. package/lib/factories/ProductCollection/ProductCollectionFactory.d.ts +5 -0
  36. package/lib/factories/ProductCollection/ProductCollectionFactory.js +6 -0
  37. package/lib/factories/ProductCollection/ProductCollectionFromFormState.d.ts +5 -0
  38. package/lib/factories/ProductCollection/ProductCollectionFromFormState.js +29 -0
  39. package/lib/factories/User/UserFactory.d.ts +1 -1
  40. package/lib/factories/User/UserFromFormState.d.ts +1 -1
  41. package/lib/{models/FormStates → form-states}/Address/AddressFormState.d.ts +0 -0
  42. package/lib/{models/FormStates → form-states}/Address/AddressFormState.js +1 -3
  43. package/lib/{models/FormStates → form-states}/FormState.d.ts +1 -1
  44. package/lib/{models/FormStates → form-states}/FormState.js +1 -1
  45. package/lib/{models/FormStates → form-states}/Merchant/MerchantFormState.d.ts +1 -1
  46. package/lib/{models/FormStates → form-states}/Merchant/MerchantFormState.js +19 -4
  47. package/lib/form-states/Merchant/WebhookFormState.d.ts +8 -0
  48. package/lib/form-states/Merchant/WebhookFormState.js +49 -0
  49. package/lib/{models/FormStates → form-states}/Merchant/options.d.ts +8 -0
  50. package/lib/{models/FormStates → form-states}/Merchant/options.js +15 -2
  51. package/lib/{models/FormStates → form-states}/Order/OrderFormState.d.ts +2 -2
  52. package/lib/{models/FormStates → form-states}/Order/OrderFormState.js +12 -13
  53. package/lib/form-states/Order/RefundFormState.d.ts +17 -0
  54. package/lib/form-states/Order/RefundFormState.js +122 -0
  55. package/lib/{models/FormStates → form-states}/Order/options.d.ts +0 -0
  56. package/lib/{models/FormStates → form-states}/Order/options.js +1 -1
  57. package/lib/{models/FormStates → form-states}/PayoutAccount/PayoutAccountFormState.d.ts +1 -1
  58. package/lib/{models/FormStates → form-states}/PayoutAccount/PayoutAccountFormState.js +2 -2
  59. package/lib/{models/FormStates → form-states}/PayoutAccount/options.d.ts +0 -0
  60. package/lib/{models/FormStates → form-states}/PayoutAccount/options.js +0 -0
  61. package/lib/{models/FormStates → form-states}/PickUp/PickUpFormState.d.ts +0 -0
  62. package/lib/{models/FormStates → form-states}/PickUp/PickUpFormState.js +0 -0
  63. package/lib/{models/FormStates → form-states}/Product/ProductFormState.d.ts +8 -2
  64. package/lib/{models/FormStates → form-states}/Product/ProductFormState.js +24 -4
  65. package/lib/{models/FormStates → form-states}/Product/options.d.ts +0 -0
  66. package/lib/form-states/Product/options.js +3455 -0
  67. package/lib/form-states/ProductCollection/ProductCollectionFormState.d.ts +12 -0
  68. package/lib/form-states/ProductCollection/ProductCollectionFormState.js +80 -0
  69. package/lib/{models/FormStates → form-states}/SellRequest/SellRequestFormState.d.ts +0 -0
  70. package/lib/{models/FormStates → form-states}/SellRequest/SellRequestFormState.js +1 -1
  71. package/lib/{models/FormStates → form-states}/User/UserFormState.d.ts +1 -1
  72. package/lib/{models/FormStates → form-states}/User/UserFormState.js +2 -2
  73. package/lib/helpers/AnalyticsHelpers.js +3 -3
  74. package/lib/helpers/OrderHelpers.d.ts +5 -0
  75. package/lib/helpers/OrderHelpers.js +107 -0
  76. package/lib/helpers/ProductCollectionHelpers.d.ts +4 -0
  77. package/lib/helpers/ProductCollectionHelpers.js +27 -0
  78. package/lib/helpers/ReRobeProductHelpers.d.ts +6 -0
  79. package/lib/helpers/ReRobeProductHelpers.js +221 -41
  80. package/lib/helpers/Utilities.d.ts +1 -0
  81. package/lib/helpers/Utilities.js +10 -0
  82. package/lib/index.d.ts +7 -3
  83. package/lib/index.js +11 -3
  84. package/lib/models/Merchant.d.ts +16 -0
  85. package/lib/models/Merchant.js +40 -0
  86. package/lib/models/Order.d.ts +4 -0
  87. package/lib/models/Order.js +7 -1
  88. package/lib/models/Product.d.ts +1 -0
  89. package/lib/models/Product.js +37 -3
  90. package/lib/models/ProductCollection.d.ts +15 -0
  91. package/lib/models/ProductCollection.js +34 -0
  92. package/lib/models/Refund.d.ts +13 -0
  93. package/lib/models/Refund.js +40 -0
  94. package/lib/models/User.js +7 -2
  95. package/lib/types/merchant-types.d.ts +46 -13
  96. package/lib/types/product-collection-types.d.ts +63 -0
  97. package/lib/types/product-collection-types.js +13 -0
  98. package/lib/types/rerobe-order-types.d.ts +88 -26
  99. package/lib/types/rerobe-product-types.d.ts +30 -0
  100. package/lib/types/rerobe-user-types.d.ts +27 -21
  101. package/lib/types/rerobe-user-types.js +0 -1
  102. package/package.json +3 -2
  103. package/lib/models/FormStates/Product/options.js +0 -3453
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const FormState_1 = require("../FormState");
4
4
  const options_1 = require("./options");
5
- const Product_1 = require("../../../models/Product");
6
- const ProductFromFormState_1 = require("../../../factories/Product/ProductFromFormState");
5
+ const Product_1 = require("../../models/Product");
6
+ const ProductFromFormState_1 = require("../../factories/Product/ProductFromFormState");
7
7
  class ProductFormState extends FormState_1.default {
8
- constructor(props) {
8
+ constructor(props, opts) {
9
9
  super();
10
10
  this.props = new Product_1.default(props).toObj();
11
+ this.opts = opts;
11
12
  // ProductAttributesFormFields
12
13
  this.fields.availableForSale = this.fieldFactory('singleSelect', 'availableForSale', options_1.availableForSaleOptions);
13
14
  this.fields.description = this.fieldFactory('textInput', 'description');
@@ -68,6 +69,10 @@ class ProductFormState extends FormState_1.default {
68
69
  this.fields.editorAuthorizations = this.fieldFactory('singleSelect', 'editorAuthorizations', Object.keys(new Product_1.default().toObj()).map((v) => ({ label: this.utilities.startCase(v), value: v })));
69
70
  this.fields.vendorId = this.fieldFactory('singleSelect', 'vendorId');
70
71
  this.fields.vendorName = this.fieldFactory('singleSelect', 'vendorName');
72
+ this.fields.rfidTag = this.fieldFactory('textInput', 'rfidTag');
73
+ this.fields.locationIds = this.fieldFactory('multiSelect', 'locationIds');
74
+ this.fields.featuredCollections = this.fieldFactory('multiSelect', 'featuredCollections');
75
+ this.fields.tags = this.fieldFactory('multiSelect', 'tags');
71
76
  }
72
77
  autoCreateTitle() {
73
78
  return this.createProduct().autoCreateTitle();
@@ -505,6 +510,21 @@ class ProductFormState extends FormState_1.default {
505
510
  }
506
511
  hidden = this.props.productStyle.length < 1;
507
512
  }
513
+ if (fieldKey === 'tags') {
514
+ if (this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length > 0) {
515
+ this.props.tags.forEach((tag) => {
516
+ if (!options.map((o) => o.value).includes(tag)) {
517
+ options.splice(0, 0, { label: tag, value: tag });
518
+ }
519
+ });
520
+ }
521
+ hidden = Boolean(this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length < 1);
522
+ }
523
+ if (fieldKey === 'featuredCollections') {
524
+ if (this.opts && this.opts.featuredCollectionOpts && this.opts.featuredCollectionOpts.length > 0) {
525
+ options = this.utilities.uniqObjArray([...options, ...this.opts.featuredCollectionOpts.map((o) => ({ label: o.label, value: o.value }))], 'value');
526
+ }
527
+ }
508
528
  if (fieldKey === 'clothingSize') {
509
529
  if (this.props.gender === 'Woman') {
510
530
  options = [
@@ -604,7 +624,7 @@ class ProductFormState extends FormState_1.default {
604
624
  onChangeHandler = (val) => this.priceInputChangeHandler(val);
605
625
  }
606
626
  if (fieldKey === 'reRobeCommission') {
607
- inputValue = this.props[fieldKey] || '0.35';
627
+ inputValue = this.props[fieldKey] || '0.5';
608
628
  valid = true;
609
629
  }
610
630
  if (fieldKey === 'discountValue') {