@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(AXOS_ONE_APY - 0.1);
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 = Number.parseFloat(
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
  };
@@ -24,6 +24,7 @@ interface ChatWindowProps {
24
24
  name: string;
25
25
  id: string;
26
26
  };
27
+ showAvatar?: boolean;
27
28
  }
28
29
  export declare const ChatWindow: React.FC<ChatWindowProps>;
29
30
  export {};
@@ -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,
@@ -32,11 +32,10 @@
32
32
  }
33
33
  .n5hj5p8 {
34
34
  display: block;
35
+ font: 700 16px / 1.15 var(--header-font-family);
35
36
  }
36
37
  .n5hj5p0 .n5hj5p8 {
37
38
  color: #4B6080;
38
- font-family: var(--header-font-family);
39
- font-size: 16px;
40
39
  }
41
40
  .n5hj5p9 {
42
41
  color: var(--_1073cm85);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@axos-web-dev/shared-components",
3
3
  "description": "Axos shared components library for web.",
4
- "version": "1.0.100-dev.25",
4
+ "version": "1.0.100-dev.27",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",