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.
- package/lib/factories/FormState/Address/AddressFormStateFactory.d.ts +1 -1
- package/lib/factories/FormState/Address/AddressFormStateFactory.js +1 -1
- package/lib/factories/FormState/Merchant/MerchantFormStateFactory.d.ts +1 -1
- package/lib/factories/FormState/Merchant/MerchantFormStateFactory.js +1 -1
- package/lib/factories/FormState/Order/OrderFormStateFactory.d.ts +1 -1
- package/lib/factories/FormState/Order/OrderFormStateFactory.js +1 -1
- package/lib/factories/FormState/Order/RefundFormStateFactory.d.ts +5 -0
- package/lib/factories/FormState/Order/RefundFormStateFactory.js +10 -0
- package/lib/factories/FormState/PickUp/PickUpFormStateFactory.d.ts +1 -1
- package/lib/factories/FormState/PickUp/PickUpFormStateFactory.js +1 -1
- package/lib/factories/FormState/Product/ProductFormStateFactory.d.ts +2 -2
- package/lib/factories/FormState/Product/ProductFormStateFactory.js +3 -3
- package/lib/factories/FormState/ProductCollection/ProductCollectionFormStateFactory.d.ts +5 -0
- package/lib/factories/FormState/ProductCollection/ProductCollectionFormStateFactory.js +10 -0
- package/lib/factories/FormState/SellRequest/SellRequestFormStateFactory.d.ts +1 -1
- package/lib/factories/FormState/SellRequest/SellRequestFormStateFactory.js +1 -1
- package/lib/factories/FormState/User/UserFormStateFactory.d.ts +1 -1
- package/lib/factories/FormState/User/UserFormStateFactory.js +1 -1
- package/lib/factories/Merchant/MerchantFactory.d.ts +1 -1
- package/lib/factories/Merchant/MerchantFromFormState.d.ts +1 -1
- package/lib/factories/Merchant/MerchantFromFormState.js +13 -1
- package/lib/factories/Order/OrderFactory.d.ts +1 -1
- package/lib/factories/Order/OrderFromApp.js +4 -2
- package/lib/factories/Order/OrderFromFormState.d.ts +1 -1
- package/lib/factories/Order/OrderFromFormState.js +17 -15
- package/lib/factories/Order/OrderFromShopifyWebhook.js +126 -10
- package/lib/factories/Order/RefundFactory.d.ts +5 -0
- package/lib/factories/Order/RefundFactory.js +6 -0
- package/lib/factories/Order/RefundFromFormState.d.ts +5 -0
- package/lib/factories/Order/RefundFromFormState.js +29 -0
- package/lib/factories/PayoutAccount/PayoutAccountFromFormState.d.ts +1 -1
- package/lib/factories/Product/ProductFactory.d.ts +1 -1
- package/lib/factories/Product/ProductFromFormState.d.ts +1 -1
- package/lib/factories/Product/ProductFromFormState.js +29 -3
- 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 +29 -0
- package/lib/factories/User/UserFactory.d.ts +1 -1
- package/lib/factories/User/UserFromFormState.d.ts +1 -1
- package/lib/{models/FormStates → form-states}/Address/AddressFormState.d.ts +0 -0
- package/lib/{models/FormStates → form-states}/Address/AddressFormState.js +1 -3
- package/lib/{models/FormStates → form-states}/FormState.d.ts +1 -1
- package/lib/{models/FormStates → form-states}/FormState.js +1 -1
- package/lib/{models/FormStates → form-states}/Merchant/MerchantFormState.d.ts +1 -1
- package/lib/{models/FormStates → form-states}/Merchant/MerchantFormState.js +19 -4
- package/lib/form-states/Merchant/WebhookFormState.d.ts +8 -0
- package/lib/form-states/Merchant/WebhookFormState.js +49 -0
- package/lib/{models/FormStates → form-states}/Merchant/options.d.ts +8 -0
- package/lib/{models/FormStates → form-states}/Merchant/options.js +15 -2
- package/lib/{models/FormStates → form-states}/Order/OrderFormState.d.ts +2 -2
- package/lib/{models/FormStates → form-states}/Order/OrderFormState.js +12 -13
- package/lib/form-states/Order/RefundFormState.d.ts +17 -0
- package/lib/form-states/Order/RefundFormState.js +122 -0
- package/lib/{models/FormStates → form-states}/Order/options.d.ts +0 -0
- package/lib/{models/FormStates → form-states}/Order/options.js +1 -1
- package/lib/{models/FormStates → form-states}/PayoutAccount/PayoutAccountFormState.d.ts +1 -1
- package/lib/{models/FormStates → form-states}/PayoutAccount/PayoutAccountFormState.js +2 -2
- package/lib/{models/FormStates → form-states}/PayoutAccount/options.d.ts +0 -0
- package/lib/{models/FormStates → form-states}/PayoutAccount/options.js +0 -0
- package/lib/{models/FormStates → form-states}/PickUp/PickUpFormState.d.ts +0 -0
- package/lib/{models/FormStates → form-states}/PickUp/PickUpFormState.js +0 -0
- package/lib/{models/FormStates → form-states}/Product/ProductFormState.d.ts +8 -2
- package/lib/{models/FormStates → form-states}/Product/ProductFormState.js +24 -4
- package/lib/{models/FormStates → form-states}/Product/options.d.ts +0 -0
- package/lib/form-states/Product/options.js +3455 -0
- package/lib/form-states/ProductCollection/ProductCollectionFormState.d.ts +12 -0
- package/lib/form-states/ProductCollection/ProductCollectionFormState.js +80 -0
- package/lib/{models/FormStates → form-states}/SellRequest/SellRequestFormState.d.ts +0 -0
- package/lib/{models/FormStates → form-states}/SellRequest/SellRequestFormState.js +1 -1
- package/lib/{models/FormStates → form-states}/User/UserFormState.d.ts +1 -1
- package/lib/{models/FormStates → form-states}/User/UserFormState.js +2 -2
- package/lib/helpers/AnalyticsHelpers.js +3 -3
- package/lib/helpers/OrderHelpers.d.ts +5 -0
- package/lib/helpers/OrderHelpers.js +107 -0
- package/lib/helpers/ProductCollectionHelpers.d.ts +4 -0
- package/lib/helpers/ProductCollectionHelpers.js +27 -0
- package/lib/helpers/ReRobeProductHelpers.d.ts +6 -0
- package/lib/helpers/ReRobeProductHelpers.js +221 -41
- package/lib/helpers/Utilities.d.ts +1 -0
- package/lib/helpers/Utilities.js +10 -0
- package/lib/index.d.ts +7 -3
- package/lib/index.js +11 -3
- package/lib/models/Merchant.d.ts +16 -0
- package/lib/models/Merchant.js +40 -0
- package/lib/models/Order.d.ts +4 -0
- package/lib/models/Order.js +7 -1
- package/lib/models/Product.d.ts +1 -0
- package/lib/models/Product.js +37 -3
- package/lib/models/ProductCollection.d.ts +15 -0
- package/lib/models/ProductCollection.js +34 -0
- package/lib/models/Refund.d.ts +13 -0
- package/lib/models/Refund.js +40 -0
- package/lib/models/User.js +7 -2
- package/lib/types/merchant-types.d.ts +46 -13
- package/lib/types/product-collection-types.d.ts +63 -0
- package/lib/types/product-collection-types.js +13 -0
- package/lib/types/rerobe-order-types.d.ts +88 -26
- package/lib/types/rerobe-product-types.d.ts +30 -0
- package/lib/types/rerobe-user-types.d.ts +27 -21
- package/lib/types/rerobe-user-types.js +0 -1
- package/package.json +3 -2
- 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("
|
|
6
|
-
const ProductFromFormState_1 = require("
|
|
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.
|
|
627
|
+
inputValue = this.props[fieldKey] || '0.5';
|
|
608
628
|
valid = true;
|
|
609
629
|
}
|
|
610
630
|
if (fieldKey === 'discountValue') {
|
|
File without changes
|