@artisan-commerce/analytics-rn 0.3.0-canary.64 → 0.3.0-canary.66
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 +17 -0
- package/dist/bundle.cjs.js +36 -12
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +36 -12
- package/dist/bundle.esm.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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.66](https://bitbucket.org/tradesystem/artisn_sdk/compare/@artisan-commerce/analytics-rn@0.3.0-canary.65...@artisan-commerce/analytics-rn@0.3.0-canary.66) (2022-02-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **global:** make initialization console warns be only available on debug mode ([afcd6a3](https://bitbucket.org/tradesystem/artisn_sdk/commit/afcd6a3ada69a93e5fbf6e0fe8b887d2f82cc9d2))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [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)
|
|
16
|
+
|
|
17
|
+
**Note:** Version bump only for package @artisan-commerce/analytics-rn
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [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
24
|
|
|
8
25
|
**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.66";
|
|
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.62",
|
|
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 = "d1db871e73166816ef42b1c0e191abd80ccc69df";
|
|
116
116
|
var packageJSON = {
|
|
117
117
|
name: name,
|
|
118
118
|
description: description,
|
|
@@ -483,7 +483,7 @@ var __objRest$3V = (source, exclude) => {
|
|
|
483
483
|
let initialized = false;
|
|
484
484
|
const initAnalytics = (config) => {
|
|
485
485
|
if (initialized) {
|
|
486
|
-
logMessage("initAnalytics has been called more than once. This behaviour will very likely result in unexpected outcomes so its call was skipped. Please make sure initAnalytics is only called once.", "
|
|
486
|
+
logMessage("initAnalytics has been called more than once. This behaviour will very likely result in unexpected outcomes so its call was skipped. Please make sure initAnalytics is only called once.", "debug");
|
|
487
487
|
return;
|
|
488
488
|
}
|
|
489
489
|
initialized = true;
|
|
@@ -795,18 +795,19 @@ var __spreadValues$k$1 = (a, b) => {
|
|
|
795
795
|
}
|
|
796
796
|
return a;
|
|
797
797
|
};
|
|
798
|
-
const { DEFAULT_SHOPPING_CART_NAME: DEFAULT_SHOPPING_CART_NAME$
|
|
798
|
+
const { DEFAULT_SHOPPING_CART_NAME: DEFAULT_SHOPPING_CART_NAME$2, DEFAULT_MAX_SHOPPING_CARTS } = CONSTANTS;
|
|
799
799
|
const initialState = {
|
|
800
800
|
artisnApp: void 0,
|
|
801
801
|
accountId: void 0,
|
|
802
802
|
customerId: void 0,
|
|
803
|
-
activeShoppingCart: DEFAULT_SHOPPING_CART_NAME$
|
|
803
|
+
activeShoppingCart: DEFAULT_SHOPPING_CART_NAME$2,
|
|
804
804
|
maxShoppingCarts: DEFAULT_MAX_SHOPPING_CARTS,
|
|
805
805
|
wallets: {},
|
|
806
806
|
anonymous: false,
|
|
807
807
|
initialized: false,
|
|
808
808
|
queue: new ActionQueue(),
|
|
809
|
-
eventLoop: new EventLoop()
|
|
809
|
+
eventLoop: new EventLoop(),
|
|
810
|
+
debug: false
|
|
810
811
|
};
|
|
811
812
|
Object.freeze(initialState);
|
|
812
813
|
let state = __spreadValues$k$1({}, initialState);
|
|
@@ -1517,13 +1518,16 @@ const applyBenefits = (additionalInfo, benefits, shoppingCartTotals) => {
|
|
|
1517
1518
|
}
|
|
1518
1519
|
const benefitsValues = Object.values(benefits);
|
|
1519
1520
|
return benefitsValues.reduce((acc, benefit) => {
|
|
1520
|
-
if (benefit.type === "
|
|
1521
|
-
return
|
|
1521
|
+
if (benefit.type === "DISCOUNT_PERCENTAGE" && benefit.discountPercentage) {
|
|
1522
|
+
return applyBenefitByDiscountPercentage(benefit, acc, additionalInfo);
|
|
1523
|
+
}
|
|
1524
|
+
if (benefit.type === "DISCOUNT_FIXED" && benefit.discountFixed) {
|
|
1525
|
+
return applyBenefitByDiscountFixed(benefit, acc, additionalInfo);
|
|
1522
1526
|
}
|
|
1523
1527
|
return acc;
|
|
1524
1528
|
}, shoppingCartTotals);
|
|
1525
1529
|
};
|
|
1526
|
-
const
|
|
1530
|
+
const applyBenefitByDiscountPercentage = (benefit, shoppingCartTotals, additionalInfo) => {
|
|
1527
1531
|
const { subtotal, total: prevTotal } = shoppingCartTotals;
|
|
1528
1532
|
const { totalDiscounts: prevTotalDiscounts } = shoppingCartTotals;
|
|
1529
1533
|
const discountPercentage = benefit.discountPercentage * 0.01;
|
|
@@ -1546,6 +1550,26 @@ const applyBenefitByDiscount = (benefit, shoppingCartTotals, additionalInfo) =>
|
|
|
1546
1550
|
total: newTotal
|
|
1547
1551
|
});
|
|
1548
1552
|
};
|
|
1553
|
+
const applyBenefitByDiscountFixed = (benefit, shoppingCartTotals, additionalInfo) => {
|
|
1554
|
+
const { total: prevTotal } = shoppingCartTotals;
|
|
1555
|
+
const { totalDiscounts: prevTotalDiscounts } = shoppingCartTotals;
|
|
1556
|
+
const discountFixed = Number(benefit.discountFixed);
|
|
1557
|
+
if (typeof (additionalInfo == null ? void 0 : additionalInfo.copayment) !== "undefined") {
|
|
1558
|
+
const copayment = additionalInfo == null ? void 0 : additionalInfo.copayment;
|
|
1559
|
+
const newTotalDiscounts2 = prevTotalDiscounts !== null ? prevTotalDiscounts + discountFixed : discountFixed;
|
|
1560
|
+
const newTotal2 = (copayment - discountFixed).toFixed(4);
|
|
1561
|
+
return __spreadProps$c$1(__spreadValues$g$1({}, shoppingCartTotals), {
|
|
1562
|
+
totalDiscounts: newTotalDiscounts2,
|
|
1563
|
+
total: Number(newTotal2)
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
const newTotalDiscounts = prevTotalDiscounts !== null ? prevTotalDiscounts + discountFixed : discountFixed;
|
|
1567
|
+
const newTotal = prevTotal - discountFixed;
|
|
1568
|
+
return __spreadProps$c$1(__spreadValues$g$1({}, shoppingCartTotals), {
|
|
1569
|
+
totalDiscounts: newTotalDiscounts,
|
|
1570
|
+
total: newTotal
|
|
1571
|
+
});
|
|
1572
|
+
};
|
|
1549
1573
|
|
|
1550
1574
|
const isBaseProduct = (product) => {
|
|
1551
1575
|
const { attributes, description, name } = product;
|