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