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

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.
@@ -14621,13 +14621,23 @@ class SeamlyUnauthorizedError extends Error {
14621
14621
 
14622
14622
 
14623
14623
 
14624
-
14625
14624
  const handledErrorTypes = [SeamlyGeneralError, SeamlyConfigurationError, SeamlySessionExpiredError, SeamlyOfflineError, SeamlyUnauthorizedError];
14626
- function middleware_createMiddleware() {
14625
+ function middleware_createMiddleware({
14626
+ api
14627
+ }) {
14627
14628
  return () => next => action => {
14628
- if (action.type === String(set)) {
14629
- if (!handledErrorTypes.some(ErrorType => action.error instanceof ErrorType)) {
14630
- throw action.error;
14629
+ const {
14630
+ error
14631
+ } = action;
14632
+
14633
+ if (error) {
14634
+ if (!handledErrorTypes.some(ErrorType => error instanceof ErrorType)) {
14635
+ throw error;
14636
+ } else if (error.action === 'reset') {
14637
+ // [SMLY-942] We clear the store before a reset to force a new conversation if the page is refreshed before the conversation is reset
14638
+ api.disconnect().then(() => {
14639
+ api.clearStore();
14640
+ });
14631
14641
  }
14632
14642
  }
14633
14643
 
@@ -25486,7 +25496,9 @@ function store_createStore({
25486
25496
  initialState,
25487
25497
  middlewares: [es.withExtraArgument({
25488
25498
  api
25489
- }), createMiddleware(), middleware_createMiddleware(), options_middleware_createMiddleware({
25499
+ }), createMiddleware(), middleware_createMiddleware({
25500
+ api
25501
+ }), options_middleware_createMiddleware({
25490
25502
  api
25491
25503
  }), translations_middleware_createMiddleware()]
25492
25504
  });