@syntrologie/runtime-sdk 2.8.0-canary.4 → 2.8.0-canary.40
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 +44 -0
- package/dist/actions/schema.d.ts +1 -1
- package/dist/actions/schema.js +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-5GTCL2IH.js → chunk-ESLIWC3T.js} +1506 -599
- package/dist/chunk-ESLIWC3T.js.map +7 -0
- package/dist/{chunk-R5DNAIRI.js → chunk-TN5BLBPU.js} +1 -1
- package/dist/{chunk-R5DNAIRI.js.map → chunk-TN5BLBPU.js.map} +1 -1
- package/dist/components/TileIcon.d.ts +2 -2
- package/dist/components/emojiToIcon.d.ts +24 -0
- 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 +1479 -180
- 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 +123 -54
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +5607 -2962
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +123 -54
- 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 +100 -2
- package/scripts/syntroReactPlugin.mjs +3 -0
- package/scripts/validate-config.mjs +42 -0
- package/dist/chunk-5GTCL2IH.js.map +0 -7
package/CAPABILITIES.md
CHANGED
|
@@ -233,6 +233,7 @@ Inserts HTML content relative to an element.
|
|
|
233
233
|
| `anchorId` | string | Yes | Element selector |
|
|
234
234
|
| `html` | string | Yes | HTML content (sanitized) |
|
|
235
235
|
| `position` | string | Yes | `"before"`, `"after"`, `"prepend"`, `"append"`, `"replace"` |
|
|
236
|
+
| `deepLink` | object | No | Makes the entire inserted element clickable to open the canvas panel and navigate to a specific tile |
|
|
236
237
|
|
|
237
238
|
**Positions:**
|
|
238
239
|
|
|
@@ -251,6 +252,27 @@ Inserts HTML content relative to an element.
|
|
|
251
252
|
}
|
|
252
253
|
```
|
|
253
254
|
|
|
255
|
+
**Deep-linking to canvas tiles:**
|
|
256
|
+
|
|
257
|
+
Use `deepLink` to make inserted content open the canvas panel and navigate to a specific tile when clicked. This is the correct way to connect inserted buttons/links to canvas tiles — do NOT use `onclick` handlers with `window.SynOS`.
|
|
258
|
+
|
|
259
|
+
| Property | Type | Required | Description |
|
|
260
|
+
| ---------------- | ------ | -------- | ---------------------------------- |
|
|
261
|
+
| `deepLink.tileId` | string | Yes | ID of the tile to open |
|
|
262
|
+
| `deepLink.itemId` | string | No | Specific item within the tile |
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"kind": "insert_html",
|
|
267
|
+
"anchorId": "[data-id='pricing-heading']",
|
|
268
|
+
"html": "<button style='background: #4a90e2; color: white; border: none; padding: 8px 16px; border-radius: 20px; cursor: pointer;'>Help Me Choose</button>",
|
|
269
|
+
"position": "after",
|
|
270
|
+
"deepLink": { "tileId": "plan_selector_faq" }
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The SDK automatically handles opening the canvas, setting the cursor to pointer, and publishing a `notification.deep_link` event. The click handler is wired up and cleaned up by the SDK — no JavaScript in the HTML is needed.
|
|
275
|
+
|
|
254
276
|
### add_class
|
|
255
277
|
|
|
256
278
|
Adds a CSS class to an element.
|
|
@@ -1284,3 +1306,25 @@ Control when adaptives activate using `DecisionStrategy`:
|
|
|
1284
1306
|
- Listen for `action.failed` to handle errors
|
|
1285
1307
|
- Track `action.applied` for analytics
|
|
1286
1308
|
- Use EventBus for cross-adaptive coordination
|
|
1309
|
+
|
|
1310
|
+
### 6. Opening the Canvas from Inserted Content
|
|
1311
|
+
|
|
1312
|
+
When `content:insertHtml` needs to open the canvas panel (e.g., a "Help Me Choose" button that opens an FAQ tile), use the `deepLink` property — **never write `onclick` handlers or reference `window.SynOS` in HTML**.
|
|
1313
|
+
|
|
1314
|
+
```json
|
|
1315
|
+
{
|
|
1316
|
+
"kind": "insert_html",
|
|
1317
|
+
"anchorId": "[data-id='pricing-heading']",
|
|
1318
|
+
"html": "<button style='background: #4a90e2; color: white; border: none; padding: 8px 16px; border-radius: 20px; cursor: pointer;'>Help Me Choose</button>",
|
|
1319
|
+
"position": "after",
|
|
1320
|
+
"deepLink": { "tileId": "plan_selector_faq" }
|
|
1321
|
+
}
|
|
1322
|
+
```
|
|
1323
|
+
|
|
1324
|
+
The `deepLink` object:
|
|
1325
|
+
- `tileId` (required) — ID of the canvas tile to navigate to
|
|
1326
|
+
- `itemId` (optional) — specific item within the tile (e.g., a FAQ question ID)
|
|
1327
|
+
|
|
1328
|
+
The SDK automatically opens the canvas, navigates to the tile, sets cursor to pointer, and wires up click/cleanup handlers.
|
|
1329
|
+
|
|
1330
|
+
**NEVER use `onclick`, `window.SynOS`, or any JavaScript in `insert_html` HTML strings.** The HTML is sanitized and event handlers are stripped. Use `deepLink` instead.
|
package/dist/actions/schema.d.ts
CHANGED
|
@@ -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
|
@@ -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 {};
|