@seamly/web-ui 21.0.7 → 21.0.9

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 (44) hide show
  1. package/build/dist/lib/components.js +224 -231
  2. package/build/dist/lib/components.min.js +1 -1
  3. package/build/dist/lib/hooks.js +116 -16
  4. package/build/dist/lib/hooks.min.js +1 -1
  5. package/build/dist/lib/index.debug.js +50 -39
  6. package/build/dist/lib/index.debug.min.js +1 -1
  7. package/build/dist/lib/index.debug.min.js.LICENSE.txt +5 -1
  8. package/build/dist/lib/index.js +208 -220
  9. package/build/dist/lib/index.min.js +1 -1
  10. package/build/dist/lib/standalone.js +215 -251
  11. package/build/dist/lib/standalone.min.js +1 -1
  12. package/build/dist/lib/style-guide.js +194 -191
  13. package/build/dist/lib/style-guide.min.js +1 -1
  14. package/build/dist/lib/utils.js +192 -189
  15. package/build/dist/lib/utils.min.js +1 -1
  16. package/package.json +1 -1
  17. package/src/javascripts/domains/forms/provider.tsx +1 -1
  18. package/src/javascripts/domains/i18n/slice.ts +2 -0
  19. package/src/javascripts/domains/interrupt/hooks.ts +15 -7
  20. package/src/javascripts/domains/interrupt/middleware.ts +7 -14
  21. package/src/javascripts/domains/interrupt/selectors.ts +4 -0
  22. package/src/javascripts/domains/interrupt/slice.ts +2 -2
  23. package/src/javascripts/domains/translations/components/translation-status.tsx +4 -3
  24. package/src/javascripts/domains/translations/slice.ts +2 -0
  25. package/src/javascripts/ui/components/app-options/index.js +4 -3
  26. package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +9 -13
  27. package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +5 -5
  28. package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +4 -3
  29. package/src/javascripts/ui/components/faq/faq.js +5 -4
  30. package/src/javascripts/ui/components/layout/agent-info.js +4 -3
  31. package/src/javascripts/ui/components/layout/chat-frame.js +7 -8
  32. package/src/javascripts/ui/components/layout/deprecated-chat-frame.js +7 -8
  33. package/src/javascripts/ui/components/layout/interrupt.js +6 -15
  34. package/src/javascripts/ui/components/layout/pre-chat-messages.js +4 -3
  35. package/src/javascripts/ui/components/suggestions/index.js +5 -4
  36. package/src/javascripts/ui/components/translation-chat-status/index.tsx +4 -3
  37. package/src/javascripts/ui/components/view/app-view.js +1 -2
  38. package/src/javascripts/ui/components/view/deprecated-view.js +1 -2
  39. package/src/javascripts/ui/components/view/inline-view.js +1 -11
  40. package/src/javascripts/ui/components/view/window-view/index.js +1 -9
  41. package/src/javascripts/ui/components/view/window-view/window-open-button.js +4 -3
  42. package/src/javascripts/ui/hooks/{use-seamly-chat.js → use-seamly-chat.ts} +5 -1
  43. package/src/javascripts/ui/hooks/use-session-expired-command.ts +17 -0
  44. package/src/.DS_Store +0 -0
@@ -7393,7 +7393,7 @@ _API_ready = new WeakMap(), _API_externalId = new WeakMap(), _API_layoutMode = n
7393
7393
  return {
7394
7394
  clientName: "@seamly/web-ui",
7395
7395
  clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
7396
- clientVersion: "21.0.7",
7396
+ clientVersion: "21.0.9",
7397
7397
  currentUrl: window.location.toString(),
7398
7398
  screenResolution: `${window.screen.width}x${window.screen.height}`,
7399
7399
  timezone: getTimeZone(),
@@ -11729,7 +11729,7 @@ const interruptSlice = createSlice({
11729
11729
  clearInterrupt: () => slice_initialState
11730
11730
  },
11731
11731
  extraReducers: builder => {
11732
- builder.addCase(resetApp.fulfilled, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
11732
+ builder.addCase(initializeConfig.pending, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
11733
11733
  payload
11734
11734
  }) => {
11735
11735
  state.error = payload;
@@ -12605,6 +12605,7 @@ const {
12605
12605
 
12606
12606
 
12607
12607
 
12608
+
12608
12609
  const i18n_slice_initialState = {
12609
12610
  translations: {
12610
12611
  'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
@@ -12641,7 +12642,7 @@ const i18nSlice = createSlice({
12641
12642
  },
12642
12643
  extraReducers: builder => {
12643
12644
  // Add reducers for additional action types here, and handle loading state as needed
12644
- builder.addCase(initializeConfig.fulfilled, (state, {
12645
+ builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(initializeConfig.fulfilled, (state, {
12645
12646
  payload
12646
12647
  }) => {
12647
12648
  state.initialLocale = payload.locale;
@@ -12671,12 +12672,7 @@ const {
12671
12672
  ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/middleware.ts
12672
12673
 
12673
12674
 
12674
-
12675
-
12676
-
12677
-
12678
-
12679
- const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
12675
+ const handledErrorTypes = ['SeamlyGeneralError', 'SeamlyConfigurationError', 'SeamlySessionExpiredError', 'SeamlyOfflineError', 'SeamlyUnauthorizedError', 'SeamlyUnavailableError'];
12680
12676
  function createInterruptMiddleware({
12681
12677
  api
12682
12678
  }) {
@@ -12686,7 +12682,7 @@ function createInterruptMiddleware({
12686
12682
  type
12687
12683
  } = action;
12688
12684
  if (type === setInterrupt.type) {
12689
- if (!handledErrorTypes.some(ErrorType => payload.name === ErrorType.name)) {
12685
+ if (!handledErrorTypes.includes(payload.name)) {
12690
12686
  throw new SeamlyGeneralError(payload);
12691
12687
  } else if (payload.action === 'reset') {
12692
12688
  // [SMLY-942] We clear the store before a reset to force a new conversation if the page is refreshed before the conversation is reset
@@ -12749,6 +12745,7 @@ const selectIsLoading = es_createSelector(({
12749
12745
 
12750
12746
 
12751
12747
 
12748
+
12752
12749
  const translationsInitialState = {
12753
12750
  isActive: false,
12754
12751
  currentLocale: undefined,
@@ -12839,7 +12836,7 @@ const translationSlice = createSlice({
12839
12836
  }
12840
12837
  },
12841
12838
  extraReducers: builder => {
12842
- builder.addCase(initializeConfig.fulfilled, (state, {
12839
+ builder.addCase(resetApp.pending, () => translationsInitialState).addCase(initializeConfig.fulfilled, (state, {
12843
12840
  payload
12844
12841
  }) => {
12845
12842
  var _a;
@@ -14026,7 +14023,109 @@ const useLiveRegion = () => {
14026
14023
  sendAssertive
14027
14024
  };
14028
14025
  };
14029
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
14026
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
14027
+
14028
+ const selectError = es_createSelector(({
14029
+ interrupt
14030
+ }) => interrupt, ({
14031
+ error
14032
+ }) => error);
14033
+ const selectHasError = es_createSelector(selectError, error => Boolean(error));
14034
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
14035
+
14036
+
14037
+
14038
+
14039
+ function useInterrupt() {
14040
+ const {
14041
+ t
14042
+ } = useI18n();
14043
+ const error = useSelector_useSelector(selectError);
14044
+ const hasError = useSelector_useSelector(selectHasError);
14045
+ const meta = (0,hooks_.useMemo)(() => {
14046
+ if (!hasError) {
14047
+ return {
14048
+ title: undefined,
14049
+ message: undefined,
14050
+ srText: undefined,
14051
+ buttonText: undefined,
14052
+ originalError: undefined
14053
+ };
14054
+ }
14055
+ const {
14056
+ langKey,
14057
+ action
14058
+ } = error;
14059
+ const title = t(`${langKey}.title`);
14060
+ const message = t(`${langKey}.message`);
14061
+ const srText = t(`${langKey}.srText`);
14062
+ const buttonText = t(`${langKey}.buttonText`);
14063
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
14064
+ title,
14065
+ message,
14066
+ srText
14067
+ } : {}), action ? {
14068
+ action
14069
+ } : {}), action && langKey ? {
14070
+ buttonText
14071
+ } : {}), {
14072
+ originalError: error
14073
+ });
14074
+ }, [hasError, error, t]);
14075
+ return {
14076
+ hasError,
14077
+ meta,
14078
+ error
14079
+ };
14080
+ }
14081
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-session-expired-command.ts
14082
+
14083
+
14084
+
14085
+ function useSessionExpiredCommand() {
14086
+ const {
14087
+ meta: {
14088
+ originalError,
14089
+ action
14090
+ }
14091
+ } = useInterrupt();
14092
+ const seamlyCommands = use_seamly_commands();
14093
+ const isExpiredError = (originalError === null || originalError === void 0 ? void 0 : originalError.name) === 'SeamlySessionExpiredError';
14094
+ (0,hooks_.useEffect)(() => {
14095
+ if (isExpiredError && seamlyCommands[action]) {
14096
+ seamlyCommands[action]();
14097
+ }
14098
+ }, [action, seamlyCommands, isExpiredError]);
14099
+ }
14100
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.ts
14101
+ var use_seamly_chat_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
14102
+ function adopt(value) {
14103
+ return value instanceof P ? value : new P(function (resolve) {
14104
+ resolve(value);
14105
+ });
14106
+ }
14107
+ return new (P || (P = Promise))(function (resolve, reject) {
14108
+ function fulfilled(value) {
14109
+ try {
14110
+ step(generator.next(value));
14111
+ } catch (e) {
14112
+ reject(e);
14113
+ }
14114
+ }
14115
+ function rejected(value) {
14116
+ try {
14117
+ step(generator["throw"](value));
14118
+ } catch (e) {
14119
+ reject(e);
14120
+ }
14121
+ }
14122
+ function step(result) {
14123
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
14124
+ }
14125
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14126
+ });
14127
+ };
14128
+
14030
14129
 
14031
14130
 
14032
14131
 
@@ -14065,6 +14164,8 @@ const useSeamlyChat = () => {
14065
14164
  const {
14066
14165
  sendAssertive
14067
14166
  } = useLiveRegion();
14167
+ // Automatically reset conversation if the session has expired
14168
+ useSessionExpiredCommand();
14068
14169
  (0,hooks_.useEffect)(() => {
14069
14170
  if (isVisible) {
14070
14171
  // Wait for the live containers to stabilise in the DOM before injecting
@@ -14111,24 +14212,23 @@ const useSeamlyChat = () => {
14111
14212
  connectCalled.current = false;
14112
14213
  }
14113
14214
  }, [apiConfigReady, apiConnected]);
14114
- const connectAndStart = (0,hooks_.useCallback)(async () => {
14215
+ const connectAndStart = (0,hooks_.useCallback)(() => use_seamly_chat_awaiter(void 0, void 0, void 0, function* () {
14115
14216
  // We don't connect if we are already connected to the api to avoid multiple in-flight connection processes.
14116
14217
  if (!apiConnected) {
14117
14218
  connectCalled.current = true;
14118
- await connect();
14219
+ yield connect();
14119
14220
  }
14120
-
14121
14221
  // We only start a conversation when the chat interface is either app, 'open' or if using the inline view if it's 'open' or 'minimized'.
14122
14222
  if (isApp || isOpen || isVisible && isInline) {
14123
14223
  start();
14124
14224
  }
14125
- }, [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
14225
+ }), [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
14126
14226
  (0,hooks_.useEffect)(() => {
14127
14227
  // We dont't connect or start when the apiConfig is not ready yet.
14128
14228
  // We also keep track of whether start has been called to avoid multiple in-flight connection processes.
14129
14229
  // We check if the window view is not open and no conversation is started yet.
14130
14230
  // Lastly we check if the inline view is not scrolled in to view.
14131
- if (!apiConfigReady || connectCalled.current || isWindow && !isOpen && !hasConversation() || isInline && (!isVisible || !showInlineView)) {
14231
+ if (!apiConfigReady || connectCalled.current || isWindow && !isOpen || isInline && (!isVisible || !showInlineView)) {
14132
14232
  return;
14133
14233
  }
14134
14234
  if (hasConversation() && isOpen) {
@@ -18002,7 +18102,7 @@ const SeamlyEventSubscriber = () => {
18002
18102
  channel === null || channel === void 0 ? void 0 : channel.leave();
18003
18103
  };
18004
18104
  }
18005
- return () => {};
18105
+ return () => undefined;
18006
18106
  }, [api, api.connectionInfo, api.conversation]);
18007
18107
  (0,hooks_.useEffect)(() => {
18008
18108
  api.conversation.onConnection(({
@@ -18185,6 +18285,9 @@ const SeamlyEventSubscriber = () => {
18185
18285
  const {
18186
18286
  channel
18187
18287
  } = api.conversation;
18288
+ if (messageChannelRef.current) {
18289
+ channel === null || channel === void 0 ? void 0 : channel.off('message', messageChannelRef.current);
18290
+ }
18188
18291
  messageChannelRef.current = channel.on('message', payload => {
18189
18292
  if (!EMITTABLE_MESSAGE_TYPES.includes(payload.type)) {
18190
18293
  return payload;
@@ -18201,19 +18304,18 @@ const SeamlyEventSubscriber = () => {
18201
18304
  });
18202
18305
  return true;
18203
18306
  });
18204
- return () => {
18205
- var _a;
18206
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('message', messageChannelRef.current);
18207
- };
18208
18307
  }
18209
- return () => undefined;
18210
18308
  }, [api, api.connectionInfo, api.conversation.channel, eventBus]);
18211
18309
  (0,hooks_.useEffect)(() => {
18212
18310
  if (api.connectionInfo) {
18213
18311
  api.conversation.onConnection(({
18214
18312
  connected
18215
18313
  }) => {
18314
+ var _a;
18216
18315
  if (!connected) return false;
18316
+ if (syncChannelRef.current) {
18317
+ (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
18318
+ }
18217
18319
  syncChannelRef.current = api.conversation.channel.on('sync', payload => {
18218
18320
  var _a;
18219
18321
  const lastEvent = events[events.length - 1];
@@ -18237,12 +18339,7 @@ const SeamlyEventSubscriber = () => {
18237
18339
  });
18238
18340
  return true;
18239
18341
  });
18240
- return () => {
18241
- var _a;
18242
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
18243
- };
18244
18342
  }
18245
- return () => undefined;
18246
18343
  }, [api, api.connectionInfo, api.conversation.channel, events, dispatch]);
18247
18344
  return null;
18248
18345
  };
@@ -18378,52 +18475,6 @@ const SeamlyInitializer = () => {
18378
18475
  return null;
18379
18476
  };
18380
18477
  /* harmony default export */ const seamly_initializer = (SeamlyInitializer);
18381
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
18382
-
18383
- const selectError = es_createSelector(({
18384
- interrupt
18385
- }) => interrupt, ({
18386
- error
18387
- }) => error);
18388
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
18389
-
18390
-
18391
-
18392
-
18393
- function useInterrupt() {
18394
- const {
18395
- t
18396
- } = useI18n();
18397
- const error = useSelector_useSelector(selectError);
18398
- const hasInterrupt = Boolean(error);
18399
- const meta = (0,hooks_.useMemo)(() => {
18400
- if (!error) return {};
18401
- const {
18402
- langKey,
18403
- action
18404
- } = error;
18405
- const title = t(`${langKey}.title`);
18406
- const message = t(`${langKey}.message`);
18407
- const srText = t(`${langKey}.srText`);
18408
- const buttonText = t(`${langKey}.buttonText`);
18409
- return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
18410
- title,
18411
- message,
18412
- srText
18413
- } : {}), action ? {
18414
- action
18415
- } : {}), action && langKey ? {
18416
- buttonText
18417
- } : {}), {
18418
- originalError: error
18419
- });
18420
- }, [t, error]);
18421
- return {
18422
- hasInterrupt,
18423
- meta,
18424
- error
18425
- };
18426
- }
18427
18478
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-instance-functions-loader.js
18428
18479
 
18429
18480
 
@@ -18473,9 +18524,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18473
18524
  isInline,
18474
18525
  isResolving
18475
18526
  } = useSeamlyLayoutMode();
18476
- const {
18477
- hasInterrupt
18478
- } = useInterrupt();
18527
+ const hasError = useSelector_useSelector(selectHasError);
18479
18528
  const currentConversationUrl = useSeamlyConversationUrl();
18480
18529
  const prevConversationUrl = (0,hooks_.useRef)(null);
18481
18530
  const onActivityHandler = use_seamly_activity_event_handler();
@@ -18555,7 +18604,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18555
18604
  }
18556
18605
  }, [api.send]);
18557
18606
  (0,hooks_.useEffect)(() => {
18558
- if (!isResolving && !hasInterrupt) {
18607
+ if (!isResolving && !hasError) {
18559
18608
  // Check for app reset
18560
18609
  if (prevConversationUrl.current && prevConversationUrl.current !== currentConversationUrl) {
18561
18610
  eventBus.emit('unreadMessageCount', unreadCount);
@@ -18574,7 +18623,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18574
18623
  previousUnreadCount.current = unreadCount;
18575
18624
  prevConversationUrl.current = currentConversationUrl;
18576
18625
  }
18577
- }, [unreadCount, visible, eventBus, isInline, isResolving, hasInterrupt, currentConversationUrl]);
18626
+ }, [unreadCount, visible, eventBus, isInline, isResolving, hasError, currentConversationUrl]);
18578
18627
  return null;
18579
18628
  };
18580
18629
  /* harmony default export */ const seamly_instance_functions_loader = (SeamlyInstanceFunctionsLoader);
@@ -19051,6 +19100,7 @@ const InOutTransition = ({
19051
19100
 
19052
19101
 
19053
19102
 
19103
+
19054
19104
 
19055
19105
 
19056
19106
  const Suggestions = ({
@@ -19082,9 +19132,7 @@ const Suggestions = ({
19082
19132
  sendPolite
19083
19133
  } = useLiveRegion();
19084
19134
  // interrupt & countdown hooks
19085
- const {
19086
- hasInterrupt
19087
- } = useInterrupt();
19135
+ const hasError = useSelector_useSelector(selectHasError);
19088
19136
  const {
19089
19137
  hasCountdown,
19090
19138
  endCountdown
@@ -19101,7 +19149,7 @@ const Suggestions = ({
19101
19149
  } = useTranslatedEventData({
19102
19150
  payload
19103
19151
  });
19104
- const suggestions = (0,hooks_.useMemo)(() => payload && !hasInterrupt ? eventBody : [], [payload, hasInterrupt, eventBody]);
19152
+ const suggestions = (0,hooks_.useMemo)(() => payload && !hasError ? eventBody : [], [payload, hasError, eventBody]);
19105
19153
  const prevSuggestions = (0,hooks_.useRef)(null);
19106
19154
  const prevHasSuggestions = (0,hooks_.useRef)(false);
19107
19155
  const previousRenderedSuggestions = (0,hooks_.useRef)([]);
@@ -19553,10 +19601,9 @@ function FormProvider(_a) {
19553
19601
  });
19554
19602
  }, [setExternalErrors]);
19555
19603
  const handleSubmit = (0,hooks_.useCallback)((e) => {
19556
- var _a;
19557
19604
  e.preventDefault();
19558
19605
  // If the submitter is set to being aria-disabled, block the submit action
19559
- const ariaDisabled = ((_a = e.submitter) === null || _a === void 0 ? void 0 : _a.ariaDisabled) === 'true';
19606
+ const ariaDisabled = e.submitter.getAttribute('aria-disabled') === 'true';
19560
19607
  setIsSubmitted(!ariaDisabled);
19561
19608
  if (!ariaDisabled && validationIsValid) {
19562
19609
  dispatch(setHasResponded(true));
@@ -20231,6 +20278,7 @@ function TranslationsOptionsButton({ children, position = {
20231
20278
 
20232
20279
 
20233
20280
 
20281
+
20234
20282
  function AppOptions() {
20235
20283
  const {
20236
20284
  menuOptions,
@@ -20239,15 +20287,13 @@ function AppOptions() {
20239
20287
  const {
20240
20288
  isAvailable: isTranslationsAvailable
20241
20289
  } = useTranslations();
20242
- const {
20243
- hasInterrupt
20244
- } = useInterrupt();
20290
+ const hasError = useSelector_useSelector(selectHasError);
20245
20291
  const {
20246
20292
  t,
20247
20293
  locale
20248
20294
  } = useI18n();
20249
20295
  const localeNativeName = useLocaleNativeName(locale);
20250
- if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasInterrupt) {
20296
+ if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasError) {
20251
20297
  return null;
20252
20298
  }
20253
20299
  const openButtonText = t('translations.settings.openButtonText', {
@@ -21509,10 +21555,11 @@ const ChatStatus = ({ children, handleClose, title, closeButtonText, srCloseButt
21509
21555
 
21510
21556
 
21511
21557
 
21558
+
21512
21559
  function TranslationChatStatus() {
21513
21560
  const { t } = useI18n();
21514
21561
  const { id } = useTranslationsContainer();
21515
- const { hasInterrupt } = useInterrupt();
21562
+ const hasError = useSelector_useSelector(selectHasError);
21516
21563
  const { disableTranslations, currentLocale } = useTranslations();
21517
21564
  const localeNativeName = useLocaleNativeName(currentLocale);
21518
21565
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
@@ -21521,7 +21568,7 @@ function TranslationChatStatus() {
21521
21568
  disableTranslations();
21522
21569
  focusSkiplinkTarget();
21523
21570
  }, [disableTranslations, focusSkiplinkTarget]);
21524
- if (hasInterrupt) {
21571
+ if (hasError) {
21525
21572
  return null;
21526
21573
  }
21527
21574
  return ((0,jsx_runtime_namespaceObject.jsx)(chat_status, { handleClose: handleClickStop, title: label, id: id, closeButtonText: t('translations.status.stopText'), srCloseButtonText: t('translations.status.srStopText') }));
@@ -21554,24 +21601,17 @@ function TranslationProposal() {
21554
21601
 
21555
21602
 
21556
21603
 
21604
+
21557
21605
  function TranslationStatus() {
21558
- const { hasInterrupt } = useInterrupt();
21606
+ const hasError = useSelector_useSelector(selectHasError);
21559
21607
  const { isActive } = useTranslations();
21560
- if (hasInterrupt) {
21608
+ if (hasError) {
21561
21609
  return null;
21562
21610
  }
21563
21611
  return !isActive ? (0,jsx_runtime_namespaceObject.jsx)(TranslationProposal, {}) : (0,jsx_runtime_namespaceObject.jsx)(TranslationChatStatus, {});
21564
21612
  }
21565
21613
 
21566
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
21567
- function chat_frame_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21568
- function chat_frame_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? chat_frame_ownKeys(Object(source), !0).forEach(function (key) { chat_frame_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : chat_frame_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21569
- function chat_frame_defineProperty(obj, key, value) { key = chat_frame_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21570
- function chat_frame_toPropertyKey(arg) { var key = chat_frame_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21571
- function chat_frame_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); }
21572
-
21573
-
21574
-
21614
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
21575
21615
 
21576
21616
 
21577
21617
 
@@ -21580,61 +21620,24 @@ function chat_frame_toPrimitive(input, hint) { if (typeof input !== "object" ||
21580
21620
 
21581
21621
 
21582
21622
 
21583
- function ChatFrame({
21584
- children,
21585
- interruptComponent: InterruptComponent
21586
- }) {
21623
+ const Interrupt = () => {
21587
21624
  const {
21588
- hasInterrupt,
21589
- meta
21590
- } = useInterrupt();
21591
- const {
21592
- isOpen
21593
- } = useVisibility();
21594
- if (hasInterrupt) {
21595
- if (isOpen) {
21596
- return (0,jsx_runtime_namespaceObject.jsx)(InterruptComponent, chat_frame_objectSpread({}, meta));
21625
+ meta: {
21626
+ originalError,
21627
+ title,
21628
+ message,
21629
+ buttonText,
21630
+ action,
21631
+ srText
21597
21632
  }
21598
- return null;
21599
- }
21600
- return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21601
- children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
21602
- children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
21603
- className: css_className('chat__container__header'),
21604
- children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
21605
- }), children]
21606
- }), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
21607
- });
21608
- }
21609
- /* harmony default export */ const chat_frame = (ChatFrame);
21610
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
21611
-
21612
-
21613
-
21614
-
21615
-
21616
-
21617
-
21618
- const Interrupt = ({
21619
- originalError,
21620
- title,
21621
- message,
21622
- buttonText,
21623
- action,
21624
- srText
21625
- }) => {
21633
+ } = useInterrupt();
21626
21634
  const seamlyCommands = use_seamly_commands();
21627
21635
  const headingId = useGeneratedId();
21628
21636
  const {
21629
21637
  sendPolite
21630
21638
  } = useLiveRegion();
21631
21639
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
21632
- const isExpiredError = originalError.name === 'SeamlySessionExpiredError';
21633
- (0,hooks_.useEffect)(() => {
21634
- if (isExpiredError && seamlyCommands[action]) {
21635
- seamlyCommands[action]();
21636
- }
21637
- }, [action, seamlyCommands, isExpiredError]);
21640
+ const isExpiredError = originalError?.name === 'SeamlySessionExpiredError';
21638
21641
  (0,hooks_.useEffect)(() => {
21639
21642
  if (!isExpiredError && srText) {
21640
21643
  // Wait for live regions to stabilise in case this occurs
@@ -21675,16 +21678,48 @@ const Interrupt = ({
21675
21678
  }) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {});
21676
21679
  };
21677
21680
  /* harmony default export */ const interrupt = (Interrupt);
21678
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
21681
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
21682
+
21683
+
21684
+
21685
+
21686
+
21687
+
21688
+
21679
21689
 
21680
21690
 
21681
21691
 
21682
21692
 
21683
21693
 
21694
+
21695
+ function ChatFrame({
21696
+ children
21697
+ }) {
21698
+ const hasError = useSelector_useSelector(selectHasError);
21699
+ const {
21700
+ isOpen
21701
+ } = useVisibility();
21702
+ if (hasError) {
21703
+ return (0,jsx_runtime_namespaceObject.jsx)(interrupt, {});
21704
+ }
21705
+ return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21706
+ children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
21707
+ children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
21708
+ className: css_className('chat__container__header'),
21709
+ children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
21710
+ }), children]
21711
+ }), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
21712
+ });
21713
+ }
21714
+ /* harmony default export */ const chat_frame = (ChatFrame);
21715
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
21716
+
21717
+
21718
+
21719
+
21684
21720
  const AppView = () => {
21685
21721
  return (0,jsx_runtime_namespaceObject.jsx)(chat, {
21686
21722
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21687
- interruptComponent: interrupt,
21688
21723
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21689
21724
  })
21690
21725
  });
@@ -21697,6 +21732,7 @@ const AppView = () => {
21697
21732
 
21698
21733
 
21699
21734
 
21735
+
21700
21736
  function PreChatMessageEvent({
21701
21737
  event
21702
21738
  }) {
@@ -21710,13 +21746,11 @@ function PreChatMessages() {
21710
21746
  preChatEvents,
21711
21747
  layoutMode
21712
21748
  } = useConfig();
21713
- const {
21714
- hasInterrupt
21715
- } = useInterrupt();
21749
+ const hasError = useSelector_useSelector(selectHasError);
21716
21750
  const {
21717
21751
  isOpen
21718
21752
  } = useVisibility();
21719
- const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
21753
+ const isVisible = !(hasError || !preChatEvents?.length || isOpen);
21720
21754
  return isVisible && (0,jsx_runtime_namespaceObject.jsx)("ul", {
21721
21755
  className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
21722
21756
  "aria-hidden": !isVisible,
@@ -21729,13 +21763,6 @@ function PreChatMessages() {
21729
21763
  });
21730
21764
  }
21731
21765
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/inline-view.js
21732
- function inline_view_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21733
- function inline_view_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? inline_view_ownKeys(Object(source), !0).forEach(function (key) { inline_view_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : inline_view_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21734
- function inline_view_defineProperty(obj, key, value) { key = inline_view_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21735
- function inline_view_toPropertyKey(arg) { var key = inline_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21736
- function inline_view_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); }
21737
-
21738
-
21739
21766
 
21740
21767
 
21741
21768
 
@@ -21755,13 +21782,6 @@ const InlineView = () => {
21755
21782
  const {
21756
21783
  isOpen
21757
21784
  } = useVisibility();
21758
- const {
21759
- hasInterrupt,
21760
- meta
21761
- } = useInterrupt();
21762
- if (hasInterrupt && !isOpen) {
21763
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, inline_view_objectSpread({}, meta));
21764
- }
21765
21785
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21766
21786
  children: [(0,jsx_runtime_namespaceObject.jsx)(in_out_transition, {
21767
21787
  isActive: !isOpen,
@@ -21777,7 +21797,6 @@ const InlineView = () => {
21777
21797
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
21778
21798
  ref: containerRef,
21779
21799
  children: showInlineView && (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21780
- interruptComponent: interrupt,
21781
21800
  children: isOpen && (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21782
21801
  })
21783
21802
  })
@@ -21799,13 +21818,12 @@ const InlineView = () => {
21799
21818
 
21800
21819
 
21801
21820
 
21821
+
21802
21822
  const ButtonIcon = () => {
21803
21823
  const startChatIcon = useStartChatIcon();
21804
21824
  const currentAgent = useSeamlyCurrentAgent();
21805
- const {
21806
- hasInterrupt
21807
- } = useInterrupt();
21808
- const isActiveConversation = currentAgent && !hasInterrupt;
21825
+ const hasError = useSelector_useSelector(selectHasError);
21826
+ const isActiveConversation = currentAgent && !hasError;
21809
21827
  const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
21810
21828
  return src ? (0,jsx_runtime_namespaceObject.jsx)("img", {
21811
21829
  className: css_className(isActiveConversation ? 'avatar' : 'icon'),
@@ -21851,13 +21869,6 @@ const WindowOpenButton = ({
21851
21869
  };
21852
21870
  /* harmony default export */ const window_open_button = (WindowOpenButton);
21853
21871
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/window-view/index.js
21854
- function window_view_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21855
- function window_view_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? window_view_ownKeys(Object(source), !0).forEach(function (key) { window_view_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : window_view_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21856
- function window_view_defineProperty(obj, key, value) { key = window_view_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21857
- function window_view_toPropertyKey(arg) { var key = window_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21858
- function window_view_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); }
21859
-
21860
-
21861
21872
 
21862
21873
 
21863
21874
 
@@ -21879,10 +21890,6 @@ const WindowView = () => {
21879
21890
  openChat
21880
21891
  } = useVisibility();
21881
21892
  const userHasResponded = useUserHasResponded();
21882
- const {
21883
- hasInterrupt,
21884
- meta
21885
- } = useInterrupt();
21886
21893
  const {
21887
21894
  t
21888
21895
  } = useI18n();
@@ -21894,9 +21901,6 @@ const WindowView = () => {
21894
21901
  }
21895
21902
  }
21896
21903
  }), [continueChatText]);
21897
- if (hasInterrupt && !isOpen) {
21898
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, window_view_objectSpread({}, meta));
21899
- }
21900
21904
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21901
21905
  children: [(0,jsx_runtime_namespaceObject.jsx)(window_open_button, {
21902
21906
  onClick: openChat
@@ -21921,7 +21925,6 @@ const WindowView = () => {
21921
21925
  transitionStartState: transitionStartStates.notRendered,
21922
21926
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
21923
21927
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21924
- interruptComponent: interrupt,
21925
21928
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21926
21929
  })
21927
21930
  })