@syntrologie/runtime-sdk 0.2.20 → 1.0.0-canary.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/CAPABILITIES.md +756 -284
- package/README.md +310 -68
- package/dist/RuntimeProvider.d.ts +51 -0
- package/dist/RuntimeProvider.js +113 -0
- package/dist/RuntimeProvider.js.map +1 -0
- package/dist/SmartCanvasApp.d.ts +16 -10
- package/dist/SmartCanvasApp.js +45 -49
- package/dist/SmartCanvasApp.js.map +1 -1
- package/dist/SmartCanvasElement.d.ts +5 -5
- package/dist/SmartCanvasElement.js +24 -14
- package/dist/SmartCanvasElement.js.map +1 -1
- package/dist/SmartCanvasPortal.d.ts +2 -2
- package/dist/SmartCanvasPortal.js +2 -2
- package/dist/actions/ActionEngine.d.ts +11 -0
- package/dist/actions/ActionEngine.js +274 -0
- package/dist/actions/ActionEngine.js.map +1 -0
- package/dist/actions/executors/index.d.ts +117 -0
- package/dist/actions/executors/index.js +242 -0
- package/dist/actions/executors/index.js.map +1 -0
- package/dist/actions/executors/tour.d.ts +18 -0
- package/dist/actions/executors/tour.js +332 -0
- package/dist/actions/executors/tour.js.map +1 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/index.js +12 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/types.d.ts +399 -0
- package/dist/actions/types.js +8 -0
- package/dist/actions/types.js.map +1 -0
- package/dist/actions/validation.d.ts +14 -0
- package/dist/actions/validation.js +602 -0
- package/dist/actions/validation.js.map +1 -0
- package/dist/antiFlicker.js +1 -1
- package/dist/api.d.ts +40 -26
- package/dist/api.js +90 -59
- package/dist/api.js.map +1 -1
- package/dist/apps/AppContext.d.ts +31 -0
- package/dist/apps/AppContext.js +93 -0
- package/dist/apps/AppContext.js.map +1 -0
- package/dist/apps/AppLoader.d.ts +84 -0
- package/dist/apps/AppLoader.js +256 -0
- package/dist/apps/AppLoader.js.map +1 -0
- package/dist/apps/AppRegistry.d.ts +102 -0
- package/dist/apps/AppRegistry.js +317 -0
- package/dist/apps/AppRegistry.js.map +1 -0
- package/dist/apps/adaptive-chatbot/index.js +7 -0
- package/dist/apps/adaptive-chatbot/index.js.map +7 -0
- package/dist/apps/examples/gamification-app.example.d.ts +305 -0
- package/dist/apps/examples/gamification-app.example.js +329 -0
- package/dist/apps/examples/gamification-app.example.js.map +1 -0
- package/dist/apps/faq/index.js +11 -0
- package/dist/apps/faq/index.js.map +7 -0
- package/dist/apps/gamification/index.js +2 -0
- package/dist/apps/gamification/index.js.map +7 -0
- package/dist/apps/index.d.ts +15 -0
- package/dist/apps/index.js +17 -0
- package/dist/apps/index.js.map +1 -0
- package/dist/apps/nav/index.js +11 -0
- package/dist/apps/nav/index.js.map +7 -0
- package/dist/apps/types.d.ts +231 -0
- package/dist/apps/types.js +8 -0
- package/dist/apps/types.js.map +1 -0
- package/dist/blocks/data/ComparisonBlock.d.ts +1 -1
- package/dist/blocks/data/ComparisonBlock.js +40 -40
- package/dist/blocks/data/ComparisonBlock.js.map +1 -1
- package/dist/blocks/data/StatsBlock.d.ts +1 -1
- package/dist/blocks/data/StatsBlock.js +41 -41
- package/dist/blocks/data/StatsBlock.js.map +1 -1
- package/dist/blocks/data/index.d.ts +2 -2
- package/dist/blocks/data/index.js +2 -2
- package/dist/blocks/index.d.ts +5 -5
- package/dist/blocks/index.js +29 -29
- package/dist/blocks/index.js.map +1 -1
- package/dist/blocks/interactive/ChecklistBlock.d.ts +1 -1
- package/dist/blocks/interactive/ChecklistBlock.js +60 -60
- package/dist/blocks/interactive/ChecklistBlock.js.map +1 -1
- package/dist/blocks/interactive/RatingBlock.d.ts +1 -1
- package/dist/blocks/interactive/RatingBlock.js +75 -65
- package/dist/blocks/interactive/RatingBlock.js.map +1 -1
- package/dist/blocks/interactive/index.d.ts +2 -2
- package/dist/blocks/interactive/index.js +2 -2
- package/dist/blocks/notification/NotificationBlock.d.ts +2 -2
- package/dist/blocks/notification/NotificationBlock.js +67 -63
- package/dist/blocks/notification/NotificationBlock.js.map +1 -1
- package/dist/blocks/notification/index.d.ts +1 -1
- package/dist/blocks/notification/index.js +1 -1
- package/dist/bootstrap.d.ts +47 -9
- package/dist/bootstrap.js +237 -69
- package/dist/bootstrap.js.map +1 -1
- package/dist/components/ShadowCanvasOverlay.d.ts +6 -6
- package/dist/components/ShadowCanvasOverlay.js +144 -107
- package/dist/components/ShadowCanvasOverlay.js.map +1 -1
- package/dist/components/TileCard.d.ts +5 -5
- package/dist/components/TileCard.js +204 -154
- package/dist/components/TileCard.js.map +1 -1
- package/dist/components/TileWheel.d.ts +3 -3
- package/dist/components/TileWheel.js +7 -7
- package/dist/components/TileWheel.js.map +1 -1
- package/dist/config-validator.d.ts +49 -0
- package/dist/config-validator.js +173 -0
- package/dist/config-validator.js.map +1 -0
- package/dist/configFetcher.d.ts +2 -2
- package/dist/configFetcher.js +20 -8
- package/dist/configFetcher.js.map +1 -1
- package/dist/context/ContextManager.d.ts +66 -0
- package/dist/context/ContextManager.js +268 -0
- package/dist/context/ContextManager.js.map +1 -0
- package/dist/context/index.d.ts +7 -0
- package/dist/context/index.js +7 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/schema.d.ts +360 -0
- package/dist/context/schema.js +50 -0
- package/dist/context/schema.js.map +1 -0
- package/dist/context/types.d.ts +101 -0
- package/dist/context/types.js +8 -0
- package/dist/context/types.js.map +1 -0
- package/dist/decisions/engine.d.ts +43 -0
- package/dist/decisions/engine.js +112 -0
- package/dist/decisions/engine.js.map +1 -0
- package/dist/decisions/index.d.ts +9 -0
- package/dist/decisions/index.js +10 -0
- package/dist/decisions/index.js.map +1 -0
- package/dist/decisions/schema.d.ts +2166 -0
- package/dist/decisions/schema.js +143 -0
- package/dist/decisions/schema.js.map +1 -0
- package/dist/decisions/strategies/rules.d.ts +24 -0
- package/dist/decisions/strategies/rules.js +152 -0
- package/dist/decisions/strategies/rules.js.map +1 -0
- package/dist/decisions/strategies/score.d.ts +10 -0
- package/dist/decisions/strategies/score.js +29 -0
- package/dist/decisions/strategies/score.js.map +1 -0
- package/dist/decisions/types.d.ts +242 -0
- package/dist/decisions/types.js +2 -0
- package/dist/decisions/types.js.map +1 -0
- package/dist/earlyPatcher.d.ts +8 -20
- package/dist/earlyPatcher.js +13 -62
- package/dist/earlyPatcher.js.map +1 -1
- package/dist/editorLoader.d.ts +12 -0
- package/dist/editorLoader.js +132 -48
- package/dist/editorLoader.js.map +1 -1
- package/dist/events/EventBus.d.ts +59 -0
- package/dist/events/EventBus.js +152 -0
- package/dist/events/EventBus.js.map +1 -0
- package/dist/events/index.d.ts +9 -0
- package/dist/events/index.js +10 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/normalizers/canvas.d.ts +67 -0
- package/dist/events/normalizers/canvas.js +116 -0
- package/dist/events/normalizers/canvas.js.map +1 -0
- package/dist/events/normalizers/posthog.d.ts +53 -0
- package/dist/events/normalizers/posthog.js +163 -0
- package/dist/events/normalizers/posthog.js.map +1 -0
- package/dist/events/schema.d.ts +70 -0
- package/dist/events/schema.js +30 -0
- package/dist/events/schema.js.map +1 -0
- package/dist/events/types.d.ts +79 -0
- package/dist/events/types.js +49 -0
- package/dist/events/types.js.map +1 -0
- package/dist/experiments/adapters/growthbook.d.ts +4 -4
- package/dist/experiments/adapters/growthbook.js +5 -5
- package/dist/experiments/adapters/growthbook.js.map +1 -1
- package/dist/experiments/index.d.ts +3 -3
- package/dist/experiments/index.js +1 -1
- package/dist/experiments/registry.d.ts +2 -2
- package/dist/experiments/registry.js +2 -2
- package/dist/experiments/types.d.ts +5 -1
- package/dist/fetchers/cdnFetcher.d.ts +1 -1
- package/dist/fetchers/cdnFetcher.js +4 -8
- package/dist/fetchers/cdnFetcher.js.map +1 -1
- package/dist/fetchers/experimentsFetcher.d.ts +2 -2
- package/dist/fetchers/experimentsFetcher.js +7 -7
- package/dist/fetchers/experimentsFetcher.js.map +1 -1
- package/dist/fetchers/index.d.ts +3 -3
- package/dist/fetchers/index.js +2 -2
- package/dist/fetchers/index.js.map +1 -1
- package/dist/fetchers/registry.d.ts +1 -1
- package/dist/fetchers/registry.js +4 -4
- package/dist/fetchers/types.d.ts +1 -1
- package/dist/hooks/useCanvasOverlays.d.ts +8 -5
- package/dist/hooks/useCanvasOverlays.js +66 -17
- package/dist/hooks/useCanvasOverlays.js.map +1 -1
- package/dist/hooks/useHostPatches.d.ts +2 -2
- package/dist/hooks/useHostPatches.js +8 -8
- package/dist/hooks/useHostPatches.js.map +1 -1
- package/dist/hooks/useShadowCanvasConfig.d.ts +9 -9
- package/dist/hooks/useShadowCanvasConfig.js +24 -8
- package/dist/hooks/useShadowCanvasConfig.js.map +1 -1
- package/dist/hostPatcher/core/patcher.d.ts +1 -1
- package/dist/hostPatcher/core/patcher.js +18 -9
- package/dist/hostPatcher/core/patcher.js.map +1 -1
- package/dist/hostPatcher/core/sanitizer.js +24 -3
- package/dist/hostPatcher/core/sanitizer.js.map +1 -1
- package/dist/hostPatcher/policy/defaultPolicy.js +15 -5
- package/dist/hostPatcher/policy/defaultPolicy.js.map +1 -1
- package/dist/hostPatcher/utils/anchors.js +4 -6
- package/dist/hostPatcher/utils/anchors.js.map +1 -1
- package/dist/index.d.ts +34 -21
- package/dist/index.js +46 -19
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +29 -0
- package/dist/logger.js +81 -0
- package/dist/logger.js.map +1 -0
- package/dist/metrics/index.d.ts +1 -1
- package/dist/metrics/index.js +1 -1
- package/dist/metrics/sessionMetrics.d.ts +1 -1
- package/dist/metrics/sessionMetrics.js +6 -6
- package/dist/overlays/fetcher.d.ts +2 -2
- package/dist/overlays/fetcher.js +4 -4
- package/dist/overlays/recipeRegistry.js +2 -2
- package/dist/overlays/recipeRegistry.js.map +1 -1
- package/dist/overlays/runtime/anchor/resolve.js +1 -1
- package/dist/overlays/runtime/anchor/resolve.js.map +1 -1
- package/dist/overlays/runtime/index.d.ts +7 -7
- package/dist/overlays/runtime/index.js +7 -7
- package/dist/overlays/runtime/overlay/highlight.js +39 -39
- package/dist/overlays/runtime/overlay/highlight.js.map +1 -1
- package/dist/overlays/runtime/overlay/modal.js +5 -5
- package/dist/overlays/runtime/overlay/modal.js.map +1 -1
- package/dist/overlays/runtime/overlay/root.js +1 -1
- package/dist/overlays/runtime/overlay/runner.js +70 -23
- package/dist/overlays/runtime/overlay/runner.js.map +1 -1
- package/dist/overlays/runtime/overlay/tooltip.d.ts +1 -1
- package/dist/overlays/runtime/overlay/tooltip.js +10 -10
- package/dist/overlays/runtime/overlay/tooltip.js.map +1 -1
- package/dist/overlays/runtime/utils/dom.js +4 -1
- package/dist/overlays/runtime/utils/dom.js.map +1 -1
- package/dist/overlays/schema.d.ts +98 -98
- package/dist/overlays/schema.js +12 -8
- package/dist/overlays/schema.js.map +1 -1
- package/dist/react.d.ts +7 -7
- package/dist/react.js +4 -4
- package/dist/react.js.map +1 -1
- package/dist/render/RenderContext.d.ts +2 -2
- package/dist/render/RenderContext.js +5 -5
- package/dist/render/RenderContext.js.map +1 -1
- package/dist/render/index.d.ts +3 -3
- package/dist/render/index.js +1 -1
- package/dist/render/types.d.ts +4 -4
- package/dist/runtime.d.ts +110 -0
- package/dist/runtime.js +206 -0
- package/dist/runtime.js.map +1 -0
- package/dist/smart-canvas.esm.js +155 -78
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +44390 -37343
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +156 -78
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/state/StateStore.d.ts +41 -0
- package/dist/state/StateStore.js +170 -0
- package/dist/state/StateStore.js.map +1 -0
- package/dist/state/helpers/cooldowns.d.ts +7 -0
- package/dist/state/helpers/cooldowns.js +31 -0
- package/dist/state/helpers/cooldowns.js.map +1 -0
- package/dist/state/helpers/dismissals.d.ts +7 -0
- package/dist/state/helpers/dismissals.js +34 -0
- package/dist/state/helpers/dismissals.js.map +1 -0
- package/dist/state/helpers/frequency.d.ts +8 -0
- package/dist/state/helpers/frequency.js +43 -0
- package/dist/state/helpers/frequency.js.map +1 -0
- package/dist/state/index.d.ts +7 -0
- package/dist/state/index.js +7 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/schema.d.ts +49 -0
- package/dist/state/schema.js +25 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/state/types.d.ts +137 -0
- package/dist/state/types.js +9 -0
- package/dist/state/types.js.map +1 -0
- package/dist/store/example.d.ts +1 -0
- package/dist/store/example.js +43 -0
- package/dist/store/example.js.map +1 -0
- package/dist/store/mini-effector.d.ts +46 -0
- package/dist/store/mini-effector.js +88 -0
- package/dist/store/mini-effector.js.map +1 -0
- package/dist/surfaces/Surfaces.d.ts +11 -0
- package/dist/surfaces/Surfaces.js +361 -0
- package/dist/surfaces/Surfaces.js.map +1 -0
- package/dist/surfaces/index.d.ts +9 -0
- package/dist/surfaces/index.js +12 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/positioning.d.ts +50 -0
- package/dist/surfaces/positioning.js +228 -0
- package/dist/surfaces/positioning.js.map +1 -0
- package/dist/surfaces/types.d.ts +167 -0
- package/dist/surfaces/types.js +23 -0
- package/dist/surfaces/types.js.map +1 -0
- package/dist/telemetry/adapters/noop.d.ts +12 -0
- package/dist/telemetry/adapters/noop.js +42 -0
- package/dist/telemetry/adapters/noop.js.map +1 -0
- package/dist/telemetry/adapters/posthog.d.ts +9 -3
- package/dist/telemetry/adapters/posthog.js +36 -14
- package/dist/telemetry/adapters/posthog.js.map +1 -1
- package/dist/telemetry/index.d.ts +4 -3
- package/dist/telemetry/index.js +3 -2
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/registry.d.ts +2 -2
- package/dist/telemetry/registry.js +4 -2
- package/dist/telemetry/registry.js.map +1 -1
- package/dist/telemetry/types.d.ts +1 -1
- package/dist/theme/ThemeProvider.d.ts +2 -2
- package/dist/theme/ThemeProvider.js +21 -21
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/defaultTheme.d.ts +2 -2
- package/dist/theme/defaultTheme.js +111 -111
- package/dist/theme/defaultTheme.js.map +1 -1
- package/dist/theme/extractHostTheme.d.ts +1 -1
- package/dist/theme/extractHostTheme.js +42 -44
- package/dist/theme/extractHostTheme.js.map +1 -1
- package/dist/theme/index.d.ts +5 -5
- package/dist/theme/index.js +3 -3
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/types.d.ts +2 -2
- package/dist/token.d.ts +2 -0
- package/dist/token.js +3 -6
- package/dist/token.js.map +1 -1
- package/dist/types-only.d.ts +32 -0
- package/dist/types-only.js +11 -0
- package/dist/types-only.js.map +1 -0
- package/dist/types.d.ts +95 -54
- package/dist/types.js +15 -2
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +13 -0
- package/dist/version.js +14 -0
- package/dist/version.js.map +1 -0
- package/dist/widgets/WidgetRegistry.d.ts +139 -0
- package/dist/widgets/WidgetRegistry.js +182 -0
- package/dist/widgets/WidgetRegistry.js.map +1 -0
- package/dist/widgets/index.d.ts +7 -0
- package/dist/widgets/index.js +7 -0
- package/dist/widgets/index.js.map +1 -0
- package/package.json +27 -11
- package/schema/canvas-config.schema.json +666 -227
- package/schema/runtime-context.schema.json +127 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
export { SDK_VERSION } from './version';
|
|
2
|
+
/**
|
|
3
|
+
* SDK schema version in Major.Minor format (e.g., "2.0", "2.1").
|
|
4
|
+
* Used for compatibility checking between SDK and backend configs.
|
|
5
|
+
* Sent in X-SDK-Schema-Version header.
|
|
6
|
+
*
|
|
7
|
+
* Bump rules:
|
|
8
|
+
* - Major: Breaking changes (field removal, type changes)
|
|
9
|
+
* - Minor: Backwards-compatible additions (new optional fields)
|
|
10
|
+
*
|
|
11
|
+
* @since 2.0.0
|
|
12
|
+
*/
|
|
13
|
+
export declare const SDK_SCHEMA_VERSION = "2.0";
|
|
14
|
+
export type { ActionStep } from './actions/types';
|
|
1
15
|
/**
|
|
2
16
|
* Props passed to every tile component when mounted
|
|
3
17
|
*/
|
|
4
18
|
export interface TileComponentProps {
|
|
5
19
|
config: TileConfig;
|
|
6
20
|
isExpanded: boolean;
|
|
7
|
-
surface:
|
|
8
|
-
telemetry?: import(
|
|
21
|
+
surface: 'overlay' | 'wheel';
|
|
22
|
+
telemetry?: import('./telemetry/types').TelemetryClient;
|
|
9
23
|
}
|
|
10
24
|
/**
|
|
11
25
|
* Interface for registering custom tile components
|
|
@@ -16,15 +30,15 @@ export interface TileComponent {
|
|
|
16
30
|
/**
|
|
17
31
|
* All available block types organized by category
|
|
18
32
|
*/
|
|
19
|
-
export type NotificationBlockType =
|
|
20
|
-
export type MediaBlockType =
|
|
21
|
-
export type InteractiveBlockType =
|
|
22
|
-
export type DataBlockType =
|
|
23
|
-
export type LegacyBlockType =
|
|
33
|
+
export type NotificationBlockType = 'alert' | 'success' | 'warning' | 'info' | 'error';
|
|
34
|
+
export type MediaBlockType = 'video' | 'gallery' | 'code';
|
|
35
|
+
export type InteractiveBlockType = 'form' | 'rating' | 'progress' | 'survey' | 'checklist';
|
|
36
|
+
export type DataBlockType = 'stats' | 'comparison' | 'chart' | 'table';
|
|
37
|
+
export type LegacyBlockType = 'text' | 'metric' | 'chatbot' | 'embed';
|
|
24
38
|
/**
|
|
25
39
|
* Union of all block types
|
|
26
40
|
*/
|
|
27
|
-
export type BlockType = NotificationBlockType | MediaBlockType | InteractiveBlockType | DataBlockType | LegacyBlockType |
|
|
41
|
+
export type BlockType = NotificationBlockType | MediaBlockType | InteractiveBlockType | DataBlockType | LegacyBlockType | 'custom';
|
|
28
42
|
export interface NotificationContentBase {
|
|
29
43
|
title: string;
|
|
30
44
|
body?: string;
|
|
@@ -33,49 +47,49 @@ export interface NotificationContentBase {
|
|
|
33
47
|
timestamp?: string;
|
|
34
48
|
}
|
|
35
49
|
export interface AlertContent extends NotificationContentBase {
|
|
36
|
-
type:
|
|
37
|
-
severity?:
|
|
50
|
+
type: 'alert';
|
|
51
|
+
severity?: 'low' | 'medium' | 'high' | 'critical';
|
|
38
52
|
}
|
|
39
53
|
export interface SuccessContent extends NotificationContentBase {
|
|
40
|
-
type:
|
|
54
|
+
type: 'success';
|
|
41
55
|
confetti?: boolean;
|
|
42
56
|
}
|
|
43
57
|
export interface WarningContent extends NotificationContentBase {
|
|
44
|
-
type:
|
|
58
|
+
type: 'warning';
|
|
45
59
|
countdown?: number;
|
|
46
60
|
}
|
|
47
61
|
export interface InfoContent extends NotificationContentBase {
|
|
48
|
-
type:
|
|
62
|
+
type: 'info';
|
|
49
63
|
learnMoreUrl?: string;
|
|
50
64
|
}
|
|
51
65
|
export interface ErrorContent extends NotificationContentBase {
|
|
52
|
-
type:
|
|
66
|
+
type: 'error';
|
|
53
67
|
errorCode?: string;
|
|
54
68
|
retryable?: boolean;
|
|
55
69
|
}
|
|
56
70
|
export type NotificationContent = AlertContent | SuccessContent | WarningContent | InfoContent | ErrorContent;
|
|
57
71
|
export interface VideoContent {
|
|
58
|
-
type:
|
|
72
|
+
type: 'video';
|
|
59
73
|
src: string;
|
|
60
|
-
provider?:
|
|
74
|
+
provider?: 'youtube' | 'vimeo' | 'custom';
|
|
61
75
|
poster?: string;
|
|
62
76
|
autoplay?: boolean;
|
|
63
77
|
muted?: boolean;
|
|
64
78
|
loop?: boolean;
|
|
65
|
-
aspectRatio?:
|
|
79
|
+
aspectRatio?: '16:9' | '4:3' | '1:1' | '9:16';
|
|
66
80
|
}
|
|
67
81
|
export interface GalleryContent {
|
|
68
|
-
type:
|
|
82
|
+
type: 'gallery';
|
|
69
83
|
images: Array<{
|
|
70
84
|
src: string;
|
|
71
85
|
alt?: string;
|
|
72
86
|
caption?: string;
|
|
73
87
|
}>;
|
|
74
|
-
layout?:
|
|
88
|
+
layout?: 'carousel' | 'grid' | 'masonry';
|
|
75
89
|
columns?: 2 | 3 | 4;
|
|
76
90
|
}
|
|
77
91
|
export interface CodeContent {
|
|
78
|
-
type:
|
|
92
|
+
type: 'code';
|
|
79
93
|
code: string;
|
|
80
94
|
language?: string;
|
|
81
95
|
lineNumbers?: boolean;
|
|
@@ -86,7 +100,7 @@ export interface CodeContent {
|
|
|
86
100
|
export type MediaContent = VideoContent | GalleryContent | CodeContent;
|
|
87
101
|
export interface FormField {
|
|
88
102
|
id: string;
|
|
89
|
-
type:
|
|
103
|
+
type: 'text' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea';
|
|
90
104
|
label: string;
|
|
91
105
|
placeholder?: string;
|
|
92
106
|
required?: boolean;
|
|
@@ -97,21 +111,21 @@ export interface FormField {
|
|
|
97
111
|
defaultValue?: string | boolean;
|
|
98
112
|
}
|
|
99
113
|
export interface FormContent {
|
|
100
|
-
type:
|
|
114
|
+
type: 'form';
|
|
101
115
|
fields: FormField[];
|
|
102
116
|
submitLabel?: string;
|
|
103
117
|
submitActionId?: string;
|
|
104
118
|
}
|
|
105
119
|
export interface RatingContent {
|
|
106
|
-
type:
|
|
107
|
-
variant:
|
|
120
|
+
type: 'rating';
|
|
121
|
+
variant: 'stars' | 'thumbs' | 'nps' | 'emoji';
|
|
108
122
|
question?: string;
|
|
109
123
|
maxValue?: number;
|
|
110
124
|
submitActionId?: string;
|
|
111
125
|
}
|
|
112
126
|
export interface ProgressContent {
|
|
113
|
-
type:
|
|
114
|
-
variant:
|
|
127
|
+
type: 'progress';
|
|
128
|
+
variant: 'bar' | 'steps' | 'circular';
|
|
115
129
|
value: number;
|
|
116
130
|
max?: number;
|
|
117
131
|
steps?: Array<{
|
|
@@ -126,7 +140,7 @@ export interface SurveyChoice {
|
|
|
126
140
|
icon?: string;
|
|
127
141
|
}
|
|
128
142
|
export interface SurveyContent {
|
|
129
|
-
type:
|
|
143
|
+
type: 'survey';
|
|
130
144
|
question: string;
|
|
131
145
|
choices: SurveyChoice[];
|
|
132
146
|
multiSelect?: boolean;
|
|
@@ -143,19 +157,19 @@ export interface ChecklistItem {
|
|
|
143
157
|
completed?: boolean;
|
|
144
158
|
}
|
|
145
159
|
export interface ChecklistContent {
|
|
146
|
-
type:
|
|
160
|
+
type: 'checklist';
|
|
147
161
|
items: ChecklistItem[];
|
|
148
162
|
title?: string;
|
|
149
163
|
showProgress?: boolean;
|
|
150
164
|
}
|
|
151
165
|
export type InteractiveContent = FormContent | RatingContent | ProgressContent | SurveyContent | ChecklistContent;
|
|
152
166
|
export interface TrendIndicator {
|
|
153
|
-
direction:
|
|
167
|
+
direction: 'up' | 'down' | 'neutral';
|
|
154
168
|
value: string;
|
|
155
169
|
timeframe?: string;
|
|
156
170
|
}
|
|
157
171
|
export interface StatsContent {
|
|
158
|
-
type:
|
|
172
|
+
type: 'stats';
|
|
159
173
|
value: string;
|
|
160
174
|
label: string;
|
|
161
175
|
trend?: TrendIndicator;
|
|
@@ -170,15 +184,15 @@ export interface ComparisonItem {
|
|
|
170
184
|
icon?: string;
|
|
171
185
|
}
|
|
172
186
|
export interface ComparisonContent {
|
|
173
|
-
type:
|
|
187
|
+
type: 'comparison';
|
|
174
188
|
items: ComparisonItem[];
|
|
175
|
-
layout?:
|
|
189
|
+
layout?: 'grid' | 'list' | 'table';
|
|
176
190
|
columns?: 2 | 3 | 4;
|
|
177
191
|
highlightBest?: boolean;
|
|
178
192
|
}
|
|
179
193
|
export interface ChartContent {
|
|
180
|
-
type:
|
|
181
|
-
chartType:
|
|
194
|
+
type: 'chart';
|
|
195
|
+
chartType: 'bar' | 'line' | 'pie' | 'donut';
|
|
182
196
|
data: Array<{
|
|
183
197
|
label: string;
|
|
184
198
|
value: number;
|
|
@@ -195,7 +209,7 @@ export interface TableColumn {
|
|
|
195
209
|
width?: string;
|
|
196
210
|
}
|
|
197
211
|
export interface TableContent {
|
|
198
|
-
type:
|
|
212
|
+
type: 'table';
|
|
199
213
|
columns: TableColumn[];
|
|
200
214
|
rows: Array<Record<string, string | number>>;
|
|
201
215
|
sortable?: boolean;
|
|
@@ -206,12 +220,12 @@ export type DataContent = StatsContent | ComparisonContent | ChartContent | Tabl
|
|
|
206
220
|
/**
|
|
207
221
|
* Grid width: "full" = spans both columns, "half" = one column
|
|
208
222
|
*/
|
|
209
|
-
export type TileSize =
|
|
223
|
+
export type TileSize = 'full' | 'half';
|
|
210
224
|
/**
|
|
211
225
|
* Built-in tile types (convenience components we ship)
|
|
212
226
|
* @deprecated Use BlockType instead
|
|
213
227
|
*/
|
|
214
|
-
export type BuiltInTileType =
|
|
228
|
+
export type BuiltInTileType = 'text' | 'metric' | 'chatbot' | 'embed';
|
|
215
229
|
/**
|
|
216
230
|
* Content configuration for built-in tile types
|
|
217
231
|
* @deprecated Use specific content types (NotificationContent, MediaContent, etc.)
|
|
@@ -229,7 +243,7 @@ export interface BuiltInTileContent {
|
|
|
229
243
|
* Content configuration for custom tile components
|
|
230
244
|
*/
|
|
231
245
|
export interface CustomTileContent {
|
|
232
|
-
type:
|
|
246
|
+
type: 'custom';
|
|
233
247
|
component: string;
|
|
234
248
|
props?: Record<string, unknown>;
|
|
235
249
|
actions?: TileAction[];
|
|
@@ -249,7 +263,7 @@ export interface TileAction {
|
|
|
249
263
|
label: string;
|
|
250
264
|
href?: string;
|
|
251
265
|
onClickId?: string;
|
|
252
|
-
style?:
|
|
266
|
+
style?: 'primary' | 'secondary';
|
|
253
267
|
}
|
|
254
268
|
/**
|
|
255
269
|
* Visual styling for tile chrome
|
|
@@ -261,6 +275,7 @@ export interface TileStyle {
|
|
|
261
275
|
}
|
|
262
276
|
/**
|
|
263
277
|
* Experiment targeting for A/B tests
|
|
278
|
+
* @deprecated Use ActivationConfig with DecisionStrategy instead
|
|
264
279
|
*/
|
|
265
280
|
export interface TileExperiment {
|
|
266
281
|
featureKey?: string;
|
|
@@ -268,6 +283,7 @@ export interface TileExperiment {
|
|
|
268
283
|
variationValue?: string | number | boolean;
|
|
269
284
|
predicate?: (value: unknown) => boolean;
|
|
270
285
|
}
|
|
286
|
+
export type { ActivationConfig, RouteFilter, DecisionStrategy } from './decisions/types';
|
|
271
287
|
/**
|
|
272
288
|
* Full tile configuration
|
|
273
289
|
*/
|
|
@@ -283,13 +299,18 @@ export interface TileConfig {
|
|
|
283
299
|
defaultExpanded?: boolean;
|
|
284
300
|
content: TileContent;
|
|
285
301
|
style?: TileStyle;
|
|
302
|
+
/** @deprecated Use activation.strategy instead */
|
|
286
303
|
experiment?: TileExperiment;
|
|
287
304
|
analyticsKey?: string;
|
|
305
|
+
/**
|
|
306
|
+
* Activation configuration for conditional rendering.
|
|
307
|
+
* Replaces the experiment field with more flexible context-aware decisions.
|
|
308
|
+
*/
|
|
309
|
+
activation?: import('./decisions/types').ActivationConfig;
|
|
288
310
|
}
|
|
289
|
-
import type {
|
|
311
|
+
import type { ActionStep } from './actions/types';
|
|
290
312
|
/**
|
|
291
313
|
* Theme configuration for the SmartCanvas overlay.
|
|
292
|
-
* These values are typically set from workspace settings after style selection.
|
|
293
314
|
*/
|
|
294
315
|
export interface CanvasThemeConfig {
|
|
295
316
|
name?: string;
|
|
@@ -302,35 +323,55 @@ export interface CanvasThemeConfig {
|
|
|
302
323
|
borderRadius?: string;
|
|
303
324
|
position?: 'left' | 'right';
|
|
304
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Launcher button configuration.
|
|
328
|
+
*/
|
|
305
329
|
export interface LauncherConfig {
|
|
306
|
-
/** Label shown on the launcher button (default: "Adaptives") */
|
|
307
330
|
label?: string;
|
|
308
|
-
/** Whether to animate the launcher to draw attention */
|
|
309
331
|
animate?: boolean;
|
|
310
|
-
|
|
311
|
-
animationStyle?: "pulse" | "bounce" | "glow";
|
|
332
|
+
animationStyle?: 'pulse' | 'bounce' | 'glow';
|
|
312
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Route filtering - control where canvas appears.
|
|
336
|
+
*/
|
|
313
337
|
export interface RoutesConfig {
|
|
314
|
-
/** Routes where the canvas should NOT appear (e.g., ["/login", "/signup"]) */
|
|
315
338
|
exclude?: string[];
|
|
316
|
-
/** If specified, canvas ONLY appears on these routes */
|
|
317
339
|
include?: string[];
|
|
318
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Canvas configuration response.
|
|
343
|
+
*
|
|
344
|
+
* This is the complete config format. Actions are the single mechanism
|
|
345
|
+
* for all interventions: DOM modifications, tooltips, highlights, modals.
|
|
346
|
+
*/
|
|
319
347
|
export interface CanvasConfigResponse {
|
|
348
|
+
/**
|
|
349
|
+
* Schema version this config conforms to (e.g., "2.0", "2.1").
|
|
350
|
+
* Used for compatibility checking and automatic migration between versions.
|
|
351
|
+
* If omitted, defaults to "1.0" for backwards compatibility.
|
|
352
|
+
*
|
|
353
|
+
* @since 2.0.0
|
|
354
|
+
*/
|
|
355
|
+
schemaVersion?: string;
|
|
356
|
+
/** Tiles to display in the canvas drawer */
|
|
320
357
|
tiles: TileConfig[];
|
|
358
|
+
/**
|
|
359
|
+
* Actions to execute.
|
|
360
|
+
* This is the unified intervention format. Every DOM change, tooltip,
|
|
361
|
+
* highlight, or modal is an ActionStep.
|
|
362
|
+
*/
|
|
363
|
+
actions: ActionStep[];
|
|
364
|
+
/** When the config was fetched */
|
|
321
365
|
fetchedAt: string;
|
|
366
|
+
/** Optional version string for cache invalidation */
|
|
322
367
|
configVersion?: string;
|
|
368
|
+
/** Display title for the canvas */
|
|
323
369
|
canvasTitle?: string;
|
|
324
|
-
|
|
325
|
-
/** @deprecated Use overlayRecipes instead */
|
|
326
|
-
overlayRecipe?: import('./overlays/types').CanvasRecipe;
|
|
327
|
-
/** Multiple overlay recipes (tours) */
|
|
328
|
-
overlayRecipes?: import('./overlays/types').CanvasRecipe[];
|
|
329
|
-
/** SmartCanvas theme configuration from workspace settings */
|
|
370
|
+
/** Theme configuration */
|
|
330
371
|
theme?: CanvasThemeConfig;
|
|
331
372
|
/** Launcher button configuration */
|
|
332
373
|
launcher?: LauncherConfig;
|
|
333
|
-
/** Route filtering
|
|
374
|
+
/** Route filtering */
|
|
334
375
|
routes?: RoutesConfig;
|
|
335
376
|
}
|
|
336
377
|
export type CanvasConfigFetcher = () => Promise<CanvasConfigResponse>;
|
package/dist/types.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
//
|
|
2
|
+
// SDK VERSION CONSTANTS
|
|
3
3
|
// =============================================================================
|
|
4
|
-
export
|
|
4
|
+
// Re-export SDK_VERSION from the auto-generated version file
|
|
5
|
+
export { SDK_VERSION } from './version';
|
|
6
|
+
/**
|
|
7
|
+
* SDK schema version in Major.Minor format (e.g., "2.0", "2.1").
|
|
8
|
+
* Used for compatibility checking between SDK and backend configs.
|
|
9
|
+
* Sent in X-SDK-Schema-Version header.
|
|
10
|
+
*
|
|
11
|
+
* Bump rules:
|
|
12
|
+
* - Major: Breaking changes (field removal, type changes)
|
|
13
|
+
* - Minor: Backwards-compatible additions (new optional fields)
|
|
14
|
+
*
|
|
15
|
+
* @since 2.0.0
|
|
16
|
+
*/
|
|
17
|
+
export const SDK_SCHEMA_VERSION = '2.0';
|
|
5
18
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAEhF,6DAA6D;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK package version.
|
|
3
|
+
*
|
|
4
|
+
* This file is auto-generated at release time by `scripts/prepare-release.mjs`.
|
|
5
|
+
* The sentinel value below is overwritten with the real semver version
|
|
6
|
+
* during the semantic-release prepare phase.
|
|
7
|
+
*
|
|
8
|
+
* DO NOT import version from package.json — this constant is the single
|
|
9
|
+
* source of truth for the runtime bundle.
|
|
10
|
+
*
|
|
11
|
+
* @since 2.0.0
|
|
12
|
+
*/
|
|
13
|
+
export declare const SDK_VERSION = "1.0.0-canary.1";
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK package version.
|
|
3
|
+
*
|
|
4
|
+
* This file is auto-generated at release time by `scripts/prepare-release.mjs`.
|
|
5
|
+
* The sentinel value below is overwritten with the real semver version
|
|
6
|
+
* during the semantic-release prepare phase.
|
|
7
|
+
*
|
|
8
|
+
* DO NOT import version from package.json — this constant is the single
|
|
9
|
+
* source of truth for the runtime bundle.
|
|
10
|
+
*
|
|
11
|
+
* @since 2.0.0
|
|
12
|
+
*/
|
|
13
|
+
export const SDK_VERSION = '1.0.0-canary.1';
|
|
14
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget Registry
|
|
3
|
+
*
|
|
4
|
+
* Extensible registry for mountable widget components.
|
|
5
|
+
* Apps can register custom widgets that can be rendered via mountWidget actions.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Cleanup function returned when unmounting a widget.
|
|
9
|
+
*/
|
|
10
|
+
export type WidgetCleanup = () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Mountable widget component interface.
|
|
13
|
+
*
|
|
14
|
+
* Widgets must implement this interface to be registered and mounted
|
|
15
|
+
* via the Surfaces system or mountWidget actions.
|
|
16
|
+
*/
|
|
17
|
+
export interface MountableWidget {
|
|
18
|
+
/**
|
|
19
|
+
* Mount the widget into a container element.
|
|
20
|
+
*
|
|
21
|
+
* @param container - The DOM element to mount into
|
|
22
|
+
* @param config - Configuration/props for the widget
|
|
23
|
+
* @returns A cleanup function to unmount the widget, or void
|
|
24
|
+
*/
|
|
25
|
+
mount(container: HTMLElement, config?: Record<string, unknown>): WidgetCleanup | void;
|
|
26
|
+
/**
|
|
27
|
+
* Optional: Update the widget with new config.
|
|
28
|
+
* If not provided, the widget will be unmounted and remounted on updates.
|
|
29
|
+
*
|
|
30
|
+
* @param container - The DOM element containing the widget
|
|
31
|
+
* @param config - New configuration/props
|
|
32
|
+
*/
|
|
33
|
+
update?(container: HTMLElement, config?: Record<string, unknown>): void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Widget registration entry.
|
|
37
|
+
*/
|
|
38
|
+
export interface WidgetRegistration {
|
|
39
|
+
/** Widget ID (e.g., "gamification:leaderboard") */
|
|
40
|
+
id: string;
|
|
41
|
+
/** The widget component */
|
|
42
|
+
widget: MountableWidget;
|
|
43
|
+
/** Source app ID or "built-in" */
|
|
44
|
+
source: 'built-in' | string;
|
|
45
|
+
/** Optional metadata */
|
|
46
|
+
metadata?: {
|
|
47
|
+
name?: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
icon?: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Mounted widget handle.
|
|
54
|
+
*/
|
|
55
|
+
export interface MountedWidgetHandle {
|
|
56
|
+
/** The widget ID */
|
|
57
|
+
widgetId: string;
|
|
58
|
+
/** The container element */
|
|
59
|
+
container: HTMLElement;
|
|
60
|
+
/** Unmount the widget */
|
|
61
|
+
unmount: () => void;
|
|
62
|
+
/** Update the widget config */
|
|
63
|
+
update: (config?: Record<string, unknown>) => void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Extensible registry for widget components.
|
|
67
|
+
*
|
|
68
|
+
* Allows apps to register custom widgets that can be rendered via
|
|
69
|
+
* mountWidget actions or directly through the Surfaces system.
|
|
70
|
+
*/
|
|
71
|
+
export declare class WidgetRegistry {
|
|
72
|
+
private widgets;
|
|
73
|
+
private mountedWidgets;
|
|
74
|
+
private mountIdCounter;
|
|
75
|
+
constructor();
|
|
76
|
+
/**
|
|
77
|
+
* Register a widget.
|
|
78
|
+
*
|
|
79
|
+
* @param id - The widget ID (e.g., "gamification:leaderboard")
|
|
80
|
+
* @param widget - The widget component
|
|
81
|
+
* @param source - The source app ID (for tracking)
|
|
82
|
+
* @param metadata - Optional metadata about the widget
|
|
83
|
+
*/
|
|
84
|
+
register(id: string, widget: MountableWidget, source?: string, metadata?: WidgetRegistration['metadata']): void;
|
|
85
|
+
/**
|
|
86
|
+
* Unregister a widget.
|
|
87
|
+
*
|
|
88
|
+
* @param id - The widget ID to unregister
|
|
89
|
+
* @returns true if the widget was unregistered, false if not found or built-in
|
|
90
|
+
*/
|
|
91
|
+
unregister(id: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Unregister all widgets from a specific source.
|
|
94
|
+
*
|
|
95
|
+
* @param source - The source app ID
|
|
96
|
+
*/
|
|
97
|
+
unregisterBySource(source: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* Get a widget by ID.
|
|
100
|
+
*/
|
|
101
|
+
get(id: string): MountableWidget | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Get the full registration for a widget.
|
|
104
|
+
*/
|
|
105
|
+
getRegistration(id: string): WidgetRegistration | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Check if a widget exists.
|
|
108
|
+
*/
|
|
109
|
+
has(id: string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Mount a widget into a container.
|
|
112
|
+
*
|
|
113
|
+
* @param id - The widget ID
|
|
114
|
+
* @param container - The DOM element to mount into
|
|
115
|
+
* @param config - Configuration/props for the widget
|
|
116
|
+
* @returns A handle for managing the mounted widget
|
|
117
|
+
*/
|
|
118
|
+
mount(id: string, container: HTMLElement, config?: Record<string, unknown>): MountedWidgetHandle;
|
|
119
|
+
/**
|
|
120
|
+
* List all registered widget IDs.
|
|
121
|
+
*/
|
|
122
|
+
list(): string[];
|
|
123
|
+
/**
|
|
124
|
+
* List all registrations.
|
|
125
|
+
*/
|
|
126
|
+
listRegistrations(): WidgetRegistration[];
|
|
127
|
+
/**
|
|
128
|
+
* Get all widgets from a specific source.
|
|
129
|
+
*/
|
|
130
|
+
getBySource(source: string): WidgetRegistration[];
|
|
131
|
+
/**
|
|
132
|
+
* Clean up all mounted widgets.
|
|
133
|
+
*/
|
|
134
|
+
destroy(): void;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Default singleton instance of WidgetRegistry.
|
|
138
|
+
*/
|
|
139
|
+
export declare const widgetRegistry: WidgetRegistry;
|