@microsoft/omnichannel-chat-widget 1.2.4-main.9847fc4 → 1.3.1-main.0ab8965
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/lib/cjs/assets/Icons.js +10 -2
- package/lib/cjs/common/Constants.js +15 -1
- package/lib/cjs/common/telemetry/TelemetryConstants.js +4 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +5 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +53 -4
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +9 -7
- package/lib/cjs/components/livechatwidget/common/startChat.js +1 -1
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +31 -6
- package/lib/cjs/components/notificationpanestateful/NotificationPaneStateful.js +177 -0
- package/lib/cjs/components/notificationpanestateful/defaultProps/defaultChatDisconnectControlProps.js +41 -0
- package/lib/cjs/components/notificationpanestateful/defaultProps/defaultChatDisconnectStyleProps.js +98 -0
- package/lib/cjs/components/notificationpanestateful/interfaces/INotificationPaneStatefulProps.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +13 -7
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +4 -3
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +40 -101
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.js +92 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentContent.js +17 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentIcon.js +21 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/DownloadBlockedAttachment.js +36 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/FileScanStatus.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/MaliciousAttachment.js +24 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/ScanInProgressAttachment.js +24 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Spinner.js +41 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.js +35 -0
- package/lib/esm/assets/Icons.js +5 -1
- package/lib/esm/common/Constants.js +13 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +4 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +5 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +51 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +9 -7
- package/lib/esm/components/livechatwidget/common/startChat.js +1 -1
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +31 -6
- package/lib/esm/components/notificationpanestateful/NotificationPaneStateful.js +167 -0
- package/lib/esm/components/notificationpanestateful/defaultProps/defaultChatDisconnectControlProps.js +34 -0
- package/lib/esm/components/notificationpanestateful/defaultProps/defaultChatDisconnectStyleProps.js +91 -0
- package/lib/esm/components/notificationpanestateful/interfaces/INotificationPaneStatefulProps.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +13 -7
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +4 -3
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +36 -96
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.js +84 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentContent.js +9 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentIcon.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/DownloadBlockedAttachment.js +28 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/FileScanStatus.js +7 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/MaliciousAttachment.js +16 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/ScanInProgressAttachment.js +16 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Spinner.js +33 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.js +28 -0
- package/lib/types/assets/Icons.d.ts +4 -0
- package/lib/types/common/Constants.d.ts +14 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/notificationpanestateful/NotificationPaneStateful.d.ts +3 -0
- package/lib/types/components/notificationpanestateful/defaultProps/defaultChatDisconnectControlProps.d.ts +2 -0
- package/lib/types/components/notificationpanestateful/defaultProps/defaultChatDisconnectStyleProps.d.ts +2 -0
- package/lib/types/components/notificationpanestateful/interfaces/INotificationPaneStatefulProps.d.ts +13 -0
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentContent.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentIcon.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/DownloadBlockedAttachment.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/FileScanStatus.d.ts +6 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/MaliciousAttachment.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/ScanInProgressAttachment.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Spinner.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.d.ts +3 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +7 -0
- package/package.json +5 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NotificationPaneConstants } from "../../../common/Constants";
|
|
2
|
+
import { NotificationAlertIcon } from "../../../assets/Icons";
|
|
3
|
+
export const defaultChatDisconnectControlProps = {
|
|
4
|
+
hideTitle: false,
|
|
5
|
+
titleText: NotificationPaneConstants.ChatDisconnectTitleText,
|
|
6
|
+
hideSubtitle: false,
|
|
7
|
+
subtitleText: NotificationPaneConstants.ChatDisconnectSubtitleText,
|
|
8
|
+
hideIcon: false,
|
|
9
|
+
notificationIconProps: {
|
|
10
|
+
id: NotificationPaneConstants.IconId,
|
|
11
|
+
src: NotificationAlertIcon,
|
|
12
|
+
alt: NotificationPaneConstants.IconText
|
|
13
|
+
},
|
|
14
|
+
hideHyperlink: true,
|
|
15
|
+
hyperlinkText: "Learn more",
|
|
16
|
+
hyperlinkAriaLabel: "Learn more",
|
|
17
|
+
hyperlinkHref: "https://www.microsoft.com",
|
|
18
|
+
hideDismissButton: false,
|
|
19
|
+
dismissButtonProps: {
|
|
20
|
+
id: NotificationPaneConstants.DismissId,
|
|
21
|
+
text: NotificationPaneConstants.DismissText,
|
|
22
|
+
type: "icon",
|
|
23
|
+
iconName: NotificationPaneConstants.ChromeCloseIconName,
|
|
24
|
+
ariaLabel: NotificationPaneConstants.DismissAriaLabel
|
|
25
|
+
},
|
|
26
|
+
hideCloseChatButton: false,
|
|
27
|
+
closeChatButtonProps: {
|
|
28
|
+
id: NotificationPaneConstants.CloseChatId,
|
|
29
|
+
text: NotificationPaneConstants.CloseChatText,
|
|
30
|
+
type: "text",
|
|
31
|
+
iconName: NotificationPaneConstants.ChromeCloseIconName,
|
|
32
|
+
ariaLabel: NotificationPaneConstants.CloseChatAriaLabel
|
|
33
|
+
}
|
|
34
|
+
};
|
package/lib/esm/components/notificationpanestateful/defaultProps/defaultChatDisconnectStyleProps.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export const defaultChatDisconnectStyleProps = {
|
|
2
|
+
generalStyleProps: {
|
|
3
|
+
backgroundColor: "#FFF4CE",
|
|
4
|
+
display: "flex"
|
|
5
|
+
},
|
|
6
|
+
notificationIconStyleProps: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
height: "19px",
|
|
9
|
+
width: "19px"
|
|
10
|
+
},
|
|
11
|
+
notificationIconContainerStyleProps: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
width: "36px",
|
|
14
|
+
height: "32px",
|
|
15
|
+
flexShrink: "0",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
alignItems: "center"
|
|
18
|
+
},
|
|
19
|
+
titleStyleProps: {
|
|
20
|
+
fontFamily: "'Segoe UI', Arial, sans-serif",
|
|
21
|
+
fontSize: "87.5%",
|
|
22
|
+
minHeight: "32px",
|
|
23
|
+
fontWeight: "bold"
|
|
24
|
+
},
|
|
25
|
+
subtitleStyleProps: {
|
|
26
|
+
fontFamily: "'Segoe UI', Arial, sans-serif",
|
|
27
|
+
fontSize: "87.5%",
|
|
28
|
+
fontWeight: "normal"
|
|
29
|
+
},
|
|
30
|
+
hyperlinkStyleProps: {
|
|
31
|
+
fontFamily: "'Segoe UI', Arial, sans-serif",
|
|
32
|
+
fontSize: "87.5%",
|
|
33
|
+
textDecoration: "none",
|
|
34
|
+
color: "#0078d4",
|
|
35
|
+
fontWeight: "normal"
|
|
36
|
+
},
|
|
37
|
+
hyperlinkHoverStyleProps: {
|
|
38
|
+
textDecoration: "none",
|
|
39
|
+
color: "#005a9e"
|
|
40
|
+
},
|
|
41
|
+
dismissButtonStyleProps: {
|
|
42
|
+
width: "22px",
|
|
43
|
+
height: "22px",
|
|
44
|
+
borderRadius: "3px",
|
|
45
|
+
border: "0",
|
|
46
|
+
margin: "4px",
|
|
47
|
+
backgroundColor: "transparent",
|
|
48
|
+
color: "black",
|
|
49
|
+
icon: {
|
|
50
|
+
fontSize: "14px"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
dismissButtonHoverStyleProps: {
|
|
54
|
+
filter: "brightness(0.8)",
|
|
55
|
+
icon: {
|
|
56
|
+
color: "black"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
closeChatButtonStyleProps: {
|
|
60
|
+
backgroundColor: "white",
|
|
61
|
+
fontFamily: "Segoe UI, Arial, sans-serif",
|
|
62
|
+
fontSize: "87.5%",
|
|
63
|
+
fontWeight: "500",
|
|
64
|
+
height: "32px",
|
|
65
|
+
width: "80px",
|
|
66
|
+
padding: "0px"
|
|
67
|
+
},
|
|
68
|
+
closeChatButtonHoverStyleProps: {
|
|
69
|
+
filter: "brightness(0.8)"
|
|
70
|
+
},
|
|
71
|
+
infoGroupStyleProps: {
|
|
72
|
+
display: "flex",
|
|
73
|
+
justifyContent: "space-between",
|
|
74
|
+
flex: "1 1 0%",
|
|
75
|
+
marginTop: "2px"
|
|
76
|
+
},
|
|
77
|
+
buttonGroupStyleProps: {
|
|
78
|
+
display: "flex",
|
|
79
|
+
justifyContent: "flex-end",
|
|
80
|
+
margin: "8px"
|
|
81
|
+
},
|
|
82
|
+
classNames: {
|
|
83
|
+
containerClassName: "chat-disconnect-container",
|
|
84
|
+
titleClassName: "chat-disconnect-title",
|
|
85
|
+
subtitleClassName: "chat-disconnect-subtitle",
|
|
86
|
+
dismissButtonClassName: "chat-disconnect-dismiss-button",
|
|
87
|
+
hyperlinkClassName: "chat-disconnect-hyperlink",
|
|
88
|
+
notificationIconClassName: "chat-disconnect-notification-icon",
|
|
89
|
+
closeChatButtonClassName: "chat-disconnect-close-chat-button"
|
|
90
|
+
}
|
|
91
|
+
};
|
package/lib/esm/components/notificationpanestateful/interfaces/INotificationPaneStatefulProps.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -47,7 +47,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export const WebChatContainerStateful = props => {
|
|
50
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14
|
|
50
|
+
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain3, _props$webChatContain4, _defaultWebChatContai, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai2, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14;
|
|
51
51
|
const {
|
|
52
52
|
BasicWebChat
|
|
53
53
|
} = Components;
|
|
@@ -145,21 +145,27 @@ export const WebChatContainerStateful = props => {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
div[class="ac-textBlock"] *,
|
|
148
|
-
div[class="ac-input-container"] * {
|
|
148
|
+
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
149
|
+
|
|
150
|
+
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
151
|
+
background-color: ${((_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : (_props$webChatContain4 = _props$webChatContain3.webChatStyles) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.bubbleBackground) ?? ((_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
|
|
152
|
+
color:${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleTextColor) ?? ((_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
|
|
153
|
+
}
|
|
154
|
+
|
|
149
155
|
div[class="ac-textBlock"] a:link,
|
|
150
156
|
div[class="ac-textBlock"] a:visited,
|
|
151
157
|
div[class="ac-textBlock"] a:hover,
|
|
152
158
|
div[class="ac-textBlock"] a:active {
|
|
153
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
159
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
|
|
154
160
|
}
|
|
155
161
|
|
|
156
|
-
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
162
|
+
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
157
163
|
|
|
158
164
|
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
159
165
|
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
160
166
|
height: '.75em';
|
|
161
167
|
marginLeft: '.25em';
|
|
162
|
-
filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
168
|
+
filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp9 === void 0 ? void 0 : (_webChatContainerProp10 = _webChatContainerProp9.receivedMessageAnchorStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.filter) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.filter)};
|
|
163
169
|
}
|
|
164
170
|
pre {
|
|
165
171
|
white-space: pre-wrap;
|
|
@@ -172,13 +178,13 @@ export const WebChatContainerStateful = props => {
|
|
|
172
178
|
.ms_lcw_webchat_received_message a:visited,
|
|
173
179
|
.ms_lcw_webchat_received_message a:hover,
|
|
174
180
|
.ms_lcw_webchat_received_message a:active {
|
|
175
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
181
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp11 === void 0 ? void 0 : (_webChatContainerProp12 = _webChatContainerProp11.receivedMessageAnchorStyles) === null || _webChatContainerProp12 === void 0 ? void 0 : _webChatContainerProp12.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
|
|
176
182
|
}
|
|
177
183
|
.ms_lcw_webchat_sent_message a:link,
|
|
178
184
|
.ms_lcw_webchat_sent_message a:visited,
|
|
179
185
|
.ms_lcw_webchat_sent_message a:hover,
|
|
180
186
|
.ms_lcw_webchat_sent_message a:active {
|
|
181
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
187
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp13 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp13 === void 0 ? void 0 : (_webChatContainerProp14 = _webChatContainerProp13.sentMessageAnchorStyles) === null || _webChatContainerProp14 === void 0 ? void 0 : _webChatContainerProp14.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
|
|
182
188
|
}
|
|
183
189
|
`), /*#__PURE__*/React.createElement(Stack, {
|
|
184
190
|
styles: containerStyles
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/*
|
|
2
2
|
MIDDLEWARE_BANNER_FILE parameters:
|
|
3
3
|
{0} = File limit size
|
|
4
4
|
{1} = File extension
|
|
5
|
-
{2} = File name
|
|
5
|
+
{2} = File name
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export const defaultMiddlewareLocalizedTexts = {
|
|
@@ -25,5 +25,6 @@ export const defaultMiddlewareLocalizedTexts = {
|
|
|
25
25
|
MIDDLEWARE_MESSAGE_NOT_DELIVERED: "Not Delivered",
|
|
26
26
|
MIDDLEWARE_MESSAGE_RETRY: "Retry",
|
|
27
27
|
MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
|
|
28
|
-
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Third party cookies are blocked. Reloading this page will start a new conversation."
|
|
28
|
+
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Third party cookies are blocked. Reloading this page will start a new conversation.",
|
|
29
|
+
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware."
|
|
29
30
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/******
|
|
3
3
|
* AttachmentMiddleware
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* Handles attachment downloading.
|
|
6
6
|
******/
|
|
7
7
|
|
|
@@ -12,99 +12,15 @@ import { BroadcastEvent } from "../../../../../common/telemetry/TelemetryConstan
|
|
|
12
12
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
13
13
|
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
14
14
|
import { defaultAttachmentAdaptiveCardStyles } from "./defaultStyles/defaultAtttachmentAdaptiveCardStyles";
|
|
15
|
-
import { defaultAttachmentContentStyles } from "./defaultStyles/defaultAttachmentContentStyles";
|
|
16
|
-
import { defaultAttachmentDividerStyles } from "./defaultStyles/defaultAttachmentDividerStyles";
|
|
17
|
-
import { defaultAttachmentDownloadIconStyles } from "./defaultStyles/defaultAttachmentDownloadIconStyles";
|
|
18
|
-
import { defaultAttachmentFileNameStyles } from "./defaultStyles/defaultAttachmentFileNameStyles";
|
|
19
|
-
import { defaultAttachmentIconStyles } from "./defaultStyles/defaultAtttachmentIconStyles";
|
|
20
15
|
import { defaultAttachmentProps } from "../../../common/defaultProps/defaultAttachmentProps";
|
|
21
|
-
import { defaultAttachmentSizeStyles } from "./defaultStyles/defaultAttachmentSizeStyles";
|
|
22
|
-
import { defaultAttachmentStyles } from "./defaultStyles/defaultAtttachmentStyles";
|
|
23
16
|
import { useChatContextStore } from "../../../../..";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
-
id: props.id,
|
|
33
|
-
style: props.style
|
|
34
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
35
|
-
src: props.src ?? getFileAttachmentIconData("txt")
|
|
36
|
-
}));
|
|
37
|
-
};
|
|
38
|
-
const Attachment = props => {
|
|
39
|
-
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _state$domainStates$r4, _state$domainStates$r5, _state$domainStates$r6, _state$domainStates$r7, _state$domainStates$r8, _state$domainStates$r9;
|
|
40
|
-
const {
|
|
41
|
-
iconData,
|
|
42
|
-
imageCard,
|
|
43
|
-
textCard,
|
|
44
|
-
renderer
|
|
45
|
-
} = props;
|
|
46
|
-
const [state] = useChatContextStore();
|
|
47
|
-
const attachmentId = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : (_state$domainStates$r2 = _state$domainStates$r.attachmentProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.webChatAttachmentId) ?? defaultAttachmentProps.webChatAttachmentId;
|
|
48
|
-
const attachmentDividerStyles = {
|
|
49
|
-
...defaultAttachmentDividerStyles,
|
|
50
|
-
...((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : _state$domainStates$r3.attachmentDividerStyles)
|
|
51
|
-
};
|
|
52
|
-
const attachmentIconStyles = {
|
|
53
|
-
...defaultAttachmentIconStyles,
|
|
54
|
-
...((_state$domainStates$r4 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r4 === void 0 ? void 0 : _state$domainStates$r4.attachmentIconStyles)
|
|
55
|
-
};
|
|
56
|
-
const attachmentStyles = {
|
|
57
|
-
...defaultAttachmentStyles,
|
|
58
|
-
...((_state$domainStates$r5 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r5 === void 0 ? void 0 : _state$domainStates$r5.attachmentStyles)
|
|
59
|
-
};
|
|
60
|
-
const attachmentSizeStylesString = Object.entries({
|
|
61
|
-
...defaultAttachmentSizeStyles,
|
|
62
|
-
...((_state$domainStates$r6 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r6 === void 0 ? void 0 : _state$domainStates$r6.attachmentSizeStyles)
|
|
63
|
-
}).map(_ref => {
|
|
64
|
-
let [k, v] = _ref;
|
|
65
|
-
return `${k.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)}:${v}`;
|
|
66
|
-
}).join(";");
|
|
67
|
-
const attachmentContentStylesString = Object.entries({
|
|
68
|
-
...defaultAttachmentContentStyles,
|
|
69
|
-
...((_state$domainStates$r7 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r7 === void 0 ? void 0 : _state$domainStates$r7.attachmentContentStyles)
|
|
70
|
-
}).map(_ref2 => {
|
|
71
|
-
let [k, v] = _ref2;
|
|
72
|
-
return `${k.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)}:${v}`;
|
|
73
|
-
}).join(";");
|
|
74
|
-
const attachmentFileNameStylesString = Object.entries({
|
|
75
|
-
...defaultAttachmentFileNameStyles,
|
|
76
|
-
...((_state$domainStates$r8 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r8 === void 0 ? void 0 : _state$domainStates$r8.attachmentFileNameStyles)
|
|
77
|
-
}).map(_ref3 => {
|
|
78
|
-
let [k, v] = _ref3;
|
|
79
|
-
return `${k.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)}:${v}`;
|
|
80
|
-
}).join(";");
|
|
81
|
-
const attachmentDownloadIconStylesString = Object.entries({
|
|
82
|
-
...defaultAttachmentDownloadIconStyles,
|
|
83
|
-
...((_state$domainStates$r9 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r9 === void 0 ? void 0 : _state$domainStates$r9.attachmentDownloadIconStyles)
|
|
84
|
-
}).map(_ref4 => {
|
|
85
|
-
let [k, v] = _ref4;
|
|
86
|
-
return `${k.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)}:${v}`;
|
|
87
|
-
}).join(";");
|
|
88
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
89
|
-
.webchat__fileContent__size { ${attachmentSizeStylesString} }
|
|
90
|
-
.webchat__fileContent { ${attachmentContentStylesString} }
|
|
91
|
-
.webchat__fileContent__fileName { ${attachmentFileNameStylesString} }
|
|
92
|
-
.webchat__fileContent__downloadIcon { ${attachmentDownloadIconStylesString} }
|
|
93
|
-
`), /*#__PURE__*/React.createElement("div", {
|
|
94
|
-
dir: state.domainStates.globalDir
|
|
95
|
-
}, imageCard && renderer(imageCard), imageCard && /*#__PURE__*/React.createElement("hr", {
|
|
96
|
-
id: attachmentId + "-divider",
|
|
97
|
-
style: attachmentDividerStyles
|
|
98
|
-
}), /*#__PURE__*/React.createElement(AttachmentContent, {
|
|
99
|
-
attachment: textCard.attachment,
|
|
100
|
-
id: attachmentId,
|
|
101
|
-
style: attachmentStyles
|
|
102
|
-
}, /*#__PURE__*/React.createElement(AttachmentIcon, {
|
|
103
|
-
src: iconData,
|
|
104
|
-
id: attachmentId + "-icon",
|
|
105
|
-
style: attachmentIconStyles
|
|
106
|
-
}), textCard && renderer(textCard))));
|
|
107
|
-
};
|
|
17
|
+
import { NotificationHandler } from "../../notification/NotificationHandler";
|
|
18
|
+
import { NotificationScenarios } from "../../enums/NotificationScenarios";
|
|
19
|
+
import { defaultMiddlewareLocalizedTexts } from "../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
20
|
+
import Attachment from "./attachments/Attachment";
|
|
21
|
+
import ScanInProgressAttachment from "./attachments/ScanInProgressAttachment";
|
|
22
|
+
import MaliciousAttachment from "./attachments/MaliciousAttachment";
|
|
23
|
+
import FileScanStatus from "./attachments/FileScanStatus";
|
|
108
24
|
|
|
109
25
|
/**
|
|
110
26
|
* Patch card with different attachment data.
|
|
@@ -140,9 +56,9 @@ const genPreviewCardWithAttachment = (card, iconData, next) => {
|
|
|
140
56
|
});
|
|
141
57
|
};
|
|
142
58
|
const createAttachmentMiddleware = enableInlinePlaying => {
|
|
143
|
-
// eslint-disable-next-line react/display-name
|
|
59
|
+
// eslint-disable-next-line react/display-name
|
|
144
60
|
const attachmentMiddleware = () => next => function () {
|
|
145
|
-
var _state$domainStates$
|
|
61
|
+
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _card$activity$channe;
|
|
146
62
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
147
63
|
args[_key] = arguments[_key];
|
|
148
64
|
}
|
|
@@ -192,10 +108,10 @@ const createAttachmentMiddleware = enableInlinePlaying => {
|
|
|
192
108
|
}
|
|
193
109
|
}
|
|
194
110
|
const [state] = useChatContextStore();
|
|
195
|
-
const attachmentId = ((_state$domainStates$
|
|
111
|
+
const attachmentId = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : (_state$domainStates$r2 = _state$domainStates$r.attachmentProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.adaptiveCardAttachmentId) ?? defaultAttachmentProps.adaptiveCardAttachmentId;
|
|
196
112
|
const atttachmentAdaptiveCardStyles = {
|
|
197
113
|
...defaultAttachmentAdaptiveCardStyles,
|
|
198
|
-
...((_state$domainStates$
|
|
114
|
+
...((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : _state$domainStates$r3.attachmentAdaptiveCardStyles)
|
|
199
115
|
};
|
|
200
116
|
if (type === WebChatMiddlewareConstants.adaptiveCard || Constants.supportedAdaptiveCardContentTypes.indexOf(contentType) >= 0) {
|
|
201
117
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -213,6 +129,30 @@ const createAttachmentMiddleware = enableInlinePlaying => {
|
|
|
213
129
|
if (!attachment.name) {
|
|
214
130
|
return next(...args);
|
|
215
131
|
}
|
|
132
|
+
if (card.activity.channelData && card.activity.channelData.fileScan) {
|
|
133
|
+
const index = attachments.findIndex(attachment => attachment.name === card.attachment.name);
|
|
134
|
+
const {
|
|
135
|
+
activity: {
|
|
136
|
+
channelData: {
|
|
137
|
+
fileScan
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
} = card;
|
|
141
|
+
const scanResult = fileScan[index];
|
|
142
|
+
if ((scanResult === null || scanResult === void 0 ? void 0 : scanResult.status) === FileScanStatus.INPROGRESS) {
|
|
143
|
+
return /*#__PURE__*/React.createElement(ScanInProgressAttachment, {
|
|
144
|
+
textCard: card
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if ((scanResult === null || scanResult === void 0 ? void 0 : scanResult.status) === FileScanStatus.MALWARE) {
|
|
148
|
+
var _state$domainStates$m;
|
|
149
|
+
const localizedText = ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_FILE_IS_MALICIOUS) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_IS_MALICIOUS;
|
|
150
|
+
NotificationHandler.notifyError(NotificationScenarios.AttachmentError, localizedText.replace("{0}", attachment.name));
|
|
151
|
+
return /*#__PURE__*/React.createElement(MaliciousAttachment, {
|
|
152
|
+
textCard: card
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
216
156
|
const fileExtension = attachment.name.substring(attachment.name.lastIndexOf(".") + 1, attachment.name.length) || attachment.name;
|
|
217
157
|
const imageExtension = Constants.imageRegex.test(attachment.name);
|
|
218
158
|
const audioExtension = Constants.audioMediaRegex.test(attachment.name);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import useChatContextStore from "../../../../../../hooks/useChatContextStore";
|
|
3
|
+
import { defaultAttachmentProps } from "../../../../common/defaultProps/defaultAttachmentProps";
|
|
4
|
+
import { defaultAttachmentContentStyles } from "../defaultStyles/defaultAttachmentContentStyles";
|
|
5
|
+
import { defaultAttachmentDividerStyles } from "../defaultStyles/defaultAttachmentDividerStyles";
|
|
6
|
+
import { defaultAttachmentDownloadIconStyles } from "../defaultStyles/defaultAttachmentDownloadIconStyles";
|
|
7
|
+
import { defaultAttachmentFileNameStyles } from "../defaultStyles/defaultAttachmentFileNameStyles";
|
|
8
|
+
import { defaultAttachmentSizeStyles } from "../defaultStyles/defaultAttachmentSizeStyles";
|
|
9
|
+
import { defaultAttachmentIconStyles } from "../defaultStyles/defaultAtttachmentIconStyles";
|
|
10
|
+
import { defaultAttachmentStyles } from "../defaultStyles/defaultAtttachmentStyles";
|
|
11
|
+
import AttachmentContent from "./AttachmentContent";
|
|
12
|
+
import AttachmentIcon from "./AttachmentIcon";
|
|
13
|
+
const Attachment = props => {
|
|
14
|
+
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _state$domainStates$r4, _state$domainStates$r5, _state$domainStates$r6, _state$domainStates$r7, _state$domainStates$r8, _state$domainStates$r9;
|
|
15
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
16
|
+
const {
|
|
17
|
+
iconData,
|
|
18
|
+
imageCard,
|
|
19
|
+
textCard,
|
|
20
|
+
renderer
|
|
21
|
+
} = props;
|
|
22
|
+
const [state] = useChatContextStore();
|
|
23
|
+
const attachmentId = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : (_state$domainStates$r2 = _state$domainStates$r.attachmentProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.webChatAttachmentId) ?? defaultAttachmentProps.webChatAttachmentId;
|
|
24
|
+
const attachmentDividerStyles = {
|
|
25
|
+
...defaultAttachmentDividerStyles,
|
|
26
|
+
...((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : _state$domainStates$r3.attachmentDividerStyles)
|
|
27
|
+
};
|
|
28
|
+
const attachmentIconStyles = {
|
|
29
|
+
...defaultAttachmentIconStyles,
|
|
30
|
+
...((_state$domainStates$r4 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r4 === void 0 ? void 0 : _state$domainStates$r4.attachmentIconStyles)
|
|
31
|
+
};
|
|
32
|
+
const attachmentStyles = {
|
|
33
|
+
...defaultAttachmentStyles,
|
|
34
|
+
...((_state$domainStates$r5 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r5 === void 0 ? void 0 : _state$domainStates$r5.attachmentStyles)
|
|
35
|
+
};
|
|
36
|
+
const attachmentSizeStylesString = Object.entries({
|
|
37
|
+
...defaultAttachmentSizeStyles,
|
|
38
|
+
...((_state$domainStates$r6 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r6 === void 0 ? void 0 : _state$domainStates$r6.attachmentSizeStyles)
|
|
39
|
+
}).map(_ref => {
|
|
40
|
+
let [k, v] = _ref;
|
|
41
|
+
return `${k.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)}:${v}`;
|
|
42
|
+
}).join(";");
|
|
43
|
+
const attachmentContentStylesString = Object.entries({
|
|
44
|
+
...defaultAttachmentContentStyles,
|
|
45
|
+
...((_state$domainStates$r7 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r7 === void 0 ? void 0 : _state$domainStates$r7.attachmentContentStyles)
|
|
46
|
+
}).map(_ref2 => {
|
|
47
|
+
let [k, v] = _ref2;
|
|
48
|
+
return `${k.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)}:${v}`;
|
|
49
|
+
}).join(";");
|
|
50
|
+
const attachmentFileNameStylesString = Object.entries({
|
|
51
|
+
...defaultAttachmentFileNameStyles,
|
|
52
|
+
...((_state$domainStates$r8 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r8 === void 0 ? void 0 : _state$domainStates$r8.attachmentFileNameStyles)
|
|
53
|
+
}).map(_ref3 => {
|
|
54
|
+
let [k, v] = _ref3;
|
|
55
|
+
return `${k.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)}:${v}`;
|
|
56
|
+
}).join(";");
|
|
57
|
+
const attachmentDownloadIconStylesString = Object.entries({
|
|
58
|
+
...defaultAttachmentDownloadIconStyles,
|
|
59
|
+
...((_state$domainStates$r9 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r9 === void 0 ? void 0 : _state$domainStates$r9.attachmentDownloadIconStyles)
|
|
60
|
+
}).map(_ref4 => {
|
|
61
|
+
let [k, v] = _ref4;
|
|
62
|
+
return `${k.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)}:${v}`;
|
|
63
|
+
}).join(";");
|
|
64
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
65
|
+
.webchat__fileContent__size { ${attachmentSizeStylesString} }
|
|
66
|
+
.webchat__fileContent { ${attachmentContentStylesString} }
|
|
67
|
+
.webchat__fileContent__fileName { ${attachmentFileNameStylesString} }
|
|
68
|
+
.webchat__fileContent__downloadIcon { ${attachmentDownloadIconStylesString} }
|
|
69
|
+
`), /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
dir: state.domainStates.globalDir
|
|
71
|
+
}, imageCard && renderer(imageCard), imageCard && /*#__PURE__*/React.createElement("hr", {
|
|
72
|
+
id: attachmentId + "-divider",
|
|
73
|
+
style: attachmentDividerStyles
|
|
74
|
+
}), /*#__PURE__*/React.createElement(AttachmentContent, {
|
|
75
|
+
attachment: textCard.attachment,
|
|
76
|
+
id: attachmentId,
|
|
77
|
+
style: attachmentStyles
|
|
78
|
+
}, /*#__PURE__*/React.createElement(AttachmentIcon, {
|
|
79
|
+
src: iconData,
|
|
80
|
+
id: attachmentId + "-icon",
|
|
81
|
+
style: attachmentIconStyles
|
|
82
|
+
}), textCard && renderer(textCard))));
|
|
83
|
+
};
|
|
84
|
+
export default Attachment;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const AttachmentContent = props => {
|
|
3
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5
|
+
id: props.id,
|
|
6
|
+
style: props.style
|
|
7
|
+
}, props.children);
|
|
8
|
+
};
|
|
9
|
+
export default AttachmentContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { getFileAttachmentIconData } from "../../../../common/utils/FileAttachmentIconManager";
|
|
3
|
+
const AttachmentIcon = props => {
|
|
4
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6
|
+
id: props.id,
|
|
7
|
+
style: props.style
|
|
8
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
9
|
+
src: props.src ?? getFileAttachmentIconData("txt"),
|
|
10
|
+
alt: "attachment icon"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
export default AttachmentIcon;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Attachment from "./Attachment";
|
|
4
|
+
const DownloadBlockedAttachment = props => {
|
|
5
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
6
|
+
const renderer = () => /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
style: {
|
|
8
|
+
display: "flex",
|
|
9
|
+
padding: "10px 10px 10px 8px",
|
|
10
|
+
width: "100%"
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
style: {
|
|
14
|
+
fontSize: 12,
|
|
15
|
+
fontFamily: "Segoe UI, Arial, sans-serif"
|
|
16
|
+
}
|
|
17
|
+
}, " ", props.textCard.attachment.name, " "), /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
style: {
|
|
19
|
+
marginLeft: "auto",
|
|
20
|
+
paddingRight: "10px"
|
|
21
|
+
}
|
|
22
|
+
}, props.extraContent && props.extraContent));
|
|
23
|
+
return /*#__PURE__*/React.createElement(Attachment, _extends({}, props, {
|
|
24
|
+
imageCard: undefined,
|
|
25
|
+
renderer: renderer
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
export default DownloadBlockedAttachment;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React from "react";
|
|
3
|
+
import DownloadBlockedAttachment from "./DownloadBlockedAttachment";
|
|
4
|
+
import { CrossIcon, MaliciousFileIcon } from "../../../../../../assets/Icons";
|
|
5
|
+
const MaliciousAttachment = props => {
|
|
6
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
7
|
+
const extraContent = /*#__PURE__*/React.createElement("img", {
|
|
8
|
+
src: CrossIcon,
|
|
9
|
+
alt: "download blocked icon"
|
|
10
|
+
});
|
|
11
|
+
return /*#__PURE__*/React.createElement(DownloadBlockedAttachment, _extends({}, props, {
|
|
12
|
+
iconData: MaliciousFileIcon,
|
|
13
|
+
extraContent: extraContent
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
export default MaliciousAttachment;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Spinner from "./Spinner";
|
|
4
|
+
import DownloadBlockedAttachment from "./DownloadBlockedAttachment";
|
|
5
|
+
import { FileScanInProgressIcon } from "../../../../../../assets/Icons";
|
|
6
|
+
const ScanInProgressAttachment = props => {
|
|
7
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
8
|
+
const extraContent = /*#__PURE__*/React.createElement(Spinner, {
|
|
9
|
+
size: 16
|
|
10
|
+
});
|
|
11
|
+
return /*#__PURE__*/React.createElement(DownloadBlockedAttachment, _extends({}, props, {
|
|
12
|
+
iconData: FileScanInProgressIcon,
|
|
13
|
+
extraContent: extraContent
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
export default ScanInProgressAttachment;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const Spinner = props => {
|
|
3
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4
|
+
const spinnerStyle = {
|
|
5
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
6
|
+
boxSizing: "border-box",
|
|
7
|
+
borderRadius: "50%",
|
|
8
|
+
borderWidth: props.borderWidth || 2,
|
|
9
|
+
borderStyle: "solid",
|
|
10
|
+
borderColor: "rgb(0,120,212) rgb(199,224,244) rgb(199,224,244)",
|
|
11
|
+
borderImage: "initial",
|
|
12
|
+
animationName: "spin",
|
|
13
|
+
animationDuration: "1.3s",
|
|
14
|
+
animationIterationCount: "infinite",
|
|
15
|
+
animationTimingFunction: "cubic-bezier(0.53, 0.21, 0.29, 0.67)",
|
|
16
|
+
width: props.size || 20,
|
|
17
|
+
height: props.size || 20
|
|
18
|
+
};
|
|
19
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
20
|
+
@keyframes spin {
|
|
21
|
+
0% {
|
|
22
|
+
transform: rotate(0deg);
|
|
23
|
+
}
|
|
24
|
+
100% {
|
|
25
|
+
transform: rotate(360deg);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`), /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "spinner",
|
|
30
|
+
style: spinnerStyle
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
export default Spinner;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NotificationScenarios } from "../../enums/NotificationScenarios";
|
|
3
|
+
import NotificationPaneStateful from "../../../../notificationpanestateful/NotificationPaneStateful";
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
const createToastMiddleware = (notificationPaneProps, endChat) => {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/display-name
|
|
8
|
+
const toastMiddleware = () => next => card => {
|
|
9
|
+
const {
|
|
10
|
+
notification
|
|
11
|
+
} = card;
|
|
12
|
+
if (notificationPaneProps) {
|
|
13
|
+
if (notification.id === NotificationScenarios.ChatDisconnect) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(NotificationPaneStateful, {
|
|
15
|
+
notificationPaneProps: notificationPaneProps,
|
|
16
|
+
notificationScenarioType: NotificationScenarios.ChatDisconnect,
|
|
17
|
+
endChat: endChat
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// TODO: additional notification scenarios to be added...
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return next(card);
|
|
25
|
+
};
|
|
26
|
+
return toastMiddleware;
|
|
27
|
+
};
|
|
28
|
+
export default createToastMiddleware;
|