@intercartx/booster-core 0.0.1-beta.3 → 0.0.1-beta.5
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/dist/api/config/index.js
CHANGED
|
@@ -6,6 +6,9 @@ export async function apiProcessor(data) {
|
|
|
6
6
|
return post(`/processor`, data);
|
|
7
7
|
}
|
|
8
8
|
export function getApiURL() {
|
|
9
|
+
if (prefixApi) {
|
|
10
|
+
return `${prefixApi}/v3`;
|
|
11
|
+
}
|
|
9
12
|
if (process.env.NODE_ENV === 'development') {
|
|
10
13
|
return '/api/v3';
|
|
11
14
|
}
|
|
@@ -15,3 +18,7 @@ export function getApiURL() {
|
|
|
15
18
|
}
|
|
16
19
|
return `${location.protocol}//${location.host}/v3`;
|
|
17
20
|
}
|
|
21
|
+
let prefixApi = null;
|
|
22
|
+
export function setPrefixApi(prefix) {
|
|
23
|
+
prefixApi = prefix;
|
|
24
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CheckoutEvents } from "../../types";
|
|
2
|
-
import { divide100,
|
|
2
|
+
import { divide100, plus } from "../../utils";
|
|
3
3
|
import { globalState } from "../GlobalState";
|
|
4
4
|
import { BusinessModel } from "./Business";
|
|
5
5
|
export class OrderSummaryModel extends BusinessModel {
|
|
@@ -19,6 +19,7 @@ export class OrderSummaryModel extends BusinessModel {
|
|
|
19
19
|
price: divide100(product.price),
|
|
20
20
|
originPrice: divide100(product.originPrice),
|
|
21
21
|
}));
|
|
22
|
+
console.log(this.displayProductList, 'this.displayProductList');
|
|
22
23
|
globalState.on(CheckoutEvents.FEE_UPDATE, (feesData) => {
|
|
23
24
|
this.fees = Object.fromEntries(Object.entries(feesData.feeDetail).map(([key, value]) => [
|
|
24
25
|
key, { value: divide100(value.value), currency: value.currency }
|
|
@@ -29,13 +30,13 @@ export class OrderSummaryModel extends BusinessModel {
|
|
|
29
30
|
}
|
|
30
31
|
get totalSavings() {
|
|
31
32
|
const res = this.displayProductList.reduce((acc, product) => {
|
|
32
|
-
return plus(acc,
|
|
33
|
+
return plus(acc, divide100(product.discount * product.quantity));
|
|
33
34
|
}, '0');
|
|
34
35
|
return res;
|
|
35
36
|
}
|
|
36
37
|
get subtotal() {
|
|
37
38
|
const res = this.displayProductList.reduce((acc, product) => {
|
|
38
|
-
return plus(acc, product.price);
|
|
39
|
+
return plus(acc, Number(product.price) * product.quantity);
|
|
39
40
|
}, '0');
|
|
40
41
|
return res;
|
|
41
42
|
}
|