@tramvai/module-router 7.39.0 → 7.41.1

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.
@@ -9,5 +9,6 @@ export { PageErrorStore, setPageErrorEvent } from './stores/PageErrorStore.brows
9
9
  export { usePageService } from './hooks/usePageService.browser.js';
10
10
  export { stopRunAtError } from './modules/utils/stopRunAtError.browser.js';
11
11
  export { ROUTER_VIEW_TRANSITIONS_ENABLED, afterNavigateHooksToken, afterUpdateCurrentHooksToken, beforeNavigateHooksToken, beforeResolveHooksToken, beforeUpdateCurrentHooksToken, onChangeHooksToken, routeTransformToken, routerBundleInfoAdditionalToken } from './modules/tokens.browser.js';
12
+ export { resetDeferredAction } from './modules/hooks/runActions.browser.js';
12
13
  export * from '@tinkoff/router';
13
14
  export { deserializeError, serializeError } from '@tramvai/safe-strings';
package/lib/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './stores/PageErrorStore';
9
9
  export * from './hooks/usePageService';
10
10
  export { stopRunAtError } from './modules/utils/stopRunAtError';
11
11
  export { onChangeHooksToken, beforeNavigateHooksToken, afterNavigateHooksToken, beforeResolveHooksToken, beforeUpdateCurrentHooksToken, afterUpdateCurrentHooksToken, routerBundleInfoAdditionalToken, routeTransformToken, ROUTER_VIEW_TRANSITIONS_ENABLED, } from './modules/tokens';
12
+ export { resetDeferredAction } from './modules/hooks/runActions';
12
13
  export * from '@tinkoff/router';
13
14
  declare module '@tinkoff/router' {
14
15
  interface RouteConfig {
package/lib/index.es.js CHANGED
@@ -8,5 +8,6 @@ export { PageErrorStore, setPageErrorEvent } from './stores/PageErrorStore.es.js
8
8
  export { usePageService } from './hooks/usePageService.es.js';
9
9
  export { stopRunAtError } from './modules/utils/stopRunAtError.es.js';
10
10
  export { ROUTER_VIEW_TRANSITIONS_ENABLED, afterNavigateHooksToken, afterUpdateCurrentHooksToken, beforeNavigateHooksToken, beforeResolveHooksToken, beforeUpdateCurrentHooksToken, onChangeHooksToken, routeTransformToken, routerBundleInfoAdditionalToken } from './modules/tokens.es.js';
11
+ export { resetDeferredAction } from './modules/hooks/runActions.es.js';
11
12
  export * from '@tinkoff/router';
12
13
  export { deserializeError, serializeError } from '@tramvai/safe-strings';
package/lib/index.js CHANGED
@@ -12,6 +12,7 @@ var PageErrorStore = require('./stores/PageErrorStore.js');
12
12
  var usePageService = require('./hooks/usePageService.js');
13
13
  var stopRunAtError = require('./modules/utils/stopRunAtError.js');
14
14
  var tokens = require('./modules/tokens.js');
15
+ var runActions = require('./modules/hooks/runActions.js');
15
16
  var router = require('@tinkoff/router');
16
17
  var safeStrings = require('@tramvai/safe-strings');
17
18
 
@@ -42,6 +43,7 @@ exports.beforeUpdateCurrentHooksToken = tokens.beforeUpdateCurrentHooksToken;
42
43
  exports.onChangeHooksToken = tokens.onChangeHooksToken;
43
44
  exports.routeTransformToken = tokens.routeTransformToken;
44
45
  exports.routerBundleInfoAdditionalToken = tokens.routerBundleInfoAdditionalToken;
46
+ exports.resetDeferredAction = runActions.resetDeferredAction;
45
47
  Object.defineProperty(exports, 'deserializeError', {
46
48
  enumerable: true,
47
49
  get: function () { return safeStrings.deserializeError; }
@@ -30,17 +30,18 @@ const runActionsFactory = (deps) => {
30
30
  });
31
31
  };
32
32
  };
33
+ const resetDeferredAction = (action, deferredActionsMap, actionExecution) => {
34
+ const parameters = action[ACTION_PARAMETERS];
35
+ const isDeferredAction = parameters?.deferred;
36
+ const deferred = deferredActionsMap.get(parameters?.name);
37
+ // here only deferred actions with always or dynamic conditions will be refreshed
38
+ if (isDeferredAction && deferred && actionExecution.canExecute(action)) {
39
+ deferred.reset();
40
+ }
41
+ };
33
42
  const resetDeferredActions = (deps) => {
34
43
  const actions = getActions(deps);
35
- actions.forEach((action) => {
36
- const parameters = action[ACTION_PARAMETERS];
37
- const isDeferredAction = parameters?.deferred;
38
- const deferred = deps.deferredActionsMap.get(parameters?.name);
39
- // here only deferred actions with always or dynamic conditions will be refreshed
40
- if (isDeferredAction && deferred && deps.actionExecution.canExecute(action)) {
41
- deferred.reset();
42
- }
43
- });
44
+ actions.forEach((action) => resetDeferredAction(action, deps.deferredActionsMap, deps.actionExecution));
44
45
  };
45
46
 
46
- export { getActions, resetDeferredActions, runActionsFactory };
47
+ export { getActions, resetDeferredAction, resetDeferredActions, runActionsFactory };
@@ -1,17 +1,19 @@
1
1
  import type { ACTION_REGISTRY_TOKEN, ACTION_PAGE_RUNNER_TOKEN, STORE_TOKEN, DEFERRED_ACTIONS_MAP_TOKEN, ACTION_EXECUTION_TOKEN } from '@tramvai/tokens-common';
2
2
  import type { ROUTER_TOKEN } from '@tramvai/tokens-router';
3
+ import { type PageAction } from '@tramvai/core';
3
4
  export declare const getActions: ({ store, router, actionRegistry, actionPageRunner, }: {
4
5
  store: typeof STORE_TOKEN;
5
6
  router: typeof ROUTER_TOKEN;
6
7
  actionRegistry: typeof ACTION_REGISTRY_TOKEN;
7
8
  actionPageRunner: typeof ACTION_PAGE_RUNNER_TOKEN;
8
- }) => import("@tramvai/core").PageAction[];
9
+ }) => PageAction[];
9
10
  export declare const runActionsFactory: (deps: {
10
11
  store: typeof STORE_TOKEN;
11
12
  router: typeof ROUTER_TOKEN;
12
13
  actionRegistry: typeof ACTION_REGISTRY_TOKEN;
13
14
  actionPageRunner: typeof ACTION_PAGE_RUNNER_TOKEN;
14
15
  }) => () => Promise<any>;
16
+ export declare const resetDeferredAction: (action: PageAction, deferredActionsMap: typeof DEFERRED_ACTIONS_MAP_TOKEN, actionExecution: typeof ACTION_EXECUTION_TOKEN) => void;
15
17
  export declare const resetDeferredActions: (deps: {
16
18
  store: typeof STORE_TOKEN;
17
19
  router: typeof ROUTER_TOKEN;
@@ -1,6 +1,6 @@
1
1
  import uniq from '@tinkoff/utils/array/uniq';
2
2
  import { isRedirectFoundError } from '@tinkoff/errors';
3
- import '@tramvai/core';
3
+ import { ACTION_PARAMETERS } from '@tramvai/core';
4
4
  import { stopRunAtError } from '../utils/stopRunAtError.es.js';
5
5
 
6
6
  const getActions = ({ store, router, actionRegistry, actionPageRunner, }) => {
@@ -30,5 +30,14 @@ const runActionsFactory = (deps) => {
30
30
  });
31
31
  };
32
32
  };
33
+ const resetDeferredAction = (action, deferredActionsMap, actionExecution) => {
34
+ const parameters = action[ACTION_PARAMETERS];
35
+ const isDeferredAction = parameters?.deferred;
36
+ const deferred = deferredActionsMap.get(parameters?.name);
37
+ // here only deferred actions with always or dynamic conditions will be refreshed
38
+ if (isDeferredAction && deferred && actionExecution.canExecute(action)) {
39
+ deferred.reset();
40
+ }
41
+ };
33
42
 
34
- export { getActions, runActionsFactory };
43
+ export { getActions, resetDeferredAction, runActionsFactory };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var uniq = require('@tinkoff/utils/array/uniq');
6
6
  var errors = require('@tinkoff/errors');
7
- require('@tramvai/core');
7
+ var core = require('@tramvai/core');
8
8
  var stopRunAtError = require('../utils/stopRunAtError.js');
9
9
 
10
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -38,6 +38,16 @@ const runActionsFactory = (deps) => {
38
38
  });
39
39
  };
40
40
  };
41
+ const resetDeferredAction = (action, deferredActionsMap, actionExecution) => {
42
+ const parameters = action[core.ACTION_PARAMETERS];
43
+ const isDeferredAction = parameters?.deferred;
44
+ const deferred = deferredActionsMap.get(parameters?.name);
45
+ // here only deferred actions with always or dynamic conditions will be refreshed
46
+ if (isDeferredAction && deferred && actionExecution.canExecute(action)) {
47
+ deferred.reset();
48
+ }
49
+ };
41
50
 
42
51
  exports.getActions = getActions;
52
+ exports.resetDeferredAction = resetDeferredAction;
43
53
  exports.runActionsFactory = runActionsFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-router",
3
- "version": "7.39.0",
3
+ "version": "7.41.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "browser": {
@@ -26,29 +26,29 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@tinkoff/errors": "0.8.1",
29
- "@tinkoff/router": "0.7.149",
29
+ "@tinkoff/router": "0.7.153",
30
30
  "@tinkoff/url": "0.13.1",
31
- "@tramvai/experiments": "7.39.0",
32
- "@tramvai/react": "7.39.0",
31
+ "@tramvai/experiments": "7.41.1",
32
+ "@tramvai/react": "7.41.1",
33
33
  "@tramvai/safe-strings": "0.10.2",
34
- "@tramvai/tokens-child-app": "7.39.0",
35
- "@tramvai/tokens-core": "7.39.0",
36
- "@tramvai/tokens-render": "7.39.0",
37
- "@tramvai/tokens-router": "7.39.0",
38
- "@tramvai/tokens-server": "7.39.0"
34
+ "@tramvai/tokens-child-app": "7.41.1",
35
+ "@tramvai/tokens-core": "7.41.1",
36
+ "@tramvai/tokens-render": "7.41.1",
37
+ "@tramvai/tokens-router": "7.41.1",
38
+ "@tramvai/tokens-server": "7.41.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@tinkoff/dippy": "^1.0.0",
42
42
  "@tinkoff/utils": "^2.1.2",
43
- "@tramvai/cli": "7.39.0",
44
- "@tramvai/core": "7.39.0",
45
- "@tramvai/module-log": "7.39.0",
46
- "@tramvai/module-server": "7.39.0",
47
- "@tramvai/papi": "7.39.0",
48
- "@tramvai/state": "7.39.0",
49
- "@tramvai/test-helpers": "7.39.0",
50
- "@tramvai/test-mocks": "7.39.0",
51
- "@tramvai/tokens-common": "7.39.0",
43
+ "@tramvai/cli": "7.41.1",
44
+ "@tramvai/core": "7.41.1",
45
+ "@tramvai/module-log": "7.41.1",
46
+ "@tramvai/module-server": "7.41.1",
47
+ "@tramvai/papi": "7.41.1",
48
+ "@tramvai/state": "7.41.1",
49
+ "@tramvai/test-helpers": "7.41.1",
50
+ "@tramvai/test-mocks": "7.41.1",
51
+ "@tramvai/tokens-common": "7.41.1",
52
52
  "react": "*",
53
53
  "tslib": "^2.4.0"
54
54
  },