@seamly/web-ui 19.0.0-beta.3 → 19.1.2

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 (64) hide show
  1. package/build/dist/lib/index.debug.js +149 -61
  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 +494 -416
  5. package/build/dist/lib/index.min.js +1 -1
  6. package/build/dist/lib/standalone.js +582 -435
  7. package/build/dist/lib/standalone.min.js +1 -1
  8. package/build/dist/lib/style-guide.js +1880 -1795
  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 +10 -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/domains/app/actions.js +27 -17
  20. package/src/javascripts/domains/app/index.js +2 -1
  21. package/src/javascripts/domains/config/reducer.js +1 -0
  22. package/src/javascripts/domains/config/selectors.js +1 -1
  23. package/src/javascripts/domains/errors/index.js +32 -0
  24. package/src/javascripts/domains/i18n/reducer.js +6 -0
  25. package/src/javascripts/domains/interrupt/middleware.js +12 -9
  26. package/src/javascripts/domains/interrupt/reducer.js +10 -9
  27. package/src/javascripts/domains/store/index.js +7 -2
  28. package/src/javascripts/domains/store/state-reducer.js +10 -6
  29. package/src/javascripts/domains/visibility/actions.js +73 -0
  30. package/src/javascripts/domains/visibility/constants.js +8 -0
  31. package/src/javascripts/domains/visibility/hooks.js +24 -0
  32. package/src/javascripts/domains/visibility/index.js +8 -0
  33. package/src/javascripts/domains/visibility/reducer.js +19 -0
  34. package/src/javascripts/domains/visibility/selectors.js +9 -0
  35. package/src/javascripts/domains/visibility/utils.js +42 -0
  36. package/src/javascripts/index.js +3 -12
  37. package/src/javascripts/lib/engine/index.js +1 -0
  38. package/src/javascripts/lib/redux-helpers/index.js +1 -5
  39. package/src/javascripts/style-guide/components/app.js +1 -1
  40. package/src/javascripts/style-guide/components/static-core.js +13 -0
  41. package/src/javascripts/style-guide/states.js +48 -21
  42. package/src/javascripts/ui/components/conversation/conversation.js +2 -2
  43. package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +1 -8
  44. package/src/javascripts/ui/components/conversation/event/text.js +19 -13
  45. package/src/javascripts/ui/components/core/seamly-core.js +3 -0
  46. package/src/javascripts/ui/components/core/seamly-event-subscriber.js +3 -3
  47. package/src/javascripts/ui/components/core/seamly-initializer.js +2 -6
  48. package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +2 -3
  49. package/src/javascripts/ui/components/core/seamly-new-notifications.js +2 -2
  50. package/src/javascripts/ui/components/core/seamly-read-state.js +2 -2
  51. package/src/javascripts/ui/components/entry/toggle-button.js +2 -2
  52. package/src/javascripts/ui/components/layout/agent-info.js +2 -2
  53. package/src/javascripts/ui/components/layout/app-frame.js +2 -3
  54. package/src/javascripts/ui/components/layout/chat-frame.js +2 -2
  55. package/src/javascripts/ui/components/layout/modal-wrapper.js +3 -6
  56. package/src/javascripts/ui/components/layout/view.js +3 -6
  57. package/src/javascripts/ui/hooks/seamly-hooks.js +0 -2
  58. package/src/javascripts/ui/hooks/use-seamly-chat.js +3 -5
  59. package/src/javascripts/ui/hooks/use-seamly-commands.js +7 -29
  60. package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +2 -2
  61. package/src/javascripts/ui/utils/general-utils.js +0 -9
  62. package/src/javascripts/ui/utils/seamly-utils.js +0 -66
  63. package/src/javascripts/ui/hooks/use-seamly-stored-visibility.js +0 -31
  64. 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,24 @@ 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));
14553
14497
  }
14554
14498
 
14499
+ this.originalError = originalError;
14500
+ }
14501
+
14502
+ }
14503
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
14504
+
14505
+ class SeamlyGeneralError extends SeamlyBaseError {
14506
+ constructor(originalError, ...params) {
14507
+ super(originalError, ...params);
14555
14508
  this.name = 'SeamlyGeneralError';
14556
14509
  this.langKey = 'errors.general';
14557
14510
  this.action = 'reset';
@@ -14559,59 +14512,62 @@ class SeamlyGeneralError extends Error {
14559
14512
 
14560
14513
  }
14561
14514
  ;// 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
14515
 
14516
+ class SeamlyConfigurationError extends SeamlyBaseError {
14517
+ constructor(originalError, ...params) {
14518
+ super(originalError, ...params);
14570
14519
  this.name = 'SeamlyConfigurationError';
14571
14520
  this.langKey = 'errors.configError';
14572
14521
  }
14573
14522
 
14574
14523
  }
14575
14524
  ;// 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
14525
 
14526
+ class SeamlySessionExpiredError extends SeamlyBaseError {
14527
+ constructor(originalError, ...params) {
14528
+ super(originalError, ...params);
14584
14529
  this.name = 'SeamlySessionExpiredError';
14585
14530
  this.action = 'reset';
14586
14531
  }
14587
14532
 
14588
14533
  }
14589
14534
  ;// 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
14535
 
14536
+ class SeamlyOfflineError extends SeamlyBaseError {
14537
+ constructor(originalError, ...params) {
14538
+ super(originalError, ...params);
14598
14539
  this.name = 'SeamlyOfflineError';
14599
14540
  this.langKey = 'errors.seamlyOffline';
14600
14541
  }
14601
14542
 
14602
14543
  }
14603
14544
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unauthorized-error.js
14604
- class SeamlyUnauthorizedError extends Error {
14545
+
14546
+ class SeamlyUnauthorizedError extends SeamlyBaseError {
14547
+ constructor(originalError, ...params) {
14548
+ super(originalError, ...params);
14549
+ this.name = 'SeamlyUnauthorizedError';
14550
+ this.langKey = 'errors.general';
14551
+ this.action = 'reset';
14552
+ }
14553
+
14554
+ }
14555
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unavailable-error.js
14556
+ /**
14557
+ * This error is used to alert the user that there's a problem with the connection
14558
+ * when initialising the application because of a connection issue on either the server
14559
+ * or the client side.
14560
+ */
14561
+ class SeamlyUnavailableError extends Error {
14605
14562
  constructor(params) {
14606
14563
  super(params);
14607
14564
 
14608
14565
  if (Error.captureStackTrace) {
14609
- Error.captureStackTrace(this, SeamlyUnauthorizedError);
14566
+ Error.captureStackTrace(this, SeamlyUnavailableError);
14610
14567
  }
14611
14568
 
14612
- this.name = 'SeamlyUnauthorizedError';
14613
- this.langKey = 'errors.general';
14614
- this.action = 'reset';
14569
+ this.name = 'SeamlyUnavailableError';
14570
+ this.langKey = 'errors.seamlyUnavailable';
14615
14571
  }
14616
14572
 
14617
14573
  }
@@ -14622,76 +14578,192 @@ class SeamlyUnauthorizedError extends Error {
14622
14578
 
14623
14579
 
14624
14580
 
14625
- const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError];
14626
- function middleware_createMiddleware() {
14581
+ const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
14582
+ function middleware_createMiddleware({
14583
+ api
14584
+ }) {
14627
14585
  return () => next => action => {
14628
- if (action.type === String(set)) {
14629
- if (!handledErrorTypes.some(ErrorType => action.error instanceof ErrorType)) {
14630
- throw action.error;
14586
+ const {
14587
+ error
14588
+ } = action;
14589
+
14590
+ if (error) {
14591
+ if (!handledErrorTypes.some(ErrorType => error instanceof ErrorType)) {
14592
+ throw error;
14593
+ } else if (error.action === 'reset') {
14594
+ // [SMLY-942] We clear the store before a reset to force a new conversation if the page is refreshed before the conversation is reset
14595
+ api.disconnect().then(() => {
14596
+ api.clearStore();
14597
+ });
14631
14598
  }
14632
14599
  }
14633
14600
 
14634
14601
  return next(action);
14635
14602
  };
14636
14603
  }
14637
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
14638
- 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; }
14604
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
14639
14605
 
14640
- 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; }
14606
+ const {
14607
+ createAction: app_utils_createAction,
14608
+ createThunk: app_utils_createThunk,
14609
+ createReducer: app_utils_createReducer,
14610
+ selectState: app_utils_selectState
14611
+ } = createDomain('app');
14612
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
14641
14613
 
14642
- 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; }
14643
14614
 
14615
+ const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
14644
14616
 
14617
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/utils.js
14645
14618
 
14646
- const reducer_initialState = {
14647
- error: undefined
14619
+
14620
+ const {
14621
+ createAction: visibility_utils_createAction,
14622
+ createActions: utils_createActions,
14623
+ createThunk: visibility_utils_createThunk,
14624
+ createReducer: visibility_utils_createReducer,
14625
+ selectState: visibility_utils_selectState
14626
+ } = createDomain('visibility');
14627
+ const calculateVisibility = ({
14628
+ hasResponded,
14629
+ previousVisibility,
14630
+ requestedVisibility,
14631
+ config
14632
+ }) => {
14633
+ const {
14634
+ defaults,
14635
+ layoutMode,
14636
+ hideOnNoUserResponse
14637
+ } = config;
14638
+ const {
14639
+ visible: defaultVisibility
14640
+ } = defaults || {}; // Requesting open should override the responded check.
14641
+
14642
+ if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
14643
+ return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
14644
+ }
14645
+
14646
+ const baseVisibility = layoutMode === 'inline' ? visibilityStates.open : visibilityStates.minimized;
14647
+ return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
14648
14648
  };
14649
- /* harmony default export */ const interrupt_reducer = (interrupt_utils_createReducer({
14650
- [set]: (state, {
14651
- error
14652
- }) => {
14653
- return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
14654
- error
14655
- });
14656
- },
14657
- [clear]: () => {
14658
- return reducer_initialState;
14649
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/selectors.js
14650
+
14651
+
14652
+ const selectVisibility = createSelector(visibility_utils_selectState, state => state.visibility);
14653
+
14654
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/actions.js
14655
+ 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; }
14656
+
14657
+ 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; }
14658
+
14659
+ 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; }
14660
+
14661
+
14662
+
14663
+
14664
+
14665
+
14666
+
14667
+ const setFromStorage = visibility_utils_createAction('setFromStorage', visibility => ({
14668
+ visibility
14669
+ }));
14670
+ const validVisibilityStates = [visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden];
14671
+ const actions_setVisibility = visibility_utils_createThunk('set', (requestedVisibility, {
14672
+ getState,
14673
+ extra: {
14674
+ api,
14675
+ eventBus
14659
14676
  }
14660
- }, reducer_initialState));
14661
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
14677
+ }) => {
14678
+ const state = getState();
14679
+ const previousVisibility = selectVisibility(state);
14680
+ const hasResponded = selectUserHasResponded(state);
14681
+ const hasConversation = api.hasConversation();
14682
+ const config = selectConfig(state);
14683
+ const {
14684
+ visibilityCallback = calculateVisibility,
14685
+ layoutMode
14686
+ } = config;
14687
+ const {
14688
+ unreadEvents: unreadMessageCount
14689
+ } = seamly_state_hooks_selectState(state);
14690
+ const calculatedVisibility = visibilityCallback({
14691
+ hasConversation,
14692
+ hasResponded,
14693
+ previousVisibility,
14694
+ requestedVisibility,
14695
+ config
14696
+ });
14662
14697
 
14698
+ if (!validVisibilityStates.includes(calculatedVisibility)) {
14699
+ console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
14700
+ return undefined;
14701
+ }
14663
14702
 
14703
+ if (previousVisibility === calculatedVisibility) {
14704
+ return undefined;
14705
+ } // Store the user-requested visibility in order to reinitialize after refresh
14664
14706
 
14665
14707
 
14708
+ api.store.set(StoreKey, actions_objectSpread(actions_objectSpread({}, api.store.get(StoreKey) || {}), {}, {
14709
+ [layoutMode]: requestedVisibility
14710
+ }));
14666
14711
 
14712
+ if (requestedVisibility) {
14713
+ eventBus.emit('ui.visible', requestedVisibility, {
14714
+ visibility: requestedVisibility,
14715
+ hasConversation,
14716
+ hasResponded,
14717
+ unreadMessageCount
14718
+ });
14719
+ }
14667
14720
 
14668
- ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
14721
+ return calculatedVisibility;
14722
+ });
14723
+ const actions_initialize = visibility_utils_createThunk('initialize', async (locale, {
14724
+ dispatch,
14725
+ getState,
14726
+ extra: {
14727
+ api
14728
+ }
14729
+ }) => {
14730
+ var _api$store$get;
14669
14731
 
14670
- const {
14671
- createAction: app_utils_createAction,
14672
- createThunk: app_utils_createThunk,
14673
- createReducer: app_utils_createReducer,
14674
- selectState: app_utils_selectState
14675
- } = createDomain('app');
14732
+ // initialize stored visibility
14733
+ const {
14734
+ layoutMode
14735
+ } = selectConfig(getState());
14736
+ const storedVisibility = (_api$store$get = api.store.get(StoreKey)) === null || _api$store$get === void 0 ? void 0 : _api$store$get[layoutMode];
14737
+
14738
+ if (storedVisibility) {
14739
+ dispatch(setFromStorage(storedVisibility));
14740
+ }
14741
+
14742
+ dispatch(actions_setVisibility(visibilityStates.initialize));
14743
+ });
14676
14744
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
14677
14745
 
14678
14746
 
14679
14747
 
14680
14748
 
14681
14749
 
14750
+
14751
+
14682
14752
  const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
14683
14753
  hasResponded
14684
14754
  }));
14685
- const actions_initialize = app_utils_createThunk('initialize', async (config, {
14755
+ const app_actions_initialize = app_utils_createThunk('initialize', async (config, {
14686
14756
  dispatch,
14687
14757
  extra: {
14688
14758
  api
14689
14759
  }
14690
14760
  }) => {
14691
- try {
14692
- var _config$context;
14761
+ var _config$context;
14693
14762
 
14694
- dispatch(initialize(config));
14763
+ dispatch(initialize(config));
14764
+ let locale = config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale;
14765
+
14766
+ try {
14695
14767
  const {
14696
14768
  features,
14697
14769
  defaultLocale
@@ -14700,38 +14772,39 @@ const actions_initialize = app_utils_createThunk('initialize', async (config, {
14700
14772
  type: seamlyActions.SET_FEATURES,
14701
14773
  features
14702
14774
  });
14703
- let locale = (config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale) || defaultLocale;
14775
+ locale = locale || defaultLocale;
14704
14776
  dispatch(setInitialLocale(locale));
14777
+ } catch (e) {
14778
+ throw new SeamlyUnavailableError();
14779
+ }
14705
14780
 
14706
- try {
14707
- if (api.hasConversation()) {
14708
- var _initialState$transla;
14781
+ try {
14782
+ if (api.hasConversation()) {
14783
+ var _initialState$transla;
14709
14784
 
14710
- const initialState = await api.getConversationIntitialState();
14711
- dispatch({
14712
- type: seamlyActions.SET_INITIAL_STATE,
14713
- initialState
14714
- });
14715
- locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
14785
+ const initialState = await api.getConversationIntitialState();
14786
+ dispatch({
14787
+ type: seamlyActions.SET_INITIAL_STATE,
14788
+ initialState
14789
+ });
14790
+ locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
14716
14791
 
14717
- if ('userResponded' in initialState) {
14718
- dispatch(setHasResponded(initialState.userResponded));
14719
- }
14792
+ if ('userResponded' in initialState) {
14793
+ dispatch(setHasResponded(initialState.userResponded));
14720
14794
  }
14721
- } catch (error) {
14722
- dispatch(set(error));
14795
+ }
14796
+ } catch (e) {
14797
+ if (e instanceof SeamlySessionExpiredError) {
14798
+ throw e;
14723
14799
  }
14724
14800
 
14801
+ throw new SeamlyUnavailableError();
14802
+ } finally {
14725
14803
  await dispatch(setLocale(locale));
14726
- } catch (error) {
14727
- dispatch(set(error));
14804
+ dispatch(actions_initialize());
14728
14805
  }
14729
14806
  });
14730
- ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
14731
-
14732
-
14733
- const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
14734
-
14807
+ const actions_reset = app_utils_createAction('reset', () => {});
14735
14808
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
14736
14809
 
14737
14810
 
@@ -14747,7 +14820,7 @@ function app_reducer_defineProperty(obj, key, value) { if (key in obj) { Object.
14747
14820
 
14748
14821
 
14749
14822
 
14750
- const app_reducer_initialState = {
14823
+ const reducer_initialState = {
14751
14824
  userHasResponded: false
14752
14825
  };
14753
14826
  /* harmony default export */ const app_reducer = (app_utils_createReducer({
@@ -14756,12 +14829,102 @@ const app_reducer_initialState = {
14756
14829
  }) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
14757
14830
  userHasResponded: hasResponded
14758
14831
  })
14759
- }, app_reducer_initialState));
14832
+ }, reducer_initialState));
14760
14833
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
14761
14834
 
14762
14835
 
14763
14836
 
14764
14837
 
14838
+
14839
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
14840
+ 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; }
14841
+
14842
+ 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; }
14843
+
14844
+ 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; }
14845
+
14846
+
14847
+
14848
+
14849
+ const interrupt_reducer_initialState = {
14850
+ error: undefined
14851
+ };
14852
+
14853
+ const handleError = (state, {
14854
+ error
14855
+ }) => interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
14856
+ error
14857
+ });
14858
+
14859
+ /* harmony default export */ const interrupt_reducer = (interrupt_utils_createReducer({
14860
+ [set]: handleError,
14861
+ [app_actions_initialize.rejected]: handleError,
14862
+ [clear]: () => interrupt_reducer_initialState,
14863
+ [actions_reset]: () => interrupt_reducer_initialState
14864
+ }, interrupt_reducer_initialState));
14865
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
14866
+
14867
+
14868
+
14869
+
14870
+
14871
+
14872
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/hooks.js
14873
+
14874
+
14875
+
14876
+
14877
+
14878
+
14879
+ const useVisibility = () => {
14880
+ const dispatch = useStoreDispatch();
14881
+ const visible = useSelector(selectVisibility);
14882
+ const isVisible = visible ? visible !== visibilityStates.hidden : false;
14883
+ const {
14884
+ layoutMode
14885
+ } = useConfig();
14886
+ const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
14887
+ const setVisibility = (0,hooks_namespaceObject.useCallback)(visibility => dispatch(actions_setVisibility(visibility)), [dispatch]);
14888
+ return {
14889
+ isVisible,
14890
+ isOpen,
14891
+ visible,
14892
+ setVisibility
14893
+ };
14894
+ };
14895
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/reducer.js
14896
+ 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; }
14897
+
14898
+ 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; }
14899
+
14900
+ 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; }
14901
+
14902
+
14903
+
14904
+
14905
+ const visibility_reducer_initialState = {
14906
+ visibility: visibilityStates.initialize
14907
+ };
14908
+ /* harmony default export */ const visibility_reducer = (visibility_utils_createReducer({
14909
+ [setFromStorage]: (state, {
14910
+ visibility
14911
+ }) => visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
14912
+ visibility
14913
+ }),
14914
+ [actions_setVisibility.fulfilled]: (state, {
14915
+ payload: visibility
14916
+ }) => visibility ? visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
14917
+ visibility
14918
+ }) : state
14919
+ }, visibility_reducer_initialState));
14920
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/index.js
14921
+
14922
+
14923
+
14924
+
14925
+
14926
+
14927
+
14765
14928
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
14766
14929
  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; }
14767
14930
 
@@ -14784,15 +14947,10 @@ function use_seamly_commands_defineProperty(obj, key, value) { if (key in obj) {
14784
14947
 
14785
14948
  const {
14786
14949
  ADD_EVENT: use_seamly_commands_ADD_EVENT,
14787
- CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
14788
14950
  SET_IS_LOADING: use_seamly_commands_SET_IS_LOADING,
14789
- CLEAR_PARTICIPANTS: use_seamly_commands_CLEAR_PARTICIPANTS,
14790
14951
  SET_HEADER_SUB_TITLE: use_seamly_commands_SET_HEADER_SUB_TITLE,
14791
14952
  SET_INITIAL_STATE: use_seamly_commands_SET_INITIAL_STATE,
14792
- CLEAR_FEATURES: use_seamly_commands_CLEAR_FEATURES,
14793
- SET_FEATURES: use_seamly_commands_SET_FEATURES,
14794
- RESET_UPLOAD_STATE: use_seamly_commands_RESET_UPLOAD_STATE,
14795
- RESET_ENTRY_STATE: use_seamly_commands_RESET_ENTRY_STATE
14953
+ SET_FEATURES: use_seamly_commands_SET_FEATURES
14796
14954
  } = seamlyActions;
14797
14955
 
14798
14956
  const useSeamlyCommands = () => {
@@ -14804,7 +14962,7 @@ const useSeamlyCommands = () => {
14804
14962
  const hasConversation = useSeamlyHasConversation();
14805
14963
  const {
14806
14964
  visible: visibility
14807
- } = useSeamlyStateContext();
14965
+ } = useVisibility();
14808
14966
  const unreadMessageCount = useSeamlyUnreadCount();
14809
14967
  const emitEvent = (0,hooks_namespaceObject.useCallback)((...args) => {
14810
14968
  eventBus.emit(...args);
@@ -14826,26 +14984,12 @@ const useSeamlyCommands = () => {
14826
14984
  });
14827
14985
  }, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
14828
14986
  const reset = (0,hooks_namespaceObject.useCallback)(async () => {
14987
+ dispatch(actions_reset());
14829
14988
  dispatch(clear());
14830
- dispatch({
14831
- type: use_seamly_commands_CLEAR_EVENTS
14832
- });
14833
14989
  dispatch({
14834
14990
  type: use_seamly_commands_SET_IS_LOADING,
14835
14991
  isLoading: true
14836
14992
  });
14837
- dispatch({
14838
- type: use_seamly_commands_CLEAR_PARTICIPANTS
14839
- });
14840
- dispatch({
14841
- type: use_seamly_commands_RESET_UPLOAD_STATE
14842
- });
14843
- dispatch({
14844
- type: use_seamly_commands_RESET_ENTRY_STATE
14845
- });
14846
- dispatch({
14847
- type: use_seamly_commands_CLEAR_FEATURES
14848
- });
14849
14993
  const {
14850
14994
  agentName
14851
14995
  } = appConfig.defaults || {};
@@ -14897,21 +15041,13 @@ const useSeamlyCommands = () => {
14897
15041
 
14898
15042
  const message = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, getTextMessageBase(body)), config);
14899
15043
 
14900
- const sanitizedText = sanitizeText(body);
14901
-
14902
- const sanitizedMessage = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, message), {}, {
14903
- body: {
14904
- text: sanitizedText
14905
- }
14906
- });
14907
-
14908
15044
  api.send('message', message);
14909
15045
  emitEvent('message', message);
14910
15046
  dispatch({
14911
15047
  type: use_seamly_commands_ADD_EVENT,
14912
15048
  event: {
14913
15049
  type: 'message',
14914
- payload: sanitizedMessage
15050
+ payload: message
14915
15051
  }
14916
15052
  });
14917
15053
  }, [api, dispatch, emitEvent, getTextMessageBase]);
@@ -15194,121 +15330,6 @@ const useSeamlyEntry = () => {
15194
15330
  setBlockAutoEntrySwitch
15195
15331
  };
15196
15332
  };
15197
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-stored-visibility.js
15198
- 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; }
15199
-
15200
- 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; }
15201
-
15202
- 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; }
15203
-
15204
-
15205
-
15206
-
15207
-
15208
- const useSeamlyStoredVisibility = () => {
15209
- const {
15210
- layoutMode
15211
- } = useConfig();
15212
- const key = 'visibility';
15213
- const {
15214
- get,
15215
- set
15216
- } = useSeamlyObjectStore();
15217
- let storedVisibilityObj = {};
15218
- const savedVisibility = get ? get(key) : {};
15219
-
15220
- if (savedVisibility) {
15221
- storedVisibilityObj = savedVisibility;
15222
- }
15223
-
15224
- const setStoredVisibility = (0,hooks_namespaceObject.useCallback)(state => {
15225
- const saved = get ? get(key) : {};
15226
- set(key, use_seamly_stored_visibility_objectSpread(use_seamly_stored_visibility_objectSpread({}, saved), {}, {
15227
- [layoutMode]: state
15228
- }));
15229
- }, [set, get, layoutMode]);
15230
- return [layoutMode ? storedVisibilityObj[layoutMode] : null, set && layoutMode ? setStoredVisibility : null];
15231
- };
15232
-
15233
- /* harmony default export */ const use_seamly_stored_visibility = (useSeamlyStoredVisibility);
15234
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-visibility.js
15235
-
15236
-
15237
-
15238
-
15239
-
15240
-
15241
-
15242
-
15243
-
15244
- const {
15245
- SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
15246
- } = seamlyActions;
15247
-
15248
- const useSeamlyVisibility = () => {
15249
- const config = useConfig();
15250
- const {
15251
- layoutMode,
15252
- visibilityCallback
15253
- } = config;
15254
- const {
15255
- visible
15256
- } = useSeamlyStateContext();
15257
- const {
15258
- emitEvent
15259
- } = use_seamly_commands();
15260
- const dispatch = use_seamly_dispatch();
15261
- const [storedVisibility, setStoredVisibility] = use_seamly_stored_visibility();
15262
- const hasResponded = useUserHasResponded();
15263
- const hasConversation = useSeamlyHasConversation();
15264
- const unreadMessageCount = useSeamlyUnreadCount();
15265
- const isVisible = visible ? visible !== visibilityStates.hidden : false;
15266
- const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
15267
- const setVisibility = (0,hooks_namespaceObject.useCallback)(visibility => {
15268
- const visibilityFn = visibilityCallback || calculateVisibility;
15269
- const requestedVisibility = visibilityFn({
15270
- hasConversation,
15271
- hasResponded,
15272
- previousVisibility: storedVisibility || null,
15273
- requestedVisibility: visibility,
15274
- config
15275
- });
15276
-
15277
- if (![visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden].includes(requestedVisibility)) {
15278
- console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
15279
- return;
15280
- }
15281
-
15282
- if (requestedVisibility !== visible) {
15283
- if (setStoredVisibility) {
15284
- setStoredVisibility(requestedVisibility);
15285
- } // Don't broadcast the init visibility state
15286
-
15287
-
15288
- if (visibility) {
15289
- emitEvent('ui.visible', requestedVisibility, {
15290
- visibility: requestedVisibility,
15291
- hasConversation,
15292
- hasResponded,
15293
- unreadMessageCount
15294
- });
15295
- }
15296
-
15297
- dispatch({
15298
- type: use_seamly_visibility_SET_VISIBILITY,
15299
- visible: requestedVisibility
15300
- });
15301
- }
15302
- }, [visible, emitEvent, dispatch, hasConversation, hasResponded, storedVisibility, visibilityCallback, config, setStoredVisibility, unreadMessageCount]);
15303
- return {
15304
- isVisible,
15305
- isOpen,
15306
- visible,
15307
- setVisibility
15308
- };
15309
- };
15310
-
15311
- /* harmony default export */ const use_seamly_visibility = (useSeamlyVisibility);
15312
15333
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
15313
15334
 
15314
15335
 
@@ -15330,9 +15351,8 @@ const useSeamlyChat = () => {
15330
15351
  const {
15331
15352
  isOpen,
15332
15353
  isVisible,
15333
- visible,
15334
15354
  setVisibility
15335
- } = use_seamly_visibility();
15355
+ } = useVisibility();
15336
15356
  const dispatch = use_seamly_dispatch();
15337
15357
  const events = useEvents();
15338
15358
  const spinnerTimeout = (0,hooks_namespaceObject.useRef)(null);
@@ -15376,7 +15396,6 @@ const useSeamlyChat = () => {
15376
15396
  prevIsOpen.current = isOpen;
15377
15397
  prevIsVisible.current = isVisible;
15378
15398
  }, [isOpen, isVisible, sendAssertive, t]);
15379
- (0,hooks_namespaceObject.useEffect)(() => {}, [visible, sendAssertive]);
15380
15399
  (0,hooks_namespaceObject.useEffect)(() => {
15381
15400
  // This delays the start of the loading inidicator we set when we initialise
15382
15401
  // the application. This is done to only avoid BSOD on initial load if DCX is slow.
@@ -15474,7 +15493,7 @@ const useSeamlyIdleDetachCountdown = () => {
15474
15493
  } = useSeamlyStateContext();
15475
15494
  const {
15476
15495
  isOpen: isSeamlyOpen
15477
- } = use_seamly_visibility();
15496
+ } = useVisibility();
15478
15497
  const stableState = (0,hooks_namespaceObject.useRef)({});
15479
15498
  stableState.current = {
15480
15499
  hasCountdown: idleDetachCountdown.hasCountdown,
@@ -15673,8 +15692,6 @@ const useSeamlyResumeConversationPrompt = () => {
15673
15692
 
15674
15693
 
15675
15694
 
15676
-
15677
-
15678
15695
  // This hook isn't used within the core
15679
15696
  // But it is used in implementations
15680
15697
  // and imported directly from this file
@@ -15820,7 +15837,7 @@ const ModalWrapper = ({
15820
15837
  const {
15821
15838
  isOpen,
15822
15839
  setVisibility
15823
- } = use_seamly_visibility();
15840
+ } = useVisibility();
15824
15841
  const container = (0,hooks_namespaceObject.useRef)(null);
15825
15842
  const focusTrap = (0,hooks_namespaceObject.useRef)(null);
15826
15843
 
@@ -15999,19 +16016,19 @@ const Icon = ({
15999
16016
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
16000
16017
 
16001
16018
  const {
16002
- createActions: utils_createActions,
16019
+ createActions: translations_utils_createActions,
16003
16020
  createReducer: translations_utils_createReducer,
16004
16021
  selectState: translations_utils_selectState
16005
16022
  } = createDomain('translations');
16006
16023
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
16007
16024
 
16008
- const [enable, disable] = utils_createActions('translate', {
16025
+ const [enable, disable] = translations_utils_createActions('translate', {
16009
16026
  enable: locale => ({
16010
16027
  locale
16011
16028
  }),
16012
16029
  disable: () => ({})
16013
16030
  });
16014
- const [enableEvent, disableEvent] = utils_createActions('event', {
16031
+ const [enableEvent, disableEvent] = translations_utils_createActions('event', {
16015
16032
  enable: payloadId => ({
16016
16033
  payloadId
16017
16034
  }),
@@ -17578,7 +17595,7 @@ const AppFrame = ({
17578
17595
  isOpen,
17579
17596
  isVisible,
17580
17597
  setVisibility
17581
- } = use_seamly_visibility();
17598
+ } = useVisibility();
17582
17599
  const {
17583
17600
  zIndex,
17584
17601
  showFaq
@@ -18304,7 +18321,7 @@ function ChatFrame({
18304
18321
  } = useInterrupt();
18305
18322
  const {
18306
18323
  isOpen
18307
- } = use_seamly_visibility();
18324
+ } = useVisibility();
18308
18325
 
18309
18326
  const getContent = () => {
18310
18327
  if (hasInterrupt) {
@@ -18336,6 +18353,7 @@ function ChatFrame({
18336
18353
 
18337
18354
 
18338
18355
 
18356
+
18339
18357
  const ToggleButton = ({
18340
18358
  onOpenChat
18341
18359
  }) => {
@@ -18345,7 +18363,7 @@ const ToggleButton = ({
18345
18363
  const titleId = useGeneratedId();
18346
18364
  const {
18347
18365
  isOpen
18348
- } = use_seamly_visibility();
18366
+ } = useVisibility();
18349
18367
  const prevIsOpen = (0,hooks_namespaceObject.useRef)(null);
18350
18368
  const buttonRef = (0,hooks_namespaceObject.useRef)(null);
18351
18369
  const lastEventRef = (0,hooks_namespaceObject.useRef)();
@@ -18426,6 +18444,7 @@ const ToggleButton = ({
18426
18444
 
18427
18445
 
18428
18446
 
18447
+
18429
18448
  const AgentInfo = () => {
18430
18449
  const {
18431
18450
  t
@@ -18437,7 +18456,7 @@ const AgentInfo = () => {
18437
18456
  const unreadMessageCount = useSeamlyUnreadCount();
18438
18457
  const {
18439
18458
  isOpen
18440
- } = use_seamly_visibility();
18459
+ } = useVisibility();
18441
18460
  const currentAgent = useSeamlyCurrentAgent();
18442
18461
  const {
18443
18462
  hasInterrupt
@@ -19916,7 +19935,6 @@ mustache.Writer = Writer;
19916
19935
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js
19917
19936
 
19918
19937
 
19919
-
19920
19938
  mustache_mustache.escape = function (escapeText) {
19921
19939
  return escapeText;
19922
19940
  };
@@ -19925,7 +19943,7 @@ const parseLinkVariable = variable => {
19925
19943
  return `<a href='${variable.url}' data-link-id='${variable.id}' ${variable.newTab ? 'target="_blank"' : ''}>${variable.name}</a>`;
19926
19944
  };
19927
19945
 
19928
- function parseRichtText(text, variables = {}) {
19946
+ function parseRichText(text, variables = {}) {
19929
19947
  const view = {};
19930
19948
  Object.entries(variables).forEach(([key, variable]) => {
19931
19949
  switch (variable.type) {
@@ -19949,15 +19967,6 @@ function parseRichtText(text, variables = {}) {
19949
19967
  mustache_mustache.escape = oldEscape;
19950
19968
  return output;
19951
19969
  }
19952
-
19953
- const useTextRendering = ({
19954
- text,
19955
- variables = {}
19956
- }) => {
19957
- return (0,hooks_namespaceObject.useMemo)(() => parseRichtText(text, variables), [text, variables]);
19958
- };
19959
-
19960
- /* harmony default export */ const use_text_rendering = (useTextRendering);
19961
19970
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/text.js
19962
19971
  const text_excluded = ["event"];
19963
19972
 
@@ -19978,32 +19987,37 @@ function text_objectWithoutPropertiesLoose(source, excluded) { if (source == nul
19978
19987
 
19979
19988
 
19980
19989
 
19990
+
19981
19991
  const Text = _ref => {
19982
19992
  let {
19983
19993
  event
19984
19994
  } = _ref,
19985
19995
  props = text_objectWithoutProperties(_ref, text_excluded);
19986
19996
 
19987
- const {
19988
- payload
19989
- } = event;
19990
19997
  const [body] = useTranslatedEventData(event);
19991
- const eventClick = use_event_link_click_handler(payload.id);
19992
- const eventBody = use_text_rendering({
19993
- text: parse_body(body.text),
19994
- variables: body.variables
19995
- });
19998
+ const eventClick = use_event_link_click_handler(event.payload.id);
19999
+ const containerProps = (0,hooks_namespaceObject.useMemo)(() => {
20000
+ if (!event.payload.fromClient) {
20001
+ return {
20002
+ bodyProps: {
20003
+ dangerouslySetInnerHTML: {
20004
+ __html: parseRichText(parse_body(body.text), body.variables)
20005
+ }
20006
+ }
20007
+ };
20008
+ }
20009
+
20010
+ return {
20011
+ children: (0,jsx_runtime_namespaceObject.jsx)("p", {
20012
+ children: body.text
20013
+ })
20014
+ };
20015
+ }, [body, event]);
19996
20016
  return (0,jsx_runtime_namespaceObject.jsx)(message_container, text_objectSpread(text_objectSpread({
19997
20017
  type: "text",
19998
20018
  event: event,
19999
20019
  onClick: eventClick
20000
- }, props), {}, {
20001
- bodyProps: {
20002
- dangerouslySetInnerHTML: {
20003
- __html: eventBody
20004
- }
20005
- }
20006
- }));
20020
+ }, props), containerProps));
20007
20021
  };
20008
20022
 
20009
20023
  /* harmony default export */ const event_text = (Text);
@@ -21177,6 +21191,7 @@ const PrivacyDisclaimer = () => {
21177
21191
 
21178
21192
 
21179
21193
 
21194
+
21180
21195
  const Conversation = () => {
21181
21196
  const {
21182
21197
  t
@@ -21186,7 +21201,7 @@ const Conversation = () => {
21186
21201
  const isLoading = useSeamlyIsLoading();
21187
21202
  const {
21188
21203
  isOpen
21189
- } = use_seamly_visibility();
21204
+ } = useVisibility();
21190
21205
  const skiplinkTargetId = useSkiplink();
21191
21206
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
21192
21207
  (0,hooks_namespaceObject.useEffect)(() => {
@@ -22275,10 +22290,11 @@ const Interrupt = ({
22275
22290
 
22276
22291
 
22277
22292
 
22293
+
22278
22294
  const View = () => {
22279
22295
  const {
22280
22296
  isVisible
22281
- } = use_seamly_visibility();
22297
+ } = useVisibility();
22282
22298
  const {
22283
22299
  openChat,
22284
22300
  closeChat
@@ -22341,7 +22357,7 @@ const SeamlyInstanceFunctionsLoader = () => {
22341
22357
  const {
22342
22358
  setVisibility,
22343
22359
  visible
22344
- } = use_seamly_visibility();
22360
+ } = useVisibility();
22345
22361
  const currentVisibility = (0,hooks_namespaceObject.useRef)(visible);
22346
22362
  const eventBus = (0,hooks_namespaceObject.useContext)(SeamlyEventBusContext);
22347
22363
  const api = useSeamlyApiContext();
@@ -22465,6 +22481,7 @@ const SeamlyInstanceFunctionsLoader = () => {
22465
22481
 
22466
22482
 
22467
22483
 
22484
+
22468
22485
  const {
22469
22486
  SET_EVENTS_READ: seamly_read_state_SET_EVENTS_READ
22470
22487
  } = seamlyActions;
@@ -22478,7 +22495,7 @@ const SeamlyReadState = () => {
22478
22495
  const {
22479
22496
  isOpen,
22480
22497
  isVisible
22481
- } = use_seamly_visibility();
22498
+ } = useVisibility();
22482
22499
  const {
22483
22500
  sendAction
22484
22501
  } = use_seamly_commands();
@@ -22533,6 +22550,7 @@ const SeamlyReadState = () => {
22533
22550
 
22534
22551
 
22535
22552
 
22553
+
22536
22554
  const SeamlyNewNotifications = () => {
22537
22555
  const {
22538
22556
  t
@@ -22546,7 +22564,7 @@ const SeamlyNewNotifications = () => {
22546
22564
  } = useLiveRegion();
22547
22565
  const {
22548
22566
  isOpen
22549
- } = use_seamly_visibility();
22567
+ } = useVisibility();
22550
22568
  const prevIsOpen = (0,hooks_namespaceObject.useRef)(null);
22551
22569
  const debounceFunc = (0,hooks_namespaceObject.useRef)(null);
22552
22570
  const notifyUnread = (0,hooks_namespaceObject.useMemo)(() => {
@@ -22761,23 +22779,18 @@ const SeamlyActivityMonitor = ({
22761
22779
 
22762
22780
 
22763
22781
 
22764
-
22765
22782
  const SeamlyInitializer = () => {
22766
22783
  const {
22767
22784
  initUserSelectedOptions
22768
22785
  } = useSeamlyOptions();
22769
22786
  const seamlyInitialized = (0,hooks_namespaceObject.useRef)(false);
22770
- const {
22771
- setVisibility
22772
- } = use_seamly_visibility();
22773
22787
  const config = useConfig();
22774
22788
  (0,hooks_namespaceObject.useEffect)(() => {
22775
22789
  if (config.api && !seamlyInitialized.current) {
22776
22790
  seamlyInitialized.current = true;
22777
22791
  initUserSelectedOptions();
22778
- setVisibility(visibilityStates.initialize);
22779
22792
  }
22780
- }, [initUserSelectedOptions, config, setVisibility]);
22793
+ }, [initUserSelectedOptions, config]);
22781
22794
  return null;
22782
22795
  };
22783
22796
 
@@ -23009,18 +23022,18 @@ const SeamlyEventSubscriber = ({
23009
23022
  case 'error':
23010
23023
  switch (payload.type) {
23011
23024
  case 'find_conversation_erred':
23012
- dispatch(set(new SeamlySessionExpiredError()));
23025
+ dispatch(set(new SeamlySessionExpiredError(event)));
23013
23026
  break;
23014
23027
 
23015
23028
  case 'seamly_offline':
23016
- dispatch(set(new SeamlyOfflineError()));
23029
+ dispatch(set(new SeamlyOfflineError(event)));
23017
23030
  dispatch({
23018
23031
  type: seamly_event_subscriber_CLEAR_EVENTS
23019
23032
  });
23020
23033
  break;
23021
23034
 
23022
23035
  default:
23023
- dispatch(set(new SeamlyGeneralError()));
23036
+ dispatch(set(new SeamlyGeneralError(event)));
23024
23037
  break;
23025
23038
  }
23026
23039
 
@@ -23190,6 +23203,50 @@ const SeamlyFileUpload = ({
23190
23203
  };
23191
23204
 
23192
23205
  /* harmony default export */ const seamly_file_upload = (SeamlyFileUpload);
23206
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/errors/index.js
23207
+
23208
+
23209
+ const {
23210
+ createAction: errors_createAction
23211
+ } = createDomain('errors');
23212
+ const catchError = errors_createAction('catch-error', error => ({
23213
+ error
23214
+ }));
23215
+ function errors_createMiddleware({
23216
+ api: seamlyApi
23217
+ }) {
23218
+ return ({
23219
+ getState
23220
+ }) => {
23221
+ const handleError = error => {
23222
+ const {
23223
+ errorCallback,
23224
+ namespace,
23225
+ api,
23226
+ layoutMode
23227
+ } = selectConfig(getState());
23228
+ errorCallback === null || errorCallback === void 0 ? void 0 : errorCallback(error, {
23229
+ namespace,
23230
+ api,
23231
+ layoutMode,
23232
+ conversationUrl: seamlyApi.getConversationUrl()
23233
+ });
23234
+ };
23235
+
23236
+ return next => action => {
23237
+ try {
23238
+ if (action.error) {
23239
+ handleError(action.error);
23240
+ }
23241
+
23242
+ return next(action);
23243
+ } catch (error) {
23244
+ handleError(error);
23245
+ throw error;
23246
+ }
23247
+ };
23248
+ };
23249
+ }
23193
23250
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-core.js
23194
23251
 
23195
23252
 
@@ -23205,6 +23262,8 @@ const SeamlyFileUpload = ({
23205
23262
 
23206
23263
 
23207
23264
 
23265
+
23266
+
23208
23267
  const SeamlyCore = ({
23209
23268
  store,
23210
23269
  children,
@@ -23212,6 +23271,7 @@ const SeamlyCore = ({
23212
23271
  eventBus,
23213
23272
  api
23214
23273
  }) => {
23274
+ (0,hooks_namespaceObject.useErrorBoundary)(error => store.dispatch(catchError(error)));
23215
23275
  return (0,jsx_runtime_namespaceObject.jsx)(StoreProvider, {
23216
23276
  store: store,
23217
23277
  children: (0,jsx_runtime_namespaceObject.jsx)(SeamlyEventBusContext.Provider, {
@@ -25088,7 +25148,6 @@ class API {
25088
25148
  }) // withCredentials() is necessary to allow browsers to save received
25089
25149
  // cookies in CORS requests.
25090
25150
  .withCredentials().send({
25091
- authorizationRequired: true,
25092
25151
  externalId: this.externalId || undefined
25093
25152
  });
25094
25153
  const {
@@ -25109,7 +25168,7 @@ class API {
25109
25168
  return initialState;
25110
25169
  } catch (error) {
25111
25170
  if (error.status >= 500) {
25112
- throw new SeamlyGeneralError();
25171
+ throw new SeamlyGeneralError(error);
25113
25172
  }
25114
25173
 
25115
25174
  throw error;
@@ -25155,15 +25214,15 @@ class API {
25155
25214
  };
25156
25215
  } catch (error) {
25157
25216
  if (error.status === 401) {
25158
- throw new SeamlyUnauthorizedError();
25217
+ throw new SeamlyUnauthorizedError(error);
25159
25218
  }
25160
25219
 
25161
25220
  if (error.status === 404) {
25162
- throw new SeamlySessionExpiredError();
25221
+ throw new SeamlySessionExpiredError(error);
25163
25222
  }
25164
25223
 
25165
25224
  if (error.status >= 500) {
25166
- throw new SeamlyGeneralError();
25225
+ throw new SeamlyGeneralError(error);
25167
25226
  }
25168
25227
 
25169
25228
  throw error;
@@ -25228,11 +25287,11 @@ class API {
25228
25287
  return body.config;
25229
25288
  }).catch(error => {
25230
25289
  if (error.status === 404) {
25231
- throw new SeamlyConfigurationError();
25290
+ throw new SeamlyConfigurationError(error);
25232
25291
  }
25233
25292
 
25234
25293
  if (error.status >= 500) {
25235
- throw new SeamlyGeneralError();
25294
+ throw new SeamlyGeneralError(error);
25236
25295
  }
25237
25296
 
25238
25297
  throw error;
@@ -25249,15 +25308,15 @@ class API {
25249
25308
  return omit(body.conversation, ['accessToken', 'channelName']);
25250
25309
  }).catch(error => {
25251
25310
  if (error.status === 401) {
25252
- throw new SeamlyUnauthorizedError();
25311
+ throw new SeamlyUnauthorizedError(error);
25253
25312
  }
25254
25313
 
25255
25314
  if (error.status === 404) {
25256
- throw new SeamlySessionExpiredError();
25315
+ throw new SeamlySessionExpiredError(error);
25257
25316
  }
25258
25317
 
25259
25318
  if (error.status >= 500) {
25260
- throw new SeamlyGeneralError();
25319
+ throw new SeamlyGeneralError(error);
25261
25320
  }
25262
25321
 
25263
25322
  throw error;
@@ -25280,7 +25339,7 @@ class API {
25280
25339
  return body.translations;
25281
25340
  } catch (error) {
25282
25341
  if (error.status >= 500) {
25283
- throw new SeamlyGeneralError();
25342
+ throw new SeamlyGeneralError(error);
25284
25343
  }
25285
25344
 
25286
25345
  throw error;
@@ -25406,9 +25465,16 @@ function options_middleware_createMiddleware({
25406
25465
  ;// CONCATENATED MODULE: ./src/javascripts/domains/options/index.js
25407
25466
 
25408
25467
  ;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
25468
+ 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; }
25469
+
25470
+ 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; }
25471
+
25472
+ 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; }
25473
+
25409
25474
  // Legacy state reducer. Do not add new features here but extract/create new reducers as needed
25410
25475
 
25411
25476
 
25477
+
25412
25478
  const state_reducer_initialState = {
25413
25479
  events: [],
25414
25480
  initialState: {},
@@ -25419,7 +25485,6 @@ const state_reducer_initialState = {
25419
25485
  isActive: false
25420
25486
  },
25421
25487
  resumeConversationPrompt: false,
25422
- visible: visibilityStates.hidden,
25423
25488
  serviceInfo: {
25424
25489
  activeServiceSessionId: ''
25425
25490
  },
@@ -25456,6 +25521,15 @@ const state_reducer_initialState = {
25456
25521
  seamlyContainerElement: null
25457
25522
  };
25458
25523
  function stateReducer(state = state_reducer_initialState, action) {
25524
+ if (action.type === String(actions_reset)) {
25525
+ const {
25526
+ visible
25527
+ } = state;
25528
+ return state_reducer_objectSpread(state_reducer_objectSpread({}, state_reducer_initialState), {}, {
25529
+ visible
25530
+ });
25531
+ }
25532
+
25459
25533
  return seamlyStateReducer(state, action);
25460
25534
  }
25461
25535
  ;// CONCATENATED MODULE: ./src/javascripts/domains/store/index.js
@@ -25469,9 +25543,12 @@ function stateReducer(state = state_reducer_initialState, action) {
25469
25543
 
25470
25544
 
25471
25545
 
25546
+
25547
+
25472
25548
  function store_createStore({
25473
25549
  initialState,
25474
- api
25550
+ api,
25551
+ eventBus
25475
25552
  } = {}) {
25476
25553
  const store = createReduxStore({
25477
25554
  reducers: {
@@ -25481,12 +25558,18 @@ function store_createStore({
25481
25558
  [String(forms_reducer)]: forms_reducer,
25482
25559
  [String(translations_reducer)]: translations_reducer,
25483
25560
  [String(i18n_reducer)]: i18n_reducer,
25484
- [String(interrupt_reducer)]: interrupt_reducer
25561
+ [String(interrupt_reducer)]: interrupt_reducer,
25562
+ [String(visibility_reducer)]: visibility_reducer
25485
25563
  },
25486
25564
  initialState,
25487
- middlewares: [es.withExtraArgument({
25565
+ middlewares: [errors_createMiddleware({
25488
25566
  api
25489
- }), createMiddleware(), middleware_createMiddleware(), options_middleware_createMiddleware({
25567
+ }), es.withExtraArgument({
25568
+ api,
25569
+ eventBus
25570
+ }), createMiddleware(), middleware_createMiddleware({
25571
+ api
25572
+ }), options_middleware_createMiddleware({
25490
25573
  api
25491
25574
  }), translations_middleware_createMiddleware()]
25492
25575
  });
@@ -25559,9 +25642,10 @@ class Engine {
25559
25642
  });
25560
25643
 
25561
25644
  const store = store_createStore({
25562
- api: this.api
25645
+ api: this.api,
25646
+ eventBus: this.eventBus
25563
25647
  });
25564
- await store.dispatch(actions_initialize(renderConfig));
25648
+ await store.dispatch(app_actions_initialize(renderConfig));
25565
25649
 
25566
25650
  if (View) {
25567
25651
  (0,external_preact_namespaceObject.render)((0,jsx_runtime_namespaceObject.jsx)(seamly_core, {
@@ -25881,12 +25965,6 @@ function initializeExternalApi(appConfig) {
25881
25965
 
25882
25966
  // Used by: StyleGuide
25883
25967
 
25884
- // Used by: StyleGuide
25885
-
25886
- // Used by: StyleGuide
25887
-
25888
- // Used by: StyleGuide
25889
-
25890
25968
 
25891
25969
  })();
25892
25970