@nuskin/ns-shop 7.6.3 → 7.6.5-pa-87.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/ns-shop",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.5-pa-87.1",
|
|
4
4
|
"description": "The description that will amaze and astound your audience when they read it",
|
|
5
5
|
"main": "src/shop.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@nuskin/ns-common-lib": "1.4.8",
|
|
27
27
|
"@nuskin/ns-feature-flags": "1.5.0",
|
|
28
28
|
"@nuskin/ns-loyalty-web": "1.5.7",
|
|
29
|
-
"@nuskin/ns-product-lib": "2.
|
|
29
|
+
"@nuskin/ns-product-lib": "2.21.0",
|
|
30
30
|
"@nuskin/nuskinjquery": "2.3.1",
|
|
31
31
|
"@nuskin/order-model": "3.1.3",
|
|
32
32
|
"@nuskin/product-lib": "2.4.0",
|
|
@@ -395,7 +395,7 @@ function _assembleChildSkus(requestData, options) {
|
|
|
395
395
|
if (personalOffer !== null) {
|
|
396
396
|
personalOffer = JSON.parse(personalOffer);
|
|
397
397
|
productWithVariant = personalOffer.products.filter((sku) =>
|
|
398
|
-
sku.type === 'bundle' && sku.variantSelected !== null && sku.sku === productSku
|
|
398
|
+
sku.type.toLowerCase() === 'bundle' && sku.variantSelected !== null && sku.sku === productSku
|
|
399
399
|
)
|
|
400
400
|
}
|
|
401
401
|
|
|
@@ -411,7 +411,7 @@ function _assembleChildSkus(requestData, options) {
|
|
|
411
411
|
}
|
|
412
412
|
if (personalOffer != null && selectedVariants && cs.skuId != selectedVariants[cs.productId] && (cs.type !== "BUNDLE" && cs.type !== "OPTIONAL")) return null
|
|
413
413
|
const childSku =
|
|
414
|
-
(personalOffer != null && selectedVariants && selectedVariants[cs.productId] && config.MySite_graphql_active)
|
|
414
|
+
(personalOffer != null && selectedVariants && selectedVariants[cs.productId] && config && config.MySite_graphql_active)
|
|
415
415
|
? {
|
|
416
416
|
productId: cs.productId,
|
|
417
417
|
skuId: selectedVariants[cs.productId],
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import $ from '@nuskin/nuskinjquery';
|
|
2
2
|
import {Agelocme, CartService, ShippingAddress, ShopContextService, OrderManager, SalesOrder,
|
|
3
|
-
|
|
3
|
+
Product, ProductService, ExternalPaymentService, ProcessorCode} from "../shop.js";
|
|
4
4
|
import {RunConfigService, events, util, PersonalOfferStorageService, BrowserDetection, ShoppingContext, UrlService} from "@nuskin/ns-util";
|
|
5
5
|
import {getCachedConfigField} from '@nuskin/configuration-sdk';
|
|
6
6
|
import {UserService} from "@nuskin/ns-account";
|
|
7
7
|
import PaymentAdapter from '../payment/PaymentAdapter';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
8
|
+
import PickupUtil from '../shipping/pickupUtil';
|
|
9
|
+
import {Order} from '@nuskin/order-model';
|
|
10
|
+
import {storage} from "@nuskin/ns-util";
|
|
10
11
|
|
|
11
12
|
let splitLineItems = [];
|
|
12
13
|
const utmInfo = storage.getItem(storage.metadata.UTM_INFO) || {};
|
|
@@ -501,7 +502,7 @@ const populateCategory = (salesOrder) => {
|
|
|
501
502
|
} else if (utmMedium && utmMedium.toLowerCase().includes('paidsearch')) {
|
|
502
503
|
salesOrder.Category = 'PAIDSEARCH';
|
|
503
504
|
} else if (utmMedium && utmMedium.toLowerCase().includes('paidsocial')) {
|
|
504
|
-
salesOrder.Category = 'PAIDAD';
|
|
505
|
+
salesOrder.Category = 'PAIDAD';
|
|
505
506
|
} else {
|
|
506
507
|
salesOrder.Category = 'WEB';
|
|
507
508
|
}
|
|
@@ -650,6 +651,10 @@ const syncProductItems = async (order, sapProducts, adr, includeSapItems) => {
|
|
|
650
651
|
label = custom.Value;
|
|
651
652
|
} else if (custom.Key === 'SUB_PRICE') {
|
|
652
653
|
newItem.subPriceFlag = true;
|
|
654
|
+
} else if (custom.Key === 'GROSSWEIGHT') {
|
|
655
|
+
newItem.grossWeight = parseFloat(custom.Value);
|
|
656
|
+
} else if (custom.Key === 'WEIGHTUNIT') {
|
|
657
|
+
newItem.weightUnit = custom.Value;
|
|
653
658
|
}
|
|
654
659
|
});
|
|
655
660
|
if (code != null || name !== null || label != null) {
|
|
@@ -1120,6 +1125,18 @@ const populateSalesOrder = (action, adr) => {
|
|
|
1120
1125
|
return salesOrder;
|
|
1121
1126
|
};
|
|
1122
1127
|
|
|
1128
|
+
const getShipMethods = async (salesOrderDetail) => {
|
|
1129
|
+
let shipMethods;
|
|
1130
|
+
const useShipMethodsApi = getCachedConfigField('useShipMethodsApi');
|
|
1131
|
+
if (useShipMethodsApi) {
|
|
1132
|
+
await PickupUtil.loadShipMethods(Order.fromSalesOrderRequest(populateSalesOrder('SIMULATE')));
|
|
1133
|
+
shipMethods = await PickupUtil.getShipMethods();
|
|
1134
|
+
} else {
|
|
1135
|
+
shipMethods = salesOrderDetail.ShippingAvailableMethods
|
|
1136
|
+
}
|
|
1137
|
+
return shipMethods
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1123
1140
|
/**
|
|
1124
1141
|
* Maps Sales order detail object to the order object
|
|
1125
1142
|
* @param {Object} salesOrderDetail
|
|
@@ -1141,7 +1158,7 @@ const toOrder = async (salesOrderDetail, adr, createResponse) => {
|
|
|
1141
1158
|
|
|
1142
1159
|
const useShipMethodsApi = getCachedConfigField('useShipMethodsApi');
|
|
1143
1160
|
if (useShipMethodsApi || salesOrderDetail.ShippingAvailableMethods && salesOrderDetail.ShippingAvailableMethods.length > 0) {
|
|
1144
|
-
const shipMethods =
|
|
1161
|
+
const shipMethods = await getShipMethods(salesOrderDetail);
|
|
1145
1162
|
order.shippingAvailableMethods = sortShippingAvailableMethods(shipMethods);
|
|
1146
1163
|
order.simulatedShippingMethod =
|
|
1147
1164
|
order.shippingAvailableMethods.find(
|
|
@@ -1156,7 +1173,7 @@ const toOrder = async (salesOrderDetail, adr, createResponse) => {
|
|
|
1156
1173
|
let oldPup = null;
|
|
1157
1174
|
if (!useShipMethodsApi) oldPup = salesOrderDetail.Custom;
|
|
1158
1175
|
let newPup = null;
|
|
1159
|
-
if (useShipMethodsApi) newPup = await
|
|
1176
|
+
if (useShipMethodsApi) newPup = await PickupUtil.getPickupPoints();
|
|
1160
1177
|
setPickupPoints(oldPup, newPup, order);
|
|
1161
1178
|
}
|
|
1162
1179
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {getCachedConfiguration} from '@nuskin/configuration-sdk';
|
|
2
|
-
import {Order} from '@nuskin/order-model';
|
|
3
2
|
import {RunConfigService} from '@nuskin/ns-util';
|
|
4
|
-
import {OrderManager, CartService, OrderType
|
|
3
|
+
import {OrderManager, CartService, OrderType} from '../shop';
|
|
5
4
|
import axios from 'axios';
|
|
6
5
|
|
|
7
6
|
let PickupUtil = function() {
|
|
@@ -197,8 +196,7 @@ let PickupUtil = function() {
|
|
|
197
196
|
return same
|
|
198
197
|
}
|
|
199
198
|
|
|
200
|
-
function loadShipMethods() {
|
|
201
|
-
const order = Order.fromSalesOrderRequest(OrderAdapter.populateSalesOrder('SIMULATE'));
|
|
199
|
+
function loadShipMethods(order) {
|
|
202
200
|
const {metapackMarket} = getCachedConfiguration('Checkout');
|
|
203
201
|
|
|
204
202
|
if (metapackMarket) {
|