@guidelytech/sdk-core 0.15.0 → 0.17.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/README.md +4 -1
- package/dist/{chunk-2E2YUQAG.js → chunk-GFLVZRTS.js} +28 -3
- package/dist/chunk-GFLVZRTS.js.map +1 -0
- package/dist/{types-Bkw8ErmO.d.cts → environment-D63OzdWf.d.cts} +172 -5
- package/dist/{types-Dy_uPu6S.d.ts → environment-DAT4iYvZ.d.ts} +172 -5
- package/dist/headless.cjs +27 -1
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +3 -1
- package/dist/index.cjs +1155 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -10
- package/dist/index.d.ts +71 -10
- package/dist/index.js +1089 -72
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/dist/capture-CgN69Lxq.d.cts +0 -100
- package/dist/capture-Csz721-A.d.ts +0 -100
- package/dist/chunk-2E2YUQAG.js.map +0 -1
- package/dist/chunk-JUSM7J5N.js +0 -376
- package/dist/chunk-JUSM7J5N.js.map +0 -1
- package/dist/chunk-ZAF2KRJA.js +0 -334
- package/dist/chunk-ZAF2KRJA.js.map +0 -1
- package/dist/health-sbP9JwTE.d.cts +0 -90
- package/dist/health-sbP9JwTE.d.ts +0 -90
- package/dist/http-Cb6KYYFv.d.cts +0 -61
- package/dist/http-D047Ngxk.d.ts +0 -61
- package/dist/types-BDlebXrm.d.ts +0 -314
- package/dist/types-Mtlmlj5C.d.cts +0 -314
package/dist/http-Cb6KYYFv.d.cts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { S as ServerHealth } from './health-sbP9JwTE.cjs';
|
|
2
|
-
|
|
3
|
-
interface ApiResponse<T> {
|
|
4
|
-
status: number;
|
|
5
|
-
ok: boolean;
|
|
6
|
-
data: T | null;
|
|
7
|
-
etag: string | null;
|
|
8
|
-
}
|
|
9
|
-
type FetchLike = typeof fetch;
|
|
10
|
-
/** Thin HTTP client for the public SDK API. Adds the public key as query + header. */
|
|
11
|
-
declare class Api {
|
|
12
|
-
private readonly baseUrl;
|
|
13
|
-
private readonly key;
|
|
14
|
-
private readonly fetchImpl?;
|
|
15
|
-
/** Reachability of the API, fed by every answer (see {@link ServerHealth}). */
|
|
16
|
-
readonly health: ServerHealth;
|
|
17
|
-
constructor(baseUrl: string, key: string, fetchImpl?: FetchLike | undefined, health?: ServerHealth);
|
|
18
|
-
/** Feeds an answer (or a failed request, `null`) into {@link health}. */
|
|
19
|
-
private observe;
|
|
20
|
-
url(path: string, params?: Record<string, string | undefined>): string;
|
|
21
|
-
private get fetcher();
|
|
22
|
-
request<T>(method: "GET" | "POST", path: string, options?: {
|
|
23
|
-
body?: unknown;
|
|
24
|
-
etag?: string | null;
|
|
25
|
-
params?: Record<string, string | undefined>;
|
|
26
|
-
keepalive?: boolean;
|
|
27
|
-
timeoutMs?: number;
|
|
28
|
-
headers?: Record<string, string>;
|
|
29
|
-
}): Promise<ApiResponse<T>>;
|
|
30
|
-
get<T>(path: string, options?: {
|
|
31
|
-
etag?: string | null;
|
|
32
|
-
params?: Record<string, string | undefined>;
|
|
33
|
-
headers?: Record<string, string>;
|
|
34
|
-
}): Promise<ApiResponse<T>>;
|
|
35
|
-
post<T>(path: string, body: unknown, options?: {
|
|
36
|
-
params?: Record<string, string | undefined>;
|
|
37
|
-
keepalive?: boolean;
|
|
38
|
-
headers?: Record<string, string>;
|
|
39
|
-
}): Promise<ApiResponse<T>>;
|
|
40
|
-
/** Multipart POST (file uploads). No Content-Type header: the browser adds it with the boundary. */
|
|
41
|
-
postForm<T>(path: string, form: FormData, options?: {
|
|
42
|
-
params?: Record<string, string | undefined>;
|
|
43
|
-
timeoutMs?: number;
|
|
44
|
-
}): Promise<ApiResponse<T>>;
|
|
45
|
-
/**
|
|
46
|
-
* POST that may answer with server-sent events. Each event is passed to `onEvent`; a JSON answer is
|
|
47
|
-
* returned instead. Scout replies can take a while, so there is no overall timeout: the response
|
|
48
|
-
* must start within 30 s and then never go quiet for more than 60 s (the server sends keepalives),
|
|
49
|
-
* otherwise the request is aborted and rejects.
|
|
50
|
-
*/
|
|
51
|
-
stream<T>(path: string, body: unknown, onEvent: (event: string, data: unknown) => void, headers?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
52
|
-
/** `navigator.sendBeacon` when available (page unload); returns false when it could not be queued. */
|
|
53
|
-
beacon(path: string, body: unknown): boolean;
|
|
54
|
-
}
|
|
55
|
-
declare const sleep: (ms: number) => Promise<void>;
|
|
56
|
-
/** Exponential backoff helper: 1s → 2s → 4s … capped. */
|
|
57
|
-
declare function backoffMs(attempt: number, baseMs?: number, maxMs?: number): number;
|
|
58
|
-
/** Fire-and-forget POST with bounded retries (used for state sync; never blocks UI). */
|
|
59
|
-
declare function postWithRetry<T>(api: Api, path: string, body: unknown, attempts?: number, baseMs?: number): Promise<ApiResponse<T> | null>;
|
|
60
|
-
|
|
61
|
-
export { Api as A, type FetchLike as F, type ApiResponse as a, backoffMs as b, postWithRetry as p, sleep as s };
|
package/dist/http-D047Ngxk.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { S as ServerHealth } from './health-sbP9JwTE.js';
|
|
2
|
-
|
|
3
|
-
interface ApiResponse<T> {
|
|
4
|
-
status: number;
|
|
5
|
-
ok: boolean;
|
|
6
|
-
data: T | null;
|
|
7
|
-
etag: string | null;
|
|
8
|
-
}
|
|
9
|
-
type FetchLike = typeof fetch;
|
|
10
|
-
/** Thin HTTP client for the public SDK API. Adds the public key as query + header. */
|
|
11
|
-
declare class Api {
|
|
12
|
-
private readonly baseUrl;
|
|
13
|
-
private readonly key;
|
|
14
|
-
private readonly fetchImpl?;
|
|
15
|
-
/** Reachability of the API, fed by every answer (see {@link ServerHealth}). */
|
|
16
|
-
readonly health: ServerHealth;
|
|
17
|
-
constructor(baseUrl: string, key: string, fetchImpl?: FetchLike | undefined, health?: ServerHealth);
|
|
18
|
-
/** Feeds an answer (or a failed request, `null`) into {@link health}. */
|
|
19
|
-
private observe;
|
|
20
|
-
url(path: string, params?: Record<string, string | undefined>): string;
|
|
21
|
-
private get fetcher();
|
|
22
|
-
request<T>(method: "GET" | "POST", path: string, options?: {
|
|
23
|
-
body?: unknown;
|
|
24
|
-
etag?: string | null;
|
|
25
|
-
params?: Record<string, string | undefined>;
|
|
26
|
-
keepalive?: boolean;
|
|
27
|
-
timeoutMs?: number;
|
|
28
|
-
headers?: Record<string, string>;
|
|
29
|
-
}): Promise<ApiResponse<T>>;
|
|
30
|
-
get<T>(path: string, options?: {
|
|
31
|
-
etag?: string | null;
|
|
32
|
-
params?: Record<string, string | undefined>;
|
|
33
|
-
headers?: Record<string, string>;
|
|
34
|
-
}): Promise<ApiResponse<T>>;
|
|
35
|
-
post<T>(path: string, body: unknown, options?: {
|
|
36
|
-
params?: Record<string, string | undefined>;
|
|
37
|
-
keepalive?: boolean;
|
|
38
|
-
headers?: Record<string, string>;
|
|
39
|
-
}): Promise<ApiResponse<T>>;
|
|
40
|
-
/** Multipart POST (file uploads). No Content-Type header: the browser adds it with the boundary. */
|
|
41
|
-
postForm<T>(path: string, form: FormData, options?: {
|
|
42
|
-
params?: Record<string, string | undefined>;
|
|
43
|
-
timeoutMs?: number;
|
|
44
|
-
}): Promise<ApiResponse<T>>;
|
|
45
|
-
/**
|
|
46
|
-
* POST that may answer with server-sent events. Each event is passed to `onEvent`; a JSON answer is
|
|
47
|
-
* returned instead. Scout replies can take a while, so there is no overall timeout: the response
|
|
48
|
-
* must start within 30 s and then never go quiet for more than 60 s (the server sends keepalives),
|
|
49
|
-
* otherwise the request is aborted and rejects.
|
|
50
|
-
*/
|
|
51
|
-
stream<T>(path: string, body: unknown, onEvent: (event: string, data: unknown) => void, headers?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
52
|
-
/** `navigator.sendBeacon` when available (page unload); returns false when it could not be queued. */
|
|
53
|
-
beacon(path: string, body: unknown): boolean;
|
|
54
|
-
}
|
|
55
|
-
declare const sleep: (ms: number) => Promise<void>;
|
|
56
|
-
/** Exponential backoff helper: 1s → 2s → 4s … capped. */
|
|
57
|
-
declare function backoffMs(attempt: number, baseMs?: number, maxMs?: number): number;
|
|
58
|
-
/** Fire-and-forget POST with bounded retries (used for state sync; never blocks UI). */
|
|
59
|
-
declare function postWithRetry<T>(api: Api, path: string, body: unknown, attempts?: number, baseMs?: number): Promise<ApiResponse<T> | null>;
|
|
60
|
-
|
|
61
|
-
export { Api as A, type FetchLike as F, type ApiResponse as a, backoffMs as b, postWithRetry as p, sleep as s };
|
package/dist/types-BDlebXrm.d.ts
DELETED
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import { SdkEvent, PublishedGuide, FrequencyConfig, GuideThrottlingSettings, AutocaptureSettings, NetworkRequest, ProjectTheme, SdkConfigResponse, ChecklistTask, MessengerMessage, MessengerConversation } from '@guidelytech/shared';
|
|
2
|
-
import { K as KeyValueStore, S as ServerHealth, c as StorageKind } from './health-sbP9JwTE.js';
|
|
3
|
-
import { FlagsClientOptions } from '@guidelytech/flags';
|
|
4
|
-
import { AgentTurnInput } from '@guidelytech/shared/runtime';
|
|
5
|
-
|
|
6
|
-
interface EventQueueOptions {
|
|
7
|
-
store: KeyValueStore;
|
|
8
|
-
storageKey: string;
|
|
9
|
-
/** Sends one batch. Resolve `{ ok: true }` on success, `{ ok: false, retry }` otherwise. */
|
|
10
|
-
send: (events: SdkEvent[]) => Promise<{
|
|
11
|
-
ok: boolean;
|
|
12
|
-
retry?: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
/** Synchronous best-effort send used on page hide. */
|
|
15
|
-
beacon?: (events: SdkEvent[]) => boolean;
|
|
16
|
-
/** Should events be flushed right now? (analytics enabled + consent granted). */
|
|
17
|
-
enabled: () => boolean;
|
|
18
|
-
/** API reachability: sends wait while its circuit is open, and beaconed events are only forgotten while it is reachable. */
|
|
19
|
-
health?: ServerHealth;
|
|
20
|
-
flushIntervalMs?: number;
|
|
21
|
-
maxQueue?: number;
|
|
22
|
-
batchSize?: number;
|
|
23
|
-
maxAttempts?: number;
|
|
24
|
-
onError?: (err: unknown) => void;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Bounded, persisted event queue. Batches ≤50 events every 2s (or on demand), dedupes by
|
|
28
|
-
* `eventId`, and keeps failed events (also across page loads) until the server takes them:
|
|
29
|
-
* retries back off 1s→60s, wait while the API's circuit is open, and start again as soon as it
|
|
30
|
-
* recovers. Drops the oldest events once the queue exceeds 500.
|
|
31
|
-
*/
|
|
32
|
-
declare class EventQueue {
|
|
33
|
-
private readonly opts;
|
|
34
|
-
private events;
|
|
35
|
-
private timer;
|
|
36
|
-
private retryTimer;
|
|
37
|
-
private inflight;
|
|
38
|
-
private inflightIds;
|
|
39
|
-
private attempt;
|
|
40
|
-
private destroyed;
|
|
41
|
-
private offRecover;
|
|
42
|
-
private readonly flushIntervalMs;
|
|
43
|
-
private readonly maxQueue;
|
|
44
|
-
private readonly batchSize;
|
|
45
|
-
private readonly maxAttempts;
|
|
46
|
-
constructor(opts: EventQueueOptions);
|
|
47
|
-
/** The API is back: drop any pending backoff and send what is queued. */
|
|
48
|
-
private retryNow;
|
|
49
|
-
private retryIn;
|
|
50
|
-
get size(): number;
|
|
51
|
-
/** Pending events (read-only copy, for debugging). */
|
|
52
|
-
peek(): SdkEvent[];
|
|
53
|
-
enqueue(event: SdkEvent): void;
|
|
54
|
-
private persist;
|
|
55
|
-
private schedule;
|
|
56
|
-
/** Sends queued events now (one batch at a time). Safe to call at any time. */
|
|
57
|
-
flush(): Promise<void>;
|
|
58
|
-
/** Best-effort synchronous flush on unload using `sendBeacon`. */
|
|
59
|
-
flushSync(): void;
|
|
60
|
-
clear(): void;
|
|
61
|
-
destroy(): void;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Per-guide state kept locally and merged with the server's `IdentifyResponse.guideState`. */
|
|
65
|
-
interface GuideLocalState {
|
|
66
|
-
impressions: number;
|
|
67
|
-
completedAt?: string | null;
|
|
68
|
-
dismissedAt?: string | null;
|
|
69
|
-
lastShownAt?: string | null;
|
|
70
|
-
/** Last step reached in a multi-step flow (local only), so the messenger can offer to resume it. */
|
|
71
|
-
lastStepId?: string | null;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Pure frequency evaluation. `shownThisSession` comes from session storage.
|
|
75
|
-
* - `once`: a single impression ever (unless `reshowAfterDismiss` and it was only dismissed).
|
|
76
|
-
* - `once_per_session`: at most once per browser session.
|
|
77
|
-
* - `every_time`: on every trigger (still blocked by completion/dismissal rules below).
|
|
78
|
-
* - `interval`: at most once every `intervalHours`.
|
|
79
|
-
* `maxImpressions` caps total impressions; dismissal blocks re-showing unless `reshowAfterDismiss`
|
|
80
|
-
* (then `cooldownHours` must have elapsed); completion blocks unless mode is `every_time`.
|
|
81
|
-
*/
|
|
82
|
-
declare function isFrequencyEligible(freq: FrequencyConfig, state: GuideLocalState | undefined, shownThisSession: boolean, now?: number): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Exclusive guides (flows, modals, tooltips, announcements, surveys) run one at a time.
|
|
85
|
-
* Banners, checklists and hotspot-only tooltips can coexist with an active flow.
|
|
86
|
-
*/
|
|
87
|
-
declare function isExclusiveGuide(guide: PublishedGuide): boolean;
|
|
88
|
-
/** Is `a` mutually exclusive with `b` (by id or key, in either direction)? */
|
|
89
|
-
declare function areMutuallyExclusive(a: PublishedGuide, b: PublishedGuide): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Scheduling window: the guide's `schedule` (any kind) and, for surveys, `survey.startAt` / `endAt`.
|
|
92
|
-
* Unparsable dates are ignored.
|
|
93
|
-
*/
|
|
94
|
-
declare function isWithinSchedule(guide: Pick<PublishedGuide, "config">, now?: number): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Does showing this guide automatically count toward (and get limited by) the project's guide
|
|
97
|
-
* throttling? Only exclusive guides (flows, modals, tooltips, announcements, surveys) interrupt;
|
|
98
|
-
* banners, checklists and hotspot-only guides never count, nor does a guide set to ignore throttling.
|
|
99
|
-
* Guides started by the visitor or the app (`startGuide`, buttons, Help) are never throttled.
|
|
100
|
-
*/
|
|
101
|
-
declare function countsTowardThrottle(guide: PublishedGuide): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Pure throttling check. `launches` = ISO times of this visitor's earlier automatic launches of
|
|
104
|
-
* counted guides (any order). Disabled or missing settings never throttle.
|
|
105
|
-
*/
|
|
106
|
-
declare function isThrottleEligible(settings: GuideThrottlingSettings | null | undefined, launches: readonly string[], now?: number): boolean;
|
|
107
|
-
/** Launch times worth keeping: those still inside the window or the minimum gap (at most 100). */
|
|
108
|
-
declare function pruneLaunches(launches: readonly string[], settings: GuideThrottlingSettings | null | undefined, now?: number): string[];
|
|
109
|
-
/**
|
|
110
|
-
* A checklist's dismissal after merging server state. A local dismissal normally wins (it may not have
|
|
111
|
-
* synced yet), but when the server reports a reset this device hasn't applied, the server's value wins:
|
|
112
|
-
* null, or a dismissal made on another device after the reset. Compared as tokens, not times, so a
|
|
113
|
-
* skewed device clock can't keep a reset dismissal.
|
|
114
|
-
*/
|
|
115
|
-
declare function dismissedAfterMerge(local: {
|
|
116
|
-
dismissedAt?: string | null;
|
|
117
|
-
dismissResetAt?: string | null;
|
|
118
|
-
} | undefined, server: {
|
|
119
|
-
dismissedAt?: string | null;
|
|
120
|
-
dismissResetAt?: string | null;
|
|
121
|
-
}): string | null;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Agent Analytics in the browser: turns of conversations with the app's own AI agent, sent to
|
|
125
|
-
* `POST /api/v1/sdk/agent-events`. Turns are filled in with the visitor's ids and session, passed through
|
|
126
|
-
* the app's `agents.redact` callback, and kept in a persisted outbox until the server accepts them
|
|
127
|
-
* (retried with backoff while it is unreachable; the server ignores turns it already has).
|
|
128
|
-
*/
|
|
129
|
-
/** Last say over each turn before it leaves the browser: return a changed copy, or null to drop it. */
|
|
130
|
-
type AgentTurnRedactor = (turn: AgentTurnInput) => AgentTurnInput | null | undefined;
|
|
131
|
-
|
|
132
|
-
type GuidelyEnvironment = "development" | "staging" | "production";
|
|
133
|
-
type ConsentState = "granted" | "denied" | "pending";
|
|
134
|
-
interface GuidelyAccount {
|
|
135
|
-
id: string;
|
|
136
|
-
traits?: Record<string, unknown>;
|
|
137
|
-
}
|
|
138
|
-
interface GuidelyUser {
|
|
139
|
-
id: string;
|
|
140
|
-
traits?: Record<string, unknown>;
|
|
141
|
-
account?: GuidelyAccount;
|
|
142
|
-
}
|
|
143
|
-
interface GuidelyOptions {
|
|
144
|
-
/** Environment public key, e.g. `pk_dev_…`. Not a secret. */
|
|
145
|
-
projectId: string;
|
|
146
|
-
environment?: GuidelyEnvironment;
|
|
147
|
-
/** Base URL of the Guidely API (default `https://api.guidely.app`; use `http://localhost:3000` locally). */
|
|
148
|
-
apiUrl?: string;
|
|
149
|
-
/** Log trigger decisions and requests to the console. */
|
|
150
|
-
debug?: boolean;
|
|
151
|
-
/** Send analytics events (default `true`). Guides still render when disabled. */
|
|
152
|
-
analytics?: boolean;
|
|
153
|
-
/** `pending` buffers events until `setConsent("granted")`; `denied` disables analytics. */
|
|
154
|
-
consent?: ConsentState;
|
|
155
|
-
/** Where to persist identity, cached config and the event queue (default `local`). */
|
|
156
|
-
storage?: StorageKind;
|
|
157
|
-
/** Interval for re-checking element-visibility triggers while the page is idle (default 1000ms). */
|
|
158
|
-
pollIntervalMs?: number;
|
|
159
|
-
/** How often to refresh the published config (default 5 minutes). */
|
|
160
|
-
configRefreshMs?: number;
|
|
161
|
-
/** Elements whose text must never be captured (authoring snapshots, click text, session replays). Merged with the project setting. */
|
|
162
|
-
maskSelectors?: string[];
|
|
163
|
-
/**
|
|
164
|
-
* Page views, page leave, clicks and rage clicks are captured when the project enables them.
|
|
165
|
-
* `false` turns all of them off for this installation; an object turns individual ones off
|
|
166
|
-
* (`{ clicks: false }`). Options can only switch capture off, never on.
|
|
167
|
-
*/
|
|
168
|
-
autocapture?: boolean | Partial<AutocaptureSettings>;
|
|
169
|
-
/** App version or commit SHA (≤100 chars), sent with every `exception` to pick the matching uploaded source maps. */
|
|
170
|
-
release?: string;
|
|
171
|
-
/**
|
|
172
|
-
* Version of the host application (e.g. an Electron app's `app.getVersion()`), used by **App version**
|
|
173
|
-
* targeting rules and as the `appVersion` flag attribute.
|
|
174
|
-
*/
|
|
175
|
-
appVersion?: string;
|
|
176
|
-
/**
|
|
177
|
-
* Maps the browser URL to the page URL Guidely sees (targeting, URL patterns, page analytics). By
|
|
178
|
-
* default http(s) URLs are used as they are and `file:` / custom-protocol URLs (Electron, desktop
|
|
179
|
-
* shells) are made app-relative with `normalizeAppUrl`: `file:///…/index.html#/settings` → `file://app/settings`.
|
|
180
|
-
*/
|
|
181
|
-
pageUrl?: (href: string) => string;
|
|
182
|
-
/** `false` stops uncaught errors / unhandled rejections from being reported (`captureException` still works). */
|
|
183
|
-
captureErrors?: boolean;
|
|
184
|
-
/**
|
|
185
|
-
* `false` never records sessions on this installation. An object can only make masking stricter:
|
|
186
|
-
* `maskAllText` masks every text node, `blockSelectors` replaces matching elements with a placeholder.
|
|
187
|
-
*/
|
|
188
|
-
sessionReplay?: boolean | {
|
|
189
|
-
maskAllText?: boolean;
|
|
190
|
-
blockSelectors?: string[];
|
|
191
|
-
/** `false`: never record network requests / WebSockets in replays. */
|
|
192
|
-
recordNetwork?: false;
|
|
193
|
-
/** `false`: never record request/response headers, bodies or WebSocket frame data. */
|
|
194
|
-
recordNetworkPayloads?: false;
|
|
195
|
-
/** Last say over each recorded request (applied after redaction): return a modified copy, or null to drop it. */
|
|
196
|
-
maskNetworkRequest?: (request: NetworkRequest) => NetworkRequest | null;
|
|
197
|
-
};
|
|
198
|
-
onError?: (error: Error) => void;
|
|
199
|
-
/**
|
|
200
|
-
* Language for guides and the resource center (BCP 47, e.g. `fr` or `pt-BR`). Defaults to the
|
|
201
|
-
* user's `language` / `locale` trait, then the browser language; see also `setLocale()`.
|
|
202
|
-
*/
|
|
203
|
-
locale?: string;
|
|
204
|
-
/** Overrides for the project theme (colors, radius, font). */
|
|
205
|
-
theme?: Partial<ProjectTheme>;
|
|
206
|
-
/** Identify this user as soon as the client initialises. */
|
|
207
|
-
user?: GuidelyUser;
|
|
208
|
-
/** Custom fetch (tests / polyfills). */
|
|
209
|
-
fetch?: typeof fetch;
|
|
210
|
-
/** Disable the authoring-mode and how-to capture URL parameter detection. */
|
|
211
|
-
disableAuthoring?: boolean;
|
|
212
|
-
/**
|
|
213
|
-
* Feature flags (on by default, same key and API URL). `false` turns them off (getters return
|
|
214
|
-
* fallbacks, nothing is fetched); an object passes options to the flags client, e.g.
|
|
215
|
-
* `{ payload }` to bootstrap from server rendering, `{ attributes }`, `{ remoteEval: true }`,
|
|
216
|
-
* `{ pollingMode: "stream" }`. Identity, page and device attributes are maintained for you.
|
|
217
|
-
*/
|
|
218
|
-
flags?: false | Partial<FlagsClientOptions>;
|
|
219
|
-
/**
|
|
220
|
-
* Agent Analytics (`agentConversation()`): `redact` gets each turn before it leaves the browser and
|
|
221
|
-
* returns a changed copy (e.g. with personal details removed from `text`), or null to drop it.
|
|
222
|
-
*/
|
|
223
|
-
agents?: {
|
|
224
|
-
redact?: AgentTurnRedactor;
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
interface ChecklistProgressState {
|
|
228
|
-
completedTaskIds: string[];
|
|
229
|
-
completedAt?: string | null;
|
|
230
|
-
dismissedAt?: string | null;
|
|
231
|
-
/** The server's last dismissal reset this device applied (see `dismissedAfterMerge`). */
|
|
232
|
-
dismissResetAt?: string | null;
|
|
233
|
-
}
|
|
234
|
-
/** Everything the client persists per project key (`guidely:state:<key>`). */
|
|
235
|
-
interface PersistedState {
|
|
236
|
-
guides: Record<string, GuideLocalState>;
|
|
237
|
-
checklists: Record<string, ChecklistProgressState>;
|
|
238
|
-
surveysSubmitted: string[];
|
|
239
|
-
audienceIds: string[];
|
|
240
|
-
firstSeenAt?: string;
|
|
241
|
-
/** ISO times of automatic launches that count toward guide throttling (pruned to the window). */
|
|
242
|
-
throttle?: string[];
|
|
243
|
-
/** When the visitor last opened the resource center's "What's new" (unread badge). */
|
|
244
|
-
announcementsSeenAt?: string;
|
|
245
|
-
}
|
|
246
|
-
interface SessionState {
|
|
247
|
-
id: string;
|
|
248
|
-
startedAt: string;
|
|
249
|
-
shownGuides: string[];
|
|
250
|
-
events: string[];
|
|
251
|
-
/** Epoch ms of the last tracked activity; the session rotates after `sessionTimeoutMinutes` of inactivity. */
|
|
252
|
-
lastActivityAt?: number;
|
|
253
|
-
/** Page views sent in this session (the first one carries the referrer). */
|
|
254
|
-
pageViews?: number;
|
|
255
|
-
/** Exceptions reported in this session (capped at 100). */
|
|
256
|
-
exceptions?: number;
|
|
257
|
-
/** Replay decision for this session: sampled in / forced (`true`), sampled out or disabled by the server (`false`). */
|
|
258
|
-
replay?: boolean;
|
|
259
|
-
}
|
|
260
|
-
interface GuideStepInfo {
|
|
261
|
-
guide: PublishedGuide;
|
|
262
|
-
stepId: string;
|
|
263
|
-
stepIndex: number;
|
|
264
|
-
}
|
|
265
|
-
interface GuidelyEvents {
|
|
266
|
-
/** Config loaded (from network or cache) and triggers evaluated. */
|
|
267
|
-
ready: (config: SdkConfigResponse) => void;
|
|
268
|
-
/** Config (re)loaded. */
|
|
269
|
-
config: (config: SdkConfigResponse) => void;
|
|
270
|
-
"guide:start": (guide: PublishedGuide) => void;
|
|
271
|
-
"guide:step": (info: GuideStepInfo) => void;
|
|
272
|
-
"guide:complete": (guide: PublishedGuide) => void;
|
|
273
|
-
"guide:dismiss": (guide: PublishedGuide) => void;
|
|
274
|
-
"guide:skip": (guide: PublishedGuide) => void;
|
|
275
|
-
"checklist:task": (info: {
|
|
276
|
-
guide: PublishedGuide;
|
|
277
|
-
task: ChecklistTask;
|
|
278
|
-
progress: ChecklistProgressState;
|
|
279
|
-
}) => void;
|
|
280
|
-
"checklist:complete": (guide: PublishedGuide) => void;
|
|
281
|
-
"survey:submit": (info: {
|
|
282
|
-
guide: PublishedGuide;
|
|
283
|
-
answers: Record<string, unknown>;
|
|
284
|
-
responseId: string;
|
|
285
|
-
}) => void;
|
|
286
|
-
"resource-center:open": () => void;
|
|
287
|
-
"messenger:open": () => void;
|
|
288
|
-
/** A Scout or teammate message arrived in the messenger. */
|
|
289
|
-
"conversation:message": (info: {
|
|
290
|
-
message: MessengerMessage;
|
|
291
|
-
conversation: MessengerConversation;
|
|
292
|
-
}) => void;
|
|
293
|
-
error: (error: Error) => void;
|
|
294
|
-
/** Every tracked event (custom and lifecycle). */
|
|
295
|
-
track: (event: SdkEvent) => void;
|
|
296
|
-
identify: (info: {
|
|
297
|
-
userId: string | null;
|
|
298
|
-
anonymousId: string;
|
|
299
|
-
}) => void;
|
|
300
|
-
authoring: (info: {
|
|
301
|
-
active: boolean;
|
|
302
|
-
}) => void;
|
|
303
|
-
/** How-to capture (recording steps for a how-to guide) started or ended in this tab. */
|
|
304
|
-
capture: (info: {
|
|
305
|
-
active: boolean;
|
|
306
|
-
}) => void;
|
|
307
|
-
/** Feature flags loaded (bootstrap, cache or network) — or failed to and serve fallbacks. */
|
|
308
|
-
"flags:ready": () => void;
|
|
309
|
-
/** New flag rules arrived (attribute changes notify `onFlagsChange` subscribers instead). */
|
|
310
|
-
"flags:change": () => void;
|
|
311
|
-
}
|
|
312
|
-
type GuidelyEventName = keyof GuidelyEvents;
|
|
313
|
-
|
|
314
|
-
export { type AgentTurnRedactor as A, type ChecklistProgressState as C, EventQueue as E, type GuideLocalState as G, type PersistedState as P, type SessionState as S, type ConsentState as a, type EventQueueOptions as b, type GuidelyAccount as c, type GuidelyEnvironment as d, type GuidelyUser as e, areMutuallyExclusive as f, countsTowardThrottle as g, dismissedAfterMerge as h, isExclusiveGuide as i, isFrequencyEligible as j, isThrottleEligible as k, isWithinSchedule as l, type GuidelyOptions as m, type GuidelyEvents as n, type GuideStepInfo as o, pruneLaunches as p, type GuidelyEventName as q };
|