@azure/communication-react 1.28.0-alpha-202506060018 → 1.28.0-alpha-202506070019

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/dist/communication-react.d.ts +4 -0
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-Bw7J3RuW.js → ChatMessageComponentAsRichTextEditBox-BLQjFCiz.js} +2 -2
  3. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-Bw7J3RuW.js.map → ChatMessageComponentAsRichTextEditBox-BLQjFCiz.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-B8Z4lRZE.js → RichTextSendBoxWrapper-DKX9Hw77.js} +2 -2
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-B8Z4lRZE.js.map → RichTextSendBoxWrapper-DKX9Hw77.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-DAvfOWzU.js → index-B1nXGt3n.js} +56 -7
  7. package/dist/dist-cjs/communication-react/index-B1nXGt3n.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  11. package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js +2 -1
  12. package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js.map +1 -1
  13. package/dist/dist-esm/react-components/src/components/CaptionsBanner.d.ts +4 -0
  14. package/dist/dist-esm/react-components/src/components/CaptionsBanner.js +36 -1
  15. package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
  16. package/dist/dist-esm/react-components/src/components/styles/Captions.style.d.ts +4 -0
  17. package/dist/dist-esm/react-components/src/components/styles/Captions.style.js +13 -0
  18. package/dist/dist-esm/react-components/src/components/styles/Captions.style.js.map +1 -1
  19. package/package.json +1 -1
  20. package/dist/dist-cjs/communication-react/index-DAvfOWzU.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DAvfOWzU.js');
3
+ var index = require('./index-B1nXGt3n.js');
4
4
  require('react');
5
5
  require('@fluentui/react');
6
6
  require('@fluentui/react-components');
@@ -2,5 +2,5 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT License.
4
4
  // GENERATED FILE. DO NOT EDIT MANUALLY.
5
- module.exports = '1.28.0-alpha-202506060018';
5
+ module.exports = '1.28.0-alpha-202506070019';
6
6
  //# sourceMappingURL=telemetryVersion.js.map
@@ -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.28.0-alpha-202506060018';\n"]}
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.28.0-alpha-202506070019';\n"]}
@@ -69,7 +69,8 @@ export const captionsBannerSelector = reselect.createSelector([
69
69
  displayName: finalDisplayName !== null && finalDisplayName !== void 0 ? finalDisplayName : 'Unnamed Participant',
70
70
  captionText: c.captionText,
71
71
  userId,
72
- createdTimeStamp: c.timestamp
72
+ createdTimeStamp: c.timestamp,
73
+ isFinalized: c.resultType === 'Final'
73
74
  };
74
75
  });
75
76
  const completedRealTimeTexts = (_a = realTimeTexts === null || realTimeTexts === void 0 ? void 0 : realTimeTexts.completedMessages) === null || _a === void 0 ? void 0 : _a.filter((rtt) => rtt.message !== '').map((rtt) => {
@@ -1 +1 @@
1
- {"version":3,"file":"captionsSelector.js","sourceRoot":"","sources":["../../../../../calling-component-bindings/src/captionsSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAEL,cAAc,EACd,aAAa,EACb,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACzE,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;AAGxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAepE;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAgC,QAAQ,CAAC,cAAc,CAC7F,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,uBAAuB,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\n// Licensed under the MIT License.\n\nimport { CallClientState, CaptionsInfo } from '@internal/calling-stateful-client';\nimport { RealTimeTextInfo, RemoteParticipantState } from '@internal/calling-stateful-client';\nimport {\n CallingBaseSelectorProps,\n getDisplayName,\n getIdentifier,\n getStartCaptionsInProgress,\n getSupportedCaptionLanguages\n} from './baseSelectors';\nimport { allRemoteParticipantsSelector } from './remoteParticipantsSelector';\nimport { getRealTimeTextStatus, getRealTimeText } 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';\nimport { RealTimeTextInformation } from '@internal/react-components';\nimport { getRemoteParticipantDisplayName } from './utils/callUtils';\n\n/**\n * Selector type for the {@link StartCaptionsButton} component.\n * @public\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 * @public\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 * @public\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 * @public\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 realTimeTexts: {\n completedMessages?: RealTimeTextInformation[];\n currentInProgress?: RealTimeTextInformation[];\n myInProgress?: RealTimeTextInformation;\n };\n isCaptionsOn: boolean;\n startCaptionsInProgress: boolean;\n isRealTimeTextOn: boolean;\n latestLocalRealTimeText: RealTimeTextInformation;\n};\n\n/**\n * Selector for {@link CaptionsBanner} component.\n *\n * @public\n */\nexport const captionsBannerSelector: CaptionsBannerSelector = reselect.createSelector(\n [\n getCaptions,\n getRealTimeText,\n getCaptionsStatus,\n getRealTimeTextStatus,\n getStartCaptionsInProgress,\n allRemoteParticipantsSelector,\n getDisplayName,\n getIdentifier\n ],\n (\n captions,\n realTimeTexts,\n isCaptionsFeatureActive,\n isRealTimeTextActive,\n startCaptionsInProgress,\n allRemoteParticipants,\n displayName,\n identifier\n ) => {\n const captionsInfo = captions?.map((c, index) => {\n const userId = getCaptionsSpeakerIdentifier(c);\n let finalDisplayName;\n if (userId === identifier) {\n finalDisplayName = displayName;\n } else {\n finalDisplayName = getRemoteParticipantDisplayName(userId, allRemoteParticipants);\n }\n\n return {\n id: (finalDisplayName ?? 'Unnamed Participant') + index,\n displayName: finalDisplayName ?? 'Unnamed Participant',\n captionText: c.captionText,\n userId,\n createdTimeStamp: c.timestamp\n };\n });\n\n const completedRealTimeTexts = realTimeTexts?.completedMessages\n ?.filter((rtt) => rtt.message !== '')\n .map((rtt) => {\n const userId = getRealTimeTextSpeakerIdentifier(rtt);\n return {\n id: rtt.sequenceId,\n displayName: getRealTimeTextDisplayName(rtt, identifier, allRemoteParticipants, displayName, userId),\n message: rtt.message,\n userId,\n isTyping: rtt.resultType === 'Partial',\n isMe: rtt.isMe,\n finalizedTimeStamp: rtt.updatedTimestamp\n };\n });\n\n const inProgressRealTimeTexts = realTimeTexts?.currentInProgress\n ?.filter((rtt) => rtt.message !== '')\n .map((rtt) => {\n const userId = getRealTimeTextSpeakerIdentifier(rtt);\n return {\n id: rtt.sequenceId,\n displayName: getRealTimeTextDisplayName(rtt, identifier, allRemoteParticipants, displayName, userId),\n message: rtt.message,\n userId,\n isTyping: rtt.resultType === 'Partial',\n isMe: rtt.isMe,\n finalizedTimeStamp: rtt.updatedTimestamp\n };\n });\n\n const myInProgress =\n realTimeTexts?.myInProgress && realTimeTexts.myInProgress.message !== ''\n ? {\n id: realTimeTexts.myInProgress.sequenceId,\n displayName: displayName,\n message: realTimeTexts.myInProgress.message,\n userId: identifier,\n isTyping: realTimeTexts.myInProgress.resultType === 'Partial',\n isMe: true,\n finalizedTimeStamp: realTimeTexts.myInProgress.updatedTimestamp\n }\n : undefined;\n\n // find the last final local real time text caption if myInProgress is not available\n let latestLocalRealTimeText;\n\n if (!myInProgress) {\n latestLocalRealTimeText =\n realTimeTexts &&\n realTimeTexts.completedMessages &&\n realTimeTexts.completedMessages\n .slice()\n .reverse()\n .find((rtt) => rtt.isMe);\n }\n\n return {\n captions: captionsInfo ?? [],\n\n realTimeTexts: {\n completedMessages: completedRealTimeTexts as RealTimeTextInformation[],\n currentInProgress: inProgressRealTimeTexts as RealTimeTextInformation[],\n myInProgress: myInProgress as RealTimeTextInformation\n },\n isCaptionsOn: isCaptionsFeatureActive ?? false,\n startCaptionsInProgress: startCaptionsInProgress ?? false,\n\n isRealTimeTextOn: isRealTimeTextActive ?? false,\n\n latestLocalRealTimeText: (myInProgress ?? latestLocalRealTimeText) as RealTimeTextInformation\n };\n }\n);\n\nconst getCaptionsSpeakerIdentifier = (captions: CaptionsInfo): string => {\n return captions.speaker.identifier ? toFlatCommunicationIdentifier(captions.speaker.identifier) : '';\n};\n\nconst getRealTimeTextSpeakerIdentifier = (realTimeText: RealTimeTextInfo): string => {\n return realTimeText.sender.identifier ? toFlatCommunicationIdentifier(realTimeText.sender.identifier) : '';\n};\n\nconst getRealTimeTextDisplayName = (\n realTimeText: RealTimeTextInfo,\n identifier: string,\n allRemoteParticipants:\n | {\n [keys: string]: RemoteParticipantState;\n }\n | undefined,\n displayName: string | undefined,\n userId: string\n): string => {\n let finalDisplayName;\n if (userId === identifier) {\n finalDisplayName = displayName;\n } else {\n finalDisplayName = getRemoteParticipantDisplayName(userId, allRemoteParticipants);\n }\n return finalDisplayName ?? 'Unnamed Participant';\n};\n"]}
1
+ {"version":3,"file":"captionsSelector.js","sourceRoot":"","sources":["../../../../../calling-component-bindings/src/captionsSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAEL,cAAc,EACd,aAAa,EACb,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,iBAAiB,CAAC;AAC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AAC,CAAC,EAAE,CAAC;AACvG,CAAC,CAAC;AAEF,MAAM,gCAAgC,GAAG,CAAC,YAA8B,EAAU,EAAE;IAClF,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,6BAA6B,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7G,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CACjC,YAA8B,EAC9B,UAAkB,EAClB,qBAIa,EACb,WAA+B,EAC/B,MAAc,EACN,EAAE;IACV,IAAI,gBAAgB,CAAC;IACrB,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;QAC1B,gBAAgB,GAAG,WAAW,CAAC;IACjC,CAAC;SAAM,CAAC;QACN,gBAAgB,GAAG,+BAA+B,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,qBAAqB,CAAC;AACnD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CallClientState, CaptionsInfo } from '@internal/calling-stateful-client';\nimport { RealTimeTextInfo, RemoteParticipantState } from '@internal/calling-stateful-client';\nimport {\n CallingBaseSelectorProps,\n getDisplayName,\n getIdentifier,\n getStartCaptionsInProgress,\n getSupportedCaptionLanguages\n} from './baseSelectors';\nimport { allRemoteParticipantsSelector } from './remoteParticipantsSelector';\nimport { getRealTimeTextStatus, getRealTimeText } 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';\nimport { RealTimeTextInformation } from '@internal/react-components';\nimport { getRemoteParticipantDisplayName } from './utils/callUtils';\n\n/**\n * Selector type for the {@link StartCaptionsButton} component.\n * @public\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 * @public\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 * @public\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 * @public\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 realTimeTexts: {\n completedMessages?: RealTimeTextInformation[];\n currentInProgress?: RealTimeTextInformation[];\n myInProgress?: RealTimeTextInformation;\n };\n isCaptionsOn: boolean;\n startCaptionsInProgress: boolean;\n isRealTimeTextOn: boolean;\n latestLocalRealTimeText: RealTimeTextInformation;\n};\n\n/**\n * Selector for {@link CaptionsBanner} component.\n *\n * @public\n */\nexport const captionsBannerSelector: CaptionsBannerSelector = reselect.createSelector(\n [\n getCaptions,\n getRealTimeText,\n getCaptionsStatus,\n getRealTimeTextStatus,\n getStartCaptionsInProgress,\n allRemoteParticipantsSelector,\n getDisplayName,\n getIdentifier\n ],\n (\n captions,\n realTimeTexts,\n isCaptionsFeatureActive,\n isRealTimeTextActive,\n startCaptionsInProgress,\n allRemoteParticipants,\n displayName,\n identifier\n ) => {\n const captionsInfo = captions?.map((c, index) => {\n const userId = getCaptionsSpeakerIdentifier(c);\n let finalDisplayName;\n if (userId === identifier) {\n finalDisplayName = displayName;\n } else {\n finalDisplayName = getRemoteParticipantDisplayName(userId, allRemoteParticipants);\n }\n\n return {\n id: (finalDisplayName ?? 'Unnamed Participant') + index,\n displayName: finalDisplayName ?? 'Unnamed Participant',\n captionText: c.captionText,\n userId,\n createdTimeStamp: c.timestamp,\n isFinalized: c.resultType === 'Final'\n };\n });\n\n const completedRealTimeTexts = realTimeTexts?.completedMessages\n ?.filter((rtt) => rtt.message !== '')\n .map((rtt) => {\n const userId = getRealTimeTextSpeakerIdentifier(rtt);\n return {\n id: rtt.sequenceId,\n displayName: getRealTimeTextDisplayName(rtt, identifier, allRemoteParticipants, displayName, userId),\n message: rtt.message,\n userId,\n isTyping: rtt.resultType === 'Partial',\n isMe: rtt.isMe,\n finalizedTimeStamp: rtt.updatedTimestamp\n };\n });\n\n const inProgressRealTimeTexts = realTimeTexts?.currentInProgress\n ?.filter((rtt) => rtt.message !== '')\n .map((rtt) => {\n const userId = getRealTimeTextSpeakerIdentifier(rtt);\n return {\n id: rtt.sequenceId,\n displayName: getRealTimeTextDisplayName(rtt, identifier, allRemoteParticipants, displayName, userId),\n message: rtt.message,\n userId,\n isTyping: rtt.resultType === 'Partial',\n isMe: rtt.isMe,\n finalizedTimeStamp: rtt.updatedTimestamp\n };\n });\n\n const myInProgress =\n realTimeTexts?.myInProgress && realTimeTexts.myInProgress.message !== ''\n ? {\n id: realTimeTexts.myInProgress.sequenceId,\n displayName: displayName,\n message: realTimeTexts.myInProgress.message,\n userId: identifier,\n isTyping: realTimeTexts.myInProgress.resultType === 'Partial',\n isMe: true,\n finalizedTimeStamp: realTimeTexts.myInProgress.updatedTimestamp\n }\n : undefined;\n\n // find the last final local real time text caption if myInProgress is not available\n let latestLocalRealTimeText;\n\n if (!myInProgress) {\n latestLocalRealTimeText =\n realTimeTexts &&\n realTimeTexts.completedMessages &&\n realTimeTexts.completedMessages\n .slice()\n .reverse()\n .find((rtt) => rtt.isMe);\n }\n\n return {\n captions: captionsInfo ?? [],\n realTimeTexts: {\n completedMessages: completedRealTimeTexts as RealTimeTextInformation[],\n currentInProgress: inProgressRealTimeTexts as RealTimeTextInformation[],\n myInProgress: myInProgress as RealTimeTextInformation\n },\n isCaptionsOn: isCaptionsFeatureActive ?? false,\n startCaptionsInProgress: startCaptionsInProgress ?? false,\n isRealTimeTextOn: isRealTimeTextActive ?? false,\n latestLocalRealTimeText: (myInProgress ?? latestLocalRealTimeText) as RealTimeTextInformation\n };\n }\n);\n\nconst getCaptionsSpeakerIdentifier = (captions: CaptionsInfo): string => {\n return captions.speaker.identifier ? toFlatCommunicationIdentifier(captions.speaker.identifier) : '';\n};\n\nconst getRealTimeTextSpeakerIdentifier = (realTimeText: RealTimeTextInfo): string => {\n return realTimeText.sender.identifier ? toFlatCommunicationIdentifier(realTimeText.sender.identifier) : '';\n};\n\nconst getRealTimeTextDisplayName = (\n realTimeText: RealTimeTextInfo,\n identifier: string,\n allRemoteParticipants:\n | {\n [keys: string]: RemoteParticipantState;\n }\n | undefined,\n displayName: string | undefined,\n userId: string\n): string => {\n let finalDisplayName;\n if (userId === identifier) {\n finalDisplayName = displayName;\n } else {\n finalDisplayName = getRemoteParticipantDisplayName(userId, allRemoteParticipants);\n }\n return finalDisplayName ?? 'Unnamed Participant';\n};\n"]}
@@ -27,6 +27,10 @@ export type CaptionsInformation = {
27
27
  * If you are using both captions and real time text, please ensure that the createdTimeStamp is populated
28
28
  */
29
29
  createdTimeStamp?: Date;
30
+ /**
31
+ * If caption is finalized
32
+ */
33
+ isFinalized?: boolean;
30
34
  };
31
35
  /**
32
36
  * @public
@@ -5,7 +5,7 @@ import { TextField } from '@fluentui/react';
5
5
  import React, { useEffect, useRef, useState, useCallback } from 'react';
6
6
  import { useMemo } from 'react';
7
7
  import { _Caption } from './Caption';
8
- import { captionContainerClassName, captionsBannerClassName, captionsBannerFullHeightClassName, captionsContainerClassName, loadingBannerFullHeightStyles, loadingBannerStyles } from './styles/Captions.style';
8
+ import { captionContainerClassName, captionsBannerClassName, captionsBannerFullHeightClassName, captionsContainerClassName, hiddenAnnouncementClassName, loadingBannerFullHeightStyles, loadingBannerStyles } from './styles/Captions.style';
9
9
  import { rttDisclosureBannerClassName } from './styles/Captions.style';
10
10
  import { useLocale } from '../localization';
11
11
  import { RealTimeText } from './RealTimeText';
@@ -28,6 +28,10 @@ export const CaptionsBanner = (props) => {
28
28
  const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState(true);
29
29
  const theme = useTheme();
30
30
  const [expandBannerHeight, setExpandBannerHeight] = useState(false);
31
+ const [announcedRTT, setAnnouncedRTT] = useState([]);
32
+ const [announcedCaption, setAnnouncedCaption] = useState([]);
33
+ const [captionAnnouncementText, setCaptionAnnouncementText] = useState([]);
34
+ const [rttAnnouncementText, setRTTAnnouncementText] = useState([]);
31
35
  const getTitle = () => {
32
36
  var _a, _b, _c;
33
37
  if (isCaptionsOn && isRealTimeTextOn) {
@@ -84,6 +88,24 @@ export const CaptionsBanner = (props) => {
84
88
  setTextFieldValue('');
85
89
  }
86
90
  }, [latestLocalRealTimeText]);
91
+ useEffect(() => {
92
+ if (realTimeTexts === null || realTimeTexts === void 0 ? void 0 : realTimeTexts.completedMessages) {
93
+ //filter out the messages that have already been announced
94
+ const rTTMessagesToAnnounce = realTimeTexts.completedMessages.filter((message) => !announcedRTT.includes(message.id));
95
+ if (rTTMessagesToAnnounce.length > 0) {
96
+ setRTTAnnouncementText(rTTMessagesToAnnounce);
97
+ setAnnouncedRTT((prev) => [...prev, ...rTTMessagesToAnnounce.map((message) => message.id)]);
98
+ }
99
+ }
100
+ if (captions.length > 0) {
101
+ // filter out the captions that have already been announced
102
+ const captionsToAnnounce = captions.filter((caption) => !announcedCaption.includes(caption.id) && caption.isFinalized);
103
+ if (captionsToAnnounce.length > 0) {
104
+ setCaptionAnnouncementText(captionsToAnnounce);
105
+ setAnnouncedCaption((prev) => [...prev, ...captionsToAnnounce.map((caption) => caption.id)]);
106
+ }
107
+ }
108
+ }, [captions, realTimeTexts === null || realTimeTexts === void 0 ? void 0 : realTimeTexts.completedMessages, announcedRTT, announcedCaption]);
87
109
  const handleKeyDown = (event) => {
88
110
  if (event.key === 'Enter') {
89
111
  event.preventDefault();
@@ -111,6 +133,19 @@ export const CaptionsBanner = (props) => {
111
133
  })));
112
134
  };
113
135
  return (React.createElement(React.Fragment, null, (startCaptionsInProgress || isCaptionsOn || isRealTimeTextOn) && (React.createElement(FocusZone, { shouldFocusOnMount: true, className: captionsContainerClassName, "data-ui-id": "captions-banner" },
136
+ (rttAnnouncementText.length > 0 || (captionAnnouncementText === null || captionAnnouncementText === void 0 ? void 0 : captionAnnouncementText.length) > 0) && (React.createElement("div", { "aria-live": "assertive", role: "alert", "aria-atomic": "true", className: hiddenAnnouncementClassName },
137
+ React.createElement("span", null, rttAnnouncementText.map((text) => (React.createElement("span", null,
138
+ strings.realTimeTextBannerTitle,
139
+ " ",
140
+ text.displayName,
141
+ ": ",
142
+ text.message)))),
143
+ React.createElement("span", null, captionAnnouncementText.map((text) => (React.createElement("span", null,
144
+ strings.captionsOnlyContainerTitle,
145
+ " ",
146
+ text.displayName,
147
+ ": ",
148
+ text.captionText)))))),
114
149
  (isCaptionsOn || isRealTimeTextOn) && formFactor === 'compact' && (React.createElement(Stack, { horizontal: true, horizontalAlign: "space-between", verticalAlign: "center", className: bannerTitleContainerClassName },
115
150
  React.createElement(Text, { className: titleClassName }, getTitle()),
116
151
  React.createElement(IconButton, { "data-ui-id": "captions-banner-expand-icon", iconProps: { iconName: expandBannerHeight ? 'MinimizeIcon' : 'ExpandIcon' }, ariaLabel: expandBannerHeight ? strings.minimizeButtonAriaLabel : strings.expandButtonAriaLabel, onClick: () => setExpandBannerHeight(!expandBannerHeight), styles: expandIconClassName(theme) }))),
@@ -1 +1 @@
1
- {"version":3,"file":"CaptionsBanner.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/CaptionsBanner.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,iCAAiC,EACjC,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAA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CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE;gBACxB,iBAAiB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;gBAClC,kBAAkB,CAAC,QAAQ,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;YAC5C,CAAC,EACD,SAAS,EAAE,IAAI,EACf,YAAY,EAAE,cAAc,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC,SAAS,GAC/F,CACH;QACA,CAAC,YAAY,IAAI,CAAC,gBAAgB,IAAI,CACrC,oBAAC,KAAK,IACJ,aAAa,EAAC,QAAQ,EACtB,MAAM,EACJ,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,MAAK,MAAM;gBAChC,CAAC,CAAC,6BAA6B,CAAC,KAAK,CAAC;gBACtC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,uBAElB,IAAI;YAEvB,oBAAC,OAAO,IAAC,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,yBAAyB,EAAE,QAAQ,EAAC,WAAW,EAAC,aAAa,EAAC,OAAO,GAAG,CAC3F,CACT,CACS,CACb,CACA,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { Stack, FocusZone, Spinner, useTheme } from '@fluentui/react';\nimport { TextField } from '@fluentui/react';\nimport React, { useEffect, useRef, useState, useCallback } from 'react';\nimport { useMemo } from 'react';\nimport { _Caption } from './Caption';\nimport {\n captionContainerClassName,\n captionsBannerClassName,\n captionsBannerFullHeightClassName,\n captionsContainerClassName,\n loadingBannerFullHeightStyles,\n loadingBannerStyles\n} from './styles/Captions.style';\nimport { rttDisclosureBannerClassName } from './styles/Captions.style';\nimport { OnRenderAvatarCallback } from '../types';\nimport { useLocale } from '../localization';\nimport { RealTimeText } from './RealTimeText';\nimport { _RTTDisclosureBanner } from './RTTDisclosureBanner';\nimport { sortCaptionsAndRealTimeTexts } from './utils/sortCaptionsAndRealTimeTexts';\nimport {\n expandIconClassName,\n bannerTitleContainerClassName,\n realTimeTextInputBoxStyles\n} from './styles/Captions.style';\nimport { titleClassName } from './styles/CaptionsSettingsModal.styles';\nimport { Text, IconButton } from '@fluentui/react';\n\n/**\n * @public\n * information required for each line of caption\n */\nexport type CaptionsInformation = {\n /**\n * unique id for each caption\n */\n id: string;\n /**\n * speaker's display name\n */\n displayName: string;\n /**\n * content of the caption\n */\n captionText: string;\n /**\n * id of the speaker\n */\n userId?: string;\n /**\n * timestamp when the caption was created\n * Please note that this value is essential for determining the order of captions and real time text messages\n * If you are using both captions and real time text, please ensure that the createdTimeStamp is populated\n */\n createdTimeStamp?: Date;\n};\n\n/**\n * @public\n * information required for each line of real time text\n */\nexport type RealTimeTextInformation = {\n /**\n * The id of the real time text.\n */\n id: number;\n /**\n * sender's display name\n */\n displayName: string;\n /**\n * id of the sender\n */\n userId?: string;\n /**\n * The real time text message.\n */\n message: string;\n /**\n * if the real time text received is partial\n */\n isTyping: boolean;\n /**\n * timestamp when the real time text was finalized\n */\n finalizedTimeStamp: Date;\n /**\n * If message originated from the local participant\n * default value is false\n */\n isMe?: boolean;\n};\n/**\n * @public\n * strings for captions banner\n */\nexport interface CaptionsBannerStrings {\n /**\n * Spinner text for captions banner\n */\n captionsBannerSpinnerText?: string;\n\n /**\n * Default text for RTT input text box\n */\n realTimeTextInputBoxDefaultText?: string;\n\n /**\n * Error message for RTT input text box when the size exceeds the limit 2000\n */\n realTimeTextInputErrorMessage?: string;\n\n /**\n * Real time text disclosure banner title\n */\n realTimeTextBannerTitle?: string;\n\n /**\n * Real time text disclosure banner content\n */\n realTimeTextBannerContent?: string;\n\n /**\n * Real time text disclosure banner link label\n */\n realTimeTextBannerLinkLabel?: string;\n\n /**\n * Title for the container when only captions is enabled\n */\n captionsOnlyContainerTitle?: string;\n /**\n * Title for the container when only real time text is enabled\n */\n realTimeTextOnlyContainerTitle?: string;\n /**\n * Title for the container when both captions and real time text is enabled\n */\n captionsAndRealTimeTextContainerTitle?: string;\n /**\n * Expand button aria label\n */\n expandButtonAriaLabel?: string;\n /**\n * Minimize button aria label\n */\n minimizeButtonAriaLabel?: string;\n}\n\n/**\n * @public\n * CaptionsBanner Component Props.\n */\nexport interface CaptionsBannerProps {\n /**\n * Array of captions to be displayed\n */\n captions: CaptionsInformation[];\n /**\n * Array of finalized and partial real time text messages\n */\n realTimeTexts?: {\n completedMessages?: RealTimeTextInformation[];\n currentInProgress?: RealTimeTextInformation[];\n myInProgress?: RealTimeTextInformation;\n };\n /**\n * Flag to indicate if captions are on\n */\n isCaptionsOn?: boolean;\n\n /**\n * Flag to indicate if real time text is on\n */\n isRealTimeTextOn?: boolean;\n /**\n * Flag to indicate if captions are being started\n * This is used to show spinner while captions are being started\n */\n startCaptionsInProgress?: boolean;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n /**\n * Optional strings for the component\n */\n strings?: CaptionsBannerStrings;\n /**\n * Optional form factor for the component.\n * @defaultValue 'default'\n */\n formFactor?: 'default' | 'compact';\n /**\n * Optional options for the component.\n */\n captionsOptions?: {\n height: 'full' | 'default';\n };\n\n /**\n * Optional callback to send real time text.\n */\n onSendRealTimeText?: (text: string, isFinalized: boolean) => Promise<void>;\n\n /**\n * Latest local real time text\n */\n latestLocalRealTimeText?: RealTimeTextInformation;\n}\n\nconst SCROLL_OFFSET_ALLOWANCE = 20;\n\n/**\n * @public\n * A component for displaying a CaptionsBanner with user icon, displayName and captions text.\n */\nexport const CaptionsBanner = (props: CaptionsBannerProps): JSX.Element => {\n const {\n captions,\n realTimeTexts,\n isCaptionsOn,\n startCaptionsInProgress,\n onRenderAvatar,\n formFactor = 'default',\n captionsOptions,\n isRealTimeTextOn,\n onSendRealTimeText,\n latestLocalRealTimeText\n } = props;\n const localeStrings = useLocale().strings.captionsBanner;\n const strings = { ...localeStrings, ...props.strings };\n const captionsScrollDivRef = useRef<HTMLDivElement>(null);\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\n const theme = useTheme();\n\n const [expandBannerHeight, setExpandBannerHeight] = useState<boolean>(false);\n\n const getTitle = (): string => {\n if (isCaptionsOn && isRealTimeTextOn) {\n return strings.captionsAndRealTimeTextContainerTitle ?? '';\n } else if (isCaptionsOn) {\n return strings.captionsOnlyContainerTitle ?? '';\n } else if (isRealTimeTextOn) {\n return strings.realTimeTextOnlyContainerTitle ?? '';\n }\n return '';\n };\n\n // merge realtimetexts and captions into one array based on timestamp\n // Combine captions and realTimeTexts into one list\n const combinedList: (CaptionsInformation | RealTimeTextInformation)[] = useMemo(() => {\n return sortCaptionsAndRealTimeTexts(captions, realTimeTexts?.completedMessages ?? []);\n }, [captions, realTimeTexts?.completedMessages]);\n\n const mergedCaptions: (CaptionsInformation | RealTimeTextInformation)[] = useMemo(() => {\n return [...combinedList, ...(realTimeTexts?.currentInProgress ?? []), realTimeTexts?.myInProgress].slice(-50) as (\n | CaptionsInformation\n | RealTimeTextInformation\n )[];\n }, [combinedList, realTimeTexts]);\n\n const scrollToBottom = (): void => {\n if (captionsScrollDivRef.current) {\n captionsScrollDivRef.current.scrollTop = captionsScrollDivRef.current.scrollHeight;\n }\n };\n\n const handleScrollToTheBottom = useCallback((): void => {\n if (!captionsScrollDivRef.current) {\n return;\n }\n const atBottom =\n Math.ceil(captionsScrollDivRef.current.scrollTop) >=\n captionsScrollDivRef.current.scrollHeight - captionsScrollDivRef.current.clientHeight - SCROLL_OFFSET_ALLOWANCE;\n\n setIsAtBottomOfScroll(atBottom);\n }, []);\n\n useEffect(() => {\n const captionsScrollDiv = captionsScrollDivRef.current;\n captionsScrollDiv?.addEventListener('scroll', handleScrollToTheBottom);\n\n return () => {\n captionsScrollDiv?.removeEventListener('scroll', handleScrollToTheBottom);\n };\n }, [handleScrollToTheBottom, isCaptionsOn, isRealTimeTextOn]);\n\n useEffect(() => {\n // only auto scroll to bottom is already is at bottom of scroll before new caption comes in\n if (isAtBottomOfScroll) {\n scrollToBottom();\n }\n }, [captions, realTimeTexts, isAtBottomOfScroll]);\n\n const [textFieldValue, setTextFieldValue] = useState<string>('');\n\n useEffect(() => {\n // if the latest real time text sent by myself is final, clear the text field\n if (latestLocalRealTimeText && !latestLocalRealTimeText.isTyping) {\n setTextFieldValue('');\n }\n }, [latestLocalRealTimeText]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>): void => {\n if (event.key === 'Enter') {\n event.preventDefault();\n if (textFieldValue && onSendRealTimeText) {\n onSendRealTimeText(textFieldValue, true);\n setTextFieldValue('');\n }\n }\n };\n\n const realTimeTextDisclosureBannerStrings = {\n bannerTitle: strings.realTimeTextBannerTitle ?? '',\n bannerContent: strings.realTimeTextBannerContent ?? '',\n bannerLinkLabel: strings.realTimeTextBannerLinkLabel ?? ''\n };\n\n const captionsAndRealTimeText = (): JSX.Element => {\n return (\n <>\n {mergedCaptions\n .filter((caption) => caption)\n .map((caption) => {\n if ('message' in caption) {\n return (\n <div\n key={`RealTimeText - ${caption.id}`}\n className={captionContainerClassName}\n data-is-focusable={true}\n >\n <RealTimeText {...(caption as RealTimeTextInformation)} />\n </div>\n );\n }\n return (\n <div key={`Captions - ${caption.id}`} className={captionContainerClassName} data-is-focusable={true}>\n <_Caption {...(caption as CaptionsInformation)} onRenderAvatar={onRenderAvatar} />\n </div>\n );\n })}\n </>\n );\n };\n\n return (\n <>\n {(startCaptionsInProgress || isCaptionsOn || isRealTimeTextOn) && (\n <FocusZone shouldFocusOnMount className={captionsContainerClassName} data-ui-id=\"captions-banner\">\n {(isCaptionsOn || isRealTimeTextOn) && formFactor === 'compact' && (\n <Stack\n horizontal\n horizontalAlign=\"space-between\"\n verticalAlign=\"center\"\n className={bannerTitleContainerClassName}\n >\n <Text className={titleClassName}>{getTitle()}</Text>\n <IconButton\n data-ui-id=\"captions-banner-expand-icon\"\n iconProps={{ iconName: expandBannerHeight ? 'MinimizeIcon' : 'ExpandIcon' }}\n ariaLabel={expandBannerHeight ? strings.minimizeButtonAriaLabel : strings.expandButtonAriaLabel}\n onClick={() => setExpandBannerHeight(!expandBannerHeight)}\n styles={expandIconClassName(theme)}\n />\n </Stack>\n )}\n {(isCaptionsOn || isRealTimeTextOn) && (\n <div\n ref={captionsScrollDivRef}\n className={\n captionsOptions?.height === 'full'\n ? captionsBannerFullHeightClassName(theme)\n : captionsBannerClassName(formFactor, expandBannerHeight)\n }\n data-ui-id=\"captions-banner-inner\"\n data-is-focusable={true}\n >\n {isRealTimeTextOn && (\n <Stack className={rttDisclosureBannerClassName()}>\n <_RTTDisclosureBanner strings={realTimeTextDisclosureBannerStrings} />\n </Stack>\n )}\n {captionsAndRealTimeText()}\n </div>\n )}\n {isRealTimeTextOn && onSendRealTimeText && (\n <TextField\n styles={realTimeTextInputBoxStyles(theme)}\n placeholder={strings.realTimeTextInputBoxDefaultText}\n value={textFieldValue}\n onKeyDown={handleKeyDown}\n onChange={(_, newValue) => {\n setTextFieldValue(newValue || '');\n onSendRealTimeText(newValue || '', false);\n }}\n maxLength={2000}\n errorMessage={textFieldValue.length >= 2000 ? strings.realTimeTextInputErrorMessage : undefined}\n />\n )}\n {!isCaptionsOn && !isRealTimeTextOn && (\n <Stack\n verticalAlign=\"center\"\n styles={\n captionsOptions?.height === 'full'\n ? loadingBannerFullHeightStyles(theme)\n : loadingBannerStyles(formFactor)\n }\n data-is-focusable={true}\n >\n <Spinner label={strings?.captionsBannerSpinnerText} ariaLive=\"assertive\" labelPosition=\"right\" />\n </Stack>\n )}\n </FocusZone>\n )}\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"CaptionsBanner.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/CaptionsBanner.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,i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gBAAgB,IAAI,kBAAkB,IAAI,CACzC,oBAAC,SAAS,IACR,MAAM,EAAE,0BAA0B,CAAC,KAAK,CAAC,EACzC,WAAW,EAAE,OAAO,CAAC,+BAA+B,EACpD,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE;gBACxB,iBAAiB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;gBAClC,kBAAkB,CAAC,QAAQ,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;YAC5C,CAAC,EACD,SAAS,EAAE,IAAI,EACf,YAAY,EAAE,cAAc,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC,SAAS,GAC/F,CACH;QACA,CAAC,YAAY,IAAI,CAAC,gBAAgB,IAAI,CACrC,oBAAC,KAAK,IACJ,aAAa,EAAC,QAAQ,EACtB,MAAM,EACJ,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,MAAK,MAAM;gBAChC,CAAC,CAAC,6BAA6B,CAAC,KAAK,CAAC;gBACtC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,uBAElB,IAAI;YAEvB,oBAAC,OAAO,IAAC,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,yBAAyB,EAAE,QAAQ,EAAC,WAAW,EAAC,aAAa,EAAC,OAAO,GAAG,CAC3F,CACT,CACS,CACb,CACA,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { Stack, FocusZone, Spinner, useTheme } from '@fluentui/react';\nimport { TextField } from '@fluentui/react';\nimport React, { useEffect, useRef, useState, useCallback } from 'react';\nimport { useMemo } from 'react';\nimport { _Caption } from './Caption';\nimport {\n captionContainerClassName,\n captionsBannerClassName,\n captionsBannerFullHeightClassName,\n captionsContainerClassName,\n hiddenAnnouncementClassName,\n loadingBannerFullHeightStyles,\n loadingBannerStyles\n} from './styles/Captions.style';\nimport { rttDisclosureBannerClassName } from './styles/Captions.style';\nimport { OnRenderAvatarCallback } from '../types';\nimport { useLocale } from '../localization';\nimport { RealTimeText } from './RealTimeText';\nimport { _RTTDisclosureBanner } from './RTTDisclosureBanner';\nimport { sortCaptionsAndRealTimeTexts } from './utils/sortCaptionsAndRealTimeTexts';\nimport {\n expandIconClassName,\n bannerTitleContainerClassName,\n realTimeTextInputBoxStyles\n} from './styles/Captions.style';\nimport { titleClassName } from './styles/CaptionsSettingsModal.styles';\nimport { Text, IconButton } from '@fluentui/react';\n\n/**\n * @public\n * information required for each line of caption\n */\nexport type CaptionsInformation = {\n /**\n * unique id for each caption\n */\n id: string;\n /**\n * speaker's display name\n */\n displayName: string;\n /**\n * content of the caption\n */\n captionText: string;\n /**\n * id of the speaker\n */\n userId?: string;\n /**\n * timestamp when the caption was created\n * Please note that this value is essential for determining the order of captions and real time text messages\n * If you are using both captions and real time text, please ensure that the createdTimeStamp is populated\n */\n createdTimeStamp?: Date;\n /**\n * If caption is finalized\n */\n isFinalized?: boolean;\n};\n\n/**\n * @public\n * information required for each line of real time text\n */\nexport type RealTimeTextInformation = {\n /**\n * The id of the real time text.\n */\n id: number;\n /**\n * sender's display name\n */\n displayName: string;\n /**\n * id of the sender\n */\n userId?: string;\n /**\n * The real time text message.\n */\n message: string;\n /**\n * if the real time text received is partial\n */\n isTyping: boolean;\n /**\n * timestamp when the real time text was finalized\n */\n finalizedTimeStamp: Date;\n /**\n * If message originated from the local participant\n * default value is false\n */\n isMe?: boolean;\n};\n/**\n * @public\n * strings for captions banner\n */\nexport interface CaptionsBannerStrings {\n /**\n * Spinner text for captions banner\n */\n captionsBannerSpinnerText?: string;\n\n /**\n * Default text for RTT input text box\n */\n realTimeTextInputBoxDefaultText?: string;\n\n /**\n * Error message for RTT input text box when the size exceeds the limit 2000\n */\n realTimeTextInputErrorMessage?: string;\n\n /**\n * Real time text disclosure banner title\n */\n realTimeTextBannerTitle?: string;\n\n /**\n * Real time text disclosure banner content\n */\n realTimeTextBannerContent?: string;\n\n /**\n * Real time text disclosure banner link label\n */\n realTimeTextBannerLinkLabel?: string;\n\n /**\n * Title for the container when only captions is enabled\n */\n captionsOnlyContainerTitle?: string;\n /**\n * Title for the container when only real time text is enabled\n */\n realTimeTextOnlyContainerTitle?: string;\n /**\n * Title for the container when both captions and real time text is enabled\n */\n captionsAndRealTimeTextContainerTitle?: string;\n /**\n * Expand button aria label\n */\n expandButtonAriaLabel?: string;\n /**\n * Minimize button aria label\n */\n minimizeButtonAriaLabel?: string;\n}\n\n/**\n * @public\n * CaptionsBanner Component Props.\n */\nexport interface CaptionsBannerProps {\n /**\n * Array of captions to be displayed\n */\n captions: CaptionsInformation[];\n /**\n * Array of finalized and partial real time text messages\n */\n realTimeTexts?: {\n completedMessages?: RealTimeTextInformation[];\n currentInProgress?: RealTimeTextInformation[];\n myInProgress?: RealTimeTextInformation;\n };\n /**\n * Flag to indicate if captions are on\n */\n isCaptionsOn?: boolean;\n\n /**\n * Flag to indicate if real time text is on\n */\n isRealTimeTextOn?: boolean;\n /**\n * Flag to indicate if captions are being started\n * This is used to show spinner while captions are being started\n */\n startCaptionsInProgress?: boolean;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n /**\n * Optional strings for the component\n */\n strings?: CaptionsBannerStrings;\n /**\n * Optional form factor for the component.\n * @defaultValue 'default'\n */\n formFactor?: 'default' | 'compact';\n /**\n * Optional options for the component.\n */\n captionsOptions?: {\n height: 'full' | 'default';\n };\n\n /**\n * Optional callback to send real time text.\n */\n onSendRealTimeText?: (text: string, isFinalized: boolean) => Promise<void>;\n\n /**\n * Latest local real time text\n */\n latestLocalRealTimeText?: RealTimeTextInformation;\n}\n\nconst SCROLL_OFFSET_ALLOWANCE = 20;\n\n/**\n * @public\n * A component for displaying a CaptionsBanner with user icon, displayName and captions text.\n */\nexport const CaptionsBanner = (props: CaptionsBannerProps): JSX.Element => {\n const {\n captions,\n realTimeTexts,\n isCaptionsOn,\n startCaptionsInProgress,\n onRenderAvatar,\n formFactor = 'default',\n captionsOptions,\n isRealTimeTextOn,\n onSendRealTimeText,\n latestLocalRealTimeText\n } = props;\n const localeStrings = useLocale().strings.captionsBanner;\n const strings = { ...localeStrings, ...props.strings };\n const captionsScrollDivRef = useRef<HTMLDivElement>(null);\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\n const theme = useTheme();\n\n const [expandBannerHeight, setExpandBannerHeight] = useState<boolean>(false);\n const [announcedRTT, setAnnouncedRTT] = useState<number[]>([]);\n const [announcedCaption, setAnnouncedCaption] = useState<string[]>([]);\n const [captionAnnouncementText, setCaptionAnnouncementText] = useState<CaptionsInformation[]>([]);\n const [rttAnnouncementText, setRTTAnnouncementText] = useState<RealTimeTextInformation[]>([]);\n\n const getTitle = (): string => {\n if (isCaptionsOn && isRealTimeTextOn) {\n return strings.captionsAndRealTimeTextContainerTitle ?? '';\n } else if (isCaptionsOn) {\n return strings.captionsOnlyContainerTitle ?? '';\n } else if (isRealTimeTextOn) {\n return strings.realTimeTextOnlyContainerTitle ?? '';\n }\n return '';\n };\n\n // merge realtimetexts and captions into one array based on timestamp\n // Combine captions and realTimeTexts into one list\n const combinedList: (CaptionsInformation | RealTimeTextInformation)[] = useMemo(() => {\n return sortCaptionsAndRealTimeTexts(captions, realTimeTexts?.completedMessages ?? []);\n }, [captions, realTimeTexts?.completedMessages]);\n\n const mergedCaptions: (CaptionsInformation | RealTimeTextInformation)[] = useMemo(() => {\n return [...combinedList, ...(realTimeTexts?.currentInProgress ?? []), realTimeTexts?.myInProgress].slice(-50) as (\n | CaptionsInformation\n | RealTimeTextInformation\n )[];\n }, [combinedList, realTimeTexts]);\n\n const scrollToBottom = (): void => {\n if (captionsScrollDivRef.current) {\n captionsScrollDivRef.current.scrollTop = captionsScrollDivRef.current.scrollHeight;\n }\n };\n\n const handleScrollToTheBottom = useCallback((): void => {\n if (!captionsScrollDivRef.current) {\n return;\n }\n const atBottom =\n Math.ceil(captionsScrollDivRef.current.scrollTop) >=\n captionsScrollDivRef.current.scrollHeight - captionsScrollDivRef.current.clientHeight - SCROLL_OFFSET_ALLOWANCE;\n\n setIsAtBottomOfScroll(atBottom);\n }, []);\n\n useEffect(() => {\n const captionsScrollDiv = captionsScrollDivRef.current;\n captionsScrollDiv?.addEventListener('scroll', handleScrollToTheBottom);\n\n return () => {\n captionsScrollDiv?.removeEventListener('scroll', handleScrollToTheBottom);\n };\n }, [handleScrollToTheBottom, isCaptionsOn, isRealTimeTextOn]);\n\n useEffect(() => {\n // only auto scroll to bottom is already is at bottom of scroll before new caption comes in\n if (isAtBottomOfScroll) {\n scrollToBottom();\n }\n }, [captions, realTimeTexts, isAtBottomOfScroll]);\n\n const [textFieldValue, setTextFieldValue] = useState<string>('');\n\n useEffect(() => {\n // if the latest real time text sent by myself is final, clear the text field\n if (latestLocalRealTimeText && !latestLocalRealTimeText.isTyping) {\n setTextFieldValue('');\n }\n }, [latestLocalRealTimeText]);\n\n useEffect(() => {\n if (realTimeTexts?.completedMessages) {\n //filter out the messages that have already been announced\n const rTTMessagesToAnnounce = realTimeTexts.completedMessages.filter(\n (message) => !announcedRTT.includes(message.id)\n );\n if (rTTMessagesToAnnounce.length > 0) {\n setRTTAnnouncementText(rTTMessagesToAnnounce);\n setAnnouncedRTT((prev) => [...prev, ...rTTMessagesToAnnounce.map((message) => message.id)]);\n }\n }\n if (captions.length > 0) {\n // filter out the captions that have already been announced\n const captionsToAnnounce = captions.filter(\n (caption) => !announcedCaption.includes(caption.id) && caption.isFinalized\n );\n if (captionsToAnnounce.length > 0) {\n setCaptionAnnouncementText(captionsToAnnounce);\n setAnnouncedCaption((prev) => [...prev, ...captionsToAnnounce.map((caption) => caption.id)]);\n }\n }\n }, [captions, realTimeTexts?.completedMessages, announcedRTT, announcedCaption]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>): void => {\n if (event.key === 'Enter') {\n event.preventDefault();\n if (textFieldValue && onSendRealTimeText) {\n onSendRealTimeText(textFieldValue, true);\n setTextFieldValue('');\n }\n }\n };\n\n const realTimeTextDisclosureBannerStrings = {\n bannerTitle: strings.realTimeTextBannerTitle ?? '',\n bannerContent: strings.realTimeTextBannerContent ?? '',\n bannerLinkLabel: strings.realTimeTextBannerLinkLabel ?? ''\n };\n\n const captionsAndRealTimeText = (): JSX.Element => {\n return (\n <>\n {mergedCaptions\n .filter((caption) => caption)\n .map((caption) => {\n if ('message' in caption) {\n return (\n <div\n key={`RealTimeText - ${caption.id}`}\n className={captionContainerClassName}\n data-is-focusable={true}\n >\n <RealTimeText {...(caption as RealTimeTextInformation)} />\n </div>\n );\n }\n return (\n <div key={`Captions - ${caption.id}`} className={captionContainerClassName} data-is-focusable={true}>\n <_Caption {...(caption as CaptionsInformation)} onRenderAvatar={onRenderAvatar} />\n </div>\n );\n })}\n </>\n );\n };\n\n return (\n <>\n {(startCaptionsInProgress || isCaptionsOn || isRealTimeTextOn) && (\n <FocusZone shouldFocusOnMount className={captionsContainerClassName} data-ui-id=\"captions-banner\">\n {/* ARIA live region */}\n {(rttAnnouncementText.length > 0 || captionAnnouncementText?.length > 0) && (\n <div aria-live=\"assertive\" role=\"alert\" aria-atomic=\"true\" className={hiddenAnnouncementClassName}>\n <span>\n {rttAnnouncementText.map((text) => (\n <span>\n {strings.realTimeTextBannerTitle} {text.displayName}: {text.message}\n </span>\n ))}\n </span>\n <span>\n {captionAnnouncementText.map((text) => (\n <span>\n {strings.captionsOnlyContainerTitle} {text.displayName}: {text.captionText}\n </span>\n ))}\n </span>\n </div>\n )}\n\n {(isCaptionsOn || isRealTimeTextOn) && formFactor === 'compact' && (\n <Stack\n horizontal\n horizontalAlign=\"space-between\"\n verticalAlign=\"center\"\n className={bannerTitleContainerClassName}\n >\n <Text className={titleClassName}>{getTitle()}</Text>\n <IconButton\n data-ui-id=\"captions-banner-expand-icon\"\n iconProps={{ iconName: expandBannerHeight ? 'MinimizeIcon' : 'ExpandIcon' }}\n ariaLabel={expandBannerHeight ? strings.minimizeButtonAriaLabel : strings.expandButtonAriaLabel}\n onClick={() => setExpandBannerHeight(!expandBannerHeight)}\n styles={expandIconClassName(theme)}\n />\n </Stack>\n )}\n {(isCaptionsOn || isRealTimeTextOn) && (\n <div\n ref={captionsScrollDivRef}\n className={\n captionsOptions?.height === 'full'\n ? captionsBannerFullHeightClassName(theme)\n : captionsBannerClassName(formFactor, expandBannerHeight)\n }\n data-ui-id=\"captions-banner-inner\"\n data-is-focusable={true}\n >\n {isRealTimeTextOn && (\n <Stack className={rttDisclosureBannerClassName()}>\n <_RTTDisclosureBanner strings={realTimeTextDisclosureBannerStrings} />\n </Stack>\n )}\n {captionsAndRealTimeText()}\n </div>\n )}\n {isRealTimeTextOn && onSendRealTimeText && (\n <TextField\n styles={realTimeTextInputBoxStyles(theme)}\n placeholder={strings.realTimeTextInputBoxDefaultText}\n value={textFieldValue}\n onKeyDown={handleKeyDown}\n onChange={(_, newValue) => {\n setTextFieldValue(newValue || '');\n onSendRealTimeText(newValue || '', false);\n }}\n maxLength={2000}\n errorMessage={textFieldValue.length >= 2000 ? strings.realTimeTextInputErrorMessage : undefined}\n />\n )}\n {!isCaptionsOn && !isRealTimeTextOn && (\n <Stack\n verticalAlign=\"center\"\n styles={\n captionsOptions?.height === 'full'\n ? loadingBannerFullHeightStyles(theme)\n : loadingBannerStyles(formFactor)\n }\n data-is-focusable={true}\n >\n <Spinner label={strings?.captionsBannerSpinnerText} ariaLive=\"assertive\" labelPosition=\"right\" />\n </Stack>\n )}\n </FocusZone>\n )}\n </>\n );\n};\n"]}
@@ -40,6 +40,10 @@ export declare const captionClassName: string;
40
40
  * @private
41
41
  */
42
42
  export declare const captionsContainerClassName: string;
43
+ /**
44
+ * @private
45
+ */
46
+ export declare const hiddenAnnouncementClassName: string;
43
47
  /**
44
48
  * @private
45
49
  */
@@ -101,6 +101,19 @@ export const captionsContainerClassName = mergeStyles({
101
101
  padding: 0,
102
102
  overflowX: 'hidden'
103
103
  });
104
+ /**
105
+ * @private
106
+ */
107
+ export const hiddenAnnouncementClassName = mergeStyles({
108
+ position: 'absolute',
109
+ width: '1px',
110
+ height: '1px',
111
+ padding: 0,
112
+ overflow: 'hidden',
113
+ clip: 'rect(0, 0, 0, 0)',
114
+ whiteSpace: 'nowrap',
115
+ border: 0
116
+ });
104
117
  /**
105
118
  * @private
106
119
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Captions.style.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/styles/Captions.style.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAwB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,sCAAgC;AAGnD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;IACvC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;CACzB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;IAC9C,UAAU,EAAE,GAAG;IACf,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;IACtB,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC;CACzB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CAAC;IACvD,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC;CAC5B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE;IACzD,OAAO,WAAW,CAAC;QACjB,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY;QAC3C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW;QAChC,YAAY,EAAE,QAAQ,CAAC,CA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IACvD,QAAQ,EAAE,QAAQ;IAClB,YAAY,EAAE,UAAU;CACzB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IStackStyles, ITheme, mergeStyles } from '@fluentui/react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport { IButtonStyles, ITextFieldStyles } from '@fluentui/react';\n\n/**\n * @private\n */\nexport const iconClassName = mergeStyles({\n marginRight: _pxToRem(8)\n});\n\n/**\n * @private\n */\nexport const displayNameClassName = mergeStyles({\n fontWeight: 400,\n fontSize: _pxToRem(12),\n lineHeight: _pxToRem(16)\n});\n\n/**\n * @private\n */\nexport const bannerTitleContainerClassName = mergeStyles({\n paddingBottom: _pxToRem(10)\n});\n\n/**\n * @private\n */\nexport const isTypingClassName = (theme: ITheme): string => {\n return mergeStyles({\n backgroundColor: theme.palette.themeLighter,\n color: theme.palette.themeDarker,\n borderRadius: _pxToRem(4),\n marginLeft: _pxToRem(4),\n fontWeight: 400,\n paddingLeft: _pxToRem(4),\n paddingRight: _pxToRem(4),\n fontSize: _pxToRem(11),\n lineHeight: _pxToRem(16)\n });\n};\n\n/**\n * @private\n */\nexport const rttContainerClassName = (theme: ITheme, isTyping: boolean): string => {\n return mergeStyles({\n borderLeft: isTyping ? `2px solid ${theme.palette.themeLighter}` : 'none'\n });\n};\n\n/**\n * @private\n */\nexport const rttDisclosureBannerClassName = (): string => {\n return mergeStyles({\n padding: '0.25rem',\n paddingTop: '0.5rem'\n });\n};\n\n/**\n * @private\n */\nexport const realTimeTextInputBoxStyles = (theme: ITheme): Partial<ITextFieldStyles> => ({\n root: {\n marginBottom: _pxToRem(8)\n },\n fieldGroup: {\n borderRadius: _pxToRem(4),\n borderColor: theme.palette.neutralQuaternaryAlt\n }\n});\n\n/**\n * @private\n */\nexport const expandIconClassName = (theme: ITheme): IButtonStyles => {\n return {\n root: {\n color: theme.palette.neutralPrimary,\n width: '1rem',\n height: '1rem'\n },\n rootHovered: {\n color: theme.palette.neutralDark\n }\n };\n};\n\n/**\n * @private\n */\nexport const captionClassName = mergeStyles({\n fontWeight: 400,\n fontSize: _pxToRem(16),\n lineHeight: _pxToRem(22),\n width: '100%'\n});\n\n/**\n * @private\n */\nexport const captionsContainerClassName = mergeStyles({\n height: '100%',\n margin: 0,\n overflow: 'auto',\n padding: 0,\n overflowX: 'hidden'\n});\n\n/**\n * @private\n */\nexport const captionContainerClassName = mergeStyles({\n marginTop: _pxToRem(6),\n marginBottom: _pxToRem(6),\n textAlign: 'unset', // ensure RTL spoken language captions are appropriately aligned to the right\n overflowAnchor: 'auto',\n overflowWrap: 'break-word',\n wordBreak: 'break-word', // Additional breaking control for long words\n maxWidth: '100%', // Ensure it never expands beyond 100% of the container\n width: '100%',\n overflow: 'hidden',\n boxSizing: 'border-box', // Include padding in the width calculation\n whiteSpace: 'normal' // Ensure text wraps\n});\n\n/** Reset styling set by the `ul` element */\nconst resetUlStyling = {\n listStyleType: 'none',\n padding: 0,\n margin: 0\n};\n\n/**\n * @private\n */\nexport const captionsBannerClassName = (formFactor: 'default' | 'compact', isExpanded?: boolean): string => {\n return mergeStyles({\n ...resetUlStyling,\n overflowX: 'hidden',\n height: formFactor === 'compact' ? (isExpanded ? '40vh' : '4.5rem') : '8.75rem',\n overflowY: 'auto'\n });\n};\n\n/**\n * @private\n */\nexport const captionsBannerFullHeightClassName = (theme: ITheme): string => {\n return mergeStyles({\n ...resetUlStyling,\n overflowX: 'hidden',\n overflowY: 'auto',\n height: '100%',\n width: '100%',\n position: 'absolute',\n backgroundColor: theme.palette.white,\n left: 0\n });\n};\n\n/**\n * @private\n */\nexport const loadingBannerStyles = (formFactor: 'default' | 'compact'): IStackStyles => {\n return {\n root: {\n height: formFactor === 'compact' ? '4.5rem' : '8.75rem'\n }\n };\n};\n\n/**\n * @private\n */\nexport const loadingBannerFullHeightStyles = (theme: ITheme): IStackStyles => {\n return {\n root: {\n height: '100%',\n width: '100%',\n position: 'absolute',\n left: 0,\n backgroundColor: theme.palette.white\n }\n };\n};\n\n/**\n * @private\n */\nexport const captionsContentContainerClassName = mergeStyles({\n width: '100%',\n paddingInlineEnd: _pxToRem(4)\n});\n\n/**\n * @private\n */\nexport const displayNameContainerClassName = mergeStyles({\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n});\n"]}
1
+ {"version":3,"file":"Captions.style.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/styles/Captions.style.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAwB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,sCAAgC;AAGnD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;IACvC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;CACzB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;IAC9C,UAAU,EAAE,GAAG;IACf,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;IACtB,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC;CACzB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CAAC;IACvD,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC;CAC5B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE;IACzD,OAAO,WAAW,CAAC;QACjB,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY;QAC3C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW;QAChC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;QACzB,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;QACvB,UAAU,EAAE,GAAG;QACf,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;QACxB,YAAY,EAAE,QAAQ,CAAC,CAAC,C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AAgB,EAAE,QAAQ,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CAAC;IACvD,QAAQ,EAAE,QAAQ;IAClB,YAAY,EAAE,UAAU;CACzB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IStackStyles, ITheme, mergeStyles } from '@fluentui/react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport { IButtonStyles, ITextFieldStyles } from '@fluentui/react';\n\n/**\n * @private\n */\nexport const iconClassName = mergeStyles({\n marginRight: _pxToRem(8)\n});\n\n/**\n * @private\n */\nexport const displayNameClassName = mergeStyles({\n fontWeight: 400,\n fontSize: _pxToRem(12),\n lineHeight: _pxToRem(16)\n});\n\n/**\n * @private\n */\nexport const bannerTitleContainerClassName = mergeStyles({\n paddingBottom: _pxToRem(10)\n});\n\n/**\n * @private\n */\nexport const isTypingClassName = (theme: ITheme): string => {\n return mergeStyles({\n backgroundColor: theme.palette.themeLighter,\n color: theme.palette.themeDarker,\n borderRadius: _pxToRem(4),\n marginLeft: _pxToRem(4),\n fontWeight: 400,\n paddingLeft: _pxToRem(4),\n paddingRight: _pxToRem(4),\n fontSize: _pxToRem(11),\n lineHeight: _pxToRem(16)\n });\n};\n\n/**\n * @private\n */\nexport const rttContainerClassName = (theme: ITheme, isTyping: boolean): string => {\n return mergeStyles({\n borderLeft: isTyping ? `2px solid ${theme.palette.themeLighter}` : 'none'\n });\n};\n\n/**\n * @private\n */\nexport const rttDisclosureBannerClassName = (): string => {\n return mergeStyles({\n padding: '0.25rem',\n paddingTop: '0.5rem'\n });\n};\n\n/**\n * @private\n */\nexport const realTimeTextInputBoxStyles = (theme: ITheme): Partial<ITextFieldStyles> => ({\n root: {\n marginBottom: _pxToRem(8)\n },\n fieldGroup: {\n borderRadius: _pxToRem(4),\n borderColor: theme.palette.neutralQuaternaryAlt\n }\n});\n\n/**\n * @private\n */\nexport const expandIconClassName = (theme: ITheme): IButtonStyles => {\n return {\n root: {\n color: theme.palette.neutralPrimary,\n width: '1rem',\n height: '1rem'\n },\n rootHovered: {\n color: theme.palette.neutralDark\n }\n };\n};\n\n/**\n * @private\n */\nexport const captionClassName = mergeStyles({\n fontWeight: 400,\n fontSize: _pxToRem(16),\n lineHeight: _pxToRem(22),\n width: '100%'\n});\n\n/**\n * @private\n */\nexport const captionsContainerClassName = mergeStyles({\n height: '100%',\n margin: 0,\n overflow: 'auto',\n padding: 0,\n overflowX: 'hidden'\n});\n\n/**\n * @private\n */\nexport const hiddenAnnouncementClassName = mergeStyles({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n border: 0\n});\n\n/**\n * @private\n */\nexport const captionContainerClassName = mergeStyles({\n marginTop: _pxToRem(6),\n marginBottom: _pxToRem(6),\n textAlign: 'unset', // ensure RTL spoken language captions are appropriately aligned to the right\n overflowAnchor: 'auto',\n overflowWrap: 'break-word',\n wordBreak: 'break-word', // Additional breaking control for long words\n maxWidth: '100%', // Ensure it never expands beyond 100% of the container\n width: '100%',\n overflow: 'hidden',\n boxSizing: 'border-box', // Include padding in the width calculation\n whiteSpace: 'normal' // Ensure text wraps\n});\n\n/** Reset styling set by the `ul` element */\nconst resetUlStyling = {\n listStyleType: 'none',\n padding: 0,\n margin: 0\n};\n\n/**\n * @private\n */\nexport const captionsBannerClassName = (formFactor: 'default' | 'compact', isExpanded?: boolean): string => {\n return mergeStyles({\n ...resetUlStyling,\n overflowX: 'hidden',\n height: formFactor === 'compact' ? (isExpanded ? '40vh' : '4.5rem') : '8.75rem',\n overflowY: 'auto'\n });\n};\n\n/**\n * @private\n */\nexport const captionsBannerFullHeightClassName = (theme: ITheme): string => {\n return mergeStyles({\n ...resetUlStyling,\n overflowX: 'hidden',\n overflowY: 'auto',\n height: '100%',\n width: '100%',\n position: 'absolute',\n backgroundColor: theme.palette.white,\n left: 0\n });\n};\n\n/**\n * @private\n */\nexport const loadingBannerStyles = (formFactor: 'default' | 'compact'): IStackStyles => {\n return {\n root: {\n height: formFactor === 'compact' ? '4.5rem' : '8.75rem'\n }\n };\n};\n\n/**\n * @private\n */\nexport const loadingBannerFullHeightStyles = (theme: ITheme): IStackStyles => {\n return {\n root: {\n height: '100%',\n width: '100%',\n position: 'absolute',\n left: 0,\n backgroundColor: theme.palette.white\n }\n };\n};\n\n/**\n * @private\n */\nexport const captionsContentContainerClassName = mergeStyles({\n width: '100%',\n paddingInlineEnd: _pxToRem(4)\n});\n\n/**\n * @private\n */\nexport const displayNameContainerClassName = mergeStyles({\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/communication-react",
3
- "version": "1.28.0-alpha-202506060018",
3
+ "version": "1.28.0-alpha-202506070019",
4
4
  "sideEffects": false,
5
5
  "description": "React library for building modern communication user experiences utilizing Azure Communication Services",
6
6
  "keywords": [