@guidelytech/shared 0.8.0 → 0.9.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-UW6NRYRY.js +809 -0
- package/dist/chunk-UW6NRYRY.js.map +1 -0
- package/dist/index.cjs +189 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -6
- package/dist/index.d.ts +97 -6
- package/dist/index.js +121 -53
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +110 -8
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +106 -5
- package/dist/runtime.d.ts +106 -5
- package/dist/runtime.js +47 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ADVANCE_ON: () => ADVANCE_ON,
|
|
24
24
|
ANNOTATION_COLORS: () => ANNOTATION_COLORS,
|
|
25
|
+
ARTICLE_VISIBILITIES: () => ARTICLE_VISIBILITIES,
|
|
25
26
|
AUTOCAPTURE_EVENTS: () => AUTOCAPTURE_EVENTS,
|
|
26
27
|
AppearanceSchema: () => AppearanceSchema,
|
|
27
28
|
AuthoringPickSchema: () => AuthoringPickSchema,
|
|
@@ -30,6 +31,9 @@ __export(index_exports, {
|
|
|
30
31
|
ButtonSchema: () => ButtonSchema,
|
|
31
32
|
CAPTURE_PARAM: () => CAPTURE_PARAM,
|
|
32
33
|
CAPTURE_SCREENSHOT_MAX_BYTES: () => CAPTURE_SCREENSHOT_MAX_BYTES,
|
|
34
|
+
COMPLAINT_EVENTS: () => COMPLAINT_EVENTS,
|
|
35
|
+
COMPLAINT_FIELD_TYPES: () => COMPLAINT_FIELD_TYPES,
|
|
36
|
+
COMPLAINT_STATUSES: () => COMPLAINT_STATUSES,
|
|
33
37
|
CaptureStepSchema: () => CaptureStepSchema,
|
|
34
38
|
CapturedElementSchema: () => CapturedElementSchema,
|
|
35
39
|
ChecklistConfigSchema: () => ChecklistConfigSchema,
|
|
@@ -44,12 +48,14 @@ __export(index_exports, {
|
|
|
44
48
|
ErrorTrackingSettingsSchema: () => ErrorTrackingSettingsSchema,
|
|
45
49
|
EventBatchSchema: () => EventBatchSchema,
|
|
46
50
|
FILE_LINK_CLASS: () => FILE_LINK_CLASS,
|
|
51
|
+
FileComplaintSchema: () => FileComplaintSchema,
|
|
47
52
|
FrequencySchema: () => FrequencySchema,
|
|
48
53
|
GUIDELY_ID_ATTRIBUTE: () => GUIDELY_ID_ATTRIBUTE,
|
|
49
54
|
GUIDE_KINDS: () => GUIDE_KINDS,
|
|
50
55
|
GUIDE_LIFECYCLE_EVENTS: () => GUIDE_LIFECYCLE_EVENTS,
|
|
51
56
|
GUIDE_STATUSES: () => GUIDE_STATUSES,
|
|
52
57
|
GUIDE_TEMPLATES: () => GUIDE_TEMPLATES,
|
|
58
|
+
GUIDE_VISIBILITIES: () => GUIDE_VISIBILITIES,
|
|
53
59
|
GuideConfigSchema: () => GuideConfigSchema,
|
|
54
60
|
GuideStateUpdateSchema: () => GuideStateUpdateSchema,
|
|
55
61
|
HEATMAP_VIEWPORTS: () => HEATMAP_VIEWPORTS,
|
|
@@ -57,8 +63,14 @@ __export(index_exports, {
|
|
|
57
63
|
HOWTO_STEP_KINDS: () => HOWTO_STEP_KINDS,
|
|
58
64
|
HowToAnnotationSchema: () => HowToAnnotationSchema,
|
|
59
65
|
IdentifyRequestSchema: () => IdentifyRequestSchema,
|
|
66
|
+
LOGGED_IN_AUDIENCE: () => LOGGED_IN_AUDIENCE,
|
|
60
67
|
MAX_ANNOTATIONS: () => MAX_ANNOTATIONS,
|
|
61
68
|
MAX_COLLECTION_DEPTH: () => MAX_COLLECTION_DEPTH,
|
|
69
|
+
MAX_COMPLAINT_ANSWER_LENGTH: () => MAX_COMPLAINT_ANSWER_LENGTH,
|
|
70
|
+
MAX_COMPLAINT_ATTACHMENT_BYTES: () => MAX_COMPLAINT_ATTACHMENT_BYTES,
|
|
71
|
+
MAX_COMPLAINT_CHOICES: () => MAX_COMPLAINT_CHOICES,
|
|
72
|
+
MAX_COMPLAINT_FIELDS: () => MAX_COMPLAINT_FIELDS,
|
|
73
|
+
MAX_COMPLAINT_LENGTH: () => MAX_COMPLAINT_LENGTH,
|
|
62
74
|
MAX_MESSAGE_LENGTH: () => MAX_MESSAGE_LENGTH,
|
|
63
75
|
MAX_PROPERTY_BYTES: () => MAX_PROPERTY_BYTES,
|
|
64
76
|
MAX_STACK_FRAMES: () => MAX_STACK_FRAMES,
|
|
@@ -99,6 +111,8 @@ __export(index_exports, {
|
|
|
99
111
|
SENSITIVE_PROPERTY_PATTERN: () => SENSITIVE_PROPERTY_PATTERN,
|
|
100
112
|
SERVER_ASSISTED_FIELDS: () => SERVER_ASSISTED_FIELDS,
|
|
101
113
|
SHARED_VERSION: () => SHARED_VERSION,
|
|
114
|
+
SHOW_ME_CLASS: () => SHOW_ME_CLASS,
|
|
115
|
+
SHOW_ME_HREF_PREFIX: () => SHOW_ME_HREF_PREFIX,
|
|
102
116
|
SOURCEMAP_MAX_FILES_PER_UPLOAD: () => SOURCEMAP_MAX_FILES_PER_UPLOAD,
|
|
103
117
|
SOURCEMAP_MAX_FILE_BYTES: () => SOURCEMAP_MAX_FILE_BYTES,
|
|
104
118
|
STATUS_LEVELS: () => STATUS_LEVELS,
|
|
@@ -122,6 +136,7 @@ __export(index_exports, {
|
|
|
122
136
|
cleanLabel: () => cleanLabel,
|
|
123
137
|
compare: () => compare,
|
|
124
138
|
compareVersions: () => compareVersions,
|
|
139
|
+
complaintReference: () => complaintReference,
|
|
125
140
|
defaultGuideConfig: () => defaultGuideConfig,
|
|
126
141
|
defaultStep: () => defaultStep,
|
|
127
142
|
describeCaptureStep: () => describeCaptureStep,
|
|
@@ -136,6 +151,7 @@ __export(index_exports, {
|
|
|
136
151
|
getPath: () => getPath,
|
|
137
152
|
guidePlatforms: () => guidePlatforms,
|
|
138
153
|
guidelyIdFromSelector: () => guidelyIdFromSelector,
|
|
154
|
+
hasVideoMedia: () => hasVideoMedia,
|
|
139
155
|
isAllowedEmbedSrc: () => isAllowedEmbedSrc,
|
|
140
156
|
isArticleListed: () => isArticleListed,
|
|
141
157
|
isChecklistComplete: () => isChecklistComplete,
|
|
@@ -148,6 +164,7 @@ __export(index_exports, {
|
|
|
148
164
|
isVideoContentType: () => isVideoContentType,
|
|
149
165
|
matchUrlPattern: () => matchUrlPattern,
|
|
150
166
|
matchesAudiences: () => matchesAudiences,
|
|
167
|
+
matchesHelpQuery: () => matchesHelpQuery,
|
|
151
168
|
mediaKind: () => mediaKind,
|
|
152
169
|
mediaMaxBytes: () => mediaMaxBytes,
|
|
153
170
|
normalizeErrorMessage: () => normalizeErrorMessage,
|
|
@@ -163,6 +180,10 @@ __export(index_exports, {
|
|
|
163
180
|
safeRegExp: () => safeRegExp,
|
|
164
181
|
sanitizeProperties: () => sanitizeProperties,
|
|
165
182
|
screenPath: () => screenPath,
|
|
183
|
+
servedArticleAudiences: () => servedArticleAudiences,
|
|
184
|
+
showMeHref: () => showMeHref,
|
|
185
|
+
showMeKeyFromHref: () => showMeKeyFromHref,
|
|
186
|
+
showMeKeys: () => showMeKeys,
|
|
166
187
|
slugify: () => slugify,
|
|
167
188
|
stripOrigin: () => stripOrigin,
|
|
168
189
|
supportsPlatform: () => supportsPlatform,
|
|
@@ -170,7 +191,9 @@ __export(index_exports, {
|
|
|
170
191
|
toEmbedUrl: () => toEmbedUrl,
|
|
171
192
|
validateGuideConfig: () => validateGuideConfig,
|
|
172
193
|
visibleArticleIds: () => visibleArticleIds,
|
|
173
|
-
visibleButtons: () => visibleButtons
|
|
194
|
+
visibleButtons: () => visibleButtons,
|
|
195
|
+
visitorAudiences: () => visitorAudiences,
|
|
196
|
+
withVisibility: () => withVisibility
|
|
174
197
|
});
|
|
175
198
|
module.exports = __toCommonJS(index_exports);
|
|
176
199
|
|
|
@@ -345,6 +368,7 @@ var RULE_FIELDS = [
|
|
|
345
368
|
"account.attribute",
|
|
346
369
|
"user.role",
|
|
347
370
|
"user.plan",
|
|
371
|
+
"user.identified",
|
|
348
372
|
"url.path",
|
|
349
373
|
"url.full",
|
|
350
374
|
"url.query",
|
|
@@ -389,6 +413,8 @@ function resolveField(rule, ctx) {
|
|
|
389
413
|
return ctx.userAttributes.role;
|
|
390
414
|
case "user.plan":
|
|
391
415
|
return ctx.userAttributes.plan ?? ctx.accountAttributes.plan;
|
|
416
|
+
case "user.identified":
|
|
417
|
+
return !!ctx.userId;
|
|
392
418
|
case "url.path":
|
|
393
419
|
return ctx.path;
|
|
394
420
|
case "url.full":
|
|
@@ -535,6 +561,11 @@ function evaluateRules(group, ctx) {
|
|
|
535
561
|
return group.negate ? !value : value;
|
|
536
562
|
}
|
|
537
563
|
var SERVER_ASSISTED_FIELDS = ["audience.member", "guide.completed", "guide.dismissed", "guide.seen", "checklist.completed"];
|
|
564
|
+
var GUIDE_VISIBILITIES = ["everyone", "identified", "anonymous"];
|
|
565
|
+
function withVisibility(targeting, visibility) {
|
|
566
|
+
if (!visibility || visibility === "everyone") return targeting;
|
|
567
|
+
return { id: "visibility", op: "and", rules: [{ id: "visibility-rule", field: "user.identified", op: visibility === "identified" ? "is_true" : "is_false" }, targeting] };
|
|
568
|
+
}
|
|
538
569
|
function describeRule(rule) {
|
|
539
570
|
const subject = rule.key ? `${rule.field}[${rule.key}]` : rule.field;
|
|
540
571
|
const v = Array.isArray(rule.value) ? rule.value.join(", ") : rule.value === void 0 ? "" : String(rule.value);
|
|
@@ -684,7 +715,7 @@ var ChecklistTaskSchema = import_zod2.z.object({
|
|
|
684
715
|
required: import_zod2.z.boolean().default(true)
|
|
685
716
|
});
|
|
686
717
|
var ChecklistConfigSchema = import_zod2.z.object({
|
|
687
|
-
tasks: import_zod2.z.array(ChecklistTaskSchema).min(1)
|
|
718
|
+
tasks: import_zod2.z.array(ChecklistTaskSchema).min(1),
|
|
688
719
|
ordered: import_zod2.z.boolean().default(false),
|
|
689
720
|
launcherLabel: import_zod2.z.string().max(60).default("Getting started"),
|
|
690
721
|
position: import_zod2.z.enum(["bottom-right", "bottom-left"]).default("bottom-right"),
|
|
@@ -718,6 +749,8 @@ var SurveyConfigSchema = import_zod2.z.object({
|
|
|
718
749
|
});
|
|
719
750
|
var GuideConfigSchema = import_zod2.z.object({
|
|
720
751
|
steps: import_zod2.z.array(StepSchema).max(50).default([]),
|
|
752
|
+
/** Everyone, only identified (logged-in) users, or only anonymous visitors; applied on top of `targeting`. */
|
|
753
|
+
visibility: import_zod2.z.enum(GUIDE_VISIBILITIES).default("everyone"),
|
|
721
754
|
targeting: RuleGroupSchema.default(() => emptyRuleGroup()),
|
|
722
755
|
trigger: TriggerSchema.default({}),
|
|
723
756
|
frequency: FrequencySchema.default({}),
|
|
@@ -1018,19 +1051,53 @@ var ConversationRatingSchema = import_zod5.z.object({
|
|
|
1018
1051
|
comment: import_zod5.z.string().max(1e3).optional()
|
|
1019
1052
|
});
|
|
1020
1053
|
|
|
1021
|
-
// src/
|
|
1054
|
+
// src/complaints.ts
|
|
1022
1055
|
var import_zod6 = require("zod");
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
var
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1056
|
+
|
|
1057
|
+
// src/complaints-limits.ts
|
|
1058
|
+
var COMPLAINT_STATUSES = ["open", "in_review", "resolved"];
|
|
1059
|
+
var COMPLAINT_EVENTS = ["complaint.filed", "complaint.status_changed", "complaint.replied", "complaint.resolved"];
|
|
1060
|
+
var COMPLAINT_FIELD_TYPES = ["text", "choice"];
|
|
1061
|
+
var MAX_COMPLAINT_FIELDS = 8;
|
|
1062
|
+
var MAX_COMPLAINT_CHOICES = 12;
|
|
1063
|
+
var MAX_COMPLAINT_LENGTH = 4e3;
|
|
1064
|
+
var MAX_COMPLAINT_ANSWER_LENGTH = 500;
|
|
1065
|
+
var MAX_COMPLAINT_ATTACHMENT_BYTES = 2 * 1024 * 1024;
|
|
1066
|
+
var complaintReference = (number) => `CMP-${number}`;
|
|
1067
|
+
|
|
1068
|
+
// src/complaints.ts
|
|
1069
|
+
var FileComplaintSchema = import_zod6.z.object({
|
|
1070
|
+
anonymousId: import_zod6.z.string().min(1).max(128),
|
|
1071
|
+
userId: import_zod6.z.string().max(256).optional().nullable(),
|
|
1072
|
+
categoryId: import_zod6.z.string().min(1).max(64),
|
|
1073
|
+
description: import_zod6.z.string().trim().min(1).max(MAX_COMPLAINT_LENGTH),
|
|
1074
|
+
/** Answers to the category's extra questions, by field id. */
|
|
1075
|
+
answers: import_zod6.z.record(import_zod6.z.string().max(64), import_zod6.z.string().trim().max(MAX_COMPLAINT_ANSWER_LENGTH)).default({}),
|
|
1076
|
+
/** Required from visitors the app hasn't identified. */
|
|
1077
|
+
email: import_zod6.z.string().trim().toLowerCase().email().max(254).optional().nullable(),
|
|
1078
|
+
pageUrl: import_zod6.z.string().max(2e3).optional(),
|
|
1079
|
+
/** File it in this conversation (send its token in `X-Guidely-Conversation`); otherwise a new one is started. */
|
|
1080
|
+
conversationId: import_zod6.z.string().min(1).max(64).optional().nullable(),
|
|
1081
|
+
/** One screenshot, base64-encoded (png, jpeg, webp or gif). */
|
|
1082
|
+
attachment: import_zod6.z.object({
|
|
1083
|
+
fileName: import_zod6.z.string().trim().min(1).max(200),
|
|
1084
|
+
data: import_zod6.z.string().max(Math.ceil(MAX_COMPLAINT_ATTACHMENT_BYTES * 4 / 3) + 4)
|
|
1085
|
+
}).optional().nullable()
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
// src/capture.ts
|
|
1089
|
+
var import_zod7 = require("zod");
|
|
1090
|
+
var AutocaptureSettingsSchema = import_zod7.z.object({ pageviews: import_zod7.z.boolean(), pageLeave: import_zod7.z.boolean(), clicks: import_zod7.z.boolean(), rageClicks: import_zod7.z.boolean(), heatmaps: import_zod7.z.boolean(), mouseMovement: import_zod7.z.boolean() }).partial();
|
|
1091
|
+
var ErrorTrackingSettingsSchema = import_zod7.z.object({ enabled: import_zod7.z.boolean() }).partial();
|
|
1092
|
+
var ReplaySettingsSchema = import_zod7.z.object({
|
|
1093
|
+
enabled: import_zod7.z.boolean(),
|
|
1094
|
+
sampleRate: import_zod7.z.number().int().min(0).max(100),
|
|
1095
|
+
recordConsole: import_zod7.z.boolean(),
|
|
1096
|
+
recordNetwork: import_zod7.z.boolean(),
|
|
1097
|
+
recordNetworkPayloads: import_zod7.z.boolean(),
|
|
1098
|
+
maskAllText: import_zod7.z.boolean(),
|
|
1099
|
+
blockSelectors: import_zod7.z.array(import_zod7.z.string().min(1).max(200)).max(50),
|
|
1100
|
+
retentionDays: import_zod7.z.number().int().min(1).max(365)
|
|
1034
1101
|
}).partial();
|
|
1035
1102
|
var DEFAULT_CAPTURE_SETTINGS = {
|
|
1036
1103
|
autocapture: { pageviews: true, pageLeave: true, clicks: true, rageClicks: true, heatmaps: true, mouseMovement: true },
|
|
@@ -1051,18 +1118,18 @@ function resolveCaptureSettings(settings) {
|
|
|
1051
1118
|
};
|
|
1052
1119
|
}
|
|
1053
1120
|
var HEATMAP_VIEWPORTS = { mobile: [0, 767], tablet: [768, 1279], desktop: [1280, 1e5] };
|
|
1054
|
-
var ReplayChunkSchema =
|
|
1055
|
-
sessionId:
|
|
1056
|
-
windowId:
|
|
1057
|
-
seq:
|
|
1058
|
-
anonymousId:
|
|
1059
|
-
userId:
|
|
1121
|
+
var ReplayChunkSchema = import_zod7.z.object({
|
|
1122
|
+
sessionId: import_zod7.z.string().min(1).max(128),
|
|
1123
|
+
windowId: import_zod7.z.string().min(1).max(64),
|
|
1124
|
+
seq: import_zod7.z.number().int().min(0).max(1e6),
|
|
1125
|
+
anonymousId: import_zod7.z.string().min(1).max(128),
|
|
1126
|
+
userId: import_zod7.z.string().max(256).optional().nullable(),
|
|
1060
1127
|
/** rrweb `eventWithTime` objects, in order. */
|
|
1061
|
-
events:
|
|
1062
|
-
url:
|
|
1063
|
-
device:
|
|
1064
|
-
viewport:
|
|
1065
|
-
sdk:
|
|
1128
|
+
events: import_zod7.z.array(import_zod7.z.object({ type: import_zod7.z.number().int(), timestamp: import_zod7.z.number() }).passthrough()).min(1).max(5e4),
|
|
1129
|
+
url: import_zod7.z.string().max(2e3).optional(),
|
|
1130
|
+
device: import_zod7.z.object({ type: import_zod7.z.string().max(20), browser: import_zod7.z.string().max(40).optional(), os: import_zod7.z.string().max(40).optional() }).optional(),
|
|
1131
|
+
viewport: import_zod7.z.object({ width: import_zod7.z.number().int().min(0).max(1e5), height: import_zod7.z.number().int().min(0).max(1e5) }).optional(),
|
|
1132
|
+
sdk: import_zod7.z.object({ name: import_zod7.z.string().max(60), version: import_zod7.z.string().max(30) }).optional()
|
|
1066
1133
|
});
|
|
1067
1134
|
var REPLAY_MAX_COMPRESSED_BYTES = 2 * 1024 * 1024;
|
|
1068
1135
|
var REPLAY_MAX_RAW_BYTES = 16 * 1024 * 1024;
|
|
@@ -1433,12 +1500,51 @@ function isArticleListed(collections, article, member) {
|
|
|
1433
1500
|
}
|
|
1434
1501
|
return true;
|
|
1435
1502
|
}
|
|
1503
|
+
var ARTICLE_VISIBILITIES = ["everyone", "identified"];
|
|
1504
|
+
var LOGGED_IN_AUDIENCE = "$identified";
|
|
1505
|
+
function servedArticleAudiences(audienceIds, visibility) {
|
|
1506
|
+
return visibility === "identified" && audienceIds.length === 0 ? [LOGGED_IN_AUDIENCE] : [...audienceIds];
|
|
1507
|
+
}
|
|
1508
|
+
function visitorAudiences(audienceIds, identified) {
|
|
1509
|
+
const ids = audienceIds.filter((id) => id !== LOGGED_IN_AUDIENCE);
|
|
1510
|
+
return identified ? [...ids, LOGGED_IN_AUDIENCE] : ids;
|
|
1511
|
+
}
|
|
1436
1512
|
function visibleArticleIds(collections, articles, member) {
|
|
1437
1513
|
return new Set(resourceCenterSections(collections, articles, member).flatMap((s) => s.articles.map((a) => a.id)));
|
|
1438
1514
|
}
|
|
1515
|
+
var SHOW_ME_CLASS = "gd-show-me";
|
|
1516
|
+
var SHOW_ME_HREF_PREFIX = "#guidely-show-me:";
|
|
1517
|
+
var SHOW_ME_KEY = /^[A-Za-z0-9_-]{1,64}$/;
|
|
1518
|
+
function showMeHref(guideKey) {
|
|
1519
|
+
return `${SHOW_ME_HREF_PREFIX}${guideKey}`;
|
|
1520
|
+
}
|
|
1521
|
+
function showMeKeyFromHref(href) {
|
|
1522
|
+
if (!href || !href.startsWith(SHOW_ME_HREF_PREFIX)) return null;
|
|
1523
|
+
const key = href.slice(SHOW_ME_HREF_PREFIX.length);
|
|
1524
|
+
return SHOW_ME_KEY.test(key) ? key : null;
|
|
1525
|
+
}
|
|
1526
|
+
function showMeKeys(html) {
|
|
1527
|
+
const out = [];
|
|
1528
|
+
for (const m of (html ?? "").matchAll(/href="#guidely-show-me:([A-Za-z0-9_-]{1,64})"/g)) if (!out.includes(m[1])) out.push(m[1]);
|
|
1529
|
+
return out.slice(0, 10);
|
|
1530
|
+
}
|
|
1531
|
+
function hasVideoMedia(html) {
|
|
1532
|
+
return /<(video|iframe)\b/i.test(html ?? "");
|
|
1533
|
+
}
|
|
1534
|
+
var words = (s) => s.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [];
|
|
1535
|
+
function matchesHelpQuery(text, query) {
|
|
1536
|
+
const q = query.trim().toLowerCase();
|
|
1537
|
+
if (!q) return true;
|
|
1538
|
+
const hay = text.toLowerCase();
|
|
1539
|
+
if (hay.includes(q)) return true;
|
|
1540
|
+
const terms = words(q);
|
|
1541
|
+
if (!terms.length) return false;
|
|
1542
|
+
const have = words(hay);
|
|
1543
|
+
return terms.every((t) => have.some((w) => w.startsWith(t) || t.length > 3 && t.endsWith("s") && w.startsWith(t.slice(0, -1))));
|
|
1544
|
+
}
|
|
1439
1545
|
|
|
1440
1546
|
// src/howto.ts
|
|
1441
|
-
var
|
|
1547
|
+
var import_zod8 = require("zod");
|
|
1442
1548
|
|
|
1443
1549
|
// src/howto-limits.ts
|
|
1444
1550
|
var CAPTURE_PARAM = "guidely_capture";
|
|
@@ -1447,36 +1553,36 @@ var CAPTURE_SCREENSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
|
1447
1553
|
// src/howto.ts
|
|
1448
1554
|
var HOWTO_STEP_KINDS = ["action", "text", "heading", "tip", "alert"];
|
|
1449
1555
|
var HOWTO_ACTIONS = ["click", "type", "select", "navigate"];
|
|
1450
|
-
var NormalizedRectSchema =
|
|
1451
|
-
x:
|
|
1452
|
-
y:
|
|
1453
|
-
width:
|
|
1454
|
-
height:
|
|
1556
|
+
var NormalizedRectSchema = import_zod8.z.object({
|
|
1557
|
+
x: import_zod8.z.number().min(0).max(1),
|
|
1558
|
+
y: import_zod8.z.number().min(0).max(1),
|
|
1559
|
+
width: import_zod8.z.number().min(0).max(1),
|
|
1560
|
+
height: import_zod8.z.number().min(0).max(1)
|
|
1455
1561
|
});
|
|
1456
|
-
var CapturedElementSchema =
|
|
1562
|
+
var CapturedElementSchema = import_zod8.z.object({
|
|
1457
1563
|
/** Visible name: aria-label, associated label, text, placeholder, alt or title. */
|
|
1458
|
-
label:
|
|
1564
|
+
label: import_zod8.z.string().max(200).default(""),
|
|
1459
1565
|
/** button, link, tab, menuitem, checkbox, radio, field, dropdown, option, element… */
|
|
1460
|
-
role:
|
|
1461
|
-
tag:
|
|
1566
|
+
role: import_zod8.z.string().max(40).default("element"),
|
|
1567
|
+
tag: import_zod8.z.string().max(40).default("")
|
|
1462
1568
|
});
|
|
1463
|
-
var CaptureStepSchema =
|
|
1569
|
+
var CaptureStepSchema = import_zod8.z.object({
|
|
1464
1570
|
/** Random id from the SDK; a retried upload with the same id is stored once. */
|
|
1465
|
-
clientId:
|
|
1466
|
-
action:
|
|
1467
|
-
url:
|
|
1468
|
-
pageTitle:
|
|
1571
|
+
clientId: import_zod8.z.string().min(1).max(64),
|
|
1572
|
+
action: import_zod8.z.enum(HOWTO_ACTIONS),
|
|
1573
|
+
url: import_zod8.z.string().max(2e3),
|
|
1574
|
+
pageTitle: import_zod8.z.string().max(300).default(""),
|
|
1469
1575
|
element: CapturedElementSchema.optional(),
|
|
1470
1576
|
/** Typed text or chosen option; absent when it was sensitive (`valueRedacted`). */
|
|
1471
|
-
value:
|
|
1472
|
-
valueRedacted:
|
|
1577
|
+
value: import_zod8.z.string().max(200).optional(),
|
|
1578
|
+
valueRedacted: import_zod8.z.boolean().default(false),
|
|
1473
1579
|
/** Selectors for the element, so the step can later become an interactive tour step. */
|
|
1474
|
-
selectors:
|
|
1580
|
+
selectors: import_zod8.z.array(SelectorStrategySchema).max(10).default([]),
|
|
1475
1581
|
/** Where the element sits in the screenshot. */
|
|
1476
1582
|
highlight: NormalizedRectSchema.optional(),
|
|
1477
1583
|
/** Number of regions the SDK blurred in the screenshot before upload. */
|
|
1478
|
-
redactions:
|
|
1479
|
-
occurredAt:
|
|
1584
|
+
redactions: import_zod8.z.number().int().min(0).max(1e3).default(0),
|
|
1585
|
+
occurredAt: import_zod8.z.string().datetime().optional()
|
|
1480
1586
|
});
|
|
1481
1587
|
function quoted(s) {
|
|
1482
1588
|
const t = (s ?? "").replace(/\s+/g, " ").trim();
|
|
@@ -1490,8 +1596,8 @@ function cleanLabel(label) {
|
|
|
1490
1596
|
var SEPARATORS = /\s+[·|•–—-]\s+|\s*[|·•]\s*/;
|
|
1491
1597
|
var ID_SEGMENT = /^(?:\d+|[0-9a-f]{8,}(?:-[0-9a-f]{4,})*|[A-Za-z0-9_-]{20,})$/i;
|
|
1492
1598
|
function humanize(segment) {
|
|
1493
|
-
const
|
|
1494
|
-
return
|
|
1599
|
+
const words2 = decodeURIComponent(segment).replace(/[-_+]+/g, " ").trim();
|
|
1600
|
+
return words2 ? words2.charAt(0).toUpperCase() + words2.slice(1) : "";
|
|
1495
1601
|
}
|
|
1496
1602
|
function pageName(url, pageTitle) {
|
|
1497
1603
|
const title = (pageTitle ?? "").replace(/\s+/g, " ").trim();
|
|
@@ -1547,17 +1653,17 @@ function hostAndPath(url) {
|
|
|
1547
1653
|
return url.slice(0, 80);
|
|
1548
1654
|
}
|
|
1549
1655
|
}
|
|
1550
|
-
var NormalizedPointSchema =
|
|
1656
|
+
var NormalizedPointSchema = import_zod8.z.object({ x: import_zod8.z.number().min(0).max(1), y: import_zod8.z.number().min(0).max(1) });
|
|
1551
1657
|
var ANNOTATION_COLORS = ["brand", "red", "amber", "green", "black", "white"];
|
|
1552
|
-
var HowToAnnotationSchema =
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1658
|
+
var HowToAnnotationSchema = import_zod8.z.discriminatedUnion("type", [
|
|
1659
|
+
import_zod8.z.object({ id: import_zod8.z.string().min(1).max(32), type: import_zod8.z.literal("arrow"), from: NormalizedPointSchema, to: NormalizedPointSchema, color: import_zod8.z.enum(ANNOTATION_COLORS).default("brand") }),
|
|
1660
|
+
import_zod8.z.object({ id: import_zod8.z.string().min(1).max(32), type: import_zod8.z.literal("text"), at: NormalizedPointSchema, text: import_zod8.z.string().trim().min(1).max(120), color: import_zod8.z.enum(ANNOTATION_COLORS).default("brand") }),
|
|
1661
|
+
import_zod8.z.object({ id: import_zod8.z.string().min(1).max(32), type: import_zod8.z.literal("box"), rect: NormalizedRectSchema, color: import_zod8.z.enum(ANNOTATION_COLORS).default("brand") })
|
|
1556
1662
|
]);
|
|
1557
1663
|
var MAX_ANNOTATIONS = 30;
|
|
1558
1664
|
|
|
1559
1665
|
// src/page.ts
|
|
1560
|
-
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,})(
|
|
1666
|
+
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,})(?=[/?]|$)";
|
|
1561
1667
|
function foldPathIds(path) {
|
|
1562
1668
|
return path.replace(new RegExp(PATH_ID_PATTERN, "gi"), "/:id");
|
|
1563
1669
|
}
|
|
@@ -1567,15 +1673,15 @@ function segmentsOf(path) {
|
|
|
1567
1673
|
return clean.split("/").map((s) => s.replace(/\.(html?|php|aspx?)$/, "")).filter((s) => !GENERIC_SEGMENTS.has(s) && /[a-z]/.test(s) && s.length <= 40);
|
|
1568
1674
|
}
|
|
1569
1675
|
function pageTerms(path) {
|
|
1570
|
-
const
|
|
1571
|
-
return [...new Set(
|
|
1676
|
+
const words2 = segmentsOf(path).flatMap((s) => s.split(/[-_.+\s]+/).filter((w) => w.length > 1 && /[a-z]/.test(w)));
|
|
1677
|
+
return [...new Set(words2)].slice(0, 8);
|
|
1572
1678
|
}
|
|
1573
1679
|
function pageLabel(path) {
|
|
1574
1680
|
const last = segmentsOf(path).at(-1);
|
|
1575
1681
|
if (!last) return null;
|
|
1576
|
-
const
|
|
1577
|
-
if (!
|
|
1578
|
-
const label =
|
|
1682
|
+
const words2 = last.split(/[-_.+\s]+/).filter(Boolean);
|
|
1683
|
+
if (!words2.length) return null;
|
|
1684
|
+
const label = words2.join(" ");
|
|
1579
1685
|
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
1580
1686
|
}
|
|
1581
1687
|
function firstNameFromTraits(traits) {
|
|
@@ -1588,11 +1694,12 @@ function firstNameFromTraits(traits) {
|
|
|
1588
1694
|
|
|
1589
1695
|
// src/index.ts
|
|
1590
1696
|
var SDK_API_VERSION = "v1";
|
|
1591
|
-
var SHARED_VERSION = "0.
|
|
1697
|
+
var SHARED_VERSION = "0.9.0";
|
|
1592
1698
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1593
1699
|
0 && (module.exports = {
|
|
1594
1700
|
ADVANCE_ON,
|
|
1595
1701
|
ANNOTATION_COLORS,
|
|
1702
|
+
ARTICLE_VISIBILITIES,
|
|
1596
1703
|
AUTOCAPTURE_EVENTS,
|
|
1597
1704
|
AppearanceSchema,
|
|
1598
1705
|
AuthoringPickSchema,
|
|
@@ -1601,6 +1708,9 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1601
1708
|
ButtonSchema,
|
|
1602
1709
|
CAPTURE_PARAM,
|
|
1603
1710
|
CAPTURE_SCREENSHOT_MAX_BYTES,
|
|
1711
|
+
COMPLAINT_EVENTS,
|
|
1712
|
+
COMPLAINT_FIELD_TYPES,
|
|
1713
|
+
COMPLAINT_STATUSES,
|
|
1604
1714
|
CaptureStepSchema,
|
|
1605
1715
|
CapturedElementSchema,
|
|
1606
1716
|
ChecklistConfigSchema,
|
|
@@ -1615,12 +1725,14 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1615
1725
|
ErrorTrackingSettingsSchema,
|
|
1616
1726
|
EventBatchSchema,
|
|
1617
1727
|
FILE_LINK_CLASS,
|
|
1728
|
+
FileComplaintSchema,
|
|
1618
1729
|
FrequencySchema,
|
|
1619
1730
|
GUIDELY_ID_ATTRIBUTE,
|
|
1620
1731
|
GUIDE_KINDS,
|
|
1621
1732
|
GUIDE_LIFECYCLE_EVENTS,
|
|
1622
1733
|
GUIDE_STATUSES,
|
|
1623
1734
|
GUIDE_TEMPLATES,
|
|
1735
|
+
GUIDE_VISIBILITIES,
|
|
1624
1736
|
GuideConfigSchema,
|
|
1625
1737
|
GuideStateUpdateSchema,
|
|
1626
1738
|
HEATMAP_VIEWPORTS,
|
|
@@ -1628,8 +1740,14 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1628
1740
|
HOWTO_STEP_KINDS,
|
|
1629
1741
|
HowToAnnotationSchema,
|
|
1630
1742
|
IdentifyRequestSchema,
|
|
1743
|
+
LOGGED_IN_AUDIENCE,
|
|
1631
1744
|
MAX_ANNOTATIONS,
|
|
1632
1745
|
MAX_COLLECTION_DEPTH,
|
|
1746
|
+
MAX_COMPLAINT_ANSWER_LENGTH,
|
|
1747
|
+
MAX_COMPLAINT_ATTACHMENT_BYTES,
|
|
1748
|
+
MAX_COMPLAINT_CHOICES,
|
|
1749
|
+
MAX_COMPLAINT_FIELDS,
|
|
1750
|
+
MAX_COMPLAINT_LENGTH,
|
|
1633
1751
|
MAX_MESSAGE_LENGTH,
|
|
1634
1752
|
MAX_PROPERTY_BYTES,
|
|
1635
1753
|
MAX_STACK_FRAMES,
|
|
@@ -1670,6 +1788,8 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1670
1788
|
SENSITIVE_PROPERTY_PATTERN,
|
|
1671
1789
|
SERVER_ASSISTED_FIELDS,
|
|
1672
1790
|
SHARED_VERSION,
|
|
1791
|
+
SHOW_ME_CLASS,
|
|
1792
|
+
SHOW_ME_HREF_PREFIX,
|
|
1673
1793
|
SOURCEMAP_MAX_FILES_PER_UPLOAD,
|
|
1674
1794
|
SOURCEMAP_MAX_FILE_BYTES,
|
|
1675
1795
|
STATUS_LEVELS,
|
|
@@ -1693,6 +1813,7 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1693
1813
|
cleanLabel,
|
|
1694
1814
|
compare,
|
|
1695
1815
|
compareVersions,
|
|
1816
|
+
complaintReference,
|
|
1696
1817
|
defaultGuideConfig,
|
|
1697
1818
|
defaultStep,
|
|
1698
1819
|
describeCaptureStep,
|
|
@@ -1707,6 +1828,7 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1707
1828
|
getPath,
|
|
1708
1829
|
guidePlatforms,
|
|
1709
1830
|
guidelyIdFromSelector,
|
|
1831
|
+
hasVideoMedia,
|
|
1710
1832
|
isAllowedEmbedSrc,
|
|
1711
1833
|
isArticleListed,
|
|
1712
1834
|
isChecklistComplete,
|
|
@@ -1719,6 +1841,7 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1719
1841
|
isVideoContentType,
|
|
1720
1842
|
matchUrlPattern,
|
|
1721
1843
|
matchesAudiences,
|
|
1844
|
+
matchesHelpQuery,
|
|
1722
1845
|
mediaKind,
|
|
1723
1846
|
mediaMaxBytes,
|
|
1724
1847
|
normalizeErrorMessage,
|
|
@@ -1734,6 +1857,10 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1734
1857
|
safeRegExp,
|
|
1735
1858
|
sanitizeProperties,
|
|
1736
1859
|
screenPath,
|
|
1860
|
+
servedArticleAudiences,
|
|
1861
|
+
showMeHref,
|
|
1862
|
+
showMeKeyFromHref,
|
|
1863
|
+
showMeKeys,
|
|
1737
1864
|
slugify,
|
|
1738
1865
|
stripOrigin,
|
|
1739
1866
|
supportsPlatform,
|
|
@@ -1741,6 +1868,8 @@ var SHARED_VERSION = "0.8.0";
|
|
|
1741
1868
|
toEmbedUrl,
|
|
1742
1869
|
validateGuideConfig,
|
|
1743
1870
|
visibleArticleIds,
|
|
1744
|
-
visibleButtons
|
|
1871
|
+
visibleButtons,
|
|
1872
|
+
visitorAudiences,
|
|
1873
|
+
withVisibility
|
|
1745
1874
|
});
|
|
1746
1875
|
//# sourceMappingURL=index.cjs.map
|