@tramvai/module-common 1.44.4 → 1.46.6

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.
@@ -1,2 +1,4 @@
1
+ import type { Cache } from '@tramvai/tokens-common';
2
+ export declare const cachesToken: Cache<any>[];
1
3
  export declare class CacheModule {
2
4
  }
@@ -0,0 +1,2 @@
1
+ export declare class CommonChildAppModule {
2
+ }
@@ -0,0 +1,2 @@
1
+ import type { Provider } from '@tramvai/core';
2
+ export declare const actionsProviders: Provider[];
@@ -0,0 +1,2 @@
1
+ import type { Provider } from '@tramvai/core';
2
+ export declare const actionsProviders: Provider[];
@@ -0,0 +1,7 @@
1
+ import type { Provider } from '@tramvai/core';
2
+ declare global {
3
+ interface Window {
4
+ childInitialState: string;
5
+ }
6
+ }
7
+ export declare const providers: Provider[];
@@ -0,0 +1,14 @@
1
+ import type { Provider } from '@tramvai/core';
2
+ export declare const lines: {
3
+ server: {
4
+ customer: import("@tramvai/core").Command[];
5
+ clear: import("@tramvai/core").Command[];
6
+ spa: import("@tramvai/core").Command[];
7
+ };
8
+ client: {
9
+ customer: import("@tramvai/core").Command[];
10
+ clear: import("@tramvai/core").Command[];
11
+ spa: import("@tramvai/core").Command[];
12
+ };
13
+ };
14
+ export declare const commandProviders: Provider[];
@@ -0,0 +1,2 @@
1
+ import type { Provider } from '@tramvai/core';
2
+ export declare const providers: Provider[];
@@ -0,0 +1,2 @@
1
+ import type { Provider } from '@tramvai/core';
2
+ export declare const stateProviders: Provider[];
@@ -11,7 +11,7 @@ export * from '@tramvai/tokens-common';
11
11
  import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponent } from '@tramvai/experiments';
12
12
  import pathOr from '@tinkoff/utils/object/pathOr';
13
13
  import flatten from '@tinkoff/utils/array/flatten';
14
- import { createEvent, createReducer, convertAction, createDispatcher, devTools } from '@tramvai/state';
14
+ import { createEvent, createReducer, convertAction, createDispatcher, devTools, Provider } from '@tramvai/state';
15
15
  import { format } from '@tinkoff/url';
16
16
  import isEmpty from '@tinkoff/utils/is/empty';
17
17
  import values from '@tinkoff/utils/object/values';
@@ -26,6 +26,9 @@ import uniq from '@tinkoff/utils/array/uniq';
26
26
  import difference from '@tinkoff/utils/array/difference';
27
27
  import toArray from '@tinkoff/utils/array/toArray';
28
28
  import LRU from 'lru-cache';
29
+ import React from 'react';
30
+ import { EXTEND_RENDER } from '@tramvai/tokens-render';
31
+ import { CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, commandLineListTokens as commandLineListTokens$1 } from '@tramvai/tokens-child-app';
29
32
 
30
33
  const FS_PAGES_DEFAULT_BUNDLE = '__default';
31
34
  class BundleManager {
@@ -377,7 +380,7 @@ class CommandLineRunner {
377
380
  this.metrics = metrics;
378
381
  }
379
382
  run(type, status, providers, customDi) {
380
- const di = resolveDi(type, status, customDi || this.rootDi, providers);
383
+ const di = customDi !== null && customDi !== void 0 ? customDi : resolveDi(type, status, this.rootDi, providers);
381
384
  this.log.debug({
382
385
  event: 'command-run',
383
386
  type,
@@ -478,7 +481,7 @@ class CommandLineRunner {
478
481
  }
479
482
  }
480
483
 
481
- const command = {
484
+ const command$1 = {
482
485
  init: [commandLineListTokens.init, commandLineListTokens.listen],
483
486
  close: [commandLineListTokens.close],
484
487
  customer: [
@@ -494,9 +497,9 @@ const command = {
494
497
  commandLineListTokens.spaTransition,
495
498
  ],
496
499
  };
497
- const lines = {
498
- server: command,
499
- client: command,
500
+ const lines$1 = {
501
+ server: command$1,
502
+ client: command$1,
500
503
  };
501
504
 
502
505
  let CommandModule = class CommandModule {
@@ -523,7 +526,7 @@ CommandModule = __decorate([
523
526
  // Дефолтный список команл
524
527
  provide: COMMAND_LINES_TOKEN,
525
528
  scope: Scope$1.SINGLETON,
526
- useValue: lines,
529
+ useValue: lines$1,
527
530
  },
528
531
  ],
529
532
  })
@@ -567,9 +570,11 @@ PubSubModule = __decorate([
567
570
  })
568
571
  ], PubSubModule);
569
572
 
570
- const providers$1 = [
573
+ const INITIAL_APP_STATE_TOKEN = createToken('initialAppState');
574
+
575
+ const providers$2 = [
571
576
  {
572
- provide: 'initialAppState',
577
+ provide: INITIAL_APP_STATE_TOKEN,
573
578
  useFactory: () => JSON.parse(window.initialState || '{}'),
574
579
  scope: Scope.REQUEST,
575
580
  },
@@ -869,14 +874,16 @@ StateModule = __decorate([
869
874
  {
870
875
  provide: DISPATCHER_CONTEXT_TOKEN,
871
876
  scope: Scope.REQUEST,
872
- useFactory: ({ dispatcher, initialState, middlewares }) => dispatcher.createContext({}, initialState, [
873
- devTools.middleware(),
874
- ...flatten(middlewares || []),
875
- ]),
877
+ useFactory: ({ dispatcher, initialState, middlewares }) => {
878
+ return dispatcher.createContext({}, initialState, [
879
+ devTools.middleware(),
880
+ ...flatten(middlewares || []),
881
+ ]);
882
+ },
876
883
  deps: {
877
884
  dispatcher: DISPATCHER_TOKEN,
878
885
  middlewares: { token: STORE_MIDDLEWARE, optional: true },
879
- initialState: { token: 'initialAppState', optional: true },
886
+ initialState: { token: INITIAL_APP_STATE_TOKEN, optional: true },
880
887
  },
881
888
  },
882
889
  {
@@ -901,7 +908,7 @@ const cacheFactory = (type, ...args) => {
901
908
  return new LRU(...args);
902
909
  };
903
910
 
904
- const providers = [];
911
+ const providers$1 = [];
905
912
 
906
913
  const cachesToken = createToken('_cachesList');
907
914
  let CacheModule = class CacheModule {
@@ -909,7 +916,7 @@ let CacheModule = class CacheModule {
909
916
  CacheModule = __decorate([
910
917
  Module({
911
918
  providers: [
912
- ...providers,
919
+ ...providers$1,
913
920
  {
914
921
  provide: cachesToken,
915
922
  scope: Scope.SINGLETON,
@@ -1024,9 +1031,87 @@ CommonModule = __decorate([
1024
1031
  store: STORE_TOKEN,
1025
1032
  },
1026
1033
  }),
1027
- ...providers$1,
1034
+ ...providers$2,
1028
1035
  ],
1029
1036
  })
1030
1037
  ], CommonModule);
1031
1038
 
1032
- export { ActionExecution, CommandModule, CommonModule, createConsumerContext };
1039
+ const providers = [];
1040
+
1041
+ const stateProviders = [
1042
+ provide({
1043
+ provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1044
+ multi: true,
1045
+ useValue: [DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN, STORE_TOKEN, CONTEXT_TOKEN],
1046
+ }),
1047
+ ];
1048
+
1049
+ const command = {
1050
+ customer: [
1051
+ commandLineListTokens$1.customerStart,
1052
+ commandLineListTokens$1.resolveUserDeps,
1053
+ commandLineListTokens$1.resolvePageDeps,
1054
+ ],
1055
+ clear: [commandLineListTokens$1.clear],
1056
+ spa: [
1057
+ commandLineListTokens$1.resolveUserDeps,
1058
+ commandLineListTokens$1.resolvePageDeps,
1059
+ commandLineListTokens$1.spaTransition,
1060
+ ],
1061
+ };
1062
+ const lines = {
1063
+ server: command,
1064
+ client: command,
1065
+ };
1066
+ const commandProviders = [
1067
+ provide({
1068
+ provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1069
+ multi: true,
1070
+ useValue: COMMAND_LINE_RUNNER_TOKEN,
1071
+ }),
1072
+ provide({
1073
+ provide: COMMAND_LINES_TOKEN,
1074
+ scope: Scope.SINGLETON,
1075
+ useValue: lines,
1076
+ }),
1077
+ ];
1078
+
1079
+ const actionsProviders = [
1080
+ provide({
1081
+ provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1082
+ multi: true,
1083
+ useValue: [ACTION_EXECUTION_TOKEN, ACTION_PAGE_RUNNER_TOKEN],
1084
+ }),
1085
+ {
1086
+ provide: COMBINE_REDUCERS,
1087
+ multi: true,
1088
+ useValue: actionTramvaiReducer,
1089
+ },
1090
+ ];
1091
+
1092
+ let CommonChildAppModule = class CommonChildAppModule {
1093
+ };
1094
+ CommonChildAppModule = __decorate([
1095
+ Module({
1096
+ providers: [
1097
+ ...providers,
1098
+ ...stateProviders,
1099
+ ...commandProviders,
1100
+ ...actionsProviders,
1101
+ provide({
1102
+ provide: EXTEND_RENDER,
1103
+ multi: true,
1104
+ useFactory: ({ context }) => {
1105
+ return (render) => {
1106
+ return React.createElement(Provider, { context: context }, render);
1107
+ };
1108
+ },
1109
+ deps: {
1110
+ context: CONTEXT_TOKEN,
1111
+ },
1112
+ }),
1113
+ ],
1114
+ })
1115
+ ], CommonChildAppModule);
1116
+
1117
+ export { ActionExecution, CommandModule, CommonChildAppModule, CommonModule, createConsumerContext };
package/lib/index.d.ts CHANGED
@@ -2,5 +2,6 @@ export { CommonModule } from './CommonModule';
2
2
  export { CommandModule } from './command/CommandModule';
3
3
  export { ActionExecution } from './actions/actionExecution';
4
4
  export { createConsumerContext } from './createConsumerContext/createConsumerContext';
5
+ export { CommonChildAppModule } from './child-app/ChildAppModule';
5
6
  export * from '@tramvai/tokens-common';
6
7
  export { COOKIE_MANAGER_TOKEN } from '@tramvai/module-cookie';
package/lib/index.es.js CHANGED
@@ -11,7 +11,7 @@ export * from '@tramvai/tokens-common';
11
11
  import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponent } from '@tramvai/experiments';
12
12
  import pathOr from '@tinkoff/utils/object/pathOr';
13
13
  import flatten from '@tinkoff/utils/array/flatten';
14
- import { createEvent, createReducer, convertAction, createDispatcher, devTools } from '@tramvai/state';
14
+ import { createEvent, createReducer, convertAction, createDispatcher, devTools, Provider } from '@tramvai/state';
15
15
  import { format } from '@tinkoff/url';
16
16
  import isEmpty from '@tinkoff/utils/is/empty';
17
17
  import values from '@tinkoff/utils/object/values';
@@ -28,6 +28,9 @@ import toArray from '@tinkoff/utils/array/toArray';
28
28
  import LRU from 'lru-cache';
29
29
  import { SERVER_MODULE_PAPI_PRIVATE_ROUTE } from '@tramvai/tokens-server';
30
30
  import { createPapiMethod } from '@tramvai/papi';
31
+ import React from 'react';
32
+ import { EXTEND_RENDER } from '@tramvai/tokens-render';
33
+ import { CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, commandLineListTokens as commandLineListTokens$1 } from '@tramvai/tokens-child-app';
31
34
 
32
35
  const FS_PAGES_DEFAULT_BUNDLE = '__default';
33
36
  class BundleManager {
@@ -374,7 +377,7 @@ class CommandLineRunner {
374
377
  this.metrics = metrics;
375
378
  }
376
379
  run(type, status, providers, customDi) {
377
- const di = resolveDi(type, status, customDi || this.rootDi, providers);
380
+ const di = customDi !== null && customDi !== void 0 ? customDi : resolveDi(type, status, this.rootDi, providers);
378
381
  this.log.debug({
379
382
  event: 'command-run',
380
383
  type,
@@ -475,7 +478,7 @@ class CommandLineRunner {
475
478
  }
476
479
  }
477
480
 
478
- const command = {
481
+ const command$1 = {
479
482
  init: [commandLineListTokens.init, commandLineListTokens.listen],
480
483
  close: [commandLineListTokens.close],
481
484
  customer: [
@@ -491,9 +494,9 @@ const command = {
491
494
  commandLineListTokens.spaTransition,
492
495
  ],
493
496
  };
494
- const lines = {
495
- server: command,
496
- client: command,
497
+ const lines$1 = {
498
+ server: command$1,
499
+ client: command$1,
497
500
  };
498
501
 
499
502
  let CommandModule = class CommandModule {
@@ -520,7 +523,7 @@ CommandModule = __decorate([
520
523
  // Дефолтный список команл
521
524
  provide: COMMAND_LINES_TOKEN,
522
525
  scope: Scope$1.SINGLETON,
523
- useValue: lines,
526
+ useValue: lines$1,
524
527
  },
525
528
  ],
526
529
  })
@@ -564,7 +567,7 @@ PubSubModule = __decorate([
564
567
  })
565
568
  ], PubSubModule);
566
569
 
567
- const providers$1 = [];
570
+ const providers$2 = [];
568
571
 
569
572
  const actionServerStateEvent = createEvent('action state execution in server');
570
573
  const initalState = { serverState: {} };
@@ -858,6 +861,8 @@ ActionModule = __decorate([
858
861
  })
859
862
  ], ActionModule);
860
863
 
864
+ const INITIAL_APP_STATE_TOKEN = createToken('initialAppState');
865
+
861
866
  let StateModule = class StateModule {
862
867
  };
863
868
  StateModule = __decorate([
@@ -877,14 +882,16 @@ StateModule = __decorate([
877
882
  {
878
883
  provide: DISPATCHER_CONTEXT_TOKEN,
879
884
  scope: Scope.REQUEST,
880
- useFactory: ({ dispatcher, initialState, middlewares }) => dispatcher.createContext({}, initialState, [
881
- devTools.middleware(),
882
- ...flatten(middlewares || []),
883
- ]),
885
+ useFactory: ({ dispatcher, initialState, middlewares }) => {
886
+ return dispatcher.createContext({}, initialState, [
887
+ devTools.middleware(),
888
+ ...flatten(middlewares || []),
889
+ ]);
890
+ },
884
891
  deps: {
885
892
  dispatcher: DISPATCHER_TOKEN,
886
893
  middlewares: { token: STORE_MIDDLEWARE, optional: true },
887
- initialState: { token: 'initialAppState', optional: true },
894
+ initialState: { token: INITIAL_APP_STATE_TOKEN, optional: true },
888
895
  },
889
896
  },
890
897
  {
@@ -924,7 +931,7 @@ const papiClearCache = ({ clearCache, logger, }) => {
924
931
  });
925
932
  };
926
933
 
927
- const providers = [
934
+ const providers$1 = [
928
935
  {
929
936
  provide: SERVER_MODULE_PAPI_PRIVATE_ROUTE,
930
937
  multi: true,
@@ -942,7 +949,7 @@ let CacheModule = class CacheModule {
942
949
  CacheModule = __decorate([
943
950
  Module({
944
951
  providers: [
945
- ...providers,
952
+ ...providers$1,
946
953
  {
947
954
  provide: cachesToken,
948
955
  scope: Scope.SINGLETON,
@@ -1057,9 +1064,87 @@ CommonModule = __decorate([
1057
1064
  store: STORE_TOKEN,
1058
1065
  },
1059
1066
  }),
1060
- ...providers$1,
1067
+ ...providers$2,
1061
1068
  ],
1062
1069
  })
1063
1070
  ], CommonModule);
1064
1071
 
1065
- export { ActionExecution, CommandModule, CommonModule, createConsumerContext };
1072
+ const providers = [];
1073
+
1074
+ const stateProviders = [
1075
+ provide({
1076
+ provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1077
+ multi: true,
1078
+ useValue: [DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN, STORE_TOKEN, CONTEXT_TOKEN],
1079
+ }),
1080
+ ];
1081
+
1082
+ const command = {
1083
+ customer: [
1084
+ commandLineListTokens$1.customerStart,
1085
+ commandLineListTokens$1.resolveUserDeps,
1086
+ commandLineListTokens$1.resolvePageDeps,
1087
+ ],
1088
+ clear: [commandLineListTokens$1.clear],
1089
+ spa: [
1090
+ commandLineListTokens$1.resolveUserDeps,
1091
+ commandLineListTokens$1.resolvePageDeps,
1092
+ commandLineListTokens$1.spaTransition,
1093
+ ],
1094
+ };
1095
+ const lines = {
1096
+ server: command,
1097
+ client: command,
1098
+ };
1099
+ const commandProviders = [
1100
+ provide({
1101
+ provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1102
+ multi: true,
1103
+ useValue: COMMAND_LINE_RUNNER_TOKEN,
1104
+ }),
1105
+ provide({
1106
+ provide: COMMAND_LINES_TOKEN,
1107
+ scope: Scope.SINGLETON,
1108
+ useValue: lines,
1109
+ }),
1110
+ ];
1111
+
1112
+ const actionsProviders = [
1113
+ provide({
1114
+ provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1115
+ multi: true,
1116
+ useValue: [ACTION_EXECUTION_TOKEN, ACTION_PAGE_RUNNER_TOKEN],
1117
+ }),
1118
+ {
1119
+ provide: COMBINE_REDUCERS,
1120
+ multi: true,
1121
+ useValue: actionTramvaiReducer,
1122
+ },
1123
+ ];
1124
+
1125
+ let CommonChildAppModule = class CommonChildAppModule {
1126
+ };
1127
+ CommonChildAppModule = __decorate([
1128
+ Module({
1129
+ providers: [
1130
+ ...providers,
1131
+ ...stateProviders,
1132
+ ...commandProviders,
1133
+ ...actionsProviders,
1134
+ provide({
1135
+ provide: EXTEND_RENDER,
1136
+ multi: true,
1137
+ useFactory: ({ context }) => {
1138
+ return (render) => {
1139
+ return React.createElement(Provider, { context: context }, render);
1140
+ };
1141
+ },
1142
+ deps: {
1143
+ context: CONTEXT_TOKEN,
1144
+ },
1145
+ }),
1146
+ ],
1147
+ })
1148
+ ], CommonChildAppModule);
1149
+
1150
+ export { ActionExecution, CommandModule, CommonChildAppModule, CommonModule, createConsumerContext };
package/lib/index.js CHANGED
@@ -30,6 +30,9 @@ var toArray = require('@tinkoff/utils/array/toArray');
30
30
  var LRU = require('lru-cache');
31
31
  var tokensServer = require('@tramvai/tokens-server');
32
32
  var papi = require('@tramvai/papi');
33
+ var React = require('react');
34
+ var tokensRender = require('@tramvai/tokens-render');
35
+ var tokensChildApp = require('@tramvai/tokens-child-app');
33
36
 
34
37
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
35
38
 
@@ -45,6 +48,7 @@ var uniq__default = /*#__PURE__*/_interopDefaultLegacy(uniq);
45
48
  var difference__default = /*#__PURE__*/_interopDefaultLegacy(difference);
46
49
  var toArray__default = /*#__PURE__*/_interopDefaultLegacy(toArray);
47
50
  var LRU__default = /*#__PURE__*/_interopDefaultLegacy(LRU);
51
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
48
52
 
49
53
  const FS_PAGES_DEFAULT_BUNDLE = '__default';
50
54
  class BundleManager {
@@ -391,7 +395,7 @@ class CommandLineRunner {
391
395
  this.metrics = metrics;
392
396
  }
393
397
  run(type, status, providers, customDi) {
394
- const di = resolveDi(type, status, customDi || this.rootDi, providers);
398
+ const di = customDi !== null && customDi !== void 0 ? customDi : resolveDi(type, status, this.rootDi, providers);
395
399
  this.log.debug({
396
400
  event: 'command-run',
397
401
  type,
@@ -492,7 +496,7 @@ class CommandLineRunner {
492
496
  }
493
497
  }
494
498
 
495
- const command = {
499
+ const command$1 = {
496
500
  init: [core.commandLineListTokens.init, core.commandLineListTokens.listen],
497
501
  close: [core.commandLineListTokens.close],
498
502
  customer: [
@@ -508,9 +512,9 @@ const command = {
508
512
  core.commandLineListTokens.spaTransition,
509
513
  ],
510
514
  };
511
- const lines = {
512
- server: command,
513
- client: command,
515
+ const lines$1 = {
516
+ server: command$1,
517
+ client: command$1,
514
518
  };
515
519
 
516
520
  exports.CommandModule = class CommandModule {
@@ -537,7 +541,7 @@ exports.CommandModule = tslib.__decorate([
537
541
  // Дефолтный список команл
538
542
  provide: core.COMMAND_LINES_TOKEN,
539
543
  scope: dippy.Scope.SINGLETON,
540
- useValue: lines,
544
+ useValue: lines$1,
541
545
  },
542
546
  ],
543
547
  })
@@ -581,7 +585,7 @@ PubSubModule = tslib.__decorate([
581
585
  })
582
586
  ], PubSubModule);
583
587
 
584
- const providers$1 = [];
588
+ const providers$2 = [];
585
589
 
586
590
  const actionServerStateEvent = state.createEvent('action state execution in server');
587
591
  const initalState = { serverState: {} };
@@ -875,6 +879,8 @@ ActionModule = tslib.__decorate([
875
879
  })
876
880
  ], ActionModule);
877
881
 
882
+ const INITIAL_APP_STATE_TOKEN = dippy.createToken('initialAppState');
883
+
878
884
  let StateModule = class StateModule {
879
885
  };
880
886
  StateModule = tslib.__decorate([
@@ -894,14 +900,16 @@ StateModule = tslib.__decorate([
894
900
  {
895
901
  provide: tokensCommon.DISPATCHER_CONTEXT_TOKEN,
896
902
  scope: core.Scope.REQUEST,
897
- useFactory: ({ dispatcher, initialState, middlewares }) => dispatcher.createContext({}, initialState, [
898
- state.devTools.middleware(),
899
- ...flatten__default["default"](middlewares || []),
900
- ]),
903
+ useFactory: ({ dispatcher, initialState, middlewares }) => {
904
+ return dispatcher.createContext({}, initialState, [
905
+ state.devTools.middleware(),
906
+ ...flatten__default["default"](middlewares || []),
907
+ ]);
908
+ },
901
909
  deps: {
902
910
  dispatcher: tokensCommon.DISPATCHER_TOKEN,
903
911
  middlewares: { token: tokensCommon.STORE_MIDDLEWARE, optional: true },
904
- initialState: { token: 'initialAppState', optional: true },
912
+ initialState: { token: INITIAL_APP_STATE_TOKEN, optional: true },
905
913
  },
906
914
  },
907
915
  {
@@ -941,7 +949,7 @@ const papiClearCache = ({ clearCache, logger, }) => {
941
949
  });
942
950
  };
943
951
 
944
- const providers = [
952
+ const providers$1 = [
945
953
  {
946
954
  provide: tokensServer.SERVER_MODULE_PAPI_PRIVATE_ROUTE,
947
955
  multi: true,
@@ -959,7 +967,7 @@ let CacheModule = class CacheModule {
959
967
  CacheModule = tslib.__decorate([
960
968
  core.Module({
961
969
  providers: [
962
- ...providers,
970
+ ...providers$1,
963
971
  {
964
972
  provide: cachesToken,
965
973
  scope: core.Scope.SINGLETON,
@@ -1074,11 +1082,89 @@ exports.CommonModule = tslib.__decorate([
1074
1082
  store: tokensCommon.STORE_TOKEN,
1075
1083
  },
1076
1084
  }),
1077
- ...providers$1,
1085
+ ...providers$2,
1078
1086
  ],
1079
1087
  })
1080
1088
  ], exports.CommonModule);
1081
1089
 
1090
+ const providers = [];
1091
+
1092
+ const stateProviders = [
1093
+ core.provide({
1094
+ provide: tokensChildApp.CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1095
+ multi: true,
1096
+ useValue: [tokensCommon.DISPATCHER_TOKEN, tokensCommon.DISPATCHER_CONTEXT_TOKEN, tokensCommon.STORE_TOKEN, tokensCommon.CONTEXT_TOKEN],
1097
+ }),
1098
+ ];
1099
+
1100
+ const command = {
1101
+ customer: [
1102
+ tokensChildApp.commandLineListTokens.customerStart,
1103
+ tokensChildApp.commandLineListTokens.resolveUserDeps,
1104
+ tokensChildApp.commandLineListTokens.resolvePageDeps,
1105
+ ],
1106
+ clear: [tokensChildApp.commandLineListTokens.clear],
1107
+ spa: [
1108
+ tokensChildApp.commandLineListTokens.resolveUserDeps,
1109
+ tokensChildApp.commandLineListTokens.resolvePageDeps,
1110
+ tokensChildApp.commandLineListTokens.spaTransition,
1111
+ ],
1112
+ };
1113
+ const lines = {
1114
+ server: command,
1115
+ client: command,
1116
+ };
1117
+ const commandProviders = [
1118
+ core.provide({
1119
+ provide: tokensChildApp.CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1120
+ multi: true,
1121
+ useValue: core.COMMAND_LINE_RUNNER_TOKEN,
1122
+ }),
1123
+ core.provide({
1124
+ provide: core.COMMAND_LINES_TOKEN,
1125
+ scope: core.Scope.SINGLETON,
1126
+ useValue: lines,
1127
+ }),
1128
+ ];
1129
+
1130
+ const actionsProviders = [
1131
+ core.provide({
1132
+ provide: tokensChildApp.CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1133
+ multi: true,
1134
+ useValue: [tokensCommon.ACTION_EXECUTION_TOKEN, tokensCommon.ACTION_PAGE_RUNNER_TOKEN],
1135
+ }),
1136
+ {
1137
+ provide: tokensCommon.COMBINE_REDUCERS,
1138
+ multi: true,
1139
+ useValue: actionTramvaiReducer,
1140
+ },
1141
+ ];
1142
+
1143
+ exports.CommonChildAppModule = class CommonChildAppModule {
1144
+ };
1145
+ exports.CommonChildAppModule = tslib.__decorate([
1146
+ core.Module({
1147
+ providers: [
1148
+ ...providers,
1149
+ ...stateProviders,
1150
+ ...commandProviders,
1151
+ ...actionsProviders,
1152
+ core.provide({
1153
+ provide: tokensRender.EXTEND_RENDER,
1154
+ multi: true,
1155
+ useFactory: ({ context }) => {
1156
+ return (render) => {
1157
+ return React__default["default"].createElement(state.Provider, { context: context }, render);
1158
+ };
1159
+ },
1160
+ deps: {
1161
+ context: tokensCommon.CONTEXT_TOKEN,
1162
+ },
1163
+ }),
1164
+ ],
1165
+ })
1166
+ ], exports.CommonChildAppModule);
1167
+
1082
1168
  Object.defineProperty(exports, 'COOKIE_MANAGER_TOKEN', {
1083
1169
  enumerable: true,
1084
1170
  get: function () { return moduleCookie.COOKIE_MANAGER_TOKEN; }
@@ -1,11 +1,13 @@
1
1
  import { COMMAND_LINE_RUNNER_TOKEN } from '@tramvai/core';
2
2
  declare global {
3
3
  interface Window {
4
- initialState: any;
4
+ initialState: string;
5
5
  }
6
6
  }
7
7
  export declare const providers: ({
8
- provide: string;
8
+ provide: {
9
+ stores: Record<string, any>;
10
+ };
9
11
  useFactory: () => any;
10
12
  scope: import("@tinkoff/dippy/lib/Provider").ScopeVariants;
11
13
  deps?: undefined;
@@ -0,0 +1,3 @@
1
+ export declare const INITIAL_APP_STATE_TOKEN: {
2
+ stores: Record<string, any>;
3
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "1.44.4",
3
+ "version": "1.46.6",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -30,23 +30,26 @@
30
30
  "@tinkoff/errors": "0.2.18",
31
31
  "@tinkoff/pubsub": "0.4.23",
32
32
  "@tinkoff/url": "0.7.37",
33
- "@tramvai/module-cookie": "1.44.4",
34
- "@tramvai/module-environment": "1.44.4",
35
- "@tramvai/module-log": "1.44.4",
36
- "@tramvai/tokens-common": "1.44.4",
37
- "@tramvai/experiments": "1.44.4",
33
+ "@tramvai/module-cookie": "1.46.6",
34
+ "@tramvai/module-environment": "1.46.6",
35
+ "@tramvai/module-log": "1.46.6",
36
+ "@tramvai/tokens-child-app": "1.46.6",
37
+ "@tramvai/tokens-common": "1.46.6",
38
+ "@tramvai/tokens-render": "1.46.6",
39
+ "@tramvai/experiments": "1.46.6",
38
40
  "@tinkoff/hook-runner": "0.3.21",
39
41
  "lru-cache": "^6.0.0"
40
42
  },
41
43
  "peerDependencies": {
42
44
  "@tinkoff/utils": "^2.1.2",
43
- "@tramvai/cli": "1.44.4",
44
- "@tramvai/core": "1.44.4",
45
- "@tramvai/papi": "1.44.4",
46
- "@tramvai/state": "1.44.4",
47
- "@tramvai/tokens-metrics": "1.44.4",
48
- "@tramvai/tokens-server": "1.44.4",
49
- "@tinkoff/dippy": "0.7.35",
45
+ "@tramvai/cli": "1.46.6",
46
+ "@tramvai/core": "1.46.6",
47
+ "@tramvai/papi": "1.46.6",
48
+ "@tramvai/state": "1.46.6",
49
+ "@tramvai/tokens-metrics": "1.46.6",
50
+ "@tramvai/tokens-server": "1.46.6",
51
+ "@tinkoff/dippy": "0.7.36",
52
+ "react": ">=16.8.0",
50
53
  "tslib": "^2.0.3"
51
54
  },
52
55
  "module": "lib/index.es.js",