@microsoft/omnichannel-chat-widget 0.1.0-main.a7ac5de → 0.1.0-main.a7b2241

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 (113) hide show
  1. package/README.md +7 -34
  2. package/lib/cjs/assets/Icons.js +4 -2
  3. package/lib/cjs/common/Constants.js +7 -3
  4. package/lib/cjs/common/KeyCodes.js +3 -1
  5. package/lib/cjs/common/contextDataStore/DataStoreManager.js +3 -1
  6. package/lib/cjs/common/storage/default/defaultCacheManager.js +5 -3
  7. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +15 -6
  8. package/lib/cjs/common/telemetry/TelemetryConstants.js +13 -0
  9. package/lib/cjs/common/telemetry/TelemetryHelper.js +5 -2
  10. package/lib/cjs/common/telemetry/TelemetryManager.js +3 -1
  11. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +1 -1
  12. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  13. package/lib/cjs/components/headerstateful/HeaderStateful.js +6 -4
  14. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +3 -1
  15. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +139 -0
  16. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -1
  17. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +3 -1
  18. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +3 -1
  19. package/lib/cjs/components/livechatwidget/common/Deferred.js +3 -1
  20. package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
  21. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +66 -14
  22. package/lib/cjs/components/livechatwidget/common/endChat.js +23 -17
  23. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +25 -13
  24. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +6 -9
  25. package/lib/cjs/components/livechatwidget/common/startChat.js +76 -53
  26. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +44 -38
  27. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +22 -2
  28. package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
  29. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  30. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  31. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +3 -1
  32. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -1
  33. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
  34. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -1
  35. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -1
  36. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  39. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  40. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +5 -6
  41. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  42. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  43. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +29 -28
  44. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +5 -2
  45. package/lib/cjs/contexts/createReducer.js +8 -0
  46. package/lib/cjs/hooks/useDebounce.js +28 -0
  47. package/lib/cjs/hooks/useWindowDimensions.js +30 -0
  48. package/lib/cjs/plugins/newMessageEventHandler.js +14 -0
  49. package/lib/esm/assets/Icons.js +2 -1
  50. package/lib/esm/common/Constants.js +7 -3
  51. package/lib/esm/common/KeyCodes.js +3 -1
  52. package/lib/esm/common/contextDataStore/DataStoreManager.js +3 -1
  53. package/lib/esm/common/storage/default/defaultCacheManager.js +5 -3
  54. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +15 -6
  55. package/lib/esm/common/telemetry/TelemetryConstants.js +13 -0
  56. package/lib/esm/common/telemetry/TelemetryHelper.js +5 -2
  57. package/lib/esm/common/telemetry/TelemetryManager.js +3 -1
  58. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +1 -1
  59. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  60. package/lib/esm/components/headerstateful/HeaderStateful.js +6 -4
  61. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +3 -1
  62. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +134 -0
  63. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -1
  64. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +3 -1
  65. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +3 -1
  66. package/lib/esm/components/livechatwidget/common/Deferred.js +3 -1
  67. package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
  68. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +66 -14
  69. package/lib/esm/components/livechatwidget/common/endChat.js +23 -17
  70. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +25 -13
  71. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +7 -9
  72. package/lib/esm/components/livechatwidget/common/startChat.js +76 -53
  73. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -39
  74. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +22 -2
  75. package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
  76. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  77. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  78. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +3 -1
  79. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -1
  80. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
  81. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -1
  82. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -1
  83. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  84. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  85. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  86. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  87. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +5 -6
  88. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  89. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  90. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +29 -28
  91. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +5 -2
  92. package/lib/esm/contexts/createReducer.js +8 -0
  93. package/lib/esm/hooks/useDebounce.js +22 -0
  94. package/lib/esm/hooks/useWindowDimensions.js +23 -0
  95. package/lib/esm/plugins/newMessageEventHandler.js +14 -0
  96. package/lib/types/assets/Icons.d.ts +1 -0
  97. package/lib/types/common/Constants.d.ts +2 -0
  98. package/lib/types/common/storage/default/defaultCacheManager.d.ts +1 -1
  99. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -1
  100. package/lib/types/common/telemetry/TelemetryConstants.d.ts +14 -1
  101. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -0
  102. package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
  103. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
  104. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +9 -0
  105. package/lib/types/components/livechatwidget/common/startChat.d.ts +3 -3
  106. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -0
  107. package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
  108. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
  109. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  110. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +29 -28
  111. package/lib/types/hooks/useDebounce.d.ts +3 -0
  112. package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
  113. package/package.json +3 -3
@@ -0,0 +1,134 @@
1
+ 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; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ 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); }
4
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5
+ /* eslint-disable @typescript-eslint/no-explicit-any */
6
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
7
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../../common/telemetry/TelemetryConstants";
8
+ import { TelemetryHelper } from "../../../../common/telemetry/TelemetryHelper";
9
+ const supportedSignInCardContentTypes = ["application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"];
10
+ const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
11
+ const delay = t => new Promise(resolve => setTimeout(resolve, t));
12
+ const fetchBotAuthConfigRetries = 3;
13
+ const fetchBotAuthConfigRetryInterval = 1000;
14
+ let response;
15
+ const extractSignInId = signInUrl => {
16
+ const result = botOauthUrlRegex.exec(signInUrl);
17
+ if (result && result[1]) {
18
+ return result[1];
19
+ }
20
+ return "";
21
+ };
22
+ const extractSasUrl = async attachment => {
23
+ let sasUrl = undefined;
24
+ if (attachment && attachment.content && attachment.content.tokenPostResource && attachment.content.tokenPostResource.sasUrl) {
25
+ sasUrl = attachment.content.tokenPostResource.sasUrl;
26
+ }
27
+ if (!sasUrl) {
28
+ const signInId = extractSignInId(attachment.content.buttons[0].value);
29
+ const getTestUrlEndpoint = `https://token.botframework.com/api/sas/gettesturl?signInId=${signInId}`;
30
+ try {
31
+ const response = await window.fetch(getTestUrlEndpoint);
32
+ if (response.status === 200) {
33
+ const responseJson = await response.json();
34
+ sasUrl = responseJson.sasUrl;
35
+ }
36
+ } catch {
37
+ sasUrl = undefined;
38
+ }
39
+ }
40
+ return sasUrl;
41
+ };
42
+ const fetchBotAuthConfig = async retries => {
43
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
44
+ Event: TelemetryEvent.SetBotAuthProviderFetchConfig
45
+ });
46
+ const botAuthConfigRequestEvent = {
47
+ eventName: BroadcastEvent.BotAuthConfigRequest
48
+ };
49
+ BroadcastService.postMessage(botAuthConfigRequestEvent);
50
+ const listener = BroadcastService.getMessageByEventName(BroadcastEvent.BotAuthConfigResponse).subscribe(data => {
51
+ var _data$payload, _data$payload2;
52
+ response = ((_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.response) !== undefined ? (_data$payload2 = data.payload) === null || _data$payload2 === void 0 ? void 0 : _data$payload2.response : response;
53
+ listener.unsubscribe();
54
+ });
55
+ if (response !== undefined) {
56
+ //return response;
57
+ return response;
58
+ }
59
+ if (retries === 1) {
60
+ // Base Case
61
+ throw new Error();
62
+ }
63
+ await delay(fetchBotAuthConfigRetryInterval);
64
+ return await fetchBotAuthConfig(--retries);
65
+ };
66
+ export class BotAuthActivitySubscriber {
67
+ constructor() {
68
+ _defineProperty(this, "observer", void 0);
69
+ _defineProperty(this, "signInCardSeen", void 0);
70
+ this.signInCardSeen = new Set();
71
+ }
72
+ applicable(activity) {
73
+ var _activity$attachments;
74
+ return (activity === null || activity === void 0 ? void 0 : (_activity$attachments = activity.attachments) === null || _activity$attachments === void 0 ? void 0 : _activity$attachments.length) > 0 && activity.attachments[0] && supportedSignInCardContentTypes.indexOf(activity.attachments[0].contentType) >= 0;
75
+ }
76
+ async apply(activity) {
77
+ this.observer.next(false); // Hides card
78
+ const attachment = activity.attachments[0];
79
+ const signInUrl = attachment.content.buttons[0].value;
80
+ const signInId = extractSignInId(signInUrl);
81
+ if (!signInId) {
82
+ return;
83
+ }
84
+ if (this.signInCardSeen.has(signInId)) {
85
+ // Prevents duplicate auth
86
+ return;
87
+ }
88
+ this.signInCardSeen.add(signInId);
89
+ const sasUrl = await extractSasUrl(attachment);
90
+ const event = {
91
+ eventName: BroadcastEvent.SigninCardReceived,
92
+ payload: {
93
+ sasUrl
94
+ }
95
+ };
96
+ if (!sasUrl) {
97
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
98
+ Event: TelemetryEvent.BotAuthActivityEmptySasUrl,
99
+ Description: "SaS Url is empty"
100
+ });
101
+ return activity;
102
+ } else {
103
+ BroadcastService.postMessage(event);
104
+ }
105
+ try {
106
+ const response = await fetchBotAuthConfig(fetchBotAuthConfigRetries);
107
+ if (response === false) {
108
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
109
+ Event: TelemetryEvent.SetBotAuthProviderHideCard
110
+ });
111
+ } else {
112
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
113
+ Event: TelemetryEvent.SetBotAuthProviderDisplayCard
114
+ });
115
+ return activity;
116
+ }
117
+ } catch {
118
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
119
+ Event: TelemetryEvent.SetBotAuthProviderNotFound
120
+ });
121
+ //this is to ensure listener continues waiting for response
122
+ if (this.signInCardSeen.has(signInId)) {
123
+ this.signInCardSeen.delete(signInId);
124
+ }
125
+ return activity;
126
+ }
127
+ }
128
+ async next(activity) {
129
+ if (this.applicable(activity)) {
130
+ return await this.apply(activity);
131
+ }
132
+ return activity;
133
+ }
134
+ }
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ 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; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ 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); }
2
4
  export class DefaultActivitySubscriber {
3
5
  constructor() {
4
6
  _defineProperty(this, "observer", void 0);
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ 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; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ 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); }
2
4
  import { ActivityStreamHandler } from "../ActivityStreamHandler";
3
5
  export class PauseActivitySubscriber {
4
6
  constructor() {
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ 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; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ 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); }
2
4
  import { DefaultActivitySubscriber } from "./ActivitySubscriber/DefaultActivitySubscriber";
3
5
  import { shareObservable } from "./shareObservable";
4
6
  export class ChatAdapterShim {
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ 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; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ 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); }
2
4
  export class Deferred {
3
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
6
 
@@ -4,6 +4,7 @@ import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcon
4
4
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
5
5
  import { ChatAdapterShim } from "./ChatAdapterShim";
6
6
  import { PauseActivitySubscriber } from "./ActivitySubscriber/PauseActivitySubscriber";
7
+ import { BotAuthActivitySubscriber } from "./ActivitySubscriber/BotAuthActivitySubscriber";
7
8
 
8
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
10
  export const createAdapter = async chatSDK => {
@@ -29,6 +30,7 @@ export const createAdapter = async chatSDK => {
29
30
  if (chatSDK.isMockModeOn !== true) {
30
31
  adapter = new ChatAdapterShim(adapter);
31
32
  adapter.addSubscriber(new PauseActivitySubscriber());
33
+ adapter.addSubscriber(new BotAuthActivitySubscriber());
32
34
  return adapter.chatAdapter;
33
35
  }
34
36
  return adapter;
@@ -9,9 +9,9 @@ import { createActivityMiddleware } from "../../../webchatcontainerstateful/webc
9
9
  import createAttachmentMiddleware from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware";
10
10
  import { createAvatarMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware";
11
11
  import { createMarkdown } from "../createMarkdown";
12
+ import { createWebChatTelemetry } from "../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
12
13
  import { groupActivitiesMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware";
13
14
  import { typingIndicatorMiddleware } from "../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware";
14
- import { createWebChatTelemetry } from "../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
15
15
 
16
16
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
17
  export const dummyDefaultProps = {
@@ -407,6 +407,7 @@ export const dummyDefaultProps = {
407
407
  width: "90px",
408
408
  cursor: "pointer",
409
409
  overflow: "hidden",
410
+ padding: "0px",
410
411
  whiteSpace: "nowrap"
411
412
  },
412
413
  subtitleStyleProps: {
@@ -414,12 +415,14 @@ export const dummyDefaultProps = {
414
415
  fontWeight: "200",
415
416
  color: "#666",
416
417
  overflow: "hidden",
418
+ padding: "0px",
417
419
  fontFamily: "'Segoe UI',Arial,sans-serif",
418
420
  display: "block",
419
421
  alignItems: "center",
420
422
  margin: "0px 14px 0px 14px",
421
423
  textOverflow: "ellipsis !important",
422
- width: "max-content",
424
+ width: "90px",
425
+ whiteSpace: "nowrap",
423
426
  cursor: "pointer"
424
427
  },
425
428
  classNames: {
@@ -469,7 +472,6 @@ export const dummyDefaultProps = {
469
472
  cancelButtonText: "Cancel",
470
473
  cancelButtonAriaLabel: "Cancel. Return to Chat",
471
474
  brightnessValueOnDim: "0.2",
472
- disableDimLayer: false,
473
475
  onConfirm: () => {},
474
476
  // Detailed implementation omitted
475
477
  onCancel: () => {} // Detailed implementation omitted
@@ -477,20 +479,23 @@ export const dummyDefaultProps = {
477
479
 
478
480
  styleProps: {
479
481
  generalStyleProps: {
482
+ display: "flex",
483
+ minHeight: "160px",
484
+ maxHeight: "300px",
485
+ boxSizing: "border-box",
480
486
  backgroundColor: "#FFFFFF",
481
487
  borderRadius: "2px",
482
488
  color: "black",
483
489
  fontFamily: "Segoe UI, Arial, sans-serif",
484
490
  fontSize: "14px",
485
- height: "160px",
486
491
  padding: "10px 20px",
487
- width: "262px",
488
492
  position: "absolute",
489
493
  justifyContent: "center",
490
494
  alignItems: "center",
491
- display: "flex",
492
495
  flexFlow: "column",
493
- zIndex: "9999"
496
+ zIndex: "9999",
497
+ left: "26px",
498
+ right: "26px"
494
499
  },
495
500
  titleStyleProps: {
496
501
  color: "#323130",
@@ -512,10 +517,14 @@ export const dummyDefaultProps = {
512
517
  },
513
518
  buttonGroupStyleProps: {
514
519
  display: "flex",
520
+ width: "auto",
521
+ height: "auto",
522
+ boxSizing: "border-box",
515
523
  flexFlow: "row",
516
524
  justifyContent: "center",
517
525
  alignItems: "center",
518
- gap: "10px"
526
+ gap: "10px",
527
+ marginBottom: "10px"
519
528
  },
520
529
  confirmButtonStyleProps: {
521
530
  backgroundColor: "rgba(9,72,159,1)",
@@ -570,6 +579,7 @@ export const dummyDefaultProps = {
570
579
  hideCallingContainer: false,
571
580
  hideChatButton: false,
572
581
  hideConfirmationPane: false,
582
+ hideErrorUIPane: false,
573
583
  hideFooter: false,
574
584
  hideHeader: false,
575
585
  hideLoadingPane: false,
@@ -620,7 +630,6 @@ export const dummyDefaultProps = {
620
630
  cancelButtonText: "Cancel",
621
631
  cancelButtonAriaLabel: "Cancel",
622
632
  brightnessValueOnDim: "0.2",
623
- disableDimLayer: false,
624
633
  onSend: undefined,
625
634
  onCancel: undefined,
626
635
  checkInput: undefined
@@ -1018,7 +1027,8 @@ export const dummyDefaultProps = {
1018
1027
  margin: "0px 0px 20px 0px",
1019
1028
  display: "flex",
1020
1029
  order: 1,
1021
- alignSelf: "auto"
1030
+ alignSelf: "auto",
1031
+ overflow: "visible"
1022
1032
  },
1023
1033
  iconImageProps: {
1024
1034
  src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIwX2lpKSI+DQo8cGF0aCBkPSJNMTUuMTk3MSAxNi4yNzI1VjI1Ljg1MjRDMTUuMTk3MSAyNy4zODExIDE1Ljg0MDEgMjcuNTIwMSAxNi45ODMyIDI3LjUyMDFMMjYuNzA4NCAyNy41NjQ5TDMxLjAwMzkgMzIuMzEyM1YyNy41NjQ5SDMxLjg5N0MzMi4xNzQzIDI3LjU2MzcgMzIuNDQ4NyAyNy41MDc3IDMyLjcwNDUgMjcuNDAwMUMzMi45NjAzIDI3LjI5MjQgMzMuMTkyNSAyNy4xMzUzIDMzLjM4NzggMjYuOTM3NUMzMy41ODMxIDI2LjczOTggMzMuNzM3NyAyNi41MDU0IDMzLjg0MjcgMjYuMjQ3N0MzMy45NDc4IDI1Ljk5IDM0LjAwMTMgMjUuNzE0IDM0LjAwMDEgMjUuNDM1NVYxNi4zMDM4QzM0LjAwMTMgMTYuMDI1NCAzMy45NDc4IDE1Ljc0OTQgMzMuODQyNyAxNS40OTE3QzMzLjczNzcgMTUuMjM0IDMzLjU4MzEgMTQuOTk5NiAzMy4zODc4IDE0LjgwMThDMzMuMTkyNSAxNC42MDQxIDMyLjk2MDMgMTQuNDQ2OSAzMi43MDQ1IDE0LjMzOTNDMzIuNDQ4NyAxNC4yMzE2IDMyLjE3NDMgMTQuMTc1NiAzMS44OTcgMTQuMTc0NEwxNy4zMDQ3IDE0LjE0MzFDMTcuMDI2OSAxNC4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gMCAwIDAgMCAwIDAgMCAwIDAgMTI3IDAiIHJlc3VsdD0iaGFyZEFscGhhIi8+DQo8ZmVPZmZzZXQgZHg9Ii0xIiBkeT0iLTEiLz4NCjxmZUNvbXBvc2l0ZSBpbjI9ImhhcmRBbHBoYSIgb3BlcmF0b3I9ImFyaXRobWV0aWMiIGsyPSItMSIgazM9IjEiLz4NCjxmZUNvbG9yTWF0cml4IHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDEgMCAwIDAgMCAxIDAgMCAwIDAgMSAwIDAgMCAwLjE2IDAiLz4NCjxmZUJsZW5kIG1vZGU9Im5vcm1hbCIgaW4yPSJlZmZlY3QyX2lubmVyU2hhZG93IiByZXN1bHQ9ImVmZmVjdDNfaW5uZXJTaGFkb3ciLz4NCjwvZmlsdGVyPg0KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyIiB4MT0iLTAuMzk1MDAxIiB5MT0iMjMuMTI4MiIgeDI9IjIwLjEwNTgiIHkyPSIzNy44NDc0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+DQo8c3RvcCBzdG9wLWNvbG9yPSIjRUZFRkVGIi8+DQo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+DQo8L2xpbmVhckdyYWRpZW50Pg0KPC9kZWZzPg0KPC9zdmc+DQo=",
@@ -1110,7 +1120,8 @@ export const dummyDefaultProps = {
1110
1120
  dir: "auto",
1111
1121
  hideOOOHPane: false,
1112
1122
  hideTitle: false,
1113
- titleText: "Thanks for contacting us. You have reached us outside of our operating hours. An agent will respond when we open."
1123
+ titleText: "Thanks for contacting us. You have reached us outside of our operating hours. An agent will respond when we open. Please see link https://microsoft.com",
1124
+ openLinkInNewTab: true
1114
1125
  },
1115
1126
  styleProps: {
1116
1127
  generalStyleProps: {
@@ -1153,7 +1164,7 @@ export const dummyDefaultProps = {
1153
1164
  subtitleText: "Please take a moment to give us feedback about your chat experience. We are loading the survey for you now."
1154
1165
  },
1155
1166
  styleProps: {
1156
- // ...[Existing chat button style props]
1167
+ // ...[Existing loading pane style props]
1157
1168
  generalStyleProps: {
1158
1169
  position: "initial",
1159
1170
  width: "100%",
@@ -1184,6 +1195,47 @@ export const dummyDefaultProps = {
1184
1195
  },
1185
1196
  isCustomerVoiceSurveyCompact: undefined
1186
1197
  },
1198
+ preChatSurveyPaneProps: {
1199
+ controlProps: {
1200
+ id: "oc-lcw-prechatsurveypane-default",
1201
+ dir: "auto",
1202
+ hidePreChatSurveyPane: false,
1203
+ adaptiveCardHostConfig: "{\"fontFamily\":\"Segoe UI, Helvetica Neue, sans-serif\",\"containerStyles\":{\"default\":{\"foregroundColors\":{\"default\":{\"default\":\"#000000\"}},\"backgroundColor\":\"#FFFFFF\"}},\"actions\":{\"actionsOrientation\":\"Vertical\",\"actionAlignment\":\"stretch\"}}",
1204
+ payload: "{\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"type\":\"AdaptiveCard\",\"version\":\"1.1\",\"body\":[{\"type\":\"TextBlock\",\"weight\":\"bolder\",\"text\":\"Please answer below questions.\"},{\"type\":\"Input.Text\",\"id\":\"1e5e4e7a-8f0b-ec11-b6e6-000d3a305d38\",\"label\":\"name pls?\",\"maxLength\":100,\"isRequired\":true,\"errorMessage\":\"Name is required\"},{\"type\":\"Input.Text\",\"id\":\"7f8f5d6d-995e-ec11-8f8f-000d3a31376e\",\"label\":\"multi\\nmulti\\nmulti\",\"style\":\"text\",\"isMultiline\":true,\"maxLength\":250},{\"type\":\"Input.ChoiceSet\",\"id\":\"e4bdf7cb-995e-ec11-8f8f-000d3a31376e\",\"label\":\"options\",\"isMultiSelect\":false,\"value\":\"1\",\"style\":\"compact\",\"choices\":[{\"title\":\"one\",\"value\":\"1\"},{\"title\":\"two\",\"value\":\"2\"},{\"title\":\"three\",\"value\":\"3\"}]},{\"type\":\"Input.Toggle\",\"id\":\"b26011d2-995e-ec11-8f8f-000d3a31376e\",\"title\":\"consent\",\"valueOn\":\"True\",\"valueOff\":\"False\",\"value\":\"false\"},{\"type\":\"TextBlock\",\"isSubtle\":true,\"text\":\"Fields marked with * are mandatory.\",\"wrap\":true}],\"actions\":[{\"type\":\"Action.Submit\",\"title\":\"Submit\",\"data\":{\"Type\":\"InputSubmit\"}}]}",
1205
+ onSubmit: function () {} // Detailed implementation omitted
1206
+ },
1207
+
1208
+ styleProps: {
1209
+ generalStyleProps: {
1210
+ borderStyle: "solid",
1211
+ borderRadius: "4px",
1212
+ borderWidth: "0px",
1213
+ backgroundColor: "#FFFFFF",
1214
+ borderColor: "#F1F1F1",
1215
+ overflowY: "auto",
1216
+ height: "inherit",
1217
+ width: "inherit"
1218
+ },
1219
+ customButtonStyleProps: {
1220
+ backgroundColor: "rgb(49, 95, 162)",
1221
+ color: "#FFFFFF",
1222
+ fontFamily: "Segoe UI, Arial, sans-serif",
1223
+ fontSize: "15px",
1224
+ height: "48px"
1225
+ },
1226
+ adaptiveCardContainerStyleProps: {
1227
+ border: "1px solid #ECECEC",
1228
+ borderRadius: "4px",
1229
+ margin: "3%"
1230
+ },
1231
+ customTextInputStyleProps: {
1232
+ height: "20px"
1233
+ },
1234
+ customMultilineTextInputStyleProps: {
1235
+ height: "52px"
1236
+ }
1237
+ }
1238
+ },
1187
1239
  proactiveChatPaneProps: {
1188
1240
  componentOverrides: {
1189
1241
  title: undefined,
@@ -1562,10 +1614,10 @@ export const dummyDefaultProps = {
1562
1614
  padding: "0px 10px 0 10px"
1563
1615
  },
1564
1616
  userMessageBoxStyles: {
1565
- maxWidth: "75%"
1617
+ maxWidth: "90%"
1566
1618
  },
1567
1619
  systemMessageBoxStyles: {
1568
- maxWidth: "75%"
1620
+ maxWidth: "90%"
1569
1621
  },
1570
1622
  typingIndicatorStyleProps: {
1571
1623
  marginLeft: "10px",
@@ -12,15 +12,15 @@ import { getAuthClientFunction, handleAuthentication } from "./authHelper";
12
12
 
13
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
14
  const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
15
- var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _conversationDetails;
16
- const isPostChatEnabled = (_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable;
17
- const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
15
+ var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates$l, _state$domainStates$l2, _props$chatConfig2, _props$chatConfig2$Li, _state$domainStates$l3, _state$domainStates$l4, _conversationDetails;
16
+ const isPostChatEnabled = ((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_postconversationsurveyenable) ?? ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable);
17
+ const postChatSurveyMode = ((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_postconversationsurveymode) ?? ((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode);
18
18
 
19
19
  //Unable to end chat if token has expired
20
20
  if (props.getAuthToken) {
21
21
  const authClientFunction = getAuthClientFunction(props.chatConfig);
22
22
  if (props.getAuthToken && authClientFunction) {
23
- // set auth token to chat sdk before start chat
23
+ // set auth token to chat sdk before end chat
24
24
  const authSuccess = await handleAuthentication(chatSDK, props.chatConfig, props.getAuthToken);
25
25
  if (!authSuccess) {
26
26
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
@@ -56,15 +56,20 @@ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
56
56
  chatSDK.requestId = chatSession.requestId;
57
57
  }
58
58
  if (postChatSurveyMode === PostChatSurveyMode.Embed) {
59
- dispatch({
60
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
61
- payload: ConversationState.PostchatLoading
62
- });
63
- await addDelayInMs(Constants.PostChatLoadingDurationInMs);
64
- const loadPostChatEvent = {
65
- eventName: BroadcastEvent.LoadPostChatSurvey
66
- };
67
- BroadcastService.postMessage(loadPostChatEvent);
59
+ // Only start embedded Postchat workflow if postchat context is set successfully else close chat
60
+ if (state.domainStates.postChatContext) {
61
+ dispatch({
62
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
63
+ payload: ConversationState.PostchatLoading
64
+ });
65
+ await addDelayInMs(Constants.PostChatLoadingDurationInMs);
66
+ const loadPostChatEvent = {
67
+ eventName: BroadcastEvent.LoadPostChatSurvey
68
+ };
69
+ BroadcastService.postMessage(loadPostChatEvent);
70
+ } else {
71
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, true, false, true);
72
+ }
68
73
  } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
69
74
  var _props$webChatContain, _props$webChatContain2;
70
75
  dispatch({
@@ -150,10 +155,6 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
150
155
  type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
151
156
  payload: null
152
157
  });
153
- dispatch({
154
- type: LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
155
- payload: 0
156
- });
157
158
  dispatch({
158
159
  type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
159
160
  payload: {
@@ -176,6 +177,11 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
176
177
  exception: `Failed to endChat: ${error}`
177
178
  }
178
179
  });
180
+ } finally {
181
+ dispatch({
182
+ type: LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
183
+ payload: 0
184
+ });
179
185
  }
180
186
  }
181
187
  };
@@ -33,7 +33,7 @@ import { Constants } from "../../../common/Constants";
33
33
 
34
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
35
  export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
36
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
36
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$chatConfig, _props$chatConfig$Liv, _state$domainStates$l, _state$domainStates$l2, _props$chatConfig2, _props$chatConfig2$Li, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
37
37
  const localizedTexts = {
38
38
  ...defaultMiddlewareLocalizedTexts,
39
39
  ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.localizedTexts)
@@ -41,8 +41,8 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
41
41
  const disableNewLineMarkdownSupport = ((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.disableNewLineMarkdownSupport) ?? defaultWebChatContainerStatefulProps.disableNewLineMarkdownSupport;
42
42
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
43
43
  const markdown = createMarkdown(((_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.disableMarkdownMessageFormatting) ?? defaultWebChatContainerStatefulProps.disableMarkdownMessageFormatting, disableNewLineMarkdownSupport);
44
- const isPostChatEnabled = (_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable;
45
- const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
44
+ const isPostChatEnabled = ((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_postconversationsurveyenable) ?? ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable);
45
+ const postChatSurveyMode = ((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_postconversationsurveymode) ?? ((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode);
46
46
 
47
47
  // Initialize Web Chat's redux store
48
48
  let webChatStore = WebChatStoreLoader.store;
@@ -64,16 +64,28 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
64
64
  }
65
65
  if (isPostChatEnabled === "true") {
66
66
  if (postChatSurveyMode === PostChatSurveyMode.Embed) {
67
- WebChatStoreLoader.store = null;
68
- dispatch({
69
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
70
- payload: ConversationState.PostchatLoading
71
- });
72
- await addDelayInMs(Constants.PostChatLoadingDurationInMs);
73
- const loadPostChatEvent = {
74
- eventName: BroadcastEvent.LoadPostChatSurvey
75
- };
76
- BroadcastService.postMessage(loadPostChatEvent);
67
+ // Only start embedded Postchat workflow if postchat context is set successfully else close chat
68
+ if (state.domainStates.postChatContext) {
69
+ WebChatStoreLoader.store = null;
70
+ dispatch({
71
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
72
+ payload: ConversationState.PostchatLoading
73
+ });
74
+ await addDelayInMs(Constants.PostChatLoadingDurationInMs);
75
+ const loadPostChatEvent = {
76
+ eventName: BroadcastEvent.LoadPostChatSurvey
77
+ };
78
+ BroadcastService.postMessage(loadPostChatEvent);
79
+ } else {
80
+ dispatch({
81
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
82
+ payload: ConversationState.InActive
83
+ });
84
+ dispatch({
85
+ type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
86
+ payload: true
87
+ });
88
+ }
77
89
  } else if (postChatSurveyMode === PostChatSurveyMode.Link) {
78
90
  dispatch({
79
91
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
@@ -1,11 +1,12 @@
1
1
  import "regenerator-runtime/runtime";
2
2
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
+ import { handleAuthentication, removeAuthTokenProvider } from "./authHelper";
4
+ import { isNullOrEmptyString, isNullOrUndefined } from "../../../common/utils";
3
5
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
4
6
  import { ConversationState } from "../../../contexts/common/ConversationState";
5
7
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
6
8
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
7
- import { handleAuthentication, removeAuthTokenProvider } from "./authHelper";
8
- import { isNullOrEmptyString, isNullOrUndefined } from "../../../common/utils";
9
+
9
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
11
  const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
11
12
  var _props$chatConfig, _props$chatConfig$Liv;
@@ -53,14 +54,14 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
53
54
  const chatReconnectOptionalParams = {
54
55
  reconnectId: (_props$reconnectChatP4 = props.reconnectChatPaneProps) === null || _props$reconnectChatP4 === void 0 ? void 0 : _props$reconnectChatP4.reconnectId
55
56
  };
57
+ // Get auth token for getting chat reconnect context
56
58
  if (isAuthenticatedChat) {
57
- // Get auth token for for getting chat reconnect context
58
59
  await handleAuthentication(chatSDK, chatConfig, props.getAuthToken);
59
60
  }
60
61
  const reconnectChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatReconnectContext(chatReconnectOptionalParams));
61
62
  if (isAuthenticatedChat) {
62
63
  // remove auth token after reconnectId is fetched
63
- // this will be reset later at start chat
64
+ // AuthToken will be reset later at start chat
64
65
  removeAuthTokenProvider(chatSDK);
65
66
  }
66
67
  return reconnectChatContext;
@@ -76,10 +77,7 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
76
77
 
77
78
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
79
  const setReconnectIdAndStartChat = async (isAuthenticatedChat, chatSDK, props, dispatch, setAdapter, reconnectId, initStartChat) => {
79
- if (isAuthenticatedChat) {
80
- // Get auth token for for getting chat reconnect context
81
- await handleAuthentication(chatSDK, props.chatConfig, props.getAuthToken);
82
- } else {
80
+ if (!isAuthenticatedChat) {
83
81
  const startUnauthenticatedReconnectChat = {
84
82
  eventName: BroadcastEvent.StartUnauthenticatedReconnectChat
85
83
  };
@@ -96,7 +94,7 @@ const setReconnectIdAndStartChat = async (isAuthenticatedChat, chatSDK, props, d
96
94
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
97
95
  payload: ConversationState.Loading
98
96
  });
99
- await initStartChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, optionalParams);
97
+ await initStartChat(chatSDK, dispatch, setAdapter, props, optionalParams);
100
98
  };
101
99
  const redirectPage = (redirectURL, redirectInSameWindow) => {
102
100
  const redirectPageRequest = {