rerobe-js-orm 2.7.17 → 2.7.18

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.
@@ -4,7 +4,7 @@ const UserFactory_1 = require("./UserFactory");
4
4
  const User_1 = require("../../models/User");
5
5
  class UserFromFormState extends UserFactory_1.default {
6
6
  createUser(props) {
7
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
8
8
  const userAttributes = {
9
9
  documentId: ((_a = props.props) === null || _a === void 0 ? void 0 : _a.documentId) || '',
10
10
  uid: ((_b = props.props) === null || _b === void 0 ? void 0 : _b.uid) || '',
@@ -73,6 +73,7 @@ class UserFromFormState extends UserFactory_1.default {
73
73
  itemSoldPct: ((_4 = props.props) === null || _4 === void 0 ? void 0 : _4.itemSoldPct) || 0,
74
74
  lastOrderDate: ((_5 = props.props) === null || _5 === void 0 ? void 0 : _5.lastOrderDate) || '',
75
75
  lastUploadDate: ((_6 = props.props) === null || _6 === void 0 ? void 0 : _6.lastUploadDate) || '',
76
+ registrationSource: ((_7 = props.props) === null || _7 === void 0 ? void 0 : _7.registrationSource) || '',
76
77
  };
77
78
  return new User_1.default(Object.assign({}, userAttributes));
78
79
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class AnalyticsHelpers {
4
4
  // Trait object for analytics.identify (https://segment.com/docs/connections/spec/identify/)
5
5
  static createIdentifyPayloadForSegment(userProps) {
6
- const { firstName, lastName, email, phone, documentId, createdAt, updatedAt, addresses, title, isSeller, ordersCount, amountSpent, itemsUploadedCount, lastOrderDate, inventoryValue, inventoryCount, itemsSoldCount, itemsSoldValue, itemRejectionPct, itemSoldPct, lastUploadDate, } = userProps;
6
+ const { firstName, lastName, email, phone, documentId, createdAt, updatedAt, addresses, title, isSeller, ordersCount = 0, amountSpent = 0, itemsUploadedCount = 0, lastOrderDate, inventoryValue = 0, inventoryCount = 0, itemsSoldCount = 0, itemsSoldValue = 0, itemRejectionPct, itemSoldPct, lastUploadDate, availableCredit, registrationSource = '', } = userProps;
7
7
  // Step 1. Get all reserved traits (https://segment.com/docs/connections/spec/identify/#traits)
8
8
  const reservedTraitsObj = {
9
9
  firstName,
@@ -30,6 +30,8 @@ class AnalyticsHelpers {
30
30
  itemSoldPct,
31
31
  lastOrderDate,
32
32
  lastUploadDate,
33
+ availableCredit,
34
+ registrationSource,
33
35
  };
34
36
  return {
35
37
  userId: documentId || '',
@@ -45,6 +45,7 @@ export default class User extends Base {
45
45
  itemSoldPct: number;
46
46
  lastOrderDate: string;
47
47
  lastUploadDate: string;
48
+ registrationSource: string;
48
49
  constructor(props?: any);
49
50
  toObj(): UserAttributes;
50
51
  toCustomerUpdateInputObjForShopify(): any;
@@ -65,6 +65,7 @@ class User extends Base_1.default {
65
65
  this.itemSoldPct = (props === null || props === void 0 ? void 0 : props.itemSoldPct) || 0;
66
66
  this.lastOrderDate = (props === null || props === void 0 ? void 0 : props.lastOrderDate) || '';
67
67
  this.lastUploadDate = (props === null || props === void 0 ? void 0 : props.lastUploadDate) || '';
68
+ this.registrationSource = (props === null || props === void 0 ? void 0 : props.registrationSource) || '';
68
69
  }
69
70
  toObj() {
70
71
  return {
@@ -110,6 +111,7 @@ class User extends Base_1.default {
110
111
  itemSoldPct: this.itemSoldPct,
111
112
  lastOrderDate: this.lastOrderDate,
112
113
  lastUploadDate: this.lastUploadDate,
114
+ registrationSource: this.registrationSource,
113
115
  };
114
116
  }
115
117
  toCustomerUpdateInputObjForShopify() {
@@ -188,6 +190,7 @@ class User extends Base_1.default {
188
190
  itemSoldPct: this.itemSoldPct,
189
191
  lastOrderDate: this.lastOrderDate,
190
192
  lastUploadDate: this.lastUploadDate,
193
+ registrationSource: this.registrationSource,
191
194
  };
192
195
  return customerInput;
193
196
  }
@@ -300,6 +303,16 @@ class User extends Base_1.default {
300
303
  name: 'lastUploadTimestamp',
301
304
  type: 'int64',
302
305
  },
306
+ {
307
+ facet: true,
308
+ name: 'availableCredit',
309
+ type: 'float',
310
+ },
311
+ {
312
+ facet: true,
313
+ name: 'registrationSource',
314
+ type: 'string',
315
+ },
303
316
  ],
304
317
  name: 'prod_customers_20220907',
305
318
  };
@@ -327,6 +340,8 @@ class User extends Base_1.default {
327
340
  itemSoldPct: this.utilities.sanitizeNumber(this.itemSoldPct),
328
341
  lastOrderTimestamp: this.utilities.sanitizeMillisTimeStamp(new Date(this.lastOrderDate).getTime()),
329
342
  lastUploadTimestamp: this.utilities.sanitizeMillisTimeStamp(new Date(this.lastUploadDate).getTime()),
343
+ availableCredit: this.utilities.sanitizeNumber(this.availableCredit),
344
+ registrationSource: this.utilities.sanitizeString(this.registrationSource),
330
345
  };
331
346
  return stagedObj;
332
347
  }
@@ -41,6 +41,7 @@ interface UserAttributes extends ReRobeDocument {
41
41
  itemSoldPct?: number;
42
42
  lastOrderDate?: string;
43
43
  lastUploadDate?: string;
44
+ registrationSource?: string;
44
45
  }
45
46
  declare type RibbnCustomerObj = {
46
47
  uid?: string;
@@ -76,6 +77,7 @@ declare type RibbnCustomerObj = {
76
77
  itemSoldPct?: number;
77
78
  lastOrderDate?: string;
78
79
  lastUploadDate?: string;
80
+ registrationSource?: string;
79
81
  };
80
82
  declare type UserObjForAuthTemplateMethod = {
81
83
  authUserProfile: UserFromShopifyGraphQLResp;
@@ -169,4 +171,6 @@ declare type TypesenseUserObj = {
169
171
  itemSoldPct: number;
170
172
  lastOrderTimestamp: number;
171
173
  lastUploadTimestamp: number;
174
+ availableCredit: number;
175
+ registrationSource: string;
172
176
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.7.17",
3
+ "version": "2.7.18",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",