@guidelytech/shared 0.14.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/index.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  AGENT_TURNS_PER_BATCH,
8
8
  AGENT_TURN_MAX_TEXT,
9
9
  AGENT_TURN_ROLES,
10
+ ARTICLE_HREF_PREFIX,
10
11
  ARTICLE_VISIBILITIES,
11
12
  CAPTURE_PARAM,
12
13
  CAPTURE_SCREENSHOT_MAX_BYTES,
@@ -75,6 +76,8 @@ import {
75
76
  WS_MAX_MESSAGES_PER_SOCKET,
76
77
  WS_MAX_MESSAGE_BYTES,
77
78
  applyGuideTranslations,
79
+ articleHref,
80
+ articleIdFromHref,
78
81
  articleTextEntries,
79
82
  assignGuideVariant,
80
83
  baseLanguage,
@@ -116,6 +119,7 @@ import {
116
119
  isRuleGroup,
117
120
  isSafeMediaUrl,
118
121
  isVideoContentType,
122
+ isVideoFileUrl,
119
123
  localeName,
120
124
  localizeAnnouncement,
121
125
  localizeArticle,
@@ -164,6 +168,7 @@ import {
164
168
  slugify,
165
169
  snapshotFromSelector,
166
170
  stableStringify,
171
+ stepVideo,
167
172
  stripOrigin,
168
173
  supportsPlatform,
169
174
  toEmbedUrl,
@@ -171,13 +176,14 @@ import {
171
176
  unreadAnnouncements,
172
177
  variantProblems,
173
178
  variantRanges,
179
+ videoThumbnailUrl,
174
180
  visibleAnnouncements,
175
181
  visibleArticleIds,
176
182
  visitorAudiences,
177
183
  visitorLocales,
178
184
  withExperimentBucket,
179
185
  withVisibility
180
- } from "./chunk-XJXXVV3C.js";
186
+ } from "./chunk-7PWYIAJI.js";
181
187
 
182
188
  // src/targeting.ts
183
189
  import { z } from "zod";
@@ -250,6 +256,11 @@ var StepSchema = z2.object({
250
256
  imageUrl: z2.string().url().max(2e3).optional().or(z2.literal("")),
251
257
  /** Alternative text for `imageUrl` (screen readers); empty = decorative. */
252
258
  imageAlt: z2.string().max(300).optional(),
259
+ /**
260
+ * Video (YouTube, Vimeo, Loom, a file…): drawn as a poster with a play button that opens the video
261
+ * in a new tab. The poster is `imageUrl` when set, else the provider's thumbnail.
262
+ */
263
+ videoUrl: z2.string().url().max(2e3).optional().or(z2.literal("")),
253
264
  buttons: z2.array(ButtonSchema).max(6).default([]),
254
265
  target: TargetSchema.optional(),
255
266
  placement: z2.enum(PLACEMENTS).default("auto"),
@@ -395,9 +406,9 @@ var GuideConfigSchema = z2.object({
395
406
  /** Everyone, only identified (logged-in) users, or only anonymous visitors; applied on top of `targeting`. */
396
407
  visibility: z2.enum(GUIDE_VISIBILITIES).default("everyone"),
397
408
  targeting: RuleGroupSchema.default(() => emptyRuleGroup()),
398
- trigger: TriggerSchema.default({}),
399
- frequency: FrequencySchema.default({}),
400
- appearance: AppearanceSchema.default({}),
409
+ trigger: TriggerSchema.prefault({}),
410
+ frequency: FrequencySchema.prefault({}),
411
+ appearance: AppearanceSchema.prefault({}),
401
412
  checklist: ChecklistConfigSchema.optional(),
402
413
  survey: SurveyConfigSchema.optional(),
403
414
  /** Restrict guide to url pattern(s) (applied before trigger). On mobile these match the screen path `/<Screen>`. */
@@ -512,6 +523,8 @@ var EVENT_NAMES = [
512
523
  "guide_skipped",
513
524
  "guide_dismissed",
514
525
  "guide_abandoned",
526
+ /** The video on a guide step was clicked (opened in a new tab). Properties: videoUrl. */
527
+ "guide_video_clicked",
515
528
  "checklist_task_completed",
516
529
  "checklist_completed",
517
530
  "checklist_dismissed",
@@ -559,7 +572,7 @@ var SdkEventSchema = z3.object({
559
572
  stepId: z3.string().max(64).optional(),
560
573
  stepIndex: z3.number().int().min(0).optional(),
561
574
  url: z3.string().max(2e3).optional(),
562
- properties: z3.record(z3.unknown()).optional()
575
+ properties: z3.record(z3.string(), z3.unknown()).optional()
563
576
  });
564
577
  var EventBatchSchema = z3.object({
565
578
  events: z3.array(SdkEventSchema).min(1).max(50),
@@ -572,8 +585,8 @@ import { z as z4 } from "zod";
572
585
  var IdentifyRequestSchema = z4.object({
573
586
  anonymousId: z4.string().min(1).max(128),
574
587
  userId: z4.string().min(1).max(256).optional().nullable(),
575
- traits: z4.record(z4.unknown()).optional(),
576
- account: z4.object({ id: z4.string().min(1).max(256), traits: z4.record(z4.unknown()).optional() }).optional().nullable(),
588
+ traits: z4.record(z4.string(), z4.unknown()).optional(),
589
+ account: z4.object({ id: z4.string().min(1).max(256), traits: z4.record(z4.string(), z4.unknown()).optional() }).optional().nullable(),
577
590
  sessionId: z4.string().max(128).optional(),
578
591
  url: z4.string().max(2e3).optional()
579
592
  });
@@ -590,7 +603,7 @@ var SurveyResponseRequestSchema = z4.object({
590
603
  userId: z4.string().max(256).optional().nullable(),
591
604
  accountId: z4.string().max(256).optional().nullable(),
592
605
  guideVersion: z4.number().int(),
593
- answers: z4.record(z4.union([z4.string().max(5e3), z4.number(), z4.boolean(), z4.array(z4.string().max(500)).max(50)])),
606
+ answers: z4.record(z4.string(), z4.union([z4.string().max(5e3), z4.number(), z4.boolean(), z4.array(z4.string().max(500)).max(50)])),
594
607
  responseId: z4.string().min(8).max(64)
595
608
  });
596
609
  var GuideStateUpdateSchema = z4.object({
@@ -612,7 +625,7 @@ var AuthoringPickSchema = z4.object({
612
625
  url: z4.string().max(2e3).optional(),
613
626
  rect: z4.object({ x: z4.number(), y: z4.number(), width: z4.number(), height: z4.number() }).optional(),
614
627
  /** Compact snapshot of the picked element (tag mode: feature rules are proposed from it). */
615
- elementSnapshot: z4.record(z4.unknown()).optional()
628
+ elementSnapshot: z4.record(z4.string(), z4.unknown()).optional()
616
629
  });
617
630
  var PublishedGuideSchema = z4.object({
618
631
  id: z4.string(),
@@ -814,6 +827,23 @@ var DEFAULT_CAPTURE_SETTINGS = {
814
827
  errorTracking: { enabled: true },
815
828
  replay: { enabled: false, sampleRate: 100, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false, maskAllText: false, blockSelectors: [], retentionDays: 30 }
816
829
  };
830
+ var RECORDING_LEVELS = ["off", "privacy", "standard", "full"];
831
+ var RECORDING_PRESETS = {
832
+ privacy: { maskAllText: true, recordConsole: false, recordNetwork: false, recordNetworkPayloads: false },
833
+ standard: { maskAllText: false, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false },
834
+ full: { maskAllText: false, recordConsole: true, recordNetwork: true, recordNetworkPayloads: true }
835
+ };
836
+ function recordingLevel(replay) {
837
+ if (!replay.enabled) return "off";
838
+ for (const level of ["privacy", "standard", "full"]) {
839
+ const preset = RECORDING_PRESETS[level];
840
+ if (Object.keys(preset).every((k) => replay[k] === preset[k])) return level;
841
+ }
842
+ return "custom";
843
+ }
844
+ function withRecordingLevel(replay, level) {
845
+ return level === "off" ? { ...replay, enabled: false } : { ...replay, ...RECORDING_PRESETS[level], enabled: true };
846
+ }
817
847
  function resolveCaptureSettings(settings) {
818
848
  const s = settings && typeof settings === "object" ? settings : {};
819
849
  const obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
@@ -1276,7 +1306,7 @@ function parseTranslationCsv(text) {
1276
1306
 
1277
1307
  // src/index.ts
1278
1308
  var SDK_API_VERSION = "v1";
1279
- var SHARED_VERSION = "0.14.0";
1309
+ var SHARED_VERSION = "0.16.0";
1280
1310
  export {
1281
1311
  ADVANCE_ON,
1282
1312
  AGENT_METADATA_MAX_BYTES,
@@ -1289,6 +1319,7 @@ export {
1289
1319
  AGENT_TURN_ROLES,
1290
1320
  ANNOTATION_COLORS,
1291
1321
  APP_LIFECYCLE_EVENTS,
1322
+ ARTICLE_HREF_PREFIX,
1292
1323
  ARTICLE_VISIBILITIES,
1293
1324
  AUTOCAPTURE_EVENTS,
1294
1325
  AgentEventsRequestSchema,
@@ -1403,6 +1434,7 @@ export {
1403
1434
  PublishedGuideSchema,
1404
1435
  RC_MODULE_IDS,
1405
1436
  RC_MODULE_LABELS,
1437
+ RECORDING_LEVELS,
1406
1438
  REPLAY_MAX_COMPRESSED_BYTES,
1407
1439
  REPLAY_MAX_RAW_BYTES,
1408
1440
  REPLY_TIMES,
@@ -1452,6 +1484,8 @@ export {
1452
1484
  WS_MAX_MESSAGES_PER_SOCKET,
1453
1485
  WS_MAX_MESSAGE_BYTES,
1454
1486
  applyGuideTranslations,
1487
+ articleHref,
1488
+ articleIdFromHref,
1455
1489
  articleTextEntries,
1456
1490
  assignGuideVariant,
1457
1491
  baseLanguage,
@@ -1498,6 +1532,7 @@ export {
1498
1532
  isRuleGroup,
1499
1533
  isSafeMediaUrl,
1500
1534
  isVideoContentType,
1535
+ isVideoFileUrl,
1501
1536
  localeName,
1502
1537
  localizeAnnouncement,
1503
1538
  localizeArticle,
@@ -1532,6 +1567,7 @@ export {
1532
1567
  queryConditionRegex,
1533
1568
  randomId,
1534
1569
  readableTextOn,
1570
+ recordingLevel,
1535
1571
  relativeLuminance,
1536
1572
  resolveCaptureSettings,
1537
1573
  resolveLocale,
@@ -1552,6 +1588,7 @@ export {
1552
1588
  slugify,
1553
1589
  snapshotFromSelector,
1554
1590
  stableStringify,
1591
+ stepVideo,
1555
1592
  stripOrigin,
1556
1593
  supportsPlatform,
1557
1594
  templateConfig,
@@ -1563,12 +1600,14 @@ export {
1563
1600
  validateGuideConfig,
1564
1601
  variantProblems,
1565
1602
  variantRanges,
1603
+ videoThumbnailUrl,
1566
1604
  visibleAnnouncements,
1567
1605
  visibleArticleIds,
1568
1606
  visibleButtons,
1569
1607
  visitorAudiences,
1570
1608
  visitorLocales,
1571
1609
  withExperimentBucket,
1610
+ withRecordingLevel,
1572
1611
  withVisibility
1573
1612
  };
1574
1613
  //# sourceMappingURL=index.js.map