@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.
- package/README.md +62 -9
- package/dist/{index.js → index.cjs} +13 -23
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +52 -0
- package/dist/index.esm.js +12 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/sdk/core/component.d.cts +46 -0
- package/dist/sdk/core/component.d.ts +1 -1
- package/dist/sdk/core/component.d.ts.map +1 -1
- package/dist/sdk/core/events.d.cts +25 -0
- package/dist/sdk/core/events.d.ts +1 -1
- package/dist/sdk/core/events.d.ts.map +1 -1
- package/dist/sdk/core/index.d.cts +32 -0
- package/dist/sdk/core/index.d.ts +6 -6
- package/dist/sdk/core/index.d.ts.map +1 -1
- package/dist/sdk/core/lifecycle.d.cts +96 -0
- package/dist/sdk/core/lifecycle.d.ts +3 -3
- package/dist/sdk/core/lifecycle.d.ts.map +1 -1
- package/dist/sdk/core/local-events.d.cts +24 -0
- package/dist/sdk/core/local-events.d.ts +1 -1
- package/dist/sdk/core/local-events.d.ts.map +1 -1
- package/dist/sdk/core/messaging.d.cts +57 -0
- package/dist/sdk/core/messaging.d.ts +2 -2
- package/dist/sdk/core/messaging.d.ts.map +1 -1
- package/dist/sdk/core/state.d.cts +64 -0
- package/dist/sdk/core/state.d.ts +10 -3
- package/dist/sdk/core/state.d.ts.map +1 -1
- package/dist/sdk/core/theme-mode.d.cts +43 -0
- package/dist/sdk/core/theme-mode.d.ts +1 -1
- package/dist/sdk/core/theme-mode.d.ts.map +1 -1
- package/dist/sdk/core/theme.d.cts +57 -0
- package/dist/sdk/core/theme.d.ts +2 -2
- package/dist/sdk/core/theme.d.ts.map +1 -1
- package/dist/sdk/index.d.cts +3 -0
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/integration/host.d.cts +53 -0
- package/dist/sdk/integration/host.d.ts +2 -2
- package/dist/sdk/integration/host.d.ts.map +1 -1
- package/dist/sdk/integration/index.d.cts +18 -0
- package/dist/sdk/integration/index.d.ts +1 -1
- package/dist/sdk/integration/index.d.ts.map +1 -1
- package/dist/sdk/layers/index.d.cts +35 -0
- package/dist/sdk/loader/ui.d.cts +207 -0
- package/dist/sdk/loader/ui.d.ts +49 -6
- package/dist/sdk/loader/ui.d.ts.map +1 -1
- package/dist/sdk/modules/index.d.cts +8 -0
- package/dist/sdk/modules/index.d.ts +1 -1
- package/dist/sdk/modules/index.d.ts.map +1 -1
- package/dist/sdk/modules/loader.d.cts +83 -0
- package/dist/sdk/modules/loader.d.ts +1 -1
- package/dist/sdk/modules/loader.d.ts.map +1 -1
- package/dist/sdk/types/component.d.cts +214 -0
- package/dist/sdk/types/component.d.ts +27 -12
- package/dist/sdk/types/component.d.ts.map +1 -1
- package/dist/sdk/types/events.d.cts +111 -0
- package/dist/sdk/types/events.d.ts.map +1 -1
- package/dist/sdk/types/index.d.cts +43 -0
- package/dist/sdk/types/index.d.ts +8 -7
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/messaging.d.cts +40 -0
- package/dist/sdk/types/module-events.d.cts +212 -0
- package/dist/sdk/types/module-events.d.ts +213 -0
- package/dist/sdk/types/module-events.d.ts.map +1 -0
- package/dist/sdk/types/module-language.d.cts +46 -0
- package/dist/sdk/types/module-media-library.d.cts +143 -0
- package/dist/sdk/types/module-theme.d.cts +96 -0
- package/dist/sdk/types/module-theme.d.ts +1 -1
- package/dist/sdk/types/module-theme.d.ts.map +1 -1
- package/dist/sdk/types/state.d.cts +37 -0
- package/dist/sdk/types/state.d.ts.map +1 -1
- package/dist/sdk/types/theme.d.cts +75 -0
- package/dist/sdk/utils/config.d.cts +69 -0
- package/dist/sdk/utils/config.d.ts.map +1 -1
- package/dist/sdk/utils/errors.d.cts +55 -0
- package/dist/sdk/utils/errors.d.ts +1 -1
- package/dist/sdk/utils/errors.d.ts.map +1 -1
- package/dist/sdk/utils/http.d.cts +20 -0
- package/dist/sdk/utils/security.d.cts +94 -0
- package/dist/sdk/utils/validation.d.cts +63 -0
- package/dist/sdk/utils/validation.d.ts +1 -1
- package/dist/sdk/utils/validation.d.ts.map +1 -1
- package/dist/sdk/version.d.cts +10 -0
- package/dist/sdk/version.d.ts +1 -1
- package/dist/services/dataService.d.cts +9 -0
- package/dist/services/dataService.d.ts +4 -4
- package/dist/services/dataService.d.ts.map +1 -1
- package/dist/umd/ui-sdk.js +1 -1
- package/dist/umd/ui-sdk.js.map +1 -1
- package/dist/utils/caseConversion.d.cts +2 -0
- package/dist/utils/caseConversion.d.ts +2 -2
- package/dist/utils/caseConversion.d.ts.map +1 -1
- package/modules/README.md +62 -35
- package/package.json +21 -9
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a partner can say about the look of a UI module: the `theme` of a mount call, of `new WidgeticUI({ theme })`
|
|
3
|
+
* and of `updateTheme(...)`, and the `theme` option every module takes when it is built without the loader.
|
|
4
|
+
*
|
|
5
|
+
* await ui.mount('file-browser', { container, theme: 'dark' }); // just light or dark
|
|
6
|
+
* await ui.mount('file-browser', { container, theme: { preset: 'ocean' } }); // one of the built-in themes
|
|
7
|
+
* await ui.mount('composition-editor', {
|
|
8
|
+
* container,
|
|
9
|
+
* theme: {
|
|
10
|
+
* preset: 'graphite', // start from a built-in theme ...
|
|
11
|
+
* colors: { primary: '#e0541b', background: '#fffaf5' }, // ... and change what is yours
|
|
12
|
+
* radius: 'large',
|
|
13
|
+
* font: { family: '"Poppins", sans-serif', stylesheetUrl: 'https://fonts.googleapis.com/css2?family=Poppins' },
|
|
14
|
+
* },
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* Each module takes its own `theme`, so the modules on one page can look different.
|
|
18
|
+
*
|
|
19
|
+
* This file is the single source of these types: the modules (`modules/src/shared/theme/themeTypes.ts`) re-export it, so
|
|
20
|
+
* what the loader accepts and what a module accepts cannot drift apart. It holds types only.
|
|
21
|
+
*/
|
|
22
|
+
import type { ThemeMode } from './theme.cjs';
|
|
23
|
+
/** Light or dark. */
|
|
24
|
+
export type ModuleThemeMode = 'light' | 'dark';
|
|
25
|
+
/** The built-in themes. `widgetic` is the look the modules have when nothing is asked. */
|
|
26
|
+
export type ModuleThemePresetName = 'widgetic' | 'graphite' | 'ocean' | 'violet' | 'sunset';
|
|
27
|
+
/**
|
|
28
|
+
* Colours of a theme. Any CSS colour that is written out (`#0b6bcb`, `rgb(11 107 203)`, `hsl(210 90% 41%)`, `rebeccapurple`,
|
|
29
|
+
* `oklch(0.6 0.15 250)`); `var(--x)` and `currentColor` are not understood. A colour is used opaque: a transparency in it is ignored.
|
|
30
|
+
* Leave a colour out and it follows from the others (a theme with only a `primary` still has readable text on it).
|
|
31
|
+
*/
|
|
32
|
+
export interface ModuleThemeColors {
|
|
33
|
+
/** The brand colour: buttons, selected items, links, the focus ring. */
|
|
34
|
+
primary?: string;
|
|
35
|
+
/** Text and icons on `primary`. Default: white or near-black, whichever reads better. */
|
|
36
|
+
primaryForeground?: string;
|
|
37
|
+
/** The module's own background (its panels, menus and dialogs). */
|
|
38
|
+
background?: string;
|
|
39
|
+
/** Main text and icons. */
|
|
40
|
+
foreground?: string;
|
|
41
|
+
/** Quiet surfaces: a search box, a hovered row, a tab strip. Default: a little of `foreground` over `background`. */
|
|
42
|
+
muted?: string;
|
|
43
|
+
/** Secondary text: captions, placeholders, file sizes. Default: `foreground` over `background`, softened. */
|
|
44
|
+
mutedForeground?: string;
|
|
45
|
+
/** Lines around cards and inputs, and between sections. Default: a little of `foreground` over `background`. */
|
|
46
|
+
border?: string;
|
|
47
|
+
/** A soft highlight: the selected file, a hovered menu entry. Default: a light tint of `primary`. */
|
|
48
|
+
accent?: string;
|
|
49
|
+
/** Errors, warnings about data loss, and delete buttons. */
|
|
50
|
+
destructive?: string;
|
|
51
|
+
/** Panel and card surfaces (`--background`, `--card`, `--popover`, `--surface-canvas`). */
|
|
52
|
+
surface?: string;
|
|
53
|
+
/** Secondary fills and quiet rows (`--secondary`, `--muted`, `--grey1`). */
|
|
54
|
+
secondary?: string;
|
|
55
|
+
}
|
|
56
|
+
/** The typeface of a module. The widgets the visitor builds keep their own fonts. */
|
|
57
|
+
export interface ModuleThemeFont {
|
|
58
|
+
/**
|
|
59
|
+
* A CSS font-family list, like `'"Poppins", system-ui, sans-serif'`. A single name (`'Poppins'`) gets a safe list of
|
|
60
|
+
* fallbacks added behind it. The font has to be available on the page: already loaded by the page, or through `stylesheetUrl`.
|
|
61
|
+
*/
|
|
62
|
+
family: string;
|
|
63
|
+
/**
|
|
64
|
+
* A stylesheet that defines the font, such as a Google Fonts address. The module adds it to the page's `<head>`
|
|
65
|
+
* once (a font can only be defined there, not inside the module). Needs `https:`; your Content-Security-Policy has
|
|
66
|
+
* to allow it. Not needed for a font your page loads itself.
|
|
67
|
+
*/
|
|
68
|
+
stylesheetUrl?: string;
|
|
69
|
+
}
|
|
70
|
+
/** How round the corners are: a word, or the radius in pixels of a normal control. `medium` (8px) is how the modules look by default. */
|
|
71
|
+
export type ModuleThemeRadius = 'none' | 'small' | 'medium' | 'large' | number;
|
|
72
|
+
/** Everything about a look. All of it is optional. */
|
|
73
|
+
export interface ModuleThemeSettings {
|
|
74
|
+
/** The built-in theme to start from. Default `widgetic`. */
|
|
75
|
+
preset?: ModuleThemePresetName;
|
|
76
|
+
/** Light or dark. Default `light`. */
|
|
77
|
+
mode?: ModuleThemeMode;
|
|
78
|
+
/** Your colours, on top of the preset's. */
|
|
79
|
+
colors?: ModuleThemeColors;
|
|
80
|
+
/** Roundness of buttons, cards and inputs. */
|
|
81
|
+
radius?: ModuleThemeRadius;
|
|
82
|
+
/** Your typeface. */
|
|
83
|
+
font?: ModuleThemeFont;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* What a module takes as its `theme`: `'light'`, `'dark'`, or the settings. As the argument of a module's `setTheme`, a
|
|
87
|
+
* bare `'light'` or `'dark'` changes only the mode and keeps the rest; settings replace the whole theme.
|
|
88
|
+
*/
|
|
89
|
+
export type ModuleTheme = ModuleThemeMode | ModuleThemeSettings;
|
|
90
|
+
/**
|
|
91
|
+
* What a page may write wherever the loader takes a theme (`new WidgeticUI({ theme })`, `updateTheme`, the `theme` of a
|
|
92
|
+
* mount call): the modules' theme, where the mode may also be `'system'` to follow the visitor's operating system.
|
|
93
|
+
*/
|
|
94
|
+
export type ThemeOption = ThemeMode | (Omit<ModuleThemeSettings, 'mode'> & {
|
|
95
|
+
mode?: ThemeMode;
|
|
96
|
+
});
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* This file is the single source of these types: the modules (`modules/src/shared/theme/themeTypes.ts`) re-export it, so
|
|
20
20
|
* what the loader accepts and what a module accepts cannot drift apart. It holds types only.
|
|
21
21
|
*/
|
|
22
|
-
import type { ThemeMode } from './theme';
|
|
22
|
+
import type { ThemeMode } from './theme.js';
|
|
23
23
|
/** Light or dark. */
|
|
24
24
|
export type ModuleThemeMode = 'light' | 'dark';
|
|
25
25
|
/** The built-in themes. `widgetic` is the look the modules have when nothing is asked. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-theme.d.ts","sourceRoot":"","sources":["../../../src/sdk/types/module-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"module-theme.d.ts","sourceRoot":"","sources":["../../../src/sdk/types/module-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,qBAAqB;AACrB,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/C,0FAA0F;AAC1F,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qHAAqH;IACrH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6GAA6G;IAC7G,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qGAAqG;IACrG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,yIAAyI;AACzI,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/E,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,sCAAsC;IACtC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,8CAA8C;IAC9C,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,qBAAqB;IACrB,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAEhE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State Management Types
|
|
3
|
+
* Contains type definitions for component and system state management.
|
|
4
|
+
* Used for tracking component status, errors, and configuration.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Component state configuration
|
|
8
|
+
* Defines state manager settings
|
|
9
|
+
*/
|
|
10
|
+
export interface StateConfig {
|
|
11
|
+
maxSnapshots?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Component state snapshot
|
|
15
|
+
* Point-in-time capture of component state
|
|
16
|
+
*/
|
|
17
|
+
export interface StateSnapshot {
|
|
18
|
+
timestamp: number;
|
|
19
|
+
state: Map<string, any>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Component state interface
|
|
23
|
+
* Current state of a UI component
|
|
24
|
+
*/
|
|
25
|
+
export interface ComponentState {
|
|
26
|
+
status: 'initializing' | 'ready' | 'error';
|
|
27
|
+
error: Error | null;
|
|
28
|
+
data?: Record<string, any>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* State update configuration
|
|
32
|
+
* Options for state updates
|
|
33
|
+
*/
|
|
34
|
+
export interface StateUpdateOptions {
|
|
35
|
+
silent?: boolean;
|
|
36
|
+
snapshot?: boolean;
|
|
37
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/sdk/types/state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/sdk/types/state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAEpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Type Definitions
|
|
3
|
+
* Contains types for theme configuration and customization.
|
|
4
|
+
* Used for consistent styling across components.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Theme mode options
|
|
8
|
+
* Defines available color schemes
|
|
9
|
+
*/
|
|
10
|
+
export type ThemeMode = 'light' | 'dark' | 'system';
|
|
11
|
+
/**
|
|
12
|
+
* Color scheme configuration
|
|
13
|
+
* Defines customizable colors for components
|
|
14
|
+
*/
|
|
15
|
+
export interface ColorScheme {
|
|
16
|
+
primary: string;
|
|
17
|
+
secondary: string;
|
|
18
|
+
background: string;
|
|
19
|
+
surface: string;
|
|
20
|
+
text: string;
|
|
21
|
+
border: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Spacing configuration
|
|
25
|
+
* Defines consistent spacing units
|
|
26
|
+
*/
|
|
27
|
+
export interface SpacingConfig {
|
|
28
|
+
unit: number;
|
|
29
|
+
scale: number[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Typography configuration
|
|
33
|
+
* Defines font settings and scale
|
|
34
|
+
*/
|
|
35
|
+
export interface TypographyConfig {
|
|
36
|
+
fontFamily: string;
|
|
37
|
+
scale: number[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Complete theme configuration
|
|
41
|
+
* Combines all theme settings
|
|
42
|
+
*/
|
|
43
|
+
export interface ThemeConfig {
|
|
44
|
+
mode: ThemeMode;
|
|
45
|
+
colors: ColorScheme;
|
|
46
|
+
spacing: SpacingConfig;
|
|
47
|
+
typography: TypographyConfig;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Partial theme updates
|
|
51
|
+
* Allows updating specific theme properties
|
|
52
|
+
*/
|
|
53
|
+
export type PartialThemeConfig = Partial<ThemeConfig>;
|
|
54
|
+
/**
|
|
55
|
+
* Partner theme overrides
|
|
56
|
+
* Allows partners to customize specific theme aspects
|
|
57
|
+
*/
|
|
58
|
+
export interface PartnerTheme {
|
|
59
|
+
mode?: ThemeMode;
|
|
60
|
+
colors?: Partial<ColorScheme>;
|
|
61
|
+
spacing?: Partial<SpacingConfig>;
|
|
62
|
+
typography?: Partial<TypographyConfig>;
|
|
63
|
+
}
|
|
64
|
+
export type ThemePreset = {
|
|
65
|
+
readonly mode: ThemeMode;
|
|
66
|
+
readonly colors: Readonly<ColorScheme>;
|
|
67
|
+
readonly spacing: {
|
|
68
|
+
readonly unit: number;
|
|
69
|
+
readonly scale: readonly number[];
|
|
70
|
+
};
|
|
71
|
+
readonly typography: {
|
|
72
|
+
readonly fontFamily: string;
|
|
73
|
+
readonly scale: readonly number[];
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Configuration Management
|
|
3
|
+
*
|
|
4
|
+
* Holds the SDK's default addresses and the few switches the legacy security helpers read.
|
|
5
|
+
*
|
|
6
|
+
* Nothing in here handles credentials. The SDK never sees an API key: a partner's server mints a short-lived editor
|
|
7
|
+
* session token and the partner's `getToken` function hands it to the SDK (see `WidgeticUI`).
|
|
8
|
+
*/
|
|
9
|
+
/** The Widgetic API every module talks to unless the partner points it somewhere else (staging, local gateway). */
|
|
10
|
+
export declare const DEFAULT_API_URL = "https://api.widgetic.com";
|
|
11
|
+
/** Where the UI modules are served from. Each module lives in a folder named after it: `<base>/<name>/…`. */
|
|
12
|
+
export declare const DEFAULT_MODULE_BASE_URL = "https://cdn.widgetic.com/modules";
|
|
13
|
+
export interface Config {
|
|
14
|
+
CDN_URL: string;
|
|
15
|
+
NODE_ENV: string;
|
|
16
|
+
API_URL: string;
|
|
17
|
+
API_VERSION: string;
|
|
18
|
+
CLIENT_URL: string;
|
|
19
|
+
PRODUCTION_URL: string;
|
|
20
|
+
EMBED_SDK_URL: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Default configuration values.
|
|
24
|
+
*
|
|
25
|
+
* `NODE_ENV` defaults to production: the origin checks in the security helpers are only relaxed when a developer
|
|
26
|
+
* asks for development mode explicitly, never because nobody configured anything.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DEFAULT_CONFIG: Config;
|
|
29
|
+
/**
|
|
30
|
+
* Configuration Manager
|
|
31
|
+
* Singleton class that handles the SDK's configuration values.
|
|
32
|
+
*/
|
|
33
|
+
export declare class ConfigManager {
|
|
34
|
+
private static instance;
|
|
35
|
+
private config;
|
|
36
|
+
private constructor();
|
|
37
|
+
/**
|
|
38
|
+
* Get singleton instance
|
|
39
|
+
* Creates instance if it doesn't exist
|
|
40
|
+
*/
|
|
41
|
+
static getInstance(): ConfigManager;
|
|
42
|
+
/**
|
|
43
|
+
* Initialize configuration with custom values
|
|
44
|
+
* Merges provided config with defaults
|
|
45
|
+
* @param config - Partial configuration to apply
|
|
46
|
+
*/
|
|
47
|
+
initialize(config: Partial<Config>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Get API base URL
|
|
50
|
+
* @returns Configured API URL
|
|
51
|
+
*/
|
|
52
|
+
getApiUrl(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Get CDN base URL
|
|
55
|
+
* @returns Configured CDN URL
|
|
56
|
+
*/
|
|
57
|
+
getCdnUrl(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Check if running in production mode
|
|
60
|
+
*/
|
|
61
|
+
get isProduction(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Validate required configuration
|
|
64
|
+
* Ensures all required values are present
|
|
65
|
+
* @throws Error if required config is missing
|
|
66
|
+
*/
|
|
67
|
+
validateConfig(): void;
|
|
68
|
+
}
|
|
69
|
+
export declare const config: ConfigManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mHAAmH;AACnH,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D,6GAA6G;AAC7G,eAAO,MAAM,uBAAuB,qCAAqC,CAAC;AAE1E,MAAM,WAAW,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mHAAmH;AACnH,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D,6GAA6G;AAC7G,eAAO,MAAM,uBAAuB,qCAAqC,CAAC;AAE1E,MAAM,WAAW,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,MAS5B,CAAC;AAEF;;;GAGG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;IACvC,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO;IAIP;;;OAGG;IACH,MAAM,CAAC,WAAW,IAAI,aAAa;IAOnC;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI;IAOzC;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED;;;;OAIG;IACH,cAAc,IAAI,IAAI;CAazB;AAGD,eAAO,MAAM,MAAM,eAA8B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handling System
|
|
3
|
+
* Provides centralized error handling and standardization.
|
|
4
|
+
* Creates consistent error objects with proper typing and context.
|
|
5
|
+
*/
|
|
6
|
+
import type { SDKError } from '../types/index.cjs';
|
|
7
|
+
export declare class SDKErrorHandler {
|
|
8
|
+
/**
|
|
9
|
+
* Create standardized error object
|
|
10
|
+
* Formats error with message and code for consistent handling
|
|
11
|
+
* @param message - Human readable error message
|
|
12
|
+
* @param code - Error code for programmatic handling
|
|
13
|
+
* @returns Formatted error object
|
|
14
|
+
*/
|
|
15
|
+
static createError(message: string, code: string): Error;
|
|
16
|
+
/**
|
|
17
|
+
* Handle and transform errors
|
|
18
|
+
* Converts various error types to standardized SDK errors
|
|
19
|
+
* @param error - Original error object
|
|
20
|
+
* @param context - Error context for tracking
|
|
21
|
+
* @returns Standardized error object
|
|
22
|
+
*/
|
|
23
|
+
static handleError(error: unknown, context: string): Error;
|
|
24
|
+
/**
|
|
25
|
+
* Convert error to SDK error format
|
|
26
|
+
* Ensures error object matches SDK error interface
|
|
27
|
+
* @param error - Error to convert
|
|
28
|
+
* @returns SDK formatted error
|
|
29
|
+
*/
|
|
30
|
+
static toSDKError(error: Error): SDKError;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validation Error
|
|
34
|
+
* Thrown when input validation fails
|
|
35
|
+
*/
|
|
36
|
+
export declare class ValidationError extends Error {
|
|
37
|
+
field?: string | undefined;
|
|
38
|
+
constructor(message: string, field?: string | undefined);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Security Error
|
|
42
|
+
* Thrown when security checks fail
|
|
43
|
+
*/
|
|
44
|
+
export declare class SecurityError extends Error {
|
|
45
|
+
code?: string | undefined;
|
|
46
|
+
constructor(message: string, code?: string | undefined);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Component Error
|
|
50
|
+
* Thrown when component operations fail
|
|
51
|
+
*/
|
|
52
|
+
export declare class ComponentError extends Error {
|
|
53
|
+
componentId?: string | undefined;
|
|
54
|
+
constructor(message: string, componentId?: string | undefined);
|
|
55
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides centralized error handling and standardization.
|
|
4
4
|
* Creates consistent error objects with proper typing and context.
|
|
5
5
|
*/
|
|
6
|
-
import type { SDKError } from '../types';
|
|
6
|
+
import type { SDKError } from '../types/index.js';
|
|
7
7
|
export declare class SDKErrorHandler {
|
|
8
8
|
/**
|
|
9
9
|
* Create standardized error object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAKlD,qBAAa,eAAe;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK;IAMxD;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK;IAqB1D;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ;CAS5C;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACF,KAAK,CAAC,EAAE,MAAM;gBAAtC,OAAO,EAAE,MAAM,EAAS,KAAK,CAAC,EAAE,MAAM,YAAA;CAIrD;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACA,IAAI,CAAC,EAAE,MAAM;gBAArC,OAAO,EAAE,MAAM,EAAS,IAAI,CAAC,EAAE,MAAM,YAAA;CAIpD;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACD,WAAW,CAAC,EAAE,MAAM;gBAA5C,OAAO,EAAE,MAAM,EAAS,WAAW,CAAC,EAAE,MAAM,YAAA;CAI3D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP helpers
|
|
3
|
+
*
|
|
4
|
+
* Small request/response helpers. The SDK itself makes no authenticated API calls: the UI modules talk to the
|
|
5
|
+
* Widgetic API with the editor session token the partner's `getToken` returns. A browser-side HTTP client that
|
|
6
|
+
* attached an API key to requests used to live here; it was removed so an API key can never end up in a browser.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Create a secure HTTP request
|
|
10
|
+
* @param url - Request URL
|
|
11
|
+
* @param options - Request options
|
|
12
|
+
* @returns Configured request
|
|
13
|
+
*/
|
|
14
|
+
export declare function createSecureRequest(url: string, options?: RequestInit): Request;
|
|
15
|
+
/**
|
|
16
|
+
* Validate HTTP response
|
|
17
|
+
* @param response - Response to validate
|
|
18
|
+
* @returns True if response is valid
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateResponse(response: Response): boolean;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export declare class SecurityManager {
|
|
2
|
+
private allowedOrigins;
|
|
3
|
+
/**
|
|
4
|
+
* Validate domain against allowed list
|
|
5
|
+
* @param domain - Domain to validate
|
|
6
|
+
* @returns boolean indicating if domain is valid
|
|
7
|
+
*/
|
|
8
|
+
validateDomain(domain: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Development CSP Configuration
|
|
11
|
+
* Relaxed rules for local development
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
private readonly DEVELOPMENT_CSP;
|
|
15
|
+
/**
|
|
16
|
+
* Production CSP Configuration
|
|
17
|
+
* Strict rules for production environment
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private readonly PRODUCTION_CSP;
|
|
21
|
+
/**
|
|
22
|
+
* Allowed Development Origins
|
|
23
|
+
* Origins that are always allowed in development
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
private readonly ALLOWED_DEV_ORIGINS;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize security manager
|
|
29
|
+
* Sets up CSP and configures allowed origins
|
|
30
|
+
* @param allowedOrigins - List of allowed origins
|
|
31
|
+
*/
|
|
32
|
+
constructor(allowedOrigins?: string[]);
|
|
33
|
+
/**
|
|
34
|
+
* Set up Content Security Policy
|
|
35
|
+
* In an embedded UI SDK, injecting top-level document CSP meta tags
|
|
36
|
+
* can interfere with the host application. Boundaries are maintained
|
|
37
|
+
* via iframe isolation and shadow DOM scoping.
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private setupCSP;
|
|
41
|
+
/**
|
|
42
|
+
* Build CSP directive string
|
|
43
|
+
* Converts CSP config to valid directive string
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
private buildCSPString;
|
|
47
|
+
/**
|
|
48
|
+
* Validate request origin
|
|
49
|
+
* Checks if origin is allowed to make requests
|
|
50
|
+
* @param origin - Request origin to validate
|
|
51
|
+
*/
|
|
52
|
+
validateOrigin(origin: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Validate HTTP request
|
|
55
|
+
* Checks origin and CSRF token
|
|
56
|
+
* @param request - Request to validate
|
|
57
|
+
*/
|
|
58
|
+
validateRequest(request: Request): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Validate CSRF token
|
|
61
|
+
* Placeholder for CSRF token validation
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
private validateCSRFToken;
|
|
65
|
+
/**
|
|
66
|
+
* Validate message event
|
|
67
|
+
* Checks message structure and content
|
|
68
|
+
* @param event - Message event to validate
|
|
69
|
+
*/
|
|
70
|
+
validateMessage(event: MessageEvent): boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate origin against allowed list
|
|
74
|
+
* @param origin - Origin to validate
|
|
75
|
+
* @param allowedOrigins - List of allowed origins
|
|
76
|
+
* @returns True if origin is valid
|
|
77
|
+
*/
|
|
78
|
+
export declare function validateOrigin(origin: string, allowedOrigins?: string[]): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Sanitize input string
|
|
81
|
+
* @param input - Input to sanitize
|
|
82
|
+
* @returns Sanitized input
|
|
83
|
+
*/
|
|
84
|
+
export declare function sanitizeInput(input: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Create secure context for iframe communication
|
|
87
|
+
* @param allowedOrigins - List of allowed origins
|
|
88
|
+
* @returns Security context
|
|
89
|
+
*/
|
|
90
|
+
export declare function createSecureContext(allowedOrigins?: string[]): {
|
|
91
|
+
validateMessage: (event: MessageEvent) => boolean;
|
|
92
|
+
validateOrigin: (origin: string) => boolean;
|
|
93
|
+
sanitizeInput: typeof sanitizeInput;
|
|
94
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare class ValidationUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Validate component or resource ID
|
|
4
|
+
* Ensures ID is non-empty string and properly formatted
|
|
5
|
+
* @param id - ID to validate
|
|
6
|
+
* @param context - Context for error messages
|
|
7
|
+
* @throws Error if ID is invalid
|
|
8
|
+
*/
|
|
9
|
+
static validateId(id: string | undefined, context: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Validate DOM container element
|
|
12
|
+
* Checks container existence and type, handles both selectors and elements
|
|
13
|
+
* @param container - Container element or selector
|
|
14
|
+
* @param context - Context for error messages
|
|
15
|
+
* @returns Validated HTMLElement
|
|
16
|
+
* @throws Error if container is invalid
|
|
17
|
+
*/
|
|
18
|
+
static validateContainer(container: string | HTMLElement | undefined, context: string): HTMLElement;
|
|
19
|
+
/**
|
|
20
|
+
* Refuse to run where there is no page
|
|
21
|
+
* Importing and constructing the SDK is safe on a server (it touches nothing), but a module can only be shown in a
|
|
22
|
+
* browser. Mounting during server-side rendering is a mistake worth a clear message, not "document is not defined".
|
|
23
|
+
* @param context - What was being attempted, for the message
|
|
24
|
+
* @throws Error with code NOT_IN_BROWSER when there is no `document`
|
|
25
|
+
*/
|
|
26
|
+
static requireBrowser(context: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Refuse an API key in SDK options
|
|
29
|
+
* An API key must never be in a browser: whoever opens the page's developer tools could read it. The partner's
|
|
30
|
+
* server keeps the key, mints an editor session token with it, and the page's `getToken` returns that token.
|
|
31
|
+
* Both the current spelling (`apiKey`) and the old one (`partner: { apiKey }`) are refused, with a message that
|
|
32
|
+
* says what to do instead. The key itself is never put into the message.
|
|
33
|
+
* @param options - SDK or mount options to check
|
|
34
|
+
* @throws Error with code API_KEY_NOT_ALLOWED if an API key is present
|
|
35
|
+
*/
|
|
36
|
+
static rejectApiKey(options: unknown): void;
|
|
37
|
+
/**
|
|
38
|
+
* Validate configuration object
|
|
39
|
+
* Checks for required fields in configuration objects
|
|
40
|
+
* @param config - Configuration object to validate
|
|
41
|
+
* @param requiredFields - Array of required field names
|
|
42
|
+
* @param context - Context for error messages
|
|
43
|
+
* @throws Error if required fields are missing
|
|
44
|
+
*/
|
|
45
|
+
static validateConfig(config: object | undefined, requiredFields: string[], context: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Validate event type
|
|
48
|
+
* Ensures event type is in list of valid types
|
|
49
|
+
* @param type - Event type to validate
|
|
50
|
+
* @param validTypes - Array of valid event types
|
|
51
|
+
* @throws Error if event type is invalid
|
|
52
|
+
*/
|
|
53
|
+
static validateEventType(type: string, validTypes: string[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Validate file upload
|
|
56
|
+
* Checks file size and type against allowed values
|
|
57
|
+
* @param file - File to validate
|
|
58
|
+
* @param maxSize - Maximum allowed file size
|
|
59
|
+
* @param allowedTypes - Array of allowed MIME types
|
|
60
|
+
* @throws Error if file is invalid
|
|
61
|
+
*/
|
|
62
|
+
static validateFileUpload(file: File, maxSize: number, allowedTypes: string[]): void;
|
|
63
|
+
}
|
|
@@ -42,7 +42,7 @@ export declare class ValidationUtils {
|
|
|
42
42
|
* @param context - Context for error messages
|
|
43
43
|
* @throws Error if required fields are missing
|
|
44
44
|
*/
|
|
45
|
-
static validateConfig(config:
|
|
45
|
+
static validateConfig(config: object | undefined, requiredFields: string[], context: string): void;
|
|
46
46
|
/**
|
|
47
47
|
* Validate event type
|
|
48
48
|
* Ensures event type is in list of valid types
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/validation.ts"],"names":[],"mappings":"AAWA,qBAAa,eAAe;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAShE;;;;;;;OAOG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW;IA+BnG;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAU5C;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAa3C;;;;;;;OAOG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/validation.ts"],"names":[],"mappings":"AAWA,qBAAa,eAAe;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAShE;;;;;;;OAOG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW;IA+BnG;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAU5C;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAa3C;;;;;;;OAOG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAkBlG;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IASlE;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI;CAevF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version and name of the SDK.
|
|
3
|
+
*
|
|
4
|
+
* Keep `SDK_VERSION` equal to "version" in package.json: it is the version the bundles
|
|
5
|
+
* report at runtime, while package.json is the version the package is published as.
|
|
6
|
+
* `scripts-sdk/check-version.js` fails `npm run build` when the two disagree, and
|
|
7
|
+
* `tests/unit/version.test.ts` fails the same way in the suite.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SDK_VERSION = "0.1.6";
|
|
10
|
+
export declare const SDK_NAME = "@widgetic/ui-sdk";
|
package/dist/sdk/version.d.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* `scripts-sdk/check-version.js` fails `npm run build` when the two disagree, and
|
|
7
7
|
* `tests/unit/version.test.ts` fails the same way in the suite.
|
|
8
8
|
*/
|
|
9
|
-
export declare const SDK_VERSION = "0.1.
|
|
9
|
+
export declare const SDK_VERSION = "0.1.6";
|
|
10
10
|
export declare const SDK_NAME = "@widgetic/ui-sdk";
|
|
11
11
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ApiClient = {
|
|
2
|
+
fetchMeta(): Promise<unknown>;
|
|
3
|
+
updateMeta(payload: unknown): Promise<unknown>;
|
|
4
|
+
};
|
|
5
|
+
export declare function createDataService(api: ApiClient): {
|
|
6
|
+
getMetaForUi(): Promise<unknown>;
|
|
7
|
+
updateMetaFromUi(uiPayload: unknown): Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
type ApiClient = {
|
|
2
|
-
fetchMeta(): Promise<
|
|
3
|
-
updateMeta(payload:
|
|
2
|
+
fetchMeta(): Promise<unknown>;
|
|
3
|
+
updateMeta(payload: unknown): Promise<unknown>;
|
|
4
4
|
};
|
|
5
5
|
export declare function createDataService(api: ApiClient): {
|
|
6
|
-
getMetaForUi(): Promise<
|
|
7
|
-
updateMetaFromUi(uiPayload:
|
|
6
|
+
getMetaForUi(): Promise<unknown>;
|
|
7
|
+
updateMetaFromUi(uiPayload: unknown): Promise<void>;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=dataService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataService.d.ts","sourceRoot":"","sources":["../../src/services/dataService.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG;IACf,SAAS,IAAI,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"dataService.d.ts","sourceRoot":"","sources":["../../src/services/dataService.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG;IACf,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS;;gCAMV,OAAO;EAI5C"}
|