rerobe-js-orm 2.4.72 → 2.4.76

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.
@@ -1,5 +1,5 @@
1
1
  import FormStateFactory from '../FormStateFactory';
2
2
  import ProductFormState from '../../../form-states/Product/ProductFormState';
3
3
  export default class ProductFormStateFactory extends FormStateFactory {
4
- createFormState(props?: CompleteProduct): ProductFormState;
4
+ createFormState(props?: CompleteProduct, opts?: any): ProductFormState;
5
5
  }
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const FormStateFactory_1 = require("../FormStateFactory");
4
4
  const ProductFormState_1 = require("../../../form-states/Product/ProductFormState");
5
5
  class ProductFormStateFactory extends FormStateFactory_1.default {
6
- createFormState(props) {
7
- return new ProductFormState_1.default(props);
6
+ createFormState(props, opts) {
7
+ return new ProductFormState_1.default(props, opts);
8
8
  }
9
9
  }
10
10
  exports.default = ProductFormStateFactory;
@@ -3,7 +3,13 @@ import Product from '../../models/Product';
3
3
  export default class ProductFormState extends FormState {
4
4
  fields: ProductFormFields;
5
5
  props: CompleteProduct;
6
- constructor(props?: any);
6
+ opts: {
7
+ featuredCollectionOpts: {
8
+ label: string;
9
+ value: string;
10
+ }[];
11
+ };
12
+ constructor(props?: any, opts?: any);
7
13
  autoCreateTitle(): string;
8
14
  autoCreateDescription(): string;
9
15
  createProduct(): Product;
@@ -5,9 +5,10 @@ const options_1 = require("./options");
5
5
  const Product_1 = require("../../models/Product");
6
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');
@@ -519,6 +520,11 @@ class ProductFormState extends FormState_1.default {
519
520
  }
520
521
  hidden = Boolean(this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length < 1);
521
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
+ }
522
528
  if (fieldKey === 'clothingSize') {
523
529
  if (this.props.gender === 'Woman') {
524
530
  options = [
@@ -133,6 +133,7 @@ class User extends Base_1.default {
133
133
  toCustomerInputObjForRibbn() {
134
134
  const customerInput = {
135
135
  uid: this.uid,
136
+ gid: this.gid,
136
137
  firstName: this.firstName,
137
138
  lastName: this.lastName,
138
139
  displayName: this.displayName,
@@ -150,6 +151,10 @@ class User extends Base_1.default {
150
151
  ordersCount: this.ordersCount,
151
152
  amountSpent: this.amountSpent,
152
153
  emailVerified: this.emailVerified,
154
+ isSeller: this.isSeller,
155
+ devicePlatform: this.devicePlatform,
156
+ lastLogin: this.lastLogin,
157
+ referralCode: this.referralCode,
153
158
  };
154
159
  return customerInput;
155
160
  }
@@ -31,6 +31,32 @@ interface UserAttributes extends ReRobeDocument {
31
31
  lastLogin?: string;
32
32
  emailVerified: boolean;
33
33
  }
34
+ declare type RibbnCustomerObj = {
35
+ uid?: string;
36
+ gid?: string;
37
+ firstName: string;
38
+ lastName: string;
39
+ displayName?: string;
40
+ email: string;
41
+ phone?: string;
42
+ addresses?: UserAddress;
43
+ availableCredit?: number;
44
+ createdAt?: string;
45
+ updatedAt?: string;
46
+ shoppingSessionId?: string;
47
+ savedItems?: string[];
48
+ shoppingBag?: string[];
49
+ avatarUrl?: string | null;
50
+ tags?: string[];
51
+ notes?: string;
52
+ ordersCount?: number;
53
+ amountSpent?: number;
54
+ emailVerified: boolean;
55
+ isSeller?: boolean;
56
+ devicePlatform?: string;
57
+ lastLogin?: string;
58
+ referralCode?: string;
59
+ };
34
60
  declare type UserObjForAuthTemplateMethod = {
35
61
  authUserProfile: UserFromShopifyGraphQLResp;
36
62
  prevUserProfile: UserAttributes | undefined;
@@ -101,23 +127,3 @@ declare type UserRespFromShopifyWebhook = {
101
127
  phone?: string;
102
128
  addresses: AddressInput[];
103
129
  };
104
- declare type RibbnCustomerObj = {
105
- uid?: string;
106
- firstName: string;
107
- lastName: string;
108
- displayName?: string;
109
- email: string;
110
- phone?: string;
111
- addresses?: UserAddress;
112
- availableCredit?: number;
113
- createdAt?: string;
114
- shoppingSessionId?: string;
115
- savedItems?: string[];
116
- shoppingBag?: string[];
117
- avatarUrl?: string | null;
118
- tags?: string[];
119
- notes?: string;
120
- ordersCount?: number;
121
- amountSpent?: number;
122
- emailVerified: boolean;
123
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.4.72",
3
+ "version": "2.4.76",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",