@microsoft/omnichannel-chat-widget 1.2.2 → 1.2.3-main.fc07b68

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.
@@ -58,7 +58,8 @@ _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
58
58
  _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
59
59
  _defineProperty(Constants, "publicMessageTag", "public");
60
60
  //attachmentMiddleware
61
- _defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"]);
61
+ _defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth", "application/vnd.microsoft.card.video"]);
62
+ _defineProperty(Constants, "adaptiveCardContentTypePrefix", "application/vnd.microsoft.card");
62
63
  _defineProperty(Constants, "maxUploadFileSize", "500000");
63
64
  _defineProperty(Constants, "imageRegex", /(\.)(jpeg|jpg|jiff|png|gif|bmp|webp)$/i);
64
65
  _defineProperty(Constants, "audioMediaRegex", /(\.)(aac|aiff|alac|amr|flac|mp2|mp3|pcm|wav|wma)$/i);
@@ -209,12 +209,17 @@ const createAttachmentMiddleware = enableInlinePlaying => {
209
209
  id: attachmentId,
210
210
  style: atttachmentAdaptiveCardStyles
211
211
  }, next(...args));
212
+ } else if (contentType.startsWith(_Constants.Constants.adaptiveCardContentTypePrefix)) {
213
+ console.warn(`${contentType} adaptive card type is currently not supported.`);
212
214
  }
213
215
  if ((_card$activity$channe = card.activity.channelData) !== null && _card$activity$channe !== void 0 && _card$activity$channe.middlewareData) {
214
216
  attachment.contentUrl = card.activity.channelData.middlewareData[attachment.name];
215
217
  } else if (attachment !== null && attachment !== void 0 && attachment.tempContentUrl) {
216
218
  attachment.contentUrl = attachment.tempContentUrl;
217
219
  }
220
+ if (!attachment.name) {
221
+ return next(...args);
222
+ }
218
223
  const fileExtension = attachment.name.substring(attachment.name.lastIndexOf(".") + 1, attachment.name.length) || attachment.name;
219
224
  const imageExtension = _Constants.Constants.imageRegex.test(attachment.name);
220
225
  const audioExtension = _Constants.Constants.audioMediaRegex.test(attachment.name);
@@ -51,7 +51,8 @@ _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
51
51
  _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
52
52
  _defineProperty(Constants, "publicMessageTag", "public");
53
53
  //attachmentMiddleware
54
- _defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"]);
54
+ _defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth", "application/vnd.microsoft.card.video"]);
55
+ _defineProperty(Constants, "adaptiveCardContentTypePrefix", "application/vnd.microsoft.card");
55
56
  _defineProperty(Constants, "maxUploadFileSize", "500000");
56
57
  _defineProperty(Constants, "imageRegex", /(\.)(jpeg|jpg|jiff|png|gif|bmp|webp)$/i);
57
58
  _defineProperty(Constants, "audioMediaRegex", /(\.)(aac|aiff|alac|amr|flac|mp2|mp3|pcm|wav|wma)$/i);
@@ -202,12 +202,17 @@ const createAttachmentMiddleware = enableInlinePlaying => {
202
202
  id: attachmentId,
203
203
  style: atttachmentAdaptiveCardStyles
204
204
  }, next(...args));
205
+ } else if (contentType.startsWith(Constants.adaptiveCardContentTypePrefix)) {
206
+ console.warn(`${contentType} adaptive card type is currently not supported.`);
205
207
  }
206
208
  if ((_card$activity$channe = card.activity.channelData) !== null && _card$activity$channe !== void 0 && _card$activity$channe.middlewareData) {
207
209
  attachment.contentUrl = card.activity.channelData.middlewareData[attachment.name];
208
210
  } else if (attachment !== null && attachment !== void 0 && attachment.tempContentUrl) {
209
211
  attachment.contentUrl = attachment.tempContentUrl;
210
212
  }
213
+ if (!attachment.name) {
214
+ return next(...args);
215
+ }
211
216
  const fileExtension = attachment.name.substring(attachment.name.lastIndexOf(".") + 1, attachment.name.length) || attachment.name;
212
217
  const imageExtension = Constants.imageRegex.test(attachment.name);
213
218
  const audioExtension = Constants.audioMediaRegex.test(attachment.name);
@@ -41,6 +41,7 @@ export declare class Constants {
41
41
  static readonly acsChannel = "ACS_CHANNEL";
42
42
  static readonly publicMessageTag = "public";
43
43
  static readonly supportedAdaptiveCardContentTypes: Array<string>;
44
+ static readonly adaptiveCardContentTypePrefix = "application/vnd.microsoft.card";
44
45
  static readonly maxUploadFileSize = "500000";
45
46
  static readonly imageRegex: RegExp;
46
47
  static readonly audioMediaRegex: RegExp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.2.2",
3
+ "version": "1.2.3-main.fc07b68",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -74,7 +74,7 @@
74
74
  "webpack-cli": "^4.9.2"
75
75
  },
76
76
  "dependencies": {
77
- "@microsoft/omnichannel-chat-components": "^1.0.5",
77
+ "@microsoft/omnichannel-chat-components": "^1.0.6",
78
78
  "@microsoft/omnichannel-chat-sdk": "1.4.6",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.3.4",