@microsoft/omnichannel-chat-widget 1.7.8-main.2e1cc2b → 1.7.8-main.50111af

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 (100) hide show
  1. package/lib/cjs/common/Constants.js +57 -18
  2. package/lib/cjs/common/KeyCodes.js +6 -1
  3. package/lib/cjs/common/contextDataStore/DataStoreManager.js +6 -1
  4. package/lib/cjs/common/facades/FacadeChatSDK.js +385 -291
  5. package/lib/cjs/common/storage/default/defaultCacheManager.js +6 -3
  6. package/lib/cjs/common/telemetry/TelemetryConstants.js +139 -116
  7. package/lib/cjs/common/telemetry/TelemetryHelper.js +219 -181
  8. package/lib/cjs/common/telemetry/TelemetryManager.js +9 -2
  9. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +4 -5
  10. package/lib/cjs/components/headerstateful/HeaderStateful.js +3 -5
  11. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +32 -19
  12. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +71 -56
  13. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +17 -8
  14. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +65 -52
  15. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +31 -18
  16. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +14 -6
  17. package/lib/cjs/components/livechatwidget/common/Deferred.js +14 -6
  18. package/lib/cjs/components/livechatwidget/common/authHelper.js +15 -0
  19. package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +3 -1
  20. package/lib/cjs/components/livechatwidget/common/endChat.js +4 -18
  21. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +0 -5
  22. package/lib/cjs/components/livechatwidget/common/startChat.js +2 -23
  23. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +17 -11
  24. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +9 -3
  25. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +22 -6
  26. package/lib/cjs/components/postchatsurveypanestateful/common/isValidSurveyUrl.js +28 -0
  27. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +4 -3
  28. package/lib/cjs/components/webchatcontainerstateful/common/DemoChatAdapter.js +88 -65
  29. package/lib/cjs/components/webchatcontainerstateful/common/DemoChatSDK.js +26 -7
  30. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +49 -26
  31. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +57 -35
  32. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +62 -52
  33. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +95 -61
  34. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +6 -1
  35. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +6 -1
  36. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +53 -39
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +4 -0
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +88 -60
  39. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +18 -6
  40. package/lib/cjs/firstresponselatency/Constants.js +13 -0
  41. package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +118 -0
  42. package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +201 -0
  43. package/lib/cjs/firstresponselatency/util.js +98 -0
  44. package/lib/cjs/plugins/createChatTranscript.js +92 -62
  45. package/lib/cjs/plugins/newMessageEventHandler.js +102 -88
  46. package/lib/esm/common/Constants.js +57 -18
  47. package/lib/esm/common/KeyCodes.js +6 -1
  48. package/lib/esm/common/contextDataStore/DataStoreManager.js +6 -1
  49. package/lib/esm/common/facades/FacadeChatSDK.js +385 -291
  50. package/lib/esm/common/storage/default/defaultCacheManager.js +6 -1
  51. package/lib/esm/common/telemetry/TelemetryConstants.js +139 -116
  52. package/lib/esm/common/telemetry/TelemetryHelper.js +219 -181
  53. package/lib/esm/common/telemetry/TelemetryManager.js +9 -2
  54. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -5
  55. package/lib/esm/components/headerstateful/HeaderStateful.js +3 -5
  56. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +32 -19
  57. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +71 -56
  58. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +17 -8
  59. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +65 -52
  60. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +31 -18
  61. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +14 -6
  62. package/lib/esm/components/livechatwidget/common/Deferred.js +14 -6
  63. package/lib/esm/components/livechatwidget/common/authHelper.js +15 -0
  64. package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -1
  65. package/lib/esm/components/livechatwidget/common/endChat.js +4 -18
  66. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +1 -6
  67. package/lib/esm/components/livechatwidget/common/startChat.js +3 -24
  68. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +17 -11
  69. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +9 -3
  70. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +22 -6
  71. package/lib/esm/components/postchatsurveypanestateful/common/isValidSurveyUrl.js +21 -0
  72. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +4 -3
  73. package/lib/esm/components/webchatcontainerstateful/common/DemoChatAdapter.js +88 -65
  74. package/lib/esm/components/webchatcontainerstateful/common/DemoChatSDK.js +26 -7
  75. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +49 -26
  76. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +57 -35
  77. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +63 -52
  78. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +95 -61
  79. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +6 -1
  80. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +6 -1
  81. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +53 -39
  82. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +4 -0
  83. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +88 -60
  84. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -6
  85. package/lib/esm/firstresponselatency/Constants.js +6 -0
  86. package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +112 -0
  87. package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +194 -0
  88. package/lib/esm/firstresponselatency/util.js +87 -0
  89. package/lib/esm/plugins/createChatTranscript.js +92 -62
  90. package/lib/esm/plugins/newMessageEventHandler.js +100 -86
  91. package/lib/types/common/facades/FacadeChatSDK.d.ts +1 -0
  92. package/lib/types/common/telemetry/TelemetryConstants.d.ts +10 -1
  93. package/lib/types/components/postchatsurveypanestateful/common/isValidSurveyUrl.d.ts +2 -0
  94. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +2 -2
  95. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -1
  96. package/lib/types/firstresponselatency/Constants.d.ts +30 -0
  97. package/lib/types/firstresponselatency/FirstMessageTrackerFromBot.d.ts +1 -0
  98. package/lib/types/firstresponselatency/FirstResponseLatencyTracker.d.ts +22 -0
  99. package/lib/types/firstresponselatency/util.d.ts +7 -0
  100. package/package.json +18 -6
@@ -6,43 +6,65 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.DesignerChatSDK = void 0;
7
7
  var _DesignerChatAdapter = require("./DesignerChatAdapter");
8
8
  var _mockchatsdk = require("./mockchatsdk");
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
13
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
+ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
16
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
17
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
18
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
9
19
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
20
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
21
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
- class DesignerChatSDK extends _mockchatsdk.MockChatSDK {
13
- constructor() {
14
- super();
15
- _defineProperty(this, "localeId", this.getLiveChatConfig().ChatWidgetLanguage.msdyn_localeid);
22
+ let DesignerChatSDK = /*#__PURE__*/function (_MockChatSDK) {
23
+ _inherits(DesignerChatSDK, _MockChatSDK);
24
+ var _super = _createSuper(DesignerChatSDK);
25
+ function DesignerChatSDK() {
26
+ var _this;
27
+ _classCallCheck(this, DesignerChatSDK);
28
+ _this = _super.call(this);
29
+ _defineProperty(_assertThisInitialized(_this), "localeId", _this.getLiveChatConfig().ChatWidgetLanguage.msdyn_localeid);
30
+ return _this;
16
31
  }
17
- createChatAdapter() {
18
- return new _DesignerChatAdapter.DesignerChatAdapter();
19
- }
20
- /**
21
- * If the widget is running in designer mode, we mock the initialize response. We don't want
22
- * any interactions with a real server in when designing LCW widget visually in Modern Admin.
23
- *
24
- * - All GUIDs were changed to 00000000-0000-0000-0000-000000000000.
25
- * - msdyn_callingoptions was changed to disable calling functionality
26
- */
27
- getLiveChatConfig() {
28
- return {
29
- LiveWSAndLiveChatEngJoin: {
30
- msdyn_widgetthemecolor: "19236002",
31
- // msdyn_callingoptions was changed to disable calling functionality
32
- msdyn_callingoptions: "192350000",
33
- msdyn_widgettitle: "Let\u0027s chat",
34
- msdyn_conversationmode: "192350000",
35
- msdyn_avatarurl: "https://oc-cdn-ocprod.azureedge.net/livechatwidget/images/chatIcon.svg",
36
- msdyn_name: "Let's Chat",
37
- msdyn_postconversationsurveyenable: "false",
38
- OutOfOperatingHours: "False",
39
- ShowWidget: "True"
40
- },
41
- ChatWidgetLanguage: {
42
- msdyn_localeid: "1033",
43
- msdyn_languagename: "English - United States"
44
- }
45
- };
46
- }
47
- }
32
+ _createClass(DesignerChatSDK, [{
33
+ key: "createChatAdapter",
34
+ value: function createChatAdapter() {
35
+ return new _DesignerChatAdapter.DesignerChatAdapter();
36
+ }
37
+ }, {
38
+ key: "getLiveChatConfig",
39
+ value:
40
+ /**
41
+ * If the widget is running in designer mode, we mock the initialize response. We don't want
42
+ * any interactions with a real server in when designing LCW widget visually in Modern Admin.
43
+ *
44
+ * - All GUIDs were changed to 00000000-0000-0000-0000-000000000000.
45
+ * - msdyn_callingoptions was changed to disable calling functionality
46
+ */
47
+ function getLiveChatConfig() {
48
+ return {
49
+ LiveWSAndLiveChatEngJoin: {
50
+ msdyn_widgetthemecolor: "19236002",
51
+ // msdyn_callingoptions was changed to disable calling functionality
52
+ msdyn_callingoptions: "192350000",
53
+ msdyn_widgettitle: "Let\u0027s chat",
54
+ msdyn_conversationmode: "192350000",
55
+ msdyn_avatarurl: "https://oc-cdn-ocprod.azureedge.net/livechatwidget/images/chatIcon.svg",
56
+ msdyn_name: "Let's Chat",
57
+ msdyn_postconversationsurveyenable: "false",
58
+ OutOfOperatingHours: "False",
59
+ ShowWidget: "True"
60
+ },
61
+ ChatWidgetLanguage: {
62
+ msdyn_localeid: "1033",
63
+ msdyn_languagename: "English - United States"
64
+ }
65
+ };
66
+ }
67
+ }]);
68
+ return DesignerChatSDK;
69
+ }(_mockchatsdk.MockChatSDK);
48
70
  exports.DesignerChatSDK = DesignerChatSDK;
@@ -10,11 +10,15 @@ var _botframeworkDirectlinejs = require("botframework-directlinejs");
10
10
  var _rxjs = require("rxjs");
11
11
  var _Observable = require("rxjs/Observable");
12
12
  var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
16
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
17
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
18
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
- class MockAdapter {
17
- constructor() {
19
+ let MockAdapter = /*#__PURE__*/function () {
20
+ function MockAdapter() {
21
+ _classCallCheck(this, MockAdapter);
18
22
  _defineProperty(this, "activityObserver", void 0);
19
23
  _defineProperty(this, "activity$", void 0);
20
24
  _defineProperty(this, "connectionStatus$", new _rxjs.BehaviorSubject(_botframeworkDirectlinejs.ConnectionStatus.Uninitialized));
@@ -33,57 +37,63 @@ class MockAdapter {
33
37
  });
34
38
  }).share();
35
39
  }
36
- postActivity(activity) {
37
- if (activity) {
38
- var _activity$text;
39
- let modActivity;
40
- let typingActivity;
41
- const userId = "userId",
42
- botId = "botId";
43
- if ((_activity$text = activity.text) !== null && _activity$text !== void 0 && _activity$text.startsWith(":")) {
44
- var _this$activityObserve, _this$activityObserve2;
45
- modActivity = {
46
- ...activity,
47
- id: (0, _omnichannelChatSdk.uuidv4)(),
48
- from: {
49
- ...activity.from,
50
- id: botId,
51
- name: "Bot",
52
- role: "bot"
53
- },
54
- text: activity.text.substr(1)
55
- };
56
- typingActivity = {
57
- id: (0, _omnichannelChatSdk.uuidv4)(),
58
- from: {
40
+ _createClass(MockAdapter, [{
41
+ key: "postActivity",
42
+ value: function postActivity(activity) {
43
+ if (activity) {
44
+ var _activity$text;
45
+ let modActivity;
46
+ let typingActivity;
47
+ const userId = "userId",
48
+ botId = "botId";
49
+ if ((_activity$text = activity.text) !== null && _activity$text !== void 0 && _activity$text.startsWith(":")) {
50
+ var _this$activityObserve, _this$activityObserve2;
51
+ modActivity = {
52
+ ...activity,
59
53
  id: (0, _omnichannelChatSdk.uuidv4)(),
60
- name: "Bot",
61
- role: "bot"
62
- },
63
- type: "typing"
64
- };
65
- (_this$activityObserve = this.activityObserver) === null || _this$activityObserve === void 0 ? void 0 : _this$activityObserve.next(modActivity); // mock echo message
66
- (_this$activityObserve2 = this.activityObserver) === null || _this$activityObserve2 === void 0 ? void 0 : _this$activityObserve2.next(typingActivity); // mock typing
67
- } else {
68
- var _this$activityObserve3;
69
- modActivity = {
70
- ...activity,
71
- id: (0, _omnichannelChatSdk.uuidv4)(),
72
- from: {
73
- ...activity.from,
74
- id: userId,
75
- name: "User",
76
- role: "user"
77
- }
78
- };
79
- (_this$activityObserve3 = this.activityObserver) === null || _this$activityObserve3 === void 0 ? void 0 : _this$activityObserve3.next(modActivity); // mock message sent
54
+ from: {
55
+ ...activity.from,
56
+ id: botId,
57
+ name: "Bot",
58
+ role: "bot"
59
+ },
60
+ text: activity.text.substr(1)
61
+ };
62
+ typingActivity = {
63
+ id: (0, _omnichannelChatSdk.uuidv4)(),
64
+ from: {
65
+ id: (0, _omnichannelChatSdk.uuidv4)(),
66
+ name: "Bot",
67
+ role: "bot"
68
+ },
69
+ type: "typing"
70
+ };
71
+ (_this$activityObserve = this.activityObserver) === null || _this$activityObserve === void 0 ? void 0 : _this$activityObserve.next(modActivity); // mock echo message
72
+ (_this$activityObserve2 = this.activityObserver) === null || _this$activityObserve2 === void 0 ? void 0 : _this$activityObserve2.next(typingActivity); // mock typing
73
+ } else {
74
+ var _this$activityObserve3;
75
+ modActivity = {
76
+ ...activity,
77
+ id: (0, _omnichannelChatSdk.uuidv4)(),
78
+ from: {
79
+ ...activity.from,
80
+ id: userId,
81
+ name: "User",
82
+ role: "user"
83
+ }
84
+ };
85
+ (_this$activityObserve3 = this.activityObserver) === null || _this$activityObserve3 === void 0 ? void 0 : _this$activityObserve3.next(modActivity); // mock message sent
86
+ }
80
87
  }
81
- }
82
88
 
83
- return _Observable.Observable.of(activity.id || "");
84
- }
85
- end() {
86
- return;
87
- }
88
- }
89
+ return _Observable.Observable.of(activity.id || "");
90
+ }
91
+ }, {
92
+ key: "end",
93
+ value: function end() {
94
+ return;
95
+ }
96
+ }]);
97
+ return MockAdapter;
98
+ }();
89
99
  exports.default = MockAdapter;
@@ -7,11 +7,15 @@ exports.MockChatSDK = void 0;
7
7
  var _mockadapter = _interopRequireDefault(require("./mockadapter"));
8
8
  var _Constants = require("../../../common/Constants");
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
13
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
15
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
- class MockChatSDK {
14
- constructor() {
16
+ let MockChatSDK = /*#__PURE__*/function () {
17
+ function MockChatSDK() {
18
+ _classCallCheck(this, MockChatSDK);
15
19
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
20
  _defineProperty(this, "sleep", ms => new Promise(r => setTimeout(r, ms)));
17
21
  _defineProperty(this, "isMockModeOn", true);
@@ -21,64 +25,94 @@ class MockChatSDK {
21
25
  orgUrl: "https://contoso.crm.dynamics.com"
22
26
  });
23
27
  }
24
- async initialize() {
25
- return this.getLiveChatConfig();
26
- }
27
- async startChat() {
28
- await this.sleep(1000);
29
- }
30
- endChat() {
31
- return null;
32
- }
33
- getChatToken() {
34
- return null;
35
- }
36
- createChatAdapter() {
37
- return new _mockadapter.default();
38
- }
28
+ _createClass(MockChatSDK, [{
29
+ key: "initialize",
30
+ value: async function initialize() {
31
+ return this.getLiveChatConfig();
32
+ }
33
+ }, {
34
+ key: "startChat",
35
+ value: async function startChat() {
36
+ await this.sleep(1000);
37
+ }
38
+ }, {
39
+ key: "endChat",
40
+ value: function endChat() {
41
+ return null;
42
+ }
43
+ }, {
44
+ key: "getChatToken",
45
+ value: function getChatToken() {
46
+ return null;
47
+ }
48
+ }, {
49
+ key: "createChatAdapter",
50
+ value: function createChatAdapter() {
51
+ return new _mockadapter.default();
52
+ }
39
53
 
40
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
41
- getPreChatSurvey(parseToJson) {
42
- return "";
43
- }
44
- getConversationDetails() {
45
- return {
46
- State: "Active",
47
- conversationId: "",
48
- canRenderPostChat: "",
49
- participantType: _Constants.ParticipantType.User
50
- };
51
- }
52
- getCurrentLiveChatContext() {
53
- return {
54
- chatToken: {},
55
- requestId: ""
56
- };
57
- }
58
- onNewMessage() {
59
- return null;
60
- }
61
- getChatReconnectContext() {
62
- return {
63
- reconnectId: "123"
64
- };
65
- }
66
- getVoiceVideoCalling() {
67
- return null;
68
- }
69
- setAuthTokenProvider() {
70
- return null;
71
- }
72
- getLiveChatConfig() {
73
- return {
74
- LiveWSAndLiveChatEngJoin: {
75
- msdyn_postconversationsurveyenable: "true",
76
- msdyn_conversationmode: "192350000"
77
- }
78
- };
79
- }
80
- sendTypingEvent() {
81
- return null;
82
- }
83
- }
54
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
55
+ }, {
56
+ key: "getPreChatSurvey",
57
+ value: function getPreChatSurvey(parseToJson) {
58
+ return "";
59
+ }
60
+ }, {
61
+ key: "getConversationDetails",
62
+ value: function getConversationDetails() {
63
+ return {
64
+ State: "Active",
65
+ conversationId: "",
66
+ canRenderPostChat: "",
67
+ participantType: _Constants.ParticipantType.User
68
+ };
69
+ }
70
+ }, {
71
+ key: "getCurrentLiveChatContext",
72
+ value: function getCurrentLiveChatContext() {
73
+ return {
74
+ chatToken: {},
75
+ requestId: ""
76
+ };
77
+ }
78
+ }, {
79
+ key: "onNewMessage",
80
+ value: function onNewMessage() {
81
+ return null;
82
+ }
83
+ }, {
84
+ key: "getChatReconnectContext",
85
+ value: function getChatReconnectContext() {
86
+ return {
87
+ reconnectId: "123"
88
+ };
89
+ }
90
+ }, {
91
+ key: "getVoiceVideoCalling",
92
+ value: function getVoiceVideoCalling() {
93
+ return null;
94
+ }
95
+ }, {
96
+ key: "setAuthTokenProvider",
97
+ value: function setAuthTokenProvider() {
98
+ return null;
99
+ }
100
+ }, {
101
+ key: "getLiveChatConfig",
102
+ value: function getLiveChatConfig() {
103
+ return {
104
+ LiveWSAndLiveChatEngJoin: {
105
+ msdyn_postconversationsurveyenable: "true",
106
+ msdyn_conversationmode: "192350000"
107
+ }
108
+ };
109
+ }
110
+ }, {
111
+ key: "sendTypingEvent",
112
+ value: function sendTypingEvent() {
113
+ return null;
114
+ }
115
+ }]);
116
+ return MockChatSDK;
117
+ }();
84
118
  exports.MockChatSDK = MockChatSDK;
@@ -4,9 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.BotMagicCodeStore = void 0;
7
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
8
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
11
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
12
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
- class BotMagicCodeStore {}
13
+ let BotMagicCodeStore = /*#__PURE__*/_createClass(function BotMagicCodeStore() {
14
+ _classCallCheck(this, BotMagicCodeStore);
15
+ });
11
16
  exports.BotMagicCodeStore = BotMagicCodeStore;
12
17
  _defineProperty(BotMagicCodeStore, "botOAuthSignInId", "");
@@ -4,10 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.WebChatStoreLoader = void 0;
7
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
8
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
11
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
12
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
- class WebChatStoreLoader {}
13
+ let WebChatStoreLoader = /*#__PURE__*/_createClass(function WebChatStoreLoader() {
14
+ _classCallCheck(this, WebChatStoreLoader);
15
+ });
11
16
  exports.WebChatStoreLoader = WebChatStoreLoader;
12
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
18
  _defineProperty(WebChatStoreLoader, "store", void 0);
@@ -7,58 +7,72 @@ exports.default = void 0;
7
7
  var _dompurify = _interopRequireDefault(require("dompurify"));
8
8
  var _Constants = require("../../../../common/Constants");
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
13
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
15
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
- class HyperlinkTextOverrideRenderer {
14
- constructor(hyperlinkTextOverride) {
16
+ let HyperlinkTextOverrideRenderer = /*#__PURE__*/function () {
17
+ function HyperlinkTextOverrideRenderer(hyperlinkTextOverride) {
18
+ _classCallCheck(this, HyperlinkTextOverrideRenderer);
15
19
  _defineProperty(this, "hyperlinkTextOverride", void 0);
16
20
  this.hyperlinkTextOverride = hyperlinkTextOverride;
17
21
  }
18
- convertTextToHtmlNode(text) {
19
- const htmlNode = document.createElement(_Constants.HtmlAttributeNames.div);
20
- try {
21
- text = _dompurify.default.sanitize(text, {
22
- ADD_ATTR: ["target"]
23
- });
24
- htmlNode.innerHTML = text;
25
- } catch {
22
+ _createClass(HyperlinkTextOverrideRenderer, [{
23
+ key: "convertTextToHtmlNode",
24
+ value: function convertTextToHtmlNode(text) {
25
+ const htmlNode = document.createElement(_Constants.HtmlAttributeNames.div);
26
+ try {
27
+ text = _dompurify.default.sanitize(text, {
28
+ ADD_ATTR: ["target"]
29
+ });
30
+ htmlNode.innerHTML = text;
31
+ } catch {
32
+ return htmlNode;
33
+ }
26
34
  return htmlNode;
27
35
  }
28
- return htmlNode;
29
- }
30
- processANode(htmlNode) {
31
- // eslint-disable-line @typescript-eslint/no-explicit-any
32
- const aTags = htmlNode.getElementsByTagName(_Constants.HtmlAttributeNames.aTagName);
33
- for (let index = 0; index < aTags.length; index++) {
34
- const aNode = aTags[index];
35
- if (!aNode || !aNode.tagName || aNode.tagName.toLowerCase() !== _Constants.HtmlAttributeNames.aTagName || !aNode.href) continue;
36
- if (aNode.href !== aNode.text.trim()) {
37
- aNode.text = aNode.href;
36
+ }, {
37
+ key: "processANode",
38
+ value: function processANode(htmlNode) {
39
+ // eslint-disable-line @typescript-eslint/no-explicit-any
40
+ const aTags = htmlNode.getElementsByTagName(_Constants.HtmlAttributeNames.aTagName);
41
+ for (let index = 0; index < aTags.length; index++) {
42
+ const aNode = aTags[index];
43
+ if (!aNode || !aNode.tagName || aNode.tagName.toLowerCase() !== _Constants.HtmlAttributeNames.aTagName || !aNode.href) continue;
44
+ if (aNode.href !== aNode.text.trim()) {
45
+ aNode.text = aNode.href;
46
+ }
38
47
  }
39
48
  }
40
- }
41
- applicable(text) {
42
- if (!this.hyperlinkTextOverride) {
43
- return false;
49
+ }, {
50
+ key: "applicable",
51
+ value: function applicable(text) {
52
+ if (!this.hyperlinkTextOverride) {
53
+ return false;
54
+ }
55
+ try {
56
+ const htmlNode = this.convertTextToHtmlNode(text);
57
+ const aNodes = htmlNode.getElementsByTagName(_Constants.HtmlAttributeNames.aTagName);
58
+ return !!aNodes && aNodes.length && aNodes.length > 0;
59
+ } catch {
60
+ return false;
61
+ }
44
62
  }
45
- try {
63
+ }, {
64
+ key: "render",
65
+ value: function render(text) {
66
+ if (!this.applicable(text)) {
67
+ return text;
68
+ }
46
69
  const htmlNode = this.convertTextToHtmlNode(text);
47
- const aNodes = htmlNode.getElementsByTagName(_Constants.HtmlAttributeNames.aTagName);
48
- return !!aNodes && aNodes.length && aNodes.length > 0;
49
- } catch {
50
- return false;
51
- }
52
- }
53
- render(text) {
54
- if (!this.applicable(text)) {
70
+ this.processANode(htmlNode);
71
+ text = htmlNode.innerHTML;
55
72
  return text;
56
73
  }
57
- const htmlNode = this.convertTextToHtmlNode(text);
58
- this.processANode(htmlNode);
59
- text = htmlNode.innerHTML;
60
- return text;
61
- }
62
- }
74
+ }]);
75
+ return HyperlinkTextOverrideRenderer;
76
+ }();
63
77
  var _default = HyperlinkTextOverrideRenderer;
64
78
  exports.default = _default;
@@ -41,6 +41,10 @@ const DeliveredTimestamp = _ref => {
41
41
  return /*#__PURE__*/_react.default.createElement("span", {
42
42
  dir: "ltr"
43
43
  }, (0, _utils.getTimestampHourMinute)(timestamp));
44
+ } else {
45
+ return /*#__PURE__*/_react.default.createElement("span", {
46
+ dir: dir
47
+ }, (0, _utils.getTimestampHourMinute)(timestamp));
44
48
  }
45
49
  return timeString;
46
50
  };