rerobe-js-orm 2.4.91 → 2.4.94

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.
@@ -18,6 +18,7 @@ export default class ProductFormState extends FormState {
18
18
  autoCreateDescription(): string;
19
19
  createProduct(): Product;
20
20
  private priceInputChangeHandler;
21
+ private setGenderFromPassedOptions;
21
22
  private genderSelectHandler;
22
23
  private conditionSelectHandler;
23
24
  private productCategorySelectHandler;
@@ -96,6 +96,12 @@ class ProductFormState extends FormState_1.default {
96
96
  // Recalculates salePrice
97
97
  this.props.salePrice = this.calculateSalePrice();
98
98
  }
99
+ setGenderFromPassedOptions() {
100
+ if (this.opts && this.opts.taxonomy && Object.keys(this.opts.taxonomy).length > 0) {
101
+ return Object.keys(this.opts.taxonomy).map((t) => ({ label: t, value: t }));
102
+ }
103
+ return options_1.gender;
104
+ }
99
105
  genderSelectHandler(value) {
100
106
  // Mutate gender selectedValue and valid prop
101
107
  this.fields.gender.selectedValue = value;
@@ -285,7 +291,9 @@ class ProductFormState extends FormState_1.default {
285
291
  else {
286
292
  productCategoryOptions = options_1.productCategories;
287
293
  }
288
- const selectedCategoryOptions = this.props.productCategory ? [{ label: this.props.productCategory, value: this.props.productCategory }] : [];
294
+ const selectedCategoryOptions = this.props.productCategory
295
+ ? [{ label: this.props.productCategory, value: this.props.productCategory }]
296
+ : [];
289
297
  const options = this.utilities.uniqObjArray([...productCategoryOptions, ...selectedCategoryOptions], 'value');
290
298
  return options;
291
299
  }
@@ -500,6 +508,20 @@ class ProductFormState extends FormState_1.default {
500
508
  if (fieldKey === 'materialComposition') {
501
509
  selectedValue = this.props[fieldKey] || {};
502
510
  valid = Object.keys(this.props[fieldKey]).length > 0;
511
+ // Mutate materialComposition options with passed in material obj
512
+ if (this.props.materialComposition && Object.keys(this.props.materialComposition).length > 0) {
513
+ if (!options.map((o) => o.key).every((v) => Object.keys(this.props.materialComposition).includes(v))) {
514
+ Object.keys(this.props.materialComposition).forEach((o) => {
515
+ if (!options.map((opt) => opt.key).includes(this.utilities.camelCase(o))) {
516
+ options.splice(0, 0, {
517
+ label: this.utilities.startCase(o),
518
+ value: this.utilities.startCase(o),
519
+ key: this.utilities.camelCase(o),
520
+ });
521
+ }
522
+ });
523
+ }
524
+ }
503
525
  }
504
526
  if (fieldKey === 'editorAuthorizations') {
505
527
  selectedValue = this.props[fieldKey] || {};
@@ -514,6 +536,7 @@ class ProductFormState extends FormState_1.default {
514
536
  valid = Object.keys(this.props[fieldKey]).length > 0;
515
537
  }
516
538
  if (fieldKey === 'gender') {
539
+ options = this.setGenderFromPassedOptions();
517
540
  onChangeHandler = (val) => this.genderSelectHandler(val);
518
541
  }
519
542
  if (fieldKey === 'productCategory') {
@@ -5,6 +5,7 @@ export default class ProductStateManager extends Base {
5
5
  sellRequestReviewDraft: string;
6
6
  rejected: string;
7
7
  hold: string;
8
+ draft: string;
8
9
  accepted: string;
9
10
  sellerToDropOff: string;
10
11
  sellerToShip: string;
@@ -351,6 +351,7 @@ ProductStateManager.PRODUCT_STATES = {
351
351
  sellRequestReviewDraft: 'SELL_REQUEST_REVIEW_DRAFT',
352
352
  rejected: 'REJECTED',
353
353
  hold: 'HOLD',
354
+ draft: 'DRAFT',
354
355
  accepted: 'ACCEPTED',
355
356
  sellerToDropOff: 'DROP_OFF_AT_REROBE',
356
357
  sellerToShip: 'SHIP_TO_REROBE',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.4.91",
3
+ "version": "2.4.94",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",