@guidelytech/shared 0.14.0 → 0.16.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/dist/{chunk-XJXXVV3C.js → chunk-7PWYIAJI.js} +30 -1
- package/dist/chunk-7PWYIAJI.js.map +1 -0
- package/dist/index.cjs +74 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +231 -645
- package/dist/index.d.ts +231 -645
- package/dist/index.js +49 -10
- package/dist/index.js.map +1 -1
- package/dist/runtime-CAtOOY7X.d.cts +3047 -0
- package/dist/runtime-CAtOOY7X.d.ts +3047 -0
- package/dist/runtime.cjs +35 -0
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +13 -1
- package/package.json +3 -3
- package/dist/chunk-OLWGMDRX.js +0 -729
- package/dist/chunk-OLWGMDRX.js.map +0 -1
- package/dist/chunk-TGIUEYXM.js +0 -1937
- package/dist/chunk-TGIUEYXM.js.map +0 -1
- package/dist/chunk-UW6NRYRY.js +0 -809
- package/dist/chunk-UW6NRYRY.js.map +0 -1
- package/dist/chunk-XJXXVV3C.js.map +0 -1
- package/dist/runtime-BM5cztmJ.d.cts +0 -5234
- package/dist/runtime-BM5cztmJ.d.ts +0 -5234
- package/dist/runtime-BeSHQtNX.d.cts +0 -5263
- package/dist/runtime-BeSHQtNX.d.ts +0 -5263
|
@@ -0,0 +1,3047 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** FNV-1a 32-bit hash; deterministic across SDK and server for rollout bucketing. */
|
|
4
|
+
declare function fnv1a(input: string): number;
|
|
5
|
+
/** Deterministic 0-99 bucket for percentage rollouts. */
|
|
6
|
+
declare function rolloutBucket(subject: string, salt: string): number;
|
|
7
|
+
declare function slugify(input: string): string;
|
|
8
|
+
/** URL-safe random id. Uses crypto when available, falls back to Math.random (ids are not secrets). */
|
|
9
|
+
declare function randomId(size?: number): string;
|
|
10
|
+
declare function isPlainObject(v: unknown): v is Record<string, unknown>;
|
|
11
|
+
/** Safe nested getter: get(obj, "account.plan") */
|
|
12
|
+
declare function getPath(obj: unknown, path: string): unknown;
|
|
13
|
+
declare function clamp(n: number, min: number, max: number): number;
|
|
14
|
+
/** Glob-style URL pattern match: `*` matches any chars except `/`, `**` matches anything. */
|
|
15
|
+
declare function matchUrlPattern(pattern: string, url: string): boolean;
|
|
16
|
+
declare function stripOrigin(url: string): string;
|
|
17
|
+
/** Safe regexp construction with a length cap to limit ReDoS exposure. */
|
|
18
|
+
declare function safeRegExp(source: string, flags?: string): RegExp | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Cross-platform helpers shared by the web SDK, the React Native SDK and (as a reference for) the
|
|
22
|
+
* native iOS/Android SDKs. Zod-free so it can ship in runtime bundles.
|
|
23
|
+
*/
|
|
24
|
+
/** Platforms a guide can be delivered to. */
|
|
25
|
+
declare const PLATFORMS: readonly ["web", "ios", "android"];
|
|
26
|
+
type Platform = (typeof PLATFORMS)[number];
|
|
27
|
+
/** Guides published before platforms existed have no `platforms` field and are web-only. */
|
|
28
|
+
declare const DEFAULT_PLATFORMS: Platform[];
|
|
29
|
+
/** Platforms a guide config targets (missing field → web only). */
|
|
30
|
+
declare function guidePlatforms(config: {
|
|
31
|
+
platforms?: readonly string[] | null;
|
|
32
|
+
}): string[];
|
|
33
|
+
declare function supportsPlatform(config: {
|
|
34
|
+
platforms?: readonly string[] | null;
|
|
35
|
+
}, platform: string): boolean;
|
|
36
|
+
/** Attribute web apps put on elements to share a target id with their mobile apps. */
|
|
37
|
+
declare const GUIDELY_ID_ATTRIBUTE = "data-guidely-id";
|
|
38
|
+
/**
|
|
39
|
+
* Extracts a Guidely target id from a trigger / advance / checklist value so the same guide works on
|
|
40
|
+
* web and mobile. Accepts a bare id (`new-deal`), `#new-deal`, or `[data-guidely-id="new-deal"]`
|
|
41
|
+
* (also `data-testid` / `data-tour`). Returns null for selectors that cannot name a single id.
|
|
42
|
+
*/
|
|
43
|
+
declare function guidelyIdFromSelector(value: string | null | undefined): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Mobile SDKs have screens instead of URLs. URL-based features (URL patterns, `url_match` triggers,
|
|
46
|
+
* multi-page steps, `url_visited` checklist tasks) match against the screen path `/<ScreenName>`.
|
|
47
|
+
*/
|
|
48
|
+
declare function screenPath(screen: string | null | undefined): string;
|
|
49
|
+
/**
|
|
50
|
+
* Compares dotted version strings numerically (`2.10.0` > `2.9.3`). Non-numeric parts compare as
|
|
51
|
+
* strings; a missing part counts as 0 (`2.1` == `2.1.0`). Returns -1, 0 or 1, or null when either
|
|
52
|
+
* side is empty.
|
|
53
|
+
*/
|
|
54
|
+
declare function compareVersions(a: unknown, b: unknown): -1 | 0 | 1 | null;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Pure checklist / survey logic shared by every renderer (web runtime, React Native, and the
|
|
58
|
+
* reference for the native SDKs). Zod-free; uses structural types so it stays in the runtime entry.
|
|
59
|
+
*/
|
|
60
|
+
type SurveyAnswer = string | number | boolean | string[];
|
|
61
|
+
type SurveyAnswers = Record<string, SurveyAnswer>;
|
|
62
|
+
interface ShowWhen {
|
|
63
|
+
questionId: string;
|
|
64
|
+
op: "equals" | "lte" | "gte" | "in";
|
|
65
|
+
value: string | number | string[];
|
|
66
|
+
}
|
|
67
|
+
/** Evaluates a question's `showWhen` condition against current answers. */
|
|
68
|
+
declare function isQuestionVisible(q: {
|
|
69
|
+
showWhen?: ShowWhen;
|
|
70
|
+
}, answers: SurveyAnswers): boolean;
|
|
71
|
+
/** Are all required tasks done? */
|
|
72
|
+
declare function isChecklistComplete(config: {
|
|
73
|
+
tasks: Array<{
|
|
74
|
+
id: string;
|
|
75
|
+
required: boolean;
|
|
76
|
+
}>;
|
|
77
|
+
}, progress: {
|
|
78
|
+
completedTaskIds: string[];
|
|
79
|
+
}): boolean;
|
|
80
|
+
|
|
81
|
+
declare const RULE_OPERATORS: readonly ["equals", "not_equals", "contains", "not_contains", "starts_with", "ends_with", "exists", "not_exists", "gt", "gte", "lt", "lte", "in", "not_in", "regex", "is_true", "is_false", "before", "after"];
|
|
82
|
+
type RuleOperator = (typeof RULE_OPERATORS)[number];
|
|
83
|
+
declare const RULE_FIELDS: readonly ["user.attribute", "account.attribute", "user.role", "user.plan", "user.identified", "url.path", "url.full", "url.query", "device.type", "device.browser", "device.os", "visitor.firstVisit", "visitor.returning", "event.seen", "guide.completed", "guide.dismissed", "guide.seen", "checklist.completed", "audience.member", "datetime.now", "datetime.dayOfWeek", "datetime.hour", "rollout.percentage", "experiment.bucket", "environment", "locale", "app.platform", "app.screen", "app.version", "page.views", "feature.clicks"];
|
|
84
|
+
type RuleField = (typeof RULE_FIELDS)[number];
|
|
85
|
+
interface Rule {
|
|
86
|
+
id: string;
|
|
87
|
+
field: RuleField;
|
|
88
|
+
/** For attribute/query/event fields: the attribute key, query param name, event name, guide id... */
|
|
89
|
+
key?: string;
|
|
90
|
+
op: RuleOperator;
|
|
91
|
+
value?: string | number | boolean | string[];
|
|
92
|
+
/** When true, the rule is negated (exclusion rule). */
|
|
93
|
+
negate?: boolean;
|
|
94
|
+
}
|
|
95
|
+
type RuleGroup = {
|
|
96
|
+
id: string;
|
|
97
|
+
op: "and" | "or";
|
|
98
|
+
rules: Array<Rule | RuleGroup>;
|
|
99
|
+
negate?: boolean;
|
|
100
|
+
};
|
|
101
|
+
declare function isRuleGroup(r: Rule | RuleGroup): r is RuleGroup;
|
|
102
|
+
declare function emptyRuleGroup(id?: string): RuleGroup;
|
|
103
|
+
/** Everything targeting evaluation can see. Built by the SDK (browser) or the server. */
|
|
104
|
+
interface TargetingContext {
|
|
105
|
+
userId?: string | null;
|
|
106
|
+
anonymousId: string;
|
|
107
|
+
userAttributes: Record<string, unknown>;
|
|
108
|
+
accountAttributes: Record<string, unknown>;
|
|
109
|
+
url: string;
|
|
110
|
+
path: string;
|
|
111
|
+
query: Record<string, string>;
|
|
112
|
+
device: {
|
|
113
|
+
type: "desktop" | "tablet" | "mobile";
|
|
114
|
+
browser?: string;
|
|
115
|
+
os?: string;
|
|
116
|
+
};
|
|
117
|
+
firstVisit: boolean;
|
|
118
|
+
eventsSeen: Set<string> | string[];
|
|
119
|
+
completedGuides: Set<string> | string[];
|
|
120
|
+
dismissedGuides: Set<string> | string[];
|
|
121
|
+
seenGuides: Set<string> | string[];
|
|
122
|
+
completedChecklists: Set<string> | string[];
|
|
123
|
+
audienceIds: Set<string> | string[];
|
|
124
|
+
now: Date;
|
|
125
|
+
environment: string;
|
|
126
|
+
locale?: string;
|
|
127
|
+
/** `web`, `ios` or `android`. Missing means web. */
|
|
128
|
+
platform?: string;
|
|
129
|
+
/** Current screen name (mobile SDKs; set via `screen()`). */
|
|
130
|
+
screen?: string;
|
|
131
|
+
/** Host app version (mobile SDKs), e.g. `2.4.1`. */
|
|
132
|
+
appVersion?: string;
|
|
133
|
+
/** Salt for rollout (guide id). Set per guide before evaluating. */
|
|
134
|
+
rolloutSalt?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Views of tagged pages / clicks on tagged features in the last 30 days, by tag id. Only the server
|
|
137
|
+
* fills it (audience evaluation); in the browser `page.views` / `feature.clicks` read 0.
|
|
138
|
+
*/
|
|
139
|
+
tagUsage?: Record<string, number>;
|
|
140
|
+
}
|
|
141
|
+
declare function compare(op: RuleOperator, actual: unknown, expected: Rule["value"]): boolean;
|
|
142
|
+
declare function evaluateRule(rule: Rule, ctx: TargetingContext): boolean;
|
|
143
|
+
/** Evaluate a rule tree. An empty group matches everyone. */
|
|
144
|
+
declare function evaluateRules(group: RuleGroup | null | undefined, ctx: TargetingContext): boolean;
|
|
145
|
+
/** Fields whose evaluation requires server-held data. Used by docs/UI to annotate rules. */
|
|
146
|
+
declare const SERVER_ASSISTED_FIELDS: RuleField[];
|
|
147
|
+
/** Who a guide is shown to, before its targeting rules: everyone, only signed-in (identified) users, or only anonymous visitors. */
|
|
148
|
+
declare const GUIDE_VISIBILITIES: readonly ["everyone", "identified", "anonymous"];
|
|
149
|
+
type GuideVisibility = (typeof GUIDE_VISIBILITIES)[number];
|
|
150
|
+
/**
|
|
151
|
+
* Targeting with the visibility folded in as a `user.identified` rule. The server sends guides to SDKs
|
|
152
|
+
* this way, so every SDK applies it through the rules it already evaluates (SDKs that predate the field
|
|
153
|
+
* resolve it as undefined and show the guide to nobody rather than to everyone).
|
|
154
|
+
*/
|
|
155
|
+
declare function withVisibility(targeting: RuleGroup, visibility: GuideVisibility | undefined): RuleGroup;
|
|
156
|
+
declare function describeRule(rule: Rule): string;
|
|
157
|
+
|
|
158
|
+
declare const GUIDE_KINDS: readonly ["flow", "modal", "tooltip", "banner", "checklist", "survey", "announcement"];
|
|
159
|
+
type GuideKind = (typeof GUIDE_KINDS)[number];
|
|
160
|
+
declare const GUIDE_STATUSES: readonly ["draft", "published", "paused", "archived"];
|
|
161
|
+
type GuideStatus = (typeof GUIDE_STATUSES)[number];
|
|
162
|
+
declare const STEP_TYPES: readonly ["modal", "tooltip", "popover", "spotlight", "hotspot", "banner", "slideout", "checklist", "custom", "survey"];
|
|
163
|
+
type StepType = (typeof STEP_TYPES)[number];
|
|
164
|
+
declare const PLACEMENTS: readonly ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "auto"];
|
|
165
|
+
type Placement = (typeof PLACEMENTS)[number];
|
|
166
|
+
/** `guidely-id` is cross-platform: `data-guidely-id` on web, `GuidelyTarget` / `guidelyTarget()` on mobile. */
|
|
167
|
+
declare const SELECTOR_KINDS: readonly ["css", "id", "data-attr", "aria", "text", "xpath", "guidely-id"];
|
|
168
|
+
declare const SelectorStrategySchema: z.ZodObject<{
|
|
169
|
+
kind: z.ZodEnum<{
|
|
170
|
+
id: "id";
|
|
171
|
+
text: "text";
|
|
172
|
+
css: "css";
|
|
173
|
+
"data-attr": "data-attr";
|
|
174
|
+
aria: "aria";
|
|
175
|
+
xpath: "xpath";
|
|
176
|
+
"guidely-id": "guidely-id";
|
|
177
|
+
}>;
|
|
178
|
+
value: z.ZodString;
|
|
179
|
+
label: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
type SelectorStrategy = z.infer<typeof SelectorStrategySchema>;
|
|
182
|
+
declare const TargetSchema: z.ZodObject<{
|
|
183
|
+
selectors: z.ZodArray<z.ZodObject<{
|
|
184
|
+
kind: z.ZodEnum<{
|
|
185
|
+
id: "id";
|
|
186
|
+
text: "text";
|
|
187
|
+
css: "css";
|
|
188
|
+
"data-attr": "data-attr";
|
|
189
|
+
aria: "aria";
|
|
190
|
+
xpath: "xpath";
|
|
191
|
+
"guidely-id": "guidely-id";
|
|
192
|
+
}>;
|
|
193
|
+
value: z.ZodString;
|
|
194
|
+
label: z.ZodOptional<z.ZodString>;
|
|
195
|
+
}, z.core.$strip>>;
|
|
196
|
+
waitMs: z.ZodDefault<z.ZodNumber>;
|
|
197
|
+
fallback: z.ZodDefault<z.ZodEnum<{
|
|
198
|
+
skip: "skip";
|
|
199
|
+
show_as_modal: "show_as_modal";
|
|
200
|
+
end_guide: "end_guide";
|
|
201
|
+
wait: "wait";
|
|
202
|
+
}>>;
|
|
203
|
+
scrollIntoView: z.ZodDefault<z.ZodBoolean>;
|
|
204
|
+
textSnapshot: z.ZodOptional<z.ZodString>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
type StepTarget = z.infer<typeof TargetSchema>;
|
|
207
|
+
declare const BUTTON_ACTIONS: readonly ["next", "back", "dismiss", "complete", "skip", "url", "start_guide", "event", "open_resource_center", "none"];
|
|
208
|
+
declare const ButtonSchema: z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
label: z.ZodString;
|
|
211
|
+
action: z.ZodEnum<{
|
|
212
|
+
skip: "skip";
|
|
213
|
+
next: "next";
|
|
214
|
+
back: "back";
|
|
215
|
+
dismiss: "dismiss";
|
|
216
|
+
complete: "complete";
|
|
217
|
+
url: "url";
|
|
218
|
+
start_guide: "start_guide";
|
|
219
|
+
event: "event";
|
|
220
|
+
open_resource_center: "open_resource_center";
|
|
221
|
+
none: "none";
|
|
222
|
+
}>;
|
|
223
|
+
variant: z.ZodDefault<z.ZodEnum<{
|
|
224
|
+
link: "link";
|
|
225
|
+
primary: "primary";
|
|
226
|
+
secondary: "secondary";
|
|
227
|
+
ghost: "ghost";
|
|
228
|
+
}>>;
|
|
229
|
+
value: z.ZodOptional<z.ZodString>;
|
|
230
|
+
newTab: z.ZodOptional<z.ZodBoolean>;
|
|
231
|
+
}, z.core.$strip>;
|
|
232
|
+
type StepButton = z.infer<typeof ButtonSchema>;
|
|
233
|
+
declare const StepBranchSchema: z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
when: z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>;
|
|
236
|
+
goTo: z.ZodString;
|
|
237
|
+
}, z.core.$strip>;
|
|
238
|
+
declare const ADVANCE_ON: readonly ["button", "element_click", "element_visible", "event", "delay", "any"];
|
|
239
|
+
declare const StepSchema: z.ZodObject<{
|
|
240
|
+
id: z.ZodString;
|
|
241
|
+
type: z.ZodEnum<{
|
|
242
|
+
custom: "custom";
|
|
243
|
+
modal: "modal";
|
|
244
|
+
tooltip: "tooltip";
|
|
245
|
+
banner: "banner";
|
|
246
|
+
checklist: "checklist";
|
|
247
|
+
survey: "survey";
|
|
248
|
+
popover: "popover";
|
|
249
|
+
spotlight: "spotlight";
|
|
250
|
+
hotspot: "hotspot";
|
|
251
|
+
slideout: "slideout";
|
|
252
|
+
}>;
|
|
253
|
+
title: z.ZodDefault<z.ZodString>;
|
|
254
|
+
body: z.ZodDefault<z.ZodString>;
|
|
255
|
+
imageUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
256
|
+
imageAlt: z.ZodOptional<z.ZodString>;
|
|
257
|
+
videoUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
258
|
+
buttons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
259
|
+
id: z.ZodString;
|
|
260
|
+
label: z.ZodString;
|
|
261
|
+
action: z.ZodEnum<{
|
|
262
|
+
skip: "skip";
|
|
263
|
+
next: "next";
|
|
264
|
+
back: "back";
|
|
265
|
+
dismiss: "dismiss";
|
|
266
|
+
complete: "complete";
|
|
267
|
+
url: "url";
|
|
268
|
+
start_guide: "start_guide";
|
|
269
|
+
event: "event";
|
|
270
|
+
open_resource_center: "open_resource_center";
|
|
271
|
+
none: "none";
|
|
272
|
+
}>;
|
|
273
|
+
variant: z.ZodDefault<z.ZodEnum<{
|
|
274
|
+
link: "link";
|
|
275
|
+
primary: "primary";
|
|
276
|
+
secondary: "secondary";
|
|
277
|
+
ghost: "ghost";
|
|
278
|
+
}>>;
|
|
279
|
+
value: z.ZodOptional<z.ZodString>;
|
|
280
|
+
newTab: z.ZodOptional<z.ZodBoolean>;
|
|
281
|
+
}, z.core.$strip>>>;
|
|
282
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
283
|
+
selectors: z.ZodArray<z.ZodObject<{
|
|
284
|
+
kind: z.ZodEnum<{
|
|
285
|
+
id: "id";
|
|
286
|
+
text: "text";
|
|
287
|
+
css: "css";
|
|
288
|
+
"data-attr": "data-attr";
|
|
289
|
+
aria: "aria";
|
|
290
|
+
xpath: "xpath";
|
|
291
|
+
"guidely-id": "guidely-id";
|
|
292
|
+
}>;
|
|
293
|
+
value: z.ZodString;
|
|
294
|
+
label: z.ZodOptional<z.ZodString>;
|
|
295
|
+
}, z.core.$strip>>;
|
|
296
|
+
waitMs: z.ZodDefault<z.ZodNumber>;
|
|
297
|
+
fallback: z.ZodDefault<z.ZodEnum<{
|
|
298
|
+
skip: "skip";
|
|
299
|
+
show_as_modal: "show_as_modal";
|
|
300
|
+
end_guide: "end_guide";
|
|
301
|
+
wait: "wait";
|
|
302
|
+
}>>;
|
|
303
|
+
scrollIntoView: z.ZodDefault<z.ZodBoolean>;
|
|
304
|
+
textSnapshot: z.ZodOptional<z.ZodString>;
|
|
305
|
+
}, z.core.$strip>>;
|
|
306
|
+
placement: z.ZodDefault<z.ZodEnum<{
|
|
307
|
+
top: "top";
|
|
308
|
+
"top-start": "top-start";
|
|
309
|
+
"top-end": "top-end";
|
|
310
|
+
right: "right";
|
|
311
|
+
"right-start": "right-start";
|
|
312
|
+
"right-end": "right-end";
|
|
313
|
+
bottom: "bottom";
|
|
314
|
+
"bottom-start": "bottom-start";
|
|
315
|
+
"bottom-end": "bottom-end";
|
|
316
|
+
left: "left";
|
|
317
|
+
"left-start": "left-start";
|
|
318
|
+
"left-end": "left-end";
|
|
319
|
+
auto: "auto";
|
|
320
|
+
}>>;
|
|
321
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
322
|
+
showOverlay: z.ZodDefault<z.ZodBoolean>;
|
|
323
|
+
showProgress: z.ZodDefault<z.ZodBoolean>;
|
|
324
|
+
showClose: z.ZodDefault<z.ZodBoolean>;
|
|
325
|
+
dismissOnOutsideClick: z.ZodDefault<z.ZodBoolean>;
|
|
326
|
+
spotlightPadding: z.ZodDefault<z.ZodNumber>;
|
|
327
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
328
|
+
top: "top";
|
|
329
|
+
bottom: "bottom";
|
|
330
|
+
"top-left": "top-left";
|
|
331
|
+
"top-right": "top-right";
|
|
332
|
+
"bottom-left": "bottom-left";
|
|
333
|
+
"bottom-right": "bottom-right";
|
|
334
|
+
center: "center";
|
|
335
|
+
}>>;
|
|
336
|
+
url: z.ZodOptional<z.ZodString>;
|
|
337
|
+
advanceOn: z.ZodDefault<z.ZodEnum<{
|
|
338
|
+
any: "any";
|
|
339
|
+
button: "button";
|
|
340
|
+
event: "event";
|
|
341
|
+
element_click: "element_click";
|
|
342
|
+
element_visible: "element_visible";
|
|
343
|
+
delay: "delay";
|
|
344
|
+
}>>;
|
|
345
|
+
advanceValue: z.ZodOptional<z.ZodString>;
|
|
346
|
+
advanceDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
347
|
+
branches: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
348
|
+
id: z.ZodString;
|
|
349
|
+
when: z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>;
|
|
350
|
+
goTo: z.ZodString;
|
|
351
|
+
}, z.core.$strip>>>;
|
|
352
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
353
|
+
targeting: z.ZodOptional<z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>>;
|
|
354
|
+
hotspot: z.ZodOptional<z.ZodObject<{
|
|
355
|
+
size: z.ZodDefault<z.ZodNumber>;
|
|
356
|
+
pulse: z.ZodDefault<z.ZodBoolean>;
|
|
357
|
+
openOn: z.ZodDefault<z.ZodEnum<{
|
|
358
|
+
click: "click";
|
|
359
|
+
hover: "hover";
|
|
360
|
+
}>>;
|
|
361
|
+
}, z.core.$strip>>;
|
|
362
|
+
customHtml: z.ZodOptional<z.ZodString>;
|
|
363
|
+
code: z.ZodOptional<z.ZodString>;
|
|
364
|
+
}, z.core.$strip>;
|
|
365
|
+
type GuideStep = z.infer<typeof StepSchema>;
|
|
366
|
+
type GuideStepInput = z.input<typeof StepSchema>;
|
|
367
|
+
declare const TRIGGER_TYPES: readonly ["page_load", "url_match", "event", "element_click", "element_visible", "manual", "delay", "after_guide", "segment_enter"];
|
|
368
|
+
declare const TriggerSchema: z.ZodObject<{
|
|
369
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
370
|
+
event: "event";
|
|
371
|
+
element_click: "element_click";
|
|
372
|
+
element_visible: "element_visible";
|
|
373
|
+
delay: "delay";
|
|
374
|
+
page_load: "page_load";
|
|
375
|
+
url_match: "url_match";
|
|
376
|
+
manual: "manual";
|
|
377
|
+
after_guide: "after_guide";
|
|
378
|
+
segment_enter: "segment_enter";
|
|
379
|
+
}>>;
|
|
380
|
+
value: z.ZodOptional<z.ZodString>;
|
|
381
|
+
delayMs: z.ZodDefault<z.ZodNumber>;
|
|
382
|
+
urlPattern: z.ZodOptional<z.ZodString>;
|
|
383
|
+
}, z.core.$strip>;
|
|
384
|
+
type TriggerConfig = z.infer<typeof TriggerSchema>;
|
|
385
|
+
declare const FrequencySchema: z.ZodObject<{
|
|
386
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
387
|
+
once: "once";
|
|
388
|
+
once_per_session: "once_per_session";
|
|
389
|
+
every_time: "every_time";
|
|
390
|
+
interval: "interval";
|
|
391
|
+
}>>;
|
|
392
|
+
intervalHours: z.ZodOptional<z.ZodNumber>;
|
|
393
|
+
maxImpressions: z.ZodOptional<z.ZodNumber>;
|
|
394
|
+
cooldownHours: z.ZodDefault<z.ZodNumber>;
|
|
395
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
396
|
+
mutuallyExclusiveWith: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
397
|
+
reshowAfterDismiss: z.ZodDefault<z.ZodBoolean>;
|
|
398
|
+
ignoreThrottling: z.ZodOptional<z.ZodBoolean>;
|
|
399
|
+
}, z.core.$strip>;
|
|
400
|
+
type FrequencyConfig = z.infer<typeof FrequencySchema>;
|
|
401
|
+
declare const AppearanceSchema: z.ZodObject<{
|
|
402
|
+
theme: z.ZodDefault<z.ZodEnum<{
|
|
403
|
+
auto: "auto";
|
|
404
|
+
light: "light";
|
|
405
|
+
dark: "dark";
|
|
406
|
+
}>>;
|
|
407
|
+
primaryColor: z.ZodOptional<z.ZodString>;
|
|
408
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
409
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
410
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
411
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
412
|
+
overlayOpacity: z.ZodOptional<z.ZodNumber>;
|
|
413
|
+
zIndex: z.ZodOptional<z.ZodNumber>;
|
|
414
|
+
preset: z.ZodOptional<z.ZodString>;
|
|
415
|
+
animation: z.ZodDefault<z.ZodEnum<{
|
|
416
|
+
none: "none";
|
|
417
|
+
fade: "fade";
|
|
418
|
+
slide: "slide";
|
|
419
|
+
}>>;
|
|
420
|
+
customCss: z.ZodOptional<z.ZodString>;
|
|
421
|
+
}, z.core.$strip>;
|
|
422
|
+
type Appearance = z.infer<typeof AppearanceSchema>;
|
|
423
|
+
declare const ChecklistTaskSchema: z.ZodObject<{
|
|
424
|
+
id: z.ZodString;
|
|
425
|
+
title: z.ZodString;
|
|
426
|
+
description: z.ZodDefault<z.ZodString>;
|
|
427
|
+
completion: z.ZodDefault<z.ZodEnum<{
|
|
428
|
+
event: "event";
|
|
429
|
+
click: "click";
|
|
430
|
+
manual: "manual";
|
|
431
|
+
guide_completed: "guide_completed";
|
|
432
|
+
url_visited: "url_visited";
|
|
433
|
+
}>>;
|
|
434
|
+
completionValue: z.ZodOptional<z.ZodString>;
|
|
435
|
+
action: z.ZodDefault<z.ZodEnum<{
|
|
436
|
+
url: "url";
|
|
437
|
+
start_guide: "start_guide";
|
|
438
|
+
event: "event";
|
|
439
|
+
none: "none";
|
|
440
|
+
}>>;
|
|
441
|
+
actionValue: z.ZodOptional<z.ZodString>;
|
|
442
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
443
|
+
}, z.core.$strip>;
|
|
444
|
+
type ChecklistTask = z.infer<typeof ChecklistTaskSchema>;
|
|
445
|
+
declare const ChecklistConfigSchema: z.ZodObject<{
|
|
446
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
447
|
+
id: z.ZodString;
|
|
448
|
+
title: z.ZodString;
|
|
449
|
+
description: z.ZodDefault<z.ZodString>;
|
|
450
|
+
completion: z.ZodDefault<z.ZodEnum<{
|
|
451
|
+
event: "event";
|
|
452
|
+
click: "click";
|
|
453
|
+
manual: "manual";
|
|
454
|
+
guide_completed: "guide_completed";
|
|
455
|
+
url_visited: "url_visited";
|
|
456
|
+
}>>;
|
|
457
|
+
completionValue: z.ZodOptional<z.ZodString>;
|
|
458
|
+
action: z.ZodDefault<z.ZodEnum<{
|
|
459
|
+
url: "url";
|
|
460
|
+
start_guide: "start_guide";
|
|
461
|
+
event: "event";
|
|
462
|
+
none: "none";
|
|
463
|
+
}>>;
|
|
464
|
+
actionValue: z.ZodOptional<z.ZodString>;
|
|
465
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
466
|
+
}, z.core.$strip>>;
|
|
467
|
+
ordered: z.ZodDefault<z.ZodBoolean>;
|
|
468
|
+
launcherLabel: z.ZodDefault<z.ZodString>;
|
|
469
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
470
|
+
"bottom-left": "bottom-left";
|
|
471
|
+
"bottom-right": "bottom-right";
|
|
472
|
+
}>>;
|
|
473
|
+
completionTitle: z.ZodDefault<z.ZodString>;
|
|
474
|
+
completionBody: z.ZodDefault<z.ZodString>;
|
|
475
|
+
autoOpen: z.ZodDefault<z.ZodBoolean>;
|
|
476
|
+
dismissible: z.ZodDefault<z.ZodBoolean>;
|
|
477
|
+
}, z.core.$strip>;
|
|
478
|
+
type ChecklistConfig = z.infer<typeof ChecklistConfigSchema>;
|
|
479
|
+
declare const SURVEY_QUESTION_TYPES: readonly ["nps", "csat", "thumbs", "single_choice", "multiple_choice", "text", "rating"];
|
|
480
|
+
declare const SurveyQuestionSchema: z.ZodObject<{
|
|
481
|
+
id: z.ZodString;
|
|
482
|
+
type: z.ZodEnum<{
|
|
483
|
+
text: "text";
|
|
484
|
+
nps: "nps";
|
|
485
|
+
csat: "csat";
|
|
486
|
+
thumbs: "thumbs";
|
|
487
|
+
single_choice: "single_choice";
|
|
488
|
+
multiple_choice: "multiple_choice";
|
|
489
|
+
rating: "rating";
|
|
490
|
+
}>;
|
|
491
|
+
title: z.ZodString;
|
|
492
|
+
description: z.ZodDefault<z.ZodString>;
|
|
493
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
494
|
+
options: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
495
|
+
id: z.ZodString;
|
|
496
|
+
label: z.ZodString;
|
|
497
|
+
}, z.core.$strip>>>;
|
|
498
|
+
scaleMax: z.ZodOptional<z.ZodNumber>;
|
|
499
|
+
lowLabel: z.ZodOptional<z.ZodString>;
|
|
500
|
+
highLabel: z.ZodOptional<z.ZodString>;
|
|
501
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
502
|
+
showWhen: z.ZodOptional<z.ZodObject<{
|
|
503
|
+
questionId: z.ZodString;
|
|
504
|
+
op: z.ZodEnum<{
|
|
505
|
+
equals: "equals";
|
|
506
|
+
lte: "lte";
|
|
507
|
+
gte: "gte";
|
|
508
|
+
in: "in";
|
|
509
|
+
}>;
|
|
510
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>;
|
|
511
|
+
}, z.core.$strip>>;
|
|
512
|
+
}, z.core.$strip>;
|
|
513
|
+
type SurveyQuestion = z.infer<typeof SurveyQuestionSchema>;
|
|
514
|
+
declare const SurveyConfigSchema: z.ZodObject<{
|
|
515
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
516
|
+
id: z.ZodString;
|
|
517
|
+
type: z.ZodEnum<{
|
|
518
|
+
text: "text";
|
|
519
|
+
nps: "nps";
|
|
520
|
+
csat: "csat";
|
|
521
|
+
thumbs: "thumbs";
|
|
522
|
+
single_choice: "single_choice";
|
|
523
|
+
multiple_choice: "multiple_choice";
|
|
524
|
+
rating: "rating";
|
|
525
|
+
}>;
|
|
526
|
+
title: z.ZodString;
|
|
527
|
+
description: z.ZodDefault<z.ZodString>;
|
|
528
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
529
|
+
options: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
530
|
+
id: z.ZodString;
|
|
531
|
+
label: z.ZodString;
|
|
532
|
+
}, z.core.$strip>>>;
|
|
533
|
+
scaleMax: z.ZodOptional<z.ZodNumber>;
|
|
534
|
+
lowLabel: z.ZodOptional<z.ZodString>;
|
|
535
|
+
highLabel: z.ZodOptional<z.ZodString>;
|
|
536
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
537
|
+
showWhen: z.ZodOptional<z.ZodObject<{
|
|
538
|
+
questionId: z.ZodString;
|
|
539
|
+
op: z.ZodEnum<{
|
|
540
|
+
equals: "equals";
|
|
541
|
+
lte: "lte";
|
|
542
|
+
gte: "gte";
|
|
543
|
+
in: "in";
|
|
544
|
+
}>;
|
|
545
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>;
|
|
546
|
+
}, z.core.$strip>>;
|
|
547
|
+
}, z.core.$strip>>;
|
|
548
|
+
thankYouTitle: z.ZodDefault<z.ZodString>;
|
|
549
|
+
thankYouBody: z.ZodDefault<z.ZodString>;
|
|
550
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
551
|
+
"bottom-left": "bottom-left";
|
|
552
|
+
"bottom-right": "bottom-right";
|
|
553
|
+
center: "center";
|
|
554
|
+
}>>;
|
|
555
|
+
startAt: z.ZodOptional<z.ZodString>;
|
|
556
|
+
endAt: z.ZodOptional<z.ZodString>;
|
|
557
|
+
}, z.core.$strip>;
|
|
558
|
+
type SurveyConfig = z.infer<typeof SurveyConfigSchema>;
|
|
559
|
+
/**
|
|
560
|
+
* When any guide may show: `startAt` / `endAt` are UTC instants; `timezone` (IANA, e.g.
|
|
561
|
+
* `Europe/London`) is the zone they were entered in, kept for display only.
|
|
562
|
+
*/
|
|
563
|
+
declare const GuideScheduleSchema: z.ZodObject<{
|
|
564
|
+
startAt: z.ZodOptional<z.ZodString>;
|
|
565
|
+
endAt: z.ZodOptional<z.ZodString>;
|
|
566
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
567
|
+
}, z.core.$strip>;
|
|
568
|
+
type GuideSchedule = z.infer<typeof GuideScheduleSchema>;
|
|
569
|
+
/** Locale codes: BCP 47 language tags such as `fr`, `pt-BR`, `zh-Hans`. */
|
|
570
|
+
declare const LOCALE_PATTERN: RegExp;
|
|
571
|
+
declare const LocaleSchema: z.ZodString;
|
|
572
|
+
/**
|
|
573
|
+
* Translations of a guide's text: locale → translation key → text. Keys come from
|
|
574
|
+
* `guideTextEntries` (e.g. `steps.<stepId>.title`); missing keys fall back to the default language.
|
|
575
|
+
*/
|
|
576
|
+
declare const GuideLocalizationSchema: z.ZodObject<{
|
|
577
|
+
translations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
578
|
+
}, z.core.$strip>;
|
|
579
|
+
type GuideLocalization = z.infer<typeof GuideLocalizationSchema>;
|
|
580
|
+
/** Project.settings.localization: the language guides are written in and the languages offered for translation. */
|
|
581
|
+
declare const LocalizationSettingsSchema: z.ZodObject<{
|
|
582
|
+
defaultLocale: z.ZodDefault<z.ZodString>;
|
|
583
|
+
locales: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
584
|
+
autoTranslate: z.ZodOptional<z.ZodBoolean>;
|
|
585
|
+
requireReview: z.ZodOptional<z.ZodBoolean>;
|
|
586
|
+
}, z.core.$strip>;
|
|
587
|
+
/**
|
|
588
|
+
* Project.settings.guideThrottling: limits automatically launched guides per visitor (guides
|
|
589
|
+
* started by a button, a link, Help or `startGuide()` are never throttled; nor are banners,
|
|
590
|
+
* checklists and hotspot-only guides, which don't interrupt).
|
|
591
|
+
*/
|
|
592
|
+
declare const GuideThrottlingSchema: z.ZodObject<{
|
|
593
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
594
|
+
maxGuides: z.ZodDefault<z.ZodNumber>;
|
|
595
|
+
windowHours: z.ZodDefault<z.ZodNumber>;
|
|
596
|
+
minGapMinutes: z.ZodDefault<z.ZodNumber>;
|
|
597
|
+
}, z.core.$strip>;
|
|
598
|
+
declare const GuideConfigSchema: z.ZodObject<{
|
|
599
|
+
steps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
600
|
+
id: z.ZodString;
|
|
601
|
+
type: z.ZodEnum<{
|
|
602
|
+
custom: "custom";
|
|
603
|
+
modal: "modal";
|
|
604
|
+
tooltip: "tooltip";
|
|
605
|
+
banner: "banner";
|
|
606
|
+
checklist: "checklist";
|
|
607
|
+
survey: "survey";
|
|
608
|
+
popover: "popover";
|
|
609
|
+
spotlight: "spotlight";
|
|
610
|
+
hotspot: "hotspot";
|
|
611
|
+
slideout: "slideout";
|
|
612
|
+
}>;
|
|
613
|
+
title: z.ZodDefault<z.ZodString>;
|
|
614
|
+
body: z.ZodDefault<z.ZodString>;
|
|
615
|
+
imageUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
616
|
+
imageAlt: z.ZodOptional<z.ZodString>;
|
|
617
|
+
videoUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
618
|
+
buttons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
619
|
+
id: z.ZodString;
|
|
620
|
+
label: z.ZodString;
|
|
621
|
+
action: z.ZodEnum<{
|
|
622
|
+
skip: "skip";
|
|
623
|
+
next: "next";
|
|
624
|
+
back: "back";
|
|
625
|
+
dismiss: "dismiss";
|
|
626
|
+
complete: "complete";
|
|
627
|
+
url: "url";
|
|
628
|
+
start_guide: "start_guide";
|
|
629
|
+
event: "event";
|
|
630
|
+
open_resource_center: "open_resource_center";
|
|
631
|
+
none: "none";
|
|
632
|
+
}>;
|
|
633
|
+
variant: z.ZodDefault<z.ZodEnum<{
|
|
634
|
+
link: "link";
|
|
635
|
+
primary: "primary";
|
|
636
|
+
secondary: "secondary";
|
|
637
|
+
ghost: "ghost";
|
|
638
|
+
}>>;
|
|
639
|
+
value: z.ZodOptional<z.ZodString>;
|
|
640
|
+
newTab: z.ZodOptional<z.ZodBoolean>;
|
|
641
|
+
}, z.core.$strip>>>;
|
|
642
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
643
|
+
selectors: z.ZodArray<z.ZodObject<{
|
|
644
|
+
kind: z.ZodEnum<{
|
|
645
|
+
id: "id";
|
|
646
|
+
text: "text";
|
|
647
|
+
css: "css";
|
|
648
|
+
"data-attr": "data-attr";
|
|
649
|
+
aria: "aria";
|
|
650
|
+
xpath: "xpath";
|
|
651
|
+
"guidely-id": "guidely-id";
|
|
652
|
+
}>;
|
|
653
|
+
value: z.ZodString;
|
|
654
|
+
label: z.ZodOptional<z.ZodString>;
|
|
655
|
+
}, z.core.$strip>>;
|
|
656
|
+
waitMs: z.ZodDefault<z.ZodNumber>;
|
|
657
|
+
fallback: z.ZodDefault<z.ZodEnum<{
|
|
658
|
+
skip: "skip";
|
|
659
|
+
show_as_modal: "show_as_modal";
|
|
660
|
+
end_guide: "end_guide";
|
|
661
|
+
wait: "wait";
|
|
662
|
+
}>>;
|
|
663
|
+
scrollIntoView: z.ZodDefault<z.ZodBoolean>;
|
|
664
|
+
textSnapshot: z.ZodOptional<z.ZodString>;
|
|
665
|
+
}, z.core.$strip>>;
|
|
666
|
+
placement: z.ZodDefault<z.ZodEnum<{
|
|
667
|
+
top: "top";
|
|
668
|
+
"top-start": "top-start";
|
|
669
|
+
"top-end": "top-end";
|
|
670
|
+
right: "right";
|
|
671
|
+
"right-start": "right-start";
|
|
672
|
+
"right-end": "right-end";
|
|
673
|
+
bottom: "bottom";
|
|
674
|
+
"bottom-start": "bottom-start";
|
|
675
|
+
"bottom-end": "bottom-end";
|
|
676
|
+
left: "left";
|
|
677
|
+
"left-start": "left-start";
|
|
678
|
+
"left-end": "left-end";
|
|
679
|
+
auto: "auto";
|
|
680
|
+
}>>;
|
|
681
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
682
|
+
showOverlay: z.ZodDefault<z.ZodBoolean>;
|
|
683
|
+
showProgress: z.ZodDefault<z.ZodBoolean>;
|
|
684
|
+
showClose: z.ZodDefault<z.ZodBoolean>;
|
|
685
|
+
dismissOnOutsideClick: z.ZodDefault<z.ZodBoolean>;
|
|
686
|
+
spotlightPadding: z.ZodDefault<z.ZodNumber>;
|
|
687
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
688
|
+
top: "top";
|
|
689
|
+
bottom: "bottom";
|
|
690
|
+
"top-left": "top-left";
|
|
691
|
+
"top-right": "top-right";
|
|
692
|
+
"bottom-left": "bottom-left";
|
|
693
|
+
"bottom-right": "bottom-right";
|
|
694
|
+
center: "center";
|
|
695
|
+
}>>;
|
|
696
|
+
url: z.ZodOptional<z.ZodString>;
|
|
697
|
+
advanceOn: z.ZodDefault<z.ZodEnum<{
|
|
698
|
+
any: "any";
|
|
699
|
+
button: "button";
|
|
700
|
+
event: "event";
|
|
701
|
+
element_click: "element_click";
|
|
702
|
+
element_visible: "element_visible";
|
|
703
|
+
delay: "delay";
|
|
704
|
+
}>>;
|
|
705
|
+
advanceValue: z.ZodOptional<z.ZodString>;
|
|
706
|
+
advanceDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
707
|
+
branches: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
708
|
+
id: z.ZodString;
|
|
709
|
+
when: z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>;
|
|
710
|
+
goTo: z.ZodString;
|
|
711
|
+
}, z.core.$strip>>>;
|
|
712
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
713
|
+
targeting: z.ZodOptional<z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>>;
|
|
714
|
+
hotspot: z.ZodOptional<z.ZodObject<{
|
|
715
|
+
size: z.ZodDefault<z.ZodNumber>;
|
|
716
|
+
pulse: z.ZodDefault<z.ZodBoolean>;
|
|
717
|
+
openOn: z.ZodDefault<z.ZodEnum<{
|
|
718
|
+
click: "click";
|
|
719
|
+
hover: "hover";
|
|
720
|
+
}>>;
|
|
721
|
+
}, z.core.$strip>>;
|
|
722
|
+
customHtml: z.ZodOptional<z.ZodString>;
|
|
723
|
+
code: z.ZodOptional<z.ZodString>;
|
|
724
|
+
}, z.core.$strip>>>;
|
|
725
|
+
visibility: z.ZodDefault<z.ZodEnum<{
|
|
726
|
+
everyone: "everyone";
|
|
727
|
+
identified: "identified";
|
|
728
|
+
anonymous: "anonymous";
|
|
729
|
+
}>>;
|
|
730
|
+
targeting: z.ZodDefault<z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>>;
|
|
731
|
+
trigger: z.ZodPrefault<z.ZodObject<{
|
|
732
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
733
|
+
event: "event";
|
|
734
|
+
element_click: "element_click";
|
|
735
|
+
element_visible: "element_visible";
|
|
736
|
+
delay: "delay";
|
|
737
|
+
page_load: "page_load";
|
|
738
|
+
url_match: "url_match";
|
|
739
|
+
manual: "manual";
|
|
740
|
+
after_guide: "after_guide";
|
|
741
|
+
segment_enter: "segment_enter";
|
|
742
|
+
}>>;
|
|
743
|
+
value: z.ZodOptional<z.ZodString>;
|
|
744
|
+
delayMs: z.ZodDefault<z.ZodNumber>;
|
|
745
|
+
urlPattern: z.ZodOptional<z.ZodString>;
|
|
746
|
+
}, z.core.$strip>>;
|
|
747
|
+
frequency: z.ZodPrefault<z.ZodObject<{
|
|
748
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
749
|
+
once: "once";
|
|
750
|
+
once_per_session: "once_per_session";
|
|
751
|
+
every_time: "every_time";
|
|
752
|
+
interval: "interval";
|
|
753
|
+
}>>;
|
|
754
|
+
intervalHours: z.ZodOptional<z.ZodNumber>;
|
|
755
|
+
maxImpressions: z.ZodOptional<z.ZodNumber>;
|
|
756
|
+
cooldownHours: z.ZodDefault<z.ZodNumber>;
|
|
757
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
758
|
+
mutuallyExclusiveWith: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
759
|
+
reshowAfterDismiss: z.ZodDefault<z.ZodBoolean>;
|
|
760
|
+
ignoreThrottling: z.ZodOptional<z.ZodBoolean>;
|
|
761
|
+
}, z.core.$strip>>;
|
|
762
|
+
appearance: z.ZodPrefault<z.ZodObject<{
|
|
763
|
+
theme: z.ZodDefault<z.ZodEnum<{
|
|
764
|
+
auto: "auto";
|
|
765
|
+
light: "light";
|
|
766
|
+
dark: "dark";
|
|
767
|
+
}>>;
|
|
768
|
+
primaryColor: z.ZodOptional<z.ZodString>;
|
|
769
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
770
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
771
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
772
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
773
|
+
overlayOpacity: z.ZodOptional<z.ZodNumber>;
|
|
774
|
+
zIndex: z.ZodOptional<z.ZodNumber>;
|
|
775
|
+
preset: z.ZodOptional<z.ZodString>;
|
|
776
|
+
animation: z.ZodDefault<z.ZodEnum<{
|
|
777
|
+
none: "none";
|
|
778
|
+
fade: "fade";
|
|
779
|
+
slide: "slide";
|
|
780
|
+
}>>;
|
|
781
|
+
customCss: z.ZodOptional<z.ZodString>;
|
|
782
|
+
}, z.core.$strip>>;
|
|
783
|
+
checklist: z.ZodOptional<z.ZodObject<{
|
|
784
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
785
|
+
id: z.ZodString;
|
|
786
|
+
title: z.ZodString;
|
|
787
|
+
description: z.ZodDefault<z.ZodString>;
|
|
788
|
+
completion: z.ZodDefault<z.ZodEnum<{
|
|
789
|
+
event: "event";
|
|
790
|
+
click: "click";
|
|
791
|
+
manual: "manual";
|
|
792
|
+
guide_completed: "guide_completed";
|
|
793
|
+
url_visited: "url_visited";
|
|
794
|
+
}>>;
|
|
795
|
+
completionValue: z.ZodOptional<z.ZodString>;
|
|
796
|
+
action: z.ZodDefault<z.ZodEnum<{
|
|
797
|
+
url: "url";
|
|
798
|
+
start_guide: "start_guide";
|
|
799
|
+
event: "event";
|
|
800
|
+
none: "none";
|
|
801
|
+
}>>;
|
|
802
|
+
actionValue: z.ZodOptional<z.ZodString>;
|
|
803
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
804
|
+
}, z.core.$strip>>;
|
|
805
|
+
ordered: z.ZodDefault<z.ZodBoolean>;
|
|
806
|
+
launcherLabel: z.ZodDefault<z.ZodString>;
|
|
807
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
808
|
+
"bottom-left": "bottom-left";
|
|
809
|
+
"bottom-right": "bottom-right";
|
|
810
|
+
}>>;
|
|
811
|
+
completionTitle: z.ZodDefault<z.ZodString>;
|
|
812
|
+
completionBody: z.ZodDefault<z.ZodString>;
|
|
813
|
+
autoOpen: z.ZodDefault<z.ZodBoolean>;
|
|
814
|
+
dismissible: z.ZodDefault<z.ZodBoolean>;
|
|
815
|
+
}, z.core.$strip>>;
|
|
816
|
+
survey: z.ZodOptional<z.ZodObject<{
|
|
817
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
818
|
+
id: z.ZodString;
|
|
819
|
+
type: z.ZodEnum<{
|
|
820
|
+
text: "text";
|
|
821
|
+
nps: "nps";
|
|
822
|
+
csat: "csat";
|
|
823
|
+
thumbs: "thumbs";
|
|
824
|
+
single_choice: "single_choice";
|
|
825
|
+
multiple_choice: "multiple_choice";
|
|
826
|
+
rating: "rating";
|
|
827
|
+
}>;
|
|
828
|
+
title: z.ZodString;
|
|
829
|
+
description: z.ZodDefault<z.ZodString>;
|
|
830
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
831
|
+
options: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
832
|
+
id: z.ZodString;
|
|
833
|
+
label: z.ZodString;
|
|
834
|
+
}, z.core.$strip>>>;
|
|
835
|
+
scaleMax: z.ZodOptional<z.ZodNumber>;
|
|
836
|
+
lowLabel: z.ZodOptional<z.ZodString>;
|
|
837
|
+
highLabel: z.ZodOptional<z.ZodString>;
|
|
838
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
839
|
+
showWhen: z.ZodOptional<z.ZodObject<{
|
|
840
|
+
questionId: z.ZodString;
|
|
841
|
+
op: z.ZodEnum<{
|
|
842
|
+
equals: "equals";
|
|
843
|
+
lte: "lte";
|
|
844
|
+
gte: "gte";
|
|
845
|
+
in: "in";
|
|
846
|
+
}>;
|
|
847
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>;
|
|
848
|
+
}, z.core.$strip>>;
|
|
849
|
+
}, z.core.$strip>>;
|
|
850
|
+
thankYouTitle: z.ZodDefault<z.ZodString>;
|
|
851
|
+
thankYouBody: z.ZodDefault<z.ZodString>;
|
|
852
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
853
|
+
"bottom-left": "bottom-left";
|
|
854
|
+
"bottom-right": "bottom-right";
|
|
855
|
+
center: "center";
|
|
856
|
+
}>>;
|
|
857
|
+
startAt: z.ZodOptional<z.ZodString>;
|
|
858
|
+
endAt: z.ZodOptional<z.ZodString>;
|
|
859
|
+
}, z.core.$strip>>;
|
|
860
|
+
urlPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
861
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
862
|
+
web: "web";
|
|
863
|
+
ios: "ios";
|
|
864
|
+
android: "android";
|
|
865
|
+
}>>>;
|
|
866
|
+
schedule: z.ZodOptional<z.ZodObject<{
|
|
867
|
+
startAt: z.ZodOptional<z.ZodString>;
|
|
868
|
+
endAt: z.ZodOptional<z.ZodString>;
|
|
869
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
870
|
+
}, z.core.$strip>>;
|
|
871
|
+
localization: z.ZodOptional<z.ZodObject<{
|
|
872
|
+
translations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
873
|
+
}, z.core.$strip>>;
|
|
874
|
+
}, z.core.$strip>;
|
|
875
|
+
type GuideConfig = z.infer<typeof GuideConfigSchema>;
|
|
876
|
+
type GuideConfigInput = z.input<typeof GuideConfigSchema>;
|
|
877
|
+
declare function defaultGuideConfig(kind: GuideKind): GuideConfig;
|
|
878
|
+
declare function defaultStep(type: StepType, overrides?: Partial<GuideStepInput>): GuideStep;
|
|
879
|
+
/** Buttons to show for a step; "back" buttons are hidden when there is no previous step to return to. */
|
|
880
|
+
declare function visibleButtons(step: GuideStep, canGoBack: boolean): GuideStep["buttons"];
|
|
881
|
+
/** Validation beyond Zod shape: returns human-readable problems that block publishing. */
|
|
882
|
+
interface ValidationIssue {
|
|
883
|
+
level: "error" | "warning";
|
|
884
|
+
stepId?: string;
|
|
885
|
+
message: string;
|
|
886
|
+
}
|
|
887
|
+
declare function validateGuideConfig(kind: GuideKind, config: GuideConfig, theme?: Partial<Pick<ProjectTheme, "primaryColor" | "backgroundColor" | "textColor">>): ValidationIssue[];
|
|
888
|
+
interface ProjectTheme {
|
|
889
|
+
primaryColor: string;
|
|
890
|
+
backgroundColor: string;
|
|
891
|
+
textColor: string;
|
|
892
|
+
borderRadius: number;
|
|
893
|
+
fontFamily: string;
|
|
894
|
+
logoUrl?: string;
|
|
895
|
+
brandName?: string;
|
|
896
|
+
customCss?: string;
|
|
897
|
+
}
|
|
898
|
+
declare const ProjectThemeSchema: z.ZodObject<{
|
|
899
|
+
primaryColor: z.ZodDefault<z.ZodString>;
|
|
900
|
+
backgroundColor: z.ZodDefault<z.ZodString>;
|
|
901
|
+
textColor: z.ZodDefault<z.ZodString>;
|
|
902
|
+
borderRadius: z.ZodDefault<z.ZodNumber>;
|
|
903
|
+
fontFamily: z.ZodDefault<z.ZodString>;
|
|
904
|
+
logoUrl: z.ZodOptional<z.ZodString>;
|
|
905
|
+
brandName: z.ZodOptional<z.ZodString>;
|
|
906
|
+
customCss: z.ZodOptional<z.ZodString>;
|
|
907
|
+
}, z.core.$strip>;
|
|
908
|
+
|
|
909
|
+
/** Reserved property names that are stripped from `properties` to avoid collecting sensitive data. */
|
|
910
|
+
declare const SENSITIVE_PROPERTY_PATTERN: RegExp;
|
|
911
|
+
declare const MAX_PROPERTY_BYTES: number;
|
|
912
|
+
declare function sanitizeProperties(props: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
913
|
+
|
|
914
|
+
/** One parsed stack frame. `file` is the script URL (or path) as the browser reported it. */
|
|
915
|
+
interface StackFrame {
|
|
916
|
+
fn?: string;
|
|
917
|
+
file?: string;
|
|
918
|
+
line?: number;
|
|
919
|
+
col?: number;
|
|
920
|
+
}
|
|
921
|
+
/** Properties carried by an `exception` event (see `docs/product-analytics.md`). */
|
|
922
|
+
interface ExceptionProperties {
|
|
923
|
+
type: string;
|
|
924
|
+
message: string;
|
|
925
|
+
frames: StackFrame[];
|
|
926
|
+
/** `onerror` | `unhandledrejection` | `manual` (captureException) | `console`. */
|
|
927
|
+
source?: string;
|
|
928
|
+
handled?: boolean;
|
|
929
|
+
/** App version or commit (SDK option `release`); selects the matching uploaded source maps. */
|
|
930
|
+
release?: string;
|
|
931
|
+
/** Set by the server at ingestion; groups occurrences into an issue. */
|
|
932
|
+
fingerprint?: string;
|
|
933
|
+
}
|
|
934
|
+
declare const MAX_STACK_FRAMES = 30;
|
|
935
|
+
/** Parses `Error.stack` from V8, SpiderMonkey and JavaScriptCore into frames (innermost first). */
|
|
936
|
+
declare function parseStack(stack: string | undefined | null, max?: number): StackFrame[];
|
|
937
|
+
/** Replaces volatile parts of a message (numbers, ids, quoted values) so repeats group together. */
|
|
938
|
+
declare function normalizeErrorMessage(message: string): string;
|
|
939
|
+
/** Strips origin, query, hash and build hashes (`main.3f2a1b9c.js` → `main.js`) from a script URL. */
|
|
940
|
+
declare function normalizeFrameFile(file: string | undefined): string;
|
|
941
|
+
/** Source map upload limits (`POST /api/v1/sourcemaps/upload`). */
|
|
942
|
+
/** Per map, uncompressed (the CLI uploads maps gzipped). */
|
|
943
|
+
declare const SOURCEMAP_MAX_FILE_BYTES: number;
|
|
944
|
+
declare const SOURCEMAP_MAX_FILES_PER_UPLOAD = 200;
|
|
945
|
+
/**
|
|
946
|
+
* Stable issue key for an exception: error type + normalised message + the innermost frame that
|
|
947
|
+
* has a file (path without build hash + function name, or its original source + name when a source
|
|
948
|
+
* map resolved it). Line/column numbers are left out because they change with every deploy of a
|
|
949
|
+
* minified bundle.
|
|
950
|
+
*/
|
|
951
|
+
declare function fingerprintError(input: {
|
|
952
|
+
type?: string;
|
|
953
|
+
message?: string;
|
|
954
|
+
frames?: StackFrame[];
|
|
955
|
+
original?: {
|
|
956
|
+
source: string;
|
|
957
|
+
name?: string | null;
|
|
958
|
+
} | null;
|
|
959
|
+
}): string;
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Resource center structure shared by every SDK: nested collections and audience targeting.
|
|
963
|
+
*
|
|
964
|
+
* Audience targeting decides what the help widget lists; it is not access control. The published
|
|
965
|
+
* config (and every article body) is the same for all visitors of an environment, and end-user
|
|
966
|
+
* identities are self-asserted, so never rely on it to keep an article private.
|
|
967
|
+
*/
|
|
968
|
+
/** Collections nest at most this deep (a collection, its sections, and their sub-sections). */
|
|
969
|
+
declare const MAX_COLLECTION_DEPTH = 3;
|
|
970
|
+
interface RcCollectionLike {
|
|
971
|
+
id: string;
|
|
972
|
+
name: string;
|
|
973
|
+
order: number;
|
|
974
|
+
/** Parent collection; null/absent for a top-level collection. */
|
|
975
|
+
parentId?: string | null;
|
|
976
|
+
/** Shown only to members of any of these audiences; empty/absent means everyone. */
|
|
977
|
+
audienceIds?: string[];
|
|
978
|
+
}
|
|
979
|
+
interface RcArticleLike {
|
|
980
|
+
id: string;
|
|
981
|
+
collectionId?: string | null;
|
|
982
|
+
audienceIds?: string[];
|
|
983
|
+
}
|
|
984
|
+
interface RcSection<C extends RcCollectionLike, A extends RcArticleLike> {
|
|
985
|
+
/** null for articles outside any (known) collection. */
|
|
986
|
+
collection: C | null;
|
|
987
|
+
/** Collection names from the top level down, e.g. ["Billing", "Invoices"]. */
|
|
988
|
+
path: string[];
|
|
989
|
+
/** 0 for a top-level collection. */
|
|
990
|
+
depth: number;
|
|
991
|
+
articles: A[];
|
|
992
|
+
}
|
|
993
|
+
type Membership = ReadonlySet<string> | readonly string[] | undefined | null;
|
|
994
|
+
/** True when an item targeted at `required` audiences is shown to someone in `member`. */
|
|
995
|
+
declare function matchesAudiences(required: readonly string[] | undefined | null, member: Membership): boolean;
|
|
996
|
+
/**
|
|
997
|
+
* Article sections in display order: each collection (depth first, siblings by `order`) with the
|
|
998
|
+
* visible articles filed directly in it, then the uncategorized articles. A collection the viewer
|
|
999
|
+
* isn't targeted by hides its whole subtree, and sections without visible articles are left out
|
|
1000
|
+
* (their sub-collections still appear). Unknown parents count as top level, so an old config or a
|
|
1001
|
+
* dangling reference never hides content.
|
|
1002
|
+
*/
|
|
1003
|
+
declare function resourceCenterSections<C extends RcCollectionLike, A extends RcArticleLike>(collections: readonly C[], articles: readonly A[], member?: Membership): Array<RcSection<C, A>>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Whether one article is listed for a viewer: its own audiences and those of every collection above
|
|
1006
|
+
* it must match. For articles outside a loaded list (e.g. server search results).
|
|
1007
|
+
*/
|
|
1008
|
+
declare function isArticleListed(collections: readonly RcCollectionLike[], article: RcArticleLike, member?: Membership): boolean;
|
|
1009
|
+
/** Who an article is listed for, besides its audiences: everyone, or logged-in (identified) visitors only. */
|
|
1010
|
+
declare const ARTICLE_VISIBILITIES: readonly ["everyone", "identified"];
|
|
1011
|
+
type ArticleVisibility = (typeof ARTICLE_VISIBILITIES)[number];
|
|
1012
|
+
/**
|
|
1013
|
+
* Reserved audience every logged-in visitor belongs to. The server folds an article's visibility into
|
|
1014
|
+
* the audiences it serves and adds this one to identified visitors' memberships, so every SDK (old ones
|
|
1015
|
+
* too) applies "logged-in only" through the audience matching it already does. Anonymous visitors never
|
|
1016
|
+
* identify, so their membership is empty and these articles stay hidden.
|
|
1017
|
+
*/
|
|
1018
|
+
declare const LOGGED_IN_AUDIENCE = "$identified";
|
|
1019
|
+
/**
|
|
1020
|
+
* The audiences an article is served with. Logged-in only with no audiences becomes the reserved
|
|
1021
|
+
* audience; with audiences it is already implied, since audience membership only comes from identify.
|
|
1022
|
+
*/
|
|
1023
|
+
declare function servedArticleAudiences(audienceIds: readonly string[], visibility: ArticleVisibility | string | null | undefined): string[];
|
|
1024
|
+
/** A visitor's memberships as matched against served articles: logged-in visitors are also in `LOGGED_IN_AUDIENCE`. */
|
|
1025
|
+
declare function visitorAudiences(audienceIds: readonly string[], identified: boolean): string[];
|
|
1026
|
+
/** Ids of the articles a viewer sees (for filtering server search results the same way). */
|
|
1027
|
+
declare function visibleArticleIds(collections: readonly RcCollectionLike[], articles: readonly RcArticleLike[], member?: Membership): Set<string>;
|
|
1028
|
+
/**
|
|
1029
|
+
* A "Show me" prompt in an article body is a plain link, `<p class="gd-show-me"><a href="#guidely-show-me:<guide key>">Show me how</a></p>`,
|
|
1030
|
+
* so it survives every sanitizer and reads as a harmless link anywhere else. The widgets turn it into a
|
|
1031
|
+
* button that starts the walkthrough (a live flow guide), or hide it when that guide isn't available.
|
|
1032
|
+
*/
|
|
1033
|
+
declare const SHOW_ME_CLASS = "gd-show-me";
|
|
1034
|
+
declare const SHOW_ME_HREF_PREFIX = "#guidely-show-me:";
|
|
1035
|
+
declare function showMeHref(guideKey: string): string;
|
|
1036
|
+
/** The guide key of a Show me link's `href`, or null. */
|
|
1037
|
+
declare function showMeKeyFromHref(href: string | null | undefined): string | null;
|
|
1038
|
+
/** Guide keys of the Show me prompts in an article body, in order, without repeats (at most 10). */
|
|
1039
|
+
declare function showMeKeys(html: string | null | undefined): string[];
|
|
1040
|
+
/** The article body plays a video (uploaded, or embedded from YouTube, Vimeo, Loom or Wistia). */
|
|
1041
|
+
declare function hasVideoMedia(html: string | null | undefined): boolean;
|
|
1042
|
+
/**
|
|
1043
|
+
* Help search on the device: every word of the query starts a word of the text, in any order, or the
|
|
1044
|
+
* query appears as typed. "add user" finds "Add a new user" and "Users › Add".
|
|
1045
|
+
*/
|
|
1046
|
+
declare function matchesHelpQuery(text: string, query: string): boolean;
|
|
1047
|
+
declare const RC_MODULE_IDS: readonly ["announcements", "search", "checklists", "guides", "articles", "links", "faqs"];
|
|
1048
|
+
type ResourceCenterModuleId = (typeof RC_MODULE_IDS)[number];
|
|
1049
|
+
declare const RC_MODULE_LABELS: Record<ResourceCenterModuleId, string>;
|
|
1050
|
+
/**
|
|
1051
|
+
* The resource center's sections in display order: the configured modules (unknown ids dropped,
|
|
1052
|
+
* missing ones appended enabled, in the default order), so an old config shows every section.
|
|
1053
|
+
*/
|
|
1054
|
+
declare function orderedModules<M extends {
|
|
1055
|
+
id: string;
|
|
1056
|
+
enabled: boolean;
|
|
1057
|
+
}>(modules: readonly M[] | null | undefined): Array<M | {
|
|
1058
|
+
id: ResourceCenterModuleId;
|
|
1059
|
+
enabled: true;
|
|
1060
|
+
}>;
|
|
1061
|
+
/** Announcements a visitor sees: published (not in the future), audience-matched, newest first. */
|
|
1062
|
+
declare function visibleAnnouncements<A extends {
|
|
1063
|
+
publishedAt: string;
|
|
1064
|
+
audienceIds?: string[];
|
|
1065
|
+
}>(items: readonly A[] | null | undefined, member?: Membership, now?: number): A[];
|
|
1066
|
+
/** Unread count for the launcher badge: announcements published after the visitor last opened "What's new". */
|
|
1067
|
+
declare function unreadAnnouncements(items: readonly {
|
|
1068
|
+
publishedAt: string;
|
|
1069
|
+
}[], lastSeenAt: string | null | undefined): number;
|
|
1070
|
+
/**
|
|
1071
|
+
* A link to a help article from guide or article HTML: `<a href="#guidely-article:ID">`. A fragment
|
|
1072
|
+
* survives every sanitizer (editor, server, SDK), and the SDKs open the article in the resource
|
|
1073
|
+
* center (or Scout's Help tab) instead of following the link.
|
|
1074
|
+
*/
|
|
1075
|
+
declare const ARTICLE_HREF_PREFIX = "#guidely-article:";
|
|
1076
|
+
declare function articleHref(articleId: string): string;
|
|
1077
|
+
/** The article id of an article link's `href`, or null. */
|
|
1078
|
+
declare function articleIdFromHref(href: string | null | undefined): string | null;
|
|
1079
|
+
|
|
1080
|
+
/** How-to capture constants the browser SDK needs without zod (also exported from `@guidelytech/shared/runtime`). */
|
|
1081
|
+
/** Query parameter that starts capture mode in the SDK (separate from `guidely_authoring`, so SDKs without capture ignore it). */
|
|
1082
|
+
declare const CAPTURE_PARAM = "guidely_capture";
|
|
1083
|
+
/** Largest screenshot the capture endpoint accepts. */
|
|
1084
|
+
declare const CAPTURE_SCREENSHOT_MAX_BYTES: number;
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* How-tos: step-by-step guides with screenshots, recorded by clicking through the customer's app
|
|
1088
|
+
* (SDK capture mode) and edited in the dashboard. Each step is either an action captured in the app
|
|
1089
|
+
* (click, type, select, navigate) or a block the author added (text, heading, tip, alert).
|
|
1090
|
+
*/
|
|
1091
|
+
declare const HOWTO_STEP_KINDS: readonly ["action", "text", "heading", "tip", "alert"];
|
|
1092
|
+
type HowToStepKind = (typeof HOWTO_STEP_KINDS)[number];
|
|
1093
|
+
declare const HOWTO_ACTIONS: readonly ["click", "type", "select", "navigate"];
|
|
1094
|
+
type HowToAction = (typeof HOWTO_ACTIONS)[number];
|
|
1095
|
+
/** A rectangle as fractions (0–1) of its screenshot, so it survives any rendered size. */
|
|
1096
|
+
declare const NormalizedRectSchema: z.ZodObject<{
|
|
1097
|
+
x: z.ZodNumber;
|
|
1098
|
+
y: z.ZodNumber;
|
|
1099
|
+
width: z.ZodNumber;
|
|
1100
|
+
height: z.ZodNumber;
|
|
1101
|
+
}, z.core.$strip>;
|
|
1102
|
+
type NormalizedRect = z.infer<typeof NormalizedRectSchema>;
|
|
1103
|
+
/** The element an action was performed on, described for people (not for selecting it). */
|
|
1104
|
+
declare const CapturedElementSchema: z.ZodObject<{
|
|
1105
|
+
label: z.ZodDefault<z.ZodString>;
|
|
1106
|
+
role: z.ZodDefault<z.ZodString>;
|
|
1107
|
+
tag: z.ZodDefault<z.ZodString>;
|
|
1108
|
+
}, z.core.$strip>;
|
|
1109
|
+
type CapturedElement = z.infer<typeof CapturedElementSchema>;
|
|
1110
|
+
/**
|
|
1111
|
+
* One action the SDK recorded, sent with its screenshot as multipart form data
|
|
1112
|
+
* (`step` = this JSON, `screenshot` = the image) to `POST /api/v1/sdk/capture/steps?token=`.
|
|
1113
|
+
* Sensitive values never arrive here: the SDK drops typed text from password, payment, one-time-code
|
|
1114
|
+
* and masked fields and redacts screenshots in the browser before uploading them.
|
|
1115
|
+
*/
|
|
1116
|
+
declare const CaptureStepSchema: z.ZodObject<{
|
|
1117
|
+
clientId: z.ZodString;
|
|
1118
|
+
action: z.ZodEnum<{
|
|
1119
|
+
type: "type";
|
|
1120
|
+
click: "click";
|
|
1121
|
+
select: "select";
|
|
1122
|
+
navigate: "navigate";
|
|
1123
|
+
}>;
|
|
1124
|
+
url: z.ZodString;
|
|
1125
|
+
pageTitle: z.ZodDefault<z.ZodString>;
|
|
1126
|
+
element: z.ZodOptional<z.ZodObject<{
|
|
1127
|
+
label: z.ZodDefault<z.ZodString>;
|
|
1128
|
+
role: z.ZodDefault<z.ZodString>;
|
|
1129
|
+
tag: z.ZodDefault<z.ZodString>;
|
|
1130
|
+
}, z.core.$strip>>;
|
|
1131
|
+
value: z.ZodOptional<z.ZodString>;
|
|
1132
|
+
valueRedacted: z.ZodDefault<z.ZodBoolean>;
|
|
1133
|
+
selectors: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1134
|
+
kind: z.ZodEnum<{
|
|
1135
|
+
id: "id";
|
|
1136
|
+
text: "text";
|
|
1137
|
+
css: "css";
|
|
1138
|
+
"data-attr": "data-attr";
|
|
1139
|
+
aria: "aria";
|
|
1140
|
+
xpath: "xpath";
|
|
1141
|
+
"guidely-id": "guidely-id";
|
|
1142
|
+
}>;
|
|
1143
|
+
value: z.ZodString;
|
|
1144
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1145
|
+
}, z.core.$strip>>>;
|
|
1146
|
+
highlight: z.ZodOptional<z.ZodObject<{
|
|
1147
|
+
x: z.ZodNumber;
|
|
1148
|
+
y: z.ZodNumber;
|
|
1149
|
+
width: z.ZodNumber;
|
|
1150
|
+
height: z.ZodNumber;
|
|
1151
|
+
}, z.core.$strip>>;
|
|
1152
|
+
redactions: z.ZodDefault<z.ZodNumber>;
|
|
1153
|
+
occurredAt: z.ZodOptional<z.ZodString>;
|
|
1154
|
+
}, z.core.$strip>;
|
|
1155
|
+
type CaptureStep = z.infer<typeof CaptureStepSchema>;
|
|
1156
|
+
type CaptureStepInput = z.input<typeof CaptureStepSchema>;
|
|
1157
|
+
/** `GET /api/v1/sdk/capture/session?token=`: what the SDK needs to start recording. */
|
|
1158
|
+
interface CaptureSessionInfo {
|
|
1159
|
+
id: string;
|
|
1160
|
+
projectId: string;
|
|
1161
|
+
environment: string;
|
|
1162
|
+
howToId: string;
|
|
1163
|
+
howToTitle: string;
|
|
1164
|
+
/** Origin of the dashboard window that opened the app (for `postMessage`). */
|
|
1165
|
+
dashboardOrigin: string;
|
|
1166
|
+
expiresAt: string;
|
|
1167
|
+
/** Steps already recorded (a recording continues across full page loads). */
|
|
1168
|
+
stepCount: number;
|
|
1169
|
+
/** False when the server has no media storage: record steps without screenshots. */
|
|
1170
|
+
screenshots: boolean;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* A label as people would say it: icon glyphs and symbols at either end ("+ New contact", "Next →")
|
|
1175
|
+
* and required-field markers ("Email *", "Name:") removed. Falls back to the raw label when nothing
|
|
1176
|
+
* readable is left.
|
|
1177
|
+
*/
|
|
1178
|
+
declare function cleanLabel(label: string | undefined | null): string;
|
|
1179
|
+
/**
|
|
1180
|
+
* Name of the page a navigate step opens. A title like "Contacts · Northwind CRM" gives "Contacts";
|
|
1181
|
+
* a title that's just the app's name (no word of the path in it) gives the path instead, so
|
|
1182
|
+
* "/contacts/new" reads "Contacts › New". Ids in the path are skipped.
|
|
1183
|
+
*/
|
|
1184
|
+
declare function pageName(url: string, pageTitle: string | undefined | null): string;
|
|
1185
|
+
/** Plain-language instruction for a captured action, e.g. `Click “Save”` or `Type “Acme” into “Company”`. */
|
|
1186
|
+
declare function describeCaptureStep(step: Pick<CaptureStepInput, "action" | "element" | "value" | "valueRedacted" | "pageTitle" | "url">): string;
|
|
1187
|
+
/** A point as fractions (0–1) of a screenshot. */
|
|
1188
|
+
declare const NormalizedPointSchema: z.ZodObject<{
|
|
1189
|
+
x: z.ZodNumber;
|
|
1190
|
+
y: z.ZodNumber;
|
|
1191
|
+
}, z.core.$strip>;
|
|
1192
|
+
declare const ANNOTATION_COLORS: readonly ["brand", "red", "amber", "green", "black", "white"];
|
|
1193
|
+
type AnnotationColor = (typeof ANNOTATION_COLORS)[number];
|
|
1194
|
+
/**
|
|
1195
|
+
* A mark drawn over a step's screenshot, in fractions of the full image so it survives cropping and
|
|
1196
|
+
* any rendered size: an arrow, a text label or a box. `brand` uses the project's primary colour.
|
|
1197
|
+
*/
|
|
1198
|
+
declare const HowToAnnotationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1199
|
+
id: z.ZodString;
|
|
1200
|
+
type: z.ZodLiteral<"arrow">;
|
|
1201
|
+
from: z.ZodObject<{
|
|
1202
|
+
x: z.ZodNumber;
|
|
1203
|
+
y: z.ZodNumber;
|
|
1204
|
+
}, z.core.$strip>;
|
|
1205
|
+
to: z.ZodObject<{
|
|
1206
|
+
x: z.ZodNumber;
|
|
1207
|
+
y: z.ZodNumber;
|
|
1208
|
+
}, z.core.$strip>;
|
|
1209
|
+
color: z.ZodDefault<z.ZodEnum<{
|
|
1210
|
+
brand: "brand";
|
|
1211
|
+
red: "red";
|
|
1212
|
+
amber: "amber";
|
|
1213
|
+
green: "green";
|
|
1214
|
+
black: "black";
|
|
1215
|
+
white: "white";
|
|
1216
|
+
}>>;
|
|
1217
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1218
|
+
id: z.ZodString;
|
|
1219
|
+
type: z.ZodLiteral<"text">;
|
|
1220
|
+
at: z.ZodObject<{
|
|
1221
|
+
x: z.ZodNumber;
|
|
1222
|
+
y: z.ZodNumber;
|
|
1223
|
+
}, z.core.$strip>;
|
|
1224
|
+
text: z.ZodString;
|
|
1225
|
+
color: z.ZodDefault<z.ZodEnum<{
|
|
1226
|
+
brand: "brand";
|
|
1227
|
+
red: "red";
|
|
1228
|
+
amber: "amber";
|
|
1229
|
+
green: "green";
|
|
1230
|
+
black: "black";
|
|
1231
|
+
white: "white";
|
|
1232
|
+
}>>;
|
|
1233
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1234
|
+
id: z.ZodString;
|
|
1235
|
+
type: z.ZodLiteral<"box">;
|
|
1236
|
+
rect: z.ZodObject<{
|
|
1237
|
+
x: z.ZodNumber;
|
|
1238
|
+
y: z.ZodNumber;
|
|
1239
|
+
width: z.ZodNumber;
|
|
1240
|
+
height: z.ZodNumber;
|
|
1241
|
+
}, z.core.$strip>;
|
|
1242
|
+
color: z.ZodDefault<z.ZodEnum<{
|
|
1243
|
+
brand: "brand";
|
|
1244
|
+
red: "red";
|
|
1245
|
+
amber: "amber";
|
|
1246
|
+
green: "green";
|
|
1247
|
+
black: "black";
|
|
1248
|
+
white: "white";
|
|
1249
|
+
}>>;
|
|
1250
|
+
}, z.core.$strip>], "type">;
|
|
1251
|
+
type HowToAnnotation = z.infer<typeof HowToAnnotationSchema>;
|
|
1252
|
+
declare const MAX_ANNOTATIONS = 30;
|
|
1253
|
+
|
|
1254
|
+
/** Complaint types and limits shared by the server and the messenger runtime (zod-free). */
|
|
1255
|
+
/** Where a complaint is in its handling; the messenger shows it as Received → In review → Resolved. */
|
|
1256
|
+
declare const COMPLAINT_STATUSES: readonly ["open", "in_review", "resolved"];
|
|
1257
|
+
type ComplaintStatus = (typeof COMPLAINT_STATUSES)[number];
|
|
1258
|
+
/** Events a complaint webhook can fire on. */
|
|
1259
|
+
declare const COMPLAINT_EVENTS: readonly ["complaint.filed", "complaint.status_changed", "complaint.replied", "complaint.resolved"];
|
|
1260
|
+
type ComplaintEvent = (typeof COMPLAINT_EVENTS)[number];
|
|
1261
|
+
/** Extra questions a category asks for. */
|
|
1262
|
+
declare const COMPLAINT_FIELD_TYPES: readonly ["text", "choice"];
|
|
1263
|
+
type ComplaintFieldType = (typeof COMPLAINT_FIELD_TYPES)[number];
|
|
1264
|
+
declare const MAX_COMPLAINT_FIELDS = 8;
|
|
1265
|
+
declare const MAX_COMPLAINT_CHOICES = 12;
|
|
1266
|
+
declare const MAX_COMPLAINT_LENGTH = 4000;
|
|
1267
|
+
declare const MAX_COMPLAINT_ANSWER_LENGTH = 500;
|
|
1268
|
+
/** Largest screenshot the messenger may attach (after it scales the image down). */
|
|
1269
|
+
declare const MAX_COMPLAINT_ATTACHMENT_BYTES: number;
|
|
1270
|
+
interface ComplaintField {
|
|
1271
|
+
/** Stable id (`invoice_number`), used as the answer's key in webhook payloads. */
|
|
1272
|
+
id: string;
|
|
1273
|
+
label: string;
|
|
1274
|
+
type: ComplaintFieldType;
|
|
1275
|
+
/** Choices for `choice` questions. */
|
|
1276
|
+
options?: string[];
|
|
1277
|
+
required: boolean;
|
|
1278
|
+
}
|
|
1279
|
+
/** "CMP-1042" for complaint number 1042. */
|
|
1280
|
+
declare const complaintReference: (number: number) => string;
|
|
1281
|
+
/** A category as the messenger offers it. */
|
|
1282
|
+
interface MessengerComplaintCategory {
|
|
1283
|
+
id: string;
|
|
1284
|
+
name: string;
|
|
1285
|
+
description: string;
|
|
1286
|
+
color: string;
|
|
1287
|
+
fields: ComplaintField[];
|
|
1288
|
+
}
|
|
1289
|
+
/** Complaints block of `MessengerConfig`; absent when the project doesn't take complaints. */
|
|
1290
|
+
interface MessengerComplaintsConfig {
|
|
1291
|
+
categories: MessengerComplaintCategory[];
|
|
1292
|
+
/** Visitors the app hasn't identified may file one (with an email address). */
|
|
1293
|
+
anonymous: boolean;
|
|
1294
|
+
}
|
|
1295
|
+
/** A complaint as the person who filed it sees it (on its conversation). */
|
|
1296
|
+
interface MessengerComplaint {
|
|
1297
|
+
id: string;
|
|
1298
|
+
reference: string;
|
|
1299
|
+
status: ComplaintStatus;
|
|
1300
|
+
categoryName: string;
|
|
1301
|
+
createdAt: string;
|
|
1302
|
+
}
|
|
1303
|
+
/** Scout offered the complaint form in a reply, with this category picked. */
|
|
1304
|
+
interface MessengerComplaintOffer {
|
|
1305
|
+
categoryId: string;
|
|
1306
|
+
name: string;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/** Feedback (feature requests) types and limits shared by the server, the portal and the messenger runtime (zod-free). */
|
|
1310
|
+
/** Where a request is: shown to end users with FEEDBACK_STATUS_LABEL. */
|
|
1311
|
+
declare const FEEDBACK_STATUSES: readonly ["new", "under_review", "planned", "in_progress", "released", "declined"];
|
|
1312
|
+
type FeedbackStatus = (typeof FEEDBACK_STATUSES)[number];
|
|
1313
|
+
declare const FEEDBACK_STATUS_LABEL: Record<FeedbackStatus, string>;
|
|
1314
|
+
/** How much a voter needs it; weights 1 / 2 / 3 in the priority score. */
|
|
1315
|
+
declare const FEEDBACK_PRIORITIES: readonly ["nice_to_have", "important", "critical"];
|
|
1316
|
+
type FeedbackPriority = (typeof FEEDBACK_PRIORITIES)[number];
|
|
1317
|
+
declare const FEEDBACK_PRIORITY_LABEL: Record<FeedbackPriority, string>;
|
|
1318
|
+
declare const FEEDBACK_PRIORITY_WEIGHT: Record<FeedbackPriority, number>;
|
|
1319
|
+
/** Events feedback integrations (Slack, webhooks) can get. */
|
|
1320
|
+
declare const FEEDBACK_EVENTS: readonly ["request.created", "request.status_changed", "request.voted"];
|
|
1321
|
+
type FeedbackEvent = (typeof FEEDBACK_EVENTS)[number];
|
|
1322
|
+
declare const MAX_FEEDBACK_TITLE = 140;
|
|
1323
|
+
declare const MAX_FEEDBACK_DESCRIPTION = 4000;
|
|
1324
|
+
declare const MAX_FEEDBACK_COMMENT = 2000;
|
|
1325
|
+
declare const MAX_FEEDBACK_NOTE = 500;
|
|
1326
|
+
/** "#42" for request number 42. */
|
|
1327
|
+
declare const feedbackReference: (number: number) => string;
|
|
1328
|
+
/** A request as end users see it (messenger Ideas tab, portal). */
|
|
1329
|
+
interface PublicFeedbackRequest {
|
|
1330
|
+
id: string;
|
|
1331
|
+
number: number;
|
|
1332
|
+
title: string;
|
|
1333
|
+
description: string;
|
|
1334
|
+
status: FeedbackStatus;
|
|
1335
|
+
/** Public note shown with the status, when the team wrote one. */
|
|
1336
|
+
statusNote: string;
|
|
1337
|
+
productArea: string | null;
|
|
1338
|
+
votes: number;
|
|
1339
|
+
comments: number;
|
|
1340
|
+
/** This visitor's vote, if any. */
|
|
1341
|
+
myVote: {
|
|
1342
|
+
priority: FeedbackPriority;
|
|
1343
|
+
} | null;
|
|
1344
|
+
following: boolean;
|
|
1345
|
+
/** The visitor submitted it. */
|
|
1346
|
+
mine: boolean;
|
|
1347
|
+
createdAt: string;
|
|
1348
|
+
updatedAt: string;
|
|
1349
|
+
}
|
|
1350
|
+
interface PublicFeedbackComment {
|
|
1351
|
+
id: string;
|
|
1352
|
+
authorName: string;
|
|
1353
|
+
/** "team" replies are shown with a badge. */
|
|
1354
|
+
authorType: "user" | "team";
|
|
1355
|
+
body: string;
|
|
1356
|
+
createdAt: string;
|
|
1357
|
+
}
|
|
1358
|
+
interface PublicFeedbackRequestDetail extends PublicFeedbackRequest {
|
|
1359
|
+
thread: PublicFeedbackComment[];
|
|
1360
|
+
}
|
|
1361
|
+
interface PublicFeedbackList {
|
|
1362
|
+
requests: PublicFeedbackRequest[];
|
|
1363
|
+
hasMore: boolean;
|
|
1364
|
+
}
|
|
1365
|
+
/** An update about a request the visitor follows (status changed, merged). */
|
|
1366
|
+
interface FeedbackUpdate {
|
|
1367
|
+
id: string;
|
|
1368
|
+
requestId: string | null;
|
|
1369
|
+
kind: "status" | "merged" | "comment";
|
|
1370
|
+
title: string;
|
|
1371
|
+
body: string;
|
|
1372
|
+
read: boolean;
|
|
1373
|
+
createdAt: string;
|
|
1374
|
+
}
|
|
1375
|
+
interface FeedbackUpdatesResponse {
|
|
1376
|
+
updates: FeedbackUpdate[];
|
|
1377
|
+
unread: number;
|
|
1378
|
+
}
|
|
1379
|
+
/** Ideas block of `MessengerConfig`; absent when the project hasn't turned on the Ideas tab. */
|
|
1380
|
+
interface MessengerIdeasConfig {
|
|
1381
|
+
/** Tab and heading title. */
|
|
1382
|
+
title: string;
|
|
1383
|
+
/** Visitors the app hasn't identified may vote and submit (otherwise they can only browse). */
|
|
1384
|
+
anonymous: boolean;
|
|
1385
|
+
/** Votes and new ideas need a signed identity: the messenger only browses and links to the portal. */
|
|
1386
|
+
readOnly: boolean;
|
|
1387
|
+
/** Product areas people may tag new ideas with. */
|
|
1388
|
+
productAreas: string[];
|
|
1389
|
+
/** The hosted portal is on (the messenger offers "Open the portal"). */
|
|
1390
|
+
portal: boolean;
|
|
1391
|
+
}
|
|
1392
|
+
/** Scout offered to file or upvote a feature request in a reply. */
|
|
1393
|
+
interface MessengerIdeaOffer {
|
|
1394
|
+
/** The matching request to upvote, or null to suggest a new one. */
|
|
1395
|
+
requestId: string | null;
|
|
1396
|
+
title: string;
|
|
1397
|
+
/** Prefilled description for a new idea (the person's words, summarised). */
|
|
1398
|
+
description: string;
|
|
1399
|
+
votes?: number;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/** How quickly the team usually replies, shown on the messenger home screen. */
|
|
1403
|
+
declare const REPLY_TIMES: readonly ["minutes", "hour", "hours", "day"];
|
|
1404
|
+
type ReplyTime = (typeof REPLY_TIMES)[number];
|
|
1405
|
+
/** Levels of the status card on the messenger home screen. */
|
|
1406
|
+
declare const STATUS_LEVELS: readonly ["operational", "degraded", "outage", "maintenance"];
|
|
1407
|
+
type StatusLevel = (typeof STATUS_LEVELS)[number];
|
|
1408
|
+
/** A teammate shown on the messenger home screen (first name only). */
|
|
1409
|
+
interface MessengerTeammate {
|
|
1410
|
+
name: string;
|
|
1411
|
+
avatarUrl: string | null;
|
|
1412
|
+
}
|
|
1413
|
+
interface MessengerStatus {
|
|
1414
|
+
level: StatusLevel;
|
|
1415
|
+
message: string;
|
|
1416
|
+
updatedAt: string;
|
|
1417
|
+
}
|
|
1418
|
+
/** Which personalised cards the messenger home screen shows. */
|
|
1419
|
+
interface MessengerHomeCards {
|
|
1420
|
+
/** Guides, how-tos, articles and common questions for the page the user is on. */
|
|
1421
|
+
suggestions: boolean;
|
|
1422
|
+
/** A guide the user started and didn't finish, and checklist progress. */
|
|
1423
|
+
progress: boolean;
|
|
1424
|
+
/** Live announcements (also the News tab). */
|
|
1425
|
+
news: boolean;
|
|
1426
|
+
}
|
|
1427
|
+
/** Messenger settings delivered to the SDK in `SdkConfigResponse.messenger`. */
|
|
1428
|
+
interface MessengerConfig {
|
|
1429
|
+
enabled: boolean;
|
|
1430
|
+
/** Display name of the AI agent ("Scout"). */
|
|
1431
|
+
name: string;
|
|
1432
|
+
greeting: string;
|
|
1433
|
+
/** Scout answers with AI; when false every conversation goes to the team inbox. */
|
|
1434
|
+
aiAvailable: boolean;
|
|
1435
|
+
handoffEnabled: boolean;
|
|
1436
|
+
launcher: {
|
|
1437
|
+
position: "bottom-right" | "bottom-left";
|
|
1438
|
+
};
|
|
1439
|
+
/** Absent from servers before the personalised home screen; SDKs fall back to their defaults. */
|
|
1440
|
+
replyTime?: ReplyTime | null;
|
|
1441
|
+
team?: MessengerTeammate[];
|
|
1442
|
+
status?: MessengerStatus | null;
|
|
1443
|
+
home?: MessengerHomeCards;
|
|
1444
|
+
/** Complaint categories when the project takes complaints in the messenger (absent from older servers). */
|
|
1445
|
+
complaints?: MessengerComplaintsConfig | null;
|
|
1446
|
+
/** The Ideas tab (feature requests) when the project turned it on (absent from older servers). */
|
|
1447
|
+
ideas?: MessengerIdeasConfig | null;
|
|
1448
|
+
}
|
|
1449
|
+
/** Page-matched content for the messenger, from `POST /sdk/messenger/page`. */
|
|
1450
|
+
type MessengerPageSuggestion = {
|
|
1451
|
+
type: "article";
|
|
1452
|
+
articleId: string;
|
|
1453
|
+
title: string;
|
|
1454
|
+
summary: string;
|
|
1455
|
+
}
|
|
1456
|
+
/** A how-to recorded on this page, opened as its help article. */
|
|
1457
|
+
| {
|
|
1458
|
+
type: "howto";
|
|
1459
|
+
articleId: string;
|
|
1460
|
+
title: string;
|
|
1461
|
+
steps: number;
|
|
1462
|
+
};
|
|
1463
|
+
interface MessengerPageContent {
|
|
1464
|
+
/** The page as matched: its path with ids folded (`/invoices/:id`). */
|
|
1465
|
+
path: string;
|
|
1466
|
+
label: string | null;
|
|
1467
|
+
suggestions: MessengerPageSuggestion[];
|
|
1468
|
+
/** Questions people ask on this page (FAQs and learned answers); tapping one asks Scout. */
|
|
1469
|
+
questions: string[];
|
|
1470
|
+
}
|
|
1471
|
+
declare const MessengerPageRequestSchema: z.ZodObject<{
|
|
1472
|
+
anonymousId: z.ZodString;
|
|
1473
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1474
|
+
path: z.ZodString;
|
|
1475
|
+
}, z.core.$strip>;
|
|
1476
|
+
type MessengerPageRequest = z.infer<typeof MessengerPageRequestSchema>;
|
|
1477
|
+
declare const MESSAGE_AUTHORS: readonly ["user", "scout", "agent", "system"];
|
|
1478
|
+
type MessageAuthor = (typeof MESSAGE_AUTHORS)[number];
|
|
1479
|
+
type ConversationStatus = "bot" | "open" | "closed";
|
|
1480
|
+
interface MessengerCitation {
|
|
1481
|
+
articleId: string;
|
|
1482
|
+
title: string;
|
|
1483
|
+
}
|
|
1484
|
+
interface MessengerSuggestedGuide {
|
|
1485
|
+
key: string;
|
|
1486
|
+
name: string;
|
|
1487
|
+
}
|
|
1488
|
+
/** A how-to Scout relied on; the messenger opens it in place (`GET /sdk/how-tos/:id`). */
|
|
1489
|
+
interface MessengerHowToCitation {
|
|
1490
|
+
howToId: string;
|
|
1491
|
+
title: string;
|
|
1492
|
+
}
|
|
1493
|
+
interface MessengerMessage {
|
|
1494
|
+
id: string;
|
|
1495
|
+
author: MessageAuthor;
|
|
1496
|
+
/** Team member name for `agent` messages. */
|
|
1497
|
+
authorName?: string | null;
|
|
1498
|
+
body: string;
|
|
1499
|
+
citations: MessengerCitation[];
|
|
1500
|
+
suggestedGuides: MessengerSuggestedGuide[];
|
|
1501
|
+
/** How-tos Scout cited (absent when none; SDKs before how-to support ignore it). */
|
|
1502
|
+
howTos?: MessengerHowToCitation[];
|
|
1503
|
+
/** Scout offered the complaint form (absent otherwise). */
|
|
1504
|
+
complaintOffer?: MessengerComplaintOffer;
|
|
1505
|
+
/** Scout offered to file or upvote a feature request (absent otherwise). */
|
|
1506
|
+
ideaOffer?: MessengerIdeaOffer;
|
|
1507
|
+
status: "pending" | "complete" | "failed";
|
|
1508
|
+
createdAt: string;
|
|
1509
|
+
}
|
|
1510
|
+
interface MessengerConversation {
|
|
1511
|
+
id: string;
|
|
1512
|
+
status: ConversationStatus;
|
|
1513
|
+
subject: string;
|
|
1514
|
+
lastMessageAt: string;
|
|
1515
|
+
lastMessagePreview: string;
|
|
1516
|
+
unread: number;
|
|
1517
|
+
rating: number | null;
|
|
1518
|
+
/** The complaint filed in this conversation, latest first (absent when none). */
|
|
1519
|
+
complaint?: MessengerComplaint;
|
|
1520
|
+
}
|
|
1521
|
+
declare const MAX_MESSAGE_LENGTH = 4000;
|
|
1522
|
+
declare const StartConversationSchema: z.ZodObject<{
|
|
1523
|
+
anonymousId: z.ZodString;
|
|
1524
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1525
|
+
message: z.ZodString;
|
|
1526
|
+
pageUrl: z.ZodOptional<z.ZodString>;
|
|
1527
|
+
}, z.core.$strip>;
|
|
1528
|
+
type StartConversationRequest = z.infer<typeof StartConversationSchema>;
|
|
1529
|
+
interface StartConversationResponse {
|
|
1530
|
+
conversation: MessengerConversation;
|
|
1531
|
+
/** Secret that authorises this browser to read and post in the conversation. Store it; it is not shown again. */
|
|
1532
|
+
token: string;
|
|
1533
|
+
messages: MessengerMessage[];
|
|
1534
|
+
}
|
|
1535
|
+
declare const ConversationLookupSchema: z.ZodObject<{
|
|
1536
|
+
tokens: z.ZodArray<z.ZodString>;
|
|
1537
|
+
}, z.core.$strip>;
|
|
1538
|
+
interface ConversationLookupResponse {
|
|
1539
|
+
conversations: Array<MessengerConversation & {
|
|
1540
|
+
token: string;
|
|
1541
|
+
}>;
|
|
1542
|
+
}
|
|
1543
|
+
declare const PostMessageSchema: z.ZodObject<{
|
|
1544
|
+
message: z.ZodString;
|
|
1545
|
+
pageUrl: z.ZodOptional<z.ZodString>;
|
|
1546
|
+
}, z.core.$strip>;
|
|
1547
|
+
declare const ConversationRatingSchema: z.ZodObject<{
|
|
1548
|
+
rating: z.ZodNumber;
|
|
1549
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
1550
|
+
}, z.core.$strip>;
|
|
1551
|
+
interface FileComplaintResponse {
|
|
1552
|
+
complaint: MessengerComplaint;
|
|
1553
|
+
conversation: MessengerConversation;
|
|
1554
|
+
/** Token of the conversation started for it (absent when it was filed in an existing one). */
|
|
1555
|
+
token?: string;
|
|
1556
|
+
}
|
|
1557
|
+
interface ConversationMessagesResponse {
|
|
1558
|
+
conversation: MessengerConversation;
|
|
1559
|
+
messages: MessengerMessage[];
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* Server-sent events streamed by `POST /sdk/conversations` and `POST /sdk/conversations/:id/messages`
|
|
1563
|
+
* while Scout replies. `conversation` (start only) carries the new conversation and its token, `message`
|
|
1564
|
+
* each stored message, `delta` reply text as it is generated, and `done` the final stored message.
|
|
1565
|
+
*/
|
|
1566
|
+
type ScoutStreamEvent = {
|
|
1567
|
+
event: "conversation";
|
|
1568
|
+
data: StartConversationResponse;
|
|
1569
|
+
} | {
|
|
1570
|
+
event: "message";
|
|
1571
|
+
data: MessengerMessage;
|
|
1572
|
+
} | {
|
|
1573
|
+
event: "delta";
|
|
1574
|
+
data: {
|
|
1575
|
+
messageId: string;
|
|
1576
|
+
text: string;
|
|
1577
|
+
};
|
|
1578
|
+
} | {
|
|
1579
|
+
event: "done";
|
|
1580
|
+
data: {
|
|
1581
|
+
message: MessengerMessage;
|
|
1582
|
+
conversation: MessengerConversation;
|
|
1583
|
+
};
|
|
1584
|
+
} | {
|
|
1585
|
+
event: "error";
|
|
1586
|
+
data: {
|
|
1587
|
+
message: string;
|
|
1588
|
+
};
|
|
1589
|
+
};
|
|
1590
|
+
/** Article list entry for the messenger Help tab (bodies are fetched on demand). */
|
|
1591
|
+
interface SdkArticleSummary {
|
|
1592
|
+
id: string;
|
|
1593
|
+
slug: string;
|
|
1594
|
+
title: string;
|
|
1595
|
+
summary: string;
|
|
1596
|
+
collectionId: string | null;
|
|
1597
|
+
externalUrl: string | null;
|
|
1598
|
+
/** Listed only for members of these audiences (absent = everyone). */
|
|
1599
|
+
audienceIds?: string[];
|
|
1600
|
+
/** Guide keys of the article's "Show me" prompts (absent = none). */
|
|
1601
|
+
walkthroughs?: string[];
|
|
1602
|
+
hasVideo?: boolean;
|
|
1603
|
+
updatedAt: string;
|
|
1604
|
+
}
|
|
1605
|
+
interface SdkArticlesResponse {
|
|
1606
|
+
collections: ResourceCenterCollection[];
|
|
1607
|
+
articles: SdkArticleSummary[];
|
|
1608
|
+
}
|
|
1609
|
+
/** A how-to the team made available in the app (`GET /sdk/how-tos`). */
|
|
1610
|
+
interface SdkHowToSummary {
|
|
1611
|
+
id: string;
|
|
1612
|
+
title: string;
|
|
1613
|
+
description: string;
|
|
1614
|
+
/** Numbered (recorded) steps. */
|
|
1615
|
+
stepCount: number;
|
|
1616
|
+
/** Key of the interactive tour made from it, when that tour is live in this environment ("Show me"). */
|
|
1617
|
+
guideKey?: string;
|
|
1618
|
+
/** The how-to has a video. */
|
|
1619
|
+
hasVideo?: boolean;
|
|
1620
|
+
updatedAt: string;
|
|
1621
|
+
}
|
|
1622
|
+
interface SdkHowTosResponse {
|
|
1623
|
+
/** Every how-to available in the app, by title (at most 200). */
|
|
1624
|
+
howTos: SdkHowToSummary[];
|
|
1625
|
+
/** Ids of the ones recorded on the page in `?url=`, best match first (at most 5). */
|
|
1626
|
+
forPage: string[];
|
|
1627
|
+
}
|
|
1628
|
+
/** One step as the messenger renders it: text only, plus a screenshot with the element's highlight. */
|
|
1629
|
+
interface SdkHowToStep {
|
|
1630
|
+
id: string;
|
|
1631
|
+
kind: HowToStepKind;
|
|
1632
|
+
title: string;
|
|
1633
|
+
body: string;
|
|
1634
|
+
image?: {
|
|
1635
|
+
url: string;
|
|
1636
|
+
/** Show only this part of the screenshot (zoomed in on the element). */
|
|
1637
|
+
crop?: NormalizedRect;
|
|
1638
|
+
/** The element, in the coordinates of the (cropped) image. */
|
|
1639
|
+
highlight?: NormalizedRect;
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
/** `GET /sdk/how-tos/:id`: an available how-to with its steps. */
|
|
1643
|
+
interface SdkHowTo {
|
|
1644
|
+
id: string;
|
|
1645
|
+
title: string;
|
|
1646
|
+
description: string;
|
|
1647
|
+
updatedAt: string;
|
|
1648
|
+
steps: SdkHowToStep[];
|
|
1649
|
+
/** Key of the interactive tour made from it, when that tour is live in this environment ("Show me"). */
|
|
1650
|
+
guideKey?: string;
|
|
1651
|
+
/** Video made from the how-to (WebM), played above the steps. */
|
|
1652
|
+
video?: {
|
|
1653
|
+
url: string;
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
/**
|
|
1658
|
+
* Product-analytics capture settings. Stored on `Project.settings` (keys `autocapture`,
|
|
1659
|
+
* `errorTracking`, `replay`) and delivered to the SDK in `SdkConfigResponse.settings`. The project
|
|
1660
|
+
* setting turns a capability on; SDK options can only turn it off for one installation.
|
|
1661
|
+
*/
|
|
1662
|
+
interface AutocaptureSettings {
|
|
1663
|
+
/** `page_view` on load and on every SPA navigation. */
|
|
1664
|
+
pageviews: boolean;
|
|
1665
|
+
/** `page_leave` with visible time on page and scroll depth. */
|
|
1666
|
+
pageLeave: boolean;
|
|
1667
|
+
/** `click` on buttons, links and other interactive elements. */
|
|
1668
|
+
clicks: boolean;
|
|
1669
|
+
/** `rage_click` when the same spot is clicked 3+ times within a second. */
|
|
1670
|
+
rageClicks: boolean;
|
|
1671
|
+
/** Batched click positions on every element (`heatmap` events) for click heatmaps. */
|
|
1672
|
+
heatmaps: boolean;
|
|
1673
|
+
/** Mouse-movement heatmaps: pointer position sampled while it moves, aggregated in the browser into `heatmap` events. */
|
|
1674
|
+
mouseMovement: boolean;
|
|
1675
|
+
/**
|
|
1676
|
+
* Mobile SDKs: `app_install`, `app_update`, `app_open` and `app_background` events (ignored on the web).
|
|
1677
|
+
* Optional in the type for older stored settings; `resolveCaptureSettings` always fills it.
|
|
1678
|
+
*/
|
|
1679
|
+
appLifecycle?: boolean;
|
|
1680
|
+
}
|
|
1681
|
+
interface ErrorTrackingSettings {
|
|
1682
|
+
/** Uncaught errors and unhandled promise rejections become `exception` events. */
|
|
1683
|
+
enabled: boolean;
|
|
1684
|
+
}
|
|
1685
|
+
interface ReplaySettings {
|
|
1686
|
+
enabled: boolean;
|
|
1687
|
+
/** Percentage of sessions recorded (0–100), decided once per session. */
|
|
1688
|
+
sampleRate: number;
|
|
1689
|
+
/** Record console.log/warn/error output into the recording. */
|
|
1690
|
+
recordConsole: boolean;
|
|
1691
|
+
/** Record network requests (method, URL with sensitive query values redacted, status, timing, size). */
|
|
1692
|
+
recordNetwork: boolean;
|
|
1693
|
+
/** Also record request/response headers and text/JSON bodies (redacted, ≤10KB each). Off by default. */
|
|
1694
|
+
recordNetworkPayloads: boolean;
|
|
1695
|
+
/** Mask every text node (inputs are always masked). */
|
|
1696
|
+
maskAllText: boolean;
|
|
1697
|
+
/**
|
|
1698
|
+
* Mask every image (mobile SDKs; the web SDK gets image block selectors instead). Not a project setting: the
|
|
1699
|
+
* server sets it for HIPAA-mode workspaces, which also force `maskAllText` and turn console and payloads off.
|
|
1700
|
+
*/
|
|
1701
|
+
maskAllImages?: boolean;
|
|
1702
|
+
/** Elements replaced by a placeholder box in recordings (in addition to `[data-guidely-block]`). */
|
|
1703
|
+
blockSelectors: string[];
|
|
1704
|
+
/** Days recordings are kept before the worker deletes them. */
|
|
1705
|
+
retentionDays: number;
|
|
1706
|
+
}
|
|
1707
|
+
interface CaptureSettings {
|
|
1708
|
+
autocapture: AutocaptureSettings;
|
|
1709
|
+
errorTracking: ErrorTrackingSettings;
|
|
1710
|
+
replay: ReplaySettings;
|
|
1711
|
+
}
|
|
1712
|
+
declare const AutocaptureSettingsSchema: z.ZodObject<{
|
|
1713
|
+
pageviews: z.ZodOptional<z.ZodBoolean>;
|
|
1714
|
+
pageLeave: z.ZodOptional<z.ZodBoolean>;
|
|
1715
|
+
clicks: z.ZodOptional<z.ZodBoolean>;
|
|
1716
|
+
rageClicks: z.ZodOptional<z.ZodBoolean>;
|
|
1717
|
+
heatmaps: z.ZodOptional<z.ZodBoolean>;
|
|
1718
|
+
mouseMovement: z.ZodOptional<z.ZodBoolean>;
|
|
1719
|
+
appLifecycle: z.ZodOptional<z.ZodBoolean>;
|
|
1720
|
+
}, z.core.$strip>;
|
|
1721
|
+
declare const ErrorTrackingSettingsSchema: z.ZodObject<{
|
|
1722
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1723
|
+
}, z.core.$strip>;
|
|
1724
|
+
declare const ReplaySettingsSchema: z.ZodObject<{
|
|
1725
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1726
|
+
sampleRate: z.ZodOptional<z.ZodNumber>;
|
|
1727
|
+
recordConsole: z.ZodOptional<z.ZodBoolean>;
|
|
1728
|
+
recordNetwork: z.ZodOptional<z.ZodBoolean>;
|
|
1729
|
+
recordNetworkPayloads: z.ZodOptional<z.ZodBoolean>;
|
|
1730
|
+
maskAllText: z.ZodOptional<z.ZodBoolean>;
|
|
1731
|
+
blockSelectors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1732
|
+
retentionDays: z.ZodOptional<z.ZodNumber>;
|
|
1733
|
+
}, z.core.$strip>;
|
|
1734
|
+
declare const DEFAULT_CAPTURE_SETTINGS: CaptureSettings;
|
|
1735
|
+
/**
|
|
1736
|
+
* A project's recording level: a preset over the replay toggles, picked per project in Settings →
|
|
1737
|
+
* Workspace or Privacy & data. Sample rate, block selectors and retention are kept as they are.
|
|
1738
|
+
*/
|
|
1739
|
+
declare const RECORDING_LEVELS: readonly ["off", "privacy", "standard", "full"];
|
|
1740
|
+
type RecordingLevel = (typeof RECORDING_LEVELS)[number];
|
|
1741
|
+
/** The level a project's replay settings match, or "custom" when the toggles were set by hand. */
|
|
1742
|
+
declare function recordingLevel(replay: ReplaySettings): RecordingLevel | "custom";
|
|
1743
|
+
/** Replay settings set to a level. "off" stops recording and leaves the toggles for when it's turned back on. */
|
|
1744
|
+
declare function withRecordingLevel(replay: ReplaySettings, level: RecordingLevel): ReplaySettings;
|
|
1745
|
+
/** Fills defaults for whatever a project's stored settings leave out. */
|
|
1746
|
+
declare function resolveCaptureSettings(settings: unknown): CaptureSettings;
|
|
1747
|
+
/**
|
|
1748
|
+
* One position in a `heatmap` event (`properties.points`). `x`/`y` are page coordinates in CSS
|
|
1749
|
+
* pixels; `s` is a stable selector for the element and `rx`/`ry` the position inside it (0–1), which
|
|
1750
|
+
* lets the dashboard place the point on the element even when layouts differ.
|
|
1751
|
+
*
|
|
1752
|
+
* Mouse movement (`k: "m"`) is sampled at most every 200ms while the pointer moves and binned in the
|
|
1753
|
+
* browser (per element at 0.1 of `rx`/`ry`, else on a 16px page grid); `w` is the number of samples
|
|
1754
|
+
* in the bin, so a minute of movement costs a few dozen points rather than thousands.
|
|
1755
|
+
*/
|
|
1756
|
+
interface HeatmapPoint {
|
|
1757
|
+
/** `c` click, `r` part of a rage-click burst, `m` mouse movement. */
|
|
1758
|
+
k: "c" | "r" | "m";
|
|
1759
|
+
x: number;
|
|
1760
|
+
y: number;
|
|
1761
|
+
s?: string;
|
|
1762
|
+
rx?: number;
|
|
1763
|
+
ry?: number;
|
|
1764
|
+
/** Weight: samples aggregated into this point (movement only; clicks are 1). */
|
|
1765
|
+
w?: number;
|
|
1766
|
+
}
|
|
1767
|
+
/** Properties of a `heatmap` event: a batch of clicks on one page (flushed at ~40 points and on page leave). */
|
|
1768
|
+
interface HeatmapProperties {
|
|
1769
|
+
path?: string;
|
|
1770
|
+
viewportWidth: number;
|
|
1771
|
+
viewportHeight: number;
|
|
1772
|
+
/** Document scroll height when the batch was sent. */
|
|
1773
|
+
pageHeight: number;
|
|
1774
|
+
points: HeatmapPoint[];
|
|
1775
|
+
}
|
|
1776
|
+
/** Viewport buckets heatmaps are split by (CSS px of `viewportWidth`). */
|
|
1777
|
+
declare const HEATMAP_VIEWPORTS: {
|
|
1778
|
+
readonly mobile: readonly [0, 767];
|
|
1779
|
+
readonly tablet: readonly [768, 1279];
|
|
1780
|
+
readonly desktop: readonly [1280, 100000];
|
|
1781
|
+
};
|
|
1782
|
+
type HeatmapViewport = keyof typeof HEATMAP_VIEWPORTS;
|
|
1783
|
+
/**
|
|
1784
|
+
* One upload of rrweb events for a recording, `POST /api/v1/sdk/replay`. The SDK sends it as JSON,
|
|
1785
|
+
* or gzip-compressed JSON with `?enc=gzip`. A recording is keyed by the SDK session id; every page
|
|
1786
|
+
* load starts a new `windowId` whose uploads are numbered by `seq`.
|
|
1787
|
+
*/
|
|
1788
|
+
declare const ReplayChunkSchema: z.ZodObject<{
|
|
1789
|
+
sessionId: z.ZodString;
|
|
1790
|
+
windowId: z.ZodString;
|
|
1791
|
+
seq: z.ZodNumber;
|
|
1792
|
+
anonymousId: z.ZodString;
|
|
1793
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1794
|
+
events: z.ZodArray<z.ZodObject<{
|
|
1795
|
+
type: z.ZodNumber;
|
|
1796
|
+
timestamp: z.ZodNumber;
|
|
1797
|
+
}, z.core.$loose>>;
|
|
1798
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1799
|
+
device: z.ZodOptional<z.ZodObject<{
|
|
1800
|
+
type: z.ZodString;
|
|
1801
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
1802
|
+
os: z.ZodOptional<z.ZodString>;
|
|
1803
|
+
}, z.core.$strip>>;
|
|
1804
|
+
viewport: z.ZodOptional<z.ZodObject<{
|
|
1805
|
+
width: z.ZodNumber;
|
|
1806
|
+
height: z.ZodNumber;
|
|
1807
|
+
}, z.core.$strip>>;
|
|
1808
|
+
sdk: z.ZodOptional<z.ZodObject<{
|
|
1809
|
+
name: z.ZodString;
|
|
1810
|
+
version: z.ZodString;
|
|
1811
|
+
}, z.core.$strip>>;
|
|
1812
|
+
}, z.core.$strip>;
|
|
1813
|
+
type ReplayChunk = z.infer<typeof ReplayChunkSchema>;
|
|
1814
|
+
/** Max upload sizes for one replay chunk (bytes on the wire, and after decompression). */
|
|
1815
|
+
declare const REPLAY_MAX_COMPRESSED_BYTES: number;
|
|
1816
|
+
declare const REPLAY_MAX_RAW_BYTES: number;
|
|
1817
|
+
|
|
1818
|
+
/**
|
|
1819
|
+
* Tagged pages and features (named rules over the URLs and clicks the SDK captures), shared by the server (retroactive
|
|
1820
|
+
* matching, SQL generation), the dashboard (previews) and the SDK (event properties). Pure and zod-free.
|
|
1821
|
+
*
|
|
1822
|
+
* - An `ElementSnapshot` is the compact description of a clicked element the SDK attaches to `click`
|
|
1823
|
+
* events (`properties.el`): tag, id, classes, a few safe attributes, nth-of-type, ~5 ancestors and
|
|
1824
|
+
* the shadow hosts above it. CSS selector rules are evaluated against it with {@link matchCssSelector},
|
|
1825
|
+
* so a rule written today also matches clicks stored before it existed.
|
|
1826
|
+
* - Older clicks carry only a selector string; {@link snapshotFromSelector} turns that string into a
|
|
1827
|
+
* partial snapshot so CSS rules still match them where the string says enough.
|
|
1828
|
+
*/
|
|
1829
|
+
/** One element in a snapshot: tag, id, classes, safe attributes and its 1-based nth-of-type. */
|
|
1830
|
+
interface ElementNode {
|
|
1831
|
+
t: string;
|
|
1832
|
+
id?: string;
|
|
1833
|
+
c?: string[];
|
|
1834
|
+
a?: Record<string, string>;
|
|
1835
|
+
n?: number;
|
|
1836
|
+
}
|
|
1837
|
+
/** A clicked element (`click.properties.el`): the element, its ancestors (`p`, parent first) and shadow hosts (`h`, nearest first). */
|
|
1838
|
+
interface ElementSnapshot extends ElementNode {
|
|
1839
|
+
p?: ElementNode[];
|
|
1840
|
+
h?: ElementNode[];
|
|
1841
|
+
}
|
|
1842
|
+
declare const SNAPSHOT_LIMITS: {
|
|
1843
|
+
readonly classes: 8;
|
|
1844
|
+
readonly className: 60;
|
|
1845
|
+
readonly attrs: 6;
|
|
1846
|
+
readonly attrValue: 100;
|
|
1847
|
+
readonly ancestors: 5;
|
|
1848
|
+
readonly hosts: 3;
|
|
1849
|
+
readonly tag: 40;
|
|
1850
|
+
readonly id: 80;
|
|
1851
|
+
};
|
|
1852
|
+
/** Attributes a snapshot may carry besides `data-*` ones. Never `value`, never event handlers. */
|
|
1853
|
+
declare const SNAPSHOT_ATTRS: readonly ["role", "name", "type", "aria-label", "title", "alt", "for", "href"];
|
|
1854
|
+
/** Framework and state `data-*` attributes that say nothing stable about an element. */
|
|
1855
|
+
declare const NOISY_DATA_ATTR: RegExp;
|
|
1856
|
+
/** The custom attribute that names a feature by default (`<button data-guidely-feature="Export CSV">`). */
|
|
1857
|
+
declare const DEFAULT_FEATURE_ATTRIBUTE = "data-guidely-feature";
|
|
1858
|
+
declare const FEATURE_ATTRIBUTE_PATTERN: RegExp;
|
|
1859
|
+
/** Validates and trims a snapshot sent by an SDK (server side); null when it is not one. */
|
|
1860
|
+
declare function normalizeSnapshot(raw: unknown): ElementSnapshot | null;
|
|
1861
|
+
/** JSON with sorted keys, so equal snapshots hash the same whatever order the SDK wrote them in. */
|
|
1862
|
+
declare function stableStringify(v: unknown): string;
|
|
1863
|
+
type AttrOp = "exists" | "=" | "^=" | "$=" | "*=" | "~=" | "|=";
|
|
1864
|
+
interface AttrTest {
|
|
1865
|
+
name: string;
|
|
1866
|
+
op: AttrOp;
|
|
1867
|
+
value?: string;
|
|
1868
|
+
/** `[attr="x" i]` */
|
|
1869
|
+
insensitive?: boolean;
|
|
1870
|
+
}
|
|
1871
|
+
interface Compound {
|
|
1872
|
+
tag?: string;
|
|
1873
|
+
id?: string;
|
|
1874
|
+
classes: string[];
|
|
1875
|
+
attrs: AttrTest[];
|
|
1876
|
+
/** `:nth-of-type(n)`; `odd`/`even` as `{ a: 2, b: 1|0 }`; `:first-of-type` is `{ a: 0, b: 1 }`. */
|
|
1877
|
+
nth?: {
|
|
1878
|
+
a: number;
|
|
1879
|
+
b: number;
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
/** A complex selector: compounds left to right and the combinator before each (index 0 has none). */
|
|
1883
|
+
interface ComplexSelector {
|
|
1884
|
+
compounds: Compound[];
|
|
1885
|
+
combinators: Array<" " | ">" | ">>>">;
|
|
1886
|
+
}
|
|
1887
|
+
declare class SelectorSyntaxError extends Error {
|
|
1888
|
+
}
|
|
1889
|
+
/**
|
|
1890
|
+
* Parses the supported subset: type and universal selectors, `#id`, `.class`, `[attr]`,
|
|
1891
|
+
* `[attr=v]`, `^=`, `$=`, `*=`, `~=`, `|=` (optionally `i`), `:nth-of-type(n|odd|even)`,
|
|
1892
|
+
* `:first-of-type`, descendant and child combinators, `>>>` (shadow host) and selector lists.
|
|
1893
|
+
* Throws {@link SelectorSyntaxError} on anything else.
|
|
1894
|
+
*/
|
|
1895
|
+
declare function parseCssSelector(input: string): ComplexSelector[];
|
|
1896
|
+
/** Is the selector inside the supported subset? Returns the error message, or null when it parses. */
|
|
1897
|
+
declare function cssSelectorError(selector: string): string | null;
|
|
1898
|
+
/** Does one compound match one node? An unknown nth-of-type fails `:nth-of-type` tests. */
|
|
1899
|
+
declare function compoundMatches(c: Compound, node: ElementNode): boolean;
|
|
1900
|
+
/** Does a CSS selector (subset, see {@link parseCssSelector}) match the snapshot? Invalid selectors match nothing. */
|
|
1901
|
+
declare function matchCssSelector(selector: string | ComplexSelector[], snap: ElementSnapshot): boolean;
|
|
1902
|
+
/**
|
|
1903
|
+
* A partial snapshot read from a stored selector string (clicks captured before snapshots existed):
|
|
1904
|
+
* `#form > div:nth-of-type(2) > button[data-testid="save"]` becomes a `button` with that attribute,
|
|
1905
|
+
* nth 1-unknown, and two ancestors. Shadow steps (`c-app >>> button`) become hosts. Null when the
|
|
1906
|
+
* string is not a selector in the supported subset.
|
|
1907
|
+
*/
|
|
1908
|
+
declare function snapshotFromSelector(selector: string, tag?: string | null): ElementSnapshot | null;
|
|
1909
|
+
type QueryParamOp = "exists" | "absent" | "equals" | "contains";
|
|
1910
|
+
interface QueryParamCondition {
|
|
1911
|
+
name: string;
|
|
1912
|
+
op: QueryParamOp;
|
|
1913
|
+
value?: string;
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* One way a URL belongs to a page. `url`: a pattern (`/accounts/:id/settings`, `/reports/*`,
|
|
1917
|
+
* `/docs/**`, `//*\/billing`, `https://app.acme.com/x`) plus optional query conditions; `regex`: a
|
|
1918
|
+
* regular expression over the path; `title`: the document title (`equals` / `contains`). With
|
|
1919
|
+
* `exclude`, matching URLs are taken out of the page instead.
|
|
1920
|
+
*/
|
|
1921
|
+
interface PageRule {
|
|
1922
|
+
id?: string;
|
|
1923
|
+
type: "url" | "regex" | "title";
|
|
1924
|
+
value: string;
|
|
1925
|
+
op?: "equals" | "contains";
|
|
1926
|
+
query?: QueryParamCondition[];
|
|
1927
|
+
exclude?: boolean;
|
|
1928
|
+
}
|
|
1929
|
+
declare const PAGE_RULE_LIMITS: {
|
|
1930
|
+
readonly rules: 20;
|
|
1931
|
+
readonly value: 500;
|
|
1932
|
+
readonly query: 5;
|
|
1933
|
+
};
|
|
1934
|
+
interface PagePattern {
|
|
1935
|
+
/** Anchored regex source, valid both as a JS RegExp (flag `i`) and a Postgres ARE (`~*`). */
|
|
1936
|
+
source: string;
|
|
1937
|
+
/** What it runs against: the path (query removed) or the full URL without query and hash. */
|
|
1938
|
+
target: "path" | "url";
|
|
1939
|
+
/** Query conditions written into the pattern (`/search?tab=people`). */
|
|
1940
|
+
query: QueryParamCondition[];
|
|
1941
|
+
}
|
|
1942
|
+
/** Turns a URL rule pattern into a regex. Query parameters in the pattern become conditions. */
|
|
1943
|
+
declare function pagePattern(raw: string): PagePattern;
|
|
1944
|
+
/** Regex (JS + Postgres) for a query condition over a raw URL. */
|
|
1945
|
+
declare function queryConditionRegex(c: QueryParamCondition): string;
|
|
1946
|
+
interface PageContext {
|
|
1947
|
+
/** Full URL (with query) when known. */
|
|
1948
|
+
url?: string | null;
|
|
1949
|
+
/** Path as stored (`/a/b`, or `/a/b?section=x` with kept page parameters). */
|
|
1950
|
+
path?: string | null;
|
|
1951
|
+
title?: string | null;
|
|
1952
|
+
}
|
|
1953
|
+
/** JS twin of the SQL a page rule compiles to (server `pageRuleSql`). */
|
|
1954
|
+
declare function pageRuleMatches(rule: PageRule, ctx: PageContext): boolean;
|
|
1955
|
+
/** Included by any include rule and excluded by no exclude rule. */
|
|
1956
|
+
declare function pageRulesMatch(rules: PageRule[], ctx: PageContext): boolean;
|
|
1957
|
+
/** Validation message for a page rule, or null. */
|
|
1958
|
+
declare function pageRuleError(rule: PageRule): string | null;
|
|
1959
|
+
type SelectorOp = "exact" | "prefix" | "contains" | "glob" | "css";
|
|
1960
|
+
/**
|
|
1961
|
+
* One way a click belongs to a feature. Every condition present must hold. `selector.op = "css"`
|
|
1962
|
+
* evaluates a CSS selector against the element snapshot (or, for old clicks, the snapshot read from
|
|
1963
|
+
* the stored selector string); the other selector operators compare the stored selector string —
|
|
1964
|
+
* mobile taps store the accessibility id / `data-guidely-id` there, so `exact` works for them too.
|
|
1965
|
+
*/
|
|
1966
|
+
interface FeatureRule {
|
|
1967
|
+
id?: string;
|
|
1968
|
+
selector?: {
|
|
1969
|
+
op: SelectorOp;
|
|
1970
|
+
value: string;
|
|
1971
|
+
};
|
|
1972
|
+
text?: {
|
|
1973
|
+
op: "equals" | "contains";
|
|
1974
|
+
value: string;
|
|
1975
|
+
};
|
|
1976
|
+
tag?: string;
|
|
1977
|
+
href?: {
|
|
1978
|
+
op: "equals" | "prefix" | "contains";
|
|
1979
|
+
value: string;
|
|
1980
|
+
};
|
|
1981
|
+
/** Only clicks on this tagged page / URL pattern. */
|
|
1982
|
+
page?: {
|
|
1983
|
+
pageId?: string;
|
|
1984
|
+
pattern?: string;
|
|
1985
|
+
};
|
|
1986
|
+
/** `web`, `ios`, `android` (mobile autocapture sets `properties.platform`). */
|
|
1987
|
+
platform?: string;
|
|
1988
|
+
exclude?: boolean;
|
|
1989
|
+
}
|
|
1990
|
+
declare const FEATURE_RULE_LIMITS: {
|
|
1991
|
+
readonly rules: 20;
|
|
1992
|
+
readonly value: 1000;
|
|
1993
|
+
};
|
|
1994
|
+
interface ClickFacts {
|
|
1995
|
+
selector?: string | null;
|
|
1996
|
+
text?: string | null;
|
|
1997
|
+
tag?: string | null;
|
|
1998
|
+
href?: string | null;
|
|
1999
|
+
platform?: string | null;
|
|
2000
|
+
}
|
|
2001
|
+
/** Does a click (facts + a CSS test) satisfy one rule's element conditions? Page scope is checked by the caller. */
|
|
2002
|
+
declare function featureRuleMatchesClick(rule: FeatureRule, click: ClickFacts, css: (selector: string) => boolean): boolean;
|
|
2003
|
+
/** Validation message for a feature rule, or null. */
|
|
2004
|
+
declare function featureRuleError(rule: FeatureRule): string | null;
|
|
2005
|
+
/** Selector to find a feature's elements on a page (dashboard overlays, SDK property capture), when the rules give one. */
|
|
2006
|
+
declare function featureCssSelectors(rules: FeatureRule[]): string[];
|
|
2007
|
+
interface TagPropertyDefinition {
|
|
2008
|
+
id: string;
|
|
2009
|
+
name: string;
|
|
2010
|
+
/** Element to read: CSS selector (may use `>>>`); empty = the clicked element itself (features only). */
|
|
2011
|
+
selector?: string;
|
|
2012
|
+
source: "text" | "attribute";
|
|
2013
|
+
/** Attribute name for `source: "attribute"`; `value` is never read. */
|
|
2014
|
+
attribute?: string;
|
|
2015
|
+
}
|
|
2016
|
+
/** One tag's capture config in the SDK payload (`SdkConfigResponse.tagging.properties`). */
|
|
2017
|
+
interface TagPropertyConfig {
|
|
2018
|
+
kind: "page" | "feature";
|
|
2019
|
+
tagId: string;
|
|
2020
|
+
/** Page rules (pages) or feature rules (features), evaluated in the browser. */
|
|
2021
|
+
pageRules?: PageRule[];
|
|
2022
|
+
featureRules?: FeatureRule[];
|
|
2023
|
+
properties: TagPropertyDefinition[];
|
|
2024
|
+
}
|
|
2025
|
+
interface TaggingSdkConfig {
|
|
2026
|
+
/** Attribute that names features automatically (null = off). */
|
|
2027
|
+
featureAttribute: string | null;
|
|
2028
|
+
properties: TagPropertyConfig[];
|
|
2029
|
+
}
|
|
2030
|
+
declare const TAG_PROPERTY_LIMITS: {
|
|
2031
|
+
readonly perTag: 10;
|
|
2032
|
+
readonly total: 50;
|
|
2033
|
+
readonly value: 100;
|
|
2034
|
+
};
|
|
2035
|
+
/** Attribute names an event property may read. */
|
|
2036
|
+
declare function propertyAttributeAllowed(name: string): boolean;
|
|
2037
|
+
|
|
2038
|
+
/** A published guide as delivered to the SDK. Draft-only data (author, notes) is never included. */
|
|
2039
|
+
interface PublishedGuide {
|
|
2040
|
+
id: string;
|
|
2041
|
+
key: string;
|
|
2042
|
+
name: string;
|
|
2043
|
+
kind: GuideKind;
|
|
2044
|
+
version: number;
|
|
2045
|
+
config: GuideConfig;
|
|
2046
|
+
publishedAt: string;
|
|
2047
|
+
/**
|
|
2048
|
+
* Set while the guide is a variant of a running guide A/B test. Its targeting already carries the
|
|
2049
|
+
* variant's `experiment.bucket` range; SDKs record an `experiment_viewed` exposure
|
|
2050
|
+
* (`{ guideExperimentId, variantId, guideId }`) when it shows.
|
|
2051
|
+
*/
|
|
2052
|
+
experiment?: {
|
|
2053
|
+
id: string;
|
|
2054
|
+
variantId: string;
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
/**
|
|
2058
|
+
* The control group of a running guide A/B test: the base guide's targeting, trigger and frequency
|
|
2059
|
+
* restricted to the control bucket. SDKs evaluate it like a guide but never render it; when it would
|
|
2060
|
+
* show they record the `experiment_viewed` exposure (variant `control`) and its local impression.
|
|
2061
|
+
* SDKs that don't know `guideHoldouts` ignore it (control visitors then simply see nothing).
|
|
2062
|
+
*/
|
|
2063
|
+
interface GuideHoldout {
|
|
2064
|
+
experimentId: string;
|
|
2065
|
+
variantId: string;
|
|
2066
|
+
guide: PublishedGuide;
|
|
2067
|
+
}
|
|
2068
|
+
/** Project-wide limit on automatically shown guides (Project.settings.guideThrottling). */
|
|
2069
|
+
interface GuideThrottlingSettings {
|
|
2070
|
+
enabled: boolean;
|
|
2071
|
+
/** At most this many auto-launched guides per visitor within `windowHours`. */
|
|
2072
|
+
maxGuides: number;
|
|
2073
|
+
windowHours: number;
|
|
2074
|
+
/** Minimum minutes between two auto-launched guides. */
|
|
2075
|
+
minGapMinutes: number;
|
|
2076
|
+
}
|
|
2077
|
+
interface ResourceCenterArticle {
|
|
2078
|
+
id: string;
|
|
2079
|
+
slug: string;
|
|
2080
|
+
title: string;
|
|
2081
|
+
summary: string;
|
|
2082
|
+
body: string;
|
|
2083
|
+
/** True when `body` was left out of the config to keep it small; fetch it from `GET /sdk/articles/:id`. */
|
|
2084
|
+
bodyOmitted?: boolean;
|
|
2085
|
+
collectionId?: string | null;
|
|
2086
|
+
externalUrl?: string | null;
|
|
2087
|
+
/** Listed only for members of any of these audiences (absent = everyone). Not access control. */
|
|
2088
|
+
audienceIds?: string[];
|
|
2089
|
+
/** Guide keys of the article's "Show me" prompts (absent = none); the first one is offered in Help results. */
|
|
2090
|
+
walkthroughs?: string[];
|
|
2091
|
+
/** The article plays a video. */
|
|
2092
|
+
hasVideo?: boolean;
|
|
2093
|
+
updatedAt: string;
|
|
2094
|
+
/** Translations by locale; a `bodyOmitted` translation is fetched with `GET /sdk/articles/:id?locale=`. */
|
|
2095
|
+
translations?: Record<string, {
|
|
2096
|
+
title?: string;
|
|
2097
|
+
summary?: string;
|
|
2098
|
+
body?: string;
|
|
2099
|
+
bodyOmitted?: boolean;
|
|
2100
|
+
}>;
|
|
2101
|
+
}
|
|
2102
|
+
/** A "What's new" entry in the resource center. */
|
|
2103
|
+
interface ResourceCenterAnnouncement {
|
|
2104
|
+
id: string;
|
|
2105
|
+
title: string;
|
|
2106
|
+
/** Sanitized HTML. */
|
|
2107
|
+
body: string;
|
|
2108
|
+
publishedAt: string;
|
|
2109
|
+
/** Guide id or key started by its "Show me" button. */
|
|
2110
|
+
guideId?: string | null;
|
|
2111
|
+
articleId?: string | null;
|
|
2112
|
+
url?: string | null;
|
|
2113
|
+
linkLabel?: string | null;
|
|
2114
|
+
/** Listed only for members of any of these audiences (absent = everyone). */
|
|
2115
|
+
audienceIds?: string[];
|
|
2116
|
+
translations?: Record<string, {
|
|
2117
|
+
title?: string;
|
|
2118
|
+
body?: string;
|
|
2119
|
+
}>;
|
|
2120
|
+
}
|
|
2121
|
+
/** A section of the resource center, in display order; hidden when disabled or its targeting doesn't match. */
|
|
2122
|
+
interface ResourceCenterModule {
|
|
2123
|
+
id: ResourceCenterModuleId;
|
|
2124
|
+
enabled: boolean;
|
|
2125
|
+
/** Evaluated by the SDK like guide targeting (absent = everyone). */
|
|
2126
|
+
targeting?: RuleGroup | null;
|
|
2127
|
+
}
|
|
2128
|
+
interface ResourceCenterCollection {
|
|
2129
|
+
id: string;
|
|
2130
|
+
name: string;
|
|
2131
|
+
description: string;
|
|
2132
|
+
order: number;
|
|
2133
|
+
/** Parent collection for nested collections (absent/null = top level). */
|
|
2134
|
+
parentId?: string | null;
|
|
2135
|
+
/** Listed only for members of any of these audiences, with everything inside it (absent = everyone). */
|
|
2136
|
+
audienceIds?: string[];
|
|
2137
|
+
}
|
|
2138
|
+
interface ResourceCenterConfig {
|
|
2139
|
+
enabled: boolean;
|
|
2140
|
+
title: string;
|
|
2141
|
+
launcher: {
|
|
2142
|
+
position: "bottom-right" | "bottom-left";
|
|
2143
|
+
label: string;
|
|
2144
|
+
showIcon: boolean;
|
|
2145
|
+
};
|
|
2146
|
+
collections: ResourceCenterCollection[];
|
|
2147
|
+
articles: ResourceCenterArticle[];
|
|
2148
|
+
recommendedGuideIds: string[];
|
|
2149
|
+
checklistGuideIds: string[];
|
|
2150
|
+
links: Array<{
|
|
2151
|
+
id: string;
|
|
2152
|
+
label: string;
|
|
2153
|
+
url: string;
|
|
2154
|
+
}>;
|
|
2155
|
+
faqs: Array<{
|
|
2156
|
+
id: string;
|
|
2157
|
+
question: string;
|
|
2158
|
+
answer: string;
|
|
2159
|
+
}>;
|
|
2160
|
+
/** "What's new" (newest first). Absent from servers that predate it. */
|
|
2161
|
+
announcements?: ResourceCenterAnnouncement[];
|
|
2162
|
+
/** Section order and targeting; absent = every section in the default order. */
|
|
2163
|
+
modules?: ResourceCenterModule[];
|
|
2164
|
+
/** Translations of the strings above (see `resourceCenterTextEntries`), by locale. */
|
|
2165
|
+
translations?: Record<string, Record<string, string>>;
|
|
2166
|
+
}
|
|
2167
|
+
interface SdkConfigResponse {
|
|
2168
|
+
projectId: string;
|
|
2169
|
+
environment: string;
|
|
2170
|
+
configVersion: number;
|
|
2171
|
+
theme: z.infer<typeof ProjectThemeSchema>;
|
|
2172
|
+
guides: PublishedGuide[];
|
|
2173
|
+
/** Control groups of running guide A/B tests (see GuideHoldout); absent from older servers. */
|
|
2174
|
+
guideHoldouts?: GuideHoldout[];
|
|
2175
|
+
resourceCenter: ResourceCenterConfig | null;
|
|
2176
|
+
/** Scout messenger; absent from servers that predate it. */
|
|
2177
|
+
messenger?: MessengerConfig | null;
|
|
2178
|
+
settings: {
|
|
2179
|
+
analyticsEnabled: boolean;
|
|
2180
|
+
collectUrls: boolean;
|
|
2181
|
+
maskSelectors: string[];
|
|
2182
|
+
sessionTimeoutMinutes: number;
|
|
2183
|
+
/** Product analytics; absent from servers that predate it (the SDK then captures nothing extra). */
|
|
2184
|
+
autocapture?: AutocaptureSettings;
|
|
2185
|
+
errorTracking?: ErrorTrackingSettings;
|
|
2186
|
+
/** `retentionDays` is server-side only and not sent. */
|
|
2187
|
+
replay?: Omit<ReplaySettings, "retentionDays">;
|
|
2188
|
+
/** Project-wide guide throttling; absent or disabled = no limit. */
|
|
2189
|
+
throttling?: GuideThrottlingSettings;
|
|
2190
|
+
/** The language guides are written in, and the languages they may be translated into. */
|
|
2191
|
+
localization?: {
|
|
2192
|
+
defaultLocale: string;
|
|
2193
|
+
locales: string[];
|
|
2194
|
+
};
|
|
2195
|
+
};
|
|
2196
|
+
/** Tagged pages and features: the feature attribute and DOM event properties; absent from servers that predate them. */
|
|
2197
|
+
tagging?: TaggingSdkConfig;
|
|
2198
|
+
generatedAt: string;
|
|
2199
|
+
}
|
|
2200
|
+
declare const IdentifyRequestSchema: z.ZodObject<{
|
|
2201
|
+
anonymousId: z.ZodString;
|
|
2202
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2203
|
+
traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2204
|
+
account: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
2205
|
+
id: z.ZodString;
|
|
2206
|
+
traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2207
|
+
}, z.core.$strip>>>;
|
|
2208
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2209
|
+
url: z.ZodOptional<z.ZodString>;
|
|
2210
|
+
}, z.core.$strip>;
|
|
2211
|
+
type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;
|
|
2212
|
+
/** Server-held state the SDK needs for targeting & frequency. */
|
|
2213
|
+
interface IdentifyResponse {
|
|
2214
|
+
endUserId: string;
|
|
2215
|
+
audienceIds: string[];
|
|
2216
|
+
guideState: Record<string, {
|
|
2217
|
+
impressions: number;
|
|
2218
|
+
completedAt?: string | null;
|
|
2219
|
+
dismissedAt?: string | null;
|
|
2220
|
+
lastShownAt?: string | null;
|
|
2221
|
+
}>;
|
|
2222
|
+
/** `dismissResetAt` changes when a teammate resets the user's dismissal; SDKs then drop their cached `dismissedAt`. */
|
|
2223
|
+
checklistProgress: Record<string, {
|
|
2224
|
+
completedTaskIds: string[];
|
|
2225
|
+
completedAt?: string | null;
|
|
2226
|
+
dismissedAt?: string | null;
|
|
2227
|
+
dismissResetAt?: string | null;
|
|
2228
|
+
}>;
|
|
2229
|
+
surveysSubmitted: string[];
|
|
2230
|
+
firstSeenAt: string;
|
|
2231
|
+
}
|
|
2232
|
+
declare const ChecklistProgressRequestSchema: z.ZodObject<{
|
|
2233
|
+
anonymousId: z.ZodString;
|
|
2234
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2235
|
+
guideVersion: z.ZodOptional<z.ZodNumber>;
|
|
2236
|
+
completedTaskIds: z.ZodArray<z.ZodString>;
|
|
2237
|
+
dismissed: z.ZodOptional<z.ZodBoolean>;
|
|
2238
|
+
completed: z.ZodOptional<z.ZodBoolean>;
|
|
2239
|
+
}, z.core.$strip>;
|
|
2240
|
+
type ChecklistProgressRequest = z.infer<typeof ChecklistProgressRequestSchema>;
|
|
2241
|
+
declare const SurveyResponseRequestSchema: z.ZodObject<{
|
|
2242
|
+
anonymousId: z.ZodString;
|
|
2243
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2244
|
+
accountId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2245
|
+
guideVersion: z.ZodNumber;
|
|
2246
|
+
answers: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
2247
|
+
responseId: z.ZodString;
|
|
2248
|
+
}, z.core.$strip>;
|
|
2249
|
+
type SurveyResponseRequest = z.infer<typeof SurveyResponseRequestSchema>;
|
|
2250
|
+
declare const GuideStateUpdateSchema: z.ZodObject<{
|
|
2251
|
+
anonymousId: z.ZodString;
|
|
2252
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2253
|
+
updates: z.ZodArray<z.ZodObject<{
|
|
2254
|
+
guideId: z.ZodString;
|
|
2255
|
+
impression: z.ZodOptional<z.ZodBoolean>;
|
|
2256
|
+
completed: z.ZodOptional<z.ZodBoolean>;
|
|
2257
|
+
dismissed: z.ZodOptional<z.ZodBoolean>;
|
|
2258
|
+
}, z.core.$strip>>;
|
|
2259
|
+
}, z.core.$strip>;
|
|
2260
|
+
declare const AuthoringPickSchema: z.ZodObject<{
|
|
2261
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
2262
|
+
selectors: z.ZodArray<z.ZodObject<{
|
|
2263
|
+
kind: z.ZodString;
|
|
2264
|
+
value: z.ZodString;
|
|
2265
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2266
|
+
}, z.core.$strip>>;
|
|
2267
|
+
textSnapshot: z.ZodOptional<z.ZodString>;
|
|
2268
|
+
url: z.ZodOptional<z.ZodString>;
|
|
2269
|
+
rect: z.ZodOptional<z.ZodObject<{
|
|
2270
|
+
x: z.ZodNumber;
|
|
2271
|
+
y: z.ZodNumber;
|
|
2272
|
+
width: z.ZodNumber;
|
|
2273
|
+
height: z.ZodNumber;
|
|
2274
|
+
}, z.core.$strip>>;
|
|
2275
|
+
elementSnapshot: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2276
|
+
}, z.core.$strip>;
|
|
2277
|
+
type AuthoringPick = z.infer<typeof AuthoringPickSchema>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Static, script-free copy of the page an authoring session is connected to. The SDK posts it to
|
|
2280
|
+
* the dashboard (never to the API) so the editor canvas can show the customer's real app.
|
|
2281
|
+
*/
|
|
2282
|
+
interface AppSnapshot {
|
|
2283
|
+
/** Full HTML document (doctype included) with scripts and Guidely UI removed and a `<base>` pointing at `url`. */
|
|
2284
|
+
html: string;
|
|
2285
|
+
url: string;
|
|
2286
|
+
title: string;
|
|
2287
|
+
/** Viewport the snapshot was taken at, in CSS pixels. */
|
|
2288
|
+
width: number;
|
|
2289
|
+
height: number;
|
|
2290
|
+
capturedAt: string;
|
|
2291
|
+
}
|
|
2292
|
+
interface AuthoringSessionInfo {
|
|
2293
|
+
id: string;
|
|
2294
|
+
projectId: string;
|
|
2295
|
+
environment: string;
|
|
2296
|
+
guideId: string | null;
|
|
2297
|
+
dashboardOrigin: string;
|
|
2298
|
+
expiresAt: string;
|
|
2299
|
+
/** `tag`: the session tags pages and features (no guide); absent or `guide` for the guide editor. */
|
|
2300
|
+
purpose?: "guide" | "tag";
|
|
2301
|
+
/** Draft guide config to preview while authoring (not published). */
|
|
2302
|
+
draft: {
|
|
2303
|
+
id: string;
|
|
2304
|
+
key: string;
|
|
2305
|
+
name: string;
|
|
2306
|
+
kind: GuideKind;
|
|
2307
|
+
config: GuideConfig;
|
|
2308
|
+
} | null;
|
|
2309
|
+
}
|
|
2310
|
+
declare const PublishedGuideSchema: z.ZodObject<{
|
|
2311
|
+
id: z.ZodString;
|
|
2312
|
+
key: z.ZodString;
|
|
2313
|
+
name: z.ZodString;
|
|
2314
|
+
kind: z.ZodString;
|
|
2315
|
+
version: z.ZodNumber;
|
|
2316
|
+
config: z.ZodObject<{
|
|
2317
|
+
steps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2318
|
+
id: z.ZodString;
|
|
2319
|
+
type: z.ZodEnum<{
|
|
2320
|
+
custom: "custom";
|
|
2321
|
+
modal: "modal";
|
|
2322
|
+
tooltip: "tooltip";
|
|
2323
|
+
banner: "banner";
|
|
2324
|
+
checklist: "checklist";
|
|
2325
|
+
survey: "survey";
|
|
2326
|
+
popover: "popover";
|
|
2327
|
+
spotlight: "spotlight";
|
|
2328
|
+
hotspot: "hotspot";
|
|
2329
|
+
slideout: "slideout";
|
|
2330
|
+
}>;
|
|
2331
|
+
title: z.ZodDefault<z.ZodString>;
|
|
2332
|
+
body: z.ZodDefault<z.ZodString>;
|
|
2333
|
+
imageUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
2334
|
+
imageAlt: z.ZodOptional<z.ZodString>;
|
|
2335
|
+
videoUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
2336
|
+
buttons: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2337
|
+
id: z.ZodString;
|
|
2338
|
+
label: z.ZodString;
|
|
2339
|
+
action: z.ZodEnum<{
|
|
2340
|
+
skip: "skip";
|
|
2341
|
+
next: "next";
|
|
2342
|
+
back: "back";
|
|
2343
|
+
dismiss: "dismiss";
|
|
2344
|
+
complete: "complete";
|
|
2345
|
+
url: "url";
|
|
2346
|
+
start_guide: "start_guide";
|
|
2347
|
+
event: "event";
|
|
2348
|
+
open_resource_center: "open_resource_center";
|
|
2349
|
+
none: "none";
|
|
2350
|
+
}>;
|
|
2351
|
+
variant: z.ZodDefault<z.ZodEnum<{
|
|
2352
|
+
link: "link";
|
|
2353
|
+
primary: "primary";
|
|
2354
|
+
secondary: "secondary";
|
|
2355
|
+
ghost: "ghost";
|
|
2356
|
+
}>>;
|
|
2357
|
+
value: z.ZodOptional<z.ZodString>;
|
|
2358
|
+
newTab: z.ZodOptional<z.ZodBoolean>;
|
|
2359
|
+
}, z.core.$strip>>>;
|
|
2360
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
2361
|
+
selectors: z.ZodArray<z.ZodObject<{
|
|
2362
|
+
kind: z.ZodEnum<{
|
|
2363
|
+
id: "id";
|
|
2364
|
+
text: "text";
|
|
2365
|
+
css: "css";
|
|
2366
|
+
"data-attr": "data-attr";
|
|
2367
|
+
aria: "aria";
|
|
2368
|
+
xpath: "xpath";
|
|
2369
|
+
"guidely-id": "guidely-id";
|
|
2370
|
+
}>;
|
|
2371
|
+
value: z.ZodString;
|
|
2372
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2373
|
+
}, z.core.$strip>>;
|
|
2374
|
+
waitMs: z.ZodDefault<z.ZodNumber>;
|
|
2375
|
+
fallback: z.ZodDefault<z.ZodEnum<{
|
|
2376
|
+
skip: "skip";
|
|
2377
|
+
show_as_modal: "show_as_modal";
|
|
2378
|
+
end_guide: "end_guide";
|
|
2379
|
+
wait: "wait";
|
|
2380
|
+
}>>;
|
|
2381
|
+
scrollIntoView: z.ZodDefault<z.ZodBoolean>;
|
|
2382
|
+
textSnapshot: z.ZodOptional<z.ZodString>;
|
|
2383
|
+
}, z.core.$strip>>;
|
|
2384
|
+
placement: z.ZodDefault<z.ZodEnum<{
|
|
2385
|
+
top: "top";
|
|
2386
|
+
"top-start": "top-start";
|
|
2387
|
+
"top-end": "top-end";
|
|
2388
|
+
right: "right";
|
|
2389
|
+
"right-start": "right-start";
|
|
2390
|
+
"right-end": "right-end";
|
|
2391
|
+
bottom: "bottom";
|
|
2392
|
+
"bottom-start": "bottom-start";
|
|
2393
|
+
"bottom-end": "bottom-end";
|
|
2394
|
+
left: "left";
|
|
2395
|
+
"left-start": "left-start";
|
|
2396
|
+
"left-end": "left-end";
|
|
2397
|
+
auto: "auto";
|
|
2398
|
+
}>>;
|
|
2399
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
2400
|
+
showOverlay: z.ZodDefault<z.ZodBoolean>;
|
|
2401
|
+
showProgress: z.ZodDefault<z.ZodBoolean>;
|
|
2402
|
+
showClose: z.ZodDefault<z.ZodBoolean>;
|
|
2403
|
+
dismissOnOutsideClick: z.ZodDefault<z.ZodBoolean>;
|
|
2404
|
+
spotlightPadding: z.ZodDefault<z.ZodNumber>;
|
|
2405
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
2406
|
+
top: "top";
|
|
2407
|
+
bottom: "bottom";
|
|
2408
|
+
"top-left": "top-left";
|
|
2409
|
+
"top-right": "top-right";
|
|
2410
|
+
"bottom-left": "bottom-left";
|
|
2411
|
+
"bottom-right": "bottom-right";
|
|
2412
|
+
center: "center";
|
|
2413
|
+
}>>;
|
|
2414
|
+
url: z.ZodOptional<z.ZodString>;
|
|
2415
|
+
advanceOn: z.ZodDefault<z.ZodEnum<{
|
|
2416
|
+
any: "any";
|
|
2417
|
+
button: "button";
|
|
2418
|
+
event: "event";
|
|
2419
|
+
element_click: "element_click";
|
|
2420
|
+
element_visible: "element_visible";
|
|
2421
|
+
delay: "delay";
|
|
2422
|
+
}>>;
|
|
2423
|
+
advanceValue: z.ZodOptional<z.ZodString>;
|
|
2424
|
+
advanceDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
2425
|
+
branches: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2426
|
+
id: z.ZodString;
|
|
2427
|
+
when: z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>;
|
|
2428
|
+
goTo: z.ZodString;
|
|
2429
|
+
}, z.core.$strip>>>;
|
|
2430
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
2431
|
+
targeting: z.ZodOptional<z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>>;
|
|
2432
|
+
hotspot: z.ZodOptional<z.ZodObject<{
|
|
2433
|
+
size: z.ZodDefault<z.ZodNumber>;
|
|
2434
|
+
pulse: z.ZodDefault<z.ZodBoolean>;
|
|
2435
|
+
openOn: z.ZodDefault<z.ZodEnum<{
|
|
2436
|
+
click: "click";
|
|
2437
|
+
hover: "hover";
|
|
2438
|
+
}>>;
|
|
2439
|
+
}, z.core.$strip>>;
|
|
2440
|
+
customHtml: z.ZodOptional<z.ZodString>;
|
|
2441
|
+
code: z.ZodOptional<z.ZodString>;
|
|
2442
|
+
}, z.core.$strip>>>;
|
|
2443
|
+
visibility: z.ZodDefault<z.ZodEnum<{
|
|
2444
|
+
everyone: "everyone";
|
|
2445
|
+
identified: "identified";
|
|
2446
|
+
anonymous: "anonymous";
|
|
2447
|
+
}>>;
|
|
2448
|
+
targeting: z.ZodDefault<z.ZodType<RuleGroup, unknown, z.core.$ZodTypeInternals<RuleGroup, unknown>>>;
|
|
2449
|
+
trigger: z.ZodPrefault<z.ZodObject<{
|
|
2450
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
2451
|
+
event: "event";
|
|
2452
|
+
element_click: "element_click";
|
|
2453
|
+
element_visible: "element_visible";
|
|
2454
|
+
delay: "delay";
|
|
2455
|
+
page_load: "page_load";
|
|
2456
|
+
url_match: "url_match";
|
|
2457
|
+
manual: "manual";
|
|
2458
|
+
after_guide: "after_guide";
|
|
2459
|
+
segment_enter: "segment_enter";
|
|
2460
|
+
}>>;
|
|
2461
|
+
value: z.ZodOptional<z.ZodString>;
|
|
2462
|
+
delayMs: z.ZodDefault<z.ZodNumber>;
|
|
2463
|
+
urlPattern: z.ZodOptional<z.ZodString>;
|
|
2464
|
+
}, z.core.$strip>>;
|
|
2465
|
+
frequency: z.ZodPrefault<z.ZodObject<{
|
|
2466
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
2467
|
+
once: "once";
|
|
2468
|
+
once_per_session: "once_per_session";
|
|
2469
|
+
every_time: "every_time";
|
|
2470
|
+
interval: "interval";
|
|
2471
|
+
}>>;
|
|
2472
|
+
intervalHours: z.ZodOptional<z.ZodNumber>;
|
|
2473
|
+
maxImpressions: z.ZodOptional<z.ZodNumber>;
|
|
2474
|
+
cooldownHours: z.ZodDefault<z.ZodNumber>;
|
|
2475
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
2476
|
+
mutuallyExclusiveWith: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2477
|
+
reshowAfterDismiss: z.ZodDefault<z.ZodBoolean>;
|
|
2478
|
+
ignoreThrottling: z.ZodOptional<z.ZodBoolean>;
|
|
2479
|
+
}, z.core.$strip>>;
|
|
2480
|
+
appearance: z.ZodPrefault<z.ZodObject<{
|
|
2481
|
+
theme: z.ZodDefault<z.ZodEnum<{
|
|
2482
|
+
auto: "auto";
|
|
2483
|
+
light: "light";
|
|
2484
|
+
dark: "dark";
|
|
2485
|
+
}>>;
|
|
2486
|
+
primaryColor: z.ZodOptional<z.ZodString>;
|
|
2487
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
2488
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
2489
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
2490
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
2491
|
+
overlayOpacity: z.ZodOptional<z.ZodNumber>;
|
|
2492
|
+
zIndex: z.ZodOptional<z.ZodNumber>;
|
|
2493
|
+
preset: z.ZodOptional<z.ZodString>;
|
|
2494
|
+
animation: z.ZodDefault<z.ZodEnum<{
|
|
2495
|
+
none: "none";
|
|
2496
|
+
fade: "fade";
|
|
2497
|
+
slide: "slide";
|
|
2498
|
+
}>>;
|
|
2499
|
+
customCss: z.ZodOptional<z.ZodString>;
|
|
2500
|
+
}, z.core.$strip>>;
|
|
2501
|
+
checklist: z.ZodOptional<z.ZodObject<{
|
|
2502
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
2503
|
+
id: z.ZodString;
|
|
2504
|
+
title: z.ZodString;
|
|
2505
|
+
description: z.ZodDefault<z.ZodString>;
|
|
2506
|
+
completion: z.ZodDefault<z.ZodEnum<{
|
|
2507
|
+
event: "event";
|
|
2508
|
+
click: "click";
|
|
2509
|
+
manual: "manual";
|
|
2510
|
+
guide_completed: "guide_completed";
|
|
2511
|
+
url_visited: "url_visited";
|
|
2512
|
+
}>>;
|
|
2513
|
+
completionValue: z.ZodOptional<z.ZodString>;
|
|
2514
|
+
action: z.ZodDefault<z.ZodEnum<{
|
|
2515
|
+
url: "url";
|
|
2516
|
+
start_guide: "start_guide";
|
|
2517
|
+
event: "event";
|
|
2518
|
+
none: "none";
|
|
2519
|
+
}>>;
|
|
2520
|
+
actionValue: z.ZodOptional<z.ZodString>;
|
|
2521
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
2522
|
+
}, z.core.$strip>>;
|
|
2523
|
+
ordered: z.ZodDefault<z.ZodBoolean>;
|
|
2524
|
+
launcherLabel: z.ZodDefault<z.ZodString>;
|
|
2525
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
2526
|
+
"bottom-left": "bottom-left";
|
|
2527
|
+
"bottom-right": "bottom-right";
|
|
2528
|
+
}>>;
|
|
2529
|
+
completionTitle: z.ZodDefault<z.ZodString>;
|
|
2530
|
+
completionBody: z.ZodDefault<z.ZodString>;
|
|
2531
|
+
autoOpen: z.ZodDefault<z.ZodBoolean>;
|
|
2532
|
+
dismissible: z.ZodDefault<z.ZodBoolean>;
|
|
2533
|
+
}, z.core.$strip>>;
|
|
2534
|
+
survey: z.ZodOptional<z.ZodObject<{
|
|
2535
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
2536
|
+
id: z.ZodString;
|
|
2537
|
+
type: z.ZodEnum<{
|
|
2538
|
+
text: "text";
|
|
2539
|
+
nps: "nps";
|
|
2540
|
+
csat: "csat";
|
|
2541
|
+
thumbs: "thumbs";
|
|
2542
|
+
single_choice: "single_choice";
|
|
2543
|
+
multiple_choice: "multiple_choice";
|
|
2544
|
+
rating: "rating";
|
|
2545
|
+
}>;
|
|
2546
|
+
title: z.ZodString;
|
|
2547
|
+
description: z.ZodDefault<z.ZodString>;
|
|
2548
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
2549
|
+
options: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2550
|
+
id: z.ZodString;
|
|
2551
|
+
label: z.ZodString;
|
|
2552
|
+
}, z.core.$strip>>>;
|
|
2553
|
+
scaleMax: z.ZodOptional<z.ZodNumber>;
|
|
2554
|
+
lowLabel: z.ZodOptional<z.ZodString>;
|
|
2555
|
+
highLabel: z.ZodOptional<z.ZodString>;
|
|
2556
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
2557
|
+
showWhen: z.ZodOptional<z.ZodObject<{
|
|
2558
|
+
questionId: z.ZodString;
|
|
2559
|
+
op: z.ZodEnum<{
|
|
2560
|
+
equals: "equals";
|
|
2561
|
+
lte: "lte";
|
|
2562
|
+
gte: "gte";
|
|
2563
|
+
in: "in";
|
|
2564
|
+
}>;
|
|
2565
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>;
|
|
2566
|
+
}, z.core.$strip>>;
|
|
2567
|
+
}, z.core.$strip>>;
|
|
2568
|
+
thankYouTitle: z.ZodDefault<z.ZodString>;
|
|
2569
|
+
thankYouBody: z.ZodDefault<z.ZodString>;
|
|
2570
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
2571
|
+
"bottom-left": "bottom-left";
|
|
2572
|
+
"bottom-right": "bottom-right";
|
|
2573
|
+
center: "center";
|
|
2574
|
+
}>>;
|
|
2575
|
+
startAt: z.ZodOptional<z.ZodString>;
|
|
2576
|
+
endAt: z.ZodOptional<z.ZodString>;
|
|
2577
|
+
}, z.core.$strip>>;
|
|
2578
|
+
urlPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2579
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
2580
|
+
web: "web";
|
|
2581
|
+
ios: "ios";
|
|
2582
|
+
android: "android";
|
|
2583
|
+
}>>>;
|
|
2584
|
+
schedule: z.ZodOptional<z.ZodObject<{
|
|
2585
|
+
startAt: z.ZodOptional<z.ZodString>;
|
|
2586
|
+
endAt: z.ZodOptional<z.ZodString>;
|
|
2587
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
2588
|
+
}, z.core.$strip>>;
|
|
2589
|
+
localization: z.ZodOptional<z.ZodObject<{
|
|
2590
|
+
translations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
2591
|
+
}, z.core.$strip>>;
|
|
2592
|
+
}, z.core.$strip>;
|
|
2593
|
+
publishedAt: z.ZodString;
|
|
2594
|
+
}, z.core.$strip>;
|
|
2595
|
+
interface ApiError {
|
|
2596
|
+
error: {
|
|
2597
|
+
code: string;
|
|
2598
|
+
message: string;
|
|
2599
|
+
details?: unknown;
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
/**
|
|
2604
|
+
* Agent Analytics: the `agent.conversation` turn the customer's own AI agents send (zod-free, so the
|
|
2605
|
+
* browser SDK can use the types and limits without bundling the schema). The schema is in agents.ts.
|
|
2606
|
+
*/
|
|
2607
|
+
declare const AGENT_TURN_ROLES: readonly ["user", "assistant", "tool", "system"];
|
|
2608
|
+
type AgentTurnRole = (typeof AGENT_TURN_ROLES)[number];
|
|
2609
|
+
/** How a conversation ended, as the agent reports it. */
|
|
2610
|
+
declare const AGENT_OUTCOMES: readonly ["success", "failure", "escalated", "abandoned"];
|
|
2611
|
+
type AgentOutcome = (typeof AGENT_OUTCOMES)[number];
|
|
2612
|
+
declare const AGENT_TOOL_STATUSES: readonly ["ok", "error"];
|
|
2613
|
+
type AgentToolStatus = (typeof AGENT_TOOL_STATUSES)[number];
|
|
2614
|
+
/** Longest turn text accepted (characters). */
|
|
2615
|
+
declare const AGENT_TURN_MAX_TEXT = 20000;
|
|
2616
|
+
/** Most turns in one request. */
|
|
2617
|
+
declare const AGENT_TURNS_PER_BATCH = 100;
|
|
2618
|
+
/** Most tool calls on one turn. */
|
|
2619
|
+
declare const AGENT_TOOL_CALLS_PER_TURN = 50;
|
|
2620
|
+
/** Metadata: at most this many keys, string values up to 500 characters, 4 KB in all. */
|
|
2621
|
+
declare const AGENT_METADATA_MAX_KEYS = 30;
|
|
2622
|
+
declare const AGENT_METADATA_MAX_BYTES = 4096;
|
|
2623
|
+
/** The built-in Scout agent's id; customer agents can't use it. */
|
|
2624
|
+
declare const SCOUT_AGENT_ID = "scout";
|
|
2625
|
+
/** One tool the agent called in a turn. Arguments and results are never sent or stored. */
|
|
2626
|
+
interface AgentToolCallInput {
|
|
2627
|
+
name: string;
|
|
2628
|
+
status?: AgentToolStatus;
|
|
2629
|
+
latencyMs?: number;
|
|
2630
|
+
}
|
|
2631
|
+
/** One `agent.conversation` turn. */
|
|
2632
|
+
interface AgentTurnInput {
|
|
2633
|
+
type?: "agent.conversation";
|
|
2634
|
+
/** Your conversation (thread) id. */
|
|
2635
|
+
conversationId: string;
|
|
2636
|
+
/** Your agent's id, e.g. "support-bot". The agent is created on its first turn. */
|
|
2637
|
+
agentId: string;
|
|
2638
|
+
/** Display name for a new agent (defaults to agentId). */
|
|
2639
|
+
agentName?: string;
|
|
2640
|
+
/** Idempotency key: a turn sent twice with the same id is stored once. */
|
|
2641
|
+
turnId?: string;
|
|
2642
|
+
role: AgentTurnRole;
|
|
2643
|
+
text?: string;
|
|
2644
|
+
toolCalls?: AgentToolCallInput[];
|
|
2645
|
+
/** How long the agent took to produce this turn (assistant turns). */
|
|
2646
|
+
latencyMs?: number;
|
|
2647
|
+
/** How the conversation ended, when this turn ends it (the latest reported outcome wins). */
|
|
2648
|
+
outcome?: AgentOutcome;
|
|
2649
|
+
/** Whether the person got what they came for, when the agent knows. */
|
|
2650
|
+
taskSuccess?: boolean;
|
|
2651
|
+
/** ISO 8601 time of the turn (default: when Guidely receives it). */
|
|
2652
|
+
occurredAt?: string;
|
|
2653
|
+
userId?: string | null;
|
|
2654
|
+
anonymousId?: string | null;
|
|
2655
|
+
accountId?: string | null;
|
|
2656
|
+
sessionId?: string | null;
|
|
2657
|
+
/** Flat key/value pairs (strings, numbers, booleans), e.g. { model: "gpt-4.1" }. */
|
|
2658
|
+
metadata?: Record<string, string | number | boolean | null>;
|
|
2659
|
+
}
|
|
2660
|
+
/** Response of both ingestion endpoints. */
|
|
2661
|
+
interface AgentEventsResponse {
|
|
2662
|
+
accepted: number;
|
|
2663
|
+
duplicates: number;
|
|
2664
|
+
/** Turns refused (an agent past the per-project limit, or a conversation past its turn limit). */
|
|
2665
|
+
rejected?: number;
|
|
2666
|
+
/** Turns dropped because this month's product analytics allowance is used up. */
|
|
2667
|
+
overLimit?: number;
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
/** rrweb plugin name for network events in recordings (event type 6, `data.plugin`). */
|
|
2671
|
+
declare const NETWORK_PLUGIN = "guidely/network@1";
|
|
2672
|
+
/** Request kinds, from `fetch`/`XMLHttpRequest` patching or `PerformanceResourceTiming.initiatorType`. */
|
|
2673
|
+
type NetworkRequestType = "fetch" | "xhr" | "websocket" | "document" | "script" | "stylesheet" | "image" | "font" | "media" | "beacon" | "other";
|
|
2674
|
+
/**
|
|
2675
|
+
* One network request in a recording: the payload of an rrweb plugin event
|
|
2676
|
+
* `{ type: 6, data: { plugin: NETWORK_PLUGIN, payload: NetworkPluginPayload } }`, batched.
|
|
2677
|
+
* Times are epoch milliseconds (same clock as rrweb event timestamps).
|
|
2678
|
+
*
|
|
2679
|
+
* A WebSocket is a request with `type: "websocket"` and `method: "GET"`, emitted when it opens
|
|
2680
|
+
* (`startTime`) and again, with the same `id`, when it closes (`endTime`, `closeCode`, `closeReason`,
|
|
2681
|
+
* totals in `messages`). Its frames are `WebSocketMessage`s referencing that `id`.
|
|
2682
|
+
*/
|
|
2683
|
+
interface NetworkRequest {
|
|
2684
|
+
/** Stable id within the recording. */
|
|
2685
|
+
id: string;
|
|
2686
|
+
type: NetworkRequestType;
|
|
2687
|
+
method: string;
|
|
2688
|
+
/** Absolute URL; values of sensitive-looking query parameters replaced with `[redacted]`. */
|
|
2689
|
+
url: string;
|
|
2690
|
+
startTime: number;
|
|
2691
|
+
endTime?: number;
|
|
2692
|
+
durationMs?: number;
|
|
2693
|
+
/** HTTP status; 0 for network errors / blocked / aborted. Absent when the browser doesn't expose it. */
|
|
2694
|
+
status?: number;
|
|
2695
|
+
/** Set for failed requests: network error, abort or timeout message. */
|
|
2696
|
+
error?: string;
|
|
2697
|
+
/** Encoded bytes transferred / decoded response size, when known. */
|
|
2698
|
+
transferSize?: number;
|
|
2699
|
+
responseSize?: number;
|
|
2700
|
+
/** Only when `recordNetworkPayloads` is on; sensitive headers are `[redacted]`. */
|
|
2701
|
+
requestHeaders?: Record<string, string>;
|
|
2702
|
+
responseHeaders?: Record<string, string>;
|
|
2703
|
+
/** Text/JSON bodies, ≤10KB, sensitive JSON fields masked; `[binary]` / `[truncated]` markers otherwise. */
|
|
2704
|
+
requestBody?: string;
|
|
2705
|
+
responseBody?: string;
|
|
2706
|
+
/** WebSocket only: negotiated subprotocol, close details, and frame totals (all frames, including ones not recorded). */
|
|
2707
|
+
protocol?: string;
|
|
2708
|
+
closeCode?: number;
|
|
2709
|
+
closeReason?: string;
|
|
2710
|
+
messages?: {
|
|
2711
|
+
sent: number;
|
|
2712
|
+
received: number;
|
|
2713
|
+
sentBytes: number;
|
|
2714
|
+
receivedBytes: number;
|
|
2715
|
+
recorded: number;
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
/** One WebSocket frame. At most `WS_MAX_MESSAGES_PER_SOCKET` are recorded per connection per page load. */
|
|
2719
|
+
interface WebSocketMessage {
|
|
2720
|
+
/** The `NetworkRequest.id` of the connection. */
|
|
2721
|
+
socketId: string;
|
|
2722
|
+
dir: "send" | "recv";
|
|
2723
|
+
time: number;
|
|
2724
|
+
/** Bytes (UTF-8 length for text frames). */
|
|
2725
|
+
size: number;
|
|
2726
|
+
binary?: boolean;
|
|
2727
|
+
/** Only with `recordNetworkPayloads`: text ≤ 2KB (JSON with sensitive keys masked), else `[truncated]`; binary frames are `[binary <n> B]`. */
|
|
2728
|
+
data?: string;
|
|
2729
|
+
}
|
|
2730
|
+
interface NetworkPluginPayload {
|
|
2731
|
+
requests?: NetworkRequest[];
|
|
2732
|
+
messages?: WebSocketMessage[];
|
|
2733
|
+
/** Requests/frames dropped since the previous payload because a cap was reached. */
|
|
2734
|
+
dropped?: {
|
|
2735
|
+
requests?: number;
|
|
2736
|
+
messages?: number;
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2739
|
+
declare const WS_MAX_MESSAGES_PER_SOCKET = 200;
|
|
2740
|
+
declare const WS_MAX_MESSAGE_BYTES = 2048;
|
|
2741
|
+
/** Header names always replaced with `[redacted]` when payload capture is on. */
|
|
2742
|
+
declare const SENSITIVE_HEADER_PATTERN: RegExp;
|
|
2743
|
+
/** Query parameter and JSON field names whose values are redacted. */
|
|
2744
|
+
declare const SENSITIVE_PARAM_PATTERN: RegExp;
|
|
2745
|
+
|
|
2746
|
+
/**
|
|
2747
|
+
* Media in article bodies: uploaded images, videos and PDFs, and video embeds from a fixed set of hosts.
|
|
2748
|
+
* Sanitizers (server, browser runtime) only keep an `<iframe>` whose `src` is the canonical embed URL
|
|
2749
|
+
* that `toEmbedUrl` produces, so authors can never point a frame anywhere else.
|
|
2750
|
+
*
|
|
2751
|
+
* An uploaded PDF reads inline, as its pages: the dashboard renders each page to an image when the
|
|
2752
|
+
* PDF is uploaded, and the body holds plain HTML every renderer already understands:
|
|
2753
|
+
*
|
|
2754
|
+
* <div class="gd-pdf">
|
|
2755
|
+
* <a class="gd-file" href="…/{id}.pdf" target="_blank">{file name}</a>
|
|
2756
|
+
* <div class="gd-pdf-pages"><img src="…/{page}.webp" alt="{file name}, page 1 of 12"> …</div>
|
|
2757
|
+
* </div>
|
|
2758
|
+
*
|
|
2759
|
+
* Renderers that know the classes draw a swipeable page viewer with the PDF one tap away; older ones
|
|
2760
|
+
* show a link and the pages as images. A PDF whose pages couldn't be rendered (password-protected,
|
|
2761
|
+
* damaged) is just the `gd-file` link, drawn as a file card.
|
|
2762
|
+
*/
|
|
2763
|
+
type EmbedProvider = "youtube" | "vimeo" | "loom" | "wistia";
|
|
2764
|
+
interface VideoEmbed {
|
|
2765
|
+
provider: EmbedProvider;
|
|
2766
|
+
/** Canonical player URL, safe to use as an iframe `src`. */
|
|
2767
|
+
src: string;
|
|
2768
|
+
/** Page a viewer can open instead (native SDKs show a link rather than a player). */
|
|
2769
|
+
watchUrl: string;
|
|
2770
|
+
/** Accessible iframe title. */
|
|
2771
|
+
title: string;
|
|
2772
|
+
}
|
|
2773
|
+
declare const MEDIA_IMAGE_TYPES: readonly ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
2774
|
+
declare const MEDIA_VIDEO_TYPES: readonly ["video/mp4", "video/webm"];
|
|
2775
|
+
declare const MEDIA_FILE_TYPES: readonly ["application/pdf"];
|
|
2776
|
+
type MediaContentType = (typeof MEDIA_IMAGE_TYPES)[number] | (typeof MEDIA_VIDEO_TYPES)[number] | (typeof MEDIA_FILE_TYPES)[number];
|
|
2777
|
+
type MediaKind = "image" | "video" | "file";
|
|
2778
|
+
declare const MEDIA_IMAGE_MAX_BYTES: number;
|
|
2779
|
+
declare const MEDIA_VIDEO_MAX_BYTES: number;
|
|
2780
|
+
declare const MEDIA_FILE_MAX_BYTES: number;
|
|
2781
|
+
/** The largest upload of any type. */
|
|
2782
|
+
declare const MEDIA_MAX_BYTES: number;
|
|
2783
|
+
declare function isMediaContentType(type: string): type is MediaContentType;
|
|
2784
|
+
declare function isVideoContentType(type: string): boolean;
|
|
2785
|
+
declare function mediaKind(type: string): MediaKind | null;
|
|
2786
|
+
declare function mediaMaxBytes(type: string): number;
|
|
2787
|
+
/** Class marking a link as an attached file (an uploaded PDF), drawn as a file card. */
|
|
2788
|
+
declare const FILE_LINK_CLASS = "gd-file";
|
|
2789
|
+
/** Class of the block holding a PDF's link and its rendered pages. */
|
|
2790
|
+
declare const PDF_BLOCK_CLASS = "gd-pdf";
|
|
2791
|
+
/** Class of the element wrapping a PDF's page images. */
|
|
2792
|
+
declare const PDF_PAGES_CLASS = "gd-pdf-pages";
|
|
2793
|
+
/** Pages rendered inline per PDF; readers open the PDF itself for the rest. */
|
|
2794
|
+
declare const PDF_MAX_PAGES = 40;
|
|
2795
|
+
/** True for an `<a>` with the file class and an absolute http(s) `href`: render it as a file card. */
|
|
2796
|
+
declare function isFileLink(className: string | null | undefined, href: string | null | undefined): boolean;
|
|
2797
|
+
/**
|
|
2798
|
+
* Turns a pasted video page or player URL from YouTube, Vimeo, Loom or Wistia into its canonical
|
|
2799
|
+
* embed. Returns null for anything else, including lookalike hosts.
|
|
2800
|
+
*/
|
|
2801
|
+
declare function toEmbedUrl(input: string): VideoEmbed | null;
|
|
2802
|
+
/** True only for a canonical embed URL (exactly what `toEmbedUrl` returns), so an iframe can't be pointed elsewhere. */
|
|
2803
|
+
declare function isAllowedEmbedSrc(src: string | null | undefined): boolean;
|
|
2804
|
+
/** Fixed iframe attributes for an embed; sanitizers overwrite whatever the author's HTML carried. */
|
|
2805
|
+
declare const EMBED_IFRAME_ATTRS: Readonly<Record<string, string>>;
|
|
2806
|
+
/** Fixed `<video>` attributes: player controls, no autoplay or loop. */
|
|
2807
|
+
declare const VIDEO_ATTRS: Readonly<Record<string, string>>;
|
|
2808
|
+
/** `<video src>` / `poster` must be plain http(s): no data:, blob: or relative URLs (bodies render on customer sites). */
|
|
2809
|
+
declare function isSafeMediaUrl(url: string | null | undefined): boolean;
|
|
2810
|
+
/**
|
|
2811
|
+
* Still image for a guide step's video (`videoUrl`): YouTube serves one per video; other hosts don't
|
|
2812
|
+
* without an API call, so those steps use their own image (`imageUrl`) as the poster, or a plain tile.
|
|
2813
|
+
*/
|
|
2814
|
+
declare function videoThumbnailUrl(url: string | null | undefined): string | null;
|
|
2815
|
+
/** A video file a `<video>` can load directly (shows its first frame when there's no poster). */
|
|
2816
|
+
declare function isVideoFileUrl(url: string | null | undefined): boolean;
|
|
2817
|
+
/**
|
|
2818
|
+
* The video shown on a guide step: a poster with a play button that opens `url` in a new tab.
|
|
2819
|
+
* `poster` is the step's image, else the provider's thumbnail; null means draw a plain tile.
|
|
2820
|
+
*/
|
|
2821
|
+
declare function stepVideo(step: {
|
|
2822
|
+
videoUrl?: string | null;
|
|
2823
|
+
imageUrl?: string | null;
|
|
2824
|
+
}): {
|
|
2825
|
+
url: string;
|
|
2826
|
+
poster: string | null;
|
|
2827
|
+
} | null;
|
|
2828
|
+
|
|
2829
|
+
/**
|
|
2830
|
+
* Page helpers shared by the SDK (page-aware messenger) and the server (page matching, analytics).
|
|
2831
|
+
* Pure and zod-free.
|
|
2832
|
+
*/
|
|
2833
|
+
/**
|
|
2834
|
+
* One path segment that looks like an identifier: digits, a UUID, or a long hex string (hashes,
|
|
2835
|
+
* Mongo ids). Written so the same source works as a JS RegExp and a Postgres ARE (`regexp_replace`
|
|
2836
|
+
* with flags `gi`), which keeps id folding identical in SQL and in code. A segment may be followed
|
|
2837
|
+
* by the page query parameters a project keeps in its paths (`/contacts/42?tab=notes`).
|
|
2838
|
+
*/
|
|
2839
|
+
declare const PATH_ID_PATTERN = "/([0-9]+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{12,})(?=[/?]|$)";
|
|
2840
|
+
/** `/contacts/42/notes/9f8e…` → `/contacts/:id/notes/:id`; `/contacts/42?tab=notes` → `/contacts/:id?tab=notes`. */
|
|
2841
|
+
declare function foldPathIds(path: string): string;
|
|
2842
|
+
/** Words describing a page, from its path (`/settings/billing-plans/42` → `settings billing plans`). */
|
|
2843
|
+
declare function pageTerms(path: string): string[];
|
|
2844
|
+
/** A short human name for a page (`/app/invoices/42` → `Invoices`), or null for the root and unnamed pages. */
|
|
2845
|
+
declare function pageLabel(path: string): string | null;
|
|
2846
|
+
/** The first name in a user's traits (`firstName`, `first_name`, or the first word of `name`), or null. */
|
|
2847
|
+
declare function firstNameFromTraits(traits: Record<string, unknown> | null | undefined): string | null;
|
|
2848
|
+
|
|
2849
|
+
/**
|
|
2850
|
+
* Guide and resource-center localization (zod-free, so the browser SDK can import it).
|
|
2851
|
+
*
|
|
2852
|
+
* Every translatable text field has a stable key derived from ids, never from positions, so
|
|
2853
|
+
* reordering steps keeps translations attached: `steps.<stepId>.title`,
|
|
2854
|
+
* `steps.<stepId>.buttons.<buttonId>.label`, `checklist.tasks.<taskId>.title`,
|
|
2855
|
+
* `survey.questions.<questionId>.options.<optionId>.label`, …
|
|
2856
|
+
*
|
|
2857
|
+
* A visitor's language comes from (in order) an explicit SDK locale, the `language` / `locale`
|
|
2858
|
+
* trait, then the browser / device language. `resolveLocale` matches it against the languages a
|
|
2859
|
+
* guide is translated into (exact tag first, then the base language) and falls back to the
|
|
2860
|
+
* project's default language, in which the guide is written.
|
|
2861
|
+
*/
|
|
2862
|
+
|
|
2863
|
+
type TextKind = "text" | "html";
|
|
2864
|
+
interface TextEntry {
|
|
2865
|
+
key: string;
|
|
2866
|
+
/** Default-language text. */
|
|
2867
|
+
source: string;
|
|
2868
|
+
kind: TextKind;
|
|
2869
|
+
/** Human-readable location for translators ("Step 2 · Title"). */
|
|
2870
|
+
label: string;
|
|
2871
|
+
}
|
|
2872
|
+
/** Project-level language settings (Project.settings.localization). */
|
|
2873
|
+
interface LocalizationSettings {
|
|
2874
|
+
/** Language the content is written in. */
|
|
2875
|
+
defaultLocale: string;
|
|
2876
|
+
/** Additional languages offered for translation. */
|
|
2877
|
+
locales: string[];
|
|
2878
|
+
/** Machine-translate new and changed text into every language automatically. */
|
|
2879
|
+
autoTranslate?: boolean;
|
|
2880
|
+
/** Machine translations need a teammate's approval before visitors see them. */
|
|
2881
|
+
requireReview?: boolean;
|
|
2882
|
+
}
|
|
2883
|
+
/**
|
|
2884
|
+
* Review state of one translated text. `machine` texts were written by AI translation; `human`
|
|
2885
|
+
* ones were typed or imported by a teammate (approved by doing so). `outdated` means the source
|
|
2886
|
+
* text changed after the translation was written or approved.
|
|
2887
|
+
*/
|
|
2888
|
+
interface TranslationReviewState {
|
|
2889
|
+
origin: "machine" | "human";
|
|
2890
|
+
approved: boolean;
|
|
2891
|
+
outdated: boolean;
|
|
2892
|
+
reviewedBy?: string | null;
|
|
2893
|
+
reviewedAt?: string | null;
|
|
2894
|
+
}
|
|
2895
|
+
/** locale → key → review state. Texts without a state are human translations from before review existed. */
|
|
2896
|
+
type TranslationReviewMap = Record<string, Record<string, TranslationReviewState>>;
|
|
2897
|
+
/** Does this translation still need a teammate to look at it? */
|
|
2898
|
+
declare function needsReview(state: TranslationReviewState | undefined): boolean;
|
|
2899
|
+
declare const DEFAULT_LOCALE = "en";
|
|
2900
|
+
/** Common languages offered in the dashboard's language picker (any BCP 47 tag is accepted). */
|
|
2901
|
+
declare const COMMON_LOCALES: Array<{
|
|
2902
|
+
code: string;
|
|
2903
|
+
name: string;
|
|
2904
|
+
}>;
|
|
2905
|
+
declare function localeName(code: string): string;
|
|
2906
|
+
/** `fr_FR` / `FR-fr` → `fr-FR`; script subtags keep title case (`zh-hans` → `zh-Hans`). Invalid input → "". */
|
|
2907
|
+
declare function normalizeLocale(input: unknown): string;
|
|
2908
|
+
declare function baseLanguage(locale: string): string;
|
|
2909
|
+
/**
|
|
2910
|
+
* Picks the language to show: for each requested locale in order, an exact match among
|
|
2911
|
+
* `available`, else one sharing its base language (`fr-CA` → `fr`, `fr` → `fr-FR`). Falls back to
|
|
2912
|
+
* `defaultLocale`. Matching ignores case.
|
|
2913
|
+
*/
|
|
2914
|
+
declare function resolveLocale(requested: ReadonlyArray<string | null | undefined>, available: readonly string[], defaultLocale?: string): string;
|
|
2915
|
+
/** Locale candidates for a visitor: explicit option, traits (`language`, `locale`), then the platform's languages. */
|
|
2916
|
+
declare function visitorLocales(explicit: string | null | undefined, traits: Record<string, unknown> | null | undefined, platform?: ReadonlyArray<string | null | undefined>): string[];
|
|
2917
|
+
/** Every translatable text in a guide config, in display order. Empty texts are skipped. */
|
|
2918
|
+
declare function guideTextEntries(config: Pick<GuideConfig, "steps" | "checklist" | "survey">): TextEntry[];
|
|
2919
|
+
/** Locales a guide has any translation for. */
|
|
2920
|
+
declare function guideLocales(config: Pick<GuideConfig, "localization">): string[];
|
|
2921
|
+
/** The config with one language's translations applied (untranslated texts keep the default language). */
|
|
2922
|
+
declare function applyGuideTranslations<C extends Pick<GuideConfig, "steps" | "checklist" | "survey">>(config: C, map: Record<string, string> | undefined): C;
|
|
2923
|
+
/**
|
|
2924
|
+
* The guide as a visitor speaking `requested` should see it, with `locale` set to the language
|
|
2925
|
+
* chosen (the default language when none of the guide's translations match).
|
|
2926
|
+
*/
|
|
2927
|
+
declare function localizeGuide(guide: PublishedGuide, requested: readonly string[], defaultLocale?: string): PublishedGuide & {
|
|
2928
|
+
locale: string;
|
|
2929
|
+
};
|
|
2930
|
+
interface TranslationCoverage {
|
|
2931
|
+
locale: string;
|
|
2932
|
+
total: number;
|
|
2933
|
+
translated: number;
|
|
2934
|
+
/** Keys with no translation. */
|
|
2935
|
+
missing: string[];
|
|
2936
|
+
/** Keys whose translation exists but whose key no longer matches any text (stale). */
|
|
2937
|
+
stale: string[];
|
|
2938
|
+
}
|
|
2939
|
+
declare function translationCoverage(entries: readonly TextEntry[], map: Record<string, string> | undefined, locale: string): TranslationCoverage;
|
|
2940
|
+
/** Translations carried by the published resource center (texts other than articles and announcements). */
|
|
2941
|
+
type ResourceCenterTranslations = Record<string, Record<string, string>>;
|
|
2942
|
+
/** Translatable resource-center texts (title, launcher label, links, FAQs, collections). */
|
|
2943
|
+
declare function resourceCenterTextEntries(rc: Pick<ResourceCenterConfig, "title" | "launcher" | "links" | "faqs" | "collections">): TextEntry[];
|
|
2944
|
+
/** Article texts, keyed `title` / `summary` / `body`. */
|
|
2945
|
+
declare function articleTextEntries(a: {
|
|
2946
|
+
title: string;
|
|
2947
|
+
summary?: string | null;
|
|
2948
|
+
body?: string | null;
|
|
2949
|
+
}): TextEntry[];
|
|
2950
|
+
/** Locales the resource center offers (its own strings, articles or announcements). */
|
|
2951
|
+
declare function resourceCenterLocales(rc: ResourceCenterConfig): string[];
|
|
2952
|
+
declare function localizeArticle(a: ResourceCenterArticle, locale: string): ResourceCenterArticle;
|
|
2953
|
+
declare function localizeAnnouncement(a: ResourceCenterAnnouncement, locale: string): ResourceCenterAnnouncement;
|
|
2954
|
+
/** The resource center in the visitor's language (with `locale` = the language chosen). */
|
|
2955
|
+
declare function localizeResourceCenter(rc: ResourceCenterConfig, requested: readonly string[], defaultLocale?: string): ResourceCenterConfig & {
|
|
2956
|
+
locale: string;
|
|
2957
|
+
};
|
|
2958
|
+
|
|
2959
|
+
/** The "no guide" variant: visitors in it see nothing, and are measured against the guide variants. */
|
|
2960
|
+
declare const CONTROL_VARIANT_ID = "control";
|
|
2961
|
+
declare const GUIDE_EXPERIMENT_STATUSES: readonly ["draft", "running", "completed"];
|
|
2962
|
+
type GuideExperimentStatus = (typeof GUIDE_EXPERIMENT_STATUSES)[number];
|
|
2963
|
+
declare const GUIDE_EXPERIMENT_GOALS: readonly ["guide_completed", "event", "page_visit", "click_text"];
|
|
2964
|
+
type GuideExperimentGoalKind = (typeof GUIDE_EXPERIMENT_GOALS)[number];
|
|
2965
|
+
declare const GUIDE_EXPERIMENT_GOAL_LABELS: Record<GuideExperimentGoalKind, string>;
|
|
2966
|
+
interface GuideExperimentGoal {
|
|
2967
|
+
kind: GuideExperimentGoalKind;
|
|
2968
|
+
/** Event name, page path pattern (`/billing/*`) or click text, depending on `kind`. */
|
|
2969
|
+
value?: string;
|
|
2970
|
+
}
|
|
2971
|
+
interface GuideExperimentVariant {
|
|
2972
|
+
id: string;
|
|
2973
|
+
name: string;
|
|
2974
|
+
/** The guide shown to this variant; null for the control group (no guide). */
|
|
2975
|
+
guideId: string | null;
|
|
2976
|
+
/** Share of visitors, a whole percentage; all weights sum to 100. */
|
|
2977
|
+
weight: number;
|
|
2978
|
+
}
|
|
2979
|
+
declare function experimentSalt(experimentId: string): string;
|
|
2980
|
+
/** Bucket ranges `[from, to)` per variant, in order. */
|
|
2981
|
+
declare function variantRanges(variants: ReadonlyArray<Pick<GuideExperimentVariant, "id" | "weight">>): Array<{
|
|
2982
|
+
id: string;
|
|
2983
|
+
from: number;
|
|
2984
|
+
to: number;
|
|
2985
|
+
}>;
|
|
2986
|
+
/** The variant a visitor is in, or null when weights leave their bucket unassigned. */
|
|
2987
|
+
declare function assignGuideVariant(variants: ReadonlyArray<Pick<GuideExperimentVariant, "id" | "weight">>, experimentId: string, subject: string): string | null;
|
|
2988
|
+
/** Rules restricting targeting to bucket range `[from, to)` of `salt`. */
|
|
2989
|
+
declare function experimentBucketRules(salt: string, from: number, to: number): Rule[];
|
|
2990
|
+
/** Targeting with a variant's bucket range folded in (an SDK without `experiment.bucket` shows the guide to nobody). */
|
|
2991
|
+
declare function withExperimentBucket(targeting: RuleGroup, salt: string, from: number, to: number): RuleGroup;
|
|
2992
|
+
/** Problems with a variant list; empty when it can run. */
|
|
2993
|
+
declare function variantProblems(variants: ReadonlyArray<GuideExperimentVariant>): string[];
|
|
2994
|
+
/** Splits 100% as evenly as possible across `n` variants (first ones get the remainder). */
|
|
2995
|
+
declare function evenWeights(n: number): number[];
|
|
2996
|
+
|
|
2997
|
+
/**
|
|
2998
|
+
* Custom CSS for guides and themes (zod-free; the server sanitizes on save, the web runtime
|
|
2999
|
+
* sanitizes again and scopes before injecting).
|
|
3000
|
+
*
|
|
3001
|
+
* Guides render inside the SDK's Shadow DOM, so page styles and guide styles never mix. Within the
|
|
3002
|
+
* shadow root, every rule is additionally prefixed with the guide's own container selector, so one
|
|
3003
|
+
* guide's CSS can't restyle another guide, the resource center or the messenger. Sanitizing removes
|
|
3004
|
+
* what could reach outside the container or load anything: `@import`, `:host` / `::slotted` rules,
|
|
3005
|
+
* `url()`s other than https images and `data:image/…`, legacy script hooks (`expression()`,
|
|
3006
|
+
* `behavior`, `-moz-binding`, `javascript:`) and any markup.
|
|
3007
|
+
*/
|
|
3008
|
+
declare const MAX_CUSTOM_CSS = 20000;
|
|
3009
|
+
/** Removes everything unsafe; keeps the rule structure. */
|
|
3010
|
+
declare function sanitizeCustomCss(input: string | null | undefined): string;
|
|
3011
|
+
/**
|
|
3012
|
+
* Prefixes every selector with `scope` (e.g. `.g-scope[data-guide="abc"]`). `:root`, `html`,
|
|
3013
|
+
* `body`, `:scope` and `&` at the start of a selector refer to the container itself.
|
|
3014
|
+
*/
|
|
3015
|
+
declare function scopeCustomCss(css: string, scope: string): string;
|
|
3016
|
+
|
|
3017
|
+
/**
|
|
3018
|
+
* WCAG 2.1 colour contrast (zod-free). The editor warns when a guide's colours fall below AA:
|
|
3019
|
+
* 4.5:1 for body text, 3:1 for large text and UI components (button outlines, the close icon).
|
|
3020
|
+
*/
|
|
3021
|
+
declare const WCAG_AA_TEXT = 4.5;
|
|
3022
|
+
declare const WCAG_AA_LARGE = 3;
|
|
3023
|
+
/** `#rgb` / `#rrggbb` → [r, g, b]; null when not a hex colour. */
|
|
3024
|
+
declare function parseHexColor(hex: string | null | undefined): [number, number, number] | null;
|
|
3025
|
+
declare function relativeLuminance(hex: string): number | null;
|
|
3026
|
+
/** Contrast ratio 1–21 between two hex colours, or null when either is not a hex colour. */
|
|
3027
|
+
declare function contrastRatio(a: string, b: string): number | null;
|
|
3028
|
+
/** Text colour (black or white) with the better contrast on `background`. */
|
|
3029
|
+
declare function readableTextOn(background: string): "#ffffff" | "#111827";
|
|
3030
|
+
interface ContrastIssue {
|
|
3031
|
+
/** What is hard to read. */
|
|
3032
|
+
pair: "text" | "button" | "link";
|
|
3033
|
+
ratio: number;
|
|
3034
|
+
required: number;
|
|
3035
|
+
message: string;
|
|
3036
|
+
}
|
|
3037
|
+
/**
|
|
3038
|
+
* Contrast problems of a guide's effective colours (guide appearance over the project theme).
|
|
3039
|
+
* Buttons use white or dark text, whichever reads better, so only a mid-tone primary colour fails.
|
|
3040
|
+
*/
|
|
3041
|
+
declare function contrastIssues(colors: {
|
|
3042
|
+
primaryColor?: string;
|
|
3043
|
+
backgroundColor?: string;
|
|
3044
|
+
textColor?: string;
|
|
3045
|
+
}): ContrastIssue[];
|
|
3046
|
+
|
|
3047
|
+
export { type ChecklistProgressRequest as $, ADVANCE_ON as A, type AttrTest as B, type AuthoringPick as C, AuthoringPickSchema as D, type AuthoringSessionInfo as E, type AutocaptureSettings as F, type GuideKind as G, AutocaptureSettingsSchema as H, BUTTON_ACTIONS as I, ButtonSchema as J, CAPTURE_PARAM as K, CAPTURE_SCREENSHOT_MAX_BYTES as L, COMMON_LOCALES as M, COMPLAINT_EVENTS as N, COMPLAINT_FIELD_TYPES as O, COMPLAINT_STATUSES as P, CONTROL_VARIANT_ID as Q, type RuleGroup as R, type CaptureSessionInfo as S, type CaptureSettings as T, type CaptureStep as U, type CaptureStepInput as V, CaptureStepSchema as W, type CapturedElement as X, CapturedElementSchema as Y, type ChecklistConfig as Z, ChecklistConfigSchema as _, type Rule as a, GuideStateUpdateSchema as a$, ChecklistProgressRequestSchema as a0, type ChecklistTask as a1, ChecklistTaskSchema as a2, type ClickFacts as a3, type ComplaintEvent as a4, type ComplaintField as a5, type ComplaintFieldType as a6, type ComplaintStatus as a7, type ComplexSelector as a8, type Compound as a9, type FeatureRule as aA, type FeedbackEvent as aB, type FeedbackPriority as aC, type FeedbackStatus as aD, type FeedbackUpdate as aE, type FeedbackUpdatesResponse as aF, type FileComplaintResponse as aG, type FrequencyConfig as aH, FrequencySchema as aI, GUIDELY_ID_ATTRIBUTE as aJ, GUIDE_EXPERIMENT_GOALS as aK, GUIDE_EXPERIMENT_GOAL_LABELS as aL, GUIDE_EXPERIMENT_STATUSES as aM, GUIDE_KINDS as aN, GUIDE_STATUSES as aO, GUIDE_VISIBILITIES as aP, type GuideConfig as aQ, GuideConfigSchema as aR, type GuideExperimentGoal as aS, type GuideExperimentGoalKind as aT, type GuideExperimentStatus as aU, type GuideExperimentVariant as aV, type GuideHoldout as aW, type GuideLocalization as aX, GuideLocalizationSchema as aY, type GuideSchedule as aZ, GuideScheduleSchema as a_, type ContrastIssue as aa, type ConversationLookupResponse as ab, ConversationLookupSchema as ac, type ConversationMessagesResponse as ad, ConversationRatingSchema as ae, type ConversationStatus as af, DEFAULT_CAPTURE_SETTINGS as ag, DEFAULT_FEATURE_ATTRIBUTE as ah, DEFAULT_LOCALE as ai, DEFAULT_PLATFORMS as aj, EMBED_IFRAME_ATTRS as ak, type ElementNode as al, type ElementSnapshot as am, type EmbedProvider as an, type ErrorTrackingSettings as ao, ErrorTrackingSettingsSchema as ap, type ExceptionProperties as aq, FEATURE_ATTRIBUTE_PATTERN as ar, FEATURE_RULE_LIMITS as as, FEEDBACK_EVENTS as at, FEEDBACK_PRIORITIES as au, FEEDBACK_PRIORITY_LABEL as av, FEEDBACK_PRIORITY_WEIGHT as aw, FEEDBACK_STATUSES as ax, FEEDBACK_STATUS_LABEL as ay, FILE_LINK_CLASS as az, type GuideConfigInput as b, type MessengerPageRequest as b$, type GuideStatus as b0, type GuideStep as b1, type GuideStepInput as b2, GuideThrottlingSchema as b3, type GuideThrottlingSettings as b4, type GuideVisibility as b5, HEATMAP_VIEWPORTS as b6, HOWTO_ACTIONS as b7, HOWTO_STEP_KINDS as b8, type HeatmapPoint as b9, MAX_MESSAGE_LENGTH as bA, MAX_PROPERTY_BYTES as bB, MAX_STACK_FRAMES as bC, MEDIA_FILE_MAX_BYTES as bD, MEDIA_FILE_TYPES as bE, MEDIA_IMAGE_MAX_BYTES as bF, MEDIA_IMAGE_TYPES as bG, MEDIA_MAX_BYTES as bH, MEDIA_VIDEO_MAX_BYTES as bI, MEDIA_VIDEO_TYPES as bJ, MESSAGE_AUTHORS as bK, type MediaContentType as bL, type MediaKind as bM, type MessageAuthor as bN, type MessengerCitation as bO, type MessengerComplaint as bP, type MessengerComplaintCategory as bQ, type MessengerComplaintOffer as bR, type MessengerComplaintsConfig as bS, type MessengerConfig as bT, type MessengerConversation as bU, type MessengerHomeCards as bV, type MessengerHowToCitation as bW, type MessengerIdeaOffer as bX, type MessengerIdeasConfig as bY, type MessengerMessage as bZ, type MessengerPageContent as b_, type HeatmapProperties as ba, type HeatmapViewport as bb, type HowToAction as bc, type HowToAnnotation as bd, HowToAnnotationSchema as be, type HowToStepKind as bf, type IdentifyRequest as bg, IdentifyRequestSchema as bh, type IdentifyResponse as bi, LOCALE_PATTERN as bj, LOGGED_IN_AUDIENCE as bk, LocaleSchema as bl, type LocalizationSettings as bm, LocalizationSettingsSchema as bn, MAX_ANNOTATIONS as bo, MAX_COLLECTION_DEPTH as bp, MAX_COMPLAINT_ANSWER_LENGTH as bq, MAX_COMPLAINT_ATTACHMENT_BYTES as br, MAX_COMPLAINT_CHOICES as bs, MAX_COMPLAINT_FIELDS as bt, MAX_COMPLAINT_LENGTH as bu, MAX_CUSTOM_CSS as bv, MAX_FEEDBACK_COMMENT as bw, MAX_FEEDBACK_DESCRIPTION as bx, MAX_FEEDBACK_NOTE as by, MAX_FEEDBACK_TITLE as bz, AGENT_METADATA_MAX_BYTES as c, SELECTOR_KINDS as c$, MessengerPageRequestSchema as c0, type MessengerPageSuggestion as c1, type MessengerStatus as c2, type MessengerSuggestedGuide as c3, type MessengerTeammate as c4, NETWORK_PLUGIN as c5, NOISY_DATA_ATTR as c6, type NetworkPluginPayload as c7, type NetworkRequest as c8, type NetworkRequestType as c9, RC_MODULE_IDS as cA, RC_MODULE_LABELS as cB, RECORDING_LEVELS as cC, REPLAY_MAX_COMPRESSED_BYTES as cD, REPLAY_MAX_RAW_BYTES as cE, REPLY_TIMES as cF, RULE_FIELDS as cG, RULE_OPERATORS as cH, type RcArticleLike as cI, type RcCollectionLike as cJ, type RcSection as cK, type RecordingLevel as cL, type ReplayChunk as cM, ReplayChunkSchema as cN, type ReplaySettings as cO, ReplaySettingsSchema as cP, type ReplyTime as cQ, type ResourceCenterAnnouncement as cR, type ResourceCenterArticle as cS, type ResourceCenterCollection as cT, type ResourceCenterConfig as cU, type ResourceCenterModule as cV, type ResourceCenterModuleId as cW, type ResourceCenterTranslations as cX, type RuleField as cY, type RuleOperator as cZ, SCOUT_AGENT_ID as c_, NormalizedPointSchema as ca, type NormalizedRect as cb, NormalizedRectSchema as cc, PAGE_RULE_LIMITS as cd, PATH_ID_PATTERN as ce, PDF_BLOCK_CLASS as cf, PDF_MAX_PAGES as cg, PDF_PAGES_CLASS as ch, PLACEMENTS as ci, PLATFORMS as cj, type PageContext as ck, type PagePattern as cl, type PageRule as cm, type Placement as cn, type Platform as co, PostMessageSchema as cp, type ProjectTheme as cq, ProjectThemeSchema as cr, type PublicFeedbackComment as cs, type PublicFeedbackList as ct, type PublicFeedbackRequest as cu, type PublicFeedbackRequestDetail as cv, type PublishedGuide as cw, PublishedGuideSchema as cx, type QueryParamCondition as cy, type QueryParamOp as cz, AGENT_METADATA_MAX_KEYS as d, WCAG_AA_TEXT as d$, SENSITIVE_HEADER_PATTERN as d0, SENSITIVE_PARAM_PATTERN as d1, SENSITIVE_PROPERTY_PATTERN as d2, SERVER_ASSISTED_FIELDS as d3, SHOW_ME_CLASS as d4, SHOW_ME_HREF_PREFIX as d5, SNAPSHOT_ATTRS as d6, SNAPSHOT_LIMITS as d7, SOURCEMAP_MAX_FILES_PER_UPLOAD as d8, SOURCEMAP_MAX_FILE_BYTES as d9, type StepType as dA, type SurveyAnswer as dB, type SurveyAnswers as dC, type SurveyConfig as dD, SurveyConfigSchema as dE, type SurveyQuestion as dF, SurveyQuestionSchema as dG, type SurveyResponseRequest as dH, SurveyResponseRequestSchema as dI, TAG_PROPERTY_LIMITS as dJ, TRIGGER_TYPES as dK, type TagPropertyConfig as dL, type TagPropertyDefinition as dM, type TaggingSdkConfig as dN, TargetSchema as dO, type TargetingContext as dP, type TextEntry as dQ, type TextKind as dR, type TranslationCoverage as dS, type TranslationReviewMap as dT, type TranslationReviewState as dU, type TriggerConfig as dV, TriggerSchema as dW, VIDEO_ATTRS as dX, type ValidationIssue as dY, type VideoEmbed as dZ, WCAG_AA_LARGE as d_, STATUS_LEVELS as da, STEP_TYPES as db, SURVEY_QUESTION_TYPES as dc, type ScoutStreamEvent as dd, type SdkArticleSummary as de, type SdkArticlesResponse as df, type SdkConfigResponse as dg, type SdkHowTo as dh, type SdkHowToStep as di, type SdkHowToSummary as dj, type SdkHowTosResponse as dk, type SelectorOp as dl, type SelectorStrategy as dm, SelectorStrategySchema as dn, SelectorSyntaxError as dp, type ShowWhen as dq, type StackFrame as dr, type StartConversationRequest as ds, type StartConversationResponse as dt, StartConversationSchema as du, type StatusLevel as dv, StepBranchSchema as dw, type StepButton as dx, StepSchema as dy, type StepTarget as dz, AGENT_OUTCOMES as e, mediaMaxBytes as e$, WS_MAX_MESSAGES_PER_SOCKET as e0, WS_MAX_MESSAGE_BYTES as e1, type WebSocketMessage as e2, applyGuideTranslations as e3, articleHref as e4, articleIdFromHref as e5, articleTextEntries as e6, assignGuideVariant as e7, baseLanguage as e8, clamp as e9, getPath as eA, guideLocales as eB, guidePlatforms as eC, guideTextEntries as eD, guidelyIdFromSelector as eE, hasVideoMedia as eF, isAllowedEmbedSrc as eG, isArticleListed as eH, isChecklistComplete as eI, isFileLink as eJ, isMediaContentType as eK, isPlainObject as eL, isQuestionVisible as eM, isRuleGroup as eN, isSafeMediaUrl as eO, isVideoContentType as eP, isVideoFileUrl as eQ, localeName as eR, localizeAnnouncement as eS, localizeArticle as eT, localizeGuide as eU, localizeResourceCenter as eV, matchCssSelector as eW, matchUrlPattern as eX, matchesAudiences as eY, matchesHelpQuery as eZ, mediaKind as e_, cleanLabel as ea, compare as eb, compareVersions as ec, complaintReference as ed, compoundMatches as ee, contrastIssues as ef, contrastRatio as eg, cssSelectorError as eh, defaultGuideConfig as ei, defaultStep as ej, describeCaptureStep as ek, describeRule as el, emptyRuleGroup as em, evaluateRule as en, evaluateRules as eo, evenWeights as ep, experimentBucketRules as eq, experimentSalt as er, featureCssSelectors as es, featureRuleError as et, featureRuleMatchesClick as eu, feedbackReference as ev, fingerprintError as ew, firstNameFromTraits as ex, fnv1a as ey, foldPathIds as ez, AGENT_TOOL_CALLS_PER_TURN as f, needsReview as f0, normalizeErrorMessage as f1, normalizeFrameFile as f2, normalizeLocale as f3, normalizeSnapshot as f4, orderedModules as f5, pageLabel as f6, pageName as f7, pagePattern as f8, pageRuleError as f9, showMeKeys as fA, slugify as fB, snapshotFromSelector as fC, stableStringify as fD, stepVideo as fE, stripOrigin as fF, supportsPlatform as fG, toEmbedUrl as fH, translationCoverage as fI, unreadAnnouncements as fJ, validateGuideConfig as fK, variantProblems as fL, variantRanges as fM, videoThumbnailUrl as fN, visibleAnnouncements as fO, visibleArticleIds as fP, visibleButtons as fQ, visitorAudiences as fR, visitorLocales as fS, withExperimentBucket as fT, withRecordingLevel as fU, withVisibility as fV, pageRuleMatches as fa, pageRulesMatch as fb, pageTerms as fc, parseCssSelector as fd, parseHexColor as fe, parseStack as ff, propertyAttributeAllowed as fg, queryConditionRegex as fh, randomId as fi, readableTextOn as fj, recordingLevel as fk, relativeLuminance as fl, resolveCaptureSettings as fm, resolveLocale as fn, resourceCenterLocales as fo, resourceCenterSections as fp, resourceCenterTextEntries as fq, rolloutBucket as fr, safeRegExp as fs, sanitizeCustomCss as ft, sanitizeProperties as fu, scopeCustomCss as fv, screenPath as fw, servedArticleAudiences as fx, showMeHref as fy, showMeKeyFromHref as fz, AGENT_TOOL_STATUSES as g, AGENT_TURNS_PER_BATCH as h, AGENT_TURN_MAX_TEXT as i, AGENT_TURN_ROLES as j, ANNOTATION_COLORS as k, ARTICLE_HREF_PREFIX as l, ARTICLE_VISIBILITIES as m, type AgentEventsResponse as n, type AgentOutcome as o, type AgentToolCallInput as p, type AgentToolStatus as q, type AgentTurnInput as r, type AgentTurnRole as s, type AnnotationColor as t, type ApiError as u, type AppSnapshot as v, type Appearance as w, AppearanceSchema as x, type ArticleVisibility as y, type AttrOp as z };
|