@guidelytech/shared 0.9.0 → 0.11.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.
@@ -1,511 +1,2 @@
1
- /** FNV-1a 32-bit hash; deterministic across SDK and server for rollout bucketing. */
2
- declare function fnv1a(input: string): number;
3
- /** Deterministic 0-99 bucket for percentage rollouts. */
4
- declare function rolloutBucket(subject: string, salt: string): number;
5
- declare function slugify(input: string): string;
6
- /** URL-safe random id. Uses crypto when available, falls back to Math.random (ids are not secrets). */
7
- declare function randomId(size?: number): string;
8
- declare function isPlainObject(v: unknown): v is Record<string, unknown>;
9
- /** Safe nested getter: get(obj, "account.plan") */
10
- declare function getPath(obj: unknown, path: string): unknown;
11
- declare function clamp(n: number, min: number, max: number): number;
12
- /** Glob-style URL pattern match: `*` matches any chars except `/`, `**` matches anything. */
13
- declare function matchUrlPattern(pattern: string, url: string): boolean;
14
- declare function stripOrigin(url: string): string;
15
- /** Safe regexp construction with a length cap to limit ReDoS exposure. */
16
- declare function safeRegExp(source: string, flags?: string): RegExp | null;
17
-
18
- /**
19
- * Cross-platform helpers shared by the web SDK, the React Native SDK and (as a reference for) the
20
- * native iOS/Android SDKs. Zod-free so it can ship in runtime bundles.
21
- */
22
- /** Platforms a guide can be delivered to. */
23
- declare const PLATFORMS: readonly ["web", "ios", "android"];
24
- type Platform = (typeof PLATFORMS)[number];
25
- /** Guides published before platforms existed have no `platforms` field and are web-only. */
26
- declare const DEFAULT_PLATFORMS: Platform[];
27
- /** Platforms a guide config targets (missing field → web only). */
28
- declare function guidePlatforms(config: {
29
- platforms?: readonly string[] | null;
30
- }): string[];
31
- declare function supportsPlatform(config: {
32
- platforms?: readonly string[] | null;
33
- }, platform: string): boolean;
34
- /** Attribute web apps put on elements to share a target id with their mobile apps. */
35
- declare const GUIDELY_ID_ATTRIBUTE = "data-guidely-id";
36
- /**
37
- * Extracts a Guidely target id from a trigger / advance / checklist value so the same guide works on
38
- * web and mobile. Accepts a bare id (`new-deal`), `#new-deal`, or `[data-guidely-id="new-deal"]`
39
- * (also `data-testid` / `data-tour`). Returns null for selectors that cannot name a single id.
40
- */
41
- declare function guidelyIdFromSelector(value: string | null | undefined): string | null;
42
- /**
43
- * Mobile SDKs have screens instead of URLs. URL-based features (URL patterns, `url_match` triggers,
44
- * multi-page steps, `url_visited` checklist tasks) match against the screen path `/<ScreenName>`.
45
- */
46
- declare function screenPath(screen: string | null | undefined): string;
47
- /**
48
- * Compares dotted version strings numerically (`2.10.0` > `2.9.3`). Non-numeric parts compare as
49
- * strings; a missing part counts as 0 (`2.1` == `2.1.0`). Returns -1, 0 or 1, or null when either
50
- * side is empty.
51
- */
52
- declare function compareVersions(a: unknown, b: unknown): -1 | 0 | 1 | null;
53
-
54
- /**
55
- * Pure checklist / survey logic shared by every renderer (web runtime, React Native, and the
56
- * reference for the native SDKs). Zod-free; uses structural types so it stays in the runtime entry.
57
- */
58
- type SurveyAnswer = string | number | boolean | string[];
59
- type SurveyAnswers = Record<string, SurveyAnswer>;
60
- interface ShowWhen {
61
- questionId: string;
62
- op: "equals" | "lte" | "gte" | "in";
63
- value: string | number | string[];
64
- }
65
- /** Evaluates a question's `showWhen` condition against current answers. */
66
- declare function isQuestionVisible(q: {
67
- showWhen?: ShowWhen;
68
- }, answers: SurveyAnswers): boolean;
69
- /** Are all required tasks done? */
70
- declare function isChecklistComplete(config: {
71
- tasks: Array<{
72
- id: string;
73
- required: boolean;
74
- }>;
75
- }, progress: {
76
- completedTaskIds: string[];
77
- }): boolean;
78
-
79
- 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"];
80
- type RuleOperator = (typeof RULE_OPERATORS)[number];
81
- 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", "environment", "locale", "app.platform", "app.screen", "app.version"];
82
- type RuleField = (typeof RULE_FIELDS)[number];
83
- interface Rule {
84
- id: string;
85
- field: RuleField;
86
- /** For attribute/query/event fields: the attribute key, query param name, event name, guide id... */
87
- key?: string;
88
- op: RuleOperator;
89
- value?: string | number | boolean | string[];
90
- /** When true, the rule is negated (exclusion rule). */
91
- negate?: boolean;
92
- }
93
- type RuleGroup = {
94
- id: string;
95
- op: "and" | "or";
96
- rules: Array<Rule | RuleGroup>;
97
- negate?: boolean;
98
- };
99
- declare function isRuleGroup(r: Rule | RuleGroup): r is RuleGroup;
100
- declare function emptyRuleGroup(id?: string): RuleGroup;
101
- /** Everything targeting evaluation can see. Built by the SDK (browser) or the server. */
102
- interface TargetingContext {
103
- userId?: string | null;
104
- anonymousId: string;
105
- userAttributes: Record<string, unknown>;
106
- accountAttributes: Record<string, unknown>;
107
- url: string;
108
- path: string;
109
- query: Record<string, string>;
110
- device: {
111
- type: "desktop" | "tablet" | "mobile";
112
- browser?: string;
113
- os?: string;
114
- };
115
- firstVisit: boolean;
116
- eventsSeen: Set<string> | string[];
117
- completedGuides: Set<string> | string[];
118
- dismissedGuides: Set<string> | string[];
119
- seenGuides: Set<string> | string[];
120
- completedChecklists: Set<string> | string[];
121
- audienceIds: Set<string> | string[];
122
- now: Date;
123
- environment: string;
124
- locale?: string;
125
- /** `web`, `ios` or `android`. Missing means web. */
126
- platform?: string;
127
- /** Current screen name (mobile SDKs; set via `screen()`). */
128
- screen?: string;
129
- /** Host app version (mobile SDKs), e.g. `2.4.1`. */
130
- appVersion?: string;
131
- /** Salt for rollout (guide id). Set per guide before evaluating. */
132
- rolloutSalt?: string;
133
- }
134
- declare function compare(op: RuleOperator, actual: unknown, expected: Rule["value"]): boolean;
135
- declare function evaluateRule(rule: Rule, ctx: TargetingContext): boolean;
136
- /** Evaluate a rule tree. An empty group matches everyone. */
137
- declare function evaluateRules(group: RuleGroup | null | undefined, ctx: TargetingContext): boolean;
138
- /** Fields whose evaluation requires server-held data. Used by docs/UI to annotate rules. */
139
- declare const SERVER_ASSISTED_FIELDS: RuleField[];
140
- /** Who a guide is shown to, before its targeting rules: everyone, only signed-in (identified) users, or only anonymous visitors. */
141
- declare const GUIDE_VISIBILITIES: readonly ["everyone", "identified", "anonymous"];
142
- type GuideVisibility = (typeof GUIDE_VISIBILITIES)[number];
143
- /**
144
- * Targeting with the visibility folded in as a `user.identified` rule. The server sends guides to SDKs
145
- * this way, so every SDK applies it through the rules it already evaluates (SDKs that predate the field
146
- * resolve it as undefined and show the guide to nobody rather than to everyone).
147
- */
148
- declare function withVisibility(targeting: RuleGroup, visibility: GuideVisibility | undefined): RuleGroup;
149
- declare function describeRule(rule: Rule): string;
150
-
151
- /** Reserved property names that are stripped from `properties` to avoid collecting sensitive data. */
152
- declare const SENSITIVE_PROPERTY_PATTERN: RegExp;
153
- declare const MAX_PROPERTY_BYTES: number;
154
- declare function sanitizeProperties(props: Record<string, unknown> | undefined): Record<string, unknown>;
155
-
156
- /** One parsed stack frame. `file` is the script URL (or path) as the browser reported it. */
157
- interface StackFrame {
158
- fn?: string;
159
- file?: string;
160
- line?: number;
161
- col?: number;
162
- }
163
- /** Properties carried by an `exception` event (see `docs/product-analytics.md`). */
164
- interface ExceptionProperties {
165
- type: string;
166
- message: string;
167
- frames: StackFrame[];
168
- /** `onerror` | `unhandledrejection` | `manual` (captureException) | `console`. */
169
- source?: string;
170
- handled?: boolean;
171
- /** App version or commit (SDK option `release`); selects the matching uploaded source maps. */
172
- release?: string;
173
- /** Set by the server at ingestion; groups occurrences into an issue. */
174
- fingerprint?: string;
175
- }
176
- declare const MAX_STACK_FRAMES = 30;
177
- /** Parses `Error.stack` from V8, SpiderMonkey and JavaScriptCore into frames (innermost first). */
178
- declare function parseStack(stack: string | undefined | null, max?: number): StackFrame[];
179
- /** Replaces volatile parts of a message (numbers, ids, quoted values) so repeats group together. */
180
- declare function normalizeErrorMessage(message: string): string;
181
- /** Strips origin, query, hash and build hashes (`main.3f2a1b9c.js` → `main.js`) from a script URL. */
182
- declare function normalizeFrameFile(file: string | undefined): string;
183
- /** Source map upload limits (`POST /api/v1/sourcemaps/upload`). */
184
- declare const SOURCEMAP_MAX_FILE_BYTES: number;
185
- declare const SOURCEMAP_MAX_FILES_PER_UPLOAD = 200;
186
- /**
187
- * Stable issue key for an exception: error type + normalised message + the innermost frame that
188
- * has a file (path without build hash + function name, or its original source + name when a source
189
- * map resolved it). Line/column numbers are left out because they change with every deploy of a
190
- * minified bundle.
191
- */
192
- declare function fingerprintError(input: {
193
- type?: string;
194
- message?: string;
195
- frames?: StackFrame[];
196
- original?: {
197
- source: string;
198
- name?: string | null;
199
- } | null;
200
- }): string;
201
-
202
- /** How-to capture constants the browser SDK needs without zod (also exported from `@guidelytech/shared/runtime`). */
203
- /** Query parameter that starts capture mode in the SDK (separate from `guidely_authoring`, so SDKs without capture ignore it). */
204
- declare const CAPTURE_PARAM = "guidely_capture";
205
- /** Largest screenshot the capture endpoint accepts. */
206
- declare const CAPTURE_SCREENSHOT_MAX_BYTES: number;
207
-
208
- /** Complaint types and limits shared by the server and the messenger runtime (zod-free). */
209
- /** Where a complaint is in its handling; the messenger shows it as Received → In review → Resolved. */
210
- declare const COMPLAINT_STATUSES: readonly ["open", "in_review", "resolved"];
211
- type ComplaintStatus = (typeof COMPLAINT_STATUSES)[number];
212
- /** Events a complaint webhook can fire on. */
213
- declare const COMPLAINT_EVENTS: readonly ["complaint.filed", "complaint.status_changed", "complaint.replied", "complaint.resolved"];
214
- type ComplaintEvent = (typeof COMPLAINT_EVENTS)[number];
215
- /** Extra questions a category asks for. */
216
- declare const COMPLAINT_FIELD_TYPES: readonly ["text", "choice"];
217
- type ComplaintFieldType = (typeof COMPLAINT_FIELD_TYPES)[number];
218
- declare const MAX_COMPLAINT_FIELDS = 8;
219
- declare const MAX_COMPLAINT_CHOICES = 12;
220
- declare const MAX_COMPLAINT_LENGTH = 4000;
221
- declare const MAX_COMPLAINT_ANSWER_LENGTH = 500;
222
- /** Largest screenshot the messenger may attach (after it scales the image down). */
223
- declare const MAX_COMPLAINT_ATTACHMENT_BYTES: number;
224
- interface ComplaintField {
225
- /** Stable id (`invoice_number`), used as the answer's key in webhook payloads. */
226
- id: string;
227
- label: string;
228
- type: ComplaintFieldType;
229
- /** Choices for `choice` questions. */
230
- options?: string[];
231
- required: boolean;
232
- }
233
- /** "CMP-1042" for complaint number 1042. */
234
- declare const complaintReference: (number: number) => string;
235
- /** A category as the messenger offers it. */
236
- interface MessengerComplaintCategory {
237
- id: string;
238
- name: string;
239
- description: string;
240
- color: string;
241
- fields: ComplaintField[];
242
- }
243
- /** Complaints block of `MessengerConfig`; absent when the project doesn't take complaints. */
244
- interface MessengerComplaintsConfig {
245
- categories: MessengerComplaintCategory[];
246
- /** Visitors the app hasn't identified may file one (with an email address). */
247
- anonymous: boolean;
248
- }
249
- /** A complaint as the person who filed it sees it (on its conversation). */
250
- interface MessengerComplaint {
251
- id: string;
252
- reference: string;
253
- status: ComplaintStatus;
254
- categoryName: string;
255
- createdAt: string;
256
- }
257
- /** Scout offered the complaint form in a reply, with this category picked. */
258
- interface MessengerComplaintOffer {
259
- categoryId: string;
260
- name: string;
261
- }
262
-
263
- /** rrweb plugin name for network events in recordings (event type 6, `data.plugin`). */
264
- declare const NETWORK_PLUGIN = "guidely/network@1";
265
- /** Request kinds, from `fetch`/`XMLHttpRequest` patching or `PerformanceResourceTiming.initiatorType`. */
266
- type NetworkRequestType = "fetch" | "xhr" | "websocket" | "document" | "script" | "stylesheet" | "image" | "font" | "media" | "beacon" | "other";
267
- /**
268
- * One network request in a recording: the payload of an rrweb plugin event
269
- * `{ type: 6, data: { plugin: NETWORK_PLUGIN, payload: NetworkPluginPayload } }`, batched.
270
- * Times are epoch milliseconds (same clock as rrweb event timestamps).
271
- *
272
- * A WebSocket is a request with `type: "websocket"` and `method: "GET"`, emitted when it opens
273
- * (`startTime`) and again, with the same `id`, when it closes (`endTime`, `closeCode`, `closeReason`,
274
- * totals in `messages`). Its frames are `WebSocketMessage`s referencing that `id`.
275
- */
276
- interface NetworkRequest {
277
- /** Stable id within the recording. */
278
- id: string;
279
- type: NetworkRequestType;
280
- method: string;
281
- /** Absolute URL; values of sensitive-looking query parameters replaced with `[redacted]`. */
282
- url: string;
283
- startTime: number;
284
- endTime?: number;
285
- durationMs?: number;
286
- /** HTTP status; 0 for network errors / blocked / aborted. Absent when the browser doesn't expose it. */
287
- status?: number;
288
- /** Set for failed requests: network error, abort or timeout message. */
289
- error?: string;
290
- /** Encoded bytes transferred / decoded response size, when known. */
291
- transferSize?: number;
292
- responseSize?: number;
293
- /** Only when `recordNetworkPayloads` is on; sensitive headers are `[redacted]`. */
294
- requestHeaders?: Record<string, string>;
295
- responseHeaders?: Record<string, string>;
296
- /** Text/JSON bodies, ≤10KB, sensitive JSON fields masked; `[binary]` / `[truncated]` markers otherwise. */
297
- requestBody?: string;
298
- responseBody?: string;
299
- /** WebSocket only: negotiated subprotocol, close details, and frame totals (all frames, including ones not recorded). */
300
- protocol?: string;
301
- closeCode?: number;
302
- closeReason?: string;
303
- messages?: {
304
- sent: number;
305
- received: number;
306
- sentBytes: number;
307
- receivedBytes: number;
308
- recorded: number;
309
- };
310
- }
311
- /** One WebSocket frame. At most `WS_MAX_MESSAGES_PER_SOCKET` are recorded per connection per page load. */
312
- interface WebSocketMessage {
313
- /** The `NetworkRequest.id` of the connection. */
314
- socketId: string;
315
- dir: "send" | "recv";
316
- time: number;
317
- /** Bytes (UTF-8 length for text frames). */
318
- size: number;
319
- binary?: boolean;
320
- /** Only with `recordNetworkPayloads`: text ≤ 2KB (JSON with sensitive keys masked), else `[truncated]`; binary frames are `[binary <n> B]`. */
321
- data?: string;
322
- }
323
- interface NetworkPluginPayload {
324
- requests?: NetworkRequest[];
325
- messages?: WebSocketMessage[];
326
- /** Requests/frames dropped since the previous payload because a cap was reached. */
327
- dropped?: {
328
- requests?: number;
329
- messages?: number;
330
- };
331
- }
332
- declare const WS_MAX_MESSAGES_PER_SOCKET = 200;
333
- declare const WS_MAX_MESSAGE_BYTES = 2048;
334
- /** Header names always replaced with `[redacted]` when payload capture is on. */
335
- declare const SENSITIVE_HEADER_PATTERN: RegExp;
336
- /** Query parameter and JSON field names whose values are redacted. */
337
- declare const SENSITIVE_PARAM_PATTERN: RegExp;
338
-
339
- /**
340
- * Media in article bodies: uploaded images, videos and PDFs, and video embeds from a fixed set of hosts.
341
- * Sanitizers (server, browser runtime) only keep an `<iframe>` whose `src` is the canonical embed URL
342
- * that `toEmbedUrl` produces, so authors can never point a frame anywhere else.
343
- *
344
- * An uploaded PDF reads inline, as its pages: the dashboard renders each page to an image when the
345
- * PDF is uploaded, and the body holds plain HTML every renderer already understands:
346
- *
347
- * <div class="gd-pdf">
348
- * <a class="gd-file" href="…/{id}.pdf" target="_blank">{file name}</a>
349
- * <div class="gd-pdf-pages"><img src="…/{page}.webp" alt="{file name}, page 1 of 12"> …</div>
350
- * </div>
351
- *
352
- * Renderers that know the classes draw a swipeable page viewer with the PDF one tap away; older ones
353
- * show a link and the pages as images. A PDF whose pages couldn't be rendered (password-protected,
354
- * damaged) is just the `gd-file` link, drawn as a file card.
355
- */
356
- type EmbedProvider = "youtube" | "vimeo" | "loom" | "wistia";
357
- interface VideoEmbed {
358
- provider: EmbedProvider;
359
- /** Canonical player URL, safe to use as an iframe `src`. */
360
- src: string;
361
- /** Page a viewer can open instead (native SDKs show a link rather than a player). */
362
- watchUrl: string;
363
- /** Accessible iframe title. */
364
- title: string;
365
- }
366
- declare const MEDIA_IMAGE_TYPES: readonly ["image/png", "image/jpeg", "image/gif", "image/webp"];
367
- declare const MEDIA_VIDEO_TYPES: readonly ["video/mp4", "video/webm"];
368
- declare const MEDIA_FILE_TYPES: readonly ["application/pdf"];
369
- type MediaContentType = (typeof MEDIA_IMAGE_TYPES)[number] | (typeof MEDIA_VIDEO_TYPES)[number] | (typeof MEDIA_FILE_TYPES)[number];
370
- type MediaKind = "image" | "video" | "file";
371
- declare const MEDIA_IMAGE_MAX_BYTES: number;
372
- declare const MEDIA_VIDEO_MAX_BYTES: number;
373
- declare const MEDIA_FILE_MAX_BYTES: number;
374
- /** The largest upload of any type. */
375
- declare const MEDIA_MAX_BYTES: number;
376
- declare function isMediaContentType(type: string): type is MediaContentType;
377
- declare function isVideoContentType(type: string): boolean;
378
- declare function mediaKind(type: string): MediaKind | null;
379
- declare function mediaMaxBytes(type: string): number;
380
- /** Class marking a link as an attached file (an uploaded PDF), drawn as a file card. */
381
- declare const FILE_LINK_CLASS = "gd-file";
382
- /** Class of the block holding a PDF's link and its rendered pages. */
383
- declare const PDF_BLOCK_CLASS = "gd-pdf";
384
- /** Class of the element wrapping a PDF's page images. */
385
- declare const PDF_PAGES_CLASS = "gd-pdf-pages";
386
- /** Pages rendered inline per PDF; readers open the PDF itself for the rest. */
387
- declare const PDF_MAX_PAGES = 40;
388
- /** True for an `<a>` with the file class and an absolute http(s) `href`: render it as a file card. */
389
- declare function isFileLink(className: string | null | undefined, href: string | null | undefined): boolean;
390
- /**
391
- * Turns a pasted video page or player URL from YouTube, Vimeo, Loom or Wistia into its canonical
392
- * embed. Returns null for anything else, including lookalike hosts.
393
- */
394
- declare function toEmbedUrl(input: string): VideoEmbed | null;
395
- /** True only for a canonical embed URL (exactly what `toEmbedUrl` returns), so an iframe can't be pointed elsewhere. */
396
- declare function isAllowedEmbedSrc(src: string | null | undefined): boolean;
397
- /** Fixed iframe attributes for an embed; sanitizers overwrite whatever the author's HTML carried. */
398
- declare const EMBED_IFRAME_ATTRS: Readonly<Record<string, string>>;
399
- /** Fixed `<video>` attributes: player controls, no autoplay or loop. */
400
- declare const VIDEO_ATTRS: Readonly<Record<string, string>>;
401
- /** `<video src>` / `poster` must be plain http(s): no data:, blob: or relative URLs (bodies render on customer sites). */
402
- declare function isSafeMediaUrl(url: string | null | undefined): boolean;
403
-
404
- /**
405
- * Resource center structure shared by every SDK: nested collections and audience targeting.
406
- *
407
- * Audience targeting decides what the help widget lists; it is not access control. The published
408
- * config (and every article body) is the same for all visitors of an environment, and end-user
409
- * identities are self-asserted, so never rely on it to keep an article private.
410
- */
411
- /** Collections nest at most this deep (a collection, its sections, and their sub-sections). */
412
- declare const MAX_COLLECTION_DEPTH = 3;
413
- interface RcCollectionLike {
414
- id: string;
415
- name: string;
416
- order: number;
417
- /** Parent collection; null/absent for a top-level collection. */
418
- parentId?: string | null;
419
- /** Shown only to members of any of these audiences; empty/absent means everyone. */
420
- audienceIds?: string[];
421
- }
422
- interface RcArticleLike {
423
- id: string;
424
- collectionId?: string | null;
425
- audienceIds?: string[];
426
- }
427
- interface RcSection<C extends RcCollectionLike, A extends RcArticleLike> {
428
- /** null for articles outside any (known) collection. */
429
- collection: C | null;
430
- /** Collection names from the top level down, e.g. ["Billing", "Invoices"]. */
431
- path: string[];
432
- /** 0 for a top-level collection. */
433
- depth: number;
434
- articles: A[];
435
- }
436
- type Membership = ReadonlySet<string> | readonly string[] | undefined | null;
437
- /** True when an item targeted at `required` audiences is shown to someone in `member`. */
438
- declare function matchesAudiences(required: readonly string[] | undefined | null, member: Membership): boolean;
439
- /**
440
- * Article sections in display order: each collection (depth first, siblings by `order`) with the
441
- * visible articles filed directly in it, then the uncategorized articles. A collection the viewer
442
- * isn't targeted by hides its whole subtree, and sections without visible articles are left out
443
- * (their sub-collections still appear). Unknown parents count as top level, so an old config or a
444
- * dangling reference never hides content.
445
- */
446
- declare function resourceCenterSections<C extends RcCollectionLike, A extends RcArticleLike>(collections: readonly C[], articles: readonly A[], member?: Membership): Array<RcSection<C, A>>;
447
- /**
448
- * Whether one article is listed for a viewer: its own audiences and those of every collection above
449
- * it must match. For articles outside a loaded list (e.g. server search results).
450
- */
451
- declare function isArticleListed(collections: readonly RcCollectionLike[], article: RcArticleLike, member?: Membership): boolean;
452
- /** Who an article is listed for, besides its audiences: everyone, or logged-in (identified) visitors only. */
453
- declare const ARTICLE_VISIBILITIES: readonly ["everyone", "identified"];
454
- type ArticleVisibility = (typeof ARTICLE_VISIBILITIES)[number];
455
- /**
456
- * Reserved audience every logged-in visitor belongs to. The server folds an article's visibility into
457
- * the audiences it serves and adds this one to identified visitors' memberships, so every SDK (old ones
458
- * too) applies "logged-in only" through the audience matching it already does. Anonymous visitors never
459
- * identify, so their membership is empty and these articles stay hidden.
460
- */
461
- declare const LOGGED_IN_AUDIENCE = "$identified";
462
- /**
463
- * The audiences an article is served with. Logged-in only with no audiences becomes the reserved
464
- * audience; with audiences it is already implied, since audience membership only comes from identify.
465
- */
466
- declare function servedArticleAudiences(audienceIds: readonly string[], visibility: ArticleVisibility | string | null | undefined): string[];
467
- /** A visitor's memberships as matched against served articles: logged-in visitors are also in `LOGGED_IN_AUDIENCE`. */
468
- declare function visitorAudiences(audienceIds: readonly string[], identified: boolean): string[];
469
- /** Ids of the articles a viewer sees (for filtering server search results the same way). */
470
- declare function visibleArticleIds(collections: readonly RcCollectionLike[], articles: readonly RcArticleLike[], member?: Membership): Set<string>;
471
- /**
472
- * 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>`,
473
- * so it survives every sanitizer and reads as a harmless link anywhere else. The widgets turn it into a
474
- * button that starts the walkthrough (a live flow guide), or hide it when that guide isn't available.
475
- */
476
- declare const SHOW_ME_CLASS = "gd-show-me";
477
- declare const SHOW_ME_HREF_PREFIX = "#guidely-show-me:";
478
- declare function showMeHref(guideKey: string): string;
479
- /** The guide key of a Show me link's `href`, or null. */
480
- declare function showMeKeyFromHref(href: string | null | undefined): string | null;
481
- /** Guide keys of the Show me prompts in an article body, in order, without repeats (at most 10). */
482
- declare function showMeKeys(html: string | null | undefined): string[];
483
- /** The article body plays a video (uploaded, or embedded from YouTube, Vimeo, Loom or Wistia). */
484
- declare function hasVideoMedia(html: string | null | undefined): boolean;
485
- /**
486
- * Help search on the device: every word of the query starts a word of the text, in any order, or the
487
- * query appears as typed. "add user" finds "Add a new user" and "Users › Add".
488
- */
489
- declare function matchesHelpQuery(text: string, query: string): boolean;
490
-
491
- /**
492
- * Page helpers shared by the SDK (page-aware messenger) and the server (page matching, analytics).
493
- * Pure and zod-free.
494
- */
495
- /**
496
- * One path segment that looks like an identifier: digits, a UUID, or a long hex string (hashes,
497
- * Mongo ids). Written so the same source works as a JS RegExp and a Postgres ARE (`regexp_replace`
498
- * with flags `gi`), which keeps id folding identical in SQL and in code. A segment may be followed
499
- * by the page query parameters a project keeps in its paths (`/contacts/42?tab=notes`).
500
- */
501
- 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,})(?=[/?]|$)";
502
- /** `/contacts/42/notes/9f8e…` → `/contacts/:id/notes/:id`; `/contacts/42?tab=notes` → `/contacts/:id?tab=notes`. */
503
- declare function foldPathIds(path: string): string;
504
- /** Words describing a page, from its path (`/settings/billing-plans/42` → `settings billing plans`). */
505
- declare function pageTerms(path: string): string[];
506
- /** A short human name for a page (`/app/invoices/42` → `Invoices`), or null for the root and unnamed pages. */
507
- declare function pageLabel(path: string): string | null;
508
- /** The first name in a user's traits (`firstName`, `first_name`, or the first word of `name`), or null. */
509
- declare function firstNameFromTraits(traits: Record<string, unknown> | null | undefined): string | null;
510
-
511
- export { ARTICLE_VISIBILITIES, type ArticleVisibility, CAPTURE_PARAM, CAPTURE_SCREENSHOT_MAX_BYTES, COMPLAINT_EVENTS, COMPLAINT_FIELD_TYPES, COMPLAINT_STATUSES, type ComplaintEvent, type ComplaintField, type ComplaintFieldType, type ComplaintStatus, DEFAULT_PLATFORMS, EMBED_IFRAME_ATTRS, type EmbedProvider, type ExceptionProperties, FILE_LINK_CLASS, GUIDELY_ID_ATTRIBUTE, GUIDE_VISIBILITIES, type GuideVisibility, LOGGED_IN_AUDIENCE, MAX_COLLECTION_DEPTH, MAX_COMPLAINT_ANSWER_LENGTH, MAX_COMPLAINT_ATTACHMENT_BYTES, MAX_COMPLAINT_CHOICES, MAX_COMPLAINT_FIELDS, MAX_COMPLAINT_LENGTH, MAX_PROPERTY_BYTES, MAX_STACK_FRAMES, MEDIA_FILE_MAX_BYTES, MEDIA_FILE_TYPES, MEDIA_IMAGE_MAX_BYTES, MEDIA_IMAGE_TYPES, MEDIA_MAX_BYTES, MEDIA_VIDEO_MAX_BYTES, MEDIA_VIDEO_TYPES, type MediaContentType, type MediaKind, type MessengerComplaint, type MessengerComplaintCategory, type MessengerComplaintOffer, type MessengerComplaintsConfig, NETWORK_PLUGIN, type NetworkPluginPayload, type NetworkRequest, type NetworkRequestType, PATH_ID_PATTERN, PDF_BLOCK_CLASS, PDF_MAX_PAGES, PDF_PAGES_CLASS, PLATFORMS, type Platform, RULE_FIELDS, RULE_OPERATORS, type RcArticleLike, type RcCollectionLike, type RcSection, type Rule, type RuleField, type RuleGroup, type RuleOperator, SENSITIVE_HEADER_PATTERN, SENSITIVE_PARAM_PATTERN, SENSITIVE_PROPERTY_PATTERN, SERVER_ASSISTED_FIELDS, SHOW_ME_CLASS, SHOW_ME_HREF_PREFIX, SOURCEMAP_MAX_FILES_PER_UPLOAD, SOURCEMAP_MAX_FILE_BYTES, type ShowWhen, type StackFrame, type SurveyAnswer, type SurveyAnswers, type TargetingContext, VIDEO_ATTRS, type VideoEmbed, WS_MAX_MESSAGES_PER_SOCKET, WS_MAX_MESSAGE_BYTES, type WebSocketMessage, clamp, compare, compareVersions, complaintReference, describeRule, emptyRuleGroup, evaluateRule, evaluateRules, fingerprintError, firstNameFromTraits, fnv1a, foldPathIds, getPath, guidePlatforms, guidelyIdFromSelector, hasVideoMedia, isAllowedEmbedSrc, isArticleListed, isChecklistComplete, isFileLink, isMediaContentType, isPlainObject, isQuestionVisible, isRuleGroup, isSafeMediaUrl, isVideoContentType, matchUrlPattern, matchesAudiences, matchesHelpQuery, mediaKind, mediaMaxBytes, normalizeErrorMessage, normalizeFrameFile, pageLabel, pageTerms, parseStack, randomId, resourceCenterSections, rolloutBucket, safeRegExp, sanitizeProperties, screenPath, servedArticleAudiences, showMeHref, showMeKeyFromHref, showMeKeys, slugify, stripOrigin, supportsPlatform, toEmbedUrl, visibleArticleIds, visitorAudiences, withVisibility };
1
+ export { c as AGENT_METADATA_MAX_BYTES, d as AGENT_METADATA_MAX_KEYS, e as AGENT_OUTCOMES, f as AGENT_TOOL_CALLS_PER_TURN, g as AGENT_TOOL_STATUSES, h as AGENT_TURNS_PER_BATCH, i as AGENT_TURN_MAX_TEXT, j as AGENT_TURN_ROLES, l as ARTICLE_VISIBILITIES, m as AgentEventsResponse, n as AgentOutcome, o as AgentToolCallInput, p as AgentToolStatus, q as AgentTurnInput, r as AgentTurnRole, x as ArticleVisibility, y as AttrOp, z as AttrTest, J as CAPTURE_PARAM, K as CAPTURE_SCREENSHOT_MAX_BYTES, L as COMMON_LOCALES, M as COMPLAINT_EVENTS, N as COMPLAINT_FIELD_TYPES, O as COMPLAINT_STATUSES, P as CONTROL_VARIANT_ID, a2 as ClickFacts, a3 as ComplaintEvent, a4 as ComplaintField, a5 as ComplaintFieldType, a6 as ComplaintStatus, a7 as ComplexSelector, a8 as Compound, a9 as ContrastIssue, ag as DEFAULT_FEATURE_ATTRIBUTE, ah as DEFAULT_LOCALE, ai as DEFAULT_PLATFORMS, aj as EMBED_IFRAME_ATTRS, ak as ElementNode, al as ElementSnapshot, am as EmbedProvider, ap as ExceptionProperties, aq as FEATURE_ATTRIBUTE_PATTERN, ar as FEATURE_RULE_LIMITS, ay as FILE_LINK_CLASS, az as FeatureRule, aI as GUIDELY_ID_ATTRIBUTE, aJ as GUIDE_EXPERIMENT_GOALS, aK as GUIDE_EXPERIMENT_GOAL_LABELS, aL as GUIDE_EXPERIMENT_STATUSES, aO as GUIDE_VISIBILITIES, aR as GuideExperimentGoal, aS as GuideExperimentGoalKind, aT as GuideExperimentStatus, aU as GuideExperimentVariant, b4 as GuideVisibility, bj as LOGGED_IN_AUDIENCE, bl as LocalizationSettings, bo as MAX_COLLECTION_DEPTH, bp as MAX_COMPLAINT_ANSWER_LENGTH, bq as MAX_COMPLAINT_ATTACHMENT_BYTES, br as MAX_COMPLAINT_CHOICES, bs as MAX_COMPLAINT_FIELDS, bt as MAX_COMPLAINT_LENGTH, bu as MAX_CUSTOM_CSS, bA as MAX_PROPERTY_BYTES, bB as MAX_STACK_FRAMES, bC as MEDIA_FILE_MAX_BYTES, bD as MEDIA_FILE_TYPES, bE as MEDIA_IMAGE_MAX_BYTES, bF as MEDIA_IMAGE_TYPES, bG as MEDIA_MAX_BYTES, bH as MEDIA_VIDEO_MAX_BYTES, bI as MEDIA_VIDEO_TYPES, bK as MediaContentType, bL as MediaKind, bO as MessengerComplaint, bP as MessengerComplaintCategory, bQ as MessengerComplaintOffer, bR as MessengerComplaintsConfig, c4 as NETWORK_PLUGIN, c5 as NOISY_DATA_ATTR, c6 as NetworkPluginPayload, c7 as NetworkRequest, c8 as NetworkRequestType, cc as PAGE_RULE_LIMITS, cd as PATH_ID_PATTERN, ce as PDF_BLOCK_CLASS, cf as PDF_MAX_PAGES, cg as PDF_PAGES_CLASS, ci as PLATFORMS, cj as PageContext, ck as PagePattern, cl as PageRule, cn as Platform, cx as QueryParamCondition, cy as QueryParamOp, cz as RC_MODULE_IDS, cA as RC_MODULE_LABELS, cE as RULE_FIELDS, cF as RULE_OPERATORS, cG as RcArticleLike, cH as RcCollectionLike, cI as RcSection, cT as ResourceCenterModuleId, cU as ResourceCenterTranslations, a as Rule, cV as RuleField, R as RuleGroup, cW as RuleOperator, cX as SCOUT_AGENT_ID, cZ as SENSITIVE_HEADER_PATTERN, c_ as SENSITIVE_PARAM_PATTERN, c$ as SENSITIVE_PROPERTY_PATTERN, d0 as SERVER_ASSISTED_FIELDS, d1 as SHOW_ME_CLASS, d2 as SHOW_ME_HREF_PREFIX, d3 as SNAPSHOT_ATTRS, d4 as SNAPSHOT_LIMITS, d5 as SOURCEMAP_MAX_FILES_PER_UPLOAD, d6 as SOURCEMAP_MAX_FILE_BYTES, di as SelectorOp, dl as SelectorSyntaxError, dm as ShowWhen, dn as StackFrame, dy as SurveyAnswer, dz as SurveyAnswers, dG as TAG_PROPERTY_LIMITS, dI as TagPropertyConfig, dJ as TagPropertyDefinition, dK as TaggingSdkConfig, dM as TargetingContext, dN as TextEntry, dO as TextKind, dP as TranslationCoverage, dS as VIDEO_ATTRS, dU as VideoEmbed, dV as WCAG_AA_LARGE, dW as WCAG_AA_TEXT, dX as WS_MAX_MESSAGES_PER_SOCKET, dY as WS_MAX_MESSAGE_BYTES, dZ as WebSocketMessage, d_ as applyGuideTranslations, d$ as articleTextEntries, e0 as assignGuideVariant, e1 as baseLanguage, e2 as clamp, e4 as compare, e5 as compareVersions, e6 as complaintReference, e7 as compoundMatches, e8 as contrastIssues, e9 as contrastRatio, ea as cssSelectorError, ee as describeRule, ef as emptyRuleGroup, eg as evaluateRule, eh as evaluateRules, ei as evenWeights, ej as experimentBucketRules, ek as experimentSalt, el as featureCssSelectors, em as featureRuleError, en as featureRuleMatchesClick, ep as fingerprintError, eq as firstNameFromTraits, er as fnv1a, es as foldPathIds, et as getPath, eu as guideLocales, ev as guidePlatforms, ew as guideTextEntries, ex as guidelyIdFromSelector, ey as hasVideoMedia, ez as isAllowedEmbedSrc, eA as isArticleListed, eB as isChecklistComplete, eC as isFileLink, eD as isMediaContentType, eE as isPlainObject, eF as isQuestionVisible, eG as isRuleGroup, eH as isSafeMediaUrl, eI as isVideoContentType, eJ as localeName, eK as localizeAnnouncement, eL as localizeArticle, eM as localizeGuide, eN as localizeResourceCenter, eO as matchCssSelector, eP as matchUrlPattern, eQ as matchesAudiences, eR as matchesHelpQuery, eS as mediaKind, eT as mediaMaxBytes, eU as normalizeErrorMessage, eV as normalizeFrameFile, eW as normalizeLocale, eX as normalizeSnapshot, eY as orderedModules, eZ as pageLabel, e$ as pagePattern, f0 as pageRuleError, f1 as pageRuleMatches, f2 as pageRulesMatch, f3 as pageTerms, f4 as parseCssSelector, f5 as parseHexColor, f6 as parseStack, f7 as propertyAttributeAllowed, f8 as queryConditionRegex, f9 as randomId, fa as readableTextOn, fb as relativeLuminance, fd as resolveLocale, fe as resourceCenterLocales, ff as resourceCenterSections, fg as resourceCenterTextEntries, fh as rolloutBucket, fi as safeRegExp, fj as sanitizeCustomCss, fk as sanitizeProperties, fl as scopeCustomCss, fm as screenPath, fn as servedArticleAudiences, fo as showMeHref, fp as showMeKeyFromHref, fq as showMeKeys, fr as slugify, fs as snapshotFromSelector, ft as stableStringify, fu as stripOrigin, fv as supportsPlatform, fw as toEmbedUrl, fx as translationCoverage, fy as unreadAnnouncements, fA as variantProblems, fB as variantRanges, fC as visibleAnnouncements, fD as visibleArticleIds, fF as visitorAudiences, fG as visitorLocales, fH as withExperimentBucket, fI as withVisibility } from './runtime-BM5cztmJ.cjs';
2
+ import 'zod';