@microsoft/omnichannel-chat-widget 1.7.8 → 1.8.1-main.20b15cc

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.
@@ -19,6 +19,7 @@ _defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
19
19
  _defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
20
20
  _defineProperty(Constants, "systemMessageTag", "system");
21
21
  _defineProperty(Constants, "userMessageTag", "user");
22
+ _defineProperty(Constants, "channelMessageTag", "channel");
22
23
  _defineProperty(Constants, "historyMessageTag", "history");
23
24
  _defineProperty(Constants, "agentEndConversationMessageTag", "agentendconversation");
24
25
  _defineProperty(Constants, "supervisorForceCloseMessageTag", "supervisorforceclosedconversation");
@@ -73,11 +73,13 @@ const polyfillMessagePayloadForEvent = (activity, payload, conversationId) => {
73
73
  };
74
74
  exports.polyfillMessagePayloadForEvent = polyfillMessagePayloadForEvent;
75
75
  const getScenarioType = activity => {
76
- var _activity$from3, _activity$channelData4, _activity$channelData5;
77
- if ((activity === null || activity === void 0 ? void 0 : (_activity$from3 = activity.from) === null || _activity$from3 === void 0 ? void 0 : _activity$from3.role) === _Constants2.Constants.userMessageTag) {
76
+ var _activity$from3, _activity$channelData4;
77
+ const role = activity === null || activity === void 0 ? void 0 : (_activity$from3 = activity.from) === null || _activity$from3 === void 0 ? void 0 : _activity$from3.role;
78
+ const tags = activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags;
79
+ if (role === _Constants2.Constants.userMessageTag) {
78
80
  return _Constants.ScenarioType.UserSendMessageStrategy;
79
81
  }
80
- if (activity !== null && activity !== void 0 && (_activity$channelData4 = activity.channelData) !== null && _activity$channelData4 !== void 0 && (_activity$channelData5 = _activity$channelData4.tags) !== null && _activity$channelData5 !== void 0 && _activity$channelData5.includes(_Constants2.Constants.systemMessageTag)) {
82
+ if (tags && tags.includes(_Constants2.Constants.systemMessageTag) || role === _Constants2.Constants.channelMessageTag) {
81
83
  return _Constants.ScenarioType.SystemMessageStrategy;
82
84
  }
83
85
  return _Constants.ScenarioType.ReceivedMessageStrategy;
@@ -12,6 +12,7 @@ _defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
12
12
  _defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
13
13
  _defineProperty(Constants, "systemMessageTag", "system");
14
14
  _defineProperty(Constants, "userMessageTag", "user");
15
+ _defineProperty(Constants, "channelMessageTag", "channel");
15
16
  _defineProperty(Constants, "historyMessageTag", "history");
16
17
  _defineProperty(Constants, "agentEndConversationMessageTag", "agentendconversation");
17
18
  _defineProperty(Constants, "supervisorForceCloseMessageTag", "supervisorforceclosedconversation");
@@ -64,11 +64,13 @@ export const polyfillMessagePayloadForEvent = (activity, payload, conversationId
64
64
  };
65
65
  };
66
66
  export const getScenarioType = activity => {
67
- var _activity$from3, _activity$channelData4, _activity$channelData5;
68
- if ((activity === null || activity === void 0 ? void 0 : (_activity$from3 = activity.from) === null || _activity$from3 === void 0 ? void 0 : _activity$from3.role) === Constants.userMessageTag) {
67
+ var _activity$from3, _activity$channelData4;
68
+ const role = activity === null || activity === void 0 ? void 0 : (_activity$from3 = activity.from) === null || _activity$from3 === void 0 ? void 0 : _activity$from3.role;
69
+ const tags = activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags;
70
+ if (role === Constants.userMessageTag) {
69
71
  return ScenarioType.UserSendMessageStrategy;
70
72
  }
71
- if (activity !== null && activity !== void 0 && (_activity$channelData4 = activity.channelData) !== null && _activity$channelData4 !== void 0 && (_activity$channelData5 = _activity$channelData4.tags) !== null && _activity$channelData5 !== void 0 && _activity$channelData5.includes(Constants.systemMessageTag)) {
73
+ if (tags && tags.includes(Constants.systemMessageTag) || role === Constants.channelMessageTag) {
72
74
  return ScenarioType.SystemMessageStrategy;
73
75
  }
74
76
  return ScenarioType.ReceivedMessageStrategy;
@@ -3,6 +3,7 @@ export declare class Constants {
3
3
  static readonly magicCodeResponseBroadcastChannel = "MagicCodeResponseChannel";
4
4
  static readonly systemMessageTag = "system";
5
5
  static readonly userMessageTag = "user";
6
+ static readonly channelMessageTag = "channel";
6
7
  static readonly historyMessageTag = "history";
7
8
  static readonly agentEndConversationMessageTag = "agentendconversation";
8
9
  static readonly supervisorForceCloseMessageTag = "supervisorforceclosedconversation";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.7.8",
3
+ "version": "1.8.1-main.20b15cc",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -87,7 +87,7 @@
87
87
  "@azure/core-tracing": "^1.2.0",
88
88
  "@microsoft/applicationinsights-web": "^3.3.6",
89
89
  "@microsoft/omnichannel-chat-components": "1.1.12",
90
- "@microsoft/omnichannel-chat-sdk": "^1.11.0",
90
+ "@microsoft/omnichannel-chat-sdk": "^1.11.1",
91
91
  "@opentelemetry/api": "^1.9.0",
92
92
  "abort-controller": "^3",
93
93
  "abort-controller-es5": "^2.0.1",
@@ -152,4 +152,4 @@
152
152
  "default"
153
153
  ]
154
154
  }
155
- }
155
+ }