@syntrologie/runtime-sdk 2.10.0 → 2.12.0
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 +176 -117
- package/README.md +2 -0
- package/dist/actions/schema.d.ts +7 -7
- package/dist/actions/schema.js +1 -1
- package/dist/actions/types.d.ts +1 -1
- package/dist/actions/validation-core.d.ts +24 -0
- package/dist/actions/validation-rules.d.ts +74 -0
- package/dist/actions/validation.d.ts +5 -11
- package/dist/bootstrap-init.d.ts +33 -0
- package/dist/bootstrap-runtime.d.ts +7 -0
- package/dist/bootstrap-types.d.ts +90 -0
- package/dist/bootstrap.d.ts +17 -83
- package/dist/{chunk-OIDBMIRB.js → chunk-J2LGX2PV.js} +1282 -488
- package/dist/chunk-J2LGX2PV.js.map +7 -0
- package/dist/{chunk-R5DNAIRI.js → chunk-L6RJMBR2.js} +2 -2
- package/dist/{chunk-R5DNAIRI.js.map → chunk-L6RJMBR2.js.map} +2 -2
- package/dist/events/EventBus.d.ts +27 -1
- package/dist/events/history.d.ts +9 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/normalizers/posthog.d.ts +4 -50
- package/dist/events/types.d.ts +30 -23
- package/dist/events/validation.d.ts +7 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1125 -2027
- package/dist/index.js.map +4 -4
- package/dist/overlays/runtime/overlay/overlay-runner.d.ts +4 -0
- package/dist/overlays/runtime/overlay/overlay-state.d.ts +21 -0
- package/dist/overlays/types.d.ts +3 -1
- package/dist/react.js +4 -2
- package/dist/react.js.map +2 -2
- package/dist/smart-canvas.esm.js +92 -108
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +5225 -5012
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +92 -108
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/telemetry/adapters/posthog.d.ts +30 -4
- package/dist/test/setup.d.ts +1 -0
- package/dist/token.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/package.json +23 -28
- package/schema/canvas-config.schema.json +1 -1
- package/scripts/syntroReactPlugin.mjs +3 -0
- package/scripts/validate-config.mjs +42 -0
- package/dist/chunk-OIDBMIRB.js.map +0 -7
package/dist/actions/schema.d.ts
CHANGED
|
@@ -11831,7 +11831,7 @@ declare const ParallelZ: z.ZodObject<{
|
|
|
11831
11831
|
* `steps` contains TourStepForSchemaZ which uses z.any() for step.action.
|
|
11832
11832
|
*/
|
|
11833
11833
|
declare const TourZ: z.ZodObject<{
|
|
11834
|
-
kind: z.ZodLiteral<"
|
|
11834
|
+
kind: z.ZodLiteral<"overlays:tour">;
|
|
11835
11835
|
tourId: z.ZodString;
|
|
11836
11836
|
steps: z.ZodArray<z.ZodObject<{
|
|
11837
11837
|
id: z.ZodString;
|
|
@@ -12339,7 +12339,7 @@ declare const TourZ: z.ZodObject<{
|
|
|
12339
12339
|
timeoutMs?: number | undefined;
|
|
12340
12340
|
}>]>>>;
|
|
12341
12341
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
12342
|
-
kind: z.ZodLiteral<"
|
|
12342
|
+
kind: z.ZodLiteral<"overlays:tour">;
|
|
12343
12343
|
tourId: z.ZodString;
|
|
12344
12344
|
steps: z.ZodArray<z.ZodObject<{
|
|
12345
12345
|
id: z.ZodString;
|
|
@@ -12847,7 +12847,7 @@ declare const TourZ: z.ZodObject<{
|
|
|
12847
12847
|
timeoutMs?: number | undefined;
|
|
12848
12848
|
}>]>>>;
|
|
12849
12849
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
12850
|
-
kind: z.ZodLiteral<"
|
|
12850
|
+
kind: z.ZodLiteral<"overlays:tour">;
|
|
12851
12851
|
tourId: z.ZodString;
|
|
12852
12852
|
steps: z.ZodArray<z.ZodObject<{
|
|
12853
12853
|
id: z.ZodString;
|
|
@@ -25067,7 +25067,7 @@ export declare const coreActionStepSchemas: ({
|
|
|
25067
25067
|
} | {
|
|
25068
25068
|
defName: string;
|
|
25069
25069
|
schema: z.ZodObject<{
|
|
25070
|
-
kind: z.ZodLiteral<"
|
|
25070
|
+
kind: z.ZodLiteral<"overlays:tour">;
|
|
25071
25071
|
tourId: z.ZodString;
|
|
25072
25072
|
steps: z.ZodArray<z.ZodObject<{
|
|
25073
25073
|
id: z.ZodString;
|
|
@@ -25575,7 +25575,7 @@ export declare const coreActionStepSchemas: ({
|
|
|
25575
25575
|
timeoutMs?: number | undefined;
|
|
25576
25576
|
}>]>>>;
|
|
25577
25577
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
25578
|
-
kind: z.ZodLiteral<"
|
|
25578
|
+
kind: z.ZodLiteral<"overlays:tour">;
|
|
25579
25579
|
tourId: z.ZodString;
|
|
25580
25580
|
steps: z.ZodArray<z.ZodObject<{
|
|
25581
25581
|
id: z.ZodString;
|
|
@@ -26083,7 +26083,7 @@ export declare const coreActionStepSchemas: ({
|
|
|
26083
26083
|
timeoutMs?: number | undefined;
|
|
26084
26084
|
}>]>>>;
|
|
26085
26085
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
26086
|
-
kind: z.ZodLiteral<"
|
|
26086
|
+
kind: z.ZodLiteral<"overlays:tour">;
|
|
26087
26087
|
tourId: z.ZodString;
|
|
26088
26088
|
steps: z.ZodArray<z.ZodObject<{
|
|
26089
26089
|
id: z.ZodString;
|
|
@@ -26592,4 +26592,4 @@ export declare const coreActionStepSchemas: ({
|
|
|
26592
26592
|
}>]>>>;
|
|
26593
26593
|
}, z.ZodTypeAny, "passthrough">>;
|
|
26594
26594
|
})[];
|
|
26595
|
-
export {
|
|
26595
|
+
export { AddClassZ, AnchorIdZ, BadgePositionZ, BadgeZ, CtaButtonZ, HighlightStyleZ, HighlightZ, InsertHtmlZ, InsertPositionZ, ModalContentZ, ModalZ, MountWidgetZ, NavigateZ, ParallelZ, PlacementZ, PulseZ, RemoveClassZ, ScrollBehaviorZ, ScrollLogicalPositionZ, ScrollToZ, SequenceZ, SetAttrZ, SetStyleZ, SetTextZ, TooltipContentZ, TooltipTriggerZ, TooltipZ, TourStepForSchemaZ, TourZ, WaitZ, WidgetConfigZ, };
|
package/dist/actions/schema.js
CHANGED
package/dist/actions/types.d.ts
CHANGED
|
@@ -181,7 +181,7 @@ export interface TourStep {
|
|
|
181
181
|
}
|
|
182
182
|
/** Orchestrate sequential steps with cross-page state */
|
|
183
183
|
export interface TourAction extends BaseAction {
|
|
184
|
-
kind: '
|
|
184
|
+
kind: 'overlays:tour';
|
|
185
185
|
tourId: string;
|
|
186
186
|
steps: TourStep[];
|
|
187
187
|
startStep?: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Validation — Core
|
|
3
|
+
*
|
|
4
|
+
* Main validate dispatch function, anchor validation, dangerous attrs constants,
|
|
5
|
+
* and common validation helpers.
|
|
6
|
+
*/
|
|
7
|
+
import type { ActionStep, AnchorId, ValidationError, ValidationResult, ValidationWarning } from './types';
|
|
8
|
+
/** Dangerous attribute names that should not be set */
|
|
9
|
+
export declare const DANGEROUS_ATTRS: Set<string>;
|
|
10
|
+
/** Maximum HTML content length */
|
|
11
|
+
export declare const MAX_HTML_LENGTH = 50000;
|
|
12
|
+
/** Maximum style count */
|
|
13
|
+
export declare const MAX_STYLE_COUNT = 50;
|
|
14
|
+
/**
|
|
15
|
+
* Validate an action step.
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateAction(action: ActionStep): ValidationResult;
|
|
18
|
+
export declare function validateAnchorAction(action: {
|
|
19
|
+
anchorId: AnchorId;
|
|
20
|
+
}, errors: ValidationError[], warnings: ValidationWarning[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Validate a batch of actions.
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateActions(actions: ActionStep[]): ValidationResult;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Validation — Rules
|
|
3
|
+
*
|
|
4
|
+
* Specific validators by action kind: badge, tooltip, modal, content
|
|
5
|
+
* (text/attrs/classes/styles/HTML), tour, sequence, parallel, wait,
|
|
6
|
+
* navigate, mountWidget, and warning detection.
|
|
7
|
+
*/
|
|
8
|
+
import type { ActionStep, ValidationError, ValidationWarning } from './types';
|
|
9
|
+
export declare function validateBadgeAction(action: {
|
|
10
|
+
content: string;
|
|
11
|
+
}, errors: ValidationError[], warnings: ValidationWarning[]): void;
|
|
12
|
+
export declare function validateTooltipAction(action: {
|
|
13
|
+
content: {
|
|
14
|
+
title?: string;
|
|
15
|
+
body: string;
|
|
16
|
+
};
|
|
17
|
+
}, errors: ValidationError[], _warnings: ValidationWarning[]): void;
|
|
18
|
+
export declare function validateInsertHtmlAction(action: {
|
|
19
|
+
html: string;
|
|
20
|
+
position: string;
|
|
21
|
+
}, errors: ValidationError[], _warnings: ValidationWarning[]): void;
|
|
22
|
+
export declare function validateSetTextAction(action: {
|
|
23
|
+
text: string;
|
|
24
|
+
}, errors: ValidationError[], _warnings: ValidationWarning[]): void;
|
|
25
|
+
export declare function validateSetAttrAction(action: {
|
|
26
|
+
attr: string;
|
|
27
|
+
value: string;
|
|
28
|
+
}, errors: ValidationError[], _warnings: ValidationWarning[]): void;
|
|
29
|
+
export declare function validateClassAction(action: {
|
|
30
|
+
className: string;
|
|
31
|
+
}, errors: ValidationError[], warnings: ValidationWarning[]): void;
|
|
32
|
+
export declare function validateSetStyleAction(action: {
|
|
33
|
+
styles: Record<string, string>;
|
|
34
|
+
}, errors: ValidationError[], _warnings: ValidationWarning[]): void;
|
|
35
|
+
export declare function validateMountWidgetAction(action: {
|
|
36
|
+
slot: string;
|
|
37
|
+
widget: {
|
|
38
|
+
widgetId: string;
|
|
39
|
+
};
|
|
40
|
+
}, errors: ValidationError[], _warnings: ValidationWarning[]): void;
|
|
41
|
+
export declare function validateWaitAction(action: {
|
|
42
|
+
durationMs?: number;
|
|
43
|
+
event?: string;
|
|
44
|
+
}, errors: ValidationError[], _warnings: ValidationWarning[]): void;
|
|
45
|
+
export declare function validateSequenceAction(action: {
|
|
46
|
+
actions: ActionStep[];
|
|
47
|
+
}, errors: ValidationError[], warnings: ValidationWarning[]): void;
|
|
48
|
+
export declare function validateParallelAction(action: {
|
|
49
|
+
actions: ActionStep[];
|
|
50
|
+
waitFor?: string;
|
|
51
|
+
}, errors: ValidationError[], warnings: ValidationWarning[]): void;
|
|
52
|
+
export declare function validateNavigateAction(action: {
|
|
53
|
+
url: string;
|
|
54
|
+
}, errors: ValidationError[], warnings: ValidationWarning[]): void;
|
|
55
|
+
export declare function validateModalAction(action: {
|
|
56
|
+
content: {
|
|
57
|
+
title?: string;
|
|
58
|
+
body: string;
|
|
59
|
+
};
|
|
60
|
+
size?: string;
|
|
61
|
+
ctaButtons?: {
|
|
62
|
+
label: string;
|
|
63
|
+
actionId: string;
|
|
64
|
+
}[];
|
|
65
|
+
}, errors: ValidationError[], _warnings: ValidationWarning[]): void;
|
|
66
|
+
export declare function validateTourAction(action: {
|
|
67
|
+
tourId: string;
|
|
68
|
+
steps: {
|
|
69
|
+
id: string;
|
|
70
|
+
action: ActionStep;
|
|
71
|
+
route?: string;
|
|
72
|
+
onAction?: Record<string, string>;
|
|
73
|
+
}[];
|
|
74
|
+
}, errors: ValidationError[], warnings: ValidationWarning[]): void;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Action Validation
|
|
2
|
+
* Action Validation — Barrel re-export
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Re-exports from validation-core and validation-rules so that existing
|
|
5
|
+
* imports from './validation' continue to work unchanged.
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* Validate an action step.
|
|
9
|
-
*/
|
|
10
|
-
export declare function validateAction(action: ActionStep): ValidationResult;
|
|
11
|
-
/**
|
|
12
|
-
* Validate a batch of actions.
|
|
13
|
-
*/
|
|
14
|
-
export declare function validateActions(actions: ActionStep[]): ValidationResult;
|
|
7
|
+
export { DANGEROUS_ATTRS, MAX_HTML_LENGTH, MAX_STYLE_COUNT, validateAction, validateActions, validateAnchorAction, } from './validation-core';
|
|
8
|
+
export { validateBadgeAction, validateClassAction, validateInsertHtmlAction, validateModalAction, validateMountWidgetAction, validateNavigateAction, validateParallelAction, validateSequenceAction, validateSetAttrAction, validateSetStyleAction, validateSetTextAction, validateTooltipAction, validateTourAction, validateWaitAction, } from './validation-rules';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootstrap init helpers — token decode, host resolution, browser metadata
|
|
3
|
+
* collection, env var resolution, segment cache, and geo data fetching.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get environment variable, supporting both Vite and Next.js patterns.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getEnvVar(name: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Load cached segment attributes from localStorage.
|
|
11
|
+
* Returns cached values for instant Phase 1 evaluation.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadCachedSegmentAttributes(): Record<string, boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Save segment attributes to localStorage for faster future loads.
|
|
16
|
+
*/
|
|
17
|
+
export declare function cacheSegmentAttributes(attrs: Record<string, boolean>): void;
|
|
18
|
+
/**
|
|
19
|
+
* Extract segment flags (in_segment_*) from PostHog feature flags.
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractSegmentFlags(allFlags: Record<string, boolean | string> | undefined): Record<string, boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Collect browser metadata for instant GrowthBook targeting.
|
|
24
|
+
* This data is available synchronously from browser APIs — no network call needed.
|
|
25
|
+
* Only non-empty values are included.
|
|
26
|
+
*/
|
|
27
|
+
export declare function collectBrowserMetadata(): Record<string, string | string[]>;
|
|
28
|
+
export declare const GEO_DEFAULT_HOST = "https://geo.syntrologie.com";
|
|
29
|
+
/**
|
|
30
|
+
* Fetch geo data from the Cloudflare Worker, with localStorage caching.
|
|
31
|
+
* Returns cached data immediately on subsequent visits. Best-effort — never blocks init.
|
|
32
|
+
*/
|
|
33
|
+
export declare function fetchGeo(geoHost: string): Promise<Record<string, string>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootstrap runtime phase — EventBus creation, event processor, experiment client,
|
|
3
|
+
* telemetry, runtime factory, canvas initialization, app loader, and cleanup.
|
|
4
|
+
*/
|
|
5
|
+
import type { SyntroInitOptions, SyntroInitResult } from './bootstrap-types';
|
|
6
|
+
/** Internal init implementation — all errors propagate to the outer init() try/catch. */
|
|
7
|
+
export declare function _initCore(options: SyntroInitOptions): Promise<SyntroInitResult>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootstrap type definitions — interfaces, enums, and type exports
|
|
3
|
+
* for the Syntro SDK initialization flow.
|
|
4
|
+
*/
|
|
5
|
+
import type { SmartCanvasConfig, SmartCanvasHandle } from './api';
|
|
6
|
+
import type { AppLoader } from './apps/AppLoader';
|
|
7
|
+
import type { ExperimentClient } from './experiments/types';
|
|
8
|
+
import type { SessionMetricTracker } from './metrics';
|
|
9
|
+
import type { SmartCanvasRuntime } from './runtime';
|
|
10
|
+
import type { TelemetryClient } from './telemetry/types';
|
|
11
|
+
import type { CanvasConfigFetcher } from './types';
|
|
12
|
+
export interface SyntroInitOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The Syntro token containing all credentials.
|
|
15
|
+
* Generated from your admin dashboard.
|
|
16
|
+
*
|
|
17
|
+
* Optional in editor mode (when editor_token is present in URL params).
|
|
18
|
+
*/
|
|
19
|
+
token?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional canvas configuration overrides.
|
|
22
|
+
*/
|
|
23
|
+
canvas?: Partial<Omit<SmartCanvasConfig, 'integrations' | 'fetcher'>>;
|
|
24
|
+
/**
|
|
25
|
+
* Custom config fetcher to override the default experiment-based fetcher.
|
|
26
|
+
* Use this for local development or when bypassing the experiment server.
|
|
27
|
+
*
|
|
28
|
+
* When provided, this fetcher is used instead of the experiments-based config lookup.
|
|
29
|
+
* The token's telemetry credentials (t field) are still used if present.
|
|
30
|
+
*/
|
|
31
|
+
fetcher?: CanvasConfigFetcher;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Session metrics are always enabled. This flag has no effect.
|
|
34
|
+
*/
|
|
35
|
+
enableSessionMetrics?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* CDN base URL for loading adaptive bundles.
|
|
38
|
+
* Adaptives are loaded from: {cdnBase}/adaptives/{appId}/index.js
|
|
39
|
+
*
|
|
40
|
+
* @default "https://cdn.syntrologie.com"
|
|
41
|
+
*/
|
|
42
|
+
cdnBase?: string;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Core app executors are now registered synchronously.
|
|
45
|
+
* This option has no effect and will be removed in a future version.
|
|
46
|
+
*/
|
|
47
|
+
registerBuiltInApps?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Enable debug mode. emit() returns EmitResult, all events logged to console.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
debug?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Enable test mode. PostHog capture skipped, toasts not rendered,
|
|
55
|
+
* full event history retained (uncapped).
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
testMode?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface SyntroInitResult {
|
|
61
|
+
/**
|
|
62
|
+
* The SmartCanvas handle for controlling the canvas.
|
|
63
|
+
*/
|
|
64
|
+
canvas: SmartCanvasHandle;
|
|
65
|
+
/**
|
|
66
|
+
* The unified v2 runtime with all providers.
|
|
67
|
+
* Use this to access telemetry, context, events, and state.
|
|
68
|
+
*/
|
|
69
|
+
runtime: SmartCanvasRuntime;
|
|
70
|
+
/**
|
|
71
|
+
* The experiment client, if experiments are configured in the token.
|
|
72
|
+
* @deprecated Access via runtime.telemetry or use DecisionStrategy instead
|
|
73
|
+
*/
|
|
74
|
+
experiments?: ExperimentClient;
|
|
75
|
+
/**
|
|
76
|
+
* The telemetry client, if telemetry is configured in the token.
|
|
77
|
+
* @deprecated Access via runtime.telemetry instead
|
|
78
|
+
*/
|
|
79
|
+
telemetry?: TelemetryClient;
|
|
80
|
+
/**
|
|
81
|
+
* The session metric tracker, if enableSessionMetrics is true.
|
|
82
|
+
* @deprecated Access via runtime.sessionMetrics instead
|
|
83
|
+
*/
|
|
84
|
+
sessionMetrics?: SessionMetricTracker;
|
|
85
|
+
/**
|
|
86
|
+
* App loader for loading external apps from CDN.
|
|
87
|
+
* Exposed for manual app loading if needed.
|
|
88
|
+
*/
|
|
89
|
+
appLoader: AppLoader;
|
|
90
|
+
}
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -16,89 +16,11 @@
|
|
|
16
16
|
* runtime.state.dismissals.mark('my-tile');
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
import { type SmartCanvasConfig, type SmartCanvasHandle } from './api';
|
|
20
19
|
import type { appRegistry } from './apps';
|
|
21
|
-
import {
|
|
22
|
-
import type { ExperimentClient } from './experiments/types';
|
|
23
|
-
import { type SessionMetricTracker } from './metrics';
|
|
24
|
-
import { type SmartCanvasRuntime } from './runtime';
|
|
25
|
-
import type { TelemetryClient } from './telemetry/types';
|
|
20
|
+
import type { SmartCanvasRuntime } from './runtime';
|
|
26
21
|
import { decodeToken, encodeToken } from './token';
|
|
27
|
-
|
|
28
|
-
export
|
|
29
|
-
/**
|
|
30
|
-
* The Syntro token containing all credentials.
|
|
31
|
-
* Generated from your admin dashboard.
|
|
32
|
-
*
|
|
33
|
-
* Optional in editor mode (when editor_token is present in URL params).
|
|
34
|
-
*/
|
|
35
|
-
token?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Optional canvas configuration overrides.
|
|
38
|
-
*/
|
|
39
|
-
canvas?: Partial<Omit<SmartCanvasConfig, 'integrations' | 'fetcher'>>;
|
|
40
|
-
/**
|
|
41
|
-
* Custom config fetcher to override the default experiment-based fetcher.
|
|
42
|
-
* Use this for local development or when bypassing the experiment server.
|
|
43
|
-
*
|
|
44
|
-
* When provided, this fetcher is used instead of the experiments-based config lookup.
|
|
45
|
-
* The token's telemetry credentials (t field) are still used if present.
|
|
46
|
-
*/
|
|
47
|
-
fetcher?: CanvasConfigFetcher;
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated Session metrics are always enabled. This flag has no effect.
|
|
50
|
-
*/
|
|
51
|
-
enableSessionMetrics?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* CDN base URL for loading adaptive bundles.
|
|
54
|
-
* Adaptives are loaded from: {cdnBase}/adaptives/{appId}/index.js
|
|
55
|
-
*
|
|
56
|
-
* @default "https://cdn.syntrologie.com"
|
|
57
|
-
*/
|
|
58
|
-
cdnBase?: string;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated Core app executors are now registered synchronously.
|
|
61
|
-
* This option has no effect and will be removed in a future version.
|
|
62
|
-
*/
|
|
63
|
-
registerBuiltInApps?: boolean;
|
|
64
|
-
}
|
|
65
|
-
export interface SyntroInitResult {
|
|
66
|
-
/**
|
|
67
|
-
* The SmartCanvas handle for controlling the canvas.
|
|
68
|
-
*/
|
|
69
|
-
canvas: SmartCanvasHandle;
|
|
70
|
-
/**
|
|
71
|
-
* The unified v2 runtime with all providers.
|
|
72
|
-
* Use this to access telemetry, context, events, and state.
|
|
73
|
-
*/
|
|
74
|
-
runtime: SmartCanvasRuntime;
|
|
75
|
-
/**
|
|
76
|
-
* The experiment client, if experiments are configured in the token.
|
|
77
|
-
* @deprecated Access via runtime.telemetry or use DecisionStrategy instead
|
|
78
|
-
*/
|
|
79
|
-
experiments?: ExperimentClient;
|
|
80
|
-
/**
|
|
81
|
-
* The telemetry client, if telemetry is configured in the token.
|
|
82
|
-
* @deprecated Access via runtime.telemetry instead
|
|
83
|
-
*/
|
|
84
|
-
telemetry?: TelemetryClient;
|
|
85
|
-
/**
|
|
86
|
-
* The session metric tracker, if enableSessionMetrics is true.
|
|
87
|
-
* @deprecated Access via runtime.sessionMetrics instead
|
|
88
|
-
*/
|
|
89
|
-
sessionMetrics?: SessionMetricTracker;
|
|
90
|
-
/**
|
|
91
|
-
* App loader for loading external apps from CDN.
|
|
92
|
-
* Exposed for manual app loading if needed.
|
|
93
|
-
*/
|
|
94
|
-
appLoader: AppLoader;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Collect browser metadata for instant GrowthBook targeting.
|
|
98
|
-
* This data is available synchronously from browser APIs — no network call needed.
|
|
99
|
-
* Only non-empty values are included.
|
|
100
|
-
*/
|
|
101
|
-
export declare function collectBrowserMetadata(): Record<string, string | string[]>;
|
|
22
|
+
export { collectBrowserMetadata, fetchGeo } from './bootstrap-init';
|
|
23
|
+
export type { SyntroInitOptions, SyntroInitResult } from './bootstrap-types';
|
|
102
24
|
/**
|
|
103
25
|
* Initialize the Syntro SDK with a single token.
|
|
104
26
|
*
|
|
@@ -112,7 +34,17 @@ export declare function collectBrowserMetadata(): Record<string, string | string
|
|
|
112
34
|
* @param options - Initialization options
|
|
113
35
|
* @returns The initialized SDK components
|
|
114
36
|
*/
|
|
115
|
-
declare function init(options: SyntroInitOptions): Promise<SyntroInitResult>;
|
|
37
|
+
declare function init(options: import('./bootstrap-types').SyntroInitOptions): Promise<import('./bootstrap-types').SyntroInitResult | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* Emit a custom event through the SDK.
|
|
40
|
+
*
|
|
41
|
+
* Events flow through the EventBus (tile notification rule matching)
|
|
42
|
+
* and PostHog (analytics). Event names must use the `app:` prefix.
|
|
43
|
+
*
|
|
44
|
+
* @param eventName - Event name (e.g., 'app:setup:sdk_connected')
|
|
45
|
+
* @param props - Optional event properties
|
|
46
|
+
*/
|
|
47
|
+
declare function emit(eventName: string, props?: Record<string, unknown>): void;
|
|
116
48
|
/**
|
|
117
49
|
* The Syntro namespace for single-token initialization.
|
|
118
50
|
*/
|
|
@@ -120,6 +52,9 @@ export declare const Syntro: {
|
|
|
120
52
|
init: typeof init;
|
|
121
53
|
encodeToken: typeof encodeToken;
|
|
122
54
|
decodeToken: typeof decodeToken;
|
|
55
|
+
events: {
|
|
56
|
+
emit: typeof emit;
|
|
57
|
+
};
|
|
123
58
|
};
|
|
124
59
|
declare global {
|
|
125
60
|
interface Window {
|
|
@@ -131,4 +66,3 @@ declare global {
|
|
|
131
66
|
};
|
|
132
67
|
}
|
|
133
68
|
}
|
|
134
|
-
export {};
|