@azure/communication-react 1.22.0-alpha-202411300016 → 1.22.0-alpha-202412070017
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +85 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DzsGluyT.js → ChatMessageComponentAsRichTextEditBox-CTHWXMl0.js} +2 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DzsGluyT.js.map → ChatMessageComponentAsRichTextEditBox-CTHWXMl0.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-xkuOcBvs.js → RichTextSendBoxWrapper-C0YPqtKB.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-xkuOcBvs.js.map → RichTextSendBoxWrapper-C0YPqtKB.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-DlHL2qZP.js → index-Bf1eybwR.js} +67 -80
- package/dist/dist-cjs/communication-react/index-Bf1eybwR.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +2 -1
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.d.ts +6 -6
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js +2 -2
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +2 -2
- package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js +4 -1
- package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/index.d.ts +2 -2
- package/dist/dist-esm/calling-component-bindings/src/index.js +1 -1
- package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +3 -3
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/utils/compareMessages.js +0 -6
- package/dist/dist-esm/chat-component-bindings/src/utils/compareMessages.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.js +1 -1
- package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +2 -0
- package/dist/dist-esm/communication-react/src/index.js +1 -0
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Caption.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/Caption.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.d.ts +42 -11
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js +6 -3
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.js +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RealTimeText.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SystemMessage.js +15 -4
- package/dist/dist-esm/react-components/src/components/SystemMessage.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/Captions.style.js +4 -4
- package/dist/dist-esm/react-components/src/components/styles/Captions.style.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.js +4 -2
- package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/Common.style.d.ts +0 -13
- package/dist/dist-esm/react-components/src/components/styles/Common.style.js +0 -13
- package/dist/dist-esm/react-components/src/components/styles/Common.style.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +3 -3
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +3 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +3 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js +1 -13
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/{CaptionsBanner.d.ts → CallingCaptionsBanner.d.ts} +2 -2
- package/dist/dist-esm/react-composites/src/composites/common/{CaptionsBanner.js → CallingCaptionsBanner.js} +7 -10
- package/dist/dist-esm/react-composites/src/composites/common/CallingCaptionsBanner.js.map +1 -0
- package/package.json +1 -1
- package/dist/dist-cjs/communication-react/index-DlHL2qZP.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/CaptionsBanner.js.map +0 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var index = require('./index-
|
3
|
+
var index = require('./index-Bf1eybwR.js');
|
4
4
|
require('react');
|
5
5
|
require('@fluentui/react');
|
6
6
|
require('@fluentui/react-components');
|
@@ -92,6 +92,7 @@ exports.CallWithChatComposite = index.CallWithChatComposite;
|
|
92
92
|
exports.CameraAndMicrophoneSitePermissions = index.CameraAndMicrophoneSitePermissions;
|
93
93
|
exports.CameraButton = index.CameraButton;
|
94
94
|
exports.CameraSitePermissions = index.CameraSitePermissions;
|
95
|
+
exports.CaptionsBanner = index.CaptionsBanner;
|
95
96
|
exports.ChatClientProvider = index.ChatClientProvider;
|
96
97
|
exports.ChatComposite = index.ChatComposite;
|
97
98
|
exports.ChatThreadClientProvider = index.ChatThreadClientProvider;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.22.0-alpha-
|
1
|
+
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.22.0-alpha-202412070017';\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CallClientState } from "../../calling-stateful-client/src";
|
2
2
|
import { CallingBaseSelectorProps } from './baseSelectors';
|
3
|
-
import {
|
3
|
+
import { CaptionsInformation, _SupportedCaptionLanguage, _SupportedSpokenLanguage } from "../../react-components/src";
|
4
4
|
/**
|
5
5
|
* Selector type for the {@link StartCaptionsButton} component.
|
6
6
|
* @internal
|
@@ -35,16 +35,16 @@ export type _CaptionSettingsSelector = (state: CallClientState, props: CallingBa
|
|
35
35
|
export declare const _captionSettingsSelector: _CaptionSettingsSelector;
|
36
36
|
/**
|
37
37
|
* Selector type for the {@link CaptionsBanner} component.
|
38
|
-
* @
|
38
|
+
* @public
|
39
39
|
*/
|
40
|
-
export type
|
41
|
-
captions:
|
40
|
+
export type CaptionsBannerSelector = (state: CallClientState, props: CallingBaseSelectorProps) => {
|
41
|
+
captions: CaptionsInformation[];
|
42
42
|
isCaptionsOn: boolean;
|
43
43
|
};
|
44
44
|
/**
|
45
45
|
* Selector for {@link CaptionsBanner} component.
|
46
46
|
*
|
47
|
-
* @
|
47
|
+
* @public
|
48
48
|
*/
|
49
|
-
export declare const
|
49
|
+
export declare const captionsBannerSelector: CaptionsBannerSelector;
|
50
50
|
//# sourceMappingURL=captionsSelector.d.ts.map
|
@@ -39,9 +39,9 @@ export const _captionSettingsSelector = reselect.createSelector([
|
|
39
39
|
/**
|
40
40
|
* Selector for {@link CaptionsBanner} component.
|
41
41
|
*
|
42
|
-
* @
|
42
|
+
* @public
|
43
43
|
*/
|
44
|
-
export const
|
44
|
+
export const captionsBannerSelector = reselect.createSelector([getCaptions, getCaptionsStatus, getStartCaptionsInProgress, getRemoteParticipants, getDisplayName, getIdentifier], (captions, isCaptionsFeatureActive, startCaptionsInProgress, remoteParticipants, displayName, identifier) => {
|
45
45
|
const captionsInfo = captions === null || captions === void 0 ? void 0 : captions.map((c, index) => {
|
46
46
|
var _a;
|
47
47
|
const userId = getCaptionsSpeakerIdentifier(c);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"captionsSelector.js","sourceRoot":"","sources":["../../../../../calling-component-bindings/src/captionsSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAgBxE;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAiC,QAAQ,CAAC,cAAc,CAC/F,CAAC,iBAAiB,EAAE,yBAAyB,EAAE,wBAAwB,CAAC,EACxE,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,EAAE;IACzE,OAAO;QACL,OAAO,EAAE,uBAAuB,aAAvB,uBAAuB,cAAvB,uBAAuB,GAAI,KAAK;QACzC,sBAAsB,EAAE,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,EAAE;QACpD,qBAAqB,EAAE,qBAAqB,aAArB,qBAAqB,cAArB,qBAAqB,GAAI,OAAO;KACxD,CAAC;AACJ,CAAC,CACF,CAAC;AAiBF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAA6B,QAAQ,CAAC,cAAc,CACvF;IACE,4BAA4B;IAC5B,yBAAyB;IACzB,2BAA2B;IAC3B,wBAAwB;IACxB,iBAAiB;CAClB,EACD,CACE,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,EAAE;IACF,OAAO;QACL,yBAAyB,EAAE,yBAAyB,aAAzB,yBAAyB,cAAzB,yBAAyB,GAAI,EAAE;QAC1D,sBAAsB,EAAE,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,IAAI;QACtD,wBAAwB,EAAE,wBAAwB,aAAxB,wBAAwB,cAAxB,wBAAwB,GAAI,CAAC,OAAO,CAAC;QAC/D,qBAAqB,EAAE,qBAAqB,aAArB,qBAAqB,cAArB,qBAAqB,GAAI,OAAO;QACvD,uBAAuB,EAAE,uBAAuB,aAAvB,uBAAuB,cAAvB,uBAAuB,GAAI,KAAK;KAC1D,CAAC;AACJ,CAAC,CACF,CAAC;AAaF;;;;GAIG;AACH,MAAM,CAAC,MAAM,
|
1
|
+
{"version":3,"file":"captionsSelector.js","sourceRoot":"","sources":["../../../../../calling-component-bindings/src/captionsSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAgBxE;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAiC,QAAQ,CAAC,cAAc,CAC/F,CAAC,iBAAiB,EAAE,yBAAyB,EAAE,wBAAwB,CAAC,EACxE,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,EAAE;IACzE,OAAO;QACL,OAAO,EAAE,uBAAuB,aAAvB,uBAAuB,cAAvB,uBAAuB,GAAI,KAAK;QACzC,sBAAsB,EAAE,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,EAAE;QACpD,qBAAqB,EAAE,qBAAqB,aAArB,qBAAqB,cAArB,qBAAqB,GAAI,OAAO;KACxD,CAAC;AACJ,CAAC,CACF,CAAC;AAiBF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wB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G,kBAAkB,CAAC,MAAM,CAAC,CAAC;YAC/C,IAAI,WAAW,EAAE,CAAC;gBAChB,gBAAgB,GAAG,WAAW,CAAC,WAAW,CAAC;YAC7C,CAAC;QACH,CAAC;QACD,OAAO;YACL,EAAE,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,qBAAqB,CAAC,GAAG,KAAK;YACvD,WAAW,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,qBAAqB;YACtD,WAAW,EAAE,MAAA,CAAC,CAAC,WAAW,mCAAI,EAAE;YAChC,MAAM;SACP,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO;QACL,QAAQ,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE;QAC5B,YAAY,EAAE,uBAAuB,aAAvB,uBAAuB,cAAvB,uBAAuB,GAAI,KAAK;QAC9C,uBAAuB,EAAE,uBAAuB,aAAvB,uBAAuB,cAAvB,uBAAuB,GAAI,KAAK;KAC1D,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,QAAsB,EAAU,EAAE;IACtE,OAAO,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,6BAA6B,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACvG,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CallClientState, CaptionsInfo } from '@internal/calling-stateful-client';\nimport {\n CallingBaseSelectorProps,\n getDisplayName,\n getIdentifier,\n getRemoteParticipants,\n getStartCaptionsInProgress,\n getSupportedCaptionLanguages\n} from './baseSelectors';\nimport {\n getCaptions,\n getCaptionsStatus,\n getCurrentCaptionLanguage,\n getCurrentSpokenLanguage,\n getSupportedSpokenLanguages\n} from './baseSelectors';\nimport * as reselect from 'reselect';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { CaptionsInformation, _SupportedCaptionLanguage, _SupportedSpokenLanguage } from '@internal/react-components';\n\n/**\n * Selector type for the {@link StartCaptionsButton} component.\n * @internal\n */\nexport type _StartCaptionsButtonSelector = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n) => {\n checked: boolean;\n currentCaptionLanguage: string;\n currentSpokenLanguage: string;\n};\n\n/**\n * Selector for {@link StartCaptionsButton} component.\n *\n * @internal\n */\nexport const _startCaptionsButtonSelector: _StartCaptionsButtonSelector = reselect.createSelector(\n [getCaptionsStatus, getCurrentCaptionLanguage, getCurrentSpokenLanguage],\n (isCaptionsFeatureActive, currentCaptionLanguage, currentSpokenLanguage) => {\n return {\n checked: isCaptionsFeatureActive ?? false,\n currentCaptionLanguage: currentCaptionLanguage ?? '',\n currentSpokenLanguage: currentSpokenLanguage ?? 'en-us'\n };\n }\n);\n\n/**\n * Selector type for components for Changing caption language and spoken language\n * @internal\n */\nexport type _CaptionSettingsSelector = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n) => {\n supportedCaptionLanguages: _SupportedCaptionLanguage[];\n currentCaptionLanguage: _SupportedCaptionLanguage;\n supportedSpokenLanguages: _SupportedSpokenLanguage[];\n currentSpokenLanguage: _SupportedSpokenLanguage;\n isCaptionsFeatureActive: boolean;\n};\n\n/**\n * Selector for Changing caption language and spoken language\n *\n * @internal\n */\nexport const _captionSettingsSelector: _CaptionSettingsSelector = reselect.createSelector(\n [\n getSupportedCaptionLanguages,\n getCurrentCaptionLanguage,\n getSupportedSpokenLanguages,\n getCurrentSpokenLanguage,\n getCaptionsStatus\n ],\n (\n supportedCaptionLanguages,\n currentCaptionLanguage,\n supportedSpokenLanguages,\n currentSpokenLanguage,\n isCaptionsFeatureActive\n ) => {\n return {\n supportedCaptionLanguages: supportedCaptionLanguages ?? [],\n currentCaptionLanguage: currentCaptionLanguage ?? 'en',\n supportedSpokenLanguages: supportedSpokenLanguages ?? ['en-us'],\n currentSpokenLanguage: currentSpokenLanguage ?? 'en-us',\n isCaptionsFeatureActive: isCaptionsFeatureActive ?? false\n };\n }\n);\n/**\n * Selector type for the {@link CaptionsBanner} component.\n * @public\n */\nexport type CaptionsBannerSelector = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n) => {\n captions: CaptionsInformation[];\n isCaptionsOn: boolean;\n};\n\n/**\n * Selector for {@link CaptionsBanner} component.\n *\n * @public\n */\nexport const captionsBannerSelector: CaptionsBannerSelector = reselect.createSelector(\n [getCaptions, getCaptionsStatus, getStartCaptionsInProgress, getRemoteParticipants, getDisplayName, getIdentifier],\n (captions, isCaptionsFeatureActive, startCaptionsInProgress, remoteParticipants, displayName, identifier) => {\n const captionsInfo = captions?.map((c, index) => {\n const userId = getCaptionsSpeakerIdentifier(c);\n let finalDisplayName;\n if (userId === identifier) {\n finalDisplayName = displayName;\n } else if (remoteParticipants) {\n const participant = remoteParticipants[userId];\n if (participant) {\n finalDisplayName = participant.displayName;\n }\n }\n return {\n id: (finalDisplayName ?? 'Unnamed Participant') + index,\n displayName: finalDisplayName ?? 'Unnamed Participant',\n captionText: c.captionText ?? '',\n userId\n };\n });\n return {\n captions: captionsInfo ?? [],\n isCaptionsOn: isCaptionsFeatureActive ?? false,\n startCaptionsInProgress: startCaptionsInProgress ?? false\n };\n }\n);\n\nconst getCaptionsSpeakerIdentifier = (captions: CaptionsInfo): string => {\n return captions.speaker.identifier ? toFlatCommunicationIdentifier(captions.speaker.identifier) : '';\n};\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import { CameraButton, EndCallButton, ErrorBar, MicrophoneButton, DevicesButton, ParticipantList, ScreenShareButton, VideoGallery } from "../../../react-components/src";
|
2
|
+
import { CameraButton, EndCallButton, ErrorBar, MicrophoneButton, DevicesButton, ParticipantList, ScreenShareButton, VideoGallery, CaptionsBanner } from "../../../react-components/src";
|
3
3
|
import { IncomingCallStack } from "../../../react-components/src";
|
4
4
|
import { NotificationStack } from "../../../react-components/src";
|
5
5
|
import { Dialpad } from "../../../react-components/src";
|
@@ -52,7 +52,7 @@ export type EmptySelector = () => Record<string, never>;
|
|
52
52
|
*
|
53
53
|
* @public
|
54
54
|
*/
|
55
|
-
export type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof VideoGallery> extends true ? VideoGallerySelector : AreEqual<Component, typeof DevicesButton> extends true ? DevicesButtonSelector : AreEqual<Component, typeof MicrophoneButton> extends true ? MicrophoneButtonSelector : AreEqual<Component, typeof CameraButton> extends true ? CameraButtonSelector : AreEqual<Component, typeof ScreenShareButton> extends true ? ScreenShareButtonSelector : AreEqual<Component, typeof ParticipantList> extends true ? ParticipantListSelector : AreEqual<Component, typeof ParticipantsButton> extends true ? ParticipantsButtonSelector : AreEqual<Component, typeof EndCallButton> extends true ? EmptySelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : AreEqual<Component, typeof Dialpad> extends true ? EmptySelector : AreEqual<Component, typeof HoldButton> extends true ? HoldButtonSelector : AreEqual<Component, typeof NotificationStack> extends true ? NotificationStackSelector : AreEqual<Component, typeof IncomingCallStack> extends true ? IncomingCallStackSelector : AreEqual<Component, typeof ReactionButton> extends true ? RaiseHandButtonSelector : AreEqual<Component, typeof RaiseHandButton> extends true ? EmptySelector : undefined;
|
55
|
+
export type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof VideoGallery> extends true ? VideoGallerySelector : AreEqual<Component, typeof DevicesButton> extends true ? DevicesButtonSelector : AreEqual<Component, typeof MicrophoneButton> extends true ? MicrophoneButtonSelector : AreEqual<Component, typeof CameraButton> extends true ? CameraButtonSelector : AreEqual<Component, typeof ScreenShareButton> extends true ? ScreenShareButtonSelector : AreEqual<Component, typeof ParticipantList> extends true ? ParticipantListSelector : AreEqual<Component, typeof ParticipantsButton> extends true ? ParticipantsButtonSelector : AreEqual<Component, typeof EndCallButton> extends true ? EmptySelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : AreEqual<Component, typeof Dialpad> extends true ? EmptySelector : AreEqual<Component, typeof HoldButton> extends true ? HoldButtonSelector : AreEqual<Component, typeof NotificationStack> extends true ? NotificationStackSelector : AreEqual<Component, typeof IncomingCallStack> extends true ? IncomingCallStackSelector : AreEqual<Component, typeof ReactionButton> extends true ? RaiseHandButtonSelector : AreEqual<Component, typeof RaiseHandButton> extends true ? EmptySelector : AreEqual<Component, typeof CaptionsBanner> extends true ? EmptySelector : undefined;
|
56
56
|
/**
|
57
57
|
* Get the selector for a specified component.
|
58
58
|
*
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
import { CameraButton, EndCallButton, ErrorBar, MicrophoneButton, DevicesButton, ParticipantList, ScreenShareButton, VideoGallery } from "../../../react-components/src";
|
3
|
+
import { CameraButton, EndCallButton, ErrorBar, MicrophoneButton, DevicesButton, ParticipantList, ScreenShareButton, VideoGallery, CaptionsBanner } from "../../../react-components/src";
|
4
4
|
import { IncomingCallStack } from "../../../react-components/src";
|
5
5
|
import { NotificationStack } from "../../../react-components/src";
|
6
6
|
import { Dialpad } from "../../../react-components/src";
|
@@ -20,6 +20,7 @@ import { reactionButtonSelector } from '../callControlSelectors';
|
|
20
20
|
import { ReactionButton } from "../../../react-components/src";
|
21
21
|
import { notificationStackSelector } from '../notificationStackSelector';
|
22
22
|
import { incomingCallStackSelector } from '../incomingCallStackSelector';
|
23
|
+
import { captionsBannerSelector } from '../captionsSelector';
|
23
24
|
/**
|
24
25
|
* Primary hook to get all hooks necessary for a calling Component.
|
25
26
|
*
|
@@ -94,6 +95,8 @@ const findSelector = (component) => {
|
|
94
95
|
return holdButtonSelector;
|
95
96
|
case IncomingCallStack:
|
96
97
|
return incomingCallStackSelector;
|
98
|
+
case CaptionsBanner:
|
99
|
+
return captionsBannerSelector;
|
97
100
|
}
|
98
101
|
return undefined;
|
99
102
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usePropsFor.js","sourceRoot":"","sources":["../../../../../../calling-component-bindings/src/hooks/usePropsFor.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,YAAY,EACb,sCAAmC;AACpC,OAAO,EAAE,iBAAiB,EAAE,sCAAmC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,sCAAmC;AAC/D,OAAO,EAAE,OAAO,EAAE,sCAAmC;AAErD,OAAO,EAAE,UAAU,EAAE,sCAAmC;AACxD,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAA2B,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAEL,oBAAoB,EAEpB,wBAAwB,EAExB,qBAAqB,EAErB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAsB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAwB,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAA2B,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAA8B,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,sCAAmC;AAChE,OAAO,EAAoB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,sCAAmC;AAE5D,OAAO,EAAE,yBAAyB,EAA6B,MAAM,8BAA8B,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAA6B,MAAM,8BAA8B,CAAC;AAEpG;;;;;;;;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uBAAuB,CAAC;QACjC,KAAK,cAAc;YACjB,OAAO,sBAAsB,CAAC;QAChC,KAAK,iBAAiB;YACpB,OAAO,yBAAyB,CAAC;QACnC,KAAK,UAAU;YACb,OAAO,kBAAkB,CAAC;QAC5B,KAAK,iBAAiB;YACpB,OAAO,yBAAyB,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AACF;;GAEG;AACH,yGAAyG;AACzG,yBAAyB;AACzB,MAAM;AACN,KAAK","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n CameraButton,\n EndCallButton,\n ErrorBar,\n MicrophoneButton,\n DevicesButton,\n ParticipantList,\n ScreenShareButton,\n VideoGallery\n} from '@internal/react-components';\nimport { IncomingCallStack } from '@internal/react-components';\n\nimport { NotificationStack } from '@internal/react-components';\nimport { Dialpad } from '@internal/react-components';\n\nimport { HoldButton } from '@internal/react-components';\nimport { RaiseHandButton } from '@internal/react-components';\nimport { RaiseHandButtonSelector, raiseHandButtonSelector } from '../callControlSelectors';\nimport {\n CameraButtonSelector,\n cameraButtonSelector,\n MicrophoneButtonSelector,\n microphoneButtonSelector,\n DevicesButtonSelector,\n devicesButtonSelector,\n ScreenShareButtonSelector,\n screenShareButtonSelector\n} from '../callControlSelectors';\nimport { holdButtonSelector, HoldButtonSelector } from '../callControlSelectors';\nimport { VideoGallerySelector, videoGallerySelector } from '../videoGallerySelector';\nimport { ParticipantListSelector, participantListSelector } from '../participantListSelector';\nimport { ParticipantsButtonSelector, participantsButtonSelector } from '../participantsButtonSelector';\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { Common } from '@internal/acs-ui-common';\nimport { AreEqual } from '@internal/acs-ui-common';\nimport { ParticipantsButton } from '@internal/react-components';\nimport { ErrorBarSelector, errorBarSelector } from '../errorBarSelector';\nimport { CommonCallingHandlers } from '../handlers/createCommonHandlers';\nimport { reactionButtonSelector } from '../callControlSelectors';\nimport { ReactionButton } from '@internal/react-components';\nimport { _ComponentCallingHandlers } from '../handlers/createHandlers';\nimport { notificationStackSelector, NotificationStackSelector } from '../notificationStackSelector';\nimport { incomingCallStackSelector, IncomingCallStackSelector } from '../incomingCallStackSelector';\n\n/**\n * Primary hook to get all hooks necessary for a calling Component.\n *\n * Most straightforward usage of calling components looks like:\n *\n * @example\n * ```\n * import { ParticipantList, usePropsFor } from '@azure/communication-react';\n *\n * const App = (): JSX.Element => {\n * // ... code to setup Providers ...\n *\n * return <ParticipantList {...usePropsFor(ParticipantList)}/>\n * }\n * ```\n *\n * @public\n */\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\n component: Component\n): GetSelector<Component> extends (props: any) => any\n ? ReturnType<GetSelector<Component>> &\n Common<CommonCallingHandlers & _ComponentCallingHandlers, Parameters<Component>[0]>\n : undefined => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers<Parameters<Component>[0]>(component);\n if (props !== undefined) {\n return { ...props, ...handlers } as any;\n }\n return undefined as any;\n};\n\n/**\n * A type for trivial selectors that return no data.\n *\n * Used as a default return value if {@link usePropsFor} is called for a component that requires no data.\n *\n * @public\n */\nexport type EmptySelector = () => Record<string, never>;\n\nconst emptySelector: EmptySelector = (): Record<string, never> => ({});\n\n/**\n * Specific type of the selector applicable to a given Component.\n *\n * @public\n */\nexport type GetSelector<Component extends (props: any) => JSX.Element | undefined> =\n AreEqual<Component, typeof VideoGallery> extends true\n ? VideoGallerySelector\n : AreEqual<Component, typeof DevicesButton> extends true\n ? DevicesButtonSelector\n : AreEqual<Component, typeof MicrophoneButton> extends true\n ? MicrophoneButtonSelector\n : AreEqual<Component, typeof CameraButton> extends true\n ? CameraButtonSelector\n : AreEqual<Component, typeof ScreenShareButton> extends true\n ? ScreenShareButtonSelector\n : AreEqual<Component, typeof ParticipantList> extends true\n ? ParticipantListSelector\n : AreEqual<Component, typeof ParticipantsButton> extends true\n ? ParticipantsButtonSelector\n : AreEqual<Component, typeof EndCallButton> extends true\n ? EmptySelector\n : AreEqual<Component, typeof ErrorBar> extends true\n ? ErrorBarSelector\n : AreEqual<Component, typeof Dialpad> extends true\n ? EmptySelector\n : AreEqual<Component, typeof HoldButton> extends true\n ? HoldButtonSelector\n : AreEqual<Component, typeof NotificationStack> extends true\n ? NotificationStackSelector\n : AreEqual<Component, typeof IncomingCallStack> extends true\n ? IncomingCallStackSelector\n : AreEqual<Component, typeof ReactionButton> extends true\n ? RaiseHandButtonSelector\n : AreEqual<Component, typeof RaiseHandButton> extends true\n ? EmptySelector\n : undefined;\n\n/**\n * Get the selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined>(\n component: Component\n): GetSelector<Component> => {\n return findSelector(component);\n};\n\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\n // Dialpad only has handlers currently and doesn't require any props from the stateful layer so return the emptySelector\n if (component === Dialpad) {\n return emptySelector;\n }\n\n switch (component) {\n case VideoGallery:\n return videoGallerySelector;\n case MicrophoneButton:\n return microphoneButtonSelector;\n case CameraButton:\n return cameraButtonSelector;\n case ScreenShareButton:\n return screenShareButtonSelector;\n case DevicesButton:\n return devicesButtonSelector;\n case ParticipantList:\n return participantListSelector;\n case ParticipantsButton:\n return participantsButtonSelector;\n case EndCallButton:\n return emptySelector;\n case ErrorBar:\n return errorBarSelector;\n case RaiseHandButton:\n return raiseHandButtonSelector;\n case ReactionButton:\n return reactionButtonSelector;\n case NotificationStack:\n return notificationStackSelector;\n case HoldButton:\n return holdButtonSelector;\n case IncomingCallStack:\n return incomingCallStackSelector;\n }\n return undefined;\n};\n/**\n * Selector for new components that are conditionally compiled. Comment out when there is no CC'd components\n */\n// const findConditionalCompiledSelector = (component: (props: any) => JSX.Element | undefined): any => {\n// switch (component) {\n// }\n// };\n"]}
|
1
|
+
{"version":3,"file":"usePropsFor.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CAAC;QAC1B,KAAK,eAAe;YAClB,OAAO,uBAAuB,CAAC;QACjC,KAAK,cAAc;YACjB,OAAO,sBAAsB,CAAC;QAChC,KAAK,iBAAiB;YACpB,OAAO,yBAAyB,CAAC;QACnC,KAAK,UAAU;YACb,OAAO,kBAAkB,CAAC;QAC5B,KAAK,iBAAiB;YACpB,OAAO,yBAAyB,CAAC;QACnC,KAAK,cAAc;YACjB,OAAO,sBAAsB,CAAC;IAClC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AACF;;GAEG;AACH,yGAAyG;AACzG,yBAAyB;AACzB,MAAM;AACN,KAAK","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n CameraButton,\n EndCallButton,\n ErrorBar,\n MicrophoneButton,\n DevicesButton,\n ParticipantList,\n ScreenShareButton,\n VideoGallery,\n CaptionsBanner\n} from '@internal/react-components';\nimport { IncomingCallStack } from '@internal/react-components';\n\nimport { NotificationStack } from '@internal/react-components';\nimport { Dialpad } from '@internal/react-components';\n\nimport { HoldButton } from '@internal/react-components';\nimport { RaiseHandButton } from '@internal/react-components';\nimport { RaiseHandButtonSelector, raiseHandButtonSelector } from '../callControlSelectors';\nimport {\n CameraButtonSelector,\n cameraButtonSelector,\n MicrophoneButtonSelector,\n microphoneButtonSelector,\n DevicesButtonSelector,\n devicesButtonSelector,\n ScreenShareButtonSelector,\n screenShareButtonSelector\n} from '../callControlSelectors';\nimport { holdButtonSelector, HoldButtonSelector } from '../callControlSelectors';\nimport { VideoGallerySelector, videoGallerySelector } from '../videoGallerySelector';\nimport { ParticipantListSelector, participantListSelector } from '../participantListSelector';\nimport { ParticipantsButtonSelector, participantsButtonSelector } from '../participantsButtonSelector';\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { Common } from '@internal/acs-ui-common';\nimport { AreEqual } from '@internal/acs-ui-common';\nimport { ParticipantsButton } from '@internal/react-components';\nimport { ErrorBarSelector, errorBarSelector } from '../errorBarSelector';\nimport { CommonCallingHandlers } from '../handlers/createCommonHandlers';\nimport { reactionButtonSelector } from '../callControlSelectors';\nimport { ReactionButton } from '@internal/react-components';\nimport { _ComponentCallingHandlers } from '../handlers/createHandlers';\nimport { notificationStackSelector, NotificationStackSelector } from '../notificationStackSelector';\nimport { incomingCallStackSelector, IncomingCallStackSelector } from '../incomingCallStackSelector';\nimport { captionsBannerSelector } from '../captionsSelector';\n\n/**\n * Primary hook to get all hooks necessary for a calling Component.\n *\n * Most straightforward usage of calling components looks like:\n *\n * @example\n * ```\n * import { ParticipantList, usePropsFor } from '@azure/communication-react';\n *\n * const App = (): JSX.Element => {\n * // ... code to setup Providers ...\n *\n * return <ParticipantList {...usePropsFor(ParticipantList)}/>\n * }\n * ```\n *\n * @public\n */\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\n component: Component\n): GetSelector<Component> extends (props: any) => any\n ? ReturnType<GetSelector<Component>> &\n Common<CommonCallingHandlers & _ComponentCallingHandlers, Parameters<Component>[0]>\n : undefined => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers<Parameters<Component>[0]>(component);\n if (props !== undefined) {\n return { ...props, ...handlers } as any;\n }\n return undefined as any;\n};\n\n/**\n * A type for trivial selectors that return no data.\n *\n * Used as a default return value if {@link usePropsFor} is called for a component that requires no data.\n *\n * @public\n */\nexport type EmptySelector = () => Record<string, never>;\n\nconst emptySelector: EmptySelector = (): Record<string, never> => ({});\n\n/**\n * Specific type of the selector applicable to a given Component.\n *\n * @public\n */\nexport type GetSelector<Component extends (props: any) => JSX.Element | undefined> =\n AreEqual<Component, typeof VideoGallery> extends true\n ? VideoGallerySelector\n : AreEqual<Component, typeof DevicesButton> extends true\n ? DevicesButtonSelector\n : AreEqual<Component, typeof MicrophoneButton> extends true\n ? MicrophoneButtonSelector\n : AreEqual<Component, typeof CameraButton> extends true\n ? CameraButtonSelector\n : AreEqual<Component, typeof ScreenShareButton> extends true\n ? ScreenShareButtonSelector\n : AreEqual<Component, typeof ParticipantList> extends true\n ? ParticipantListSelector\n : AreEqual<Component, typeof ParticipantsButton> extends true\n ? ParticipantsButtonSelector\n : AreEqual<Component, typeof EndCallButton> extends true\n ? EmptySelector\n : AreEqual<Component, typeof ErrorBar> extends true\n ? ErrorBarSelector\n : AreEqual<Component, typeof Dialpad> extends true\n ? EmptySelector\n : AreEqual<Component, typeof HoldButton> extends true\n ? HoldButtonSelector\n : AreEqual<Component, typeof NotificationStack> extends true\n ? NotificationStackSelector\n : AreEqual<Component, typeof IncomingCallStack> extends true\n ? IncomingCallStackSelector\n : AreEqual<Component, typeof ReactionButton> extends true\n ? RaiseHandButtonSelector\n : AreEqual<Component, typeof RaiseHandButton> extends true\n ? EmptySelector\n : AreEqual<Component, typeof CaptionsBanner> extends true\n ? EmptySelector\n : undefined;\n\n/**\n * Get the selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined>(\n component: Component\n): GetSelector<Component> => {\n return findSelector(component);\n};\n\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\n // Dialpad only has handlers currently and doesn't require any props from the stateful layer so return the emptySelector\n if (component === Dialpad) {\n return emptySelector;\n }\n\n switch (component) {\n case VideoGallery:\n return videoGallerySelector;\n case MicrophoneButton:\n return microphoneButtonSelector;\n case CameraButton:\n return cameraButtonSelector;\n case ScreenShareButton:\n return screenShareButtonSelector;\n case DevicesButton:\n return devicesButtonSelector;\n case ParticipantList:\n return participantListSelector;\n case ParticipantsButton:\n return participantsButtonSelector;\n case EndCallButton:\n return emptySelector;\n case ErrorBar:\n return errorBarSelector;\n case RaiseHandButton:\n return raiseHandButtonSelector;\n case ReactionButton:\n return reactionButtonSelector;\n case NotificationStack:\n return notificationStackSelector;\n case HoldButton:\n return holdButtonSelector;\n case IncomingCallStack:\n return incomingCallStackSelector;\n case CaptionsBanner:\n return captionsBannerSelector;\n }\n return undefined;\n};\n/**\n * Selector for new components that are conditionally compiled. Comment out when there is no CC'd components\n */\n// const findConditionalCompiledSelector = (component: (props: any) => JSX.Element | undefined): any => {\n// switch (component) {\n// }\n// };\n"]}
|
@@ -11,8 +11,8 @@ export { notificationStackSelector } from './notificationStackSelector';
|
|
11
11
|
export type { HoldButtonSelector } from './callControlSelectors';
|
12
12
|
export type { IncomingCallStackSelector } from './incomingCallStackSelector';
|
13
13
|
export { incomingCallStackSelector } from './incomingCallStackSelector';
|
14
|
-
export type { _StartCaptionsButtonSelector, _CaptionSettingsSelector,
|
15
|
-
export {
|
14
|
+
export type { _StartCaptionsButtonSelector, _CaptionSettingsSelector, CaptionsBannerSelector } from './captionsSelector';
|
15
|
+
export { captionsBannerSelector, _startCaptionsButtonSelector, _captionSettingsSelector } from './captionsSelector';
|
16
16
|
export type { CallingHandlers, CreateDefaultCallingHandlers } from './handlers/createHandlers';
|
17
17
|
export type { TeamsCallingHandlers } from './handlers/createTeamsCallHandlers';
|
18
18
|
export type { CommonCallingHandlers } from './handlers/createCommonHandlers';
|
@@ -5,7 +5,7 @@ export { createDefaultCallingHandlers } from './handlers/createHandlers';
|
|
5
5
|
export { createDefaultTeamsCallingHandlers } from './handlers/createTeamsCallHandlers';
|
6
6
|
export { notificationStackSelector } from './notificationStackSelector';
|
7
7
|
export { incomingCallStackSelector } from './incomingCallStackSelector';
|
8
|
-
export {
|
8
|
+
export { captionsBannerSelector, _startCaptionsButtonSelector, _captionSettingsSelector } from './captionsSelector';
|
9
9
|
export { useTeamsCall, useTeamsCallAgent } from './providers';
|
10
10
|
export { CallAgentProvider, CallClientProvider, CallProvider, useCall, useCallAgent, useCallClient, useDeviceManager } from './providers';
|
11
11
|
export { usePropsFor as useCallingPropsFor, getSelector as getCallingSelector } from './hooks/usePropsFor';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../calling-component-bindings/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AAQvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAQxE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../calling-component-bindings/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AAQvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAQxE,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAepH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG3G,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,EACL,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mCAAmC,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport type { CallingBaseSelectorProps } from './baseSelectors';\nexport * from './callControlSelectors';\nexport { createDefaultCallingHandlers } from './handlers/createHandlers';\n\nexport { createDefaultTeamsCallingHandlers } from './handlers/createTeamsCallHandlers';\nexport type { ParticipantListSelector } from './participantListSelector';\nexport type { ParticipantsButtonSelector } from './participantsButtonSelector';\nexport type { VideoGallerySelector } from './videoGallerySelector';\nexport type { ErrorBarSelector } from './errorBarSelector';\n\nexport type { NotificationStackSelector } from './notificationStackSelector';\n\nexport { notificationStackSelector } from './notificationStackSelector';\nexport type { HoldButtonSelector } from './callControlSelectors';\nexport type { IncomingCallStackSelector } from './incomingCallStackSelector';\nexport { incomingCallStackSelector } from './incomingCallStackSelector';\n\nexport type {\n _StartCaptionsButtonSelector,\n _CaptionSettingsSelector,\n CaptionsBannerSelector\n} from './captionsSelector';\n\nexport { captionsBannerSelector, _startCaptionsButtonSelector, _captionSettingsSelector } from './captionsSelector';\n\nexport type { CallingHandlers, CreateDefaultCallingHandlers } from './handlers/createHandlers';\n\nexport type { TeamsCallingHandlers } from './handlers/createTeamsCallHandlers';\nexport type { CommonCallingHandlers } from './handlers/createCommonHandlers';\nexport type { CaptionsOptions } from './handlers/createCommonHandlers';\n\nexport type {\n DeepNoiseSuppressionEffectDependency,\n VideoBackgroundEffectsDependency\n} from './handlers/createCommonHandlers';\n\nexport type { _ComponentCallingHandlers, CallingHandlersOptions } from './handlers/createHandlers';\n\nexport { useTeamsCall, useTeamsCallAgent } from './providers';\n\nexport {\n CallAgentProvider,\n CallClientProvider,\n CallProvider,\n useCall,\n useCallAgent,\n useCallClient,\n useDeviceManager\n} from './providers';\nexport type { CallAgentProviderProps, CallClientProviderProps, CallProviderProps } from './providers';\n\nexport { usePropsFor as useCallingPropsFor, getSelector as getCallingSelector } from './hooks/usePropsFor';\nexport type { GetSelector as GetCallingSelector, EmptySelector } from './hooks/usePropsFor';\n\nexport { useSelector as useCallingSelector } from './hooks/useSelector';\nexport { useHandlers as useCallingHandlers } from './hooks/useHandlers';\n\nexport {\n _isInCall,\n _isPreviewOn,\n _isInLobbyOrConnecting,\n _updateUserDisplayNames,\n _getEnvironmentInfo\n} from './utils/callUtils';\n\nexport { _videoGalleryRemoteParticipantsMemo, _dominantSpeakersWithFlatId } from './utils/videoGalleryUtils';\nexport type { _VideoGalleryRemoteParticipantsMemoFn } from './utils/videoGalleryUtils';\n"]}
|
@@ -44,7 +44,7 @@ export const createDefaultChatHandlers = memoizeOne((chatClient, chatThreadClien
|
|
44
44
|
options.attachments[0] &&
|
45
45
|
!options.attachments[0].attachmentType;
|
46
46
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
47
|
-
const hasImages =
|
47
|
+
const hasImages = imageAttachments && imageAttachments.length > 0;
|
48
48
|
/* @conditional-compile-remove(file-sharing-acs) */
|
49
49
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
50
50
|
if (
|
@@ -53,10 +53,10 @@ export const createDefaultChatHandlers = memoizeOne((chatClient, chatThreadClien
|
|
53
53
|
const chatSDKOptions = {
|
54
54
|
metadata: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.metadata), {
|
55
55
|
/* @conditional-compile-remove(file-sharing-acs) */
|
56
|
-
fileSharingMetadata: JSON.stringify(options.attachments) }),
|
56
|
+
fileSharingMetadata: JSON.stringify(options === null || options === void 0 ? void 0 : options.attachments) }),
|
57
57
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
58
58
|
attachments: imageAttachments,
|
59
|
-
type: options.type
|
59
|
+
type: options === null || options === void 0 ? void 0 : options.type
|
60
60
|
};
|
61
61
|
yield chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);
|
62
62
|
return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createHandlers.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/handlers/createHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,OAAO,EAAU,+BAA+B,EAAE,mCAAgC;AAMlF,gEAAgE;AAChE,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AAEjG,OAAO,UAAU,MAAM,aAAa,CAAC;AAmCrC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CACjD,CAAC,UAA8B,EAAE,gBAAkC,EAAgB,EAAE;IACnF,IAAI,eAAe,GAAwD,SAAS,CAAC;IACrF,IAAI,mBAAmB,GAAmE,SAAS,CAAC;IACpG,OAAO;QACL,0DAA0D;QAC1D,0DAA0D;QAC1D,aAAa,EAAE,UACb,OAAe,EACf,OAAiG;;gBAEjG,MAAM,kBAAkB,GAAG;oBACzB,OAAO;oBACP,iBAAiB,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,WAAW;iBACrD,CAAC;gBAEF,gEAAgE;gBAChE,MAAM,gBAAgB,GAAiC,kCAAkC,CAAC,OAAO,CAAC,CAAC;gBAEnG,mDAAmD;gBACnD,MAAM,cAAc,GAClB,OAAO;oBACP,aAAa,IAAI,OAAO;oBACxB,OAAO,CAAC,WAAW;oBACnB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;oBACtB,CAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAoB,CAAC,cAAc,CAAC;gBAC7D,gEAAgE;gBAChE,MAAM,SAAS,GAAG,OAAO,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;gBAE7E,mDAAmD;gBACnD,gEAAgE;gBAChE;gBACE,mDAAmD,CAAC,cAAc;oBAClE,gEAAgE,CAAC,SAAS,EAC1E,CAAC;oBACD,MAAM,cAAc,GAAuB;wBACzC,QAAQ,kCACH,OAAO,aAAP,OAAO,uBAA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AAgB,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachment } from '@azure/communication-chat';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { UploadChatImageResult } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { getImageAttachmentsFromHTMLContent } from '../utils/getImageAttachmentsFromHTMLContent';\nimport { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Object containing all the handlers required for chat components.\n *\n * Chat related components from this package are able to pick out relevant handlers from this object.\n * See {@link useHandlers} and {@link usePropsFor}.\n *\n * @public\n */\nexport type ChatHandlers = {\n onSendMessage: (\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ) => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadImage: (image: Blob, imageFilename: string) => Promise<UploadChatImageResult>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onDeleteImage: (imageId: string) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onRemoveParticipant: (userId: string) => Promise<void>;\n updateThreadTopicName: (topicName: string) => Promise<void>;\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\n onUpdateMessage: (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n onDeleteMessage: (messageId: string) => Promise<void>;\n};\n\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne(\n (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n let readReceiptIterator: PagedAsyncIterableIterator<ChatMessageReadReceipt> | undefined = undefined;\n return {\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onSendMessage: async function (\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ) {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const imageAttachments: ChatAttachment[] | undefined = getImageAttachmentsFromHTMLContent(content);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasAttachments =\n options &&\n 'attachments' in options &&\n options.attachments &&\n options.attachments[0] &&\n !(options.attachments[0] as ChatAttachment).attachmentType;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const hasImages = options && imageAttachments && imageAttachments.length > 0;\n\n /* @conditional-compile-remove(file-sharing-acs) */\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (\n /* @conditional-compile-remove(file-sharing-acs) */ hasAttachments ||\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ hasImages\n ) {\n const chatSDKOptions: SendMessageOptions = {\n metadata: {\n ...options?.metadata,\n /* @conditional-compile-remove(file-sharing-acs) */\n fileSharingMetadata: JSON.stringify(options.attachments)\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n attachments: imageAttachments,\n type: options.type\n };\n await chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);\n return;\n }\n\n await chatThreadClient.sendMessage(sendMessageRequest, options as SendMessageOptions);\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadImage: async function (image: Blob, imageFilename: string): Promise<UploadChatImageResult> {\n const imageResult = await chatThreadClient.uploadImage(image, imageFilename);\n return imageResult;\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onDeleteImage: async function (imageId: string): Promise<void> {\n try {\n await chatThreadClient.deleteImage(imageId);\n } catch (e) {\n console.log(`Error deleting image message: ${e}`);\n }\n return;\n },\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onUpdateMessage: async function (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const imageAttachments: ChatAttachment[] | undefined = getImageAttachmentsFromHTMLContent(content);\n\n const updateMessageOptions = {\n content,\n /* @conditional-compile-remove(file-sharing-acs) */\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n attachments: imageAttachments\n };\n await chatThreadClient.updateMessage(messageId, updateMessageOptions);\n },\n onDeleteMessage: async (messageId: string) => {\n await chatThreadClient.deleteMessage(messageId);\n },\n // This handler is designed for chatThread to consume\n onMessageSeen: async (chatMessageId: string) => {\n await chatThreadClient.sendReadReceipt({ chatMessageId });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onRemoveParticipant: async (userId: string) => {\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n },\n updateThreadTopicName: async (topicName: string) => {\n await chatThreadClient.updateTopic(topicName);\n },\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({ maxPageSize: 50 });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message?.value?.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n\n if (message.value?.type && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = await readReceiptIterator.next();\n while (!readReceipt.done && parseInt(readReceipt?.value?.chatMessageId) >= earliestTime) {\n readReceipt = await readReceiptIterator.next();\n }\n\n return isAllChatMessagesLoaded;\n }\n };\n }\n);\n\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = <Props>(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient,\n _: (props: Props) => ReactElement | null\n): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};\n"]}
|
1
|
+
{"version":3,"file":"createHandlers.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/handlers/createHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,OAAO,EAAU,+BAA+B,EAAE,mCAAgC;AAMlF,gEAAgE;AAChE,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AAEjG,OAAO,UAAU,MAAM,aAAa,CAAC;AAmCrC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CACjD,CAAC,UAA8B,EAAE,gBAAkC,EAAgB,EAAE;IACnF,IAAI,eAAe,GAAwD,SAAS,CAAC;IACrF,IAAI,mBAAmB,GAAmE,SAAS,CAAC;IACpG,OAAO;QACL,0DAA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AO,CAAC,KAAK,0CAAE,IAAI,KAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBACzD,sBAAsB,EAAE,CAAC;gBAC3B,CAAC;gBAED,gDAAgD;gBAChD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;oBACjB,uBAAuB,GAAG,IAAI,CAAC;oBAC/B,MAAM;gBACR,CAAC;YACH,CAAC;YACD,6EAA6E;YAC7E,IAAI,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACnD,OAAO,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,0CAAE,aAAa,CAAC,IAAI,YAAY,EAAE,CAAC;gBACxF,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjD,CAAC;YAED,OAAO,uBAAuB,CAAC;QACjC,CAAC,CAAA;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,UAA8B,EAC9B,gBAAkC,EAClC,CAAwC,EACX,EAAE;IAC/B,OAAO,yBAAyB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachment } from '@azure/communication-chat';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { UploadChatImageResult } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { getImageAttachmentsFromHTMLContent } from '../utils/getImageAttachmentsFromHTMLContent';\nimport { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Object containing all the handlers required for chat components.\n *\n * Chat related components from this package are able to pick out relevant handlers from this object.\n * See {@link useHandlers} and {@link usePropsFor}.\n *\n * @public\n */\nexport type ChatHandlers = {\n onSendMessage: (\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ) => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadImage: (image: Blob, imageFilename: string) => Promise<UploadChatImageResult>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onDeleteImage: (imageId: string) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onRemoveParticipant: (userId: string) => Promise<void>;\n updateThreadTopicName: (topicName: string) => Promise<void>;\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\n onUpdateMessage: (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n onDeleteMessage: (messageId: string) => Promise<void>;\n};\n\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne(\n (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n let readReceiptIterator: PagedAsyncIterableIterator<ChatMessageReadReceipt> | undefined = undefined;\n return {\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onSendMessage: async function (\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ) {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const imageAttachments: ChatAttachment[] | undefined = getImageAttachmentsFromHTMLContent(content);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasAttachments =\n options &&\n 'attachments' in options &&\n options.attachments &&\n options.attachments[0] &&\n !(options.attachments[0] as ChatAttachment).attachmentType;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const hasImages = imageAttachments && imageAttachments.length > 0;\n\n /* @conditional-compile-remove(file-sharing-acs) */\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (\n /* @conditional-compile-remove(file-sharing-acs) */ hasAttachments ||\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ hasImages\n ) {\n const chatSDKOptions: SendMessageOptions = {\n metadata: {\n ...options?.metadata,\n /* @conditional-compile-remove(file-sharing-acs) */\n fileSharingMetadata: JSON.stringify(options?.attachments)\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n attachments: imageAttachments,\n type: options?.type\n };\n await chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);\n return;\n }\n\n await chatThreadClient.sendMessage(sendMessageRequest, options as SendMessageOptions);\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadImage: async function (image: Blob, imageFilename: string): Promise<UploadChatImageResult> {\n const imageResult = await chatThreadClient.uploadImage(image, imageFilename);\n return imageResult;\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onDeleteImage: async function (imageId: string): Promise<void> {\n try {\n await chatThreadClient.deleteImage(imageId);\n } catch (e) {\n console.log(`Error deleting image message: ${e}`);\n }\n return;\n },\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onUpdateMessage: async function (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const imageAttachments: ChatAttachment[] | undefined = getImageAttachmentsFromHTMLContent(content);\n\n const updateMessageOptions = {\n content,\n /* @conditional-compile-remove(file-sharing-acs) */\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n attachments: imageAttachments\n };\n await chatThreadClient.updateMessage(messageId, updateMessageOptions);\n },\n onDeleteMessage: async (messageId: string) => {\n await chatThreadClient.deleteMessage(messageId);\n },\n // This handler is designed for chatThread to consume\n onMessageSeen: async (chatMessageId: string) => {\n await chatThreadClient.sendReadReceipt({ chatMessageId });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onRemoveParticipant: async (userId: string) => {\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n },\n updateThreadTopicName: async (topicName: string) => {\n await chatThreadClient.updateTopic(topicName);\n },\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({ maxPageSize: 50 });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message?.value?.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n\n if (message.value?.type && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = await readReceiptIterator.next();\n while (!readReceipt.done && parseInt(readReceipt?.value?.chatMessageId) >= earliestTime) {\n readReceipt = await readReceiptIterator.next();\n }\n\n return isAllChatMessagesLoaded;\n }\n };\n }\n);\n\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = <Props>(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient,\n _: (props: Props) => ReactElement | null\n): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};\n"]}
|
@@ -126,7 +126,7 @@ const generateImageAttachmentImgHtml = (message, attachment) => {
|
|
126
126
|
const src = getResourceSourceUrl(resourceCache);
|
127
127
|
// if in error state
|
128
128
|
if (src === undefined) {
|
129
|
-
return `\r\n<p>${getBrokenImageViewNode()}</p>`;
|
129
|
+
return `\r\n<p>${getBrokenImageViewNode().outerHTML}</p>`;
|
130
130
|
}
|
131
131
|
// else in loading or success state
|
132
132
|
return `\r\n<p><img alt="image" src="${src}" itemscope="${contentType}" id="${attachment.id}"></p>`;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"messageThreadSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/messageThreadSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAEL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,YAAY,EAAE,gCAAgC;AAWvD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,uDAAuD;AACvD,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAMhF,MAAM,6BAA6B,GAAG,YAAY,CAChD,CACE,IAAY,EACZ,WAAkC,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O,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,mBAAmB,MAAI,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,0CAAE,MAAM,CAAA,EAAE,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,uDAAuD;IACvD,IAAI,CAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,MAAM,MAAK,gBAAgB,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,MAAK,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,+BAA+B,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n ChatBaseSelectorProps,\n getChatMessages,\n getIsLargeGroup,\n getLatestReadTime,\n getParticipants,\n getReadReceipts,\n getUserId\n} from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatClientState, ChatMessageWithStatus, ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport {\n ChatMessage,\n Message,\n CommunicationParticipant,\n SystemMessage,\n MessageContentType,\n ReadReceiptsBySenderId\n} from '@internal/react-components';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '@internal/react-components';\nimport { createSelector } from 'reselect';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';\nimport { ACSKnownMessageType } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatAttachment } from '@azure/communication-chat';\nimport type { ChatParticipant } from '@azure/communication-chat';\nimport { ChatAttachmentType } from '@internal/react-components';\n\nconst memoizedAllConvertChatMessage = memoizeFnAll(\n (\n _key: string,\n chatMessage: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n ): Message => {\n const messageType = chatMessage.type.toLowerCase();\n /* @conditional-compile-remove(data-loss-prevention) */\n if (chatMessage.policyViolation?.result === 'contentBlocked') {\n return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);\n }\n if (\n messageType === ACSKnownMessageType.text ||\n messageType === ACSKnownMessageType.richtextHtml ||\n messageType === ACSKnownMessageType.html\n ) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n }\n);\n\nconst extractAttachmentMetadata = (metadata: Record<string, string>): AttachmentMetadata[] => {\n const attachmentMetadata = metadata.fileSharingMetadata;\n if (!attachmentMetadata) {\n return [];\n }\n try {\n return JSON.parse(attachmentMetadata);\n } catch (e) {\n console.error(e);\n return [];\n }\n};\n\nconst extractTeamsAttachmentsMetadata = (\n rawAttachments: ChatAttachment[]\n): {\n attachments: AttachmentMetadata[];\n} => {\n const attachments: AttachmentMetadata[] = [];\n rawAttachments.forEach((rawAttachment) => {\n const attachmentType = rawAttachment.attachmentType as ChatAttachmentType;\n if (attachmentType === 'file') {\n attachments.push({\n id: rawAttachment.id,\n name: rawAttachment.name ?? '',\n url: extractAttachmentUrl(rawAttachment)\n });\n }\n });\n return {\n attachments\n };\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\nconst convertToUiBlockedMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): BlockedMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n return {\n messageType: 'blocked',\n createdOn: message.createdOn,\n warningText: undefined,\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL\n };\n};\n\nconst extractAttachmentUrl = (attachment: ChatAttachment): string => {\n return attachment.previewUrl ? attachment.previewUrl : attachment.url || '';\n};\n\nconst processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {\n let content = message.content?.message;\n if (\n message.content?.attachments &&\n message.content?.attachments.length > 0 &&\n sanitizedMessageContentType(message.type).includes('html')\n ) {\n const attachments: ChatAttachment[] = message.content?.attachments;\n // Fill in the src here\n if (content) {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach((img) => {\n const attachmentPreviewUrl = attachments.find((attachment) => attachment.id === img.id)?.previewUrl;\n if (attachmentPreviewUrl) {\n const resourceCache = message.resourceCache?.[attachmentPreviewUrl];\n const src = getResourceSourceUrl(resourceCache);\n // if in error state\n if (src === undefined) {\n const brokenImageView = getBrokenImageViewNode(img);\n img.parentElement?.replaceChild(brokenImageView, img);\n } else {\n // else in loading or success state\n img.setAttribute('src', src);\n }\n setImageWidthAndHeight(img);\n }\n });\n content = document.body.innerHTML;\n }\n\n const teamsImageHtmlContent = attachments\n .filter(\n (attachment) =>\n attachment.attachmentType === 'image' &&\n attachment.previewUrl !== undefined &&\n !message.content?.message?.includes(attachment.id)\n )\n .map((attachment) => generateImageAttachmentImgHtml(message, attachment))\n .join('');\n if (teamsImageHtmlContent) {\n return (content ?? '') + teamsImageHtmlContent;\n }\n }\n return content;\n};\n\nconst generateImageAttachmentImgHtml = (message: ChatMessageWithStatus, attachment: ChatAttachment): string => {\n if (attachment.previewUrl !== undefined) {\n const contentType = extractAttachmentContentTypeFromName(attachment.name);\n const resourceCache = message.resourceCache?.[attachment.previewUrl];\n const src = getResourceSourceUrl(resourceCache);\n // if in error state\n if (src === undefined) {\n return `\\r\\n<p>${getBrokenImageViewNode()}</p>`;\n }\n // else in loading or success state\n return `\\r\\n<p><img alt=\"image\" src=\"${src}\" itemscope=\"${contentType}\" id=\"${attachment.id}\"></p>`;\n }\n\n return '';\n};\n\nconst getResourceSourceUrl = (result?: ResourceFetchResult): string | undefined => {\n if (result) {\n if (!result.error && result.sourceUrl) {\n // return sourceUrl for success state\n return result.sourceUrl;\n } else {\n // return undefined for error state\n return undefined;\n }\n }\n // return empty string for loading state\n return '';\n};\n\nconst extractAttachmentContentTypeFromName = (name?: string): string => {\n if (name === undefined) {\n return '';\n }\n const indexOfLastDot = name.lastIndexOf('.');\n if (indexOfLastDot === undefined || indexOfLastDot < 0) {\n return '';\n }\n const contentType = name.substring(indexOfLastDot + 1);\n return contentType;\n};\n\nconst setImageWidthAndHeight = (img?: HTMLImageElement): void => {\n if (img) {\n // define aspect ratio explicitly to prevent image not being displayed correctly\n // in safari, this includes image placeholder for loading state\n const width = img.width;\n const height = img.height;\n img.style.aspectRatio = `${width}/${height}`;\n }\n};\n\nconst extractAttachmentsMetadata = (message: ChatMessageWithStatus): { attachments?: AttachmentMetadata[] } => {\n let attachments: AttachmentMetadata[] = [];\n if (message.metadata) {\n attachments = attachments.concat(extractAttachmentMetadata(message.metadata));\n }\n if (message.content?.attachments) {\n const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);\n attachments = attachments.concat(teamsAttachments.attachments);\n }\n return { attachments: attachments.length > 0 ? attachments : undefined };\n};\n\nconst convertToUiChatMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): ChatMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n const { attachments } = extractAttachmentsMetadata(message);\n return {\n messageType: 'chat',\n createdOn: message.createdOn,\n content: processChatMessageContent(message),\n contentType: sanitizedMessageContentType(message.type),\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n clientMessageId: message.clientMessageId,\n editedOn: message.editedOn,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n metadata: message.metadata,\n attachments\n };\n};\n\nconst convertToUiSystemMessage = (message: ChatMessageWithStatus): SystemMessage => {\n const systemMessageType = message.type;\n if (systemMessageType === 'participantAdded' || systemMessageType === 'participantRemoved') {\n return {\n messageType: 'system',\n systemMessageType,\n createdOn: message.createdOn,\n participants:\n message.content?.participants\n // TODO: In our moderator logic, we use undefined name as our displayName for moderator, which should be filtered out\n // Once we have a better solution to identify the moderator, remove this line\n ?.filter((participant: ChatParticipant) => participant.displayName && participant.displayName !== '')\n .map(\n (participant: ChatParticipant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })\n ) ?? [],\n messageId: message.id,\n iconName: systemMessageType === 'participantAdded' ? 'PeopleAdd' : 'PeopleBlock'\n };\n } else {\n // Only topic updated type left, according to ACSKnown type\n return {\n messageType: 'system',\n systemMessageType: 'topicUpdated',\n createdOn: message.createdOn,\n topic: message.content?.topic ?? '',\n messageId: message.id,\n iconName: 'Edit'\n };\n }\n};\n\n/**\n * Selector type for {@link MessageThread} component.\n *\n * @public\n */\nexport type MessageThreadSelector = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\n userId: string;\n showMessageStatus: boolean;\n messages: Message[];\n};\n\n/** Returns `true` if the message has participants and at least one participant has a display name. */\nconst hasValidParticipant = (chatMessage: ChatMessageWithStatus): boolean =>\n !!chatMessage.content?.participants && chatMessage.content.participants.some((p: ChatParticipant) => !!p.displayName);\n\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread: () => MessageThreadSelector = () =>\n createSelector(\n [getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants],\n (userId, chatMessages, latestReadTime, isLargeGroup, readReceipts = [], participants) => {\n // We can't get displayName in teams meeting interop for now, disable rr feature when it is teams interop\n const isTeamsInterop = Object.values(participants).find((p) => 'microsoftTeamsUserId' in p.id) !== undefined;\n\n // get number of participants\n // filter out the non valid participants (no display name)\n // Read Receipt details will be disabled when participant count is 0\n const participantCount = isTeamsInterop\n ? undefined\n : Object.values(participants).filter((p) => p.displayName && p.displayName !== '').length;\n\n // creating key value pairs of senderID: last read message information\n\n const readReceiptsBySenderId: ReadReceiptsBySenderId = {};\n\n // readReceiptsBySenderId[senderID] gets updated every time a new message is read by this sender\n // in this way we can make sure that we are only saving the latest read message id and read on time for each sender\n readReceipts\n .filter((r) => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId)\n .forEach((r) => {\n readReceiptsBySenderId[toFlatCommunicationIdentifier(r.sender)] = {\n lastReadMessage: r.chatMessageId,\n displayName: participants[toFlatCommunicationIdentifier(r.sender)]?.displayName ?? ''\n };\n });\n\n // A function takes parameter above and generate return value\n const convertedMessages = memoizedAllConvertChatMessage((memoizedFn) =>\n Object.values(chatMessages)\n .filter(\n (message) =>\n message.type.toLowerCase() === ACSKnownMessageType.text ||\n message.type.toLowerCase() === ACSKnownMessageType.richtextHtml ||\n message.type.toLowerCase() === ACSKnownMessageType.html ||\n (message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message)) ||\n (message.type === ACSKnownMessageType.participantRemoved && hasValidParticipant(message)) ||\n // TODO: Add support for topicUpdated system messages in MessageThread component.\n // message.type === ACSKnownMessageType.topicUpdated ||\n message.clientMessageId !== undefined\n )\n .filter(isMessageValidToRender)\n .map((message) => {\n return memoizedFn(\n message.id ?? message.clientMessageId,\n message,\n userId,\n message.createdOn <= latestReadTime,\n isLargeGroup\n );\n })\n );\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n }\n );\nconst sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html'\n ? lowerCaseType\n : 'unknown';\n};\n\nconst getBrokenImageViewNode = (img?: HTMLDivElement): HTMLDivElement => {\n const wrapper = document.createElement('div');\n Array.from(img?.attributes ?? []).forEach((attr) => {\n wrapper.setAttribute(attr.nodeName, attr.nodeValue ?? '');\n });\n wrapper.setAttribute('class', 'broken-image-wrapper');\n wrapper.setAttribute('data-ui-id', 'broken-image-icon');\n return wrapper;\n};\n\nconst isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {\n if (message.deletedOn) {\n return false;\n }\n if (message.metadata?.fileSharingMetadata || message.content?.attachments?.length) {\n return true;\n }\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.policyViolation?.result === 'contentBlocked') {\n return true;\n }\n return !!(message.content && message.content?.message !== '');\n};\n\n/**\n * Selector for {@link MessageThread} component.\n *\n * @public\n */\nexport const messageThreadSelector: MessageThreadSelector = messageThreadSelectorWithThread();\n"]}
|
1
|
+
{"version":3,"file":"messageThreadSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/messageThreadSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAEL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,YAAY,EAAE,gCAAgC;AAWvD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,uDAAuD;AACvD,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAMhF,MAAM,6BAA6B,GAAG,YAAY,CAChD,CACE,IAAY,EACZ,WAAkC,EAClC,MAAc,EACd,MAAe,EACf,YAAqB,EACZ,EAAE;;IACX,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,WAA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AI,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,0CAAE,MAAM,CAAA,EAAE,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,uDAAuD;IACvD,IAAI,CAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,MAAM,MAAK,gBAAgB,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,MAAK,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,+BAA+B,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n ChatBaseSelectorProps,\n getChatMessages,\n getIsLargeGroup,\n getLatestReadTime,\n getParticipants,\n getReadReceipts,\n getUserId\n} from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatClientState, ChatMessageWithStatus, ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport {\n ChatMessage,\n Message,\n CommunicationParticipant,\n SystemMessage,\n MessageContentType,\n ReadReceiptsBySenderId\n} from '@internal/react-components';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '@internal/react-components';\nimport { createSelector } from 'reselect';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';\nimport { ACSKnownMessageType } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatAttachment } from '@azure/communication-chat';\nimport type { ChatParticipant } from '@azure/communication-chat';\nimport { ChatAttachmentType } from '@internal/react-components';\n\nconst memoizedAllConvertChatMessage = memoizeFnAll(\n (\n _key: string,\n chatMessage: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n ): Message => {\n const messageType = chatMessage.type.toLowerCase();\n /* @conditional-compile-remove(data-loss-prevention) */\n if (chatMessage.policyViolation?.result === 'contentBlocked') {\n return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);\n }\n if (\n messageType === ACSKnownMessageType.text ||\n messageType === ACSKnownMessageType.richtextHtml ||\n messageType === ACSKnownMessageType.html\n ) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n }\n);\n\nconst extractAttachmentMetadata = (metadata: Record<string, string>): AttachmentMetadata[] => {\n const attachmentMetadata = metadata.fileSharingMetadata;\n if (!attachmentMetadata) {\n return [];\n }\n try {\n return JSON.parse(attachmentMetadata);\n } catch (e) {\n console.error(e);\n return [];\n }\n};\n\nconst extractTeamsAttachmentsMetadata = (\n rawAttachments: ChatAttachment[]\n): {\n attachments: AttachmentMetadata[];\n} => {\n const attachments: AttachmentMetadata[] = [];\n rawAttachments.forEach((rawAttachment) => {\n const attachmentType = rawAttachment.attachmentType as ChatAttachmentType;\n if (attachmentType === 'file') {\n attachments.push({\n id: rawAttachment.id,\n name: rawAttachment.name ?? '',\n url: extractAttachmentUrl(rawAttachment)\n });\n }\n });\n return {\n attachments\n };\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\nconst convertToUiBlockedMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): BlockedMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n return {\n messageType: 'blocked',\n createdOn: message.createdOn,\n warningText: undefined,\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL\n };\n};\n\nconst extractAttachmentUrl = (attachment: ChatAttachment): string => {\n return attachment.previewUrl ? attachment.previewUrl : attachment.url || '';\n};\n\nconst processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {\n let content = message.content?.message;\n if (\n message.content?.attachments &&\n message.content?.attachments.length > 0 &&\n sanitizedMessageContentType(message.type).includes('html')\n ) {\n const attachments: ChatAttachment[] = message.content?.attachments;\n // Fill in the src here\n if (content) {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach((img) => {\n const attachmentPreviewUrl = attachments.find((attachment) => attachment.id === img.id)?.previewUrl;\n if (attachmentPreviewUrl) {\n const resourceCache = message.resourceCache?.[attachmentPreviewUrl];\n const src = getResourceSourceUrl(resourceCache);\n // if in error state\n if (src === undefined) {\n const brokenImageView = getBrokenImageViewNode(img);\n img.parentElement?.replaceChild(brokenImageView, img);\n } else {\n // else in loading or success state\n img.setAttribute('src', src);\n }\n setImageWidthAndHeight(img);\n }\n });\n content = document.body.innerHTML;\n }\n\n const teamsImageHtmlContent = attachments\n .filter(\n (attachment) =>\n attachment.attachmentType === 'image' &&\n attachment.previewUrl !== undefined &&\n !message.content?.message?.includes(attachment.id)\n )\n .map((attachment) => generateImageAttachmentImgHtml(message, attachment))\n .join('');\n if (teamsImageHtmlContent) {\n return (content ?? '') + teamsImageHtmlContent;\n }\n }\n return content;\n};\n\nconst generateImageAttachmentImgHtml = (message: ChatMessageWithStatus, attachment: ChatAttachment): string => {\n if (attachment.previewUrl !== undefined) {\n const contentType = extractAttachmentContentTypeFromName(attachment.name);\n const resourceCache = message.resourceCache?.[attachment.previewUrl];\n const src = getResourceSourceUrl(resourceCache);\n // if in error state\n if (src === undefined) {\n return `\\r\\n<p>${getBrokenImageViewNode().outerHTML}</p>`;\n }\n // else in loading or success state\n return `\\r\\n<p><img alt=\"image\" src=\"${src}\" itemscope=\"${contentType}\" id=\"${attachment.id}\"></p>`;\n }\n\n return '';\n};\n\nconst getResourceSourceUrl = (result?: ResourceFetchResult): string | undefined => {\n if (result) {\n if (!result.error && result.sourceUrl) {\n // return sourceUrl for success state\n return result.sourceUrl;\n } else {\n // return undefined for error state\n return undefined;\n }\n }\n // return empty string for loading state\n return '';\n};\n\nconst extractAttachmentContentTypeFromName = (name?: string): string => {\n if (name === undefined) {\n return '';\n }\n const indexOfLastDot = name.lastIndexOf('.');\n if (indexOfLastDot === undefined || indexOfLastDot < 0) {\n return '';\n }\n const contentType = name.substring(indexOfLastDot + 1);\n return contentType;\n};\n\nconst setImageWidthAndHeight = (img?: HTMLImageElement): void => {\n if (img) {\n // define aspect ratio explicitly to prevent image not being displayed correctly\n // in safari, this includes image placeholder for loading state\n const width = img.width;\n const height = img.height;\n img.style.aspectRatio = `${width}/${height}`;\n }\n};\n\nconst extractAttachmentsMetadata = (message: ChatMessageWithStatus): { attachments?: AttachmentMetadata[] } => {\n let attachments: AttachmentMetadata[] = [];\n if (message.metadata) {\n attachments = attachments.concat(extractAttachmentMetadata(message.metadata));\n }\n if (message.content?.attachments) {\n const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);\n attachments = attachments.concat(teamsAttachments.attachments);\n }\n return { attachments: attachments.length > 0 ? attachments : undefined };\n};\n\nconst convertToUiChatMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): ChatMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n const { attachments } = extractAttachmentsMetadata(message);\n return {\n messageType: 'chat',\n createdOn: message.createdOn,\n content: processChatMessageContent(message),\n contentType: sanitizedMessageContentType(message.type),\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n clientMessageId: message.clientMessageId,\n editedOn: message.editedOn,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n metadata: message.metadata,\n attachments\n };\n};\n\nconst convertToUiSystemMessage = (message: ChatMessageWithStatus): SystemMessage => {\n const systemMessageType = message.type;\n if (systemMessageType === 'participantAdded' || systemMessageType === 'participantRemoved') {\n return {\n messageType: 'system',\n systemMessageType,\n createdOn: message.createdOn,\n participants:\n message.content?.participants\n // TODO: In our moderator logic, we use undefined name as our displayName for moderator, which should be filtered out\n // Once we have a better solution to identify the moderator, remove this line\n ?.filter((participant: ChatParticipant) => participant.displayName && participant.displayName !== '')\n .map(\n (participant: ChatParticipant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })\n ) ?? [],\n messageId: message.id,\n iconName: systemMessageType === 'participantAdded' ? 'PeopleAdd' : 'PeopleBlock'\n };\n } else {\n // Only topic updated type left, according to ACSKnown type\n return {\n messageType: 'system',\n systemMessageType: 'topicUpdated',\n createdOn: message.createdOn,\n topic: message.content?.topic ?? '',\n messageId: message.id,\n iconName: 'Edit'\n };\n }\n};\n\n/**\n * Selector type for {@link MessageThread} component.\n *\n * @public\n */\nexport type MessageThreadSelector = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\n userId: string;\n showMessageStatus: boolean;\n messages: Message[];\n};\n\n/** Returns `true` if the message has participants and at least one participant has a display name. */\nconst hasValidParticipant = (chatMessage: ChatMessageWithStatus): boolean =>\n !!chatMessage.content?.participants && chatMessage.content.participants.some((p: ChatParticipant) => !!p.displayName);\n\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread: () => MessageThreadSelector = () =>\n createSelector(\n [getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants],\n (userId, chatMessages, latestReadTime, isLargeGroup, readReceipts = [], participants) => {\n // We can't get displayName in teams meeting interop for now, disable rr feature when it is teams interop\n const isTeamsInterop = Object.values(participants).find((p) => 'microsoftTeamsUserId' in p.id) !== undefined;\n\n // get number of participants\n // filter out the non valid participants (no display name)\n // Read Receipt details will be disabled when participant count is 0\n const participantCount = isTeamsInterop\n ? undefined\n : Object.values(participants).filter((p) => p.displayName && p.displayName !== '').length;\n\n // creating key value pairs of senderID: last read message information\n\n const readReceiptsBySenderId: ReadReceiptsBySenderId = {};\n\n // readReceiptsBySenderId[senderID] gets updated every time a new message is read by this sender\n // in this way we can make sure that we are only saving the latest read message id and read on time for each sender\n readReceipts\n .filter((r) => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId)\n .forEach((r) => {\n readReceiptsBySenderId[toFlatCommunicationIdentifier(r.sender)] = {\n lastReadMessage: r.chatMessageId,\n displayName: participants[toFlatCommunicationIdentifier(r.sender)]?.displayName ?? ''\n };\n });\n\n // A function takes parameter above and generate return value\n const convertedMessages = memoizedAllConvertChatMessage((memoizedFn) =>\n Object.values(chatMessages)\n .filter(\n (message) =>\n message.type.toLowerCase() === ACSKnownMessageType.text ||\n message.type.toLowerCase() === ACSKnownMessageType.richtextHtml ||\n message.type.toLowerCase() === ACSKnownMessageType.html ||\n (message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message)) ||\n (message.type === ACSKnownMessageType.participantRemoved && hasValidParticipant(message)) ||\n // TODO: Add support for topicUpdated system messages in MessageThread component.\n // message.type === ACSKnownMessageType.topicUpdated ||\n message.clientMessageId !== undefined\n )\n .filter(isMessageValidToRender)\n .map((message) => {\n return memoizedFn(\n message.id ?? message.clientMessageId,\n message,\n userId,\n message.createdOn <= latestReadTime,\n isLargeGroup\n );\n })\n );\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n }\n );\nconst sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html'\n ? lowerCaseType\n : 'unknown';\n};\n\nconst getBrokenImageViewNode = (img?: HTMLDivElement): HTMLDivElement => {\n const wrapper = document.createElement('div');\n Array.from(img?.attributes ?? []).forEach((attr) => {\n wrapper.setAttribute(attr.nodeName, attr.nodeValue ?? '');\n });\n wrapper.setAttribute('class', 'broken-image-wrapper');\n wrapper.setAttribute('data-ui-id', 'broken-image-icon');\n return wrapper;\n};\n\nconst isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {\n if (message.deletedOn) {\n return false;\n }\n if (message.metadata?.fileSharingMetadata || message.content?.attachments?.length) {\n return true;\n }\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.policyViolation?.result === 'contentBlocked') {\n return true;\n }\n return !!(message.content && message.content?.message !== '');\n};\n\n/**\n * Selector for {@link MessageThread} component.\n *\n * @public\n */\nexport const messageThreadSelector: MessageThreadSelector = messageThreadSelectorWithThread();\n"]}
|
@@ -4,12 +4,6 @@
|
|
4
4
|
* @private
|
5
5
|
*/
|
6
6
|
export const compareMessages = (firstMessage, secondMessage) => {
|
7
|
-
if (firstMessage.createdOn === undefined) {
|
8
|
-
return 1;
|
9
|
-
}
|
10
|
-
if (secondMessage.createdOn === undefined) {
|
11
|
-
return -1;
|
12
|
-
}
|
13
7
|
const firstDate = new Date(firstMessage.createdOn).getTime();
|
14
8
|
const secondDate = new Date(secondMessage.createdOn).getTime();
|
15
9
|
// Workaround to get a stable order of message before we can get sequenceId from chat service.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"compareMessages.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/utils/compareMessages.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAAqB,EAAE,aAAsB,EAAU,EAAE;IACvF,
|
1
|
+
{"version":3,"file":"compareMessages.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/utils/compareMessages.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAAqB,EAAE,aAAsB,EAAU,EAAE;IACvF,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IAC7D,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IAC/D,8FAA8F;IAC9F,+FAA+F;IAC/F,MAAM,OAAO,GACX,YAAY,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS;QAC/C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC;QACpF,CAAC,CAAC,CAAC,CAAC;IACR,OAAO,SAAS,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,GAAG,UAAU,CAAC;AACzE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Message } from '@internal/react-components';\n\n/**\n * @private\n */\nexport const compareMessages = (firstMessage: Message, secondMessage: Message): number => {\n const firstDate = new Date(firstMessage.createdOn).getTime();\n const secondDate = new Date(secondMessage.createdOn).getTime();\n // Workaround to get a stable order of message before we can get sequenceId from chat service.\n // MessageIds are generated by time order the message persist, a good candidate other than time\n const idDelta =\n firstMessage.messageId && secondMessage.messageId\n ? Number.parseInt(firstMessage.messageId) - Number.parseInt(secondMessage.messageId)\n : 0;\n return firstDate - secondDate === 0 ? idDelta : firstDate - secondDate;\n};\n"]}
|
package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.js
CHANGED
@@ -8,7 +8,7 @@ export const getImageAttachmentsFromHTMLContent = (content) => {
|
|
8
8
|
let imageAttachments;
|
9
9
|
// get image attachments from content,
|
10
10
|
// for the editing scenario, this includes the ones before editing and the newly added ones during editing.
|
11
|
-
const document = new DOMParser().parseFromString(content
|
11
|
+
const document = new DOMParser().parseFromString(content, 'text/html');
|
12
12
|
document.querySelectorAll('img').forEach((img) => {
|
13
13
|
if (imageAttachments === undefined) {
|
14
14
|
imageAttachments = [];
|
package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getImageAttachmentsFromHTMLContent.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,gEAAgE;AAChE;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,OAAe,EAAgC,EAAE;IAClG,IAAI,gBAA8C,CAAC;IACnD,sCAAsC;IACtC,2GAA2G;IAC3G,MAAM,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,OAAO,
|
1
|
+
{"version":3,"file":"getImageAttachmentsFromHTMLContent.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,gEAAgE;AAChE;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,OAAe,EAAgC,EAAE;IAClG,IAAI,gBAA8C,CAAC;IACnD,sCAAsC;IACtC,2GAA2G;IAC3G,MAAM,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACvE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/C,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACnC,gBAAgB,GAAG,EAAE,CAAC;QACxB,CAAC;QACD,gBAAgB,CAAC,IAAI,CAAC;YACpB,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,cAAc,EAAE,OAAO;SACxB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { ChatAttachment } from '@azure/communication-chat';\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @private\n */\nexport const getImageAttachmentsFromHTMLContent = (content: string): ChatAttachment[] | undefined => {\n let imageAttachments: ChatAttachment[] | undefined;\n // get image attachments from content,\n // for the editing scenario, this includes the ones before editing and the newly added ones during editing.\n const document = new DOMParser().parseFromString(content, 'text/html');\n document.querySelectorAll('img').forEach((img) => {\n if (imageAttachments === undefined) {\n imageAttachments = [];\n }\n imageAttachments.push({\n id: img.id,\n attachmentType: 'image'\n });\n });\n return imageAttachments;\n};\n"]}
|
@@ -103,4 +103,6 @@ export { RTTDisclosureBanner } from '../../react-components/src';
|
|
103
103
|
export type { RealTimeTextProps, RealTimeTextStrings } from '../../react-components/src/components/RealTimeText';
|
104
104
|
export { RealTimeText } from '../../react-components/src/components/RealTimeText';
|
105
105
|
export type { MediaAccess } from '../../react-components/src';
|
106
|
+
export type { CaptionsBannerProps, CaptionsInformation, CaptionsBannerStrings } from '../../react-components/src/components/CaptionsBanner';
|
107
|
+
export { CaptionsBanner } from '../../react-components/src/components/CaptionsBanner';
|
106
108
|
//# sourceMappingURL=index.d.ts.map
|
@@ -52,4 +52,5 @@ export { RTTModal } from '../../react-components/src';
|
|
52
52
|
export { RTTDisclosureBanner } from '../../react-components/src';
|
53
53
|
/* @conditional-compile-remove(rtt) */
|
54
54
|
export { RealTimeText } from '../../react-components/src/components/RealTimeText';
|
55
|
+
export { CaptionsBanner } from '../../react-components/src/components/CaptionsBanner';
|
55
56
|
//# sourceMappingURL=index.js.map
|