@tramvai/tokens-child-app 3.33.2 → 3.37.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.
package/lib/index.d.ts CHANGED
@@ -1,4 +1,9 @@
1
- import type { Action, Command, TramvaiAction } from '@tramvai/core';
1
+ import type { ComponentType } from 'react';
2
+ import type { Container } from '@tinkoff/dippy';
3
+ import type { Route } from '@tinkoff/router';
4
+ import type { Command, PageAction } from '@tramvai/core';
5
+ import type { ActionsRegistry } from '@tramvai/tokens-common';
6
+ import type { LazyComponentWrapper } from '@tramvai/react';
2
7
  import type { StoreClass } from '@tramvai/state';
3
8
  import type { ChunkExtractor } from '@loadable/server';
4
9
  import type { ChildAppLoader, ChildAppDiManager, ChildAppPreloadManager, ChildAppCommandLineRunner, ChildAppRequestConfig, WrapperProps, RootStateSubscription, ChildAppStateManager, ChildAppFinalConfig, ChildAppRenderManager, ChildAppResolutionConfig, ResolutionConfig } from './types';
@@ -77,18 +82,25 @@ export declare const CHILD_APP_INTERNAL_CONFIG_TOKEN: ChildAppFinalConfig & {
77
82
  __type?: "base token" | undefined;
78
83
  };
79
84
  /**
80
- * @public
81
- * @description Actions of child app
85
+ * @private
86
+ * @description Global actions of child app
82
87
  */
83
- export declare const CHILD_APP_INTERNAL_ACTION_TOKEN: (((context: import("@tramvai/state").ConsumerContext, payload: any, deps: import("@tinkoff/dippy").ProvideDepsIterator<any>) => any) & {
84
- __action_parameters__: import("@tramvai/core").ActionParameters<any, any, any>;
88
+ export declare const CHILD_APP_INTERNAL_ACTION_TOKEN: (((context: import("@tramvai/state").ConsumerContext, payload: void, deps: import("@tinkoff/dippy").ProvideDepsIterator<any>) => void) & {
89
+ __action_parameters__: import("@tramvai/core").ActionParameters<void, void, any>;
85
90
  } & {
86
91
  __type?: "multi token" | undefined;
87
- }) | (TramvaiAction<any[], any, any> & {
92
+ }) | (import("@tramvai/core").TramvaiAction<[], void, any> & {
88
93
  __type?: "multi token" | undefined;
89
- }) | ((Action | TramvaiAction<any[], any, any>)[] & {
94
+ }) | (PageAction[] & {
90
95
  __type?: "multi token" | undefined;
91
96
  });
97
+ /**
98
+ * @private
99
+ * @description Registry of child app actions
100
+ */
101
+ export declare const CHILD_APP_ACTIONS_REGISTRY_TOKEN: ActionsRegistry & {
102
+ __type?: "base token" | undefined;
103
+ };
92
104
  /**
93
105
  * @deprecated use CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN
94
106
  * @public
@@ -189,4 +201,41 @@ export declare const CHILD_APP_INTERNAL_RENDER_TOKEN: (import("react").Component
189
201
  export declare const CHILD_APP_INTERNAL_CHUNK_EXTRACTOR: ChunkExtractor & {
190
202
  __type?: "base token" | undefined;
191
203
  };
204
+ /**
205
+ * @public
206
+ * @description Service to work with Child Apps page components and actions
207
+ */
208
+ export declare const CHILD_APP_PAGE_SERVICE_TOKEN: ChildAppPageService & {
209
+ __type?: "base token" | undefined;
210
+ };
211
+ /**
212
+ * @public
213
+ * @description Child Apps page components list
214
+ */
215
+ export declare const CHILD_APP_PAGE_COMPONENTS_TOKEN: Record<string, ChildAppPageComponent> & {
216
+ __type?: "multi token" | undefined;
217
+ };
218
+ /**
219
+ * @private
220
+ * @description Children for `createChildApp.render` component
221
+ */
222
+ export declare const CHILD_APP_RENDER_CHILDREN_TOKEN: (import("react").ComponentClass<{
223
+ di: Container;
224
+ }, any> & {
225
+ __type?: "base token" | undefined;
226
+ }) | (import("react").FunctionComponent<{
227
+ di: Container;
228
+ }> & {
229
+ __type?: "base token" | undefined;
230
+ });
231
+ export interface ChildAppPageService {
232
+ resolveComponent(route?: Route): Promise<void>;
233
+ getComponentName(route?: Route): string | void;
234
+ getComponent(route?: Route): ChildAppPageComponent | void;
235
+ getActions(route?: Route): PageAction[];
236
+ }
237
+ export type ChildAppPageComponent = ComponentType<{}> & {
238
+ actions?: PageAction[];
239
+ };
240
+ export type ChildAppPageComponentDecl = ChildAppPageComponent | LazyComponentWrapper<ChildAppPageComponent>;
192
241
  //# sourceMappingURL=index.d.ts.map
package/lib/index.es.js CHANGED
@@ -48,10 +48,15 @@ const CHILD_APP_PRELOAD_MANAGER_TOKEN = createToken('child-app preload manager')
48
48
  */
49
49
  const CHILD_APP_INTERNAL_CONFIG_TOKEN = createToken('child-app current config');
50
50
  /**
51
- * @public
52
- * @description Actions of child app
51
+ * @private
52
+ * @description Global actions of child app
53
53
  */
54
54
  const CHILD_APP_INTERNAL_ACTION_TOKEN = createToken('child-app action', multiOptions);
55
+ /**
56
+ * @private
57
+ * @description Registry of child app actions
58
+ */
59
+ const CHILD_APP_ACTIONS_REGISTRY_TOKEN = createToken('child-app actions registry');
55
60
  /**
56
61
  * @deprecated use CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN
57
62
  * @public
@@ -118,5 +123,20 @@ const CHILD_APP_INTERNAL_RENDER_TOKEN = createToken('child-app render');
118
123
  * @description Instance of loadable ChunkExtractor for specific child app
119
124
  */
120
125
  const CHILD_APP_INTERNAL_CHUNK_EXTRACTOR = createToken('child-app chunk extractor');
126
+ /**
127
+ * @public
128
+ * @description Service to work with Child Apps page components and actions
129
+ */
130
+ const CHILD_APP_PAGE_SERVICE_TOKEN = createToken('child-app page service');
131
+ /**
132
+ * @public
133
+ * @description Child Apps page components list
134
+ */
135
+ const CHILD_APP_PAGE_COMPONENTS_TOKEN = createToken('child-app page components', { multi: true });
136
+ /**
137
+ * @private
138
+ * @description Children for `createChildApp.render` component
139
+ */
140
+ const CHILD_APP_RENDER_CHILDREN_TOKEN = createToken('child-app render children');
121
141
 
122
- export { CHILD_APP_COMMAND_LINE_RUNNER_TOKEN, CHILD_APP_COMMON_INITIAL_STATE_TOKEN, CHILD_APP_DI_MANAGER_TOKEN, CHILD_APP_INTERNAL_ACTION_TOKEN, CHILD_APP_INTERNAL_CHUNK_EXTRACTOR, CHILD_APP_INTERNAL_CONFIG_TOKEN, CHILD_APP_INTERNAL_RENDER_TOKEN, CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN, CHILD_APP_LOADER_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN, CHILD_APP_RENDER_MANAGER_TOKEN, CHILD_APP_RESOLUTION_CONFIGS_TOKEN, CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN, CHILD_APP_RESOLVE_BASE_URL_TOKEN, CHILD_APP_RESOLVE_CONFIG_TOKEN, CHILD_APP_SINGLETON_DI_MANAGER_TOKEN, CHILD_APP_STATE_MANAGER_TOKEN, IS_CHILD_APP_DI_TOKEN, commandLineListTokens };
142
+ export { CHILD_APP_ACTIONS_REGISTRY_TOKEN, CHILD_APP_COMMAND_LINE_RUNNER_TOKEN, CHILD_APP_COMMON_INITIAL_STATE_TOKEN, CHILD_APP_DI_MANAGER_TOKEN, CHILD_APP_INTERNAL_ACTION_TOKEN, CHILD_APP_INTERNAL_CHUNK_EXTRACTOR, CHILD_APP_INTERNAL_CONFIG_TOKEN, CHILD_APP_INTERNAL_RENDER_TOKEN, CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN, CHILD_APP_LOADER_TOKEN, CHILD_APP_PAGE_COMPONENTS_TOKEN, CHILD_APP_PAGE_SERVICE_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN, CHILD_APP_RENDER_CHILDREN_TOKEN, CHILD_APP_RENDER_MANAGER_TOKEN, CHILD_APP_RESOLUTION_CONFIGS_TOKEN, CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN, CHILD_APP_RESOLVE_BASE_URL_TOKEN, CHILD_APP_RESOLVE_CONFIG_TOKEN, CHILD_APP_SINGLETON_DI_MANAGER_TOKEN, CHILD_APP_STATE_MANAGER_TOKEN, IS_CHILD_APP_DI_TOKEN, commandLineListTokens };
package/lib/index.js CHANGED
@@ -52,10 +52,15 @@ const CHILD_APP_PRELOAD_MANAGER_TOKEN = dippy.createToken('child-app preload man
52
52
  */
53
53
  const CHILD_APP_INTERNAL_CONFIG_TOKEN = dippy.createToken('child-app current config');
54
54
  /**
55
- * @public
56
- * @description Actions of child app
55
+ * @private
56
+ * @description Global actions of child app
57
57
  */
58
58
  const CHILD_APP_INTERNAL_ACTION_TOKEN = dippy.createToken('child-app action', multiOptions);
59
+ /**
60
+ * @private
61
+ * @description Registry of child app actions
62
+ */
63
+ const CHILD_APP_ACTIONS_REGISTRY_TOKEN = dippy.createToken('child-app actions registry');
59
64
  /**
60
65
  * @deprecated use CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN
61
66
  * @public
@@ -122,7 +127,23 @@ const CHILD_APP_INTERNAL_RENDER_TOKEN = dippy.createToken('child-app render');
122
127
  * @description Instance of loadable ChunkExtractor for specific child app
123
128
  */
124
129
  const CHILD_APP_INTERNAL_CHUNK_EXTRACTOR = dippy.createToken('child-app chunk extractor');
130
+ /**
131
+ * @public
132
+ * @description Service to work with Child Apps page components and actions
133
+ */
134
+ const CHILD_APP_PAGE_SERVICE_TOKEN = dippy.createToken('child-app page service');
135
+ /**
136
+ * @public
137
+ * @description Child Apps page components list
138
+ */
139
+ const CHILD_APP_PAGE_COMPONENTS_TOKEN = dippy.createToken('child-app page components', { multi: true });
140
+ /**
141
+ * @private
142
+ * @description Children for `createChildApp.render` component
143
+ */
144
+ const CHILD_APP_RENDER_CHILDREN_TOKEN = dippy.createToken('child-app render children');
125
145
 
146
+ exports.CHILD_APP_ACTIONS_REGISTRY_TOKEN = CHILD_APP_ACTIONS_REGISTRY_TOKEN;
126
147
  exports.CHILD_APP_COMMAND_LINE_RUNNER_TOKEN = CHILD_APP_COMMAND_LINE_RUNNER_TOKEN;
127
148
  exports.CHILD_APP_COMMON_INITIAL_STATE_TOKEN = CHILD_APP_COMMON_INITIAL_STATE_TOKEN;
128
149
  exports.CHILD_APP_DI_MANAGER_TOKEN = CHILD_APP_DI_MANAGER_TOKEN;
@@ -134,7 +155,10 @@ exports.CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN = CHILD_APP_INTERNAL_ROOT_DI_BOR
134
155
  exports.CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN = CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN;
135
156
  exports.CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN = CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN;
136
157
  exports.CHILD_APP_LOADER_TOKEN = CHILD_APP_LOADER_TOKEN;
158
+ exports.CHILD_APP_PAGE_COMPONENTS_TOKEN = CHILD_APP_PAGE_COMPONENTS_TOKEN;
159
+ exports.CHILD_APP_PAGE_SERVICE_TOKEN = CHILD_APP_PAGE_SERVICE_TOKEN;
137
160
  exports.CHILD_APP_PRELOAD_MANAGER_TOKEN = CHILD_APP_PRELOAD_MANAGER_TOKEN;
161
+ exports.CHILD_APP_RENDER_CHILDREN_TOKEN = CHILD_APP_RENDER_CHILDREN_TOKEN;
138
162
  exports.CHILD_APP_RENDER_MANAGER_TOKEN = CHILD_APP_RENDER_MANAGER_TOKEN;
139
163
  exports.CHILD_APP_RESOLUTION_CONFIGS_TOKEN = CHILD_APP_RESOLUTION_CONFIGS_TOKEN;
140
164
  exports.CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN = CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN;
package/lib/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import type { Container, Provider } from '@tinkoff/dippy';
3
3
  import type { CommandLines, CommandLineDescription, ModuleType, ExtendedModule, Action, TramvaiAction } from '@tramvai/core';
4
+ import type { Route } from '@tinkoff/router';
4
5
  export interface ChildApp {
5
6
  name: string;
6
7
  modules?: (ModuleType | ExtendedModule)[];
@@ -49,8 +50,8 @@ export interface ChildAppFinalConfig extends Required<ChildAppRequestConfig>, Ch
49
50
  key: string;
50
51
  }
51
52
  export interface ChildAppPreloadManager {
52
- preload(config: ChildAppRequestConfig): Promise<void>;
53
- prefetch(config: ChildAppRequestConfig): Promise<void>;
53
+ preload(config: ChildAppRequestConfig, route?: Route): Promise<void>;
54
+ prefetch(config: ChildAppRequestConfig, route?: Route): Promise<void>;
54
55
  isPreloaded(config: ChildAppRequestConfig): boolean;
55
56
  runPreloaded(): Promise<void>;
56
57
  pageRender(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-child-app",
3
- "version": "3.33.2",
3
+ "version": "3.37.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -21,9 +21,11 @@
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@tinkoff/dippy": "0.9.2",
24
- "@tramvai/core": "3.33.2",
25
- "@tramvai/state": "3.33.2",
26
- "@tramvai/tokens-common": "3.33.2",
24
+ "@tinkoff/router": "0.3.73",
25
+ "@tramvai/core": "3.37.1",
26
+ "@tramvai/react": "3.37.1",
27
+ "@tramvai/state": "3.37.1",
28
+ "@tramvai/tokens-common": "3.37.1",
27
29
  "@loadable/server": "*",
28
30
  "react": ">=16.14.0"
29
31
  },