@akinon/app-shared 0.2.0 → 0.2.2

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/dist/types.d.ts CHANGED
@@ -1,47 +1,120 @@
1
+ /**
2
+ * Represents the type of a registered application within the system.
3
+ * @typedef {('fullpage' | 'plugin')} RegisteredAppType
4
+ */
1
5
  export type RegisteredAppType = 'fullpage' | 'plugin';
6
+ /**
7
+ * Defines the structure of a registered application, including its type,
8
+ * unique identifier, URL, and slug.
9
+ * @typedef {Object} RegisteredApp
10
+ * @property {number} id - The unique identifier of the application.
11
+ * @property {string} url - The URL where the application is hosted.
12
+ * @property {string} slug - A short, unique string used to identify the application.
13
+ * @property {RegisteredAppType} type - The type of the application (e.g., 'fullpage' or 'plugin').
14
+ */
2
15
  export type RegisteredApp = {
3
16
  id: number;
4
17
  url: string;
5
18
  slug: string;
6
19
  type: RegisteredAppType;
7
20
  };
21
+ /**
22
+ * Describes a page within an application, including its navigation path and label.
23
+ * @typedef {Object} Page
24
+ * @property {string} path - The navigation path of the page.
25
+ * @property {string} label - The label used for displaying the page in menus or navigation elements.
26
+ */
8
27
  export type Page = {
9
28
  path: string;
10
29
  label: string;
11
30
  };
12
- export interface AppClientConfig {
31
+ /**
32
+ * Common configuration settings for applications, which may include options for
33
+ * development mode, redirection behavior, and menu structure. This base configuration
34
+ * is applicable to both full-page and plugin applications.
35
+ *
36
+ * @typedef {Object} ApplicationConfig
37
+ * @property {boolean} [isDev=false] - Indicates if the application is running in development mode. This can
38
+ * enable more verbose logging or debugging features.
39
+ * @property {boolean} [forceRedirect=false] - Indicates if the application should force a redirect into an
40
+ * iframe context, enhancing security and encapsulation.
41
+ */
42
+ export interface ApplicationConfig {
13
43
  isDev?: boolean;
14
44
  forceRedirect?: boolean;
45
+ }
46
+ /**
47
+ * Configuration settings for full-page applications, extending the common `ApplicationConfig`.
48
+ * Full-page applications typically occupy the entire viewport and may have a menu for
49
+ * navigation.
50
+ *
51
+ * Inherits all properties from `ApplicationConfig` with no additional specific properties, but
52
+ * explicitly restates `menu` to emphasize its relevance to full-page applications.
53
+ *
54
+ * @typedef {Object} FullpageApplicationConfig
55
+ * @extends ApplicationConfig
56
+ * @property {Page[]} [menu] - Optionally redefined from `ApplicationConfig` to highlight its
57
+ * importance in full-page applications for defining the navigation menu.
58
+ */
59
+ export interface FullpageApplicationConfig extends ApplicationConfig {
15
60
  menu?: Page[];
16
61
  }
17
- export type AppConfig = {
18
- /** Authentication token. */
19
- token: string | null;
20
- language: string;
21
- };
22
- export interface ApplicationData {
23
- [key: string]: any;
62
+ /**
63
+ * Configuration settings for plugin applications, which are smaller applications or widgets
64
+ * embedded within a larger application context. Extends the common `ApplicationConfig` with
65
+ * an additional property specific to plugins.
66
+ *
67
+ * Plugin applications are designed to be embedded and might require a specific placeholder
68
+ * within the DOM where they can be loaded.
69
+ *
70
+ * @typedef {Object} PluginApplicationConfig
71
+ * @extends ApplicationConfig
72
+ * @property {string} placeholderId - The ID of the DOM element where the plugin application
73
+ * should be rendered. This allows the application to be
74
+ * dynamically inserted into the correct location within
75
+ * the host environment.
76
+ */
77
+ export interface PluginApplicationConfig extends ApplicationConfig {
78
+ placeholderId: string;
24
79
  }
25
- export type CustomDataEvent = {
80
+ /**
81
+ * A flexible data structure for storing application data, with string keys and any type of value.
82
+ * @typedef {Object} ApplicationData
83
+ */
84
+ export interface ApplicationData {
26
85
  [key: string]: any;
27
- };
28
- export interface ParentModel {
29
- appConfig: AppConfig;
30
- }
31
- export interface ChildModel {
32
- pages: Page[];
33
86
  }
34
- export interface HandshakeEmitMap {
35
- navigateViaChild: {
36
- path: string;
37
- label?: string;
87
+ /**
88
+ * Defines actions that can be shared across applications, including default UI actions and custom actions.
89
+ * @typedef {Object} ApplicationActions
90
+ * @property {Function} [showModalDialog] - Optional. A function to show a modal dialog.
91
+ * @property {Function} [showConfirmationDialog] - Optional. A function to show a confirmation dialog.
92
+ * @property {Function} [showToast] - Optional. A function to show a toast message.
93
+ * @property {Function} [showErrorMessage] - Optional. A function to display an error message.
94
+ * @property {Object} actions - A collection of custom actions that can be invoked.
95
+ */
96
+ export interface ApplicationActions {
97
+ showModalDialog?: (title: string, content: string) => void;
98
+ showConfirmationDialog?: (title: string, content: string) => boolean;
99
+ showToast?: (content: string, type: 'success' | 'warning' | 'error' | 'loading' | 'destroy') => void;
100
+ showErrorMessage?: (title: string, content: string) => void;
101
+ actions: {
102
+ [key: string]: (...args: any[]) => any;
38
103
  };
39
- customData: CustomDataEvent;
40
104
  }
41
- export interface HandshakeCallMap {
42
- navigateViaParent: {
43
- path: string;
44
- };
45
- receiveCustomData: CustomDataEvent;
105
+ /**
106
+ * Provides a mechanism for navigating within the application.
107
+ * @typedef {Object} ApplicationNavigation
108
+ * @property {Function} navigate - A function that performs navigation to the specified URL.
109
+ */
110
+ export interface ApplicationNavigation {
111
+ navigate: (url: string) => void;
46
112
  }
113
+ /**
114
+ * Represents a custom event with flexible data structure for storing event-specific data.
115
+ * @typedef {Object} CustomDataEvent
116
+ */
117
+ export type CustomDataEvent = {
118
+ [key: string]: any;
119
+ };
47
120
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEtD,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,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  "name": "@akinon/app-shared",
3
3
  "description": "Shared utilities and helper functions for app-shell and app-client packages.",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "dist/index.js",