@axos-web-dev/shared-components 1.0.100-dev.25 → 1.0.100-dev.27
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.
|
@@ -16,12 +16,18 @@ const ApyCalculator = ({
|
|
|
16
16
|
variant
|
|
17
17
|
}) => {
|
|
18
18
|
const calculator_variant = getVariant(variant);
|
|
19
|
+
const [compounding, setCompounding] = useState(360);
|
|
20
|
+
const getAPR = (apy) => {
|
|
21
|
+
return Number.parseFloat(
|
|
22
|
+
(((1 + apy / 100) ** (1 / compounding) - 1) * compounding * 100).toFixed(2)
|
|
23
|
+
);
|
|
24
|
+
};
|
|
19
25
|
const AXOS_ONE_APY = +process.env.NEXT_PUBLIC_AXOS_ONE_APY;
|
|
26
|
+
const AXOS_ONE_APR = getAPR(AXOS_ONE_APY);
|
|
20
27
|
const [initialDeposit, setInititalDeposit] = useState(1e3);
|
|
21
|
-
const [APR, setAPR] = useState(
|
|
28
|
+
const [APR, setAPR] = useState(AXOS_ONE_APR);
|
|
22
29
|
const [APY, setAPY] = useState(AXOS_ONE_APY);
|
|
23
30
|
const [months, setMonths] = useState(12);
|
|
24
|
-
const [compounding, setCompounding] = useState(360);
|
|
25
31
|
const [monthlyDeposits, setMonthlyDeposits] = useState(100);
|
|
26
32
|
const [endingBalance, setEndingBalance] = useState("");
|
|
27
33
|
const [errors, setErrors] = useState([]);
|
|
@@ -103,9 +109,7 @@ const ApyCalculator = ({
|
|
|
103
109
|
};
|
|
104
110
|
const updateAPY = (value) => {
|
|
105
111
|
setAPY(value);
|
|
106
|
-
const new_apr =
|
|
107
|
-
(((1 + value / 100) ** (1 / compounding) - 1) * compounding * 100).toFixed(2)
|
|
108
|
-
);
|
|
112
|
+
const new_apr = getAPR(value);
|
|
109
113
|
setAPR(new_apr);
|
|
110
114
|
convertInterest();
|
|
111
115
|
};
|
|
@@ -18,7 +18,8 @@ const ChatWindow = ({
|
|
|
18
18
|
console.log("End chat");
|
|
19
19
|
},
|
|
20
20
|
showReconnect = false,
|
|
21
|
-
virtualAgent
|
|
21
|
+
virtualAgent,
|
|
22
|
+
showAvatar = false
|
|
22
23
|
}) => {
|
|
23
24
|
const [mounted, setMounted] = React.useState(false);
|
|
24
25
|
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
@@ -252,7 +253,7 @@ const ChatWindow = ({
|
|
|
252
253
|
gap: "8px"
|
|
253
254
|
},
|
|
254
255
|
children: [
|
|
255
|
-
/* @__PURE__ */ jsx(
|
|
256
|
+
showAvatar && /* @__PURE__ */ jsx(
|
|
256
257
|
"img",
|
|
257
258
|
{
|
|
258
259
|
width: 24,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useState, useRef, useCallback, useEffect } from "react";
|
|
3
|
+
import { useLocation } from "react-use";
|
|
3
4
|
import { useMessages } from "./store/messages.js";
|
|
4
5
|
const brandMap = /* @__PURE__ */ new Map([
|
|
5
6
|
["axos", 1],
|
|
@@ -15,6 +16,7 @@ function useHeadlessChat({
|
|
|
15
16
|
debug = false,
|
|
16
17
|
menuOption = "Support Virtual Agent"
|
|
17
18
|
}) {
|
|
19
|
+
const { hostname } = useLocation();
|
|
18
20
|
const addMessage = useMessages((state) => state.addMessage);
|
|
19
21
|
const addMessages = useMessages((state) => state.addMessages);
|
|
20
22
|
const clearMessages = useMessages((state) => state.clearMessages);
|
|
@@ -50,13 +52,17 @@ function useHeadlessChat({
|
|
|
50
52
|
user_auth: {
|
|
51
53
|
label: "user_auth",
|
|
52
54
|
value: "false"
|
|
55
|
+
},
|
|
56
|
+
env: {
|
|
57
|
+
label: "env",
|
|
58
|
+
value: hostname?.includes("www") ? "prod" : hostname?.split(".")[1] ? hostname?.split(".")[1] : ""
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
);
|
|
58
64
|
}
|
|
59
|
-
}, [clearMessages, menuOption, projectId]);
|
|
65
|
+
}, [clearMessages, hostname, menuOption, projectId]);
|
|
60
66
|
useEffect(() => {
|
|
61
67
|
let messageHandler;
|
|
62
68
|
let chatReadyHandler;
|
|
@@ -105,6 +111,10 @@ function useHeadlessChat({
|
|
|
105
111
|
user_auth: {
|
|
106
112
|
label: "user_auth",
|
|
107
113
|
value: "false"
|
|
114
|
+
},
|
|
115
|
+
env: {
|
|
116
|
+
label: "env",
|
|
117
|
+
value: hostname?.includes("www") ? "prod" : hostname?.split(".")[1] ? hostname?.split(".")[1] : ""
|
|
108
118
|
}
|
|
109
119
|
}
|
|
110
120
|
};
|
|
@@ -213,7 +223,8 @@ function useHeadlessChat({
|
|
|
213
223
|
addMessages,
|
|
214
224
|
debug,
|
|
215
225
|
projectId,
|
|
216
|
-
menuOption
|
|
226
|
+
menuOption,
|
|
227
|
+
hostname
|
|
217
228
|
]);
|
|
218
229
|
return {
|
|
219
230
|
status,
|
package/package.json
CHANGED