@guidelytech/shared 0.15.0 → 0.17.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,
@@ -28,6 +29,10 @@ import {
28
29
  GUIDE_EXPERIMENT_STATUSES,
29
30
  GUIDE_VISIBILITIES,
30
31
  LOGGED_IN_AUDIENCE,
32
+ MAX_APP_VERSION_LENGTH,
33
+ MAX_BREADCRUMBS,
34
+ MAX_BUG_REPORT_LENGTH,
35
+ MAX_BUG_REPORT_SCREENSHOT_BYTES,
31
36
  MAX_COLLECTION_DEPTH,
32
37
  MAX_COMPLAINT_ANSWER_LENGTH,
33
38
  MAX_COMPLAINT_ATTACHMENT_BYTES,
@@ -35,6 +40,13 @@ import {
35
40
  MAX_COMPLAINT_FIELDS,
36
41
  MAX_COMPLAINT_LENGTH,
37
42
  MAX_CUSTOM_CSS,
43
+ MAX_DEBUG_IMAGES,
44
+ MAX_DETAIL_FRAMES,
45
+ MAX_DETAIL_THREADS,
46
+ MAX_ERROR_TAGS,
47
+ MAX_EXCEPTION_CHAIN,
48
+ MAX_EXCEPTION_DETAIL_BYTES,
49
+ MAX_EXCEPTION_DETAIL_RAW_BYTES,
38
50
  MAX_PROPERTY_BYTES,
39
51
  MAX_STACK_FRAMES,
40
52
  MEDIA_FILE_MAX_BYTES,
@@ -75,6 +87,8 @@ import {
75
87
  WS_MAX_MESSAGES_PER_SOCKET,
76
88
  WS_MAX_MESSAGE_BYTES,
77
89
  applyGuideTranslations,
90
+ articleHref,
91
+ articleIdFromHref,
78
92
  articleTextEntries,
79
93
  assignGuideVariant,
80
94
  baseLanguage,
@@ -86,8 +100,10 @@ import {
86
100
  contrastIssues,
87
101
  contrastRatio,
88
102
  cssSelectorError,
103
+ customFingerprint,
89
104
  describeRule,
90
105
  emptyRuleGroup,
106
+ errorFilterDrops,
91
107
  evaluateRule,
92
108
  evaluateRules,
93
109
  evenWeights,
@@ -116,6 +132,7 @@ import {
116
132
  isRuleGroup,
117
133
  isSafeMediaUrl,
118
134
  isVideoContentType,
135
+ isVideoFileUrl,
119
136
  localeName,
120
137
  localizeAnnouncement,
121
138
  localizeArticle,
@@ -128,10 +145,12 @@ import {
128
145
  mediaKind,
129
146
  mediaMaxBytes,
130
147
  needsReview,
148
+ normalizeAppVersion,
131
149
  normalizeErrorMessage,
132
150
  normalizeFrameFile,
133
151
  normalizeLocale,
134
152
  normalizeSnapshot,
153
+ normalizeTags,
135
154
  orderedModules,
136
155
  pageLabel,
137
156
  pagePattern,
@@ -145,6 +164,7 @@ import {
145
164
  propertyAttributeAllowed,
146
165
  queryConditionRegex,
147
166
  randomId,
167
+ reactNativeBundleUrl,
148
168
  readableTextOn,
149
169
  relativeLuminance,
150
170
  resolveLocale,
@@ -164,20 +184,23 @@ import {
164
184
  slugify,
165
185
  snapshotFromSelector,
166
186
  stableStringify,
187
+ stepVideo,
167
188
  stripOrigin,
168
189
  supportsPlatform,
169
190
  toEmbedUrl,
170
191
  translationCoverage,
192
+ trimExceptionDetail,
171
193
  unreadAnnouncements,
172
194
  variantProblems,
173
195
  variantRanges,
196
+ videoThumbnailUrl,
174
197
  visibleAnnouncements,
175
198
  visibleArticleIds,
176
199
  visitorAudiences,
177
200
  visitorLocales,
178
201
  withExperimentBucket,
179
202
  withVisibility
180
- } from "./chunk-XJXXVV3C.js";
203
+ } from "./chunk-YL65O3FS.js";
181
204
 
182
205
  // src/targeting.ts
183
206
  import { z } from "zod";
@@ -250,6 +273,11 @@ var StepSchema = z2.object({
250
273
  imageUrl: z2.string().url().max(2e3).optional().or(z2.literal("")),
251
274
  /** Alternative text for `imageUrl` (screen readers); empty = decorative. */
252
275
  imageAlt: z2.string().max(300).optional(),
276
+ /**
277
+ * Video (YouTube, Vimeo, Loom, a file…): drawn as a poster with a play button that opens the video
278
+ * in a new tab. The poster is `imageUrl` when set, else the provider's thumbnail.
279
+ */
280
+ videoUrl: z2.string().url().max(2e3).optional().or(z2.literal("")),
253
281
  buttons: z2.array(ButtonSchema).max(6).default([]),
254
282
  target: TargetSchema.optional(),
255
283
  placement: z2.enum(PLACEMENTS).default("auto"),
@@ -395,9 +423,9 @@ var GuideConfigSchema = z2.object({
395
423
  /** Everyone, only identified (logged-in) users, or only anonymous visitors; applied on top of `targeting`. */
396
424
  visibility: z2.enum(GUIDE_VISIBILITIES).default("everyone"),
397
425
  targeting: RuleGroupSchema.default(() => emptyRuleGroup()),
398
- trigger: TriggerSchema.default({}),
399
- frequency: FrequencySchema.default({}),
400
- appearance: AppearanceSchema.default({}),
426
+ trigger: TriggerSchema.prefault({}),
427
+ frequency: FrequencySchema.prefault({}),
428
+ appearance: AppearanceSchema.prefault({}),
401
429
  checklist: ChecklistConfigSchema.optional(),
402
430
  survey: SurveyConfigSchema.optional(),
403
431
  /** Restrict guide to url pattern(s) (applied before trigger). On mobile these match the screen path `/<Screen>`. */
@@ -512,6 +540,8 @@ var EVENT_NAMES = [
512
540
  "guide_skipped",
513
541
  "guide_dismissed",
514
542
  "guide_abandoned",
543
+ /** The video on a guide step was clicked (opened in a new tab). Properties: videoUrl. */
544
+ "guide_video_clicked",
515
545
  "checklist_task_completed",
516
546
  "checklist_completed",
517
547
  "checklist_dismissed",
@@ -544,6 +574,14 @@ var EVENT_NAMES = [
544
574
  var AUTOCAPTURE_EVENTS = ["page_view", "page_leave", "click", "rage_click", "exception", "heatmap", "app_install", "app_update", "app_open", "app_background"];
545
575
  var APP_LIFECYCLE_EVENTS = ["app_install", "app_update", "app_open", "app_background"];
546
576
  var GUIDE_LIFECYCLE_EVENTS = ["guide_viewed", "guide_started", "step_viewed", "step_completed", "guide_completed", "guide_skipped", "guide_dismissed", "guide_abandoned"];
577
+ var ExceptionDetailField = z3.preprocess((v) => {
578
+ if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
579
+ try {
580
+ return JSON.stringify(v).length > MAX_EXCEPTION_DETAIL_RAW_BYTES ? void 0 : v;
581
+ } catch {
582
+ return void 0;
583
+ }
584
+ }, z3.record(z3.string(), z3.unknown()).optional());
547
585
  var SdkEventSchema = z3.object({
548
586
  eventId: z3.string().min(8).max(64),
549
587
  name: z3.enum(EVENT_NAMES),
@@ -559,7 +597,19 @@ var SdkEventSchema = z3.object({
559
597
  stepId: z3.string().max(64).optional(),
560
598
  stepIndex: z3.number().int().min(0).optional(),
561
599
  url: z3.string().max(2e3).optional(),
562
- properties: z3.record(z3.unknown()).optional()
600
+ /**
601
+ * Version of the customer's app when the event happened (`appVersion` SDK option, auto-detected on
602
+ * mobile). Stored per event so reports can filter and break down by version; see `normalizeAppVersion`.
603
+ */
604
+ appVersion: z3.string().max(200).optional().nullable(),
605
+ properties: z3.record(z3.string(), z3.unknown()).optional(),
606
+ /**
607
+ * `exception` events only: breadcrumbs, contexts, tags, extra, the exception chain, threads and
608
+ * debug images in the Sentry event shape (`ExceptionDetail`, docs/error-monitoring/sdks.md), outside
609
+ * the 8 KB property budget. The server trims it to 64 KB and stores it in ErrorEventDetail; one over
610
+ * 1 MB (or that isn't an object) is dropped without failing the batch.
611
+ */
612
+ detail: ExceptionDetailField
563
613
  });
564
614
  var EventBatchSchema = z3.object({
565
615
  events: z3.array(SdkEventSchema).min(1).max(50),
@@ -572,8 +622,8 @@ import { z as z4 } from "zod";
572
622
  var IdentifyRequestSchema = z4.object({
573
623
  anonymousId: z4.string().min(1).max(128),
574
624
  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(),
625
+ traits: z4.record(z4.string(), z4.unknown()).optional(),
626
+ account: z4.object({ id: z4.string().min(1).max(256), traits: z4.record(z4.string(), z4.unknown()).optional() }).optional().nullable(),
577
627
  sessionId: z4.string().max(128).optional(),
578
628
  url: z4.string().max(2e3).optional()
579
629
  });
@@ -590,7 +640,7 @@ var SurveyResponseRequestSchema = z4.object({
590
640
  userId: z4.string().max(256).optional().nullable(),
591
641
  accountId: z4.string().max(256).optional().nullable(),
592
642
  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)])),
643
+ answers: z4.record(z4.string(), z4.union([z4.string().max(5e3), z4.number(), z4.boolean(), z4.array(z4.string().max(500)).max(50)])),
594
644
  responseId: z4.string().min(8).max(64)
595
645
  });
596
646
  var GuideStateUpdateSchema = z4.object({
@@ -612,7 +662,7 @@ var AuthoringPickSchema = z4.object({
612
662
  url: z4.string().max(2e3).optional(),
613
663
  rect: z4.object({ x: z4.number(), y: z4.number(), width: z4.number(), height: z4.number() }).optional(),
614
664
  /** Compact snapshot of the picked element (tag mode: feature rules are proposed from it). */
615
- elementSnapshot: z4.record(z4.unknown()).optional()
665
+ elementSnapshot: z4.record(z4.string(), z4.unknown()).optional()
616
666
  });
617
667
  var PublishedGuideSchema = z4.object({
618
668
  id: z4.string(),
@@ -677,15 +727,38 @@ var FileComplaintSchema = z6.object({
677
727
  }).optional().nullable()
678
728
  });
679
729
 
680
- // src/agents.ts
730
+ // src/bug-reports.ts
681
731
  import { z as z7 } from "zod";
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()
732
+ var BugReportSchema = z7.object({
733
+ anonymousId: z7.string().min(1).max(128),
734
+ userId: z7.string().max(256).optional().nullable(),
735
+ sessionId: z7.string().max(128).optional().nullable(),
736
+ message: z7.string().trim().min(1).max(MAX_BUG_REPORT_LENGTH),
737
+ email: z7.string().trim().toLowerCase().email().max(254).optional().nullable(),
738
+ name: z7.string().trim().max(200).optional().nullable(),
739
+ /** The exception event the report is about (the SDK sends the page's last error unless told otherwise). */
740
+ associatedEventId: z7.string().trim().max(64).optional().nullable(),
741
+ url: z7.string().max(2e3).optional().nullable(),
742
+ appVersion: z7.string().max(200).optional().nullable(),
743
+ /** widget (the built-in dialog) or api (captureFeedback). */
744
+ source: z7.enum(["widget", "api"]).default("api"),
745
+ tags: z7.record(z7.string().max(64), z7.string().max(200)).optional(),
746
+ sdk: z7.object({ name: z7.string().max(60), version: z7.string().max(30) }).optional(),
747
+ screenshot: z7.object({
748
+ fileName: z7.string().trim().min(1).max(200),
749
+ data: z7.string().max(Math.ceil(MAX_BUG_REPORT_SCREENSHOT_BYTES * 4 / 3) + 64)
750
+ }).optional().nullable()
751
+ });
752
+
753
+ // src/agents.ts
754
+ import { z as z8 } from "zod";
755
+ var EnvironmentKey = z8.string().trim().regex(/^[a-z][a-z0-9-]{0,29}$/, "environment: use an environment key such as production");
756
+ var AgentToolCallSchema = z8.object({
757
+ name: z8.string().trim().min(1).max(100),
758
+ status: z8.enum(AGENT_TOOL_STATUSES).optional(),
759
+ latencyMs: z8.number().int().min(0).max(36e5).optional()
687
760
  }).strip();
688
- var AgentMetadataSchema = z7.record(z7.string().max(100), z7.unknown()).transform((m) => {
761
+ var AgentMetadataSchema = z8.record(z8.string().max(100), z8.unknown()).transform((m) => {
689
762
  const out = {};
690
763
  let size = 0;
691
764
  for (const [k, v] of Object.entries(m)) {
@@ -699,31 +772,31 @@ var AgentMetadataSchema = z7.record(z7.string().max(100), z7.unknown()).transfor
699
772
  }
700
773
  return out;
701
774
  });
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(),
775
+ var id = (max) => z8.string().trim().min(1).max(max);
776
+ var optionalId = (max) => z8.string().trim().max(max).optional().nullable().transform((v) => v || null);
777
+ var AgentTurnInputSchema = z8.object({
778
+ type: z8.literal("agent.conversation").optional(),
706
779
  conversationId: id(128),
707
780
  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(),
781
+ agentName: z8.string().trim().max(100).optional(),
782
+ turnId: z8.string().trim().min(1).max(128).optional(),
783
+ role: z8.enum(AGENT_TURN_ROLES),
784
+ text: z8.string().max(AGENT_TURN_MAX_TEXT).default(""),
785
+ toolCalls: z8.array(AgentToolCallSchema).max(AGENT_TOOL_CALLS_PER_TURN).default([]),
786
+ latencyMs: z8.number().int().min(0).max(36e5).optional(),
787
+ outcome: z8.enum(AGENT_OUTCOMES).optional(),
788
+ taskSuccess: z8.boolean().optional(),
789
+ occurredAt: z8.string().datetime({ offset: true }).optional(),
717
790
  userId: optionalId(256),
718
791
  anonymousId: optionalId(128),
719
792
  accountId: optionalId(256),
720
793
  sessionId: optionalId(128),
721
794
  metadata: AgentMetadataSchema.default({})
722
795
  });
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(
796
+ var turns = z8.array(AgentTurnInputSchema).min(1).max(AGENT_TURNS_PER_BATCH);
797
+ var sdkInfo = z8.object({ name: z8.string().max(60), version: z8.string().max(30) }).optional();
798
+ var SdkAgentEventsSchema = z8.object({ turns, sdk: sdkInfo });
799
+ var AgentEventsRequestSchema = z8.preprocess(
727
800
  (v) => {
728
801
  if (Array.isArray(v)) return { turns: v };
729
802
  if (v && typeof v === "object" && !("turns" in v)) {
@@ -732,11 +805,11 @@ var AgentEventsRequestSchema = z7.preprocess(
732
805
  }
733
806
  return v;
734
807
  },
735
- z7.object({ turns, environment: z7.enum(ENVIRONMENTS).default("production"), sdk: sdkInfo })
808
+ z8.object({ turns, environment: EnvironmentKey.default("production"), sdk: sdkInfo })
736
809
  );
737
810
 
738
811
  // src/feedback.ts
739
- import { z as z8 } from "zod";
812
+ import { z as z9 } from "zod";
740
813
 
741
814
  // src/feedback-limits.ts
742
815
  var FEEDBACK_STATUSES = ["new", "under_review", "planned", "in_progress", "released", "declined"];
@@ -760,60 +833,79 @@ var feedbackReference = (number) => `#${number}`;
760
833
 
761
834
  // src/feedback.ts
762
835
  var visitor = {
763
- anonymousId: z8.string().min(1).max(128),
764
- userId: z8.string().max(256).optional().nullable()
836
+ anonymousId: z9.string().min(1).max(128),
837
+ userId: z9.string().max(256).optional().nullable()
765
838
  };
766
- var FeedbackListRequestSchema = z8.object({
839
+ var FeedbackListRequestSchema = z9.object({
767
840
  ...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(),
841
+ q: z9.string().trim().max(200).optional(),
842
+ sort: z9.enum(["top", "new", "trending"]).default("top"),
843
+ status: z9.enum(FEEDBACK_STATUSES).optional(),
771
844
  /** "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)
845
+ filter: z9.enum(["open", "all", "mine", "following"]).default("open"),
846
+ productArea: z9.string().trim().max(60).optional(),
847
+ page: z9.number().int().min(1).max(100).default(1)
775
848
  });
776
- var FeedbackVisitorSchema = z8.object(visitor);
777
- var SubmitFeedbackSchema = z8.object({
849
+ var FeedbackVisitorSchema = z9.object(visitor);
850
+ var SubmitFeedbackSchema = z9.object({
778
851
  ...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"),
852
+ title: z9.string().trim().min(3, "Give your idea a short title").max(MAX_FEEDBACK_TITLE),
853
+ description: z9.string().trim().max(MAX_FEEDBACK_DESCRIPTION).default(""),
854
+ productArea: z9.string().trim().max(60).optional().nullable(),
855
+ priority: z9.enum(FEEDBACK_PRIORITIES).default("nice_to_have"),
783
856
  /** 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()
857
+ conversationId: z9.string().min(1).max(64).optional().nullable(),
858
+ pageUrl: z9.string().max(2e3).optional()
786
859
  });
787
- var FeedbackVoteSchema = z8.object({
860
+ var FeedbackVoteSchema = z9.object({
788
861
  ...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()
862
+ priority: z9.enum(FEEDBACK_PRIORITIES).default("nice_to_have"),
863
+ note: z9.string().trim().max(MAX_FEEDBACK_NOTE).optional(),
864
+ conversationId: z9.string().min(1).max(64).optional().nullable()
792
865
  });
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() });
866
+ var FeedbackFollowSchema = z9.object({ ...visitor, follow: z9.boolean() });
867
+ var FeedbackCommentSchema = z9.object({ ...visitor, body: z9.string().trim().min(1).max(MAX_FEEDBACK_COMMENT) });
868
+ var FeedbackSimilarSchema = z9.object({ ...visitor, title: z9.string().trim().min(3).max(MAX_FEEDBACK_TITLE) });
869
+ var FeedbackUpdatesReadSchema = z9.object({ ...visitor, ids: z9.array(z9.string().min(1).max(64)).max(100).optional() });
797
870
 
798
871
  // 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)
872
+ import { z as z10 } from "zod";
873
+ var AutocaptureSettingsSchema = z10.object({ pageviews: z10.boolean(), pageLeave: z10.boolean(), clicks: z10.boolean(), rageClicks: z10.boolean(), heatmaps: z10.boolean(), mouseMovement: z10.boolean(), appLifecycle: z10.boolean() }).partial();
874
+ var ErrorTrackingSettingsSchema = z10.object({ enabled: z10.boolean() }).partial();
875
+ var PerformanceSettingsSchema = z10.object({ enabled: z10.boolean(), sampleRate: z10.number().min(0).max(100) }).partial();
876
+ var ReplaySettingsSchema = z10.object({
877
+ enabled: z10.boolean(),
878
+ sampleRate: z10.number().int().min(0).max(100),
879
+ recordConsole: z10.boolean(),
880
+ recordNetwork: z10.boolean(),
881
+ recordNetworkPayloads: z10.boolean(),
882
+ maskAllText: z10.boolean(),
883
+ blockSelectors: z10.array(z10.string().min(1).max(200)).max(50),
884
+ retentionDays: z10.number().int().min(1).max(365)
811
885
  }).partial();
812
886
  var DEFAULT_CAPTURE_SETTINGS = {
813
887
  autocapture: { pageviews: true, pageLeave: true, clicks: true, rageClicks: true, heatmaps: true, mouseMovement: true, appLifecycle: true },
814
888
  errorTracking: { enabled: true },
889
+ performance: { enabled: false, sampleRate: 100 },
815
890
  replay: { enabled: false, sampleRate: 100, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false, maskAllText: false, blockSelectors: [], retentionDays: 30 }
816
891
  };
892
+ var RECORDING_LEVELS = ["off", "privacy", "standard", "full"];
893
+ var RECORDING_PRESETS = {
894
+ privacy: { maskAllText: true, recordConsole: false, recordNetwork: false, recordNetworkPayloads: false },
895
+ standard: { maskAllText: false, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false },
896
+ full: { maskAllText: false, recordConsole: true, recordNetwork: true, recordNetworkPayloads: true }
897
+ };
898
+ function recordingLevel(replay) {
899
+ if (!replay.enabled) return "off";
900
+ for (const level of ["privacy", "standard", "full"]) {
901
+ const preset = RECORDING_PRESETS[level];
902
+ if (Object.keys(preset).every((k) => replay[k] === preset[k])) return level;
903
+ }
904
+ return "custom";
905
+ }
906
+ function withRecordingLevel(replay, level) {
907
+ return level === "off" ? { ...replay, enabled: false } : { ...replay, ...RECORDING_PRESETS[level], enabled: true };
908
+ }
817
909
  function resolveCaptureSettings(settings) {
818
910
  const s = settings && typeof settings === "object" ? settings : {};
819
911
  const obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
@@ -821,25 +913,29 @@ function resolveCaptureSettings(settings) {
821
913
  const a = AutocaptureSettingsSchema.safeParse(obj(s.autocapture));
822
914
  const e = ErrorTrackingSettingsSchema.safeParse(obj(s.errorTracking));
823
915
  const r = ReplaySettingsSchema.safeParse(obj(s.replay));
916
+ const p = PerformanceSettingsSchema.safeParse(obj(s.performance));
824
917
  return {
825
918
  autocapture: { ...d.autocapture, ...a.success ? a.data : {} },
826
919
  errorTracking: { ...d.errorTracking, ...e.success ? e.data : {} },
827
- replay: { ...d.replay, ...r.success ? r.data : {} }
920
+ replay: { ...d.replay, ...r.success ? r.data : {} },
921
+ performance: { ...d.performance, ...p.success ? p.data : {} }
828
922
  };
829
923
  }
830
924
  var HEATMAP_VIEWPORTS = { mobile: [0, 767], tablet: [768, 1279], desktop: [1280, 1e5] };
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(),
925
+ var ReplayChunkSchema = z10.object({
926
+ sessionId: z10.string().min(1).max(128),
927
+ windowId: z10.string().min(1).max(64),
928
+ seq: z10.number().int().min(0).max(1e6),
929
+ anonymousId: z10.string().min(1).max(128),
930
+ userId: z10.string().max(256).optional().nullable(),
837
931
  /** rrweb `eventWithTime` objects, in order. */
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()
932
+ events: z10.array(z10.object({ type: z10.number().int(), timestamp: z10.number() }).passthrough()).min(1).max(5e4),
933
+ url: z10.string().max(2e3).optional(),
934
+ device: z10.object({ type: z10.string().max(20), browser: z10.string().max(40).optional(), os: z10.string().max(40).optional() }).optional(),
935
+ viewport: z10.object({ width: z10.number().int().min(0).max(1e5), height: z10.number().int().min(0).max(1e5) }).optional(),
936
+ sdk: z10.object({ name: z10.string().max(60), version: z10.string().max(30) }).optional(),
937
+ /** The app's version (`appVersion` SDK option); recordings can be filtered by it. */
938
+ appVersion: z10.string().max(200).optional()
843
939
  });
844
940
  var REPLAY_MAX_COMPRESSED_BYTES = 2 * 1024 * 1024;
845
941
  var REPLAY_MAX_RAW_BYTES = 16 * 1024 * 1024;
@@ -1023,39 +1119,39 @@ function templateConfig(id2) {
1023
1119
  }
1024
1120
 
1025
1121
  // src/howto.ts
1026
- import { z as z10 } from "zod";
1122
+ import { z as z11 } from "zod";
1027
1123
  var HOWTO_STEP_KINDS = ["action", "text", "heading", "tip", "alert"];
1028
1124
  var HOWTO_ACTIONS = ["click", "type", "select", "navigate"];
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)
1125
+ var NormalizedRectSchema = z11.object({
1126
+ x: z11.number().min(0).max(1),
1127
+ y: z11.number().min(0).max(1),
1128
+ width: z11.number().min(0).max(1),
1129
+ height: z11.number().min(0).max(1)
1034
1130
  });
1035
- var CapturedElementSchema = z10.object({
1131
+ var CapturedElementSchema = z11.object({
1036
1132
  /** Visible name: aria-label, associated label, text, placeholder, alt or title. */
1037
- label: z10.string().max(200).default(""),
1133
+ label: z11.string().max(200).default(""),
1038
1134
  /** button, link, tab, menuitem, checkbox, radio, field, dropdown, option, element… */
1039
- role: z10.string().max(40).default("element"),
1040
- tag: z10.string().max(40).default("")
1135
+ role: z11.string().max(40).default("element"),
1136
+ tag: z11.string().max(40).default("")
1041
1137
  });
1042
- var CaptureStepSchema = z10.object({
1138
+ var CaptureStepSchema = z11.object({
1043
1139
  /** Random id from the SDK; a retried upload with the same id is stored once. */
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(""),
1140
+ clientId: z11.string().min(1).max(64),
1141
+ action: z11.enum(HOWTO_ACTIONS),
1142
+ url: z11.string().max(2e3),
1143
+ pageTitle: z11.string().max(300).default(""),
1048
1144
  element: CapturedElementSchema.optional(),
1049
1145
  /** Typed text or chosen option; absent when it was sensitive (`valueRedacted`). */
1050
- value: z10.string().max(200).optional(),
1051
- valueRedacted: z10.boolean().default(false),
1146
+ value: z11.string().max(200).optional(),
1147
+ valueRedacted: z11.boolean().default(false),
1052
1148
  /** Selectors for the element, so the step can later become an interactive tour step. */
1053
- selectors: z10.array(SelectorStrategySchema).max(10).default([]),
1149
+ selectors: z11.array(SelectorStrategySchema).max(10).default([]),
1054
1150
  /** Where the element sits in the screenshot. */
1055
1151
  highlight: NormalizedRectSchema.optional(),
1056
1152
  /** Number of regions the SDK blurred in the screenshot before upload. */
1057
- redactions: z10.number().int().min(0).max(1e3).default(0),
1058
- occurredAt: z10.string().datetime().optional()
1153
+ redactions: z11.number().int().min(0).max(1e3).default(0),
1154
+ occurredAt: z11.string().datetime().optional()
1059
1155
  });
1060
1156
  function quoted(s) {
1061
1157
  const t = (s ?? "").replace(/\s+/g, " ").trim();
@@ -1126,12 +1222,12 @@ function hostAndPath(url) {
1126
1222
  return url.slice(0, 80);
1127
1223
  }
1128
1224
  }
1129
- var NormalizedPointSchema = z10.object({ x: z10.number().min(0).max(1), y: z10.number().min(0).max(1) });
1225
+ var NormalizedPointSchema = z11.object({ x: z11.number().min(0).max(1), y: z11.number().min(0).max(1) });
1130
1226
  var ANNOTATION_COLORS = ["brand", "red", "amber", "green", "black", "white"];
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") })
1227
+ var HowToAnnotationSchema = z11.discriminatedUnion("type", [
1228
+ z11.object({ id: z11.string().min(1).max(32), type: z11.literal("arrow"), from: NormalizedPointSchema, to: NormalizedPointSchema, color: z11.enum(ANNOTATION_COLORS).default("brand") }),
1229
+ z11.object({ id: z11.string().min(1).max(32), type: z11.literal("text"), at: NormalizedPointSchema, text: z11.string().trim().min(1).max(120), color: z11.enum(ANNOTATION_COLORS).default("brand") }),
1230
+ z11.object({ id: z11.string().min(1).max(32), type: z11.literal("box"), rect: NormalizedRectSchema, color: z11.enum(ANNOTATION_COLORS).default("brand") })
1135
1231
  ]);
1136
1232
  var MAX_ANNOTATIONS = 30;
1137
1233
 
@@ -1159,6 +1255,16 @@ var SCRIPT_STUB_METHODS = [
1159
1255
  "openComplaint",
1160
1256
  "openIdeas",
1161
1257
  "captureException",
1258
+ "captureFeedback",
1259
+ "showBugReport",
1260
+ "captureMessage",
1261
+ "addBreadcrumb",
1262
+ "setTag",
1263
+ "setTags",
1264
+ "setExtra",
1265
+ "setExtras",
1266
+ "setContext",
1267
+ "setUser",
1162
1268
  "agentConversation",
1163
1269
  "trackAgentTurn",
1164
1270
  "on"
@@ -1276,7 +1382,7 @@ function parseTranslationCsv(text) {
1276
1382
 
1277
1383
  // src/index.ts
1278
1384
  var SDK_API_VERSION = "v1";
1279
- var SHARED_VERSION = "0.15.0";
1385
+ var SHARED_VERSION = "0.17.0";
1280
1386
  export {
1281
1387
  ADVANCE_ON,
1282
1388
  AGENT_METADATA_MAX_BYTES,
@@ -1289,6 +1395,7 @@ export {
1289
1395
  AGENT_TURN_ROLES,
1290
1396
  ANNOTATION_COLORS,
1291
1397
  APP_LIFECYCLE_EVENTS,
1398
+ ARTICLE_HREF_PREFIX,
1292
1399
  ARTICLE_VISIBILITIES,
1293
1400
  AUTOCAPTURE_EVENTS,
1294
1401
  AgentEventsRequestSchema,
@@ -1299,6 +1406,7 @@ export {
1299
1406
  AuthoringPickSchema,
1300
1407
  AutocaptureSettingsSchema,
1301
1408
  BUTTON_ACTIONS,
1409
+ BugReportSchema,
1302
1410
  ButtonSchema,
1303
1411
  CAPTURE_PARAM,
1304
1412
  CAPTURE_SCREENSHOT_MAX_BYTES,
@@ -1364,6 +1472,10 @@ export {
1364
1472
  LocaleSchema,
1365
1473
  LocalizationSettingsSchema,
1366
1474
  MAX_ANNOTATIONS,
1475
+ MAX_APP_VERSION_LENGTH,
1476
+ MAX_BREADCRUMBS,
1477
+ MAX_BUG_REPORT_LENGTH,
1478
+ MAX_BUG_REPORT_SCREENSHOT_BYTES,
1367
1479
  MAX_COLLECTION_DEPTH,
1368
1480
  MAX_COMPLAINT_ANSWER_LENGTH,
1369
1481
  MAX_COMPLAINT_ATTACHMENT_BYTES,
@@ -1371,6 +1483,13 @@ export {
1371
1483
  MAX_COMPLAINT_FIELDS,
1372
1484
  MAX_COMPLAINT_LENGTH,
1373
1485
  MAX_CUSTOM_CSS,
1486
+ MAX_DEBUG_IMAGES,
1487
+ MAX_DETAIL_FRAMES,
1488
+ MAX_DETAIL_THREADS,
1489
+ MAX_ERROR_TAGS,
1490
+ MAX_EXCEPTION_CHAIN,
1491
+ MAX_EXCEPTION_DETAIL_BYTES,
1492
+ MAX_EXCEPTION_DETAIL_RAW_BYTES,
1374
1493
  MAX_FEEDBACK_COMMENT,
1375
1494
  MAX_FEEDBACK_DESCRIPTION,
1376
1495
  MAX_FEEDBACK_NOTE,
@@ -1398,11 +1517,13 @@ export {
1398
1517
  PDF_PAGES_CLASS,
1399
1518
  PLACEMENTS,
1400
1519
  PLATFORMS,
1520
+ PerformanceSettingsSchema,
1401
1521
  PostMessageSchema,
1402
1522
  ProjectThemeSchema,
1403
1523
  PublishedGuideSchema,
1404
1524
  RC_MODULE_IDS,
1405
1525
  RC_MODULE_LABELS,
1526
+ RECORDING_LEVELS,
1406
1527
  REPLAY_MAX_COMPRESSED_BYTES,
1407
1528
  REPLAY_MAX_RAW_BYTES,
1408
1529
  REPLY_TIMES,
@@ -1452,6 +1573,8 @@ export {
1452
1573
  WS_MAX_MESSAGES_PER_SOCKET,
1453
1574
  WS_MAX_MESSAGE_BYTES,
1454
1575
  applyGuideTranslations,
1576
+ articleHref,
1577
+ articleIdFromHref,
1455
1578
  articleTextEntries,
1456
1579
  assignGuideVariant,
1457
1580
  baseLanguage,
@@ -1464,11 +1587,13 @@ export {
1464
1587
  contrastIssues,
1465
1588
  contrastRatio,
1466
1589
  cssSelectorError,
1590
+ customFingerprint,
1467
1591
  defaultGuideConfig,
1468
1592
  defaultStep,
1469
1593
  describeCaptureStep,
1470
1594
  describeRule,
1471
1595
  emptyRuleGroup,
1596
+ errorFilterDrops,
1472
1597
  evaluateRule,
1473
1598
  evaluateRules,
1474
1599
  evenWeights,
@@ -1498,6 +1623,7 @@ export {
1498
1623
  isRuleGroup,
1499
1624
  isSafeMediaUrl,
1500
1625
  isVideoContentType,
1626
+ isVideoFileUrl,
1501
1627
  localeName,
1502
1628
  localizeAnnouncement,
1503
1629
  localizeArticle,
@@ -1510,10 +1636,12 @@ export {
1510
1636
  mediaKind,
1511
1637
  mediaMaxBytes,
1512
1638
  needsReview,
1639
+ normalizeAppVersion,
1513
1640
  normalizeErrorMessage,
1514
1641
  normalizeFrameFile,
1515
1642
  normalizeLocale,
1516
1643
  normalizeSnapshot,
1644
+ normalizeTags,
1517
1645
  orderedModules,
1518
1646
  pageLabel,
1519
1647
  pageName,
@@ -1531,7 +1659,9 @@ export {
1531
1659
  propertyAttributeAllowed,
1532
1660
  queryConditionRegex,
1533
1661
  randomId,
1662
+ reactNativeBundleUrl,
1534
1663
  readableTextOn,
1664
+ recordingLevel,
1535
1665
  relativeLuminance,
1536
1666
  resolveCaptureSettings,
1537
1667
  resolveLocale,
@@ -1552,6 +1682,7 @@ export {
1552
1682
  slugify,
1553
1683
  snapshotFromSelector,
1554
1684
  stableStringify,
1685
+ stepVideo,
1555
1686
  stripOrigin,
1556
1687
  supportsPlatform,
1557
1688
  templateConfig,
@@ -1559,16 +1690,19 @@ export {
1559
1690
  toTranslationCsv,
1560
1691
  toXliff,
1561
1692
  translationCoverage,
1693
+ trimExceptionDetail,
1562
1694
  unreadAnnouncements,
1563
1695
  validateGuideConfig,
1564
1696
  variantProblems,
1565
1697
  variantRanges,
1698
+ videoThumbnailUrl,
1566
1699
  visibleAnnouncements,
1567
1700
  visibleArticleIds,
1568
1701
  visibleButtons,
1569
1702
  visitorAudiences,
1570
1703
  visitorLocales,
1571
1704
  withExperimentBucket,
1705
+ withRecordingLevel,
1572
1706
  withVisibility
1573
1707
  };
1574
1708
  //# sourceMappingURL=index.js.map