@seamly/web-ui 19.0.0 → 19.1.3

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 (66) hide show
  1. package/build/dist/lib/index.debug.js +150 -62
  2. package/build/dist/lib/index.debug.min.js +1 -1
  3. package/build/dist/lib/index.debug.min.js.LICENSE.txt +40 -8
  4. package/build/dist/lib/index.js +493 -413
  5. package/build/dist/lib/index.min.js +1 -1
  6. package/build/dist/lib/standalone.js +581 -432
  7. package/build/dist/lib/standalone.min.js +1 -1
  8. package/build/dist/lib/style-guide.js +1875 -1791
  9. package/build/dist/lib/style-guide.min.js +1 -1
  10. package/package.json +1 -1
  11. package/src/javascripts/api/errors/seamly-base-error.js +17 -0
  12. package/src/javascripts/api/errors/seamly-configuration-error.js +4 -6
  13. package/src/javascripts/api/errors/seamly-general-error.js +4 -6
  14. package/src/javascripts/api/errors/seamly-offline-error.js +4 -6
  15. package/src/javascripts/api/errors/seamly-session-expired-error.js +4 -6
  16. package/src/javascripts/api/errors/seamly-unauthorized-error.js +4 -6
  17. package/src/javascripts/api/errors/seamly-unavailable-error.js +17 -0
  18. package/src/javascripts/api/index.js +10 -11
  19. package/src/javascripts/api/producer.js +5 -1
  20. package/src/javascripts/domains/app/actions.js +27 -17
  21. package/src/javascripts/domains/app/index.js +2 -1
  22. package/src/javascripts/domains/config/reducer.js +1 -0
  23. package/src/javascripts/domains/config/selectors.js +1 -1
  24. package/src/javascripts/domains/errors/index.js +33 -0
  25. package/src/javascripts/domains/i18n/reducer.js +6 -0
  26. package/src/javascripts/domains/interrupt/middleware.js +2 -0
  27. package/src/javascripts/domains/interrupt/reducer.js +10 -9
  28. package/src/javascripts/domains/store/index.js +6 -1
  29. package/src/javascripts/domains/store/state-reducer.js +10 -6
  30. package/src/javascripts/domains/visibility/actions.js +73 -0
  31. package/src/javascripts/domains/visibility/constants.js +8 -0
  32. package/src/javascripts/domains/visibility/hooks.js +24 -0
  33. package/src/javascripts/domains/visibility/index.js +8 -0
  34. package/src/javascripts/domains/visibility/reducer.js +19 -0
  35. package/src/javascripts/domains/visibility/selectors.js +9 -0
  36. package/src/javascripts/domains/visibility/utils.js +42 -0
  37. package/src/javascripts/index.js +3 -12
  38. package/src/javascripts/lib/engine/index.js +1 -0
  39. package/src/javascripts/lib/redux-helpers/index.js +1 -5
  40. package/src/javascripts/style-guide/components/app.js +1 -1
  41. package/src/javascripts/style-guide/components/static-core.js +13 -0
  42. package/src/javascripts/style-guide/states.js +48 -21
  43. package/src/javascripts/ui/components/conversation/conversation.js +2 -2
  44. package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +1 -8
  45. package/src/javascripts/ui/components/conversation/event/text.js +19 -13
  46. package/src/javascripts/ui/components/core/seamly-core.js +3 -0
  47. package/src/javascripts/ui/components/core/seamly-event-subscriber.js +3 -3
  48. package/src/javascripts/ui/components/core/seamly-initializer.js +2 -6
  49. package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +2 -3
  50. package/src/javascripts/ui/components/core/seamly-new-notifications.js +2 -2
  51. package/src/javascripts/ui/components/core/seamly-read-state.js +2 -2
  52. package/src/javascripts/ui/components/entry/toggle-button.js +2 -2
  53. package/src/javascripts/ui/components/layout/agent-info.js +2 -2
  54. package/src/javascripts/ui/components/layout/app-frame.js +2 -3
  55. package/src/javascripts/ui/components/layout/chat-frame.js +2 -2
  56. package/src/javascripts/ui/components/layout/modal-wrapper.js +3 -6
  57. package/src/javascripts/ui/components/layout/view.js +3 -6
  58. package/src/javascripts/ui/hooks/seamly-hooks.js +0 -2
  59. package/src/javascripts/ui/hooks/use-seamly-chat.js +3 -5
  60. package/src/javascripts/ui/hooks/use-seamly-commands.js +7 -29
  61. package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +2 -2
  62. package/src/javascripts/ui/utils/general-utils.js +0 -9
  63. package/src/javascripts/ui/utils/seamly-utils.js +0 -66
  64. package/src/.DS_Store +0 -0
  65. package/src/javascripts/ui/hooks/use-seamly-stored-visibility.js +0 -31
  66. package/src/javascripts/ui/hooks/use-seamly-visibility.js +0 -98
@@ -9947,13 +9947,10 @@ __webpack_require__.d(__webpack_exports__, {
9947
9947
  "Interrupt": () => (/* reexport */ interrupt),
9948
9948
  "MessageContainer": () => (/* reexport */ message_container),
9949
9949
  "SeamlyApiContext": () => (/* reexport */ SeamlyApiContext),
9950
- "SeamlyConfigurationError": () => (/* reexport */ SeamlyConfigurationError),
9951
9950
  "SeamlyEventBusContext": () => (/* reexport */ SeamlyEventBusContext),
9952
9951
  "SeamlyGeneralError": () => (/* reexport */ SeamlyGeneralError),
9953
9952
  "SeamlyLiveRegionContext": () => (/* reexport */ SeamlyLiveRegionContext),
9954
9953
  "SeamlyOfflineError": () => (/* reexport */ SeamlyOfflineError),
9955
- "SeamlySessionExpiredError": () => (/* reexport */ SeamlySessionExpiredError),
9956
- "SeamlyUnauthorizedError": () => (/* reexport */ SeamlyUnauthorizedError),
9957
9954
  "StoreProvider": () => (/* reexport */ StoreProvider),
9958
9955
  "Text": () => (/* reexport */ event_text),
9959
9956
  "ToggleButton": () => (/* reexport */ toggle_button),
@@ -9979,7 +9976,7 @@ __webpack_require__.d(__webpack_exports__, {
9979
9976
  "useSeamlyIdleDetachCountdown": () => (/* reexport */ use_seamly_idle_detach_countdown),
9980
9977
  "useSeamlyMessageContainerClassNames": () => (/* reexport */ useSeamlyMessageContainerClassNames),
9981
9978
  "useSeamlyOptions": () => (/* reexport */ useSeamlyOptions),
9982
- "useSeamlyVisibility": () => (/* reexport */ use_seamly_visibility),
9979
+ "useSeamlyVisibility": () => (/* reexport */ useVisibility),
9983
9980
  "useTranslatedEventData": () => (/* reexport */ useTranslatedEventData),
9984
9981
  "useTranslations": () => (/* reexport */ useTranslations),
9985
9982
  "useTranslationsContainer": () => (/* reexport */ useTranslationsContainer),
@@ -12009,7 +12006,6 @@ const millisecondsToSeconds = milliseconds => {
12009
12006
  const microsecondsToMilliseconds = microseconds => {
12010
12007
  return Math.ceil(microseconds / 1000);
12011
12008
  };
12012
- const sanitizeText = text => text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/\//g, '&#x2F;');
12013
12009
  const getTimeFromSeconds = seconds => {
12014
12010
  const minutes = Math.floor(seconds / 60);
12015
12011
  const secondsPartial = seconds - minutes * 60;
@@ -12218,12 +12214,7 @@ function createThunk(type, payloadCreator) {
12218
12214
  });
12219
12215
  }
12220
12216
  function createReducer(domain, handlers = {}, defaultState) {
12221
- const reducer = (state, action) => {
12222
- if (state === undefined) {
12223
- // eslint-disable-next-line no-param-reassign
12224
- state = defaultState;
12225
- }
12226
-
12217
+ const reducer = (state = defaultState, action) => {
12227
12218
  const typeReducer = handlers === null || handlers === void 0 ? void 0 : handlers[action === null || action === void 0 ? void 0 : action.type];
12228
12219
  return typeReducer ? typeReducer(state, action) : state;
12229
12220
  };
@@ -12257,6 +12248,45 @@ const initialize = utils_createAction('initialize', config => ({
12257
12248
  const update = utils_createAction('update', config => ({
12258
12249
  config
12259
12250
  }));
12251
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/constants.js
12252
+ const StoreKey = 'visibility';
12253
+ const visibilityStates = {
12254
+ hidden: 'hidden',
12255
+ minimized: 'minimized',
12256
+ open: 'open',
12257
+ initialize: null
12258
+ };
12259
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
12260
+ function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12261
+
12262
+ function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { selectors_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
12263
+
12264
+ function selectors_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12265
+
12266
+
12267
+
12268
+
12269
+ const selectConfig = createSelector(selectState, config => {
12270
+ let newConfig = selectors_objectSpread({
12271
+ visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? visibilityStates.open : visibilityStates.minimized,
12272
+ appContainerClassNames: config.appContainerClassNames || []
12273
+ }, config);
12274
+
12275
+ if (typeof newConfig.appContainerClassNames === 'function') {
12276
+ newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
12277
+ appContainerClassNames: newConfig.appContainerClassNames(newConfig)
12278
+ });
12279
+ }
12280
+
12281
+ return newConfig;
12282
+ });
12283
+
12284
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
12285
+
12286
+
12287
+ function useConfig() {
12288
+ return useSelector(selectConfig);
12289
+ }
12260
12290
  ;// CONCATENATED MODULE: ./src/javascripts/ui/utils/seamly-utils.js
12261
12291
  function seamly_utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12262
12292
 
@@ -12288,12 +12318,6 @@ const entryTypes = {
12288
12318
  text: 'text',
12289
12319
  upload: 'upload'
12290
12320
  };
12291
- const visibilityStates = {
12292
- hidden: 'hidden',
12293
- minimized: 'minimized',
12294
- open: 'open',
12295
- initialize: null
12296
- };
12297
12321
  const readStates = {
12298
12322
  received: 'received',
12299
12323
  read: 'read'
@@ -12340,7 +12364,6 @@ const seamlyActions = {
12340
12364
  SET_PARTICIPANT: 'SET_PARTICIPANT',
12341
12365
  SET_HEADER_TITLE: 'SET_HEADER_TITLE',
12342
12366
  SET_HEADER_SUB_TITLE: 'SET_HEADER_SUB_TITLE',
12343
- SET_VISIBILITY: 'SET_VISIBILITY',
12344
12367
  RESET_HISTORY_LOADED_FLAG: 'RESET_HISTORY_LOADED_FLAG',
12345
12368
  SET_ACTIVE_SERVICE: 'SET_ACTIVE_SERVICE',
12346
12369
  INIT_IDLE_DETACH_COUNTDOWN: 'INIT_IDLE_DETACH_COUNTDOWN',
@@ -12368,8 +12391,6 @@ const seamlyActions = {
12368
12391
  SET_UPLOAD_ERROR: 'SET_UPLOAD_ERROR',
12369
12392
  CLEAR_UPLOAD: 'CLEAR_UPLOAD',
12370
12393
  CLEAR_ALL_UPLOADS: 'CLEAR_ALL_UPLOADS',
12371
- RESET_UPLOAD_STATE: 'RESET_UPLOAD_STATE',
12372
- RESET_ENTRY_STATE: 'RESET_ENTRY_STATE',
12373
12394
  SET_SEAMLY_CONTAINER_ELEMENT: 'SET_SEAMLY_CONTAINER_ELEMENT'
12374
12395
  };
12375
12396
  const cardTypes = {
@@ -12388,7 +12409,6 @@ const {
12388
12409
  SET_PARTICIPANT,
12389
12410
  SET_HEADER_TITLE,
12390
12411
  SET_HEADER_SUB_TITLE,
12391
- SET_VISIBILITY,
12392
12412
  RESET_HISTORY_LOADED_FLAG,
12393
12413
  SET_ACTIVE_SERVICE,
12394
12414
  INIT_IDLE_DETACH_COUNTDOWN,
@@ -12416,8 +12436,6 @@ const {
12416
12436
  SET_UPLOAD_ERROR,
12417
12437
  CLEAR_UPLOAD,
12418
12438
  CLEAR_ALL_UPLOADS,
12419
- RESET_UPLOAD_STATE,
12420
- RESET_ENTRY_STATE,
12421
12439
  SET_SEAMLY_CONTAINER_ELEMENT
12422
12440
  } = seamlyActions;
12423
12441
  const isUnreadMessage = ({
@@ -12796,11 +12814,6 @@ const seamlyStateReducer = (state, action) => {
12796
12814
  resumeConversationPrompt: false
12797
12815
  });
12798
12816
 
12799
- case SET_VISIBILITY:
12800
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
12801
- visible: action.visible
12802
- });
12803
-
12804
12817
  case SET_PARTICIPANT:
12805
12818
  case CLEAR_PARTICIPANTS:
12806
12819
  return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
@@ -13008,26 +13021,6 @@ const seamlyStateReducer = (state, action) => {
13008
13021
  currentUploads: []
13009
13022
  });
13010
13023
 
13011
- case RESET_UPLOAD_STATE:
13012
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
13013
- showFileUpload: false,
13014
- currentUploads: []
13015
- });
13016
-
13017
- case RESET_ENTRY_STATE:
13018
- {
13019
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
13020
- entryMeta: {
13021
- default: payloadTypes.text,
13022
- active: payloadTypes.text,
13023
- userSelected: null,
13024
- blockAutoEntrySwitch: false,
13025
- options: {},
13026
- optionsOverride: {}
13027
- }
13028
- });
13029
- }
13030
-
13031
13024
  case SET_SEAMLY_CONTAINER_ELEMENT:
13032
13025
  {
13033
13026
  return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
@@ -13039,59 +13032,6 @@ const seamlyStateReducer = (state, action) => {
13039
13032
  return state;
13040
13033
  }
13041
13034
  };
13042
- const calculateVisibility = ({
13043
- hasResponded,
13044
- previousVisibility,
13045
- requestedVisibility,
13046
- config
13047
- }) => {
13048
- const {
13049
- defaults,
13050
- layoutMode,
13051
- hideOnNoUserResponse
13052
- } = config;
13053
- const {
13054
- visible: defaultVisibility
13055
- } = defaults || {}; // Requesting open should override the responded check.
13056
-
13057
- if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
13058
- return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
13059
- }
13060
-
13061
- const baseVisibility = layoutMode === 'inline' ? visibilityStates.open : visibilityStates.minimized;
13062
- return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
13063
- };
13064
- ;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
13065
- function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
13066
-
13067
- function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { selectors_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
13068
-
13069
- function selectors_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13070
-
13071
-
13072
-
13073
-
13074
- const selectConfig = createSelector(selectState, config => {
13075
- let newConfig = selectors_objectSpread({
13076
- visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? visibilityStates.open : visibilityStates.minimized,
13077
- appContainerClassNames: config.appContainerClassNames || []
13078
- }, config);
13079
-
13080
- if (typeof newConfig.appContainerClassNames === 'function') {
13081
- newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
13082
- appContainerClassNames: newConfig.appContainerClassNames(newConfig)
13083
- });
13084
- }
13085
-
13086
- return newConfig;
13087
- });
13088
-
13089
- ;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
13090
-
13091
-
13092
- function useConfig() {
13093
- return useSelector(selectConfig);
13094
- }
13095
13035
  ;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
13096
13036
 
13097
13037
 
@@ -13184,7 +13124,7 @@ const initialState = reducer_objectSpread(reducer_objectSpread({}, defaultConfig
13184
13124
  defaults: {}
13185
13125
  });
13186
13126
 
13187
- const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback'];
13127
+ const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback'];
13188
13128
 
13189
13129
  const updateState = (state, {
13190
13130
  config
@@ -14204,7 +14144,11 @@ const defaultState = {
14204
14144
  'errors.general.title': 'Something went wrong',
14205
14145
  'errors.seamlyOffline.message': 'There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.',
14206
14146
  'errors.seamlyOffline.srText': 'The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.',
14207
- 'errors.seamlyOffline.title': 'Connection issues'
14147
+ 'errors.seamlyOffline.title': 'Connection issues',
14148
+ 'errors.seamlyUnavailable.buttonText': 'Try again',
14149
+ 'errors.seamlyUnavailable.message': 'The server could not be reached. Try again in a little while.',
14150
+ 'errors.seamlyUnavailable.srText': 'The chat server could not be reached. Try again in a little while.',
14151
+ 'errors.seamlyUnavailable.title': 'Server unavailable'
14208
14152
  },
14209
14153
  isLoading: false,
14210
14154
  initialLocale: undefined
@@ -14543,15 +14487,33 @@ function useInterrupt() {
14543
14487
  error
14544
14488
  };
14545
14489
  }
14546
- ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
14547
- class SeamlyGeneralError extends Error {
14548
- constructor(params) {
14549
- super(params);
14490
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-base-error.js
14491
+ class SeamlyBaseError extends Error {
14492
+ constructor(originalError, ...params) {
14493
+ super(...params);
14550
14494
 
14551
14495
  if (Error.captureStackTrace) {
14552
- Error.captureStackTrace(this, SeamlyGeneralError);
14496
+ Error.captureStackTrace(this, Object.getPrototypeOf(this));
14497
+ }
14498
+
14499
+ this.originalError = originalError;
14500
+
14501
+ if (originalError !== null && originalError !== void 0 && originalError.payload) {
14502
+ this.originalEvent = originalError;
14503
+ this.originalError = originalError.payload.error;
14553
14504
  }
14554
14505
 
14506
+ if (originalError !== null && originalError !== void 0 && originalError.error) {
14507
+ this.originalError = originalError.error;
14508
+ }
14509
+ }
14510
+
14511
+ }
14512
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
14513
+
14514
+ class SeamlyGeneralError extends SeamlyBaseError {
14515
+ constructor(originalError, ...params) {
14516
+ super(originalError, ...params);
14555
14517
  this.name = 'SeamlyGeneralError';
14556
14518
  this.langKey = 'errors.general';
14557
14519
  this.action = 'reset';
@@ -14559,59 +14521,62 @@ class SeamlyGeneralError extends Error {
14559
14521
 
14560
14522
  }
14561
14523
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-configuration-error.js
14562
- class SeamlyConfigurationError extends Error {
14563
- constructor(params) {
14564
- super(params);
14565
-
14566
- if (Error.captureStackTrace) {
14567
- Error.captureStackTrace(this, SeamlyConfigurationError);
14568
- }
14569
14524
 
14525
+ class SeamlyConfigurationError extends SeamlyBaseError {
14526
+ constructor(originalError, ...params) {
14527
+ super(originalError, ...params);
14570
14528
  this.name = 'SeamlyConfigurationError';
14571
14529
  this.langKey = 'errors.configError';
14572
14530
  }
14573
14531
 
14574
14532
  }
14575
14533
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-session-expired-error.js
14576
- class SeamlySessionExpiredError extends Error {
14577
- constructor(params) {
14578
- super(params);
14579
-
14580
- if (Error.captureStackTrace) {
14581
- Error.captureStackTrace(this, SeamlySessionExpiredError);
14582
- }
14583
14534
 
14535
+ class SeamlySessionExpiredError extends SeamlyBaseError {
14536
+ constructor(originalError, ...params) {
14537
+ super(originalError, ...params);
14584
14538
  this.name = 'SeamlySessionExpiredError';
14585
14539
  this.action = 'reset';
14586
14540
  }
14587
14541
 
14588
14542
  }
14589
14543
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-offline-error.js
14590
- class SeamlyOfflineError extends Error {
14591
- constructor(params) {
14592
- super(params);
14593
-
14594
- if (Error.captureStackTrace) {
14595
- Error.captureStackTrace(this, SeamlyOfflineError);
14596
- }
14597
14544
 
14545
+ class SeamlyOfflineError extends SeamlyBaseError {
14546
+ constructor(originalError, ...params) {
14547
+ super(originalError, ...params);
14598
14548
  this.name = 'SeamlyOfflineError';
14599
14549
  this.langKey = 'errors.seamlyOffline';
14600
14550
  }
14601
14551
 
14602
14552
  }
14603
14553
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unauthorized-error.js
14604
- class SeamlyUnauthorizedError extends Error {
14554
+
14555
+ class SeamlyUnauthorizedError extends SeamlyBaseError {
14556
+ constructor(originalError, ...params) {
14557
+ super(originalError, ...params);
14558
+ this.name = 'SeamlyUnauthorizedError';
14559
+ this.langKey = 'errors.general';
14560
+ this.action = 'reset';
14561
+ }
14562
+
14563
+ }
14564
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unavailable-error.js
14565
+ /**
14566
+ * This error is used to alert the user that there's a problem with the connection
14567
+ * when initialising the application because of a connection issue on either the server
14568
+ * or the client side.
14569
+ */
14570
+ class SeamlyUnavailableError extends Error {
14605
14571
  constructor(params) {
14606
14572
  super(params);
14607
14573
 
14608
14574
  if (Error.captureStackTrace) {
14609
- Error.captureStackTrace(this, SeamlyUnauthorizedError);
14575
+ Error.captureStackTrace(this, SeamlyUnavailableError);
14610
14576
  }
14611
14577
 
14612
- this.name = 'SeamlyUnauthorizedError';
14613
- this.langKey = 'errors.general';
14614
- this.action = 'reset';
14578
+ this.name = 'SeamlyUnavailableError';
14579
+ this.langKey = 'errors.seamlyUnavailable';
14615
14580
  }
14616
14581
 
14617
14582
  }
@@ -14621,7 +14586,8 @@ class SeamlyUnauthorizedError extends Error {
14621
14586
 
14622
14587
 
14623
14588
 
14624
- const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError];
14589
+
14590
+ const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
14625
14591
  function middleware_createMiddleware({
14626
14592
  api
14627
14593
  }) {
@@ -14644,64 +14610,169 @@ function middleware_createMiddleware({
14644
14610
  return next(action);
14645
14611
  };
14646
14612
  }
14647
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
14648
- function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14613
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
14649
14614
 
14650
- function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { interrupt_reducer_ownKeys(Object(source), true).forEach(function (key) { interrupt_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { interrupt_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14615
+ const {
14616
+ createAction: app_utils_createAction,
14617
+ createThunk: app_utils_createThunk,
14618
+ createReducer: app_utils_createReducer,
14619
+ selectState: app_utils_selectState
14620
+ } = createDomain('app');
14621
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
14651
14622
 
14652
- function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14653
14623
 
14624
+ const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
14654
14625
 
14626
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/utils.js
14655
14627
 
14656
- const reducer_initialState = {
14657
- error: undefined
14628
+
14629
+ const {
14630
+ createAction: visibility_utils_createAction,
14631
+ createActions: utils_createActions,
14632
+ createThunk: visibility_utils_createThunk,
14633
+ createReducer: visibility_utils_createReducer,
14634
+ selectState: visibility_utils_selectState
14635
+ } = createDomain('visibility');
14636
+ const calculateVisibility = ({
14637
+ hasResponded,
14638
+ previousVisibility,
14639
+ requestedVisibility,
14640
+ config
14641
+ }) => {
14642
+ const {
14643
+ defaults,
14644
+ layoutMode,
14645
+ hideOnNoUserResponse
14646
+ } = config;
14647
+ const {
14648
+ visible: defaultVisibility
14649
+ } = defaults || {}; // Requesting open should override the responded check.
14650
+
14651
+ if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
14652
+ return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
14653
+ }
14654
+
14655
+ const baseVisibility = layoutMode === 'inline' ? visibilityStates.open : visibilityStates.minimized;
14656
+ return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
14658
14657
  };
14659
- /* harmony default export */ const interrupt_reducer = (interrupt_utils_createReducer({
14660
- [set]: (state, {
14661
- error
14662
- }) => {
14663
- return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
14664
- error
14665
- });
14666
- },
14667
- [clear]: () => {
14668
- return reducer_initialState;
14658
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/selectors.js
14659
+
14660
+
14661
+ const selectVisibility = createSelector(visibility_utils_selectState, state => state.visibility);
14662
+
14663
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/actions.js
14664
+ function actions_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14665
+
14666
+ function actions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { actions_ownKeys(Object(source), true).forEach(function (key) { actions_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { actions_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14667
+
14668
+ function actions_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14669
+
14670
+
14671
+
14672
+
14673
+
14674
+
14675
+
14676
+ const setFromStorage = visibility_utils_createAction('setFromStorage', visibility => ({
14677
+ visibility
14678
+ }));
14679
+ const validVisibilityStates = [visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden];
14680
+ const actions_setVisibility = visibility_utils_createThunk('set', (requestedVisibility, {
14681
+ getState,
14682
+ extra: {
14683
+ api,
14684
+ eventBus
14669
14685
  }
14670
- }, reducer_initialState));
14671
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
14686
+ }) => {
14687
+ const state = getState();
14688
+ const previousVisibility = selectVisibility(state);
14689
+ const hasResponded = selectUserHasResponded(state);
14690
+ const hasConversation = api.hasConversation();
14691
+ const config = selectConfig(state);
14692
+ const {
14693
+ visibilityCallback = calculateVisibility,
14694
+ layoutMode
14695
+ } = config;
14696
+ const {
14697
+ unreadEvents: unreadMessageCount
14698
+ } = seamly_state_hooks_selectState(state);
14699
+ const calculatedVisibility = visibilityCallback({
14700
+ hasConversation,
14701
+ hasResponded,
14702
+ previousVisibility,
14703
+ requestedVisibility,
14704
+ config
14705
+ });
14672
14706
 
14707
+ if (!validVisibilityStates.includes(calculatedVisibility)) {
14708
+ console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
14709
+ return undefined;
14710
+ }
14673
14711
 
14712
+ if (previousVisibility === calculatedVisibility) {
14713
+ return undefined;
14714
+ } // Store the user-requested visibility in order to reinitialize after refresh
14674
14715
 
14675
14716
 
14717
+ api.store.set(StoreKey, actions_objectSpread(actions_objectSpread({}, api.store.get(StoreKey) || {}), {}, {
14718
+ [layoutMode]: requestedVisibility
14719
+ }));
14676
14720
 
14721
+ if (requestedVisibility) {
14722
+ eventBus.emit('ui.visible', requestedVisibility, {
14723
+ visibility: requestedVisibility,
14724
+ hasConversation,
14725
+ hasResponded,
14726
+ unreadMessageCount
14727
+ });
14728
+ }
14677
14729
 
14678
- ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
14730
+ return calculatedVisibility;
14731
+ });
14732
+ const actions_initialize = visibility_utils_createThunk('initialize', async (locale, {
14733
+ dispatch,
14734
+ getState,
14735
+ extra: {
14736
+ api
14737
+ }
14738
+ }) => {
14739
+ var _api$store$get;
14679
14740
 
14680
- const {
14681
- createAction: app_utils_createAction,
14682
- createThunk: app_utils_createThunk,
14683
- createReducer: app_utils_createReducer,
14684
- selectState: app_utils_selectState
14685
- } = createDomain('app');
14741
+ // initialize stored visibility
14742
+ const {
14743
+ layoutMode
14744
+ } = selectConfig(getState());
14745
+ const storedVisibility = (_api$store$get = api.store.get(StoreKey)) === null || _api$store$get === void 0 ? void 0 : _api$store$get[layoutMode];
14746
+
14747
+ if (storedVisibility) {
14748
+ dispatch(setFromStorage(storedVisibility));
14749
+ }
14750
+
14751
+ dispatch(actions_setVisibility(visibilityStates.initialize));
14752
+ });
14686
14753
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
14687
14754
 
14688
14755
 
14689
14756
 
14690
14757
 
14691
14758
 
14759
+
14760
+
14692
14761
  const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
14693
14762
  hasResponded
14694
14763
  }));
14695
- const actions_initialize = app_utils_createThunk('initialize', async (config, {
14764
+ const app_actions_initialize = app_utils_createThunk('initialize', async (config, {
14696
14765
  dispatch,
14697
14766
  extra: {
14698
14767
  api
14699
14768
  }
14700
14769
  }) => {
14701
- try {
14702
- var _config$context;
14770
+ var _config$context;
14703
14771
 
14704
- dispatch(initialize(config));
14772
+ dispatch(initialize(config));
14773
+ let locale = config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale;
14774
+
14775
+ try {
14705
14776
  const {
14706
14777
  features,
14707
14778
  defaultLocale
@@ -14710,38 +14781,39 @@ const actions_initialize = app_utils_createThunk('initialize', async (config, {
14710
14781
  type: seamlyActions.SET_FEATURES,
14711
14782
  features
14712
14783
  });
14713
- let locale = (config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale) || defaultLocale;
14784
+ locale = locale || defaultLocale;
14714
14785
  dispatch(setInitialLocale(locale));
14786
+ } catch (e) {
14787
+ throw new SeamlyUnavailableError();
14788
+ }
14715
14789
 
14716
- try {
14717
- if (api.hasConversation()) {
14718
- var _initialState$transla;
14790
+ try {
14791
+ if (api.hasConversation()) {
14792
+ var _initialState$transla;
14719
14793
 
14720
- const initialState = await api.getConversationIntitialState();
14721
- dispatch({
14722
- type: seamlyActions.SET_INITIAL_STATE,
14723
- initialState
14724
- });
14725
- locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
14794
+ const initialState = await api.getConversationIntitialState();
14795
+ dispatch({
14796
+ type: seamlyActions.SET_INITIAL_STATE,
14797
+ initialState
14798
+ });
14799
+ locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
14726
14800
 
14727
- if ('userResponded' in initialState) {
14728
- dispatch(setHasResponded(initialState.userResponded));
14729
- }
14801
+ if ('userResponded' in initialState) {
14802
+ dispatch(setHasResponded(initialState.userResponded));
14730
14803
  }
14731
- } catch (error) {
14732
- dispatch(set(error));
14804
+ }
14805
+ } catch (e) {
14806
+ if (e instanceof SeamlySessionExpiredError) {
14807
+ throw e;
14733
14808
  }
14734
14809
 
14810
+ throw new SeamlyUnavailableError();
14811
+ } finally {
14735
14812
  await dispatch(setLocale(locale));
14736
- } catch (error) {
14737
- dispatch(set(error));
14813
+ dispatch(actions_initialize());
14738
14814
  }
14739
14815
  });
14740
- ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
14741
-
14742
-
14743
- const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
14744
-
14816
+ const actions_reset = app_utils_createAction('reset', () => {});
14745
14817
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
14746
14818
 
14747
14819
 
@@ -14757,7 +14829,7 @@ function app_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.
14757
14829
 
14758
14830
 
14759
14831
 
14760
- const app_reducer_initialState = {
14832
+ const reducer_initialState = {
14761
14833
  userHasResponded: false
14762
14834
  };
14763
14835
  /* harmony default export */ const app_reducer = (app_utils_createReducer({
@@ -14766,12 +14838,102 @@ const app_reducer_initialState = {
14766
14838
  }) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
14767
14839
  userHasResponded: hasResponded
14768
14840
  })
14769
- }, app_reducer_initialState));
14841
+ }, reducer_initialState));
14770
14842
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
14771
14843
 
14772
14844
 
14773
14845
 
14774
14846
 
14847
+
14848
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
14849
+ function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14850
+
14851
+ function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { interrupt_reducer_ownKeys(Object(source), true).forEach(function (key) { interrupt_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { interrupt_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14852
+
14853
+ function interrupt_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14854
+
14855
+
14856
+
14857
+
14858
+ const interrupt_reducer_initialState = {
14859
+ error: undefined
14860
+ };
14861
+
14862
+ const handleError = (state, {
14863
+ error
14864
+ }) => interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
14865
+ error
14866
+ });
14867
+
14868
+ /* harmony default export */ const interrupt_reducer = (interrupt_utils_createReducer({
14869
+ [set]: handleError,
14870
+ [app_actions_initialize.rejected]: handleError,
14871
+ [clear]: () => interrupt_reducer_initialState,
14872
+ [actions_reset]: () => interrupt_reducer_initialState
14873
+ }, interrupt_reducer_initialState));
14874
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
14875
+
14876
+
14877
+
14878
+
14879
+
14880
+
14881
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/hooks.js
14882
+
14883
+
14884
+
14885
+
14886
+
14887
+
14888
+ const useVisibility = () => {
14889
+ const dispatch = useStoreDispatch();
14890
+ const visible = useSelector(selectVisibility);
14891
+ const isVisible = visible ? visible !== visibilityStates.hidden : false;
14892
+ const {
14893
+ layoutMode
14894
+ } = useConfig();
14895
+ const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
14896
+ const setVisibility = (0,hooks_namespaceObject.useCallback)(visibility => dispatch(actions_setVisibility(visibility)), [dispatch]);
14897
+ return {
14898
+ isVisible,
14899
+ isOpen,
14900
+ visible,
14901
+ setVisibility
14902
+ };
14903
+ };
14904
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/reducer.js
14905
+ function visibility_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14906
+
14907
+ function visibility_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { visibility_reducer_ownKeys(Object(source), true).forEach(function (key) { visibility_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { visibility_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14908
+
14909
+ function visibility_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14910
+
14911
+
14912
+
14913
+
14914
+ const visibility_reducer_initialState = {
14915
+ visibility: visibilityStates.initialize
14916
+ };
14917
+ /* harmony default export */ const visibility_reducer = (visibility_utils_createReducer({
14918
+ [setFromStorage]: (state, {
14919
+ visibility
14920
+ }) => visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
14921
+ visibility
14922
+ }),
14923
+ [actions_setVisibility.fulfilled]: (state, {
14924
+ payload: visibility
14925
+ }) => visibility ? visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
14926
+ visibility
14927
+ }) : state
14928
+ }, visibility_reducer_initialState));
14929
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/index.js
14930
+
14931
+
14932
+
14933
+
14934
+
14935
+
14936
+
14775
14937
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
14776
14938
  function use_seamly_commands_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14777
14939
 
@@ -14794,15 +14956,10 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
14794
14956
 
14795
14957
  const {
14796
14958
  ADD_EVENT: use_seamly_commands_ADD_EVENT,
14797
- CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
14798
14959
  SET_IS_LOADING: use_seamly_commands_SET_IS_LOADING,
14799
- CLEAR_PARTICIPANTS: use_seamly_commands_CLEAR_PARTICIPANTS,
14800
14960
  SET_HEADER_SUB_TITLE: use_seamly_commands_SET_HEADER_SUB_TITLE,
14801
14961
  SET_INITIAL_STATE: use_seamly_commands_SET_INITIAL_STATE,
14802
- CLEAR_FEATURES: use_seamly_commands_CLEAR_FEATURES,
14803
- SET_FEATURES: use_seamly_commands_SET_FEATURES,
14804
- RESET_UPLOAD_STATE: use_seamly_commands_RESET_UPLOAD_STATE,
14805
- RESET_ENTRY_STATE: use_seamly_commands_RESET_ENTRY_STATE
14962
+ SET_FEATURES: use_seamly_commands_SET_FEATURES
14806
14963
  } = seamlyActions;
14807
14964
 
14808
14965
  const useSeamlyCommands = () => {
@@ -14814,7 +14971,7 @@ const useSeamlyCommands = () => {
14814
14971
  const hasConversation = useSeamlyHasConversation();
14815
14972
  const {
14816
14973
  visible: visibility
14817
- } = useSeamlyStateContext();
14974
+ } = useVisibility();
14818
14975
  const unreadMessageCount = useSeamlyUnreadCount();
14819
14976
  const emitEvent = (0,hooks_namespaceObject.useCallback)((...args) => {
14820
14977
  eventBus.emit(...args);
@@ -14836,26 +14993,12 @@ const useSeamlyCommands = () => {
14836
14993
  });
14837
14994
  }, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
14838
14995
  const reset = (0,hooks_namespaceObject.useCallback)(async () => {
14996
+ dispatch(actions_reset());
14839
14997
  dispatch(clear());
14840
- dispatch({
14841
- type: use_seamly_commands_CLEAR_EVENTS
14842
- });
14843
14998
  dispatch({
14844
14999
  type: use_seamly_commands_SET_IS_LOADING,
14845
15000
  isLoading: true
14846
15001
  });
14847
- dispatch({
14848
- type: use_seamly_commands_CLEAR_PARTICIPANTS
14849
- });
14850
- dispatch({
14851
- type: use_seamly_commands_RESET_UPLOAD_STATE
14852
- });
14853
- dispatch({
14854
- type: use_seamly_commands_RESET_ENTRY_STATE
14855
- });
14856
- dispatch({
14857
- type: use_seamly_commands_CLEAR_FEATURES
14858
- });
14859
15002
  const {
14860
15003
  agentName
14861
15004
  } = appConfig.defaults || {};
@@ -14907,21 +15050,13 @@ const useSeamlyCommands = () => {
14907
15050
 
14908
15051
  const message = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, getTextMessageBase(body)), config);
14909
15052
 
14910
- const sanitizedText = sanitizeText(body);
14911
-
14912
- const sanitizedMessage = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, message), {}, {
14913
- body: {
14914
- text: sanitizedText
14915
- }
14916
- });
14917
-
14918
15053
  api.send('message', message);
14919
15054
  emitEvent('message', message);
14920
15055
  dispatch({
14921
15056
  type: use_seamly_commands_ADD_EVENT,
14922
15057
  event: {
14923
15058
  type: 'message',
14924
- payload: sanitizedMessage
15059
+ payload: message
14925
15060
  }
14926
15061
  });
14927
15062
  }, [api, dispatch, emitEvent, getTextMessageBase]);
@@ -15204,121 +15339,6 @@ const useSeamlyEntry = () => {
15204
15339
  setBlockAutoEntrySwitch
15205
15340
  };
15206
15341
  };
15207
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-stored-visibility.js
15208
- function use_seamly_stored_visibility_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15209
-
15210
- function use_seamly_stored_visibility_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { use_seamly_stored_visibility_ownKeys(Object(source), true).forEach(function (key) { use_seamly_stored_visibility_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { use_seamly_stored_visibility_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
15211
-
15212
- function use_seamly_stored_visibility_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15213
-
15214
-
15215
-
15216
-
15217
-
15218
- const useSeamlyStoredVisibility = () => {
15219
- const {
15220
- layoutMode
15221
- } = useConfig();
15222
- const key = 'visibility';
15223
- const {
15224
- get,
15225
- set
15226
- } = useSeamlyObjectStore();
15227
- let storedVisibilityObj = {};
15228
- const savedVisibility = get ? get(key) : {};
15229
-
15230
- if (savedVisibility) {
15231
- storedVisibilityObj = savedVisibility;
15232
- }
15233
-
15234
- const setStoredVisibility = (0,hooks_namespaceObject.useCallback)(state => {
15235
- const saved = get ? get(key) : {};
15236
- set(key, use_seamly_stored_visibility_objectSpread(use_seamly_stored_visibility_objectSpread({}, saved), {}, {
15237
- [layoutMode]: state
15238
- }));
15239
- }, [set, get, layoutMode]);
15240
- return [layoutMode ? storedVisibilityObj[layoutMode] : null, set && layoutMode ? setStoredVisibility : null];
15241
- };
15242
-
15243
- /* harmony default export */ const use_seamly_stored_visibility = (useSeamlyStoredVisibility);
15244
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-visibility.js
15245
-
15246
-
15247
-
15248
-
15249
-
15250
-
15251
-
15252
-
15253
-
15254
- const {
15255
- SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
15256
- } = seamlyActions;
15257
-
15258
- const useSeamlyVisibility = () => {
15259
- const config = useConfig();
15260
- const {
15261
- layoutMode,
15262
- visibilityCallback
15263
- } = config;
15264
- const {
15265
- visible
15266
- } = useSeamlyStateContext();
15267
- const {
15268
- emitEvent
15269
- } = use_seamly_commands();
15270
- const dispatch = use_seamly_dispatch();
15271
- const [storedVisibility, setStoredVisibility] = use_seamly_stored_visibility();
15272
- const hasResponded = useUserHasResponded();
15273
- const hasConversation = useSeamlyHasConversation();
15274
- const unreadMessageCount = useSeamlyUnreadCount();
15275
- const isVisible = visible ? visible !== visibilityStates.hidden : false;
15276
- const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
15277
- const setVisibility = (0,hooks_namespaceObject.useCallback)(visibility => {
15278
- const visibilityFn = visibilityCallback || calculateVisibility;
15279
- const requestedVisibility = visibilityFn({
15280
- hasConversation,
15281
- hasResponded,
15282
- previousVisibility: storedVisibility || null,
15283
- requestedVisibility: visibility,
15284
- config
15285
- });
15286
-
15287
- if (![visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden].includes(requestedVisibility)) {
15288
- console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
15289
- return;
15290
- }
15291
-
15292
- if (requestedVisibility !== visible) {
15293
- if (setStoredVisibility) {
15294
- setStoredVisibility(requestedVisibility);
15295
- } // Don't broadcast the init visibility state
15296
-
15297
-
15298
- if (visibility) {
15299
- emitEvent('ui.visible', requestedVisibility, {
15300
- visibility: requestedVisibility,
15301
- hasConversation,
15302
- hasResponded,
15303
- unreadMessageCount
15304
- });
15305
- }
15306
-
15307
- dispatch({
15308
- type: use_seamly_visibility_SET_VISIBILITY,
15309
- visible: requestedVisibility
15310
- });
15311
- }
15312
- }, [visible, emitEvent, dispatch, hasConversation, hasResponded, storedVisibility, visibilityCallback, config, setStoredVisibility, unreadMessageCount]);
15313
- return {
15314
- isVisible,
15315
- isOpen,
15316
- visible,
15317
- setVisibility
15318
- };
15319
- };
15320
-
15321
- /* harmony default export */ const use_seamly_visibility = (useSeamlyVisibility);
15322
15342
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
15323
15343
 
15324
15344
 
@@ -15340,9 +15360,8 @@ const useSeamlyChat = () => {
15340
15360
  const {
15341
15361
  isOpen,
15342
15362
  isVisible,
15343
- visible,
15344
15363
  setVisibility
15345
- } = use_seamly_visibility();
15364
+ } = useVisibility();
15346
15365
  const dispatch = use_seamly_dispatch();
15347
15366
  const events = useEvents();
15348
15367
  const spinnerTimeout = (0,hooks_namespaceObject.useRef)(null);
@@ -15386,7 +15405,6 @@ const useSeamlyChat = () => {
15386
15405
  prevIsOpen.current = isOpen;
15387
15406
  prevIsVisible.current = isVisible;
15388
15407
  }, [isOpen, isVisible, sendAssertive, t]);
15389
- (0,hooks_namespaceObject.useEffect)(() => {}, [visible, sendAssertive]);
15390
15408
  (0,hooks_namespaceObject.useEffect)(() => {
15391
15409
  // This delays the start of the loading inidicator we set when we initialise
15392
15410
  // the application. This is done to only avoid BSOD on initial load if DCX is slow.
@@ -15484,7 +15502,7 @@ const useSeamlyIdleDetachCountdown = () => {
15484
15502
  } = useSeamlyStateContext();
15485
15503
  const {
15486
15504
  isOpen: isSeamlyOpen
15487
- } = use_seamly_visibility();
15505
+ } = useVisibility();
15488
15506
  const stableState = (0,hooks_namespaceObject.useRef)({});
15489
15507
  stableState.current = {
15490
15508
  hasCountdown: idleDetachCountdown.hasCountdown,
@@ -15683,8 +15701,6 @@ const useSeamlyResumeConversationPrompt = () => {
15683
15701
 
15684
15702
 
15685
15703
 
15686
-
15687
-
15688
15704
  // This hook isn't used within the core
15689
15705
  // But it is used in implementations
15690
15706
  // and imported directly from this file
@@ -15830,7 +15846,7 @@ const ModalWrapper = ({
15830
15846
  const {
15831
15847
  isOpen,
15832
15848
  setVisibility
15833
- } = use_seamly_visibility();
15849
+ } = useVisibility();
15834
15850
  const container = (0,hooks_namespaceObject.useRef)(null);
15835
15851
  const focusTrap = (0,hooks_namespaceObject.useRef)(null);
15836
15852
 
@@ -16009,19 +16025,19 @@ const Icon = ({
16009
16025
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
16010
16026
 
16011
16027
  const {
16012
- createActions: utils_createActions,
16028
+ createActions: translations_utils_createActions,
16013
16029
  createReducer: translations_utils_createReducer,
16014
16030
  selectState: translations_utils_selectState
16015
16031
  } = createDomain('translations');
16016
16032
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
16017
16033
 
16018
- const [enable, disable] = utils_createActions('translate', {
16034
+ const [enable, disable] = translations_utils_createActions('translate', {
16019
16035
  enable: locale => ({
16020
16036
  locale
16021
16037
  }),
16022
16038
  disable: () => ({})
16023
16039
  });
16024
- const [enableEvent, disableEvent] = utils_createActions('event', {
16040
+ const [enableEvent, disableEvent] = translations_utils_createActions('event', {
16025
16041
  enable: payloadId => ({
16026
16042
  payloadId
16027
16043
  }),
@@ -17588,7 +17604,7 @@ const AppFrame = ({
17588
17604
  isOpen,
17589
17605
  isVisible,
17590
17606
  setVisibility
17591
- } = use_seamly_visibility();
17607
+ } = useVisibility();
17592
17608
  const {
17593
17609
  zIndex,
17594
17610
  showFaq
@@ -18314,7 +18330,7 @@ function ChatFrame({
18314
18330
  } = useInterrupt();
18315
18331
  const {
18316
18332
  isOpen
18317
- } = use_seamly_visibility();
18333
+ } = useVisibility();
18318
18334
 
18319
18335
  const getContent = () => {
18320
18336
  if (hasInterrupt) {
@@ -18346,6 +18362,7 @@ function ChatFrame({
18346
18362
 
18347
18363
 
18348
18364
 
18365
+
18349
18366
  const ToggleButton = ({
18350
18367
  onOpenChat
18351
18368
  }) => {
@@ -18355,7 +18372,7 @@ const ToggleButton = ({
18355
18372
  const titleId = useGeneratedId();
18356
18373
  const {
18357
18374
  isOpen
18358
- } = use_seamly_visibility();
18375
+ } = useVisibility();
18359
18376
  const prevIsOpen = (0,hooks_namespaceObject.useRef)(null);
18360
18377
  const buttonRef = (0,hooks_namespaceObject.useRef)(null);
18361
18378
  const lastEventRef = (0,hooks_namespaceObject.useRef)();
@@ -18436,6 +18453,7 @@ const ToggleButton = ({
18436
18453
 
18437
18454
 
18438
18455
 
18456
+
18439
18457
  const AgentInfo = () => {
18440
18458
  const {
18441
18459
  t
@@ -18447,7 +18465,7 @@ const AgentInfo = () => {
18447
18465
  const unreadMessageCount = useSeamlyUnreadCount();
18448
18466
  const {
18449
18467
  isOpen
18450
- } = use_seamly_visibility();
18468
+ } = useVisibility();
18451
18469
  const currentAgent = useSeamlyCurrentAgent();
18452
18470
  const {
18453
18471
  hasInterrupt
@@ -19926,7 +19944,6 @@ mustache.Writer = Writer;
19926
19944
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js
19927
19945
 
19928
19946
 
19929
-
19930
19947
  mustache_mustache.escape = function (escapeText) {
19931
19948
  return escapeText;
19932
19949
  };
@@ -19935,7 +19952,7 @@ const parseLinkVariable = variable => {
19935
19952
  return `<a href='${variable.url}' data-link-id='${variable.id}' ${variable.newTab ? 'target="_blank"' : ''}>${variable.name}</a>`;
19936
19953
  };
19937
19954
 
19938
- function parseRichtText(text, variables = {}) {
19955
+ function parseRichText(text, variables = {}) {
19939
19956
  const view = {};
19940
19957
  Object.entries(variables).forEach(([key, variable]) => {
19941
19958
  switch (variable.type) {
@@ -19959,15 +19976,6 @@ function parseRichtText(text, variables = {}) {
19959
19976
  mustache_mustache.escape = oldEscape;
19960
19977
  return output;
19961
19978
  }
19962
-
19963
- const useTextRendering = ({
19964
- text,
19965
- variables = {}
19966
- }) => {
19967
- return (0,hooks_namespaceObject.useMemo)(() => parseRichtText(text, variables), [text, variables]);
19968
- };
19969
-
19970
- /* harmony default export */ const use_text_rendering = (useTextRendering);
19971
19979
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/text.js
19972
19980
  const text_excluded = ["event"];
19973
19981
 
@@ -19988,32 +19996,37 @@ function text_objectWithoutPropertiesLoose(source, excluded) { if (source == nul
19988
19996
 
19989
19997
 
19990
19998
 
19999
+
19991
20000
  const Text = _ref => {
19992
20001
  let {
19993
20002
  event
19994
20003
  } = _ref,
19995
20004
  props = text_objectWithoutProperties(_ref, text_excluded);
19996
20005
 
19997
- const {
19998
- payload
19999
- } = event;
20000
20006
  const [body] = useTranslatedEventData(event);
20001
- const eventClick = use_event_link_click_handler(payload.id);
20002
- const eventBody = use_text_rendering({
20003
- text: parse_body(body.text),
20004
- variables: body.variables
20005
- });
20007
+ const eventClick = use_event_link_click_handler(event.payload.id);
20008
+ const containerProps = (0,hooks_namespaceObject.useMemo)(() => {
20009
+ if (!event.payload.fromClient) {
20010
+ return {
20011
+ bodyProps: {
20012
+ dangerouslySetInnerHTML: {
20013
+ __html: parseRichText(parse_body(body.text), body.variables)
20014
+ }
20015
+ }
20016
+ };
20017
+ }
20018
+
20019
+ return {
20020
+ children: (0,jsx_runtime_namespaceObject.jsx)("p", {
20021
+ children: body.text
20022
+ })
20023
+ };
20024
+ }, [body, event]);
20006
20025
  return (0,jsx_runtime_namespaceObject.jsx)(message_container, text_objectSpread(text_objectSpread({
20007
20026
  type: "text",
20008
20027
  event: event,
20009
20028
  onClick: eventClick
20010
- }, props), {}, {
20011
- bodyProps: {
20012
- dangerouslySetInnerHTML: {
20013
- __html: eventBody
20014
- }
20015
- }
20016
- }));
20029
+ }, props), containerProps));
20017
20030
  };
20018
20031
 
20019
20032
  /* harmony default export */ const event_text = (Text);
@@ -21187,6 +21200,7 @@ const PrivacyDisclaimer = () => {
21187
21200
 
21188
21201
 
21189
21202
 
21203
+
21190
21204
  const Conversation = () => {
21191
21205
  const {
21192
21206
  t
@@ -21196,7 +21210,7 @@ const Conversation = () => {
21196
21210
  const isLoading = useSeamlyIsLoading();
21197
21211
  const {
21198
21212
  isOpen
21199
- } = use_seamly_visibility();
21213
+ } = useVisibility();
21200
21214
  const skiplinkTargetId = useSkiplink();
21201
21215
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
21202
21216
  (0,hooks_namespaceObject.useEffect)(() => {
@@ -22285,10 +22299,11 @@ const Interrupt = ({
22285
22299
 
22286
22300
 
22287
22301
 
22302
+
22288
22303
  const View = () => {
22289
22304
  const {
22290
22305
  isVisible
22291
- } = use_seamly_visibility();
22306
+ } = useVisibility();
22292
22307
  const {
22293
22308
  openChat,
22294
22309
  closeChat
@@ -22351,7 +22366,7 @@ const SeamlyInstanceFunctionsLoader = () => {
22351
22366
  const {
22352
22367
  setVisibility,
22353
22368
  visible
22354
- } = use_seamly_visibility();
22369
+ } = useVisibility();
22355
22370
  const currentVisibility = (0,hooks_namespaceObject.useRef)(visible);
22356
22371
  const eventBus = (0,hooks_namespaceObject.useContext)(SeamlyEventBusContext);
22357
22372
  const api = useSeamlyApiContext();
@@ -22475,6 +22490,7 @@ const SeamlyInstanceFunctionsLoader = () => {
22475
22490
 
22476
22491
 
22477
22492
 
22493
+
22478
22494
  const {
22479
22495
  SET_EVENTS_READ: seamly_read_state_SET_EVENTS_READ
22480
22496
  } = seamlyActions;
@@ -22488,7 +22504,7 @@ const SeamlyReadState = () => {
22488
22504
  const {
22489
22505
  isOpen,
22490
22506
  isVisible
22491
- } = use_seamly_visibility();
22507
+ } = useVisibility();
22492
22508
  const {
22493
22509
  sendAction
22494
22510
  } = use_seamly_commands();
@@ -22543,6 +22559,7 @@ const SeamlyReadState = () => {
22543
22559
 
22544
22560
 
22545
22561
 
22562
+
22546
22563
  const SeamlyNewNotifications = () => {
22547
22564
  const {
22548
22565
  t
@@ -22556,7 +22573,7 @@ const SeamlyNewNotifications = () => {
22556
22573
  } = useLiveRegion();
22557
22574
  const {
22558
22575
  isOpen
22559
- } = use_seamly_visibility();
22576
+ } = useVisibility();
22560
22577
  const prevIsOpen = (0,hooks_namespaceObject.useRef)(null);
22561
22578
  const debounceFunc = (0,hooks_namespaceObject.useRef)(null);
22562
22579
  const notifyUnread = (0,hooks_namespaceObject.useMemo)(() => {
@@ -22771,23 +22788,18 @@ const SeamlyActivityMonitor = ({
22771
22788
 
22772
22789
 
22773
22790
 
22774
-
22775
22791
  const SeamlyInitializer = () => {
22776
22792
  const {
22777
22793
  initUserSelectedOptions
22778
22794
  } = useSeamlyOptions();
22779
22795
  const seamlyInitialized = (0,hooks_namespaceObject.useRef)(false);
22780
- const {
22781
- setVisibility
22782
- } = use_seamly_visibility();
22783
22796
  const config = useConfig();
22784
22797
  (0,hooks_namespaceObject.useEffect)(() => {
22785
22798
  if (config.api && !seamlyInitialized.current) {
22786
22799
  seamlyInitialized.current = true;
22787
22800
  initUserSelectedOptions();
22788
- setVisibility(visibilityStates.initialize);
22789
22801
  }
22790
- }, [initUserSelectedOptions, config, setVisibility]);
22802
+ }, [initUserSelectedOptions, config]);
22791
22803
  return null;
22792
22804
  };
22793
22805
 
@@ -23019,18 +23031,18 @@ const SeamlyEventSubscriber = ({
23019
23031
  case 'error':
23020
23032
  switch (payload.type) {
23021
23033
  case 'find_conversation_erred':
23022
- dispatch(set(new SeamlySessionExpiredError()));
23034
+ dispatch(set(new SeamlySessionExpiredError(event)));
23023
23035
  break;
23024
23036
 
23025
23037
  case 'seamly_offline':
23026
- dispatch(set(new SeamlyOfflineError()));
23038
+ dispatch(set(new SeamlyOfflineError(event)));
23027
23039
  dispatch({
23028
23040
  type: seamly_event_subscriber_CLEAR_EVENTS
23029
23041
  });
23030
23042
  break;
23031
23043
 
23032
23044
  default:
23033
- dispatch(set(new SeamlyGeneralError()));
23045
+ dispatch(set(new SeamlyGeneralError(event)));
23034
23046
  break;
23035
23047
  }
23036
23048
 
@@ -23200,6 +23212,53 @@ const SeamlyFileUpload = ({
23200
23212
  };
23201
23213
 
23202
23214
  /* harmony default export */ const seamly_file_upload = (SeamlyFileUpload);
23215
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/errors/index.js
23216
+
23217
+
23218
+ const {
23219
+ createAction: errors_createAction
23220
+ } = createDomain('errors');
23221
+ const catchError = errors_createAction('catch-error', error => ({
23222
+ error
23223
+ }));
23224
+ function errors_createMiddleware({
23225
+ api: seamlyApi
23226
+ }) {
23227
+ return ({
23228
+ getState
23229
+ }) => {
23230
+ const handleError = action => {
23231
+ const {
23232
+ errorCallback,
23233
+ namespace,
23234
+ api,
23235
+ layoutMode
23236
+ } = selectConfig(getState());
23237
+ errorCallback === null || errorCallback === void 0 ? void 0 : errorCallback(action.error, {
23238
+ namespace,
23239
+ api,
23240
+ layoutMode,
23241
+ conversationUrl: seamlyApi.getConversationUrl(),
23242
+ action: action.type ? action : undefined
23243
+ });
23244
+ };
23245
+
23246
+ return next => action => {
23247
+ try {
23248
+ if (action.error) {
23249
+ handleError(action);
23250
+ }
23251
+
23252
+ return next(action);
23253
+ } catch (error) {
23254
+ handleError({
23255
+ error
23256
+ });
23257
+ throw error;
23258
+ }
23259
+ };
23260
+ };
23261
+ }
23203
23262
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-core.js
23204
23263
 
23205
23264
 
@@ -23215,6 +23274,8 @@ const SeamlyFileUpload = ({
23215
23274
 
23216
23275
 
23217
23276
 
23277
+
23278
+
23218
23279
  const SeamlyCore = ({
23219
23280
  store,
23220
23281
  children,
@@ -23222,6 +23283,7 @@ const SeamlyCore = ({
23222
23283
  eventBus,
23223
23284
  api
23224
23285
  }) => {
23286
+ (0,hooks_namespaceObject.useErrorBoundary)(error => store.dispatch(catchError(error)));
23225
23287
  return (0,jsx_runtime_namespaceObject.jsx)(StoreProvider, {
23226
23288
  store: store,
23227
23289
  children: (0,jsx_runtime_namespaceObject.jsx)(SeamlyEventBusContext.Provider, {
@@ -24717,7 +24779,8 @@ class ConversationProducer {
24717
24779
  this.emit({
24718
24780
  type: 'error',
24719
24781
  payload: {
24720
- type: 'seamly_offline'
24782
+ type: 'seamly_offline',
24783
+ error: err
24721
24784
  }
24722
24785
  });
24723
24786
  });
@@ -24789,7 +24852,8 @@ class ConversationProducer {
24789
24852
  this.emit({
24790
24853
  type: 'error',
24791
24854
  payload: {
24792
- type: 'join_channel_erred'
24855
+ type: 'join_channel_erred',
24856
+ error: err
24793
24857
  }
24794
24858
  });
24795
24859
  this.emit({
@@ -25098,7 +25162,6 @@ class API {
25098
25162
  }) // withCredentials() is necessary to allow browsers to save received
25099
25163
  // cookies in CORS requests.
25100
25164
  .withCredentials().send({
25101
- authorizationRequired: true,
25102
25165
  externalId: this.externalId || undefined
25103
25166
  });
25104
25167
  const {
@@ -25119,7 +25182,7 @@ class API {
25119
25182
  return initialState;
25120
25183
  } catch (error) {
25121
25184
  if (error.status >= 500) {
25122
- throw new SeamlyGeneralError();
25185
+ throw new SeamlyGeneralError(error);
25123
25186
  }
25124
25187
 
25125
25188
  throw error;
@@ -25165,15 +25228,15 @@ class API {
25165
25228
  };
25166
25229
  } catch (error) {
25167
25230
  if (error.status === 401) {
25168
- throw new SeamlyUnauthorizedError();
25231
+ throw new SeamlyUnauthorizedError(error);
25169
25232
  }
25170
25233
 
25171
25234
  if (error.status === 404) {
25172
- throw new SeamlySessionExpiredError();
25235
+ throw new SeamlySessionExpiredError(error);
25173
25236
  }
25174
25237
 
25175
25238
  if (error.status >= 500) {
25176
- throw new SeamlyGeneralError();
25239
+ throw new SeamlyGeneralError(error);
25177
25240
  }
25178
25241
 
25179
25242
  throw error;
@@ -25238,11 +25301,11 @@ class API {
25238
25301
  return body.config;
25239
25302
  }).catch(error => {
25240
25303
  if (error.status === 404) {
25241
- throw new SeamlyConfigurationError();
25304
+ throw new SeamlyConfigurationError(error);
25242
25305
  }
25243
25306
 
25244
25307
  if (error.status >= 500) {
25245
- throw new SeamlyGeneralError();
25308
+ throw new SeamlyGeneralError(error);
25246
25309
  }
25247
25310
 
25248
25311
  throw error;
@@ -25259,15 +25322,15 @@ class API {
25259
25322
  return omit(body.conversation, ['accessToken', 'channelName']);
25260
25323
  }).catch(error => {
25261
25324
  if (error.status === 401) {
25262
- throw new SeamlyUnauthorizedError();
25325
+ throw new SeamlyUnauthorizedError(error);
25263
25326
  }
25264
25327
 
25265
25328
  if (error.status === 404) {
25266
- throw new SeamlySessionExpiredError();
25329
+ throw new SeamlySessionExpiredError(error);
25267
25330
  }
25268
25331
 
25269
25332
  if (error.status >= 500) {
25270
- throw new SeamlyGeneralError();
25333
+ throw new SeamlyGeneralError(error);
25271
25334
  }
25272
25335
 
25273
25336
  throw error;
@@ -25290,7 +25353,7 @@ class API {
25290
25353
  return body.translations;
25291
25354
  } catch (error) {
25292
25355
  if (error.status >= 500) {
25293
- throw new SeamlyGeneralError();
25356
+ throw new SeamlyGeneralError(error);
25294
25357
  }
25295
25358
 
25296
25359
  throw error;
@@ -25416,9 +25479,16 @@ function options_middleware_createMiddleware({
25416
25479
  ;// CONCATENATED MODULE: ./src/javascripts/domains/options/index.js
25417
25480
 
25418
25481
  ;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
25482
+ function state_reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
25483
+
25484
+ function state_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { state_reducer_ownKeys(Object(source), true).forEach(function (key) { state_reducer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { state_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25485
+
25486
+ function state_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25487
+
25419
25488
  // Legacy state reducer. Do not add new features here but extract/create new reducers as needed
25420
25489
 
25421
25490
 
25491
+
25422
25492
  const state_reducer_initialState = {
25423
25493
  events: [],
25424
25494
  initialState: {},
@@ -25429,7 +25499,6 @@ const state_reducer_initialState = {
25429
25499
  isActive: false
25430
25500
  },
25431
25501
  resumeConversationPrompt: false,
25432
- visible: visibilityStates.hidden,
25433
25502
  serviceInfo: {
25434
25503
  activeServiceSessionId: ''
25435
25504
  },
@@ -25466,6 +25535,15 @@ const state_reducer_initialState = {
25466
25535
  seamlyContainerElement: null
25467
25536
  };
25468
25537
  function stateReducer(state = state_reducer_initialState, action) {
25538
+ if (action.type === String(actions_reset)) {
25539
+ const {
25540
+ visible
25541
+ } = state;
25542
+ return state_reducer_objectSpread(state_reducer_objectSpread({}, state_reducer_initialState), {}, {
25543
+ visible
25544
+ });
25545
+ }
25546
+
25469
25547
  return seamlyStateReducer(state, action);
25470
25548
  }
25471
25549
  ;// CONCATENATED MODULE: ./src/javascripts/domains/store/index.js
@@ -25479,9 +25557,12 @@ function stateReducer(state = state_reducer_initialState, action) {
25479
25557
 
25480
25558
 
25481
25559
 
25560
+
25561
+
25482
25562
  function store_createStore({
25483
25563
  initialState,
25484
- api
25564
+ api,
25565
+ eventBus
25485
25566
  } = {}) {
25486
25567
  const store = createReduxStore({
25487
25568
  reducers: {
@@ -25491,11 +25572,15 @@ function store_createStore({
25491
25572
  [String(forms_reducer)]: forms_reducer,
25492
25573
  [String(translations_reducer)]: translations_reducer,
25493
25574
  [String(i18n_reducer)]: i18n_reducer,
25494
- [String(interrupt_reducer)]: interrupt_reducer
25575
+ [String(interrupt_reducer)]: interrupt_reducer,
25576
+ [String(visibility_reducer)]: visibility_reducer
25495
25577
  },
25496
25578
  initialState,
25497
- middlewares: [es.withExtraArgument({
25579
+ middlewares: [errors_createMiddleware({
25498
25580
  api
25581
+ }), es.withExtraArgument({
25582
+ api,
25583
+ eventBus
25499
25584
  }), createMiddleware(), middleware_createMiddleware({
25500
25585
  api
25501
25586
  }), options_middleware_createMiddleware({
@@ -25571,9 +25656,10 @@ class Engine {
25571
25656
  });
25572
25657
 
25573
25658
  const store = store_createStore({
25574
- api: this.api
25659
+ api: this.api,
25660
+ eventBus: this.eventBus
25575
25661
  });
25576
- await store.dispatch(actions_initialize(renderConfig));
25662
+ await store.dispatch(app_actions_initialize(renderConfig));
25577
25663
 
25578
25664
  if (View) {
25579
25665
  (0,external_preact_namespaceObject.render)((0,jsx_runtime_namespaceObject.jsx)(seamly_core, {
@@ -25893,12 +25979,6 @@ function initializeExternalApi(appConfig) {
25893
25979
 
25894
25980
  // Used by: StyleGuide
25895
25981
 
25896
- // Used by: StyleGuide
25897
-
25898
- // Used by: StyleGuide
25899
-
25900
- // Used by: StyleGuide
25901
-
25902
25982
 
25903
25983
  })();
25904
25984