@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
@@ -6660,7 +6660,7 @@ const interruptSlice = createSlice({
6660
6660
  clearInterrupt: () => slice_initialState
6661
6661
  },
6662
6662
  extraReducers: builder => {
6663
- builder.addCase(resetApp.fulfilled, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, actions_initializeConfig.rejected, actions_setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
6663
+ builder.addCase(actions_initializeConfig.pending, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, actions_initializeConfig.rejected, actions_setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
6664
6664
  payload
6665
6665
  }) => {
6666
6666
  state.error = payload;
@@ -6985,6 +6985,7 @@ const {
6985
6985
 
6986
6986
 
6987
6987
 
6988
+
6988
6989
  const i18n_slice_initialState = {
6989
6990
  translations: {
6990
6991
  'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
@@ -7021,7 +7022,7 @@ const i18nSlice = createSlice({
7021
7022
  },
7022
7023
  extraReducers: builder => {
7023
7024
  // Add reducers for additional action types here, and handle loading state as needed
7024
- builder.addCase(actions_initializeConfig.fulfilled, (state, {
7025
+ builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(actions_initializeConfig.fulfilled, (state, {
7025
7026
  payload
7026
7027
  }) => {
7027
7028
  state.initialLocale = payload.locale;
@@ -7051,12 +7052,7 @@ const {
7051
7052
  ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/middleware.ts
7052
7053
 
7053
7054
 
7054
-
7055
-
7056
-
7057
-
7058
-
7059
- const handledErrorTypes = [seamly_general_error_SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
7055
+ const handledErrorTypes = (/* unused pure expression or super */ null && (['SeamlyGeneralError', 'SeamlyConfigurationError', 'SeamlySessionExpiredError', 'SeamlyOfflineError', 'SeamlyUnauthorizedError', 'SeamlyUnavailableError']));
7060
7056
  function middleware_createInterruptMiddleware({
7061
7057
  api
7062
7058
  }) {
@@ -7066,7 +7062,7 @@ function middleware_createInterruptMiddleware({
7066
7062
  type
7067
7063
  } = action;
7068
7064
  if (type === setInterrupt.type) {
7069
- if (!handledErrorTypes.some(ErrorType => payload.name === ErrorType.name)) {
7065
+ if (!handledErrorTypes.includes(payload.name)) {
7070
7066
  throw new SeamlyGeneralError(payload);
7071
7067
  } else if (payload.action === 'reset') {
7072
7068
  // [SMLY-942] We clear the store before a reset to force a new conversation if the page is refreshed before the conversation is reset
@@ -7107,6 +7103,7 @@ function middleware_createOptionsMiddleware({
7107
7103
 
7108
7104
 
7109
7105
 
7106
+
7110
7107
  const translationsInitialState = {
7111
7108
  isActive: false,
7112
7109
  currentLocale: undefined,
@@ -7197,7 +7194,7 @@ const translationSlice = createSlice({
7197
7194
  }
7198
7195
  },
7199
7196
  extraReducers: builder => {
7200
- builder.addCase(actions_initializeConfig.fulfilled, (state, {
7197
+ builder.addCase(resetApp.pending, () => translationsInitialState).addCase(actions_initializeConfig.fulfilled, (state, {
7201
7198
  payload
7202
7199
  }) => {
7203
7200
  var _a;
@@ -7642,7 +7639,109 @@ const use_seamly_commands_useSeamlyCommands = () => {
7642
7639
  };
7643
7640
  };
7644
7641
  /* harmony default export */ const use_seamly_commands = (use_seamly_commands_useSeamlyCommands);
7645
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
7642
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
7643
+
7644
+ const selectError = es_createSelector(({
7645
+ interrupt
7646
+ }) => interrupt, ({
7647
+ error
7648
+ }) => error);
7649
+ const selectHasError = es_createSelector(selectError, error => Boolean(error));
7650
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
7651
+
7652
+
7653
+
7654
+
7655
+ function hooks_useInterrupt() {
7656
+ const {
7657
+ t
7658
+ } = hooks_useI18n();
7659
+ const error = useSelector_useSelector(selectError);
7660
+ const hasError = useSelector_useSelector(selectHasError);
7661
+ const meta = (0,hooks_.useMemo)(() => {
7662
+ if (!hasError) {
7663
+ return {
7664
+ title: undefined,
7665
+ message: undefined,
7666
+ srText: undefined,
7667
+ buttonText: undefined,
7668
+ originalError: undefined
7669
+ };
7670
+ }
7671
+ const {
7672
+ langKey,
7673
+ action
7674
+ } = error;
7675
+ const title = t(`${langKey}.title`);
7676
+ const message = t(`${langKey}.message`);
7677
+ const srText = t(`${langKey}.srText`);
7678
+ const buttonText = t(`${langKey}.buttonText`);
7679
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
7680
+ title,
7681
+ message,
7682
+ srText
7683
+ } : {}), action ? {
7684
+ action
7685
+ } : {}), action && langKey ? {
7686
+ buttonText
7687
+ } : {}), {
7688
+ originalError: error
7689
+ });
7690
+ }, [hasError, error, t]);
7691
+ return {
7692
+ hasError,
7693
+ meta,
7694
+ error
7695
+ };
7696
+ }
7697
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-session-expired-command.ts
7698
+
7699
+
7700
+
7701
+ function use_session_expired_command_useSessionExpiredCommand() {
7702
+ const {
7703
+ meta: {
7704
+ originalError,
7705
+ action
7706
+ }
7707
+ } = useInterrupt();
7708
+ const seamlyCommands = useSeamlyCommands();
7709
+ const isExpiredError = (originalError === null || originalError === void 0 ? void 0 : originalError.name) === 'SeamlySessionExpiredError';
7710
+ useEffect(() => {
7711
+ if (isExpiredError && seamlyCommands[action]) {
7712
+ seamlyCommands[action]();
7713
+ }
7714
+ }, [action, seamlyCommands, isExpiredError]);
7715
+ }
7716
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.ts
7717
+ var use_seamly_chat_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
7718
+ function adopt(value) {
7719
+ return value instanceof P ? value : new P(function (resolve) {
7720
+ resolve(value);
7721
+ });
7722
+ }
7723
+ return new (P || (P = Promise))(function (resolve, reject) {
7724
+ function fulfilled(value) {
7725
+ try {
7726
+ step(generator.next(value));
7727
+ } catch (e) {
7728
+ reject(e);
7729
+ }
7730
+ }
7731
+ function rejected(value) {
7732
+ try {
7733
+ step(generator["throw"](value));
7734
+ } catch (e) {
7735
+ reject(e);
7736
+ }
7737
+ }
7738
+ function step(result) {
7739
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7740
+ }
7741
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7742
+ });
7743
+ };
7744
+
7646
7745
 
7647
7746
 
7648
7747
 
@@ -7681,6 +7780,8 @@ const useSeamlyChat = () => {
7681
7780
  const {
7682
7781
  sendAssertive
7683
7782
  } = useLiveRegion();
7783
+ // Automatically reset conversation if the session has expired
7784
+ useSessionExpiredCommand();
7684
7785
  useEffect(() => {
7685
7786
  if (isVisible) {
7686
7787
  // Wait for the live containers to stabilise in the DOM before injecting
@@ -7727,24 +7828,23 @@ const useSeamlyChat = () => {
7727
7828
  connectCalled.current = false;
7728
7829
  }
7729
7830
  }, [apiConfigReady, apiConnected]);
7730
- const connectAndStart = useCallback(async () => {
7831
+ const connectAndStart = useCallback(() => use_seamly_chat_awaiter(void 0, void 0, void 0, function* () {
7731
7832
  // We don't connect if we are already connected to the api to avoid multiple in-flight connection processes.
7732
7833
  if (!apiConnected) {
7733
7834
  connectCalled.current = true;
7734
- await connect();
7835
+ yield connect();
7735
7836
  }
7736
-
7737
7837
  // 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'.
7738
7838
  if (isApp || isOpen || isVisible && isInline) {
7739
7839
  start();
7740
7840
  }
7741
- }, [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
7841
+ }), [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
7742
7842
  useEffect(() => {
7743
7843
  // We dont't connect or start when the apiConfig is not ready yet.
7744
7844
  // We also keep track of whether start has been called to avoid multiple in-flight connection processes.
7745
7845
  // We check if the window view is not open and no conversation is started yet.
7746
7846
  // Lastly we check if the inline view is not scrolled in to view.
7747
- if (!apiConfigReady || connectCalled.current || isWindow && !isOpen && !hasConversation() || isInline && (!isVisible || !showInlineView)) {
7847
+ if (!apiConfigReady || connectCalled.current || isWindow && !isOpen || isInline && (!isVisible || !showInlineView)) {
7748
7848
  return;
7749
7849
  }
7750
7850
  if (hasConversation() && isOpen) {
@@ -11416,52 +11516,6 @@ const Conversation = () => {
11416
11516
  };
11417
11517
  /* harmony default export */ const conversation = (Conversation);
11418
11518
 
11419
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
11420
-
11421
- const selectError = es_createSelector(({
11422
- interrupt
11423
- }) => interrupt, ({
11424
- error
11425
- }) => error);
11426
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
11427
-
11428
-
11429
-
11430
-
11431
- function useInterrupt() {
11432
- const {
11433
- t
11434
- } = hooks_useI18n();
11435
- const error = useSelector_useSelector(selectError);
11436
- const hasInterrupt = Boolean(error);
11437
- const meta = (0,hooks_.useMemo)(() => {
11438
- if (!error) return {};
11439
- const {
11440
- langKey,
11441
- action
11442
- } = error;
11443
- const title = t(`${langKey}.title`);
11444
- const message = t(`${langKey}.message`);
11445
- const srText = t(`${langKey}.srText`);
11446
- const buttonText = t(`${langKey}.buttonText`);
11447
- return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
11448
- title,
11449
- message,
11450
- srText
11451
- } : {}), action ? {
11452
- action
11453
- } : {}), action && langKey ? {
11454
- buttonText
11455
- } : {}), {
11456
- originalError: error
11457
- });
11458
- }, [t, error]);
11459
- return {
11460
- hasInterrupt,
11461
- meta,
11462
- error
11463
- };
11464
- }
11465
11519
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/entry/deprecated-toggle-button.js
11466
11520
 
11467
11521
 
@@ -11470,6 +11524,7 @@ function useInterrupt() {
11470
11524
 
11471
11525
 
11472
11526
 
11527
+
11473
11528
  // Deprecated Toggle Button, should be removed once it is removed from clients
11474
11529
 
11475
11530
 
@@ -11490,13 +11545,11 @@ const DeprecatedToggleButton = ({
11490
11545
  const focusIfContained = useFocusIfSeamlyContainedFocus();
11491
11546
  const currentAgent = useSeamlyCurrentAgent();
11492
11547
  const agentSubtitle = useSeamlyHeaderData().subTitle;
11493
- const {
11494
- hasInterrupt
11495
- } = useInterrupt();
11548
+ const hasError = useSelector_useSelector(selectHasError);
11496
11549
  const {
11497
11550
  headerCollapseButtonId
11498
11551
  } = useSeamlyStateContext();
11499
- const showAgentInfo = currentAgent && !hasInterrupt;
11552
+ const showAgentInfo = currentAgent && !hasError;
11500
11553
  (0,hooks_.useLayoutEffect)(() => {
11501
11554
  // Because we can close the app from the external API we
11502
11555
  // need to determine if current keyboard focus resides inside
@@ -11997,10 +12050,9 @@ function FormProvider(_a) {
11997
12050
  });
11998
12051
  }, [setExternalErrors]);
11999
12052
  const handleSubmit = (0,hooks_.useCallback)((e) => {
12000
- var _a;
12001
12053
  e.preventDefault();
12002
12054
  // If the submitter is set to being aria-disabled, block the submit action
12003
- const ariaDisabled = ((_a = e.submitter) === null || _a === void 0 ? void 0 : _a.ariaDisabled) === 'true';
12055
+ const ariaDisabled = e.submitter.getAttribute('aria-disabled') === 'true';
12004
12056
  setIsSubmitted(!ariaDisabled);
12005
12057
  if (!ariaDisabled && validationIsValid) {
12006
12058
  dispatch(setHasResponded(true));
@@ -13109,6 +13161,7 @@ const EntryContainer = () => {
13109
13161
 
13110
13162
 
13111
13163
 
13164
+
13112
13165
  const AgentInfo = () => {
13113
13166
  const {
13114
13167
  t
@@ -13122,12 +13175,10 @@ const AgentInfo = () => {
13122
13175
  isOpen
13123
13176
  } = hooks_useVisibility();
13124
13177
  const currentAgent = useSeamlyCurrentAgent();
13125
- const {
13126
- hasInterrupt
13127
- } = useInterrupt();
13178
+ const hasError = useSelector_useSelector(selectHasError);
13128
13179
  const startChatIcon = useStartChatIcon();
13129
13180
  const src = currentAgent?.avatar ?? startChatIcon;
13130
- const displaySubtitle = hasInterrupt ? '' : subTitle;
13181
+ const displaySubtitle = hasError ? '' : subTitle;
13131
13182
  const classNames = ['message-count'];
13132
13183
  if (isOpen) {
13133
13184
  classNames.push('message-count__hide');
@@ -13185,6 +13236,7 @@ const AgentInfo = () => {
13185
13236
 
13186
13237
 
13187
13238
 
13239
+
13188
13240
 
13189
13241
 
13190
13242
  const Suggestions = ({
@@ -13216,9 +13268,7 @@ const Suggestions = ({
13216
13268
  sendPolite
13217
13269
  } = live_region_hooks_useLiveRegion();
13218
13270
  // interrupt & countdown hooks
13219
- const {
13220
- hasInterrupt
13221
- } = useInterrupt();
13271
+ const hasError = useSelector_useSelector(selectHasError);
13222
13272
  const {
13223
13273
  hasCountdown,
13224
13274
  endCountdown
@@ -13235,7 +13285,7 @@ const Suggestions = ({
13235
13285
  } = useTranslatedEventData({
13236
13286
  payload
13237
13287
  });
13238
- const suggestions = (0,hooks_.useMemo)(() => payload && !hasInterrupt ? eventBody : [], [payload, hasInterrupt, eventBody]);
13288
+ const suggestions = (0,hooks_.useMemo)(() => payload && !hasError ? eventBody : [], [payload, hasError, eventBody]);
13239
13289
  const prevSuggestions = (0,hooks_.useRef)(null);
13240
13290
  const prevHasSuggestions = (0,hooks_.useRef)(false);
13241
13291
  const previousRenderedSuggestions = (0,hooks_.useRef)([]);
@@ -13923,6 +13973,7 @@ function TranslationsOptionsButton({ children, position = {
13923
13973
 
13924
13974
 
13925
13975
 
13976
+
13926
13977
  function AppOptions() {
13927
13978
  const {
13928
13979
  menuOptions,
@@ -13931,15 +13982,13 @@ function AppOptions() {
13931
13982
  const {
13932
13983
  isAvailable: isTranslationsAvailable
13933
13984
  } = useTranslations();
13934
- const {
13935
- hasInterrupt
13936
- } = useInterrupt();
13985
+ const hasError = useSelector_useSelector(selectHasError);
13937
13986
  const {
13938
13987
  t,
13939
13988
  locale
13940
13989
  } = hooks_useI18n();
13941
13990
  const localeNativeName = useLocaleNativeName(locale);
13942
- if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasInterrupt) {
13991
+ if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasError) {
13943
13992
  return null;
13944
13993
  }
13945
13994
  const openButtonText = t('translations.settings.openButtonText', {
@@ -14172,10 +14221,11 @@ const ChatStatus = ({ children, handleClose, title, closeButtonText, srCloseButt
14172
14221
 
14173
14222
 
14174
14223
 
14224
+
14175
14225
  function TranslationChatStatus() {
14176
14226
  const { t } = hooks_useI18n();
14177
14227
  const { id } = useTranslationsContainer();
14178
- const { hasInterrupt } = useInterrupt();
14228
+ const hasError = useSelector_useSelector(selectHasError);
14179
14229
  const { disableTranslations, currentLocale } = useTranslations();
14180
14230
  const localeNativeName = useLocaleNativeName(currentLocale);
14181
14231
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
@@ -14184,7 +14234,7 @@ function TranslationChatStatus() {
14184
14234
  disableTranslations();
14185
14235
  focusSkiplinkTarget();
14186
14236
  }, [disableTranslations, focusSkiplinkTarget]);
14187
- if (hasInterrupt) {
14237
+ if (hasError) {
14188
14238
  return null;
14189
14239
  }
14190
14240
  return ((0,jsx_runtime_namespaceObject.jsx)(chat_status, { handleClose: handleClickStop, title: label, id: id, closeButtonText: t('translations.status.stopText'), srCloseButtonText: t('translations.status.srStopText') }));
@@ -14217,21 +14267,86 @@ function TranslationProposal() {
14217
14267
 
14218
14268
 
14219
14269
 
14270
+
14220
14271
  function TranslationStatus() {
14221
- const { hasInterrupt } = useInterrupt();
14272
+ const hasError = useSelector_useSelector(selectHasError);
14222
14273
  const { isActive } = useTranslations();
14223
- if (hasInterrupt) {
14274
+ if (hasError) {
14224
14275
  return null;
14225
14276
  }
14226
14277
  return !isActive ? (0,jsx_runtime_namespaceObject.jsx)(TranslationProposal, {}) : (0,jsx_runtime_namespaceObject.jsx)(TranslationChatStatus, {});
14227
14278
  }
14228
14279
 
14280
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
14281
+
14282
+
14283
+
14284
+
14285
+
14286
+
14287
+
14288
+
14289
+ const Interrupt = () => {
14290
+ const {
14291
+ meta: {
14292
+ originalError,
14293
+ title,
14294
+ message,
14295
+ buttonText,
14296
+ action,
14297
+ srText
14298
+ }
14299
+ } = hooks_useInterrupt();
14300
+ const seamlyCommands = use_seamly_commands();
14301
+ const headingId = useGeneratedId();
14302
+ const {
14303
+ sendPolite
14304
+ } = live_region_hooks_useLiveRegion();
14305
+ const focusSkiplinkTarget = useSkiplinkTargetFocusing();
14306
+ const isExpiredError = originalError?.name === 'SeamlySessionExpiredError';
14307
+ (0,hooks_.useEffect)(() => {
14308
+ if (!isExpiredError && srText) {
14309
+ // Wait for live regions to stabilise in case this occurs
14310
+ // at an initial render
14311
+ setTimeout(() => {
14312
+ sendPolite(srText);
14313
+ }, 200);
14314
+ }
14315
+ }, [sendPolite, srText, isExpiredError]);
14316
+ const onClickHandler = () => {
14317
+ if (seamlyCommands[action]) {
14318
+ seamlyCommands[action]();
14319
+ }
14320
+ focusSkiplinkTarget();
14321
+ };
14322
+ return !isExpiredError ? (0,jsx_runtime_namespaceObject.jsxs)("section", {
14323
+ className: css_className('interrupt'),
14324
+ "aria-labelledby": headingId,
14325
+ children: [(0,jsx_runtime_namespaceObject.jsx)(collapse_button, {}), (0,jsx_runtime_namespaceObject.jsxs)("div", {
14326
+ className: css_className('interrupt__body'),
14327
+ children: [(0,jsx_runtime_namespaceObject.jsx)("h2", {
14328
+ id: headingId,
14329
+ className: css_className('interrupt__title'),
14330
+ children: title
14331
+ }), (0,jsx_runtime_namespaceObject.jsx)("p", {
14332
+ className: css_className('interrupt__message'),
14333
+ children: message
14334
+ }), buttonText && action && (0,jsx_runtime_namespaceObject.jsx)("div", {
14335
+ className: css_className('interrupt__actions'),
14336
+ children: (0,jsx_runtime_namespaceObject.jsx)("button", {
14337
+ type: "button",
14338
+ className: css_className('button', 'button--primary'),
14339
+ onClick: onClickHandler,
14340
+ children: buttonText
14341
+ })
14342
+ })]
14343
+ })]
14344
+ }) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {});
14345
+ };
14346
+ /* harmony default export */ const interrupt = (Interrupt);
14229
14347
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
14230
- 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; }
14231
- 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; }
14232
- 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; }
14233
- function chat_frame_toPropertyKey(arg) { var key = chat_frame_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14234
- 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); }
14348
+
14349
+
14235
14350
 
14236
14351
 
14237
14352
 
@@ -14244,21 +14359,14 @@ function chat_frame_toPrimitive(input, hint) { if (typeof input !== "object" ||
14244
14359
 
14245
14360
 
14246
14361
  function ChatFrame({
14247
- children,
14248
- interruptComponent: InterruptComponent
14362
+ children
14249
14363
  }) {
14250
- const {
14251
- hasInterrupt,
14252
- meta
14253
- } = useInterrupt();
14364
+ const hasError = useSelector_useSelector(selectHasError);
14254
14365
  const {
14255
14366
  isOpen
14256
14367
  } = hooks_useVisibility();
14257
- if (hasInterrupt) {
14258
- if (isOpen) {
14259
- return (0,jsx_runtime_namespaceObject.jsx)(InterruptComponent, chat_frame_objectSpread({}, meta));
14260
- }
14261
- return null;
14368
+ if (hasError) {
14369
+ return (0,jsx_runtime_namespaceObject.jsx)(interrupt, {});
14262
14370
  }
14263
14371
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
14264
14372
  children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
@@ -14309,84 +14417,14 @@ const Header = ({
14309
14417
  });
14310
14418
  };
14311
14419
  /* harmony default export */ const header = (Header);
14312
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
14313
-
14314
-
14315
-
14316
-
14317
-
14318
-
14319
-
14320
- const Interrupt = ({
14321
- originalError,
14322
- title,
14323
- message,
14324
- buttonText,
14325
- action,
14326
- srText
14327
- }) => {
14328
- const seamlyCommands = use_seamly_commands();
14329
- const headingId = useGeneratedId();
14330
- const {
14331
- sendPolite
14332
- } = live_region_hooks_useLiveRegion();
14333
- const focusSkiplinkTarget = useSkiplinkTargetFocusing();
14334
- const isExpiredError = originalError.name === 'SeamlySessionExpiredError';
14335
- (0,hooks_.useEffect)(() => {
14336
- if (isExpiredError && seamlyCommands[action]) {
14337
- seamlyCommands[action]();
14338
- }
14339
- }, [action, seamlyCommands, isExpiredError]);
14340
- (0,hooks_.useEffect)(() => {
14341
- if (!isExpiredError && srText) {
14342
- // Wait for live regions to stabilise in case this occurs
14343
- // at an initial render
14344
- setTimeout(() => {
14345
- sendPolite(srText);
14346
- }, 200);
14347
- }
14348
- }, [sendPolite, srText, isExpiredError]);
14349
- const onClickHandler = () => {
14350
- if (seamlyCommands[action]) {
14351
- seamlyCommands[action]();
14352
- }
14353
- focusSkiplinkTarget();
14354
- };
14355
- return !isExpiredError ? (0,jsx_runtime_namespaceObject.jsxs)("section", {
14356
- className: css_className('interrupt'),
14357
- "aria-labelledby": headingId,
14358
- children: [(0,jsx_runtime_namespaceObject.jsx)(collapse_button, {}), (0,jsx_runtime_namespaceObject.jsxs)("div", {
14359
- className: css_className('interrupt__body'),
14360
- children: [(0,jsx_runtime_namespaceObject.jsx)("h2", {
14361
- id: headingId,
14362
- className: css_className('interrupt__title'),
14363
- children: title
14364
- }), (0,jsx_runtime_namespaceObject.jsx)("p", {
14365
- className: css_className('interrupt__message'),
14366
- children: message
14367
- }), buttonText && action && (0,jsx_runtime_namespaceObject.jsx)("div", {
14368
- className: css_className('interrupt__actions'),
14369
- children: (0,jsx_runtime_namespaceObject.jsx)("button", {
14370
- type: "button",
14371
- className: css_className('button', 'button--primary'),
14372
- onClick: onClickHandler,
14373
- children: buttonText
14374
- })
14375
- })]
14376
- })]
14377
- }) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {});
14378
- };
14379
- /* harmony default export */ const interrupt = (Interrupt);
14380
14420
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
14381
14421
 
14382
14422
 
14383
14423
 
14384
14424
 
14385
-
14386
14425
  const AppView = () => {
14387
14426
  return (0,jsx_runtime_namespaceObject.jsx)(chat, {
14388
14427
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
14389
- interruptComponent: interrupt,
14390
14428
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
14391
14429
  })
14392
14430
  });
@@ -14399,6 +14437,7 @@ const AppView = () => {
14399
14437
 
14400
14438
 
14401
14439
 
14440
+
14402
14441
  function PreChatMessageEvent({
14403
14442
  event
14404
14443
  }) {
@@ -14412,13 +14451,11 @@ function PreChatMessages() {
14412
14451
  preChatEvents,
14413
14452
  layoutMode
14414
14453
  } = useConfig();
14415
- const {
14416
- hasInterrupt
14417
- } = useInterrupt();
14454
+ const hasError = useSelector_useSelector(selectHasError);
14418
14455
  const {
14419
14456
  isOpen
14420
14457
  } = hooks_useVisibility();
14421
- const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
14458
+ const isVisible = !(hasError || !preChatEvents?.length || isOpen);
14422
14459
  return isVisible && (0,jsx_runtime_namespaceObject.jsx)("ul", {
14423
14460
  className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
14424
14461
  "aria-hidden": !isVisible,
@@ -14431,13 +14468,6 @@ function PreChatMessages() {
14431
14468
  });
14432
14469
  }
14433
14470
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/inline-view.js
14434
- 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; }
14435
- 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; }
14436
- 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; }
14437
- function inline_view_toPropertyKey(arg) { var key = inline_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14438
- 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); }
14439
-
14440
-
14441
14471
 
14442
14472
 
14443
14473
 
@@ -14457,13 +14487,6 @@ const InlineView = () => {
14457
14487
  const {
14458
14488
  isOpen
14459
14489
  } = hooks_useVisibility();
14460
- const {
14461
- hasInterrupt,
14462
- meta
14463
- } = useInterrupt();
14464
- if (hasInterrupt && !isOpen) {
14465
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, inline_view_objectSpread({}, meta));
14466
- }
14467
14490
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
14468
14491
  children: [(0,jsx_runtime_namespaceObject.jsx)(in_out_transition, {
14469
14492
  isActive: !isOpen,
@@ -14479,7 +14502,6 @@ const InlineView = () => {
14479
14502
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
14480
14503
  ref: containerRef,
14481
14504
  children: showInlineView && (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
14482
- interruptComponent: interrupt,
14483
14505
  children: isOpen && (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
14484
14506
  })
14485
14507
  })
@@ -14501,13 +14523,12 @@ const InlineView = () => {
14501
14523
 
14502
14524
 
14503
14525
 
14526
+
14504
14527
  const ButtonIcon = () => {
14505
14528
  const startChatIcon = useStartChatIcon();
14506
14529
  const currentAgent = useSeamlyCurrentAgent();
14507
- const {
14508
- hasInterrupt
14509
- } = useInterrupt();
14510
- const isActiveConversation = currentAgent && !hasInterrupt;
14530
+ const hasError = useSelector_useSelector(selectHasError);
14531
+ const isActiveConversation = currentAgent && !hasError;
14511
14532
  const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
14512
14533
  return src ? (0,jsx_runtime_namespaceObject.jsx)("img", {
14513
14534
  className: css_className(isActiveConversation ? 'avatar' : 'icon'),
@@ -14553,13 +14574,6 @@ const WindowOpenButton = ({
14553
14574
  };
14554
14575
  /* harmony default export */ const window_open_button = (WindowOpenButton);
14555
14576
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/window-view/index.js
14556
- 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; }
14557
- 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; }
14558
- 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; }
14559
- function window_view_toPropertyKey(arg) { var key = window_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14560
- 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); }
14561
-
14562
-
14563
14577
 
14564
14578
 
14565
14579
 
@@ -14581,10 +14595,6 @@ const WindowView = () => {
14581
14595
  openChat
14582
14596
  } = hooks_useVisibility();
14583
14597
  const userHasResponded = useUserHasResponded();
14584
- const {
14585
- hasInterrupt,
14586
- meta
14587
- } = useInterrupt();
14588
14598
  const {
14589
14599
  t
14590
14600
  } = hooks_useI18n();
@@ -14596,9 +14606,6 @@ const WindowView = () => {
14596
14606
  }
14597
14607
  }
14598
14608
  }), [continueChatText]);
14599
- if (hasInterrupt && !isOpen) {
14600
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, window_view_objectSpread({}, meta));
14601
- }
14602
14609
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
14603
14610
  children: [(0,jsx_runtime_namespaceObject.jsx)(window_open_button, {
14604
14611
  onClick: openChat
@@ -14623,7 +14630,6 @@ const WindowView = () => {
14623
14630
  transitionStartState: transitionStartStates.notRendered,
14624
14631
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
14625
14632
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
14626
- interruptComponent: interrupt,
14627
14633
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
14628
14634
  })
14629
14635
  })
@@ -14706,11 +14712,8 @@ const View = ({
14706
14712
  };
14707
14713
  /* harmony default export */ const view = (View);
14708
14714
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/deprecated-chat-frame.js
14709
- function deprecated_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; }
14710
- function deprecated_chat_frame_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? deprecated_chat_frame_ownKeys(Object(source), !0).forEach(function (key) { deprecated_chat_frame_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : deprecated_chat_frame_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14711
- function deprecated_chat_frame_defineProperty(obj, key, value) { key = deprecated_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; }
14712
- function deprecated_chat_frame_toPropertyKey(arg) { var key = deprecated_chat_frame_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14713
- function deprecated_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); }
14715
+
14716
+
14714
14717
 
14715
14718
 
14716
14719
 
@@ -14722,21 +14725,14 @@ function deprecated_chat_frame_toPrimitive(input, hint) { if (typeof input !== "
14722
14725
 
14723
14726
 
14724
14727
  function deprecated_chat_frame_ChatFrame({
14725
- children,
14726
- interruptComponent: InterruptComponent
14728
+ children
14727
14729
  }) {
14728
- const {
14729
- hasInterrupt,
14730
- meta
14731
- } = useInterrupt();
14732
14730
  const {
14733
14731
  isOpen
14734
14732
  } = hooks_useVisibility();
14735
- if (hasInterrupt) {
14736
- if (isOpen) {
14737
- return (0,jsx_runtime_namespaceObject.jsx)(InterruptComponent, deprecated_chat_frame_objectSpread({}, meta));
14738
- }
14739
- return null;
14733
+ const hasError = useSelector_useSelector(selectHasError);
14734
+ if (hasError) {
14735
+ return (0,jsx_runtime_namespaceObject.jsx)(interrupt, {});
14740
14736
  }
14741
14737
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
14742
14738
  children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
@@ -14776,6 +14772,7 @@ function faq_objectWithoutPropertiesLoose(source, excluded) { if (source == null
14776
14772
 
14777
14773
 
14778
14774
 
14775
+
14779
14776
  const Faq = () => {
14780
14777
  const {
14781
14778
  t
@@ -14789,9 +14786,7 @@ const Faq = () => {
14789
14786
  const {
14790
14787
  sendPolite
14791
14788
  } = live_region_hooks_useLiveRegion();
14792
- const {
14793
- hasInterrupt
14794
- } = useInterrupt();
14789
+ const hasError = useSelector_useSelector(selectHasError);
14795
14790
  const {
14796
14791
  hasCountdown,
14797
14792
  endCountdown
@@ -14807,7 +14802,7 @@ const Faq = () => {
14807
14802
  payload: lastFaqEventPayload
14808
14803
  });
14809
14804
  const faqs = (0,hooks_.useMemo)(() => {
14810
- const newFaqs = lastFaqEventPayload && !hasInterrupt ? eventBody : [];
14805
+ const newFaqs = lastFaqEventPayload && !hasError ? eventBody : [];
14811
14806
  const itemBaseClass = `faqs__item`;
14812
14807
  return newFaqs.map(_ref => {
14813
14808
  let {
@@ -14819,7 +14814,7 @@ const Faq = () => {
14819
14814
  classNames: [itemBaseClass, ...categories.map(cat => `faqs__item--${String(cat).toLowerCase().replace(/[^a-z0-9_\\-]/, '')}`)]
14820
14815
  });
14821
14816
  });
14822
- }, [lastFaqEventPayload, hasInterrupt, eventBody]);
14817
+ }, [lastFaqEventPayload, hasError, eventBody]);
14823
14818
  const prevFaqs = (0,hooks_.useRef)(null);
14824
14819
  const prevHasFaqs = (0,hooks_.useRef)(false);
14825
14820
  const {
@@ -14999,7 +14994,6 @@ const DeprecatedAppFrame = ({
14999
14994
 
15000
14995
 
15001
14996
 
15002
-
15003
14997
  const ShowInlineView = ({
15004
14998
  children
15005
14999
  }) => {
@@ -15026,7 +15020,6 @@ const DeprecatedView = () => {
15026
15020
  onCloseChat: closeChat,
15027
15021
  children: (0,jsx_runtime_namespaceObject.jsx)(agent_info, {})
15028
15022
  }), (0,jsx_runtime_namespaceObject.jsx)(deprecated_chat_frame, {
15029
- interruptComponent: interrupt,
15030
15023
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
15031
15024
  })]
15032
15025
  })