rerobe-js-orm 2.6.99 → 2.7.11

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.
@@ -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 } = userProps;
6
+ const { firstName, lastName, email, phone, documentId, createdAt, updatedAt, addresses, title, isSeller, ordersCount, amountSpent, } = userProps;
7
7
  // Step 1. Get all reserved traits (https://segment.com/docs/connections/spec/identify/#traits)
8
8
  const reservedTraitsObj = {
9
9
  firstName,
@@ -19,6 +19,8 @@ class AnalyticsHelpers {
19
19
  const traitsObj = {
20
20
  updatedAt: prepareCreatedOrUpdatedAt(updatedAt),
21
21
  isSeller,
22
+ ordersCount,
23
+ amountSpent,
22
24
  };
23
25
  return {
24
26
  userId: documentId || '',
@@ -52,7 +52,7 @@ class ChatRoom extends Base_1.default {
52
52
  type: 'string[]',
53
53
  },
54
54
  {
55
- facet: false,
55
+ facet: true,
56
56
  name: 'userIdsToBeNotified',
57
57
  type: 'string[]',
58
58
  },
@@ -305,7 +305,9 @@ class Order extends Base_1.default {
305
305
  };
306
306
  }
307
307
  toObjForTypesense() {
308
- var _a;
308
+ const image = this.lineItems && this.lineItems[0] && this.lineItems[0].image && this.lineItems[0].image.originalSrc
309
+ ? this.lineItems[0].image.originalSrc
310
+ : 'https://res.cloudinary.com/ribbn/image/fetch/e_blur:1000,o_20,q_50/https://cdn.shopify.com/s/files/1/0261/9686/9172/products/7AC16810-F519-4665-8891-7163EB29FBB7_1000x1000.jpg%3Fv%3D1634827512';
309
311
  const stagedObj = {
310
312
  id: this.utilities.sanitizeString(this.documentId),
311
313
  documentId: this.utilities.sanitizeString(this.documentId),
@@ -313,11 +315,11 @@ class Order extends Base_1.default {
313
315
  createdAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp),
314
316
  updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.updatedAtTimestamp),
315
317
  merchantId: this.utilities.sanitizeString(this.merchantId),
316
- image: this.utilities.sanitizeString((_a = this.lineItems[0].image) === null || _a === void 0 ? void 0 : _a.originalSrc),
318
+ image: this.utilities.sanitizeString(image),
317
319
  orderNumber: this.utilities.sanitizeNumber(this.orderNumber),
318
320
  customerName: this.utilities.sanitizeString(this.customerName),
319
321
  customerEmail: this.utilities.sanitizeString(this.email),
320
- totalPrice: this.utilities.sanitizeNumber(this.totalPrice.amount),
322
+ totalPrice: this.utilities.sanitizeNumber(Number(this.totalPrice.amount) - Number(this.totalRefunded.amount)),
321
323
  state: this.utilities.sanitizeString(this.state),
322
324
  financialStatus: this.utilities.sanitizeString(this.financialStatus),
323
325
  fulfillmentStatus: this.utilities.sanitizeString(this.fulfillmentStatus),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.6.99",
3
+ "version": "2.7.11",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",