@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.
- package/dist/chunk-TGIUEYXM.js +1937 -0
- package/dist/chunk-TGIUEYXM.js.map +1 -0
- package/dist/index.cjs +1684 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +773 -3951
- package/dist/index.d.ts +773 -3951
- package/dist/index.js +568 -62
- package/dist/index.js.map +1 -1
- package/dist/runtime-BM5cztmJ.d.cts +5234 -0
- package/dist/runtime-BM5cztmJ.d.ts +5234 -0
- package/dist/runtime.cjs +1212 -6
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +2 -511
- package/dist/runtime.d.ts +2 -511
- package/dist/runtime.js +157 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AGENT_METADATA_MAX_BYTES,
|
|
3
|
+
AGENT_METADATA_MAX_KEYS,
|
|
4
|
+
AGENT_OUTCOMES,
|
|
5
|
+
AGENT_TOOL_CALLS_PER_TURN,
|
|
6
|
+
AGENT_TOOL_STATUSES,
|
|
7
|
+
AGENT_TURNS_PER_BATCH,
|
|
8
|
+
AGENT_TURN_MAX_TEXT,
|
|
9
|
+
AGENT_TURN_ROLES,
|
|
2
10
|
ARTICLE_VISIBILITIES,
|
|
3
11
|
CAPTURE_PARAM,
|
|
4
12
|
CAPTURE_SCREENSHOT_MAX_BYTES,
|
|
13
|
+
COMMON_LOCALES,
|
|
5
14
|
COMPLAINT_EVENTS,
|
|
6
15
|
COMPLAINT_FIELD_TYPES,
|
|
7
16
|
COMPLAINT_STATUSES,
|
|
17
|
+
CONTROL_VARIANT_ID,
|
|
18
|
+
DEFAULT_FEATURE_ATTRIBUTE,
|
|
19
|
+
DEFAULT_LOCALE,
|
|
8
20
|
DEFAULT_PLATFORMS,
|
|
9
21
|
EMBED_IFRAME_ATTRS,
|
|
22
|
+
FEATURE_ATTRIBUTE_PATTERN,
|
|
23
|
+
FEATURE_RULE_LIMITS,
|
|
10
24
|
FILE_LINK_CLASS,
|
|
11
25
|
GUIDELY_ID_ATTRIBUTE,
|
|
26
|
+
GUIDE_EXPERIMENT_GOALS,
|
|
27
|
+
GUIDE_EXPERIMENT_GOAL_LABELS,
|
|
28
|
+
GUIDE_EXPERIMENT_STATUSES,
|
|
12
29
|
GUIDE_VISIBILITIES,
|
|
13
30
|
LOGGED_IN_AUDIENCE,
|
|
14
31
|
MAX_COLLECTION_DEPTH,
|
|
@@ -17,6 +34,7 @@ import {
|
|
|
17
34
|
MAX_COMPLAINT_CHOICES,
|
|
18
35
|
MAX_COMPLAINT_FIELDS,
|
|
19
36
|
MAX_COMPLAINT_LENGTH,
|
|
37
|
+
MAX_CUSTOM_CSS,
|
|
20
38
|
MAX_PROPERTY_BYTES,
|
|
21
39
|
MAX_STACK_FRAMES,
|
|
22
40
|
MEDIA_FILE_MAX_BYTES,
|
|
@@ -27,38 +45,65 @@ import {
|
|
|
27
45
|
MEDIA_VIDEO_MAX_BYTES,
|
|
28
46
|
MEDIA_VIDEO_TYPES,
|
|
29
47
|
NETWORK_PLUGIN,
|
|
48
|
+
NOISY_DATA_ATTR,
|
|
49
|
+
PAGE_RULE_LIMITS,
|
|
30
50
|
PATH_ID_PATTERN,
|
|
31
51
|
PDF_BLOCK_CLASS,
|
|
32
52
|
PDF_MAX_PAGES,
|
|
33
53
|
PDF_PAGES_CLASS,
|
|
34
54
|
PLATFORMS,
|
|
55
|
+
RC_MODULE_IDS,
|
|
56
|
+
RC_MODULE_LABELS,
|
|
35
57
|
RULE_FIELDS,
|
|
36
58
|
RULE_OPERATORS,
|
|
59
|
+
SCOUT_AGENT_ID,
|
|
37
60
|
SENSITIVE_HEADER_PATTERN,
|
|
38
61
|
SENSITIVE_PARAM_PATTERN,
|
|
39
62
|
SENSITIVE_PROPERTY_PATTERN,
|
|
40
63
|
SERVER_ASSISTED_FIELDS,
|
|
41
64
|
SHOW_ME_CLASS,
|
|
42
65
|
SHOW_ME_HREF_PREFIX,
|
|
66
|
+
SNAPSHOT_ATTRS,
|
|
67
|
+
SNAPSHOT_LIMITS,
|
|
43
68
|
SOURCEMAP_MAX_FILES_PER_UPLOAD,
|
|
44
69
|
SOURCEMAP_MAX_FILE_BYTES,
|
|
70
|
+
SelectorSyntaxError,
|
|
71
|
+
TAG_PROPERTY_LIMITS,
|
|
45
72
|
VIDEO_ATTRS,
|
|
73
|
+
WCAG_AA_LARGE,
|
|
74
|
+
WCAG_AA_TEXT,
|
|
46
75
|
WS_MAX_MESSAGES_PER_SOCKET,
|
|
47
76
|
WS_MAX_MESSAGE_BYTES,
|
|
77
|
+
applyGuideTranslations,
|
|
78
|
+
articleTextEntries,
|
|
79
|
+
assignGuideVariant,
|
|
80
|
+
baseLanguage,
|
|
48
81
|
clamp,
|
|
49
82
|
compare,
|
|
50
83
|
compareVersions,
|
|
51
84
|
complaintReference,
|
|
85
|
+
compoundMatches,
|
|
86
|
+
contrastIssues,
|
|
87
|
+
contrastRatio,
|
|
88
|
+
cssSelectorError,
|
|
52
89
|
describeRule,
|
|
53
90
|
emptyRuleGroup,
|
|
54
91
|
evaluateRule,
|
|
55
92
|
evaluateRules,
|
|
93
|
+
evenWeights,
|
|
94
|
+
experimentBucketRules,
|
|
95
|
+
experimentSalt,
|
|
96
|
+
featureCssSelectors,
|
|
97
|
+
featureRuleError,
|
|
98
|
+
featureRuleMatchesClick,
|
|
56
99
|
fingerprintError,
|
|
57
100
|
firstNameFromTraits,
|
|
58
101
|
fnv1a,
|
|
59
102
|
foldPathIds,
|
|
60
103
|
getPath,
|
|
104
|
+
guideLocales,
|
|
61
105
|
guidePlatforms,
|
|
106
|
+
guideTextEntries,
|
|
62
107
|
guidelyIdFromSelector,
|
|
63
108
|
hasVideoMedia,
|
|
64
109
|
isAllowedEmbedSrc,
|
|
@@ -71,6 +116,12 @@ import {
|
|
|
71
116
|
isRuleGroup,
|
|
72
117
|
isSafeMediaUrl,
|
|
73
118
|
isVideoContentType,
|
|
119
|
+
localeName,
|
|
120
|
+
localizeAnnouncement,
|
|
121
|
+
localizeArticle,
|
|
122
|
+
localizeGuide,
|
|
123
|
+
localizeResourceCenter,
|
|
124
|
+
matchCssSelector,
|
|
74
125
|
matchUrlPattern,
|
|
75
126
|
matchesAudiences,
|
|
76
127
|
matchesHelpQuery,
|
|
@@ -78,27 +129,54 @@ import {
|
|
|
78
129
|
mediaMaxBytes,
|
|
79
130
|
normalizeErrorMessage,
|
|
80
131
|
normalizeFrameFile,
|
|
132
|
+
normalizeLocale,
|
|
133
|
+
normalizeSnapshot,
|
|
134
|
+
orderedModules,
|
|
81
135
|
pageLabel,
|
|
136
|
+
pagePattern,
|
|
137
|
+
pageRuleError,
|
|
138
|
+
pageRuleMatches,
|
|
139
|
+
pageRulesMatch,
|
|
82
140
|
pageTerms,
|
|
141
|
+
parseCssSelector,
|
|
142
|
+
parseHexColor,
|
|
83
143
|
parseStack,
|
|
144
|
+
propertyAttributeAllowed,
|
|
145
|
+
queryConditionRegex,
|
|
84
146
|
randomId,
|
|
147
|
+
readableTextOn,
|
|
148
|
+
relativeLuminance,
|
|
149
|
+
resolveLocale,
|
|
150
|
+
resourceCenterLocales,
|
|
85
151
|
resourceCenterSections,
|
|
152
|
+
resourceCenterTextEntries,
|
|
86
153
|
rolloutBucket,
|
|
87
154
|
safeRegExp,
|
|
155
|
+
sanitizeCustomCss,
|
|
88
156
|
sanitizeProperties,
|
|
157
|
+
scopeCustomCss,
|
|
89
158
|
screenPath,
|
|
90
159
|
servedArticleAudiences,
|
|
91
160
|
showMeHref,
|
|
92
161
|
showMeKeyFromHref,
|
|
93
162
|
showMeKeys,
|
|
94
163
|
slugify,
|
|
164
|
+
snapshotFromSelector,
|
|
165
|
+
stableStringify,
|
|
95
166
|
stripOrigin,
|
|
96
167
|
supportsPlatform,
|
|
97
168
|
toEmbedUrl,
|
|
169
|
+
translationCoverage,
|
|
170
|
+
unreadAnnouncements,
|
|
171
|
+
variantProblems,
|
|
172
|
+
variantRanges,
|
|
173
|
+
visibleAnnouncements,
|
|
98
174
|
visibleArticleIds,
|
|
99
175
|
visitorAudiences,
|
|
176
|
+
visitorLocales,
|
|
177
|
+
withExperimentBucket,
|
|
100
178
|
withVisibility
|
|
101
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-TGIUEYXM.js";
|
|
102
180
|
|
|
103
181
|
// src/targeting.ts
|
|
104
182
|
import { z } from "zod";
|
|
@@ -169,6 +247,8 @@ var StepSchema = z2.object({
|
|
|
169
247
|
/** Sanitized HTML body (links, images, lists, formatting). */
|
|
170
248
|
body: z2.string().max(2e4).default(""),
|
|
171
249
|
imageUrl: z2.string().url().max(2e3).optional().or(z2.literal("")),
|
|
250
|
+
/** Alternative text for `imageUrl` (screen readers); empty = decorative. */
|
|
251
|
+
imageAlt: z2.string().max(300).optional(),
|
|
172
252
|
buttons: z2.array(ButtonSchema).max(6).default([]),
|
|
173
253
|
target: TargetSchema.optional(),
|
|
174
254
|
placement: z2.enum(PLACEMENTS).default("auto"),
|
|
@@ -195,7 +275,12 @@ var StepSchema = z2.object({
|
|
|
195
275
|
/** Hotspot pulse dot settings. */
|
|
196
276
|
hotspot: z2.object({ size: z2.number().int().min(8).max(40).default(14), pulse: z2.boolean().default(true), openOn: z2.enum(["click", "hover"]).default("click") }).optional(),
|
|
197
277
|
/** Custom step: arbitrary sanitized HTML with no chrome. */
|
|
198
|
-
customHtml: z2.string().max(5e4).optional()
|
|
278
|
+
customHtml: z2.string().max(5e4).optional(),
|
|
279
|
+
/**
|
|
280
|
+
* Code block (custom steps only): JavaScript run on the web when the step shows, only while the
|
|
281
|
+
* workspace allows code blocks (an admin setting, off by default). Mobile SDKs never receive it.
|
|
282
|
+
*/
|
|
283
|
+
code: z2.string().max(2e4).optional()
|
|
199
284
|
});
|
|
200
285
|
var TRIGGER_TYPES = ["page_load", "url_match", "event", "element_click", "element_visible", "manual", "delay", "after_guide", "segment_enter"];
|
|
201
286
|
var TriggerSchema = z2.object({
|
|
@@ -217,7 +302,9 @@ var FrequencySchema = z2.object({
|
|
|
217
302
|
/** Guide ids that must not be active at the same time. */
|
|
218
303
|
mutuallyExclusiveWith: z2.array(z2.string()).max(50).default([]),
|
|
219
304
|
/** Re-show if dismissed (otherwise dismissal counts as completion for frequency). */
|
|
220
|
-
reshowAfterDismiss: z2.boolean().default(false)
|
|
305
|
+
reshowAfterDismiss: z2.boolean().default(false),
|
|
306
|
+
/** Bypass the project's guide throttling (always eligible as far as throttling goes). */
|
|
307
|
+
ignoreThrottling: z2.boolean().optional()
|
|
221
308
|
});
|
|
222
309
|
var AppearanceSchema = z2.object({
|
|
223
310
|
theme: z2.enum(["light", "dark", "auto"]).default("auto"),
|
|
@@ -229,7 +316,9 @@ var AppearanceSchema = z2.object({
|
|
|
229
316
|
overlayOpacity: z2.number().min(0).max(1).optional(),
|
|
230
317
|
zIndex: z2.number().int().min(1).max(2147483647).optional(),
|
|
231
318
|
preset: z2.string().max(50).optional(),
|
|
232
|
-
animation: z2.enum(["fade", "slide", "none"]).default("fade")
|
|
319
|
+
animation: z2.enum(["fade", "slide", "none"]).default("fade"),
|
|
320
|
+
/** Custom CSS scoped to this guide's container (sanitized; see custom-css.ts). Web only. */
|
|
321
|
+
customCss: z2.string().max(2e4).optional()
|
|
233
322
|
});
|
|
234
323
|
var ChecklistTaskSchema = z2.object({
|
|
235
324
|
id: z2.string().min(1),
|
|
@@ -276,6 +365,26 @@ var SurveyConfigSchema = z2.object({
|
|
|
276
365
|
startAt: z2.string().datetime().optional(),
|
|
277
366
|
endAt: z2.string().datetime().optional()
|
|
278
367
|
});
|
|
368
|
+
var GuideScheduleSchema = z2.object({
|
|
369
|
+
startAt: z2.string().datetime().optional(),
|
|
370
|
+
endAt: z2.string().datetime().optional(),
|
|
371
|
+
timezone: z2.string().max(64).optional()
|
|
372
|
+
});
|
|
373
|
+
var LOCALE_PATTERN = /^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8}){0,2}$/;
|
|
374
|
+
var LocaleSchema = z2.string().regex(LOCALE_PATTERN, "Use a language code such as fr or pt-BR").max(20);
|
|
375
|
+
var GuideLocalizationSchema = z2.object({
|
|
376
|
+
translations: z2.record(LocaleSchema, z2.record(z2.string().max(200), z2.string().max(5e4))).default({})
|
|
377
|
+
});
|
|
378
|
+
var LocalizationSettingsSchema = z2.object({
|
|
379
|
+
defaultLocale: LocaleSchema.default("en"),
|
|
380
|
+
locales: z2.array(LocaleSchema).max(50).default([])
|
|
381
|
+
});
|
|
382
|
+
var GuideThrottlingSchema = z2.object({
|
|
383
|
+
enabled: z2.boolean().default(false),
|
|
384
|
+
maxGuides: z2.number().int().min(1).max(50).default(1),
|
|
385
|
+
windowHours: z2.number().int().min(1).max(720).default(24),
|
|
386
|
+
minGapMinutes: z2.number().int().min(0).max(10080).default(0)
|
|
387
|
+
});
|
|
279
388
|
var GuideConfigSchema = z2.object({
|
|
280
389
|
steps: z2.array(StepSchema).max(50).default([]),
|
|
281
390
|
/** Everyone, only identified (logged-in) users, or only anonymous visitors; applied on top of `targeting`. */
|
|
@@ -289,7 +398,11 @@ var GuideConfigSchema = z2.object({
|
|
|
289
398
|
/** Restrict guide to url pattern(s) (applied before trigger). On mobile these match the screen path `/<Screen>`. */
|
|
290
399
|
urlPatterns: z2.array(z2.string().max(500)).max(20).default([]),
|
|
291
400
|
/** Platforms that receive this guide. Guides created before mobile support are web-only. */
|
|
292
|
-
platforms: z2.array(z2.enum(PLATFORMS)).max(PLATFORMS.length).default(["web"])
|
|
401
|
+
platforms: z2.array(z2.enum(PLATFORMS)).max(PLATFORMS.length).default(["web"]),
|
|
402
|
+
/** Start / end window for any guide kind (surveys also honour `survey.startAt` / `endAt`). */
|
|
403
|
+
schedule: GuideScheduleSchema.optional(),
|
|
404
|
+
/** Translations (see localization.ts). */
|
|
405
|
+
localization: GuideLocalizationSchema.optional()
|
|
293
406
|
});
|
|
294
407
|
function defaultGuideConfig(kind) {
|
|
295
408
|
return GuideConfigSchema.parse({
|
|
@@ -323,7 +436,7 @@ function defaultStep(type, overrides = {}) {
|
|
|
323
436
|
function visibleButtons(step, canGoBack) {
|
|
324
437
|
return canGoBack ? step.buttons : step.buttons.filter((b) => b.action !== "back");
|
|
325
438
|
}
|
|
326
|
-
function validateGuideConfig(kind, config) {
|
|
439
|
+
function validateGuideConfig(kind, config, theme) {
|
|
327
440
|
const issues = [];
|
|
328
441
|
if (kind === "checklist") {
|
|
329
442
|
if (!config.checklist || config.checklist.tasks.length === 0) issues.push({ level: "error", message: "Checklist needs at least one task." });
|
|
@@ -360,6 +473,15 @@ function validateGuideConfig(kind, config) {
|
|
|
360
473
|
if (config.trigger.type === "element_click" && !config.trigger.value) issues.push({ level: "error", message: "Element click trigger needs a selector." });
|
|
361
474
|
if (config.trigger.type === "url_match" && !config.trigger.value) issues.push({ level: "error", message: "URL trigger needs a pattern." });
|
|
362
475
|
if (config.frequency.mode === "interval" && !config.frequency.intervalHours) issues.push({ level: "error", message: "Interval frequency needs an interval in hours." });
|
|
476
|
+
const sched = config.schedule;
|
|
477
|
+
if (sched?.startAt && sched.endAt && Date.parse(sched.endAt) <= Date.parse(sched.startAt)) issues.push({ level: "error", message: "The schedule ends before it starts." });
|
|
478
|
+
if (sched?.endAt && Date.parse(sched.endAt) < Date.now()) issues.push({ level: "warning", message: "The schedule has already ended, so nobody will see this guide." });
|
|
479
|
+
config.steps.forEach((step, i) => {
|
|
480
|
+
if (step.code && step.type !== "custom") issues.push({ level: "error", stepId: step.id, message: `Step ${i + 1}: code blocks can only run in custom steps.` });
|
|
481
|
+
if (step.code && mobile) issues.push({ level: "warning", stepId: step.id, message: `Step ${i + 1} runs a code block; mobile apps skip it.` });
|
|
482
|
+
});
|
|
483
|
+
const colors = { primaryColor: config.appearance.primaryColor ?? theme?.primaryColor, backgroundColor: config.appearance.backgroundColor ?? theme?.backgroundColor, textColor: config.appearance.textColor ?? theme?.textColor };
|
|
484
|
+
for (const c of contrastIssues(colors)) issues.push({ level: "warning", message: `Low contrast: ${c.message}` });
|
|
363
485
|
return issues;
|
|
364
486
|
}
|
|
365
487
|
var ProjectThemeSchema = z2.object({
|
|
@@ -369,7 +491,9 @@ var ProjectThemeSchema = z2.object({
|
|
|
369
491
|
borderRadius: z2.number().int().min(0).max(32).default(12),
|
|
370
492
|
fontFamily: z2.string().max(200).default("Inter, system-ui, -apple-system, sans-serif"),
|
|
371
493
|
logoUrl: z2.string().max(2e3).optional(),
|
|
372
|
-
brandName: z2.string().max(100).optional()
|
|
494
|
+
brandName: z2.string().max(100).optional(),
|
|
495
|
+
/** Custom CSS applied to every guide's container (sanitized and scoped like guide CSS). Web only. */
|
|
496
|
+
customCss: z2.string().max(2e4).optional()
|
|
373
497
|
});
|
|
374
498
|
|
|
375
499
|
// src/events.ts
|
|
@@ -405,9 +529,15 @@ var EVENT_NAMES = [
|
|
|
405
529
|
"exception",
|
|
406
530
|
"heatmap",
|
|
407
531
|
// Feature flags: a user was bucketed into an experiment variation (properties: experimentKey, variationId, flagKey).
|
|
408
|
-
"experiment_viewed"
|
|
532
|
+
"experiment_viewed",
|
|
533
|
+
// Mobile app lifecycle (mobile/SPEC.md "Product analytics"): installs, updates, opens and backgrounding.
|
|
534
|
+
"app_install",
|
|
535
|
+
"app_update",
|
|
536
|
+
"app_open",
|
|
537
|
+
"app_background"
|
|
409
538
|
];
|
|
410
|
-
var AUTOCAPTURE_EVENTS = ["page_view", "page_leave", "click", "rage_click", "exception", "heatmap"];
|
|
539
|
+
var AUTOCAPTURE_EVENTS = ["page_view", "page_leave", "click", "rage_click", "exception", "heatmap", "app_install", "app_update", "app_open", "app_background"];
|
|
540
|
+
var APP_LIFECYCLE_EVENTS = ["app_install", "app_update", "app_open", "app_background"];
|
|
411
541
|
var GUIDE_LIFECYCLE_EVENTS = ["guide_viewed", "guide_started", "step_viewed", "step_completed", "guide_completed", "guide_skipped", "guide_dismissed", "guide_abandoned"];
|
|
412
542
|
var SdkEventSchema = z3.object({
|
|
413
543
|
eventId: z3.string().min(8).max(64),
|
|
@@ -475,7 +605,9 @@ var AuthoringPickSchema = z4.object({
|
|
|
475
605
|
selectors: z4.array(z4.object({ kind: z4.string(), value: z4.string().max(1e3), label: z4.string().max(200).optional() })).max(10),
|
|
476
606
|
textSnapshot: z4.string().max(200).optional(),
|
|
477
607
|
url: z4.string().max(2e3).optional(),
|
|
478
|
-
rect: z4.object({ x: z4.number(), y: z4.number(), width: z4.number(), height: z4.number() }).optional()
|
|
608
|
+
rect: z4.object({ x: z4.number(), y: z4.number(), width: z4.number(), height: z4.number() }).optional(),
|
|
609
|
+
/** Compact snapshot of the picked element (tag mode: feature rules are proposed from it). */
|
|
610
|
+
elementSnapshot: z4.record(z4.unknown()).optional()
|
|
479
611
|
});
|
|
480
612
|
var PublishedGuideSchema = z4.object({
|
|
481
613
|
id: z4.string(),
|
|
@@ -540,22 +672,140 @@ var FileComplaintSchema = z6.object({
|
|
|
540
672
|
}).optional().nullable()
|
|
541
673
|
});
|
|
542
674
|
|
|
543
|
-
// src/
|
|
675
|
+
// src/agents.ts
|
|
544
676
|
import { z as z7 } from "zod";
|
|
545
|
-
var
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
677
|
+
var ENVIRONMENTS = ["development", "staging", "production"];
|
|
678
|
+
var AgentToolCallSchema = z7.object({
|
|
679
|
+
name: z7.string().trim().min(1).max(100),
|
|
680
|
+
status: z7.enum(AGENT_TOOL_STATUSES).optional(),
|
|
681
|
+
latencyMs: z7.number().int().min(0).max(36e5).optional()
|
|
682
|
+
}).strip();
|
|
683
|
+
var AgentMetadataSchema = z7.record(z7.string().max(100), z7.unknown()).transform((m) => {
|
|
684
|
+
const out = {};
|
|
685
|
+
let size = 0;
|
|
686
|
+
for (const [k, v] of Object.entries(m)) {
|
|
687
|
+
const key = k.trim();
|
|
688
|
+
if (!key || key.startsWith("$") || SENSITIVE_PROPERTY_PATTERN.test(key)) continue;
|
|
689
|
+
if (!(typeof v === "string" || typeof v === "boolean" || v === null || typeof v === "number" && Number.isFinite(v))) continue;
|
|
690
|
+
const value = typeof v === "string" ? v.slice(0, 500) : v;
|
|
691
|
+
size += key.length + String(value).length;
|
|
692
|
+
if (size > AGENT_METADATA_MAX_BYTES || Object.keys(out).length >= AGENT_METADATA_MAX_KEYS) break;
|
|
693
|
+
out[key] = value;
|
|
694
|
+
}
|
|
695
|
+
return out;
|
|
696
|
+
});
|
|
697
|
+
var id = (max) => z7.string().trim().min(1).max(max);
|
|
698
|
+
var optionalId = (max) => z7.string().trim().max(max).optional().nullable().transform((v) => v || null);
|
|
699
|
+
var AgentTurnInputSchema = z7.object({
|
|
700
|
+
type: z7.literal("agent.conversation").optional(),
|
|
701
|
+
conversationId: id(128),
|
|
702
|
+
agentId: id(64).refine((v) => v.toLowerCase() !== SCOUT_AGENT_ID, { message: `"${SCOUT_AGENT_ID}" is reserved for Guidely's built-in Scout agent` }),
|
|
703
|
+
agentName: z7.string().trim().max(100).optional(),
|
|
704
|
+
turnId: z7.string().trim().min(1).max(128).optional(),
|
|
705
|
+
role: z7.enum(AGENT_TURN_ROLES),
|
|
706
|
+
text: z7.string().max(AGENT_TURN_MAX_TEXT).default(""),
|
|
707
|
+
toolCalls: z7.array(AgentToolCallSchema).max(AGENT_TOOL_CALLS_PER_TURN).default([]),
|
|
708
|
+
latencyMs: z7.number().int().min(0).max(36e5).optional(),
|
|
709
|
+
outcome: z7.enum(AGENT_OUTCOMES).optional(),
|
|
710
|
+
taskSuccess: z7.boolean().optional(),
|
|
711
|
+
occurredAt: z7.string().datetime({ offset: true }).optional(),
|
|
712
|
+
userId: optionalId(256),
|
|
713
|
+
anonymousId: optionalId(128),
|
|
714
|
+
accountId: optionalId(256),
|
|
715
|
+
sessionId: optionalId(128),
|
|
716
|
+
metadata: AgentMetadataSchema.default({})
|
|
717
|
+
});
|
|
718
|
+
var turns = z7.array(AgentTurnInputSchema).min(1).max(AGENT_TURNS_PER_BATCH);
|
|
719
|
+
var sdkInfo = z7.object({ name: z7.string().max(60), version: z7.string().max(30) }).optional();
|
|
720
|
+
var SdkAgentEventsSchema = z7.object({ turns, sdk: sdkInfo });
|
|
721
|
+
var AgentEventsRequestSchema = z7.preprocess(
|
|
722
|
+
(v) => {
|
|
723
|
+
if (Array.isArray(v)) return { turns: v };
|
|
724
|
+
if (v && typeof v === "object" && !("turns" in v)) {
|
|
725
|
+
const { environment, ...turn } = v;
|
|
726
|
+
return { turns: [turn], environment };
|
|
727
|
+
}
|
|
728
|
+
return v;
|
|
729
|
+
},
|
|
730
|
+
z7.object({ turns, environment: z7.enum(ENVIRONMENTS).default("production"), sdk: sdkInfo })
|
|
731
|
+
);
|
|
732
|
+
|
|
733
|
+
// src/feedback.ts
|
|
734
|
+
import { z as z8 } from "zod";
|
|
735
|
+
|
|
736
|
+
// src/feedback-limits.ts
|
|
737
|
+
var FEEDBACK_STATUSES = ["new", "under_review", "planned", "in_progress", "released", "declined"];
|
|
738
|
+
var FEEDBACK_STATUS_LABEL = {
|
|
739
|
+
new: "New",
|
|
740
|
+
under_review: "Under review",
|
|
741
|
+
planned: "Planned",
|
|
742
|
+
in_progress: "In progress",
|
|
743
|
+
released: "Released",
|
|
744
|
+
declined: "Declined"
|
|
745
|
+
};
|
|
746
|
+
var FEEDBACK_PRIORITIES = ["nice_to_have", "important", "critical"];
|
|
747
|
+
var FEEDBACK_PRIORITY_LABEL = { nice_to_have: "Nice to have", important: "Important", critical: "Critical" };
|
|
748
|
+
var FEEDBACK_PRIORITY_WEIGHT = { nice_to_have: 1, important: 2, critical: 3 };
|
|
749
|
+
var FEEDBACK_EVENTS = ["request.created", "request.status_changed", "request.voted"];
|
|
750
|
+
var MAX_FEEDBACK_TITLE = 140;
|
|
751
|
+
var MAX_FEEDBACK_DESCRIPTION = 4e3;
|
|
752
|
+
var MAX_FEEDBACK_COMMENT = 2e3;
|
|
753
|
+
var MAX_FEEDBACK_NOTE = 500;
|
|
754
|
+
var feedbackReference = (number) => `#${number}`;
|
|
755
|
+
|
|
756
|
+
// src/feedback.ts
|
|
757
|
+
var visitor = {
|
|
758
|
+
anonymousId: z8.string().min(1).max(128),
|
|
759
|
+
userId: z8.string().max(256).optional().nullable()
|
|
760
|
+
};
|
|
761
|
+
var FeedbackListRequestSchema = z8.object({
|
|
762
|
+
...visitor,
|
|
763
|
+
q: z8.string().trim().max(200).optional(),
|
|
764
|
+
sort: z8.enum(["top", "new", "trending"]).default("top"),
|
|
765
|
+
status: z8.enum(FEEDBACK_STATUSES).optional(),
|
|
766
|
+
/** "open" = not released or declined. */
|
|
767
|
+
filter: z8.enum(["open", "all", "mine", "following"]).default("open"),
|
|
768
|
+
productArea: z8.string().trim().max(60).optional(),
|
|
769
|
+
page: z8.number().int().min(1).max(100).default(1)
|
|
770
|
+
});
|
|
771
|
+
var FeedbackVisitorSchema = z8.object(visitor);
|
|
772
|
+
var SubmitFeedbackSchema = z8.object({
|
|
773
|
+
...visitor,
|
|
774
|
+
title: z8.string().trim().min(3, "Give your idea a short title").max(MAX_FEEDBACK_TITLE),
|
|
775
|
+
description: z8.string().trim().max(MAX_FEEDBACK_DESCRIPTION).default(""),
|
|
776
|
+
productArea: z8.string().trim().max(60).optional().nullable(),
|
|
777
|
+
priority: z8.enum(FEEDBACK_PRIORITIES).default("nice_to_have"),
|
|
778
|
+
/** Filed from this Scout conversation (Scout offered it). */
|
|
779
|
+
conversationId: z8.string().min(1).max(64).optional().nullable(),
|
|
780
|
+
pageUrl: z8.string().max(2e3).optional()
|
|
781
|
+
});
|
|
782
|
+
var FeedbackVoteSchema = z8.object({
|
|
783
|
+
...visitor,
|
|
784
|
+
priority: z8.enum(FEEDBACK_PRIORITIES).default("nice_to_have"),
|
|
785
|
+
note: z8.string().trim().max(MAX_FEEDBACK_NOTE).optional(),
|
|
786
|
+
conversationId: z8.string().min(1).max(64).optional().nullable()
|
|
787
|
+
});
|
|
788
|
+
var FeedbackFollowSchema = z8.object({ ...visitor, follow: z8.boolean() });
|
|
789
|
+
var FeedbackCommentSchema = z8.object({ ...visitor, body: z8.string().trim().min(1).max(MAX_FEEDBACK_COMMENT) });
|
|
790
|
+
var FeedbackSimilarSchema = z8.object({ ...visitor, title: z8.string().trim().min(3).max(MAX_FEEDBACK_TITLE) });
|
|
791
|
+
var FeedbackUpdatesReadSchema = z8.object({ ...visitor, ids: z8.array(z8.string().min(1).max(64)).max(100).optional() });
|
|
792
|
+
|
|
793
|
+
// src/capture.ts
|
|
794
|
+
import { z as z9 } from "zod";
|
|
795
|
+
var AutocaptureSettingsSchema = z9.object({ pageviews: z9.boolean(), pageLeave: z9.boolean(), clicks: z9.boolean(), rageClicks: z9.boolean(), heatmaps: z9.boolean(), mouseMovement: z9.boolean(), appLifecycle: z9.boolean() }).partial();
|
|
796
|
+
var ErrorTrackingSettingsSchema = z9.object({ enabled: z9.boolean() }).partial();
|
|
797
|
+
var ReplaySettingsSchema = z9.object({
|
|
798
|
+
enabled: z9.boolean(),
|
|
799
|
+
sampleRate: z9.number().int().min(0).max(100),
|
|
800
|
+
recordConsole: z9.boolean(),
|
|
801
|
+
recordNetwork: z9.boolean(),
|
|
802
|
+
recordNetworkPayloads: z9.boolean(),
|
|
803
|
+
maskAllText: z9.boolean(),
|
|
804
|
+
blockSelectors: z9.array(z9.string().min(1).max(200)).max(50),
|
|
805
|
+
retentionDays: z9.number().int().min(1).max(365)
|
|
556
806
|
}).partial();
|
|
557
807
|
var DEFAULT_CAPTURE_SETTINGS = {
|
|
558
|
-
autocapture: { pageviews: true, pageLeave: true, clicks: true, rageClicks: true, heatmaps: true, mouseMovement: true },
|
|
808
|
+
autocapture: { pageviews: true, pageLeave: true, clicks: true, rageClicks: true, heatmaps: true, mouseMovement: true, appLifecycle: true },
|
|
559
809
|
errorTracking: { enabled: true },
|
|
560
810
|
replay: { enabled: false, sampleRate: 100, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false, maskAllText: false, blockSelectors: [], retentionDays: 30 }
|
|
561
811
|
};
|
|
@@ -573,18 +823,18 @@ function resolveCaptureSettings(settings) {
|
|
|
573
823
|
};
|
|
574
824
|
}
|
|
575
825
|
var HEATMAP_VIEWPORTS = { mobile: [0, 767], tablet: [768, 1279], desktop: [1280, 1e5] };
|
|
576
|
-
var ReplayChunkSchema =
|
|
577
|
-
sessionId:
|
|
578
|
-
windowId:
|
|
579
|
-
seq:
|
|
580
|
-
anonymousId:
|
|
581
|
-
userId:
|
|
826
|
+
var ReplayChunkSchema = z9.object({
|
|
827
|
+
sessionId: z9.string().min(1).max(128),
|
|
828
|
+
windowId: z9.string().min(1).max(64),
|
|
829
|
+
seq: z9.number().int().min(0).max(1e6),
|
|
830
|
+
anonymousId: z9.string().min(1).max(128),
|
|
831
|
+
userId: z9.string().max(256).optional().nullable(),
|
|
582
832
|
/** rrweb `eventWithTime` objects, in order. */
|
|
583
|
-
events:
|
|
584
|
-
url:
|
|
585
|
-
device:
|
|
586
|
-
viewport:
|
|
587
|
-
sdk:
|
|
833
|
+
events: z9.array(z9.object({ type: z9.number().int(), timestamp: z9.number() }).passthrough()).min(1).max(5e4),
|
|
834
|
+
url: z9.string().max(2e3).optional(),
|
|
835
|
+
device: z9.object({ type: z9.string().max(20), browser: z9.string().max(40).optional(), os: z9.string().max(40).optional() }).optional(),
|
|
836
|
+
viewport: z9.object({ width: z9.number().int().min(0).max(1e5), height: z9.number().int().min(0).max(1e5) }).optional(),
|
|
837
|
+
sdk: z9.object({ name: z9.string().max(60), version: z9.string().max(30) }).optional()
|
|
588
838
|
});
|
|
589
839
|
var REPLAY_MAX_COMPRESSED_BYTES = 2 * 1024 * 1024;
|
|
590
840
|
var REPLAY_MAX_RAW_BYTES = 16 * 1024 * 1024;
|
|
@@ -761,46 +1011,46 @@ var GUIDE_TEMPLATES = [
|
|
|
761
1011
|
}
|
|
762
1012
|
}
|
|
763
1013
|
];
|
|
764
|
-
function templateConfig(
|
|
765
|
-
const t = GUIDE_TEMPLATES.find((x) => x.id ===
|
|
1014
|
+
function templateConfig(id2) {
|
|
1015
|
+
const t = GUIDE_TEMPLATES.find((x) => x.id === id2);
|
|
766
1016
|
if (!t) return null;
|
|
767
1017
|
return { template: t, config: GuideConfigSchema.parse(t.config) };
|
|
768
1018
|
}
|
|
769
1019
|
|
|
770
1020
|
// src/howto.ts
|
|
771
|
-
import { z as
|
|
1021
|
+
import { z as z10 } from "zod";
|
|
772
1022
|
var HOWTO_STEP_KINDS = ["action", "text", "heading", "tip", "alert"];
|
|
773
1023
|
var HOWTO_ACTIONS = ["click", "type", "select", "navigate"];
|
|
774
|
-
var NormalizedRectSchema =
|
|
775
|
-
x:
|
|
776
|
-
y:
|
|
777
|
-
width:
|
|
778
|
-
height:
|
|
1024
|
+
var NormalizedRectSchema = z10.object({
|
|
1025
|
+
x: z10.number().min(0).max(1),
|
|
1026
|
+
y: z10.number().min(0).max(1),
|
|
1027
|
+
width: z10.number().min(0).max(1),
|
|
1028
|
+
height: z10.number().min(0).max(1)
|
|
779
1029
|
});
|
|
780
|
-
var CapturedElementSchema =
|
|
1030
|
+
var CapturedElementSchema = z10.object({
|
|
781
1031
|
/** Visible name: aria-label, associated label, text, placeholder, alt or title. */
|
|
782
|
-
label:
|
|
1032
|
+
label: z10.string().max(200).default(""),
|
|
783
1033
|
/** button, link, tab, menuitem, checkbox, radio, field, dropdown, option, element… */
|
|
784
|
-
role:
|
|
785
|
-
tag:
|
|
1034
|
+
role: z10.string().max(40).default("element"),
|
|
1035
|
+
tag: z10.string().max(40).default("")
|
|
786
1036
|
});
|
|
787
|
-
var CaptureStepSchema =
|
|
1037
|
+
var CaptureStepSchema = z10.object({
|
|
788
1038
|
/** Random id from the SDK; a retried upload with the same id is stored once. */
|
|
789
|
-
clientId:
|
|
790
|
-
action:
|
|
791
|
-
url:
|
|
792
|
-
pageTitle:
|
|
1039
|
+
clientId: z10.string().min(1).max(64),
|
|
1040
|
+
action: z10.enum(HOWTO_ACTIONS),
|
|
1041
|
+
url: z10.string().max(2e3),
|
|
1042
|
+
pageTitle: z10.string().max(300).default(""),
|
|
793
1043
|
element: CapturedElementSchema.optional(),
|
|
794
1044
|
/** Typed text or chosen option; absent when it was sensitive (`valueRedacted`). */
|
|
795
|
-
value:
|
|
796
|
-
valueRedacted:
|
|
1045
|
+
value: z10.string().max(200).optional(),
|
|
1046
|
+
valueRedacted: z10.boolean().default(false),
|
|
797
1047
|
/** Selectors for the element, so the step can later become an interactive tour step. */
|
|
798
|
-
selectors:
|
|
1048
|
+
selectors: z10.array(SelectorStrategySchema).max(10).default([]),
|
|
799
1049
|
/** Where the element sits in the screenshot. */
|
|
800
1050
|
highlight: NormalizedRectSchema.optional(),
|
|
801
1051
|
/** Number of regions the SDK blurred in the screenshot before upload. */
|
|
802
|
-
redactions:
|
|
803
|
-
occurredAt:
|
|
1052
|
+
redactions: z10.number().int().min(0).max(1e3).default(0),
|
|
1053
|
+
occurredAt: z10.string().datetime().optional()
|
|
804
1054
|
});
|
|
805
1055
|
function quoted(s) {
|
|
806
1056
|
const t = (s ?? "").replace(/\s+/g, " ").trim();
|
|
@@ -871,23 +1121,175 @@ function hostAndPath(url) {
|
|
|
871
1121
|
return url.slice(0, 80);
|
|
872
1122
|
}
|
|
873
1123
|
}
|
|
874
|
-
var NormalizedPointSchema =
|
|
1124
|
+
var NormalizedPointSchema = z10.object({ x: z10.number().min(0).max(1), y: z10.number().min(0).max(1) });
|
|
875
1125
|
var ANNOTATION_COLORS = ["brand", "red", "amber", "green", "black", "white"];
|
|
876
|
-
var HowToAnnotationSchema =
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1126
|
+
var HowToAnnotationSchema = z10.discriminatedUnion("type", [
|
|
1127
|
+
z10.object({ id: z10.string().min(1).max(32), type: z10.literal("arrow"), from: NormalizedPointSchema, to: NormalizedPointSchema, color: z10.enum(ANNOTATION_COLORS).default("brand") }),
|
|
1128
|
+
z10.object({ id: z10.string().min(1).max(32), type: z10.literal("text"), at: NormalizedPointSchema, text: z10.string().trim().min(1).max(120), color: z10.enum(ANNOTATION_COLORS).default("brand") }),
|
|
1129
|
+
z10.object({ id: z10.string().min(1).max(32), type: z10.literal("box"), rect: NormalizedRectSchema, color: z10.enum(ANNOTATION_COLORS).default("brand") })
|
|
880
1130
|
]);
|
|
881
1131
|
var MAX_ANNOTATIONS = 30;
|
|
882
1132
|
|
|
1133
|
+
// src/snippet.ts
|
|
1134
|
+
var SCRIPT_STUB_METHODS = [
|
|
1135
|
+
"identify",
|
|
1136
|
+
"track",
|
|
1137
|
+
"page",
|
|
1138
|
+
"reset",
|
|
1139
|
+
"setAccount",
|
|
1140
|
+
"updateTraits",
|
|
1141
|
+
"setConsent",
|
|
1142
|
+
"setLocale",
|
|
1143
|
+
"startGuide",
|
|
1144
|
+
"stopGuide",
|
|
1145
|
+
"dismissGuide",
|
|
1146
|
+
"openMessenger",
|
|
1147
|
+
"closeMessenger",
|
|
1148
|
+
"showNewMessage",
|
|
1149
|
+
"openResourceCenter",
|
|
1150
|
+
"closeResourceCenter",
|
|
1151
|
+
"openChecklist",
|
|
1152
|
+
"closeChecklist",
|
|
1153
|
+
"completeChecklistTask",
|
|
1154
|
+
"openComplaint",
|
|
1155
|
+
"openIdeas",
|
|
1156
|
+
"captureException",
|
|
1157
|
+
"agentConversation",
|
|
1158
|
+
"trackAgentTurn",
|
|
1159
|
+
"on"
|
|
1160
|
+
];
|
|
1161
|
+
var SCRIPT_STUB = `!function(w){if(w.Guidely)return;var g=w.Guidely={_q:[]},c=g._c={};function q(o,k){o[k]=function(){g._q.push([o===c?1:0,k,[].slice.call(arguments)])}}q(g,"init");"${SCRIPT_STUB_METHODS.join(" ")}".split(" ").forEach(function(k){q(c,k)});c.isFeatureEnabled=function(k,f){return!!f};c.getFeatureValue=function(k,f){return f};g.get=function(){return c}}(window);`;
|
|
1162
|
+
function scriptSnippet(scriptUrl, initOptions) {
|
|
1163
|
+
return `<script>
|
|
1164
|
+
${SCRIPT_STUB}
|
|
1165
|
+
Guidely.init(${initOptions});
|
|
1166
|
+
</script>
|
|
1167
|
+
<script src="${scriptUrl}" async></script>`;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
// src/translation-files.ts
|
|
1171
|
+
function xmlEscape(s) {
|
|
1172
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1173
|
+
}
|
|
1174
|
+
function xmlUnescape(s) {
|
|
1175
|
+
return s.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, (_, c) => c.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&#(\d+);/g, (_, d) => String.fromCodePoint(Number(d))).replace(/&#x([0-9a-f]+);/gi, (_, h) => String.fromCodePoint(parseInt(h, 16))).replace(/&/g, "&");
|
|
1176
|
+
}
|
|
1177
|
+
function toXliff(units, opts) {
|
|
1178
|
+
const body = units.map(
|
|
1179
|
+
(u) => ` <trans-unit id="${xmlEscape(u.key)}">
|
|
1180
|
+
<source>${xmlEscape(u.source)}</source>
|
|
1181
|
+
<target${u.target ? "" : ' state="needs-translation"'}>${xmlEscape(u.target)}</target>${u.note ? `
|
|
1182
|
+
<note>${xmlEscape(u.note)}</note>` : ""}
|
|
1183
|
+
</trans-unit>`
|
|
1184
|
+
).join("\n");
|
|
1185
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
1186
|
+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
|
1187
|
+
<file original="${xmlEscape(opts.original)}" source-language="${xmlEscape(opts.sourceLocale)}" target-language="${xmlEscape(opts.targetLocale)}" datatype="html">
|
|
1188
|
+
<body>
|
|
1189
|
+
${body}
|
|
1190
|
+
</body>
|
|
1191
|
+
</file>
|
|
1192
|
+
</xliff>
|
|
1193
|
+
`;
|
|
1194
|
+
}
|
|
1195
|
+
function parseXliff(xml) {
|
|
1196
|
+
const target = xml.match(/target-language="([^"]+)"/)?.[1] ?? xml.match(/\btrgLang="([^"]+)"/)?.[1];
|
|
1197
|
+
const entries = {};
|
|
1198
|
+
for (const m of xml.matchAll(/<(trans-unit|unit)\b[^>]*\bid="([^"]*)"[^>]*>([\s\S]*?)<\/\1>/g)) {
|
|
1199
|
+
const key = xmlUnescape(m[2]);
|
|
1200
|
+
const t = m[3].match(/<target\b[^>]*>([\s\S]*?)<\/target>/);
|
|
1201
|
+
const text = t ? xmlUnescape(t[1]) : "";
|
|
1202
|
+
if (key && text.trim()) entries[key] = text;
|
|
1203
|
+
}
|
|
1204
|
+
return { targetLocale: target ? xmlUnescape(target) : void 0, entries };
|
|
1205
|
+
}
|
|
1206
|
+
function csvCell(s) {
|
|
1207
|
+
return /[",\n\r]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
|
|
1208
|
+
}
|
|
1209
|
+
function toTranslationCsv(units, targetLocale) {
|
|
1210
|
+
const rows = [["key", "context", "source", targetLocale], ...units.map((u) => [u.key, u.note ?? "", u.source, u.target])];
|
|
1211
|
+
return rows.map((r) => r.map(csvCell).join(",")).join("\r\n") + "\r\n";
|
|
1212
|
+
}
|
|
1213
|
+
function parseCsvRows(text) {
|
|
1214
|
+
const rows = [];
|
|
1215
|
+
let row = [];
|
|
1216
|
+
let cell = "";
|
|
1217
|
+
let quoted2 = false;
|
|
1218
|
+
const src = text.replace(/^\uFEFF/, "");
|
|
1219
|
+
for (let i = 0; i < src.length; i++) {
|
|
1220
|
+
const ch = src[i];
|
|
1221
|
+
if (quoted2) {
|
|
1222
|
+
if (ch === '"') {
|
|
1223
|
+
if (src[i + 1] === '"') {
|
|
1224
|
+
cell += '"';
|
|
1225
|
+
i++;
|
|
1226
|
+
} else quoted2 = false;
|
|
1227
|
+
} else cell += ch;
|
|
1228
|
+
} else if (ch === '"') quoted2 = true;
|
|
1229
|
+
else if (ch === ",") {
|
|
1230
|
+
row.push(cell);
|
|
1231
|
+
cell = "";
|
|
1232
|
+
} else if (ch === "\n" || ch === "\r") {
|
|
1233
|
+
if (ch === "\r" && src[i + 1] === "\n") i++;
|
|
1234
|
+
row.push(cell);
|
|
1235
|
+
rows.push(row);
|
|
1236
|
+
row = [];
|
|
1237
|
+
cell = "";
|
|
1238
|
+
} else cell += ch;
|
|
1239
|
+
}
|
|
1240
|
+
if (cell !== "" || row.length) {
|
|
1241
|
+
row.push(cell);
|
|
1242
|
+
rows.push(row);
|
|
1243
|
+
}
|
|
1244
|
+
return rows.filter((r) => r.some((c) => c.trim() !== ""));
|
|
1245
|
+
}
|
|
1246
|
+
function parseTranslationCsv(text) {
|
|
1247
|
+
const [header, ...rows] = parseCsvRows(text);
|
|
1248
|
+
if (!header) return { entries: {} };
|
|
1249
|
+
const names = header.map((h) => h.trim());
|
|
1250
|
+
const lower = names.map((h) => h.toLowerCase());
|
|
1251
|
+
const keyCol = lower.indexOf("key");
|
|
1252
|
+
if (keyCol < 0) return { entries: {} };
|
|
1253
|
+
let targetCol = lower.indexOf("target");
|
|
1254
|
+
if (targetCol < 0) {
|
|
1255
|
+
for (let i = names.length - 1; i >= 0; i--) {
|
|
1256
|
+
if (!["key", "context", "source", "label", "note"].includes(lower[i])) {
|
|
1257
|
+
targetCol = i;
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
if (targetCol < 0) return { entries: {} };
|
|
1263
|
+
const entries = {};
|
|
1264
|
+
for (const r of rows) {
|
|
1265
|
+
const key = (r[keyCol] ?? "").trim();
|
|
1266
|
+
const value = r[targetCol] ?? "";
|
|
1267
|
+
if (key && value.trim()) entries[key] = value;
|
|
1268
|
+
}
|
|
1269
|
+
return { targetLocale: lower[targetCol] === "target" ? void 0 : names[targetCol], entries };
|
|
1270
|
+
}
|
|
1271
|
+
|
|
883
1272
|
// src/index.ts
|
|
884
1273
|
var SDK_API_VERSION = "v1";
|
|
885
|
-
var SHARED_VERSION = "0.
|
|
1274
|
+
var SHARED_VERSION = "0.11.0";
|
|
886
1275
|
export {
|
|
887
1276
|
ADVANCE_ON,
|
|
1277
|
+
AGENT_METADATA_MAX_BYTES,
|
|
1278
|
+
AGENT_METADATA_MAX_KEYS,
|
|
1279
|
+
AGENT_OUTCOMES,
|
|
1280
|
+
AGENT_TOOL_CALLS_PER_TURN,
|
|
1281
|
+
AGENT_TOOL_STATUSES,
|
|
1282
|
+
AGENT_TURNS_PER_BATCH,
|
|
1283
|
+
AGENT_TURN_MAX_TEXT,
|
|
1284
|
+
AGENT_TURN_ROLES,
|
|
888
1285
|
ANNOTATION_COLORS,
|
|
1286
|
+
APP_LIFECYCLE_EVENTS,
|
|
889
1287
|
ARTICLE_VISIBILITIES,
|
|
890
1288
|
AUTOCAPTURE_EVENTS,
|
|
1289
|
+
AgentEventsRequestSchema,
|
|
1290
|
+
AgentMetadataSchema,
|
|
1291
|
+
AgentToolCallSchema,
|
|
1292
|
+
AgentTurnInputSchema,
|
|
891
1293
|
AppearanceSchema,
|
|
892
1294
|
AuthoringPickSchema,
|
|
893
1295
|
AutocaptureSettingsSchema,
|
|
@@ -895,9 +1297,11 @@ export {
|
|
|
895
1297
|
ButtonSchema,
|
|
896
1298
|
CAPTURE_PARAM,
|
|
897
1299
|
CAPTURE_SCREENSHOT_MAX_BYTES,
|
|
1300
|
+
COMMON_LOCALES,
|
|
898
1301
|
COMPLAINT_EVENTS,
|
|
899
1302
|
COMPLAINT_FIELD_TYPES,
|
|
900
1303
|
COMPLAINT_STATUSES,
|
|
1304
|
+
CONTROL_VARIANT_ID,
|
|
901
1305
|
CaptureStepSchema,
|
|
902
1306
|
CapturedElementSchema,
|
|
903
1307
|
ChecklistConfigSchema,
|
|
@@ -906,28 +1310,54 @@ export {
|
|
|
906
1310
|
ConversationLookupSchema,
|
|
907
1311
|
ConversationRatingSchema,
|
|
908
1312
|
DEFAULT_CAPTURE_SETTINGS,
|
|
1313
|
+
DEFAULT_FEATURE_ATTRIBUTE,
|
|
1314
|
+
DEFAULT_LOCALE,
|
|
909
1315
|
DEFAULT_PLATFORMS,
|
|
910
1316
|
EMBED_IFRAME_ATTRS,
|
|
911
1317
|
EVENT_NAMES,
|
|
912
1318
|
ErrorTrackingSettingsSchema,
|
|
913
1319
|
EventBatchSchema,
|
|
1320
|
+
FEATURE_ATTRIBUTE_PATTERN,
|
|
1321
|
+
FEATURE_RULE_LIMITS,
|
|
1322
|
+
FEEDBACK_EVENTS,
|
|
1323
|
+
FEEDBACK_PRIORITIES,
|
|
1324
|
+
FEEDBACK_PRIORITY_LABEL,
|
|
1325
|
+
FEEDBACK_PRIORITY_WEIGHT,
|
|
1326
|
+
FEEDBACK_STATUSES,
|
|
1327
|
+
FEEDBACK_STATUS_LABEL,
|
|
914
1328
|
FILE_LINK_CLASS,
|
|
1329
|
+
FeedbackCommentSchema,
|
|
1330
|
+
FeedbackFollowSchema,
|
|
1331
|
+
FeedbackListRequestSchema,
|
|
1332
|
+
FeedbackSimilarSchema,
|
|
1333
|
+
FeedbackUpdatesReadSchema,
|
|
1334
|
+
FeedbackVisitorSchema,
|
|
1335
|
+
FeedbackVoteSchema,
|
|
915
1336
|
FileComplaintSchema,
|
|
916
1337
|
FrequencySchema,
|
|
917
1338
|
GUIDELY_ID_ATTRIBUTE,
|
|
1339
|
+
GUIDE_EXPERIMENT_GOALS,
|
|
1340
|
+
GUIDE_EXPERIMENT_GOAL_LABELS,
|
|
1341
|
+
GUIDE_EXPERIMENT_STATUSES,
|
|
918
1342
|
GUIDE_KINDS,
|
|
919
1343
|
GUIDE_LIFECYCLE_EVENTS,
|
|
920
1344
|
GUIDE_STATUSES,
|
|
921
1345
|
GUIDE_TEMPLATES,
|
|
922
1346
|
GUIDE_VISIBILITIES,
|
|
923
1347
|
GuideConfigSchema,
|
|
1348
|
+
GuideLocalizationSchema,
|
|
1349
|
+
GuideScheduleSchema,
|
|
924
1350
|
GuideStateUpdateSchema,
|
|
1351
|
+
GuideThrottlingSchema,
|
|
925
1352
|
HEATMAP_VIEWPORTS,
|
|
926
1353
|
HOWTO_ACTIONS,
|
|
927
1354
|
HOWTO_STEP_KINDS,
|
|
928
1355
|
HowToAnnotationSchema,
|
|
929
1356
|
IdentifyRequestSchema,
|
|
1357
|
+
LOCALE_PATTERN,
|
|
930
1358
|
LOGGED_IN_AUDIENCE,
|
|
1359
|
+
LocaleSchema,
|
|
1360
|
+
LocalizationSettingsSchema,
|
|
931
1361
|
MAX_ANNOTATIONS,
|
|
932
1362
|
MAX_COLLECTION_DEPTH,
|
|
933
1363
|
MAX_COMPLAINT_ANSWER_LENGTH,
|
|
@@ -935,6 +1365,11 @@ export {
|
|
|
935
1365
|
MAX_COMPLAINT_CHOICES,
|
|
936
1366
|
MAX_COMPLAINT_FIELDS,
|
|
937
1367
|
MAX_COMPLAINT_LENGTH,
|
|
1368
|
+
MAX_CUSTOM_CSS,
|
|
1369
|
+
MAX_FEEDBACK_COMMENT,
|
|
1370
|
+
MAX_FEEDBACK_DESCRIPTION,
|
|
1371
|
+
MAX_FEEDBACK_NOTE,
|
|
1372
|
+
MAX_FEEDBACK_TITLE,
|
|
938
1373
|
MAX_MESSAGE_LENGTH,
|
|
939
1374
|
MAX_PROPERTY_BYTES,
|
|
940
1375
|
MAX_STACK_FRAMES,
|
|
@@ -948,8 +1383,10 @@ export {
|
|
|
948
1383
|
MESSAGE_AUTHORS,
|
|
949
1384
|
MessengerPageRequestSchema,
|
|
950
1385
|
NETWORK_PLUGIN,
|
|
1386
|
+
NOISY_DATA_ATTR,
|
|
951
1387
|
NormalizedPointSchema,
|
|
952
1388
|
NormalizedRectSchema,
|
|
1389
|
+
PAGE_RULE_LIMITS,
|
|
953
1390
|
PATH_ID_PATTERN,
|
|
954
1391
|
PDF_BLOCK_CLASS,
|
|
955
1392
|
PDF_MAX_PAGES,
|
|
@@ -959,6 +1396,8 @@ export {
|
|
|
959
1396
|
PostMessageSchema,
|
|
960
1397
|
ProjectThemeSchema,
|
|
961
1398
|
PublishedGuideSchema,
|
|
1399
|
+
RC_MODULE_IDS,
|
|
1400
|
+
RC_MODULE_LABELS,
|
|
962
1401
|
REPLAY_MAX_COMPRESSED_BYTES,
|
|
963
1402
|
REPLAY_MAX_RAW_BYTES,
|
|
964
1403
|
REPLY_TIMES,
|
|
@@ -968,6 +1407,9 @@ export {
|
|
|
968
1407
|
ReplaySettingsSchema,
|
|
969
1408
|
RuleGroupSchema,
|
|
970
1409
|
RuleSchema,
|
|
1410
|
+
SCOUT_AGENT_ID,
|
|
1411
|
+
SCRIPT_STUB,
|
|
1412
|
+
SCRIPT_STUB_METHODS,
|
|
971
1413
|
SDK_API_VERSION,
|
|
972
1414
|
SELECTOR_KINDS,
|
|
973
1415
|
SENSITIVE_HEADER_PATTERN,
|
|
@@ -977,30 +1419,46 @@ export {
|
|
|
977
1419
|
SHARED_VERSION,
|
|
978
1420
|
SHOW_ME_CLASS,
|
|
979
1421
|
SHOW_ME_HREF_PREFIX,
|
|
1422
|
+
SNAPSHOT_ATTRS,
|
|
1423
|
+
SNAPSHOT_LIMITS,
|
|
980
1424
|
SOURCEMAP_MAX_FILES_PER_UPLOAD,
|
|
981
1425
|
SOURCEMAP_MAX_FILE_BYTES,
|
|
982
1426
|
STATUS_LEVELS,
|
|
983
1427
|
STEP_TYPES,
|
|
984
1428
|
SURVEY_QUESTION_TYPES,
|
|
1429
|
+
SdkAgentEventsSchema,
|
|
985
1430
|
SdkEventSchema,
|
|
986
1431
|
SelectorStrategySchema,
|
|
1432
|
+
SelectorSyntaxError,
|
|
987
1433
|
StartConversationSchema,
|
|
988
1434
|
StepBranchSchema,
|
|
989
1435
|
StepSchema,
|
|
1436
|
+
SubmitFeedbackSchema,
|
|
990
1437
|
SurveyConfigSchema,
|
|
991
1438
|
SurveyQuestionSchema,
|
|
992
1439
|
SurveyResponseRequestSchema,
|
|
1440
|
+
TAG_PROPERTY_LIMITS,
|
|
993
1441
|
TRIGGER_TYPES,
|
|
994
1442
|
TargetSchema,
|
|
995
1443
|
TriggerSchema,
|
|
996
1444
|
VIDEO_ATTRS,
|
|
1445
|
+
WCAG_AA_LARGE,
|
|
1446
|
+
WCAG_AA_TEXT,
|
|
997
1447
|
WS_MAX_MESSAGES_PER_SOCKET,
|
|
998
1448
|
WS_MAX_MESSAGE_BYTES,
|
|
1449
|
+
applyGuideTranslations,
|
|
1450
|
+
articleTextEntries,
|
|
1451
|
+
assignGuideVariant,
|
|
1452
|
+
baseLanguage,
|
|
999
1453
|
clamp,
|
|
1000
1454
|
cleanLabel,
|
|
1001
1455
|
compare,
|
|
1002
1456
|
compareVersions,
|
|
1003
1457
|
complaintReference,
|
|
1458
|
+
compoundMatches,
|
|
1459
|
+
contrastIssues,
|
|
1460
|
+
contrastRatio,
|
|
1461
|
+
cssSelectorError,
|
|
1004
1462
|
defaultGuideConfig,
|
|
1005
1463
|
defaultStep,
|
|
1006
1464
|
describeCaptureStep,
|
|
@@ -1008,12 +1466,21 @@ export {
|
|
|
1008
1466
|
emptyRuleGroup,
|
|
1009
1467
|
evaluateRule,
|
|
1010
1468
|
evaluateRules,
|
|
1469
|
+
evenWeights,
|
|
1470
|
+
experimentBucketRules,
|
|
1471
|
+
experimentSalt,
|
|
1472
|
+
featureCssSelectors,
|
|
1473
|
+
featureRuleError,
|
|
1474
|
+
featureRuleMatchesClick,
|
|
1475
|
+
feedbackReference,
|
|
1011
1476
|
fingerprintError,
|
|
1012
1477
|
firstNameFromTraits,
|
|
1013
1478
|
fnv1a,
|
|
1014
1479
|
foldPathIds,
|
|
1015
1480
|
getPath,
|
|
1481
|
+
guideLocales,
|
|
1016
1482
|
guidePlatforms,
|
|
1483
|
+
guideTextEntries,
|
|
1017
1484
|
guidelyIdFromSelector,
|
|
1018
1485
|
hasVideoMedia,
|
|
1019
1486
|
isAllowedEmbedSrc,
|
|
@@ -1026,6 +1493,12 @@ export {
|
|
|
1026
1493
|
isRuleGroup,
|
|
1027
1494
|
isSafeMediaUrl,
|
|
1028
1495
|
isVideoContentType,
|
|
1496
|
+
localeName,
|
|
1497
|
+
localizeAnnouncement,
|
|
1498
|
+
localizeArticle,
|
|
1499
|
+
localizeGuide,
|
|
1500
|
+
localizeResourceCenter,
|
|
1501
|
+
matchCssSelector,
|
|
1029
1502
|
matchUrlPattern,
|
|
1030
1503
|
matchesAudiences,
|
|
1031
1504
|
matchesHelpQuery,
|
|
@@ -1033,30 +1506,63 @@ export {
|
|
|
1033
1506
|
mediaMaxBytes,
|
|
1034
1507
|
normalizeErrorMessage,
|
|
1035
1508
|
normalizeFrameFile,
|
|
1509
|
+
normalizeLocale,
|
|
1510
|
+
normalizeSnapshot,
|
|
1511
|
+
orderedModules,
|
|
1036
1512
|
pageLabel,
|
|
1037
1513
|
pageName,
|
|
1514
|
+
pagePattern,
|
|
1515
|
+
pageRuleError,
|
|
1516
|
+
pageRuleMatches,
|
|
1517
|
+
pageRulesMatch,
|
|
1038
1518
|
pageTerms,
|
|
1519
|
+
parseCssSelector,
|
|
1520
|
+
parseCsvRows,
|
|
1521
|
+
parseHexColor,
|
|
1039
1522
|
parseStack,
|
|
1523
|
+
parseTranslationCsv,
|
|
1524
|
+
parseXliff,
|
|
1525
|
+
propertyAttributeAllowed,
|
|
1526
|
+
queryConditionRegex,
|
|
1040
1527
|
randomId,
|
|
1528
|
+
readableTextOn,
|
|
1529
|
+
relativeLuminance,
|
|
1041
1530
|
resolveCaptureSettings,
|
|
1531
|
+
resolveLocale,
|
|
1532
|
+
resourceCenterLocales,
|
|
1042
1533
|
resourceCenterSections,
|
|
1534
|
+
resourceCenterTextEntries,
|
|
1043
1535
|
rolloutBucket,
|
|
1044
1536
|
safeRegExp,
|
|
1537
|
+
sanitizeCustomCss,
|
|
1045
1538
|
sanitizeProperties,
|
|
1539
|
+
scopeCustomCss,
|
|
1046
1540
|
screenPath,
|
|
1541
|
+
scriptSnippet,
|
|
1047
1542
|
servedArticleAudiences,
|
|
1048
1543
|
showMeHref,
|
|
1049
1544
|
showMeKeyFromHref,
|
|
1050
1545
|
showMeKeys,
|
|
1051
1546
|
slugify,
|
|
1547
|
+
snapshotFromSelector,
|
|
1548
|
+
stableStringify,
|
|
1052
1549
|
stripOrigin,
|
|
1053
1550
|
supportsPlatform,
|
|
1054
1551
|
templateConfig,
|
|
1055
1552
|
toEmbedUrl,
|
|
1553
|
+
toTranslationCsv,
|
|
1554
|
+
toXliff,
|
|
1555
|
+
translationCoverage,
|
|
1556
|
+
unreadAnnouncements,
|
|
1056
1557
|
validateGuideConfig,
|
|
1558
|
+
variantProblems,
|
|
1559
|
+
variantRanges,
|
|
1560
|
+
visibleAnnouncements,
|
|
1057
1561
|
visibleArticleIds,
|
|
1058
1562
|
visibleButtons,
|
|
1059
1563
|
visitorAudiences,
|
|
1564
|
+
visitorLocales,
|
|
1565
|
+
withExperimentBucket,
|
|
1060
1566
|
withVisibility
|
|
1061
1567
|
};
|
|
1062
1568
|
//# sourceMappingURL=index.js.map
|