@guidelytech/shared 0.2.1 → 0.4.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/index.cjs CHANGED
@@ -21,8 +21,10 @@ 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
+ AUTOCAPTURE_EVENTS: () => AUTOCAPTURE_EVENTS,
24
25
  AppearanceSchema: () => AppearanceSchema,
25
26
  AuthoringPickSchema: () => AuthoringPickSchema,
27
+ AutocaptureSettingsSchema: () => AutocaptureSettingsSchema,
26
28
  BUTTON_ACTIONS: () => BUTTON_ACTIONS,
27
29
  ButtonSchema: () => ButtonSchema,
28
30
  ChecklistConfigSchema: () => ChecklistConfigSchema,
@@ -30,32 +32,48 @@ __export(index_exports, {
30
32
  ChecklistTaskSchema: () => ChecklistTaskSchema,
31
33
  ConversationLookupSchema: () => ConversationLookupSchema,
32
34
  ConversationRatingSchema: () => ConversationRatingSchema,
35
+ DEFAULT_CAPTURE_SETTINGS: () => DEFAULT_CAPTURE_SETTINGS,
36
+ DEFAULT_PLATFORMS: () => DEFAULT_PLATFORMS,
33
37
  EVENT_NAMES: () => EVENT_NAMES,
38
+ ErrorTrackingSettingsSchema: () => ErrorTrackingSettingsSchema,
34
39
  EventBatchSchema: () => EventBatchSchema,
35
40
  FrequencySchema: () => FrequencySchema,
41
+ GUIDELY_ID_ATTRIBUTE: () => GUIDELY_ID_ATTRIBUTE,
36
42
  GUIDE_KINDS: () => GUIDE_KINDS,
37
43
  GUIDE_LIFECYCLE_EVENTS: () => GUIDE_LIFECYCLE_EVENTS,
38
44
  GUIDE_STATUSES: () => GUIDE_STATUSES,
39
45
  GUIDE_TEMPLATES: () => GUIDE_TEMPLATES,
40
46
  GuideConfigSchema: () => GuideConfigSchema,
41
47
  GuideStateUpdateSchema: () => GuideStateUpdateSchema,
48
+ HEATMAP_VIEWPORTS: () => HEATMAP_VIEWPORTS,
42
49
  IdentifyRequestSchema: () => IdentifyRequestSchema,
43
50
  MAX_MESSAGE_LENGTH: () => MAX_MESSAGE_LENGTH,
44
51
  MAX_PROPERTY_BYTES: () => MAX_PROPERTY_BYTES,
52
+ MAX_STACK_FRAMES: () => MAX_STACK_FRAMES,
45
53
  MESSAGE_AUTHORS: () => MESSAGE_AUTHORS,
54
+ NETWORK_PLUGIN: () => NETWORK_PLUGIN,
46
55
  PLACEMENTS: () => PLACEMENTS,
56
+ PLATFORMS: () => PLATFORMS,
47
57
  PostMessageSchema: () => PostMessageSchema,
48
58
  ProjectThemeSchema: () => ProjectThemeSchema,
49
59
  PublishedGuideSchema: () => PublishedGuideSchema,
60
+ REPLAY_MAX_COMPRESSED_BYTES: () => REPLAY_MAX_COMPRESSED_BYTES,
61
+ REPLAY_MAX_RAW_BYTES: () => REPLAY_MAX_RAW_BYTES,
50
62
  RULE_FIELDS: () => RULE_FIELDS,
51
63
  RULE_OPERATORS: () => RULE_OPERATORS,
64
+ ReplayChunkSchema: () => ReplayChunkSchema,
65
+ ReplaySettingsSchema: () => ReplaySettingsSchema,
52
66
  RuleGroupSchema: () => RuleGroupSchema,
53
67
  RuleSchema: () => RuleSchema,
54
68
  SDK_API_VERSION: () => SDK_API_VERSION,
55
69
  SELECTOR_KINDS: () => SELECTOR_KINDS,
70
+ SENSITIVE_HEADER_PATTERN: () => SENSITIVE_HEADER_PATTERN,
71
+ SENSITIVE_PARAM_PATTERN: () => SENSITIVE_PARAM_PATTERN,
56
72
  SENSITIVE_PROPERTY_PATTERN: () => SENSITIVE_PROPERTY_PATTERN,
57
73
  SERVER_ASSISTED_FIELDS: () => SERVER_ASSISTED_FIELDS,
58
74
  SHARED_VERSION: () => SHARED_VERSION,
75
+ SOURCEMAP_MAX_FILES_PER_UPLOAD: () => SOURCEMAP_MAX_FILES_PER_UPLOAD,
76
+ SOURCEMAP_MAX_FILE_BYTES: () => SOURCEMAP_MAX_FILE_BYTES,
59
77
  STEP_TYPES: () => STEP_TYPES,
60
78
  SURVEY_QUESTION_TYPES: () => SURVEY_QUESTION_TYPES,
61
79
  SdkEventSchema: () => SdkEventSchema,
@@ -69,25 +87,39 @@ __export(index_exports, {
69
87
  TRIGGER_TYPES: () => TRIGGER_TYPES,
70
88
  TargetSchema: () => TargetSchema,
71
89
  TriggerSchema: () => TriggerSchema,
90
+ WS_MAX_MESSAGES_PER_SOCKET: () => WS_MAX_MESSAGES_PER_SOCKET,
91
+ WS_MAX_MESSAGE_BYTES: () => WS_MAX_MESSAGE_BYTES,
72
92
  clamp: () => clamp,
73
93
  compare: () => compare,
94
+ compareVersions: () => compareVersions,
74
95
  defaultGuideConfig: () => defaultGuideConfig,
75
96
  defaultStep: () => defaultStep,
76
97
  describeRule: () => describeRule,
77
98
  emptyRuleGroup: () => emptyRuleGroup,
78
99
  evaluateRule: () => evaluateRule,
79
100
  evaluateRules: () => evaluateRules,
101
+ fingerprintError: () => fingerprintError,
80
102
  fnv1a: () => fnv1a,
81
103
  getPath: () => getPath,
104
+ guidePlatforms: () => guidePlatforms,
105
+ guidelyIdFromSelector: () => guidelyIdFromSelector,
106
+ isChecklistComplete: () => isChecklistComplete,
82
107
  isPlainObject: () => isPlainObject,
108
+ isQuestionVisible: () => isQuestionVisible,
83
109
  isRuleGroup: () => isRuleGroup,
84
110
  matchUrlPattern: () => matchUrlPattern,
111
+ normalizeErrorMessage: () => normalizeErrorMessage,
112
+ normalizeFrameFile: () => normalizeFrameFile,
113
+ parseStack: () => parseStack,
85
114
  randomId: () => randomId,
115
+ resolveCaptureSettings: () => resolveCaptureSettings,
86
116
  rolloutBucket: () => rolloutBucket,
87
117
  safeRegExp: () => safeRegExp,
88
118
  sanitizeProperties: () => sanitizeProperties,
119
+ screenPath: () => screenPath,
89
120
  slugify: () => slugify,
90
121
  stripOrigin: () => stripOrigin,
122
+ supportsPlatform: () => supportsPlatform,
91
123
  templateConfig: () => templateConfig,
92
124
  validateGuideConfig: () => validateGuideConfig,
93
125
  visibleButtons: () => visibleButtons
@@ -163,6 +195,78 @@ function safeRegExp(source, flags = "i") {
163
195
  }
164
196
  }
165
197
 
198
+ // src/platform.ts
199
+ var PLATFORMS = ["web", "ios", "android"];
200
+ var DEFAULT_PLATFORMS = ["web"];
201
+ function guidePlatforms(config) {
202
+ return Array.isArray(config.platforms) ? [...config.platforms] : [...DEFAULT_PLATFORMS];
203
+ }
204
+ function supportsPlatform(config, platform) {
205
+ return guidePlatforms(config).includes(platform);
206
+ }
207
+ var GUIDELY_ID_ATTRIBUTE = "data-guidely-id";
208
+ function guidelyIdFromSelector(value) {
209
+ const v = (value ?? "").trim();
210
+ if (!v) return null;
211
+ if (/^[A-Za-z0-9_][A-Za-z0-9_\-:.]*$/.test(v)) return v;
212
+ const hash = v.match(/^#([A-Za-z0-9_][A-Za-z0-9_\-:.]*)$/);
213
+ if (hash) return hash[1];
214
+ const attr = v.match(/^(?:[a-z][a-z0-9]*)?\[\s*data-(?:guidely-id|testid|tour)\s*=\s*(["']?)([^"'\]]+)\1\s*\]$/i);
215
+ if (attr) return attr[2].trim();
216
+ return null;
217
+ }
218
+ function screenPath(screen) {
219
+ const s = (screen ?? "").trim();
220
+ if (!s) return "/";
221
+ return s.startsWith("/") ? s : `/${s}`;
222
+ }
223
+ function compareVersions(a, b) {
224
+ const sa = a == null ? "" : String(a).trim().replace(/^v/i, "");
225
+ const sb = b == null ? "" : String(b).trim().replace(/^v/i, "");
226
+ if (!sa || !sb) return null;
227
+ const pa = sa.split(/[.+-]/);
228
+ const pb = sb.split(/[.+-]/);
229
+ const n = Math.max(pa.length, pb.length);
230
+ for (let i = 0; i < n; i++) {
231
+ const x = pa[i] ?? "0";
232
+ const y = pb[i] ?? "0";
233
+ const nx = /^\d+$/.test(x) ? Number(x) : NaN;
234
+ const ny = /^\d+$/.test(y) ? Number(y) : NaN;
235
+ if (!Number.isNaN(nx) && !Number.isNaN(ny)) {
236
+ if (nx !== ny) return nx < ny ? -1 : 1;
237
+ } else if (x !== y) {
238
+ return x < y ? -1 : 1;
239
+ }
240
+ }
241
+ return 0;
242
+ }
243
+
244
+ // src/widgets.ts
245
+ function isQuestionVisible(q, answers) {
246
+ if (!q.showWhen) return true;
247
+ const actual = answers[q.showWhen.questionId];
248
+ if (actual === void 0) return false;
249
+ const expected = q.showWhen.value;
250
+ switch (q.showWhen.op) {
251
+ case "equals":
252
+ return Array.isArray(actual) ? actual.includes(String(expected)) : String(actual) === String(expected);
253
+ case "lte":
254
+ return Number(actual) <= Number(expected);
255
+ case "gte":
256
+ return Number(actual) >= Number(expected);
257
+ case "in": {
258
+ const list = Array.isArray(expected) ? expected : [String(expected)];
259
+ return Array.isArray(actual) ? actual.some((a) => list.includes(a)) : list.includes(String(actual));
260
+ }
261
+ default:
262
+ return false;
263
+ }
264
+ }
265
+ function isChecklistComplete(config, progress) {
266
+ const done = new Set(progress.completedTaskIds);
267
+ return config.tasks.filter((t) => t.required).every((t) => done.has(t.id));
268
+ }
269
+
166
270
  // src/targeting.ts
167
271
  var import_zod = require("zod");
168
272
 
@@ -212,7 +316,10 @@ var RULE_FIELDS = [
212
316
  "datetime.hour",
213
317
  "rollout.percentage",
214
318
  "environment",
215
- "locale"
319
+ "locale",
320
+ "app.platform",
321
+ "app.screen",
322
+ "app.version"
216
323
  ];
217
324
  function isRuleGroup(r) {
218
325
  return r.rules !== void 0;
@@ -274,6 +381,12 @@ function resolveField(rule, ctx) {
274
381
  return ctx.environment;
275
382
  case "locale":
276
383
  return ctx.locale;
384
+ case "app.platform":
385
+ return ctx.platform ?? "web";
386
+ case "app.screen":
387
+ return ctx.screen;
388
+ case "app.version":
389
+ return ctx.appVersion;
277
390
  default:
278
391
  return void 0;
279
392
  }
@@ -353,11 +466,15 @@ function compare(op, actual, expected) {
353
466
  }
354
467
  function evaluateRule(rule, ctx) {
355
468
  let result;
356
- if (rule.field === "url.path" || rule.field === "url.full") {
469
+ if (rule.field === "url.path" || rule.field === "url.full" || rule.field === "app.screen") {
357
470
  const actual = String(resolveField(rule, ctx) ?? "");
358
471
  if (rule.op === "equals") result = matchUrlPattern(String(rule.value ?? ""), actual);
359
472
  else if (rule.op === "not_equals") result = !matchUrlPattern(String(rule.value ?? ""), actual);
360
473
  else result = compare(rule.op, actual, rule.value);
474
+ } else if (rule.field === "app.version" && ["equals", "not_equals", "gt", "gte", "lt", "lte"].includes(rule.op)) {
475
+ const c = compareVersions(resolveField(rule, ctx), rule.value);
476
+ if (c === null) result = rule.op === "not_equals";
477
+ else result = rule.op === "equals" ? c === 0 : rule.op === "not_equals" ? c !== 0 : rule.op === "gt" ? c > 0 : rule.op === "gte" ? c >= 0 : rule.op === "lt" ? c < 0 : c <= 0;
361
478
  } else {
362
479
  result = compare(rule.op, resolveField(rule, ctx), rule.value);
363
480
  }
@@ -400,7 +517,7 @@ var GUIDE_KINDS = ["flow", "modal", "tooltip", "banner", "checklist", "survey",
400
517
  var GUIDE_STATUSES = ["draft", "published", "paused", "archived"];
401
518
  var STEP_TYPES = ["modal", "tooltip", "popover", "spotlight", "hotspot", "banner", "slideout", "checklist", "custom", "survey"];
402
519
  var PLACEMENTS = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "auto"];
403
- var SELECTOR_KINDS = ["css", "id", "data-attr", "aria", "text", "xpath"];
520
+ var SELECTOR_KINDS = ["css", "id", "data-attr", "aria", "text", "xpath", "guidely-id"];
404
521
  var SelectorStrategySchema = import_zod2.z.object({
405
522
  kind: import_zod2.z.enum(SELECTOR_KINDS),
406
523
  value: import_zod2.z.string().min(1).max(1e3),
@@ -559,8 +676,10 @@ var GuideConfigSchema = import_zod2.z.object({
559
676
  appearance: AppearanceSchema.default({}),
560
677
  checklist: ChecklistConfigSchema.optional(),
561
678
  survey: SurveyConfigSchema.optional(),
562
- /** Restrict guide to url pattern(s) (applied before trigger). */
563
- urlPatterns: import_zod2.z.array(import_zod2.z.string().max(500)).max(20).default([])
679
+ /** Restrict guide to url pattern(s) (applied before trigger). On mobile these match the screen path `/<Screen>`. */
680
+ urlPatterns: import_zod2.z.array(import_zod2.z.string().max(500)).max(20).default([]),
681
+ /** Platforms that receive this guide. Guides created before mobile support are web-only. */
682
+ platforms: import_zod2.z.array(import_zod2.z.enum(PLATFORMS)).max(PLATFORMS.length).default(["web"])
564
683
  });
565
684
  function defaultGuideConfig(kind) {
566
685
  return GuideConfigSchema.parse({
@@ -606,12 +725,17 @@ function validateGuideConfig(kind, config) {
606
725
  } else {
607
726
  if (config.steps.length === 0) issues.push({ level: "error", message: "Add at least one step." });
608
727
  }
728
+ if (config.platforms.length === 0) issues.push({ level: "error", message: "Choose at least one platform (web, iOS or Android)." });
729
+ const mobile = config.platforms.some((p) => p !== "web");
609
730
  const ids = /* @__PURE__ */ new Set();
610
731
  config.steps.forEach((step, i) => {
611
732
  if (ids.has(step.id)) issues.push({ level: "error", stepId: step.id, message: `Duplicate step id "${step.id}".` });
612
733
  ids.add(step.id);
613
734
  const anchored = ["tooltip", "popover", "spotlight", "hotspot"].includes(step.type);
614
735
  if (anchored && (!step.target || step.target.selectors.length === 0)) issues.push({ level: "error", stepId: step.id, message: `Step ${i + 1} (${step.type}) needs a target element.` });
736
+ if (mobile && anchored && step.target && step.target.selectors.length > 0 && !step.target.selectors.some((s) => s.kind === "guidely-id" || s.kind === "id"))
737
+ issues.push({ level: "warning", stepId: step.id, message: `Step ${i + 1} has no Guidely id or element id target, so mobile apps cannot find its element.` });
738
+ if (mobile && step.type === "custom") issues.push({ level: "warning", stepId: step.id, message: `Step ${i + 1} is a custom HTML step; mobile apps show it as a plain modal.` });
615
739
  if (!step.title && !step.body && step.type !== "custom") issues.push({ level: "warning", stepId: step.id, message: `Step ${i + 1} has no title or body.` });
616
740
  if (step.buttons.length === 0 && step.advanceOn === "button" && step.type !== "hotspot" && step.type !== "custom") issues.push({ level: "warning", stepId: step.id, message: `Step ${i + 1} has no buttons and advances on button; users can only close it.` });
617
741
  step.buttons.forEach((b) => {
@@ -659,6 +783,47 @@ function sanitizeProperties(props) {
659
783
  return out;
660
784
  }
661
785
 
786
+ // src/errors.ts
787
+ var MAX_STACK_FRAMES = 30;
788
+ var V8 = /^\s*at (?:(.+?) \()?((?:[a-z][\w+.-]*:)?[^\s()]+?):(\d+):(\d+)\)?\s*$/i;
789
+ var GECKO = /^\s*(.*?)@(.+?):(\d+):(\d+)\s*$/;
790
+ function parseStack(stack, max = MAX_STACK_FRAMES) {
791
+ if (!stack || typeof stack !== "string") return [];
792
+ const frames = [];
793
+ for (const raw of stack.split("\n")) {
794
+ if (frames.length >= max) break;
795
+ const line = raw.slice(0, 1e3);
796
+ const m = V8.exec(line) ?? GECKO.exec(line);
797
+ if (!m) continue;
798
+ const fn = (m[1] || "").trim();
799
+ frames.push({ fn: fn ? fn.slice(0, 200) : void 0, file: m[2]?.slice(0, 500), line: Number(m[3]), col: Number(m[4]) });
800
+ }
801
+ return frames;
802
+ }
803
+ function normalizeErrorMessage(message) {
804
+ return (message || "").slice(0, 500).replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, "<uuid>").replace(/(["'`]).*?\1/g, "<str>").replace(/\b0x[0-9a-f]+\b/gi, "<hex>").replace(/\d+(\.\d+)?/g, "<n>").replace(/\s+/g, " ").trim();
805
+ }
806
+ function normalizeFrameFile(file) {
807
+ if (!file) return "";
808
+ let path = file;
809
+ try {
810
+ path = new URL(file).pathname;
811
+ } catch {
812
+ path = file.replace(/[?#].*$/, "");
813
+ }
814
+ return path.replace(/[.-][0-9a-f]{6,}(?=\.\w+$)/i, "").replace(/\/\d+\//g, "/<n>/");
815
+ }
816
+ var SOURCEMAP_MAX_FILE_BYTES = 25 * 1024 * 1024;
817
+ var SOURCEMAP_MAX_FILES_PER_UPLOAD = 200;
818
+ function fingerprintError(input) {
819
+ const top = (input.frames ?? []).find((f) => f.file);
820
+ const frameKey = input.original ? `src:${input.original.source}:${input.original.name || "?"}` : top ? `${normalizeFrameFile(top.file)}:${top.fn || "?"}` : "";
821
+ const key = [input.type || "Error", normalizeErrorMessage(input.message || ""), frameKey].join("|");
822
+ const a = fnv1a(key).toString(16).padStart(8, "0");
823
+ const b = fnv1a(`guidely:${key}`).toString(16).padStart(8, "0");
824
+ return a + b;
825
+ }
826
+
662
827
  // src/events.ts
663
828
  var EVENT_NAMES = [
664
829
  "guide_viewed",
@@ -683,8 +848,15 @@ var EVENT_NAMES = [
683
848
  "scout_answered",
684
849
  "custom",
685
850
  "page_view",
686
- "identify"
851
+ "identify",
852
+ // Product analytics (autocapture + error tracking)
853
+ "page_leave",
854
+ "click",
855
+ "rage_click",
856
+ "exception",
857
+ "heatmap"
687
858
  ];
859
+ var AUTOCAPTURE_EVENTS = ["page_view", "page_leave", "click", "rage_click", "exception", "heatmap"];
688
860
  var GUIDE_LIFECYCLE_EVENTS = ["guide_viewed", "guide_started", "step_viewed", "step_completed", "guide_completed", "guide_skipped", "guide_dismissed", "guide_abandoned"];
689
861
  var SdkEventSchema = import_zod3.z.object({
690
862
  eventId: import_zod3.z.string().min(8).max(64),
@@ -784,6 +956,62 @@ var ConversationRatingSchema = import_zod5.z.object({
784
956
  comment: import_zod5.z.string().max(1e3).optional()
785
957
  });
786
958
 
959
+ // src/capture.ts
960
+ var import_zod6 = require("zod");
961
+ var AutocaptureSettingsSchema = import_zod6.z.object({ pageviews: import_zod6.z.boolean(), pageLeave: import_zod6.z.boolean(), clicks: import_zod6.z.boolean(), rageClicks: import_zod6.z.boolean(), heatmaps: import_zod6.z.boolean(), mouseMovement: import_zod6.z.boolean() }).partial();
962
+ var ErrorTrackingSettingsSchema = import_zod6.z.object({ enabled: import_zod6.z.boolean() }).partial();
963
+ var ReplaySettingsSchema = import_zod6.z.object({
964
+ enabled: import_zod6.z.boolean(),
965
+ sampleRate: import_zod6.z.number().int().min(0).max(100),
966
+ recordConsole: import_zod6.z.boolean(),
967
+ recordNetwork: import_zod6.z.boolean(),
968
+ recordNetworkPayloads: import_zod6.z.boolean(),
969
+ maskAllText: import_zod6.z.boolean(),
970
+ blockSelectors: import_zod6.z.array(import_zod6.z.string().min(1).max(200)).max(50),
971
+ retentionDays: import_zod6.z.number().int().min(1).max(365)
972
+ }).partial();
973
+ var DEFAULT_CAPTURE_SETTINGS = {
974
+ autocapture: { pageviews: true, pageLeave: true, clicks: true, rageClicks: true, heatmaps: true, mouseMovement: true },
975
+ errorTracking: { enabled: true },
976
+ replay: { enabled: false, sampleRate: 100, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false, maskAllText: false, blockSelectors: [], retentionDays: 30 }
977
+ };
978
+ function resolveCaptureSettings(settings) {
979
+ const s = settings && typeof settings === "object" ? settings : {};
980
+ const obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
981
+ const d = DEFAULT_CAPTURE_SETTINGS;
982
+ const a = AutocaptureSettingsSchema.safeParse(obj(s.autocapture));
983
+ const e = ErrorTrackingSettingsSchema.safeParse(obj(s.errorTracking));
984
+ const r = ReplaySettingsSchema.safeParse(obj(s.replay));
985
+ return {
986
+ autocapture: { ...d.autocapture, ...a.success ? a.data : {} },
987
+ errorTracking: { ...d.errorTracking, ...e.success ? e.data : {} },
988
+ replay: { ...d.replay, ...r.success ? r.data : {} }
989
+ };
990
+ }
991
+ var HEATMAP_VIEWPORTS = { mobile: [0, 767], tablet: [768, 1279], desktop: [1280, 1e5] };
992
+ var ReplayChunkSchema = import_zod6.z.object({
993
+ sessionId: import_zod6.z.string().min(1).max(128),
994
+ windowId: import_zod6.z.string().min(1).max(64),
995
+ seq: import_zod6.z.number().int().min(0).max(1e6),
996
+ anonymousId: import_zod6.z.string().min(1).max(128),
997
+ userId: import_zod6.z.string().max(256).optional().nullable(),
998
+ /** rrweb `eventWithTime` objects, in order. */
999
+ events: import_zod6.z.array(import_zod6.z.object({ type: import_zod6.z.number().int(), timestamp: import_zod6.z.number() }).passthrough()).min(1).max(5e4),
1000
+ url: import_zod6.z.string().max(2e3).optional(),
1001
+ device: import_zod6.z.object({ type: import_zod6.z.string().max(20), browser: import_zod6.z.string().max(40).optional(), os: import_zod6.z.string().max(40).optional() }).optional(),
1002
+ viewport: import_zod6.z.object({ width: import_zod6.z.number().int().min(0).max(1e5), height: import_zod6.z.number().int().min(0).max(1e5) }).optional(),
1003
+ sdk: import_zod6.z.object({ name: import_zod6.z.string().max(60), version: import_zod6.z.string().max(30) }).optional()
1004
+ });
1005
+ var REPLAY_MAX_COMPRESSED_BYTES = 2 * 1024 * 1024;
1006
+ var REPLAY_MAX_RAW_BYTES = 16 * 1024 * 1024;
1007
+
1008
+ // src/network.ts
1009
+ var NETWORK_PLUGIN = "guidely/network@1";
1010
+ var WS_MAX_MESSAGES_PER_SOCKET = 200;
1011
+ var WS_MAX_MESSAGE_BYTES = 2048;
1012
+ var SENSITIVE_HEADER_PATTERN = /^(authorization|proxy-authorization|cookie|set-cookie|x-api-key|x-auth-token|x-csrf-token|x-xsrf-token|x-guidely-key|x-guidely-conversation)$/i;
1013
+ var SENSITIVE_PARAM_PATTERN = /(token|key|secret|password|passwd|pwd|auth|session|code|sig|signature|credential|ssn|card|cvv|iban)/i;
1014
+
787
1015
  // src/templates.ts
788
1016
  var nav = (opts = {}) => [
789
1017
  ...opts.first ? [] : [{ id: "back", label: "Back", action: "back", variant: "ghost" }],
@@ -964,12 +1192,14 @@ function templateConfig(id) {
964
1192
 
965
1193
  // src/index.ts
966
1194
  var SDK_API_VERSION = "v1";
967
- var SHARED_VERSION = "0.2.1";
1195
+ var SHARED_VERSION = "0.4.1";
968
1196
  // Annotate the CommonJS export names for ESM import in node:
969
1197
  0 && (module.exports = {
970
1198
  ADVANCE_ON,
1199
+ AUTOCAPTURE_EVENTS,
971
1200
  AppearanceSchema,
972
1201
  AuthoringPickSchema,
1202
+ AutocaptureSettingsSchema,
973
1203
  BUTTON_ACTIONS,
974
1204
  ButtonSchema,
975
1205
  ChecklistConfigSchema,
@@ -977,32 +1207,48 @@ var SHARED_VERSION = "0.2.1";
977
1207
  ChecklistTaskSchema,
978
1208
  ConversationLookupSchema,
979
1209
  ConversationRatingSchema,
1210
+ DEFAULT_CAPTURE_SETTINGS,
1211
+ DEFAULT_PLATFORMS,
980
1212
  EVENT_NAMES,
1213
+ ErrorTrackingSettingsSchema,
981
1214
  EventBatchSchema,
982
1215
  FrequencySchema,
1216
+ GUIDELY_ID_ATTRIBUTE,
983
1217
  GUIDE_KINDS,
984
1218
  GUIDE_LIFECYCLE_EVENTS,
985
1219
  GUIDE_STATUSES,
986
1220
  GUIDE_TEMPLATES,
987
1221
  GuideConfigSchema,
988
1222
  GuideStateUpdateSchema,
1223
+ HEATMAP_VIEWPORTS,
989
1224
  IdentifyRequestSchema,
990
1225
  MAX_MESSAGE_LENGTH,
991
1226
  MAX_PROPERTY_BYTES,
1227
+ MAX_STACK_FRAMES,
992
1228
  MESSAGE_AUTHORS,
1229
+ NETWORK_PLUGIN,
993
1230
  PLACEMENTS,
1231
+ PLATFORMS,
994
1232
  PostMessageSchema,
995
1233
  ProjectThemeSchema,
996
1234
  PublishedGuideSchema,
1235
+ REPLAY_MAX_COMPRESSED_BYTES,
1236
+ REPLAY_MAX_RAW_BYTES,
997
1237
  RULE_FIELDS,
998
1238
  RULE_OPERATORS,
1239
+ ReplayChunkSchema,
1240
+ ReplaySettingsSchema,
999
1241
  RuleGroupSchema,
1000
1242
  RuleSchema,
1001
1243
  SDK_API_VERSION,
1002
1244
  SELECTOR_KINDS,
1245
+ SENSITIVE_HEADER_PATTERN,
1246
+ SENSITIVE_PARAM_PATTERN,
1003
1247
  SENSITIVE_PROPERTY_PATTERN,
1004
1248
  SERVER_ASSISTED_FIELDS,
1005
1249
  SHARED_VERSION,
1250
+ SOURCEMAP_MAX_FILES_PER_UPLOAD,
1251
+ SOURCEMAP_MAX_FILE_BYTES,
1006
1252
  STEP_TYPES,
1007
1253
  SURVEY_QUESTION_TYPES,
1008
1254
  SdkEventSchema,
@@ -1016,25 +1262,39 @@ var SHARED_VERSION = "0.2.1";
1016
1262
  TRIGGER_TYPES,
1017
1263
  TargetSchema,
1018
1264
  TriggerSchema,
1265
+ WS_MAX_MESSAGES_PER_SOCKET,
1266
+ WS_MAX_MESSAGE_BYTES,
1019
1267
  clamp,
1020
1268
  compare,
1269
+ compareVersions,
1021
1270
  defaultGuideConfig,
1022
1271
  defaultStep,
1023
1272
  describeRule,
1024
1273
  emptyRuleGroup,
1025
1274
  evaluateRule,
1026
1275
  evaluateRules,
1276
+ fingerprintError,
1027
1277
  fnv1a,
1028
1278
  getPath,
1279
+ guidePlatforms,
1280
+ guidelyIdFromSelector,
1281
+ isChecklistComplete,
1029
1282
  isPlainObject,
1283
+ isQuestionVisible,
1030
1284
  isRuleGroup,
1031
1285
  matchUrlPattern,
1286
+ normalizeErrorMessage,
1287
+ normalizeFrameFile,
1288
+ parseStack,
1032
1289
  randomId,
1290
+ resolveCaptureSettings,
1033
1291
  rolloutBucket,
1034
1292
  safeRegExp,
1035
1293
  sanitizeProperties,
1294
+ screenPath,
1036
1295
  slugify,
1037
1296
  stripOrigin,
1297
+ supportsPlatform,
1038
1298
  templateConfig,
1039
1299
  validateGuideConfig,
1040
1300
  visibleButtons