@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
@@ -1,7 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 832:
4
+ /***/ 574:
5
5
  /***/ ((module) => {
6
6
 
7
7
  "use strict";
@@ -201,7 +201,7 @@ const _require = __webpack_require__(244),
201
201
  mixin = _require.mixin,
202
202
  hasOwn = _require.hasOwn;
203
203
  const ResponseBase = __webpack_require__(253);
204
- const Agent = __webpack_require__(832);
204
+ const Agent = __webpack_require__(574);
205
205
 
206
206
  /**
207
207
  * Noop.
@@ -7249,7 +7249,7 @@ _API_ready = new WeakMap(), _API_externalId = new WeakMap(), _API_layoutMode = n
7249
7249
  return {
7250
7250
  clientName: "@seamly/web-ui",
7251
7251
  clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
7252
- clientVersion: "21.0.8",
7252
+ clientVersion: "21.0.9",
7253
7253
  currentUrl: window.location.toString(),
7254
7254
  screenResolution: `${window.screen.width}x${window.screen.height}`,
7255
7255
  timezone: getTimeZone(),
@@ -11700,7 +11700,7 @@ const interruptSlice = createSlice({
11700
11700
  clearInterrupt: () => slice_initialState
11701
11701
  },
11702
11702
  extraReducers: builder => {
11703
- builder.addCase(resetApp.fulfilled, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
11703
+ builder.addCase(initializeConfig.pending, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
11704
11704
  payload
11705
11705
  }) => {
11706
11706
  state.error = payload;
@@ -12576,6 +12576,7 @@ const {
12576
12576
 
12577
12577
 
12578
12578
 
12579
+
12579
12580
  const i18n_slice_initialState = {
12580
12581
  translations: {
12581
12582
  'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
@@ -12612,7 +12613,7 @@ const i18nSlice = createSlice({
12612
12613
  },
12613
12614
  extraReducers: builder => {
12614
12615
  // Add reducers for additional action types here, and handle loading state as needed
12615
- builder.addCase(initializeConfig.fulfilled, (state, {
12616
+ builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(initializeConfig.fulfilled, (state, {
12616
12617
  payload
12617
12618
  }) => {
12618
12619
  state.initialLocale = payload.locale;
@@ -12715,6 +12716,7 @@ const selectIsLoading = es_createSelector(({
12715
12716
 
12716
12717
 
12717
12718
 
12719
+
12718
12720
  const translationsInitialState = {
12719
12721
  isActive: false,
12720
12722
  currentLocale: undefined,
@@ -12805,7 +12807,7 @@ const translationSlice = createSlice({
12805
12807
  }
12806
12808
  },
12807
12809
  extraReducers: builder => {
12808
- builder.addCase(initializeConfig.fulfilled, (state, {
12810
+ builder.addCase(resetApp.pending, () => translationsInitialState).addCase(initializeConfig.fulfilled, (state, {
12809
12811
  payload
12810
12812
  }) => {
12811
12813
  var _a;
@@ -13992,7 +13994,109 @@ const useLiveRegion = () => {
13992
13994
  sendAssertive
13993
13995
  };
13994
13996
  };
13995
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
13997
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
13998
+
13999
+ const selectError = es_createSelector(({
14000
+ interrupt
14001
+ }) => interrupt, ({
14002
+ error
14003
+ }) => error);
14004
+ const selectHasError = es_createSelector(selectError, error => Boolean(error));
14005
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
14006
+
14007
+
14008
+
14009
+
14010
+ function useInterrupt() {
14011
+ const {
14012
+ t
14013
+ } = useI18n();
14014
+ const error = useSelector_useSelector(selectError);
14015
+ const hasError = useSelector_useSelector(selectHasError);
14016
+ const meta = (0,hooks_.useMemo)(() => {
14017
+ if (!hasError) {
14018
+ return {
14019
+ title: undefined,
14020
+ message: undefined,
14021
+ srText: undefined,
14022
+ buttonText: undefined,
14023
+ originalError: undefined
14024
+ };
14025
+ }
14026
+ const {
14027
+ langKey,
14028
+ action
14029
+ } = error;
14030
+ const title = t(`${langKey}.title`);
14031
+ const message = t(`${langKey}.message`);
14032
+ const srText = t(`${langKey}.srText`);
14033
+ const buttonText = t(`${langKey}.buttonText`);
14034
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
14035
+ title,
14036
+ message,
14037
+ srText
14038
+ } : {}), action ? {
14039
+ action
14040
+ } : {}), action && langKey ? {
14041
+ buttonText
14042
+ } : {}), {
14043
+ originalError: error
14044
+ });
14045
+ }, [hasError, error, t]);
14046
+ return {
14047
+ hasError,
14048
+ meta,
14049
+ error
14050
+ };
14051
+ }
14052
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-session-expired-command.ts
14053
+
14054
+
14055
+
14056
+ function useSessionExpiredCommand() {
14057
+ const {
14058
+ meta: {
14059
+ originalError,
14060
+ action
14061
+ }
14062
+ } = useInterrupt();
14063
+ const seamlyCommands = use_seamly_commands();
14064
+ const isExpiredError = (originalError === null || originalError === void 0 ? void 0 : originalError.name) === 'SeamlySessionExpiredError';
14065
+ (0,hooks_.useEffect)(() => {
14066
+ if (isExpiredError && seamlyCommands[action]) {
14067
+ seamlyCommands[action]();
14068
+ }
14069
+ }, [action, seamlyCommands, isExpiredError]);
14070
+ }
14071
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.ts
14072
+ var use_seamly_chat_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
14073
+ function adopt(value) {
14074
+ return value instanceof P ? value : new P(function (resolve) {
14075
+ resolve(value);
14076
+ });
14077
+ }
14078
+ return new (P || (P = Promise))(function (resolve, reject) {
14079
+ function fulfilled(value) {
14080
+ try {
14081
+ step(generator.next(value));
14082
+ } catch (e) {
14083
+ reject(e);
14084
+ }
14085
+ }
14086
+ function rejected(value) {
14087
+ try {
14088
+ step(generator["throw"](value));
14089
+ } catch (e) {
14090
+ reject(e);
14091
+ }
14092
+ }
14093
+ function step(result) {
14094
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
14095
+ }
14096
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14097
+ });
14098
+ };
14099
+
13996
14100
 
13997
14101
 
13998
14102
 
@@ -14031,6 +14135,8 @@ const useSeamlyChat = () => {
14031
14135
  const {
14032
14136
  sendAssertive
14033
14137
  } = useLiveRegion();
14138
+ // Automatically reset conversation if the session has expired
14139
+ useSessionExpiredCommand();
14034
14140
  (0,hooks_.useEffect)(() => {
14035
14141
  if (isVisible) {
14036
14142
  // Wait for the live containers to stabilise in the DOM before injecting
@@ -14077,24 +14183,23 @@ const useSeamlyChat = () => {
14077
14183
  connectCalled.current = false;
14078
14184
  }
14079
14185
  }, [apiConfigReady, apiConnected]);
14080
- const connectAndStart = (0,hooks_.useCallback)(async () => {
14186
+ const connectAndStart = (0,hooks_.useCallback)(() => use_seamly_chat_awaiter(void 0, void 0, void 0, function* () {
14081
14187
  // We don't connect if we are already connected to the api to avoid multiple in-flight connection processes.
14082
14188
  if (!apiConnected) {
14083
14189
  connectCalled.current = true;
14084
- await connect();
14190
+ yield connect();
14085
14191
  }
14086
-
14087
14192
  // 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'.
14088
14193
  if (isApp || isOpen || isVisible && isInline) {
14089
14194
  start();
14090
14195
  }
14091
- }, [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
14196
+ }), [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
14092
14197
  (0,hooks_.useEffect)(() => {
14093
14198
  // We dont't connect or start when the apiConfig is not ready yet.
14094
14199
  // We also keep track of whether start has been called to avoid multiple in-flight connection processes.
14095
14200
  // We check if the window view is not open and no conversation is started yet.
14096
14201
  // Lastly we check if the inline view is not scrolled in to view.
14097
- if (!apiConfigReady || connectCalled.current || isWindow && !isOpen && !hasConversation() || isInline && (!isVisible || !showInlineView)) {
14202
+ if (!apiConfigReady || connectCalled.current || isWindow && !isOpen || isInline && (!isVisible || !showInlineView)) {
14098
14203
  return;
14099
14204
  }
14100
14205
  if (hasConversation() && isOpen) {
@@ -17990,7 +18095,7 @@ const SeamlyEventSubscriber = () => {
17990
18095
  channel === null || channel === void 0 ? void 0 : channel.leave();
17991
18096
  };
17992
18097
  }
17993
- return () => {};
18098
+ return () => undefined;
17994
18099
  }, [api, api.connectionInfo, api.conversation]);
17995
18100
  (0,hooks_.useEffect)(() => {
17996
18101
  api.conversation.onConnection(({
@@ -18173,6 +18278,9 @@ const SeamlyEventSubscriber = () => {
18173
18278
  const {
18174
18279
  channel
18175
18280
  } = api.conversation;
18281
+ if (messageChannelRef.current) {
18282
+ channel === null || channel === void 0 ? void 0 : channel.off('message', messageChannelRef.current);
18283
+ }
18176
18284
  messageChannelRef.current = channel.on('message', payload => {
18177
18285
  if (!EMITTABLE_MESSAGE_TYPES.includes(payload.type)) {
18178
18286
  return payload;
@@ -18189,19 +18297,18 @@ const SeamlyEventSubscriber = () => {
18189
18297
  });
18190
18298
  return true;
18191
18299
  });
18192
- return () => {
18193
- var _a;
18194
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('message', messageChannelRef.current);
18195
- };
18196
18300
  }
18197
- return () => undefined;
18198
18301
  }, [api, api.connectionInfo, api.conversation.channel, eventBus]);
18199
18302
  (0,hooks_.useEffect)(() => {
18200
18303
  if (api.connectionInfo) {
18201
18304
  api.conversation.onConnection(({
18202
18305
  connected
18203
18306
  }) => {
18307
+ var _a;
18204
18308
  if (!connected) return false;
18309
+ if (syncChannelRef.current) {
18310
+ (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
18311
+ }
18205
18312
  syncChannelRef.current = api.conversation.channel.on('sync', payload => {
18206
18313
  var _a;
18207
18314
  const lastEvent = events[events.length - 1];
@@ -18225,12 +18332,7 @@ const SeamlyEventSubscriber = () => {
18225
18332
  });
18226
18333
  return true;
18227
18334
  });
18228
- return () => {
18229
- var _a;
18230
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
18231
- };
18232
18335
  }
18233
- return () => undefined;
18234
18336
  }, [api, api.connectionInfo, api.conversation.channel, events, dispatch]);
18235
18337
  return null;
18236
18338
  };
@@ -18366,52 +18468,6 @@ const SeamlyInitializer = () => {
18366
18468
  return null;
18367
18469
  };
18368
18470
  /* harmony default export */ const seamly_initializer = (SeamlyInitializer);
18369
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
18370
-
18371
- const selectError = es_createSelector(({
18372
- interrupt
18373
- }) => interrupt, ({
18374
- error
18375
- }) => error);
18376
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
18377
-
18378
-
18379
-
18380
-
18381
- function useInterrupt() {
18382
- const {
18383
- t
18384
- } = useI18n();
18385
- const error = useSelector_useSelector(selectError);
18386
- const hasInterrupt = Boolean(error);
18387
- const meta = (0,hooks_.useMemo)(() => {
18388
- if (!error) return {};
18389
- const {
18390
- langKey,
18391
- action
18392
- } = error;
18393
- const title = t(`${langKey}.title`);
18394
- const message = t(`${langKey}.message`);
18395
- const srText = t(`${langKey}.srText`);
18396
- const buttonText = t(`${langKey}.buttonText`);
18397
- return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
18398
- title,
18399
- message,
18400
- srText
18401
- } : {}), action ? {
18402
- action
18403
- } : {}), action && langKey ? {
18404
- buttonText
18405
- } : {}), {
18406
- originalError: error
18407
- });
18408
- }, [t, error]);
18409
- return {
18410
- hasInterrupt,
18411
- meta,
18412
- error
18413
- };
18414
- }
18415
18471
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-instance-functions-loader.js
18416
18472
 
18417
18473
 
@@ -18461,9 +18517,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18461
18517
  isInline,
18462
18518
  isResolving
18463
18519
  } = useSeamlyLayoutMode();
18464
- const {
18465
- hasInterrupt
18466
- } = useInterrupt();
18520
+ const hasError = useSelector_useSelector(selectHasError);
18467
18521
  const currentConversationUrl = useSeamlyConversationUrl();
18468
18522
  const prevConversationUrl = (0,hooks_.useRef)(null);
18469
18523
  const onActivityHandler = use_seamly_activity_event_handler();
@@ -18543,7 +18597,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18543
18597
  }
18544
18598
  }, [api.send]);
18545
18599
  (0,hooks_.useEffect)(() => {
18546
- if (!isResolving && !hasInterrupt) {
18600
+ if (!isResolving && !hasError) {
18547
18601
  // Check for app reset
18548
18602
  if (prevConversationUrl.current && prevConversationUrl.current !== currentConversationUrl) {
18549
18603
  eventBus.emit('unreadMessageCount', unreadCount);
@@ -18562,7 +18616,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18562
18616
  previousUnreadCount.current = unreadCount;
18563
18617
  prevConversationUrl.current = currentConversationUrl;
18564
18618
  }
18565
- }, [unreadCount, visible, eventBus, isInline, isResolving, hasInterrupt, currentConversationUrl]);
18619
+ }, [unreadCount, visible, eventBus, isInline, isResolving, hasError, currentConversationUrl]);
18566
18620
  return null;
18567
18621
  };
18568
18622
  /* harmony default export */ const seamly_instance_functions_loader = (SeamlyInstanceFunctionsLoader);
@@ -19039,6 +19093,7 @@ const InOutTransition = ({
19039
19093
 
19040
19094
 
19041
19095
 
19096
+
19042
19097
 
19043
19098
 
19044
19099
  const Suggestions = ({
@@ -19070,9 +19125,7 @@ const Suggestions = ({
19070
19125
  sendPolite
19071
19126
  } = useLiveRegion();
19072
19127
  // interrupt & countdown hooks
19073
- const {
19074
- hasInterrupt
19075
- } = useInterrupt();
19128
+ const hasError = useSelector_useSelector(selectHasError);
19076
19129
  const {
19077
19130
  hasCountdown,
19078
19131
  endCountdown
@@ -19089,7 +19142,7 @@ const Suggestions = ({
19089
19142
  } = useTranslatedEventData({
19090
19143
  payload
19091
19144
  });
19092
- const suggestions = (0,hooks_.useMemo)(() => payload && !hasInterrupt ? eventBody : [], [payload, hasInterrupt, eventBody]);
19145
+ const suggestions = (0,hooks_.useMemo)(() => payload && !hasError ? eventBody : [], [payload, hasError, eventBody]);
19093
19146
  const prevSuggestions = (0,hooks_.useRef)(null);
19094
19147
  const prevHasSuggestions = (0,hooks_.useRef)(false);
19095
19148
  const previousRenderedSuggestions = (0,hooks_.useRef)([]);
@@ -19541,10 +19594,9 @@ function FormProvider(_a) {
19541
19594
  });
19542
19595
  }, [setExternalErrors]);
19543
19596
  const handleSubmit = (0,hooks_.useCallback)((e) => {
19544
- var _a;
19545
19597
  e.preventDefault();
19546
19598
  // If the submitter is set to being aria-disabled, block the submit action
19547
- const ariaDisabled = ((_a = e.submitter) === null || _a === void 0 ? void 0 : _a.ariaDisabled) === 'true';
19599
+ const ariaDisabled = e.submitter.getAttribute('aria-disabled') === 'true';
19548
19600
  setIsSubmitted(!ariaDisabled);
19549
19601
  if (!ariaDisabled && validationIsValid) {
19550
19602
  dispatch(setHasResponded(true));
@@ -20219,6 +20271,7 @@ function TranslationsOptionsButton({ children, position = {
20219
20271
 
20220
20272
 
20221
20273
 
20274
+
20222
20275
  function AppOptions() {
20223
20276
  const {
20224
20277
  menuOptions,
@@ -20227,15 +20280,13 @@ function AppOptions() {
20227
20280
  const {
20228
20281
  isAvailable: isTranslationsAvailable
20229
20282
  } = useTranslations();
20230
- const {
20231
- hasInterrupt
20232
- } = useInterrupt();
20283
+ const hasError = useSelector_useSelector(selectHasError);
20233
20284
  const {
20234
20285
  t,
20235
20286
  locale
20236
20287
  } = useI18n();
20237
20288
  const localeNativeName = useLocaleNativeName(locale);
20238
- if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasInterrupt) {
20289
+ if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasError) {
20239
20290
  return null;
20240
20291
  }
20241
20292
  const openButtonText = t('translations.settings.openButtonText', {
@@ -21497,10 +21548,11 @@ const ChatStatus = ({ children, handleClose, title, closeButtonText, srCloseButt
21497
21548
 
21498
21549
 
21499
21550
 
21551
+
21500
21552
  function TranslationChatStatus() {
21501
21553
  const { t } = useI18n();
21502
21554
  const { id } = useTranslationsContainer();
21503
- const { hasInterrupt } = useInterrupt();
21555
+ const hasError = useSelector_useSelector(selectHasError);
21504
21556
  const { disableTranslations, currentLocale } = useTranslations();
21505
21557
  const localeNativeName = useLocaleNativeName(currentLocale);
21506
21558
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
@@ -21509,7 +21561,7 @@ function TranslationChatStatus() {
21509
21561
  disableTranslations();
21510
21562
  focusSkiplinkTarget();
21511
21563
  }, [disableTranslations, focusSkiplinkTarget]);
21512
- if (hasInterrupt) {
21564
+ if (hasError) {
21513
21565
  return null;
21514
21566
  }
21515
21567
  return ((0,jsx_runtime_namespaceObject.jsx)(chat_status, { handleClose: handleClickStop, title: label, id: id, closeButtonText: t('translations.status.stopText'), srCloseButtonText: t('translations.status.srStopText') }));
@@ -21542,24 +21594,17 @@ function TranslationProposal() {
21542
21594
 
21543
21595
 
21544
21596
 
21597
+
21545
21598
  function TranslationStatus() {
21546
- const { hasInterrupt } = useInterrupt();
21599
+ const hasError = useSelector_useSelector(selectHasError);
21547
21600
  const { isActive } = useTranslations();
21548
- if (hasInterrupt) {
21601
+ if (hasError) {
21549
21602
  return null;
21550
21603
  }
21551
21604
  return !isActive ? (0,jsx_runtime_namespaceObject.jsx)(TranslationProposal, {}) : (0,jsx_runtime_namespaceObject.jsx)(TranslationChatStatus, {});
21552
21605
  }
21553
21606
 
21554
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
21555
- 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; }
21556
- 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; }
21557
- 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; }
21558
- function chat_frame_toPropertyKey(arg) { var key = chat_frame_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21559
- 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); }
21560
-
21561
-
21562
-
21607
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
21563
21608
 
21564
21609
 
21565
21610
 
@@ -21568,61 +21613,24 @@ function chat_frame_toPrimitive(input, hint) { if (typeof input !== "object" ||
21568
21613
 
21569
21614
 
21570
21615
 
21571
- function ChatFrame({
21572
- children,
21573
- interruptComponent: InterruptComponent
21574
- }) {
21575
- const {
21576
- hasInterrupt,
21577
- meta
21578
- } = useInterrupt();
21616
+ const Interrupt = () => {
21579
21617
  const {
21580
- isOpen
21581
- } = useVisibility();
21582
- if (hasInterrupt) {
21583
- if (isOpen) {
21584
- return (0,jsx_runtime_namespaceObject.jsx)(InterruptComponent, chat_frame_objectSpread({}, meta));
21618
+ meta: {
21619
+ originalError,
21620
+ title,
21621
+ message,
21622
+ buttonText,
21623
+ action,
21624
+ srText
21585
21625
  }
21586
- return null;
21587
- }
21588
- return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21589
- children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
21590
- children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
21591
- className: css_className('chat__container__header'),
21592
- children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
21593
- }), children]
21594
- }), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
21595
- });
21596
- }
21597
- /* harmony default export */ const chat_frame = (ChatFrame);
21598
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
21599
-
21600
-
21601
-
21602
-
21603
-
21604
-
21605
-
21606
- const Interrupt = ({
21607
- originalError,
21608
- title,
21609
- message,
21610
- buttonText,
21611
- action,
21612
- srText
21613
- }) => {
21626
+ } = useInterrupt();
21614
21627
  const seamlyCommands = use_seamly_commands();
21615
21628
  const headingId = useGeneratedId();
21616
21629
  const {
21617
21630
  sendPolite
21618
21631
  } = useLiveRegion();
21619
21632
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
21620
- const isExpiredError = originalError.name === 'SeamlySessionExpiredError';
21621
- (0,hooks_.useEffect)(() => {
21622
- if (isExpiredError && seamlyCommands[action]) {
21623
- seamlyCommands[action]();
21624
- }
21625
- }, [action, seamlyCommands, isExpiredError]);
21633
+ const isExpiredError = originalError?.name === 'SeamlySessionExpiredError';
21626
21634
  (0,hooks_.useEffect)(() => {
21627
21635
  if (!isExpiredError && srText) {
21628
21636
  // Wait for live regions to stabilise in case this occurs
@@ -21663,16 +21671,48 @@ const Interrupt = ({
21663
21671
  }) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {});
21664
21672
  };
21665
21673
  /* harmony default export */ const interrupt = (Interrupt);
21666
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
21674
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
21675
+
21667
21676
 
21668
21677
 
21669
21678
 
21670
21679
 
21671
21680
 
21681
+
21682
+
21683
+
21684
+
21685
+
21686
+
21687
+
21688
+ function ChatFrame({
21689
+ children
21690
+ }) {
21691
+ const hasError = useSelector_useSelector(selectHasError);
21692
+ const {
21693
+ isOpen
21694
+ } = useVisibility();
21695
+ if (hasError) {
21696
+ return (0,jsx_runtime_namespaceObject.jsx)(interrupt, {});
21697
+ }
21698
+ return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21699
+ children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
21700
+ children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
21701
+ className: css_className('chat__container__header'),
21702
+ children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
21703
+ }), children]
21704
+ }), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
21705
+ });
21706
+ }
21707
+ /* harmony default export */ const chat_frame = (ChatFrame);
21708
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
21709
+
21710
+
21711
+
21712
+
21672
21713
  const AppView = () => {
21673
21714
  return (0,jsx_runtime_namespaceObject.jsx)(chat, {
21674
21715
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21675
- interruptComponent: interrupt,
21676
21716
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21677
21717
  })
21678
21718
  });
@@ -21685,6 +21725,7 @@ const AppView = () => {
21685
21725
 
21686
21726
 
21687
21727
 
21728
+
21688
21729
  function PreChatMessageEvent({
21689
21730
  event
21690
21731
  }) {
@@ -21698,13 +21739,11 @@ function PreChatMessages() {
21698
21739
  preChatEvents,
21699
21740
  layoutMode
21700
21741
  } = useConfig();
21701
- const {
21702
- hasInterrupt
21703
- } = useInterrupt();
21742
+ const hasError = useSelector_useSelector(selectHasError);
21704
21743
  const {
21705
21744
  isOpen
21706
21745
  } = useVisibility();
21707
- const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
21746
+ const isVisible = !(hasError || !preChatEvents?.length || isOpen);
21708
21747
  return isVisible && (0,jsx_runtime_namespaceObject.jsx)("ul", {
21709
21748
  className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
21710
21749
  "aria-hidden": !isVisible,
@@ -21717,13 +21756,6 @@ function PreChatMessages() {
21717
21756
  });
21718
21757
  }
21719
21758
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/inline-view.js
21720
- 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; }
21721
- 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; }
21722
- 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; }
21723
- function inline_view_toPropertyKey(arg) { var key = inline_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21724
- 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); }
21725
-
21726
-
21727
21759
 
21728
21760
 
21729
21761
 
@@ -21743,13 +21775,6 @@ const InlineView = () => {
21743
21775
  const {
21744
21776
  isOpen
21745
21777
  } = useVisibility();
21746
- const {
21747
- hasInterrupt,
21748
- meta
21749
- } = useInterrupt();
21750
- if (hasInterrupt && !isOpen) {
21751
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, inline_view_objectSpread({}, meta));
21752
- }
21753
21778
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21754
21779
  children: [(0,jsx_runtime_namespaceObject.jsx)(in_out_transition, {
21755
21780
  isActive: !isOpen,
@@ -21765,7 +21790,6 @@ const InlineView = () => {
21765
21790
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
21766
21791
  ref: containerRef,
21767
21792
  children: showInlineView && (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21768
- interruptComponent: interrupt,
21769
21793
  children: isOpen && (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21770
21794
  })
21771
21795
  })
@@ -21787,13 +21811,12 @@ const InlineView = () => {
21787
21811
 
21788
21812
 
21789
21813
 
21814
+
21790
21815
  const ButtonIcon = () => {
21791
21816
  const startChatIcon = useStartChatIcon();
21792
21817
  const currentAgent = useSeamlyCurrentAgent();
21793
- const {
21794
- hasInterrupt
21795
- } = useInterrupt();
21796
- const isActiveConversation = currentAgent && !hasInterrupt;
21818
+ const hasError = useSelector_useSelector(selectHasError);
21819
+ const isActiveConversation = currentAgent && !hasError;
21797
21820
  const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
21798
21821
  return src ? (0,jsx_runtime_namespaceObject.jsx)("img", {
21799
21822
  className: css_className(isActiveConversation ? 'avatar' : 'icon'),
@@ -21839,13 +21862,6 @@ const WindowOpenButton = ({
21839
21862
  };
21840
21863
  /* harmony default export */ const window_open_button = (WindowOpenButton);
21841
21864
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/window-view/index.js
21842
- 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; }
21843
- 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; }
21844
- 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; }
21845
- function window_view_toPropertyKey(arg) { var key = window_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21846
- 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); }
21847
-
21848
-
21849
21865
 
21850
21866
 
21851
21867
 
@@ -21867,10 +21883,6 @@ const WindowView = () => {
21867
21883
  openChat
21868
21884
  } = useVisibility();
21869
21885
  const userHasResponded = useUserHasResponded();
21870
- const {
21871
- hasInterrupt,
21872
- meta
21873
- } = useInterrupt();
21874
21886
  const {
21875
21887
  t
21876
21888
  } = useI18n();
@@ -21882,9 +21894,6 @@ const WindowView = () => {
21882
21894
  }
21883
21895
  }
21884
21896
  }), [continueChatText]);
21885
- if (hasInterrupt && !isOpen) {
21886
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, window_view_objectSpread({}, meta));
21887
- }
21888
21897
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21889
21898
  children: [(0,jsx_runtime_namespaceObject.jsx)(window_open_button, {
21890
21899
  onClick: openChat
@@ -21909,7 +21918,6 @@ const WindowView = () => {
21909
21918
  transitionStartState: transitionStartStates.notRendered,
21910
21919
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
21911
21920
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21912
- interruptComponent: interrupt,
21913
21921
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21914
21922
  })
21915
21923
  })