@seamly/web-ui 21.0.8 → 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 (43) hide show
  1. package/build/dist/lib/components.js +222 -224
  2. package/build/dist/lib/components.min.js +1 -1
  3. package/build/dist/lib/hooks.js +114 -9
  4. package/build/dist/lib/hooks.min.js +1 -1
  5. package/build/dist/lib/index.debug.js +49 -38
  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 +206 -213
  9. package/build/dist/lib/index.min.js +1 -1
  10. package/build/dist/lib/standalone.js +213 -244
  11. package/build/dist/lib/standalone.min.js +1 -1
  12. package/build/dist/lib/style-guide.js +192 -184
  13. package/build/dist/lib/style-guide.min.js +1 -1
  14. package/build/dist/lib/utils.js +190 -182
  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/selectors.ts +4 -0
  21. package/src/javascripts/domains/interrupt/slice.ts +2 -2
  22. package/src/javascripts/domains/translations/components/translation-status.tsx +4 -3
  23. package/src/javascripts/domains/translations/slice.ts +2 -0
  24. package/src/javascripts/ui/components/app-options/index.js +4 -3
  25. package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +9 -13
  26. package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +5 -5
  27. package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +4 -3
  28. package/src/javascripts/ui/components/faq/faq.js +5 -4
  29. package/src/javascripts/ui/components/layout/agent-info.js +4 -3
  30. package/src/javascripts/ui/components/layout/chat-frame.js +7 -8
  31. package/src/javascripts/ui/components/layout/deprecated-chat-frame.js +7 -8
  32. package/src/javascripts/ui/components/layout/interrupt.js +6 -15
  33. package/src/javascripts/ui/components/layout/pre-chat-messages.js +4 -3
  34. package/src/javascripts/ui/components/suggestions/index.js +5 -4
  35. package/src/javascripts/ui/components/translation-chat-status/index.tsx +4 -3
  36. package/src/javascripts/ui/components/view/app-view.js +1 -2
  37. package/src/javascripts/ui/components/view/deprecated-view.js +1 -2
  38. package/src/javascripts/ui/components/view/inline-view.js +1 -11
  39. package/src/javascripts/ui/components/view/window-view/index.js +1 -9
  40. package/src/javascripts/ui/components/view/window-view/window-open-button.js +4 -3
  41. package/src/javascripts/ui/hooks/{use-seamly-chat.js → use-seamly-chat.ts} +5 -1
  42. package/src/javascripts/ui/hooks/use-session-expired-command.ts +17 -0
  43. package/src/.DS_Store +0 -0
@@ -17008,7 +17008,7 @@ _API_ready = new (weak_map_default())(), _API_externalId = new (weak_map_default
17008
17008
  return {
17009
17009
  clientName: "@seamly/web-ui",
17010
17010
  clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
17011
- clientVersion: "21.0.8",
17011
+ clientVersion: "21.0.9",
17012
17012
  currentUrl: window.location.toString(),
17013
17013
  screenResolution: `${window.screen.width}x${window.screen.height}`,
17014
17014
  timezone: getTimeZone(),
@@ -21516,7 +21516,7 @@ const interruptSlice = createSlice({
21516
21516
  clearInterrupt: () => slice_initialState
21517
21517
  },
21518
21518
  extraReducers: builder => {
21519
- builder.addCase(resetApp.fulfilled, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, _ref) => {
21519
+ builder.addCase(initializeConfig.pending, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, _ref) => {
21520
21520
  let {
21521
21521
  payload
21522
21522
  } = _ref;
@@ -22487,6 +22487,7 @@ const {
22487
22487
 
22488
22488
 
22489
22489
 
22490
+
22490
22491
  const i18n_slice_initialState = {
22491
22492
  translations: {
22492
22493
  'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
@@ -22524,7 +22525,7 @@ const i18nSlice = createSlice({
22524
22525
  },
22525
22526
  extraReducers: builder => {
22526
22527
  // Add reducers for additional action types here, and handle loading state as needed
22527
- builder.addCase(initializeConfig.fulfilled, (state, _ref2) => {
22528
+ builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(initializeConfig.fulfilled, (state, _ref2) => {
22528
22529
  let {
22529
22530
  payload
22530
22531
  } = _ref2;
@@ -22671,6 +22672,7 @@ var splice_default = /*#__PURE__*/__webpack_require__.n(splice);
22671
22672
 
22672
22673
 
22673
22674
 
22675
+
22674
22676
  const translationsInitialState = {
22675
22677
  isActive: false,
22676
22678
  currentLocale: undefined,
@@ -22769,7 +22771,7 @@ const translationSlice = createSlice({
22769
22771
  }
22770
22772
  },
22771
22773
  extraReducers: builder => {
22772
- builder.addCase(initializeConfig.fulfilled, (state, _ref6) => {
22774
+ builder.addCase(resetApp.pending, () => translationsInitialState).addCase(initializeConfig.fulfilled, (state, _ref6) => {
22773
22775
  let {
22774
22776
  payload
22775
22777
  } = _ref6;
@@ -23984,7 +23986,117 @@ const useLiveRegion = () => {
23984
23986
  sendAssertive
23985
23987
  };
23986
23988
  };
23987
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
23989
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
23990
+
23991
+ const selectError = es_createSelector(_ref => {
23992
+ let {
23993
+ interrupt
23994
+ } = _ref;
23995
+ return interrupt;
23996
+ }, _ref2 => {
23997
+ let {
23998
+ error
23999
+ } = _ref2;
24000
+ return error;
24001
+ });
24002
+ const selectHasError = es_createSelector(selectError, error => Boolean(error));
24003
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
24004
+
24005
+
24006
+
24007
+
24008
+
24009
+ function useInterrupt() {
24010
+ const {
24011
+ t
24012
+ } = useI18n();
24013
+ const error = useSelector_useSelector(selectError);
24014
+ const hasError = useSelector_useSelector(selectHasError);
24015
+ const meta = (0,hooks_module/* useMemo */.Ye)(() => {
24016
+ if (!hasError) {
24017
+ return {
24018
+ title: undefined,
24019
+ message: undefined,
24020
+ srText: undefined,
24021
+ buttonText: undefined,
24022
+ originalError: undefined
24023
+ };
24024
+ }
24025
+ const {
24026
+ langKey,
24027
+ action
24028
+ } = error;
24029
+ const title = t(`${langKey}.title`);
24030
+ const message = t(`${langKey}.message`);
24031
+ const srText = t(`${langKey}.srText`);
24032
+ const buttonText = t(`${langKey}.buttonText`);
24033
+ return assign_default()(assign_default()(assign_default()(assign_default()({}, langKey ? {
24034
+ title,
24035
+ message,
24036
+ srText
24037
+ } : {}), action ? {
24038
+ action
24039
+ } : {}), action && langKey ? {
24040
+ buttonText
24041
+ } : {}), {
24042
+ originalError: error
24043
+ });
24044
+ }, [hasError, error, t]);
24045
+ return {
24046
+ hasError,
24047
+ meta,
24048
+ error
24049
+ };
24050
+ }
24051
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-session-expired-command.ts
24052
+
24053
+
24054
+
24055
+ function useSessionExpiredCommand() {
24056
+ const {
24057
+ meta: {
24058
+ originalError,
24059
+ action
24060
+ }
24061
+ } = useInterrupt();
24062
+ const seamlyCommands = use_seamly_commands();
24063
+ const isExpiredError = (originalError === null || originalError === void 0 ? void 0 : originalError.name) === 'SeamlySessionExpiredError';
24064
+ (0,hooks_module/* useEffect */.d4)(() => {
24065
+ if (isExpiredError && seamlyCommands[action]) {
24066
+ seamlyCommands[action]();
24067
+ }
24068
+ }, [action, seamlyCommands, isExpiredError]);
24069
+ }
24070
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.ts
24071
+
24072
+
24073
+ var use_seamly_chat_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
24074
+ function adopt(value) {
24075
+ return value instanceof P ? value : new P(function (resolve) {
24076
+ resolve(value);
24077
+ });
24078
+ }
24079
+ return new (P || (P = (promise_default())))(function (resolve, reject) {
24080
+ function fulfilled(value) {
24081
+ try {
24082
+ step(generator.next(value));
24083
+ } catch (e) {
24084
+ reject(e);
24085
+ }
24086
+ }
24087
+ function rejected(value) {
24088
+ try {
24089
+ step(generator["throw"](value));
24090
+ } catch (e) {
24091
+ reject(e);
24092
+ }
24093
+ }
24094
+ function step(result) {
24095
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
24096
+ }
24097
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24098
+ });
24099
+ };
23988
24100
 
23989
24101
 
23990
24102
 
@@ -24024,6 +24136,8 @@ const useSeamlyChat = () => {
24024
24136
  const {
24025
24137
  sendAssertive
24026
24138
  } = useLiveRegion();
24139
+ // Automatically reset conversation if the session has expired
24140
+ useSessionExpiredCommand();
24027
24141
  (0,hooks_module/* useEffect */.d4)(() => {
24028
24142
  if (isVisible) {
24029
24143
  // Wait for the live containers to stabilise in the DOM before injecting
@@ -24070,24 +24184,23 @@ const useSeamlyChat = () => {
24070
24184
  connectCalled.current = false;
24071
24185
  }
24072
24186
  }, [apiConfigReady, apiConnected]);
24073
- const connectAndStart = (0,hooks_module/* useCallback */.I4)(async () => {
24187
+ const connectAndStart = (0,hooks_module/* useCallback */.I4)(() => use_seamly_chat_awaiter(void 0, void 0, void 0, function* () {
24074
24188
  // We don't connect if we are already connected to the api to avoid multiple in-flight connection processes.
24075
24189
  if (!apiConnected) {
24076
24190
  connectCalled.current = true;
24077
- await connect();
24191
+ yield connect();
24078
24192
  }
24079
-
24080
24193
  // 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'.
24081
24194
  if (isApp || isOpen || isVisible && isInline) {
24082
24195
  start();
24083
24196
  }
24084
- }, [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
24197
+ }), [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
24085
24198
  (0,hooks_module/* useEffect */.d4)(() => {
24086
24199
  // We dont't connect or start when the apiConfig is not ready yet.
24087
24200
  // We also keep track of whether start has been called to avoid multiple in-flight connection processes.
24088
24201
  // We check if the window view is not open and no conversation is started yet.
24089
24202
  // Lastly we check if the inline view is not scrolled in to view.
24090
- if (!apiConfigReady || connectCalled.current || isWindow && !isOpen && !hasConversation() || isInline && (!isVisible || !showInlineView)) {
24203
+ if (!apiConfigReady || connectCalled.current || isWindow && !isOpen || isInline && (!isVisible || !showInlineView)) {
24091
24204
  return;
24092
24205
  }
24093
24206
  if (hasConversation() && isOpen) {
@@ -28239,7 +28352,7 @@ const SeamlyEventSubscriber = () => {
28239
28352
  channel === null || channel === void 0 ? void 0 : channel.leave();
28240
28353
  };
28241
28354
  }
28242
- return () => {};
28355
+ return () => undefined;
28243
28356
  }, [api, api.connectionInfo, api.conversation]);
28244
28357
  (0,hooks_module/* useEffect */.d4)(() => {
28245
28358
  api.conversation.onConnection(_ref => {
@@ -28425,6 +28538,9 @@ const SeamlyEventSubscriber = () => {
28425
28538
  const {
28426
28539
  channel
28427
28540
  } = api.conversation;
28541
+ if (messageChannelRef.current) {
28542
+ channel === null || channel === void 0 ? void 0 : channel.off('message', messageChannelRef.current);
28543
+ }
28428
28544
  messageChannelRef.current = channel.on('message', payload => {
28429
28545
  if (!includes_default()(EMITTABLE_MESSAGE_TYPES).call(EMITTABLE_MESSAGE_TYPES, payload.type)) {
28430
28546
  return payload;
@@ -28441,12 +28557,7 @@ const SeamlyEventSubscriber = () => {
28441
28557
  });
28442
28558
  return true;
28443
28559
  });
28444
- return () => {
28445
- var _a;
28446
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('message', messageChannelRef.current);
28447
- };
28448
28560
  }
28449
- return () => undefined;
28450
28561
  }, [api, api.connectionInfo, api.conversation.channel, eventBus]);
28451
28562
  (0,hooks_module/* useEffect */.d4)(() => {
28452
28563
  if (api.connectionInfo) {
@@ -28454,7 +28565,11 @@ const SeamlyEventSubscriber = () => {
28454
28565
  let {
28455
28566
  connected
28456
28567
  } = _ref4;
28568
+ var _a;
28457
28569
  if (!connected) return false;
28570
+ if (syncChannelRef.current) {
28571
+ (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
28572
+ }
28458
28573
  syncChannelRef.current = api.conversation.channel.on('sync', payload => {
28459
28574
  var _a;
28460
28575
  const lastEvent = events[events.length - 1];
@@ -28478,12 +28593,7 @@ const SeamlyEventSubscriber = () => {
28478
28593
  });
28479
28594
  return true;
28480
28595
  });
28481
- return () => {
28482
- var _a;
28483
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
28484
- };
28485
28596
  }
28486
- return () => undefined;
28487
28597
  }, [api, api.connectionInfo, api.conversation.channel, events, dispatch]);
28488
28598
  return null;
28489
28599
  };
@@ -28624,59 +28734,6 @@ const SeamlyInitializer = () => {
28624
28734
  return null;
28625
28735
  };
28626
28736
  /* harmony default export */ var seamly_initializer = (SeamlyInitializer);
28627
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
28628
-
28629
- const selectError = es_createSelector(_ref => {
28630
- let {
28631
- interrupt
28632
- } = _ref;
28633
- return interrupt;
28634
- }, _ref2 => {
28635
- let {
28636
- error
28637
- } = _ref2;
28638
- return error;
28639
- });
28640
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
28641
-
28642
-
28643
-
28644
-
28645
-
28646
- function useInterrupt() {
28647
- const {
28648
- t
28649
- } = useI18n();
28650
- const error = useSelector_useSelector(selectError);
28651
- const hasInterrupt = Boolean(error);
28652
- const meta = (0,hooks_module/* useMemo */.Ye)(() => {
28653
- if (!error) return {};
28654
- const {
28655
- langKey,
28656
- action
28657
- } = error;
28658
- const title = t(`${langKey}.title`);
28659
- const message = t(`${langKey}.message`);
28660
- const srText = t(`${langKey}.srText`);
28661
- const buttonText = t(`${langKey}.buttonText`);
28662
- return assign_default()(assign_default()(assign_default()(assign_default()({}, langKey ? {
28663
- title,
28664
- message,
28665
- srText
28666
- } : {}), action ? {
28667
- action
28668
- } : {}), action && langKey ? {
28669
- buttonText
28670
- } : {}), {
28671
- originalError: error
28672
- });
28673
- }, [t, error]);
28674
- return {
28675
- hasInterrupt,
28676
- meta,
28677
- error
28678
- };
28679
- }
28680
28737
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-instance-functions-loader.js
28681
28738
 
28682
28739
 
@@ -28735,9 +28792,7 @@ const SeamlyInstanceFunctionsLoader = () => {
28735
28792
  isInline,
28736
28793
  isResolving
28737
28794
  } = useSeamlyLayoutMode();
28738
- const {
28739
- hasInterrupt
28740
- } = useInterrupt();
28795
+ const hasError = useSelector_useSelector(selectHasError);
28741
28796
  const currentConversationUrl = useSeamlyConversationUrl();
28742
28797
  const prevConversationUrl = (0,hooks_module/* useRef */.sO)(null);
28743
28798
  const onActivityHandler = use_seamly_activity_event_handler();
@@ -28820,7 +28875,7 @@ const SeamlyInstanceFunctionsLoader = () => {
28820
28875
  }
28821
28876
  }, [api.send]);
28822
28877
  (0,hooks_module/* useEffect */.d4)(() => {
28823
- if (!isResolving && !hasInterrupt) {
28878
+ if (!isResolving && !hasError) {
28824
28879
  // Check for app reset
28825
28880
  if (prevConversationUrl.current && prevConversationUrl.current !== currentConversationUrl) {
28826
28881
  eventBus.emit('unreadMessageCount', unreadCount);
@@ -28839,7 +28894,7 @@ const SeamlyInstanceFunctionsLoader = () => {
28839
28894
  previousUnreadCount.current = unreadCount;
28840
28895
  prevConversationUrl.current = currentConversationUrl;
28841
28896
  }
28842
- }, [unreadCount, visible, eventBus, isInline, isResolving, hasInterrupt, currentConversationUrl]);
28897
+ }, [unreadCount, visible, eventBus, isInline, isResolving, hasError, currentConversationUrl]);
28843
28898
  return null;
28844
28899
  };
28845
28900
  /* harmony default export */ var seamly_instance_functions_loader = (SeamlyInstanceFunctionsLoader);
@@ -29334,6 +29389,7 @@ const InOutTransition = _ref => {
29334
29389
 
29335
29390
 
29336
29391
 
29392
+
29337
29393
 
29338
29394
 
29339
29395
  const Suggestions = _ref => {
@@ -29366,9 +29422,7 @@ const Suggestions = _ref => {
29366
29422
  sendPolite
29367
29423
  } = useLiveRegion();
29368
29424
  // interrupt & countdown hooks
29369
- const {
29370
- hasInterrupt
29371
- } = useInterrupt();
29425
+ const hasError = useSelector_useSelector(selectHasError);
29372
29426
  const {
29373
29427
  hasCountdown,
29374
29428
  endCountdown
@@ -29385,7 +29439,7 @@ const Suggestions = _ref => {
29385
29439
  } = useTranslatedEventData({
29386
29440
  payload
29387
29441
  });
29388
- const suggestions = (0,hooks_module/* useMemo */.Ye)(() => payload && !hasInterrupt ? eventBody : [], [payload, hasInterrupt, eventBody]);
29442
+ const suggestions = (0,hooks_module/* useMemo */.Ye)(() => payload && !hasError ? eventBody : [], [payload, hasError, eventBody]);
29389
29443
  const prevSuggestions = (0,hooks_module/* useRef */.sO)(null);
29390
29444
  const prevHasSuggestions = (0,hooks_module/* useRef */.sO)(false);
29391
29445
  const previousRenderedSuggestions = (0,hooks_module/* useRef */.sO)([]);
@@ -29873,10 +29927,9 @@ function FormProvider(_a) {
29873
29927
  });
29874
29928
  }, [setExternalErrors]);
29875
29929
  const handleSubmit = (0,hooks_module/* useCallback */.I4)((e) => {
29876
- var _a;
29877
29930
  e.preventDefault();
29878
29931
  // If the submitter is set to being aria-disabled, block the submit action
29879
- const ariaDisabled = ((_a = e.submitter) === null || _a === void 0 ? void 0 : _a.ariaDisabled) === 'true';
29932
+ const ariaDisabled = e.submitter.getAttribute('aria-disabled') === 'true';
29880
29933
  setIsSubmitted(!ariaDisabled);
29881
29934
  if (!ariaDisabled && validationIsValid) {
29882
29935
  dispatch(setHasResponded(true));
@@ -30575,6 +30628,7 @@ function TranslationsOptionsButton({ children, position = {
30575
30628
 
30576
30629
 
30577
30630
 
30631
+
30578
30632
  function AppOptions() {
30579
30633
  const {
30580
30634
  menuOptions,
@@ -30583,15 +30637,13 @@ function AppOptions() {
30583
30637
  const {
30584
30638
  isAvailable: isTranslationsAvailable
30585
30639
  } = useTranslations();
30586
- const {
30587
- hasInterrupt
30588
- } = useInterrupt();
30640
+ const hasError = useSelector_useSelector(selectHasError);
30589
30641
  const {
30590
30642
  t,
30591
30643
  locale
30592
30644
  } = useI18n();
30593
30645
  const localeNativeName = useLocaleNativeName(locale);
30594
- if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasInterrupt) {
30646
+ if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasError) {
30595
30647
  return null;
30596
30648
  }
30597
30649
  const openButtonText = t('translations.settings.openButtonText', {
@@ -31914,10 +31966,11 @@ const ChatStatus = ({ children, handleClose, title, closeButtonText, srCloseButt
31914
31966
 
31915
31967
 
31916
31968
 
31969
+
31917
31970
  function TranslationChatStatus() {
31918
31971
  const { t } = useI18n();
31919
31972
  const { id } = useTranslationsContainer();
31920
- const { hasInterrupt } = useInterrupt();
31973
+ const hasError = useSelector_useSelector(selectHasError);
31921
31974
  const { disableTranslations, currentLocale } = useTranslations();
31922
31975
  const localeNativeName = useLocaleNativeName(currentLocale);
31923
31976
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
@@ -31926,7 +31979,7 @@ function TranslationChatStatus() {
31926
31979
  disableTranslations();
31927
31980
  focusSkiplinkTarget();
31928
31981
  }, [disableTranslations, focusSkiplinkTarget]);
31929
- if (hasInterrupt) {
31982
+ if (hasError) {
31930
31983
  return null;
31931
31984
  }
31932
31985
  return (o(chat_status, { handleClose: handleClickStop, title: label, id: id, closeButtonText: t('translations.status.stopText'), srCloseButtonText: t('translations.status.srStopText') }));
@@ -31959,29 +32012,17 @@ function TranslationProposal() {
31959
32012
 
31960
32013
 
31961
32014
 
32015
+
31962
32016
  function TranslationStatus() {
31963
- const { hasInterrupt } = useInterrupt();
32017
+ const hasError = useSelector_useSelector(selectHasError);
31964
32018
  const { isActive } = useTranslations();
31965
- if (hasInterrupt) {
32019
+ if (hasError) {
31966
32020
  return null;
31967
32021
  }
31968
32022
  return !isActive ? o(TranslationProposal, {}) : o(TranslationChatStatus, {});
31969
32023
  }
31970
32024
 
31971
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
31972
-
31973
-
31974
-
31975
-
31976
-
31977
-
31978
-
31979
-
31980
-
31981
- function chat_frame_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); enumerableOnly && (symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31982
- function chat_frame_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? for_each_default()(_context = chat_frame_ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : (get_own_property_descriptors_default()) ? define_properties_default()(target, get_own_property_descriptors_default()(source)) : for_each_default()(_context2 = chat_frame_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } return target; }
31983
-
31984
-
32025
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
31985
32026
 
31986
32027
 
31987
32028
 
@@ -31991,64 +32032,24 @@ function chat_frame_objectSpread(target) { for (var i = 1; i < arguments.length;
31991
32032
 
31992
32033
 
31993
32034
 
31994
- function ChatFrame(_ref) {
31995
- let {
31996
- children,
31997
- interruptComponent: InterruptComponent
31998
- } = _ref;
32035
+ const Interrupt = () => {
31999
32036
  const {
32000
- hasInterrupt,
32001
- meta
32002
- } = useInterrupt();
32003
- const {
32004
- isOpen
32005
- } = useVisibility();
32006
- if (hasInterrupt) {
32007
- if (isOpen) {
32008
- return o(InterruptComponent, chat_frame_objectSpread({}, meta));
32037
+ meta: {
32038
+ originalError,
32039
+ title,
32040
+ message,
32041
+ buttonText,
32042
+ action,
32043
+ srText
32009
32044
  }
32010
- return null;
32011
- }
32012
- return o(preact_module/* Fragment */.HY, {
32013
- children: [o(chat_scroll_provider, {
32014
- children: [o("div", {
32015
- className: css_className('chat__container__header'),
32016
- children: [o(TranslationStatus, {}), o(collapse_button, {})]
32017
- }), children]
32018
- }), o(entry_container, {}), isOpen && o(AppOptions, {})]
32019
- });
32020
- }
32021
- /* harmony default export */ var chat_frame = (ChatFrame);
32022
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
32023
-
32024
-
32025
-
32026
-
32027
-
32028
-
32029
-
32030
-
32031
- const Interrupt = _ref => {
32032
- let {
32033
- originalError,
32034
- title,
32035
- message,
32036
- buttonText,
32037
- action,
32038
- srText
32039
- } = _ref;
32045
+ } = useInterrupt();
32040
32046
  const seamlyCommands = use_seamly_commands();
32041
32047
  const headingId = useGeneratedId();
32042
32048
  const {
32043
32049
  sendPolite
32044
32050
  } = useLiveRegion();
32045
32051
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
32046
- const isExpiredError = originalError.name === 'SeamlySessionExpiredError';
32047
- (0,hooks_module/* useEffect */.d4)(() => {
32048
- if (isExpiredError && seamlyCommands[action]) {
32049
- seamlyCommands[action]();
32050
- }
32051
- }, [action, seamlyCommands, isExpiredError]);
32052
+ const isExpiredError = originalError?.name === 'SeamlySessionExpiredError';
32052
32053
  (0,hooks_module/* useEffect */.d4)(() => {
32053
32054
  if (!isExpiredError && srText) {
32054
32055
  // Wait for live regions to stabilise in case this occurs
@@ -32089,16 +32090,49 @@ const Interrupt = _ref => {
32089
32090
  }) : o(preact_module/* Fragment */.HY, {});
32090
32091
  };
32091
32092
  /* harmony default export */ var interrupt = (Interrupt);
32092
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
32093
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
32094
+
32093
32095
 
32094
32096
 
32095
32097
 
32096
32098
 
32097
32099
 
32100
+
32101
+
32102
+
32103
+
32104
+
32105
+
32106
+
32107
+ function ChatFrame(_ref) {
32108
+ let {
32109
+ children
32110
+ } = _ref;
32111
+ const hasError = useSelector_useSelector(selectHasError);
32112
+ const {
32113
+ isOpen
32114
+ } = useVisibility();
32115
+ if (hasError) {
32116
+ return o(interrupt, {});
32117
+ }
32118
+ return o(preact_module/* Fragment */.HY, {
32119
+ children: [o(chat_scroll_provider, {
32120
+ children: [o("div", {
32121
+ className: css_className('chat__container__header'),
32122
+ children: [o(TranslationStatus, {}), o(collapse_button, {})]
32123
+ }), children]
32124
+ }), o(entry_container, {}), isOpen && o(AppOptions, {})]
32125
+ });
32126
+ }
32127
+ /* harmony default export */ var chat_frame = (ChatFrame);
32128
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
32129
+
32130
+
32131
+
32132
+
32098
32133
  const AppView = () => {
32099
32134
  return o(chat, {
32100
32135
  children: o(chat_frame, {
32101
- interruptComponent: interrupt,
32102
32136
  children: o(conversation, {})
32103
32137
  })
32104
32138
  });
@@ -32112,6 +32146,7 @@ const AppView = () => {
32112
32146
 
32113
32147
 
32114
32148
 
32149
+
32115
32150
  function PreChatMessageEvent(_ref) {
32116
32151
  let {
32117
32152
  event
@@ -32126,13 +32161,11 @@ function PreChatMessages() {
32126
32161
  preChatEvents,
32127
32162
  layoutMode
32128
32163
  } = useConfig();
32129
- const {
32130
- hasInterrupt
32131
- } = useInterrupt();
32164
+ const hasError = useSelector_useSelector(selectHasError);
32132
32165
  const {
32133
32166
  isOpen
32134
32167
  } = useVisibility();
32135
- const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
32168
+ const isVisible = !(hasError || !preChatEvents?.length || isOpen);
32136
32169
  return isVisible && o("ul", {
32137
32170
  className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
32138
32171
  "aria-hidden": !isVisible,
@@ -32154,19 +32187,6 @@ function PreChatMessages() {
32154
32187
 
32155
32188
 
32156
32189
 
32157
- function inline_view_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); enumerableOnly && (symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
32158
- function inline_view_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? for_each_default()(_context = inline_view_ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : (get_own_property_descriptors_default()) ? define_properties_default()(target, get_own_property_descriptors_default()(source)) : for_each_default()(_context2 = inline_view_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } return target; }
32159
-
32160
-
32161
-
32162
-
32163
-
32164
-
32165
-
32166
-
32167
-
32168
-
32169
-
32170
32190
 
32171
32191
 
32172
32192
  const InlineView = () => {
@@ -32177,13 +32197,6 @@ const InlineView = () => {
32177
32197
  const {
32178
32198
  isOpen
32179
32199
  } = useVisibility();
32180
- const {
32181
- hasInterrupt,
32182
- meta
32183
- } = useInterrupt();
32184
- if (hasInterrupt && !isOpen) {
32185
- return o(interrupt, inline_view_objectSpread({}, meta));
32186
- }
32187
32200
  return o(preact_module/* Fragment */.HY, {
32188
32201
  children: [o(in_out_transition, {
32189
32202
  isActive: !isOpen,
@@ -32199,7 +32212,6 @@ const InlineView = () => {
32199
32212
  children: o(chat, {
32200
32213
  ref: containerRef,
32201
32214
  children: showInlineView && o(chat_frame, {
32202
- interruptComponent: interrupt,
32203
32215
  children: isOpen && o(conversation, {})
32204
32216
  })
32205
32217
  })
@@ -32221,13 +32233,12 @@ const InlineView = () => {
32221
32233
 
32222
32234
 
32223
32235
 
32236
+
32224
32237
  const ButtonIcon = () => {
32225
32238
  const startChatIcon = useStartChatIcon();
32226
32239
  const currentAgent = useSeamlyCurrentAgent();
32227
- const {
32228
- hasInterrupt
32229
- } = useInterrupt();
32230
- const isActiveConversation = currentAgent && !hasInterrupt;
32240
+ const hasError = useSelector_useSelector(selectHasError);
32241
+ const isActiveConversation = currentAgent && !hasError;
32231
32242
  const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
32232
32243
  return src ? o("img", {
32233
32244
  className: css_className(isActiveConversation ? 'avatar' : 'icon'),
@@ -32283,19 +32294,6 @@ const WindowOpenButton = _ref => {
32283
32294
 
32284
32295
 
32285
32296
 
32286
- function window_view_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); enumerableOnly && (symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
32287
- function window_view_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? for_each_default()(_context = window_view_ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : (get_own_property_descriptors_default()) ? define_properties_default()(target, get_own_property_descriptors_default()(source)) : for_each_default()(_context2 = window_view_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } return target; }
32288
-
32289
-
32290
-
32291
-
32292
-
32293
-
32294
-
32295
-
32296
-
32297
-
32298
-
32299
32297
 
32300
32298
 
32301
32299
 
@@ -32308,10 +32306,6 @@ const WindowView = () => {
32308
32306
  openChat
32309
32307
  } = useVisibility();
32310
32308
  const userHasResponded = useUserHasResponded();
32311
- const {
32312
- hasInterrupt,
32313
- meta
32314
- } = useInterrupt();
32315
32309
  const {
32316
32310
  t
32317
32311
  } = useI18n();
@@ -32323,9 +32317,6 @@ const WindowView = () => {
32323
32317
  }
32324
32318
  }
32325
32319
  }), [continueChatText]);
32326
- if (hasInterrupt && !isOpen) {
32327
- return o(interrupt, window_view_objectSpread({}, meta));
32328
- }
32329
32320
  return o(preact_module/* Fragment */.HY, {
32330
32321
  children: [o(window_open_button, {
32331
32322
  onClick: openChat
@@ -32350,7 +32341,6 @@ const WindowView = () => {
32350
32341
  transitionStartState: transitionStartStates.notRendered,
32351
32342
  children: o(chat, {
32352
32343
  children: o(chat_frame, {
32353
- interruptComponent: interrupt,
32354
32344
  children: o(conversation, {})
32355
32345
  })
32356
32346
  })
@@ -32804,6 +32794,7 @@ function initializeExternalApi(appConfig) {
32804
32794
 
32805
32795
 
32806
32796
 
32797
+
32807
32798
  // Deprecated Toggle Button, should be removed once it is removed from clients
32808
32799
 
32809
32800
 
@@ -32825,13 +32816,11 @@ const DeprecatedToggleButton = _ref => {
32825
32816
  const focusIfContained = useFocusIfSeamlyContainedFocus();
32826
32817
  const currentAgent = useSeamlyCurrentAgent();
32827
32818
  const agentSubtitle = useSeamlyHeaderData().subTitle;
32828
- const {
32829
- hasInterrupt
32830
- } = useInterrupt();
32819
+ const hasError = useSelector_useSelector(selectHasError);
32831
32820
  const {
32832
32821
  headerCollapseButtonId
32833
32822
  } = useSeamlyStateContext();
32834
- const showAgentInfo = currentAgent && !hasInterrupt;
32823
+ const showAgentInfo = currentAgent && !hasError;
32835
32824
  (0,hooks_module/* useLayoutEffect */.bt)(() => {
32836
32825
  // Because we can close the app from the external API we
32837
32826
  // need to determine if current keyboard focus resides inside
@@ -32891,6 +32880,7 @@ const DeprecatedToggleButton = _ref => {
32891
32880
 
32892
32881
 
32893
32882
 
32883
+
32894
32884
  const AgentInfo = () => {
32895
32885
  const {
32896
32886
  t
@@ -32904,12 +32894,10 @@ const AgentInfo = () => {
32904
32894
  isOpen
32905
32895
  } = useVisibility();
32906
32896
  const currentAgent = useSeamlyCurrentAgent();
32907
- const {
32908
- hasInterrupt
32909
- } = useInterrupt();
32897
+ const hasError = useSelector_useSelector(selectHasError);
32910
32898
  const startChatIcon = useStartChatIcon();
32911
32899
  const src = currentAgent?.avatar ?? startChatIcon;
32912
- const displaySubtitle = hasInterrupt ? '' : subTitle;
32900
+ const displaySubtitle = hasError ? '' : subTitle;
32913
32901
  const classNames = ['message-count'];
32914
32902
  if (isOpen) {
32915
32903
  classNames.push('message-count__hide');
@@ -32996,35 +32984,19 @@ const Header = _ref => {
32996
32984
 
32997
32985
 
32998
32986
 
32999
- function deprecated_chat_frame_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); enumerableOnly && (symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
33000
- function deprecated_chat_frame_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? for_each_default()(_context = deprecated_chat_frame_ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : (get_own_property_descriptors_default()) ? define_properties_default()(target, get_own_property_descriptors_default()(source)) : for_each_default()(_context2 = deprecated_chat_frame_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } return target; }
33001
-
33002
-
33003
-
33004
-
33005
-
33006
-
33007
-
33008
32987
 
33009
32988
 
33010
32989
 
33011
32990
  function deprecated_chat_frame_ChatFrame(_ref) {
33012
32991
  let {
33013
- children,
33014
- interruptComponent: InterruptComponent
32992
+ children
33015
32993
  } = _ref;
33016
- const {
33017
- hasInterrupt,
33018
- meta
33019
- } = useInterrupt();
33020
32994
  const {
33021
32995
  isOpen
33022
32996
  } = useVisibility();
33023
- if (hasInterrupt) {
33024
- if (isOpen) {
33025
- return o(InterruptComponent, deprecated_chat_frame_objectSpread({}, meta));
33026
- }
33027
- return null;
32997
+ const hasError = useSelector_useSelector(selectHasError);
32998
+ if (hasError) {
32999
+ return o(interrupt, {});
33028
33000
  }
33029
33001
  return o(preact_module/* Fragment */.HY, {
33030
33002
  children: [o(chat_scroll_provider, {
@@ -33069,6 +33041,7 @@ function faq_objectSpread(target) { for (var i = 1; i < arguments.length; i++) {
33069
33041
 
33070
33042
 
33071
33043
 
33044
+
33072
33045
 
33073
33046
 
33074
33047
  const Faq = () => {
@@ -33084,9 +33057,7 @@ const Faq = () => {
33084
33057
  const {
33085
33058
  sendPolite
33086
33059
  } = useLiveRegion();
33087
- const {
33088
- hasInterrupt
33089
- } = useInterrupt();
33060
+ const hasError = useSelector_useSelector(selectHasError);
33090
33061
  const {
33091
33062
  hasCountdown,
33092
33063
  endCountdown
@@ -33102,7 +33073,7 @@ const Faq = () => {
33102
33073
  payload: lastFaqEventPayload
33103
33074
  });
33104
33075
  const faqs = (0,hooks_module/* useMemo */.Ye)(() => {
33105
- const newFaqs = lastFaqEventPayload && !hasInterrupt ? eventBody : [];
33076
+ const newFaqs = lastFaqEventPayload && !hasError ? eventBody : [];
33106
33077
  const itemBaseClass = `faqs__item`;
33107
33078
  return map_default()(newFaqs).call(newFaqs, _ref => {
33108
33079
  let {
@@ -33114,7 +33085,7 @@ const Faq = () => {
33114
33085
  classNames: [itemBaseClass, ...map_default()(categories).call(categories, cat => `faqs__item--${String(cat).toLowerCase().replace(/[^a-z0-9_\\-]/, '')}`)]
33115
33086
  });
33116
33087
  });
33117
- }, [lastFaqEventPayload, hasInterrupt, eventBody]);
33088
+ }, [lastFaqEventPayload, hasError, eventBody]);
33118
33089
  const prevFaqs = (0,hooks_module/* useRef */.sO)(null);
33119
33090
  const prevHasFaqs = (0,hooks_module/* useRef */.sO)(false);
33120
33091
  const {
@@ -33296,7 +33267,6 @@ const DeprecatedAppFrame = _ref => {
33296
33267
 
33297
33268
 
33298
33269
 
33299
-
33300
33270
  const ShowInlineView = _ref => {
33301
33271
  let {
33302
33272
  children
@@ -33324,7 +33294,6 @@ const DeprecatedView = () => {
33324
33294
  onCloseChat: closeChat,
33325
33295
  children: o(agent_info, {})
33326
33296
  }), o(deprecated_chat_frame, {
33327
- interruptComponent: interrupt,
33328
33297
  children: o(conversation, {})
33329
33298
  })]
33330
33299
  })