@azure/communication-react 1.14.0-alpha-202403160012 → 1.14.0-alpha-202403200012

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 (133) hide show
  1. package/dist/communication-react.d.ts +14 -14
  2. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BCdGFyar.js → RichTextSendBoxWrapper-DRoOTcxC.js} +2 -2
  3. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BCdGFyar.js.map → RichTextSendBoxWrapper-DRoOTcxC.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{index-BfFCLrEO.js → index-CeYIHxFb.js} +695 -542
  5. package/dist/dist-cjs/communication-react/index-CeYIHxFb.js.map +1 -0
  6. package/dist/dist-cjs/communication-react/index.js +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  9. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +2 -2
  10. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
  11. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.d.ts +2 -2
  12. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
  13. package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.d.ts +1 -1
  14. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.d.ts +1 -1
  15. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +14 -12
  16. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
  17. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +2 -0
  18. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
  19. package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.d.ts +1 -1
  20. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +1 -1
  21. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
  22. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +1 -1
  23. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
  24. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.d.ts +2 -2
  25. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  26. package/dist/dist-esm/communication-react/src/mergedHooks.d.ts +1 -1
  27. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js +12 -3
  28. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  29. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +46 -0
  30. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +91 -0
  31. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -0
  32. package/dist/dist-esm/react-components/src/components/ChatMessage/{FluentChatMessageComponentWrapper.d.ts → MessageComponents/FluentChatMessageComponent.d.ts} +6 -7
  33. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +122 -0
  34. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -0
  35. package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponent.d.ts → MyMessageComponents/ChatMyMessageComponent.d.ts} +9 -9
  36. package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponent.js → MyMessageComponents/ChatMyMessageComponent.js} +5 -5
  37. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -0
  38. package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponentAsMessageBubble.d.ts → MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts} +10 -19
  39. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +162 -0
  40. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -0
  41. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.d.ts +12 -0
  42. package/dist/dist-esm/react-components/src/components/ChatMessage/{FluentChatMessageComponentWrapper.js → MyMessageComponents/FluentChatMyMessageComponent.js} +12 -54
  43. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -0
  44. package/dist/dist-esm/react-components/src/components/ParticipantItem.js +1 -4
  45. package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
  46. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +3 -3
  47. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +1 -1
  48. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +3 -5
  49. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js +3 -5
  51. package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js.map +1 -1
  52. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +3 -1
  53. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +98 -118
  54. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  55. package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +6 -6
  56. package/dist/dist-esm/react-components/src/components/VideoGallery.js +3 -7
  57. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  58. package/dist/dist-esm/react-components/src/components/VideoTile.js +1 -1
  59. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  60. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  61. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.d.ts +0 -1
  62. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js +1 -1
  63. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js.map +1 -1
  64. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +29 -0
  65. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +92 -0
  66. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -0
  67. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.d.ts +2 -3
  68. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js +2 -2
  69. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js.map +1 -1
  70. package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js +5 -3
  71. package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js.map +1 -1
  72. package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -1
  73. package/dist/dist-esm/react-components/src/theming/icons.js +1 -1
  74. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  75. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  76. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +5 -5
  77. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
  78. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +5 -5
  79. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  80. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +1 -1
  81. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  82. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js +2 -7
  83. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js.map +1 -1
  84. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.d.ts +2 -2
  85. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js +10 -12
  86. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js.map +1 -1
  87. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.d.ts +2 -2
  88. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +18 -18
  89. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  90. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.d.ts +1 -1
  91. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSelector.d.ts +1 -1
  92. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  93. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +1 -3
  94. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  95. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.d.ts +3 -3
  96. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.js +4 -7
  97. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.js.map +1 -1
  98. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +1 -5
  99. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  100. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +4 -4
  101. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  102. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +4 -4
  103. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  104. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.d.ts +2 -2
  105. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +1 -1
  106. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -1
  107. package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +5 -5
  108. package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +5 -5
  109. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +5 -5
  110. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +5 -5
  111. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +5 -5
  112. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +5 -5
  113. package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +5 -5
  114. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +5 -5
  115. package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +5 -5
  116. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +5 -5
  117. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +5 -5
  118. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +5 -5
  119. package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +5 -5
  120. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +5 -5
  121. package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +5 -5
  122. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +5 -5
  123. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +5 -5
  124. package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +5 -5
  125. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +5 -5
  126. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +5 -5
  127. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +5 -5
  128. package/package.json +3 -5
  129. package/dist/dist-cjs/communication-react/index-BfFCLrEO.js.map +0 -1
  130. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +0 -1
  131. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +0 -218
  132. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +0 -1
  133. package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ChatContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAS,MAAM,OAAO,CAAC;AACpE,OAAO,EAML,SAAS,EACV,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAe,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,gCAAgC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,uEAAuE;AACvE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAElF,YAAY,EAAE,CAAC;AACf,qDAAqD;AACrD,aAAa,EAAE,CAAC;AAEhB;;GAEG;AACH,MAAM,OAAO,WAA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C,OAAyC;QAC7D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,WAAW,GAAG,CAAC,MAAuB,EAAE,KAAc,EAAa,EAAE;IACzE,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport EventEmitter from 'events';\nimport { enableMapSet, enablePatches, produce, Patch } from 'immer';\nimport {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget,\n ChatError\n} from './ChatClientState';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind, UnknownIdentifierKind } from '@azure/communication-common';\nimport { AzureLogger, createClientLogger, getLogLevel } from '@azure/logger';\nimport { _safeJSONStringify, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { Constants } from './Constants';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { chatStatefulLogger } from './Logger';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ResourceDownloadQueue, fetchImageSource } from './ResourceDownloadQueue';\n\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n\n/**\n * @internal\n */\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: { id: '' } as UnknownIdentifierKind,\n displayName: '',\n threads: {},\n latestErrors: {} as ChatErrors\n };\n private _batchMode = false;\n private _logger: AzureLogger;\n private _emitter: EventEmitter;\n private typingIndicatorInterval: number | undefined = undefined;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private _inlineImageQueue: ResourceDownloadQueue | undefined = undefined;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private _fullsizeImageQueue: ResourceDownloadQueue | undefined = undefined;\n constructor(\n maxListeners?: number,\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ credential?: CommunicationTokenCredential,\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ endpoint?: string\n ) {\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n if (credential) {\n this._inlineImageQueue = new ResourceDownloadQueue(this, { credential, endpoint: endpoint ?? '' });\n this._fullsizeImageQueue = new ResourceDownloadQueue(this, { credential, endpoint: endpoint ?? '' });\n }\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n\n public getState(): ChatClientState {\n return this._state;\n }\n\n public modifyState(modifier: (draft: ChatClientState) => void): void {\n const priorState = this._state;\n this._state = produce(this._state, modifier, (patches: Patch[]) => {\n if (getLogLevel() === 'verbose') {\n // Log to `info` because AzureLogger.verbose() doesn't show up in console.\n this._logger.info(`State change: ${_safeJSONStringify(patches)}`);\n }\n });\n if (!this._batchMode && this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public dispose(): void {\n this.modifyState((draft: ChatClientState) => {\n this._inlineImageQueue?.cancelAllRequests();\n this._fullsizeImageQueue?.cancelAllRequests();\n Object.keys(draft.threads).forEach((threadId) => {\n const thread = draft.threads[threadId];\n Object.keys(thread.chatMessages).forEach((messageId) => {\n const cache = thread.chatMessages[messageId].resourceCache;\n if (cache) {\n Object.keys(cache).forEach((resourceUrl) => {\n const resource = cache[resourceUrl];\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n });\n }\n thread.chatMessages[messageId].resourceCache = undefined;\n });\n });\n });\n // Any item in queue should be removed.\n }\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public async downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string): Promise<void> {\n let message = this.getState().threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue) {\n if (!message.resourceCache) {\n message = { ...message, resourceCache: {} };\n }\n // Need to discuss retry logic in case of failure\n this._fullsizeImageQueue.addMessage(message);\n await this._fullsizeImageQueue.startQueue(threadId, fetchImageSource, {\n singleUrl: resourceUrl\n });\n }\n }\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string): void {\n this.modifyState((draft: ChatClientState) => {\n const message = draft.threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue && this._fullsizeImageQueue.containsMessageWithSameAttachments(message)) {\n this._fullsizeImageQueue?.cancelRequest(resourceUrl);\n } else if (\n message &&\n this._inlineImageQueue &&\n this._inlineImageQueue.containsMessageWithSameAttachments(message)\n ) {\n this._inlineImageQueue?.cancelRequest(resourceUrl);\n }\n if (message && message.resourceCache && message.resourceCache[resourceUrl]) {\n const resource = message.resourceCache[resourceUrl];\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n\n delete message.resourceCache[resourceUrl];\n }\n });\n }\n\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\n });\n }\n\n public createThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = {\n chatMessages: {},\n threadId: threadId,\n properties: properties,\n participants: {},\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date(0)\n };\n });\n }\n\n public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.modifyState((draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\n });\n }\n\n public createThreadIfNotExist(threadId: string, properties?: ChatThreadProperties): boolean {\n const exists = Object.prototype.hasOwnProperty.call(this.getState().threads, threadId);\n if (!exists) {\n this.createThread(threadId, properties);\n return true;\n }\n return false;\n }\n\n public updateThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n thread.properties = properties;\n }\n });\n }\n\n public updateThreadTopic(threadId: string, topic?: string): void {\n this.modifyState((draft: ChatClientState) => {\n if (topic === undefined) {\n return;\n }\n const thread = draft.threads[threadId];\n if (thread && !thread.properties) {\n thread.properties = { topic: topic };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\n }\n });\n }\n\n public deleteThread(threadId: string): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n delete draft.threads[threadId];\n }\n });\n }\n\n public setChatMessages(threadId: string, messages: { [key: string]: ChatMessageWithStatus }): void {\n this.modifyState((draft: ChatClientState) => {\n const threadState = draft.threads[threadId];\n if (threadState) {\n threadState.chatMessages = messages;\n }\n\n // remove typing indicator when receive messages\n const thread = draft.threads[threadId];\n if (thread) {\n for (const message of Object.values(messages)) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n }\n });\n }\n\n public updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessage = draft.threads[threadId]?.chatMessages[messagesId];\n if (chatMessage) {\n if (!chatMessage.content) {\n chatMessage.content = {};\n }\n chatMessage.content.message = content;\n }\n });\n }\n\n public deleteLocalMessage(threadId: string, localId: string): boolean {\n let localMessageDeleted = false;\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n const message: ChatMessageWithStatus | undefined = chatMessages ? chatMessages[localId] : undefined;\n if (chatMessages && message && message.clientMessageId) {\n delete chatMessages[message.clientMessageId];\n localMessageDeleted = true;\n }\n });\n return localMessageDeleted;\n }\n\n public deleteMessage(threadId: string, id: string): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n if (chatMessages) {\n delete chatMessages[id];\n }\n });\n }\n\n public setParticipant(threadId: string, participant: ChatParticipant): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participants[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n });\n }\n\n public setParticipants(threadId: string, participants: ChatParticipant[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participantsMap = draft.threads[threadId]?.participants;\n if (participantsMap) {\n for (const participant of participants) {\n participantsMap[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n }\n });\n }\n\n public deleteParticipants(threadId: string, participantIds: CommunicationIdentifierKind[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participantIds.forEach((id) => {\n delete participants[toFlatCommunicationIdentifier(id)];\n });\n }\n });\n }\n\n public deleteParticipant(threadId: string, participantId: CommunicationIdentifierKind): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n delete participants[toFlatCommunicationIdentifier(participantId)];\n }\n });\n }\n\n public addReadReceipt(threadId: string, readReceipt: ChatMessageReadReceipt): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n const readReceipts = thread?.readReceipts;\n if (thread && readReceipts) {\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\n thread.latestReadTime = readReceipt.readOn;\n }\n readReceipts.push(readReceipt);\n }\n });\n }\n\n private startTypingIndicatorCleanUp(): void {\n if (this.typingIndicatorInterval) {\n return;\n }\n this.typingIndicatorInterval = window.setInterval(() => {\n let isTypingActive = false;\n this.modifyState((draft: ChatClientState) => {\n for (const thread of Object.values(draft.threads)) {\n const filteredTypingIndicators = thread.typingIndicators.filter((typingIndicator) => {\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\n });\n\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\n }\n\n public addTypingIndicator(threadId: string, typingIndicator: TypingIndicatorReceivedEvent): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n const typingIndicators = thread.typingIndicators;\n typingIndicators.push(typingIndicator);\n }\n });\n\n // Make sure we only maintain a period of typing indicator for perf purposes\n this.startTypingIndicatorCleanUp();\n }\n\n public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n this.parseAttachments(threadId, message);\n const { id: messageId, clientMessageId } = message;\n if (messageId || clientMessageId) {\n this.modifyState((draft: ChatClientState) => {\n const threadMessages = draft.threads[threadId]?.chatMessages;\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages[clientMessageId];\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\n\n if (threadMessages && messageKey) {\n threadMessages[messageKey] = message;\n }\n\n // remove typing indicator when receive a message from a user\n const thread = draft.threads[threadId];\n if (thread) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n });\n }\n }\n\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private parseAttachments(threadId: string, message: ChatMessageWithStatus): void {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments && attachments.length > 0) {\n if (\n this._inlineImageQueue &&\n !this._inlineImageQueue.containsMessageWithSameAttachments(message) &&\n message.resourceCache === undefined\n ) {\n // Need to discuss retry logic in case of failure\n this._inlineImageQueue.addMessage(message);\n this._inlineImageQueue.startQueue(threadId, fetchImageSource);\n }\n }\n }\n\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * @param f Async function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withAsyncErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => Promise<R>,\n target: ChatErrorTarget\n ): (...args: Args) => Promise<R> {\n return async (...args: Args): Promise<R> => {\n try {\n return await f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n /**\n * Tees any errors encountered in an function to the state.\n *\n * @param f Function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => R,\n target: ChatErrorTarget\n ): (...args: Args) => R {\n return (...args: Args): R => {\n try {\n chatStatefulLogger.info(`Chat stateful client target function called: ${target}`);\n return f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n private setLatestError(target: ChatErrorTarget, error: ChatError): void {\n this.modifyState((draft: ChatClientState) => {\n draft.latestErrors[target] = error;\n });\n }\n\n // This is a mutating function, only use it inside of a produce() function\n private filterTypingIndicatorForUser(thread: ChatThreadClientState, userId?: CommunicationIdentifierKind): void {\n if (!userId) {\n return;\n }\n const typingIndicators = thread.typingIndicators;\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\n const filteredTypingIndicators = typingIndicators.filter(\n (typingIndicator) => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey\n );\n if (filteredTypingIndicators.length !== typingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n }\n\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n public batch(operations: () => void): void {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n } catch (e) {\n this._state = priorState;\n if (getLogLevel() === 'verbose') {\n this._logger.warning(`State rollback to: ${_safeJSONStringify(priorState)}`);\n }\n throw e;\n } finally {\n this._batchMode = false;\n }\n }\n\n public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\n }\n}\n\nconst toChatError = (target: ChatErrorTarget, error: unknown): ChatError => {\n if (error instanceof Error) {\n return new ChatError(target, error);\n }\n return new ChatError(target, new Error(`${error}`));\n};\n"]}
1
+ {"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ChatContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAS,MAAM,OAAO,CAAC;AACpE,OAAO,EAML,SAAS,EACV,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAe,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,gCAAgC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,uEAAuE;AACvE,OA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,KAAK,CAAC;QAC1B,CAAC;IACH,CAAC;IAEM,aAAa,CAAC,OAAyC;QAC5D,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAEM,cAAc,CAAC,OAAyC;QAC7D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,WAAW,GAAG,CAAC,MAAuB,EAAE,KAAc,EAAa,EAAE;IACzE,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport EventEmitter from 'events';\nimport { enableMapSet, enablePatches, produce, Patch } from 'immer';\nimport {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget,\n ChatError\n} from './ChatClientState';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind, UnknownIdentifierKind } from '@azure/communication-common';\nimport { AzureLogger, createClientLogger, getLogLevel } from '@azure/logger';\nimport { _safeJSONStringify, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { Constants } from './Constants';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { chatStatefulLogger } from './Logger';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ResourceDownloadQueue, fetchImageSource } from './ResourceDownloadQueue';\n\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n\n/**\n * @internal\n */\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: { id: '' } as UnknownIdentifierKind,\n displayName: '',\n threads: {},\n latestErrors: {} as ChatErrors\n };\n private _batchMode = false;\n private _logger: AzureLogger;\n private _emitter: EventEmitter;\n private typingIndicatorInterval: number | undefined = undefined;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private _inlineImageQueue: ResourceDownloadQueue | undefined = undefined;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private _fullsizeImageQueue: ResourceDownloadQueue | undefined = undefined;\n constructor(\n maxListeners?: number,\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ credential?: CommunicationTokenCredential,\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ endpoint?: string\n ) {\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n if (credential) {\n this._inlineImageQueue = new ResourceDownloadQueue(this, { credential, endpoint: endpoint ?? '' });\n this._fullsizeImageQueue = new ResourceDownloadQueue(this, { credential, endpoint: endpoint ?? '' });\n }\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n\n public getState(): ChatClientState {\n return this._state;\n }\n\n public modifyState(modifier: (draft: ChatClientState) => void): void {\n const priorState = this._state;\n this._state = produce(this._state, modifier, (patches: Patch[]) => {\n if (getLogLevel() === 'verbose') {\n // Log to `info` because AzureLogger.verbose() doesn't show up in console.\n this._logger.info(`State change: ${_safeJSONStringify(patches)}`);\n }\n });\n if (!this._batchMode && this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public dispose(): void {\n this.modifyState((draft: ChatClientState) => {\n this._inlineImageQueue?.cancelAllRequests();\n this._fullsizeImageQueue?.cancelAllRequests();\n Object.keys(draft.threads).forEach((threadId) => {\n const thread = draft.threads[threadId];\n Object.keys(thread.chatMessages).forEach((messageId) => {\n const cache = thread.chatMessages[messageId].resourceCache;\n if (cache) {\n Object.keys(cache).forEach((resourceUrl) => {\n const resource = cache[resourceUrl];\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n });\n }\n thread.chatMessages[messageId].resourceCache = undefined;\n });\n });\n });\n // Any item in queue should be removed.\n }\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public async downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string): Promise<void> {\n let message = this.getState().threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue) {\n if (!message.resourceCache) {\n message = { ...message, resourceCache: {} };\n }\n // Need to discuss retry logic in case of failure\n this._fullsizeImageQueue.addMessage(message);\n await this._fullsizeImageQueue.startQueue(threadId, fetchImageSource, {\n singleUrl: resourceUrl\n });\n }\n }\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string): void {\n this.modifyState((draft: ChatClientState) => {\n const message = draft.threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue && this._fullsizeImageQueue.containsMessageWithSameAttachments(message)) {\n this._fullsizeImageQueue?.cancelRequest(resourceUrl);\n } else if (\n message &&\n this._inlineImageQueue &&\n this._inlineImageQueue.containsMessageWithSameAttachments(message)\n ) {\n this._inlineImageQueue?.cancelRequest(resourceUrl);\n }\n if (message && message.resourceCache && message.resourceCache[resourceUrl]) {\n const resource = message.resourceCache[resourceUrl];\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n\n delete message.resourceCache[resourceUrl];\n }\n });\n }\n\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\n });\n }\n\n public createThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = {\n chatMessages: {},\n threadId: threadId,\n properties: properties,\n participants: {},\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date(0)\n };\n });\n }\n\n public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.modifyState((draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\n });\n }\n\n public createThreadIfNotExist(threadId: string, properties?: ChatThreadProperties): boolean {\n const exists = Object.prototype.hasOwnProperty.call(this.getState().threads, threadId);\n if (!exists) {\n this.createThread(threadId, properties);\n return true;\n }\n return false;\n }\n\n public updateThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n thread.properties = properties;\n }\n });\n }\n\n public updateThreadTopic(threadId: string, topic?: string): void {\n this.modifyState((draft: ChatClientState) => {\n if (topic === undefined) {\n return;\n }\n const thread = draft.threads[threadId];\n if (thread && !thread.properties) {\n thread.properties = { topic: topic };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\n }\n });\n }\n\n public deleteThread(threadId: string): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n delete draft.threads[threadId];\n }\n });\n }\n\n public setChatMessages(threadId: string, messages: { [key: string]: ChatMessageWithStatus }): void {\n this.modifyState((draft: ChatClientState) => {\n const threadState = draft.threads[threadId];\n if (threadState) {\n threadState.chatMessages = messages;\n }\n\n // remove typing indicator when receive messages\n const thread = draft.threads[threadId];\n if (thread) {\n for (const message of Object.values(messages)) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n }\n });\n }\n\n public updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessage = draft.threads[threadId]?.chatMessages[messagesId];\n if (chatMessage) {\n if (!chatMessage.content) {\n chatMessage.content = {};\n }\n chatMessage.content.message = content;\n }\n });\n }\n\n public deleteLocalMessage(threadId: string, localId: string): boolean {\n let localMessageDeleted = false;\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n const message: ChatMessageWithStatus | undefined = chatMessages ? chatMessages[localId] : undefined;\n if (chatMessages && message && message.clientMessageId) {\n delete chatMessages[message.clientMessageId];\n localMessageDeleted = true;\n }\n });\n return localMessageDeleted;\n }\n\n public deleteMessage(threadId: string, id: string): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n if (chatMessages) {\n delete chatMessages[id];\n }\n });\n }\n\n public setParticipant(threadId: string, participant: ChatParticipant): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participants[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n });\n }\n\n public setParticipants(threadId: string, participants: ChatParticipant[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participantsMap = draft.threads[threadId]?.participants;\n if (participantsMap) {\n for (const participant of participants) {\n participantsMap[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n }\n });\n }\n\n public deleteParticipants(threadId: string, participantIds: CommunicationIdentifierKind[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participantIds.forEach((id) => {\n delete participants[toFlatCommunicationIdentifier(id)];\n });\n }\n });\n }\n\n public deleteParticipant(threadId: string, participantId: CommunicationIdentifierKind): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n delete participants[toFlatCommunicationIdentifier(participantId)];\n }\n });\n }\n\n public addReadReceipt(threadId: string, readReceipt: ChatMessageReadReceipt): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n const readReceipts = thread?.readReceipts;\n if (thread && readReceipts) {\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\n thread.latestReadTime = readReceipt.readOn;\n }\n readReceipts.push(readReceipt);\n }\n });\n }\n\n private startTypingIndicatorCleanUp(): void {\n if (this.typingIndicatorInterval) {\n return;\n }\n this.typingIndicatorInterval = window.setInterval(() => {\n let isTypingActive = false;\n this.modifyState((draft: ChatClientState) => {\n for (const thread of Object.values(draft.threads)) {\n const filteredTypingIndicators = thread.typingIndicators.filter((typingIndicator) => {\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\n });\n\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\n }\n\n public addTypingIndicator(threadId: string, typingIndicator: TypingIndicatorReceivedEvent): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n const typingIndicators = thread.typingIndicators;\n typingIndicators.push(typingIndicator);\n }\n });\n\n // Make sure we only maintain a period of typing indicator for perf purposes\n this.startTypingIndicatorCleanUp();\n }\n\n public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n this.parseAttachments(threadId, message);\n const { id: messageId, clientMessageId } = message;\n if (messageId || clientMessageId) {\n this.modifyState((draft: ChatClientState) => {\n const threadMessages = draft.threads[threadId]?.chatMessages;\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages[clientMessageId];\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\n\n if (threadMessages && messageKey) {\n threadMessages[messageKey] = message;\n }\n\n // remove typing indicator when receive a message from a user\n const thread = draft.threads[threadId];\n if (thread) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n });\n }\n }\n\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private parseAttachments(threadId: string, message: ChatMessageWithStatus): void {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments && attachments.length > 0) {\n if (\n this._inlineImageQueue &&\n !this._inlineImageQueue.containsMessageWithSameAttachments(message) &&\n message.resourceCache === undefined\n ) {\n // Need to discuss retry logic in case of failure\n this._inlineImageQueue.addMessage(message);\n this._inlineImageQueue.startQueue(threadId, fetchImageSource);\n }\n }\n }\n\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * @param f Async function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withAsyncErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => Promise<R>,\n target: ChatErrorTarget\n ): (...args: Args) => Promise<R> {\n return async (...args: Args): Promise<R> => {\n try {\n return await f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n /**\n * Tees any errors encountered in an function to the state.\n *\n * @param f Function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => R,\n target: ChatErrorTarget\n ): (...args: Args) => R {\n return (...args: Args): R => {\n try {\n chatStatefulLogger.info(`Chat stateful client target function called: ${target}`);\n return f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n private setLatestError(target: ChatErrorTarget, error: ChatError): void {\n this.modifyState((draft: ChatClientState) => {\n draft.latestErrors[target] = error;\n });\n }\n\n // This is a mutating function, only use it inside of a produce() function\n private filterTypingIndicatorForUser(thread: ChatThreadClientState, userId?: CommunicationIdentifierKind): void {\n if (!userId) {\n return;\n }\n const typingIndicators = thread.typingIndicators;\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\n const filteredTypingIndicators = typingIndicators.filter(\n (typingIndicator) => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey\n );\n if (filteredTypingIndicators.length !== typingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n }\n\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n public batch(operations: () => void): void {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n } catch (e) {\n this._state = priorState;\n if (getLogLevel() === 'verbose') {\n this._logger.warning(`State rollback to: ${_safeJSONStringify(priorState)}`);\n }\n throw e;\n } finally {\n this._batchMode = false;\n }\n }\n\n public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\n }\n}\n\nconst toChatError = (target: ChatErrorTarget, error: unknown): ChatError => {\n if (error instanceof Error) {\n return new ChatError(target, error);\n }\n return new ChatError(target, new Error(`${error}`));\n};\n"]}
@@ -93,8 +93,8 @@ export class ResourceDownloadQueue {
93
93
  });
94
94
  }
95
95
  downloadAllPreviewUrls(message, operation) {
96
- var _a;
97
96
  return __awaiter(this, void 0, void 0, function* () {
97
+ var _a;
98
98
  const attachments = (_a = message.content) === null || _a === void 0 ? void 0 : _a.attachments;
99
99
  if (message.type === 'html' && attachments) {
100
100
  if (message.resourceCache === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;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E,OAAO,CAAC,eAAe;aACzC,CAAC,CAAC;QACL,CAAC;KAAA;IACD,SAAe,gBAAgB,CAC7B,QAAgC,EAChC,OAAkF;;YAElF,gCAAgC;YAChC,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;YAErD,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE;gBACzB,eAAe,CAAC,KAAK,EAAE,CAAC;YAC1B,CAAC,EAAE,OAAO,CAAC,CAAC;YAEZ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,kCAChC,OAAO,KACV,MAAM,EAAE,eAAe,CAAC,MAAM,IAC9B,CAAC;YACH,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IACD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAElD,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9E,KAAK,GAAG,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;IAC7D,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatContext } from './ChatContext';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatMessageWithStatus, ResourceFetchResult } from './types/ChatMessageWithStatus';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\ndeclare type CancellationDetails = { src: string; abortController: AbortController };\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n private _endpoint: string;\n private _requestsToCancel: Record<string, CancellationDetails> = {};\n\n constructor(context: ChatContext, authentication: { credential: CommunicationTokenCredential; endpoint: string }) {\n this._context = context;\n this._credential = authentication.credential;\n this._endpoint = authentication.endpoint;\n }\n\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n\n return contains;\n }\n\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = { ...message };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n\n public async startQueue(threadId: string, operation: ImageRequest, options?: { singleUrl: string }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n\n public cancelAllRequests(): void {\n for (const key in this._requestsToCancel) {\n this._requestsToCancel[key].abortController.abort();\n }\n this._requestsToCancel = {};\n }\n\n public cancelRequest(url: string): void {\n if (this._requestsToCancel[url]) {\n this._requestsToCancel[url].abortController.abort();\n delete this._requestsToCancel[url];\n }\n }\n\n private async downloadSingleUrl(\n message: ChatMessageWithStatus,\n resourceUrl: string,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, resourceUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[resourceUrl];\n }\n\n message = { ...message, resourceCache: { ...message.resourceCache, [resourceUrl]: response } };\n return message;\n }\n\n private async downloadAllPreviewUrls(\n message: ChatMessageWithStatus,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[attachment.previewUrl];\n }\n message.resourceCache[attachment.previewUrl] = response;\n }\n }\n }\n\n return message;\n }\n\n private async downloadResource(\n operation: ImageRequest,\n url: string,\n abortController: AbortController\n ): Promise<string> {\n this._requestsToCancel[url] = { src: url, abortController };\n const blobUrl = await operation(\n url,\n { credential: this._credential, endpoint: this._endpoint },\n { abortController }\n );\n delete this._requestsToCancel[url];\n return blobUrl;\n }\n}\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport const fetchImageSource = async (\n src: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n): Promise<string> => {\n async function fetchWithAuthentication(\n url: string,\n token: string,\n options: { abortController: AbortController; timeout?: number }\n ): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n return await fetchWithTimeout(url, {\n timeout: options.timeout,\n headers,\n abortController: options.abortController\n });\n }\n async function fetchWithTimeout(\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers; abortController: AbortController }\n ): Promise<Response> {\n // default timeout is 30 seconds\n const { timeout = 30000, abortController } = options;\n\n const id = setTimeout(() => {\n abortController.abort();\n }, timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: abortController.signal\n });\n clearTimeout(id);\n return response;\n }\n const fetchUrl = new URL(src);\n const endpoint = new URL(authentication.endpoint);\n\n let token = '';\n if (fetchUrl.hostname === endpoint.hostname && fetchUrl.protocol === 'https:') {\n token = (await authentication.credential.getToken()).token;\n }\n\n const response = await fetchWithAuthentication(src, token, options);\n const blob = await response.blob();\n\n return URL.createObjectURL(blob);\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\ninterface ImageRequest {\n (\n request: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n ): Promise<string>;\n}\n"]}
1
+ {"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAUA,uEAAuE;AACvE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAQhC,YAAY,OAAoB,EAAE,cAA8E;QAPxG,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAGjB,sBAAiB,GAAwC,EAAE,CAAC;QAGlE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAEM,kCAAkC,CAAC,OAA8B;;Q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ACV,MAAM,EAAE,eAAe,CAAC,MAAM,IAC9B,CAAC;YACH,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IACD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAElD,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9E,KAAK,GAAG,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;IAC7D,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatContext } from './ChatContext';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatMessageWithStatus, ResourceFetchResult } from './types/ChatMessageWithStatus';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\ndeclare type CancellationDetails = { src: string; abortController: AbortController };\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n private _endpoint: string;\n private _requestsToCancel: Record<string, CancellationDetails> = {};\n\n constructor(context: ChatContext, authentication: { credential: CommunicationTokenCredential; endpoint: string }) {\n this._context = context;\n this._credential = authentication.credential;\n this._endpoint = authentication.endpoint;\n }\n\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n\n return contains;\n }\n\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = { ...message };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n\n public async startQueue(threadId: string, operation: ImageRequest, options?: { singleUrl: string }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n\n public cancelAllRequests(): void {\n for (const key in this._requestsToCancel) {\n this._requestsToCancel[key].abortController.abort();\n }\n this._requestsToCancel = {};\n }\n\n public cancelRequest(url: string): void {\n if (this._requestsToCancel[url]) {\n this._requestsToCancel[url].abortController.abort();\n delete this._requestsToCancel[url];\n }\n }\n\n private async downloadSingleUrl(\n message: ChatMessageWithStatus,\n resourceUrl: string,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, resourceUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[resourceUrl];\n }\n\n message = { ...message, resourceCache: { ...message.resourceCache, [resourceUrl]: response } };\n return message;\n }\n\n private async downloadAllPreviewUrls(\n message: ChatMessageWithStatus,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[attachment.previewUrl];\n }\n message.resourceCache[attachment.previewUrl] = response;\n }\n }\n }\n\n return message;\n }\n\n private async downloadResource(\n operation: ImageRequest,\n url: string,\n abortController: AbortController\n ): Promise<string> {\n this._requestsToCancel[url] = { src: url, abortController };\n const blobUrl = await operation(\n url,\n { credential: this._credential, endpoint: this._endpoint },\n { abortController }\n );\n delete this._requestsToCancel[url];\n return blobUrl;\n }\n}\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport const fetchImageSource = async (\n src: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n): Promise<string> => {\n async function fetchWithAuthentication(\n url: string,\n token: string,\n options: { abortController: AbortController; timeout?: number }\n ): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n return await fetchWithTimeout(url, {\n timeout: options.timeout,\n headers,\n abortController: options.abortController\n });\n }\n async function fetchWithTimeout(\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers; abortController: AbortController }\n ): Promise<Response> {\n // default timeout is 30 seconds\n const { timeout = 30000, abortController } = options;\n\n const id = setTimeout(() => {\n abortController.abort();\n }, timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: abortController.signal\n });\n clearTimeout(id);\n return response;\n }\n const fetchUrl = new URL(src);\n const endpoint = new URL(authentication.endpoint);\n\n let token = '';\n if (fetchUrl.hostname === endpoint.hostname && fetchUrl.protocol === 'https:') {\n token = (await authentication.credential.getToken()).token;\n }\n\n const response = await fetchWithAuthentication(src, token, options);\n const blob = await response.blob();\n\n return URL.createObjectURL(blob);\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\ninterface ImageRequest {\n (\n request: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n ): Promise<string>;\n}\n"]}
@@ -10,7 +10,7 @@ type IteratorCreatorFn<T, OptionsType, PageT = T[]> = (options?: OptionsType) =>
10
10
  * @param context chatContext
11
11
  * @param decorateFn the function for the decorating behavior
12
12
  */
13
- export declare const createDecoratedIterator: <ItemType, OptionsType>(iteratorCreator: IteratorCreatorFn<ItemType, OptionsType, ItemType[]>, context: ChatContext, decorateFn: (item: ItemType, context: ChatContext) => void) => (options?: OptionsType | undefined) => PagedAsyncIterableIterator<ItemType, ItemType[], import("@azure/core-paging").PageSettings>;
13
+ export declare const createDecoratedIterator: <ItemType, OptionsType>(iteratorCreator: IteratorCreatorFn<ItemType, OptionsType>, context: ChatContext, decorateFn: (item: ItemType, context: ChatContext) => void) => (options?: OptionsType | undefined) => PagedAsyncIterableIterator<ItemType>;
14
14
  /**
15
15
  *
16
16
  * @param iteratorCreator Function that creates the base iteartor
@@ -18,6 +18,6 @@ export declare const createDecoratedIterator: <ItemType, OptionsType>(iteratorCr
18
18
  * @param target See {@link ChatContext.asyncTeeErrorToState}.
19
19
  * @returns A function to create an iterator that handles errors when iterting over the iterator from `iteratorCreator`.
20
20
  */
21
- export declare const createErrorHandlingIterator: <ItemType, OptionsType>(iteratorCreator: IteratorCreatorFn<ItemType, OptionsType, ItemType[]>, context: ChatContext, target: ChatErrorTarget) => IteratorCreatorFn<ItemType, OptionsType, ItemType[]>;
21
+ export declare const createErrorHandlingIterator: <ItemType, OptionsType>(iteratorCreator: IteratorCreatorFn<ItemType, OptionsType>, context: ChatContext, target: ChatErrorTarget) => IteratorCreatorFn<ItemType, OptionsType>;
22
22
  export {};
23
23
  //# sourceMappingURL=createDecoratedIterator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAmCzG,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,yDAAyD;AACzD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAsB9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,eAAe,EACf,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AACpC,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,0CAA0C,CAAC,6CAA6C;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,iDAAiD;AACjD,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AA0IpC,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA6C7D,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAgB1E,cAAc,yCAAyC,CAAC;AACxD,cAAc,eAAe,CAAC;AAE9B,sDAAsD;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,sDAAsD;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(video-background-effects) */\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(close-captions) */\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\nexport { RaiseHandButton } from '../../react-components/src';\n\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps\n} from '../../react-components/src';\n\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\n/* @conditional-compile-remove(reaction) */\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings } from '../../react-components/src';\n/* @conditional-compile-remove(spotlight) */\nexport type { Spotlight } from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type {\n ActiveFileUpload,\n SendBoxErrorBarError,\n FileDownloadHandler,\n FileDownloadError\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type { AttachmentMetadata } from '../../react-components/src';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ChatAttachmentType } from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type { OverflowGalleryPosition } from '../../react-components/src';\n/* @conditional-compile-remove(click-to-call) */ /* @conditional-compile-remove(rooms) */\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n/* @conditional-compile-remove(close-captions) */\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssues } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAmCzG,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,yDAAyD;AACzD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAsB9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,eAAe,EACf,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AACpC,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,0CAA0C,CAAC,6CAA6C;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,iDAAiD;AACjD,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AA0IpC,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA4C7D,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAgB1E,cAAc,yCAAyC,CAAC;AACxD,cAAc,eAAe,CAAC;AAE9B,sDAAsD;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,sDAAsD;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(video-background-effects) */\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(close-captions) */\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\nexport { RaiseHandButton } from '../../react-components/src';\n\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps\n} from '../../react-components/src';\n\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\n/* @conditional-compile-remove(reaction) */\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings } from '../../react-components/src';\n/* @conditional-compile-remove(spotlight) */\nexport type { Spotlight } from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type {\n ActiveFileUpload,\n SendBoxErrorBarError,\n FileDownloadHandler,\n FileDownloadError\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type { AttachmentMetadata } from '../../react-components/src';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ChatAttachmentType } from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type { OverflowGalleryPosition } from '../../react-components/src';\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n/* @conditional-compile-remove(close-captions) */\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssues } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n"]}
@@ -25,7 +25,7 @@ export type Selector = (state: ClientState, props: any) => any;
25
25
  *
26
26
  * @public
27
27
  */
28
- export declare const useSelector: <ParamT extends Selector | undefined>(selector: ParamT, selectorProps?: (ParamT extends Selector ? Parameters<ParamT>[1] : undefined) | undefined, type?: 'calling' | 'chat') => ParamT extends Selector ? ReturnType<ParamT> : undefined;
28
+ export declare const useSelector: <ParamT extends Selector | undefined>(selector: ParamT, selectorProps?: ParamT extends Selector ? Parameters<ParamT>[1] : undefined, type?: 'calling' | 'chat') => ParamT extends Selector ? ReturnType<ParamT> : undefined;
29
29
  /**
30
30
  * Helper type for {@link usePropsFor}.
31
31
  *
@@ -1,8 +1,9 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
  import React, { useMemo } from 'react';
4
- import { FluentChatMessageComponentWrapper } from './FluentChatMessageComponentWrapper';
5
4
  import { DefaultSystemMessage } from './DefaultSystemMessage';
5
+ import { FluentChatMyMessageComponent } from './MyMessageComponents/FluentChatMyMessageComponent';
6
+ import { FluentChatMessageComponent } from './MessageComponents/FluentChatMessageComponent';
6
7
  /**
7
8
  * The wrapper component to display different types of chat message.
8
9
  *
@@ -27,7 +28,7 @@ export const ChatMessageComponentWrapper = (props) => {
27
28
  : styles === null || styles === void 0 ? void 0 : styles.myChatMessageContainer;
28
29
  const blockedMessageStyle = styles === null || styles === void 0 ? void 0 : styles.blockedMessageContainer;
29
30
  const messageContainerStyle = message.mine ? myChatMessageStyle : blockedMessageStyle;
30
- return (React.createElement(FluentChatMessageComponentWrapper, Object.assign({}, props, { message: message, messageContainerStyle: messageContainerStyle })));
31
+ return fluentChatComponent(Object.assign(Object.assign({}, props), { message: message, messageContainerStyle: messageContainerStyle }));
31
32
  }
32
33
  switch (message.messageType) {
33
34
  case 'chat': {
@@ -36,7 +37,7 @@ export const ChatMessageComponentWrapper = (props) => {
36
37
  : styles === null || styles === void 0 ? void 0 : styles.myChatMessageContainer;
37
38
  const chatMessageStyle = styles === null || styles === void 0 ? void 0 : styles.chatMessageContainer;
38
39
  const messageContainerStyle = message.mine ? myChatMessageStyle : chatMessageStyle;
39
- return (React.createElement(FluentChatMessageComponentWrapper, Object.assign({}, props, { message: message, messageContainerStyle: messageContainerStyle })));
40
+ return fluentChatComponent(Object.assign(Object.assign({}, props), { message: message, messageContainerStyle: messageContainerStyle }));
40
41
  }
41
42
  case 'system': {
42
43
  const messageContainerStyle = styles === null || styles === void 0 ? void 0 : styles.systemMessageContainer;
@@ -50,4 +51,12 @@ export const ChatMessageComponentWrapper = (props) => {
50
51
  }
51
52
  }
52
53
  };
54
+ const fluentChatComponent = (props) => {
55
+ if (props.message.mine === true) {
56
+ return React.createElement(FluentChatMyMessageComponent, Object.assign({}, props));
57
+ }
58
+ else {
59
+ return React.createElement(FluentChatMessageComponent, Object.assign({}, props));
60
+ }
61
+ };
53
62
  //# sourceMappingURL=ChatMessageComponentWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentWrapper.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentWrapper.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAUvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAiD9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,KAAuC,EAAe,EAAE;;IAClG,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAEpE,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE;QACtC,OAAO;YACL,UAAU,EAAE,QAAQ;SACrB,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE;QACtC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;IAC1D,CAAC,EAAE,EAAE,CAAC,CAAC;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E,qBAAqB,EAAE,qBAAqB,IAAI,CACjH,CAAC;QACJ,CAAC;QAED,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,qBAAqB,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,sBAAsB,CAAC;YAC7D,MAAM,sBAAsB,GAC1B,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,CAC9B,oBAAC,oBAAoB,oBAAK,KAAK,EAAI,CACpC,CAAC,CAAC,CAAC,CACF,eAAe,iCAAM,KAAK,KAAE,qBAAqB,KAAI,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,oBAAoB,oBAAK,KAAK,EAAI,CAAC,CACrG,CAAC;YACJ,OAAO,CACL,6BAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB,IAC5C,sBAAsB,CACnB,CACP,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACR,mHAAmH;YACnH,MAAM,sBAAsB,GAAG,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,yCAAK,CAAC,CAAC,CAAC,eAAe,mBAAM,KAAK,EAAG,CAAC;YACrG,OAAO,CACL,6BAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB,IAC5C,sBAAsB,CACnB,CACP,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport React, { useMemo } from 'react';\nimport { MessageProps, MessageRenderer, MessageThreadStyles, _ChatMessageProps } from '../MessageThread';\nimport { ChatMessage, OnRenderAvatarCallback } from '../../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types';\n/* @conditional-compile-remove(file-sharing) */\nimport { FileDownloadHandler } from '../FileDownloadCards';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from '../MentionPopover';\nimport { MessageStatusIndicatorProps } from '../MessageStatusIndicator';\nimport { FluentChatMessageComponentWrapper } from './FluentChatMessageComponentWrapper';\nimport { DefaultSystemMessage } from './DefaultSystemMessage';\n/* @conditional-compile-remove(image-overlay) */\nimport { InlineImageOptions } from './ChatMessageContent';\n\n/**\n * Props for {@link ChatMessageComponentWrapper}\n *\n * @private\n */\nexport type ChatMessageComponentWrapperProps = _ChatMessageProps & {\n /**\n * UserId of the current user.\n */\n userId: string;\n styles: MessageThreadStyles | undefined;\n shouldOverlapAvatarAndMessage: boolean;\n onRenderMessageStatus: ((messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null) | undefined;\n defaultStatusRenderer: (\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage,\n participantCount: number,\n readCount: number,\n status?: MessageStatus\n ) => JSX.Element;\n onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;\n onRenderAvatar?: OnRenderAvatarCallback;\n showMessageStatus?: boolean;\n participantCount?: number;\n readCount?: number;\n /* @conditional-compile-remove(file-sharing) */\n onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (\n readBy: {\n id: string;\n displayName: string;\n }[]\n ) => void\n ) => void;\n /* @conditional-compile-remove(file-sharing) */\n fileDownloadHandler?: FileDownloadHandler;\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(image-overlay) */\n inlineImageOptions?: InlineImageOptions;\n /* @conditional-compile-remove(mention) */\n mentionOptions?: MentionOptions;\n};\n\n/**\n * The wrapper component to display different types of chat message.\n *\n * @private\n */\nexport const ChatMessageComponentWrapper = (props: ChatMessageComponentWrapperProps): JSX.Element => {\n const { message, styles, onRenderMessage, key: messageKey } = props;\n\n const systemMessageStyle = useMemo(() => {\n return {\n paddingTop: '0.5rem'\n };\n }, []);\n\n const customMessageStyle = useMemo(() => {\n return { paddingTop: '1rem', paddingBottom: '0.25rem' };\n }, []);\n\n /* @conditional-compile-remove(data-loss-prevention) */\n // Similar logic as switch statement case 'chat', if statement for conditional compile (merge logic to switch case when stabilize)\n if (message.messageType === 'blocked') {\n const myChatMessageStyle =\n message.status === 'failed'\n ? styles?.failedMyChatMessageContainer ?? styles?.myChatMessageContainer\n : styles?.myChatMessageContainer;\n const blockedMessageStyle = styles?.blockedMessageContainer;\n const messageContainerStyle = message.mine ? myChatMessageStyle : blockedMessageStyle;\n return (\n <FluentChatMessageComponentWrapper {...props} message={message} messageContainerStyle={messageContainerStyle} />\n );\n }\n\n switch (message.messageType) {\n case 'chat': {\n const myChatMessageStyle =\n message.status === 'failed'\n ? styles?.failedMyChatMessageContainer ?? styles?.myChatMessageContainer\n : styles?.myChatMessageContainer;\n const chatMessageStyle = styles?.chatMessageContainer;\n const messageContainerStyle = message.mine ? myChatMessageStyle : chatMessageStyle;\n return (\n <FluentChatMessageComponentWrapper {...props} message={message} messageContainerStyle={messageContainerStyle} />\n );\n }\n\n case 'system': {\n const messageContainerStyle = styles?.systemMessageContainer;\n const systemMessageComponent =\n onRenderMessage === undefined ? (\n <DefaultSystemMessage {...props} />\n ) : (\n onRenderMessage({ ...props, messageContainerStyle }, (props) => <DefaultSystemMessage {...props} />)\n );\n return (\n <div key={messageKey} style={systemMessageStyle}>\n {systemMessageComponent}\n </div>\n );\n }\n\n default: {\n // We do not handle custom type message by default, users can handle custom type by using onRenderMessage function.\n const customMessageComponent = onRenderMessage === undefined ? <></> : onRenderMessage({ ...props });\n return (\n <div key={messageKey} style={customMessageStyle}>\n {customMessageComponent}\n </div>\n );\n }\n }\n};\n"]}
1
+ {"version":3,"file":"ChatMessageComponentWrapper.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentWrapper.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAWv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AC,CAAC,yCAAK,CAAC,CAAC,CAAC,eAAe,mBAAM,KAAK,EAAG,CAAC;YACrG,OAAO,CACL,6BAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB,IAC5C,sBAAsB,CACnB,CACP,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,KAA6C,EAAe,EAAE;IACzF,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO,oBAAC,4BAA4B,oBAAK,KAAK,EAAI,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,oBAAC,0BAA0B,oBAAK,KAAK,EAAI,CAAC;IACnD,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport React, { useMemo } from 'react';\nimport { MessageProps, MessageRenderer, MessageThreadStyles, _ChatMessageProps } from '../MessageThread';\nimport { ChatMessage, OnRenderAvatarCallback } from '../../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types';\n/* @conditional-compile-remove(file-sharing) */\nimport { FileDownloadHandler } from '../FileDownloadCards';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from '../MentionPopover';\nimport { MessageStatusIndicatorProps } from '../MessageStatusIndicator';\nimport { FluentChatMessageComponentWrapperProps } from './MessageComponents/FluentChatMessageComponent';\nimport { DefaultSystemMessage } from './DefaultSystemMessage';\n/* @conditional-compile-remove(image-overlay) */\nimport { InlineImageOptions } from './ChatMessageContent';\nimport { FluentChatMyMessageComponent } from './MyMessageComponents/FluentChatMyMessageComponent';\nimport { FluentChatMessageComponent } from './MessageComponents/FluentChatMessageComponent';\n\n/**\n * Props for {@link ChatMessageComponentWrapper}\n *\n * @private\n */\nexport type ChatMessageComponentWrapperProps = _ChatMessageProps & {\n /**\n * UserId of the current user.\n */\n userId: string;\n styles: MessageThreadStyles | undefined;\n shouldOverlapAvatarAndMessage: boolean;\n onRenderMessageStatus: ((messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null) | undefined;\n defaultStatusRenderer: (\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage,\n participantCount: number,\n readCount: number,\n status?: MessageStatus\n ) => JSX.Element;\n onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;\n onRenderAvatar?: OnRenderAvatarCallback;\n showMessageStatus?: boolean;\n participantCount?: number;\n readCount?: number;\n /* @conditional-compile-remove(file-sharing) */\n onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (\n readBy: {\n id: string;\n displayName: string;\n }[]\n ) => void\n ) => void;\n /* @conditional-compile-remove(file-sharing) */\n fileDownloadHandler?: FileDownloadHandler;\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(image-overlay) */\n inlineImageOptions?: InlineImageOptions;\n /* @conditional-compile-remove(mention) */\n mentionOptions?: MentionOptions;\n};\n\n/**\n * The wrapper component to display different types of chat message.\n *\n * @private\n */\nexport const ChatMessageComponentWrapper = (props: ChatMessageComponentWrapperProps): JSX.Element => {\n const { message, styles, onRenderMessage, key: messageKey } = props;\n\n const systemMessageStyle = useMemo(() => {\n return {\n paddingTop: '0.5rem'\n };\n }, []);\n\n const customMessageStyle = useMemo(() => {\n return { paddingTop: '1rem', paddingBottom: '0.25rem' };\n }, []);\n\n /* @conditional-compile-remove(data-loss-prevention) */\n // Similar logic as switch statement case 'chat', if statement for conditional compile (merge logic to switch case when stabilize)\n if (message.messageType === 'blocked') {\n const myChatMessageStyle =\n message.status === 'failed'\n ? styles?.failedMyChatMessageContainer ?? styles?.myChatMessageContainer\n : styles?.myChatMessageContainer;\n const blockedMessageStyle = styles?.blockedMessageContainer;\n const messageContainerStyle = message.mine ? myChatMessageStyle : blockedMessageStyle;\n return fluentChatComponent({ ...props, message: message, messageContainerStyle: messageContainerStyle });\n }\n\n switch (message.messageType) {\n case 'chat': {\n const myChatMessageStyle =\n message.status === 'failed'\n ? styles?.failedMyChatMessageContainer ?? styles?.myChatMessageContainer\n : styles?.myChatMessageContainer;\n const chatMessageStyle = styles?.chatMessageContainer;\n const messageContainerStyle = message.mine ? myChatMessageStyle : chatMessageStyle;\n return fluentChatComponent({ ...props, message: message, messageContainerStyle: messageContainerStyle });\n }\n\n case 'system': {\n const messageContainerStyle = styles?.systemMessageContainer;\n const systemMessageComponent =\n onRenderMessage === undefined ? (\n <DefaultSystemMessage {...props} />\n ) : (\n onRenderMessage({ ...props, messageContainerStyle }, (props) => <DefaultSystemMessage {...props} />)\n );\n return (\n <div key={messageKey} style={systemMessageStyle}>\n {systemMessageComponent}\n </div>\n );\n }\n\n default: {\n // We do not handle custom type message by default, users can handle custom type by using onRenderMessage function.\n const customMessageComponent = onRenderMessage === undefined ? <></> : onRenderMessage({ ...props });\n return (\n <div key={messageKey} style={customMessageStyle}>\n {customMessageComponent}\n </div>\n );\n }\n }\n};\n\nconst fluentChatComponent = (props: FluentChatMessageComponentWrapperProps): JSX.Element => {\n if (props.message.mine === true) {\n return <FluentChatMyMessageComponent {...props} />;\n } else {\n return <FluentChatMessageComponent {...props} />;\n }\n};\n"]}
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { InlineImageOptions } from '../ChatMessageContent';
3
+ import { ChatMessage } from '../../../types/ChatMessage';
4
+ import { BlockedMessage } from '../../../types/ChatMessage';
5
+ import { MessageThreadStrings } from '../../MessageThread';
6
+ import { ComponentSlotStyle } from '../../../types';
7
+ import { FileDownloadHandler } from '../../FileDownloadCards';
8
+ import { MentionDisplayOptions } from '../../MentionPopover';
9
+ type ChatMessageComponentAsMessageBubbleProps = {
10
+ message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;
11
+ messageContainerStyle?: ComponentSlotStyle;
12
+ showDate?: boolean;
13
+ strings: MessageThreadStrings;
14
+ userId: string;
15
+ /**
16
+ * Whether to overlap avatar and message when the view is width constrained.
17
+ */
18
+ shouldOverlapAvatarAndMessage: boolean;
19
+ /**
20
+ * Optional callback to render uploaded files in the message component.
21
+ */
22
+ onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;
23
+ /**
24
+ * Optional function called when someone clicks on the file download icon.
25
+ */
26
+ fileDownloadHandler?: FileDownloadHandler;
27
+ /**
28
+ * Optional function to provide customized date format.
29
+ * @beta
30
+ */
31
+ onDisplayDateTimeString?: (messageDate: Date) => string;
32
+ /**
33
+ * Optional props needed to display suggestions in the mention scenario.
34
+ * @internal
35
+ */
36
+ mentionDisplayOptions?: MentionDisplayOptions;
37
+ /**
38
+ * Optional callback called when an inline image is clicked.
39
+ * @beta
40
+ */
41
+ inlineImageOptions?: InlineImageOptions;
42
+ };
43
+ /** @private */
44
+ export declare const ChatMessageComponentAsMessageBubble: React.MemoExoticComponent<(props: ChatMessageComponentAsMessageBubbleProps) => JSX.Element>;
45
+ export {};
46
+ //# sourceMappingURL=ChatMessageComponentAsMessageBubble.d.ts.map
@@ -0,0 +1,91 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { Text, mergeStyles } from '@fluentui/react';
4
+ import { ChatMessage as FluentChatMessage } from '@fluentui-contrib/react-chat';
5
+ import React, { useCallback, useMemo } from 'react';
6
+ import { chatMessageDateStyle, chatMessageAuthorStyle } from '../../styles/ChatMessageComponent.styles';
7
+ import { useIdentifiers } from '../../../identifiers/IdentifierProvider';
8
+ import { useTheme } from '../../../theming';
9
+ import { useLocale } from '../../../localization';
10
+ import { createStyleFromV8Style } from '../../styles/v8StyleShim';
11
+ import { mergeClasses } from '@fluentui/react-components';
12
+ import { useChatMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';
13
+ import { generateCustomizedTimestamp, generateDefaultTimestamp, getMessageBubbleContent, getMessageEditedDetails } from '../../utils/ChatMessageComponentUtils';
14
+ /** @private */
15
+ const MessageBubble = (props) => {
16
+ const ids = useIdentifiers();
17
+ const theme = useTheme();
18
+ const locale = useLocale();
19
+ const { userId, message, showDate, messageContainerStyle, strings,
20
+ /* @conditional-compile-remove(file-sharing) */
21
+ fileDownloadHandler,
22
+ /* @conditional-compile-remove(image-overlay) */
23
+ inlineImageOptions, shouldOverlapAvatarAndMessage,
24
+ /* @conditional-compile-remove(file-sharing) */
25
+ onRenderFileDownloads,
26
+ /* @conditional-compile-remove(mention) */
27
+ mentionDisplayOptions, onDisplayDateTimeString } = props;
28
+ const formattedTimestamp = useMemo(() => {
29
+ const defaultTimeStamp = message.createdOn
30
+ ? generateDefaultTimestamp(message.createdOn, showDate, strings)
31
+ : undefined;
32
+ const customTimestamp = message.createdOn
33
+ ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)
34
+ : '';
35
+ return customTimestamp || defaultTimeStamp;
36
+ }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);
37
+ const getMessageDetails = useCallback(() => {
38
+ return getMessageEditedDetails(message, theme, strings.editedTag);
39
+ }, [strings.editedTag, theme, message]);
40
+ const getContent = useCallback(() => {
41
+ return getMessageBubbleContent(message, strings, userId,
42
+ /* @conditional-compile-remove(image-overlay) */
43
+ inlineImageOptions,
44
+ /* @conditional-compile-remove(file-sharing) */
45
+ onRenderFileDownloads,
46
+ /* @conditional-compile-remove(mention) */
47
+ mentionDisplayOptions,
48
+ /* @conditional-compile-remove(file-sharing) */
49
+ fileDownloadHandler);
50
+ }, [
51
+ /* @conditional-compile-remove(file-sharing) */ fileDownloadHandler,
52
+ /* @conditional-compile-remove(image-overlay) */ inlineImageOptions,
53
+ /* @conditional-compile-remove(mention) */ mentionDisplayOptions,
54
+ message,
55
+ /* @conditional-compile-remove(file-sharing) */ onRenderFileDownloads,
56
+ strings,
57
+ userId
58
+ ]);
59
+ const isBlockedMessage = false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';
60
+ const chatMessageCommonStyles = useChatMessageCommonStyles();
61
+ const chatMessageStyles = useChatMessageStyles();
62
+ const chatItemMessageContainerClassName = mergeClasses(
63
+ // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors
64
+ chatMessageStyles.body,
65
+ // disable placeholder functionality for GA releases as it might confuse users
66
+ /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
67
+ chatMessageStyles.bodyWithPlaceholderImage, isBlockedMessage
68
+ ? chatMessageCommonStyles.blocked
69
+ : props.message.status === 'failed'
70
+ ? chatMessageCommonStyles.failed
71
+ : undefined, shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap, message.attached === 'top' || message.attached === false
72
+ ? chatMessageStyles.bodyWithAvatar
73
+ : chatMessageStyles.bodyWithoutAvatar, mergeStyles(messageContainerStyle));
74
+ const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';
75
+ const chatMessage = (React.createElement(React.Fragment, null,
76
+ React.createElement("div", { key: props.message.messageId },
77
+ React.createElement(FluentChatMessage, { attached: attached, key: props.message.messageId, root: {
78
+ className: chatMessageStyles.root,
79
+ // make body not focusable to remove repetitions from narrators.
80
+ // inner components are already focusable
81
+ tabIndex: -1,
82
+ role: 'none'
83
+ }, author: React.createElement(Text, { className: chatMessageAuthorStyle }, message.senderDisplayName), body: {
84
+ className: chatItemMessageContainerClassName,
85
+ style: Object.assign({}, createStyleFromV8Style(messageContainerStyle))
86
+ }, "data-ui-id": "chat-composite-message", timestamp: React.createElement(Text, { className: chatMessageDateStyle, "data-ui-id": ids.messageTimestamp }, formattedTimestamp), details: getMessageDetails() }, getContent()))));
87
+ return chatMessage;
88
+ };
89
+ /** @private */
90
+ export const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);
91
+ //# sourceMappingURL=ChatMessageComponentAsMessageBubble.js.map