@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
@@ -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.7",
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;
@@ -22558,12 +22559,7 @@ const {
22558
22559
 
22559
22560
 
22560
22561
 
22561
-
22562
-
22563
-
22564
-
22565
-
22566
- const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
22562
+ const handledErrorTypes = ['SeamlyGeneralError', 'SeamlyConfigurationError', 'SeamlySessionExpiredError', 'SeamlyOfflineError', 'SeamlyUnauthorizedError', 'SeamlyUnavailableError'];
22567
22563
  function createInterruptMiddleware(_ref) {
22568
22564
  let {
22569
22565
  api
@@ -22574,7 +22570,7 @@ function createInterruptMiddleware(_ref) {
22574
22570
  type
22575
22571
  } = action;
22576
22572
  if (type === setInterrupt.type) {
22577
- if (!some_default()(handledErrorTypes).call(handledErrorTypes, ErrorType => payload.name === ErrorType.name)) {
22573
+ if (!includes_default()(handledErrorTypes).call(handledErrorTypes, payload.name)) {
22578
22574
  throw new SeamlyGeneralError(payload);
22579
22575
  } else if (payload.action === 'reset') {
22580
22576
  // [SMLY-942] We clear the store before a reset to force a new conversation if the page is refreshed before the conversation is reset
@@ -22676,6 +22672,7 @@ var splice_default = /*#__PURE__*/__webpack_require__.n(splice);
22676
22672
 
22677
22673
 
22678
22674
 
22675
+
22679
22676
  const translationsInitialState = {
22680
22677
  isActive: false,
22681
22678
  currentLocale: undefined,
@@ -22774,7 +22771,7 @@ const translationSlice = createSlice({
22774
22771
  }
22775
22772
  },
22776
22773
  extraReducers: builder => {
22777
- builder.addCase(initializeConfig.fulfilled, (state, _ref6) => {
22774
+ builder.addCase(resetApp.pending, () => translationsInitialState).addCase(initializeConfig.fulfilled, (state, _ref6) => {
22778
22775
  let {
22779
22776
  payload
22780
22777
  } = _ref6;
@@ -23989,7 +23986,117 @@ const useLiveRegion = () => {
23989
23986
  sendAssertive
23990
23987
  };
23991
23988
  };
23992
- ;// 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
+ };
23993
24100
 
23994
24101
 
23995
24102
 
@@ -24029,6 +24136,8 @@ const useSeamlyChat = () => {
24029
24136
  const {
24030
24137
  sendAssertive
24031
24138
  } = useLiveRegion();
24139
+ // Automatically reset conversation if the session has expired
24140
+ useSessionExpiredCommand();
24032
24141
  (0,hooks_module/* useEffect */.d4)(() => {
24033
24142
  if (isVisible) {
24034
24143
  // Wait for the live containers to stabilise in the DOM before injecting
@@ -24075,24 +24184,23 @@ const useSeamlyChat = () => {
24075
24184
  connectCalled.current = false;
24076
24185
  }
24077
24186
  }, [apiConfigReady, apiConnected]);
24078
- 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* () {
24079
24188
  // We don't connect if we are already connected to the api to avoid multiple in-flight connection processes.
24080
24189
  if (!apiConnected) {
24081
24190
  connectCalled.current = true;
24082
- await connect();
24191
+ yield connect();
24083
24192
  }
24084
-
24085
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'.
24086
24194
  if (isApp || isOpen || isVisible && isInline) {
24087
24195
  start();
24088
24196
  }
24089
- }, [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
24197
+ }), [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
24090
24198
  (0,hooks_module/* useEffect */.d4)(() => {
24091
24199
  // We dont't connect or start when the apiConfig is not ready yet.
24092
24200
  // We also keep track of whether start has been called to avoid multiple in-flight connection processes.
24093
24201
  // We check if the window view is not open and no conversation is started yet.
24094
24202
  // Lastly we check if the inline view is not scrolled in to view.
24095
- if (!apiConfigReady || connectCalled.current || isWindow && !isOpen && !hasConversation() || isInline && (!isVisible || !showInlineView)) {
24203
+ if (!apiConfigReady || connectCalled.current || isWindow && !isOpen || isInline && (!isVisible || !showInlineView)) {
24096
24204
  return;
24097
24205
  }
24098
24206
  if (hasConversation() && isOpen) {
@@ -28244,7 +28352,7 @@ const SeamlyEventSubscriber = () => {
28244
28352
  channel === null || channel === void 0 ? void 0 : channel.leave();
28245
28353
  };
28246
28354
  }
28247
- return () => {};
28355
+ return () => undefined;
28248
28356
  }, [api, api.connectionInfo, api.conversation]);
28249
28357
  (0,hooks_module/* useEffect */.d4)(() => {
28250
28358
  api.conversation.onConnection(_ref => {
@@ -28430,6 +28538,9 @@ const SeamlyEventSubscriber = () => {
28430
28538
  const {
28431
28539
  channel
28432
28540
  } = api.conversation;
28541
+ if (messageChannelRef.current) {
28542
+ channel === null || channel === void 0 ? void 0 : channel.off('message', messageChannelRef.current);
28543
+ }
28433
28544
  messageChannelRef.current = channel.on('message', payload => {
28434
28545
  if (!includes_default()(EMITTABLE_MESSAGE_TYPES).call(EMITTABLE_MESSAGE_TYPES, payload.type)) {
28435
28546
  return payload;
@@ -28446,12 +28557,7 @@ const SeamlyEventSubscriber = () => {
28446
28557
  });
28447
28558
  return true;
28448
28559
  });
28449
- return () => {
28450
- var _a;
28451
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('message', messageChannelRef.current);
28452
- };
28453
28560
  }
28454
- return () => undefined;
28455
28561
  }, [api, api.connectionInfo, api.conversation.channel, eventBus]);
28456
28562
  (0,hooks_module/* useEffect */.d4)(() => {
28457
28563
  if (api.connectionInfo) {
@@ -28459,7 +28565,11 @@ const SeamlyEventSubscriber = () => {
28459
28565
  let {
28460
28566
  connected
28461
28567
  } = _ref4;
28568
+ var _a;
28462
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
+ }
28463
28573
  syncChannelRef.current = api.conversation.channel.on('sync', payload => {
28464
28574
  var _a;
28465
28575
  const lastEvent = events[events.length - 1];
@@ -28483,12 +28593,7 @@ const SeamlyEventSubscriber = () => {
28483
28593
  });
28484
28594
  return true;
28485
28595
  });
28486
- return () => {
28487
- var _a;
28488
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
28489
- };
28490
28596
  }
28491
- return () => undefined;
28492
28597
  }, [api, api.connectionInfo, api.conversation.channel, events, dispatch]);
28493
28598
  return null;
28494
28599
  };
@@ -28629,59 +28734,6 @@ const SeamlyInitializer = () => {
28629
28734
  return null;
28630
28735
  };
28631
28736
  /* harmony default export */ var seamly_initializer = (SeamlyInitializer);
28632
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
28633
-
28634
- const selectError = es_createSelector(_ref => {
28635
- let {
28636
- interrupt
28637
- } = _ref;
28638
- return interrupt;
28639
- }, _ref2 => {
28640
- let {
28641
- error
28642
- } = _ref2;
28643
- return error;
28644
- });
28645
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
28646
-
28647
-
28648
-
28649
-
28650
-
28651
- function useInterrupt() {
28652
- const {
28653
- t
28654
- } = useI18n();
28655
- const error = useSelector_useSelector(selectError);
28656
- const hasInterrupt = Boolean(error);
28657
- const meta = (0,hooks_module/* useMemo */.Ye)(() => {
28658
- if (!error) return {};
28659
- const {
28660
- langKey,
28661
- action
28662
- } = error;
28663
- const title = t(`${langKey}.title`);
28664
- const message = t(`${langKey}.message`);
28665
- const srText = t(`${langKey}.srText`);
28666
- const buttonText = t(`${langKey}.buttonText`);
28667
- return assign_default()(assign_default()(assign_default()(assign_default()({}, langKey ? {
28668
- title,
28669
- message,
28670
- srText
28671
- } : {}), action ? {
28672
- action
28673
- } : {}), action && langKey ? {
28674
- buttonText
28675
- } : {}), {
28676
- originalError: error
28677
- });
28678
- }, [t, error]);
28679
- return {
28680
- hasInterrupt,
28681
- meta,
28682
- error
28683
- };
28684
- }
28685
28737
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-instance-functions-loader.js
28686
28738
 
28687
28739
 
@@ -28740,9 +28792,7 @@ const SeamlyInstanceFunctionsLoader = () => {
28740
28792
  isInline,
28741
28793
  isResolving
28742
28794
  } = useSeamlyLayoutMode();
28743
- const {
28744
- hasInterrupt
28745
- } = useInterrupt();
28795
+ const hasError = useSelector_useSelector(selectHasError);
28746
28796
  const currentConversationUrl = useSeamlyConversationUrl();
28747
28797
  const prevConversationUrl = (0,hooks_module/* useRef */.sO)(null);
28748
28798
  const onActivityHandler = use_seamly_activity_event_handler();
@@ -28825,7 +28875,7 @@ const SeamlyInstanceFunctionsLoader = () => {
28825
28875
  }
28826
28876
  }, [api.send]);
28827
28877
  (0,hooks_module/* useEffect */.d4)(() => {
28828
- if (!isResolving && !hasInterrupt) {
28878
+ if (!isResolving && !hasError) {
28829
28879
  // Check for app reset
28830
28880
  if (prevConversationUrl.current && prevConversationUrl.current !== currentConversationUrl) {
28831
28881
  eventBus.emit('unreadMessageCount', unreadCount);
@@ -28844,7 +28894,7 @@ const SeamlyInstanceFunctionsLoader = () => {
28844
28894
  previousUnreadCount.current = unreadCount;
28845
28895
  prevConversationUrl.current = currentConversationUrl;
28846
28896
  }
28847
- }, [unreadCount, visible, eventBus, isInline, isResolving, hasInterrupt, currentConversationUrl]);
28897
+ }, [unreadCount, visible, eventBus, isInline, isResolving, hasError, currentConversationUrl]);
28848
28898
  return null;
28849
28899
  };
28850
28900
  /* harmony default export */ var seamly_instance_functions_loader = (SeamlyInstanceFunctionsLoader);
@@ -29339,6 +29389,7 @@ const InOutTransition = _ref => {
29339
29389
 
29340
29390
 
29341
29391
 
29392
+
29342
29393
 
29343
29394
 
29344
29395
  const Suggestions = _ref => {
@@ -29371,9 +29422,7 @@ const Suggestions = _ref => {
29371
29422
  sendPolite
29372
29423
  } = useLiveRegion();
29373
29424
  // interrupt & countdown hooks
29374
- const {
29375
- hasInterrupt
29376
- } = useInterrupt();
29425
+ const hasError = useSelector_useSelector(selectHasError);
29377
29426
  const {
29378
29427
  hasCountdown,
29379
29428
  endCountdown
@@ -29390,7 +29439,7 @@ const Suggestions = _ref => {
29390
29439
  } = useTranslatedEventData({
29391
29440
  payload
29392
29441
  });
29393
- 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]);
29394
29443
  const prevSuggestions = (0,hooks_module/* useRef */.sO)(null);
29395
29444
  const prevHasSuggestions = (0,hooks_module/* useRef */.sO)(false);
29396
29445
  const previousRenderedSuggestions = (0,hooks_module/* useRef */.sO)([]);
@@ -29878,10 +29927,9 @@ function FormProvider(_a) {
29878
29927
  });
29879
29928
  }, [setExternalErrors]);
29880
29929
  const handleSubmit = (0,hooks_module/* useCallback */.I4)((e) => {
29881
- var _a;
29882
29930
  e.preventDefault();
29883
29931
  // If the submitter is set to being aria-disabled, block the submit action
29884
- const ariaDisabled = ((_a = e.submitter) === null || _a === void 0 ? void 0 : _a.ariaDisabled) === 'true';
29932
+ const ariaDisabled = e.submitter.getAttribute('aria-disabled') === 'true';
29885
29933
  setIsSubmitted(!ariaDisabled);
29886
29934
  if (!ariaDisabled && validationIsValid) {
29887
29935
  dispatch(setHasResponded(true));
@@ -30580,6 +30628,7 @@ function TranslationsOptionsButton({ children, position = {
30580
30628
 
30581
30629
 
30582
30630
 
30631
+
30583
30632
  function AppOptions() {
30584
30633
  const {
30585
30634
  menuOptions,
@@ -30588,15 +30637,13 @@ function AppOptions() {
30588
30637
  const {
30589
30638
  isAvailable: isTranslationsAvailable
30590
30639
  } = useTranslations();
30591
- const {
30592
- hasInterrupt
30593
- } = useInterrupt();
30640
+ const hasError = useSelector_useSelector(selectHasError);
30594
30641
  const {
30595
30642
  t,
30596
30643
  locale
30597
30644
  } = useI18n();
30598
30645
  const localeNativeName = useLocaleNativeName(locale);
30599
- if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasInterrupt) {
30646
+ if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasError) {
30600
30647
  return null;
30601
30648
  }
30602
30649
  const openButtonText = t('translations.settings.openButtonText', {
@@ -31919,10 +31966,11 @@ const ChatStatus = ({ children, handleClose, title, closeButtonText, srCloseButt
31919
31966
 
31920
31967
 
31921
31968
 
31969
+
31922
31970
  function TranslationChatStatus() {
31923
31971
  const { t } = useI18n();
31924
31972
  const { id } = useTranslationsContainer();
31925
- const { hasInterrupt } = useInterrupt();
31973
+ const hasError = useSelector_useSelector(selectHasError);
31926
31974
  const { disableTranslations, currentLocale } = useTranslations();
31927
31975
  const localeNativeName = useLocaleNativeName(currentLocale);
31928
31976
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
@@ -31931,7 +31979,7 @@ function TranslationChatStatus() {
31931
31979
  disableTranslations();
31932
31980
  focusSkiplinkTarget();
31933
31981
  }, [disableTranslations, focusSkiplinkTarget]);
31934
- if (hasInterrupt) {
31982
+ if (hasError) {
31935
31983
  return null;
31936
31984
  }
31937
31985
  return (o(chat_status, { handleClose: handleClickStop, title: label, id: id, closeButtonText: t('translations.status.stopText'), srCloseButtonText: t('translations.status.srStopText') }));
@@ -31964,29 +32012,17 @@ function TranslationProposal() {
31964
32012
 
31965
32013
 
31966
32014
 
32015
+
31967
32016
  function TranslationStatus() {
31968
- const { hasInterrupt } = useInterrupt();
32017
+ const hasError = useSelector_useSelector(selectHasError);
31969
32018
  const { isActive } = useTranslations();
31970
- if (hasInterrupt) {
32019
+ if (hasError) {
31971
32020
  return null;
31972
32021
  }
31973
32022
  return !isActive ? o(TranslationProposal, {}) : o(TranslationChatStatus, {});
31974
32023
  }
31975
32024
 
31976
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
31977
-
31978
-
31979
-
31980
-
31981
-
31982
-
31983
-
31984
-
31985
-
31986
- 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; }
31987
- 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; }
31988
-
31989
-
32025
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
31990
32026
 
31991
32027
 
31992
32028
 
@@ -31996,64 +32032,24 @@ function chat_frame_objectSpread(target) { for (var i = 1; i < arguments.length;
31996
32032
 
31997
32033
 
31998
32034
 
31999
- function ChatFrame(_ref) {
32000
- let {
32001
- children,
32002
- interruptComponent: InterruptComponent
32003
- } = _ref;
32035
+ const Interrupt = () => {
32004
32036
  const {
32005
- hasInterrupt,
32006
- meta
32007
- } = useInterrupt();
32008
- const {
32009
- isOpen
32010
- } = useVisibility();
32011
- if (hasInterrupt) {
32012
- if (isOpen) {
32013
- return o(InterruptComponent, chat_frame_objectSpread({}, meta));
32037
+ meta: {
32038
+ originalError,
32039
+ title,
32040
+ message,
32041
+ buttonText,
32042
+ action,
32043
+ srText
32014
32044
  }
32015
- return null;
32016
- }
32017
- return o(preact_module/* Fragment */.HY, {
32018
- children: [o(chat_scroll_provider, {
32019
- children: [o("div", {
32020
- className: css_className('chat__container__header'),
32021
- children: [o(TranslationStatus, {}), o(collapse_button, {})]
32022
- }), children]
32023
- }), o(entry_container, {}), isOpen && o(AppOptions, {})]
32024
- });
32025
- }
32026
- /* harmony default export */ var chat_frame = (ChatFrame);
32027
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
32028
-
32029
-
32030
-
32031
-
32032
-
32033
-
32034
-
32035
-
32036
- const Interrupt = _ref => {
32037
- let {
32038
- originalError,
32039
- title,
32040
- message,
32041
- buttonText,
32042
- action,
32043
- srText
32044
- } = _ref;
32045
+ } = useInterrupt();
32045
32046
  const seamlyCommands = use_seamly_commands();
32046
32047
  const headingId = useGeneratedId();
32047
32048
  const {
32048
32049
  sendPolite
32049
32050
  } = useLiveRegion();
32050
32051
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
32051
- const isExpiredError = originalError.name === 'SeamlySessionExpiredError';
32052
- (0,hooks_module/* useEffect */.d4)(() => {
32053
- if (isExpiredError && seamlyCommands[action]) {
32054
- seamlyCommands[action]();
32055
- }
32056
- }, [action, seamlyCommands, isExpiredError]);
32052
+ const isExpiredError = originalError?.name === 'SeamlySessionExpiredError';
32057
32053
  (0,hooks_module/* useEffect */.d4)(() => {
32058
32054
  if (!isExpiredError && srText) {
32059
32055
  // Wait for live regions to stabilise in case this occurs
@@ -32094,16 +32090,49 @@ const Interrupt = _ref => {
32094
32090
  }) : o(preact_module/* Fragment */.HY, {});
32095
32091
  };
32096
32092
  /* harmony default export */ var interrupt = (Interrupt);
32097
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
32093
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
32098
32094
 
32099
32095
 
32100
32096
 
32101
32097
 
32102
32098
 
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
+
32103
32133
  const AppView = () => {
32104
32134
  return o(chat, {
32105
32135
  children: o(chat_frame, {
32106
- interruptComponent: interrupt,
32107
32136
  children: o(conversation, {})
32108
32137
  })
32109
32138
  });
@@ -32117,6 +32146,7 @@ const AppView = () => {
32117
32146
 
32118
32147
 
32119
32148
 
32149
+
32120
32150
  function PreChatMessageEvent(_ref) {
32121
32151
  let {
32122
32152
  event
@@ -32131,13 +32161,11 @@ function PreChatMessages() {
32131
32161
  preChatEvents,
32132
32162
  layoutMode
32133
32163
  } = useConfig();
32134
- const {
32135
- hasInterrupt
32136
- } = useInterrupt();
32164
+ const hasError = useSelector_useSelector(selectHasError);
32137
32165
  const {
32138
32166
  isOpen
32139
32167
  } = useVisibility();
32140
- const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
32168
+ const isVisible = !(hasError || !preChatEvents?.length || isOpen);
32141
32169
  return isVisible && o("ul", {
32142
32170
  className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
32143
32171
  "aria-hidden": !isVisible,
@@ -32159,19 +32187,6 @@ function PreChatMessages() {
32159
32187
 
32160
32188
 
32161
32189
 
32162
- 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; }
32163
- 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; }
32164
-
32165
-
32166
-
32167
-
32168
-
32169
-
32170
-
32171
-
32172
-
32173
-
32174
-
32175
32190
 
32176
32191
 
32177
32192
  const InlineView = () => {
@@ -32182,13 +32197,6 @@ const InlineView = () => {
32182
32197
  const {
32183
32198
  isOpen
32184
32199
  } = useVisibility();
32185
- const {
32186
- hasInterrupt,
32187
- meta
32188
- } = useInterrupt();
32189
- if (hasInterrupt && !isOpen) {
32190
- return o(interrupt, inline_view_objectSpread({}, meta));
32191
- }
32192
32200
  return o(preact_module/* Fragment */.HY, {
32193
32201
  children: [o(in_out_transition, {
32194
32202
  isActive: !isOpen,
@@ -32204,7 +32212,6 @@ const InlineView = () => {
32204
32212
  children: o(chat, {
32205
32213
  ref: containerRef,
32206
32214
  children: showInlineView && o(chat_frame, {
32207
- interruptComponent: interrupt,
32208
32215
  children: isOpen && o(conversation, {})
32209
32216
  })
32210
32217
  })
@@ -32226,13 +32233,12 @@ const InlineView = () => {
32226
32233
 
32227
32234
 
32228
32235
 
32236
+
32229
32237
  const ButtonIcon = () => {
32230
32238
  const startChatIcon = useStartChatIcon();
32231
32239
  const currentAgent = useSeamlyCurrentAgent();
32232
- const {
32233
- hasInterrupt
32234
- } = useInterrupt();
32235
- const isActiveConversation = currentAgent && !hasInterrupt;
32240
+ const hasError = useSelector_useSelector(selectHasError);
32241
+ const isActiveConversation = currentAgent && !hasError;
32236
32242
  const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
32237
32243
  return src ? o("img", {
32238
32244
  className: css_className(isActiveConversation ? 'avatar' : 'icon'),
@@ -32288,19 +32294,6 @@ const WindowOpenButton = _ref => {
32288
32294
 
32289
32295
 
32290
32296
 
32291
- 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; }
32292
- 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; }
32293
-
32294
-
32295
-
32296
-
32297
-
32298
-
32299
-
32300
-
32301
-
32302
-
32303
-
32304
32297
 
32305
32298
 
32306
32299
 
@@ -32313,10 +32306,6 @@ const WindowView = () => {
32313
32306
  openChat
32314
32307
  } = useVisibility();
32315
32308
  const userHasResponded = useUserHasResponded();
32316
- const {
32317
- hasInterrupt,
32318
- meta
32319
- } = useInterrupt();
32320
32309
  const {
32321
32310
  t
32322
32311
  } = useI18n();
@@ -32328,9 +32317,6 @@ const WindowView = () => {
32328
32317
  }
32329
32318
  }
32330
32319
  }), [continueChatText]);
32331
- if (hasInterrupt && !isOpen) {
32332
- return o(interrupt, window_view_objectSpread({}, meta));
32333
- }
32334
32320
  return o(preact_module/* Fragment */.HY, {
32335
32321
  children: [o(window_open_button, {
32336
32322
  onClick: openChat
@@ -32355,7 +32341,6 @@ const WindowView = () => {
32355
32341
  transitionStartState: transitionStartStates.notRendered,
32356
32342
  children: o(chat, {
32357
32343
  children: o(chat_frame, {
32358
- interruptComponent: interrupt,
32359
32344
  children: o(conversation, {})
32360
32345
  })
32361
32346
  })
@@ -32809,6 +32794,7 @@ function initializeExternalApi(appConfig) {
32809
32794
 
32810
32795
 
32811
32796
 
32797
+
32812
32798
  // Deprecated Toggle Button, should be removed once it is removed from clients
32813
32799
 
32814
32800
 
@@ -32830,13 +32816,11 @@ const DeprecatedToggleButton = _ref => {
32830
32816
  const focusIfContained = useFocusIfSeamlyContainedFocus();
32831
32817
  const currentAgent = useSeamlyCurrentAgent();
32832
32818
  const agentSubtitle = useSeamlyHeaderData().subTitle;
32833
- const {
32834
- hasInterrupt
32835
- } = useInterrupt();
32819
+ const hasError = useSelector_useSelector(selectHasError);
32836
32820
  const {
32837
32821
  headerCollapseButtonId
32838
32822
  } = useSeamlyStateContext();
32839
- const showAgentInfo = currentAgent && !hasInterrupt;
32823
+ const showAgentInfo = currentAgent && !hasError;
32840
32824
  (0,hooks_module/* useLayoutEffect */.bt)(() => {
32841
32825
  // Because we can close the app from the external API we
32842
32826
  // need to determine if current keyboard focus resides inside
@@ -32896,6 +32880,7 @@ const DeprecatedToggleButton = _ref => {
32896
32880
 
32897
32881
 
32898
32882
 
32883
+
32899
32884
  const AgentInfo = () => {
32900
32885
  const {
32901
32886
  t
@@ -32909,12 +32894,10 @@ const AgentInfo = () => {
32909
32894
  isOpen
32910
32895
  } = useVisibility();
32911
32896
  const currentAgent = useSeamlyCurrentAgent();
32912
- const {
32913
- hasInterrupt
32914
- } = useInterrupt();
32897
+ const hasError = useSelector_useSelector(selectHasError);
32915
32898
  const startChatIcon = useStartChatIcon();
32916
32899
  const src = currentAgent?.avatar ?? startChatIcon;
32917
- const displaySubtitle = hasInterrupt ? '' : subTitle;
32900
+ const displaySubtitle = hasError ? '' : subTitle;
32918
32901
  const classNames = ['message-count'];
32919
32902
  if (isOpen) {
32920
32903
  classNames.push('message-count__hide');
@@ -33001,35 +32984,19 @@ const Header = _ref => {
33001
32984
 
33002
32985
 
33003
32986
 
33004
- 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; }
33005
- 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; }
33006
-
33007
-
33008
-
33009
-
33010
-
33011
-
33012
-
33013
32987
 
33014
32988
 
33015
32989
 
33016
32990
  function deprecated_chat_frame_ChatFrame(_ref) {
33017
32991
  let {
33018
- children,
33019
- interruptComponent: InterruptComponent
32992
+ children
33020
32993
  } = _ref;
33021
- const {
33022
- hasInterrupt,
33023
- meta
33024
- } = useInterrupt();
33025
32994
  const {
33026
32995
  isOpen
33027
32996
  } = useVisibility();
33028
- if (hasInterrupt) {
33029
- if (isOpen) {
33030
- return o(InterruptComponent, deprecated_chat_frame_objectSpread({}, meta));
33031
- }
33032
- return null;
32997
+ const hasError = useSelector_useSelector(selectHasError);
32998
+ if (hasError) {
32999
+ return o(interrupt, {});
33033
33000
  }
33034
33001
  return o(preact_module/* Fragment */.HY, {
33035
33002
  children: [o(chat_scroll_provider, {
@@ -33074,6 +33041,7 @@ function faq_objectSpread(target) { for (var i = 1; i < arguments.length; i++) {
33074
33041
 
33075
33042
 
33076
33043
 
33044
+
33077
33045
 
33078
33046
 
33079
33047
  const Faq = () => {
@@ -33089,9 +33057,7 @@ const Faq = () => {
33089
33057
  const {
33090
33058
  sendPolite
33091
33059
  } = useLiveRegion();
33092
- const {
33093
- hasInterrupt
33094
- } = useInterrupt();
33060
+ const hasError = useSelector_useSelector(selectHasError);
33095
33061
  const {
33096
33062
  hasCountdown,
33097
33063
  endCountdown
@@ -33107,7 +33073,7 @@ const Faq = () => {
33107
33073
  payload: lastFaqEventPayload
33108
33074
  });
33109
33075
  const faqs = (0,hooks_module/* useMemo */.Ye)(() => {
33110
- const newFaqs = lastFaqEventPayload && !hasInterrupt ? eventBody : [];
33076
+ const newFaqs = lastFaqEventPayload && !hasError ? eventBody : [];
33111
33077
  const itemBaseClass = `faqs__item`;
33112
33078
  return map_default()(newFaqs).call(newFaqs, _ref => {
33113
33079
  let {
@@ -33119,7 +33085,7 @@ const Faq = () => {
33119
33085
  classNames: [itemBaseClass, ...map_default()(categories).call(categories, cat => `faqs__item--${String(cat).toLowerCase().replace(/[^a-z0-9_\\-]/, '')}`)]
33120
33086
  });
33121
33087
  });
33122
- }, [lastFaqEventPayload, hasInterrupt, eventBody]);
33088
+ }, [lastFaqEventPayload, hasError, eventBody]);
33123
33089
  const prevFaqs = (0,hooks_module/* useRef */.sO)(null);
33124
33090
  const prevHasFaqs = (0,hooks_module/* useRef */.sO)(false);
33125
33091
  const {
@@ -33301,7 +33267,6 @@ const DeprecatedAppFrame = _ref => {
33301
33267
 
33302
33268
 
33303
33269
 
33304
-
33305
33270
  const ShowInlineView = _ref => {
33306
33271
  let {
33307
33272
  children
@@ -33329,7 +33294,6 @@ const DeprecatedView = () => {
33329
33294
  onCloseChat: closeChat,
33330
33295
  children: o(agent_info, {})
33331
33296
  }), o(deprecated_chat_frame, {
33332
- interruptComponent: interrupt,
33333
33297
  children: o(conversation, {})
33334
33298
  })]
33335
33299
  })