@microsoft/omnichannel-chat-components 0.1.0-main.ae27766 → 0.1.0-main.bda05f5

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.
Files changed (111) hide show
  1. package/lib/cjs/common/Constants.js +12 -7
  2. package/lib/cjs/common/utils.js +21 -2
  3. package/lib/cjs/components/callingcontainer/subcomponents/CurrentCall/CurrentCall.js +31 -1
  4. package/lib/cjs/components/callingcontainer/subcomponents/CurrentCall/common/defaultStyles/customizedCurrentCallStyleProps.js +0 -12
  5. package/lib/cjs/components/callingcontainer/subcomponents/CurrentCall/common/defaultStyles/defaultCurrentCallStyleProps.js +0 -12
  6. package/lib/cjs/components/callingcontainer/subcomponents/IncomingCall/IncomingCall.js +45 -2
  7. package/lib/cjs/components/chatbutton/ChatButton.js +37 -26
  8. package/lib/cjs/components/chatbutton/common/defaultProps/defaultChatButtonControlProps.js +5 -2
  9. package/lib/cjs/components/chatbutton/common/defaultStyles/defaultChatButtonSubTitleStyles.js +1 -0
  10. package/lib/cjs/components/chatbutton/common/defaultStyles/defaultChatButtonTitleStyles.js +1 -0
  11. package/lib/cjs/components/common/commandbutton/CommandButton.js +36 -10
  12. package/lib/cjs/components/{header → common}/subcomponents/CloseButton.js +4 -3
  13. package/lib/cjs/components/confirmationpane/ConfirmationPane.js +19 -10
  14. package/lib/cjs/components/confirmationpane/common/defaultStyles/defaultConfirmationPaneButtonGroupStyles.js +5 -1
  15. package/lib/cjs/components/confirmationpane/common/defaultStyles/defaultConfirmationPaneGeneralStyles.js +7 -4
  16. package/lib/cjs/components/footer/Footer.js +2 -2
  17. package/lib/cjs/components/footer/common/defaultProps/defaultFooterControlProps.js +1 -0
  18. package/lib/cjs/components/footer/common/defaultStyles/defaultFooterStyleProps.js +12 -6
  19. package/lib/cjs/components/footer/subcomponents/AudioNotificationButton.js +29 -11
  20. package/lib/cjs/components/header/Header.js +2 -2
  21. package/lib/cjs/components/inputvalidationpane/InputValidationPane.js +76 -46
  22. package/lib/cjs/components/inputvalidationpane/common/default/defaultStyles/defaultInputValidationPaneCancelButtonStyles.js +2 -1
  23. package/lib/cjs/components/inputvalidationpane/common/default/defaultStyles/defaultInputValidationPaneInvalidInputErrorMessageStyles.js +1 -1
  24. package/lib/cjs/components/inputvalidationpane/common/default/defaultStyles/defaultInputValidationPaneSendButtonStyles.js +2 -1
  25. package/lib/cjs/components/loadingpane/common/defaultProps/defaultStyles/defaultLoadingPaneIconStyles.js +1 -1
  26. package/lib/cjs/components/outofofficehourspane/OOOHPane.js +13 -6
  27. package/lib/cjs/components/outofofficehourspane/common/defaultProps/defaultOOOHPaneControlProps.js +3 -1
  28. package/lib/cjs/components/outofofficehourspane/common/presetFourProps/presetFourOOOHPaneControlProps.js +15 -0
  29. package/lib/cjs/components/outofofficehourspane/common/presetFourProps/presetFourOOOHPaneProps.js +16 -0
  30. package/lib/cjs/components/postchatsurveypane/PostChatSurveyPane.js +2 -1
  31. package/lib/cjs/components/prechatsurveypane/PreChatSurveyPane.js +23 -9
  32. package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultPreChatSurveyPaneControlProps.js +1 -0
  33. package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneButtonStyles.js +4 -1
  34. package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultilineTextInputStyles.js +10 -0
  35. package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneStyles.js +7 -1
  36. package/lib/cjs/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneTextInputStyles.js +10 -0
  37. package/lib/cjs/components/prechatsurveypane/interfaces/IPreChatSurveyPaneElementStyles.js +1 -0
  38. package/lib/cjs/components/proactivechatpane/ProactiveChatPane.js +33 -30
  39. package/lib/cjs/components/proactivechatpane/common/default/defaultProps/defaultProactiveChatPaneControlProps.js +5 -1
  40. package/lib/cjs/components/proactivechatpane/common/default/defaultStyles/defaultProactiveChatPaneCloseButtonStyles.js +2 -13
  41. package/lib/cjs/components/proactivechatpane/common/presetOne/presetOneProps/presetOneProactiveChatPaneControlProps.js +5 -1
  42. package/lib/cjs/components/proactivechatpane/common/presetThree/presetThreeProps/presetThreeProactiveChatPaneControlProps.js +5 -1
  43. package/lib/cjs/components/reconnectchatpane/ReconnectChatPane.js +14 -12
  44. package/lib/cjs/index.js +6 -0
  45. package/lib/cjs/services/BroadcastService.js +36 -8
  46. package/lib/esm/common/Constants.js +10 -5
  47. package/lib/esm/common/utils.js +16 -0
  48. package/lib/esm/components/callingcontainer/subcomponents/CurrentCall/CurrentCall.js +33 -3
  49. package/lib/esm/components/callingcontainer/subcomponents/CurrentCall/common/defaultStyles/customizedCurrentCallStyleProps.js +0 -12
  50. package/lib/esm/components/callingcontainer/subcomponents/CurrentCall/common/defaultStyles/defaultCurrentCallStyleProps.js +0 -12
  51. package/lib/esm/components/callingcontainer/subcomponents/IncomingCall/IncomingCall.js +47 -4
  52. package/lib/esm/components/chatbutton/ChatButton.js +37 -26
  53. package/lib/esm/components/chatbutton/common/defaultProps/defaultChatButtonControlProps.js +5 -2
  54. package/lib/esm/components/chatbutton/common/defaultStyles/defaultChatButtonSubTitleStyles.js +1 -0
  55. package/lib/esm/components/chatbutton/common/defaultStyles/defaultChatButtonTitleStyles.js +1 -0
  56. package/lib/esm/components/common/commandbutton/CommandButton.js +36 -10
  57. package/lib/esm/components/{header → common}/subcomponents/CloseButton.js +4 -3
  58. package/lib/esm/components/confirmationpane/ConfirmationPane.js +20 -11
  59. package/lib/esm/components/confirmationpane/common/defaultStyles/defaultConfirmationPaneButtonGroupStyles.js +5 -1
  60. package/lib/esm/components/confirmationpane/common/defaultStyles/defaultConfirmationPaneGeneralStyles.js +7 -4
  61. package/lib/esm/components/footer/Footer.js +2 -2
  62. package/lib/esm/components/footer/common/defaultProps/defaultFooterControlProps.js +1 -0
  63. package/lib/esm/components/footer/common/defaultStyles/defaultFooterStyleProps.js +12 -6
  64. package/lib/esm/components/footer/subcomponents/AudioNotificationButton.js +29 -11
  65. package/lib/esm/components/header/Header.js +2 -2
  66. package/lib/esm/components/inputvalidationpane/InputValidationPane.js +77 -47
  67. package/lib/esm/components/inputvalidationpane/common/default/defaultStyles/defaultInputValidationPaneCancelButtonStyles.js +2 -1
  68. package/lib/esm/components/inputvalidationpane/common/default/defaultStyles/defaultInputValidationPaneInvalidInputErrorMessageStyles.js +1 -1
  69. package/lib/esm/components/inputvalidationpane/common/default/defaultStyles/defaultInputValidationPaneSendButtonStyles.js +2 -1
  70. package/lib/esm/components/loadingpane/common/defaultProps/defaultStyles/defaultLoadingPaneIconStyles.js +1 -1
  71. package/lib/esm/components/outofofficehourspane/OOOHPane.js +13 -7
  72. package/lib/esm/components/outofofficehourspane/common/defaultProps/defaultOOOHPaneControlProps.js +3 -1
  73. package/lib/esm/components/outofofficehourspane/common/presetFourProps/presetFourOOOHPaneControlProps.js +6 -0
  74. package/lib/esm/components/outofofficehourspane/common/presetFourProps/presetFourOOOHPaneProps.js +6 -0
  75. package/lib/esm/components/postchatsurveypane/PostChatSurveyPane.js +2 -1
  76. package/lib/esm/components/prechatsurveypane/PreChatSurveyPane.js +23 -9
  77. package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultPreChatSurveyPaneControlProps.js +1 -0
  78. package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneButtonStyles.js +4 -1
  79. package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultilineTextInputStyles.js +3 -0
  80. package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneStyles.js +5 -1
  81. package/lib/esm/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneTextInputStyles.js +3 -0
  82. package/lib/esm/components/prechatsurveypane/interfaces/IPreChatSurveyPaneElementStyles.js +1 -0
  83. package/lib/esm/components/proactivechatpane/ProactiveChatPane.js +30 -29
  84. package/lib/esm/components/proactivechatpane/common/default/defaultProps/defaultProactiveChatPaneControlProps.js +5 -1
  85. package/lib/esm/components/proactivechatpane/common/default/defaultStyles/defaultProactiveChatPaneCloseButtonStyles.js +2 -11
  86. package/lib/esm/components/proactivechatpane/common/presetOne/presetOneProps/presetOneProactiveChatPaneControlProps.js +5 -1
  87. package/lib/esm/components/proactivechatpane/common/presetThree/presetThreeProps/presetThreeProactiveChatPaneControlProps.js +5 -1
  88. package/lib/esm/components/reconnectchatpane/ReconnectChatPane.js +14 -12
  89. package/lib/esm/index.js +1 -0
  90. package/lib/esm/services/BroadcastService.js +34 -8
  91. package/lib/types/common/Constants.d.ts +8 -2
  92. package/lib/types/common/utils.d.ts +1 -0
  93. package/lib/types/components/callingcontainer/subcomponents/CurrentCall/interfaces/ICurrentCallStyleProps.d.ts +0 -4
  94. package/lib/types/components/chatbutton/interfaces/IChatButtonControlProps.d.ts +3 -0
  95. package/lib/types/components/common/interfaces/ICommandButtonControlProps.d.ts +1 -0
  96. package/lib/types/components/common/interfaces/ICommandButtonProps.d.ts +1 -0
  97. package/lib/types/components/{header → common}/subcomponents/CloseButton.d.ts +1 -1
  98. package/lib/types/components/confirmationpane/interfaces/IConfirmationPaneControlProps.d.ts +0 -1
  99. package/lib/types/components/inputvalidationpane/interfaces/IInputValidationPaneControlProps.d.ts +0 -1
  100. package/lib/types/components/outofofficehourspane/common/presetFourProps/presetFourOOOHPaneControlProps.d.ts +2 -0
  101. package/lib/types/components/outofofficehourspane/common/presetFourProps/presetFourOOOHPaneProps.d.ts +2 -0
  102. package/lib/types/components/outofofficehourspane/interfaces/IOOOHPaneControlProps.d.ts +1 -0
  103. package/lib/types/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneMultilineTextInputStyles.d.ts +2 -0
  104. package/lib/types/components/prechatsurveypane/common/defaultProps/defaultStyles/defaultPreChatSurveyPaneTextInputStyles.d.ts +2 -0
  105. package/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneButtonStyles.d.ts +3 -0
  106. package/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneElementStyles.d.ts +5 -0
  107. package/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneStyleProps.d.ts +5 -0
  108. package/lib/types/components/proactivechatpane/interfaces/IProactiveChatPaneControlProps.d.ts +2 -1
  109. package/lib/types/index.d.ts +1 -0
  110. package/lib/types/services/BroadcastService.d.ts +1 -0
  111. package/package.json +2 -2
@@ -93,4 +93,20 @@ export const addNoreferrerNoopenerTag = htmlNode => {
93
93
  }
94
94
  }
95
95
  }
96
+ };
97
+ export const replaceURLWithAnchor = (text, openInNewTab) => {
98
+ if (text) {
99
+ const modifiedText = text.replace(Regex.URLRegex, function (url) {
100
+ if (openInNewTab) {
101
+ // eslint-disable-next-line quotes
102
+ return '<a href="' + url + '" rel="noreferrer noopener" target="_blank">' + url + '</a>';
103
+ } // eslint-disable-next-line quotes
104
+
105
+
106
+ return '<a href="' + url + '">' + url + '</a>';
107
+ });
108
+ return modifiedText;
109
+ }
110
+
111
+ return text;
96
112
  };
@@ -1,15 +1,15 @@
1
- function _extends() { _extends = Object.assign || 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); }
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
2
 
3
3
  import * as React from "react";
4
4
  import { IconButton, Stack } from "@fluentui/react";
5
5
  import { BroadcastService } from "../../../../services/BroadcastService";
6
6
  import CommandButton from "../../../common/commandbutton/CommandButton";
7
- import { ElementType } from "../../../../common/Constants";
7
+ import { ElementType, KeyCodes } from "../../../../common/Constants";
8
8
  import Timer from "../Timer/Timer";
9
9
  import { defaultCurrentCallProps } from "./common/defaultProps/defaultCurrentCallProps";
10
10
  import { processCustomComponents } from "../../../../common/utils";
11
11
  import { useBoolean } from "@fluentui/react-hooks";
12
- import { useCallback } from "react";
12
+ import { useCallback, useEffect } from "react";
13
13
 
14
14
  function CurrentCall(props) {
15
15
  var _props$controlProps, _defaultCurrentCallPr, _props$controlProps2, _props$controlProps2$, _defaultCurrentCallPr2, _defaultCurrentCallPr3, _props$controlProps3, _props$controlProps3$, _defaultCurrentCallPr4, _defaultCurrentCallPr5, _props$controlProps4, _props$controlProps4$, _defaultCurrentCallPr6, _defaultCurrentCallPr7, _props$controlProps5, _props$controlProps5$, _defaultCurrentCallPr8, _defaultCurrentCallPr9, _props$controlProps6, _props$controlProps6$, _defaultCurrentCallPr10, _defaultCurrentCallPr11, _props$controlProps7, _props$controlProps7$, _defaultCurrentCallPr12, _defaultCurrentCallPr13, _props$controlProps8, _props$controlProps8$, _defaultCurrentCallPr14, _defaultCurrentCallPr15, _props$controlProps9, _props$controlProps10, _defaultCurrentCallPr16, _defaultCurrentCallPr17, _props$styleProps, _props$controlProps11, _props$controlProps12, _defaultCurrentCallPr18, _defaultCurrentCallPr19, _props$controlProps13, _props$controlProps14, _defaultCurrentCallPr20, _defaultCurrentCallPr21, _props$controlProps15, _props$controlProps16, _defaultCurrentCallPr22, _defaultCurrentCallPr23, _props$controlProps17, _props$controlProps18, _props$controlProps19, _props$controlProps20, _defaultCurrentCallPr24, _defaultCurrentCallPr25, _props$controlProps21, _props$controlProps22, _defaultCurrentCallPr26, _defaultCurrentCallPr27, _props$controlProps23, _props$controlProps24, _defaultCurrentCallPr28, _defaultCurrentCallPr29, _props$controlProps25, _props$controlProps26, _defaultCurrentCallPr30, _defaultCurrentCallPr31, _props$controlProps27, _props$controlProps28, _props$controlProps29, _props$controlProps30, _defaultCurrentCallPr32, _defaultCurrentCallPr33, _props$controlProps31, _props$controlProps32, _defaultCurrentCallPr34, _defaultCurrentCallPr35, _props$controlProps33, _props$controlProps34, _defaultCurrentCallPr36, _defaultCurrentCallPr37, _props$controlProps35, _props$controlProps36, _defaultCurrentCallPr38, _defaultCurrentCallPr39, _props$controlProps37, _defaultCurrentCallPr40, _props$controlProps38, _defaultCurrentCallPr41, _props$controlProps39, _defaultCurrentCallPr42, _props$controlProps40, _props$controlProps41, _props$controlProps42, _props$controlProps43, _defaultCurrentCallPr43, _defaultCurrentCallPr44, _props$controlProps44, _props$controlProps45, _defaultCurrentCallPr45, _defaultCurrentCallPr46, _props$controlProps46, _props$controlProps47, _defaultCurrentCallPr47, _defaultCurrentCallPr48, _props$controlProps48, _props$controlProps49, _defaultCurrentCallPr49, _defaultCurrentCallPr50, _props$controlProps50, _props$controlProps51, _props$controlProps52, _props$controlProps53, _defaultCurrentCallPr51, _defaultCurrentCallPr52, _props$controlProps54, _props$controlProps55, _defaultCurrentCallPr53, _defaultCurrentCallPr54, _props$controlProps56, _props$controlProps57, _defaultCurrentCallPr55, _defaultCurrentCallPr56, _props$controlProps58, _props$controlProps59, _defaultCurrentCallPr57, _defaultCurrentCallPr58, _defaultCurrentCallPr59, _props$controlProps60, _defaultCurrentCallPr60, _props$controlProps61, _defaultCurrentCallPr61, _props$styleProps2, _defaultCurrentCallPr62, _props$styleProps3, _defaultCurrentCallPr63, _props$styleProps4, _defaultCurrentCallPr67, _props$styleProps8, _defaultCurrentCallPr68, _props$styleProps9, _defaultCurrentCallPr69, _props$styleProps10, _defaultCurrentCallPr70, _props$styleProps11, _defaultCurrentCallPr71, _props$styleProps12, _props$controlProps68, _defaultCurrentCallPr72, _props$styleProps13, _props$styleProps13$c, _props$styleProps14, _props$styleProps14$c, _props$styleProps15, _props$styleProps15$c, _props$styleProps16, _props$styleProps16$c, _props$styleProps17, _props$styleProps17$c, _props$controlProps69, _props$controlProps70, _props$controlProps71, _props$controlProps72, _props$controlProps73, _props$controlProps74, _props$controlProps75, _props$controlProps76, _props$controlProps77, _defaultCurrentCallPr73, _defaultCurrentCallPr74, _props$controlProps78, _props$controlProps79, _defaultCurrentCallPr75, _defaultCurrentCallPr76, _props$controlProps80, _props$controlProps81, _props$controlProps82, _props$controlProps83, _defaultCurrentCallPr77, _defaultCurrentCallPr78, _props$controlProps84, _props$controlProps85, _defaultCurrentCallPr79, _defaultCurrentCallPr80, _props$controlProps86, _props$controlProps87, _props$controlProps88, _props$controlProps89, _props$controlProps90, _defaultCurrentCallPr81, _defaultCurrentCallPr82, _props$controlProps91, _props$controlProps92, _defaultCurrentCallPr83, _defaultCurrentCallPr84, _props$controlProps93, _props$controlProps94, _props$controlProps95, _props$controlProps96, _defaultCurrentCallPr85, _defaultCurrentCallPr86, _props$controlProps97, _props$controlProps98, _defaultCurrentCallPr87, _defaultCurrentCallPr88, _props$controlProps99, _props$controlProps100, _props$controlProps101;
@@ -189,6 +189,36 @@ function CurrentCall(props) {
189
189
  }
190
190
  }, []);
191
191
  const hideCallTimer = ((_props$controlProps68 = props.controlProps) === null || _props$controlProps68 === void 0 ? void 0 : _props$controlProps68.hideCallTimer) ?? ((_defaultCurrentCallPr72 = defaultCurrentCallProps.controlProps) === null || _defaultCurrentCallPr72 === void 0 ? void 0 : _defaultCurrentCallPr72.hideCallTimer);
192
+ useEffect(() => {
193
+ const endCallShortcut = e => e.key === KeyCodes.ENTER;
194
+
195
+ const toggleMicShortcut = e => e.ctrlKey && e.shiftKey && e.key === KeyCodes.ToggleMicHotKey;
196
+
197
+ const toggleVideoShortcut = e => e.ctrlKey && e.shiftKey && e.key === KeyCodes.ToggleCameraHotKey;
198
+
199
+ const shortcutKeysHandler = e => {
200
+ if (endCallShortcut(e)) {
201
+ handleEndCallClick();
202
+ } else if (toggleMicShortcut(e)) {
203
+ handleMicClick();
204
+ } else if (toggleVideoShortcut(e)) {
205
+ handleVideoOffClick();
206
+ }
207
+ };
208
+
209
+ const ignoreDefault = e => {
210
+ if (endCallShortcut(e) || toggleMicShortcut(e) || toggleVideoShortcut(e)) {
211
+ e.preventDefault();
212
+ }
213
+ };
214
+
215
+ window.addEventListener("keyup", shortcutKeysHandler);
216
+ window.addEventListener("keydown", ignoreDefault);
217
+ return () => {
218
+ window.removeEventListener("keyup", shortcutKeysHandler);
219
+ window.removeEventListener("keydown", ignoreDefault);
220
+ };
221
+ }, []);
192
222
  return /*#__PURE__*/React.createElement(Stack, {
193
223
  className: (_props$styleProps13 = props.styleProps) === null || _props$styleProps13 === void 0 ? void 0 : (_props$styleProps13$c = _props$styleProps13.classNames) === null || _props$styleProps13$c === void 0 ? void 0 : _props$styleProps13$c.currentCallComponentClassName,
194
224
  horizontalAlign: "space-between",
@@ -47,18 +47,6 @@ export const customizedCurrentCallStyleProps = {
47
47
  width: "50px",
48
48
  margin: "1px"
49
49
  },
50
- currentCallTimerStyleProps: {
51
- borderRadius: "2px",
52
- margin: "1px",
53
- color: "white",
54
- paddingTop: "18px",
55
- fontSize: 12,
56
- fontFamily: "Segoe UI, Arial, sans-serif",
57
- backgroundColor: "transparent",
58
- height: "50px",
59
- width: "55px",
60
- textAlign: "center"
61
- },
62
50
  videoTileStyleProps: {
63
51
  minHeight: "180px",
64
52
  height: "300px",
@@ -39,18 +39,6 @@ export const defaultCurrentCallStyleProps = {
39
39
  width: "50px",
40
40
  fontSize: "18px"
41
41
  },
42
- currentCallTimerStyleProps: {
43
- borderRadius: "2px",
44
- margin: "1px",
45
- color: "#FFFFFF",
46
- paddingTop: "18px",
47
- fontSize: 12,
48
- fontFamily: "Segoe UI, Arial, sans-serif",
49
- backgroundColor: "darkgrey",
50
- height: "45px",
51
- width: "50px",
52
- textAlign: "center"
53
- },
54
42
  videoTileStyleProps: {
55
43
  width: "100%",
56
44
  marginLeft: "auto",
@@ -1,13 +1,13 @@
1
- function _extends() { _extends = Object.assign || 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); }
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
2
 
3
3
  import * as React from "react";
4
4
  import { Label, Stack } from "@fluentui/react";
5
5
  import CommandButton from "../../../common/commandbutton/CommandButton";
6
- import { ElementType } from "../../../../common/Constants";
6
+ import { ElementType, KeyCodes } from "../../../../common/Constants";
7
7
  import { decodeComponentString } from "../../../../common/decodeComponentString";
8
8
  import { defaultIncomingCallProps } from "./common/defaultProps/defaultIncomingCallProps";
9
9
  import { processCustomComponents } from "../../../../common/utils";
10
- import { useCallback } from "react";
10
+ import { useCallback, useEffect } from "react";
11
11
 
12
12
  function IncomingCall(props) {
13
13
  var _props$controlProps, _defaultIncomingCallP, _props$controlProps2, _props$controlProps2$, _defaultIncomingCallP2, _defaultIncomingCallP3, _props$controlProps3, _props$controlProps3$, _defaultIncomingCallP4, _defaultIncomingCallP5, _props$controlProps4, _props$controlProps4$, _defaultIncomingCallP6, _defaultIncomingCallP7, _defaultIncomingCallP8, _props$styleProps, _props$controlProps5, _props$controlProps5$, _defaultIncomingCallP9, _defaultIncomingCallP10, _props$controlProps6, _props$controlProps6$, _defaultIncomingCallP11, _defaultIncomingCallP12, _props$controlProps7, _props$controlProps7$, _defaultIncomingCallP13, _defaultIncomingCallP14, _defaultIncomingCallP15, _props$controlProps8, _defaultIncomingCallP16, _props$controlProps9, _defaultIncomingCallP17, _props$controlProps10, _defaultIncomingCallP18, _props$controlProps11, _defaultIncomingCallP19, _props$styleProps2, _defaultIncomingCallP20, _props$styleProps3, _defaultIncomingCallP21, _props$styleProps4, _defaultIncomingCallP22, _props$styleProps5, _defaultIncomingCallP23, _props$styleProps6, _defaultIncomingCallP24, _props$styleProps7, _defaultIncomingCallP25, _props$styleProps8, _defaultIncomingCallP26, _props$styleProps9, _props$styleProps10, _props$controlProps18, _defaultIncomingCallP27, _props$controlProps19, _props$componentOverr, _props$controlProps20, _props$controlProps21, _props$controlProps22, _props$controlProps23, _props$controlProps24, _props$controlProps25, _props$controlProps26, _props$controlProps27, _props$controlProps28;
@@ -84,12 +84,55 @@ function IncomingCall(props) {
84
84
  (_props$controlProps17 = props.controlProps) === null || _props$controlProps17 === void 0 ? void 0 : _props$controlProps17.onAudioCallClick();
85
85
  }
86
86
  }, []);
87
+ useEffect(() => {
88
+ const declineCallShortcut = e => e.ctrlKey && e.shiftKey && e.key === KeyCodes.DeclineCallHotKey;
89
+
90
+ const acceptAudioCallShortcut = e => e.ctrlKey && e.shiftKey && e.key === KeyCodes.AcceptAudioCallHotKey;
91
+
92
+ const acceptVideoCallShortcut = e => e.ctrlKey && e.shiftKey && e.key === KeyCodes.AcceptVideoCallHotKey;
93
+
94
+ const shortcutKeysHandler = e => {
95
+ if (declineCallShortcut(e)) {
96
+ handleDeclineCallClick();
97
+ } else if (acceptAudioCallShortcut(e)) {
98
+ handleAudioCallClick();
99
+ } else if (acceptVideoCallShortcut(e)) {
100
+ handleVideoCallClick();
101
+ }
102
+ };
103
+
104
+ const ignoreDefault = e => {
105
+ if (declineCallShortcut(e) || acceptAudioCallShortcut(e) || acceptVideoCallShortcut(e)) {
106
+ e.preventDefault();
107
+ }
108
+ };
109
+
110
+ window.addEventListener("keyup", shortcutKeysHandler);
111
+ window.addEventListener("keydown", ignoreDefault);
112
+ return () => {
113
+ window.removeEventListener("keyup", shortcutKeysHandler);
114
+ window.removeEventListener("keydown", ignoreDefault);
115
+ };
116
+ }, []);
117
+ useEffect(() => {
118
+ // Setting focus to decline call button when incoming call alert appears
119
+ if (declineCallButtonId) {
120
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
121
+ const declineCallButton = document.getElementById(declineCallButtonId);
122
+
123
+ if (declineCallButton) {
124
+ declineCallButton.focus();
125
+ }
126
+ }
127
+ }, []);
87
128
  return /*#__PURE__*/React.createElement(Stack, {
88
129
  horizontal: true,
89
130
  className: (_props$styleProps10 = props.styleProps) === null || _props$styleProps10 === void 0 ? void 0 : _props$styleProps10.className,
90
131
  horizontalAlign: "space-between",
91
132
  styles: stackStyles,
92
- dir: ((_props$controlProps18 = props.controlProps) === null || _props$controlProps18 === void 0 ? void 0 : _props$controlProps18.dir) ?? ((_defaultIncomingCallP27 = defaultIncomingCallProps.controlProps) === null || _defaultIncomingCallP27 === void 0 ? void 0 : _defaultIncomingCallP27.dir)
133
+ dir: ((_props$controlProps18 = props.controlProps) === null || _props$controlProps18 === void 0 ? void 0 : _props$controlProps18.dir) ?? ((_defaultIncomingCallP27 = defaultIncomingCallProps.controlProps) === null || _defaultIncomingCallP27 === void 0 ? void 0 : _defaultIncomingCallP27.dir),
134
+ role: "alert",
135
+ "aria-label": incomingCallTitleProps === null || incomingCallTitleProps === void 0 ? void 0 : incomingCallTitleProps.text
93
136
  }, /*#__PURE__*/React.createElement(Stack, {
94
137
  horizontal: true,
95
138
  id: "incomingCallLeftGroup",
@@ -1,7 +1,7 @@
1
1
  import { Icon, Label, Stack } from "@fluentui/react";
2
2
  import React, { useCallback } from "react";
3
3
  import { BroadcastService } from "../../services/BroadcastService";
4
- import { ElementType, KeyCodes } from "../../common/Constants";
4
+ import { ElementType, HiddenTextStyles, KeyCodes } from "../../common/Constants";
5
5
  import { decodeComponentString } from "../../common/decodeComponentString";
6
6
  import { defaultChatButtonControlProps } from "./common/defaultProps/defaultChatButtonControlProps";
7
7
  import { defaultChatButtonGeneralStyles } from "./common/defaultStyles/defaultChatButtonGeneralStyles";
@@ -12,17 +12,28 @@ import { defaultChatButtonTextContainerStyles } from "./common/defaultStyles/def
12
12
  import { defaultChatButtonTitleStyles } from "./common/defaultStyles/defaultChatButtonTitleStyles";
13
13
 
14
14
  function NotificationBubble(props, parentId) {
15
- var _props$styleProps, _props$controlProps, _props$componentOverr, _props$styleProps2, _props$styleProps2$cl;
15
+ var _props$styleProps, _props$controlProps;
16
16
 
17
17
  const notificationBubbleStyles = {
18
18
  root: Object.assign({}, defaultChatButtonNotificationBubbleStyles, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.notificationBubbleStyleProps)
19
19
  };
20
20
  const unreadMessageCount = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.unreadMessageCount) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.unreadMessageCount);
21
- return decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.notificationBubble) || /*#__PURE__*/React.createElement(Label, {
22
- styles: notificationBubbleStyles,
23
- className: (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : (_props$styleProps2$cl = _props$styleProps2.classNames) === null || _props$styleProps2$cl === void 0 ? void 0 : _props$styleProps2$cl.notificationBubbleClassName,
24
- id: parentId + "-notification-bubble"
25
- }, unreadMessageCount);
21
+
22
+ if (unreadMessageCount !== "0") {
23
+ var _props$componentOverr, _props$controlProps2, _props$controlProps3, _props$styleProps2, _props$styleProps2$cl, _props$controlProps4, _props$controlProps5;
24
+
25
+ return decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.notificationBubble) || /*#__PURE__*/React.createElement(Stack, {
26
+ "aria-live": "polite",
27
+ styles: notificationBubbleStyles,
28
+ "aria-label": (_props$controlProps2 = props.controlProps) !== null && _props$controlProps2 !== void 0 && _props$controlProps2.ariaLabelUnreadMessageString ? (_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.ariaLabelUnreadMessageString : defaultChatButtonControlProps.ariaLabelUnreadMessageString,
29
+ className: (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : (_props$styleProps2$cl = _props$styleProps2.classNames) === null || _props$styleProps2$cl === void 0 ? void 0 : _props$styleProps2$cl.notificationBubbleClassName,
30
+ id: parentId + "-notification-bubble"
31
+ }, unreadMessageCount, /*#__PURE__*/React.createElement("span", {
32
+ style: HiddenTextStyles
33
+ }, (_props$controlProps4 = props.controlProps) !== null && _props$controlProps4 !== void 0 && _props$controlProps4.unreadMessageString ? (_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.unreadMessageString : defaultChatButtonControlProps.unreadMessageString));
34
+ }
35
+
36
+ return null;
26
37
  }
27
38
 
28
39
  function IconContainer(props, parentId) {
@@ -39,7 +50,7 @@ function IconContainer(props, parentId) {
39
50
  }
40
51
 
41
52
  function TextContainer(props, parentId) {
42
- var _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$controlProps2, _props$controlProps3, _props$controlProps4, _props$controlProps5, _props$controlProps6, _props$controlProps7, _props$componentOverr3, _props$styleProps8, _props$styleProps8$cl, _props$componentOverr4, _props$styleProps9, _props$styleProps9$cl, _props$componentOverr5, _props$styleProps10, _props$styleProps10$c;
53
+ var _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$controlProps6, _props$controlProps7, _props$controlProps8, _props$controlProps9, _props$controlProps10, _props$controlProps11, _props$componentOverr3, _props$styleProps8, _props$styleProps8$cl, _props$componentOverr4, _props$styleProps9, _props$styleProps9$cl, _props$componentOverr5, _props$styleProps10, _props$styleProps10$c;
43
54
 
44
55
  const textContainerStyles = {
45
56
  root: Object.assign({}, defaultChatButtonTextContainerStyles, (_props$styleProps5 = props.styleProps) === null || _props$styleProps5 === void 0 ? void 0 : _props$styleProps5.textContainerStyleProps)
@@ -50,12 +61,12 @@ function TextContainer(props, parentId) {
50
61
  const subtitleStyles = {
51
62
  root: Object.assign({}, defaultChatButtonSubTitleStyles, (_props$styleProps7 = props.styleProps) === null || _props$styleProps7 === void 0 ? void 0 : _props$styleProps7.subtitleStyleProps)
52
63
  };
53
- const hideChatTitle = ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.hideChatTitle) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatTitle);
54
- const hideChatSubtitle = ((_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.hideChatSubtitle) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatSubtitle);
55
- const titleDir = ((_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
56
- const titleText = ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.titleText) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.titleText);
57
- const subtitleDir = ((_props$controlProps6 = props.controlProps) === null || _props$controlProps6 === void 0 ? void 0 : _props$controlProps6.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
58
- const subtitleText = ((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.subtitleText) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.subtitleText);
64
+ const hideChatTitle = ((_props$controlProps6 = props.controlProps) === null || _props$controlProps6 === void 0 ? void 0 : _props$controlProps6.hideChatTitle) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatTitle);
65
+ const hideChatSubtitle = ((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.hideChatSubtitle) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatSubtitle);
66
+ const titleDir = ((_props$controlProps8 = props.controlProps) === null || _props$controlProps8 === void 0 ? void 0 : _props$controlProps8.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
67
+ const titleText = ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.titleText) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.titleText);
68
+ const subtitleDir = ((_props$controlProps10 = props.controlProps) === null || _props$controlProps10 === void 0 ? void 0 : _props$controlProps10.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
69
+ const subtitleText = ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.subtitleText) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.subtitleText);
59
70
  return decodeComponentString((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.textContainer) || /*#__PURE__*/React.createElement(Stack, {
60
71
  styles: textContainerStyles,
61
72
  className: (_props$styleProps8 = props.styleProps) === null || _props$styleProps8 === void 0 ? void 0 : (_props$styleProps8$cl = _props$styleProps8.classNames) === null || _props$styleProps8$cl === void 0 ? void 0 : _props$styleProps8$cl.textContainerClassName,
@@ -76,23 +87,23 @@ function TextContainer(props, parentId) {
76
87
  }
77
88
 
78
89
  function ChatButton(props) {
79
- var _props$controlProps8, _props$controlProps9, _props$controlProps10, _props$controlProps11, _props$controlProps12, _props$controlProps13, _props$controlProps14, _props$controlProps15, _props$styleProps11;
90
+ var _props$controlProps12, _props$controlProps13, _props$controlProps14, _props$controlProps15, _props$controlProps16, _props$controlProps17, _props$controlProps18, _props$controlProps19, _props$styleProps11;
80
91
 
81
- const elementId = ((_props$controlProps8 = props.controlProps) === null || _props$controlProps8 === void 0 ? void 0 : _props$controlProps8.id) ?? "lcw-components-chat-button";
82
- const defaultAriaLabel = ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.ariaLabel) ?? "live chat button";
83
- const defaultRole = ((_props$controlProps10 = props.controlProps) === null || _props$controlProps10 === void 0 ? void 0 : _props$controlProps10.role) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.role);
84
- const containersDir = ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
85
- const hideChatButton = ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.hideChatButton) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatButton);
86
- const hideChatIcon = ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.hideChatIcon) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatIcon);
87
- const hideChatTextContainer = ((_props$controlProps14 = props.controlProps) === null || _props$controlProps14 === void 0 ? void 0 : _props$controlProps14.hideChatTextContainer) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatTextContainer);
88
- const hideNotificationBubble = ((_props$controlProps15 = props.controlProps) === null || _props$controlProps15 === void 0 ? void 0 : _props$controlProps15.hideNotificationBubble) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideNotificationBubble);
92
+ const elementId = ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.id) ?? "lcw-components-chat-button";
93
+ const defaultAriaLabel = ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.ariaLabel) ?? defaultChatButtonControlProps.ariaLabel;
94
+ const defaultRole = ((_props$controlProps14 = props.controlProps) === null || _props$controlProps14 === void 0 ? void 0 : _props$controlProps14.role) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.role);
95
+ const containersDir = ((_props$controlProps15 = props.controlProps) === null || _props$controlProps15 === void 0 ? void 0 : _props$controlProps15.dir) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.dir);
96
+ const hideChatButton = ((_props$controlProps16 = props.controlProps) === null || _props$controlProps16 === void 0 ? void 0 : _props$controlProps16.hideChatButton) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatButton);
97
+ const hideChatIcon = ((_props$controlProps17 = props.controlProps) === null || _props$controlProps17 === void 0 ? void 0 : _props$controlProps17.hideChatIcon) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatIcon);
98
+ const hideChatTextContainer = ((_props$controlProps18 = props.controlProps) === null || _props$controlProps18 === void 0 ? void 0 : _props$controlProps18.hideChatTextContainer) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideChatTextContainer);
99
+ const hideNotificationBubble = ((_props$controlProps19 = props.controlProps) === null || _props$controlProps19 === void 0 ? void 0 : _props$controlProps19.hideNotificationBubble) ?? (defaultChatButtonControlProps === null || defaultChatButtonControlProps === void 0 ? void 0 : defaultChatButtonControlProps.hideNotificationBubble);
89
100
  const chatButtonGroupStyles = {
90
101
  root: Object.assign({}, defaultChatButtonGeneralStyles, (_props$styleProps11 = props.styleProps) === null || _props$styleProps11 === void 0 ? void 0 : _props$styleProps11.generalStyleProps)
91
102
  };
92
103
  const handleInitiateChatClick = useCallback(() => {
93
- var _props$controlProps16;
104
+ var _props$controlProps20;
94
105
 
95
- if ((_props$controlProps16 = props.controlProps) !== null && _props$controlProps16 !== void 0 && _props$controlProps16.onClick) {
106
+ if ((_props$controlProps20 = props.controlProps) !== null && _props$controlProps20 !== void 0 && _props$controlProps20.onClick) {
96
107
  const customEvent = {
97
108
  elementType: ElementType.ChatButton,
98
109
  elementId: elementId,
@@ -119,7 +130,7 @@ function ChatButton(props) {
119
130
  onClick: handleInitiateChatClick,
120
131
  onKeyDown: handleInputKeyDown,
121
132
  "aria-label": defaultAriaLabel
122
- }, !hideChatIcon && IconContainer(props, elementId), !hideChatTextContainer && TextContainer(props, elementId), !hideNotificationBubble && NotificationBubble(props, elementId)));
133
+ }, !hideChatIcon && IconContainer(props, elementId), !hideNotificationBubble && NotificationBubble(props, elementId), !hideChatTextContainer && TextContainer(props, elementId)));
123
134
  }
124
135
 
125
136
  export default ChatButton;
@@ -2,7 +2,7 @@ export const defaultChatButtonControlProps = {
2
2
  id: "lcw-components-chat-button",
3
3
  dir: "ltr",
4
4
  role: "button",
5
- ariaLabel: "live chat button",
5
+ ariaLabel: "Let's chat We are online",
6
6
  unreadMessageCount: "0",
7
7
  titleText: "Let's Chat!",
8
8
  subtitleText: "We're online.",
@@ -14,5 +14,8 @@ export const defaultChatButtonControlProps = {
14
14
  hideChatTextContainer: false,
15
15
  hideChatSubtitle: false,
16
16
  hideChatTitle: false,
17
- hideNotificationBubble: true
17
+ hideNotificationBubble: true,
18
+ unreadMessageString: "new messages",
19
+ largeUnreadMessageString: "99+",
20
+ ariaLabelUnreadMessageString: "you have new messages"
18
21
  };
@@ -8,6 +8,7 @@ export const defaultChatButtonSubTitleStyles = {
8
8
  fontWeight: "200",
9
9
  margin: "0px 14px 0px 14px",
10
10
  overflow: "hidden",
11
+ padding: "0px",
11
12
  textOverflow: "ellipsis !important",
12
13
  width: "max-content"
13
14
  };
@@ -9,6 +9,7 @@ export const defaultChatButtonTitleStyles = {
9
9
  height: "22px",
10
10
  margin: "0px 14px 0px 14px",
11
11
  overflow: "hidden",
12
+ padding: "0px",
12
13
  textOverflow: "ellipsis !important",
13
14
  whiteSpace: "nowrap",
14
15
  width: "90px"
@@ -4,19 +4,45 @@ import { BroadcastService } from "../../../services/BroadcastService";
4
4
  import { ElementType } from "../../../common/Constants";
5
5
 
6
6
  function CommandButton(props) {
7
+ var _props$hoverStyles, _props$hoverStyles2, _props$focusStyles;
8
+
7
9
  //imageIconProps > iconName
8
10
  const iconProp = props.imageIconProps ? {
9
11
  imageProps: props.imageIconProps
10
12
  } : {
11
- iconName: props.iconName,
12
- styles: {
13
- root: props.styles
14
- }
13
+ iconName: props.iconName
15
14
  };
16
- const iconButtonStyles = {
17
- root: props.styles,
15
+ let iconStyles = {};
16
+
17
+ if (props.type === "icon") {
18
+ var _props$styles;
19
+
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ iconStyles = { ...(props === null || props === void 0 ? void 0 : (_props$styles = props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.icon)
22
+ };
23
+ }
24
+
25
+ const buttonStyles = {
26
+ icon: { ...iconStyles
27
+ },
28
+ root: {
29
+ selectors: {
30
+ ":hover .ms-Button-icon": { // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ ...(props === null || props === void 0 ? void 0 : (_props$hoverStyles = props.hoverStyles) === null || _props$hoverStyles === void 0 ? void 0 : _props$hoverStyles.icon)
32
+ },
33
+ ":active .ms-Button-icon": { // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ ...(props === null || props === void 0 ? void 0 : (_props$hoverStyles2 = props.hoverStyles) === null || _props$hoverStyles2 === void 0 ? void 0 : _props$hoverStyles2.icon)
35
+ },
36
+ ":focus .ms-Button-icon": { // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ ...(props === null || props === void 0 ? void 0 : (_props$focusStyles = props.focusStyles) === null || _props$focusStyles === void 0 ? void 0 : _props$focusStyles.icon)
38
+ }
39
+ },
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ ...(props === null || props === void 0 ? void 0 : props.styles)
42
+ },
18
43
  rootHovered: props.hoverStyles,
19
- rootFocused: props.focusStyles
44
+ rootFocused: props.focusStyles,
45
+ rootPressed: props.hoverStyles
20
46
  };
21
47
  const handleOnClick = useCallback(() => {
22
48
  if (props !== null && props !== void 0 && props.onClick) {
@@ -36,14 +62,14 @@ function CommandButton(props) {
36
62
  onClick: handleOnClick,
37
63
  disabled: props.disabled,
38
64
  className: props.className,
39
- styles: iconButtonStyles
65
+ styles: buttonStyles
40
66
  }), props.type === "icon" && /*#__PURE__*/React.createElement(IconButton, {
41
67
  id: props.id,
42
68
  iconProps: iconProp,
43
- title: props.ariaLabel,
69
+ title: props.hideButtonTitle ? undefined : props.ariaLabel,
44
70
  ariaLabel: props.ariaLabel,
45
71
  disabled: props.disabled,
46
- styles: iconButtonStyles,
72
+ styles: buttonStyles,
47
73
  onClick: handleOnClick,
48
74
  className: props.className
49
75
  }));
@@ -1,13 +1,13 @@
1
1
  import React from "react";
2
2
  import { ElementType } from "../../../common/Constants";
3
- import CommandButton from "../../common/commandbutton/CommandButton";
3
+ import CommandButton from "../commandbutton/CommandButton";
4
4
 
5
5
  function CloseButton(props) {
6
6
  const {
7
7
  type
8
8
  } = props;
9
9
  const customEvent = {
10
- elementType: ElementType.HeaderCloseButton,
10
+ elementType: ElementType.CloseButton,
11
11
  elementId: props === null || props === void 0 ? void 0 : props.id,
12
12
  eventName: "OnClick"
13
13
  };
@@ -23,7 +23,8 @@ function CloseButton(props) {
23
23
  onClick: props.onClick,
24
24
  ariaLabel: props.ariaLabel ?? "Close",
25
25
  className: props.className,
26
- customEvent: customEvent
26
+ customEvent: customEvent,
27
+ hideButtonTitle: props.hideButtonTitle
27
28
  });
28
29
  }
29
30
 
@@ -2,7 +2,7 @@ import { DefaultButton, PrimaryButton } from "@fluentui/react/lib/Button";
2
2
  import { Label, Stack } from "@fluentui/react";
3
3
  import React, { useCallback } from "react";
4
4
  import { BroadcastService } from "../../services/BroadcastService";
5
- import { ElementType } from "../../common/Constants";
5
+ import { ElementType, KeyCodes } from "../../common/Constants";
6
6
  import { decodeComponentString } from "../../common/decodeComponentString";
7
7
  import { defaultConfirmationPaneButtonGroupStyles } from "./common/defaultStyles/defaultConfirmationPaneButtonGroupStyles";
8
8
  import { defaultConfirmationPaneCancelButtonHoveredStyles } from "./common/defaultStyles/defaultConfirmationPaneCancelButtonHoveredStyles";
@@ -17,7 +17,7 @@ import { defaultConfirmationPaneConfirmButtonFocusedStyles } from "./common/defa
17
17
  import { defaultConfirmationPaneCancelButtonFocusedStyles } from "./common/defaultStyles/defaultConfirmationPaneCancelButtonFocusedStyles";
18
18
 
19
19
  function ConfirmationPane(props) {
20
- var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$styleProps8, _props$styleProps9, _props$styleProps10, _props$controlProps6, _props$controlProps7, _props$controlProps8, _props$componentOverr, _props$styleProps11, _props$styleProps11$c, _props$controlProps9, _props$controlProps10, _props$componentOverr2, _props$styleProps12, _props$styleProps12$c, _props$controlProps11, _props$styleProps13, _props$styleProps13$c, _props$controlProps12, _props$componentOverr3, _props$styleProps14, _props$styleProps14$c, _props$controlProps13, _props$controlProps14, _props$controlProps15, _props$componentOverr4, _props$styleProps15, _props$styleProps15$c, _props$controlProps16, _props$controlProps17;
20
+ var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$styleProps8, _props$styleProps9, _props$styleProps10, _props$styleProps11, _props$styleProps12, _props$controlProps6, _props$controlProps7, _props$controlProps8, _props$componentOverr, _props$styleProps13, _props$styleProps13$c, _props$controlProps9, _props$controlProps10, _props$componentOverr2, _props$styleProps14, _props$styleProps14$c, _props$controlProps11, _props$styleProps15, _props$styleProps15$c, _props$controlProps12, _props$componentOverr3, _props$styleProps16, _props$styleProps16$c, _props$controlProps13, _props$controlProps14, _props$controlProps15, _props$componentOverr4, _props$styleProps17, _props$styleProps17$c, _props$controlProps16, _props$controlProps17;
21
21
 
22
22
  const elementId = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.id) ?? defaultConfirmationPaneControlProps.id;
23
23
  const handleConfirmClick = useCallback(() => {
@@ -49,6 +49,12 @@ function ConfirmationPane(props) {
49
49
  BroadcastService.postMessage(customEvent);
50
50
  (_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.onCancel();
51
51
  }
52
+ }, []); // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+
54
+ const handleEscKeyDown = useCallback(e => {
55
+ if (e.code === KeyCodes.ESCAPE) {
56
+ handleCancelClick();
57
+ }
52
58
  }, []);
53
59
  const containerStyles = {
54
60
  root: Object.assign({}, defaultConfirmationPaneGeneralStyles, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps)
@@ -65,15 +71,18 @@ function ConfirmationPane(props) {
65
71
  const confirmButtonStyles = {
66
72
  root: Object.assign({}, defaultConfirmationPaneConfirmButtonStyles, (_props$styleProps5 = props.styleProps) === null || _props$styleProps5 === void 0 ? void 0 : _props$styleProps5.confirmButtonStyleProps),
67
73
  rootHovered: Object.assign({}, defaultConfirmationPaneConfirmButtonHoveredStyles, (_props$styleProps6 = props.styleProps) === null || _props$styleProps6 === void 0 ? void 0 : _props$styleProps6.confirmButtonHoveredStyleProps),
68
- rootFocused: Object.assign({}, defaultConfirmationPaneConfirmButtonFocusedStyles, (_props$styleProps7 = props.styleProps) === null || _props$styleProps7 === void 0 ? void 0 : _props$styleProps7.confirmButtonFocusedStyleProps)
74
+ rootFocused: Object.assign({}, defaultConfirmationPaneConfirmButtonFocusedStyles, (_props$styleProps7 = props.styleProps) === null || _props$styleProps7 === void 0 ? void 0 : _props$styleProps7.confirmButtonFocusedStyleProps),
75
+ rootPressed: Object.assign({}, defaultConfirmationPaneConfirmButtonHoveredStyles, (_props$styleProps8 = props.styleProps) === null || _props$styleProps8 === void 0 ? void 0 : _props$styleProps8.confirmButtonHoveredStyleProps)
69
76
  };
70
77
  const cancelButtonStyles = {
71
- root: Object.assign({}, defaultConfirmationPaneCancelButtonStyles, (_props$styleProps8 = props.styleProps) === null || _props$styleProps8 === void 0 ? void 0 : _props$styleProps8.cancelButtonStyleProps),
72
- rootHovered: Object.assign({}, defaultConfirmationPaneCancelButtonHoveredStyles, (_props$styleProps9 = props.styleProps) === null || _props$styleProps9 === void 0 ? void 0 : _props$styleProps9.cancelButtonHoveredStyleProps),
73
- rootFocused: Object.assign({}, defaultConfirmationPaneCancelButtonFocusedStyles, (_props$styleProps10 = props.styleProps) === null || _props$styleProps10 === void 0 ? void 0 : _props$styleProps10.cancelButtonFocusedStyleProps)
78
+ root: Object.assign({}, defaultConfirmationPaneCancelButtonStyles, (_props$styleProps9 = props.styleProps) === null || _props$styleProps9 === void 0 ? void 0 : _props$styleProps9.cancelButtonStyleProps),
79
+ rootHovered: Object.assign({}, defaultConfirmationPaneCancelButtonHoveredStyles, (_props$styleProps10 = props.styleProps) === null || _props$styleProps10 === void 0 ? void 0 : _props$styleProps10.cancelButtonHoveredStyleProps),
80
+ rootFocused: Object.assign({}, defaultConfirmationPaneCancelButtonFocusedStyles, (_props$styleProps11 = props.styleProps) === null || _props$styleProps11 === void 0 ? void 0 : _props$styleProps11.cancelButtonFocusedStyleProps),
81
+ rootPressed: Object.assign({}, defaultConfirmationPaneCancelButtonHoveredStyles, (_props$styleProps12 = props.styleProps) === null || _props$styleProps12 === void 0 ? void 0 : _props$styleProps12.cancelButtonHoveredStyleProps)
74
82
  };
75
83
  return /*#__PURE__*/React.createElement(React.Fragment, null, !((_props$controlProps6 = props.controlProps) !== null && _props$controlProps6 !== void 0 && _props$controlProps6.hideConfirmationPane) && /*#__PURE__*/React.createElement(Stack, {
76
84
  id: elementId,
85
+ onKeyDown: handleEscKeyDown,
77
86
  tabIndex: -1,
78
87
  dir: ((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.dir) || defaultConfirmationPaneControlProps.dir,
79
88
  styles: containerStyles,
@@ -81,29 +90,29 @@ function ConfirmationPane(props) {
81
90
  "aria-labelledby": elementId + "-title",
82
91
  "aria-describedby": elementId + "-subtitle"
83
92
  }, !((_props$controlProps8 = props.controlProps) !== null && _props$controlProps8 !== void 0 && _props$controlProps8.hideTitle) && (decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.title) || /*#__PURE__*/React.createElement(Label, {
84
- className: (_props$styleProps11 = props.styleProps) === null || _props$styleProps11 === void 0 ? void 0 : (_props$styleProps11$c = _props$styleProps11.classNames) === null || _props$styleProps11$c === void 0 ? void 0 : _props$styleProps11$c.titleClassName,
93
+ className: (_props$styleProps13 = props.styleProps) === null || _props$styleProps13 === void 0 ? void 0 : (_props$styleProps13$c = _props$styleProps13.classNames) === null || _props$styleProps13$c === void 0 ? void 0 : _props$styleProps13$c.titleClassName,
85
94
  styles: titleStyles,
86
95
  tabIndex: -1,
87
96
  id: elementId + "-title"
88
97
  }, ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.titleText) || defaultConfirmationPaneControlProps.titleText)), !((_props$controlProps10 = props.controlProps) !== null && _props$controlProps10 !== void 0 && _props$controlProps10.hideSubtitle) && (decodeComponentString((_props$componentOverr2 = props.componentOverrides) === null || _props$componentOverr2 === void 0 ? void 0 : _props$componentOverr2.subtitle) || /*#__PURE__*/React.createElement(Label, {
89
- className: (_props$styleProps12 = props.styleProps) === null || _props$styleProps12 === void 0 ? void 0 : (_props$styleProps12$c = _props$styleProps12.classNames) === null || _props$styleProps12$c === void 0 ? void 0 : _props$styleProps12$c.subtitleClassName,
98
+ className: (_props$styleProps14 = props.styleProps) === null || _props$styleProps14 === void 0 ? void 0 : (_props$styleProps14$c = _props$styleProps14.classNames) === null || _props$styleProps14$c === void 0 ? void 0 : _props$styleProps14$c.subtitleClassName,
90
99
  styles: subtitleStyles,
91
100
  tabIndex: -1,
92
101
  id: elementId + "-subtitle"
93
102
  }, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.subtitleText) || defaultConfirmationPaneControlProps.subtitleText)), /*#__PURE__*/React.createElement(Stack, {
94
103
  horizontal: true,
95
- className: (_props$styleProps13 = props.styleProps) === null || _props$styleProps13 === void 0 ? void 0 : (_props$styleProps13$c = _props$styleProps13.classNames) === null || _props$styleProps13$c === void 0 ? void 0 : _props$styleProps13$c.buttonGroupClassName,
104
+ className: (_props$styleProps15 = props.styleProps) === null || _props$styleProps15 === void 0 ? void 0 : (_props$styleProps15$c = _props$styleProps15.classNames) === null || _props$styleProps15$c === void 0 ? void 0 : _props$styleProps15$c.buttonGroupClassName,
96
105
  styles: buttonGroupStyles,
97
106
  id: elementId + "-buttongroup"
98
107
  }, !((_props$controlProps12 = props.controlProps) !== null && _props$controlProps12 !== void 0 && _props$controlProps12.hideConfirmButton) && (decodeComponentString((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.confirmButton) || /*#__PURE__*/React.createElement(PrimaryButton, {
99
- className: (_props$styleProps14 = props.styleProps) === null || _props$styleProps14 === void 0 ? void 0 : (_props$styleProps14$c = _props$styleProps14.classNames) === null || _props$styleProps14$c === void 0 ? void 0 : _props$styleProps14$c.confirmButtonClassName,
108
+ className: (_props$styleProps16 = props.styleProps) === null || _props$styleProps16 === void 0 ? void 0 : (_props$styleProps16$c = _props$styleProps16.classNames) === null || _props$styleProps16$c === void 0 ? void 0 : _props$styleProps16$c.confirmButtonClassName,
100
109
  styles: confirmButtonStyles,
101
110
  text: ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.confirmButtonText) || defaultConfirmationPaneControlProps.confirmButtonText,
102
111
  onClick: handleConfirmClick,
103
112
  id: elementId + "-confirmbutton",
104
113
  ariaLabel: ((_props$controlProps14 = props.controlProps) === null || _props$controlProps14 === void 0 ? void 0 : _props$controlProps14.confirmButtonAriaLabel) || defaultConfirmationPaneControlProps.confirmButtonAriaLabel
105
114
  })), !((_props$controlProps15 = props.controlProps) !== null && _props$controlProps15 !== void 0 && _props$controlProps15.hideCancelButton) && (decodeComponentString((_props$componentOverr4 = props.componentOverrides) === null || _props$componentOverr4 === void 0 ? void 0 : _props$componentOverr4.cancelButton) || /*#__PURE__*/React.createElement(DefaultButton, {
106
- className: (_props$styleProps15 = props.styleProps) === null || _props$styleProps15 === void 0 ? void 0 : (_props$styleProps15$c = _props$styleProps15.classNames) === null || _props$styleProps15$c === void 0 ? void 0 : _props$styleProps15$c.cancelButtonClassName,
115
+ className: (_props$styleProps17 = props.styleProps) === null || _props$styleProps17 === void 0 ? void 0 : (_props$styleProps17$c = _props$styleProps17.classNames) === null || _props$styleProps17$c === void 0 ? void 0 : _props$styleProps17$c.cancelButtonClassName,
107
116
  styles: cancelButtonStyles,
108
117
  text: ((_props$controlProps16 = props.controlProps) === null || _props$controlProps16 === void 0 ? void 0 : _props$controlProps16.cancelButtonText) || defaultConfirmationPaneControlProps.cancelButtonText,
109
118
  onClick: handleCancelClick,
@@ -1,7 +1,11 @@
1
1
  export const defaultConfirmationPaneButtonGroupStyles = {
2
2
  display: "flex",
3
+ width: "auto",
4
+ height: "auto",
5
+ boxSizing: "border-box",
3
6
  flexFlow: "row",
4
7
  justifyContent: "center",
5
8
  alignItems: "center",
6
- gap: "10px"
9
+ gap: "10px",
10
+ marginBottom: "10px"
7
11
  };
@@ -1,16 +1,19 @@
1
1
  export const defaultConfirmationPaneGeneralStyles = {
2
+ display: "flex",
3
+ minHeight: "160px",
4
+ maxHeight: "300px",
5
+ boxSizing: "border-box",
2
6
  backgroundColor: "white",
3
7
  borderRadius: "2px",
4
8
  color: "black",
5
9
  fontFamily: "Segoe UI, Arial, sans-serif",
6
10
  fontSize: "14px",
7
- height: "160px",
8
11
  padding: "10px 20px",
9
- width: "262px",
10
12
  position: "absolute",
11
13
  justifyContent: "center",
12
14
  alignItems: "center",
13
- display: "flex",
14
15
  flexFlow: "column",
15
- zIndex: "9999"
16
+ zIndex: "9999",
17
+ left: "26px",
18
+ right: "26px"
16
19
  };
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || 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); }
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
2
 
3
3
  import * as React from "react";
4
4
  import { Stack, initializeIcons } from "@fluentui/react";
@@ -66,7 +66,7 @@ function Footer(props) {
66
66
  verticalAlign: "start"
67
67
  }, /*#__PURE__*/React.createElement(Stack, {
68
68
  horizontal: true,
69
- verticalAlign: "start"
69
+ verticalAlign: "center"
70
70
  }, processCustomComponents((_props$controlProps14 = props.controlProps) === null || _props$controlProps14 === void 0 ? void 0 : (_props$controlProps15 = _props$controlProps14.rightGroup) === null || _props$controlProps15 === void 0 ? void 0 : _props$controlProps15.children), !((_props$controlProps16 = props.controlProps) !== null && _props$controlProps16 !== void 0 && _props$controlProps16.hideAudioNotificationButton) && (decodeComponentString((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.AudioNotificationButton) || /*#__PURE__*/React.createElement(AudioNotificationButton, _extends({}, audioNotificationButtonProps, {
71
71
  onClick: (_props$controlProps17 = props.controlProps) === null || _props$controlProps17 === void 0 ? void 0 : _props$controlProps17.onAudioNotificationClick,
72
72
  styles: audioNotificationButtonStyles,