@azure/communication-react 1.4.2-alpha-202211150040.0 → 1.4.2-alpha-202211170015.0

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 (99) hide show
  1. package/dist/communication-react.d.ts +125 -35
  2. package/dist/dist-cjs/communication-react/index.js +11130 -10756
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  5. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  6. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +51 -0
  7. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +270 -0
  8. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -0
  9. package/dist/dist-esm/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.d.ts +20 -0
  10. package/dist/dist-esm/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.js +36 -0
  11. package/dist/dist-esm/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.js.map +1 -0
  12. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.d.ts +6 -51
  13. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js +22 -299
  14. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
  15. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.d.ts +43 -0
  16. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js +81 -0
  17. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +1 -0
  18. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.d.ts +1 -1
  19. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.js +17 -5
  20. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.js.map +1 -1
  21. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +2 -2
  22. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  23. package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.js +3 -3
  24. package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.js.map +1 -1
  25. package/dist/dist-esm/calling-component-bindings/src/index.d.ts +4 -0
  26. package/dist/dist-esm/calling-component-bindings/src/index.js +4 -0
  27. package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
  28. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.d.ts +12 -2
  29. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.js +25 -1
  30. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.js.map +1 -1
  31. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.d.ts +16 -2
  32. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.js +27 -1
  33. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.js.map +1 -1
  34. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.d.ts +11 -0
  35. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js +15 -1
  36. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js.map +1 -1
  37. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.d.ts +8 -5
  38. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.js.map +1 -1
  39. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js +6 -6
  40. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  41. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.d.ts +1 -1
  42. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -1
  43. package/dist/dist-esm/calling-stateful-client/src/Converter.d.ts +1 -1
  44. package/dist/dist-esm/calling-stateful-client/src/Converter.js +2 -2
  45. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  46. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js +6 -6
  47. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +1 -1
  48. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.d.ts +1 -1
  49. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +1 -1
  50. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.d.ts +8 -8
  51. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js +8 -8
  52. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js.map +1 -1
  53. package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +8 -0
  54. package/dist/dist-esm/calling-stateful-client/src/index-public.js +4 -0
  55. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -0
  56. package/dist/dist-esm/calling-stateful-client/src/index.d.ts +3 -7
  57. package/dist/dist-esm/calling-stateful-client/src/index.js +2 -1
  58. package/dist/dist-esm/calling-stateful-client/src/index.js.map +1 -1
  59. package/dist/dist-esm/communication-react/src/index.d.ts +5 -2
  60. package/dist/dist-esm/communication-react/src/index.js +3 -1
  61. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  62. package/dist/dist-esm/react-components/src/components/DevicePermissions/DomainPermissionsScaffolding.js +9 -5
  63. package/dist/dist-esm/react-components/src/components/DevicePermissions/DomainPermissionsScaffolding.js.map +1 -1
  64. package/dist/dist-esm/react-components/src/components/VideoTile.d.ts +20 -1
  65. package/dist/dist-esm/react-components/src/components/VideoTile.js +29 -2
  66. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  67. package/dist/dist-esm/react-components/src/components/styles/DomainPermissions.styles.d.ts +4 -0
  68. package/dist/dist-esm/react-components/src/components/styles/DomainPermissions.styles.js +10 -1
  69. package/dist/dist-esm/react-components/src/components/styles/DomainPermissions.styles.js.map +1 -1
  70. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +1 -1
  71. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  72. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.d.ts +9 -1
  73. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +41 -0
  74. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
  75. package/dist/dist-esm/react-components/src/components/utils.d.ts +6 -1
  76. package/dist/dist-esm/react-components/src/components/utils.js +16 -0
  77. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  78. package/dist/dist-esm/react-components/src/index.d.ts +1 -0
  79. package/dist/dist-esm/react-components/src/index.js.map +1 -1
  80. package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -0
  81. package/dist/dist-esm/react-components/src/theming/icons.js +7 -3
  82. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  83. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +2 -15
  84. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  85. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +14 -8
  86. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  87. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +1 -0
  88. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  89. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.d.ts +47 -0
  90. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js +170 -0
  91. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +1 -0
  92. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +37 -48
  93. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  94. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +1 -1
  95. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +4 -4
  96. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  97. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  98. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -0
  99. package/package.json +11 -11
@@ -0,0 +1,47 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Modal that guides user through enabling their camera and mic access
4
+ * @private
5
+ */
6
+ export declare const CallReadinessModal: (props: {
7
+ mobileView: boolean;
8
+ audioState: PermissionState;
9
+ videoState: PermissionState;
10
+ permissionsState: {
11
+ camera: PermissionState;
12
+ microphone: PermissionState;
13
+ };
14
+ isPermissionsModalDismissed: boolean;
15
+ setIsPermissionsModalDismissed: (boolean: any) => void;
16
+ onPermissionsTroubleshootingClick?: ((permissionsState: {
17
+ camera: PermissionState;
18
+ microphone: PermissionState;
19
+ }) => void) | undefined;
20
+ }) => JSX.Element;
21
+ /**
22
+ * Modal that guides user through enabling their camera and mic access
23
+ * This is used when permission API is not supported
24
+ * @private
25
+ */
26
+ export declare const CallReadinessModalFallBack: (props: {
27
+ mobileView: boolean;
28
+ cameraPermissionGranted: boolean | undefined;
29
+ microphonePermissionGranted: boolean | undefined;
30
+ checkPermissionModalShowing: boolean;
31
+ permissionsState: {
32
+ camera: PermissionState;
33
+ microphone: PermissionState;
34
+ };
35
+ isPermissionsModalDismissed: boolean;
36
+ setIsPermissionsModalDismissed: (boolean: any) => void;
37
+ onPermissionsTroubleshootingClick?: ((permissionsState: {
38
+ camera: PermissionState;
39
+ microphone: PermissionState;
40
+ }) => void) | undefined;
41
+ }) => JSX.Element;
42
+ /**
43
+ * Placeholder for conditional compile
44
+ * @private
45
+ */
46
+ export declare const CallReadinessModalPlaceHolder: () => JSX.Element;
47
+ //# sourceMappingURL=CallReadinessModal.d.ts.map
@@ -0,0 +1,170 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import React from 'react';
4
+ /* @conditional-compile-remove(call-readiness) */
5
+ import { Modal } from '@fluentui/react';
6
+ /* @conditional-compile-remove(call-readiness) */
7
+ import { CameraAndMicrophoneDomainPermissions, CameraDomainPermissions, MicrophoneDomainPermissions, _DrawerSurface } from "../../../../../react-components/src";
8
+ /* @conditional-compile-remove(call-readiness) */
9
+ import { drawerContainerStyles } from '../styles/CallComposite.styles';
10
+ /* @conditional-compile-remove(call-readiness) */
11
+ const DRAWER_HIGH_Z_BAND = 99; // setting z index to 99 so that it sit above all components
12
+ /* @conditional-compile-remove(call-readiness) */
13
+ /**
14
+ * Modal that guides user through enabling their camera and mic access
15
+ * @private
16
+ */
17
+ export const CallReadinessModal = (props) => {
18
+ const { mobileView, audioState, videoState, permissionsState, isPermissionsModalDismissed, setIsPermissionsModalDismissed, onPermissionsTroubleshootingClick } = props;
19
+ const onLightDismissTriggered = () => {
20
+ // do nothing here
21
+ // only way to dismiss this drawer is clicking on allow access which will leads to device permission prompt
22
+ };
23
+ const showModal = videoState === 'denied' || videoState === 'prompt' || audioState === 'denied' || audioState === 'prompt';
24
+ const modal = !showModal
25
+ ? undefined
26
+ : () => {
27
+ // if both video and audio permission are not set
28
+ if (videoState === 'prompt' && audioState === 'prompt') {
29
+ return (React.createElement(CameraAndMicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
30
+ ? () => {
31
+ onPermissionsTroubleshootingClick(permissionsState);
32
+ }
33
+ : undefined, type: "request" }));
34
+ }
35
+ // if audio permission is set up but video is not
36
+ else if (videoState === 'prompt') {
37
+ return (React.createElement(CameraDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
38
+ ? () => {
39
+ onPermissionsTroubleshootingClick(permissionsState);
40
+ }
41
+ : undefined, onContinueAnywayClick: () => {
42
+ setIsPermissionsModalDismissed(false);
43
+ }, type: "request" }));
44
+ }
45
+ // if video permission is set up but audio is not
46
+ else if (audioState === 'prompt') {
47
+ return (React.createElement(MicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
48
+ ? () => {
49
+ onPermissionsTroubleshootingClick(permissionsState);
50
+ }
51
+ : undefined, type: "request" }));
52
+ }
53
+ // if both video and audio are denied
54
+ else if (videoState === 'denied' && audioState === 'denied') {
55
+ return (React.createElement(CameraAndMicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
56
+ ? () => {
57
+ onPermissionsTroubleshootingClick(permissionsState);
58
+ }
59
+ : undefined, type: "denied" }));
60
+ }
61
+ // if only video is denied
62
+ else if (videoState === 'denied') {
63
+ return (React.createElement(CameraDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
64
+ ? () => {
65
+ onPermissionsTroubleshootingClick(permissionsState);
66
+ }
67
+ : undefined, onContinueAnywayClick: () => {
68
+ setIsPermissionsModalDismissed(false);
69
+ }, type: "denied" }));
70
+ }
71
+ // if only audio is denied
72
+ else {
73
+ return (React.createElement(MicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
74
+ ? () => {
75
+ onPermissionsTroubleshootingClick(permissionsState);
76
+ }
77
+ : undefined, type: "denied" }));
78
+ }
79
+ };
80
+ if (mobileView && modal !== undefined) {
81
+ return (React.createElement(React.Fragment, null, isPermissionsModalDismissed && (React.createElement(_DrawerSurface, { onLightDismiss: onLightDismissTriggered, styles: drawerContainerStyles(DRAWER_HIGH_Z_BAND) }, modal()))));
82
+ }
83
+ else if (!mobileView && modal !== undefined) {
84
+ return (React.createElement(Modal, { isOpen: isPermissionsModalDismissed, isBlocking: false, onDismiss: () => {
85
+ setIsPermissionsModalDismissed(false);
86
+ }, overlay: { styles: { root: { background: 'rgba(0,0,0,0.9)' } } } }, modal()));
87
+ }
88
+ else {
89
+ return React.createElement(React.Fragment, null);
90
+ }
91
+ };
92
+ /* @conditional-compile-remove(call-readiness) */
93
+ /**
94
+ * Modal that guides user through enabling their camera and mic access
95
+ * This is used when permission API is not supported
96
+ * @private
97
+ */
98
+ export const CallReadinessModalFallBack = (props) => {
99
+ const { mobileView, cameraPermissionGranted, microphonePermissionGranted, checkPermissionModalShowing, permissionsState, isPermissionsModalDismissed, setIsPermissionsModalDismissed, onPermissionsTroubleshootingClick } = props;
100
+ const onLightDismissTriggered = () => {
101
+ // do nothing here
102
+ // only way to dismiss this drawer is clicking on allow access which will leads to device permission prompt
103
+ };
104
+ // When permissions are not set, value is undefined, do nothing here
105
+ // When permissions are set to denied, value is false, show helper screen
106
+ const showModal = cameraPermissionGranted === false || microphonePermissionGranted === false;
107
+ const modal = !showModal
108
+ ? undefined
109
+ : () => {
110
+ if (cameraPermissionGranted === false && microphonePermissionGranted === false) {
111
+ return (React.createElement(CameraAndMicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
112
+ ? () => {
113
+ onPermissionsTroubleshootingClick(permissionsState);
114
+ }
115
+ : undefined, type: "denied" }));
116
+ }
117
+ else if (cameraPermissionGranted === false && microphonePermissionGranted) {
118
+ return (React.createElement(CameraDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
119
+ ? () => {
120
+ onPermissionsTroubleshootingClick(permissionsState);
121
+ }
122
+ : undefined, onContinueAnywayClick: () => {
123
+ setIsPermissionsModalDismissed(false);
124
+ }, type: "denied" }));
125
+ }
126
+ else {
127
+ return (React.createElement(MicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
128
+ ? () => {
129
+ onPermissionsTroubleshootingClick(permissionsState);
130
+ }
131
+ : undefined, type: "denied" }));
132
+ }
133
+ };
134
+ if (mobileView) {
135
+ return (React.createElement(React.Fragment, null,
136
+ (checkPermissionModalShowing ||
137
+ microphonePermissionGranted === undefined ||
138
+ cameraPermissionGranted === undefined) && (React.createElement(_DrawerSurface, { onLightDismiss: onLightDismissTriggered, styles: drawerContainerStyles(DRAWER_HIGH_Z_BAND) },
139
+ React.createElement(CameraAndMicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
140
+ ? () => {
141
+ onPermissionsTroubleshootingClick(permissionsState);
142
+ }
143
+ : undefined, type: "check" }))),
144
+ isPermissionsModalDismissed && !checkPermissionModalShowing && modal !== undefined && (React.createElement(_DrawerSurface, { onLightDismiss: onLightDismissTriggered, styles: drawerContainerStyles(DRAWER_HIGH_Z_BAND) }, modal()))));
145
+ }
146
+ else {
147
+ return (React.createElement(React.Fragment, null,
148
+ (checkPermissionModalShowing ||
149
+ microphonePermissionGranted === undefined ||
150
+ cameraPermissionGranted === undefined) && (React.createElement(Modal, { isOpen: isPermissionsModalDismissed, isBlocking: false, onDismiss: () => {
151
+ setIsPermissionsModalDismissed(false);
152
+ }, overlay: { styles: { root: { background: 'rgba(0,0,0,0.9)' } } } },
153
+ React.createElement(CameraAndMicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
154
+ ? () => {
155
+ onPermissionsTroubleshootingClick(permissionsState);
156
+ }
157
+ : undefined, type: "check" }))),
158
+ !checkPermissionModalShowing && modal !== undefined && (React.createElement(Modal, { isOpen: isPermissionsModalDismissed, isBlocking: false, onDismiss: () => {
159
+ setIsPermissionsModalDismissed(false);
160
+ }, overlay: { styles: { root: { background: 'rgba(0,0,0,0.9)' } } } }, modal()))));
161
+ }
162
+ };
163
+ /**
164
+ * Placeholder for conditional compile
165
+ * @private
166
+ */
167
+ export const CallReadinessModalPlaceHolder = () => {
168
+ return React.createElement(React.Fragment, null);
169
+ };
170
+ //# sourceMappingURL=CallReadinessModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallReadinessModal.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/components/CallReadinessModal.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,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ACZ,CACI,CACT;YAEA,CAAC,2BAA2B,IAAI,KAAK,KAAK,SAAS,IAAI,CACtD,oBAAC,KAAK,IACJ,MAAM,EAAE,2BAA2B,EACnC,UAAU,EAAE,KAAK,EACjB,SAAS,EAAE,GAAG,EAAE;oBACd,8BAA8B,CAAC,KAAK,CAAC,CAAC;gBACxC,CAAC,EACD,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE,EAAE,IAE/D,KAAK,EAAE,CACF,CACT,CACA,CACJ,CAAC;KACH;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAgB,EAAE;IAC7D,OAAO,yCAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\n/* @conditional-compile-remove(call-readiness) */\nimport { Modal } from '@fluentui/react';\n/* @conditional-compile-remove(call-readiness) */\nimport {\n CameraAndMicrophoneDomainPermissions,\n CameraDomainPermissions,\n MicrophoneDomainPermissions,\n _DrawerSurface\n} from '@internal/react-components';\n/* @conditional-compile-remove(call-readiness) */\nimport { drawerContainerStyles } from '../styles/CallComposite.styles';\n/* @conditional-compile-remove(call-readiness) */\nconst DRAWER_HIGH_Z_BAND = 99; // setting z index to 99 so that it sit above all components\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n * Modal that guides user through enabling their camera and mic access\n * @private\n */\nexport const CallReadinessModal = (props: {\n mobileView: boolean;\n audioState: PermissionState;\n videoState: PermissionState;\n permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n };\n isPermissionsModalDismissed: boolean;\n setIsPermissionsModalDismissed: (boolean) => void;\n onPermissionsTroubleshootingClick?: (permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n }) => void;\n}): JSX.Element => {\n const {\n mobileView,\n audioState,\n videoState,\n permissionsState,\n isPermissionsModalDismissed,\n setIsPermissionsModalDismissed,\n onPermissionsTroubleshootingClick\n } = props;\n const onLightDismissTriggered = (): void => {\n // do nothing here\n // only way to dismiss this drawer is clicking on allow access which will leads to device permission prompt\n };\n\n const showModal =\n videoState === 'denied' || videoState === 'prompt' || audioState === 'denied' || audioState === 'prompt';\n\n const modal: undefined | (() => JSX.Element) = !showModal\n ? undefined\n : () => {\n // if both video and audio permission are not set\n if (videoState === 'prompt' && audioState === 'prompt') {\n return (\n <CameraAndMicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"request\"\n />\n );\n }\n // if audio permission is set up but video is not\n else if (videoState === 'prompt') {\n return (\n <CameraDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n onContinueAnywayClick={() => {\n setIsPermissionsModalDismissed(false);\n }}\n type=\"request\"\n />\n );\n }\n // if video permission is set up but audio is not\n else if (audioState === 'prompt') {\n return (\n <MicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"request\"\n />\n );\n }\n // if both video and audio are denied\n else if (videoState === 'denied' && audioState === 'denied') {\n return (\n <CameraAndMicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"denied\"\n />\n );\n }\n // if only video is denied\n else if (videoState === 'denied') {\n return (\n <CameraDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n onContinueAnywayClick={() => {\n setIsPermissionsModalDismissed(false);\n }}\n type=\"denied\"\n />\n );\n }\n // if only audio is denied\n else {\n return (\n <MicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"denied\"\n />\n );\n }\n };\n\n if (mobileView && modal !== undefined) {\n return (\n <>\n {isPermissionsModalDismissed && (\n <_DrawerSurface onLightDismiss={onLightDismissTriggered} styles={drawerContainerStyles(DRAWER_HIGH_Z_BAND)}>\n {modal()}\n </_DrawerSurface>\n )}\n </>\n );\n } else if (!mobileView && modal !== undefined) {\n return (\n <Modal\n isOpen={isPermissionsModalDismissed}\n isBlocking={false}\n onDismiss={() => {\n setIsPermissionsModalDismissed(false);\n }}\n overlay={{ styles: { root: { background: 'rgba(0,0,0,0.9)' } } }}\n >\n {modal()}\n </Modal>\n );\n } else {\n return <></>;\n }\n};\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n * Modal that guides user through enabling their camera and mic access\n * This is used when permission API is not supported\n * @private\n */\nexport const CallReadinessModalFallBack = (props: {\n mobileView: boolean;\n cameraPermissionGranted: boolean | undefined;\n microphonePermissionGranted: boolean | undefined;\n checkPermissionModalShowing: boolean;\n permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n };\n isPermissionsModalDismissed: boolean;\n setIsPermissionsModalDismissed: (boolean) => void;\n onPermissionsTroubleshootingClick?: (permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n }) => void;\n}): JSX.Element => {\n const {\n mobileView,\n cameraPermissionGranted,\n microphonePermissionGranted,\n checkPermissionModalShowing,\n permissionsState,\n isPermissionsModalDismissed,\n setIsPermissionsModalDismissed,\n onPermissionsTroubleshootingClick\n } = props;\n const onLightDismissTriggered = (): void => {\n // do nothing here\n // only way to dismiss this drawer is clicking on allow access which will leads to device permission prompt\n };\n\n // When permissions are not set, value is undefined, do nothing here\n // When permissions are set to denied, value is false, show helper screen\n const showModal = cameraPermissionGranted === false || microphonePermissionGranted === false;\n\n const modal: undefined | (() => JSX.Element) = !showModal\n ? undefined\n : () => {\n if (cameraPermissionGranted === false && microphonePermissionGranted === false) {\n return (\n <CameraAndMicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"denied\"\n />\n );\n } else if (cameraPermissionGranted === false && microphonePermissionGranted) {\n return (\n <CameraDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n onContinueAnywayClick={() => {\n setIsPermissionsModalDismissed(false);\n }}\n type=\"denied\"\n />\n );\n } else {\n return (\n <MicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"denied\"\n />\n );\n }\n };\n\n if (mobileView) {\n return (\n <>\n {(checkPermissionModalShowing ||\n microphonePermissionGranted === undefined ||\n cameraPermissionGranted === undefined) && (\n <_DrawerSurface onLightDismiss={onLightDismissTriggered} styles={drawerContainerStyles(DRAWER_HIGH_Z_BAND)}>\n <CameraAndMicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"check\"\n />\n </_DrawerSurface>\n )}\n {isPermissionsModalDismissed && !checkPermissionModalShowing && modal !== undefined && (\n <_DrawerSurface onLightDismiss={onLightDismissTriggered} styles={drawerContainerStyles(DRAWER_HIGH_Z_BAND)}>\n {modal()}\n </_DrawerSurface>\n )}\n </>\n );\n } else {\n return (\n <>\n {(checkPermissionModalShowing ||\n microphonePermissionGranted === undefined ||\n cameraPermissionGranted === undefined) && (\n <Modal\n isOpen={isPermissionsModalDismissed}\n isBlocking={false}\n onDismiss={() => {\n setIsPermissionsModalDismissed(false);\n }}\n overlay={{ styles: { root: { background: 'rgba(0,0,0,0.9)' } } }}\n >\n <CameraAndMicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"check\"\n />\n </Modal>\n )}\n\n {!checkPermissionModalShowing && modal !== undefined && (\n <Modal\n isOpen={isPermissionsModalDismissed}\n isBlocking={false}\n onDismiss={() => {\n setIsPermissionsModalDismissed(false);\n }}\n overlay={{ styles: { root: { background: 'rgba(0,0,0,0.9)' } } }}\n >\n {modal()}\n </Modal>\n )}\n </>\n );\n }\n};\n\n/**\n * Placeholder for conditional compile\n * @private\n */\nexport const CallReadinessModalPlaceHolder = (): JSX.Element => {\n return <></>;\n};\n\"../../../../../react-components/src\""]}
@@ -1,14 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
3
  import React from 'react';
13
4
  /* @conditional-compile-remove(call-readiness) */
14
5
  import { useState } from 'react';
@@ -19,14 +10,10 @@ import { StartCallButton } from '../components/StartCallButton';
19
10
  import { devicePermissionSelector } from '../selectors/devicePermissionSelector';
20
11
  import { useSelector } from '../hooks/useSelector';
21
12
  import { DevicesButton, ErrorBar } from "../../../../../react-components/src";
22
- /* @conditional-compile-remove(call-readiness) */
23
- import { CameraAndMicrophoneDomainPermissions, _DrawerSurface } from "../../../../../react-components/src";
24
13
  /* @conditional-compile-remove(rooms) */
25
14
  import { _usePermissions } from "../../../../../react-components/src";
26
15
  import { getCallingSelector } from "../../../../../calling-component-bindings/src";
27
16
  import { Stack } from '@fluentui/react';
28
- /* @conditional-compile-remove(call-readiness) */
29
- import { Modal } from '@fluentui/react';
30
17
  import { LocalPreview } from '../components/LocalPreview';
31
18
  import { callDetailsStyleDesktop, callDetailsStyleMobile, configurationStackTokensDesktop, configurationStackTokensMobile, configurationContainerStyleDesktop, configurationContainerStyleMobile, selectionContainerStyle, startCallButtonContainerStyleDesktop, startCallButtonContainerStyleMobile, startCallButtonStyleMobile, titleContainerStyleDesktop, titleContainerStyleMobile, callDetailsContainerStylesDesktop } from '../styles/CallConfiguration.styles';
32
19
  import { useLocale } from '../../localization';
@@ -35,11 +22,9 @@ import { usePropsFor } from '../hooks/usePropsFor';
35
22
  import { useAdapter } from '../adapter/CallAdapterProvider';
36
23
  import { ConfigurationpageErrorBar } from '../components/ConfigurationpageErrorBar';
37
24
  /* @conditional-compile-remove(call-readiness) */
38
- import { drawerContainerStyles } from '../styles/CallComposite.styles';
39
- /* @conditional-compile-remove(call-readiness) */
40
25
  import { getDevicePermissionState } from '../utils';
41
26
  /* @conditional-compile-remove(call-readiness) */
42
- const DRAWER_HIGH_Z_BAND = 99; // setting z index to 99 so that it sit above all components
27
+ import { CallReadinessModal, CallReadinessModalFallBack } from '../components/CallReadinessModal';
43
28
  /**
44
29
  * @private
45
30
  */
@@ -97,20 +82,23 @@ export const ConfigurationPage = (props) => {
97
82
  /* @conditional-compile-remove(call-readiness) */
98
83
  const permissionsState = {
99
84
  // fall back to using cameraPermissionGranted and microphonePermissionGranted if permission API is not supported
100
- camera: videoState !== null && videoState !== void 0 ? videoState : (cameraPermissionGranted ? 'granted' : 'denied'),
101
- microphone: audioState !== null && audioState !== void 0 ? audioState : (microphonePermissionGranted ? 'granted' : 'denied')
85
+ camera: videoState && videoState !== 'unsupported' ? videoState : cameraPermissionGranted ? 'granted' : 'denied',
86
+ microphone: audioState && audioState !== 'unsupported' ? audioState : microphonePermissionGranted ? 'granted' : 'denied'
102
87
  };
103
88
  /* @conditional-compile-remove(call-readiness) */
104
89
  const networkErrors = errorBarProps.activeErrorMessages.filter((message) => message.type === 'callNetworkQualityLow');
105
90
  /* @conditional-compile-remove(call-readiness) */
106
- const [isDrawerShowing, setIsDrawerShowing] = useState(true);
91
+ const [isPermissionsModalDismissed, setIsPermissionsModalDismissed] = useState(true);
92
+ // When permission API is not available, we want to show screen saying checking for access (disappears on its own)
93
+ // then based on permission setting, we show permission denied or nothing
107
94
  /* @conditional-compile-remove(call-readiness) */
108
- const onLightDismissTriggered = () => {
109
- // do nothing here
110
- // only way to dismiss this drawer is clicking on allow access which will leads to device permission prompt
111
- };
95
+ const [minimumFallbackTimerElapsed, setMinimumFallbackTimerElapsed] = useState(false);
112
96
  /* @conditional-compile-remove(call-readiness) */
113
- const [isModalShowing, setIsModalShowing] = useState(false);
97
+ setTimeout(() => {
98
+ setMinimumFallbackTimerElapsed(true);
99
+ }, 2000);
100
+ /* @conditional-compile-remove(call-readiness) */
101
+ const forceShowingCheckPermissions = !minimumFallbackTimerElapsed;
114
102
  return (React.createElement(Stack, { className: mobileView ? configurationContainerStyleMobile : configurationContainerStyleDesktop },
115
103
  React.createElement(Stack, { styles: bannerNotificationStyles },
116
104
  React.createElement(ConfigurationpageErrorBar
@@ -129,29 +117,18 @@ export const ConfigurationPage = (props) => {
129
117
  /* @conditional-compile-remove(call-readiness) */
130
118
  callReadinessOptedIn: callReadinessOptedIn })),
131
119
  /* @conditional-compile-remove(call-readiness) */
132
- //show this when clicking on enable camera button or enable mic button on desktop for the first time
133
- //does not show if user has already grant mic or camera access
134
- !mobileView && !cameraPermissionGranted && !microphonePermissionGranted && callReadinessOptedIn && (React.createElement(Modal, { isOpen: isModalShowing, isBlocking: false, onDismiss: () => {
135
- setIsModalShowing(false);
136
- }, overlay: { styles: { root: { background: 'rgba(0,0,0,0.9)' } } } },
137
- React.createElement(CameraAndMicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
138
- ? () => {
139
- onPermissionsTroubleshootingClick(permissionsState);
140
- }
141
- : undefined, type: "request" }))),
120
+ // show the following screen if permission API is availible (not unsupported) and videoState, audioState is assigned values
121
+ callReadinessOptedIn &&
122
+ videoState &&
123
+ videoState !== 'unsupported' &&
124
+ audioState &&
125
+ audioState !== 'unsupported' && (React.createElement(CallReadinessModal, { mobileView: mobileView, audioState: audioState, videoState: videoState, permissionsState: permissionsState, isPermissionsModalDismissed: isPermissionsModalDismissed, setIsPermissionsModalDismissed: setIsPermissionsModalDismissed, onPermissionsTroubleshootingClick: onPermissionsTroubleshootingClick })),
142
126
  /* @conditional-compile-remove(call-readiness) */
143
- mobileView && isDrawerShowing && callReadinessOptedIn && (React.createElement(_DrawerSurface, { onLightDismiss: onLightDismissTriggered, styles: drawerContainerStyles(DRAWER_HIGH_Z_BAND) },
144
- React.createElement(CameraAndMicrophoneDomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
145
- ? () => {
146
- onPermissionsTroubleshootingClick(permissionsState);
147
- }
148
- : undefined, type: "request", onContinueAnywayClick: () => __awaiter(void 0, void 0, void 0, function* () {
149
- yield adapter.askDevicePermission({ video: true, audio: true });
150
- adapter.queryCameras();
151
- adapter.queryMicrophones();
152
- adapter.querySpeakers();
153
- setIsDrawerShowing(false);
154
- }) }))),
127
+ // show the following screen if permission API is not availible (unsupported) and videoState, audioState is assigned values
128
+ callReadinessOptedIn &&
129
+ videoState &&
130
+ audioState &&
131
+ (videoState === 'unsupported' || audioState === 'unsupported') && (React.createElement(CallReadinessModalFallBack, { mobileView: mobileView, cameraPermissionGranted: cameraPermissionGranted, microphonePermissionGranted: microphonePermissionGranted, checkPermissionModalShowing: forceShowingCheckPermissions, permissionsState: permissionsState, isPermissionsModalDismissed: isPermissionsModalDismissed, setIsPermissionsModalDismissed: setIsPermissionsModalDismissed, onPermissionsTroubleshootingClick: onPermissionsTroubleshootingClick })),
155
132
  React.createElement(Stack, { grow: true, horizontal: !mobileWithPreview, horizontalAlign: mobileWithPreview ? 'stretch' : 'center', verticalAlign: "center", tokens: mobileWithPreview ? configurationStackTokensMobile : configurationStackTokensDesktop },
156
133
  mobileWithPreview && (React.createElement(Stack.Item, null,
157
134
  title,
@@ -163,12 +140,14 @@ export const ConfigurationPage = (props) => {
163
140
  React.createElement(Stack.Item, { styles: callDetailsContainerStylesDesktop },
164
141
  title,
165
142
  callDescription),
166
- React.createElement(LocalDeviceSettings, Object.assign({}, options, localDeviceSettingsHandlers, { cameraPermissionGranted: cameraPermissionGranted, microphonePermissionGranted: microphonePermissionGranted,
143
+ React.createElement(LocalDeviceSettings, Object.assign({}, options, localDeviceSettingsHandlers, { cameraPermissionGranted: cameraPermissionGrantedTrampoline(cameraPermissionGranted,
144
+ /* @conditional-compile-remove(call-readiness) */ videoState), microphonePermissionGranted: micPermissionGrantedTrampoline(microphonePermissionGranted,
145
+ /* @conditional-compile-remove(call-readiness) */ audioState),
167
146
  /* @conditional-compile-remove(call-readiness) */
168
147
  callReadinessOptedIn: callReadinessOptedIn,
169
148
  /* @conditional-compile-remove(call-readiness) */
170
149
  onClickEnableDevicePermission: () => {
171
- setIsModalShowing(true);
150
+ setIsPermissionsModalDismissed(true);
172
151
  } })))),
173
152
  React.createElement(Stack, { styles: mobileWithPreview ? startCallButtonContainerStyleMobile : startCallButtonContainerStyleDesktop },
174
153
  React.createElement(StartCallButton, { className: mobileWithPreview ? startCallButtonStyleMobile : undefined, onClick: startCallHandler, disabled: disableStartCallButton }))))));
@@ -180,4 +159,14 @@ const localPreviewTrampoline = (mobileView, doNotShow) => {
180
159
  }
181
160
  return React.createElement(LocalPreview, { mobileView: mobileView, showDevicesButton: mobileView });
182
161
  };
162
+ const cameraPermissionGrantedTrampoline = (cameraPermissionGranted, videoState) => {
163
+ /* @conditional-compile-remove(call-readiness) */
164
+ return videoState && videoState !== 'unsupported' ? videoState === 'granted' : cameraPermissionGranted;
165
+ return cameraPermissionGranted;
166
+ };
167
+ const micPermissionGrantedTrampoline = (microphonePermissionGranted, audioState) => {
168
+ /* @conditional-compile-remove(call-readiness) */
169
+ return audioState && audioState !== 'unsupported' ? audioState === 'granted' : microphonePermissionGranted;
170
+ return microphonePermissionGranted;
171
+ };
183
172
  //# sourceMappingURL=ConfigurationPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigurationPage.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/pages/ConfigurationPage.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,iDAAiD;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,4CAAmC;AACrE,iDAAiD;AACjD,OAAO,EAAE,oCAAoC,EAAE,cAAc,EAAwB,4CAAmC;AACxH,wCAAwC;AACxC,OAAO,EAAE,eAAe,EAAgB,4CAAmC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,sDAA6C;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,iDAAiD;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OA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AAiB;YACjB,wCAAwC,CAAC,CAAC,eAAe,CAAC,YAAY,CACvE;YACD,oBAAC,KAAK,IAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAuB;gBAC/D,CAAC,iBAAiB,IAAI,CACrB;oBACE,oBAAC,KAAK,CAAC,IAAI,IAAC,MAAM,EAAE,iCAAiC;wBAClD,KAAK;wBACL,eAAe,CACL;oBACb,oBAAC,mBAAmB,oBACd,OAAO,EACP,2BAA2B,IAC/B,uBAAuB,EAAE,uBAAuB,EAChD,2BAA2B,EAAE,2BAA2B;wBACxD,iDAAiD;wBACjD,oBAAoB,EAAE,oBAAoB;wBAC1C,iDAAiD;wBACjD,6BAA6B,EAAE,GAAG,EAAE;4BAClC,iBAAiB,CAAC,IAAI,CAAC,CAAC;wBAC1B,CAAC,IACD,CACD,CACJ;gBACD,oBAAC,KAAK,IACJ,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,oCAAoC;oBAEtG,oBAAC,eAAe,IACd,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,SAAS,EACrE,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,sBAAsB,GAChC,CACI,CACF,CACF,CACF,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,UAAmB,EAAE,SAAmB,EAA2B,EAAE;IACnG,wCAAwC;IACxC,IAAI,SAAS,EAAE;QACb,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,oBAAC,YAAY,IAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,GAAI,CAAC;AACjF,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\n/* @conditional-compile-remove(call-readiness) */\nimport { useState } from 'react';\nimport { useAdaptedSelector } from '../hooks/useAdaptedSelector';\nimport { useHandlers } from '../hooks/useHandlers';\nimport { LocalDeviceSettings } from '../components/LocalDeviceSettings';\nimport { StartCallButton } from '../components/StartCallButton';\nimport { devicePermissionSelector } from '../selectors/devicePermissionSelector';\nimport { useSelector } from '../hooks/useSelector';\nimport { DevicesButton, ErrorBar } from '@internal/react-components';\n/* @conditional-compile-remove(call-readiness) */\nimport { CameraAndMicrophoneDomainPermissions, _DrawerSurface, _DrawerSurfaceStyles } from '@internal/react-components';\n/* @conditional-compile-remove(rooms) */\nimport { _usePermissions, _Permissions } from '@internal/react-components';\nimport { getCallingSelector } from '@internal/calling-component-bindings';\nimport { Stack } from '@fluentui/react';\n/* @conditional-compile-remove(call-readiness) */\nimport { Modal } from '@fluentui/react';\nimport { LocalPreview } from '../components/LocalPreview';\nimport {\n callDetailsStyleDesktop,\n callDetailsStyleMobile,\n configurationStackTokensDesktop,\n configurationStackTokensMobile,\n configurationContainerStyleDesktop,\n configurationContainerStyleMobile,\n selectionContainerStyle,\n startCallButtonContainerStyleDesktop,\n startCallButtonContainerStyleMobile,\n startCallButtonStyleMobile,\n titleContainerStyleDesktop,\n titleContainerStyleMobile,\n callDetailsContainerStylesDesktop\n} from '../styles/CallConfiguration.styles';\nimport { useLocale } from '../../localization';\nimport { bannerNotificationStyles } from '../styles/CallPage.styles';\nimport { usePropsFor } from '../hooks/usePropsFor';\nimport { useAdapter } from '../adapter/CallAdapterProvider';\n/* @conditional-compile-remove(call-readiness) */\nimport { DevicePermissionRestrictions } from '../CallComposite';\nimport { ConfigurationpageErrorBar } from '../components/ConfigurationpageErrorBar';\n/* @conditional-compile-remove(call-readiness) */\nimport { drawerContainerStyles } from '../styles/CallComposite.styles';\n/* @conditional-compile-remove(call-readiness) */\nimport { getDevicePermissionState } from '../utils';\n\n/* @conditional-compile-remove(call-readiness) */\nconst DRAWER_HIGH_Z_BAND = 99; // setting z index to 99 so that it sit above all components\n\n/**\n * @private\n */\nexport interface ConfigurationPageProps {\n mobileView: boolean;\n startCallHandler(): void;\n /* @conditional-compile-remove(call-readiness) */\n devicePermissions?: DevicePermissionRestrictions;\n /* @conditional-compile-remove(call-readiness) */\n onPermissionsTroubleshootingClick?: (permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n }) => void;\n /* @conditional-compile-remove(call-readiness) */\n onNetworkingTroubleShootingClick?: () => void;\n /* @conditional-compile-remove(call-readiness) */\n callReadinessOptedIn?: boolean;\n}\n\n/**\n * @private\n */\nexport const ConfigurationPage = (props: ConfigurationPageProps): JSX.Element => {\n const {\n startCallHandler,\n mobileView,\n /* @conditional-compile-remove(call-readiness) */ devicePermissions,\n /* @conditional-compile-remove(call-readiness) */ onPermissionsTroubleshootingClick,\n /* @conditional-compile-remove(call-readiness) */ onNetworkingTroubleShootingClick,\n /* @conditional-compile-remove(call-readiness) */ callReadinessOptedIn = false\n } = props;\n\n const options = useAdaptedSelector(getCallingSelector(DevicesButton));\n const localDeviceSettingsHandlers = useHandlers(LocalDeviceSettings);\n const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useSelector(devicePermissionSelector);\n /* @conditional-compile-remove(call-readiness) */\n // use permission API to get video and audio permission state\n const [videoState, setVideoState] = useState<PermissionState | undefined>(undefined);\n /* @conditional-compile-remove(call-readiness) */\n const [audioState, setAudioState] = useState<PermissionState | undefined>(undefined);\n /* @conditional-compile-remove(call-readiness) */\n getDevicePermissionState(setVideoState, setAudioState);\n\n let errorBarProps = usePropsFor(ErrorBar);\n const adapter = useAdapter();\n const deviceState = adapter.getState().devices;\n\n let disableStartCallButton = !microphonePermissionGranted || deviceState.microphones?.length === 0;\n /* @conditional-compile-remove(rooms) */\n const rolePermissions = _usePermissions();\n\n /* @conditional-compile-remove(rooms) */\n // TODO: move this logic to the error bar selector once role is plumbed from the headless SDK\n if (!rolePermissions.cameraButton) {\n errorBarProps = {\n ...errorBarProps,\n activeErrorMessages: errorBarProps.activeErrorMessages.filter((e) => e.type !== 'callCameraAccessDenied')\n };\n }\n /* @conditional-compile-remove(rooms) */\n if (!rolePermissions.microphoneButton) {\n // If user's role permissions do not allow access to the microphone button then DO NOT disable the start call button\n // because microphone device permission is not needed for the user's role\n disableStartCallButton = false;\n }\n\n /* @conditional-compile-remove(call-readiness) */\n // Overrides role permissions if CallCompositeOptions devicePermissions are set\n if (devicePermissions) {\n if (\n ['doNotPrompt', 'optional'].includes(devicePermissions.camera) &&\n ['doNotPrompt', 'optional'].includes(devicePermissions.microphone)\n ) {\n disableStartCallButton = false;\n } else if (devicePermissions.camera === 'required') {\n disableStartCallButton = !cameraPermissionGranted || deviceState.cameras?.length === 0;\n }\n }\n\n const locale = useLocale();\n const title = (\n <Stack.Item className={mobileView ? titleContainerStyleMobile : titleContainerStyleDesktop}>\n {locale.strings.call.configurationPageTitle}\n </Stack.Item>\n );\n\n const callDescription = locale.strings.call.configurationPageCallDetails && (\n <Stack.Item className={mobileView ? callDetailsStyleMobile : callDetailsStyleDesktop}>\n {locale.strings.call.configurationPageCallDetails}\n </Stack.Item>\n );\n\n let mobileWithPreview = mobileView;\n /* @conditional-compile-remove(rooms) */\n mobileWithPreview = mobileWithPreview && rolePermissions.cameraButton;\n\n /* @conditional-compile-remove(call-readiness) */\n const permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n } = {\n // fall back to using cameraPermissionGranted and microphonePermissionGranted if permission API is not supported\n camera: videoState ?? (cameraPermissionGranted ? 'granted' : 'denied'),\n microphone: audioState ?? (microphonePermissionGranted ? 'granted' : 'denied')\n };\n /* @conditional-compile-remove(call-readiness) */\n const networkErrors = errorBarProps.activeErrorMessages.filter((message) => message.type === 'callNetworkQualityLow');\n\n /* @conditional-compile-remove(call-readiness) */\n const [isDrawerShowing, setIsDrawerShowing] = useState(true);\n /* @conditional-compile-remove(call-readiness) */\n const onLightDismissTriggered = (): void => {\n // do nothing here\n // only way to dismiss this drawer is clicking on allow access which will leads to device permission prompt\n };\n\n /* @conditional-compile-remove(call-readiness) */\n const [isModalShowing, setIsModalShowing] = useState(false);\n\n return (\n <Stack className={mobileView ? configurationContainerStyleMobile : configurationContainerStyleDesktop}>\n <Stack styles={bannerNotificationStyles}>\n <ConfigurationpageErrorBar\n /* @conditional-compile-remove(call-readiness) */\n // show trouble shooting error bar when encountering network error/ permission error\n showTroubleShootingErrorBar={\n !cameraPermissionGranted || !microphonePermissionGranted || networkErrors.length > 0\n }\n /* @conditional-compile-remove(call-readiness) */\n permissionsState={permissionsState}\n /* @conditional-compile-remove(call-readiness) */\n onNetworkingTroubleShootingClick={onNetworkingTroubleShootingClick}\n /* @conditional-compile-remove(call-readiness) */\n onPermissionsTroubleshootingClick={onPermissionsTroubleshootingClick}\n errorBarProps={errorBarProps}\n /* @conditional-compile-remove(call-readiness) */\n callReadinessOptedIn={callReadinessOptedIn}\n />\n </Stack>\n\n {\n /* @conditional-compile-remove(call-readiness) */\n //show this when clicking on enable camera button or enable mic button on desktop for the first time\n //does not show if user has already grant mic or camera access\n !mobileView && !cameraPermissionGranted && !microphonePermissionGranted && callReadinessOptedIn && (\n <Modal\n isOpen={isModalShowing}\n isBlocking={false}\n onDismiss={() => {\n setIsModalShowing(false);\n }}\n overlay={{ styles: { root: { background: 'rgba(0,0,0,0.9)' } } }}\n >\n <CameraAndMicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"request\"\n />\n </Modal>\n )\n }\n\n {\n /* @conditional-compile-remove(call-readiness) */\n mobileView && isDrawerShowing && callReadinessOptedIn && (\n <_DrawerSurface onLightDismiss={onLightDismissTriggered} styles={drawerContainerStyles(DRAWER_HIGH_Z_BAND)}>\n <CameraAndMicrophoneDomainPermissions\n appName={'app'}\n onTroubleshootingClick={\n onPermissionsTroubleshootingClick\n ? () => {\n onPermissionsTroubleshootingClick(permissionsState);\n }\n : undefined\n }\n type=\"request\"\n onContinueAnywayClick={async () => {\n await adapter.askDevicePermission({ video: true, audio: true });\n adapter.queryCameras();\n adapter.queryMicrophones();\n adapter.querySpeakers();\n setIsDrawerShowing(false);\n }}\n />\n </_DrawerSurface>\n )\n }\n <Stack\n grow\n horizontal={!mobileWithPreview}\n horizontalAlign={mobileWithPreview ? 'stretch' : 'center'}\n verticalAlign=\"center\"\n tokens={mobileWithPreview ? configurationStackTokensMobile : configurationStackTokensDesktop}\n >\n {mobileWithPreview && (\n <Stack.Item>\n {title}\n {callDescription}\n </Stack.Item>\n )}\n {localPreviewTrampoline(\n mobileWithPreview,\n /* @conditional-compile-remove(rooms) */ !rolePermissions.cameraButton\n )}\n <Stack className={mobileView ? undefined : selectionContainerStyle}>\n {!mobileWithPreview && (\n <>\n <Stack.Item styles={callDetailsContainerStylesDesktop}>\n {title}\n {callDescription}\n </Stack.Item>\n <LocalDeviceSettings\n {...options}\n {...localDeviceSettingsHandlers}\n cameraPermissionGranted={cameraPermissionGranted}\n microphonePermissionGranted={microphonePermissionGranted}\n /* @conditional-compile-remove(call-readiness) */\n callReadinessOptedIn={callReadinessOptedIn}\n /* @conditional-compile-remove(call-readiness) */\n onClickEnableDevicePermission={() => {\n setIsModalShowing(true);\n }}\n />\n </>\n )}\n <Stack\n styles={mobileWithPreview ? startCallButtonContainerStyleMobile : startCallButtonContainerStyleDesktop}\n >\n <StartCallButton\n className={mobileWithPreview ? startCallButtonStyleMobile : undefined}\n onClick={startCallHandler}\n disabled={disableStartCallButton}\n />\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n );\n};\n\nconst localPreviewTrampoline = (mobileView: boolean, doNotShow?: boolean): JSX.Element | undefined => {\n /* @conditional-compile-remove(rooms) */\n if (doNotShow) {\n return undefined;\n }\n return <LocalPreview mobileView={mobileView} showDevicesButton={mobileView} />;\n};\n\"../../../../../react-components/src\"\"../../../../../calling-component-bindings/src\""]}
1
+ {"version":3,"file":"ConfigurationPage.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/pages/ConfigurationPage.tsx"],"names":[],"mappings":"AAAA,uCAA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AE,SAAmB,EAA2B,EAAE;IACnG,wCAAwC;IACxC,IAAI,SAAS,EAAE;QACb,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,oBAAC,YAAY,IAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,GAAI,CAAC;AACjF,CAAC,CAAC;AAEF,MAAM,iCAAiC,GAAG,CACxC,uBAA4C,EAC5C,UAAwD,EACnC,EAAE;IACvB,iDAAiD;IACjD,OAAO,UAAU,IAAI,UAAU,KAAK,aAAa,CAAC,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC;IAEvG,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,8BAA8B,GAAG,CACrC,2BAAgD,EAChD,UAAwD,EACnC,EAAE;IACvB,iDAAiD;IACjD,OAAO,UAAU,IAAI,UAAU,KAAK,aAAa,CAAC,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC;IAE3G,OAAO,2BAA2B,CAAC;AACrC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\n/* @conditional-compile-remove(call-readiness) */\nimport { useState } from 'react';\nimport { useAdaptedSelector } from '../hooks/useAdaptedSelector';\nimport { useHandlers } from '../hooks/useHandlers';\nimport { LocalDeviceSettings } from '../components/LocalDeviceSettings';\nimport { StartCallButton } from '../components/StartCallButton';\nimport { devicePermissionSelector } from '../selectors/devicePermissionSelector';\nimport { useSelector } from '../hooks/useSelector';\nimport { DevicesButton, ErrorBar } from '@internal/react-components';\n/* @conditional-compile-remove(rooms) */\nimport { _usePermissions, _Permissions } from '@internal/react-components';\nimport { getCallingSelector } from '@internal/calling-component-bindings';\nimport { Stack } from '@fluentui/react';\nimport { LocalPreview } from '../components/LocalPreview';\nimport {\n callDetailsStyleDesktop,\n callDetailsStyleMobile,\n configurationStackTokensDesktop,\n configurationStackTokensMobile,\n configurationContainerStyleDesktop,\n configurationContainerStyleMobile,\n selectionContainerStyle,\n startCallButtonContainerStyleDesktop,\n startCallButtonContainerStyleMobile,\n startCallButtonStyleMobile,\n titleContainerStyleDesktop,\n titleContainerStyleMobile,\n callDetailsContainerStylesDesktop\n} from '../styles/CallConfiguration.styles';\nimport { useLocale } from '../../localization';\nimport { bannerNotificationStyles } from '../styles/CallPage.styles';\nimport { usePropsFor } from '../hooks/usePropsFor';\nimport { useAdapter } from '../adapter/CallAdapterProvider';\n/* @conditional-compile-remove(call-readiness) */\nimport { DevicePermissionRestrictions } from '../CallComposite';\nimport { ConfigurationpageErrorBar } from '../components/ConfigurationpageErrorBar';\n/* @conditional-compile-remove(call-readiness) */\nimport { getDevicePermissionState } from '../utils';\n/* @conditional-compile-remove(call-readiness) */\nimport { CallReadinessModal, CallReadinessModalFallBack } from '../components/CallReadinessModal';\n\n/**\n * @private\n */\nexport interface ConfigurationPageProps {\n mobileView: boolean;\n startCallHandler(): void;\n /* @conditional-compile-remove(call-readiness) */\n devicePermissions?: DevicePermissionRestrictions;\n /* @conditional-compile-remove(call-readiness) */\n onPermissionsTroubleshootingClick?: (permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n }) => void;\n /* @conditional-compile-remove(call-readiness) */\n onNetworkingTroubleShootingClick?: () => void;\n /* @conditional-compile-remove(call-readiness) */\n callReadinessOptedIn?: boolean;\n}\n\n/**\n * @private\n */\nexport const ConfigurationPage = (props: ConfigurationPageProps): JSX.Element => {\n const {\n startCallHandler,\n mobileView,\n /* @conditional-compile-remove(call-readiness) */ devicePermissions,\n /* @conditional-compile-remove(call-readiness) */ onPermissionsTroubleshootingClick,\n /* @conditional-compile-remove(call-readiness) */ onNetworkingTroubleShootingClick,\n /* @conditional-compile-remove(call-readiness) */ callReadinessOptedIn = false\n } = props;\n\n const options = useAdaptedSelector(getCallingSelector(DevicesButton));\n const localDeviceSettingsHandlers = useHandlers(LocalDeviceSettings);\n const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useSelector(devicePermissionSelector);\n /* @conditional-compile-remove(call-readiness) */\n // use permission API to get video and audio permission state\n const [videoState, setVideoState] = useState<PermissionState | 'unsupported' | undefined>(undefined);\n /* @conditional-compile-remove(call-readiness) */\n const [audioState, setAudioState] = useState<PermissionState | 'unsupported' | undefined>(undefined);\n /* @conditional-compile-remove(call-readiness) */\n getDevicePermissionState(setVideoState, setAudioState);\n\n let errorBarProps = usePropsFor(ErrorBar);\n const adapter = useAdapter();\n const deviceState = adapter.getState().devices;\n\n let disableStartCallButton = !microphonePermissionGranted || deviceState.microphones?.length === 0;\n /* @conditional-compile-remove(rooms) */\n const rolePermissions = _usePermissions();\n\n /* @conditional-compile-remove(rooms) */\n // TODO: move this logic to the error bar selector once role is plumbed from the headless SDK\n if (!rolePermissions.cameraButton) {\n errorBarProps = {\n ...errorBarProps,\n activeErrorMessages: errorBarProps.activeErrorMessages.filter((e) => e.type !== 'callCameraAccessDenied')\n };\n }\n /* @conditional-compile-remove(rooms) */\n if (!rolePermissions.microphoneButton) {\n // If user's role permissions do not allow access to the microphone button then DO NOT disable the start call button\n // because microphone device permission is not needed for the user's role\n disableStartCallButton = false;\n }\n\n /* @conditional-compile-remove(call-readiness) */\n // Overrides role permissions if CallCompositeOptions devicePermissions are set\n if (devicePermissions) {\n if (\n ['doNotPrompt', 'optional'].includes(devicePermissions.camera) &&\n ['doNotPrompt', 'optional'].includes(devicePermissions.microphone)\n ) {\n disableStartCallButton = false;\n } else if (devicePermissions.camera === 'required') {\n disableStartCallButton = !cameraPermissionGranted || deviceState.cameras?.length === 0;\n }\n }\n\n const locale = useLocale();\n const title = (\n <Stack.Item className={mobileView ? titleContainerStyleMobile : titleContainerStyleDesktop}>\n {locale.strings.call.configurationPageTitle}\n </Stack.Item>\n );\n\n const callDescription = locale.strings.call.configurationPageCallDetails && (\n <Stack.Item className={mobileView ? callDetailsStyleMobile : callDetailsStyleDesktop}>\n {locale.strings.call.configurationPageCallDetails}\n </Stack.Item>\n );\n\n let mobileWithPreview = mobileView;\n /* @conditional-compile-remove(rooms) */\n mobileWithPreview = mobileWithPreview && rolePermissions.cameraButton;\n\n /* @conditional-compile-remove(call-readiness) */\n const permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n } = {\n // fall back to using cameraPermissionGranted and microphonePermissionGranted if permission API is not supported\n camera: videoState && videoState !== 'unsupported' ? videoState : cameraPermissionGranted ? 'granted' : 'denied',\n microphone:\n audioState && audioState !== 'unsupported' ? audioState : microphonePermissionGranted ? 'granted' : 'denied'\n };\n /* @conditional-compile-remove(call-readiness) */\n const networkErrors = errorBarProps.activeErrorMessages.filter((message) => message.type === 'callNetworkQualityLow');\n\n /* @conditional-compile-remove(call-readiness) */\n const [isPermissionsModalDismissed, setIsPermissionsModalDismissed] = useState(true);\n\n // When permission API is not available, we want to show screen saying checking for access (disappears on its own)\n // then based on permission setting, we show permission denied or nothing\n /* @conditional-compile-remove(call-readiness) */\n const [minimumFallbackTimerElapsed, setMinimumFallbackTimerElapsed] = useState(false);\n /* @conditional-compile-remove(call-readiness) */\n setTimeout(() => {\n setMinimumFallbackTimerElapsed(true);\n }, 2000);\n /* @conditional-compile-remove(call-readiness) */\n const forceShowingCheckPermissions = !minimumFallbackTimerElapsed;\n\n return (\n <Stack className={mobileView ? configurationContainerStyleMobile : configurationContainerStyleDesktop}>\n <Stack styles={bannerNotificationStyles}>\n <ConfigurationpageErrorBar\n /* @conditional-compile-remove(call-readiness) */\n // show trouble shooting error bar when encountering network error/ permission error\n showTroubleShootingErrorBar={\n !cameraPermissionGranted || !microphonePermissionGranted || networkErrors.length > 0\n }\n /* @conditional-compile-remove(call-readiness) */\n permissionsState={permissionsState}\n /* @conditional-compile-remove(call-readiness) */\n onNetworkingTroubleShootingClick={onNetworkingTroubleShootingClick}\n /* @conditional-compile-remove(call-readiness) */\n onPermissionsTroubleshootingClick={onPermissionsTroubleshootingClick}\n errorBarProps={errorBarProps}\n /* @conditional-compile-remove(call-readiness) */\n callReadinessOptedIn={callReadinessOptedIn}\n />\n </Stack>\n {\n /* @conditional-compile-remove(call-readiness) */\n // show the following screen if permission API is availible (not unsupported) and videoState, audioState is assigned values\n callReadinessOptedIn &&\n videoState &&\n videoState !== 'unsupported' &&\n audioState &&\n audioState !== 'unsupported' && (\n <CallReadinessModal\n mobileView={mobileView}\n audioState={audioState}\n videoState={videoState}\n permissionsState={permissionsState}\n isPermissionsModalDismissed={isPermissionsModalDismissed}\n setIsPermissionsModalDismissed={setIsPermissionsModalDismissed}\n onPermissionsTroubleshootingClick={onPermissionsTroubleshootingClick}\n />\n )\n }\n\n {\n /* @conditional-compile-remove(call-readiness) */\n // show the following screen if permission API is not availible (unsupported) and videoState, audioState is assigned values\n callReadinessOptedIn &&\n videoState &&\n audioState &&\n (videoState === 'unsupported' || audioState === 'unsupported') && (\n <CallReadinessModalFallBack\n mobileView={mobileView}\n cameraPermissionGranted={cameraPermissionGranted}\n microphonePermissionGranted={microphonePermissionGranted}\n checkPermissionModalShowing={forceShowingCheckPermissions}\n permissionsState={permissionsState}\n isPermissionsModalDismissed={isPermissionsModalDismissed}\n setIsPermissionsModalDismissed={setIsPermissionsModalDismissed}\n onPermissionsTroubleshootingClick={onPermissionsTroubleshootingClick}\n />\n )\n }\n\n <Stack\n grow\n horizontal={!mobileWithPreview}\n horizontalAlign={mobileWithPreview ? 'stretch' : 'center'}\n verticalAlign=\"center\"\n tokens={mobileWithPreview ? configurationStackTokensMobile : configurationStackTokensDesktop}\n >\n {mobileWithPreview && (\n <Stack.Item>\n {title}\n {callDescription}\n </Stack.Item>\n )}\n {localPreviewTrampoline(\n mobileWithPreview,\n /* @conditional-compile-remove(rooms) */ !rolePermissions.cameraButton\n )}\n <Stack className={mobileView ? undefined : selectionContainerStyle}>\n {!mobileWithPreview && (\n <>\n <Stack.Item styles={callDetailsContainerStylesDesktop}>\n {title}\n {callDescription}\n </Stack.Item>\n <LocalDeviceSettings\n {...options}\n {...localDeviceSettingsHandlers}\n cameraPermissionGranted={cameraPermissionGrantedTrampoline(\n cameraPermissionGranted,\n /* @conditional-compile-remove(call-readiness) */ videoState\n )}\n microphonePermissionGranted={micPermissionGrantedTrampoline(\n microphonePermissionGranted,\n /* @conditional-compile-remove(call-readiness) */ audioState\n )}\n /* @conditional-compile-remove(call-readiness) */\n callReadinessOptedIn={callReadinessOptedIn}\n /* @conditional-compile-remove(call-readiness) */\n onClickEnableDevicePermission={() => {\n setIsPermissionsModalDismissed(true);\n }}\n />\n </>\n )}\n <Stack\n styles={mobileWithPreview ? startCallButtonContainerStyleMobile : startCallButtonContainerStyleDesktop}\n >\n <StartCallButton\n className={mobileWithPreview ? startCallButtonStyleMobile : undefined}\n onClick={startCallHandler}\n disabled={disableStartCallButton}\n />\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n );\n};\n\nconst localPreviewTrampoline = (mobileView: boolean, doNotShow?: boolean): JSX.Element | undefined => {\n /* @conditional-compile-remove(rooms) */\n if (doNotShow) {\n return undefined;\n }\n return <LocalPreview mobileView={mobileView} showDevicesButton={mobileView} />;\n};\n\nconst cameraPermissionGrantedTrampoline = (\n cameraPermissionGranted: boolean | undefined,\n videoState?: PermissionState | 'unsupported' | undefined\n): boolean | undefined => {\n /* @conditional-compile-remove(call-readiness) */\n return videoState && videoState !== 'unsupported' ? videoState === 'granted' : cameraPermissionGranted;\n\n return cameraPermissionGranted;\n};\n\nconst micPermissionGrantedTrampoline = (\n microphonePermissionGranted: boolean | undefined,\n audioState?: PermissionState | 'unsupported' | undefined\n): boolean | undefined => {\n /* @conditional-compile-remove(call-readiness) */\n return audioState && audioState !== 'unsupported' ? audioState === 'granted' : microphonePermissionGranted;\n\n return microphonePermissionGranted;\n};\n\"../../../../../react-components/src\"\"../../../../../calling-component-bindings/src\""]}
@@ -56,5 +56,5 @@ export declare const isDisabled: (option: boolean | {
56
56
  * If permission API is not supported on this browser, do nothing and log out error
57
57
  * @private
58
58
  */
59
- export declare const getDevicePermissionState: (setVideoState: (state: PermissionState) => void, setAudioState: (state: PermissionState) => void) => void;
59
+ export declare const getDevicePermissionState: (setVideoState: (state: PermissionState | 'unsupported') => void, setAudioState: (state: PermissionState | 'unsupported') => void) => void;
60
60
  //# sourceMappingURL=Utils.d.ts.map
@@ -224,16 +224,16 @@ export const getDevicePermissionState = (setVideoState, setAudioState) => {
224
224
  .then((result) => {
225
225
  setVideoState(result.state);
226
226
  })
227
- .catch((error) => {
228
- console.log(error);
227
+ .catch(() => {
228
+ setVideoState('unsupported');
229
229
  });
230
230
  navigator.permissions
231
231
  .query({ name: 'microphone' })
232
232
  .then((result) => {
233
233
  setAudioState(result.state);
234
234
  })
235
- .catch((error) => {
236
- console.log(error);
235
+ .catch(() => {
236
+ setAudioState('unsupported');
237
237
  });
238
238
  };
239
239
  //# sourceMappingURL=Utils.js.map