@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
@@ -7293,7 +7293,7 @@ _API_ready = new WeakMap(), _API_externalId = new WeakMap(), _API_layoutMode = n
7293
7293
  return {
7294
7294
  clientName: "@seamly/web-ui",
7295
7295
  clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
7296
- clientVersion: "21.0.8",
7296
+ clientVersion: "21.0.9",
7297
7297
  currentUrl: window.location.toString(),
7298
7298
  screenResolution: `${window.screen.width}x${window.screen.height}`,
7299
7299
  timezone: getTimeZone(),
@@ -11744,7 +11744,7 @@ const interruptSlice = createSlice({
11744
11744
  clearInterrupt: () => slice_initialState
11745
11745
  },
11746
11746
  extraReducers: builder => {
11747
- builder.addCase(resetApp.fulfilled, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
11747
+ builder.addCase(initializeConfig.pending, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
11748
11748
  payload
11749
11749
  }) => {
11750
11750
  state.error = payload;
@@ -12620,6 +12620,7 @@ const {
12620
12620
 
12621
12621
 
12622
12622
 
12623
+
12623
12624
  const i18n_slice_initialState = {
12624
12625
  translations: {
12625
12626
  'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
@@ -12656,7 +12657,7 @@ const i18nSlice = createSlice({
12656
12657
  },
12657
12658
  extraReducers: builder => {
12658
12659
  // Add reducers for additional action types here, and handle loading state as needed
12659
- builder.addCase(initializeConfig.fulfilled, (state, {
12660
+ builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(initializeConfig.fulfilled, (state, {
12660
12661
  payload
12661
12662
  }) => {
12662
12663
  state.initialLocale = payload.locale;
@@ -12759,6 +12760,7 @@ const selectIsLoading = es_createSelector(({
12759
12760
 
12760
12761
 
12761
12762
 
12763
+
12762
12764
  const translationsInitialState = {
12763
12765
  isActive: false,
12764
12766
  currentLocale: undefined,
@@ -12849,7 +12851,7 @@ const translationSlice = createSlice({
12849
12851
  }
12850
12852
  },
12851
12853
  extraReducers: builder => {
12852
- builder.addCase(initializeConfig.fulfilled, (state, {
12854
+ builder.addCase(resetApp.pending, () => translationsInitialState).addCase(initializeConfig.fulfilled, (state, {
12853
12855
  payload
12854
12856
  }) => {
12855
12857
  var _a;
@@ -14036,7 +14038,109 @@ const useLiveRegion = () => {
14036
14038
  sendAssertive
14037
14039
  };
14038
14040
  };
14039
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
14041
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
14042
+
14043
+ const selectError = es_createSelector(({
14044
+ interrupt
14045
+ }) => interrupt, ({
14046
+ error
14047
+ }) => error);
14048
+ const selectHasError = es_createSelector(selectError, error => Boolean(error));
14049
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
14050
+
14051
+
14052
+
14053
+
14054
+ function useInterrupt() {
14055
+ const {
14056
+ t
14057
+ } = useI18n();
14058
+ const error = useSelector_useSelector(selectError);
14059
+ const hasError = useSelector_useSelector(selectHasError);
14060
+ const meta = (0,hooks_.useMemo)(() => {
14061
+ if (!hasError) {
14062
+ return {
14063
+ title: undefined,
14064
+ message: undefined,
14065
+ srText: undefined,
14066
+ buttonText: undefined,
14067
+ originalError: undefined
14068
+ };
14069
+ }
14070
+ const {
14071
+ langKey,
14072
+ action
14073
+ } = error;
14074
+ const title = t(`${langKey}.title`);
14075
+ const message = t(`${langKey}.message`);
14076
+ const srText = t(`${langKey}.srText`);
14077
+ const buttonText = t(`${langKey}.buttonText`);
14078
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
14079
+ title,
14080
+ message,
14081
+ srText
14082
+ } : {}), action ? {
14083
+ action
14084
+ } : {}), action && langKey ? {
14085
+ buttonText
14086
+ } : {}), {
14087
+ originalError: error
14088
+ });
14089
+ }, [hasError, error, t]);
14090
+ return {
14091
+ hasError,
14092
+ meta,
14093
+ error
14094
+ };
14095
+ }
14096
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-session-expired-command.ts
14097
+
14098
+
14099
+
14100
+ function useSessionExpiredCommand() {
14101
+ const {
14102
+ meta: {
14103
+ originalError,
14104
+ action
14105
+ }
14106
+ } = useInterrupt();
14107
+ const seamlyCommands = use_seamly_commands();
14108
+ const isExpiredError = (originalError === null || originalError === void 0 ? void 0 : originalError.name) === 'SeamlySessionExpiredError';
14109
+ (0,hooks_.useEffect)(() => {
14110
+ if (isExpiredError && seamlyCommands[action]) {
14111
+ seamlyCommands[action]();
14112
+ }
14113
+ }, [action, seamlyCommands, isExpiredError]);
14114
+ }
14115
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.ts
14116
+ var use_seamly_chat_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
14117
+ function adopt(value) {
14118
+ return value instanceof P ? value : new P(function (resolve) {
14119
+ resolve(value);
14120
+ });
14121
+ }
14122
+ return new (P || (P = Promise))(function (resolve, reject) {
14123
+ function fulfilled(value) {
14124
+ try {
14125
+ step(generator.next(value));
14126
+ } catch (e) {
14127
+ reject(e);
14128
+ }
14129
+ }
14130
+ function rejected(value) {
14131
+ try {
14132
+ step(generator["throw"](value));
14133
+ } catch (e) {
14134
+ reject(e);
14135
+ }
14136
+ }
14137
+ function step(result) {
14138
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
14139
+ }
14140
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14141
+ });
14142
+ };
14143
+
14040
14144
 
14041
14145
 
14042
14146
 
@@ -14075,6 +14179,8 @@ const useSeamlyChat = () => {
14075
14179
  const {
14076
14180
  sendAssertive
14077
14181
  } = useLiveRegion();
14182
+ // Automatically reset conversation if the session has expired
14183
+ useSessionExpiredCommand();
14078
14184
  (0,hooks_.useEffect)(() => {
14079
14185
  if (isVisible) {
14080
14186
  // Wait for the live containers to stabilise in the DOM before injecting
@@ -14121,24 +14227,23 @@ const useSeamlyChat = () => {
14121
14227
  connectCalled.current = false;
14122
14228
  }
14123
14229
  }, [apiConfigReady, apiConnected]);
14124
- const connectAndStart = (0,hooks_.useCallback)(async () => {
14230
+ const connectAndStart = (0,hooks_.useCallback)(() => use_seamly_chat_awaiter(void 0, void 0, void 0, function* () {
14125
14231
  // We don't connect if we are already connected to the api to avoid multiple in-flight connection processes.
14126
14232
  if (!apiConnected) {
14127
14233
  connectCalled.current = true;
14128
- await connect();
14234
+ yield connect();
14129
14235
  }
14130
-
14131
14236
  // 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'.
14132
14237
  if (isApp || isOpen || isVisible && isInline) {
14133
14238
  start();
14134
14239
  }
14135
- }, [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
14240
+ }), [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
14136
14241
  (0,hooks_.useEffect)(() => {
14137
14242
  // We dont't connect or start when the apiConfig is not ready yet.
14138
14243
  // We also keep track of whether start has been called to avoid multiple in-flight connection processes.
14139
14244
  // We check if the window view is not open and no conversation is started yet.
14140
14245
  // Lastly we check if the inline view is not scrolled in to view.
14141
- if (!apiConfigReady || connectCalled.current || isWindow && !isOpen && !hasConversation() || isInline && (!isVisible || !showInlineView)) {
14246
+ if (!apiConfigReady || connectCalled.current || isWindow && !isOpen || isInline && (!isVisible || !showInlineView)) {
14142
14247
  return;
14143
14248
  }
14144
14249
  if (hasConversation() && isOpen) {
@@ -18034,7 +18139,7 @@ const SeamlyEventSubscriber = () => {
18034
18139
  channel === null || channel === void 0 ? void 0 : channel.leave();
18035
18140
  };
18036
18141
  }
18037
- return () => {};
18142
+ return () => undefined;
18038
18143
  }, [api, api.connectionInfo, api.conversation]);
18039
18144
  (0,hooks_.useEffect)(() => {
18040
18145
  api.conversation.onConnection(({
@@ -18217,6 +18322,9 @@ const SeamlyEventSubscriber = () => {
18217
18322
  const {
18218
18323
  channel
18219
18324
  } = api.conversation;
18325
+ if (messageChannelRef.current) {
18326
+ channel === null || channel === void 0 ? void 0 : channel.off('message', messageChannelRef.current);
18327
+ }
18220
18328
  messageChannelRef.current = channel.on('message', payload => {
18221
18329
  if (!EMITTABLE_MESSAGE_TYPES.includes(payload.type)) {
18222
18330
  return payload;
@@ -18233,19 +18341,18 @@ const SeamlyEventSubscriber = () => {
18233
18341
  });
18234
18342
  return true;
18235
18343
  });
18236
- return () => {
18237
- var _a;
18238
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('message', messageChannelRef.current);
18239
- };
18240
18344
  }
18241
- return () => undefined;
18242
18345
  }, [api, api.connectionInfo, api.conversation.channel, eventBus]);
18243
18346
  (0,hooks_.useEffect)(() => {
18244
18347
  if (api.connectionInfo) {
18245
18348
  api.conversation.onConnection(({
18246
18349
  connected
18247
18350
  }) => {
18351
+ var _a;
18248
18352
  if (!connected) return false;
18353
+ if (syncChannelRef.current) {
18354
+ (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
18355
+ }
18249
18356
  syncChannelRef.current = api.conversation.channel.on('sync', payload => {
18250
18357
  var _a;
18251
18358
  const lastEvent = events[events.length - 1];
@@ -18269,12 +18376,7 @@ const SeamlyEventSubscriber = () => {
18269
18376
  });
18270
18377
  return true;
18271
18378
  });
18272
- return () => {
18273
- var _a;
18274
- (_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
18275
- };
18276
18379
  }
18277
- return () => undefined;
18278
18380
  }, [api, api.connectionInfo, api.conversation.channel, events, dispatch]);
18279
18381
  return null;
18280
18382
  };
@@ -18410,52 +18512,6 @@ const SeamlyInitializer = () => {
18410
18512
  return null;
18411
18513
  };
18412
18514
  /* harmony default export */ const seamly_initializer = (SeamlyInitializer);
18413
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
18414
-
18415
- const selectError = es_createSelector(({
18416
- interrupt
18417
- }) => interrupt, ({
18418
- error
18419
- }) => error);
18420
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
18421
-
18422
-
18423
-
18424
-
18425
- function useInterrupt() {
18426
- const {
18427
- t
18428
- } = useI18n();
18429
- const error = useSelector_useSelector(selectError);
18430
- const hasInterrupt = Boolean(error);
18431
- const meta = (0,hooks_.useMemo)(() => {
18432
- if (!error) return {};
18433
- const {
18434
- langKey,
18435
- action
18436
- } = error;
18437
- const title = t(`${langKey}.title`);
18438
- const message = t(`${langKey}.message`);
18439
- const srText = t(`${langKey}.srText`);
18440
- const buttonText = t(`${langKey}.buttonText`);
18441
- return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
18442
- title,
18443
- message,
18444
- srText
18445
- } : {}), action ? {
18446
- action
18447
- } : {}), action && langKey ? {
18448
- buttonText
18449
- } : {}), {
18450
- originalError: error
18451
- });
18452
- }, [t, error]);
18453
- return {
18454
- hasInterrupt,
18455
- meta,
18456
- error
18457
- };
18458
- }
18459
18515
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-instance-functions-loader.js
18460
18516
 
18461
18517
 
@@ -18505,9 +18561,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18505
18561
  isInline,
18506
18562
  isResolving
18507
18563
  } = useSeamlyLayoutMode();
18508
- const {
18509
- hasInterrupt
18510
- } = useInterrupt();
18564
+ const hasError = useSelector_useSelector(selectHasError);
18511
18565
  const currentConversationUrl = useSeamlyConversationUrl();
18512
18566
  const prevConversationUrl = (0,hooks_.useRef)(null);
18513
18567
  const onActivityHandler = use_seamly_activity_event_handler();
@@ -18587,7 +18641,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18587
18641
  }
18588
18642
  }, [api.send]);
18589
18643
  (0,hooks_.useEffect)(() => {
18590
- if (!isResolving && !hasInterrupt) {
18644
+ if (!isResolving && !hasError) {
18591
18645
  // Check for app reset
18592
18646
  if (prevConversationUrl.current && prevConversationUrl.current !== currentConversationUrl) {
18593
18647
  eventBus.emit('unreadMessageCount', unreadCount);
@@ -18606,7 +18660,7 @@ const SeamlyInstanceFunctionsLoader = () => {
18606
18660
  previousUnreadCount.current = unreadCount;
18607
18661
  prevConversationUrl.current = currentConversationUrl;
18608
18662
  }
18609
- }, [unreadCount, visible, eventBus, isInline, isResolving, hasInterrupt, currentConversationUrl]);
18663
+ }, [unreadCount, visible, eventBus, isInline, isResolving, hasError, currentConversationUrl]);
18610
18664
  return null;
18611
18665
  };
18612
18666
  /* harmony default export */ const seamly_instance_functions_loader = (SeamlyInstanceFunctionsLoader);
@@ -19083,6 +19137,7 @@ const InOutTransition = ({
19083
19137
 
19084
19138
 
19085
19139
 
19140
+
19086
19141
 
19087
19142
 
19088
19143
  const Suggestions = ({
@@ -19114,9 +19169,7 @@ const Suggestions = ({
19114
19169
  sendPolite
19115
19170
  } = useLiveRegion();
19116
19171
  // interrupt & countdown hooks
19117
- const {
19118
- hasInterrupt
19119
- } = useInterrupt();
19172
+ const hasError = useSelector_useSelector(selectHasError);
19120
19173
  const {
19121
19174
  hasCountdown,
19122
19175
  endCountdown
@@ -19133,7 +19186,7 @@ const Suggestions = ({
19133
19186
  } = useTranslatedEventData({
19134
19187
  payload
19135
19188
  });
19136
- const suggestions = (0,hooks_.useMemo)(() => payload && !hasInterrupt ? eventBody : [], [payload, hasInterrupt, eventBody]);
19189
+ const suggestions = (0,hooks_.useMemo)(() => payload && !hasError ? eventBody : [], [payload, hasError, eventBody]);
19137
19190
  const prevSuggestions = (0,hooks_.useRef)(null);
19138
19191
  const prevHasSuggestions = (0,hooks_.useRef)(false);
19139
19192
  const previousRenderedSuggestions = (0,hooks_.useRef)([]);
@@ -19585,10 +19638,9 @@ function FormProvider(_a) {
19585
19638
  });
19586
19639
  }, [setExternalErrors]);
19587
19640
  const handleSubmit = (0,hooks_.useCallback)((e) => {
19588
- var _a;
19589
19641
  e.preventDefault();
19590
19642
  // If the submitter is set to being aria-disabled, block the submit action
19591
- const ariaDisabled = ((_a = e.submitter) === null || _a === void 0 ? void 0 : _a.ariaDisabled) === 'true';
19643
+ const ariaDisabled = e.submitter.getAttribute('aria-disabled') === 'true';
19592
19644
  setIsSubmitted(!ariaDisabled);
19593
19645
  if (!ariaDisabled && validationIsValid) {
19594
19646
  dispatch(setHasResponded(true));
@@ -20263,6 +20315,7 @@ function TranslationsOptionsButton({ children, position = {
20263
20315
 
20264
20316
 
20265
20317
 
20318
+
20266
20319
  function AppOptions() {
20267
20320
  const {
20268
20321
  menuOptions,
@@ -20271,15 +20324,13 @@ function AppOptions() {
20271
20324
  const {
20272
20325
  isAvailable: isTranslationsAvailable
20273
20326
  } = useTranslations();
20274
- const {
20275
- hasInterrupt
20276
- } = useInterrupt();
20327
+ const hasError = useSelector_useSelector(selectHasError);
20277
20328
  const {
20278
20329
  t,
20279
20330
  locale
20280
20331
  } = useI18n();
20281
20332
  const localeNativeName = useLocaleNativeName(locale);
20282
- if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasInterrupt) {
20333
+ if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasError) {
20283
20334
  return null;
20284
20335
  }
20285
20336
  const openButtonText = t('translations.settings.openButtonText', {
@@ -21541,10 +21592,11 @@ const ChatStatus = ({ children, handleClose, title, closeButtonText, srCloseButt
21541
21592
 
21542
21593
 
21543
21594
 
21595
+
21544
21596
  function TranslationChatStatus() {
21545
21597
  const { t } = useI18n();
21546
21598
  const { id } = useTranslationsContainer();
21547
- const { hasInterrupt } = useInterrupt();
21599
+ const hasError = useSelector_useSelector(selectHasError);
21548
21600
  const { disableTranslations, currentLocale } = useTranslations();
21549
21601
  const localeNativeName = useLocaleNativeName(currentLocale);
21550
21602
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
@@ -21553,7 +21605,7 @@ function TranslationChatStatus() {
21553
21605
  disableTranslations();
21554
21606
  focusSkiplinkTarget();
21555
21607
  }, [disableTranslations, focusSkiplinkTarget]);
21556
- if (hasInterrupt) {
21608
+ if (hasError) {
21557
21609
  return null;
21558
21610
  }
21559
21611
  return ((0,jsx_runtime_namespaceObject.jsx)(chat_status, { handleClose: handleClickStop, title: label, id: id, closeButtonText: t('translations.status.stopText'), srCloseButtonText: t('translations.status.srStopText') }));
@@ -21586,24 +21638,17 @@ function TranslationProposal() {
21586
21638
 
21587
21639
 
21588
21640
 
21641
+
21589
21642
  function TranslationStatus() {
21590
- const { hasInterrupt } = useInterrupt();
21643
+ const hasError = useSelector_useSelector(selectHasError);
21591
21644
  const { isActive } = useTranslations();
21592
- if (hasInterrupt) {
21645
+ if (hasError) {
21593
21646
  return null;
21594
21647
  }
21595
21648
  return !isActive ? (0,jsx_runtime_namespaceObject.jsx)(TranslationProposal, {}) : (0,jsx_runtime_namespaceObject.jsx)(TranslationChatStatus, {});
21596
21649
  }
21597
21650
 
21598
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
21599
- 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; }
21600
- 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; }
21601
- 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; }
21602
- function chat_frame_toPropertyKey(arg) { var key = chat_frame_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21603
- 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); }
21604
-
21605
-
21606
-
21651
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
21607
21652
 
21608
21653
 
21609
21654
 
@@ -21612,61 +21657,24 @@ function chat_frame_toPrimitive(input, hint) { if (typeof input !== "object" ||
21612
21657
 
21613
21658
 
21614
21659
 
21615
- function ChatFrame({
21616
- children,
21617
- interruptComponent: InterruptComponent
21618
- }) {
21619
- const {
21620
- hasInterrupt,
21621
- meta
21622
- } = useInterrupt();
21660
+ const Interrupt = () => {
21623
21661
  const {
21624
- isOpen
21625
- } = useVisibility();
21626
- if (hasInterrupt) {
21627
- if (isOpen) {
21628
- return (0,jsx_runtime_namespaceObject.jsx)(InterruptComponent, chat_frame_objectSpread({}, meta));
21662
+ meta: {
21663
+ originalError,
21664
+ title,
21665
+ message,
21666
+ buttonText,
21667
+ action,
21668
+ srText
21629
21669
  }
21630
- return null;
21631
- }
21632
- return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21633
- children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
21634
- children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
21635
- className: css_className('chat__container__header'),
21636
- children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
21637
- }), children]
21638
- }), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
21639
- });
21640
- }
21641
- /* harmony default export */ const chat_frame = (ChatFrame);
21642
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
21643
-
21644
-
21645
-
21646
-
21647
-
21648
-
21649
-
21650
- const Interrupt = ({
21651
- originalError,
21652
- title,
21653
- message,
21654
- buttonText,
21655
- action,
21656
- srText
21657
- }) => {
21670
+ } = useInterrupt();
21658
21671
  const seamlyCommands = use_seamly_commands();
21659
21672
  const headingId = useGeneratedId();
21660
21673
  const {
21661
21674
  sendPolite
21662
21675
  } = useLiveRegion();
21663
21676
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
21664
- const isExpiredError = originalError.name === 'SeamlySessionExpiredError';
21665
- (0,hooks_.useEffect)(() => {
21666
- if (isExpiredError && seamlyCommands[action]) {
21667
- seamlyCommands[action]();
21668
- }
21669
- }, [action, seamlyCommands, isExpiredError]);
21677
+ const isExpiredError = originalError?.name === 'SeamlySessionExpiredError';
21670
21678
  (0,hooks_.useEffect)(() => {
21671
21679
  if (!isExpiredError && srText) {
21672
21680
  // Wait for live regions to stabilise in case this occurs
@@ -21707,16 +21715,48 @@ const Interrupt = ({
21707
21715
  }) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {});
21708
21716
  };
21709
21717
  /* harmony default export */ const interrupt = (Interrupt);
21710
- ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
21718
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
21711
21719
 
21712
21720
 
21713
21721
 
21714
21722
 
21715
21723
 
21724
+
21725
+
21726
+
21727
+
21728
+
21729
+
21730
+
21731
+
21732
+ function ChatFrame({
21733
+ children
21734
+ }) {
21735
+ const hasError = useSelector_useSelector(selectHasError);
21736
+ const {
21737
+ isOpen
21738
+ } = useVisibility();
21739
+ if (hasError) {
21740
+ return (0,jsx_runtime_namespaceObject.jsx)(interrupt, {});
21741
+ }
21742
+ return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21743
+ children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
21744
+ children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
21745
+ className: css_className('chat__container__header'),
21746
+ children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
21747
+ }), children]
21748
+ }), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
21749
+ });
21750
+ }
21751
+ /* harmony default export */ const chat_frame = (ChatFrame);
21752
+ ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
21753
+
21754
+
21755
+
21756
+
21716
21757
  const AppView = () => {
21717
21758
  return (0,jsx_runtime_namespaceObject.jsx)(chat, {
21718
21759
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21719
- interruptComponent: interrupt,
21720
21760
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21721
21761
  })
21722
21762
  });
@@ -21729,6 +21769,7 @@ const AppView = () => {
21729
21769
 
21730
21770
 
21731
21771
 
21772
+
21732
21773
  function PreChatMessageEvent({
21733
21774
  event
21734
21775
  }) {
@@ -21742,13 +21783,11 @@ function PreChatMessages() {
21742
21783
  preChatEvents,
21743
21784
  layoutMode
21744
21785
  } = useConfig();
21745
- const {
21746
- hasInterrupt
21747
- } = useInterrupt();
21786
+ const hasError = useSelector_useSelector(selectHasError);
21748
21787
  const {
21749
21788
  isOpen
21750
21789
  } = useVisibility();
21751
- const isVisible = !(hasInterrupt || !preChatEvents?.length || isOpen);
21790
+ const isVisible = !(hasError || !preChatEvents?.length || isOpen);
21752
21791
  return isVisible && (0,jsx_runtime_namespaceObject.jsx)("ul", {
21753
21792
  className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
21754
21793
  "aria-hidden": !isVisible,
@@ -21761,13 +21800,6 @@ function PreChatMessages() {
21761
21800
  });
21762
21801
  }
21763
21802
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/inline-view.js
21764
- 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; }
21765
- 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; }
21766
- 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; }
21767
- function inline_view_toPropertyKey(arg) { var key = inline_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21768
- 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); }
21769
-
21770
-
21771
21803
 
21772
21804
 
21773
21805
 
@@ -21787,13 +21819,6 @@ const InlineView = () => {
21787
21819
  const {
21788
21820
  isOpen
21789
21821
  } = useVisibility();
21790
- const {
21791
- hasInterrupt,
21792
- meta
21793
- } = useInterrupt();
21794
- if (hasInterrupt && !isOpen) {
21795
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, inline_view_objectSpread({}, meta));
21796
- }
21797
21822
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21798
21823
  children: [(0,jsx_runtime_namespaceObject.jsx)(in_out_transition, {
21799
21824
  isActive: !isOpen,
@@ -21809,7 +21834,6 @@ const InlineView = () => {
21809
21834
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
21810
21835
  ref: containerRef,
21811
21836
  children: showInlineView && (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21812
- interruptComponent: interrupt,
21813
21837
  children: isOpen && (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21814
21838
  })
21815
21839
  })
@@ -21831,13 +21855,12 @@ const InlineView = () => {
21831
21855
 
21832
21856
 
21833
21857
 
21858
+
21834
21859
  const ButtonIcon = () => {
21835
21860
  const startChatIcon = useStartChatIcon();
21836
21861
  const currentAgent = useSeamlyCurrentAgent();
21837
- const {
21838
- hasInterrupt
21839
- } = useInterrupt();
21840
- const isActiveConversation = currentAgent && !hasInterrupt;
21862
+ const hasError = useSelector_useSelector(selectHasError);
21863
+ const isActiveConversation = currentAgent && !hasError;
21841
21864
  const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
21842
21865
  return src ? (0,jsx_runtime_namespaceObject.jsx)("img", {
21843
21866
  className: css_className(isActiveConversation ? 'avatar' : 'icon'),
@@ -21883,13 +21906,6 @@ const WindowOpenButton = ({
21883
21906
  };
21884
21907
  /* harmony default export */ const window_open_button = (WindowOpenButton);
21885
21908
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/window-view/index.js
21886
- 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; }
21887
- 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; }
21888
- 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; }
21889
- function window_view_toPropertyKey(arg) { var key = window_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21890
- 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); }
21891
-
21892
-
21893
21909
 
21894
21910
 
21895
21911
 
@@ -21911,10 +21927,6 @@ const WindowView = () => {
21911
21927
  openChat
21912
21928
  } = useVisibility();
21913
21929
  const userHasResponded = useUserHasResponded();
21914
- const {
21915
- hasInterrupt,
21916
- meta
21917
- } = useInterrupt();
21918
21930
  const {
21919
21931
  t
21920
21932
  } = useI18n();
@@ -21926,9 +21938,6 @@ const WindowView = () => {
21926
21938
  }
21927
21939
  }
21928
21940
  }), [continueChatText]);
21929
- if (hasInterrupt && !isOpen) {
21930
- return (0,jsx_runtime_namespaceObject.jsx)(interrupt, window_view_objectSpread({}, meta));
21931
- }
21932
21941
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
21933
21942
  children: [(0,jsx_runtime_namespaceObject.jsx)(window_open_button, {
21934
21943
  onClick: openChat
@@ -21953,7 +21962,6 @@ const WindowView = () => {
21953
21962
  transitionStartState: transitionStartStates.notRendered,
21954
21963
  children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
21955
21964
  children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
21956
- interruptComponent: interrupt,
21957
21965
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
21958
21966
  })
21959
21967
  })
@@ -22377,6 +22385,7 @@ function initializeExternalApi(appConfig) {
22377
22385
 
22378
22386
 
22379
22387
 
22388
+
22380
22389
  // Deprecated Toggle Button, should be removed once it is removed from clients
22381
22390
 
22382
22391
 
@@ -22397,13 +22406,11 @@ const DeprecatedToggleButton = ({
22397
22406
  const focusIfContained = useFocusIfSeamlyContainedFocus();
22398
22407
  const currentAgent = useSeamlyCurrentAgent();
22399
22408
  const agentSubtitle = useSeamlyHeaderData().subTitle;
22400
- const {
22401
- hasInterrupt
22402
- } = useInterrupt();
22409
+ const hasError = useSelector_useSelector(selectHasError);
22403
22410
  const {
22404
22411
  headerCollapseButtonId
22405
22412
  } = useSeamlyStateContext();
22406
- const showAgentInfo = currentAgent && !hasInterrupt;
22413
+ const showAgentInfo = currentAgent && !hasError;
22407
22414
  (0,hooks_.useLayoutEffect)(() => {
22408
22415
  // Because we can close the app from the external API we
22409
22416
  // need to determine if current keyboard focus resides inside
@@ -22463,6 +22470,7 @@ const DeprecatedToggleButton = ({
22463
22470
 
22464
22471
 
22465
22472
 
22473
+
22466
22474
  const AgentInfo = () => {
22467
22475
  const {
22468
22476
  t
@@ -22476,12 +22484,10 @@ const AgentInfo = () => {
22476
22484
  isOpen
22477
22485
  } = useVisibility();
22478
22486
  const currentAgent = useSeamlyCurrentAgent();
22479
- const {
22480
- hasInterrupt
22481
- } = useInterrupt();
22487
+ const hasError = useSelector_useSelector(selectHasError);
22482
22488
  const startChatIcon = useStartChatIcon();
22483
22489
  const src = currentAgent?.avatar ?? startChatIcon;
22484
- const displaySubtitle = hasInterrupt ? '' : subTitle;
22490
+ const displaySubtitle = hasError ? '' : subTitle;
22485
22491
  const classNames = ['message-count'];
22486
22492
  if (isOpen) {
22487
22493
  classNames.push('message-count__hide');
@@ -22558,11 +22564,8 @@ const Header = ({
22558
22564
  };
22559
22565
  /* harmony default export */ const header = (Header);
22560
22566
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/deprecated-chat-frame.js
22561
- 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; }
22562
- 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; }
22563
- 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; }
22564
- function deprecated_chat_frame_toPropertyKey(arg) { var key = deprecated_chat_frame_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
22565
- 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); }
22567
+
22568
+
22566
22569
 
22567
22570
 
22568
22571
 
@@ -22574,21 +22577,14 @@ function deprecated_chat_frame_toPrimitive(input, hint) { if (typeof input !== "
22574
22577
 
22575
22578
 
22576
22579
  function deprecated_chat_frame_ChatFrame({
22577
- children,
22578
- interruptComponent: InterruptComponent
22580
+ children
22579
22581
  }) {
22580
- const {
22581
- hasInterrupt,
22582
- meta
22583
- } = useInterrupt();
22584
22582
  const {
22585
22583
  isOpen
22586
22584
  } = useVisibility();
22587
- if (hasInterrupt) {
22588
- if (isOpen) {
22589
- return (0,jsx_runtime_namespaceObject.jsx)(InterruptComponent, deprecated_chat_frame_objectSpread({}, meta));
22590
- }
22591
- return null;
22585
+ const hasError = useSelector_useSelector(selectHasError);
22586
+ if (hasError) {
22587
+ return (0,jsx_runtime_namespaceObject.jsx)(interrupt, {});
22592
22588
  }
22593
22589
  return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
22594
22590
  children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
@@ -22628,6 +22624,7 @@ function faq_objectWithoutPropertiesLoose(source, excluded) { if (source == null
22628
22624
 
22629
22625
 
22630
22626
 
22627
+
22631
22628
  const Faq = () => {
22632
22629
  const {
22633
22630
  t
@@ -22641,9 +22638,7 @@ const Faq = () => {
22641
22638
  const {
22642
22639
  sendPolite
22643
22640
  } = useLiveRegion();
22644
- const {
22645
- hasInterrupt
22646
- } = useInterrupt();
22641
+ const hasError = useSelector_useSelector(selectHasError);
22647
22642
  const {
22648
22643
  hasCountdown,
22649
22644
  endCountdown
@@ -22659,7 +22654,7 @@ const Faq = () => {
22659
22654
  payload: lastFaqEventPayload
22660
22655
  });
22661
22656
  const faqs = (0,hooks_.useMemo)(() => {
22662
- const newFaqs = lastFaqEventPayload && !hasInterrupt ? eventBody : [];
22657
+ const newFaqs = lastFaqEventPayload && !hasError ? eventBody : [];
22663
22658
  const itemBaseClass = `faqs__item`;
22664
22659
  return newFaqs.map(_ref => {
22665
22660
  let {
@@ -22671,7 +22666,7 @@ const Faq = () => {
22671
22666
  classNames: [itemBaseClass, ...categories.map(cat => `faqs__item--${String(cat).toLowerCase().replace(/[^a-z0-9_\\-]/, '')}`)]
22672
22667
  });
22673
22668
  });
22674
- }, [lastFaqEventPayload, hasInterrupt, eventBody]);
22669
+ }, [lastFaqEventPayload, hasError, eventBody]);
22675
22670
  const prevFaqs = (0,hooks_.useRef)(null);
22676
22671
  const prevHasFaqs = (0,hooks_.useRef)(false);
22677
22672
  const {
@@ -22851,7 +22846,6 @@ const DeprecatedAppFrame = ({
22851
22846
 
22852
22847
 
22853
22848
 
22854
-
22855
22849
  const ShowInlineView = ({
22856
22850
  children
22857
22851
  }) => {
@@ -22878,7 +22872,6 @@ const DeprecatedView = () => {
22878
22872
  onCloseChat: closeChat,
22879
22873
  children: (0,jsx_runtime_namespaceObject.jsx)(agent_info, {})
22880
22874
  }), (0,jsx_runtime_namespaceObject.jsx)(deprecated_chat_frame, {
22881
- interruptComponent: interrupt,
22882
22875
  children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
22883
22876
  })]
22884
22877
  })