@guidelytech/shared 0.15.0 → 0.16.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-XJXXVV3C.js → chunk-7PWYIAJI.js} +30 -1
- package/dist/chunk-7PWYIAJI.js.map +1 -0
- package/dist/index.cjs +74 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +231 -645
- package/dist/index.d.ts +231 -645
- package/dist/index.js +49 -10
- package/dist/index.js.map +1 -1
- package/dist/runtime-CAtOOY7X.d.cts +3047 -0
- package/dist/runtime-CAtOOY7X.d.ts +3047 -0
- package/dist/runtime.cjs +35 -0
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +13 -1
- package/package.json +3 -3
- package/dist/chunk-OLWGMDRX.js +0 -729
- package/dist/chunk-OLWGMDRX.js.map +0 -1
- package/dist/chunk-TGIUEYXM.js +0 -1937
- package/dist/chunk-TGIUEYXM.js.map +0 -1
- package/dist/chunk-UW6NRYRY.js +0 -809
- package/dist/chunk-UW6NRYRY.js.map +0 -1
- package/dist/chunk-XJXXVV3C.js.map +0 -1
- package/dist/runtime-BM5cztmJ.d.cts +0 -5234
- package/dist/runtime-BM5cztmJ.d.ts +0 -5234
- package/dist/runtime-BeSHQtNX.d.cts +0 -5263
- package/dist/runtime-BeSHQtNX.d.ts +0 -5263
- package/dist/runtime-DjEAlb_Q.d.cts +0 -5268
- package/dist/runtime-DjEAlb_Q.d.ts +0 -5268
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ __export(index_exports, {
|
|
|
31
31
|
AGENT_TURN_ROLES: () => AGENT_TURN_ROLES,
|
|
32
32
|
ANNOTATION_COLORS: () => ANNOTATION_COLORS,
|
|
33
33
|
APP_LIFECYCLE_EVENTS: () => APP_LIFECYCLE_EVENTS,
|
|
34
|
+
ARTICLE_HREF_PREFIX: () => ARTICLE_HREF_PREFIX,
|
|
34
35
|
ARTICLE_VISIBILITIES: () => ARTICLE_VISIBILITIES,
|
|
35
36
|
AUTOCAPTURE_EVENTS: () => AUTOCAPTURE_EVENTS,
|
|
36
37
|
AgentEventsRequestSchema: () => AgentEventsRequestSchema,
|
|
@@ -145,6 +146,7 @@ __export(index_exports, {
|
|
|
145
146
|
PublishedGuideSchema: () => PublishedGuideSchema,
|
|
146
147
|
RC_MODULE_IDS: () => RC_MODULE_IDS,
|
|
147
148
|
RC_MODULE_LABELS: () => RC_MODULE_LABELS,
|
|
149
|
+
RECORDING_LEVELS: () => RECORDING_LEVELS,
|
|
148
150
|
REPLAY_MAX_COMPRESSED_BYTES: () => REPLAY_MAX_COMPRESSED_BYTES,
|
|
149
151
|
REPLAY_MAX_RAW_BYTES: () => REPLAY_MAX_RAW_BYTES,
|
|
150
152
|
REPLY_TIMES: () => REPLY_TIMES,
|
|
@@ -194,6 +196,8 @@ __export(index_exports, {
|
|
|
194
196
|
WS_MAX_MESSAGES_PER_SOCKET: () => WS_MAX_MESSAGES_PER_SOCKET,
|
|
195
197
|
WS_MAX_MESSAGE_BYTES: () => WS_MAX_MESSAGE_BYTES,
|
|
196
198
|
applyGuideTranslations: () => applyGuideTranslations,
|
|
199
|
+
articleHref: () => articleHref,
|
|
200
|
+
articleIdFromHref: () => articleIdFromHref,
|
|
197
201
|
articleTextEntries: () => articleTextEntries,
|
|
198
202
|
assignGuideVariant: () => assignGuideVariant,
|
|
199
203
|
baseLanguage: () => baseLanguage,
|
|
@@ -240,6 +244,7 @@ __export(index_exports, {
|
|
|
240
244
|
isRuleGroup: () => isRuleGroup,
|
|
241
245
|
isSafeMediaUrl: () => isSafeMediaUrl,
|
|
242
246
|
isVideoContentType: () => isVideoContentType,
|
|
247
|
+
isVideoFileUrl: () => isVideoFileUrl,
|
|
243
248
|
localeName: () => localeName,
|
|
244
249
|
localizeAnnouncement: () => localizeAnnouncement,
|
|
245
250
|
localizeArticle: () => localizeArticle,
|
|
@@ -274,6 +279,7 @@ __export(index_exports, {
|
|
|
274
279
|
queryConditionRegex: () => queryConditionRegex,
|
|
275
280
|
randomId: () => randomId,
|
|
276
281
|
readableTextOn: () => readableTextOn,
|
|
282
|
+
recordingLevel: () => recordingLevel,
|
|
277
283
|
relativeLuminance: () => relativeLuminance,
|
|
278
284
|
resolveCaptureSettings: () => resolveCaptureSettings,
|
|
279
285
|
resolveLocale: () => resolveLocale,
|
|
@@ -294,6 +300,7 @@ __export(index_exports, {
|
|
|
294
300
|
slugify: () => slugify,
|
|
295
301
|
snapshotFromSelector: () => snapshotFromSelector,
|
|
296
302
|
stableStringify: () => stableStringify,
|
|
303
|
+
stepVideo: () => stepVideo,
|
|
297
304
|
stripOrigin: () => stripOrigin,
|
|
298
305
|
supportsPlatform: () => supportsPlatform,
|
|
299
306
|
templateConfig: () => templateConfig,
|
|
@@ -305,12 +312,14 @@ __export(index_exports, {
|
|
|
305
312
|
validateGuideConfig: () => validateGuideConfig,
|
|
306
313
|
variantProblems: () => variantProblems,
|
|
307
314
|
variantRanges: () => variantRanges,
|
|
315
|
+
videoThumbnailUrl: () => videoThumbnailUrl,
|
|
308
316
|
visibleAnnouncements: () => visibleAnnouncements,
|
|
309
317
|
visibleArticleIds: () => visibleArticleIds,
|
|
310
318
|
visibleButtons: () => visibleButtons,
|
|
311
319
|
visitorAudiences: () => visitorAudiences,
|
|
312
320
|
visitorLocales: () => visitorLocales,
|
|
313
321
|
withExperimentBucket: () => withExperimentBucket,
|
|
322
|
+
withRecordingLevel: () => withRecordingLevel,
|
|
314
323
|
withVisibility: () => withVisibility
|
|
315
324
|
});
|
|
316
325
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -820,6 +829,11 @@ var StepSchema = import_zod2.z.object({
|
|
|
820
829
|
imageUrl: import_zod2.z.string().url().max(2e3).optional().or(import_zod2.z.literal("")),
|
|
821
830
|
/** Alternative text for `imageUrl` (screen readers); empty = decorative. */
|
|
822
831
|
imageAlt: import_zod2.z.string().max(300).optional(),
|
|
832
|
+
/**
|
|
833
|
+
* Video (YouTube, Vimeo, Loom, a file…): drawn as a poster with a play button that opens the video
|
|
834
|
+
* in a new tab. The poster is `imageUrl` when set, else the provider's thumbnail.
|
|
835
|
+
*/
|
|
836
|
+
videoUrl: import_zod2.z.string().url().max(2e3).optional().or(import_zod2.z.literal("")),
|
|
823
837
|
buttons: import_zod2.z.array(ButtonSchema).max(6).default([]),
|
|
824
838
|
target: TargetSchema.optional(),
|
|
825
839
|
placement: import_zod2.z.enum(PLACEMENTS).default("auto"),
|
|
@@ -965,9 +979,9 @@ var GuideConfigSchema = import_zod2.z.object({
|
|
|
965
979
|
/** Everyone, only identified (logged-in) users, or only anonymous visitors; applied on top of `targeting`. */
|
|
966
980
|
visibility: import_zod2.z.enum(GUIDE_VISIBILITIES).default("everyone"),
|
|
967
981
|
targeting: RuleGroupSchema.default(() => emptyRuleGroup()),
|
|
968
|
-
trigger: TriggerSchema.
|
|
969
|
-
frequency: FrequencySchema.
|
|
970
|
-
appearance: AppearanceSchema.
|
|
982
|
+
trigger: TriggerSchema.prefault({}),
|
|
983
|
+
frequency: FrequencySchema.prefault({}),
|
|
984
|
+
appearance: AppearanceSchema.prefault({}),
|
|
971
985
|
checklist: ChecklistConfigSchema.optional(),
|
|
972
986
|
survey: SurveyConfigSchema.optional(),
|
|
973
987
|
/** Restrict guide to url pattern(s) (applied before trigger). On mobile these match the screen path `/<Screen>`. */
|
|
@@ -1143,6 +1157,8 @@ var EVENT_NAMES = [
|
|
|
1143
1157
|
"guide_skipped",
|
|
1144
1158
|
"guide_dismissed",
|
|
1145
1159
|
"guide_abandoned",
|
|
1160
|
+
/** The video on a guide step was clicked (opened in a new tab). Properties: videoUrl. */
|
|
1161
|
+
"guide_video_clicked",
|
|
1146
1162
|
"checklist_task_completed",
|
|
1147
1163
|
"checklist_completed",
|
|
1148
1164
|
"checklist_dismissed",
|
|
@@ -1190,7 +1206,7 @@ var SdkEventSchema = import_zod3.z.object({
|
|
|
1190
1206
|
stepId: import_zod3.z.string().max(64).optional(),
|
|
1191
1207
|
stepIndex: import_zod3.z.number().int().min(0).optional(),
|
|
1192
1208
|
url: import_zod3.z.string().max(2e3).optional(),
|
|
1193
|
-
properties: import_zod3.z.record(import_zod3.z.unknown()).optional()
|
|
1209
|
+
properties: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
1194
1210
|
});
|
|
1195
1211
|
var EventBatchSchema = import_zod3.z.object({
|
|
1196
1212
|
events: import_zod3.z.array(SdkEventSchema).min(1).max(50),
|
|
@@ -1203,8 +1219,8 @@ var import_zod4 = require("zod");
|
|
|
1203
1219
|
var IdentifyRequestSchema = import_zod4.z.object({
|
|
1204
1220
|
anonymousId: import_zod4.z.string().min(1).max(128),
|
|
1205
1221
|
userId: import_zod4.z.string().min(1).max(256).optional().nullable(),
|
|
1206
|
-
traits: import_zod4.z.record(import_zod4.z.unknown()).optional(),
|
|
1207
|
-
account: import_zod4.z.object({ id: import_zod4.z.string().min(1).max(256), traits: import_zod4.z.record(import_zod4.z.unknown()).optional() }).optional().nullable(),
|
|
1222
|
+
traits: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1223
|
+
account: import_zod4.z.object({ id: import_zod4.z.string().min(1).max(256), traits: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional() }).optional().nullable(),
|
|
1208
1224
|
sessionId: import_zod4.z.string().max(128).optional(),
|
|
1209
1225
|
url: import_zod4.z.string().max(2e3).optional()
|
|
1210
1226
|
});
|
|
@@ -1221,7 +1237,7 @@ var SurveyResponseRequestSchema = import_zod4.z.object({
|
|
|
1221
1237
|
userId: import_zod4.z.string().max(256).optional().nullable(),
|
|
1222
1238
|
accountId: import_zod4.z.string().max(256).optional().nullable(),
|
|
1223
1239
|
guideVersion: import_zod4.z.number().int(),
|
|
1224
|
-
answers: import_zod4.z.record(import_zod4.z.union([import_zod4.z.string().max(5e3), import_zod4.z.number(), import_zod4.z.boolean(), import_zod4.z.array(import_zod4.z.string().max(500)).max(50)])),
|
|
1240
|
+
answers: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.union([import_zod4.z.string().max(5e3), import_zod4.z.number(), import_zod4.z.boolean(), import_zod4.z.array(import_zod4.z.string().max(500)).max(50)])),
|
|
1225
1241
|
responseId: import_zod4.z.string().min(8).max(64)
|
|
1226
1242
|
});
|
|
1227
1243
|
var GuideStateUpdateSchema = import_zod4.z.object({
|
|
@@ -1243,7 +1259,7 @@ var AuthoringPickSchema = import_zod4.z.object({
|
|
|
1243
1259
|
url: import_zod4.z.string().max(2e3).optional(),
|
|
1244
1260
|
rect: import_zod4.z.object({ x: import_zod4.z.number(), y: import_zod4.z.number(), width: import_zod4.z.number(), height: import_zod4.z.number() }).optional(),
|
|
1245
1261
|
/** Compact snapshot of the picked element (tag mode: feature rules are proposed from it). */
|
|
1246
|
-
elementSnapshot: import_zod4.z.record(import_zod4.z.unknown()).optional()
|
|
1262
|
+
elementSnapshot: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional()
|
|
1247
1263
|
});
|
|
1248
1264
|
var PublishedGuideSchema = import_zod4.z.object({
|
|
1249
1265
|
id: import_zod4.z.string(),
|
|
@@ -1471,6 +1487,23 @@ var DEFAULT_CAPTURE_SETTINGS = {
|
|
|
1471
1487
|
errorTracking: { enabled: true },
|
|
1472
1488
|
replay: { enabled: false, sampleRate: 100, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false, maskAllText: false, blockSelectors: [], retentionDays: 30 }
|
|
1473
1489
|
};
|
|
1490
|
+
var RECORDING_LEVELS = ["off", "privacy", "standard", "full"];
|
|
1491
|
+
var RECORDING_PRESETS = {
|
|
1492
|
+
privacy: { maskAllText: true, recordConsole: false, recordNetwork: false, recordNetworkPayloads: false },
|
|
1493
|
+
standard: { maskAllText: false, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false },
|
|
1494
|
+
full: { maskAllText: false, recordConsole: true, recordNetwork: true, recordNetworkPayloads: true }
|
|
1495
|
+
};
|
|
1496
|
+
function recordingLevel(replay) {
|
|
1497
|
+
if (!replay.enabled) return "off";
|
|
1498
|
+
for (const level of ["privacy", "standard", "full"]) {
|
|
1499
|
+
const preset = RECORDING_PRESETS[level];
|
|
1500
|
+
if (Object.keys(preset).every((k) => replay[k] === preset[k])) return level;
|
|
1501
|
+
}
|
|
1502
|
+
return "custom";
|
|
1503
|
+
}
|
|
1504
|
+
function withRecordingLevel(replay, level) {
|
|
1505
|
+
return level === "off" ? { ...replay, enabled: false } : { ...replay, ...RECORDING_PRESETS[level], enabled: true };
|
|
1506
|
+
}
|
|
1474
1507
|
function resolveCaptureSettings(settings) {
|
|
1475
1508
|
const s = settings && typeof settings === "object" ? settings : {};
|
|
1476
1509
|
const obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
@@ -1813,6 +1846,19 @@ function isSafeMediaUrl(url) {
|
|
|
1813
1846
|
return false;
|
|
1814
1847
|
}
|
|
1815
1848
|
}
|
|
1849
|
+
function videoThumbnailUrl(url) {
|
|
1850
|
+
const embed = url ? toEmbedUrl(url) : null;
|
|
1851
|
+
if (embed?.provider !== "youtube") return null;
|
|
1852
|
+
const id2 = embed.src.split("/embed/")[1]?.split("?")[0];
|
|
1853
|
+
return id2 ? `https://i.ytimg.com/vi/${id2}/hqdefault.jpg` : null;
|
|
1854
|
+
}
|
|
1855
|
+
function isVideoFileUrl(url) {
|
|
1856
|
+
return isSafeMediaUrl(url) && /\.(mp4|webm|m4v|mov|ogv)$/i.test(new URL(url).pathname);
|
|
1857
|
+
}
|
|
1858
|
+
function stepVideo(step) {
|
|
1859
|
+
if (!step.videoUrl || !isSafeMediaUrl(step.videoUrl)) return null;
|
|
1860
|
+
return { url: step.videoUrl, poster: (step.imageUrl && isSafeMediaUrl(step.imageUrl) ? step.imageUrl : null) ?? videoThumbnailUrl(step.videoUrl) };
|
|
1861
|
+
}
|
|
1816
1862
|
|
|
1817
1863
|
// src/resource-center.ts
|
|
1818
1864
|
var MAX_COLLECTION_DEPTH = 3;
|
|
@@ -1935,6 +1981,16 @@ function unreadAnnouncements(items, lastSeenAt) {
|
|
|
1935
1981
|
if (Number.isNaN(seen)) return items.length;
|
|
1936
1982
|
return items.filter((a) => Date.parse(a.publishedAt) > seen).length;
|
|
1937
1983
|
}
|
|
1984
|
+
var ARTICLE_HREF_PREFIX = "#guidely-article:";
|
|
1985
|
+
var ARTICLE_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
1986
|
+
function articleHref(articleId) {
|
|
1987
|
+
return `${ARTICLE_HREF_PREFIX}${articleId}`;
|
|
1988
|
+
}
|
|
1989
|
+
function articleIdFromHref(href) {
|
|
1990
|
+
if (!href || !href.startsWith(ARTICLE_HREF_PREFIX)) return null;
|
|
1991
|
+
const id2 = href.slice(ARTICLE_HREF_PREFIX.length);
|
|
1992
|
+
return ARTICLE_ID.test(id2) ? id2 : null;
|
|
1993
|
+
}
|
|
1938
1994
|
|
|
1939
1995
|
// src/howto.ts
|
|
1940
1996
|
var import_zod10 = require("zod");
|
|
@@ -3184,7 +3240,7 @@ function parseTranslationCsv(text) {
|
|
|
3184
3240
|
|
|
3185
3241
|
// src/index.ts
|
|
3186
3242
|
var SDK_API_VERSION = "v1";
|
|
3187
|
-
var SHARED_VERSION = "0.
|
|
3243
|
+
var SHARED_VERSION = "0.16.0";
|
|
3188
3244
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3189
3245
|
0 && (module.exports = {
|
|
3190
3246
|
ADVANCE_ON,
|
|
@@ -3198,6 +3254,7 @@ var SHARED_VERSION = "0.15.0";
|
|
|
3198
3254
|
AGENT_TURN_ROLES,
|
|
3199
3255
|
ANNOTATION_COLORS,
|
|
3200
3256
|
APP_LIFECYCLE_EVENTS,
|
|
3257
|
+
ARTICLE_HREF_PREFIX,
|
|
3201
3258
|
ARTICLE_VISIBILITIES,
|
|
3202
3259
|
AUTOCAPTURE_EVENTS,
|
|
3203
3260
|
AgentEventsRequestSchema,
|
|
@@ -3312,6 +3369,7 @@ var SHARED_VERSION = "0.15.0";
|
|
|
3312
3369
|
PublishedGuideSchema,
|
|
3313
3370
|
RC_MODULE_IDS,
|
|
3314
3371
|
RC_MODULE_LABELS,
|
|
3372
|
+
RECORDING_LEVELS,
|
|
3315
3373
|
REPLAY_MAX_COMPRESSED_BYTES,
|
|
3316
3374
|
REPLAY_MAX_RAW_BYTES,
|
|
3317
3375
|
REPLY_TIMES,
|
|
@@ -3361,6 +3419,8 @@ var SHARED_VERSION = "0.15.0";
|
|
|
3361
3419
|
WS_MAX_MESSAGES_PER_SOCKET,
|
|
3362
3420
|
WS_MAX_MESSAGE_BYTES,
|
|
3363
3421
|
applyGuideTranslations,
|
|
3422
|
+
articleHref,
|
|
3423
|
+
articleIdFromHref,
|
|
3364
3424
|
articleTextEntries,
|
|
3365
3425
|
assignGuideVariant,
|
|
3366
3426
|
baseLanguage,
|
|
@@ -3407,6 +3467,7 @@ var SHARED_VERSION = "0.15.0";
|
|
|
3407
3467
|
isRuleGroup,
|
|
3408
3468
|
isSafeMediaUrl,
|
|
3409
3469
|
isVideoContentType,
|
|
3470
|
+
isVideoFileUrl,
|
|
3410
3471
|
localeName,
|
|
3411
3472
|
localizeAnnouncement,
|
|
3412
3473
|
localizeArticle,
|
|
@@ -3441,6 +3502,7 @@ var SHARED_VERSION = "0.15.0";
|
|
|
3441
3502
|
queryConditionRegex,
|
|
3442
3503
|
randomId,
|
|
3443
3504
|
readableTextOn,
|
|
3505
|
+
recordingLevel,
|
|
3444
3506
|
relativeLuminance,
|
|
3445
3507
|
resolveCaptureSettings,
|
|
3446
3508
|
resolveLocale,
|
|
@@ -3461,6 +3523,7 @@ var SHARED_VERSION = "0.15.0";
|
|
|
3461
3523
|
slugify,
|
|
3462
3524
|
snapshotFromSelector,
|
|
3463
3525
|
stableStringify,
|
|
3526
|
+
stepVideo,
|
|
3464
3527
|
stripOrigin,
|
|
3465
3528
|
supportsPlatform,
|
|
3466
3529
|
templateConfig,
|
|
@@ -3472,12 +3535,14 @@ var SHARED_VERSION = "0.15.0";
|
|
|
3472
3535
|
validateGuideConfig,
|
|
3473
3536
|
variantProblems,
|
|
3474
3537
|
variantRanges,
|
|
3538
|
+
videoThumbnailUrl,
|
|
3475
3539
|
visibleAnnouncements,
|
|
3476
3540
|
visibleArticleIds,
|
|
3477
3541
|
visibleButtons,
|
|
3478
3542
|
visitorAudiences,
|
|
3479
3543
|
visitorLocales,
|
|
3480
3544
|
withExperimentBucket,
|
|
3545
|
+
withRecordingLevel,
|
|
3481
3546
|
withVisibility
|
|
3482
3547
|
});
|
|
3483
3548
|
//# sourceMappingURL=index.cjs.map
|