rerobe-js-orm 4.6.9 → 4.7.1
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.
package/lib/models/Order.d.ts
CHANGED
package/lib/models/Order.js
CHANGED
|
@@ -346,6 +346,12 @@ class Order extends Base_1.default {
|
|
|
346
346
|
name: 'productIds',
|
|
347
347
|
type: 'string[]',
|
|
348
348
|
},
|
|
349
|
+
{
|
|
350
|
+
facet: true,
|
|
351
|
+
name: 'productSkus',
|
|
352
|
+
type: 'string[]',
|
|
353
|
+
optional: true,
|
|
354
|
+
},
|
|
349
355
|
{
|
|
350
356
|
facet: true,
|
|
351
357
|
name: 'tags',
|
|
@@ -394,7 +400,7 @@ class Order extends Base_1.default {
|
|
|
394
400
|
name: 'dev_orders_20220809',
|
|
395
401
|
};
|
|
396
402
|
}
|
|
397
|
-
toObjForTypesense() {
|
|
403
|
+
toObjForTypesense(productSkus) {
|
|
398
404
|
const image = this.lineItems && this.lineItems[0] && this.lineItems[0].image && this.lineItems[0].image.originalSrc
|
|
399
405
|
? this.lineItems[0].image.originalSrc
|
|
400
406
|
: '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';
|
|
@@ -424,6 +430,7 @@ class Order extends Base_1.default {
|
|
|
424
430
|
paymentType: this.utilities.sanitizeString(this.paymentType),
|
|
425
431
|
shippingType: this.utilities.sanitizeString(this.shippingType),
|
|
426
432
|
productIds: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.productId)),
|
|
433
|
+
productSkus: productSkus ? this.utilities.sanitzeStringArr(productSkus) : undefined,
|
|
427
434
|
productTitles: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.title)),
|
|
428
435
|
productBrands: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.brand)),
|
|
429
436
|
tags: this.utilities.sanitzeStringArr(this.tags),
|
|
@@ -439,15 +446,29 @@ class Order extends Base_1.default {
|
|
|
439
446
|
return num.toFixed(2);
|
|
440
447
|
};
|
|
441
448
|
const lineItems = (this.lineItems || []).map((item) => {
|
|
442
|
-
var _a, _b;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
(
|
|
447
|
-
item.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
var _a, _b, _c, _d;
|
|
450
|
+
const shopifyVariantId = item.shopifyVariantId || ((_a = item.variant) === null || _a === void 0 ? void 0 : _a.shopifyId) || item.shopifyProductId || ((_b = item.variant) === null || _b === void 0 ? void 0 : _b.id);
|
|
451
|
+
if (shopifyVariantId)
|
|
452
|
+
return {
|
|
453
|
+
quantity: Number(item.quantity || 1),
|
|
454
|
+
variantId: item.shopifyVariantId ||
|
|
455
|
+
((_c = item.variant) === null || _c === void 0 ? void 0 : _c.shopifyId) ||
|
|
456
|
+
item.shopifyProductId ||
|
|
457
|
+
((_d = item.variant) === null || _d === void 0 ? void 0 : _d.id) ||
|
|
458
|
+
'',
|
|
459
|
+
};
|
|
460
|
+
else
|
|
461
|
+
return {
|
|
462
|
+
title: item.title,
|
|
463
|
+
originalUnitPriceWithCurrency: item.originalUnitPrice,
|
|
464
|
+
quantity: item.quantity,
|
|
465
|
+
weight: item.variant
|
|
466
|
+
? {
|
|
467
|
+
value: item.variant.weight,
|
|
468
|
+
unit: 'GRAMS',
|
|
469
|
+
}
|
|
470
|
+
: undefined,
|
|
471
|
+
};
|
|
451
472
|
});
|
|
452
473
|
const tagsArray = Array.isArray(this.tags)
|
|
453
474
|
? this.tags
|