@guidelytech/shared 0.5.0 → 0.6.1
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-5IQVBZO6.js → chunk-OLWGMDRX.js} +71 -4
- package/dist/chunk-OLWGMDRX.js.map +1 -0
- package/dist/index.cjs +244 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +457 -7
- package/dist/index.d.ts +457 -7
- package/dist/index.js +175 -3
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +85 -2
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +56 -3
- package/dist/runtime.d.ts +56 -3
- package/dist/runtime.js +33 -1
- package/package.json +1 -1
- package/dist/chunk-5IQVBZO6.js.map +0 -1
- package/dist/chunk-QUKMOTT4.js +0 -477
- package/dist/chunk-QUKMOTT4.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -21,12 +21,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ADVANCE_ON: () => ADVANCE_ON,
|
|
24
|
+
ANNOTATION_COLORS: () => ANNOTATION_COLORS,
|
|
24
25
|
AUTOCAPTURE_EVENTS: () => AUTOCAPTURE_EVENTS,
|
|
25
26
|
AppearanceSchema: () => AppearanceSchema,
|
|
26
27
|
AuthoringPickSchema: () => AuthoringPickSchema,
|
|
27
28
|
AutocaptureSettingsSchema: () => AutocaptureSettingsSchema,
|
|
28
29
|
BUTTON_ACTIONS: () => BUTTON_ACTIONS,
|
|
29
30
|
ButtonSchema: () => ButtonSchema,
|
|
31
|
+
CAPTURE_PARAM: () => CAPTURE_PARAM,
|
|
32
|
+
CAPTURE_SCREENSHOT_MAX_BYTES: () => CAPTURE_SCREENSHOT_MAX_BYTES,
|
|
33
|
+
CaptureStepSchema: () => CaptureStepSchema,
|
|
34
|
+
CapturedElementSchema: () => CapturedElementSchema,
|
|
30
35
|
ChecklistConfigSchema: () => ChecklistConfigSchema,
|
|
31
36
|
ChecklistProgressRequestSchema: () => ChecklistProgressRequestSchema,
|
|
32
37
|
ChecklistTaskSchema: () => ChecklistTaskSchema,
|
|
@@ -38,6 +43,7 @@ __export(index_exports, {
|
|
|
38
43
|
EVENT_NAMES: () => EVENT_NAMES,
|
|
39
44
|
ErrorTrackingSettingsSchema: () => ErrorTrackingSettingsSchema,
|
|
40
45
|
EventBatchSchema: () => EventBatchSchema,
|
|
46
|
+
FILE_LINK_CLASS: () => FILE_LINK_CLASS,
|
|
41
47
|
FrequencySchema: () => FrequencySchema,
|
|
42
48
|
GUIDELY_ID_ATTRIBUTE: () => GUIDELY_ID_ATTRIBUTE,
|
|
43
49
|
GUIDE_KINDS: () => GUIDE_KINDS,
|
|
@@ -47,17 +53,31 @@ __export(index_exports, {
|
|
|
47
53
|
GuideConfigSchema: () => GuideConfigSchema,
|
|
48
54
|
GuideStateUpdateSchema: () => GuideStateUpdateSchema,
|
|
49
55
|
HEATMAP_VIEWPORTS: () => HEATMAP_VIEWPORTS,
|
|
56
|
+
HOWTO_ACTIONS: () => HOWTO_ACTIONS,
|
|
57
|
+
HOWTO_STEP_KINDS: () => HOWTO_STEP_KINDS,
|
|
58
|
+
HowToAnnotationSchema: () => HowToAnnotationSchema,
|
|
50
59
|
IdentifyRequestSchema: () => IdentifyRequestSchema,
|
|
60
|
+
MAX_ANNOTATIONS: () => MAX_ANNOTATIONS,
|
|
51
61
|
MAX_COLLECTION_DEPTH: () => MAX_COLLECTION_DEPTH,
|
|
52
62
|
MAX_MESSAGE_LENGTH: () => MAX_MESSAGE_LENGTH,
|
|
53
63
|
MAX_PROPERTY_BYTES: () => MAX_PROPERTY_BYTES,
|
|
54
64
|
MAX_STACK_FRAMES: () => MAX_STACK_FRAMES,
|
|
65
|
+
MEDIA_FILE_MAX_BYTES: () => MEDIA_FILE_MAX_BYTES,
|
|
66
|
+
MEDIA_FILE_TYPES: () => MEDIA_FILE_TYPES,
|
|
55
67
|
MEDIA_IMAGE_MAX_BYTES: () => MEDIA_IMAGE_MAX_BYTES,
|
|
56
68
|
MEDIA_IMAGE_TYPES: () => MEDIA_IMAGE_TYPES,
|
|
69
|
+
MEDIA_MAX_BYTES: () => MEDIA_MAX_BYTES,
|
|
57
70
|
MEDIA_VIDEO_MAX_BYTES: () => MEDIA_VIDEO_MAX_BYTES,
|
|
58
71
|
MEDIA_VIDEO_TYPES: () => MEDIA_VIDEO_TYPES,
|
|
59
72
|
MESSAGE_AUTHORS: () => MESSAGE_AUTHORS,
|
|
73
|
+
MessengerPageRequestSchema: () => MessengerPageRequestSchema,
|
|
60
74
|
NETWORK_PLUGIN: () => NETWORK_PLUGIN,
|
|
75
|
+
NormalizedPointSchema: () => NormalizedPointSchema,
|
|
76
|
+
NormalizedRectSchema: () => NormalizedRectSchema,
|
|
77
|
+
PATH_ID_PATTERN: () => PATH_ID_PATTERN,
|
|
78
|
+
PDF_BLOCK_CLASS: () => PDF_BLOCK_CLASS,
|
|
79
|
+
PDF_MAX_PAGES: () => PDF_MAX_PAGES,
|
|
80
|
+
PDF_PAGES_CLASS: () => PDF_PAGES_CLASS,
|
|
61
81
|
PLACEMENTS: () => PLACEMENTS,
|
|
62
82
|
PLATFORMS: () => PLATFORMS,
|
|
63
83
|
PostMessageSchema: () => PostMessageSchema,
|
|
@@ -65,6 +85,7 @@ __export(index_exports, {
|
|
|
65
85
|
PublishedGuideSchema: () => PublishedGuideSchema,
|
|
66
86
|
REPLAY_MAX_COMPRESSED_BYTES: () => REPLAY_MAX_COMPRESSED_BYTES,
|
|
67
87
|
REPLAY_MAX_RAW_BYTES: () => REPLAY_MAX_RAW_BYTES,
|
|
88
|
+
REPLY_TIMES: () => REPLY_TIMES,
|
|
68
89
|
RULE_FIELDS: () => RULE_FIELDS,
|
|
69
90
|
RULE_OPERATORS: () => RULE_OPERATORS,
|
|
70
91
|
ReplayChunkSchema: () => ReplayChunkSchema,
|
|
@@ -80,6 +101,7 @@ __export(index_exports, {
|
|
|
80
101
|
SHARED_VERSION: () => SHARED_VERSION,
|
|
81
102
|
SOURCEMAP_MAX_FILES_PER_UPLOAD: () => SOURCEMAP_MAX_FILES_PER_UPLOAD,
|
|
82
103
|
SOURCEMAP_MAX_FILE_BYTES: () => SOURCEMAP_MAX_FILE_BYTES,
|
|
104
|
+
STATUS_LEVELS: () => STATUS_LEVELS,
|
|
83
105
|
STEP_TYPES: () => STEP_TYPES,
|
|
84
106
|
SURVEY_QUESTION_TYPES: () => SURVEY_QUESTION_TYPES,
|
|
85
107
|
SdkEventSchema: () => SdkEventSchema,
|
|
@@ -97,22 +119,27 @@ __export(index_exports, {
|
|
|
97
119
|
WS_MAX_MESSAGES_PER_SOCKET: () => WS_MAX_MESSAGES_PER_SOCKET,
|
|
98
120
|
WS_MAX_MESSAGE_BYTES: () => WS_MAX_MESSAGE_BYTES,
|
|
99
121
|
clamp: () => clamp,
|
|
122
|
+
cleanLabel: () => cleanLabel,
|
|
100
123
|
compare: () => compare,
|
|
101
124
|
compareVersions: () => compareVersions,
|
|
102
125
|
defaultGuideConfig: () => defaultGuideConfig,
|
|
103
126
|
defaultStep: () => defaultStep,
|
|
127
|
+
describeCaptureStep: () => describeCaptureStep,
|
|
104
128
|
describeRule: () => describeRule,
|
|
105
129
|
emptyRuleGroup: () => emptyRuleGroup,
|
|
106
130
|
evaluateRule: () => evaluateRule,
|
|
107
131
|
evaluateRules: () => evaluateRules,
|
|
108
132
|
fingerprintError: () => fingerprintError,
|
|
133
|
+
firstNameFromTraits: () => firstNameFromTraits,
|
|
109
134
|
fnv1a: () => fnv1a,
|
|
135
|
+
foldPathIds: () => foldPathIds,
|
|
110
136
|
getPath: () => getPath,
|
|
111
137
|
guidePlatforms: () => guidePlatforms,
|
|
112
138
|
guidelyIdFromSelector: () => guidelyIdFromSelector,
|
|
113
139
|
isAllowedEmbedSrc: () => isAllowedEmbedSrc,
|
|
114
140
|
isArticleListed: () => isArticleListed,
|
|
115
141
|
isChecklistComplete: () => isChecklistComplete,
|
|
142
|
+
isFileLink: () => isFileLink,
|
|
116
143
|
isMediaContentType: () => isMediaContentType,
|
|
117
144
|
isPlainObject: () => isPlainObject,
|
|
118
145
|
isQuestionVisible: () => isQuestionVisible,
|
|
@@ -121,9 +148,13 @@ __export(index_exports, {
|
|
|
121
148
|
isVideoContentType: () => isVideoContentType,
|
|
122
149
|
matchUrlPattern: () => matchUrlPattern,
|
|
123
150
|
matchesAudiences: () => matchesAudiences,
|
|
151
|
+
mediaKind: () => mediaKind,
|
|
124
152
|
mediaMaxBytes: () => mediaMaxBytes,
|
|
125
153
|
normalizeErrorMessage: () => normalizeErrorMessage,
|
|
126
154
|
normalizeFrameFile: () => normalizeFrameFile,
|
|
155
|
+
pageLabel: () => pageLabel,
|
|
156
|
+
pageName: () => pageName,
|
|
157
|
+
pageTerms: () => pageTerms,
|
|
127
158
|
parseStack: () => parseStack,
|
|
128
159
|
randomId: () => randomId,
|
|
129
160
|
resolveCaptureSettings: () => resolveCaptureSettings,
|
|
@@ -955,6 +986,14 @@ var PublishedGuideSchema = import_zod4.z.object({
|
|
|
955
986
|
|
|
956
987
|
// src/messenger.ts
|
|
957
988
|
var import_zod5 = require("zod");
|
|
989
|
+
var REPLY_TIMES = ["minutes", "hour", "hours", "day"];
|
|
990
|
+
var STATUS_LEVELS = ["operational", "degraded", "outage", "maintenance"];
|
|
991
|
+
var MessengerPageRequestSchema = import_zod5.z.object({
|
|
992
|
+
anonymousId: import_zod5.z.string().min(1).max(128),
|
|
993
|
+
userId: import_zod5.z.string().max(256).optional().nullable(),
|
|
994
|
+
/** Pathname only: query strings and fragments are never sent. */
|
|
995
|
+
path: import_zod5.z.string().min(1).max(1e3)
|
|
996
|
+
});
|
|
958
997
|
var MESSAGE_AUTHORS = ["user", "scout", "agent", "system"];
|
|
959
998
|
var MAX_MESSAGE_LENGTH = 4e3;
|
|
960
999
|
var messageText = import_zod5.z.string().trim().min(1).max(MAX_MESSAGE_LENGTH);
|
|
@@ -967,7 +1006,11 @@ var StartConversationSchema = import_zod5.z.object({
|
|
|
967
1006
|
var ConversationLookupSchema = import_zod5.z.object({
|
|
968
1007
|
tokens: import_zod5.z.array(import_zod5.z.string().min(16).max(128)).max(50)
|
|
969
1008
|
});
|
|
970
|
-
var PostMessageSchema = import_zod5.z.object({
|
|
1009
|
+
var PostMessageSchema = import_zod5.z.object({
|
|
1010
|
+
message: messageText,
|
|
1011
|
+
/** The page the user is on now (omitted when URL collection is off and by older SDKs), so Scout answers for that page. */
|
|
1012
|
+
pageUrl: import_zod5.z.string().max(2e3).optional()
|
|
1013
|
+
});
|
|
971
1014
|
var ConversationRatingSchema = import_zod5.z.object({
|
|
972
1015
|
rating: import_zod5.z.number().int().min(1).max(5),
|
|
973
1016
|
comment: import_zod5.z.string().max(1e3).optional()
|
|
@@ -1210,16 +1253,33 @@ function templateConfig(id) {
|
|
|
1210
1253
|
// src/media.ts
|
|
1211
1254
|
var MEDIA_IMAGE_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
1212
1255
|
var MEDIA_VIDEO_TYPES = ["video/mp4", "video/webm"];
|
|
1256
|
+
var MEDIA_FILE_TYPES = ["application/pdf"];
|
|
1213
1257
|
var MEDIA_IMAGE_MAX_BYTES = 10 * 1024 * 1024;
|
|
1214
1258
|
var MEDIA_VIDEO_MAX_BYTES = 200 * 1024 * 1024;
|
|
1259
|
+
var MEDIA_FILE_MAX_BYTES = 50 * 1024 * 1024;
|
|
1260
|
+
var MEDIA_MAX_BYTES = Math.max(MEDIA_IMAGE_MAX_BYTES, MEDIA_VIDEO_MAX_BYTES, MEDIA_FILE_MAX_BYTES);
|
|
1215
1261
|
function isMediaContentType(type) {
|
|
1216
|
-
return
|
|
1262
|
+
return mediaKind(type) !== null;
|
|
1217
1263
|
}
|
|
1218
1264
|
function isVideoContentType(type) {
|
|
1219
1265
|
return MEDIA_VIDEO_TYPES.includes(type);
|
|
1220
1266
|
}
|
|
1267
|
+
function mediaKind(type) {
|
|
1268
|
+
if (MEDIA_IMAGE_TYPES.includes(type)) return "image";
|
|
1269
|
+
if (MEDIA_VIDEO_TYPES.includes(type)) return "video";
|
|
1270
|
+
if (MEDIA_FILE_TYPES.includes(type)) return "file";
|
|
1271
|
+
return null;
|
|
1272
|
+
}
|
|
1221
1273
|
function mediaMaxBytes(type) {
|
|
1222
|
-
|
|
1274
|
+
const kind = mediaKind(type);
|
|
1275
|
+
return kind === "video" ? MEDIA_VIDEO_MAX_BYTES : kind === "file" ? MEDIA_FILE_MAX_BYTES : MEDIA_IMAGE_MAX_BYTES;
|
|
1276
|
+
}
|
|
1277
|
+
var FILE_LINK_CLASS = "gd-file";
|
|
1278
|
+
var PDF_BLOCK_CLASS = "gd-pdf";
|
|
1279
|
+
var PDF_PAGES_CLASS = "gd-pdf-pages";
|
|
1280
|
+
var PDF_MAX_PAGES = 40;
|
|
1281
|
+
function isFileLink(className, href) {
|
|
1282
|
+
return !!className && className.split(/\s+/).includes(FILE_LINK_CLASS) && isSafeMediaUrl(href);
|
|
1223
1283
|
}
|
|
1224
1284
|
var YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
|
|
1225
1285
|
var VIMEO_ID = /^\d{1,12}$/;
|
|
@@ -1375,18 +1435,172 @@ function visibleArticleIds(collections, articles, member) {
|
|
|
1375
1435
|
return new Set(resourceCenterSections(collections, articles, member).flatMap((s) => s.articles.map((a) => a.id)));
|
|
1376
1436
|
}
|
|
1377
1437
|
|
|
1438
|
+
// src/howto.ts
|
|
1439
|
+
var import_zod7 = require("zod");
|
|
1440
|
+
|
|
1441
|
+
// src/howto-limits.ts
|
|
1442
|
+
var CAPTURE_PARAM = "guidely_capture";
|
|
1443
|
+
var CAPTURE_SCREENSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
1444
|
+
|
|
1445
|
+
// src/howto.ts
|
|
1446
|
+
var HOWTO_STEP_KINDS = ["action", "text", "heading", "tip", "alert"];
|
|
1447
|
+
var HOWTO_ACTIONS = ["click", "type", "select", "navigate"];
|
|
1448
|
+
var NormalizedRectSchema = import_zod7.z.object({
|
|
1449
|
+
x: import_zod7.z.number().min(0).max(1),
|
|
1450
|
+
y: import_zod7.z.number().min(0).max(1),
|
|
1451
|
+
width: import_zod7.z.number().min(0).max(1),
|
|
1452
|
+
height: import_zod7.z.number().min(0).max(1)
|
|
1453
|
+
});
|
|
1454
|
+
var CapturedElementSchema = import_zod7.z.object({
|
|
1455
|
+
/** Visible name: aria-label, associated label, text, placeholder, alt or title. */
|
|
1456
|
+
label: import_zod7.z.string().max(200).default(""),
|
|
1457
|
+
/** button, link, tab, menuitem, checkbox, radio, field, dropdown, option, element… */
|
|
1458
|
+
role: import_zod7.z.string().max(40).default("element"),
|
|
1459
|
+
tag: import_zod7.z.string().max(40).default("")
|
|
1460
|
+
});
|
|
1461
|
+
var CaptureStepSchema = import_zod7.z.object({
|
|
1462
|
+
/** Random id from the SDK; a retried upload with the same id is stored once. */
|
|
1463
|
+
clientId: import_zod7.z.string().min(1).max(64),
|
|
1464
|
+
action: import_zod7.z.enum(HOWTO_ACTIONS),
|
|
1465
|
+
url: import_zod7.z.string().max(2e3),
|
|
1466
|
+
pageTitle: import_zod7.z.string().max(300).default(""),
|
|
1467
|
+
element: CapturedElementSchema.optional(),
|
|
1468
|
+
/** Typed text or chosen option; absent when it was sensitive (`valueRedacted`). */
|
|
1469
|
+
value: import_zod7.z.string().max(200).optional(),
|
|
1470
|
+
valueRedacted: import_zod7.z.boolean().default(false),
|
|
1471
|
+
/** Selectors for the element, so the step can later become an interactive tour step. */
|
|
1472
|
+
selectors: import_zod7.z.array(SelectorStrategySchema).max(10).default([]),
|
|
1473
|
+
/** Where the element sits in the screenshot. */
|
|
1474
|
+
highlight: NormalizedRectSchema.optional(),
|
|
1475
|
+
/** Number of regions the SDK blurred in the screenshot before upload. */
|
|
1476
|
+
redactions: import_zod7.z.number().int().min(0).max(1e3).default(0),
|
|
1477
|
+
occurredAt: import_zod7.z.string().datetime().optional()
|
|
1478
|
+
});
|
|
1479
|
+
function quoted(s) {
|
|
1480
|
+
const t = (s ?? "").replace(/\s+/g, " ").trim();
|
|
1481
|
+
return t.length > 60 ? `\u201C${t.slice(0, 57)}\u2026\u201D` : `\u201C${t}\u201D`;
|
|
1482
|
+
}
|
|
1483
|
+
function cleanLabel(label) {
|
|
1484
|
+
const raw = (label ?? "").replace(/\s+/g, " ").trim();
|
|
1485
|
+
const cleaned = raw.replace(/^[^\p{L}\p{N}“"'(]+/u, "").replace(/[\s:*]+$/u, "").replace(/[^\p{L}\p{N})”"'?!.%]+$/u, "").trim();
|
|
1486
|
+
return cleaned || raw;
|
|
1487
|
+
}
|
|
1488
|
+
var SEPARATORS = /\s+[·|•–—-]\s+|\s*[|·•]\s*/;
|
|
1489
|
+
var ID_SEGMENT = /^(?:\d+|[0-9a-f]{8,}(?:-[0-9a-f]{4,})*|[A-Za-z0-9_-]{20,})$/i;
|
|
1490
|
+
function humanize(segment) {
|
|
1491
|
+
const words = decodeURIComponent(segment).replace(/[-_+]+/g, " ").trim();
|
|
1492
|
+
return words ? words.charAt(0).toUpperCase() + words.slice(1) : "";
|
|
1493
|
+
}
|
|
1494
|
+
function pageName(url, pageTitle) {
|
|
1495
|
+
const title = (pageTitle ?? "").replace(/\s+/g, " ").trim();
|
|
1496
|
+
const parts = title.split(SEPARATORS).map((p) => p.trim()).filter(Boolean);
|
|
1497
|
+
if (parts.length > 1) return parts[0];
|
|
1498
|
+
let segments = [];
|
|
1499
|
+
try {
|
|
1500
|
+
segments = new URL(url).pathname.split("/").filter((p) => p && !ID_SEGMENT.test(p));
|
|
1501
|
+
} catch {
|
|
1502
|
+
segments = [];
|
|
1503
|
+
}
|
|
1504
|
+
const fromPath = segments.slice(-2).map(humanize).filter(Boolean).join(" \u203A ");
|
|
1505
|
+
if (!fromPath) return title || hostAndPath(url);
|
|
1506
|
+
if (!title) return fromPath;
|
|
1507
|
+
const lower = title.toLowerCase();
|
|
1508
|
+
const mentionsPath = segments.some((seg) => humanize(seg).toLowerCase().split(" ").some((w) => w.length > 2 && lower.includes(w)));
|
|
1509
|
+
return mentionsPath ? title : fromPath;
|
|
1510
|
+
}
|
|
1511
|
+
var ROLE_NOUN = { tab: "tab", menuitem: "menu item", field: "field", dropdown: "dropdown", option: "option" };
|
|
1512
|
+
function describeCaptureStep(step) {
|
|
1513
|
+
const label = cleanLabel(step.element?.label);
|
|
1514
|
+
const role = step.element?.role ?? "";
|
|
1515
|
+
switch (step.action) {
|
|
1516
|
+
case "navigate": {
|
|
1517
|
+
const where = pageName(step.url, step.pageTitle);
|
|
1518
|
+
return where ? `Go to ${quoted(where)}` : "Open the page";
|
|
1519
|
+
}
|
|
1520
|
+
case "type": {
|
|
1521
|
+
const field = label ? quoted(label) : "the field";
|
|
1522
|
+
if (step.valueRedacted || !step.value) return `Fill in ${field}`;
|
|
1523
|
+
return `Type ${quoted(step.value)} into ${field}`;
|
|
1524
|
+
}
|
|
1525
|
+
case "select":
|
|
1526
|
+
if (step.value && label) return `Select ${quoted(step.value)} from ${quoted(label)}`;
|
|
1527
|
+
if (step.value) return `Select ${quoted(step.value)}`;
|
|
1528
|
+
return label ? `Choose an option in ${quoted(label)}` : "Choose an option";
|
|
1529
|
+
case "click":
|
|
1530
|
+
default:
|
|
1531
|
+
if (role === "checkbox") return label ? `Check ${quoted(label)}` : "Check the box";
|
|
1532
|
+
if (role === "switch") return label ? `Turn ${quoted(label)} on or off` : "Flip the switch";
|
|
1533
|
+
if (role === "radio") return label ? `Select ${quoted(label)}` : "Select the option";
|
|
1534
|
+
if (role === "menuitem") return label ? `Choose ${quoted(label)} from the menu` : "Choose the menu item";
|
|
1535
|
+
if (role === "tab") return label ? `Open the ${quoted(label)} tab` : "Open the tab";
|
|
1536
|
+
if (label) return `Click ${quoted(label)}`;
|
|
1537
|
+
return ROLE_NOUN[role] ? `Click the ${ROLE_NOUN[role]}` : role === "link" ? "Click the link" : "Click the button";
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
function hostAndPath(url) {
|
|
1541
|
+
try {
|
|
1542
|
+
const u = new URL(url);
|
|
1543
|
+
return `${u.host}${u.pathname === "/" ? "" : u.pathname}`;
|
|
1544
|
+
} catch {
|
|
1545
|
+
return url.slice(0, 80);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
var NormalizedPointSchema = import_zod7.z.object({ x: import_zod7.z.number().min(0).max(1), y: import_zod7.z.number().min(0).max(1) });
|
|
1549
|
+
var ANNOTATION_COLORS = ["brand", "red", "amber", "green", "black", "white"];
|
|
1550
|
+
var HowToAnnotationSchema = import_zod7.z.discriminatedUnion("type", [
|
|
1551
|
+
import_zod7.z.object({ id: import_zod7.z.string().min(1).max(32), type: import_zod7.z.literal("arrow"), from: NormalizedPointSchema, to: NormalizedPointSchema, color: import_zod7.z.enum(ANNOTATION_COLORS).default("brand") }),
|
|
1552
|
+
import_zod7.z.object({ id: import_zod7.z.string().min(1).max(32), type: import_zod7.z.literal("text"), at: NormalizedPointSchema, text: import_zod7.z.string().trim().min(1).max(120), color: import_zod7.z.enum(ANNOTATION_COLORS).default("brand") }),
|
|
1553
|
+
import_zod7.z.object({ id: import_zod7.z.string().min(1).max(32), type: import_zod7.z.literal("box"), rect: NormalizedRectSchema, color: import_zod7.z.enum(ANNOTATION_COLORS).default("brand") })
|
|
1554
|
+
]);
|
|
1555
|
+
var MAX_ANNOTATIONS = 30;
|
|
1556
|
+
|
|
1557
|
+
// src/page.ts
|
|
1558
|
+
var PATH_ID_PATTERN = "/([0-9]+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{12,})(?=/|$)";
|
|
1559
|
+
function foldPathIds(path) {
|
|
1560
|
+
return path.replace(new RegExp(PATH_ID_PATTERN, "gi"), "/:id");
|
|
1561
|
+
}
|
|
1562
|
+
var GENERIC_SEGMENTS = /* @__PURE__ */ new Set(["", ":id", "app", "apps", "dashboard", "home", "index", "main", "new", "edit", "view", "show", "details", "detail", "overview", "list", "all", "page", "pages", "en", "v1", "v2"]);
|
|
1563
|
+
function segmentsOf(path) {
|
|
1564
|
+
const clean = foldPathIds((path.split(/[?#]/)[0] || "/").toLowerCase());
|
|
1565
|
+
return clean.split("/").map((s) => s.replace(/\.(html?|php|aspx?)$/, "")).filter((s) => !GENERIC_SEGMENTS.has(s) && /[a-z]/.test(s) && s.length <= 40);
|
|
1566
|
+
}
|
|
1567
|
+
function pageTerms(path) {
|
|
1568
|
+
const words = segmentsOf(path).flatMap((s) => s.split(/[-_.+\s]+/).filter((w) => w.length > 1 && /[a-z]/.test(w)));
|
|
1569
|
+
return [...new Set(words)].slice(0, 8);
|
|
1570
|
+
}
|
|
1571
|
+
function pageLabel(path) {
|
|
1572
|
+
const last = segmentsOf(path).at(-1);
|
|
1573
|
+
if (!last) return null;
|
|
1574
|
+
const words = last.split(/[-_.+\s]+/).filter(Boolean);
|
|
1575
|
+
if (!words.length) return null;
|
|
1576
|
+
const label = words.join(" ");
|
|
1577
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
1578
|
+
}
|
|
1579
|
+
function firstNameFromTraits(traits) {
|
|
1580
|
+
if (!traits) return null;
|
|
1581
|
+
const pick = (v) => typeof v === "string" ? v.trim() : "";
|
|
1582
|
+
const first = pick(traits.firstName) || pick(traits.first_name) || pick(traits.firstname) || pick(traits.name).split(/\s+/)[0] || "";
|
|
1583
|
+
if (!first || first.length > 40 || first.includes("@") || !/\p{L}/u.test(first)) return null;
|
|
1584
|
+
return first;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1378
1587
|
// src/index.ts
|
|
1379
1588
|
var SDK_API_VERSION = "v1";
|
|
1380
|
-
var SHARED_VERSION = "0.
|
|
1589
|
+
var SHARED_VERSION = "0.6.1";
|
|
1381
1590
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1382
1591
|
0 && (module.exports = {
|
|
1383
1592
|
ADVANCE_ON,
|
|
1593
|
+
ANNOTATION_COLORS,
|
|
1384
1594
|
AUTOCAPTURE_EVENTS,
|
|
1385
1595
|
AppearanceSchema,
|
|
1386
1596
|
AuthoringPickSchema,
|
|
1387
1597
|
AutocaptureSettingsSchema,
|
|
1388
1598
|
BUTTON_ACTIONS,
|
|
1389
1599
|
ButtonSchema,
|
|
1600
|
+
CAPTURE_PARAM,
|
|
1601
|
+
CAPTURE_SCREENSHOT_MAX_BYTES,
|
|
1602
|
+
CaptureStepSchema,
|
|
1603
|
+
CapturedElementSchema,
|
|
1390
1604
|
ChecklistConfigSchema,
|
|
1391
1605
|
ChecklistProgressRequestSchema,
|
|
1392
1606
|
ChecklistTaskSchema,
|
|
@@ -1398,6 +1612,7 @@ var SHARED_VERSION = "0.5.0";
|
|
|
1398
1612
|
EVENT_NAMES,
|
|
1399
1613
|
ErrorTrackingSettingsSchema,
|
|
1400
1614
|
EventBatchSchema,
|
|
1615
|
+
FILE_LINK_CLASS,
|
|
1401
1616
|
FrequencySchema,
|
|
1402
1617
|
GUIDELY_ID_ATTRIBUTE,
|
|
1403
1618
|
GUIDE_KINDS,
|
|
@@ -1407,17 +1622,31 @@ var SHARED_VERSION = "0.5.0";
|
|
|
1407
1622
|
GuideConfigSchema,
|
|
1408
1623
|
GuideStateUpdateSchema,
|
|
1409
1624
|
HEATMAP_VIEWPORTS,
|
|
1625
|
+
HOWTO_ACTIONS,
|
|
1626
|
+
HOWTO_STEP_KINDS,
|
|
1627
|
+
HowToAnnotationSchema,
|
|
1410
1628
|
IdentifyRequestSchema,
|
|
1629
|
+
MAX_ANNOTATIONS,
|
|
1411
1630
|
MAX_COLLECTION_DEPTH,
|
|
1412
1631
|
MAX_MESSAGE_LENGTH,
|
|
1413
1632
|
MAX_PROPERTY_BYTES,
|
|
1414
1633
|
MAX_STACK_FRAMES,
|
|
1634
|
+
MEDIA_FILE_MAX_BYTES,
|
|
1635
|
+
MEDIA_FILE_TYPES,
|
|
1415
1636
|
MEDIA_IMAGE_MAX_BYTES,
|
|
1416
1637
|
MEDIA_IMAGE_TYPES,
|
|
1638
|
+
MEDIA_MAX_BYTES,
|
|
1417
1639
|
MEDIA_VIDEO_MAX_BYTES,
|
|
1418
1640
|
MEDIA_VIDEO_TYPES,
|
|
1419
1641
|
MESSAGE_AUTHORS,
|
|
1642
|
+
MessengerPageRequestSchema,
|
|
1420
1643
|
NETWORK_PLUGIN,
|
|
1644
|
+
NormalizedPointSchema,
|
|
1645
|
+
NormalizedRectSchema,
|
|
1646
|
+
PATH_ID_PATTERN,
|
|
1647
|
+
PDF_BLOCK_CLASS,
|
|
1648
|
+
PDF_MAX_PAGES,
|
|
1649
|
+
PDF_PAGES_CLASS,
|
|
1421
1650
|
PLACEMENTS,
|
|
1422
1651
|
PLATFORMS,
|
|
1423
1652
|
PostMessageSchema,
|
|
@@ -1425,6 +1654,7 @@ var SHARED_VERSION = "0.5.0";
|
|
|
1425
1654
|
PublishedGuideSchema,
|
|
1426
1655
|
REPLAY_MAX_COMPRESSED_BYTES,
|
|
1427
1656
|
REPLAY_MAX_RAW_BYTES,
|
|
1657
|
+
REPLY_TIMES,
|
|
1428
1658
|
RULE_FIELDS,
|
|
1429
1659
|
RULE_OPERATORS,
|
|
1430
1660
|
ReplayChunkSchema,
|
|
@@ -1440,6 +1670,7 @@ var SHARED_VERSION = "0.5.0";
|
|
|
1440
1670
|
SHARED_VERSION,
|
|
1441
1671
|
SOURCEMAP_MAX_FILES_PER_UPLOAD,
|
|
1442
1672
|
SOURCEMAP_MAX_FILE_BYTES,
|
|
1673
|
+
STATUS_LEVELS,
|
|
1443
1674
|
STEP_TYPES,
|
|
1444
1675
|
SURVEY_QUESTION_TYPES,
|
|
1445
1676
|
SdkEventSchema,
|
|
@@ -1457,22 +1688,27 @@ var SHARED_VERSION = "0.5.0";
|
|
|
1457
1688
|
WS_MAX_MESSAGES_PER_SOCKET,
|
|
1458
1689
|
WS_MAX_MESSAGE_BYTES,
|
|
1459
1690
|
clamp,
|
|
1691
|
+
cleanLabel,
|
|
1460
1692
|
compare,
|
|
1461
1693
|
compareVersions,
|
|
1462
1694
|
defaultGuideConfig,
|
|
1463
1695
|
defaultStep,
|
|
1696
|
+
describeCaptureStep,
|
|
1464
1697
|
describeRule,
|
|
1465
1698
|
emptyRuleGroup,
|
|
1466
1699
|
evaluateRule,
|
|
1467
1700
|
evaluateRules,
|
|
1468
1701
|
fingerprintError,
|
|
1702
|
+
firstNameFromTraits,
|
|
1469
1703
|
fnv1a,
|
|
1704
|
+
foldPathIds,
|
|
1470
1705
|
getPath,
|
|
1471
1706
|
guidePlatforms,
|
|
1472
1707
|
guidelyIdFromSelector,
|
|
1473
1708
|
isAllowedEmbedSrc,
|
|
1474
1709
|
isArticleListed,
|
|
1475
1710
|
isChecklistComplete,
|
|
1711
|
+
isFileLink,
|
|
1476
1712
|
isMediaContentType,
|
|
1477
1713
|
isPlainObject,
|
|
1478
1714
|
isQuestionVisible,
|
|
@@ -1481,9 +1717,13 @@ var SHARED_VERSION = "0.5.0";
|
|
|
1481
1717
|
isVideoContentType,
|
|
1482
1718
|
matchUrlPattern,
|
|
1483
1719
|
matchesAudiences,
|
|
1720
|
+
mediaKind,
|
|
1484
1721
|
mediaMaxBytes,
|
|
1485
1722
|
normalizeErrorMessage,
|
|
1486
1723
|
normalizeFrameFile,
|
|
1724
|
+
pageLabel,
|
|
1725
|
+
pageName,
|
|
1726
|
+
pageTerms,
|
|
1487
1727
|
parseStack,
|
|
1488
1728
|
randomId,
|
|
1489
1729
|
resolveCaptureSettings,
|