@d-najd/universal-media-tracker-sdk 0.3.12 → 0.3.14

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.
@@ -0,0 +1,18 @@
1
+ import Handler from './types/handler/base/Handler';
2
+ import Navigator from './navigator/Navigator';
3
+ export default interface AppApi {
4
+ plugins: AppPluginsApi;
5
+ ui: AppUIApi;
6
+ }
7
+ export interface AppPluginsApi {
8
+ getHandlersMatching(condition: (entry: Handler) => boolean): Handler[];
9
+ /**
10
+ * key is id of the plugin
11
+ * @param condition key is pluginId, value is handler
12
+ */
13
+ getHandlersMatchingWithPluginId(condition: (entry: [string, Handler]) => boolean): Map<string, Handler[]>;
14
+ invokeCallbackOnHandler<T, R>(id: string, args: T): Promise<R>;
15
+ }
16
+ export interface AppUIApi {
17
+ navigator: Navigator;
18
+ }
package/dist/AppApi.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/Plugin.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import PluginConfig from './types/PluginConfig';
2
+ import Handler from './types/handler/base/Handler';
2
3
  import CreateCatalogHandler from './types/handler/media/catalog/CreateCatalogHandler';
3
4
  import CreateResourceHandler from './types/handler/media/CreateResourceHandler';
4
5
  import CreatePluginSourceHandler from './types/handler/plugin/source/CreatePluginSourceHandler';
@@ -6,12 +7,14 @@ import CreateHandler from './types/handler/base/CreateHandler';
6
7
  import CreatePluginFactoryHandler from './types/handler/plugin/factory/CreatePluginFactoryHandler';
7
8
  import CreateScreenHandler from './types/handler/ui/screen/CreateScreenHandler';
8
9
  import CreateCustomScreenHandler from './types/handler/ui/screen/CreateCustomScreenHandler';
10
+ import AppApi from './AppApi';
9
11
  export default class Plugin {
10
12
  readonly config: PluginConfig;
13
+ app: AppApi;
11
14
  /**
12
15
  * key is the handler id
13
16
  */
14
- private handlers;
17
+ protected handlers: Map<string, Handler>;
15
18
  private counter;
16
19
  private loaded;
17
20
  constructor(options: PluginConfig);
package/dist/Plugin.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export default class Plugin {
2
2
  config;
3
+ app = {}; // Stub, set before onLoad
3
4
  /**
4
5
  * key is the handler id
5
6
  */
@@ -88,7 +89,8 @@ export default class Plugin {
88
89
  const newHandler = {
89
90
  id: `${this.config.id}-ui-screen-${this.counter++}`,
90
91
  ...handler,
91
- type: 'ui-screen'
92
+ type: 'ui-screen',
93
+ callback: handler.callback
92
94
  };
93
95
  return this.defineHandler(newHandler);
94
96
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export { default as Plugin } from './Plugin';
2
+ export { default as AppApi } from './AppApi';
3
+ export * from './AppApi';
2
4
  export { default as TriState } from './types/TriState';
3
5
  export { default as PluginSpec } from './types/PluginSpec';
4
6
  export { default as PluginConfig } from './types/PluginConfig';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  // Auto‑generated barrel file – do not edit manually
2
2
  export { default as Plugin } from './Plugin';
3
+ export * from './AppApi';
3
4
  export * from './types/handler/ui/screen/ZustandStoreWrapper';
@@ -1,7 +1,7 @@
1
1
  import BaseHandler from '../../base/BaseHandler';
2
2
  import ScreenHandlerArgs from './ScreenHandlerArgs';
3
3
  import ScreenHandlerResponse from './ScreenHandlerResponse';
4
- type CreateCustomScreenHandler<S extends StoreWrapper<S> = StoreWrapper> = BaseHandler<ScreenHandlerArgs<S>, ScreenHandlerResponse> & {
4
+ type CreateCustomScreenHandler<S extends StoreWrapper<S> = StoreWrapper> = Omit<BaseHandler<ScreenHandlerArgs<S>, ScreenHandlerResponse>, 'callback'> & {
5
5
  /**
6
6
  * /library/:id
7
7
  */
@@ -10,5 +10,6 @@ type CreateCustomScreenHandler<S extends StoreWrapper<S> = StoreWrapper> = BaseH
10
10
  * If undefined screen state won't be stored
11
11
  */
12
12
  readonly initialState?: S;
13
+ readonly callback: (args: ScreenHandlerArgs<S>) => ScreenHandlerResponse;
13
14
  };
14
15
  export default CreateCustomScreenHandler;
@@ -1,10 +1,8 @@
1
- import Navigator from '../../../../navigator/Navigator';
2
1
  type ScreenHandlerArgs<S extends StoreWrapper<S> = StoreWrapper> = {
3
2
  /**
4
3
  * If undefined in handler won't be passed here
5
4
  */
6
5
  readonly state?: S;
7
- readonly navigator: Navigator;
8
6
  /**
9
7
  * /library/1
10
8
  */
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
2
  type ScreenHandlerResponse = {
3
- readonly content: ReactNode;
3
+ readonly content: () => ReactNode;
4
4
  };
5
5
  export default ScreenHandlerResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-najd/universal-media-tracker-sdk",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [