@axos-web-dev/shared-components 2.2.21 → 2.2.22

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.
@@ -9,7 +9,7 @@ import '../assets/themes/victorie.css';import '../assets/themes/ufb.css';import
9
9
  /* empty css */
10
10
  /* empty css */
11
11
  import clsx from "clsx";
12
- import { shimmerText, notificationStyle, messageStyle, user_msg, agent_msg, inline_button_wrapper, inline_button, endChatButtonStyle } from "./ChatWindow.css.js";
12
+ import { shimmerText, notificationStyle, trMortgageTable, tableCell, tableHead, tableMsg, messageStyle, user_msg, agent_msg, inline_button_wrapper, inline_button, endChatButtonStyle } from "./ChatWindow.css.js";
13
13
  import { useOpenChat } from "./store/chat.js";
14
14
  function timeAgo(date) {
15
15
  const seconds = Math.floor(((/* @__PURE__ */ new Date()).getTime() - date.getTime()) / 1e3);
@@ -68,172 +68,197 @@ const ChatbotMessage = ({
68
68
  }
69
69
  );
70
70
  }
71
- return /* @__PURE__ */ jsxs(Fragment, { children: [
72
- msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationStarted" && /* @__PURE__ */ jsx("div", { className: notificationStyle, children: "We are connecting you with a human agent..." }, msg.$index),
73
- msg.type == "noti" && msg.$userType == "system" && msg.event == "memberLeft" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
74
- /* @__PURE__ */ jsx("strong", { children: "Virtual Agent" }),
75
- " just left the conversation."
76
- ] }, msg.$index),
77
- msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationAccepted" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
78
- "You are now connected with a",
79
- " ",
80
- msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
81
- ] }, msg.$index),
82
- msg.type == "noti" && msg.$userType == "virtual_agent" && msg.event == "escalationDeflected" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
83
- "div",
84
- {
85
- className: notificationStyle,
86
- style: { fontSize: 12 },
87
- children: [
88
- "Our chat team is available weekdays, 8am-5pm, except federal bank holidays. For immediate assistance you can reach out to us at",
89
- " ",
90
- /* @__PURE__ */ jsx("a", { href: "tel:1-888-502-2967", children: "1-888-502-2967" }),
91
- "."
92
- ]
71
+ const checkInformationMortgage = typeof msg.content == "string" ? msg.content.replace(/•/g, "-").replace(/\\n/g, "\n") : "";
72
+ return /* @__PURE__ */ jsxs(
73
+ "div",
74
+ {
75
+ style: {
76
+ display: "flex",
77
+ flexDirection: "column"
93
78
  },
94
- msg.$index
95
- ) }),
96
- ["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsx(
97
- "div",
98
- {
99
- className: clsx(
100
- messageStyle,
101
- msg.$userType == "end_user" ? user_msg : agent_msg
79
+ children: [
80
+ msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationStarted" && /* @__PURE__ */ jsx("div", { className: notificationStyle, children: "We are connecting you with a human agent..." }, msg.$index),
81
+ msg.type == "noti" && msg.$userType == "system" && msg.event == "memberLeft" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
82
+ /* @__PURE__ */ jsx("strong", { children: "Virtual Agent" }),
83
+ " just left the conversation."
84
+ ] }, msg.$index),
85
+ msg.type == "noti" && msg.$userType == "system" && msg.event == "escalationAccepted" && /* @__PURE__ */ jsxs("div", { className: notificationStyle, children: [
86
+ "You are now connected with a",
87
+ " ",
88
+ msg.to_agent ? /* @__PURE__ */ jsx("strong", { children: msg?.to_agent?.name }) : "an agent"
89
+ ] }, msg.$index),
90
+ msg.type == "noti" && msg.$userType == "virtual_agent" && msg.event == "escalationDeflected" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
91
+ "div",
92
+ {
93
+ className: notificationStyle,
94
+ style: { fontSize: 12 },
95
+ children: [
96
+ "Our chat team is available weekdays, 8am-5pm, except federal bank holidays. For immediate assistance you can reach out to us at",
97
+ " ",
98
+ /* @__PURE__ */ jsx("a", { href: "tel:1-888-502-2967", children: "1-888-502-2967" }),
99
+ "."
100
+ ]
101
+ },
102
+ msg.$index
103
+ ) }),
104
+ ["text", "markdown_template", "markdown"].includes(msg.type) && /* @__PURE__ */ jsx(
105
+ "div",
106
+ {
107
+ className: clsx(
108
+ messageStyle,
109
+ msg.$userType == "end_user" ? user_msg : agent_msg
110
+ ),
111
+ children: /* @__PURE__ */ jsxs(
112
+ "div",
113
+ {
114
+ style: {
115
+ fontSize: 14,
116
+ display: "flex",
117
+ flexDirection: "column",
118
+ gap: 4
119
+ },
120
+ children: [
121
+ msg.$userType == "virtual_agent" && /* @__PURE__ */ jsxs(
122
+ "div",
123
+ {
124
+ style: {
125
+ display: "flex",
126
+ alignItems: "center",
127
+ gap: "8px"
128
+ },
129
+ children: [
130
+ showAvatar && /* @__PURE__ */ jsx(
131
+ "img",
132
+ {
133
+ width: 24,
134
+ height: 24,
135
+ src: virtualAgent?.avatar_url,
136
+ alt: "agent avatar"
137
+ }
138
+ ),
139
+ showName && /* @__PURE__ */ jsx("strong", { children: virtualAgent?.name })
140
+ ]
141
+ }
142
+ ),
143
+ msg.$userType != "end_user" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
144
+ ReactMarkdown,
145
+ {
146
+ remarkPlugins: [[remarkGfm, { singleTilde: false }]],
147
+ components: {
148
+ p: ({ ...props }) => /* @__PURE__ */ jsx(
149
+ "p",
150
+ {
151
+ style: { margin: 0, fontSize: "inherit" },
152
+ title: new Date(msg.$timestamp).toLocaleTimeString([], {
153
+ hour: "2-digit",
154
+ minute: "2-digit"
155
+ }),
156
+ ...props
157
+ }
158
+ ),
159
+ a: ({ ...props }) => /* @__PURE__ */ jsx("a", { style: { wordBreak: "break-word" }, ...props }),
160
+ table: ({ node, ...props }) => /* @__PURE__ */ jsx("div", { style: { overflowX: "auto", marginTop: 4 }, children: /* @__PURE__ */ jsx(
161
+ "table",
162
+ {
163
+ ...props,
164
+ className: clsx(tableMsg),
165
+ style: { tableLayout: "fixed" }
166
+ }
167
+ ) }),
168
+ th: ({ node, ...props }) => /* @__PURE__ */ jsx("th", { ...props, className: clsx(tableHead) }),
169
+ td: ({ node, ...props }) => /* @__PURE__ */ jsx("td", { ...props, className: clsx(tableCell) }),
170
+ tr: ({ node, ...props }) => {
171
+ return /* @__PURE__ */ jsx("tr", { className: clsx(trMortgageTable), ...props });
172
+ }
173
+ },
174
+ children: msg?.content?.includes("Does this information look correct?") ? checkInformationMortgage : msg.content
175
+ }
176
+ ) }) : /* @__PURE__ */ jsx(
177
+ "div",
178
+ {
179
+ title: new Date(msg.$timestamp).toLocaleTimeString([], {
180
+ hour: "2-digit",
181
+ minute: "2-digit"
182
+ }),
183
+ children: msg.content
184
+ }
185
+ )
186
+ ]
187
+ }
188
+ )
189
+ },
190
+ msg.$index
102
191
  ),
103
- children: /* @__PURE__ */ jsxs(
192
+ msg.type == "inline_button" && Array.isArray(msg.buttons) && msg.buttons.length > 0 && /* @__PURE__ */ jsx("div", { className: inline_button_wrapper, children: msg.buttons.length !== 0 && Array.isArray(msg.buttons) && msg.buttons.map((button, index) => {
193
+ return /* @__PURE__ */ jsx(
194
+ "button",
195
+ {
196
+ className: inline_button,
197
+ onClick: () => {
198
+ onSend?.(button?.title);
199
+ },
200
+ children: button.title
201
+ },
202
+ index
203
+ );
204
+ }) }),
205
+ " ",
206
+ msg.event == "chatEnded" && msg.status == "failed" && /* @__PURE__ */ jsxs(Fragment, { children: [
207
+ /* @__PURE__ */ jsxs(
208
+ "div",
209
+ {
210
+ title: (/* @__PURE__ */ new Date()).toLocaleString(),
211
+ style: {
212
+ fontSize: 12,
213
+ color: "#888",
214
+ marginBottom: 4,
215
+ textAlign: "center"
216
+ },
217
+ children: [
218
+ "No team members are online at the moment.",
219
+ /* @__PURE__ */ jsx("br", {}),
220
+ " Please try again later."
221
+ ]
222
+ }
223
+ ),
224
+ /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onEndChat, children: "End Chat" }) })
225
+ ] }),
226
+ msg.event == "chatEnded" && msg.status != "failed" && /* @__PURE__ */ jsxs(Fragment, { children: [
227
+ /* @__PURE__ */ jsxs(
228
+ "div",
229
+ {
230
+ title: (/* @__PURE__ */ new Date()).toLocaleString(),
231
+ style: {
232
+ fontSize: 12,
233
+ color: "#888",
234
+ marginBottom: 4,
235
+ textAlign: "center"
236
+ },
237
+ children: [
238
+ "Thank you for chatting!",
239
+ /* @__PURE__ */ jsx("br", {}),
240
+ " This conversation has ended."
241
+ ]
242
+ }
243
+ ),
244
+ /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onEndChat, children: "End Chat" }) })
245
+ ] }),
246
+ msg.type == "text" && /* @__PURE__ */ jsx(
104
247
  "div",
105
248
  {
106
249
  style: {
107
- fontSize: 14,
108
- display: "flex",
109
- flexDirection: "column",
110
- gap: 4
250
+ textAlign: msg.$userType === "end_user" ? "right" : "left",
251
+ fontSize: 12,
252
+ color: vars.chatbot.window.timestampColor,
253
+ textTransform: "capitalize",
254
+ fontFamily: "inherit"
111
255
  },
112
- children: [
113
- msg.$userType == "virtual_agent" && /* @__PURE__ */ jsxs(
114
- "div",
115
- {
116
- style: {
117
- display: "flex",
118
- alignItems: "center",
119
- gap: "8px"
120
- },
121
- children: [
122
- showAvatar && /* @__PURE__ */ jsx(
123
- "img",
124
- {
125
- width: 24,
126
- height: 24,
127
- src: virtualAgent?.avatar_url,
128
- alt: "agent avatar"
129
- }
130
- ),
131
- showName && /* @__PURE__ */ jsx("strong", { children: virtualAgent?.name })
132
- ]
133
- }
134
- ),
135
- msg.$userType != "end_user" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
136
- ReactMarkdown,
137
- {
138
- remarkPlugins: [[remarkGfm, { singleTilde: false }]],
139
- components: {
140
- p: ({ ...props }) => /* @__PURE__ */ jsx(
141
- "p",
142
- {
143
- style: { margin: 0, fontSize: "inherit" },
144
- title: new Date(msg.$timestamp).toLocaleTimeString([], {
145
- hour: "2-digit",
146
- minute: "2-digit"
147
- }),
148
- ...props
149
- }
150
- ),
151
- a: ({ ...props }) => /* @__PURE__ */ jsx("a", { style: { wordBreak: "break-word" }, ...props })
152
- },
153
- children: msg.content
154
- }
155
- ) }) : /* @__PURE__ */ jsx(
156
- "div",
157
- {
158
- title: new Date(msg.$timestamp).toLocaleTimeString([], {
159
- hour: "2-digit",
160
- minute: "2-digit"
161
- }),
162
- children: msg.content
163
- }
164
- )
165
- ]
256
+ children: timeText
166
257
  }
167
258
  )
168
- },
169
- msg.$index
170
- ),
171
- msg.type == "inline_button" && Array.isArray(msg.buttons) && msg.buttons.length > 0 && /* @__PURE__ */ jsx("div", { className: inline_button_wrapper, children: msg.buttons.length !== 0 && Array.isArray(msg.buttons) && msg.buttons.map((button, index) => {
172
- return /* @__PURE__ */ jsx(
173
- "button",
174
- {
175
- className: inline_button,
176
- onClick: () => {
177
- onSend?.(button?.title);
178
- },
179
- children: button.title
180
- },
181
- index
182
- );
183
- }) }),
184
- " ",
185
- msg.event == "chatEnded" && msg.status == "failed" && /* @__PURE__ */ jsxs(Fragment, { children: [
186
- /* @__PURE__ */ jsxs(
187
- "div",
188
- {
189
- title: (/* @__PURE__ */ new Date()).toLocaleString(),
190
- style: {
191
- fontSize: 12,
192
- color: "#888",
193
- marginBottom: 4,
194
- textAlign: "center"
195
- },
196
- children: [
197
- "No team members are online at the moment.",
198
- /* @__PURE__ */ jsx("br", {}),
199
- " Please try again later."
200
- ]
201
- }
202
- ),
203
- /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onEndChat, children: "End Chat" }) })
204
- ] }),
205
- msg.event == "chatEnded" && msg.status != "failed" && /* @__PURE__ */ jsxs(Fragment, { children: [
206
- /* @__PURE__ */ jsxs(
207
- "div",
208
- {
209
- title: (/* @__PURE__ */ new Date()).toLocaleString(),
210
- style: {
211
- fontSize: 12,
212
- color: "#888",
213
- marginBottom: 4,
214
- textAlign: "center"
215
- },
216
- children: [
217
- "Thank you for chatting!",
218
- /* @__PURE__ */ jsx("br", {}),
219
- " This conversation has ended."
220
- ]
221
- }
222
- ),
223
- /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: 12 }, children: /* @__PURE__ */ jsx("button", { className: endChatButtonStyle, onClick: onEndChat, children: "End Chat" }) })
224
- ] }),
225
- msg.type == "text" && /* @__PURE__ */ jsx(
226
- "div",
227
- {
228
- style: {
229
- textAlign: msg.$userType === "end_user" ? "right" : "left",
230
- fontSize: 12,
231
- color: vars.chatbot.window.timestampColor
232
- },
233
- children: timeText
234
- }
235
- )
236
- ] });
259
+ ]
260
+ }
261
+ );
237
262
  };
238
263
  export {
239
264
  ChatbotMessage
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": "2.2.21",
4
+ "version": "2.2.22",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.js",