@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
@@ -256,6 +256,13 @@ module.exports = __webpack_require__(9534);
256
256
 
257
257
  /***/ }),
258
258
 
259
+ /***/ 1611:
260
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
261
+
262
+ module.exports = __webpack_require__(6507);
263
+
264
+ /***/ }),
265
+
259
266
  /***/ 6902:
260
267
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
261
268
 
@@ -6860,6 +6867,17 @@ var path = __webpack_require__(4058);
6860
6867
  module.exports = path.Object.getOwnPropertySymbols;
6861
6868
 
6862
6869
 
6870
+ /***/ }),
6871
+
6872
+ /***/ 3966:
6873
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
6874
+
6875
+ __webpack_require__(7405);
6876
+ var path = __webpack_require__(4058);
6877
+
6878
+ module.exports = path.Object.getPrototypeOf;
6879
+
6880
+
6863
6881
  /***/ }),
6864
6882
 
6865
6883
  /***/ 8494:
@@ -11749,6 +11767,29 @@ $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
11749
11767
  });
11750
11768
 
11751
11769
 
11770
+ /***/ }),
11771
+
11772
+ /***/ 7405:
11773
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
11774
+
11775
+ var $ = __webpack_require__(6887);
11776
+ var fails = __webpack_require__(5981);
11777
+ var toObject = __webpack_require__(9678);
11778
+ var nativeGetPrototypeOf = __webpack_require__(249);
11779
+ var CORRECT_PROTOTYPE_GETTER = __webpack_require__(4160);
11780
+
11781
+ var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
11782
+
11783
+ // `Object.getPrototypeOf` method
11784
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
11785
+ $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
11786
+ getPrototypeOf: function getPrototypeOf(it) {
11787
+ return nativeGetPrototypeOf(toObject(it));
11788
+ }
11789
+ });
11790
+
11791
+
11792
+
11752
11793
  /***/ }),
11753
11794
 
11754
11795
  /***/ 1724:
@@ -13458,6 +13499,16 @@ var parent = __webpack_require__(498);
13458
13499
  module.exports = parent;
13459
13500
 
13460
13501
 
13502
+ /***/ }),
13503
+
13504
+ /***/ 6507:
13505
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
13506
+
13507
+ var parent = __webpack_require__(3966);
13508
+
13509
+ module.exports = parent;
13510
+
13511
+
13461
13512
  /***/ }),
13462
13513
 
13463
13514
  /***/ 3059:
@@ -17988,13 +18039,10 @@ __webpack_require__.d(__webpack_exports__, {
17988
18039
  "Interrupt": function() { return /* reexport */ interrupt; },
17989
18040
  "MessageContainer": function() { return /* reexport */ message_container; },
17990
18041
  "SeamlyApiContext": function() { return /* reexport */ SeamlyApiContext; },
17991
- "SeamlyConfigurationError": function() { return /* reexport */ SeamlyConfigurationError; },
17992
18042
  "SeamlyEventBusContext": function() { return /* reexport */ SeamlyEventBusContext; },
17993
18043
  "SeamlyGeneralError": function() { return /* reexport */ SeamlyGeneralError; },
17994
18044
  "SeamlyLiveRegionContext": function() { return /* reexport */ SeamlyLiveRegionContext; },
17995
18045
  "SeamlyOfflineError": function() { return /* reexport */ SeamlyOfflineError; },
17996
- "SeamlySessionExpiredError": function() { return /* reexport */ SeamlySessionExpiredError; },
17997
- "SeamlyUnauthorizedError": function() { return /* reexport */ SeamlyUnauthorizedError; },
17998
18046
  "StoreProvider": function() { return /* reexport */ StoreProvider; },
17999
18047
  "Text": function() { return /* reexport */ event_text; },
18000
18048
  "ToggleButton": function() { return /* reexport */ toggle_button; },
@@ -18020,7 +18068,7 @@ __webpack_require__.d(__webpack_exports__, {
18020
18068
  "useSeamlyIdleDetachCountdown": function() { return /* reexport */ use_seamly_idle_detach_countdown; },
18021
18069
  "useSeamlyMessageContainerClassNames": function() { return /* reexport */ useSeamlyMessageContainerClassNames; },
18022
18070
  "useSeamlyOptions": function() { return /* reexport */ useSeamlyOptions; },
18023
- "useSeamlyVisibility": function() { return /* reexport */ use_seamly_visibility; },
18071
+ "useSeamlyVisibility": function() { return /* reexport */ useVisibility; },
18024
18072
  "useTranslatedEventData": function() { return /* reexport */ useTranslatedEventData; },
18025
18073
  "useTranslations": function() { return /* reexport */ useTranslations; },
18026
18074
  "useTranslationsContainer": function() { return /* reexport */ useTranslationsContainer; },
@@ -20202,7 +20250,6 @@ const millisecondsToSeconds = milliseconds => {
20202
20250
  const microsecondsToMilliseconds = microseconds => {
20203
20251
  return Math.ceil(microseconds / 1000);
20204
20252
  };
20205
- const sanitizeText = text => text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/\//g, '&#x2F;');
20206
20253
  const getTimeFromSeconds = seconds => {
20207
20254
  const minutes = Math.floor(seconds / 60);
20208
20255
  const secondsPartial = seconds - minutes * 60;
@@ -20441,12 +20488,7 @@ function createThunk(type, payloadCreator) {
20441
20488
  });
20442
20489
  }
20443
20490
  function createReducer(domain, handlers = {}, defaultState) {
20444
- const reducer = (state, action) => {
20445
- if (state === undefined) {
20446
- // eslint-disable-next-line no-param-reassign
20447
- state = defaultState;
20448
- }
20449
-
20491
+ const reducer = (state = defaultState, action) => {
20450
20492
  const typeReducer = handlers === null || handlers === void 0 ? void 0 : handlers[action === null || action === void 0 ? void 0 : action.type];
20451
20493
  return typeReducer ? typeReducer(state, action) : state;
20452
20494
  };
@@ -20480,6 +20522,53 @@ const initialize = utils_createAction('initialize', config => ({
20480
20522
  const update = utils_createAction('update', config => ({
20481
20523
  config
20482
20524
  }));
20525
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/constants.js
20526
+ const StoreKey = 'visibility';
20527
+ const visibilityStates = {
20528
+ hidden: 'hidden',
20529
+ minimized: 'minimized',
20530
+ open: 'open',
20531
+ initialize: null
20532
+ };
20533
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
20534
+
20535
+
20536
+
20537
+
20538
+
20539
+
20540
+
20541
+
20542
+
20543
+
20544
+ function selectors_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
20545
+
20546
+ function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; for_each_default()(_context = selectors_ownKeys(Object(source), true)).call(_context, function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { define_properties_default()(target, get_own_property_descriptors_default()(source)); } else { var _context2; for_each_default()(_context2 = selectors_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
20547
+
20548
+
20549
+
20550
+
20551
+ const selectConfig = createSelector(selectState, config => {
20552
+ let newConfig = selectors_objectSpread({
20553
+ visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? visibilityStates.open : visibilityStates.minimized,
20554
+ appContainerClassNames: config.appContainerClassNames || []
20555
+ }, config);
20556
+
20557
+ if (typeof newConfig.appContainerClassNames === 'function') {
20558
+ newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
20559
+ appContainerClassNames: newConfig.appContainerClassNames(newConfig)
20560
+ });
20561
+ }
20562
+
20563
+ return newConfig;
20564
+ });
20565
+
20566
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
20567
+
20568
+
20569
+ function useConfig() {
20570
+ return useSelector(selectConfig);
20571
+ }
20483
20572
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/sort.js
20484
20573
  var sort = __webpack_require__(7302);
20485
20574
  var sort_default = /*#__PURE__*/__webpack_require__.n(sort);
@@ -20534,12 +20623,6 @@ const entryTypes = {
20534
20623
  text: 'text',
20535
20624
  upload: 'upload'
20536
20625
  };
20537
- const visibilityStates = {
20538
- hidden: 'hidden',
20539
- minimized: 'minimized',
20540
- open: 'open',
20541
- initialize: null
20542
- };
20543
20626
  const readStates = {
20544
20627
  received: 'received',
20545
20628
  read: 'read'
@@ -20586,7 +20669,6 @@ const seamlyActions = {
20586
20669
  SET_PARTICIPANT: 'SET_PARTICIPANT',
20587
20670
  SET_HEADER_TITLE: 'SET_HEADER_TITLE',
20588
20671
  SET_HEADER_SUB_TITLE: 'SET_HEADER_SUB_TITLE',
20589
- SET_VISIBILITY: 'SET_VISIBILITY',
20590
20672
  RESET_HISTORY_LOADED_FLAG: 'RESET_HISTORY_LOADED_FLAG',
20591
20673
  SET_ACTIVE_SERVICE: 'SET_ACTIVE_SERVICE',
20592
20674
  INIT_IDLE_DETACH_COUNTDOWN: 'INIT_IDLE_DETACH_COUNTDOWN',
@@ -20614,8 +20696,6 @@ const seamlyActions = {
20614
20696
  SET_UPLOAD_ERROR: 'SET_UPLOAD_ERROR',
20615
20697
  CLEAR_UPLOAD: 'CLEAR_UPLOAD',
20616
20698
  CLEAR_ALL_UPLOADS: 'CLEAR_ALL_UPLOADS',
20617
- RESET_UPLOAD_STATE: 'RESET_UPLOAD_STATE',
20618
- RESET_ENTRY_STATE: 'RESET_ENTRY_STATE',
20619
20699
  SET_SEAMLY_CONTAINER_ELEMENT: 'SET_SEAMLY_CONTAINER_ELEMENT'
20620
20700
  };
20621
20701
  const cardTypes = {
@@ -20634,7 +20714,6 @@ const {
20634
20714
  SET_PARTICIPANT,
20635
20715
  SET_HEADER_TITLE,
20636
20716
  SET_HEADER_SUB_TITLE,
20637
- SET_VISIBILITY,
20638
20717
  RESET_HISTORY_LOADED_FLAG,
20639
20718
  SET_ACTIVE_SERVICE,
20640
20719
  INIT_IDLE_DETACH_COUNTDOWN,
@@ -20662,8 +20741,6 @@ const {
20662
20741
  SET_UPLOAD_ERROR,
20663
20742
  CLEAR_UPLOAD,
20664
20743
  CLEAR_ALL_UPLOADS,
20665
- RESET_UPLOAD_STATE,
20666
- RESET_ENTRY_STATE,
20667
20744
  SET_SEAMLY_CONTAINER_ELEMENT
20668
20745
  } = seamlyActions;
20669
20746
  const isUnreadMessage = ({
@@ -21051,11 +21128,6 @@ const seamlyStateReducer = (state, action) => {
21051
21128
  resumeConversationPrompt: false
21052
21129
  });
21053
21130
 
21054
- case SET_VISIBILITY:
21055
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
21056
- visible: action.visible
21057
- });
21058
-
21059
21131
  case SET_PARTICIPANT:
21060
21132
  case CLEAR_PARTICIPANTS:
21061
21133
  return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
@@ -21263,26 +21335,6 @@ const seamlyStateReducer = (state, action) => {
21263
21335
  currentUploads: []
21264
21336
  });
21265
21337
 
21266
- case RESET_UPLOAD_STATE:
21267
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
21268
- showFileUpload: false,
21269
- currentUploads: []
21270
- });
21271
-
21272
- case RESET_ENTRY_STATE:
21273
- {
21274
- return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
21275
- entryMeta: {
21276
- default: payloadTypes.text,
21277
- active: payloadTypes.text,
21278
- userSelected: null,
21279
- blockAutoEntrySwitch: false,
21280
- options: {},
21281
- optionsOverride: {}
21282
- }
21283
- });
21284
- }
21285
-
21286
21338
  case SET_SEAMLY_CONTAINER_ELEMENT:
21287
21339
  {
21288
21340
  return seamly_utils_objectSpread(seamly_utils_objectSpread({}, state), {}, {
@@ -21294,67 +21346,6 @@ const seamlyStateReducer = (state, action) => {
21294
21346
  return state;
21295
21347
  }
21296
21348
  };
21297
- const calculateVisibility = ({
21298
- hasResponded,
21299
- previousVisibility,
21300
- requestedVisibility,
21301
- config
21302
- }) => {
21303
- const {
21304
- defaults,
21305
- layoutMode,
21306
- hideOnNoUserResponse
21307
- } = config;
21308
- const {
21309
- visible: defaultVisibility
21310
- } = defaults || {}; // Requesting open should override the responded check.
21311
-
21312
- if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
21313
- return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
21314
- }
21315
-
21316
- const baseVisibility = layoutMode === 'inline' ? visibilityStates.open : visibilityStates.minimized;
21317
- return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
21318
- };
21319
- ;// CONCATENATED MODULE: ./src/javascripts/domains/config/selectors.js
21320
-
21321
-
21322
-
21323
-
21324
-
21325
-
21326
-
21327
-
21328
-
21329
-
21330
- function selectors_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
21331
-
21332
- function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; for_each_default()(_context = selectors_ownKeys(Object(source), true)).call(_context, function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { define_properties_default()(target, get_own_property_descriptors_default()(source)); } else { var _context2; for_each_default()(_context2 = selectors_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
21333
-
21334
-
21335
-
21336
-
21337
- const selectConfig = createSelector(selectState, config => {
21338
- let newConfig = selectors_objectSpread({
21339
- visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? visibilityStates.open : visibilityStates.minimized,
21340
- appContainerClassNames: config.appContainerClassNames || []
21341
- }, config);
21342
-
21343
- if (typeof newConfig.appContainerClassNames === 'function') {
21344
- newConfig = selectors_objectSpread(selectors_objectSpread({}, newConfig), {}, {
21345
- appContainerClassNames: newConfig.appContainerClassNames(newConfig)
21346
- });
21347
- }
21348
-
21349
- return newConfig;
21350
- });
21351
-
21352
- ;// CONCATENATED MODULE: ./src/javascripts/domains/config/hooks.js
21353
-
21354
-
21355
- function useConfig() {
21356
- return useSelector(selectConfig);
21357
- }
21358
21349
  ;// CONCATENATED MODULE: ./src/javascripts/domains/config/middleware.js
21359
21350
 
21360
21351
 
@@ -21451,7 +21442,7 @@ const initialState = reducer_objectSpread(reducer_objectSpread({}, defaultConfig
21451
21442
  defaults: {}
21452
21443
  });
21453
21444
 
21454
- const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback'];
21445
+ const configKeys = ['hideOnNoUserResponse', 'showDisclaimer', 'showFaq', 'namespace', 'customComponents', 'defaults', 'layoutMode', 'api', 'zIndex', 'context', 'appContainerClassNames', 'messages', 'visible', 'visibilityCallback', 'errorCallback'];
21455
21446
 
21456
21447
  const updateState = (state, {
21457
21448
  config
@@ -22496,7 +22487,11 @@ const defaultState = {
22496
22487
  'errors.general.title': 'Something went wrong',
22497
22488
  '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.',
22498
22489
  '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.',
22499
- 'errors.seamlyOffline.title': 'Connection issues'
22490
+ 'errors.seamlyOffline.title': 'Connection issues',
22491
+ 'errors.seamlyUnavailable.buttonText': 'Try again',
22492
+ 'errors.seamlyUnavailable.message': 'The server could not be reached. Try again in a little while.',
22493
+ 'errors.seamlyUnavailable.srText': 'The chat server could not be reached. Try again in a little while.',
22494
+ 'errors.seamlyUnavailable.title': 'Server unavailable'
22500
22495
  },
22501
22496
  isLoading: false,
22502
22497
  initialLocale: undefined
@@ -22875,15 +22870,37 @@ function useInterrupt() {
22875
22870
  error
22876
22871
  };
22877
22872
  }
22878
- ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
22879
- class SeamlyGeneralError extends Error {
22880
- constructor(params) {
22881
- super(params);
22873
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-prototype-of.js
22874
+ var get_prototype_of = __webpack_require__(1611);
22875
+ var get_prototype_of_default = /*#__PURE__*/__webpack_require__.n(get_prototype_of);
22876
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-base-error.js
22877
+
22878
+ class SeamlyBaseError extends Error {
22879
+ constructor(originalError, ...params) {
22880
+ super(...params);
22882
22881
 
22883
22882
  if (Error.captureStackTrace) {
22884
- Error.captureStackTrace(this, SeamlyGeneralError);
22883
+ Error.captureStackTrace(this, get_prototype_of_default()(this));
22884
+ }
22885
+
22886
+ this.originalError = originalError;
22887
+
22888
+ if (originalError !== null && originalError !== void 0 && originalError.payload) {
22889
+ this.originalEvent = originalError;
22890
+ this.originalError = originalError.payload.error;
22885
22891
  }
22886
22892
 
22893
+ if (originalError !== null && originalError !== void 0 && originalError.error) {
22894
+ this.originalError = originalError.error;
22895
+ }
22896
+ }
22897
+
22898
+ }
22899
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
22900
+
22901
+ class SeamlyGeneralError extends SeamlyBaseError {
22902
+ constructor(originalError, ...params) {
22903
+ super(originalError, ...params);
22887
22904
  this.name = 'SeamlyGeneralError';
22888
22905
  this.langKey = 'errors.general';
22889
22906
  this.action = 'reset';
@@ -22891,59 +22908,62 @@ class SeamlyGeneralError extends Error {
22891
22908
 
22892
22909
  }
22893
22910
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-configuration-error.js
22894
- class SeamlyConfigurationError extends Error {
22895
- constructor(params) {
22896
- super(params);
22897
-
22898
- if (Error.captureStackTrace) {
22899
- Error.captureStackTrace(this, SeamlyConfigurationError);
22900
- }
22901
22911
 
22912
+ class SeamlyConfigurationError extends SeamlyBaseError {
22913
+ constructor(originalError, ...params) {
22914
+ super(originalError, ...params);
22902
22915
  this.name = 'SeamlyConfigurationError';
22903
22916
  this.langKey = 'errors.configError';
22904
22917
  }
22905
22918
 
22906
22919
  }
22907
22920
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-session-expired-error.js
22908
- class SeamlySessionExpiredError extends Error {
22909
- constructor(params) {
22910
- super(params);
22911
-
22912
- if (Error.captureStackTrace) {
22913
- Error.captureStackTrace(this, SeamlySessionExpiredError);
22914
- }
22915
22921
 
22922
+ class SeamlySessionExpiredError extends SeamlyBaseError {
22923
+ constructor(originalError, ...params) {
22924
+ super(originalError, ...params);
22916
22925
  this.name = 'SeamlySessionExpiredError';
22917
22926
  this.action = 'reset';
22918
22927
  }
22919
22928
 
22920
22929
  }
22921
22930
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-offline-error.js
22922
- class SeamlyOfflineError extends Error {
22923
- constructor(params) {
22924
- super(params);
22925
-
22926
- if (Error.captureStackTrace) {
22927
- Error.captureStackTrace(this, SeamlyOfflineError);
22928
- }
22929
22931
 
22932
+ class SeamlyOfflineError extends SeamlyBaseError {
22933
+ constructor(originalError, ...params) {
22934
+ super(originalError, ...params);
22930
22935
  this.name = 'SeamlyOfflineError';
22931
22936
  this.langKey = 'errors.seamlyOffline';
22932
22937
  }
22933
22938
 
22934
22939
  }
22935
22940
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unauthorized-error.js
22936
- class SeamlyUnauthorizedError extends Error {
22941
+
22942
+ class SeamlyUnauthorizedError extends SeamlyBaseError {
22943
+ constructor(originalError, ...params) {
22944
+ super(originalError, ...params);
22945
+ this.name = 'SeamlyUnauthorizedError';
22946
+ this.langKey = 'errors.general';
22947
+ this.action = 'reset';
22948
+ }
22949
+
22950
+ }
22951
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unavailable-error.js
22952
+ /**
22953
+ * This error is used to alert the user that there's a problem with the connection
22954
+ * when initialising the application because of a connection issue on either the server
22955
+ * or the client side.
22956
+ */
22957
+ class SeamlyUnavailableError extends Error {
22937
22958
  constructor(params) {
22938
22959
  super(params);
22939
22960
 
22940
22961
  if (Error.captureStackTrace) {
22941
- Error.captureStackTrace(this, SeamlyUnauthorizedError);
22962
+ Error.captureStackTrace(this, SeamlyUnavailableError);
22942
22963
  }
22943
22964
 
22944
- this.name = 'SeamlyUnauthorizedError';
22945
- this.langKey = 'errors.general';
22946
- this.action = 'reset';
22965
+ this.name = 'SeamlyUnavailableError';
22966
+ this.langKey = 'errors.seamlyUnavailable';
22947
22967
  }
22948
22968
 
22949
22969
  }
@@ -22954,7 +22974,8 @@ class SeamlyUnauthorizedError extends Error {
22954
22974
 
22955
22975
 
22956
22976
 
22957
- const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError];
22977
+
22978
+ const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
22958
22979
  function middleware_createMiddleware({
22959
22980
  api
22960
22981
  }) {
@@ -22977,72 +22998,178 @@ function middleware_createMiddleware({
22977
22998
  return next(action);
22978
22999
  };
22979
23000
  }
22980
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
23001
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
23002
+
23003
+ const {
23004
+ createAction: app_utils_createAction,
23005
+ createThunk: app_utils_createThunk,
23006
+ createReducer: app_utils_createReducer,
23007
+ selectState: app_utils_selectState
23008
+ } = createDomain('app');
23009
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
23010
+
22981
23011
 
23012
+ const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
22982
23013
 
23014
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/utils.js
22983
23015
 
22984
23016
 
23017
+ const {
23018
+ createAction: visibility_utils_createAction,
23019
+ createActions: utils_createActions,
23020
+ createThunk: visibility_utils_createThunk,
23021
+ createReducer: visibility_utils_createReducer,
23022
+ selectState: visibility_utils_selectState
23023
+ } = createDomain('visibility');
23024
+ const calculateVisibility = ({
23025
+ hasResponded,
23026
+ previousVisibility,
23027
+ requestedVisibility,
23028
+ config
23029
+ }) => {
23030
+ const {
23031
+ defaults,
23032
+ layoutMode,
23033
+ hideOnNoUserResponse
23034
+ } = config;
23035
+ const {
23036
+ visible: defaultVisibility
23037
+ } = defaults || {}; // Requesting open should override the responded check.
22985
23038
 
23039
+ if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
23040
+ return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
23041
+ }
22986
23042
 
23043
+ const baseVisibility = layoutMode === 'inline' ? visibilityStates.open : visibilityStates.minimized;
23044
+ return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
23045
+ };
23046
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/selectors.js
22987
23047
 
22988
23048
 
23049
+ const selectVisibility = createSelector(visibility_utils_selectState, state => state.visibility);
22989
23050
 
23051
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/actions.js
22990
23052
 
22991
- function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
22992
23053
 
22993
- function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; for_each_default()(_context = interrupt_reducer_ownKeys(Object(source), true)).call(_context, function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { define_properties_default()(target, get_own_property_descriptors_default()(source)); } else { var _context2; for_each_default()(_context2 = interrupt_reducer_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
22994
23054
 
22995
23055
 
22996
23056
 
22997
- const reducer_initialState = {
22998
- error: undefined
22999
- };
23000
- /* harmony default export */ var interrupt_reducer = (interrupt_utils_createReducer({
23001
- [set]: (state, {
23002
- error
23003
- }) => {
23004
- return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
23005
- error
23006
- });
23007
- },
23008
- [clear]: () => {
23009
- return reducer_initialState;
23057
+
23058
+
23059
+
23060
+
23061
+
23062
+ function actions_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23063
+
23064
+ function actions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; for_each_default()(_context = actions_ownKeys(Object(source), true)).call(_context, function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { define_properties_default()(target, get_own_property_descriptors_default()(source)); } else { var _context2; for_each_default()(_context2 = actions_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
23065
+
23066
+
23067
+
23068
+
23069
+
23070
+
23071
+
23072
+
23073
+ const setFromStorage = visibility_utils_createAction('setFromStorage', visibility => ({
23074
+ visibility
23075
+ }));
23076
+ const validVisibilityStates = [visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden];
23077
+ const actions_setVisibility = visibility_utils_createThunk('set', (requestedVisibility, {
23078
+ getState,
23079
+ extra: {
23080
+ api,
23081
+ eventBus
23010
23082
  }
23011
- }, reducer_initialState));
23012
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
23083
+ }) => {
23084
+ const state = getState();
23085
+ const previousVisibility = selectVisibility(state);
23086
+ const hasResponded = selectUserHasResponded(state);
23087
+ const hasConversation = api.hasConversation();
23088
+ const config = selectConfig(state);
23089
+ const {
23090
+ visibilityCallback = calculateVisibility,
23091
+ layoutMode
23092
+ } = config;
23093
+ const {
23094
+ unreadEvents: unreadMessageCount
23095
+ } = seamly_state_hooks_selectState(state);
23096
+ const calculatedVisibility = visibilityCallback({
23097
+ hasConversation,
23098
+ hasResponded,
23099
+ previousVisibility,
23100
+ requestedVisibility,
23101
+ config
23102
+ });
23013
23103
 
23104
+ if (!includes_default()(validVisibilityStates).call(validVisibilityStates, calculatedVisibility)) {
23105
+ console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
23106
+ return undefined;
23107
+ }
23014
23108
 
23109
+ if (previousVisibility === calculatedVisibility) {
23110
+ return undefined;
23111
+ } // Store the user-requested visibility in order to reinitialize after refresh
23015
23112
 
23016
23113
 
23114
+ api.store.set(StoreKey, actions_objectSpread(actions_objectSpread({}, api.store.get(StoreKey) || {}), {}, {
23115
+ [layoutMode]: requestedVisibility
23116
+ }));
23017
23117
 
23118
+ if (requestedVisibility) {
23119
+ eventBus.emit('ui.visible', requestedVisibility, {
23120
+ visibility: requestedVisibility,
23121
+ hasConversation,
23122
+ hasResponded,
23123
+ unreadMessageCount
23124
+ });
23125
+ }
23018
23126
 
23019
- ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
23127
+ return calculatedVisibility;
23128
+ });
23129
+ const actions_initialize = visibility_utils_createThunk('initialize', async (locale, {
23130
+ dispatch,
23131
+ getState,
23132
+ extra: {
23133
+ api
23134
+ }
23135
+ }) => {
23136
+ var _api$store$get;
23020
23137
 
23021
- const {
23022
- createAction: app_utils_createAction,
23023
- createThunk: app_utils_createThunk,
23024
- createReducer: app_utils_createReducer,
23025
- selectState: app_utils_selectState
23026
- } = createDomain('app');
23138
+ // initialize stored visibility
23139
+ const {
23140
+ layoutMode
23141
+ } = selectConfig(getState());
23142
+ const storedVisibility = (_api$store$get = api.store.get(StoreKey)) === null || _api$store$get === void 0 ? void 0 : _api$store$get[layoutMode];
23143
+
23144
+ if (storedVisibility) {
23145
+ dispatch(setFromStorage(storedVisibility));
23146
+ }
23147
+
23148
+ dispatch(actions_setVisibility(visibilityStates.initialize));
23149
+ });
23027
23150
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
23028
23151
 
23029
23152
 
23030
23153
 
23031
23154
 
23032
23155
 
23156
+
23157
+
23033
23158
  const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
23034
23159
  hasResponded
23035
23160
  }));
23036
- const actions_initialize = app_utils_createThunk('initialize', async (config, {
23161
+ const app_actions_initialize = app_utils_createThunk('initialize', async (config, {
23037
23162
  dispatch,
23038
23163
  extra: {
23039
23164
  api
23040
23165
  }
23041
23166
  }) => {
23042
- try {
23043
- var _config$context;
23167
+ var _config$context;
23168
+
23169
+ dispatch(initialize(config));
23170
+ let locale = config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale;
23044
23171
 
23045
- dispatch(initialize(config));
23172
+ try {
23046
23173
  const {
23047
23174
  features,
23048
23175
  defaultLocale
@@ -23051,38 +23178,39 @@ const actions_initialize = app_utils_createThunk('initialize', async (config, {
23051
23178
  type: seamlyActions.SET_FEATURES,
23052
23179
  features
23053
23180
  });
23054
- let locale = (config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale) || defaultLocale;
23181
+ locale = locale || defaultLocale;
23055
23182
  dispatch(setInitialLocale(locale));
23183
+ } catch (e) {
23184
+ throw new SeamlyUnavailableError();
23185
+ }
23056
23186
 
23057
- try {
23058
- if (api.hasConversation()) {
23059
- var _initialState$transla;
23187
+ try {
23188
+ if (api.hasConversation()) {
23189
+ var _initialState$transla;
23060
23190
 
23061
- const initialState = await api.getConversationIntitialState();
23062
- dispatch({
23063
- type: seamlyActions.SET_INITIAL_STATE,
23064
- initialState
23065
- });
23066
- locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
23191
+ const initialState = await api.getConversationIntitialState();
23192
+ dispatch({
23193
+ type: seamlyActions.SET_INITIAL_STATE,
23194
+ initialState
23195
+ });
23196
+ locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
23067
23197
 
23068
- if ('userResponded' in initialState) {
23069
- dispatch(setHasResponded(initialState.userResponded));
23070
- }
23198
+ if ('userResponded' in initialState) {
23199
+ dispatch(setHasResponded(initialState.userResponded));
23071
23200
  }
23072
- } catch (error) {
23073
- dispatch(set(error));
23201
+ }
23202
+ } catch (e) {
23203
+ if (e instanceof SeamlySessionExpiredError) {
23204
+ throw e;
23074
23205
  }
23075
23206
 
23207
+ throw new SeamlyUnavailableError();
23208
+ } finally {
23076
23209
  await dispatch(setLocale(locale));
23077
- } catch (error) {
23078
- dispatch(set(error));
23210
+ dispatch(actions_initialize());
23079
23211
  }
23080
23212
  });
23081
- ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
23082
-
23083
-
23084
- const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
23085
-
23213
+ const actions_reset = app_utils_createAction('reset', () => {});
23086
23214
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
23087
23215
 
23088
23216
 
@@ -23106,7 +23234,7 @@ function app_reducer_objectSpread(target) { for (var i = 1; i < arguments.length
23106
23234
 
23107
23235
 
23108
23236
 
23109
- const app_reducer_initialState = {
23237
+ const reducer_initialState = {
23110
23238
  userHasResponded: false
23111
23239
  };
23112
23240
  /* harmony default export */ var app_reducer = (app_utils_createReducer({
@@ -23115,12 +23243,118 @@ const app_reducer_initialState = {
23115
23243
  }) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
23116
23244
  userHasResponded: hasResponded
23117
23245
  })
23118
- }, app_reducer_initialState));
23246
+ }, reducer_initialState));
23119
23247
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
23120
23248
 
23121
23249
 
23122
23250
 
23123
23251
 
23252
+
23253
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
23254
+
23255
+
23256
+
23257
+
23258
+
23259
+
23260
+
23261
+
23262
+
23263
+
23264
+ function interrupt_reducer_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23265
+
23266
+ function interrupt_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; for_each_default()(_context = interrupt_reducer_ownKeys(Object(source), true)).call(_context, function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { define_properties_default()(target, get_own_property_descriptors_default()(source)); } else { var _context2; for_each_default()(_context2 = interrupt_reducer_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
23267
+
23268
+
23269
+
23270
+
23271
+ const interrupt_reducer_initialState = {
23272
+ error: undefined
23273
+ };
23274
+
23275
+ const handleError = (state, {
23276
+ error
23277
+ }) => interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
23278
+ error
23279
+ });
23280
+
23281
+ /* harmony default export */ var interrupt_reducer = (interrupt_utils_createReducer({
23282
+ [set]: handleError,
23283
+ [app_actions_initialize.rejected]: handleError,
23284
+ [clear]: () => interrupt_reducer_initialState,
23285
+ [actions_reset]: () => interrupt_reducer_initialState
23286
+ }, interrupt_reducer_initialState));
23287
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
23288
+
23289
+
23290
+
23291
+
23292
+
23293
+
23294
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/hooks.js
23295
+
23296
+
23297
+
23298
+
23299
+
23300
+
23301
+ const useVisibility = () => {
23302
+ const dispatch = useStoreDispatch();
23303
+ const visible = useSelector(selectVisibility);
23304
+ const isVisible = visible ? visible !== visibilityStates.hidden : false;
23305
+ const {
23306
+ layoutMode
23307
+ } = useConfig();
23308
+ const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
23309
+ const setVisibility = F(visibility => dispatch(actions_setVisibility(visibility)), [dispatch]);
23310
+ return {
23311
+ isVisible,
23312
+ isOpen,
23313
+ visible,
23314
+ setVisibility
23315
+ };
23316
+ };
23317
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/reducer.js
23318
+
23319
+
23320
+
23321
+
23322
+
23323
+
23324
+
23325
+
23326
+
23327
+
23328
+ function visibility_reducer_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23329
+
23330
+ function visibility_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; for_each_default()(_context = visibility_reducer_ownKeys(Object(source), true)).call(_context, function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { define_properties_default()(target, get_own_property_descriptors_default()(source)); } else { var _context2; for_each_default()(_context2 = visibility_reducer_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
23331
+
23332
+
23333
+
23334
+
23335
+ const visibility_reducer_initialState = {
23336
+ visibility: visibilityStates.initialize
23337
+ };
23338
+ /* harmony default export */ var visibility_reducer = (visibility_utils_createReducer({
23339
+ [setFromStorage]: (state, {
23340
+ visibility
23341
+ }) => visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
23342
+ visibility
23343
+ }),
23344
+ [actions_setVisibility.fulfilled]: (state, {
23345
+ payload: visibility
23346
+ }) => visibility ? visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
23347
+ visibility
23348
+ }) : state
23349
+ }, visibility_reducer_initialState));
23350
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/index.js
23351
+
23352
+
23353
+
23354
+
23355
+
23356
+
23357
+
23124
23358
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
23125
23359
 
23126
23360
 
@@ -23154,15 +23388,10 @@ function use_seamly_commands_objectSpread(target) { for (var i = 1; i < argument
23154
23388
 
23155
23389
  const {
23156
23390
  ADD_EVENT: use_seamly_commands_ADD_EVENT,
23157
- CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
23158
23391
  SET_IS_LOADING: use_seamly_commands_SET_IS_LOADING,
23159
- CLEAR_PARTICIPANTS: use_seamly_commands_CLEAR_PARTICIPANTS,
23160
23392
  SET_HEADER_SUB_TITLE: use_seamly_commands_SET_HEADER_SUB_TITLE,
23161
23393
  SET_INITIAL_STATE: use_seamly_commands_SET_INITIAL_STATE,
23162
- CLEAR_FEATURES: use_seamly_commands_CLEAR_FEATURES,
23163
- SET_FEATURES: use_seamly_commands_SET_FEATURES,
23164
- RESET_UPLOAD_STATE: use_seamly_commands_RESET_UPLOAD_STATE,
23165
- RESET_ENTRY_STATE: use_seamly_commands_RESET_ENTRY_STATE
23394
+ SET_FEATURES: use_seamly_commands_SET_FEATURES
23166
23395
  } = seamlyActions;
23167
23396
 
23168
23397
  const useSeamlyCommands = () => {
@@ -23174,7 +23403,7 @@ const useSeamlyCommands = () => {
23174
23403
  const hasConversation = useSeamlyHasConversation();
23175
23404
  const {
23176
23405
  visible: visibility
23177
- } = useSeamlyStateContext();
23406
+ } = useVisibility();
23178
23407
  const unreadMessageCount = useSeamlyUnreadCount();
23179
23408
  const emitEvent = F((...args) => {
23180
23409
  eventBus.emit(...args);
@@ -23196,26 +23425,12 @@ const useSeamlyCommands = () => {
23196
23425
  });
23197
23426
  }, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
23198
23427
  const reset = F(async () => {
23428
+ dispatch(actions_reset());
23199
23429
  dispatch(clear());
23200
- dispatch({
23201
- type: use_seamly_commands_CLEAR_EVENTS
23202
- });
23203
23430
  dispatch({
23204
23431
  type: use_seamly_commands_SET_IS_LOADING,
23205
23432
  isLoading: true
23206
23433
  });
23207
- dispatch({
23208
- type: use_seamly_commands_CLEAR_PARTICIPANTS
23209
- });
23210
- dispatch({
23211
- type: use_seamly_commands_RESET_UPLOAD_STATE
23212
- });
23213
- dispatch({
23214
- type: use_seamly_commands_RESET_ENTRY_STATE
23215
- });
23216
- dispatch({
23217
- type: use_seamly_commands_CLEAR_FEATURES
23218
- });
23219
23434
  const {
23220
23435
  agentName
23221
23436
  } = appConfig.defaults || {};
@@ -23267,21 +23482,13 @@ const useSeamlyCommands = () => {
23267
23482
 
23268
23483
  const message = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, getTextMessageBase(body)), config);
23269
23484
 
23270
- const sanitizedText = sanitizeText(body);
23271
-
23272
- const sanitizedMessage = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, message), {}, {
23273
- body: {
23274
- text: sanitizedText
23275
- }
23276
- });
23277
-
23278
23485
  api.send('message', message);
23279
23486
  emitEvent('message', message);
23280
23487
  dispatch({
23281
23488
  type: use_seamly_commands_ADD_EVENT,
23282
23489
  event: {
23283
23490
  type: 'message',
23284
- payload: sanitizedMessage
23491
+ payload: message
23285
23492
  }
23286
23493
  });
23287
23494
  }, [api, dispatch, emitEvent, getTextMessageBase]);
@@ -23577,132 +23784,6 @@ const useSeamlyEntry = () => {
23577
23784
  setBlockAutoEntrySwitch
23578
23785
  };
23579
23786
  };
23580
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-stored-visibility.js
23581
-
23582
-
23583
-
23584
-
23585
-
23586
-
23587
-
23588
-
23589
-
23590
-
23591
- function use_seamly_stored_visibility_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23592
-
23593
- 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) { var _context; for_each_default()(_context = use_seamly_stored_visibility_ownKeys(Object(source), true)).call(_context, function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { define_properties_default()(target, get_own_property_descriptors_default()(source)); } else { var _context2; for_each_default()(_context2 = use_seamly_stored_visibility_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
23594
-
23595
-
23596
-
23597
-
23598
-
23599
- const useSeamlyStoredVisibility = () => {
23600
- const {
23601
- layoutMode
23602
- } = useConfig();
23603
- const key = 'visibility';
23604
- const {
23605
- get,
23606
- set
23607
- } = useSeamlyObjectStore();
23608
- let storedVisibilityObj = {};
23609
- const savedVisibility = get ? get(key) : {};
23610
-
23611
- if (savedVisibility) {
23612
- storedVisibilityObj = savedVisibility;
23613
- }
23614
-
23615
- const setStoredVisibility = F(state => {
23616
- const saved = get ? get(key) : {};
23617
- set(key, use_seamly_stored_visibility_objectSpread(use_seamly_stored_visibility_objectSpread({}, saved), {}, {
23618
- [layoutMode]: state
23619
- }));
23620
- }, [set, get, layoutMode]);
23621
- return [layoutMode ? storedVisibilityObj[layoutMode] : null, set && layoutMode ? setStoredVisibility : null];
23622
- };
23623
-
23624
- /* harmony default export */ var use_seamly_stored_visibility = (useSeamlyStoredVisibility);
23625
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-visibility.js
23626
-
23627
-
23628
-
23629
-
23630
-
23631
-
23632
-
23633
-
23634
-
23635
-
23636
- const {
23637
- SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
23638
- } = seamlyActions;
23639
-
23640
- const useSeamlyVisibility = () => {
23641
- const config = useConfig();
23642
- const {
23643
- layoutMode,
23644
- visibilityCallback
23645
- } = config;
23646
- const {
23647
- visible
23648
- } = useSeamlyStateContext();
23649
- const {
23650
- emitEvent
23651
- } = use_seamly_commands();
23652
- const dispatch = use_seamly_dispatch();
23653
- const [storedVisibility, setStoredVisibility] = use_seamly_stored_visibility();
23654
- const hasResponded = useUserHasResponded();
23655
- const hasConversation = useSeamlyHasConversation();
23656
- const unreadMessageCount = useSeamlyUnreadCount();
23657
- const isVisible = visible ? visible !== visibilityStates.hidden : false;
23658
- const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
23659
- const setVisibility = F(visibility => {
23660
- var _context;
23661
-
23662
- const visibilityFn = visibilityCallback || calculateVisibility;
23663
- const requestedVisibility = visibilityFn({
23664
- hasConversation,
23665
- hasResponded,
23666
- previousVisibility: storedVisibility || null,
23667
- requestedVisibility: visibility,
23668
- config
23669
- });
23670
-
23671
- if (!includes_default()(_context = [visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden]).call(_context, requestedVisibility)) {
23672
- console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
23673
- return;
23674
- }
23675
-
23676
- if (requestedVisibility !== visible) {
23677
- if (setStoredVisibility) {
23678
- setStoredVisibility(requestedVisibility);
23679
- } // Don't broadcast the init visibility state
23680
-
23681
-
23682
- if (visibility) {
23683
- emitEvent('ui.visible', requestedVisibility, {
23684
- visibility: requestedVisibility,
23685
- hasConversation,
23686
- hasResponded,
23687
- unreadMessageCount
23688
- });
23689
- }
23690
-
23691
- dispatch({
23692
- type: use_seamly_visibility_SET_VISIBILITY,
23693
- visible: requestedVisibility
23694
- });
23695
- }
23696
- }, [visible, emitEvent, dispatch, hasConversation, hasResponded, storedVisibility, visibilityCallback, config, setStoredVisibility, unreadMessageCount]);
23697
- return {
23698
- isVisible,
23699
- isOpen,
23700
- visible,
23701
- setVisibility
23702
- };
23703
- };
23704
-
23705
- /* harmony default export */ var use_seamly_visibility = (useSeamlyVisibility);
23706
23787
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
23707
23788
 
23708
23789
 
@@ -23725,9 +23806,8 @@ const useSeamlyChat = () => {
23725
23806
  const {
23726
23807
  isOpen,
23727
23808
  isVisible,
23728
- visible,
23729
23809
  setVisibility
23730
- } = use_seamly_visibility();
23810
+ } = useVisibility();
23731
23811
  const dispatch = use_seamly_dispatch();
23732
23812
  const events = useEvents();
23733
23813
  const spinnerTimeout = hooks_module_s(null);
@@ -23771,7 +23851,6 @@ const useSeamlyChat = () => {
23771
23851
  prevIsOpen.current = isOpen;
23772
23852
  prevIsVisible.current = isVisible;
23773
23853
  }, [isOpen, isVisible, sendAssertive, t]);
23774
- hooks_module_y(() => {}, [visible, sendAssertive]);
23775
23854
  hooks_module_y(() => {
23776
23855
  // This delays the start of the loading inidicator we set when we initialise
23777
23856
  // the application. This is done to only avoid BSOD on initial load if DCX is slow.
@@ -23877,7 +23956,7 @@ const useSeamlyIdleDetachCountdown = () => {
23877
23956
  } = useSeamlyStateContext();
23878
23957
  const {
23879
23958
  isOpen: isSeamlyOpen
23880
- } = use_seamly_visibility();
23959
+ } = useVisibility();
23881
23960
  const stableState = hooks_module_s({});
23882
23961
  stableState.current = {
23883
23962
  hasCountdown: idleDetachCountdown.hasCountdown,
@@ -24077,8 +24156,6 @@ const useSeamlyResumeConversationPrompt = () => {
24077
24156
 
24078
24157
 
24079
24158
 
24080
-
24081
-
24082
24159
  // This hook isn't used within the core
24083
24160
  // But it is used in implementations
24084
24161
  // and imported directly from this file
@@ -24253,7 +24330,7 @@ const ModalWrapper = ({
24253
24330
  const {
24254
24331
  isOpen,
24255
24332
  setVisibility
24256
- } = use_seamly_visibility();
24333
+ } = useVisibility();
24257
24334
  const container = hooks_module_s(null);
24258
24335
  const focusTrap = hooks_module_s(null);
24259
24336
 
@@ -24432,19 +24509,19 @@ const Icon = ({
24432
24509
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
24433
24510
 
24434
24511
  const {
24435
- createActions: utils_createActions,
24512
+ createActions: translations_utils_createActions,
24436
24513
  createReducer: translations_utils_createReducer,
24437
24514
  selectState: translations_utils_selectState
24438
24515
  } = createDomain('translations');
24439
24516
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
24440
24517
 
24441
- const [enable, disable] = utils_createActions('translate', {
24518
+ const [enable, disable] = translations_utils_createActions('translate', {
24442
24519
  enable: locale => ({
24443
24520
  locale
24444
24521
  }),
24445
24522
  disable: () => ({})
24446
24523
  });
24447
- const [enableEvent, disableEvent] = utils_createActions('event', {
24524
+ const [enableEvent, disableEvent] = translations_utils_createActions('event', {
24448
24525
  enable: payloadId => ({
24449
24526
  payloadId
24450
24527
  }),
@@ -26115,7 +26192,7 @@ const AppFrame = ({
26115
26192
  isOpen,
26116
26193
  isVisible,
26117
26194
  setVisibility
26118
- } = use_seamly_visibility();
26195
+ } = useVisibility();
26119
26196
  const {
26120
26197
  zIndex,
26121
26198
  showFaq
@@ -26872,7 +26949,7 @@ function ChatFrame({
26872
26949
  } = useInterrupt();
26873
26950
  const {
26874
26951
  isOpen
26875
- } = use_seamly_visibility();
26952
+ } = useVisibility();
26876
26953
 
26877
26954
  const getContent = () => {
26878
26955
  if (hasInterrupt) {
@@ -26904,6 +26981,7 @@ function ChatFrame({
26904
26981
 
26905
26982
 
26906
26983
 
26984
+
26907
26985
  const ToggleButton = ({
26908
26986
  onOpenChat
26909
26987
  }) => {
@@ -26913,7 +26991,7 @@ const ToggleButton = ({
26913
26991
  const titleId = useGeneratedId();
26914
26992
  const {
26915
26993
  isOpen
26916
- } = use_seamly_visibility();
26994
+ } = useVisibility();
26917
26995
  const prevIsOpen = hooks_module_s(null);
26918
26996
  const buttonRef = hooks_module_s(null);
26919
26997
  const lastEventRef = hooks_module_s();
@@ -26994,6 +27072,7 @@ const ToggleButton = ({
26994
27072
 
26995
27073
 
26996
27074
 
27075
+
26997
27076
  const AgentInfo = () => {
26998
27077
  const {
26999
27078
  t
@@ -27005,7 +27084,7 @@ const AgentInfo = () => {
27005
27084
  const unreadMessageCount = useSeamlyUnreadCount();
27006
27085
  const {
27007
27086
  isOpen
27008
- } = use_seamly_visibility();
27087
+ } = useVisibility();
27009
27088
  const currentAgent = useSeamlyCurrentAgent();
27010
27089
  const {
27011
27090
  hasInterrupt
@@ -28509,7 +28588,6 @@ mustache.Writer = Writer;
28509
28588
 
28510
28589
 
28511
28590
 
28512
-
28513
28591
  mustache_mustache.escape = function (escapeText) {
28514
28592
  return escapeText;
28515
28593
  };
@@ -28518,7 +28596,7 @@ const parseLinkVariable = variable => {
28518
28596
  return `<a href='${variable.url}' data-link-id='${variable.id}' ${variable.newTab ? 'target="_blank"' : ''}>${variable.name}</a>`;
28519
28597
  };
28520
28598
 
28521
- function parseRichtText(text, variables = {}) {
28599
+ function parseRichText(text, variables = {}) {
28522
28600
  var _context;
28523
28601
 
28524
28602
  const view = {};
@@ -28546,15 +28624,6 @@ function parseRichtText(text, variables = {}) {
28546
28624
  mustache_mustache.escape = oldEscape;
28547
28625
  return output;
28548
28626
  }
28549
-
28550
- const useTextRendering = ({
28551
- text,
28552
- variables = {}
28553
- }) => {
28554
- return hooks_module_A(() => parseRichtText(text, variables), [text, variables]);
28555
- };
28556
-
28557
- /* harmony default export */ var use_text_rendering = (useTextRendering);
28558
28627
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/text.js
28559
28628
 
28560
28629
 
@@ -28579,32 +28648,37 @@ function text_objectSpread(target) { for (var i = 1; i < arguments.length; i++)
28579
28648
 
28580
28649
 
28581
28650
 
28651
+
28582
28652
  const Text = _ref => {
28583
28653
  let {
28584
28654
  event
28585
28655
  } = _ref,
28586
28656
  props = _objectWithoutProperties(_ref, text_excluded);
28587
28657
 
28588
- const {
28589
- payload
28590
- } = event;
28591
28658
  const [body] = useTranslatedEventData(event);
28592
- const eventClick = use_event_link_click_handler(payload.id);
28593
- const eventBody = use_text_rendering({
28594
- text: parse_body(body.text),
28595
- variables: body.variables
28596
- });
28659
+ const eventClick = use_event_link_click_handler(event.payload.id);
28660
+ const containerProps = hooks_module_A(() => {
28661
+ if (!event.payload.fromClient) {
28662
+ return {
28663
+ bodyProps: {
28664
+ dangerouslySetInnerHTML: {
28665
+ __html: parseRichText(parse_body(body.text), body.variables)
28666
+ }
28667
+ }
28668
+ };
28669
+ }
28670
+
28671
+ return {
28672
+ children: jsxRuntime_module_e("p", {
28673
+ children: body.text
28674
+ })
28675
+ };
28676
+ }, [body, event]);
28597
28677
  return jsxRuntime_module_e(message_container, text_objectSpread(text_objectSpread({
28598
28678
  type: "text",
28599
28679
  event: event,
28600
28680
  onClick: eventClick
28601
- }, props), {}, {
28602
- bodyProps: {
28603
- dangerouslySetInnerHTML: {
28604
- __html: eventBody
28605
- }
28606
- }
28607
- }));
28681
+ }, props), containerProps));
28608
28682
  };
28609
28683
 
28610
28684
  /* harmony default export */ var event_text = (Text);
@@ -29854,6 +29928,7 @@ const PrivacyDisclaimer = () => {
29854
29928
 
29855
29929
 
29856
29930
 
29931
+
29857
29932
  const Conversation = () => {
29858
29933
  const {
29859
29934
  t
@@ -29863,7 +29938,7 @@ const Conversation = () => {
29863
29938
  const isLoading = useSeamlyIsLoading();
29864
29939
  const {
29865
29940
  isOpen
29866
- } = use_seamly_visibility();
29941
+ } = useVisibility();
29867
29942
  const skiplinkTargetId = useSkiplink();
29868
29943
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
29869
29944
  hooks_module_y(() => {
@@ -30970,10 +31045,11 @@ const Interrupt = ({
30970
31045
 
30971
31046
 
30972
31047
 
31048
+
30973
31049
  const View = () => {
30974
31050
  const {
30975
31051
  isVisible
30976
- } = use_seamly_visibility();
31052
+ } = useVisibility();
30977
31053
  const {
30978
31054
  openChat,
30979
31055
  closeChat
@@ -31039,7 +31115,7 @@ const SeamlyInstanceFunctionsLoader = () => {
31039
31115
  const {
31040
31116
  setVisibility,
31041
31117
  visible
31042
- } = use_seamly_visibility();
31118
+ } = useVisibility();
31043
31119
  const currentVisibility = hooks_module_s(visible);
31044
31120
  const eventBus = hooks_module_T(SeamlyEventBusContext);
31045
31121
  const api = useSeamlyApiContext();
@@ -31167,6 +31243,7 @@ const SeamlyInstanceFunctionsLoader = () => {
31167
31243
 
31168
31244
 
31169
31245
 
31246
+
31170
31247
  const {
31171
31248
  SET_EVENTS_READ: seamly_read_state_SET_EVENTS_READ
31172
31249
  } = seamlyActions;
@@ -31180,7 +31257,7 @@ const SeamlyReadState = () => {
31180
31257
  const {
31181
31258
  isOpen,
31182
31259
  isVisible
31183
- } = use_seamly_visibility();
31260
+ } = useVisibility();
31184
31261
  const {
31185
31262
  sendAction
31186
31263
  } = use_seamly_commands();
@@ -31239,6 +31316,7 @@ const SeamlyReadState = () => {
31239
31316
 
31240
31317
 
31241
31318
 
31319
+
31242
31320
  const SeamlyNewNotifications = () => {
31243
31321
  const {
31244
31322
  t
@@ -31252,7 +31330,7 @@ const SeamlyNewNotifications = () => {
31252
31330
  } = useLiveRegion();
31253
31331
  const {
31254
31332
  isOpen
31255
- } = use_seamly_visibility();
31333
+ } = useVisibility();
31256
31334
  const prevIsOpen = hooks_module_s(null);
31257
31335
  const debounceFunc = hooks_module_s(null);
31258
31336
  const notifyUnread = hooks_module_A(() => {
@@ -31470,23 +31548,18 @@ const SeamlyActivityMonitor = ({
31470
31548
 
31471
31549
 
31472
31550
 
31473
-
31474
31551
  const SeamlyInitializer = () => {
31475
31552
  const {
31476
31553
  initUserSelectedOptions
31477
31554
  } = useSeamlyOptions();
31478
31555
  const seamlyInitialized = hooks_module_s(false);
31479
- const {
31480
- setVisibility
31481
- } = use_seamly_visibility();
31482
31556
  const config = useConfig();
31483
31557
  hooks_module_y(() => {
31484
31558
  if (config.api && !seamlyInitialized.current) {
31485
31559
  seamlyInitialized.current = true;
31486
31560
  initUserSelectedOptions();
31487
- setVisibility(visibilityStates.initialize);
31488
31561
  }
31489
- }, [initUserSelectedOptions, config, setVisibility]);
31562
+ }, [initUserSelectedOptions, config]);
31490
31563
  return null;
31491
31564
  };
31492
31565
 
@@ -31718,18 +31791,18 @@ const SeamlyEventSubscriber = ({
31718
31791
  case 'error':
31719
31792
  switch (payload.type) {
31720
31793
  case 'find_conversation_erred':
31721
- dispatch(set(new SeamlySessionExpiredError()));
31794
+ dispatch(set(new SeamlySessionExpiredError(event)));
31722
31795
  break;
31723
31796
 
31724
31797
  case 'seamly_offline':
31725
- dispatch(set(new SeamlyOfflineError()));
31798
+ dispatch(set(new SeamlyOfflineError(event)));
31726
31799
  dispatch({
31727
31800
  type: seamly_event_subscriber_CLEAR_EVENTS
31728
31801
  });
31729
31802
  break;
31730
31803
 
31731
31804
  default:
31732
- dispatch(set(new SeamlyGeneralError()));
31805
+ dispatch(set(new SeamlyGeneralError(event)));
31733
31806
  break;
31734
31807
  }
31735
31808
 
@@ -31902,6 +31975,53 @@ const SeamlyFileUpload = ({
31902
31975
  };
31903
31976
 
31904
31977
  /* harmony default export */ var seamly_file_upload = (SeamlyFileUpload);
31978
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/errors/index.js
31979
+
31980
+
31981
+ const {
31982
+ createAction: errors_createAction
31983
+ } = createDomain('errors');
31984
+ const catchError = errors_createAction('catch-error', error => ({
31985
+ error
31986
+ }));
31987
+ function errors_createMiddleware({
31988
+ api: seamlyApi
31989
+ }) {
31990
+ return ({
31991
+ getState
31992
+ }) => {
31993
+ const handleError = action => {
31994
+ const {
31995
+ errorCallback,
31996
+ namespace,
31997
+ api,
31998
+ layoutMode
31999
+ } = selectConfig(getState());
32000
+ errorCallback === null || errorCallback === void 0 ? void 0 : errorCallback(action.error, {
32001
+ namespace,
32002
+ api,
32003
+ layoutMode,
32004
+ conversationUrl: seamlyApi.getConversationUrl(),
32005
+ action: action.type ? action : undefined
32006
+ });
32007
+ };
32008
+
32009
+ return next => action => {
32010
+ try {
32011
+ if (action.error) {
32012
+ handleError(action);
32013
+ }
32014
+
32015
+ return next(action);
32016
+ } catch (error) {
32017
+ handleError({
32018
+ error
32019
+ });
32020
+ throw error;
32021
+ }
32022
+ };
32023
+ };
32024
+ }
31905
32025
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-core.js
31906
32026
 
31907
32027
 
@@ -31917,6 +32037,8 @@ const SeamlyFileUpload = ({
31917
32037
 
31918
32038
 
31919
32039
 
32040
+
32041
+
31920
32042
  const SeamlyCore = ({
31921
32043
  store,
31922
32044
  children,
@@ -31924,6 +32046,7 @@ const SeamlyCore = ({
31924
32046
  eventBus,
31925
32047
  api
31926
32048
  }) => {
32049
+ hooks_module_q(error => store.dispatch(catchError(error)));
31927
32050
  return jsxRuntime_module_e(StoreProvider, {
31928
32051
  store: store,
31929
32052
  children: jsxRuntime_module_e(SeamlyEventBusContext.Provider, {
@@ -33548,7 +33671,8 @@ class ConversationProducer {
33548
33671
  this.emit({
33549
33672
  type: 'error',
33550
33673
  payload: {
33551
- type: 'seamly_offline'
33674
+ type: 'seamly_offline',
33675
+ error: err
33552
33676
  }
33553
33677
  });
33554
33678
  });
@@ -33620,7 +33744,8 @@ class ConversationProducer {
33620
33744
  this.emit({
33621
33745
  type: 'error',
33622
33746
  payload: {
33623
- type: 'join_channel_erred'
33747
+ type: 'join_channel_erred',
33748
+ error: err
33624
33749
  }
33625
33750
  });
33626
33751
  this.emit({
@@ -33949,7 +34074,6 @@ class API {
33949
34074
  }) // withCredentials() is necessary to allow browsers to save received
33950
34075
  // cookies in CORS requests.
33951
34076
  .withCredentials().send({
33952
- authorizationRequired: true,
33953
34077
  externalId: this.externalId || undefined
33954
34078
  });
33955
34079
  const {
@@ -33970,7 +34094,7 @@ class API {
33970
34094
  return initialState;
33971
34095
  } catch (error) {
33972
34096
  if (error.status >= 500) {
33973
- throw new SeamlyGeneralError();
34097
+ throw new SeamlyGeneralError(error);
33974
34098
  }
33975
34099
 
33976
34100
  throw error;
@@ -34016,15 +34140,15 @@ class API {
34016
34140
  };
34017
34141
  } catch (error) {
34018
34142
  if (error.status === 401) {
34019
- throw new SeamlyUnauthorizedError();
34143
+ throw new SeamlyUnauthorizedError(error);
34020
34144
  }
34021
34145
 
34022
34146
  if (error.status === 404) {
34023
- throw new SeamlySessionExpiredError();
34147
+ throw new SeamlySessionExpiredError(error);
34024
34148
  }
34025
34149
 
34026
34150
  if (error.status >= 500) {
34027
- throw new SeamlyGeneralError();
34151
+ throw new SeamlyGeneralError(error);
34028
34152
  }
34029
34153
 
34030
34154
  throw error;
@@ -34089,11 +34213,11 @@ class API {
34089
34213
  return body.config;
34090
34214
  }).catch(error => {
34091
34215
  if (error.status === 404) {
34092
- throw new SeamlyConfigurationError();
34216
+ throw new SeamlyConfigurationError(error);
34093
34217
  }
34094
34218
 
34095
34219
  if (error.status >= 500) {
34096
- throw new SeamlyGeneralError();
34220
+ throw new SeamlyGeneralError(error);
34097
34221
  }
34098
34222
 
34099
34223
  throw error;
@@ -34110,15 +34234,15 @@ class API {
34110
34234
  return omit(body.conversation, ['accessToken', 'channelName']);
34111
34235
  }).catch(error => {
34112
34236
  if (error.status === 401) {
34113
- throw new SeamlyUnauthorizedError();
34237
+ throw new SeamlyUnauthorizedError(error);
34114
34238
  }
34115
34239
 
34116
34240
  if (error.status === 404) {
34117
- throw new SeamlySessionExpiredError();
34241
+ throw new SeamlySessionExpiredError(error);
34118
34242
  }
34119
34243
 
34120
34244
  if (error.status >= 500) {
34121
- throw new SeamlyGeneralError();
34245
+ throw new SeamlyGeneralError(error);
34122
34246
  }
34123
34247
 
34124
34248
  throw error;
@@ -34141,7 +34265,7 @@ class API {
34141
34265
  return body.translations;
34142
34266
  } catch (error) {
34143
34267
  if (error.status >= 500) {
34144
- throw new SeamlyGeneralError();
34268
+ throw new SeamlyGeneralError(error);
34145
34269
  }
34146
34270
 
34147
34271
  throw error;
@@ -34280,9 +34404,24 @@ function options_middleware_createMiddleware({
34280
34404
  ;// CONCATENATED MODULE: ./src/javascripts/domains/options/index.js
34281
34405
 
34282
34406
  ;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
34407
+
34408
+
34409
+
34410
+
34411
+
34412
+
34413
+
34414
+
34415
+
34416
+
34417
+ function state_reducer_ownKeys(object, enumerableOnly) { var keys = keys_default()(object); if ((get_own_property_symbols_default())) { var symbols = get_own_property_symbols_default()(object); if (enumerableOnly) { symbols = filter_default()(symbols).call(symbols, function (sym) { return get_own_property_descriptor_default()(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
34418
+
34419
+ function state_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; for_each_default()(_context = state_reducer_ownKeys(Object(source), true)).call(_context, function (key) { defineProperty_defineProperty(target, key, source[key]); }); } else if ((get_own_property_descriptors_default())) { define_properties_default()(target, get_own_property_descriptors_default()(source)); } else { var _context2; for_each_default()(_context2 = state_reducer_ownKeys(Object(source))).call(_context2, function (key) { define_property_default()(target, key, get_own_property_descriptor_default()(source, key)); }); } } return target; }
34420
+
34283
34421
  // Legacy state reducer. Do not add new features here but extract/create new reducers as needed
34284
34422
 
34285
34423
 
34424
+
34286
34425
  const state_reducer_initialState = {
34287
34426
  events: [],
34288
34427
  initialState: {},
@@ -34293,7 +34432,6 @@ const state_reducer_initialState = {
34293
34432
  isActive: false
34294
34433
  },
34295
34434
  resumeConversationPrompt: false,
34296
- visible: visibilityStates.hidden,
34297
34435
  serviceInfo: {
34298
34436
  activeServiceSessionId: ''
34299
34437
  },
@@ -34330,6 +34468,15 @@ const state_reducer_initialState = {
34330
34468
  seamlyContainerElement: null
34331
34469
  };
34332
34470
  function stateReducer(state = state_reducer_initialState, action) {
34471
+ if (action.type === String(actions_reset)) {
34472
+ const {
34473
+ visible
34474
+ } = state;
34475
+ return state_reducer_objectSpread(state_reducer_objectSpread({}, state_reducer_initialState), {}, {
34476
+ visible
34477
+ });
34478
+ }
34479
+
34333
34480
  return seamlyStateReducer(state, action);
34334
34481
  }
34335
34482
  ;// CONCATENATED MODULE: ./src/javascripts/domains/store/index.js
@@ -34343,9 +34490,12 @@ function stateReducer(state = state_reducer_initialState, action) {
34343
34490
 
34344
34491
 
34345
34492
 
34493
+
34494
+
34346
34495
  function store_createStore({
34347
34496
  initialState,
34348
- api
34497
+ api,
34498
+ eventBus
34349
34499
  } = {}) {
34350
34500
  const store = createReduxStore({
34351
34501
  reducers: {
@@ -34355,11 +34505,15 @@ function store_createStore({
34355
34505
  [String(forms_reducer)]: forms_reducer,
34356
34506
  [String(translations_reducer)]: translations_reducer,
34357
34507
  [String(i18n_reducer)]: i18n_reducer,
34358
- [String(interrupt_reducer)]: interrupt_reducer
34508
+ [String(interrupt_reducer)]: interrupt_reducer,
34509
+ [String(visibility_reducer)]: visibility_reducer
34359
34510
  },
34360
34511
  initialState,
34361
- middlewares: [es.withExtraArgument({
34512
+ middlewares: [errors_createMiddleware({
34362
34513
  api
34514
+ }), es.withExtraArgument({
34515
+ api,
34516
+ eventBus
34363
34517
  }), createMiddleware(), middleware_createMiddleware({
34364
34518
  api
34365
34519
  }), options_middleware_createMiddleware({
@@ -34440,9 +34594,10 @@ class Engine {
34440
34594
  });
34441
34595
 
34442
34596
  const store = store_createStore({
34443
- api: this.api
34597
+ api: this.api,
34598
+ eventBus: this.eventBus
34444
34599
  });
34445
- await store.dispatch(actions_initialize(renderConfig));
34600
+ await store.dispatch(app_actions_initialize(renderConfig));
34446
34601
 
34447
34602
  if (View) {
34448
34603
  S(jsxRuntime_module_e(seamly_core, {
@@ -34792,12 +34947,6 @@ function initializeExternalApi(appConfig) {
34792
34947
 
34793
34948
  // Used by: StyleGuide
34794
34949
 
34795
- // Used by: StyleGuide
34796
-
34797
- // Used by: StyleGuide
34798
-
34799
- // Used by: StyleGuide
34800
-
34801
34950
 
34802
34951
  }();
34803
34952
  /******/ return __webpack_exports__;