@azure/communication-react 1.19.0-alpha-202407310012 → 1.19.0-alpha-202408020014
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +42 -33
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-CsHqT8dY.js → ChatMessageComponentAsRichTextEditBox-DM13Kp5W.js} +52 -33
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DM13Kp5W.js.map +1 -0
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-TGDmjXvl.js → RichTextSendBoxWrapper-8FsFMpKF.js} +3 -3
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-TGDmjXvl.js.map → RichTextSendBoxWrapper-8FsFMpKF.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-BBPqvw4B.js → index-D84PSTZV.js} +573 -198
- package/dist/dist-cjs/communication-react/index-D84PSTZV.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +2 -2
- package/dist/dist-esm/acs-ui-common/src/constants.d.ts +5 -0
- package/dist/dist-esm/acs-ui-common/src/constants.js +6 -0
- package/dist/dist-esm/acs-ui-common/src/constants.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/index.d.ts +1 -0
- package/dist/dist-esm/acs-ui-common/src/index.js +2 -0
- package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/BreakoutRoomsSubscriber.d.ts +1 -0
- package/dist/dist-esm/calling-stateful-client/src/BreakoutRoomsSubscriber.js +6 -0
- package/dist/dist-esm/calling-stateful-client/src/BreakoutRoomsSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +1 -0
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +1 -0
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +9 -0
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +6 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +1 -1
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +53 -32
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +2 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js +6 -6
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +18 -6
- package/dist/dist-esm/react-components/src/components/MessageThread.js +3 -3
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js +18 -34
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.d.ts +14 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.js +56 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js +10 -16
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +85 -8
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +16 -27
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +33 -35
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.d.ts +34 -0
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js +121 -0
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +15 -13
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +42 -32
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +3 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +41 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +4 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackCapabilityChangedNotifications.js +19 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackCapabilityChangedNotifications.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +6 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +4 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +6 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +30 -17
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.d.ts +5 -5
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js +61 -31
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +32 -2
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js +3 -3
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/constants.d.ts +5 -0
- package/dist/dist-esm/react-composites/src/composites/common/constants.js +6 -0
- package/dist/dist-esm/react-composites/src/composites/common/constants.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +7 -7
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-CsHqT8dY.js.map +0 -1
- package/dist/dist-cjs/communication-react/index-BBPqvw4B.js.map +0 -1
package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js
CHANGED
@@ -10,9 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
});
|
11
11
|
};
|
12
12
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
13
|
+
import { _IMAGE_ATTRIBUTE_INLINE_IMAGE_FILE_NAME_KEY } from "../../../../../acs-ui-common/src";
|
14
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
13
15
|
import { AttachmentUploadActionType } from '../file-sharing/AttachmentUpload';
|
14
16
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
15
|
-
import { SEND_BOX_UPLOADS_KEY_VALUE } from '../../common/constants';
|
17
|
+
import { _DEFAULT_INLINE_IMAGE_FILE_NAME, SEND_BOX_UPLOADS_KEY_VALUE } from '../../common/constants';
|
16
18
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
17
19
|
import { nanoid } from 'nanoid';
|
18
20
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
@@ -55,14 +57,14 @@ export const getEditBoxMessagesInlineImages = (editBoxInlineImageUploads) => {
|
|
55
57
|
return;
|
56
58
|
}
|
57
59
|
const messageIds = Object.keys(editBoxInlineImageUploads || {});
|
58
|
-
const
|
60
|
+
const messagesInlineImagesWithProgress = {};
|
59
61
|
messageIds.map((messageId) => {
|
60
62
|
const messageUploads = editBoxInlineImageUploads[messageId].map((upload) => {
|
61
63
|
return upload.metadata;
|
62
64
|
});
|
63
|
-
|
65
|
+
messagesInlineImagesWithProgress[messageId] = messageUploads;
|
64
66
|
});
|
65
|
-
return
|
67
|
+
return messagesInlineImagesWithProgress;
|
66
68
|
};
|
67
69
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
68
70
|
/**
|
@@ -97,7 +99,10 @@ const inlineImageUploadHandler = (uploadTasks, adapter, strings) => __awaiter(vo
|
|
97
99
|
}
|
98
100
|
try {
|
99
101
|
const response = yield adapter.uploadImage(image, (_c = task.metadata) === null || _c === void 0 ? void 0 : _c.name);
|
100
|
-
|
102
|
+
// Use response id as the image src because we need to keep the original image id as a reference to find the image.
|
103
|
+
// Also the html content we send to ChatSDK does not need image src,
|
104
|
+
// it only need the response id to match the uploaded image, url is not needed.
|
105
|
+
uploadTask.notifyUploadCompleted(task.metadata.id, response.id);
|
101
106
|
}
|
102
107
|
catch (error) {
|
103
108
|
console.error(error);
|
@@ -106,8 +111,8 @@ const inlineImageUploadHandler = (uploadTasks, adapter, strings) => __awaiter(vo
|
|
106
111
|
}
|
107
112
|
});
|
108
113
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
109
|
-
const generateUploadTask = (
|
110
|
-
const imageData = yield getInlineImageData(
|
114
|
+
const generateUploadTask = (imageAttributes, fileName, messageId, inlineImageUploadActionHandler) => __awaiter(void 0, void 0, void 0, function* () {
|
115
|
+
const imageData = yield getInlineImageData(imageAttributes.src);
|
111
116
|
if (!imageData) {
|
112
117
|
return;
|
113
118
|
}
|
@@ -116,9 +121,9 @@ const generateUploadTask = (image, fileName, messageId, inlineImageUploadActionH
|
|
116
121
|
image: imageData,
|
117
122
|
taskId,
|
118
123
|
metadata: {
|
119
|
-
id:
|
124
|
+
id: imageAttributes.id,
|
120
125
|
name: fileName,
|
121
|
-
url:
|
126
|
+
url: imageAttributes.src,
|
122
127
|
progress: 0
|
123
128
|
},
|
124
129
|
notifyUploadProgressChanged: (value) => {
|
@@ -153,8 +158,8 @@ const generateUploadTask = (image, fileName, messageId, inlineImageUploadActionH
|
|
153
158
|
/**
|
154
159
|
* @internal
|
155
160
|
*/
|
156
|
-
export const onInsertInlineImageForEditBox = (
|
157
|
-
const uploadTask = yield generateUploadTask(
|
161
|
+
export const onInsertInlineImageForEditBox = (imageAttributes, fileName, messageId, adapter, handleEditBoxInlineImageUploadAction, chatCompositeStrings) => __awaiter(void 0, void 0, void 0, function* () {
|
162
|
+
const uploadTask = yield generateUploadTask(imageAttributes, fileName, messageId, handleEditBoxInlineImageUploadAction);
|
158
163
|
if (!uploadTask) {
|
159
164
|
return;
|
160
165
|
}
|
@@ -169,8 +174,8 @@ export const onInsertInlineImageForEditBox = (image, fileName, messageId, adapte
|
|
169
174
|
/**
|
170
175
|
* @internal
|
171
176
|
*/
|
172
|
-
export const onInsertInlineImageForSendBox = (
|
173
|
-
const uploadTask = yield generateUploadTask(
|
177
|
+
export const onInsertInlineImageForSendBox = (imageAttributes, fileName, adapter, handleSendBoxInlineImageUploadAction, chatCompositeStrings) => __awaiter(void 0, void 0, void 0, function* () {
|
178
|
+
const uploadTask = yield generateUploadTask(imageAttributes, fileName, SEND_BOX_UPLOADS_KEY_VALUE, handleSendBoxInlineImageUploadAction);
|
174
179
|
if (!uploadTask) {
|
175
180
|
return;
|
176
181
|
}
|
@@ -185,8 +190,14 @@ export const onInsertInlineImageForSendBox = (image, fileName, adapter, handleSe
|
|
185
190
|
/**
|
186
191
|
* @internal
|
187
192
|
*/
|
188
|
-
export const cancelInlineImageUpload = (
|
193
|
+
export const cancelInlineImageUpload = (imageAttributes, imageUploads, messageId, inlineImageUploadActionHandler, adapter) => {
|
194
|
+
if (!imageUploads || !imageUploads[messageId]) {
|
195
|
+
deleteExistingInlineImageForEditBox(imageAttributes.id, messageId, adapter);
|
196
|
+
return;
|
197
|
+
}
|
198
|
+
const imageUpload = imageUploads[messageId].find((upload) => upload.metadata.id === imageAttributes.id);
|
189
199
|
if (!imageUpload || !(imageUpload === null || imageUpload === void 0 ? void 0 : imageUpload.metadata.id)) {
|
200
|
+
deleteExistingInlineImageForEditBox(imageAttributes.id, messageId, adapter);
|
190
201
|
return;
|
191
202
|
}
|
192
203
|
inlineImageUploadActionHandler({
|
@@ -194,36 +205,55 @@ export const cancelInlineImageUpload = (imageId, imageUpload, messageId, inlineI
|
|
194
205
|
id: imageUpload === null || imageUpload === void 0 ? void 0 : imageUpload.metadata.id,
|
195
206
|
messageId
|
196
207
|
});
|
197
|
-
// TODO: remove local blob
|
198
208
|
if ((imageUpload === null || imageUpload === void 0 ? void 0 : imageUpload.metadata.progress) === 1) {
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
209
|
+
deleteInlineImageFromServer(imageUpload === null || imageUpload === void 0 ? void 0 : imageUpload.metadata.id, adapter);
|
210
|
+
}
|
211
|
+
};
|
212
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
213
|
+
const deleteInlineImageFromServer = (imageId, adapter) => {
|
214
|
+
try {
|
215
|
+
adapter.deleteImage(imageId);
|
216
|
+
}
|
217
|
+
catch (error) {
|
218
|
+
console.error(error);
|
205
219
|
}
|
206
220
|
};
|
207
221
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
222
|
+
// This function is used to delete the inline image that existed before editing starts
|
223
|
+
const deleteExistingInlineImageForEditBox = (imageId, messageId, adapter) => {
|
224
|
+
messageId !== SEND_BOX_UPLOADS_KEY_VALUE && deleteInlineImageFromServer(imageId, adapter);
|
225
|
+
};
|
226
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
208
227
|
/**
|
209
228
|
* @internal
|
210
229
|
*/
|
211
|
-
export const
|
212
|
-
if (!
|
213
|
-
return;
|
230
|
+
export const updateContentStringWithUploadedInlineImages = (content, imageUploads, messageId = SEND_BOX_UPLOADS_KEY_VALUE) => {
|
231
|
+
if (!imageUploads || !imageUploads[messageId]) {
|
232
|
+
return content;
|
214
233
|
}
|
215
|
-
const
|
216
|
-
|
234
|
+
const messageUploads = imageUploads[messageId];
|
235
|
+
const document = new DOMParser().parseFromString(content !== null && content !== void 0 ? content : '', 'text/html');
|
236
|
+
document.querySelectorAll('img').forEach((img) => {
|
237
|
+
var _a;
|
238
|
+
const uploadInlineImage = messageUploads.find((upload) => !upload.metadata.error && upload.metadata.progress === 1 && upload.metadata.id === img.id);
|
239
|
+
if (uploadInlineImage) {
|
240
|
+
// ChatSDK uses the respond id provided by the upload response. We store the response id in the image src attribute previously.
|
241
|
+
img.id = (_a = uploadInlineImage.metadata.url) !== null && _a !== void 0 ? _a : img.id;
|
242
|
+
img.src = '';
|
243
|
+
}
|
244
|
+
});
|
245
|
+
content = document.body.innerHTML;
|
246
|
+
return content;
|
217
247
|
};
|
218
248
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
219
249
|
/**
|
220
250
|
* @internal
|
221
251
|
*/
|
222
|
-
export const
|
223
|
-
|
224
|
-
|
252
|
+
export const getImageFileNameFromAttributes = (imageAttributes) => {
|
253
|
+
const fileName = imageAttributes[_IMAGE_ATTRIBUTE_INLINE_IMAGE_FILE_NAME_KEY];
|
254
|
+
if (!fileName || fileName === '' || fileName === 'undefined' || fileName === 'null') {
|
255
|
+
return _DEFAULT_INLINE_IMAGE_FILE_NAME;
|
225
256
|
}
|
226
|
-
|
227
|
-
cancelInlineImageUpload(imageId, imageUpload, SEND_BOX_UPLOADS_KEY_VALUE, handleSendBoxInlineImageUploadAction, adapter);
|
257
|
+
return fileName;
|
228
258
|
};
|
229
259
|
//# sourceMappingURL=ImageUploadUtils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ImageUploadUtils.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,gEAAgE;AAChE,OAAO,EAAoB,0BAA0B,EAAwB,MAAM,kCAAkC,CAAC;AACtH,gEAAgE;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAOpE,gEAAgE;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,gEAAgE;AAChE,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAE3C,gEAAgE;AAChE,MAAM,aAAa,GAAG,CACpB,QAAgC,EAChC,OAAkF,EAC/D,EAAE;IACrB,gCAAgC;IAChC,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAErD,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE;QACzB,eAAe,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC,EAAE,OAAO,CAAC,CAAC;IAEZ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,kCAChC,OAAO,KACV,MAAM,EAAE,eAAe,CAAC,MAAM,IAC9B,CAAC;IACH,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,gEAAgE;AAChE;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAO,KAAa,EAA6B,EAAE;IACnF,IAAI,KAA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,CAAC;IACD,MAAM,WAAW,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;IAE1G,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,oCAAoC,EAAE,OAAO,CAAC,CAAC;AAC1G,CAAC,CAAC;AAEF,gEAAgE;AAChE;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,CACxD,OAAe,EACf,yBAAyE,EACzE,OAAoB,EACpB,oCAA4D,EACtD,EAAE;IACR,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAC/B,OAAO;IACT,CAAC;IACD,MAAM,WAAW,GAAG,yBAAyB,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAC5E,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,OAAO,CAC3C,CAAC;IAEF,uBAAuB,CACrB,OAAO,EACP,WAAW,EACX,0BAA0B,EAC1B,oCAAoC,EACpC,OAAO,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentUpload, AttachmentUploadActionType, AttachmentUploadTask } from '../file-sharing/AttachmentUpload';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { SEND_BOX_UPLOADS_KEY_VALUE } from '../../common/constants';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { ChatAdapter } from '../adapter/ChatAdapter';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { Dispatch } from 'react';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { ImageActions } from './ImageUploadReducer';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { nanoid } from 'nanoid';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { ChatCompositeStrings } from '../Strings';\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst MAX_INLINE_IMAGE_UPLOAD_SIZE_MB = 20;\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst fetchBlobData = async (\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\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @private\n */\nexport const getInlineImageData = async (image: string): Promise<Blob | undefined> => {\n if (image.startsWith('blob') || image.startsWith('http')) {\n try {\n const res = await fetchBlobData(image, { abortController: new AbortController() });\n const blobImage = await res.blob();\n return blobImage;\n } catch (error) {\n console.error('Error fetching image data', error);\n return;\n }\n }\n return;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getEditBoxMessagesInlineImages = (\n editBoxInlineImageUploads: Record<string, AttachmentUpload[]> | undefined\n): Record<string, AttachmentMetadataInProgress[]> | undefined => {\n if (!editBoxInlineImageUploads) {\n return;\n }\n const messageIds = Object.keys(editBoxInlineImageUploads || {});\n const messagesInlineImages: Record<string, AttachmentMetadataInProgress[]> = {};\n messageIds.map((messageId) => {\n const messageUploads = editBoxInlineImageUploads[messageId].map((upload) => {\n return upload.metadata;\n });\n messagesInlineImages[messageId] = messageUploads;\n });\n return messagesInlineImages;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getSendBoxInlineImages = (\n sendBoxInlineImageUploads: Record<string, AttachmentUpload[]> | undefined\n): AttachmentMetadataInProgress[] | undefined => {\n if (!sendBoxInlineImageUploads) {\n return;\n }\n return sendBoxInlineImageUploads[SEND_BOX_UPLOADS_KEY_VALUE]?.map((upload) => upload.metadata);\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst inlineImageUploadHandler = async (\n uploadTasks: AttachmentUpload[],\n adapter: ChatAdapter,\n strings: ChatCompositeStrings\n): Promise<void> => {\n for (const task of uploadTasks) {\n const uploadTask = task as AttachmentUploadTask;\n const image: Blob | undefined = uploadTask.image;\n if (!image) {\n uploadTask.notifyUploadFailed(strings.uploadImageDataNotProvided);\n continue;\n }\n if (image && image.size > MAX_INLINE_IMAGE_UPLOAD_SIZE_MB * 1024 * 1024) {\n uploadTask.notifyUploadFailed(\n strings.uploadImageIsTooLarge.replace('{maxImageSize}', `${MAX_INLINE_IMAGE_UPLOAD_SIZE_MB}`)\n );\n continue;\n }\n\n const SUPPORTED_FILES: Array<string> = ['jpg', 'jpeg', 'png', 'gif', 'heic', 'webp'];\n const imageExtension = task.metadata?.name.split('.').pop() ?? '';\n if (!SUPPORTED_FILES.includes(imageExtension)) {\n uploadTask.notifyUploadFailed(\n strings.uploadImageExtensionIsNotAllowed.replace('{imageExtension}', imageExtension)\n );\n continue;\n }\n\n try {\n const response = await adapter.uploadImage(image, task.metadata?.name);\n uploadTask.notifyUploadCompleted(response.id, task.metadata.url || '');\n } catch (error) {\n console.error(error);\n uploadTask.notifyUploadFailed(strings.uploadImageFailed);\n }\n }\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst generateUploadTask = async (\n image: string,\n fileName: string,\n messageId: string,\n inlineImageUploadActionHandler: Dispatch<ImageActions>\n): Promise<AttachmentUpload | undefined> => {\n const imageData = await getInlineImageData(image);\n if (!imageData) {\n return;\n }\n const taskId = nanoid();\n const uploadTask: AttachmentUpload = {\n image: imageData,\n taskId,\n metadata: {\n id: taskId,\n name: fileName,\n url: image,\n progress: 0\n },\n notifyUploadProgressChanged: (value: number) => {\n inlineImageUploadActionHandler({\n type: AttachmentUploadActionType.Progress,\n taskId,\n progress: value,\n messageId\n });\n },\n notifyUploadCompleted: (id: string, url: string) => {\n inlineImageUploadActionHandler({\n type: AttachmentUploadActionType.Completed,\n taskId,\n id,\n url,\n messageId\n });\n },\n notifyUploadFailed: (message: string) => {\n inlineImageUploadActionHandler({ type: AttachmentUploadActionType.Failed, taskId, message, messageId });\n // remove the failed upload task when error banner is auto dismissed after 10 seconds\n // so the banner won't be shown again on UI re-rendering.\n setTimeout(() => {\n inlineImageUploadActionHandler({ type: AttachmentUploadActionType.Remove, id: taskId, messageId });\n }, 10 * 1000);\n }\n };\n return uploadTask;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const onInsertInlineImageForEditBox = async (\n image: string,\n fileName: string,\n messageId: string,\n adapter: ChatAdapter,\n handleEditBoxInlineImageUploadAction: Dispatch<ImageActions>,\n chatCompositeStrings: ChatCompositeStrings\n): Promise<void> => {\n const uploadTask: AttachmentUpload | undefined = await generateUploadTask(\n image,\n fileName,\n messageId,\n handleEditBoxInlineImageUploadAction\n );\n if (!uploadTask) {\n return;\n }\n\n handleEditBoxInlineImageUploadAction({\n type: AttachmentUploadActionType.Set,\n newUploads: [uploadTask],\n messageId\n });\n inlineImageUploadHandler([uploadTask], adapter, chatCompositeStrings);\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const onInsertInlineImageForSendBox = async (\n image: string,\n fileName: string,\n adapter: ChatAdapter,\n handleSendBoxInlineImageUploadAction: Dispatch<ImageActions>,\n chatCompositeStrings: ChatCompositeStrings\n): Promise<void> => {\n const uploadTask: AttachmentUpload | undefined = await generateUploadTask(\n image,\n fileName,\n SEND_BOX_UPLOADS_KEY_VALUE,\n handleSendBoxInlineImageUploadAction\n );\n\n if (!uploadTask) {\n return;\n }\n\n handleSendBoxInlineImageUploadAction({\n type: AttachmentUploadActionType.Set,\n newUploads: [uploadTask],\n messageId: SEND_BOX_UPLOADS_KEY_VALUE\n });\n inlineImageUploadHandler([uploadTask], adapter, chatCompositeStrings);\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const cancelInlineImageUpload = (\n imageId: string,\n imageUpload: AttachmentUpload | undefined,\n messageId: string,\n inlineImageUploadActionHandler: Dispatch<ImageActions>,\n adapter: ChatAdapter\n): void => {\n if (!imageUpload || !imageUpload?.metadata.id) {\n return;\n }\n\n inlineImageUploadActionHandler({\n type: AttachmentUploadActionType.Remove,\n id: imageUpload?.metadata.id,\n messageId\n });\n // TODO: remove local blob\n if (imageUpload?.metadata.progress === 1) {\n try {\n adapter.deleteImage(imageId);\n } catch (error) {\n console.error(error);\n }\n }\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const onCancelInlineImageUploadHandlerForEditBox = (\n imageId: string,\n messageId: string,\n editBoxInlineImageUploads: Record<string, AttachmentUpload[]> | undefined,\n adapter: ChatAdapter,\n handleEditBoxInlineImageUploadAction: Dispatch<ImageActions>\n): void => {\n if (!editBoxInlineImageUploads) {\n return;\n }\n const imageUpload = editBoxInlineImageUploads[messageId].find((upload) => upload.metadata.id === imageId);\n\n cancelInlineImageUpload(imageId, imageUpload, messageId, handleEditBoxInlineImageUploadAction, adapter);\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const onCancelInlineImageUploadHandlerForSendBox = (\n imageId: string,\n sendBoxInlineImageUploads: Record<string, AttachmentUpload[]> | undefined,\n adapter: ChatAdapter,\n handleSendBoxInlineImageUploadAction: Dispatch<ImageActions>\n): void => {\n if (!sendBoxInlineImageUploads) {\n return;\n }\n const imageUpload = sendBoxInlineImageUploads[SEND_BOX_UPLOADS_KEY_VALUE].find(\n (upload) => upload.metadata.id === imageId\n );\n\n cancelInlineImageUpload(\n imageId,\n imageUpload,\n SEND_BOX_UPLOADS_KEY_VALUE,\n handleSendBoxInlineImageUploadAction,\n adapter\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"ImageUploadUtils.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,gEAAgE;AAChE,OAAO,EAAgC,2CAA2C,EAAE,yCAAgC;AACpH,gEAAgE;AAChE,OAAO,EAAoB,0BAA0B,EAAwB,MAAM,kCAAkC,CAAC;AACtH,gEAAgE;AAChE,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAOrG,gEAAgE;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,gEAAgE;AAChE,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAE3C,gEAAgE;AAChE,MAAM,aAAa,GAAG,CACpB,QAAgC,EAChC,OAAkF,EAC/D,EAAE;IACrB,gCAAgC;IAChC,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAErD,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE;QACzB,eAAe,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC,EAAE,OAAO,CAAC,CAAC;IAEZ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,kCAChC,OAAO,KACV,MAAM,EAAE,eAAe,CAAC,MAAM,IAC9B,CAAC;IACH,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,gEAAgE;AAChE;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAO,KAAa,EAA6B,EAAE;IACnF,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,aAAa,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,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CACtG,CAAC;QAEF,IAAI,iBAAiB,EAAE,CAAC;YACtB,+HAA+H;YAC/H,GAAG,CAAC,EAAE,GAAG,MAAA,iBAAiB,CAAC,QAAQ,CAAC,GAAG,mCAAI,GAAG,CAAC,EAAE,CAAC;YAClD,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC;QACf,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;IAElC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,gEAAgE;AAChE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,eAAuC,EAAU,EAAE;IAChG,MAAM,QAAQ,GAAG,eAAe,CAAC,2CAA2C,CAAC,CAAC;IAC9E,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,EAAE,IAAI,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACpF,OAAO,+BAA+B,CAAC;IACzC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress, _IMAGE_ATTRIBUTE_INLINE_IMAGE_FILE_NAME_KEY } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentUpload, AttachmentUploadActionType, AttachmentUploadTask } from '../file-sharing/AttachmentUpload';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { _DEFAULT_INLINE_IMAGE_FILE_NAME, SEND_BOX_UPLOADS_KEY_VALUE } from '../../common/constants';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { ChatAdapter } from '../adapter/ChatAdapter';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { Dispatch } from 'react';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { ImageActions } from './ImageUploadReducer';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { nanoid } from 'nanoid';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { ChatCompositeStrings } from '../Strings';\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst MAX_INLINE_IMAGE_UPLOAD_SIZE_MB = 20;\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst fetchBlobData = async (\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\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @private\n */\nexport const getInlineImageData = async (image: string): Promise<Blob | undefined> => {\n if (image.startsWith('blob') || image.startsWith('http')) {\n try {\n const res = await fetchBlobData(image, { abortController: new AbortController() });\n const blobImage = await res.blob();\n return blobImage;\n } catch (error) {\n console.error('Error fetching image data', error);\n return;\n }\n }\n return;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getEditBoxMessagesInlineImages = (\n editBoxInlineImageUploads: Record<string, AttachmentUpload[]> | undefined\n): Record<string, AttachmentMetadataInProgress[]> | undefined => {\n if (!editBoxInlineImageUploads) {\n return;\n }\n const messageIds = Object.keys(editBoxInlineImageUploads || {});\n const messagesInlineImagesWithProgress: Record<string, AttachmentMetadataInProgress[]> = {};\n messageIds.map((messageId) => {\n const messageUploads = editBoxInlineImageUploads[messageId].map((upload) => {\n return upload.metadata;\n });\n messagesInlineImagesWithProgress[messageId] = messageUploads;\n });\n return messagesInlineImagesWithProgress;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getSendBoxInlineImages = (\n sendBoxInlineImageUploads: Record<string, AttachmentUpload[]> | undefined\n): AttachmentMetadataInProgress[] | undefined => {\n if (!sendBoxInlineImageUploads) {\n return;\n }\n return sendBoxInlineImageUploads[SEND_BOX_UPLOADS_KEY_VALUE]?.map((upload) => upload.metadata);\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst inlineImageUploadHandler = async (\n uploadTasks: AttachmentUpload[],\n adapter: ChatAdapter,\n strings: ChatCompositeStrings\n): Promise<void> => {\n for (const task of uploadTasks) {\n const uploadTask = task as AttachmentUploadTask;\n const image: Blob | undefined = uploadTask.image;\n if (!image) {\n uploadTask.notifyUploadFailed(strings.uploadImageDataNotProvided);\n continue;\n }\n if (image && image.size > MAX_INLINE_IMAGE_UPLOAD_SIZE_MB * 1024 * 1024) {\n uploadTask.notifyUploadFailed(\n strings.uploadImageIsTooLarge.replace('{maxImageSize}', `${MAX_INLINE_IMAGE_UPLOAD_SIZE_MB}`)\n );\n continue;\n }\n\n const SUPPORTED_FILES: Array<string> = ['jpg', 'jpeg', 'png', 'gif', 'heic', 'webp'];\n const imageExtension = task.metadata?.name.split('.').pop() ?? '';\n if (!SUPPORTED_FILES.includes(imageExtension)) {\n uploadTask.notifyUploadFailed(\n strings.uploadImageExtensionIsNotAllowed.replace('{imageExtension}', imageExtension)\n );\n continue;\n }\n\n try {\n const response = await adapter.uploadImage(image, task.metadata?.name);\n // Use response id as the image src because we need to keep the original image id as a reference to find the image.\n // Also the html content we send to ChatSDK does not need image src,\n // it only need the response id to match the uploaded image, url is not needed.\n uploadTask.notifyUploadCompleted(task.metadata.id, response.id);\n } catch (error) {\n console.error(error);\n uploadTask.notifyUploadFailed(strings.uploadImageFailed);\n }\n }\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst generateUploadTask = async (\n imageAttributes: Record<string, string>,\n fileName: string,\n messageId: string,\n inlineImageUploadActionHandler: Dispatch<ImageActions>\n): Promise<AttachmentUpload | undefined> => {\n const imageData = await getInlineImageData(imageAttributes.src);\n if (!imageData) {\n return;\n }\n const taskId = nanoid();\n const uploadTask: AttachmentUpload = {\n image: imageData,\n taskId,\n metadata: {\n id: imageAttributes.id,\n name: fileName,\n url: imageAttributes.src,\n progress: 0\n },\n notifyUploadProgressChanged: (value: number) => {\n inlineImageUploadActionHandler({\n type: AttachmentUploadActionType.Progress,\n taskId,\n progress: value,\n messageId\n });\n },\n notifyUploadCompleted: (id: string, url: string) => {\n inlineImageUploadActionHandler({\n type: AttachmentUploadActionType.Completed,\n taskId,\n id,\n url,\n messageId\n });\n },\n notifyUploadFailed: (message: string) => {\n inlineImageUploadActionHandler({ type: AttachmentUploadActionType.Failed, taskId, message, messageId });\n // remove the failed upload task when error banner is auto dismissed after 10 seconds\n // so the banner won't be shown again on UI re-rendering.\n setTimeout(() => {\n inlineImageUploadActionHandler({ type: AttachmentUploadActionType.Remove, id: taskId, messageId });\n }, 10 * 1000);\n }\n };\n return uploadTask;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const onInsertInlineImageForEditBox = async (\n imageAttributes: Record<string, string>,\n fileName: string,\n messageId: string,\n adapter: ChatAdapter,\n handleEditBoxInlineImageUploadAction: Dispatch<ImageActions>,\n chatCompositeStrings: ChatCompositeStrings\n): Promise<void> => {\n const uploadTask: AttachmentUpload | undefined = await generateUploadTask(\n imageAttributes,\n fileName,\n messageId,\n handleEditBoxInlineImageUploadAction\n );\n if (!uploadTask) {\n return;\n }\n\n handleEditBoxInlineImageUploadAction({\n type: AttachmentUploadActionType.Set,\n newUploads: [uploadTask],\n messageId\n });\n inlineImageUploadHandler([uploadTask], adapter, chatCompositeStrings);\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const onInsertInlineImageForSendBox = async (\n imageAttributes: Record<string, string>,\n fileName: string,\n adapter: ChatAdapter,\n handleSendBoxInlineImageUploadAction: Dispatch<ImageActions>,\n chatCompositeStrings: ChatCompositeStrings\n): Promise<void> => {\n const uploadTask: AttachmentUpload | undefined = await generateUploadTask(\n imageAttributes,\n fileName,\n SEND_BOX_UPLOADS_KEY_VALUE,\n handleSendBoxInlineImageUploadAction\n );\n\n if (!uploadTask) {\n return;\n }\n\n handleSendBoxInlineImageUploadAction({\n type: AttachmentUploadActionType.Set,\n newUploads: [uploadTask],\n messageId: SEND_BOX_UPLOADS_KEY_VALUE\n });\n inlineImageUploadHandler([uploadTask], adapter, chatCompositeStrings);\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const cancelInlineImageUpload = (\n imageAttributes: Record<string, string>,\n imageUploads: Record<string, AttachmentUpload[]> | undefined,\n messageId: string,\n inlineImageUploadActionHandler: Dispatch<ImageActions>,\n adapter: ChatAdapter\n): void => {\n if (!imageUploads || !imageUploads[messageId]) {\n deleteExistingInlineImageForEditBox(imageAttributes.id, messageId, adapter);\n return;\n }\n const imageUpload = imageUploads[messageId].find((upload) => upload.metadata.id === imageAttributes.id);\n\n if (!imageUpload || !imageUpload?.metadata.id) {\n deleteExistingInlineImageForEditBox(imageAttributes.id, messageId, adapter);\n return;\n }\n\n inlineImageUploadActionHandler({\n type: AttachmentUploadActionType.Remove,\n id: imageUpload?.metadata.id,\n messageId\n });\n\n if (imageUpload?.metadata.progress === 1) {\n deleteInlineImageFromServer(imageUpload?.metadata.id, adapter);\n }\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst deleteInlineImageFromServer = (imageId: string, adapter: ChatAdapter): void => {\n try {\n adapter.deleteImage(imageId);\n } catch (error) {\n console.error(error);\n }\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n// This function is used to delete the inline image that existed before editing starts\nconst deleteExistingInlineImageForEditBox = (imageId: string, messageId: string, adapter: ChatAdapter): void => {\n messageId !== SEND_BOX_UPLOADS_KEY_VALUE && deleteInlineImageFromServer(imageId, adapter);\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const updateContentStringWithUploadedInlineImages = (\n content: string,\n imageUploads: Record<string, AttachmentUpload[]> | undefined,\n messageId: string = SEND_BOX_UPLOADS_KEY_VALUE\n): string => {\n if (!imageUploads || !imageUploads[messageId]) {\n return content;\n }\n const messageUploads = imageUploads[messageId];\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach((img) => {\n const uploadInlineImage = messageUploads.find(\n (upload) => !upload.metadata.error && upload.metadata.progress === 1 && upload.metadata.id === img.id\n );\n\n if (uploadInlineImage) {\n // ChatSDK uses the respond id provided by the upload response. We store the response id in the image src attribute previously.\n img.id = uploadInlineImage.metadata.url ?? img.id;\n img.src = '';\n }\n });\n content = document.body.innerHTML;\n\n return content;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getImageFileNameFromAttributes = (imageAttributes: Record<string, string>): string => {\n const fileName = imageAttributes[_IMAGE_ATTRIBUTE_INLINE_IMAGE_FILE_NAME_KEY];\n if (!fileName || fileName === '' || fileName === 'undefined' || fileName === 'null') {\n return _DEFAULT_INLINE_IMAGE_FILE_NAME;\n }\n return fileName;\n};\n"]}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { SendBoxStylesProps } from "../../../../react-components/src";
|
3
|
-
import {
|
4
|
-
import { RichTextSendBoxProps } from "../../../../react-components/src";
|
3
|
+
import { RichTextSendBoxProps, RichTextEditorOptions } from "../../../../react-components/src";
|
5
4
|
import { AttachmentMetadataInProgress, MessageOptions } from "../../../../acs-ui-common/src";
|
6
5
|
/**
|
7
6
|
* @private
|
@@ -13,6 +12,37 @@ import { AttachmentMetadataInProgress, MessageOptions } from "../../../../acs-ui
|
|
13
12
|
export declare const loadRichTextSendBox: () => Promise<{
|
14
13
|
default: React.ComponentType<RichTextSendBoxProps>;
|
15
14
|
}>;
|
15
|
+
/**
|
16
|
+
* Options for the rich text editor send box configuration.
|
17
|
+
*
|
18
|
+
* @internal
|
19
|
+
*/
|
20
|
+
export interface RichTextSendBoxOptions extends RichTextEditorOptions {
|
21
|
+
/**
|
22
|
+
* Optional callback to handle an inline image that's inserted in the rich text editor.
|
23
|
+
* When not provided, pasting images into rich text editor will be disabled.
|
24
|
+
* @param imageAttributes - attributes of the image such as id, src, style, etc.
|
25
|
+
* It also contains the image file name which can be accessed through imageAttributes['data-image-file-name']
|
26
|
+
*/
|
27
|
+
onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;
|
28
|
+
/**
|
29
|
+
* Optional callback invoked after inline image is removed from the UI.
|
30
|
+
* @param imageAttributes - attributes of the image such as id, src, style, etc.
|
31
|
+
* It also contains the image file name which can be accessed through imageAttributes['data-image-file-name'].
|
32
|
+
* Note that if the src attribute is a local blob url, it has been revoked at this point.
|
33
|
+
*/
|
34
|
+
onRemoveInlineImage?: (imageAttributes: Record<string, string>) => void;
|
35
|
+
/**
|
36
|
+
* Optional Array of type {@link AttachmentMetadataInProgress}
|
37
|
+
* to render the errorBar for inline images inserted in the RichTextSendBox when:
|
38
|
+
* - there is an error provided in the inlineImagesWithProgress
|
39
|
+
* - progress is less than 1 when the send button is clicked
|
40
|
+
* - content html string is longer than the max allowed length.
|
41
|
+
* (Note that the id and the url prop of the inlineImagesWithProgress will be used as the id and src attribute of the content html
|
42
|
+
* when calculating the content length, only for the purpose of displaying the content length overflow error.)
|
43
|
+
*/
|
44
|
+
inlineImagesWithProgress?: AttachmentMetadataInProgress[];
|
45
|
+
}
|
16
46
|
/**
|
17
47
|
* @private
|
18
48
|
*/
|
@@ -27,7 +27,7 @@ export const SendBoxPicker = (props) => {
|
|
27
27
|
/* @conditional-compile-remove(rich-text-editor-composite-support) */
|
28
28
|
const { richTextEditorOptions } = props;
|
29
29
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
30
|
-
const { onPaste, onInsertInlineImage,
|
30
|
+
const { onPaste, onInsertInlineImage, inlineImagesWithProgress, onRemoveInlineImage } = richTextEditorOptions || {};
|
31
31
|
const sendBoxProps = usePropsFor(SendBox);
|
32
32
|
/* @conditional-compile-remove(rich-text-editor-composite-support) */
|
33
33
|
const isRichTextEditorEnabled = useMemo(() => {
|
@@ -44,9 +44,9 @@ export const SendBoxPicker = (props) => {
|
|
44
44
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
45
45
|
onInsertInlineImage: onInsertInlineImage,
|
46
46
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
47
|
-
|
47
|
+
inlineImagesWithProgress: inlineImagesWithProgress,
|
48
48
|
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
49
|
-
|
49
|
+
onRemoveInlineImage: onRemoveInlineImage })))));
|
50
50
|
}
|
51
51
|
return sendBox;
|
52
52
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SendBoxPicker.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/common/SendBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,EAAsB,yCAAmC;
|
1
|
+
{"version":3,"file":"SendBoxPicker.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/common/SendBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,EAAsB,yCAAmC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,qEAAqE;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,qEAAqE;AACrE,OAAO,EAAE,cAAc,EAA+C,yCAAmC;AAIzG,qEAAqE;AACrE;;GAEG;AACH,MAAM,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAA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OAAO;oBAChB,gEAAgE;oBAChE,mBAAmB,EAAE,mBAAmB;oBACxC,gEAAgE;oBAChE,wBAAwB,EAAE,wBAAwB;oBAClD,gEAAgE;oBAChE,mBAAmB,EAAE,mBAAmB,IACxC,CACO,CACI,CAClB,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\nimport { SendBox, SendBoxStylesProps } from '@internal/react-components';\nimport { usePropsFor } from '../ChatComposite/hooks/usePropsFor';\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\nimport { Suspense } from 'react';\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\nimport { _ErrorBoundary, RichTextSendBoxProps, RichTextEditorOptions } from '@internal/react-components';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadataInProgress, MessageOptions } from '@internal/acs-ui-common';\n\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\n/**\n * Wrapper for RichTextSendBox component to allow us to use usePropsFor with richTextSendBox with lazy loading\n */\nconst RichTextSendBoxWrapper = React.lazy(() =>\n import('./RichTextSendBoxWrapper').then((module) => ({ default: module.RichTextSendBoxWrapper }))\n);\n\n/**\n * @private\n * Use this function to load RoosterJS dependencies early in the lifecycle.\n * It should be the same import as used for lazy loading.\n *\n/* @conditional-compile-remove(rich-text-editor-composite-support)\n */\nexport const loadRichTextSendBox = (): Promise<{\n default: React.ComponentType<RichTextSendBoxProps>;\n}> => import('./RichTextSendBoxWrapper').then((module) => ({ default: module.RichTextSendBoxWrapper }));\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * Options for the rich text editor send box configuration.\n *\n * @internal\n */\nexport interface RichTextSendBoxOptions extends RichTextEditorOptions {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle an inline image that's inserted in the rich text editor.\n * When not provided, pasting images into rich text editor will be disabled.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name']\n */\n onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback invoked after inline image is removed from the UI.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name'].\n * Note that if the src attribute is a local blob url, it has been revoked at this point.\n */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional Array of type {@link AttachmentMetadataInProgress}\n * to render the errorBar for inline images inserted in the RichTextSendBox when:\n * - there is an error provided in the inlineImagesWithProgress\n * - progress is less than 1 when the send button is clicked\n * - content html string is longer than the max allowed length.\n * (Note that the id and the url prop of the inlineImagesWithProgress will be used as the id and src attribute of the content html\n * when calculating the content length, only for the purpose of displaying the content length overflow error.)\n */\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n}\n/**\n * @private\n */\nexport type SendBoxPickerProps = {\n styles?: SendBoxStylesProps;\n autoFocus?: 'sendBoxTextField';\n onSendMessage: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */ options?: MessageOptions\n ) => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n richTextEditorOptions?: RichTextSendBoxOptions;\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments?: AttachmentMetadataInProgress[];\n /* @conditional-compile-remove(file-sharing-acs) */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n};\n\n/**\n * @private\n */\nexport const SendBoxPicker = (props: SendBoxPickerProps): JSX.Element => {\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n const { richTextEditorOptions } = props;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const { onPaste, onInsertInlineImage, inlineImagesWithProgress, onRemoveInlineImage } = richTextEditorOptions || {};\n\n const sendBoxProps = usePropsFor(SendBox);\n\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n const isRichTextEditorEnabled = useMemo(() => {\n return richTextEditorOptions !== undefined;\n }, [richTextEditorOptions]);\n\n const sendBox = useMemo(() => <SendBox {...sendBoxProps} {...props} />, [props, sendBoxProps]);\n\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n if (isRichTextEditorEnabled) {\n return (\n <_ErrorBoundary fallback={sendBox}>\n <Suspense fallback={sendBox}>\n <RichTextSendBoxWrapper\n {...props}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={onInsertInlineImage}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress={inlineImagesWithProgress}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage={onRemoveInlineImage}\n />\n </Suspense>\n </_ErrorBoundary>\n );\n }\n return sendBox;\n};\n"]}
|
@@ -16,4 +16,9 @@ export declare const CHAT_CONTAINER_MIN_WIDTH_REM = 17.5;
|
|
16
16
|
* @private
|
17
17
|
*/
|
18
18
|
export declare const SEND_BOX_UPLOADS_KEY_VALUE = "send-box";
|
19
|
+
/**
|
20
|
+
* Default rich text editor inline image file name
|
21
|
+
* @internal
|
22
|
+
*/
|
23
|
+
export declare const _DEFAULT_INLINE_IMAGE_FILE_NAME = "image.png";
|
19
24
|
//# sourceMappingURL=constants.d.ts.map
|
@@ -18,4 +18,10 @@ export const CHAT_CONTAINER_MIN_WIDTH_REM = 17.5;
|
|
18
18
|
* @private
|
19
19
|
*/
|
20
20
|
export const SEND_BOX_UPLOADS_KEY_VALUE = 'send-box';
|
21
|
+
/* @conditional-compile-remove(rich-text-editor-image-upload) */
|
22
|
+
/**
|
23
|
+
* Default rich text editor inline image file name
|
24
|
+
* @internal
|
25
|
+
*/
|
26
|
+
export const _DEFAULT_INLINE_IMAGE_FILE_NAME = 'image.png';
|
21
27
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/common/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,yHAAyH,CAAC;AAE5H;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @private\n */\nexport const UNSUPPORTED_CHAT_THREAD_TYPE = ['@thread.tacv2', '@thread.skype'];\n\n/**\n * @private\n */\nexport const TEAMS_LIMITATION_LEARN_MORE =\n 'https://learn.microsoft.com/en-us/azure/communication-services/concepts/join-teams-meeting#limitations-and-known-issues';\n\n/**\n * @remarks\n * This value is publicly documented in the ChatComposite API documentation.\n * Changing this value will require updating the API documentation.\n */\nexport const CHAT_CONTAINER_MIN_WIDTH_REM = 17.5;\n\n/**\n * @private\n */\nexport const SEND_BOX_UPLOADS_KEY_VALUE = 'send-box';\n"]}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/common/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,yHAAyH,CAAC;AAE5H;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAErD,gEAAgE;AAChE;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @private\n */\nexport const UNSUPPORTED_CHAT_THREAD_TYPE = ['@thread.tacv2', '@thread.skype'];\n\n/**\n * @private\n */\nexport const TEAMS_LIMITATION_LEARN_MORE =\n 'https://learn.microsoft.com/en-us/azure/communication-services/concepts/join-teams-meeting#limitations-and-known-issues';\n\n/**\n * @remarks\n * This value is publicly documented in the ChatComposite API documentation.\n * Changing this value will require updating the API documentation.\n */\nexport const CHAT_CONTAINER_MIN_WIDTH_REM = 17.5;\n\n/**\n * @private\n */\nexport const SEND_BOX_UPLOADS_KEY_VALUE = 'send-box';\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * Default rich text editor inline image file name\n * @internal\n */\nexport const _DEFAULT_INLINE_IMAGE_FILE_NAME = 'image.png';\n"]}
|
package/dist/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@azure/communication-react",
|
3
|
-
"version": "1.19.0-alpha-
|
3
|
+
"version": "1.19.0-alpha-202408020014",
|
4
4
|
"sideEffects": false,
|
5
5
|
"description": "React library for building modern communication user experiences utilizing Azure Communication Services",
|
6
6
|
"keywords": [
|
@@ -26,14 +26,14 @@
|
|
26
26
|
"@azure/communication-common": "^2.3.1",
|
27
27
|
"@azure/core-paging": "^1.5.0",
|
28
28
|
"@azure/logger": "^1.0.4",
|
29
|
-
"@fluentui/react-components": "^9.54.
|
30
|
-
"@fluentui/react": "^8.
|
29
|
+
"@fluentui/react-components": "^9.54.7",
|
30
|
+
"@fluentui/react": "^8.120.0",
|
31
31
|
"@fluentui/react-file-type-icons": "8.11.18",
|
32
32
|
"@fluentui/react-hooks": "^8.8.10",
|
33
|
-
"@fluentui/react-icons": "^2.0.
|
33
|
+
"@fluentui/react-icons": "^2.0.252",
|
34
34
|
"@fluentui/react-window-provider": "^2.2.27",
|
35
35
|
"@fluentui-contrib/react-chat": "0.1.10",
|
36
|
-
"@griffel/react": "^1.5.
|
36
|
+
"@griffel/react": "^1.5.25",
|
37
37
|
"copy-to-clipboard": "^3.3.1",
|
38
38
|
"dompurify": "^3.1.6",
|
39
39
|
"events": "^3.3.0",
|
@@ -50,11 +50,11 @@
|
|
50
50
|
"roosterjs-content-model-plugins": "^9.8.1",
|
51
51
|
"roosterjs-content-model-types": "^9.8.1",
|
52
52
|
"textarea-caret-ts": "^4.1.1",
|
53
|
-
"use-debounce": "^10.0.
|
53
|
+
"use-debounce": "^10.0.2",
|
54
54
|
"uuid": "^9.0.0"
|
55
55
|
},
|
56
56
|
"peerDependencies": {
|
57
|
-
"@azure/communication-calling": "1.28.1-beta.
|
57
|
+
"@azure/communication-calling": "1.28.1-beta.2",
|
58
58
|
"@azure/communication-calling-effects": "1.0.1",
|
59
59
|
"@azure/communication-chat": "1.6.0-beta.3",
|
60
60
|
"@types/react": ">=16.8.0 <19.0.0",
|
package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-CsHqT8dY.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponentAsRichTextEditBox-CsHqT8dY.js","sources":["../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.tsx"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { useTheme } from '../../../theming';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { useReducer } from 'react';\nimport { editBoxWidthStyles, richTextEditBoxActionButtonIcon } from '../../styles/EditBox.styles';\nimport { InputBoxButton } from '../../InputBoxButton';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { useChatMyMessageStyles } from '../../styles/MessageThread.styles';\nimport { ChatMessage } from '../../../types';\nimport { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { useChatMessageRichTextEditContainerStyles } from '../../styles/ChatMessageComponent.styles';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport {\n cancelInlineImageUpload,\n hasIncompleteAttachmentUploads,\n insertImagesToContentString,\n isAttachmentUploadCompleted,\n removeBrokenImageContentAndClearImageSizeStyles\n} from '../../utils/SendBoxUtils';\nimport {\n getMessageState,\n onRenderCancelIcon,\n onRenderSubmitIcon\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport {\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata,\n doesMessageContainMultipleAttachments\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport { RichTextEditorComponentRef } from '../../RichTextEditor/RichTextEditor';\nimport { RichTextInputBoxComponent } from '../../RichTextEditor/RichTextInputBoxComponent';\nimport { editBoxRichTextEditorStyle, richTextActionButtonsStyle } from '../../styles/RichTextEditor.styles';\nimport { RichTextSendBoxErrors } from '../../RichTextEditor/RichTextSendBoxErrors';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { FluentV9ThemeProvider } from '../../../theming/FluentV9ThemeProvider';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { attachmentUploadCardsStyles } from '../../styles/SendBox.styles';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { SendBoxErrorBarError, SendBoxErrorBarType } from '../../SendBoxErrorBar';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { BROKEN_IMAGE_SVG_DATA } from '../../styles/Common.style';\n\n/** @private */\nexport type ChatMessageComponentAsRichTextEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onCancelInlineImageUpload?: (imageId: string, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageUrl: string, imageFileName: string, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImages?: AttachmentMetadataInProgress[];\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsRichTextEditBox = (\n props: ChatMessageComponentAsRichTextEditBoxProps\n): JSX.Element => {\n const {\n onCancel,\n onSubmit,\n strings,\n message,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImages,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onCancelInlineImageUpload\n } = props;\n\n const initialContent = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const content = message.content;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n // The broken image element is a div element with all the attributes of the original image element.\n // We need to convert it to a img element so the Rooster knows how to render it.\n // And we need to copy over all the attributes such as id, width, etc.\n // which is needed for sending the message with the images correctly.\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n document.querySelectorAll('.broken-image-wrapper').forEach((brokenImage) => {\n const imageElement = document.createElement('img');\n const attributes = brokenImage.attributes;\n for (const attribute of attributes) {\n imageElement.setAttribute(attribute.name, attribute.value);\n }\n\n imageElement.src = BROKEN_IMAGE_SVG_DATA;\n imageElement.style.width = '3rem';\n imageElement.style.height = '3rem';\n brokenImage.parentElement?.replaceChild(imageElement, brokenImage);\n });\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n return document.body.innerHTML;\n return message.content;\n }, [message]);\n\n const [textValue, setTextValue] = useState<string>(initialContent || '');\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const [attachmentMetadata, handleAttachmentAction] = useReducer(\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata(message) ?? []\n );\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n const editTextFieldRef = React.useRef<RichTextEditorComponentRef>(null);\n const theme = useTheme();\n const messageState = useMemo(() => {\n return getMessageState(textValue, /* @conditional-compile-remove(file-sharing-acs) */ attachmentMetadata ?? []);\n }, [/* @conditional-compile-remove(file-sharing-acs) */ attachmentMetadata, textValue]);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const imageUploadErrorMessage = useMemo(() => {\n return inlineImages?.filter((image) => image.error).pop()?.error?.message;\n }, [inlineImages]);\n\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageRichTextEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n const locale = useLocale().strings;\n\n const setText = useCallback((newValue?: string): void => {\n setTextValue(newValue ?? '');\n }, []);\n\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n\n const textTooLongMessage = useMemo(() => {\n return messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n }, [messageState, strings.editBoxTextLimit]);\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(richTextEditBoxActionButtonIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message);\n }, [message]);\n\n const onSubmitHandler = useCallback((): void => {\n if (!submitEnabled) {\n return;\n }\n // Don't send message until all attachments have been uploaded successfully\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setAttachmentUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (hasIncompleteAttachmentUploads(inlineImages)) {\n setAttachmentUploadsPendingError({\n message: strings.imageUploadsPendingError,\n timestamp: Date.now(),\n errorBarType: SendBoxErrorBarType.info\n });\n return;\n }\n\n let content = textValue;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n content = removeBrokenImageContentAndClearImageSizeStyles(content);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (isAttachmentUploadCompleted(inlineImages)) {\n insertImagesToContentString(textValue, inlineImages, (content) => {\n onSubmit(content, /* @conditional-compile-remove(file-sharing-acs) */ attachmentMetadata || []);\n });\n return;\n }\n // it's very important to pass an empty attachment here\n // so when user removes all attachments, UI can reflect it instantly\n // if you set it to undefined, the attachments pre-edited would still be there\n // until edit message event is received\n onSubmit(content, /* @conditional-compile-remove(file-sharing-acs) */ attachmentMetadata || []);\n }, [\n submitEnabled,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImages,\n textValue,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n strings.imageUploadsPendingError,\n onSubmit,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentMetadata\n ]);\n\n const actionButtons = useMemo(() => {\n return (\n <Stack horizontal>\n <InputBoxButton\n className={richTextActionButtonsStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n data-testId={strings.editBoxCancelButton}\n />\n <InputBoxButton\n className={richTextActionButtonsStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n onSubmitHandler();\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n data-testId={strings.editBoxSubmitButton}\n />\n </Stack>\n );\n }, [\n message.messageId,\n onCancel,\n onRenderThemedCancelIcon,\n onRenderThemedSubmitIcon,\n strings.editBoxCancelButton,\n strings.editBoxSubmitButton,\n onSubmitHandler\n ]);\n const richTextLocaleStrings = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor) */\n return { ...locale.richTextSendBox, ...strings };\n return locale.sendBox;\n }, [\n /* @conditional-compile-remove(rich-text-editor) */ locale.richTextSendBox,\n /* @conditional-compile-remove(rich-text-editor) */ strings,\n locale.sendBox\n ]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const onCancelAttachmentUpload = useCallback((attachmentId: string) => {\n // edit box only capable of removing attachments\n // we need to expand attachment actions\n // if we want to support more actions e.g. add\n handleAttachmentAction({ type: 'remove', id: attachmentId });\n }, []);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards\n attachments={attachmentMetadata}\n onCancelAttachmentUpload={onCancelAttachmentUpload}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [attachmentMetadata, onCancelAttachmentUpload, theme]);\n\n const onChangeHandler = useCallback(\n (\n content: string | undefined,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ imageSrcArray?: Array<string>\n ) => {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n cancelInlineImageUpload({\n imageSrcArray,\n inlineImages,\n messageId: message.messageId,\n editBoxOnCancelInlineImageUpload: onCancelInlineImageUpload,\n sendBoxOnCancelInlineImageUpload: undefined\n });\n setText(content);\n },\n [\n setText,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ inlineImages,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ onCancelInlineImageUpload,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ message.messageId\n ]\n );\n\n const getContent = (): JSX.Element => {\n return (\n <Stack className={mergeStyles(editBoxWidthStyles)}>\n <RichTextSendBoxErrors\n textTooLongMessage={textTooLongMessage}\n systemMessage={message.failureReason}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ attachmentUploadsPendingError={\n attachmentUploadsPendingError\n }\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n attachmentProgressError={\n imageUploadErrorMessage\n ? {\n message: imageUploadErrorMessage,\n timestamp: Date.now(),\n errorBarType: SendBoxErrorBarType.error\n }\n : undefined\n }\n />\n <RichTextInputBoxComponent\n placeholderText={strings.editBoxPlaceholderText}\n onChange={onChangeHandler}\n editorComponentRef={editTextFieldRef}\n initialContent={initialContent}\n strings={richTextLocaleStrings}\n disabled={false}\n actionComponents={actionButtons}\n richTextEditorStyleProps={editBoxRichTextEditorStyle}\n isHorizontalLayoutDisabled={true}\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads={onRenderAttachmentUploads}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={\n onInsertInlineImage\n ? (imageUrl: string, imageFileName: string) => {\n onInsertInlineImage(imageUrl, imageFileName, message.messageId);\n }\n : undefined\n }\n />\n </Stack>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: mergeClasses(\n chatMyMessageStyles.root,\n /* @conditional-compile-remove(file-sharing-acs) */\n hasMultipleAttachments ? chatMyMessageStyles.multipleAttachmentsInEditing : undefined\n )\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n\nexport default ChatMessageComponentAsRichTextEditBox;\n"],"names":["useMemo","BROKEN_IMAGE_SVG_DATA","useState","useReducer","attachmentMetadataReducer","getMessageWithAttachmentMetadata","useTheme","getMessageState","useChatMessageRichTextEditContainerStyles","useChatMyMessageStyles","useLocale","useCallback","useEffect","_formatString","MAXIMUM_LENGTH_OF_MESSAGE","mergeStyles","richTextEditBoxActionButtonIcon","onRenderCancelIcon","onRenderSubmitIcon","doesMessageContainMultipleAttachments","hasIncompleteAttachmentUploads","SendBoxErrorBarType","removeBrokenImageContentAndClearImageSizeStyles","isAttachmentUploadCompleted","insertImagesToContentString","Stack","InputBoxButton","richTextActionButtonsStyle","attachmentUploadCardsStyles","FluentV9ThemeProvider","_AttachmentUploadCards","cancelInlineImageUpload","editBoxWidthStyles","RichTextSendBoxErrors","RichTextInputBoxComponent","editBoxRichTextEditorStyle","ChatMyMessage","mergeClasses"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AA2EA;;AAEG;AACU,MAAA,qCAAqC,GAAG,CACnD,KAAiD,KAClC;;AACf,IAAA,MAAM,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO;;IAEP,OAAO;;IAEP,mBAAmB;;IAEnB,YAAY;;IAEZ,yBAAyB,EAC1B,GAAG,KAAK,CAAC;AAEV,IAAA,MAAM,cAAc,GAAGA,aAAO,CAAC,MAAK;;AAElC,QAAA,MAAM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