@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
@@ -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,28 @@ 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));
22885
22884
  }
22886
22885
 
22886
+ this.originalError = originalError;
22887
+ }
22888
+
22889
+ }
22890
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-general-error.js
22891
+
22892
+ class SeamlyGeneralError extends SeamlyBaseError {
22893
+ constructor(originalError, ...params) {
22894
+ super(originalError, ...params);
22887
22895
  this.name = 'SeamlyGeneralError';
22888
22896
  this.langKey = 'errors.general';
22889
22897
  this.action = 'reset';
@@ -22891,59 +22899,62 @@ class SeamlyGeneralError extends Error {
22891
22899
 
22892
22900
  }
22893
22901
  ;// 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
22902
 
22903
+ class SeamlyConfigurationError extends SeamlyBaseError {
22904
+ constructor(originalError, ...params) {
22905
+ super(originalError, ...params);
22902
22906
  this.name = 'SeamlyConfigurationError';
22903
22907
  this.langKey = 'errors.configError';
22904
22908
  }
22905
22909
 
22906
22910
  }
22907
22911
  ;// 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
22912
 
22913
+ class SeamlySessionExpiredError extends SeamlyBaseError {
22914
+ constructor(originalError, ...params) {
22915
+ super(originalError, ...params);
22916
22916
  this.name = 'SeamlySessionExpiredError';
22917
22917
  this.action = 'reset';
22918
22918
  }
22919
22919
 
22920
22920
  }
22921
22921
  ;// 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
22922
 
22923
+ class SeamlyOfflineError extends SeamlyBaseError {
22924
+ constructor(originalError, ...params) {
22925
+ super(originalError, ...params);
22930
22926
  this.name = 'SeamlyOfflineError';
22931
22927
  this.langKey = 'errors.seamlyOffline';
22932
22928
  }
22933
22929
 
22934
22930
  }
22935
22931
  ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unauthorized-error.js
22936
- class SeamlyUnauthorizedError extends Error {
22932
+
22933
+ class SeamlyUnauthorizedError extends SeamlyBaseError {
22934
+ constructor(originalError, ...params) {
22935
+ super(originalError, ...params);
22936
+ this.name = 'SeamlyUnauthorizedError';
22937
+ this.langKey = 'errors.general';
22938
+ this.action = 'reset';
22939
+ }
22940
+
22941
+ }
22942
+ ;// CONCATENATED MODULE: ./src/javascripts/api/errors/seamly-unavailable-error.js
22943
+ /**
22944
+ * This error is used to alert the user that there's a problem with the connection
22945
+ * when initialising the application because of a connection issue on either the server
22946
+ * or the client side.
22947
+ */
22948
+ class SeamlyUnavailableError extends Error {
22937
22949
  constructor(params) {
22938
22950
  super(params);
22939
22951
 
22940
22952
  if (Error.captureStackTrace) {
22941
- Error.captureStackTrace(this, SeamlyUnauthorizedError);
22953
+ Error.captureStackTrace(this, SeamlyUnavailableError);
22942
22954
  }
22943
22955
 
22944
- this.name = 'SeamlyUnauthorizedError';
22945
- this.langKey = 'errors.general';
22946
- this.action = 'reset';
22956
+ this.name = 'SeamlyUnavailableError';
22957
+ this.langKey = 'errors.seamlyUnavailable';
22947
22958
  }
22948
22959
 
22949
22960
  }
@@ -22955,84 +22966,201 @@ class SeamlyUnauthorizedError extends Error {
22955
22966
 
22956
22967
 
22957
22968
 
22958
- const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError];
22959
- function middleware_createMiddleware() {
22969
+ const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError, SeamlyUnavailableError];
22970
+ function middleware_createMiddleware({
22971
+ api
22972
+ }) {
22960
22973
  return () => next => action => {
22961
- if (action.type === String(set)) {
22962
- if (!some_default()(handledErrorTypes).call(handledErrorTypes, ErrorType => action.error instanceof ErrorType)) {
22963
- throw action.error;
22974
+ const {
22975
+ error
22976
+ } = action;
22977
+
22978
+ if (error) {
22979
+ if (!some_default()(handledErrorTypes).call(handledErrorTypes, ErrorType => error instanceof ErrorType)) {
22980
+ throw error;
22981
+ } else if (error.action === 'reset') {
22982
+ // [SMLY-942] We clear the store before a reset to force a new conversation if the page is refreshed before the conversation is reset
22983
+ api.disconnect().then(() => {
22984
+ api.clearStore();
22985
+ });
22964
22986
  }
22965
22987
  }
22966
22988
 
22967
22989
  return next(action);
22968
22990
  };
22969
22991
  }
22970
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
22992
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
22993
+
22994
+ const {
22995
+ createAction: app_utils_createAction,
22996
+ createThunk: app_utils_createThunk,
22997
+ createReducer: app_utils_createReducer,
22998
+ selectState: app_utils_selectState
22999
+ } = createDomain('app');
23000
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
22971
23001
 
22972
23002
 
23003
+ const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
22973
23004
 
23005
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/utils.js
22974
23006
 
22975
23007
 
23008
+ const {
23009
+ createAction: visibility_utils_createAction,
23010
+ createActions: utils_createActions,
23011
+ createThunk: visibility_utils_createThunk,
23012
+ createReducer: visibility_utils_createReducer,
23013
+ selectState: visibility_utils_selectState
23014
+ } = createDomain('visibility');
23015
+ const calculateVisibility = ({
23016
+ hasResponded,
23017
+ previousVisibility,
23018
+ requestedVisibility,
23019
+ config
23020
+ }) => {
23021
+ const {
23022
+ defaults,
23023
+ layoutMode,
23024
+ hideOnNoUserResponse
23025
+ } = config;
23026
+ const {
23027
+ visible: defaultVisibility
23028
+ } = defaults || {}; // Requesting open should override the responded check.
22976
23029
 
23030
+ if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
23031
+ return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
23032
+ }
22977
23033
 
23034
+ const baseVisibility = layoutMode === 'inline' ? visibilityStates.open : visibilityStates.minimized;
23035
+ return requestedVisibility || previousVisibility || defaultVisibility || baseVisibility;
23036
+ };
23037
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/selectors.js
22978
23038
 
22979
23039
 
23040
+ const selectVisibility = createSelector(visibility_utils_selectState, state => state.visibility);
22980
23041
 
22981
- 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; }
23042
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/actions.js
22982
23043
 
22983
- 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; }
22984
23044
 
22985
23045
 
22986
23046
 
22987
- const reducer_initialState = {
22988
- error: undefined
22989
- };
22990
- /* harmony default export */ var interrupt_reducer = (interrupt_utils_createReducer({
22991
- [set]: (state, {
22992
- error
22993
- }) => {
22994
- return interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
22995
- error
22996
- });
22997
- },
22998
- [clear]: () => {
22999
- return reducer_initialState;
23047
+
23048
+
23049
+
23050
+
23051
+
23052
+
23053
+ 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; }
23054
+
23055
+ 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; }
23056
+
23057
+
23058
+
23059
+
23060
+
23061
+
23062
+
23063
+
23064
+ const setFromStorage = visibility_utils_createAction('setFromStorage', visibility => ({
23065
+ visibility
23066
+ }));
23067
+ const validVisibilityStates = [visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden];
23068
+ const actions_setVisibility = visibility_utils_createThunk('set', (requestedVisibility, {
23069
+ getState,
23070
+ extra: {
23071
+ api,
23072
+ eventBus
23000
23073
  }
23001
- }, reducer_initialState));
23002
- ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
23074
+ }) => {
23075
+ const state = getState();
23076
+ const previousVisibility = selectVisibility(state);
23077
+ const hasResponded = selectUserHasResponded(state);
23078
+ const hasConversation = api.hasConversation();
23079
+ const config = selectConfig(state);
23080
+ const {
23081
+ visibilityCallback = calculateVisibility,
23082
+ layoutMode
23083
+ } = config;
23084
+ const {
23085
+ unreadEvents: unreadMessageCount
23086
+ } = seamly_state_hooks_selectState(state);
23087
+ const calculatedVisibility = visibilityCallback({
23088
+ hasConversation,
23089
+ hasResponded,
23090
+ previousVisibility,
23091
+ requestedVisibility,
23092
+ config
23093
+ });
23003
23094
 
23095
+ if (!includes_default()(validVisibilityStates).call(validVisibilityStates, calculatedVisibility)) {
23096
+ console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
23097
+ return undefined;
23098
+ }
23004
23099
 
23100
+ if (previousVisibility === calculatedVisibility) {
23101
+ return undefined;
23102
+ } // Store the user-requested visibility in order to reinitialize after refresh
23005
23103
 
23006
23104
 
23105
+ api.store.set(StoreKey, actions_objectSpread(actions_objectSpread({}, api.store.get(StoreKey) || {}), {}, {
23106
+ [layoutMode]: requestedVisibility
23107
+ }));
23007
23108
 
23109
+ if (requestedVisibility) {
23110
+ eventBus.emit('ui.visible', requestedVisibility, {
23111
+ visibility: requestedVisibility,
23112
+ hasConversation,
23113
+ hasResponded,
23114
+ unreadMessageCount
23115
+ });
23116
+ }
23008
23117
 
23009
- ;// CONCATENATED MODULE: ./src/javascripts/domains/app/utils.js
23118
+ return calculatedVisibility;
23119
+ });
23120
+ const actions_initialize = visibility_utils_createThunk('initialize', async (locale, {
23121
+ dispatch,
23122
+ getState,
23123
+ extra: {
23124
+ api
23125
+ }
23126
+ }) => {
23127
+ var _api$store$get;
23010
23128
 
23011
- const {
23012
- createAction: app_utils_createAction,
23013
- createThunk: app_utils_createThunk,
23014
- createReducer: app_utils_createReducer,
23015
- selectState: app_utils_selectState
23016
- } = createDomain('app');
23129
+ // initialize stored visibility
23130
+ const {
23131
+ layoutMode
23132
+ } = selectConfig(getState());
23133
+ const storedVisibility = (_api$store$get = api.store.get(StoreKey)) === null || _api$store$get === void 0 ? void 0 : _api$store$get[layoutMode];
23134
+
23135
+ if (storedVisibility) {
23136
+ dispatch(setFromStorage(storedVisibility));
23137
+ }
23138
+
23139
+ dispatch(actions_setVisibility(visibilityStates.initialize));
23140
+ });
23017
23141
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/actions.js
23018
23142
 
23019
23143
 
23020
23144
 
23021
23145
 
23022
23146
 
23147
+
23148
+
23023
23149
  const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
23024
23150
  hasResponded
23025
23151
  }));
23026
- const actions_initialize = app_utils_createThunk('initialize', async (config, {
23152
+ const app_actions_initialize = app_utils_createThunk('initialize', async (config, {
23027
23153
  dispatch,
23028
23154
  extra: {
23029
23155
  api
23030
23156
  }
23031
23157
  }) => {
23032
- try {
23033
- var _config$context;
23158
+ var _config$context;
23159
+
23160
+ dispatch(initialize(config));
23161
+ let locale = config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale;
23034
23162
 
23035
- dispatch(initialize(config));
23163
+ try {
23036
23164
  const {
23037
23165
  features,
23038
23166
  defaultLocale
@@ -23041,38 +23169,39 @@ const actions_initialize = app_utils_createThunk('initialize', async (config, {
23041
23169
  type: seamlyActions.SET_FEATURES,
23042
23170
  features
23043
23171
  });
23044
- let locale = (config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale) || defaultLocale;
23172
+ locale = locale || defaultLocale;
23045
23173
  dispatch(setInitialLocale(locale));
23174
+ } catch (e) {
23175
+ throw new SeamlyUnavailableError();
23176
+ }
23046
23177
 
23047
- try {
23048
- if (api.hasConversation()) {
23049
- var _initialState$transla;
23178
+ try {
23179
+ if (api.hasConversation()) {
23180
+ var _initialState$transla;
23050
23181
 
23051
- const initialState = await api.getConversationIntitialState();
23052
- dispatch({
23053
- type: seamlyActions.SET_INITIAL_STATE,
23054
- initialState
23055
- });
23056
- locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
23182
+ const initialState = await api.getConversationIntitialState();
23183
+ dispatch({
23184
+ type: seamlyActions.SET_INITIAL_STATE,
23185
+ initialState
23186
+ });
23187
+ locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
23057
23188
 
23058
- if ('userResponded' in initialState) {
23059
- dispatch(setHasResponded(initialState.userResponded));
23060
- }
23189
+ if ('userResponded' in initialState) {
23190
+ dispatch(setHasResponded(initialState.userResponded));
23061
23191
  }
23062
- } catch (error) {
23063
- dispatch(set(error));
23192
+ }
23193
+ } catch (e) {
23194
+ if (e instanceof SeamlySessionExpiredError) {
23195
+ throw e;
23064
23196
  }
23065
23197
 
23198
+ throw new SeamlyUnavailableError();
23199
+ } finally {
23066
23200
  await dispatch(setLocale(locale));
23067
- } catch (error) {
23068
- dispatch(set(error));
23201
+ dispatch(actions_initialize());
23069
23202
  }
23070
23203
  });
23071
- ;// CONCATENATED MODULE: ./src/javascripts/domains/app/selectors.js
23072
-
23073
-
23074
- const selectUserHasResponded = createSelector(app_utils_selectState, state => state.userHasResponded);
23075
-
23204
+ const actions_reset = app_utils_createAction('reset', () => {});
23076
23205
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/hooks.js
23077
23206
 
23078
23207
 
@@ -23096,7 +23225,7 @@ function app_reducer_objectSpread(target) { for (var i = 1; i < arguments.length
23096
23225
 
23097
23226
 
23098
23227
 
23099
- const app_reducer_initialState = {
23228
+ const reducer_initialState = {
23100
23229
  userHasResponded: false
23101
23230
  };
23102
23231
  /* harmony default export */ var app_reducer = (app_utils_createReducer({
@@ -23105,12 +23234,118 @@ const app_reducer_initialState = {
23105
23234
  }) => app_reducer_objectSpread(app_reducer_objectSpread({}, state), {}, {
23106
23235
  userHasResponded: hasResponded
23107
23236
  })
23108
- }, app_reducer_initialState));
23237
+ }, reducer_initialState));
23109
23238
  ;// CONCATENATED MODULE: ./src/javascripts/domains/app/index.js
23110
23239
 
23111
23240
 
23112
23241
 
23113
23242
 
23243
+
23244
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/reducer.js
23245
+
23246
+
23247
+
23248
+
23249
+
23250
+
23251
+
23252
+
23253
+
23254
+
23255
+ 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; }
23256
+
23257
+ 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; }
23258
+
23259
+
23260
+
23261
+
23262
+ const interrupt_reducer_initialState = {
23263
+ error: undefined
23264
+ };
23265
+
23266
+ const handleError = (state, {
23267
+ error
23268
+ }) => interrupt_reducer_objectSpread(interrupt_reducer_objectSpread({}, state), {}, {
23269
+ error
23270
+ });
23271
+
23272
+ /* harmony default export */ var interrupt_reducer = (interrupt_utils_createReducer({
23273
+ [set]: handleError,
23274
+ [app_actions_initialize.rejected]: handleError,
23275
+ [clear]: () => interrupt_reducer_initialState,
23276
+ [actions_reset]: () => interrupt_reducer_initialState
23277
+ }, interrupt_reducer_initialState));
23278
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/index.js
23279
+
23280
+
23281
+
23282
+
23283
+
23284
+
23285
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/hooks.js
23286
+
23287
+
23288
+
23289
+
23290
+
23291
+
23292
+ const useVisibility = () => {
23293
+ const dispatch = useStoreDispatch();
23294
+ const visible = useSelector(selectVisibility);
23295
+ const isVisible = visible ? visible !== visibilityStates.hidden : false;
23296
+ const {
23297
+ layoutMode
23298
+ } = useConfig();
23299
+ const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
23300
+ const setVisibility = F(visibility => dispatch(actions_setVisibility(visibility)), [dispatch]);
23301
+ return {
23302
+ isVisible,
23303
+ isOpen,
23304
+ visible,
23305
+ setVisibility
23306
+ };
23307
+ };
23308
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/reducer.js
23309
+
23310
+
23311
+
23312
+
23313
+
23314
+
23315
+
23316
+
23317
+
23318
+
23319
+ 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; }
23320
+
23321
+ 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; }
23322
+
23323
+
23324
+
23325
+
23326
+ const visibility_reducer_initialState = {
23327
+ visibility: visibilityStates.initialize
23328
+ };
23329
+ /* harmony default export */ var visibility_reducer = (visibility_utils_createReducer({
23330
+ [setFromStorage]: (state, {
23331
+ visibility
23332
+ }) => visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
23333
+ visibility
23334
+ }),
23335
+ [actions_setVisibility.fulfilled]: (state, {
23336
+ payload: visibility
23337
+ }) => visibility ? visibility_reducer_objectSpread(visibility_reducer_objectSpread({}, state), {}, {
23338
+ visibility
23339
+ }) : state
23340
+ }, visibility_reducer_initialState));
23341
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/visibility/index.js
23342
+
23343
+
23344
+
23345
+
23346
+
23347
+
23348
+
23114
23349
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-commands.js
23115
23350
 
23116
23351
 
@@ -23144,15 +23379,10 @@ function use_seamly_commands_objectSpread(target) { for (var i = 1; i < argument
23144
23379
 
23145
23380
  const {
23146
23381
  ADD_EVENT: use_seamly_commands_ADD_EVENT,
23147
- CLEAR_EVENTS: use_seamly_commands_CLEAR_EVENTS,
23148
23382
  SET_IS_LOADING: use_seamly_commands_SET_IS_LOADING,
23149
- CLEAR_PARTICIPANTS: use_seamly_commands_CLEAR_PARTICIPANTS,
23150
23383
  SET_HEADER_SUB_TITLE: use_seamly_commands_SET_HEADER_SUB_TITLE,
23151
23384
  SET_INITIAL_STATE: use_seamly_commands_SET_INITIAL_STATE,
23152
- CLEAR_FEATURES: use_seamly_commands_CLEAR_FEATURES,
23153
- SET_FEATURES: use_seamly_commands_SET_FEATURES,
23154
- RESET_UPLOAD_STATE: use_seamly_commands_RESET_UPLOAD_STATE,
23155
- RESET_ENTRY_STATE: use_seamly_commands_RESET_ENTRY_STATE
23385
+ SET_FEATURES: use_seamly_commands_SET_FEATURES
23156
23386
  } = seamlyActions;
23157
23387
 
23158
23388
  const useSeamlyCommands = () => {
@@ -23164,7 +23394,7 @@ const useSeamlyCommands = () => {
23164
23394
  const hasConversation = useSeamlyHasConversation();
23165
23395
  const {
23166
23396
  visible: visibility
23167
- } = useSeamlyStateContext();
23397
+ } = useVisibility();
23168
23398
  const unreadMessageCount = useSeamlyUnreadCount();
23169
23399
  const emitEvent = F((...args) => {
23170
23400
  eventBus.emit(...args);
@@ -23186,26 +23416,12 @@ const useSeamlyCommands = () => {
23186
23416
  });
23187
23417
  }, [api, appConfig, emitEvent, hasResponded, hasConversation, visibility, unreadMessageCount]);
23188
23418
  const reset = F(async () => {
23419
+ dispatch(actions_reset());
23189
23420
  dispatch(clear());
23190
- dispatch({
23191
- type: use_seamly_commands_CLEAR_EVENTS
23192
- });
23193
23421
  dispatch({
23194
23422
  type: use_seamly_commands_SET_IS_LOADING,
23195
23423
  isLoading: true
23196
23424
  });
23197
- dispatch({
23198
- type: use_seamly_commands_CLEAR_PARTICIPANTS
23199
- });
23200
- dispatch({
23201
- type: use_seamly_commands_RESET_UPLOAD_STATE
23202
- });
23203
- dispatch({
23204
- type: use_seamly_commands_RESET_ENTRY_STATE
23205
- });
23206
- dispatch({
23207
- type: use_seamly_commands_CLEAR_FEATURES
23208
- });
23209
23425
  const {
23210
23426
  agentName
23211
23427
  } = appConfig.defaults || {};
@@ -23257,21 +23473,13 @@ const useSeamlyCommands = () => {
23257
23473
 
23258
23474
  const message = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, getTextMessageBase(body)), config);
23259
23475
 
23260
- const sanitizedText = sanitizeText(body);
23261
-
23262
- const sanitizedMessage = use_seamly_commands_objectSpread(use_seamly_commands_objectSpread({}, message), {}, {
23263
- body: {
23264
- text: sanitizedText
23265
- }
23266
- });
23267
-
23268
23476
  api.send('message', message);
23269
23477
  emitEvent('message', message);
23270
23478
  dispatch({
23271
23479
  type: use_seamly_commands_ADD_EVENT,
23272
23480
  event: {
23273
23481
  type: 'message',
23274
- payload: sanitizedMessage
23482
+ payload: message
23275
23483
  }
23276
23484
  });
23277
23485
  }, [api, dispatch, emitEvent, getTextMessageBase]);
@@ -23567,132 +23775,6 @@ const useSeamlyEntry = () => {
23567
23775
  setBlockAutoEntrySwitch
23568
23776
  };
23569
23777
  };
23570
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-stored-visibility.js
23571
-
23572
-
23573
-
23574
-
23575
-
23576
-
23577
-
23578
-
23579
-
23580
-
23581
- 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; }
23582
-
23583
- 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; }
23584
-
23585
-
23586
-
23587
-
23588
-
23589
- const useSeamlyStoredVisibility = () => {
23590
- const {
23591
- layoutMode
23592
- } = useConfig();
23593
- const key = 'visibility';
23594
- const {
23595
- get,
23596
- set
23597
- } = useSeamlyObjectStore();
23598
- let storedVisibilityObj = {};
23599
- const savedVisibility = get ? get(key) : {};
23600
-
23601
- if (savedVisibility) {
23602
- storedVisibilityObj = savedVisibility;
23603
- }
23604
-
23605
- const setStoredVisibility = F(state => {
23606
- const saved = get ? get(key) : {};
23607
- set(key, use_seamly_stored_visibility_objectSpread(use_seamly_stored_visibility_objectSpread({}, saved), {}, {
23608
- [layoutMode]: state
23609
- }));
23610
- }, [set, get, layoutMode]);
23611
- return [layoutMode ? storedVisibilityObj[layoutMode] : null, set && layoutMode ? setStoredVisibility : null];
23612
- };
23613
-
23614
- /* harmony default export */ var use_seamly_stored_visibility = (useSeamlyStoredVisibility);
23615
- ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-visibility.js
23616
-
23617
-
23618
-
23619
-
23620
-
23621
-
23622
-
23623
-
23624
-
23625
-
23626
- const {
23627
- SET_VISIBILITY: use_seamly_visibility_SET_VISIBILITY
23628
- } = seamlyActions;
23629
-
23630
- const useSeamlyVisibility = () => {
23631
- const config = useConfig();
23632
- const {
23633
- layoutMode,
23634
- visibilityCallback
23635
- } = config;
23636
- const {
23637
- visible
23638
- } = useSeamlyStateContext();
23639
- const {
23640
- emitEvent
23641
- } = use_seamly_commands();
23642
- const dispatch = use_seamly_dispatch();
23643
- const [storedVisibility, setStoredVisibility] = use_seamly_stored_visibility();
23644
- const hasResponded = useUserHasResponded();
23645
- const hasConversation = useSeamlyHasConversation();
23646
- const unreadMessageCount = useSeamlyUnreadCount();
23647
- const isVisible = visible ? visible !== visibilityStates.hidden : false;
23648
- const isOpen = visible && layoutMode ? visible === visibilityStates.open || layoutMode === 'inline' && visible !== visibilityStates.hidden : false;
23649
- const setVisibility = F(visibility => {
23650
- var _context;
23651
-
23652
- const visibilityFn = visibilityCallback || calculateVisibility;
23653
- const requestedVisibility = visibilityFn({
23654
- hasConversation,
23655
- hasResponded,
23656
- previousVisibility: storedVisibility || null,
23657
- requestedVisibility: visibility,
23658
- config
23659
- });
23660
-
23661
- if (!includes_default()(_context = [visibilityStates.open, visibilityStates.minimized, visibilityStates.hidden]).call(_context, requestedVisibility)) {
23662
- console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');
23663
- return;
23664
- }
23665
-
23666
- if (requestedVisibility !== visible) {
23667
- if (setStoredVisibility) {
23668
- setStoredVisibility(requestedVisibility);
23669
- } // Don't broadcast the init visibility state
23670
-
23671
-
23672
- if (visibility) {
23673
- emitEvent('ui.visible', requestedVisibility, {
23674
- visibility: requestedVisibility,
23675
- hasConversation,
23676
- hasResponded,
23677
- unreadMessageCount
23678
- });
23679
- }
23680
-
23681
- dispatch({
23682
- type: use_seamly_visibility_SET_VISIBILITY,
23683
- visible: requestedVisibility
23684
- });
23685
- }
23686
- }, [visible, emitEvent, dispatch, hasConversation, hasResponded, storedVisibility, visibilityCallback, config, setStoredVisibility, unreadMessageCount]);
23687
- return {
23688
- isVisible,
23689
- isOpen,
23690
- visible,
23691
- setVisibility
23692
- };
23693
- };
23694
-
23695
- /* harmony default export */ var use_seamly_visibility = (useSeamlyVisibility);
23696
23778
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.js
23697
23779
 
23698
23780
 
@@ -23715,9 +23797,8 @@ const useSeamlyChat = () => {
23715
23797
  const {
23716
23798
  isOpen,
23717
23799
  isVisible,
23718
- visible,
23719
23800
  setVisibility
23720
- } = use_seamly_visibility();
23801
+ } = useVisibility();
23721
23802
  const dispatch = use_seamly_dispatch();
23722
23803
  const events = useEvents();
23723
23804
  const spinnerTimeout = hooks_module_s(null);
@@ -23761,7 +23842,6 @@ const useSeamlyChat = () => {
23761
23842
  prevIsOpen.current = isOpen;
23762
23843
  prevIsVisible.current = isVisible;
23763
23844
  }, [isOpen, isVisible, sendAssertive, t]);
23764
- hooks_module_y(() => {}, [visible, sendAssertive]);
23765
23845
  hooks_module_y(() => {
23766
23846
  // This delays the start of the loading inidicator we set when we initialise
23767
23847
  // the application. This is done to only avoid BSOD on initial load if DCX is slow.
@@ -23867,7 +23947,7 @@ const useSeamlyIdleDetachCountdown = () => {
23867
23947
  } = useSeamlyStateContext();
23868
23948
  const {
23869
23949
  isOpen: isSeamlyOpen
23870
- } = use_seamly_visibility();
23950
+ } = useVisibility();
23871
23951
  const stableState = hooks_module_s({});
23872
23952
  stableState.current = {
23873
23953
  hasCountdown: idleDetachCountdown.hasCountdown,
@@ -24067,8 +24147,6 @@ const useSeamlyResumeConversationPrompt = () => {
24067
24147
 
24068
24148
 
24069
24149
 
24070
-
24071
-
24072
24150
  // This hook isn't used within the core
24073
24151
  // But it is used in implementations
24074
24152
  // and imported directly from this file
@@ -24243,7 +24321,7 @@ const ModalWrapper = ({
24243
24321
  const {
24244
24322
  isOpen,
24245
24323
  setVisibility
24246
- } = use_seamly_visibility();
24324
+ } = useVisibility();
24247
24325
  const container = hooks_module_s(null);
24248
24326
  const focusTrap = hooks_module_s(null);
24249
24327
 
@@ -24422,19 +24500,19 @@ const Icon = ({
24422
24500
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
24423
24501
 
24424
24502
  const {
24425
- createActions: utils_createActions,
24503
+ createActions: translations_utils_createActions,
24426
24504
  createReducer: translations_utils_createReducer,
24427
24505
  selectState: translations_utils_selectState
24428
24506
  } = createDomain('translations');
24429
24507
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
24430
24508
 
24431
- const [enable, disable] = utils_createActions('translate', {
24509
+ const [enable, disable] = translations_utils_createActions('translate', {
24432
24510
  enable: locale => ({
24433
24511
  locale
24434
24512
  }),
24435
24513
  disable: () => ({})
24436
24514
  });
24437
- const [enableEvent, disableEvent] = utils_createActions('event', {
24515
+ const [enableEvent, disableEvent] = translations_utils_createActions('event', {
24438
24516
  enable: payloadId => ({
24439
24517
  payloadId
24440
24518
  }),
@@ -26105,7 +26183,7 @@ const AppFrame = ({
26105
26183
  isOpen,
26106
26184
  isVisible,
26107
26185
  setVisibility
26108
- } = use_seamly_visibility();
26186
+ } = useVisibility();
26109
26187
  const {
26110
26188
  zIndex,
26111
26189
  showFaq
@@ -26862,7 +26940,7 @@ function ChatFrame({
26862
26940
  } = useInterrupt();
26863
26941
  const {
26864
26942
  isOpen
26865
- } = use_seamly_visibility();
26943
+ } = useVisibility();
26866
26944
 
26867
26945
  const getContent = () => {
26868
26946
  if (hasInterrupt) {
@@ -26894,6 +26972,7 @@ function ChatFrame({
26894
26972
 
26895
26973
 
26896
26974
 
26975
+
26897
26976
  const ToggleButton = ({
26898
26977
  onOpenChat
26899
26978
  }) => {
@@ -26903,7 +26982,7 @@ const ToggleButton = ({
26903
26982
  const titleId = useGeneratedId();
26904
26983
  const {
26905
26984
  isOpen
26906
- } = use_seamly_visibility();
26985
+ } = useVisibility();
26907
26986
  const prevIsOpen = hooks_module_s(null);
26908
26987
  const buttonRef = hooks_module_s(null);
26909
26988
  const lastEventRef = hooks_module_s();
@@ -26984,6 +27063,7 @@ const ToggleButton = ({
26984
27063
 
26985
27064
 
26986
27065
 
27066
+
26987
27067
  const AgentInfo = () => {
26988
27068
  const {
26989
27069
  t
@@ -26995,7 +27075,7 @@ const AgentInfo = () => {
26995
27075
  const unreadMessageCount = useSeamlyUnreadCount();
26996
27076
  const {
26997
27077
  isOpen
26998
- } = use_seamly_visibility();
27078
+ } = useVisibility();
26999
27079
  const currentAgent = useSeamlyCurrentAgent();
27000
27080
  const {
27001
27081
  hasInterrupt
@@ -28499,7 +28579,6 @@ mustache.Writer = Writer;
28499
28579
 
28500
28580
 
28501
28581
 
28502
-
28503
28582
  mustache_mustache.escape = function (escapeText) {
28504
28583
  return escapeText;
28505
28584
  };
@@ -28508,7 +28587,7 @@ const parseLinkVariable = variable => {
28508
28587
  return `<a href='${variable.url}' data-link-id='${variable.id}' ${variable.newTab ? 'target="_blank"' : ''}>${variable.name}</a>`;
28509
28588
  };
28510
28589
 
28511
- function parseRichtText(text, variables = {}) {
28590
+ function parseRichText(text, variables = {}) {
28512
28591
  var _context;
28513
28592
 
28514
28593
  const view = {};
@@ -28536,15 +28615,6 @@ function parseRichtText(text, variables = {}) {
28536
28615
  mustache_mustache.escape = oldEscape;
28537
28616
  return output;
28538
28617
  }
28539
-
28540
- const useTextRendering = ({
28541
- text,
28542
- variables = {}
28543
- }) => {
28544
- return hooks_module_A(() => parseRichtText(text, variables), [text, variables]);
28545
- };
28546
-
28547
- /* harmony default export */ var use_text_rendering = (useTextRendering);
28548
28618
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/text.js
28549
28619
 
28550
28620
 
@@ -28569,32 +28639,37 @@ function text_objectSpread(target) { for (var i = 1; i < arguments.length; i++)
28569
28639
 
28570
28640
 
28571
28641
 
28642
+
28572
28643
  const Text = _ref => {
28573
28644
  let {
28574
28645
  event
28575
28646
  } = _ref,
28576
28647
  props = _objectWithoutProperties(_ref, text_excluded);
28577
28648
 
28578
- const {
28579
- payload
28580
- } = event;
28581
28649
  const [body] = useTranslatedEventData(event);
28582
- const eventClick = use_event_link_click_handler(payload.id);
28583
- const eventBody = use_text_rendering({
28584
- text: parse_body(body.text),
28585
- variables: body.variables
28586
- });
28650
+ const eventClick = use_event_link_click_handler(event.payload.id);
28651
+ const containerProps = hooks_module_A(() => {
28652
+ if (!event.payload.fromClient) {
28653
+ return {
28654
+ bodyProps: {
28655
+ dangerouslySetInnerHTML: {
28656
+ __html: parseRichText(parse_body(body.text), body.variables)
28657
+ }
28658
+ }
28659
+ };
28660
+ }
28661
+
28662
+ return {
28663
+ children: jsxRuntime_module_e("p", {
28664
+ children: body.text
28665
+ })
28666
+ };
28667
+ }, [body, event]);
28587
28668
  return jsxRuntime_module_e(message_container, text_objectSpread(text_objectSpread({
28588
28669
  type: "text",
28589
28670
  event: event,
28590
28671
  onClick: eventClick
28591
- }, props), {}, {
28592
- bodyProps: {
28593
- dangerouslySetInnerHTML: {
28594
- __html: eventBody
28595
- }
28596
- }
28597
- }));
28672
+ }, props), containerProps));
28598
28673
  };
28599
28674
 
28600
28675
  /* harmony default export */ var event_text = (Text);
@@ -29844,6 +29919,7 @@ const PrivacyDisclaimer = () => {
29844
29919
 
29845
29920
 
29846
29921
 
29922
+
29847
29923
  const Conversation = () => {
29848
29924
  const {
29849
29925
  t
@@ -29853,7 +29929,7 @@ const Conversation = () => {
29853
29929
  const isLoading = useSeamlyIsLoading();
29854
29930
  const {
29855
29931
  isOpen
29856
- } = use_seamly_visibility();
29932
+ } = useVisibility();
29857
29933
  const skiplinkTargetId = useSkiplink();
29858
29934
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
29859
29935
  hooks_module_y(() => {
@@ -30960,10 +31036,11 @@ const Interrupt = ({
30960
31036
 
30961
31037
 
30962
31038
 
31039
+
30963
31040
  const View = () => {
30964
31041
  const {
30965
31042
  isVisible
30966
- } = use_seamly_visibility();
31043
+ } = useVisibility();
30967
31044
  const {
30968
31045
  openChat,
30969
31046
  closeChat
@@ -31029,7 +31106,7 @@ const SeamlyInstanceFunctionsLoader = () => {
31029
31106
  const {
31030
31107
  setVisibility,
31031
31108
  visible
31032
- } = use_seamly_visibility();
31109
+ } = useVisibility();
31033
31110
  const currentVisibility = hooks_module_s(visible);
31034
31111
  const eventBus = hooks_module_T(SeamlyEventBusContext);
31035
31112
  const api = useSeamlyApiContext();
@@ -31157,6 +31234,7 @@ const SeamlyInstanceFunctionsLoader = () => {
31157
31234
 
31158
31235
 
31159
31236
 
31237
+
31160
31238
  const {
31161
31239
  SET_EVENTS_READ: seamly_read_state_SET_EVENTS_READ
31162
31240
  } = seamlyActions;
@@ -31170,7 +31248,7 @@ const SeamlyReadState = () => {
31170
31248
  const {
31171
31249
  isOpen,
31172
31250
  isVisible
31173
- } = use_seamly_visibility();
31251
+ } = useVisibility();
31174
31252
  const {
31175
31253
  sendAction
31176
31254
  } = use_seamly_commands();
@@ -31229,6 +31307,7 @@ const SeamlyReadState = () => {
31229
31307
 
31230
31308
 
31231
31309
 
31310
+
31232
31311
  const SeamlyNewNotifications = () => {
31233
31312
  const {
31234
31313
  t
@@ -31242,7 +31321,7 @@ const SeamlyNewNotifications = () => {
31242
31321
  } = useLiveRegion();
31243
31322
  const {
31244
31323
  isOpen
31245
- } = use_seamly_visibility();
31324
+ } = useVisibility();
31246
31325
  const prevIsOpen = hooks_module_s(null);
31247
31326
  const debounceFunc = hooks_module_s(null);
31248
31327
  const notifyUnread = hooks_module_A(() => {
@@ -31460,23 +31539,18 @@ const SeamlyActivityMonitor = ({
31460
31539
 
31461
31540
 
31462
31541
 
31463
-
31464
31542
  const SeamlyInitializer = () => {
31465
31543
  const {
31466
31544
  initUserSelectedOptions
31467
31545
  } = useSeamlyOptions();
31468
31546
  const seamlyInitialized = hooks_module_s(false);
31469
- const {
31470
- setVisibility
31471
- } = use_seamly_visibility();
31472
31547
  const config = useConfig();
31473
31548
  hooks_module_y(() => {
31474
31549
  if (config.api && !seamlyInitialized.current) {
31475
31550
  seamlyInitialized.current = true;
31476
31551
  initUserSelectedOptions();
31477
- setVisibility(visibilityStates.initialize);
31478
31552
  }
31479
- }, [initUserSelectedOptions, config, setVisibility]);
31553
+ }, [initUserSelectedOptions, config]);
31480
31554
  return null;
31481
31555
  };
31482
31556
 
@@ -31708,18 +31782,18 @@ const SeamlyEventSubscriber = ({
31708
31782
  case 'error':
31709
31783
  switch (payload.type) {
31710
31784
  case 'find_conversation_erred':
31711
- dispatch(set(new SeamlySessionExpiredError()));
31785
+ dispatch(set(new SeamlySessionExpiredError(event)));
31712
31786
  break;
31713
31787
 
31714
31788
  case 'seamly_offline':
31715
- dispatch(set(new SeamlyOfflineError()));
31789
+ dispatch(set(new SeamlyOfflineError(event)));
31716
31790
  dispatch({
31717
31791
  type: seamly_event_subscriber_CLEAR_EVENTS
31718
31792
  });
31719
31793
  break;
31720
31794
 
31721
31795
  default:
31722
- dispatch(set(new SeamlyGeneralError()));
31796
+ dispatch(set(new SeamlyGeneralError(event)));
31723
31797
  break;
31724
31798
  }
31725
31799
 
@@ -31892,6 +31966,50 @@ const SeamlyFileUpload = ({
31892
31966
  };
31893
31967
 
31894
31968
  /* harmony default export */ var seamly_file_upload = (SeamlyFileUpload);
31969
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/errors/index.js
31970
+
31971
+
31972
+ const {
31973
+ createAction: errors_createAction
31974
+ } = createDomain('errors');
31975
+ const catchError = errors_createAction('catch-error', error => ({
31976
+ error
31977
+ }));
31978
+ function errors_createMiddleware({
31979
+ api: seamlyApi
31980
+ }) {
31981
+ return ({
31982
+ getState
31983
+ }) => {
31984
+ const handleError = error => {
31985
+ const {
31986
+ errorCallback,
31987
+ namespace,
31988
+ api,
31989
+ layoutMode
31990
+ } = selectConfig(getState());
31991
+ errorCallback === null || errorCallback === void 0 ? void 0 : errorCallback(error, {
31992
+ namespace,
31993
+ api,
31994
+ layoutMode,
31995
+ conversationUrl: seamlyApi.getConversationUrl()
31996
+ });
31997
+ };
31998
+
31999
+ return next => action => {
32000
+ try {
32001
+ if (action.error) {
32002
+ handleError(action.error);
32003
+ }
32004
+
32005
+ return next(action);
32006
+ } catch (error) {
32007
+ handleError(error);
32008
+ throw error;
32009
+ }
32010
+ };
32011
+ };
32012
+ }
31895
32013
  ;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-core.js
31896
32014
 
31897
32015
 
@@ -31907,6 +32025,8 @@ const SeamlyFileUpload = ({
31907
32025
 
31908
32026
 
31909
32027
 
32028
+
32029
+
31910
32030
  const SeamlyCore = ({
31911
32031
  store,
31912
32032
  children,
@@ -31914,6 +32034,7 @@ const SeamlyCore = ({
31914
32034
  eventBus,
31915
32035
  api
31916
32036
  }) => {
32037
+ hooks_module_q(error => store.dispatch(catchError(error)));
31917
32038
  return jsxRuntime_module_e(StoreProvider, {
31918
32039
  store: store,
31919
32040
  children: jsxRuntime_module_e(SeamlyEventBusContext.Provider, {
@@ -33939,7 +34060,6 @@ class API {
33939
34060
  }) // withCredentials() is necessary to allow browsers to save received
33940
34061
  // cookies in CORS requests.
33941
34062
  .withCredentials().send({
33942
- authorizationRequired: true,
33943
34063
  externalId: this.externalId || undefined
33944
34064
  });
33945
34065
  const {
@@ -33960,7 +34080,7 @@ class API {
33960
34080
  return initialState;
33961
34081
  } catch (error) {
33962
34082
  if (error.status >= 500) {
33963
- throw new SeamlyGeneralError();
34083
+ throw new SeamlyGeneralError(error);
33964
34084
  }
33965
34085
 
33966
34086
  throw error;
@@ -34006,15 +34126,15 @@ class API {
34006
34126
  };
34007
34127
  } catch (error) {
34008
34128
  if (error.status === 401) {
34009
- throw new SeamlyUnauthorizedError();
34129
+ throw new SeamlyUnauthorizedError(error);
34010
34130
  }
34011
34131
 
34012
34132
  if (error.status === 404) {
34013
- throw new SeamlySessionExpiredError();
34133
+ throw new SeamlySessionExpiredError(error);
34014
34134
  }
34015
34135
 
34016
34136
  if (error.status >= 500) {
34017
- throw new SeamlyGeneralError();
34137
+ throw new SeamlyGeneralError(error);
34018
34138
  }
34019
34139
 
34020
34140
  throw error;
@@ -34079,11 +34199,11 @@ class API {
34079
34199
  return body.config;
34080
34200
  }).catch(error => {
34081
34201
  if (error.status === 404) {
34082
- throw new SeamlyConfigurationError();
34202
+ throw new SeamlyConfigurationError(error);
34083
34203
  }
34084
34204
 
34085
34205
  if (error.status >= 500) {
34086
- throw new SeamlyGeneralError();
34206
+ throw new SeamlyGeneralError(error);
34087
34207
  }
34088
34208
 
34089
34209
  throw error;
@@ -34100,15 +34220,15 @@ class API {
34100
34220
  return omit(body.conversation, ['accessToken', 'channelName']);
34101
34221
  }).catch(error => {
34102
34222
  if (error.status === 401) {
34103
- throw new SeamlyUnauthorizedError();
34223
+ throw new SeamlyUnauthorizedError(error);
34104
34224
  }
34105
34225
 
34106
34226
  if (error.status === 404) {
34107
- throw new SeamlySessionExpiredError();
34227
+ throw new SeamlySessionExpiredError(error);
34108
34228
  }
34109
34229
 
34110
34230
  if (error.status >= 500) {
34111
- throw new SeamlyGeneralError();
34231
+ throw new SeamlyGeneralError(error);
34112
34232
  }
34113
34233
 
34114
34234
  throw error;
@@ -34131,7 +34251,7 @@ class API {
34131
34251
  return body.translations;
34132
34252
  } catch (error) {
34133
34253
  if (error.status >= 500) {
34134
- throw new SeamlyGeneralError();
34254
+ throw new SeamlyGeneralError(error);
34135
34255
  }
34136
34256
 
34137
34257
  throw error;
@@ -34270,9 +34390,24 @@ function options_middleware_createMiddleware({
34270
34390
  ;// CONCATENATED MODULE: ./src/javascripts/domains/options/index.js
34271
34391
 
34272
34392
  ;// CONCATENATED MODULE: ./src/javascripts/domains/store/state-reducer.js
34393
+
34394
+
34395
+
34396
+
34397
+
34398
+
34399
+
34400
+
34401
+
34402
+
34403
+ 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; }
34404
+
34405
+ 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; }
34406
+
34273
34407
  // Legacy state reducer. Do not add new features here but extract/create new reducers as needed
34274
34408
 
34275
34409
 
34410
+
34276
34411
  const state_reducer_initialState = {
34277
34412
  events: [],
34278
34413
  initialState: {},
@@ -34283,7 +34418,6 @@ const state_reducer_initialState = {
34283
34418
  isActive: false
34284
34419
  },
34285
34420
  resumeConversationPrompt: false,
34286
- visible: visibilityStates.hidden,
34287
34421
  serviceInfo: {
34288
34422
  activeServiceSessionId: ''
34289
34423
  },
@@ -34320,6 +34454,15 @@ const state_reducer_initialState = {
34320
34454
  seamlyContainerElement: null
34321
34455
  };
34322
34456
  function stateReducer(state = state_reducer_initialState, action) {
34457
+ if (action.type === String(actions_reset)) {
34458
+ const {
34459
+ visible
34460
+ } = state;
34461
+ return state_reducer_objectSpread(state_reducer_objectSpread({}, state_reducer_initialState), {}, {
34462
+ visible
34463
+ });
34464
+ }
34465
+
34323
34466
  return seamlyStateReducer(state, action);
34324
34467
  }
34325
34468
  ;// CONCATENATED MODULE: ./src/javascripts/domains/store/index.js
@@ -34333,9 +34476,12 @@ function stateReducer(state = state_reducer_initialState, action) {
34333
34476
 
34334
34477
 
34335
34478
 
34479
+
34480
+
34336
34481
  function store_createStore({
34337
34482
  initialState,
34338
- api
34483
+ api,
34484
+ eventBus
34339
34485
  } = {}) {
34340
34486
  const store = createReduxStore({
34341
34487
  reducers: {
@@ -34345,12 +34491,18 @@ function store_createStore({
34345
34491
  [String(forms_reducer)]: forms_reducer,
34346
34492
  [String(translations_reducer)]: translations_reducer,
34347
34493
  [String(i18n_reducer)]: i18n_reducer,
34348
- [String(interrupt_reducer)]: interrupt_reducer
34494
+ [String(interrupt_reducer)]: interrupt_reducer,
34495
+ [String(visibility_reducer)]: visibility_reducer
34349
34496
  },
34350
34497
  initialState,
34351
- middlewares: [es.withExtraArgument({
34498
+ middlewares: [errors_createMiddleware({
34499
+ api
34500
+ }), es.withExtraArgument({
34501
+ api,
34502
+ eventBus
34503
+ }), createMiddleware(), middleware_createMiddleware({
34352
34504
  api
34353
- }), createMiddleware(), middleware_createMiddleware(), options_middleware_createMiddleware({
34505
+ }), options_middleware_createMiddleware({
34354
34506
  api
34355
34507
  }), translations_middleware_createMiddleware()]
34356
34508
  });
@@ -34428,9 +34580,10 @@ class Engine {
34428
34580
  });
34429
34581
 
34430
34582
  const store = store_createStore({
34431
- api: this.api
34583
+ api: this.api,
34584
+ eventBus: this.eventBus
34432
34585
  });
34433
- await store.dispatch(actions_initialize(renderConfig));
34586
+ await store.dispatch(app_actions_initialize(renderConfig));
34434
34587
 
34435
34588
  if (View) {
34436
34589
  S(jsxRuntime_module_e(seamly_core, {
@@ -34780,12 +34933,6 @@ function initializeExternalApi(appConfig) {
34780
34933
 
34781
34934
  // Used by: StyleGuide
34782
34935
 
34783
- // Used by: StyleGuide
34784
-
34785
- // Used by: StyleGuide
34786
-
34787
- // Used by: StyleGuide
34788
-
34789
34936
 
34790
34937
  }();
34791
34938
  /******/ return __webpack_exports__;