@widgetic/ui-sdk 0.1.5 → 0.1.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.
Files changed (95) hide show
  1. package/README.md +62 -9
  2. package/dist/{index.js → index.cjs} +13 -23
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +52 -0
  5. package/dist/index.esm.js +12 -22
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/sdk/core/component.d.cts +46 -0
  8. package/dist/sdk/core/component.d.ts +1 -1
  9. package/dist/sdk/core/component.d.ts.map +1 -1
  10. package/dist/sdk/core/events.d.cts +25 -0
  11. package/dist/sdk/core/events.d.ts +1 -1
  12. package/dist/sdk/core/events.d.ts.map +1 -1
  13. package/dist/sdk/core/index.d.cts +32 -0
  14. package/dist/sdk/core/index.d.ts +6 -6
  15. package/dist/sdk/core/index.d.ts.map +1 -1
  16. package/dist/sdk/core/lifecycle.d.cts +96 -0
  17. package/dist/sdk/core/lifecycle.d.ts +3 -3
  18. package/dist/sdk/core/lifecycle.d.ts.map +1 -1
  19. package/dist/sdk/core/local-events.d.cts +24 -0
  20. package/dist/sdk/core/local-events.d.ts +1 -1
  21. package/dist/sdk/core/local-events.d.ts.map +1 -1
  22. package/dist/sdk/core/messaging.d.cts +57 -0
  23. package/dist/sdk/core/messaging.d.ts +2 -2
  24. package/dist/sdk/core/messaging.d.ts.map +1 -1
  25. package/dist/sdk/core/state.d.cts +64 -0
  26. package/dist/sdk/core/state.d.ts +10 -3
  27. package/dist/sdk/core/state.d.ts.map +1 -1
  28. package/dist/sdk/core/theme-mode.d.cts +43 -0
  29. package/dist/sdk/core/theme-mode.d.ts +1 -1
  30. package/dist/sdk/core/theme-mode.d.ts.map +1 -1
  31. package/dist/sdk/core/theme.d.cts +57 -0
  32. package/dist/sdk/core/theme.d.ts +2 -2
  33. package/dist/sdk/core/theme.d.ts.map +1 -1
  34. package/dist/sdk/index.d.cts +3 -0
  35. package/dist/sdk/index.d.ts +1 -1
  36. package/dist/sdk/index.d.ts.map +1 -1
  37. package/dist/sdk/integration/host.d.cts +53 -0
  38. package/dist/sdk/integration/host.d.ts +2 -2
  39. package/dist/sdk/integration/host.d.ts.map +1 -1
  40. package/dist/sdk/integration/index.d.cts +18 -0
  41. package/dist/sdk/integration/index.d.ts +1 -1
  42. package/dist/sdk/integration/index.d.ts.map +1 -1
  43. package/dist/sdk/layers/index.d.cts +35 -0
  44. package/dist/sdk/loader/ui.d.cts +207 -0
  45. package/dist/sdk/loader/ui.d.ts +49 -6
  46. package/dist/sdk/loader/ui.d.ts.map +1 -1
  47. package/dist/sdk/modules/index.d.cts +8 -0
  48. package/dist/sdk/modules/index.d.ts +1 -1
  49. package/dist/sdk/modules/index.d.ts.map +1 -1
  50. package/dist/sdk/modules/loader.d.cts +83 -0
  51. package/dist/sdk/modules/loader.d.ts +1 -1
  52. package/dist/sdk/modules/loader.d.ts.map +1 -1
  53. package/dist/sdk/types/component.d.cts +214 -0
  54. package/dist/sdk/types/component.d.ts +27 -12
  55. package/dist/sdk/types/component.d.ts.map +1 -1
  56. package/dist/sdk/types/events.d.cts +111 -0
  57. package/dist/sdk/types/events.d.ts.map +1 -1
  58. package/dist/sdk/types/index.d.cts +43 -0
  59. package/dist/sdk/types/index.d.ts +8 -7
  60. package/dist/sdk/types/index.d.ts.map +1 -1
  61. package/dist/sdk/types/messaging.d.cts +40 -0
  62. package/dist/sdk/types/module-events.d.cts +212 -0
  63. package/dist/sdk/types/module-events.d.ts +213 -0
  64. package/dist/sdk/types/module-events.d.ts.map +1 -0
  65. package/dist/sdk/types/module-language.d.cts +46 -0
  66. package/dist/sdk/types/module-media-library.d.cts +143 -0
  67. package/dist/sdk/types/module-theme.d.cts +96 -0
  68. package/dist/sdk/types/module-theme.d.ts +1 -1
  69. package/dist/sdk/types/module-theme.d.ts.map +1 -1
  70. package/dist/sdk/types/state.d.cts +37 -0
  71. package/dist/sdk/types/state.d.ts.map +1 -1
  72. package/dist/sdk/types/theme.d.cts +75 -0
  73. package/dist/sdk/utils/config.d.cts +69 -0
  74. package/dist/sdk/utils/config.d.ts.map +1 -1
  75. package/dist/sdk/utils/errors.d.cts +55 -0
  76. package/dist/sdk/utils/errors.d.ts +1 -1
  77. package/dist/sdk/utils/errors.d.ts.map +1 -1
  78. package/dist/sdk/utils/http.d.cts +20 -0
  79. package/dist/sdk/utils/security.d.cts +94 -0
  80. package/dist/sdk/utils/validation.d.cts +63 -0
  81. package/dist/sdk/utils/validation.d.ts +1 -1
  82. package/dist/sdk/utils/validation.d.ts.map +1 -1
  83. package/dist/sdk/version.d.cts +10 -0
  84. package/dist/sdk/version.d.ts +1 -1
  85. package/dist/services/dataService.d.cts +9 -0
  86. package/dist/services/dataService.d.ts +4 -4
  87. package/dist/services/dataService.d.ts.map +1 -1
  88. package/dist/umd/ui-sdk.js +1 -1
  89. package/dist/umd/ui-sdk.js.map +1 -1
  90. package/dist/utils/caseConversion.d.cts +2 -0
  91. package/dist/utils/caseConversion.d.ts +2 -2
  92. package/dist/utils/caseConversion.d.ts.map +1 -1
  93. package/modules/README.md +62 -35
  94. package/package.json +21 -9
  95. package/dist/index.js.map +0 -1
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Component Type Definitions
3
+ * Core types for UI component system including:
4
+ * - Component configuration
5
+ * - Component lifecycle
6
+ * - Component interfaces
7
+ */
8
+ import type { ThemeConfig } from './theme.cjs';
9
+ import type { ModuleTheme, ThemeOption } from './module-theme.cjs';
10
+ import type { ModuleLanguage } from './module-language.cjs';
11
+ import type { PartnerMediaLibrary, PickFileFn } from './module-media-library.cjs';
12
+ import type { ModuleEventHandlers, ModuleEventName, ModuleEventPayload } from './module-events.cjs';
13
+ import type { IEventEmitter } from './events.cjs';
14
+ /**
15
+ * Why a module is asking the partner for a token.
16
+ * - `initial`: the module is starting and has no token yet.
17
+ * - `expiring`: the current token is about to expire and the module wants its replacement.
18
+ * - `expired`: the current token has already expired (the page was asleep, or an earlier refresh failed).
19
+ */
20
+ export interface TokenRequestContext {
21
+ reason: 'initial' | 'expiring' | 'expired';
22
+ }
23
+ /**
24
+ * What the partner's `getToken` resolves with: the bare editor session token, or the token together with the moment
25
+ * it stops working (an ISO 8601 string, epoch milliseconds or a Date). With `expiresAt` the module asks for a
26
+ * replacement shortly before then, so the visitor is never interrupted.
27
+ */
28
+ export type TokenResult = string | {
29
+ token: string;
30
+ expiresAt?: string | number | Date;
31
+ };
32
+ /**
33
+ * Asks the partner's server for an editor session token.
34
+ * The partner's server mints it (`POST /v1/managed-users/{id}/editor-sessions` with its API key), so the API key
35
+ * never reaches the browser.
36
+ */
37
+ export type GetToken = (context: TokenRequestContext) => Promise<TokenResult> | TokenResult;
38
+ /**
39
+ * UI Module Interface
40
+ * What the SDK needs from every UI module (File Browser, editors ...). Modules are plain classes built as
41
+ * `new Module(container, config)`; only `mount` is required.
42
+ */
43
+ export interface UIModule {
44
+ mount(): Promise<void> | void;
45
+ unmount?(): Promise<void> | void;
46
+ /**
47
+ * Change the look: `'light'` or `'dark'` switch the mode and keep the rest of the theme; settings
48
+ * (`{ preset, colors, radius, font }`) replace the whole theme. Throws for a theme that cannot be used.
49
+ */
50
+ setTheme?(theme: ModuleTheme): void;
51
+ /**
52
+ * Change the language while the module is on screen: `locale` for numbers, dates and plural rules, `messages` for the
53
+ * words. A key of `locale` or `messages` that the call leaves out keeps its current value; a `messages` object
54
+ * replaces all the module's current messages. Throws for a value that cannot be used, and then changes nothing.
55
+ */
56
+ setLanguage?(language: ModuleLanguage): void;
57
+ on?(eventName: string, handler: (payload: any) => void): () => void;
58
+ off?(eventName: string, handler: (payload: any) => void): void;
59
+ }
60
+ /**
61
+ * Component Status Type
62
+ * All possible component lifecycle states
63
+ */
64
+ export type ComponentStatus = 'initializing' | 'ready' | 'error' | 'destroyed';
65
+ /**
66
+ * Component State Interface
67
+ * Tracks component status and data
68
+ */
69
+ export interface ComponentState {
70
+ status: ComponentStatus;
71
+ error: Error | null;
72
+ data?: Record<string, any>;
73
+ }
74
+ /**
75
+ * Base mount configuration
76
+ * Settings for mounting any module. Everything that is not listed here is handed to the module itself
77
+ * (the File Browser takes `maxSelections`, `initialFilter`, `selectLabel`, `locale`, `messages` ...).
78
+ *
79
+ * `Name` is the name of the module being mounted. `mountModule` and `ui.mount` fill it in from the name you pass, which is
80
+ * how `on` knows the events of the File Browser, the composition editor and the widget creator. Left out, `on` takes any
81
+ * event name.
82
+ */
83
+ export interface MountConfig<Name extends ModuleName = ModuleName> {
84
+ container: string | HTMLElement;
85
+ /** Pin an exact module version such as "1.2.0". Default: the newest published version. */
86
+ version?: string;
87
+ /**
88
+ * The look of this module: `'light'`, `'dark'`, `'system'`, or settings (`{ preset, mode, colors, radius, font }`).
89
+ * Default: the SDK's current theme. A module with settings of its own keeps them when the page later calls
90
+ * `ui.updateTheme(...)` with settings; it follows a change of mode.
91
+ */
92
+ theme?: ThemeOption;
93
+ /** Show a loading placeholder while the module downloads. Default: true. */
94
+ placeholder?: boolean;
95
+ /** The words a screen reader says for that placeholder, in your language. Default: "Loading". */
96
+ loadingLabel?: string;
97
+ /**
98
+ * Cancels the mount. When the signal aborts before the module is running, the download is abandoned, nothing is
99
+ * left in the container and the mount rejects with an `AbortError` (code `MOUNT_ABORTED`). When it aborts
100
+ * while the module is starting, the module is taken down again. Made for components that can be removed before
101
+ * the module has finished loading (React effects, route changes).
102
+ */
103
+ signal?: AbortSignal;
104
+ /**
105
+ * Listen to module events from the very start, so `ready` is not missed. For the File Browser, the composition editor
106
+ * and the widget creator the event names and what each one carries are typed (`FileBrowserEvents`,
107
+ * `CompositionEditorEvents`, `WidgetCreatorEvents`); any other module takes any name, with a payload of `any`.
108
+ */
109
+ on?: ModuleEventHandlers<Name>;
110
+ callbacks?: {
111
+ onReady?: () => void;
112
+ onError?: (error: Error) => void;
113
+ };
114
+ /**
115
+ * Every module. When `true`, the module reads its colours and corner radius once, as it starts, from the CSS custom
116
+ * properties of the container it is mounted in (`--primary`, `--background`, `--radius` ...), and follows them
117
+ * when the container's `style` or `class` changes. What you give in `theme` wins. Default: `false`.
118
+ */
119
+ themeFromHost?: boolean;
120
+ /**
121
+ * The File Browser, the composition editor and the widget creator: your own media library, so that their pickers
122
+ * show your files and not the user's Widgetic uploads. Only `list` is required; `urlResolver` turns a listed
123
+ * address into the one that is saved.
124
+ */
125
+ mediaLibrary?: PartnerMediaLibrary;
126
+ /**
127
+ * The composition editor and the widget creator: your own picker for file fields, instead of the File Browser.
128
+ * Resolve the files chosen, or `[]` when the visitor cancelled.
129
+ */
130
+ pickFile?: PickFileFn;
131
+ /**
132
+ * The composition editor: when `true`, resizing the preview changes how it looks in the editor but does not update
133
+ * the widget's `embedSettings.width` and `embedSettings.height` when it is saved. Default: `false`.
134
+ */
135
+ lockPreviewSize?: boolean;
136
+ [moduleOption: string]: unknown;
137
+ }
138
+ /**
139
+ * Component configuration
140
+ * Full configuration for component initialization
141
+ * @deprecated Part of the legacy component base class (`WidgeticComponent`); UI modules do not use it.
142
+ */
143
+ export interface ComponentConfig {
144
+ id: string;
145
+ container: HTMLElement;
146
+ events: IEventEmitter;
147
+ theme?: ThemeConfig;
148
+ widgetId?: string;
149
+ compositionId?: string;
150
+ }
151
+ /**
152
+ * Component instance information
153
+ * Runtime data for mounted components
154
+ */
155
+ export interface ComponentInstance {
156
+ id: string;
157
+ type: ComponentType;
158
+ container: HTMLElement;
159
+ unmount: () => Promise<void>;
160
+ }
161
+ /**
162
+ * A mounted UI module
163
+ * What `mount()` resolves with: the module itself plus the controls a page needs.
164
+ *
165
+ * `Name` is the name the module was mounted with. For the File Browser, the composition editor and the widget creator it
166
+ * gives `on` and `off` the names of that module's events and the payload of each (`ModuleEventMap`); for any other name
167
+ * they take any event name, with a payload of `any`.
168
+ */
169
+ export interface MountedModule<Module extends UIModule = UIModule, Name extends ModuleName = ModuleName> {
170
+ id: string;
171
+ type: Name;
172
+ version: string;
173
+ container: HTMLElement;
174
+ module: Module;
175
+ /** Listen to a module event. Returns the function that stops listening. */
176
+ on: <Event extends ModuleEventName<Name>>(eventName: Event, handler: (payload: ModuleEventPayload<Name, Event>) => void) => () => void;
177
+ /** Stop listening with the handler given to `on`. */
178
+ off: <Event extends ModuleEventName<Name>>(eventName: Event, handler: (payload: ModuleEventPayload<Name, Event>) => void) => void;
179
+ /**
180
+ * Change the look of this module alone: `'light'` or `'dark'` switch the mode and keep the rest of its theme; settings
181
+ * replace its theme, and from then on the module keeps them when the page calls `ui.updateTheme(...)` with settings.
182
+ * Throws for a theme that cannot be used, and then changes nothing.
183
+ */
184
+ setTheme: (theme: ModuleTheme) => void;
185
+ /**
186
+ * Change the language of this module while it is on screen (`locale`, `messages`). A key the call leaves out keeps its
187
+ * current value; `messages` replaces all of the module's current messages, so a page switching from German to French
188
+ * passes the French ones only. Throws for a value the module cannot use, and then changes nothing. A module that has
189
+ * no words to translate (yet) says so in the console and does nothing.
190
+ */
191
+ setLanguage: (language: ModuleLanguage) => void;
192
+ unmount: () => Promise<void>;
193
+ }
194
+ /**
195
+ * Available component types
196
+ * Union of all supported UI components
197
+ */
198
+ export type ComponentType = 'widget-creator' | 'composition-editor' | 'embed-editor' | 'file-browser';
199
+ /**
200
+ * Any module name. The known modules autocomplete; a module published after this SDK release still works because
201
+ * modules are found through the CDN, not through this list.
202
+ */
203
+ export type ModuleName = ComponentType | (string & {});
204
+ /**
205
+ * Module manifest
206
+ * A small JSON file next to every module (`<base>/<name>/manifest.json`) that names the newest version.
207
+ */
208
+ export interface ModuleManifest {
209
+ name: string;
210
+ version: string;
211
+ entry: string;
212
+ }
213
+ /** @deprecated Use `ModuleManifest`. */
214
+ export type ComponentManifest = ModuleManifest;
@@ -5,11 +5,12 @@
5
5
  * - Component lifecycle
6
6
  * - Component interfaces
7
7
  */
8
- import type { ThemeConfig } from './theme';
9
- import type { ModuleTheme, ThemeOption } from './module-theme';
10
- import type { ModuleLanguage } from './module-language';
11
- import type { PartnerMediaLibrary, PickFileFn } from './module-media-library';
12
- import type { IEventEmitter } from './events';
8
+ import type { ThemeConfig } from './theme.js';
9
+ import type { ModuleTheme, ThemeOption } from './module-theme.js';
10
+ import type { ModuleLanguage } from './module-language.js';
11
+ import type { PartnerMediaLibrary, PickFileFn } from './module-media-library.js';
12
+ import type { ModuleEventHandlers, ModuleEventName, ModuleEventPayload } from './module-events.js';
13
+ import type { IEventEmitter } from './events.js';
13
14
  /**
14
15
  * Why a module is asking the partner for a token.
15
16
  * - `initial`: the module is starting and has no token yet.
@@ -74,8 +75,12 @@ export interface ComponentState {
74
75
  * Base mount configuration
75
76
  * Settings for mounting any module. Everything that is not listed here is handed to the module itself
76
77
  * (the File Browser takes `maxSelections`, `initialFilter`, `selectLabel`, `locale`, `messages` ...).
78
+ *
79
+ * `Name` is the name of the module being mounted. `mountModule` and `ui.mount` fill it in from the name you pass, which is
80
+ * how `on` knows the events of the File Browser, the composition editor and the widget creator. Left out, `on` takes any
81
+ * event name.
77
82
  */
78
- export interface MountConfig {
83
+ export interface MountConfig<Name extends ModuleName = ModuleName> {
79
84
  container: string | HTMLElement;
80
85
  /** Pin an exact module version such as "1.2.0". Default: the newest published version. */
81
86
  version?: string;
@@ -96,8 +101,12 @@ export interface MountConfig {
96
101
  * the module has finished loading (React effects, route changes).
97
102
  */
98
103
  signal?: AbortSignal;
99
- /** Listen to module events from the very start, so `ready` is not missed. */
100
- on?: Record<string, (payload: any) => void>;
104
+ /**
105
+ * Listen to module events from the very start, so `ready` is not missed. For the File Browser, the composition editor
106
+ * and the widget creator the event names and what each one carries are typed (`FileBrowserEvents`,
107
+ * `CompositionEditorEvents`, `WidgetCreatorEvents`); any other module takes any name, with a payload of `any`.
108
+ */
109
+ on?: ModuleEventHandlers<Name>;
101
110
  callbacks?: {
102
111
  onReady?: () => void;
103
112
  onError?: (error: Error) => void;
@@ -152,15 +161,21 @@ export interface ComponentInstance {
152
161
  /**
153
162
  * A mounted UI module
154
163
  * What `mount()` resolves with: the module itself plus the controls a page needs.
164
+ *
165
+ * `Name` is the name the module was mounted with. For the File Browser, the composition editor and the widget creator it
166
+ * gives `on` and `off` the names of that module's events and the payload of each (`ModuleEventMap`); for any other name
167
+ * they take any event name, with a payload of `any`.
155
168
  */
156
- export interface MountedModule<Module extends UIModule = UIModule> {
169
+ export interface MountedModule<Module extends UIModule = UIModule, Name extends ModuleName = ModuleName> {
157
170
  id: string;
158
- type: ModuleName;
171
+ type: Name;
159
172
  version: string;
160
173
  container: HTMLElement;
161
174
  module: Module;
162
- on: (eventName: string, handler: (payload: any) => void) => () => void;
163
- off: (eventName: string, handler: (payload: any) => void) => void;
175
+ /** Listen to a module event. Returns the function that stops listening. */
176
+ on: <Event extends ModuleEventName<Name>>(eventName: Event, handler: (payload: ModuleEventPayload<Name, Event>) => void) => () => void;
177
+ /** Stop listening with the handler given to `on`. */
178
+ off: <Event extends ModuleEventName<Name>>(eventName: Event, handler: (payload: ModuleEventPayload<Name, Event>) => void) => void;
164
179
  /**
165
180
  * Change the look of this module alone: `'light'` or `'dark'` switch the mode and keep the rest of its theme; settings
166
181
  * replace its theme, and from then on the module keeps them when the page calls `ui.updateTheme(...)` with settings.
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/sdk/types/component.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;CAC9C;AAED;;;;GAIG;AACH,MAAM,MAAM,WAA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AACH,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,wCAAwC;AACxC,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Event System Type Definitions
3
+ *
4
+ * This module defines the type system for the SDK's event handling.
5
+ * It provides type-safe event emission and handling across all components.
6
+ */
7
+ /**
8
+ * All SDK Event Types
9
+ * Union of all possible event type strings
10
+ */
11
+ export type SDKEventType = 'ready' | 'error' | 'state:update' | 'theme:update' | 'widget:create:start' | 'widget:create:complete' | 'composition:edit:start' | 'composition:save' | 'embed:configure' | 'embed:complete' | 'messaging:error' | 'cache:loaded' | 'cache:saved' | 'cache:hit' | 'cache:miss' | 'cache:updated' | 'cache:expired' | 'cache:cleared' | 'cache:error' | 'cache:update-available';
12
+ /**
13
+ * Event Handler Function
14
+ * Generic handler for all SDK events
15
+ */
16
+ export type EventHandler = (event: SDKEvent) => void;
17
+ /**
18
+ * Event Emitter Interface
19
+ * Core interface for event management
20
+ */
21
+ export interface IEventEmitter {
22
+ on(event: SDKEventType, handler: EventHandler): () => void;
23
+ off(event: SDKEventType, handler: EventHandler): void;
24
+ emit(type: SDKEventType, data: Record<string, any>): void;
25
+ }
26
+ /**
27
+ * SDK Event Base Type
28
+ * Common properties for all events
29
+ */
30
+ interface BaseEvent {
31
+ type: SDKEventType;
32
+ timestamp?: number;
33
+ }
34
+ /**
35
+ * SDK Event Union
36
+ * Combines all possible events and their payloads
37
+ */
38
+ export type SDKEvent = BaseEvent & ({
39
+ type: 'ready';
40
+ componentId: string;
41
+ } | {
42
+ type: 'error';
43
+ componentId: string;
44
+ error: Error;
45
+ } | {
46
+ type: 'state:update';
47
+ componentId: string;
48
+ state: any;
49
+ } | {
50
+ type: 'theme:update';
51
+ theme: any;
52
+ } | {
53
+ type: 'messaging:error';
54
+ error: SDKError;
55
+ } | {
56
+ type: 'widget:create:start';
57
+ partnerId: string;
58
+ } | {
59
+ type: 'widget:create:complete';
60
+ widgetId: string;
61
+ } | {
62
+ type: 'composition:edit:start';
63
+ widgetId: string;
64
+ } | {
65
+ type: 'composition:save';
66
+ compositionId: string;
67
+ } | {
68
+ type: 'embed:configure';
69
+ compositionId: string;
70
+ } | {
71
+ type: 'embed:complete';
72
+ embedCode: string;
73
+ } | {
74
+ type: 'cache:loaded';
75
+ cacheId: string;
76
+ } | {
77
+ type: 'cache:saved';
78
+ cacheId: string;
79
+ } | {
80
+ type: 'cache:hit';
81
+ cacheId: string;
82
+ } | {
83
+ type: 'cache:miss';
84
+ cacheId: string;
85
+ } | {
86
+ type: 'cache:updated';
87
+ cacheId: string;
88
+ } | {
89
+ type: 'cache:expired';
90
+ cacheId: string;
91
+ } | {
92
+ type: 'cache:cleared';
93
+ cacheId: string;
94
+ } | {
95
+ type: 'cache:error';
96
+ cacheId: string;
97
+ } | {
98
+ type: 'cache:update-available';
99
+ cacheId: string;
100
+ });
101
+ /**
102
+ * SDK Error Structure
103
+ */
104
+ export interface SDKError {
105
+ message: string;
106
+ code: string;
107
+ name: string;
108
+ stack?: string;
109
+ details?: unknown;
110
+ }
111
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/sdk/types/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,MAAM,YAAY,GAClB,OAAO,GACP,OAAO,GACP,cAAc,GACd,cAAc,GACd,qBAAqB,GACrB,wBAAwB,GACxB,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,eAAe,GACf,aAA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;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Widgetic UI SDK Type Definitions
3
+ *
4
+ * This module serves as the central type system for the UI SDK.
5
+ * It exports all type definitions used across the SDK components
6
+ * and provides type safety for the entire system.
7
+ */
8
+ export type { UIModule, ComponentStatus, ComponentState, ComponentType, ModuleName, ModuleManifest, ComponentManifest, MountConfig, MountedModule, ComponentConfig, ComponentInstance, GetToken, TokenRequestContext, TokenResult } from './component.cjs';
9
+ export * from './events.cjs';
10
+ export * from './theme.cjs';
11
+ export * from './module-theme.cjs';
12
+ export * from './module-language.cjs';
13
+ export * from './module-media-library.cjs';
14
+ export * from './module-events.cjs';
15
+ export type { StateConfig, StateSnapshot } from './state.cjs';
16
+ /**
17
+ * Error Event Structure
18
+ * Standard format for error events in messaging system
19
+ */
20
+ export interface MessagingErrorEvent {
21
+ type: 'messaging:error';
22
+ error: SDKError;
23
+ timestamp: number;
24
+ }
25
+ /**
26
+ * SDK Error Structure
27
+ * Standardized error format across the SDK
28
+ */
29
+ export interface SDKError {
30
+ message: string;
31
+ code: string;
32
+ name: string;
33
+ stack?: string;
34
+ details?: unknown;
35
+ }
36
+ /**
37
+ * HTTP Types
38
+ * Types for HTTP client configuration and responses
39
+ */
40
+ export type ResponseType = 'json' | 'text' | 'blob';
41
+ export interface RequestConfig extends RequestInit {
42
+ headers?: Record<string, string>;
43
+ }
@@ -5,13 +5,14 @@
5
5
  * It exports all type definitions used across the SDK components
6
6
  * and provides type safety for the entire system.
7
7
  */
8
- export type { UIModule, ComponentStatus, ComponentState, ComponentType, ModuleName, ModuleManifest, ComponentManifest, MountConfig, MountedModule, ComponentConfig, ComponentInstance, GetToken, TokenRequestContext, TokenResult } from './component';
9
- export * from './events';
10
- export * from './theme';
11
- export * from './module-theme';
12
- export * from './module-language';
13
- export * from './module-media-library';
14
- export type { StateConfig, StateSnapshot } from './state';
8
+ export type { UIModule, ComponentStatus, ComponentState, ComponentType, ModuleName, ModuleManifest, ComponentManifest, MountConfig, MountedModule, ComponentConfig, ComponentInstance, GetToken, TokenRequestContext, TokenResult } from './component.js';
9
+ export * from './events.js';
10
+ export * from './theme.js';
11
+ export * from './module-theme.js';
12
+ export * from './module-language.js';
13
+ export * from './module-media-library.js';
14
+ export * from './module-events.js';
15
+ export type { StateConfig, StateSnapshot } from './state.js';
15
16
  /**
16
17
  * Error Event Structure
17
18
  * Standard format for error events in messaging system
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACR,QAAQ,EACR,eAAe,EACf,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACd,MAAM,aAAa,CAAC;AAGrB,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AAGxB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,wBAAwB,CAAC;AAGvC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAA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
2
+ * Messaging System Types
3
+ * Contains types for cross-origin communication and message handling.
4
+ * Used for secure communication between SDK and host application.
5
+ */
6
+ /**
7
+ * Message origin configuration
8
+ * Defines allowed message sources
9
+ */
10
+ export interface MessageConfig {
11
+ allowedOrigins: string[];
12
+ targetOrigin: string;
13
+ }
14
+ /**
15
+ * Message payload structure
16
+ * Standard format for all messages
17
+ */
18
+ export interface MessagePayload<T = unknown> {
19
+ type: string;
20
+ data: T;
21
+ source: string;
22
+ timestamp: number;
23
+ }
24
+ /**
25
+ * Message channel configuration
26
+ * Settings for secure channel setup
27
+ */
28
+ export interface ChannelConfig {
29
+ secure: boolean;
30
+ timeout?: number;
31
+ retries?: number;
32
+ }
33
+ /**
34
+ * Message validation result
35
+ * Result of message security checks
36
+ */
37
+ export interface ValidationResult {
38
+ valid: boolean;
39
+ error?: string;
40
+ }