rerobe-js-orm 2.4.92 → 2.4.95

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.
@@ -91,6 +91,12 @@ class OrderFormState extends FormState_1.default {
91
91
  const hidden = false;
92
92
  if (fieldType === 'textInput') {
93
93
  let inputValue = this.props[fieldKey] || '';
94
+ if (fieldKey === 'firstName') {
95
+ inputValue = this.props.name ? this.props.name.split(' ')[0] : '';
96
+ }
97
+ if (fieldKey === 'lastName') {
98
+ inputValue = this.props.name && this.props.name.split(' ').length > 1 ? this.props.name.split(' ')[1] : '';
99
+ }
94
100
  if (fieldKey === 'subtotalPrice' ||
95
101
  fieldKey === 'totalPrice' ||
96
102
  fieldKey === 'totalDiscount' ||
@@ -97,9 +97,7 @@ class ProductFormState extends FormState_1.default {
97
97
  this.props.salePrice = this.calculateSalePrice();
98
98
  }
99
99
  setGenderFromPassedOptions() {
100
- if (this.opts &&
101
- this.opts.taxonomy &&
102
- Object.keys(this.opts.taxonomy).length > 0) {
100
+ if (this.opts && this.opts.taxonomy && Object.keys(this.opts.taxonomy).length > 0) {
103
101
  return Object.keys(this.opts.taxonomy).map((t) => ({ label: t, value: t }));
104
102
  }
105
103
  return options_1.gender;
@@ -293,7 +291,9 @@ class ProductFormState extends FormState_1.default {
293
291
  else {
294
292
  productCategoryOptions = options_1.productCategories;
295
293
  }
296
- 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
+ : [];
297
297
  const options = this.utilities.uniqObjArray([...productCategoryOptions, ...selectedCategoryOptions], 'value');
298
298
  return options;
299
299
  }
@@ -508,6 +508,20 @@ class ProductFormState extends FormState_1.default {
508
508
  if (fieldKey === 'materialComposition') {
509
509
  selectedValue = this.props[fieldKey] || {};
510
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
+ }
511
525
  }
512
526
  if (fieldKey === 'editorAuthorizations') {
513
527
  selectedValue = this.props[fieldKey] || {};
@@ -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.92",
3
+ "version": "2.4.95",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",