@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
@@ -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.7",
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;
@@ -12642,12 +12643,7 @@ const {
12642
12643
  ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/middleware.ts
12643
12644
 
12644
12645
 
12645
-
12646
-
12647
-
12648
-
12649
-
12650
- const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
12646
+ const handledErrorTypes = ['SeamlyGeneralError', 'SeamlyConfigurationError', 'SeamlySessionExpiredError', 'SeamlyOfflineError', 'SeamlyUnauthorizedError', 'SeamlyUnavailableError'];
12651
12647
  function createInterruptMiddleware({
12652
12648
  api
12653
12649
  }) {
@@ -12657,7 +12653,7 @@ function createInterruptMiddleware({
12657
12653
  type
12658
12654
  } = action;
12659
12655
  if (type === setInterrupt.type) {
12660
- if (!handledErrorTypes.some(ErrorType => payload.name === ErrorType.name)) {
12656
+ if (!handledErrorTypes.includes(payload.name)) {
12661
12657
  throw new SeamlyGeneralError(payload);
12662
12658
  } else if (payload.action === 'reset') {
12663
12659
  // [SMLY-942] We clear the store before a reset to force a new conversation if the page is refreshed before the conversation is reset
@@ -12720,6 +12716,7 @@ const selectIsLoading = es_createSelector(({
12720
12716
 
12721
12717
 
12722
12718
 
12719
+
12723
12720
  const translationsInitialState = {
12724
12721
  isActive: false,
12725
12722
  currentLocale: undefined,
@@ -12810,7 +12807,7 @@ const translationSlice = createSlice({
12810
12807
  }
12811
12808
  },
12812
12809
  extraReducers: builder => {
12813
- builder.addCase(initializeConfig.fulfilled, (state, {
12810
+ builder.addCase(resetApp.pending, () => translationsInitialState).addCase(initializeConfig.fulfilled, (state, {
12814
12811
  payload
12815
12812
  }) => {
12816
12813
  var _a;
@@ -13997,7 +13994,109 @@ const useLiveRegion = () => {
13997
13994
  sendAssertive
13998
13995
  };
13999
13996
  };
14000
- ;// 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
+
14001
14100
 
14002
14101
 
14003
14102
 
@@ -14036,6 +14135,8 @@ const useSeamlyChat = () => {
14036
14135
  const {
14037
14136
  sendAssertive
14038
14137
  } = useLiveRegion();
14138
+ // Automatically reset conversation if the session has expired
14139
+ useSessionExpiredCommand();
14039
14140
  (0,hooks_.useEffect)(() => {
14040
14141
  if (isVisible) {
14041
14142
  // Wait for the live containers to stabilise in the DOM before injecting
@@ -14082,24 +14183,23 @@ const useSeamlyChat = () => {
14082
14183
  connectCalled.current = false;
14083
14184
  }
14084
14185
  }, [apiConfigReady, apiConnected]);
14085
- const connectAndStart = (0,hooks_.useCallback)(async () => {
14186
+ const connectAndStart = (0,hooks_.useCallback)(() => use_seamly_chat_awaiter(void 0, void 0, void 0, function* () {
14086
14187
  // We don't connect if we are already connected to the api to avoid multiple in-flight connection processes.
14087
14188
  if (!apiConnected) {
14088
14189
  connectCalled.current = true;
14089
- await connect();
14190
+ yield connect();
14090
14191
  }
14091
-
14092
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'.
14093
14193
  if (isApp || isOpen || isVisible && isInline) {
14094
14194
  start();
14095
14195
  }
14096
- }, [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
14196
+ }), [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
14097
14197
  (0,hooks_.useEffect)(() => {
14098
14198
  // We dont't connect or start when the apiConfig is not ready yet.
14099
14199
  // We also keep track of whether start has been called to avoid multiple in-flight connection processes.
14100
14200
  // We check if the window view is not open and no conversation is started yet.
14101
14201
  // Lastly we check if the inline view is not scrolled in to view.
14102
- if (!apiConfigReady || connectCalled.current || isWindow && !isOpen && !hasConversation() || isInline && (!isVisible || !showInlineView)) {
14202
+ if (!apiConfigReady || connectCalled.current || isWindow && !isOpen || isInline && (!isVisible || !showInlineView)) {
14103
14203
  return;
14104
14204
  }
14105
14205
  if (hasConversation() && isOpen) {
@@ -17995,7 +18095,7 @@ const SeamlyEventSubscriber = () => {
17995
18095
  channel === null || channel === void 0 ? void 0 : channel.leave();
17996
18096
  };
17997
18097
  }
17998
- return () => {};
18098
+ return () => undefined;
17999
18099
  }, [api, api.connectionInfo, api.conversation]);
18000
18100
  (0,hooks_.useEffect)(() => {
18001
18101
  api.conversation.onConnection(({
@@ -18178,6 +18278,9 @@ const SeamlyEventSubscriber = () => {
18178
18278
  const {
18179
18279
  channel
18180
18280
  } = api.conversation;
18281
+ if (messageChannelRef.current) {
18282
+ channel === null || channel === void 0 ? void 0 : channel.off('message', messageChannelRef.current);
18283
+ }
18181
18284
  messageChannelRef.current = channel.on('message', payload => {
18182
18285
  if (!EMITTABLE_MESSAGE_TYPES.includes(payload.type)) {
18183
18286
  return payload;
@@ -18194,19 +18297,18 @@ const SeamlyEventSubscriber = () => {
18194
18297
  });
18195
18298
  return true;
18196
18299
  });
18197
- return () => {
18198
- var _a;
18199
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('message', messageChannelRef.current);
18200
- };
18201
18300
  }
18202
- return () => undefined;
18203
18301
  }, [api, api.connectionInfo, api.conversation.channel, eventBus]);
18204
18302
  (0,hooks_.useEffect)(() => {
18205
18303
  if (api.connectionInfo) {
18206
18304
  api.conversation.onConnection(({
18207
18305
  connected
18208
18306
  }) => {
18307
+ var _a;
18209
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
+ }
18210
18312
  syncChannelRef.current = api.conversation.channel.on('sync', payload => {
18211
18313
  var _a;
18212
18314
  const lastEvent = events[events.length - 1];
@@ -18230,12 +18332,7 @@ const SeamlyEventSubscriber = () => {
18230
18332
  });
18231
18333
  return true;
18232
18334
  });
18233
- return () => {
18234
- var _a;
18235
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
18236
- };
18237
18335
  }
18238
- return () => undefined;
18239
18336
  }, [api, api.connectionInfo, api.conversation.channel, events, dispatch]);
18240
18337
  return null;
18241
18338
  };
@@ -18371,52 +18468,6 @@ const SeamlyInitializer = () => {
18371
18468
  return null;
18372
18469
  };
18373
18470
  /* harmony default export */ const seamly_initializer = (SeamlyInitializer);
18374
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
18375
-
18376
- const selectError = es_createSelector(({
18377
- interrupt
18378
- }) => interrupt, ({
18379
- error
18380
- }) => error);
18381
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
18382
-
18383
-
18384
-
18385
-
18386
- function useInterrupt() {
18387
- const {
18388
- t
18389
- } = useI18n();
18390
- const error = useSelector_useSelector(selectError);
18391
- const hasInterrupt = Boolean(error);
18392
- const meta = (0,hooks_.useMemo)(() => {
18393
- if (!error) return {};
18394
- const {
18395
- langKey,
18396
- action
18397
- } = error;
18398
- const title = t(`${langKey}.title`);
18399
- const message = t(`${langKey}.message`);
18400
- const srText = t(`${langKey}.srText`);
18401
- const buttonText = t(`${langKey}.buttonText`);
18402
- return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
18403
- title,
18404
- message,
18405
- srText
18406
- } : {}), action ? {
18407
- action
18408
- } : {}), action && langKey ? {
18409
- buttonText
18410
- } : {}), {
18411
- originalError: error
18412
- });
18413
- }, [t, error]);
18414
- return {
18415
- hasInterrupt,
18416
- meta,
18417
- error
18418
- };
18419
- }
18420
18471
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-instance-functions-loader.js
18421
18472
 
18422
18473
 
@@ -18466,9 +18517,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18466
18517
  isInline,
18467
18518
  isResolving
18468
18519
  } = useSeamlyLayoutMode();
18469
- const {
18470
- hasInterrupt
18471
- } = useInterrupt();
18520
+ const hasError = useSelector_useSelector(selectHasError);
18472
18521
  const currentConversationUrl = useSeamlyConversationUrl();
18473
18522
  const prevConversationUrl = (0,hooks_.useRef)(null);
18474
18523
  const onActivityHandler = use_seamly_activity_event_handler();
@@ -18548,7 +18597,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18548
18597
  }
18549
18598
  }, [api.send]);
18550
18599
  (0,hooks_.useEffect)(() => {
18551
- if (!isResolving && !hasInterrupt) {
18600
+ if (!isResolving && !hasError) {
18552
18601
  // Check for app reset
18553
18602
  if (prevConversationUrl.current && prevConversationUrl.current !== currentConversationUrl) {
18554
18603
  eventBus.emit('unreadMessageCount', unreadCount);
@@ -18567,7 +18616,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18567
18616
  previousUnreadCount.current = unreadCount;
18568
18617
  prevConversationUrl.current = currentConversationUrl;
18569
18618
  }
18570
- }, [unreadCount, visible, eventBus, isInline, isResolving, hasInterrupt, currentConversationUrl]);
18619
+ }, [unreadCount, visible, eventBus, isInline, isResolving, hasError, currentConversationUrl]);
18571
18620
  return null;
18572
18621
  };
18573
18622
  /* harmony default export */ const seamly_instance_functions_loader = (SeamlyInstanceFunctionsLoader);
@@ -19044,6 +19093,7 @@ const InOutTransition = ({
19044
19093
 
19045
19094
 
19046
19095
 
19096
+
19047
19097
 
19048
19098
 
19049
19099
  const Suggestions = ({
@@ -19075,9 +19125,7 @@ const Suggestions = ({
19075
19125
  sendPolite
19076
19126
  } = useLiveRegion();
19077
19127
  // interrupt & countdown hooks
19078
- const {
19079
- hasInterrupt
19080
- } = useInterrupt();
19128
+ const hasError = useSelector_useSelector(selectHasError);
19081
19129
  const {
19082
19130
  hasCountdown,
19083
19131
  endCountdown
@@ -19094,7 +19142,7 @@ const Suggestions = ({
19094
19142
  } = useTranslatedEventData({
19095
19143
  payload
19096
19144
  });
19097
- const suggestions = (0,hooks_.useMemo)(() => payload && !hasInterrupt ? eventBody : [], [payload, hasInterrupt, eventBody]);
19145
+ const suggestions = (0,hooks_.useMemo)(() => payload && !hasError ? eventBody : [], [payload, hasError, eventBody]);
19098
19146
  const prevSuggestions = (0,hooks_.useRef)(null);
19099
19147
  const prevHasSuggestions = (0,hooks_.useRef)(false);
19100
19148
  const previousRenderedSuggestions = (0,hooks_.useRef)([]);
@@ -19546,10 +19594,9 @@ function FormProvider(_a) {
19546
19594
  });
19547
19595
  }, [setExternalErrors]);
19548
19596
  const handleSubmit = (0,hooks_.useCallback)((e) => {
19549
- var _a;
19550
19597
  e.preventDefault();
19551
19598
  // If the submitter is set to being aria-disabled, block the submit action
19552
- const ariaDisabled = ((_a = e.submitter) === null || _a === void 0 ? void 0 : _a.ariaDisabled) === 'true';
19599
+ const ariaDisabled = e.submitter.getAttribute('aria-disabled') === 'true';
19553
19600
  setIsSubmitted(!ariaDisabled);
19554
19601
  if (!ariaDisabled && validationIsValid) {
19555
19602
  dispatch(setHasResponded(true));
@@ -20224,6 +20271,7 @@ function TranslationsOptionsButton({ children, position = {
20224
20271
 
20225
20272
 
20226
20273
 
20274
+
20227
20275
  function AppOptions() {
20228
20276
  const {
20229
20277
  menuOptions,
@@ -20232,15 +20280,13 @@ function AppOptions() {
20232
20280
  const {
20233
20281
  isAvailable: isTranslationsAvailable
20234
20282
  } = useTranslations();
20235
- const {
20236
- hasInterrupt
20237
- } = useInterrupt();
20283
+ const hasError = useSelector_useSelector(selectHasError);
20238
20284
  const {
20239
20285
  t,
20240
20286
  locale
20241
20287
  } = useI18n();
20242
20288
  const localeNativeName = useLocaleNativeName(locale);
20243
- if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasInterrupt) {
20289
+ if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasError) {
20244
20290
  return null;
20245
20291
  }
20246
20292
  const openButtonText = t('translations.settings.openButtonText', {
@@ -21502,10 +21548,11 @@ const ChatStatus = ({ children, handleClose, title, closeButtonText, srCloseButt
21502
21548
 
21503
21549
 
21504
21550
 
21551
+
21505
21552
  function TranslationChatStatus() {
21506
21553
  const { t } = useI18n();
21507
21554
  const { id } = useTranslationsContainer();
21508
- const { hasInterrupt } = useInterrupt();
21555
+ const hasError = useSelector_useSelector(selectHasError);
21509
21556
  const { disableTranslations, currentLocale } = useTranslations();
21510
21557
  const localeNativeName = useLocaleNativeName(currentLocale);
21511
21558
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
@@ -21514,7 +21561,7 @@ function TranslationChatStatus() {
21514
21561
  disableTranslations();
21515
21562
  focusSkiplinkTarget();
21516
21563
  }, [disableTranslations, focusSkiplinkTarget]);
21517
- if (hasInterrupt) {
21564
+ if (hasError) {
21518
21565
  return null;
21519
21566
  }
21520
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') }));
@@ -21547,24 +21594,17 @@ function TranslationProposal() {
21547
21594
 
21548
21595
 
21549
21596
 
21597
+
21550
21598
  function TranslationStatus() {
21551
- const { hasInterrupt } = useInterrupt();
21599
+ const hasError = useSelector_useSelector(selectHasError);
21552
21600
  const { isActive } = useTranslations();
21553
- if (hasInterrupt) {
21601
+ if (hasError) {
21554
21602
  return null;
21555
21603
  }
21556
21604
  return !isActive ? (0,jsx_runtime_namespaceObject.jsx)(TranslationProposal, {}) : (0,jsx_runtime_namespaceObject.jsx)(TranslationChatStatus, {});
21557
21605
  }
21558
21606
 
21559
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
21560
- 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; }
21561
- 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; }
21562
- 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; }
21563
- function chat_frame_toPropertyKey(arg) { var key = chat_frame_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21564
- 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); }
21565
-
21566
-
21567
-
21607
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
21568
21608
 
21569
21609
 
21570
21610
 
@@ -21573,61 +21613,24 @@ function chat_frame_toPrimitive(input, hint) { if (typeof input !== "object" ||
21573
21613
 
21574
21614
 
21575
21615
 
21576
- function ChatFrame({
21577
- children,
21578
- interruptComponent: InterruptComponent
21579
- }) {
21616
+ const Interrupt = () => {
21580
21617
  const {
21581
- hasInterrupt,
21582
- meta
21583
- } = useInterrupt();
21584
- const {
21585
- isOpen
21586
- } = useVisibility();
21587
- if (hasInterrupt) {
21588
- if (isOpen) {
21589
- 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
21590
21625
  }
21591
- return null;
21592
- }
21593
- return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21594
- children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
21595
- children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
21596
- className: css_className('chat__container__header'),
21597
- children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
21598
- }), children]
21599
- }), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
21600
- });
21601
- }
21602
- /* harmony default export */ const chat_frame = (ChatFrame);
21603
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
21604
-
21605
-
21606
-
21607
-
21608
-
21609
-
21610
-
21611
- const Interrupt = ({
21612
- originalError,
21613
- title,
21614
- message,
21615
- buttonText,
21616
- action,
21617
- srText
21618
- }) => {
21626
+ } = useInterrupt();
21619
21627
  const seamlyCommands = use_seamly_commands();
21620
21628
  const headingId = useGeneratedId();
21621
21629
  const {
21622
21630
  sendPolite
21623
21631
  } = useLiveRegion();
21624
21632
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
21625
- const isExpiredError = originalError.name === 'SeamlySessionExpiredError';
21626
- (0,hooks_.useEffect)(() => {
21627
- if (isExpiredError && seamlyCommands[action]) {
21628
- seamlyCommands[action]();
21629
- }
21630
- }, [action, seamlyCommands, isExpiredError]);
21633
+ const isExpiredError = originalError?.name === 'SeamlySessionExpiredError';
21631
21634
  (0,hooks_.useEffect)(() => {
21632
21635
  if (!isExpiredError && srText) {
21633
21636
  // Wait for live regions to stabilise in case this occurs
@@ -21668,16 +21671,48 @@ const Interrupt = ({
21668
21671
  }) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {});
21669
21672
  };
21670
21673
  /* harmony default export */ const interrupt = (Interrupt);
21671
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
21674
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
21675
+
21676
+
21677
+
21678
+
21679
+
21680
+
21681
+
21672
21682
 
21673
21683
 
21674
21684
 
21675
21685
 
21676
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
+
21677
21713
  const AppView = () => {
21678
21714
  return (0,jsx_runtime_namespaceObject.jsx)(chat, {
21679
21715
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21680
- interruptComponent: interrupt,
21681
21716
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21682
21717
  })
21683
21718
  });
@@ -21690,6 +21725,7 @@ const AppView = () => {
21690
21725
 
21691
21726
 
21692
21727
 
21728
+
21693
21729
  function PreChatMessageEvent({
21694
21730
  event
21695
21731
  }) {
@@ -21703,13 +21739,11 @@ function PreChatMessages() {
21703
21739
  preChatEvents,
21704
21740
  layoutMode
21705
21741
  } = useConfig();
21706
- const {
21707
- hasInterrupt
21708
- } = useInterrupt();
21742
+ const hasError = useSelector_useSelector(selectHasError);
21709
21743
  const {
21710
21744
  isOpen
21711
21745
  } = useVisibility();
21712
- const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
21746
+ const isVisible = !(hasError || !preChatEvents?.length || isOpen);
21713
21747
  return isVisible && (0,jsx_runtime_namespaceObject.jsx)("ul", {
21714
21748
  className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
21715
21749
  "aria-hidden": !isVisible,
@@ -21722,13 +21756,6 @@ function PreChatMessages() {
21722
21756
  });
21723
21757
  }
21724
21758
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/inline-view.js
21725
- 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; }
21726
- 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; }
21727
- 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; }
21728
- function inline_view_toPropertyKey(arg) { var key = inline_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21729
- 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); }
21730
-
21731
-
21732
21759
 
21733
21760
 
21734
21761
 
@@ -21748,13 +21775,6 @@ const InlineView = () => {
21748
21775
  const {
21749
21776
  isOpen
21750
21777
  } = useVisibility();
21751
- const {
21752
- hasInterrupt,
21753
- meta
21754
- } = useInterrupt();
21755
- if (hasInterrupt && !isOpen) {
21756
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, inline_view_objectSpread({}, meta));
21757
- }
21758
21778
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21759
21779
  children: [(0,jsx_runtime_namespaceObject.jsx)(in_out_transition, {
21760
21780
  isActive: !isOpen,
@@ -21770,7 +21790,6 @@ const InlineView = () => {
21770
21790
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
21771
21791
  ref: containerRef,
21772
21792
  children: showInlineView && (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21773
- interruptComponent: interrupt,
21774
21793
  children: isOpen && (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21775
21794
  })
21776
21795
  })
@@ -21792,13 +21811,12 @@ const InlineView = () => {
21792
21811
 
21793
21812
 
21794
21813
 
21814
+
21795
21815
  const ButtonIcon = () => {
21796
21816
  const startChatIcon = useStartChatIcon();
21797
21817
  const currentAgent = useSeamlyCurrentAgent();
21798
- const {
21799
- hasInterrupt
21800
- } = useInterrupt();
21801
- const isActiveConversation = currentAgent && !hasInterrupt;
21818
+ const hasError = useSelector_useSelector(selectHasError);
21819
+ const isActiveConversation = currentAgent && !hasError;
21802
21820
  const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
21803
21821
  return src ? (0,jsx_runtime_namespaceObject.jsx)("img", {
21804
21822
  className: css_className(isActiveConversation ? 'avatar' : 'icon'),
@@ -21844,13 +21862,6 @@ const WindowOpenButton = ({
21844
21862
  };
21845
21863
  /* harmony default export */ const window_open_button = (WindowOpenButton);
21846
21864
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/window-view/index.js
21847
- 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; }
21848
- 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; }
21849
- 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; }
21850
- function window_view_toPropertyKey(arg) { var key = window_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21851
- 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); }
21852
-
21853
-
21854
21865
 
21855
21866
 
21856
21867
 
@@ -21872,10 +21883,6 @@ const WindowView = () => {
21872
21883
  openChat
21873
21884
  } = useVisibility();
21874
21885
  const userHasResponded = useUserHasResponded();
21875
- const {
21876
- hasInterrupt,
21877
- meta
21878
- } = useInterrupt();
21879
21886
  const {
21880
21887
  t
21881
21888
  } = useI18n();
@@ -21887,9 +21894,6 @@ const WindowView = () => {
21887
21894
  }
21888
21895
  }
21889
21896
  }), [continueChatText]);
21890
- if (hasInterrupt && !isOpen) {
21891
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, window_view_objectSpread({}, meta));
21892
- }
21893
21897
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21894
21898
  children: [(0,jsx_runtime_namespaceObject.jsx)(window_open_button, {
21895
21899
  onClick: openChat
@@ -21914,7 +21918,6 @@ const WindowView = () => {
21914
21918
  transitionStartState: transitionStartStates.notRendered,
21915
21919
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
21916
21920
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21917
- interruptComponent: interrupt,
21918
21921
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21919
21922
  })
21920
21923
  })