@axos-web-dev/shared-components 1.0.100-dev.2 → 1.0.100-feature-buydown.1
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/ATMLocator/ATMLocator.js +1 -7
- package/dist/ArticlesSet/ArticlesSet.js +2 -2
- package/dist/Auth/ErrorAlert.js +1 -7
- package/dist/Button/Button.js +1 -7
- package/dist/Calculators/BuyDownCalculator/index.d.ts +1 -0
- package/dist/Calculators/BuyDownCalculator/index.js +161 -71
- package/dist/Calculators/Calculator.js +1 -7
- package/dist/Carousel/index.js +1 -7
- package/dist/Chevron/index.js +1 -7
- package/dist/Comparison/Comparison.js +1 -7
- package/dist/ExecutiveBio/ExecutiveBio.js +1 -7
- package/dist/FaqAccordion/index.js +1 -7
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +1 -7
- package/dist/Forms/ApplyNow.js +1 -7
- package/dist/Forms/ContactUsBusiness.js +1 -7
- package/dist/Forms/ContactUsBusinessNameEmail.js +1 -7
- package/dist/Forms/ContactUsNMLSId.js +1 -7
- package/dist/Forms/CraPublicFile.js +1 -7
- package/dist/Forms/EmailOnly.js +1 -7
- package/dist/Forms/MortgageRate/MortgageRateForm.js +1 -7
- package/dist/Forms/MortgageRate/MortgageRateWatch.js +1 -7
- package/dist/Forms/MortgageWarehouseLending.js +1 -7
- package/dist/Forms/QuickPricer/QuickPricerForm.js +1 -1
- package/dist/Forms/SalesforceFieldsForm.d.ts +5 -0
- package/dist/Forms/SalesforceFieldsForm.js +11 -1
- package/dist/Forms/SuccesForm.js +1 -7
- package/dist/Hyperlink/index.js +1 -7
- package/dist/ImageLink/ImageLink.js +1 -7
- package/dist/ImageLink/ImageLinkSet.js +1 -7
- package/dist/ImageLink/index.js +1 -7
- package/dist/Input/Dropdown.js +1 -0
- package/dist/Insight/Featured/CategorySelector.js +1 -7
- package/dist/Insight/Featured/Featured.js +1 -7
- package/dist/Insight/Featured/Header.js +1 -7
- package/dist/Modal/Modal.js +1 -7
- package/dist/NavigationMenu/AxosALTS/NavData.js +1 -7
- package/dist/NavigationMenu/AxosALTS/index.js +1 -7
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +1 -7
- package/dist/NavigationMenu/AxosBank/NavData.js +1 -7
- package/dist/NavigationMenu/AxosBank/SubNavBar.js +1 -7
- package/dist/NavigationMenu/AxosBank/index.js +1 -7
- package/dist/NavigationMenu/LaVictoire/NavData.js +1 -7
- package/dist/NavigationMenu/LaVictoire/index.js +1 -7
- package/dist/NavigationMenu/NavDataJson.js +1 -7
- package/dist/NavigationMenu/Navbar.js +1 -7
- package/dist/NavigationMenu/SignInNavButton.js +1 -7
- package/dist/SetContainer/SetContainer.js +1 -7
- package/dist/SocialMediaBar/iconsRepository.js +1 -7
- package/dist/Table/Table.d.ts +1 -1
- package/dist/VideoTile/VideoTile.js +1 -7
- package/dist/VideoWrapper/index.js +1 -7
- package/dist/WalnutIframe/wrapper.module.js +3 -3
- package/dist/assets/WalnutIframe/wrapper.css.css +49 -49
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -28
- package/package.json +133 -136
- package/dist/Chatbot/Bubble.css.d.ts +0 -1
- package/dist/Chatbot/Bubble.css.js +0 -5
- package/dist/Chatbot/Bubble.d.ts +0 -3
- package/dist/Chatbot/Bubble.js +0 -48
- package/dist/Chatbot/Chat.d.ts +0 -1
- package/dist/Chatbot/Chat.js +0 -165
- package/dist/Chatbot/ChatWindow.css.d.ts +0 -11
- package/dist/Chatbot/ChatWindow.css.js +0 -25
- package/dist/Chatbot/ChatWindow.d.ts +0 -23
- package/dist/Chatbot/ChatWindow.js +0 -202
- package/dist/Chatbot/Chatbot.css.d.ts +0 -1
- package/dist/Chatbot/Chatbot.css.js +0 -5
- package/dist/Chatbot/Chatbot.css.ts.vanilla.css.js +0 -1
- package/dist/Chatbot/Chatbot.d.ts +0 -1
- package/dist/Chatbot/Chatbot.js +0 -39
- package/dist/Chatbot/authenticate.d.ts +0 -3
- package/dist/Chatbot/authenticate.js +0 -16
- package/dist/Chatbot/index.d.ts +0 -9
- package/dist/Chatbot/index.js +0 -31
- package/dist/Chatbot/store/chat.d.ts +0 -9
- package/dist/Chatbot/store/chat.js +0 -11
- package/dist/Chatbot/store/messages.d.ts +0 -14
- package/dist/Chatbot/store/messages.js +0 -12
- package/dist/Chatbot/useHeadlessChat.d.ts +0 -22
- package/dist/Chatbot/useHeadlessChat.js +0 -157
- package/dist/assets/Chatbot/Bubble.css +0 -40
- package/dist/assets/Chatbot/ChatWindow.css +0 -107
package/package.json
CHANGED
|
@@ -1,136 +1,133 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@axos-web-dev/shared-components",
|
|
3
|
-
"description": "Axos shared components library for web.",
|
|
4
|
-
"version": "1.0.100-
|
|
5
|
-
"type": "module",
|
|
6
|
-
"module": "dist/main.js",
|
|
7
|
-
"types": "dist/main.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"sideEffects": [
|
|
12
|
-
"dist/assets/**/*.css"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"dev": "vite",
|
|
16
|
-
"build": "tsc --p ./tsconfig.build.json && vite build",
|
|
17
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
18
|
-
"preview": "vite preview",
|
|
19
|
-
"prepublishOnly": "npm run build",
|
|
20
|
-
"check-types": "tsc --pretty --noEmit",
|
|
21
|
-
"check-format": "prettier --check .",
|
|
22
|
-
"check-lint": "eslint . --ext ts --ext tsx --ext js",
|
|
23
|
-
"format": "prettier --write .",
|
|
24
|
-
"test-all": "npm run check-format && npm run check-lint && npm run check-types && npm run build",
|
|
25
|
-
"prepare": "husky",
|
|
26
|
-
"storybook": "storybook dev -p 6006",
|
|
27
|
-
"build-storybook": "storybook build",
|
|
28
|
-
"npm:link": "npm run build && npm link"
|
|
29
|
-
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@headlessui/react": "^2.2.0",
|
|
32
|
-
"@hookform/resolvers": "^3.10.0",
|
|
33
|
-
"@next-safe-action/adapter-react-hook-form": "^2.0.0",
|
|
34
|
-
"@react-input/mask": "^1.2.15",
|
|
35
|
-
"@react-input/number-format": "^1.1.3",
|
|
36
|
-
"@storybook/icons": "^1.3.0",
|
|
37
|
-
"@storybook/preview-api": "^8.4.7",
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"react-
|
|
51
|
-
"react-
|
|
52
|
-
"react-
|
|
53
|
-
"react-
|
|
54
|
-
"react-
|
|
55
|
-
"react-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"react": "^
|
|
72
|
-
"react-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
81
|
-
"@storybook/addon-
|
|
82
|
-
"@storybook/addon-
|
|
83
|
-
"@storybook/addon-
|
|
84
|
-
"@storybook/
|
|
85
|
-
"@storybook/
|
|
86
|
-
"@storybook/
|
|
87
|
-
"@storybook/
|
|
88
|
-
"@
|
|
89
|
-
"@
|
|
90
|
-
"@
|
|
91
|
-
"@
|
|
92
|
-
"@
|
|
93
|
-
"@
|
|
94
|
-
"@types/
|
|
95
|
-
"@types/
|
|
96
|
-
"@types/react": "^18.3.
|
|
97
|
-
"@types/react-
|
|
98
|
-
"@
|
|
99
|
-
"@
|
|
100
|
-
"@
|
|
101
|
-
"@
|
|
102
|
-
"@
|
|
103
|
-
"@
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"eslint": "^8.
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"vite": "^
|
|
125
|
-
"vite-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"author": "axos-web-dev",
|
|
135
|
-
"license": "ISC"
|
|
136
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@axos-web-dev/shared-components",
|
|
3
|
+
"description": "Axos shared components library for web.",
|
|
4
|
+
"version": "1.0.100-feature-buydown.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "dist/main.js",
|
|
7
|
+
"types": "dist/main.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"dist/assets/**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "vite",
|
|
16
|
+
"build": "tsc --p ./tsconfig.build.json && vite build",
|
|
17
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
18
|
+
"preview": "vite preview",
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"check-types": "tsc --pretty --noEmit",
|
|
21
|
+
"check-format": "prettier --check .",
|
|
22
|
+
"check-lint": "eslint . --ext ts --ext tsx --ext js",
|
|
23
|
+
"format": "prettier --write .",
|
|
24
|
+
"test-all": "npm run check-format && npm run check-lint && npm run check-types && npm run build",
|
|
25
|
+
"prepare": "husky",
|
|
26
|
+
"storybook": "storybook dev -p 6006",
|
|
27
|
+
"build-storybook": "storybook build",
|
|
28
|
+
"npm:link": "npm run build && npm link"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@headlessui/react": "^2.2.0",
|
|
32
|
+
"@hookform/resolvers": "^3.10.0",
|
|
33
|
+
"@next-safe-action/adapter-react-hook-form": "^2.0.0",
|
|
34
|
+
"@react-input/mask": "^1.2.15",
|
|
35
|
+
"@react-input/number-format": "^1.1.3",
|
|
36
|
+
"@storybook/icons": "^1.3.0",
|
|
37
|
+
"@storybook/preview-api": "^8.4.7",
|
|
38
|
+
"@types/iframe-resizer": "3.5.13",
|
|
39
|
+
"@vanilla-extract/css": "^1.16.1",
|
|
40
|
+
"@vanilla-extract/recipes": "^0.5.1",
|
|
41
|
+
"antd": "^5.22.5",
|
|
42
|
+
"clsx": "^2.1.1",
|
|
43
|
+
"framer-motion": "^12.9.2",
|
|
44
|
+
"iframe-resizer": "^3.6.6",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"moment": "^2.30.1",
|
|
47
|
+
"next-safe-action": "^8.0.2",
|
|
48
|
+
"react-date-picker": "^11.0.0",
|
|
49
|
+
"react-date-range": "^2.0.1",
|
|
50
|
+
"react-hook-form": "^7.54.2",
|
|
51
|
+
"react-markdown": "^9.0.1",
|
|
52
|
+
"react-popper": "^2.3.0",
|
|
53
|
+
"react-slick": "^0.30.2",
|
|
54
|
+
"react-use": "^17.6.0",
|
|
55
|
+
"react-wrap-balancer": "^1.1.1",
|
|
56
|
+
"rsuite": "^5.75.0",
|
|
57
|
+
"slick-carousel": "^1.8.1",
|
|
58
|
+
"typed-css-modules": "^0.9.1",
|
|
59
|
+
"vite-plugin-svgr": "^4.3.0",
|
|
60
|
+
"zod": "^3.24.1",
|
|
61
|
+
"zustand": "^4.5.5"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@vanilla-extract/css-utils": "^0.1.3",
|
|
65
|
+
"@vanilla-extract/recipes": "^0.5.1",
|
|
66
|
+
"@vanilla-extract/vite-plugin": "^4.0.3",
|
|
67
|
+
"next": "^14.1.4",
|
|
68
|
+
"react": "^18.2.0",
|
|
69
|
+
"react-date-range": "^2.0.1",
|
|
70
|
+
"react-dom": "^18.2.0",
|
|
71
|
+
"react-popper": "^2.3.0",
|
|
72
|
+
"react-slick": "^0.30.2",
|
|
73
|
+
"slick-carousel": "^1.8.1"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@chromatic-com/storybook": "^1.9.0",
|
|
77
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
78
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
79
|
+
"@storybook/addon-interactions": "^8.4.7",
|
|
80
|
+
"@storybook/addon-links": "^8.4.7",
|
|
81
|
+
"@storybook/addon-mdx-gfm": "^8.4.7",
|
|
82
|
+
"@storybook/addon-onboarding": "^8.4.7",
|
|
83
|
+
"@storybook/addon-themes": "^8.4.7",
|
|
84
|
+
"@storybook/blocks": "^8.4.7",
|
|
85
|
+
"@storybook/react": "^8.6.14",
|
|
86
|
+
"@storybook/react-vite": "^8.4.7",
|
|
87
|
+
"@storybook/test": "^8.6.14",
|
|
88
|
+
"@svgr/core": "^8.1.0",
|
|
89
|
+
"@svgr/plugin-prettier": "^8.1.0",
|
|
90
|
+
"@svgr/plugin-svgo": "^8.1.0",
|
|
91
|
+
"@types/lodash": "^4.17.17",
|
|
92
|
+
"@types/node": "^20.19.0",
|
|
93
|
+
"@types/react": "^18.3.23",
|
|
94
|
+
"@types/react-date-range": "^1.4.9",
|
|
95
|
+
"@types/react-datepicker": "^6.2.0",
|
|
96
|
+
"@types/react-dom": "^18.3.7",
|
|
97
|
+
"@types/react-slick": "^0.23.13",
|
|
98
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
99
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
100
|
+
"@vanilla-extract/css-utils": "^0.1.4",
|
|
101
|
+
"@vanilla-extract/recipes": "^0.5.5",
|
|
102
|
+
"@vanilla-extract/vite-plugin": "^4.0.18",
|
|
103
|
+
"@vitejs/plugin-react-swc": "^3.7.2",
|
|
104
|
+
"esbuild-vanilla-image-loader": "^0.1.3",
|
|
105
|
+
"eslint": "^8.57.1",
|
|
106
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
107
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
108
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
109
|
+
"glob": "^10.4.5",
|
|
110
|
+
"husky": "^9.1.7",
|
|
111
|
+
"next": "^14.1.4",
|
|
112
|
+
"prettier": "3.2.5",
|
|
113
|
+
"react": "^18.3.1",
|
|
114
|
+
"react-dom": "^18.3.1",
|
|
115
|
+
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
116
|
+
"rollup-plugin-svg-import": "^3.0.0",
|
|
117
|
+
"rollup-plugin-svgo": "^2.0.0",
|
|
118
|
+
"storybook": "^8.4.7",
|
|
119
|
+
"typescript": "^5.7.2",
|
|
120
|
+
"typescript-plugin-css-modules": "^5.1.0",
|
|
121
|
+
"vite": "^5.4.11",
|
|
122
|
+
"vite-plugin-dts": "^3.9.1",
|
|
123
|
+
"vite-plugin-lib-inject-css": "^2.1.1",
|
|
124
|
+
"vite-plugin-setting-css-module": "^1.1.4",
|
|
125
|
+
"vite-tsconfig-paths": "^4.3.2"
|
|
126
|
+
},
|
|
127
|
+
"main": "index.js",
|
|
128
|
+
"directories": {
|
|
129
|
+
"lib": "lib"
|
|
130
|
+
},
|
|
131
|
+
"author": "axos-web-dev",
|
|
132
|
+
"license": "ISC"
|
|
133
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const bubbleWrapper: string;
|
package/dist/Chatbot/Bubble.d.ts
DELETED
package/dist/Chatbot/Bubble.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { bubbleWrapper } from "./Bubble.css.js";
|
|
4
|
-
import { useOpenChat } from "./store/chat.js";
|
|
5
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
6
|
-
const Bubble = ({ children }) => {
|
|
7
|
-
const isOpen = useOpenChat((state) => state.isOpen);
|
|
8
|
-
const toggle = useOpenChat((state) => state.toggle);
|
|
9
|
-
return /* @__PURE__ */ jsxs("div", { className: bubbleWrapper, onClick: toggle, children: [
|
|
10
|
-
/* @__PURE__ */ jsx("div", { className: "bubble-circle", children: /* @__PURE__ */ jsx(AnimatePresence, { children: !isOpen ? /* @__PURE__ */ jsx(
|
|
11
|
-
motion.img,
|
|
12
|
-
{
|
|
13
|
-
alt: "Evo, Virtual Financial Assistant",
|
|
14
|
-
src: "https://www.axos.com/images/5yPSYWRtCV9kNiVUzGONdb/axb-chat-bubble.png",
|
|
15
|
-
height: 36,
|
|
16
|
-
width: 36,
|
|
17
|
-
initial: { scale: 0.1, opacity: 0 },
|
|
18
|
-
animate: {
|
|
19
|
-
scale: 1,
|
|
20
|
-
opacity: 1,
|
|
21
|
-
transition: {
|
|
22
|
-
default: { type: "spring" },
|
|
23
|
-
opacity: { ease: [0, 0.71, 0.2, 1.01] }
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
) : /* @__PURE__ */ jsx("span", { className: "close-icon", children: /* @__PURE__ */ jsx(
|
|
28
|
-
motion.img,
|
|
29
|
-
{
|
|
30
|
-
alt: "Close chat",
|
|
31
|
-
src: "https://www.axos.com/images/7kHGbXlPvoGOC4YL3Ae5cg/axb-x-close.svg",
|
|
32
|
-
initial: { opacity: 0, rotate: 0 },
|
|
33
|
-
animate: {
|
|
34
|
-
opacity: 1,
|
|
35
|
-
rotate: -90,
|
|
36
|
-
transition: {
|
|
37
|
-
default: { type: "spring" },
|
|
38
|
-
opacity: { ease: "linear" }
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
) }) }) }),
|
|
43
|
-
children
|
|
44
|
-
] });
|
|
45
|
-
};
|
|
46
|
-
export {
|
|
47
|
-
Bubble
|
|
48
|
-
};
|
package/dist/Chatbot/Chat.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Chat(): import("react/jsx-runtime").JSX.Element;
|
package/dist/Chatbot/Chat.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useRef, useEffect } from "react";
|
|
4
|
-
import { authenticate } from "./authenticate.js";
|
|
5
|
-
import { useMessages } from "./store/messages.js";
|
|
6
|
-
const companyId = process.env.CCAI_COMPANY_ID || "";
|
|
7
|
-
const tenant = process.env.CCAI_TENANT_NAME || "";
|
|
8
|
-
const host = process.env.CCAI_HOST || "";
|
|
9
|
-
const COBROWSE_CONSENT_TEMPLATE = `
|
|
10
|
-
<script class="cobrowse-template" type="text/template">
|
|
11
|
-
<div class="cobrowse">
|
|
12
|
-
<div class="cobrowse-title">$title</div>
|
|
13
|
-
<div class="cobrowse-content">$content</div>
|
|
14
|
-
<div class="cobrowse-footer">
|
|
15
|
-
<button class="cobrowse-deny js-cobrowse-deny">$deny</button>
|
|
16
|
-
<button class="cobrowse-allow js-cobrowse-allow">$allow</button>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
<\/script>
|
|
20
|
-
`;
|
|
21
|
-
function Chat() {
|
|
22
|
-
const clientRef = useRef(null);
|
|
23
|
-
const hasLoadedBefore = useRef(true);
|
|
24
|
-
const addMessages = useMessages((state) => state.addMessages);
|
|
25
|
-
const addMessage = useMessages((state) => state.addMessage);
|
|
26
|
-
const chatRef = useRef(null);
|
|
27
|
-
const isMounted = useRef(true);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
let messageHandler;
|
|
30
|
-
let identityHandler;
|
|
31
|
-
let chatUpdatedHandler;
|
|
32
|
-
let memberJoinedHandler;
|
|
33
|
-
let chatConnectedHandler;
|
|
34
|
-
async function initChat() {
|
|
35
|
-
const { Client, consoleLoggerHandler, Logger } = await import("@ujet/websdk-headless");
|
|
36
|
-
console.log("this", isMounted);
|
|
37
|
-
Logger.addHandler(consoleLoggerHandler);
|
|
38
|
-
clientRef.current = new Client({
|
|
39
|
-
companyId,
|
|
40
|
-
tenant,
|
|
41
|
-
cobrowse: {
|
|
42
|
-
enabled: true,
|
|
43
|
-
template: COBROWSE_CONSENT_TEMPLATE,
|
|
44
|
-
messages: {
|
|
45
|
-
confirmSessionTitle: "...",
|
|
46
|
-
confirmSessionContent: "...",
|
|
47
|
-
endSessionText: "...",
|
|
48
|
-
confirmRemoteControlTitle: "...",
|
|
49
|
-
confirmRemoteControlContent: "...",
|
|
50
|
-
confirmFullDeviceTitle: "...",
|
|
51
|
-
confirmFullDeviceContent: "...",
|
|
52
|
-
allowText: "...",
|
|
53
|
-
denyText: "..."
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
host,
|
|
57
|
-
authenticate
|
|
58
|
-
});
|
|
59
|
-
const menus = await clientRef.current?.getMenus();
|
|
60
|
-
try {
|
|
61
|
-
chatRef.current = await clientRef.current?.loadOngoingChat();
|
|
62
|
-
console.log("chat:", chatRef.current);
|
|
63
|
-
if (!chatRef.current) {
|
|
64
|
-
chatRef.current = await clientRef.current?.createChat(
|
|
65
|
-
menus?.menus[5].id
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error("Error creating chat:", error);
|
|
70
|
-
chatRef.current = await clientRef.current?.createChat(
|
|
71
|
-
menus?.menus[5].id
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
console.log("this");
|
|
75
|
-
identityHandler = (identity) => {
|
|
76
|
-
if (!isMounted.current) return;
|
|
77
|
-
console.log("identity:", identity);
|
|
78
|
-
};
|
|
79
|
-
messageHandler = (msg) => {
|
|
80
|
-
console.log("new message:", msg);
|
|
81
|
-
console.log("addMessage:", msg);
|
|
82
|
-
addMessage(msg);
|
|
83
|
-
};
|
|
84
|
-
chatUpdatedHandler = (chat) => {
|
|
85
|
-
console.log("chat updated:", chat);
|
|
86
|
-
};
|
|
87
|
-
chatConnectedHandler = async () => {
|
|
88
|
-
console.log("connected");
|
|
89
|
-
const messagesFetched = await clientRef.current?.fetchMessages();
|
|
90
|
-
console.log("[messages]:", messagesFetched);
|
|
91
|
-
addMessages(messagesFetched || []);
|
|
92
|
-
};
|
|
93
|
-
memberJoinedHandler = (identity) => {
|
|
94
|
-
console.log("member joined:", identity);
|
|
95
|
-
};
|
|
96
|
-
console.log(isMounted.current);
|
|
97
|
-
clientRef.current?.on("authenticated", () => {
|
|
98
|
-
console.log("authenticated");
|
|
99
|
-
});
|
|
100
|
-
clientRef.current?.on("chat.ongoing", (chat) => {
|
|
101
|
-
if (!isMounted.current) return;
|
|
102
|
-
console.log("chat:", chat);
|
|
103
|
-
});
|
|
104
|
-
clientRef.current?.on("chat.connected", chatConnectedHandler);
|
|
105
|
-
clientRef.current?.on("chat.updated", chatUpdatedHandler);
|
|
106
|
-
clientRef.current?.on("chat.identity", identityHandler);
|
|
107
|
-
clientRef.current?.on("chat.message", messageHandler);
|
|
108
|
-
clientRef.current?.on("cobrowse.request", ({ from }) => {
|
|
109
|
-
console.log("request by", from);
|
|
110
|
-
});
|
|
111
|
-
clientRef.current?.on("chat.memberJoined", memberJoinedHandler);
|
|
112
|
-
}
|
|
113
|
-
if (hasLoadedBefore.current) {
|
|
114
|
-
console.log("Initial setup");
|
|
115
|
-
initChat();
|
|
116
|
-
hasLoadedBefore.current = false;
|
|
117
|
-
}
|
|
118
|
-
return () => {
|
|
119
|
-
isMounted.current = false;
|
|
120
|
-
console.log("Component unmounted. Cancelling pending async operations.");
|
|
121
|
-
if (clientRef.current) {
|
|
122
|
-
if (messageHandler)
|
|
123
|
-
clientRef.current.off("chat.message", messageHandler);
|
|
124
|
-
if (identityHandler)
|
|
125
|
-
clientRef.current.off("chat.identity", identityHandler);
|
|
126
|
-
clientRef.current.off("chat.connected", chatConnectedHandler);
|
|
127
|
-
clientRef.current.off("chat.updated", chatUpdatedHandler);
|
|
128
|
-
clientRef.current.off("chat.memberJoined", memberJoinedHandler);
|
|
129
|
-
if (typeof clientRef.current.destroyChat === "function") {
|
|
130
|
-
console.log("Destroying chat:", chatRef.current);
|
|
131
|
-
clientRef.current.destroyChat();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}, [addMessage, addMessages]);
|
|
136
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
137
|
-
/* @__PURE__ */ jsx("h2", { children: "Chat" }),
|
|
138
|
-
/* @__PURE__ */ jsxs(
|
|
139
|
-
"form",
|
|
140
|
-
{
|
|
141
|
-
style: { marginTop: "1rem", display: "flex", gap: "0.5rem" },
|
|
142
|
-
onSubmit: async (e) => {
|
|
143
|
-
e.preventDefault();
|
|
144
|
-
const form = e.target;
|
|
145
|
-
const input = form.elements[0];
|
|
146
|
-
const message = input.value;
|
|
147
|
-
console.log("Sending message:", message);
|
|
148
|
-
try {
|
|
149
|
-
await clientRef.current?.sendTextMessage(message);
|
|
150
|
-
input.value = "";
|
|
151
|
-
} catch (error) {
|
|
152
|
-
console.error("Error sending message:", error);
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
children: [
|
|
156
|
-
/* @__PURE__ */ jsx("input", { type: "text", name: "message", placeholder: "Type a message..." }),
|
|
157
|
-
/* @__PURE__ */ jsx("button", { type: "submit", children: "Send" })
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
] });
|
|
162
|
-
}
|
|
163
|
-
export {
|
|
164
|
-
Chat as default
|
|
165
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const windowStyle: string;
|
|
2
|
-
export declare const windowOpenStyle: string;
|
|
3
|
-
export declare const windowBarStyle: string;
|
|
4
|
-
export declare const chat_title: string;
|
|
5
|
-
export declare const button_reset: string;
|
|
6
|
-
export declare const inputStyle: string;
|
|
7
|
-
export declare const sendButtonStyle: string;
|
|
8
|
-
export declare const messagesContainerStyle: string;
|
|
9
|
-
export declare const notificationStyle: string;
|
|
10
|
-
export declare const messageStyle: string;
|
|
11
|
-
export declare const inline_button_wrapper: string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import '../assets/Chatbot/ChatWindow.css';/* empty css */
|
|
2
|
-
var windowStyle = "_13n1jqk0";
|
|
3
|
-
var windowOpenStyle = "_13n1jqk1";
|
|
4
|
-
var windowBarStyle = "_13n1jqk2";
|
|
5
|
-
var chat_title = "_13n1jqk3";
|
|
6
|
-
var button_reset = "_13n1jqk4";
|
|
7
|
-
var inputStyle = "_13n1jqk5";
|
|
8
|
-
var sendButtonStyle = "_13n1jqk6";
|
|
9
|
-
var messagesContainerStyle = "_13n1jqk7";
|
|
10
|
-
var notificationStyle = "_13n1jqk8";
|
|
11
|
-
var messageStyle = "_13n1jqk9";
|
|
12
|
-
var inline_button_wrapper = "_13n1jqka";
|
|
13
|
-
export {
|
|
14
|
-
button_reset,
|
|
15
|
-
chat_title,
|
|
16
|
-
inline_button_wrapper,
|
|
17
|
-
inputStyle,
|
|
18
|
-
messageStyle,
|
|
19
|
-
messagesContainerStyle,
|
|
20
|
-
notificationStyle,
|
|
21
|
-
sendButtonStyle,
|
|
22
|
-
windowBarStyle,
|
|
23
|
-
windowOpenStyle,
|
|
24
|
-
windowStyle
|
|
25
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MessageResponse as BaseMessageResponse, HumanAgent } from '@ujet/websdk-headless';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
|
|
4
|
-
interface MessageResponse extends BaseMessageResponse {
|
|
5
|
-
to_agent?: HumanAgent;
|
|
6
|
-
}
|
|
7
|
-
export interface ChatBubble {
|
|
8
|
-
id: string | number;
|
|
9
|
-
body: string;
|
|
10
|
-
sender?: string;
|
|
11
|
-
timestamp?: string;
|
|
12
|
-
isOwn?: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface ChatWindowProps {
|
|
15
|
-
messages: MessageResponse[];
|
|
16
|
-
status?: string;
|
|
17
|
-
onSend: (msg: string) => void;
|
|
18
|
-
inputDisabled?: boolean;
|
|
19
|
-
onClose?: () => void;
|
|
20
|
-
endChat?: () => void;
|
|
21
|
-
}
|
|
22
|
-
export declare const ChatWindow: React.FC<ChatWindowProps>;
|
|
23
|
-
export {};
|