@artisan-commerce/analytics-rn 0.3.0-canary.64 → 0.3.0-canary.65
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/CHANGELOG.md +8 -0
- package/dist/bundle.cjs.js +31 -8
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +31 -8
- package/dist/bundle.esm.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.3.0-canary.65](https://bitbucket.org/tradesystem/artisn_sdk/compare/@artisan-commerce/analytics-rn@0.3.0-canary.64...@artisan-commerce/analytics-rn@0.3.0-canary.65) (2022-02-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @artisan-commerce/analytics-rn
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.3.0-canary.64](https://bitbucket.org/tradesystem/artisn_sdk/compare/@artisan-commerce/analytics-rn@0.3.0-canary.63...@artisan-commerce/analytics-rn@0.3.0-canary.64) (2022-01-29)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @artisan-commerce/analytics-rn
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -49,7 +49,7 @@ const getState$2 = () => {
|
|
|
49
49
|
|
|
50
50
|
var name = "@artisan-commerce/analytics-rn";
|
|
51
51
|
var description = "Artisn commerce analytics react native library";
|
|
52
|
-
var version = "0.3.0-canary.
|
|
52
|
+
var version = "0.3.0-canary.65";
|
|
53
53
|
var main = "./dist/bundle.esm.js";
|
|
54
54
|
var module$1 = "./dist/bundle.esm.js";
|
|
55
55
|
var types = "./dist/bundle.d.ts";
|
|
@@ -91,9 +91,9 @@ var dependencies = {
|
|
|
91
91
|
"snake-case": "^3.0.4"
|
|
92
92
|
};
|
|
93
93
|
var devDependencies = {
|
|
94
|
-
"@artisan-commerce/products": "0.9.0-canary.
|
|
95
|
-
"@artisan-commerce/shopping-cart": "0.12.0-canary.
|
|
96
|
-
"@artisan-commerce/types": "0.14.0-canary.
|
|
94
|
+
"@artisan-commerce/products": "0.9.0-canary.41",
|
|
95
|
+
"@artisan-commerce/shopping-cart": "0.12.0-canary.61",
|
|
96
|
+
"@artisan-commerce/types": "0.14.0-canary.32",
|
|
97
97
|
"@babel/core": "^7.13.15",
|
|
98
98
|
"@babel/preset-env": "^7.10.4",
|
|
99
99
|
"@babel/preset-react": "^7.10.4",
|
|
@@ -112,7 +112,7 @@ var peerDependencies = {
|
|
|
112
112
|
react: ">=16.8.6",
|
|
113
113
|
"react-native-fbsdk-next": "*"
|
|
114
114
|
};
|
|
115
|
-
var gitHead = "
|
|
115
|
+
var gitHead = "ad88ffa2a383481b53bce14414e6a0b6c2942f3e";
|
|
116
116
|
var packageJSON = {
|
|
117
117
|
name: name,
|
|
118
118
|
description: description,
|
|
@@ -1517,13 +1517,16 @@ const applyBenefits = (additionalInfo, benefits, shoppingCartTotals) => {
|
|
|
1517
1517
|
}
|
|
1518
1518
|
const benefitsValues = Object.values(benefits);
|
|
1519
1519
|
return benefitsValues.reduce((acc, benefit) => {
|
|
1520
|
-
if (benefit.type === "
|
|
1521
|
-
return
|
|
1520
|
+
if (benefit.type === "DISCOUNT_PERCENTAGE" && benefit.discountPercentage) {
|
|
1521
|
+
return applyBenefitByDiscountPercentage(benefit, acc, additionalInfo);
|
|
1522
|
+
}
|
|
1523
|
+
if (benefit.type === "DISCOUNT_FIXED" && benefit.discountFixed) {
|
|
1524
|
+
return applyBenefitByDiscountFixed(benefit, acc, additionalInfo);
|
|
1522
1525
|
}
|
|
1523
1526
|
return acc;
|
|
1524
1527
|
}, shoppingCartTotals);
|
|
1525
1528
|
};
|
|
1526
|
-
const
|
|
1529
|
+
const applyBenefitByDiscountPercentage = (benefit, shoppingCartTotals, additionalInfo) => {
|
|
1527
1530
|
const { subtotal, total: prevTotal } = shoppingCartTotals;
|
|
1528
1531
|
const { totalDiscounts: prevTotalDiscounts } = shoppingCartTotals;
|
|
1529
1532
|
const discountPercentage = benefit.discountPercentage * 0.01;
|
|
@@ -1546,6 +1549,26 @@ const applyBenefitByDiscount = (benefit, shoppingCartTotals, additionalInfo) =>
|
|
|
1546
1549
|
total: newTotal
|
|
1547
1550
|
});
|
|
1548
1551
|
};
|
|
1552
|
+
const applyBenefitByDiscountFixed = (benefit, shoppingCartTotals, additionalInfo) => {
|
|
1553
|
+
const { total: prevTotal } = shoppingCartTotals;
|
|
1554
|
+
const { totalDiscounts: prevTotalDiscounts } = shoppingCartTotals;
|
|
1555
|
+
const discountFixed = Number(benefit.discountFixed);
|
|
1556
|
+
if (typeof (additionalInfo == null ? void 0 : additionalInfo.copayment) !== "undefined") {
|
|
1557
|
+
const copayment = additionalInfo == null ? void 0 : additionalInfo.copayment;
|
|
1558
|
+
const newTotalDiscounts2 = prevTotalDiscounts !== null ? prevTotalDiscounts + discountFixed : discountFixed;
|
|
1559
|
+
const newTotal2 = (copayment - discountFixed).toFixed(4);
|
|
1560
|
+
return __spreadProps$c$1(__spreadValues$g$1({}, shoppingCartTotals), {
|
|
1561
|
+
totalDiscounts: newTotalDiscounts2,
|
|
1562
|
+
total: Number(newTotal2)
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
const newTotalDiscounts = prevTotalDiscounts !== null ? prevTotalDiscounts + discountFixed : discountFixed;
|
|
1566
|
+
const newTotal = prevTotal - discountFixed;
|
|
1567
|
+
return __spreadProps$c$1(__spreadValues$g$1({}, shoppingCartTotals), {
|
|
1568
|
+
totalDiscounts: newTotalDiscounts,
|
|
1569
|
+
total: newTotal
|
|
1570
|
+
});
|
|
1571
|
+
};
|
|
1549
1572
|
|
|
1550
1573
|
const isBaseProduct = (product) => {
|
|
1551
1574
|
const { attributes, description, name } = product;
|