@guidelytech/shared 0.5.0 → 0.6.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/{chunk-5IQVBZO6.js → chunk-OLWGMDRX.js} +71 -4
- package/dist/chunk-OLWGMDRX.js.map +1 -0
- package/dist/index.cjs +244 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +457 -7
- package/dist/index.d.ts +457 -7
- package/dist/index.js +175 -3
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +85 -2
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +56 -3
- package/dist/runtime.d.ts +56 -3
- package/dist/runtime.js +33 -1
- package/package.json +1 -1
- package/dist/chunk-5IQVBZO6.js.map +0 -1
- package/dist/chunk-QUKMOTT4.js +0 -477
- package/dist/chunk-QUKMOTT4.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/targeting.ts","../src/guide.ts","../src/events.ts","../src/sdk-api.ts","../src/messenger.ts","../src/capture.ts","../src/templates.ts","../src/index.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { RULE_FIELDS, RULE_OPERATORS, type Rule, type RuleGroup } from \"./targeting-eval\";\n\nexport * from \"./targeting-eval\";\n\nexport const RuleSchema: z.ZodType<Rule> = z.object({\n id: z.string().min(1),\n field: z.enum(RULE_FIELDS),\n key: z.string().max(200).optional(),\n op: z.enum(RULE_OPERATORS),\n value: z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]).optional(),\n negate: z.boolean().optional(),\n});\n\nexport const RuleGroupSchema: z.ZodType<RuleGroup> = z.lazy(() =>\n z.object({\n id: z.string().min(1),\n op: z.enum([\"and\", \"or\"]),\n rules: z.array(z.union([RuleSchema, RuleGroupSchema])).max(100),\n negate: z.boolean().optional(),\n }),\n);\n","import { z } from \"zod\";\nimport { PLATFORMS } from \"./platform\";\nimport { RuleGroupSchema, emptyRuleGroup, type RuleGroup } from \"./targeting\";\n\nexport const GUIDE_KINDS = [\"flow\", \"modal\", \"tooltip\", \"banner\", \"checklist\", \"survey\", \"announcement\"] as const;\nexport type GuideKind = (typeof GUIDE_KINDS)[number];\n\nexport const GUIDE_STATUSES = [\"draft\", \"published\", \"paused\", \"archived\"] as const;\nexport type GuideStatus = (typeof GUIDE_STATUSES)[number];\n\nexport const STEP_TYPES = [\"modal\", \"tooltip\", \"popover\", \"spotlight\", \"hotspot\", \"banner\", \"slideout\", \"checklist\", \"custom\", \"survey\"] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n\nexport const PLACEMENTS = [\"top\", \"top-start\", \"top-end\", \"right\", \"right-start\", \"right-end\", \"bottom\", \"bottom-start\", \"bottom-end\", \"left\", \"left-start\", \"left-end\", \"auto\"] as const;\nexport type Placement = (typeof PLACEMENTS)[number];\n\n/** `guidely-id` is cross-platform: `data-guidely-id` on web, `GuidelyTarget` / `guidelyTarget()` on mobile. */\nexport const SELECTOR_KINDS = [\"css\", \"id\", \"data-attr\", \"aria\", \"text\", \"xpath\", \"guidely-id\"] as const;\nexport const SelectorStrategySchema = z.object({\n kind: z.enum(SELECTOR_KINDS),\n value: z.string().min(1).max(1000),\n /** Optional human-readable label captured at pick time. */\n label: z.string().max(200).optional(),\n});\nexport type SelectorStrategy = z.infer<typeof SelectorStrategySchema>;\n\nexport const TargetSchema = z.object({\n /** Ordered strategies; the first one resolving to exactly one element wins. */\n selectors: z.array(SelectorStrategySchema).max(10),\n /** How long to wait for the element before applying fallback. */\n waitMs: z.number().int().min(0).max(60000).default(5000),\n /** What to do when the element never shows up. */\n fallback: z.enum([\"skip\", \"show_as_modal\", \"end_guide\", \"wait\"]).default(\"skip\"),\n /** Scroll the element into view before positioning. */\n scrollIntoView: z.boolean().default(true),\n /** Text snapshot captured at pick time; used for authoring warnings. */\n textSnapshot: z.string().max(200).optional(),\n});\nexport type StepTarget = z.infer<typeof TargetSchema>;\n\nexport const BUTTON_ACTIONS = [\"next\", \"back\", \"dismiss\", \"complete\", \"skip\", \"url\", \"start_guide\", \"event\", \"open_resource_center\", \"none\"] as const;\nexport const ButtonSchema = z.object({\n id: z.string().min(1),\n label: z.string().min(1).max(80),\n action: z.enum(BUTTON_ACTIONS),\n variant: z.enum([\"primary\", \"secondary\", \"ghost\", \"link\"]).default(\"primary\"),\n /** url for `url`, guide id for `start_guide`, event name for `event`, step id for `next` branch override */\n value: z.string().max(2000).optional(),\n newTab: z.boolean().optional(),\n});\nexport type StepButton = z.infer<typeof ButtonSchema>;\n\nexport const StepBranchSchema = z.object({\n id: z.string(),\n /** Rule group evaluated against targeting context when leaving the step. */\n when: RuleGroupSchema,\n /** Step id to jump to. */\n goTo: z.string(),\n});\n\nexport const ADVANCE_ON = [\"button\", \"element_click\", \"element_visible\", \"event\", \"delay\", \"any\"] as const;\n\nexport const StepSchema = z.object({\n id: z.string().min(1).max(64),\n type: z.enum(STEP_TYPES),\n title: z.string().max(200).default(\"\"),\n /** Sanitized HTML body (links, images, lists, formatting). */\n body: z.string().max(20000).default(\"\"),\n imageUrl: z.string().url().max(2000).optional().or(z.literal(\"\")),\n buttons: z.array(ButtonSchema).max(6).default([]),\n target: TargetSchema.optional(),\n placement: z.enum(PLACEMENTS).default(\"auto\"),\n /** Pixel offset between anchor and card. */\n offset: z.number().int().min(0).max(64).default(10),\n showOverlay: z.boolean().default(false),\n showProgress: z.boolean().default(true),\n showClose: z.boolean().default(true),\n dismissOnOutsideClick: z.boolean().default(false),\n /** Highlight padding for spotlight. */\n spotlightPadding: z.number().int().min(0).max(64).default(6),\n /** Banner/slideout position. */\n position: z.enum([\"top\", \"bottom\", \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\", \"center\"]).default(\"bottom-right\"),\n /** URL pattern this step belongs to (for multi-page flows). */\n url: z.string().max(500).optional(),\n /** Automatic advancement. */\n advanceOn: z.enum(ADVANCE_ON).default(\"button\"),\n advanceValue: z.string().max(500).optional(),\n advanceDelayMs: z.number().int().min(0).max(600000).optional(),\n branches: z.array(StepBranchSchema).max(10).default([]),\n width: z.number().int().min(200).max(900).optional(),\n /** Step-level targeting: skip step when rules do not match. */\n targeting: RuleGroupSchema.optional(),\n /** Hotspot pulse dot settings. */\n hotspot: z.object({ size: z.number().int().min(8).max(40).default(14), pulse: z.boolean().default(true), openOn: z.enum([\"click\", \"hover\"]).default(\"click\") }).optional(),\n /** Custom step: arbitrary sanitized HTML with no chrome. */\n customHtml: z.string().max(50000).optional(),\n});\nexport type GuideStep = z.infer<typeof StepSchema>;\nexport type GuideStepInput = z.input<typeof StepSchema>;\n\nexport const TRIGGER_TYPES = [\"page_load\", \"url_match\", \"event\", \"element_click\", \"element_visible\", \"manual\", \"delay\", \"after_guide\", \"segment_enter\"] as const;\nexport const TriggerSchema = z.object({\n type: z.enum(TRIGGER_TYPES).default(\"page_load\"),\n /** url pattern, event name, selector, guide id, audience id depending on type */\n value: z.string().max(1000).optional(),\n delayMs: z.number().int().min(0).max(600000).default(0),\n /** Also require URL to match this pattern (any trigger). */\n urlPattern: z.string().max(500).optional(),\n});\nexport type TriggerConfig = z.infer<typeof TriggerSchema>;\n\nexport const FrequencySchema = z.object({\n mode: z.enum([\"once\", \"once_per_session\", \"every_time\", \"interval\"]).default(\"once\"),\n intervalHours: z.number().int().min(1).max(8760).optional(),\n maxImpressions: z.number().int().min(1).max(1000).optional(),\n /** Hours to wait after dismissal before eligible again (when not `once`). */\n cooldownHours: z.number().int().min(0).max(8760).default(0),\n /** Lower number wins when multiple guides qualify. */\n priority: z.number().int().min(0).max(1000).default(100),\n /** Guide ids that must not be active at the same time. */\n mutuallyExclusiveWith: z.array(z.string()).max(50).default([]),\n /** Re-show if dismissed (otherwise dismissal counts as completion for frequency). */\n reshowAfterDismiss: z.boolean().default(false),\n});\nexport type FrequencyConfig = z.infer<typeof FrequencySchema>;\n\nexport const AppearanceSchema = z.object({\n theme: z.enum([\"light\", \"dark\", \"auto\"]).default(\"auto\"),\n primaryColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n borderRadius: z.number().int().min(0).max(32).optional(),\n fontFamily: z.string().max(200).optional(),\n overlayOpacity: z.number().min(0).max(1).optional(),\n zIndex: z.number().int().min(1).max(2147483647).optional(),\n preset: z.string().max(50).optional(),\n animation: z.enum([\"fade\", \"slide\", \"none\"]).default(\"fade\"),\n});\nexport type Appearance = z.infer<typeof AppearanceSchema>;\n\nexport const ChecklistTaskSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1).max(200),\n description: z.string().max(2000).default(\"\"),\n /** How the task completes. */\n completion: z.enum([\"manual\", \"event\", \"guide_completed\", \"url_visited\", \"click\"]).default(\"manual\"),\n completionValue: z.string().max(500).optional(),\n /** Optional action when clicking the task. */\n action: z.enum([\"none\", \"start_guide\", \"url\", \"event\"]).default(\"none\"),\n actionValue: z.string().max(2000).optional(),\n required: z.boolean().default(true),\n});\nexport type ChecklistTask = z.infer<typeof ChecklistTaskSchema>;\n\nexport const ChecklistConfigSchema = z.object({\n tasks: z.array(ChecklistTaskSchema).min(1).max(30),\n ordered: z.boolean().default(false),\n launcherLabel: z.string().max(60).default(\"Getting started\"),\n position: z.enum([\"bottom-right\", \"bottom-left\"]).default(\"bottom-right\"),\n completionTitle: z.string().max(200).default(\"You're all set!\"),\n completionBody: z.string().max(2000).default(\"\"),\n autoOpen: z.boolean().default(true),\n dismissible: z.boolean().default(true),\n});\nexport type ChecklistConfig = z.infer<typeof ChecklistConfigSchema>;\n\nexport const SURVEY_QUESTION_TYPES = [\"nps\", \"csat\", \"thumbs\", \"single_choice\", \"multiple_choice\", \"text\", \"rating\"] as const;\nexport const SurveyQuestionSchema = z.object({\n id: z.string().min(1),\n type: z.enum(SURVEY_QUESTION_TYPES),\n title: z.string().min(1).max(500),\n description: z.string().max(1000).default(\"\"),\n required: z.boolean().default(true),\n options: z.array(z.object({ id: z.string(), label: z.string().max(200) })).max(20).default([]),\n scaleMax: z.number().int().min(2).max(10).optional(),\n lowLabel: z.string().max(60).optional(),\n highLabel: z.string().max(60).optional(),\n placeholder: z.string().max(200).optional(),\n /** Conditional follow-up: show only when a previous answer matches. */\n showWhen: z.object({ questionId: z.string(), op: z.enum([\"equals\", \"lte\", \"gte\", \"in\"]), value: z.union([z.string(), z.number(), z.array(z.string())]) }).optional(),\n});\nexport type SurveyQuestion = z.infer<typeof SurveyQuestionSchema>;\n\nexport const SurveyConfigSchema = z.object({\n questions: z.array(SurveyQuestionSchema).min(1).max(20),\n thankYouTitle: z.string().max(200).default(\"Thanks for your feedback!\"),\n thankYouBody: z.string().max(2000).default(\"\"),\n position: z.enum([\"bottom-right\", \"bottom-left\", \"center\"]).default(\"bottom-right\"),\n startAt: z.string().datetime().optional(),\n endAt: z.string().datetime().optional(),\n});\nexport type SurveyConfig = z.infer<typeof SurveyConfigSchema>;\n\nexport const GuideConfigSchema = z.object({\n steps: z.array(StepSchema).max(50).default([]),\n targeting: RuleGroupSchema.default(() => emptyRuleGroup()),\n trigger: TriggerSchema.default({}),\n frequency: FrequencySchema.default({}),\n appearance: AppearanceSchema.default({}),\n checklist: ChecklistConfigSchema.optional(),\n survey: SurveyConfigSchema.optional(),\n /** Restrict guide to url pattern(s) (applied before trigger). On mobile these match the screen path `/<Screen>`. */\n urlPatterns: z.array(z.string().max(500)).max(20).default([]),\n /** Platforms that receive this guide. Guides created before mobile support are web-only. */\n platforms: z.array(z.enum(PLATFORMS)).max(PLATFORMS.length).default([\"web\"]),\n});\nexport type GuideConfig = z.infer<typeof GuideConfigSchema>;\nexport type GuideConfigInput = z.input<typeof GuideConfigSchema>;\n\nexport function defaultGuideConfig(kind: GuideKind): GuideConfig {\n return GuideConfigSchema.parse({\n steps: kind === \"checklist\" || kind === \"survey\" ? [] : [defaultStep(kind === \"flow\" ? \"tooltip\" : kind === \"banner\" ? \"banner\" : kind === \"tooltip\" ? \"tooltip\" : \"modal\")],\n checklist: kind === \"checklist\" ? { tasks: [{ id: \"task-1\", title: \"Complete your profile\" }] } : undefined,\n survey: kind === \"survey\" ? { questions: [{ id: \"q1\", type: \"nps\", title: \"How likely are you to recommend us to a friend?\" }] } : undefined,\n trigger: kind === \"checklist\" ? { type: \"page_load\" } : {},\n });\n}\n\nlet stepCounter = 0;\nexport function defaultStep(type: StepType, overrides: Partial<GuideStepInput> = {}): GuideStep {\n stepCounter += 1;\n const base: GuideStepInput = {\n id: `step-${Date.now().toString(36)}-${stepCounter}`,\n type,\n title: type === \"modal\" ? \"Welcome!\" : \"Step title\",\n body: \"<p>Describe what the user should do here.</p>\",\n buttons: [\n { id: \"btn-back\", label: \"Back\", action: \"back\", variant: \"ghost\" },\n { id: \"btn-next\", label: \"Next\", action: \"next\", variant: \"primary\" },\n ],\n placement: type === \"banner\" ? \"top\" : \"auto\",\n showOverlay: type === \"modal\" || type === \"spotlight\",\n ...overrides,\n };\n if ([\"tooltip\", \"popover\", \"spotlight\", \"hotspot\"].includes(type) && !base.target) {\n base.target = { selectors: [], waitMs: 5000, fallback: \"skip\", scrollIntoView: true };\n }\n return StepSchema.parse(base);\n}\n\n/** Buttons to show for a step; \"back\" buttons are hidden when there is no previous step to return to. */\nexport function visibleButtons(step: GuideStep, canGoBack: boolean): GuideStep[\"buttons\"] {\n return canGoBack ? step.buttons : step.buttons.filter((b) => b.action !== \"back\");\n}\n\n/** Validation beyond Zod shape: returns human-readable problems that block publishing. */\nexport interface ValidationIssue {\n level: \"error\" | \"warning\";\n stepId?: string;\n message: string;\n}\nexport function validateGuideConfig(kind: GuideKind, config: GuideConfig): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n if (kind === \"checklist\") {\n if (!config.checklist || config.checklist.tasks.length === 0) issues.push({ level: \"error\", message: \"Checklist needs at least one task.\" });\n } else if (kind === \"survey\") {\n if (!config.survey || config.survey.questions.length === 0) issues.push({ level: \"error\", message: \"Survey needs at least one question.\" });\n config.survey?.questions.forEach((q) => {\n if ((q.type === \"single_choice\" || q.type === \"multiple_choice\") && q.options.length < 2) issues.push({ level: \"error\", message: `Question \"${q.title}\" needs at least two options.` });\n });\n } else {\n if (config.steps.length === 0) issues.push({ level: \"error\", message: \"Add at least one step.\" });\n }\n if (config.platforms.length === 0) issues.push({ level: \"error\", message: \"Choose at least one platform (web, iOS or Android).\" });\n const mobile = config.platforms.some((p) => p !== \"web\");\n const ids = new Set<string>();\n config.steps.forEach((step, i) => {\n if (ids.has(step.id)) issues.push({ level: \"error\", stepId: step.id, message: `Duplicate step id \"${step.id}\".` });\n ids.add(step.id);\n const anchored = [\"tooltip\", \"popover\", \"spotlight\", \"hotspot\"].includes(step.type);\n 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.` });\n if (mobile && anchored && step.target && step.target.selectors.length > 0 && !step.target.selectors.some((s) => s.kind === \"guidely-id\" || s.kind === \"id\"))\n 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.` });\n 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.` });\n if (!step.title && !step.body && step.type !== \"custom\") issues.push({ level: \"warning\", stepId: step.id, message: `Step ${i + 1} has no title or body.` });\n 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.` });\n step.buttons.forEach((b) => {\n if (b.action === \"url\" && !/^https?:\\/\\//i.test(b.value || \"\") && !(b.value || \"\").startsWith(\"/\")) issues.push({ level: \"error\", stepId: step.id, message: `Button \"${b.label}\" needs an http(s) or relative URL.` });\n if (b.action === \"start_guide\" && !b.value) issues.push({ level: \"error\", stepId: step.id, message: `Button \"${b.label}\" needs a guide to start.` });\n });\n step.branches.forEach((br) => {\n if (!ids.has(br.goTo) && !config.steps.some((s) => s.id === br.goTo)) issues.push({ level: \"error\", stepId: step.id, message: `Branch points to unknown step \"${br.goTo}\".` });\n });\n });\n if (config.trigger.type === \"event\" && !config.trigger.value) issues.push({ level: \"error\", message: \"Event trigger needs an event name.\" });\n if (config.trigger.type === \"element_click\" && !config.trigger.value) issues.push({ level: \"error\", message: \"Element click trigger needs a selector.\" });\n if (config.trigger.type === \"url_match\" && !config.trigger.value) issues.push({ level: \"error\", message: \"URL trigger needs a pattern.\" });\n if (config.frequency.mode === \"interval\" && !config.frequency.intervalHours) issues.push({ level: \"error\", message: \"Interval frequency needs an interval in hours.\" });\n return issues;\n}\n\nexport interface ProjectTheme {\n primaryColor: string;\n backgroundColor: string;\n textColor: string;\n borderRadius: number;\n fontFamily: string;\n logoUrl?: string;\n brandName?: string;\n}\nexport const ProjectThemeSchema = z.object({\n primaryColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).default(\"#4f46e5\"),\n backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).default(\"#ffffff\"),\n textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).default(\"#111827\"),\n borderRadius: z.number().int().min(0).max(32).default(12),\n fontFamily: z.string().max(200).default(\"Inter, system-ui, -apple-system, sans-serif\"),\n logoUrl: z.string().max(2000).optional(),\n brandName: z.string().max(100).optional(),\n});\n\nexport type { RuleGroup };\n","import { z } from \"zod\";\n\nexport const EVENT_NAMES = [\n \"guide_viewed\",\n \"guide_started\",\n \"step_viewed\",\n \"step_completed\",\n \"guide_completed\",\n \"guide_skipped\",\n \"guide_dismissed\",\n \"guide_abandoned\",\n \"checklist_task_completed\",\n \"checklist_completed\",\n \"checklist_dismissed\",\n \"survey_displayed\",\n \"survey_submitted\",\n \"survey_dismissed\",\n \"resource_center_opened\",\n \"article_viewed\",\n \"messenger_opened\",\n \"conversation_started\",\n \"conversation_handed_off\",\n \"scout_answered\",\n \"custom\",\n \"page_view\",\n \"identify\",\n // Product analytics (autocapture + error tracking)\n \"page_leave\",\n \"click\",\n \"rage_click\",\n \"exception\",\n \"heatmap\",\n] as const;\nexport type EventName = (typeof EVENT_NAMES)[number];\n\n/** Events the SDK records on its own (page analytics, click autocapture, error tracking). */\nexport const AUTOCAPTURE_EVENTS = [\"page_view\", \"page_leave\", \"click\", \"rage_click\", \"exception\", \"heatmap\"] as const;\n\nexport const GUIDE_LIFECYCLE_EVENTS = [\"guide_viewed\", \"guide_started\", \"step_viewed\", \"step_completed\", \"guide_completed\", \"guide_skipped\", \"guide_dismissed\", \"guide_abandoned\"] as const;\n\n/** Event as produced by the SDK and accepted by POST /api/v1/sdk/events */\nexport const SdkEventSchema = z.object({\n eventId: z.string().min(8).max(64),\n name: z.enum(EVENT_NAMES),\n /** For `custom` events: the application-defined name. */\n customName: z.string().min(1).max(120).optional(),\n occurredAt: z.string().datetime({ offset: true }),\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n accountId: z.string().max(256).optional().nullable(),\n sessionId: z.string().max(128).optional(),\n guideId: z.string().max(64).optional(),\n guideVersion: z.number().int().optional(),\n stepId: z.string().max(64).optional(),\n stepIndex: z.number().int().min(0).optional(),\n url: z.string().max(2000).optional(),\n properties: z.record(z.unknown()).optional(),\n});\nexport type SdkEvent = z.infer<typeof SdkEventSchema>;\n\nexport const EventBatchSchema = z.object({\n events: z.array(SdkEventSchema).min(1).max(50),\n sentAt: z.string().datetime({ offset: true }).optional(),\n sdk: z.object({ name: z.string().max(60), version: z.string().max(30) }).optional(),\n});\nexport type EventBatch = z.infer<typeof EventBatchSchema>;\n\nexport * from \"./events-util\";\nexport * from \"./errors\";\n","import { z } from \"zod\";\nimport { GuideConfigSchema, ProjectThemeSchema, type GuideKind, type GuideConfig } from \"./guide\";\nimport type { MessengerConfig } from \"./messenger\";\nimport type { AutocaptureSettings, ErrorTrackingSettings, ReplaySettings } from \"./capture\";\n\n/** A published guide as delivered to the SDK. Draft-only data (author, notes) is never included. */\nexport interface PublishedGuide {\n id: string;\n key: string;\n name: string;\n kind: GuideKind;\n version: number;\n config: GuideConfig;\n publishedAt: string;\n}\n\nexport interface ResourceCenterArticle {\n id: string;\n slug: string;\n title: string;\n summary: string;\n body: string;\n /** True when `body` was left out of the config to keep it small; fetch it from `GET /sdk/articles/:id`. */\n bodyOmitted?: boolean;\n collectionId?: string | null;\n externalUrl?: string | null;\n /** Listed only for members of any of these audiences (absent = everyone). Not access control. */\n audienceIds?: string[];\n updatedAt: string;\n}\n\nexport interface ResourceCenterCollection {\n id: string;\n name: string;\n description: string;\n order: number;\n /** Parent collection for nested collections (absent/null = top level). */\n parentId?: string | null;\n /** Listed only for members of any of these audiences, with everything inside it (absent = everyone). */\n audienceIds?: string[];\n}\n\nexport interface ResourceCenterConfig {\n enabled: boolean;\n title: string;\n launcher: { position: \"bottom-right\" | \"bottom-left\"; label: string; showIcon: boolean };\n collections: ResourceCenterCollection[];\n articles: ResourceCenterArticle[];\n recommendedGuideIds: string[];\n checklistGuideIds: string[];\n links: Array<{ id: string; label: string; url: string }>;\n faqs: Array<{ id: string; question: string; answer: string }>;\n}\n\nexport interface SdkConfigResponse {\n projectId: string;\n environment: string;\n configVersion: number;\n theme: z.infer<typeof ProjectThemeSchema>;\n guides: PublishedGuide[];\n resourceCenter: ResourceCenterConfig | null;\n /** Scout messenger; absent from servers that predate it. */\n messenger?: MessengerConfig | null;\n settings: {\n analyticsEnabled: boolean;\n collectUrls: boolean;\n maskSelectors: string[];\n sessionTimeoutMinutes: number;\n /** Product analytics; absent from servers that predate it (the SDK then captures nothing extra). */\n autocapture?: AutocaptureSettings;\n errorTracking?: ErrorTrackingSettings;\n /** `retentionDays` is server-side only and not sent. */\n replay?: Omit<ReplaySettings, \"retentionDays\">;\n };\n generatedAt: string;\n}\n\nexport const IdentifyRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().min(1).max(256).optional().nullable(),\n traits: z.record(z.unknown()).optional(),\n account: z\n .object({ id: z.string().min(1).max(256), traits: z.record(z.unknown()).optional() })\n .optional()\n .nullable(),\n sessionId: z.string().max(128).optional(),\n url: z.string().max(2000).optional(),\n});\nexport type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;\n\n/** Server-held state the SDK needs for targeting & frequency. */\nexport interface IdentifyResponse {\n endUserId: string;\n audienceIds: string[];\n guideState: Record<\n string,\n { impressions: number; completedAt?: string | null; dismissedAt?: string | null; lastShownAt?: string | null }\n >;\n checklistProgress: Record<string, { completedTaskIds: string[]; completedAt?: string | null; dismissedAt?: string | null }>;\n surveysSubmitted: string[];\n firstSeenAt: string;\n}\n\nexport const ChecklistProgressRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int().optional(),\n completedTaskIds: z.array(z.string().max(64)).max(100),\n dismissed: z.boolean().optional(),\n completed: z.boolean().optional(),\n});\nexport type ChecklistProgressRequest = z.infer<typeof ChecklistProgressRequestSchema>;\n\nexport const SurveyResponseRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n accountId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int(),\n answers: z.record(z.union([z.string().max(5000), z.number(), z.boolean(), z.array(z.string().max(500)).max(50)])),\n responseId: z.string().min(8).max(64),\n});\nexport type SurveyResponseRequest = z.infer<typeof SurveyResponseRequestSchema>;\n\nexport const GuideStateUpdateSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n updates: z\n .array(\n z.object({\n guideId: z.string(),\n impression: z.boolean().optional(),\n completed: z.boolean().optional(),\n dismissed: z.boolean().optional(),\n }),\n )\n .max(50),\n});\n\nexport const AuthoringPickSchema = z.object({\n stepId: z.string().max(64).optional(),\n selectors: z.array(z.object({ kind: z.string(), value: z.string().max(1000), label: z.string().max(200).optional() })).max(10),\n textSnapshot: z.string().max(200).optional(),\n url: z.string().max(2000).optional(),\n rect: z.object({ x: z.number(), y: z.number(), width: z.number(), height: z.number() }).optional(),\n});\nexport type AuthoringPick = z.infer<typeof AuthoringPickSchema>;\n\n/**\n * Static, script-free copy of the page an authoring session is connected to. The SDK posts it to\n * the dashboard (never to the API) so the editor canvas can show the customer's real app.\n */\nexport interface AppSnapshot {\n /** Full HTML document (doctype included) with scripts and Guidely UI removed and a `<base>` pointing at `url`. */\n html: string;\n url: string;\n title: string;\n /** Viewport the snapshot was taken at, in CSS pixels. */\n width: number;\n height: number;\n capturedAt: string;\n}\n\nexport interface AuthoringSessionInfo {\n id: string;\n projectId: string;\n environment: string;\n guideId: string | null;\n dashboardOrigin: string;\n expiresAt: string;\n /** Draft guide config to preview while authoring (not published). */\n draft: { id: string; key: string; name: string; kind: GuideKind; config: GuideConfig } | null;\n}\n\nexport const PublishedGuideSchema = z.object({\n id: z.string(),\n key: z.string(),\n name: z.string(),\n kind: z.string(),\n version: z.number(),\n config: GuideConfigSchema,\n publishedAt: z.string(),\n});\n\nexport interface ApiError {\n error: { code: string; message: string; details?: unknown };\n}\n","import { z } from \"zod\";\nimport type { ResourceCenterCollection } from \"./sdk-api\";\n\n/** Messenger settings delivered to the SDK in `SdkConfigResponse.messenger`. */\nexport interface MessengerConfig {\n enabled: boolean;\n /** Display name of the AI agent (\"Scout\"). */\n name: string;\n greeting: string;\n /** Scout answers with AI; when false every conversation goes to the team inbox. */\n aiAvailable: boolean;\n handoffEnabled: boolean;\n launcher: { position: \"bottom-right\" | \"bottom-left\" };\n}\n\nexport const MESSAGE_AUTHORS = [\"user\", \"scout\", \"agent\", \"system\"] as const;\nexport type MessageAuthor = (typeof MESSAGE_AUTHORS)[number];\nexport type ConversationStatus = \"bot\" | \"open\" | \"closed\";\n\nexport interface MessengerCitation {\n articleId: string;\n title: string;\n}\n\nexport interface MessengerSuggestedGuide {\n key: string;\n name: string;\n}\n\nexport interface MessengerMessage {\n id: string;\n author: MessageAuthor;\n /** Team member name for `agent` messages. */\n authorName?: string | null;\n body: string;\n citations: MessengerCitation[];\n suggestedGuides: MessengerSuggestedGuide[];\n status: \"pending\" | \"complete\" | \"failed\";\n createdAt: string;\n}\n\nexport interface MessengerConversation {\n id: string;\n status: ConversationStatus;\n subject: string;\n lastMessageAt: string;\n lastMessagePreview: string;\n unread: number;\n rating: number | null;\n}\n\nexport const MAX_MESSAGE_LENGTH = 4000;\nconst messageText = z.string().trim().min(1).max(MAX_MESSAGE_LENGTH);\n\nexport const StartConversationSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n message: messageText,\n pageUrl: z.string().max(2000).optional(),\n});\nexport type StartConversationRequest = z.infer<typeof StartConversationSchema>;\n\nexport interface StartConversationResponse {\n conversation: MessengerConversation;\n /** Secret that authorises this browser to read and post in the conversation. Store it; it is not shown again. */\n token: string;\n messages: MessengerMessage[];\n}\n\nexport const ConversationLookupSchema = z.object({\n tokens: z.array(z.string().min(16).max(128)).max(50),\n});\n\nexport interface ConversationLookupResponse {\n conversations: Array<MessengerConversation & { token: string }>;\n}\n\nexport const PostMessageSchema = z.object({ message: messageText });\n\nexport const ConversationRatingSchema = z.object({\n rating: z.number().int().min(1).max(5),\n comment: z.string().max(1000).optional(),\n});\n\nexport interface ConversationMessagesResponse {\n conversation: MessengerConversation;\n messages: MessengerMessage[];\n}\n\n/**\n * Server-sent events streamed by `POST /sdk/conversations` and `POST /sdk/conversations/:id/messages`\n * while Scout replies. `conversation` (start only) carries the new conversation and its token, `message`\n * each stored message, `delta` reply text as it is generated, and `done` the final stored message.\n */\nexport type ScoutStreamEvent =\n | { event: \"conversation\"; data: StartConversationResponse }\n | { event: \"message\"; data: MessengerMessage }\n | { event: \"delta\"; data: { messageId: string; text: string } }\n | { event: \"done\"; data: { message: MessengerMessage; conversation: MessengerConversation } }\n | { event: \"error\"; data: { message: string } };\n\n/** Article list entry for the messenger Help tab (bodies are fetched on demand). */\nexport interface SdkArticleSummary {\n id: string;\n slug: string;\n title: string;\n summary: string;\n collectionId: string | null;\n externalUrl: string | null;\n /** Listed only for members of these audiences (absent = everyone). */\n audienceIds?: string[];\n updatedAt: string;\n}\n\nexport interface SdkArticlesResponse {\n collections: ResourceCenterCollection[];\n articles: SdkArticleSummary[];\n}\n","import { z } from \"zod\";\n\n/**\n * Product-analytics capture settings. Stored on `Project.settings` (keys `autocapture`,\n * `errorTracking`, `replay`) and delivered to the SDK in `SdkConfigResponse.settings`. The project\n * setting turns a capability on; SDK options can only turn it off for one installation.\n */\nexport interface AutocaptureSettings {\n /** `page_view` on load and on every SPA navigation. */\n pageviews: boolean;\n /** `page_leave` with visible time on page and scroll depth. */\n pageLeave: boolean;\n /** `click` on buttons, links and other interactive elements. */\n clicks: boolean;\n /** `rage_click` when the same spot is clicked 3+ times within a second. */\n rageClicks: boolean;\n /** Batched click positions on every element (`heatmap` events) for click heatmaps. */\n heatmaps: boolean;\n /** Mouse-movement heatmaps: pointer position sampled while it moves, aggregated in the browser into `heatmap` events. */\n mouseMovement: boolean;\n}\n\nexport interface ErrorTrackingSettings {\n /** Uncaught errors and unhandled promise rejections become `exception` events. */\n enabled: boolean;\n}\n\nexport interface ReplaySettings {\n enabled: boolean;\n /** Percentage of sessions recorded (0–100), decided once per session. */\n sampleRate: number;\n /** Record console.log/warn/error output into the recording. */\n recordConsole: boolean;\n /** Record network requests (method, URL with sensitive query values redacted, status, timing, size). */\n recordNetwork: boolean;\n /** Also record request/response headers and text/JSON bodies (redacted, ≤10KB each). Off by default. */\n recordNetworkPayloads: boolean;\n /** Mask every text node (inputs are always masked). */\n maskAllText: boolean;\n /** Elements replaced by a placeholder box in recordings (in addition to `[data-guidely-block]`). */\n blockSelectors: string[];\n /** Days recordings are kept before the worker deletes them. */\n retentionDays: number;\n}\n\nexport interface CaptureSettings {\n autocapture: AutocaptureSettings;\n errorTracking: ErrorTrackingSettings;\n replay: ReplaySettings;\n}\n\nexport const AutocaptureSettingsSchema = z.object({ pageviews: z.boolean(), pageLeave: z.boolean(), clicks: z.boolean(), rageClicks: z.boolean(), heatmaps: z.boolean(), mouseMovement: z.boolean() }).partial();\nexport const ErrorTrackingSettingsSchema = z.object({ enabled: z.boolean() }).partial();\nexport const ReplaySettingsSchema = z\n .object({\n enabled: z.boolean(),\n sampleRate: z.number().int().min(0).max(100),\n recordConsole: z.boolean(),\n recordNetwork: z.boolean(),\n recordNetworkPayloads: z.boolean(),\n maskAllText: z.boolean(),\n blockSelectors: z.array(z.string().min(1).max(200)).max(50),\n retentionDays: z.number().int().min(1).max(365),\n })\n .partial();\n\nexport const DEFAULT_CAPTURE_SETTINGS: CaptureSettings = {\n autocapture: { pageviews: true, pageLeave: true, clicks: true, rageClicks: true, heatmaps: true, mouseMovement: true },\n errorTracking: { enabled: true },\n replay: { enabled: false, sampleRate: 100, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false, maskAllText: false, blockSelectors: [], retentionDays: 30 },\n};\n\n/** Fills defaults for whatever a project's stored settings leave out. */\nexport function resolveCaptureSettings(settings: unknown): CaptureSettings {\n const s = (settings && typeof settings === \"object\" ? settings : {}) as Record<string, unknown>;\n const obj = (v: unknown) => (v && typeof v === \"object\" && !Array.isArray(v) ? (v as Record<string, unknown>) : {});\n const d = DEFAULT_CAPTURE_SETTINGS;\n const a = AutocaptureSettingsSchema.safeParse(obj(s.autocapture));\n const e = ErrorTrackingSettingsSchema.safeParse(obj(s.errorTracking));\n const r = ReplaySettingsSchema.safeParse(obj(s.replay));\n return {\n autocapture: { ...d.autocapture, ...(a.success ? a.data : {}) },\n errorTracking: { ...d.errorTracking, ...(e.success ? e.data : {}) },\n replay: { ...d.replay, ...(r.success ? r.data : {}) },\n };\n}\n\n/**\n * One position in a `heatmap` event (`properties.points`). `x`/`y` are page coordinates in CSS\n * pixels; `s` is a stable selector for the element and `rx`/`ry` the position inside it (0–1), which\n * lets the dashboard place the point on the element even when layouts differ.\n *\n * Mouse movement (`k: \"m\"`) is sampled at most every 200ms while the pointer moves and binned in the\n * browser (per element at 0.1 of `rx`/`ry`, else on a 16px page grid); `w` is the number of samples\n * in the bin, so a minute of movement costs a few dozen points rather than thousands.\n */\nexport interface HeatmapPoint {\n /** `c` click, `r` part of a rage-click burst, `m` mouse movement. */\n k: \"c\" | \"r\" | \"m\";\n x: number;\n y: number;\n s?: string;\n rx?: number;\n ry?: number;\n /** Weight: samples aggregated into this point (movement only; clicks are 1). */\n w?: number;\n}\n\n/** Properties of a `heatmap` event: a batch of clicks on one page (flushed at ~40 points and on page leave). */\nexport interface HeatmapProperties {\n path?: string;\n viewportWidth: number;\n viewportHeight: number;\n /** Document scroll height when the batch was sent. */\n pageHeight: number;\n points: HeatmapPoint[];\n}\n\n/** Viewport buckets heatmaps are split by (CSS px of `viewportWidth`). */\nexport const HEATMAP_VIEWPORTS = { mobile: [0, 767], tablet: [768, 1279], desktop: [1280, 100_000] } as const;\nexport type HeatmapViewport = keyof typeof HEATMAP_VIEWPORTS;\n\n/**\n * One upload of rrweb events for a recording, `POST /api/v1/sdk/replay`. The SDK sends it as JSON,\n * or gzip-compressed JSON with `?enc=gzip`. A recording is keyed by the SDK session id; every page\n * load starts a new `windowId` whose uploads are numbered by `seq`.\n */\nexport const ReplayChunkSchema = z.object({\n sessionId: z.string().min(1).max(128),\n windowId: z.string().min(1).max(64),\n seq: z.number().int().min(0).max(1_000_000),\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n /** rrweb `eventWithTime` objects, in order. */\n events: z.array(z.object({ type: z.number().int(), timestamp: z.number() }).passthrough()).min(1).max(50_000),\n url: z.string().max(2000).optional(),\n device: z.object({ type: z.string().max(20), browser: z.string().max(40).optional(), os: z.string().max(40).optional() }).optional(),\n viewport: z.object({ width: z.number().int().min(0).max(100_000), height: z.number().int().min(0).max(100_000) }).optional(),\n sdk: z.object({ name: z.string().max(60), version: z.string().max(30) }).optional(),\n});\nexport type ReplayChunk = z.infer<typeof ReplayChunkSchema>;\n\n/** Max upload sizes for one replay chunk (bytes on the wire, and after decompression). */\nexport const REPLAY_MAX_COMPRESSED_BYTES = 2 * 1024 * 1024;\nexport const REPLAY_MAX_RAW_BYTES = 16 * 1024 * 1024;\n","import { GuideConfigSchema, type GuideConfigInput, type GuideKind } from \"./guide\";\n\nexport interface GuideTemplate {\n id: string;\n name: string;\n description: string;\n kind: GuideKind;\n category: \"onboarding\" | \"feature\" | \"setup\" | \"forms\" | \"announcement\" | \"help\" | \"feedback\";\n config: GuideConfigInput;\n}\n\nconst nav = (opts: { last?: boolean; first?: boolean } = {}) =>\n [\n ...(opts.first ? [] : [{ id: \"back\", label: \"Back\", action: \"back\" as const, variant: \"ghost\" as const }]),\n opts.last\n ? { id: \"done\", label: \"Finish\", action: \"complete\" as const, variant: \"primary\" as const }\n : { id: \"next\", label: \"Next\", action: \"next\" as const, variant: \"primary\" as const },\n ];\n\nexport const GUIDE_TEMPLATES: GuideTemplate[] = [\n {\n id: \"new-user-onboarding\",\n name: \"New-user onboarding tour\",\n description: \"A welcome modal followed by three anchored steps that introduce the main navigation.\",\n kind: \"flow\",\n category: \"onboarding\",\n config: {\n steps: [\n { id: \"welcome\", type: \"modal\", title: \"Welcome aboard 👋\", body: \"<p>We'll show you around in under a minute. You can skip at any time.</p>\", showOverlay: true, buttons: [{ id: \"skip\", label: \"Skip tour\", action: \"dismiss\", variant: \"ghost\" }, { id: \"start\", label: \"Show me around\", action: \"next\" }] },\n { id: \"nav\", type: \"tooltip\", title: \"Your navigation\", body: \"<p>Everything lives in the sidebar. Switch between dashboards, contacts and settings here.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='sidebar']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", buttons: nav() },\n { id: \"create\", type: \"spotlight\", title: \"Create your first record\", body: \"<p>Use the primary button to add something new. We'll highlight it for you.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='primary-action']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", showOverlay: true, buttons: nav() },\n { id: \"help\", type: \"tooltip\", title: \"Need help later?\", body: \"<p>Open the help menu any time to replay this tour or browse the resource center.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='help']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: nav({ last: true }) },\n ],\n trigger: { type: \"page_load\" },\n frequency: { mode: \"once\", priority: 10 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"visitor.firstVisit\", op: \"is_true\" }] },\n },\n },\n {\n id: \"feature-discovery\",\n name: \"First-time feature discovery\",\n description: \"A hotspot that draws attention to a new capability and expands into a tooltip.\",\n kind: \"tooltip\",\n category: \"feature\",\n config: {\n steps: [{ id: \"hotspot\", type: \"hotspot\", title: \"New: smart filters\", body: \"<p>Filters now understand natural language. Try <em>“deals closing this month”</em>.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='filters']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: [{ id: \"got-it\", label: \"Got it\", action: \"complete\" }], hotspot: { size: 14, pulse: true, openOn: \"click\" }, showProgress: false }],\n trigger: { type: \"element_visible\", value: \"[data-tour='filters']\" },\n frequency: { mode: \"once\", maxImpressions: 3, priority: 50 },\n },\n },\n {\n id: \"setup-wizard\",\n name: \"Setup wizard\",\n description: \"Multi-step modal wizard that walks a new admin through initial configuration with branching.\",\n kind: \"flow\",\n category: \"setup\",\n config: {\n steps: [\n { id: \"intro\", type: \"modal\", title: \"Let's set up your workspace\", body: \"<p>Three quick steps: invite your team, connect a data source, and choose a plan.</p>\", showOverlay: true, buttons: [{ id: \"later\", label: \"Later\", action: \"dismiss\", variant: \"ghost\" }, { id: \"go\", label: \"Start setup\", action: \"next\" }] },\n { id: \"team\", type: \"popover\", title: \"Invite teammates\", body: \"<p>Guidely works best with your whole team. Add a few emails here.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='invite']\" }], waitMs: 5000, fallback: \"show_as_modal\", scrollIntoView: true }, buttons: nav() },\n { id: \"data\", type: \"popover\", title: \"Connect a data source\", body: \"<p>Import contacts from a CSV or connect your CRM.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='import']\" }], waitMs: 5000, fallback: \"show_as_modal\", scrollIntoView: true }, buttons: nav() },\n { id: \"done\", type: \"modal\", title: \"You're ready 🎉\", body: \"<p>That's it. Explore the dashboard, and open the help menu if you get stuck.</p>\", showOverlay: true, buttons: nav({ last: true }) },\n ],\n trigger: { type: \"page_load\", urlPattern: \"/dashboard\" },\n frequency: { mode: \"once\", priority: 20 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"user.role\", op: \"equals\", value: \"admin\" }] },\n },\n },\n {\n id: \"form-completion\",\n name: \"Form completion helper\",\n description: \"Tooltips that advance as the user fills out each field of a form.\",\n kind: \"flow\",\n category: \"forms\",\n config: {\n steps: [\n { id: \"name\", type: \"tooltip\", title: \"Name the contact\", body: \"<p>Use their full name so search works well.</p>\", target: { selectors: [{ kind: \"css\", value: \"input[name='name']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", advanceOn: \"element_click\", advanceValue: \"input[name='email']\", buttons: [] },\n { id: \"email\", type: \"tooltip\", title: \"Add an email\", body: \"<p>We'll use it for sequences and reminders.</p>\", target: { selectors: [{ kind: \"css\", value: \"input[name='email']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", buttons: nav() },\n { id: \"save\", type: \"spotlight\", title: \"Save\", body: \"<p>Hit save, and your contact appears in the list.</p>\", target: { selectors: [{ kind: \"css\", value: \"button[type='submit']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"top\", showOverlay: true, buttons: nav({ last: true }) },\n ],\n trigger: { type: \"url_match\", value: \"/contacts/new\" },\n frequency: { mode: \"once\", priority: 40 },\n },\n },\n {\n id: \"workflow-walkthrough\",\n name: \"Complex workflow walkthrough\",\n description: \"A multi-page flow that follows the user across routes with URL-aware steps.\",\n kind: \"flow\",\n category: \"onboarding\",\n config: {\n steps: [\n { id: \"start\", type: \"modal\", title: \"Close your first deal\", body: \"<p>We'll go from pipeline to closed-won in four steps.</p>\", showOverlay: true, buttons: [{ id: \"skip\", label: \"Not now\", action: \"dismiss\", variant: \"ghost\" }, { id: \"next\", label: \"Let's go\", action: \"next\" }] },\n { id: \"pipeline\", type: \"tooltip\", title: \"Open the pipeline\", body: \"<p>Click here to see your deals by stage.</p>\", url: \"/dashboard\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='nav-deals']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", advanceOn: \"element_click\", advanceValue: \"[data-tour='nav-deals']\", buttons: [] },\n { id: \"drag\", type: \"spotlight\", title: \"Move a deal\", body: \"<p>Drag a card to the next stage, or use the stage menu.</p>\", url: \"/deals\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='deal-card']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", showOverlay: true, buttons: nav() },\n { id: \"won\", type: \"tooltip\", title: \"Mark as won\", body: \"<p>When it closes, mark it won to update your forecast.</p>\", url: \"/deals\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='mark-won']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"left\", buttons: nav({ last: true }) },\n ],\n trigger: { type: \"manual\" },\n frequency: { mode: \"every_time\", priority: 30 },\n },\n },\n {\n id: \"feature-announcement\",\n name: \"New feature announcement\",\n description: \"A centered modal with an image announcing a new capability.\",\n kind: \"announcement\",\n category: \"announcement\",\n config: {\n steps: [{ id: \"announce\", type: \"modal\", title: \"Introducing Reports 2.0\", body: \"<p>Build custom reports with drag-and-drop metrics, scheduled emails and shareable links.</p><ul><li>12 new chart types</li><li>Export to CSV and PDF</li></ul>\", imageUrl: \"https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=800&q=60\", showOverlay: true, buttons: [{ id: \"later\", label: \"Maybe later\", action: \"dismiss\", variant: \"ghost\" }, { id: \"try\", label: \"Try it now\", action: \"url\", value: \"/reports\" }], showProgress: false }],\n trigger: { type: \"page_load\", delayMs: 1500 },\n frequency: { mode: \"once\", priority: 60 },\n },\n },\n {\n id: \"contextual-tooltip\",\n name: \"Contextual tooltip\",\n description: \"A single tooltip that appears when a specific element becomes visible.\",\n kind: \"tooltip\",\n category: \"help\",\n config: {\n steps: [{ id: \"tip\", type: \"tooltip\", title: \"Pro tip\", body: \"<p>Press <strong>⌘K</strong> to jump anywhere.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='search']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: [{ id: \"ok\", label: \"Got it\", action: \"complete\" }], showProgress: false }],\n trigger: { type: \"element_visible\", value: \"[data-tour='search']\", delayMs: 500 },\n frequency: { mode: \"once\", priority: 80 },\n },\n },\n {\n id: \"product-update-banner\",\n name: \"Product update notification\",\n description: \"A dismissible top banner linking to release notes.\",\n kind: \"banner\",\n category: \"announcement\",\n config: {\n steps: [{ id: \"banner\", type: \"banner\", title: \"\", body: \"<p><strong>Scheduled maintenance</strong> on Saturday 02:00–03:00 UTC. <a href='/status'>Read more</a>.</p>\", position: \"top\", placement: \"top\", buttons: [{ id: \"dismiss\", label: \"Dismiss\", action: \"dismiss\", variant: \"ghost\" }], showProgress: false }],\n trigger: { type: \"page_load\" },\n frequency: { mode: \"once_per_session\", priority: 90 },\n },\n },\n {\n id: \"onboarding-checklist\",\n name: \"User onboarding checklist\",\n description: \"A persistent checklist with four tasks that complete automatically from events.\",\n kind: \"checklist\",\n category: \"onboarding\",\n config: {\n steps: [],\n checklist: {\n tasks: [\n { id: \"profile\", title: \"Complete your profile\", description: \"Add a photo and your role.\", completion: \"event\", completionValue: \"profile_completed\", action: \"url\", actionValue: \"/settings/profile\" },\n { id: \"contact\", title: \"Add your first contact\", description: \"Import or create a contact.\", completion: \"event\", completionValue: \"contact_created\", action: \"url\", actionValue: \"/contacts/new\" },\n { id: \"deal\", title: \"Create a deal\", description: \"Track your first opportunity.\", completion: \"event\", completionValue: \"deal_created\", action: \"url\", actionValue: \"/deals\" },\n { id: \"tour\", title: \"Take the product tour\", description: \"A 60-second walkthrough.\", completion: \"guide_completed\", completionValue: \"new-user-onboarding\", action: \"start_guide\", actionValue: \"new-user-onboarding\", required: false },\n ],\n ordered: false,\n launcherLabel: \"Getting started\",\n position: \"bottom-right\",\n completionTitle: \"You're all set! 🎉\",\n completionBody: \"You've completed onboarding. Explore the rest of the app at your own pace.\",\n autoOpen: true,\n dismissible: true,\n },\n trigger: { type: \"page_load\" },\n frequency: { mode: \"every_time\", priority: 200 },\n },\n },\n {\n id: \"nps-survey\",\n name: \"NPS survey\",\n description: \"Net Promoter Score with a conditional follow-up question.\",\n kind: \"survey\",\n category: \"feedback\",\n config: {\n steps: [],\n survey: {\n questions: [\n { id: \"nps\", type: \"nps\", title: \"How likely are you to recommend us to a colleague?\", lowLabel: \"Not likely\", highLabel: \"Very likely\" },\n { id: \"why-low\", type: \"text\", title: \"What could we do better?\", required: false, placeholder: \"Tell us more…\", showWhen: { questionId: \"nps\", op: \"lte\", value: 6 } },\n { id: \"why-high\", type: \"text\", title: \"What do you like most?\", required: false, placeholder: \"Tell us more…\", showWhen: { questionId: \"nps\", op: \"gte\", value: 9 } },\n ],\n position: \"bottom-right\",\n },\n trigger: { type: \"page_load\", delayMs: 5000 },\n frequency: { mode: \"interval\", intervalHours: 2160, priority: 150 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"visitor.returning\", op: \"is_true\" }] },\n },\n },\n];\n\nexport function templateConfig(id: string) {\n const t = GUIDE_TEMPLATES.find((x) => x.id === id);\n if (!t) return null;\n return { template: t, config: GuideConfigSchema.parse(t.config) };\n}\n","export * from \"./utils\";\nexport * from \"./platform\";\nexport * from \"./widgets\";\nexport * from \"./targeting\";\nexport * from \"./guide\";\nexport * from \"./events\";\nexport * from \"./sdk-api\";\nexport * from \"./messenger\";\nexport * from \"./capture\";\nexport * from \"./network\";\nexport * from \"./templates\";\nexport * from \"./media\";\nexport * from \"./resource-center\";\nexport const SDK_API_VERSION = \"v1\";\nexport const SHARED_VERSION = \"0.5.0\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAKX,IAAM,aAA8B,EAAE,OAAO;AAAA,EAClD,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,OAAO,EAAE,KAAK,WAAW;AAAA,EACzB,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAClC,IAAI,EAAE,KAAK,cAAc;AAAA,EACzB,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS;AAAA,EACpF,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAC/B,CAAC;AAEM,IAAM,kBAAwC,EAAE;AAAA,EAAK,MAC1D,EAAE,OAAO;AAAA,IACP,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,IACpB,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC;AAAA,IACxB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,YAAY,eAAe,CAAC,CAAC,EAAE,IAAI,GAAG;AAAA,IAC9D,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC/B,CAAC;AACH;;;ACrBA,SAAS,KAAAA,UAAS;AAIX,IAAM,cAAc,CAAC,QAAQ,SAAS,WAAW,UAAU,aAAa,UAAU,cAAc;AAGhG,IAAM,iBAAiB,CAAC,SAAS,aAAa,UAAU,UAAU;AAGlE,IAAM,aAAa,CAAC,SAAS,WAAW,WAAW,aAAa,WAAW,UAAU,YAA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AO,4BAA4B,UAAU,OAAO,aAAa,sBAAiB,UAAU,EAAE,YAAY,OAAO,IAAI,OAAO,OAAO,EAAE,EAAE;AAAA,UACtK,EAAE,IAAI,YAAY,MAAM,QAAQ,OAAO,0BAA0B,UAAU,OAAO,aAAa,sBAAiB,UAAU,EAAE,YAAY,OAAO,IAAI,OAAO,OAAO,EAAE,EAAE;AAAA,QACvK;AAAA,QACA,UAAU;AAAA,MACZ;AAAA,MACA,SAAS,EAAE,MAAM,aAAa,SAAS,IAAK;AAAA,MAC5C,WAAW,EAAE,MAAM,YAAY,eAAe,MAAM,UAAU,IAAI;AAAA,MAClE,WAAW,EAAE,IAAI,QAAQ,IAAI,OAAO,OAAO,CAAC,EAAE,IAAI,MAAM,OAAO,qBAAqB,IAAI,UAAU,CAAC,EAAE;AAAA,IACvG;AAAA,EACF;AACF;AAEO,SAAS,eAAe,IAAY;AACzC,QAAM,IAAI,gBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AACjD,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,EAAE,UAAU,GAAG,QAAQ,kBAAkB,MAAM,EAAE,MAAM,EAAE;AAClE;;;AClLO,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;","names":["z","z","z","z","z","z","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/targeting.ts","../src/guide.ts","../src/events.ts","../src/sdk-api.ts","../src/messenger.ts","../src/capture.ts","../src/templates.ts","../src/howto.ts","../src/index.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { RULE_FIELDS, RULE_OPERATORS, type Rule, type RuleGroup } from \"./targeting-eval\";\n\nexport * from \"./targeting-eval\";\n\nexport const RuleSchema: z.ZodType<Rule> = z.object({\n id: z.string().min(1),\n field: z.enum(RULE_FIELDS),\n key: z.string().max(200).optional(),\n op: z.enum(RULE_OPERATORS),\n value: z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]).optional(),\n negate: z.boolean().optional(),\n});\n\nexport const RuleGroupSchema: z.ZodType<RuleGroup> = z.lazy(() =>\n z.object({\n id: z.string().min(1),\n op: z.enum([\"and\", \"or\"]),\n rules: z.array(z.union([RuleSchema, RuleGroupSchema])).max(100),\n negate: z.boolean().optional(),\n }),\n);\n","import { z } from \"zod\";\nimport { PLATFORMS } from \"./platform\";\nimport { RuleGroupSchema, emptyRuleGroup, type RuleGroup } from \"./targeting\";\n\nexport const GUIDE_KINDS = [\"flow\", \"modal\", \"tooltip\", \"banner\", \"checklist\", \"survey\", \"announcement\"] as const;\nexport type GuideKind = (typeof GUIDE_KINDS)[number];\n\nexport const GUIDE_STATUSES = [\"draft\", \"published\", \"paused\", \"archived\"] as const;\nexport type GuideStatus = (typeof GUIDE_STATUSES)[number];\n\nexport const STEP_TYPES = [\"modal\", \"tooltip\", \"popover\", \"spotlight\", \"hotspot\", \"banner\", \"slideout\", \"checklist\", \"custom\", \"survey\"] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n\nexport const PLACEMENTS = [\"top\", \"top-start\", \"top-end\", \"right\", \"right-start\", \"right-end\", \"bottom\", \"bottom-start\", \"bottom-end\", \"left\", \"left-start\", \"left-end\", \"auto\"] as const;\nexport type Placement = (typeof PLACEMENTS)[number];\n\n/** `guidely-id` is cross-platform: `data-guidely-id` on web, `GuidelyTarget` / `guidelyTarget()` on mobile. */\nexport const SELECTOR_KINDS = [\"css\", \"id\", \"data-attr\", \"aria\", \"text\", \"xpath\", \"guidely-id\"] as const;\nexport const SelectorStrategySchema = z.object({\n kind: z.enum(SELECTOR_KINDS),\n value: z.string().min(1).max(1000),\n /** Optional human-readable label captured at pick time. */\n label: z.string().max(200).optional(),\n});\nexport type SelectorStrategy = z.infer<typeof SelectorStrategySchema>;\n\nexport const TargetSchema = z.object({\n /** Ordered strategies; the first one resolving to exactly one element wins. */\n selectors: z.array(SelectorStrategySchema).max(10),\n /** How long to wait for the element before applying fallback. */\n waitMs: z.number().int().min(0).max(60000).default(5000),\n /** What to do when the element never shows up. */\n fallback: z.enum([\"skip\", \"show_as_modal\", \"end_guide\", \"wait\"]).default(\"skip\"),\n /** Scroll the element into view before positioning. */\n scrollIntoView: z.boolean().default(true),\n /** Text snapshot captured at pick time; used for authoring warnings. */\n textSnapshot: z.string().max(200).optional(),\n});\nexport type StepTarget = z.infer<typeof TargetSchema>;\n\nexport const BUTTON_ACTIONS = [\"next\", \"back\", \"dismiss\", \"complete\", \"skip\", \"url\", \"start_guide\", \"event\", \"open_resource_center\", \"none\"] as const;\nexport const ButtonSchema = z.object({\n id: z.string().min(1),\n label: z.string().min(1).max(80),\n action: z.enum(BUTTON_ACTIONS),\n variant: z.enum([\"primary\", \"secondary\", \"ghost\", \"link\"]).default(\"primary\"),\n /** url for `url`, guide id for `start_guide`, event name for `event`, step id for `next` branch override */\n value: z.string().max(2000).optional(),\n newTab: z.boolean().optional(),\n});\nexport type StepButton = z.infer<typeof ButtonSchema>;\n\nexport const StepBranchSchema = z.object({\n id: z.string(),\n /** Rule group evaluated against targeting context when leaving the step. */\n when: RuleGroupSchema,\n /** Step id to jump to. */\n goTo: z.string(),\n});\n\nexport const ADVANCE_ON = [\"button\", \"element_click\", \"element_visible\", \"event\", \"delay\", \"any\"] as const;\n\nexport const StepSchema = z.object({\n id: z.string().min(1).max(64),\n type: z.enum(STEP_TYPES),\n title: z.string().max(200).default(\"\"),\n /** Sanitized HTML body (links, images, lists, formatting). */\n body: z.string().max(20000).default(\"\"),\n imageUrl: z.string().url().max(2000).optional().or(z.literal(\"\")),\n buttons: z.array(ButtonSchema).max(6).default([]),\n target: TargetSchema.optional(),\n placement: z.enum(PLACEMENTS).default(\"auto\"),\n /** Pixel offset between anchor and card. */\n offset: z.number().int().min(0).max(64).default(10),\n showOverlay: z.boolean().default(false),\n showProgress: z.boolean().default(true),\n showClose: z.boolean().default(true),\n dismissOnOutsideClick: z.boolean().default(false),\n /** Highlight padding for spotlight. */\n spotlightPadding: z.number().int().min(0).max(64).default(6),\n /** Banner/slideout position. */\n position: z.enum([\"top\", \"bottom\", \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\", \"center\"]).default(\"bottom-right\"),\n /** URL pattern this step belongs to (for multi-page flows). */\n url: z.string().max(500).optional(),\n /** Automatic advancement. */\n advanceOn: z.enum(ADVANCE_ON).default(\"button\"),\n advanceValue: z.string().max(500).optional(),\n advanceDelayMs: z.number().int().min(0).max(600000).optional(),\n branches: z.array(StepBranchSchema).max(10).default([]),\n width: z.number().int().min(200).max(900).optional(),\n /** Step-level targeting: skip step when rules do not match. */\n targeting: RuleGroupSchema.optional(),\n /** Hotspot pulse dot settings. */\n hotspot: z.object({ size: z.number().int().min(8).max(40).default(14), pulse: z.boolean().default(true), openOn: z.enum([\"click\", \"hover\"]).default(\"click\") }).optional(),\n /** Custom step: arbitrary sanitized HTML with no chrome. */\n customHtml: z.string().max(50000).optional(),\n});\nexport type GuideStep = z.infer<typeof StepSchema>;\nexport type GuideStepInput = z.input<typeof StepSchema>;\n\nexport const TRIGGER_TYPES = [\"page_load\", \"url_match\", \"event\", \"element_click\", \"element_visible\", \"manual\", \"delay\", \"after_guide\", \"segment_enter\"] as const;\nexport const TriggerSchema = z.object({\n type: z.enum(TRIGGER_TYPES).default(\"page_load\"),\n /** url pattern, event name, selector, guide id, audience id depending on type */\n value: z.string().max(1000).optional(),\n delayMs: z.number().int().min(0).max(600000).default(0),\n /** Also require URL to match this pattern (any trigger). */\n urlPattern: z.string().max(500).optional(),\n});\nexport type TriggerConfig = z.infer<typeof TriggerSchema>;\n\nexport const FrequencySchema = z.object({\n mode: z.enum([\"once\", \"once_per_session\", \"every_time\", \"interval\"]).default(\"once\"),\n intervalHours: z.number().int().min(1).max(8760).optional(),\n maxImpressions: z.number().int().min(1).max(1000).optional(),\n /** Hours to wait after dismissal before eligible again (when not `once`). */\n cooldownHours: z.number().int().min(0).max(8760).default(0),\n /** Lower number wins when multiple guides qualify. */\n priority: z.number().int().min(0).max(1000).default(100),\n /** Guide ids that must not be active at the same time. */\n mutuallyExclusiveWith: z.array(z.string()).max(50).default([]),\n /** Re-show if dismissed (otherwise dismissal counts as completion for frequency). */\n reshowAfterDismiss: z.boolean().default(false),\n});\nexport type FrequencyConfig = z.infer<typeof FrequencySchema>;\n\nexport const AppearanceSchema = z.object({\n theme: z.enum([\"light\", \"dark\", \"auto\"]).default(\"auto\"),\n primaryColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n borderRadius: z.number().int().min(0).max(32).optional(),\n fontFamily: z.string().max(200).optional(),\n overlayOpacity: z.number().min(0).max(1).optional(),\n zIndex: z.number().int().min(1).max(2147483647).optional(),\n preset: z.string().max(50).optional(),\n animation: z.enum([\"fade\", \"slide\", \"none\"]).default(\"fade\"),\n});\nexport type Appearance = z.infer<typeof AppearanceSchema>;\n\nexport const ChecklistTaskSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1).max(200),\n description: z.string().max(2000).default(\"\"),\n /** How the task completes. */\n completion: z.enum([\"manual\", \"event\", \"guide_completed\", \"url_visited\", \"click\"]).default(\"manual\"),\n completionValue: z.string().max(500).optional(),\n /** Optional action when clicking the task. */\n action: z.enum([\"none\", \"start_guide\", \"url\", \"event\"]).default(\"none\"),\n actionValue: z.string().max(2000).optional(),\n required: z.boolean().default(true),\n});\nexport type ChecklistTask = z.infer<typeof ChecklistTaskSchema>;\n\nexport const ChecklistConfigSchema = z.object({\n tasks: z.array(ChecklistTaskSchema).min(1).max(30),\n ordered: z.boolean().default(false),\n launcherLabel: z.string().max(60).default(\"Getting started\"),\n position: z.enum([\"bottom-right\", \"bottom-left\"]).default(\"bottom-right\"),\n completionTitle: z.string().max(200).default(\"You're all set!\"),\n completionBody: z.string().max(2000).default(\"\"),\n autoOpen: z.boolean().default(true),\n dismissible: z.boolean().default(true),\n});\nexport type ChecklistConfig = z.infer<typeof ChecklistConfigSchema>;\n\nexport const SURVEY_QUESTION_TYPES = [\"nps\", \"csat\", \"thumbs\", \"single_choice\", \"multiple_choice\", \"text\", \"rating\"] as const;\nexport const SurveyQuestionSchema = z.object({\n id: z.string().min(1),\n type: z.enum(SURVEY_QUESTION_TYPES),\n title: z.string().min(1).max(500),\n description: z.string().max(1000).default(\"\"),\n required: z.boolean().default(true),\n options: z.array(z.object({ id: z.string(), label: z.string().max(200) })).max(20).default([]),\n scaleMax: z.number().int().min(2).max(10).optional(),\n lowLabel: z.string().max(60).optional(),\n highLabel: z.string().max(60).optional(),\n placeholder: z.string().max(200).optional(),\n /** Conditional follow-up: show only when a previous answer matches. */\n showWhen: z.object({ questionId: z.string(), op: z.enum([\"equals\", \"lte\", \"gte\", \"in\"]), value: z.union([z.string(), z.number(), z.array(z.string())]) }).optional(),\n});\nexport type SurveyQuestion = z.infer<typeof SurveyQuestionSchema>;\n\nexport const SurveyConfigSchema = z.object({\n questions: z.array(SurveyQuestionSchema).min(1).max(20),\n thankYouTitle: z.string().max(200).default(\"Thanks for your feedback!\"),\n thankYouBody: z.string().max(2000).default(\"\"),\n position: z.enum([\"bottom-right\", \"bottom-left\", \"center\"]).default(\"bottom-right\"),\n startAt: z.string().datetime().optional(),\n endAt: z.string().datetime().optional(),\n});\nexport type SurveyConfig = z.infer<typeof SurveyConfigSchema>;\n\nexport const GuideConfigSchema = z.object({\n steps: z.array(StepSchema).max(50).default([]),\n targeting: RuleGroupSchema.default(() => emptyRuleGroup()),\n trigger: TriggerSchema.default({}),\n frequency: FrequencySchema.default({}),\n appearance: AppearanceSchema.default({}),\n checklist: ChecklistConfigSchema.optional(),\n survey: SurveyConfigSchema.optional(),\n /** Restrict guide to url pattern(s) (applied before trigger). On mobile these match the screen path `/<Screen>`. */\n urlPatterns: z.array(z.string().max(500)).max(20).default([]),\n /** Platforms that receive this guide. Guides created before mobile support are web-only. */\n platforms: z.array(z.enum(PLATFORMS)).max(PLATFORMS.length).default([\"web\"]),\n});\nexport type GuideConfig = z.infer<typeof GuideConfigSchema>;\nexport type GuideConfigInput = z.input<typeof GuideConfigSchema>;\n\nexport function defaultGuideConfig(kind: GuideKind): GuideConfig {\n return GuideConfigSchema.parse({\n steps: kind === \"checklist\" || kind === \"survey\" ? [] : [defaultStep(kind === \"flow\" ? \"tooltip\" : kind === \"banner\" ? \"banner\" : kind === \"tooltip\" ? \"tooltip\" : \"modal\")],\n checklist: kind === \"checklist\" ? { tasks: [{ id: \"task-1\", title: \"Complete your profile\" }] } : undefined,\n survey: kind === \"survey\" ? { questions: [{ id: \"q1\", type: \"nps\", title: \"How likely are you to recommend us to a friend?\" }] } : undefined,\n trigger: kind === \"checklist\" ? { type: \"page_load\" } : {},\n });\n}\n\nlet stepCounter = 0;\nexport function defaultStep(type: StepType, overrides: Partial<GuideStepInput> = {}): GuideStep {\n stepCounter += 1;\n const base: GuideStepInput = {\n id: `step-${Date.now().toString(36)}-${stepCounter}`,\n type,\n title: type === \"modal\" ? \"Welcome!\" : \"Step title\",\n body: \"<p>Describe what the user should do here.</p>\",\n buttons: [\n { id: \"btn-back\", label: \"Back\", action: \"back\", variant: \"ghost\" },\n { id: \"btn-next\", label: \"Next\", action: \"next\", variant: \"primary\" },\n ],\n placement: type === \"banner\" ? \"top\" : \"auto\",\n showOverlay: type === \"modal\" || type === \"spotlight\",\n ...overrides,\n };\n if ([\"tooltip\", \"popover\", \"spotlight\", \"hotspot\"].includes(type) && !base.target) {\n base.target = { selectors: [], waitMs: 5000, fallback: \"skip\", scrollIntoView: true };\n }\n return StepSchema.parse(base);\n}\n\n/** Buttons to show for a step; \"back\" buttons are hidden when there is no previous step to return to. */\nexport function visibleButtons(step: GuideStep, canGoBack: boolean): GuideStep[\"buttons\"] {\n return canGoBack ? step.buttons : step.buttons.filter((b) => b.action !== \"back\");\n}\n\n/** Validation beyond Zod shape: returns human-readable problems that block publishing. */\nexport interface ValidationIssue {\n level: \"error\" | \"warning\";\n stepId?: string;\n message: string;\n}\nexport function validateGuideConfig(kind: GuideKind, config: GuideConfig): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n if (kind === \"checklist\") {\n if (!config.checklist || config.checklist.tasks.length === 0) issues.push({ level: \"error\", message: \"Checklist needs at least one task.\" });\n } else if (kind === \"survey\") {\n if (!config.survey || config.survey.questions.length === 0) issues.push({ level: \"error\", message: \"Survey needs at least one question.\" });\n config.survey?.questions.forEach((q) => {\n if ((q.type === \"single_choice\" || q.type === \"multiple_choice\") && q.options.length < 2) issues.push({ level: \"error\", message: `Question \"${q.title}\" needs at least two options.` });\n });\n } else {\n if (config.steps.length === 0) issues.push({ level: \"error\", message: \"Add at least one step.\" });\n }\n if (config.platforms.length === 0) issues.push({ level: \"error\", message: \"Choose at least one platform (web, iOS or Android).\" });\n const mobile = config.platforms.some((p) => p !== \"web\");\n const ids = new Set<string>();\n config.steps.forEach((step, i) => {\n if (ids.has(step.id)) issues.push({ level: \"error\", stepId: step.id, message: `Duplicate step id \"${step.id}\".` });\n ids.add(step.id);\n const anchored = [\"tooltip\", \"popover\", \"spotlight\", \"hotspot\"].includes(step.type);\n 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.` });\n if (mobile && anchored && step.target && step.target.selectors.length > 0 && !step.target.selectors.some((s) => s.kind === \"guidely-id\" || s.kind === \"id\"))\n 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.` });\n 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.` });\n if (!step.title && !step.body && step.type !== \"custom\") issues.push({ level: \"warning\", stepId: step.id, message: `Step ${i + 1} has no title or body.` });\n 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.` });\n step.buttons.forEach((b) => {\n if (b.action === \"url\" && !/^https?:\\/\\//i.test(b.value || \"\") && !(b.value || \"\").startsWith(\"/\")) issues.push({ level: \"error\", stepId: step.id, message: `Button \"${b.label}\" needs an http(s) or relative URL.` });\n if (b.action === \"start_guide\" && !b.value) issues.push({ level: \"error\", stepId: step.id, message: `Button \"${b.label}\" needs a guide to start.` });\n });\n step.branches.forEach((br) => {\n if (!ids.has(br.goTo) && !config.steps.some((s) => s.id === br.goTo)) issues.push({ level: \"error\", stepId: step.id, message: `Branch points to unknown step \"${br.goTo}\".` });\n });\n });\n if (config.trigger.type === \"event\" && !config.trigger.value) issues.push({ level: \"error\", message: \"Event trigger needs an event name.\" });\n if (config.trigger.type === \"element_click\" && !config.trigger.value) issues.push({ level: \"error\", message: \"Element click trigger needs a selector.\" });\n if (config.trigger.type === \"url_match\" && !config.trigger.value) issues.push({ level: \"error\", message: \"URL trigger needs a pattern.\" });\n if (config.frequency.mode === \"interval\" && !config.frequency.intervalHours) issues.push({ level: \"error\", message: \"Interval frequency needs an interval in hours.\" });\n return issues;\n}\n\nexport interface ProjectTheme {\n primaryColor: string;\n backgroundColor: string;\n textColor: string;\n borderRadius: number;\n fontFamily: string;\n logoUrl?: string;\n brandName?: string;\n}\nexport const ProjectThemeSchema = z.object({\n primaryColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).default(\"#4f46e5\"),\n backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).default(\"#ffffff\"),\n textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).default(\"#111827\"),\n borderRadius: z.number().int().min(0).max(32).default(12),\n fontFamily: z.string().max(200).default(\"Inter, system-ui, -apple-system, sans-serif\"),\n logoUrl: z.string().max(2000).optional(),\n brandName: z.string().max(100).optional(),\n});\n\nexport type { RuleGroup };\n","import { z } from \"zod\";\n\nexport const EVENT_NAMES = [\n \"guide_viewed\",\n \"guide_started\",\n \"step_viewed\",\n \"step_completed\",\n \"guide_completed\",\n \"guide_skipped\",\n \"guide_dismissed\",\n \"guide_abandoned\",\n \"checklist_task_completed\",\n \"checklist_completed\",\n \"checklist_dismissed\",\n \"survey_displayed\",\n \"survey_submitted\",\n \"survey_dismissed\",\n \"resource_center_opened\",\n \"article_viewed\",\n \"messenger_opened\",\n \"conversation_started\",\n \"conversation_handed_off\",\n \"scout_answered\",\n \"custom\",\n \"page_view\",\n \"identify\",\n // Product analytics (autocapture + error tracking)\n \"page_leave\",\n \"click\",\n \"rage_click\",\n \"exception\",\n \"heatmap\",\n] as const;\nexport type EventName = (typeof EVENT_NAMES)[number];\n\n/** Events the SDK records on its own (page analytics, click autocapture, error tracking). */\nexport const AUTOCAPTURE_EVENTS = [\"page_view\", \"page_leave\", \"click\", \"rage_click\", \"exception\", \"heatmap\"] as const;\n\nexport const GUIDE_LIFECYCLE_EVENTS = [\"guide_viewed\", \"guide_started\", \"step_viewed\", \"step_completed\", \"guide_completed\", \"guide_skipped\", \"guide_dismissed\", \"guide_abandoned\"] as const;\n\n/** Event as produced by the SDK and accepted by POST /api/v1/sdk/events */\nexport const SdkEventSchema = z.object({\n eventId: z.string().min(8).max(64),\n name: z.enum(EVENT_NAMES),\n /** For `custom` events: the application-defined name. */\n customName: z.string().min(1).max(120).optional(),\n occurredAt: z.string().datetime({ offset: true }),\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n accountId: z.string().max(256).optional().nullable(),\n sessionId: z.string().max(128).optional(),\n guideId: z.string().max(64).optional(),\n guideVersion: z.number().int().optional(),\n stepId: z.string().max(64).optional(),\n stepIndex: z.number().int().min(0).optional(),\n url: z.string().max(2000).optional(),\n properties: z.record(z.unknown()).optional(),\n});\nexport type SdkEvent = z.infer<typeof SdkEventSchema>;\n\nexport const EventBatchSchema = z.object({\n events: z.array(SdkEventSchema).min(1).max(50),\n sentAt: z.string().datetime({ offset: true }).optional(),\n sdk: z.object({ name: z.string().max(60), version: z.string().max(30) }).optional(),\n});\nexport type EventBatch = z.infer<typeof EventBatchSchema>;\n\nexport * from \"./events-util\";\nexport * from \"./errors\";\n","import { z } from \"zod\";\nimport { GuideConfigSchema, ProjectThemeSchema, type GuideKind, type GuideConfig } from \"./guide\";\nimport type { MessengerConfig } from \"./messenger\";\nimport type { AutocaptureSettings, ErrorTrackingSettings, ReplaySettings } from \"./capture\";\n\n/** A published guide as delivered to the SDK. Draft-only data (author, notes) is never included. */\nexport interface PublishedGuide {\n id: string;\n key: string;\n name: string;\n kind: GuideKind;\n version: number;\n config: GuideConfig;\n publishedAt: string;\n}\n\nexport interface ResourceCenterArticle {\n id: string;\n slug: string;\n title: string;\n summary: string;\n body: string;\n /** True when `body` was left out of the config to keep it small; fetch it from `GET /sdk/articles/:id`. */\n bodyOmitted?: boolean;\n collectionId?: string | null;\n externalUrl?: string | null;\n /** Listed only for members of any of these audiences (absent = everyone). Not access control. */\n audienceIds?: string[];\n updatedAt: string;\n}\n\nexport interface ResourceCenterCollection {\n id: string;\n name: string;\n description: string;\n order: number;\n /** Parent collection for nested collections (absent/null = top level). */\n parentId?: string | null;\n /** Listed only for members of any of these audiences, with everything inside it (absent = everyone). */\n audienceIds?: string[];\n}\n\nexport interface ResourceCenterConfig {\n enabled: boolean;\n title: string;\n launcher: { position: \"bottom-right\" | \"bottom-left\"; label: string; showIcon: boolean };\n collections: ResourceCenterCollection[];\n articles: ResourceCenterArticle[];\n recommendedGuideIds: string[];\n checklistGuideIds: string[];\n links: Array<{ id: string; label: string; url: string }>;\n faqs: Array<{ id: string; question: string; answer: string }>;\n}\n\nexport interface SdkConfigResponse {\n projectId: string;\n environment: string;\n configVersion: number;\n theme: z.infer<typeof ProjectThemeSchema>;\n guides: PublishedGuide[];\n resourceCenter: ResourceCenterConfig | null;\n /** Scout messenger; absent from servers that predate it. */\n messenger?: MessengerConfig | null;\n settings: {\n analyticsEnabled: boolean;\n collectUrls: boolean;\n maskSelectors: string[];\n sessionTimeoutMinutes: number;\n /** Product analytics; absent from servers that predate it (the SDK then captures nothing extra). */\n autocapture?: AutocaptureSettings;\n errorTracking?: ErrorTrackingSettings;\n /** `retentionDays` is server-side only and not sent. */\n replay?: Omit<ReplaySettings, \"retentionDays\">;\n };\n generatedAt: string;\n}\n\nexport const IdentifyRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().min(1).max(256).optional().nullable(),\n traits: z.record(z.unknown()).optional(),\n account: z\n .object({ id: z.string().min(1).max(256), traits: z.record(z.unknown()).optional() })\n .optional()\n .nullable(),\n sessionId: z.string().max(128).optional(),\n url: z.string().max(2000).optional(),\n});\nexport type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;\n\n/** Server-held state the SDK needs for targeting & frequency. */\nexport interface IdentifyResponse {\n endUserId: string;\n audienceIds: string[];\n guideState: Record<\n string,\n { impressions: number; completedAt?: string | null; dismissedAt?: string | null; lastShownAt?: string | null }\n >;\n checklistProgress: Record<string, { completedTaskIds: string[]; completedAt?: string | null; dismissedAt?: string | null }>;\n surveysSubmitted: string[];\n firstSeenAt: string;\n}\n\nexport const ChecklistProgressRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int().optional(),\n completedTaskIds: z.array(z.string().max(64)).max(100),\n dismissed: z.boolean().optional(),\n completed: z.boolean().optional(),\n});\nexport type ChecklistProgressRequest = z.infer<typeof ChecklistProgressRequestSchema>;\n\nexport const SurveyResponseRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n accountId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int(),\n answers: z.record(z.union([z.string().max(5000), z.number(), z.boolean(), z.array(z.string().max(500)).max(50)])),\n responseId: z.string().min(8).max(64),\n});\nexport type SurveyResponseRequest = z.infer<typeof SurveyResponseRequestSchema>;\n\nexport const GuideStateUpdateSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n updates: z\n .array(\n z.object({\n guideId: z.string(),\n impression: z.boolean().optional(),\n completed: z.boolean().optional(),\n dismissed: z.boolean().optional(),\n }),\n )\n .max(50),\n});\n\nexport const AuthoringPickSchema = z.object({\n stepId: z.string().max(64).optional(),\n selectors: z.array(z.object({ kind: z.string(), value: z.string().max(1000), label: z.string().max(200).optional() })).max(10),\n textSnapshot: z.string().max(200).optional(),\n url: z.string().max(2000).optional(),\n rect: z.object({ x: z.number(), y: z.number(), width: z.number(), height: z.number() }).optional(),\n});\nexport type AuthoringPick = z.infer<typeof AuthoringPickSchema>;\n\n/**\n * Static, script-free copy of the page an authoring session is connected to. The SDK posts it to\n * the dashboard (never to the API) so the editor canvas can show the customer's real app.\n */\nexport interface AppSnapshot {\n /** Full HTML document (doctype included) with scripts and Guidely UI removed and a `<base>` pointing at `url`. */\n html: string;\n url: string;\n title: string;\n /** Viewport the snapshot was taken at, in CSS pixels. */\n width: number;\n height: number;\n capturedAt: string;\n}\n\nexport interface AuthoringSessionInfo {\n id: string;\n projectId: string;\n environment: string;\n guideId: string | null;\n dashboardOrigin: string;\n expiresAt: string;\n /** Draft guide config to preview while authoring (not published). */\n draft: { id: string; key: string; name: string; kind: GuideKind; config: GuideConfig } | null;\n}\n\nexport const PublishedGuideSchema = z.object({\n id: z.string(),\n key: z.string(),\n name: z.string(),\n kind: z.string(),\n version: z.number(),\n config: GuideConfigSchema,\n publishedAt: z.string(),\n});\n\nexport interface ApiError {\n error: { code: string; message: string; details?: unknown };\n}\n","import { z } from \"zod\";\nimport type { HowToStepKind, NormalizedRect } from \"./howto\";\nimport type { ResourceCenterCollection } from \"./sdk-api\";\n\n/** How quickly the team usually replies, shown on the messenger home screen. */\nexport const REPLY_TIMES = [\"minutes\", \"hour\", \"hours\", \"day\"] as const;\nexport type ReplyTime = (typeof REPLY_TIMES)[number];\n\n/** Levels of the status card on the messenger home screen. */\nexport const STATUS_LEVELS = [\"operational\", \"degraded\", \"outage\", \"maintenance\"] as const;\nexport type StatusLevel = (typeof STATUS_LEVELS)[number];\n\n/** A teammate shown on the messenger home screen (first name only). */\nexport interface MessengerTeammate {\n name: string;\n avatarUrl: string | null;\n}\n\nexport interface MessengerStatus {\n level: StatusLevel;\n message: string;\n updatedAt: string;\n}\n\n/** Which personalised cards the messenger home screen shows. */\nexport interface MessengerHomeCards {\n /** Guides, how-tos, articles and common questions for the page the user is on. */\n suggestions: boolean;\n /** A guide the user started and didn't finish, and checklist progress. */\n progress: boolean;\n /** Live announcements (also the News tab). */\n news: boolean;\n}\n\n/** Messenger settings delivered to the SDK in `SdkConfigResponse.messenger`. */\nexport interface MessengerConfig {\n enabled: boolean;\n /** Display name of the AI agent (\"Scout\"). */\n name: string;\n greeting: string;\n /** Scout answers with AI; when false every conversation goes to the team inbox. */\n aiAvailable: boolean;\n handoffEnabled: boolean;\n launcher: { position: \"bottom-right\" | \"bottom-left\" };\n /** Absent from servers before the personalised home screen; SDKs fall back to their defaults. */\n replyTime?: ReplyTime | null;\n team?: MessengerTeammate[];\n status?: MessengerStatus | null;\n home?: MessengerHomeCards;\n}\n\n/** Page-matched content for the messenger, from `POST /sdk/messenger/page`. */\nexport type MessengerPageSuggestion =\n | { type: \"article\"; articleId: string; title: string; summary: string }\n /** A how-to recorded on this page, opened as its help article. */\n | { type: \"howto\"; articleId: string; title: string; steps: number };\n\nexport interface MessengerPageContent {\n /** The page as matched: its path with ids folded (`/invoices/:id`). */\n path: string;\n label: string | null;\n suggestions: MessengerPageSuggestion[];\n /** Questions people ask on this page (FAQs and learned answers); tapping one asks Scout. */\n questions: string[];\n}\n\nexport const MessengerPageRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n /** Pathname only: query strings and fragments are never sent. */\n path: z.string().min(1).max(1000),\n});\nexport type MessengerPageRequest = z.infer<typeof MessengerPageRequestSchema>;\n\nexport const MESSAGE_AUTHORS = [\"user\", \"scout\", \"agent\", \"system\"] as const;\nexport type MessageAuthor = (typeof MESSAGE_AUTHORS)[number];\nexport type ConversationStatus = \"bot\" | \"open\" | \"closed\";\n\nexport interface MessengerCitation {\n articleId: string;\n title: string;\n}\n\nexport interface MessengerSuggestedGuide {\n key: string;\n name: string;\n}\n\n/** A how-to Scout relied on; the messenger opens it in place (`GET /sdk/how-tos/:id`). */\nexport interface MessengerHowToCitation {\n howToId: string;\n title: string;\n}\n\nexport interface MessengerMessage {\n id: string;\n author: MessageAuthor;\n /** Team member name for `agent` messages. */\n authorName?: string | null;\n body: string;\n citations: MessengerCitation[];\n suggestedGuides: MessengerSuggestedGuide[];\n /** How-tos Scout cited (absent when none; SDKs before how-to support ignore it). */\n howTos?: MessengerHowToCitation[];\n status: \"pending\" | \"complete\" | \"failed\";\n createdAt: string;\n}\n\nexport interface MessengerConversation {\n id: string;\n status: ConversationStatus;\n subject: string;\n lastMessageAt: string;\n lastMessagePreview: string;\n unread: number;\n rating: number | null;\n}\n\nexport const MAX_MESSAGE_LENGTH = 4000;\nconst messageText = z.string().trim().min(1).max(MAX_MESSAGE_LENGTH);\n\nexport const StartConversationSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n message: messageText,\n pageUrl: z.string().max(2000).optional(),\n});\nexport type StartConversationRequest = z.infer<typeof StartConversationSchema>;\n\nexport interface StartConversationResponse {\n conversation: MessengerConversation;\n /** Secret that authorises this browser to read and post in the conversation. Store it; it is not shown again. */\n token: string;\n messages: MessengerMessage[];\n}\n\nexport const ConversationLookupSchema = z.object({\n tokens: z.array(z.string().min(16).max(128)).max(50),\n});\n\nexport interface ConversationLookupResponse {\n conversations: Array<MessengerConversation & { token: string }>;\n}\n\nexport const PostMessageSchema = z.object({\n message: messageText,\n /** The page the user is on now (omitted when URL collection is off and by older SDKs), so Scout answers for that page. */\n pageUrl: z.string().max(2000).optional(),\n});\n\nexport const ConversationRatingSchema = z.object({\n rating: z.number().int().min(1).max(5),\n comment: z.string().max(1000).optional(),\n});\n\nexport interface ConversationMessagesResponse {\n conversation: MessengerConversation;\n messages: MessengerMessage[];\n}\n\n/**\n * Server-sent events streamed by `POST /sdk/conversations` and `POST /sdk/conversations/:id/messages`\n * while Scout replies. `conversation` (start only) carries the new conversation and its token, `message`\n * each stored message, `delta` reply text as it is generated, and `done` the final stored message.\n */\nexport type ScoutStreamEvent =\n | { event: \"conversation\"; data: StartConversationResponse }\n | { event: \"message\"; data: MessengerMessage }\n | { event: \"delta\"; data: { messageId: string; text: string } }\n | { event: \"done\"; data: { message: MessengerMessage; conversation: MessengerConversation } }\n | { event: \"error\"; data: { message: string } };\n\n/** Article list entry for the messenger Help tab (bodies are fetched on demand). */\nexport interface SdkArticleSummary {\n id: string;\n slug: string;\n title: string;\n summary: string;\n collectionId: string | null;\n externalUrl: string | null;\n /** Listed only for members of these audiences (absent = everyone). */\n audienceIds?: string[];\n updatedAt: string;\n}\n\nexport interface SdkArticlesResponse {\n collections: ResourceCenterCollection[];\n articles: SdkArticleSummary[];\n}\n\n/** A how-to the team made available in the app (`GET /sdk/how-tos`). */\nexport interface SdkHowToSummary {\n id: string;\n title: string;\n description: string;\n /** Numbered (recorded) steps. */\n stepCount: number;\n updatedAt: string;\n}\n\nexport interface SdkHowTosResponse {\n /** Every how-to available in the app, by title (at most 200). */\n howTos: SdkHowToSummary[];\n /** Ids of the ones recorded on the page in `?url=`, best match first (at most 5). */\n forPage: string[];\n}\n\n/** One step as the messenger renders it: text only, plus a screenshot with the element's highlight. */\nexport interface SdkHowToStep {\n id: string;\n kind: HowToStepKind;\n title: string;\n body: string;\n image?: {\n url: string;\n /** Show only this part of the screenshot (zoomed in on the element). */\n crop?: NormalizedRect;\n /** The element, in the coordinates of the (cropped) image. */\n highlight?: NormalizedRect;\n };\n}\n\n/** `GET /sdk/how-tos/:id`: an available how-to with its steps. */\nexport interface SdkHowTo {\n id: string;\n title: string;\n description: string;\n updatedAt: string;\n steps: SdkHowToStep[];\n /** Key of the interactive tour made from it, when that tour is live in this environment (\"Show me\"). */\n guideKey?: string;\n}\n","import { z } from \"zod\";\n\n/**\n * Product-analytics capture settings. Stored on `Project.settings` (keys `autocapture`,\n * `errorTracking`, `replay`) and delivered to the SDK in `SdkConfigResponse.settings`. The project\n * setting turns a capability on; SDK options can only turn it off for one installation.\n */\nexport interface AutocaptureSettings {\n /** `page_view` on load and on every SPA navigation. */\n pageviews: boolean;\n /** `page_leave` with visible time on page and scroll depth. */\n pageLeave: boolean;\n /** `click` on buttons, links and other interactive elements. */\n clicks: boolean;\n /** `rage_click` when the same spot is clicked 3+ times within a second. */\n rageClicks: boolean;\n /** Batched click positions on every element (`heatmap` events) for click heatmaps. */\n heatmaps: boolean;\n /** Mouse-movement heatmaps: pointer position sampled while it moves, aggregated in the browser into `heatmap` events. */\n mouseMovement: boolean;\n}\n\nexport interface ErrorTrackingSettings {\n /** Uncaught errors and unhandled promise rejections become `exception` events. */\n enabled: boolean;\n}\n\nexport interface ReplaySettings {\n enabled: boolean;\n /** Percentage of sessions recorded (0–100), decided once per session. */\n sampleRate: number;\n /** Record console.log/warn/error output into the recording. */\n recordConsole: boolean;\n /** Record network requests (method, URL with sensitive query values redacted, status, timing, size). */\n recordNetwork: boolean;\n /** Also record request/response headers and text/JSON bodies (redacted, ≤10KB each). Off by default. */\n recordNetworkPayloads: boolean;\n /** Mask every text node (inputs are always masked). */\n maskAllText: boolean;\n /** Elements replaced by a placeholder box in recordings (in addition to `[data-guidely-block]`). */\n blockSelectors: string[];\n /** Days recordings are kept before the worker deletes them. */\n retentionDays: number;\n}\n\nexport interface CaptureSettings {\n autocapture: AutocaptureSettings;\n errorTracking: ErrorTrackingSettings;\n replay: ReplaySettings;\n}\n\nexport const AutocaptureSettingsSchema = z.object({ pageviews: z.boolean(), pageLeave: z.boolean(), clicks: z.boolean(), rageClicks: z.boolean(), heatmaps: z.boolean(), mouseMovement: z.boolean() }).partial();\nexport const ErrorTrackingSettingsSchema = z.object({ enabled: z.boolean() }).partial();\nexport const ReplaySettingsSchema = z\n .object({\n enabled: z.boolean(),\n sampleRate: z.number().int().min(0).max(100),\n recordConsole: z.boolean(),\n recordNetwork: z.boolean(),\n recordNetworkPayloads: z.boolean(),\n maskAllText: z.boolean(),\n blockSelectors: z.array(z.string().min(1).max(200)).max(50),\n retentionDays: z.number().int().min(1).max(365),\n })\n .partial();\n\nexport const DEFAULT_CAPTURE_SETTINGS: CaptureSettings = {\n autocapture: { pageviews: true, pageLeave: true, clicks: true, rageClicks: true, heatmaps: true, mouseMovement: true },\n errorTracking: { enabled: true },\n replay: { enabled: false, sampleRate: 100, recordConsole: true, recordNetwork: true, recordNetworkPayloads: false, maskAllText: false, blockSelectors: [], retentionDays: 30 },\n};\n\n/** Fills defaults for whatever a project's stored settings leave out. */\nexport function resolveCaptureSettings(settings: unknown): CaptureSettings {\n const s = (settings && typeof settings === \"object\" ? settings : {}) as Record<string, unknown>;\n const obj = (v: unknown) => (v && typeof v === \"object\" && !Array.isArray(v) ? (v as Record<string, unknown>) : {});\n const d = DEFAULT_CAPTURE_SETTINGS;\n const a = AutocaptureSettingsSchema.safeParse(obj(s.autocapture));\n const e = ErrorTrackingSettingsSchema.safeParse(obj(s.errorTracking));\n const r = ReplaySettingsSchema.safeParse(obj(s.replay));\n return {\n autocapture: { ...d.autocapture, ...(a.success ? a.data : {}) },\n errorTracking: { ...d.errorTracking, ...(e.success ? e.data : {}) },\n replay: { ...d.replay, ...(r.success ? r.data : {}) },\n };\n}\n\n/**\n * One position in a `heatmap` event (`properties.points`). `x`/`y` are page coordinates in CSS\n * pixels; `s` is a stable selector for the element and `rx`/`ry` the position inside it (0–1), which\n * lets the dashboard place the point on the element even when layouts differ.\n *\n * Mouse movement (`k: \"m\"`) is sampled at most every 200ms while the pointer moves and binned in the\n * browser (per element at 0.1 of `rx`/`ry`, else on a 16px page grid); `w` is the number of samples\n * in the bin, so a minute of movement costs a few dozen points rather than thousands.\n */\nexport interface HeatmapPoint {\n /** `c` click, `r` part of a rage-click burst, `m` mouse movement. */\n k: \"c\" | \"r\" | \"m\";\n x: number;\n y: number;\n s?: string;\n rx?: number;\n ry?: number;\n /** Weight: samples aggregated into this point (movement only; clicks are 1). */\n w?: number;\n}\n\n/** Properties of a `heatmap` event: a batch of clicks on one page (flushed at ~40 points and on page leave). */\nexport interface HeatmapProperties {\n path?: string;\n viewportWidth: number;\n viewportHeight: number;\n /** Document scroll height when the batch was sent. */\n pageHeight: number;\n points: HeatmapPoint[];\n}\n\n/** Viewport buckets heatmaps are split by (CSS px of `viewportWidth`). */\nexport const HEATMAP_VIEWPORTS = { mobile: [0, 767], tablet: [768, 1279], desktop: [1280, 100_000] } as const;\nexport type HeatmapViewport = keyof typeof HEATMAP_VIEWPORTS;\n\n/**\n * One upload of rrweb events for a recording, `POST /api/v1/sdk/replay`. The SDK sends it as JSON,\n * or gzip-compressed JSON with `?enc=gzip`. A recording is keyed by the SDK session id; every page\n * load starts a new `windowId` whose uploads are numbered by `seq`.\n */\nexport const ReplayChunkSchema = z.object({\n sessionId: z.string().min(1).max(128),\n windowId: z.string().min(1).max(64),\n seq: z.number().int().min(0).max(1_000_000),\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n /** rrweb `eventWithTime` objects, in order. */\n events: z.array(z.object({ type: z.number().int(), timestamp: z.number() }).passthrough()).min(1).max(50_000),\n url: z.string().max(2000).optional(),\n device: z.object({ type: z.string().max(20), browser: z.string().max(40).optional(), os: z.string().max(40).optional() }).optional(),\n viewport: z.object({ width: z.number().int().min(0).max(100_000), height: z.number().int().min(0).max(100_000) }).optional(),\n sdk: z.object({ name: z.string().max(60), version: z.string().max(30) }).optional(),\n});\nexport type ReplayChunk = z.infer<typeof ReplayChunkSchema>;\n\n/** Max upload sizes for one replay chunk (bytes on the wire, and after decompression). */\nexport const REPLAY_MAX_COMPRESSED_BYTES = 2 * 1024 * 1024;\nexport const REPLAY_MAX_RAW_BYTES = 16 * 1024 * 1024;\n","import { GuideConfigSchema, type GuideConfigInput, type GuideKind } from \"./guide\";\n\nexport interface GuideTemplate {\n id: string;\n name: string;\n description: string;\n kind: GuideKind;\n category: \"onboarding\" | \"feature\" | \"setup\" | \"forms\" | \"announcement\" | \"help\" | \"feedback\";\n config: GuideConfigInput;\n}\n\nconst nav = (opts: { last?: boolean; first?: boolean } = {}) =>\n [\n ...(opts.first ? [] : [{ id: \"back\", label: \"Back\", action: \"back\" as const, variant: \"ghost\" as const }]),\n opts.last\n ? { id: \"done\", label: \"Finish\", action: \"complete\" as const, variant: \"primary\" as const }\n : { id: \"next\", label: \"Next\", action: \"next\" as const, variant: \"primary\" as const },\n ];\n\nexport const GUIDE_TEMPLATES: GuideTemplate[] = [\n {\n id: \"new-user-onboarding\",\n name: \"New-user onboarding tour\",\n description: \"A welcome modal followed by three anchored steps that introduce the main navigation.\",\n kind: \"flow\",\n category: \"onboarding\",\n config: {\n steps: [\n { id: \"welcome\", type: \"modal\", title: \"Welcome aboard 👋\", body: \"<p>We'll show you around in under a minute. You can skip at any time.</p>\", showOverlay: true, buttons: [{ id: \"skip\", label: \"Skip tour\", action: \"dismiss\", variant: \"ghost\" }, { id: \"start\", label: \"Show me around\", action: \"next\" }] },\n { id: \"nav\", type: \"tooltip\", title: \"Your navigation\", body: \"<p>Everything lives in the sidebar. Switch between dashboards, contacts and settings here.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='sidebar']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", buttons: nav() },\n { id: \"create\", type: \"spotlight\", title: \"Create your first record\", body: \"<p>Use the primary button to add something new. We'll highlight it for you.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='primary-action']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", showOverlay: true, buttons: nav() },\n { id: \"help\", type: \"tooltip\", title: \"Need help later?\", body: \"<p>Open the help menu any time to replay this tour or browse the resource center.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='help']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: nav({ last: true }) },\n ],\n trigger: { type: \"page_load\" },\n frequency: { mode: \"once\", priority: 10 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"visitor.firstVisit\", op: \"is_true\" }] },\n },\n },\n {\n id: \"feature-discovery\",\n name: \"First-time feature discovery\",\n description: \"A hotspot that draws attention to a new capability and expands into a tooltip.\",\n kind: \"tooltip\",\n category: \"feature\",\n config: {\n steps: [{ id: \"hotspot\", type: \"hotspot\", title: \"New: smart filters\", body: \"<p>Filters now understand natural language. Try <em>“deals closing this month”</em>.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='filters']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: [{ id: \"got-it\", label: \"Got it\", action: \"complete\" }], hotspot: { size: 14, pulse: true, openOn: \"click\" }, showProgress: false }],\n trigger: { type: \"element_visible\", value: \"[data-tour='filters']\" },\n frequency: { mode: \"once\", maxImpressions: 3, priority: 50 },\n },\n },\n {\n id: \"setup-wizard\",\n name: \"Setup wizard\",\n description: \"Multi-step modal wizard that walks a new admin through initial configuration with branching.\",\n kind: \"flow\",\n category: \"setup\",\n config: {\n steps: [\n { id: \"intro\", type: \"modal\", title: \"Let's set up your workspace\", body: \"<p>Three quick steps: invite your team, connect a data source, and choose a plan.</p>\", showOverlay: true, buttons: [{ id: \"later\", label: \"Later\", action: \"dismiss\", variant: \"ghost\" }, { id: \"go\", label: \"Start setup\", action: \"next\" }] },\n { id: \"team\", type: \"popover\", title: \"Invite teammates\", body: \"<p>Guidely works best with your whole team. Add a few emails here.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='invite']\" }], waitMs: 5000, fallback: \"show_as_modal\", scrollIntoView: true }, buttons: nav() },\n { id: \"data\", type: \"popover\", title: \"Connect a data source\", body: \"<p>Import contacts from a CSV or connect your CRM.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='import']\" }], waitMs: 5000, fallback: \"show_as_modal\", scrollIntoView: true }, buttons: nav() },\n { id: \"done\", type: \"modal\", title: \"You're ready 🎉\", body: \"<p>That's it. Explore the dashboard, and open the help menu if you get stuck.</p>\", showOverlay: true, buttons: nav({ last: true }) },\n ],\n trigger: { type: \"page_load\", urlPattern: \"/dashboard\" },\n frequency: { mode: \"once\", priority: 20 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"user.role\", op: \"equals\", value: \"admin\" }] },\n },\n },\n {\n id: \"form-completion\",\n name: \"Form completion helper\",\n description: \"Tooltips that advance as the user fills out each field of a form.\",\n kind: \"flow\",\n category: \"forms\",\n config: {\n steps: [\n { id: \"name\", type: \"tooltip\", title: \"Name the contact\", body: \"<p>Use their full name so search works well.</p>\", target: { selectors: [{ kind: \"css\", value: \"input[name='name']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", advanceOn: \"element_click\", advanceValue: \"input[name='email']\", buttons: [] },\n { id: \"email\", type: \"tooltip\", title: \"Add an email\", body: \"<p>We'll use it for sequences and reminders.</p>\", target: { selectors: [{ kind: \"css\", value: \"input[name='email']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", buttons: nav() },\n { id: \"save\", type: \"spotlight\", title: \"Save\", body: \"<p>Hit save, and your contact appears in the list.</p>\", target: { selectors: [{ kind: \"css\", value: \"button[type='submit']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"top\", showOverlay: true, buttons: nav({ last: true }) },\n ],\n trigger: { type: \"url_match\", value: \"/contacts/new\" },\n frequency: { mode: \"once\", priority: 40 },\n },\n },\n {\n id: \"workflow-walkthrough\",\n name: \"Complex workflow walkthrough\",\n description: \"A multi-page flow that follows the user across routes with URL-aware steps.\",\n kind: \"flow\",\n category: \"onboarding\",\n config: {\n steps: [\n { id: \"start\", type: \"modal\", title: \"Close your first deal\", body: \"<p>We'll go from pipeline to closed-won in four steps.</p>\", showOverlay: true, buttons: [{ id: \"skip\", label: \"Not now\", action: \"dismiss\", variant: \"ghost\" }, { id: \"next\", label: \"Let's go\", action: \"next\" }] },\n { id: \"pipeline\", type: \"tooltip\", title: \"Open the pipeline\", body: \"<p>Click here to see your deals by stage.</p>\", url: \"/dashboard\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='nav-deals']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", advanceOn: \"element_click\", advanceValue: \"[data-tour='nav-deals']\", buttons: [] },\n { id: \"drag\", type: \"spotlight\", title: \"Move a deal\", body: \"<p>Drag a card to the next stage, or use the stage menu.</p>\", url: \"/deals\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='deal-card']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", showOverlay: true, buttons: nav() },\n { id: \"won\", type: \"tooltip\", title: \"Mark as won\", body: \"<p>When it closes, mark it won to update your forecast.</p>\", url: \"/deals\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='mark-won']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"left\", buttons: nav({ last: true }) },\n ],\n trigger: { type: \"manual\" },\n frequency: { mode: \"every_time\", priority: 30 },\n },\n },\n {\n id: \"feature-announcement\",\n name: \"New feature announcement\",\n description: \"A centered modal with an image announcing a new capability.\",\n kind: \"announcement\",\n category: \"announcement\",\n config: {\n steps: [{ id: \"announce\", type: \"modal\", title: \"Introducing Reports 2.0\", body: \"<p>Build custom reports with drag-and-drop metrics, scheduled emails and shareable links.</p><ul><li>12 new chart types</li><li>Export to CSV and PDF</li></ul>\", imageUrl: \"https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=800&q=60\", showOverlay: true, buttons: [{ id: \"later\", label: \"Maybe later\", action: \"dismiss\", variant: \"ghost\" }, { id: \"try\", label: \"Try it now\", action: \"url\", value: \"/reports\" }], showProgress: false }],\n trigger: { type: \"page_load\", delayMs: 1500 },\n frequency: { mode: \"once\", priority: 60 },\n },\n },\n {\n id: \"contextual-tooltip\",\n name: \"Contextual tooltip\",\n description: \"A single tooltip that appears when a specific element becomes visible.\",\n kind: \"tooltip\",\n category: \"help\",\n config: {\n steps: [{ id: \"tip\", type: \"tooltip\", title: \"Pro tip\", body: \"<p>Press <strong>⌘K</strong> to jump anywhere.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='search']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: [{ id: \"ok\", label: \"Got it\", action: \"complete\" }], showProgress: false }],\n trigger: { type: \"element_visible\", value: \"[data-tour='search']\", delayMs: 500 },\n frequency: { mode: \"once\", priority: 80 },\n },\n },\n {\n id: \"product-update-banner\",\n name: \"Product update notification\",\n description: \"A dismissible top banner linking to release notes.\",\n kind: \"banner\",\n category: \"announcement\",\n config: {\n steps: [{ id: \"banner\", type: \"banner\", title: \"\", body: \"<p><strong>Scheduled maintenance</strong> on Saturday 02:00–03:00 UTC. <a href='/status'>Read more</a>.</p>\", position: \"top\", placement: \"top\", buttons: [{ id: \"dismiss\", label: \"Dismiss\", action: \"dismiss\", variant: \"ghost\" }], showProgress: false }],\n trigger: { type: \"page_load\" },\n frequency: { mode: \"once_per_session\", priority: 90 },\n },\n },\n {\n id: \"onboarding-checklist\",\n name: \"User onboarding checklist\",\n description: \"A persistent checklist with four tasks that complete automatically from events.\",\n kind: \"checklist\",\n category: \"onboarding\",\n config: {\n steps: [],\n checklist: {\n tasks: [\n { id: \"profile\", title: \"Complete your profile\", description: \"Add a photo and your role.\", completion: \"event\", completionValue: \"profile_completed\", action: \"url\", actionValue: \"/settings/profile\" },\n { id: \"contact\", title: \"Add your first contact\", description: \"Import or create a contact.\", completion: \"event\", completionValue: \"contact_created\", action: \"url\", actionValue: \"/contacts/new\" },\n { id: \"deal\", title: \"Create a deal\", description: \"Track your first opportunity.\", completion: \"event\", completionValue: \"deal_created\", action: \"url\", actionValue: \"/deals\" },\n { id: \"tour\", title: \"Take the product tour\", description: \"A 60-second walkthrough.\", completion: \"guide_completed\", completionValue: \"new-user-onboarding\", action: \"start_guide\", actionValue: \"new-user-onboarding\", required: false },\n ],\n ordered: false,\n launcherLabel: \"Getting started\",\n position: \"bottom-right\",\n completionTitle: \"You're all set! 🎉\",\n completionBody: \"You've completed onboarding. Explore the rest of the app at your own pace.\",\n autoOpen: true,\n dismissible: true,\n },\n trigger: { type: \"page_load\" },\n frequency: { mode: \"every_time\", priority: 200 },\n },\n },\n {\n id: \"nps-survey\",\n name: \"NPS survey\",\n description: \"Net Promoter Score with a conditional follow-up question.\",\n kind: \"survey\",\n category: \"feedback\",\n config: {\n steps: [],\n survey: {\n questions: [\n { id: \"nps\", type: \"nps\", title: \"How likely are you to recommend us to a colleague?\", lowLabel: \"Not likely\", highLabel: \"Very likely\" },\n { id: \"why-low\", type: \"text\", title: \"What could we do better?\", required: false, placeholder: \"Tell us more…\", showWhen: { questionId: \"nps\", op: \"lte\", value: 6 } },\n { id: \"why-high\", type: \"text\", title: \"What do you like most?\", required: false, placeholder: \"Tell us more…\", showWhen: { questionId: \"nps\", op: \"gte\", value: 9 } },\n ],\n position: \"bottom-right\",\n },\n trigger: { type: \"page_load\", delayMs: 5000 },\n frequency: { mode: \"interval\", intervalHours: 2160, priority: 150 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"visitor.returning\", op: \"is_true\" }] },\n },\n },\n];\n\nexport function templateConfig(id: string) {\n const t = GUIDE_TEMPLATES.find((x) => x.id === id);\n if (!t) return null;\n return { template: t, config: GuideConfigSchema.parse(t.config) };\n}\n","import { z } from \"zod\";\nimport { SelectorStrategySchema } from \"./guide\";\n\n/**\n * How-tos: step-by-step guides with screenshots, recorded by clicking through the customer's app\n * (SDK capture mode) and edited in the dashboard. Each step is either an action captured in the app\n * (click, type, select, navigate) or a block the author added (text, heading, tip, alert).\n */\n\nexport const HOWTO_STEP_KINDS = [\"action\", \"text\", \"heading\", \"tip\", \"alert\"] as const;\nexport type HowToStepKind = (typeof HOWTO_STEP_KINDS)[number];\n\nexport const HOWTO_ACTIONS = [\"click\", \"type\", \"select\", \"navigate\"] as const;\nexport type HowToAction = (typeof HOWTO_ACTIONS)[number];\n\n/** A rectangle as fractions (0–1) of its screenshot, so it survives any rendered size. */\nexport const NormalizedRectSchema = z.object({\n x: z.number().min(0).max(1),\n y: z.number().min(0).max(1),\n width: z.number().min(0).max(1),\n height: z.number().min(0).max(1),\n});\nexport type NormalizedRect = z.infer<typeof NormalizedRectSchema>;\n\n/** The element an action was performed on, described for people (not for selecting it). */\nexport const CapturedElementSchema = z.object({\n /** Visible name: aria-label, associated label, text, placeholder, alt or title. */\n label: z.string().max(200).default(\"\"),\n /** button, link, tab, menuitem, checkbox, radio, field, dropdown, option, element… */\n role: z.string().max(40).default(\"element\"),\n tag: z.string().max(40).default(\"\"),\n});\nexport type CapturedElement = z.infer<typeof CapturedElementSchema>;\n\n/**\n * One action the SDK recorded, sent with its screenshot as multipart form data\n * (`step` = this JSON, `screenshot` = the image) to `POST /api/v1/sdk/capture/steps?token=`.\n * Sensitive values never arrive here: the SDK drops typed text from password, payment, one-time-code\n * and masked fields and redacts screenshots in the browser before uploading them.\n */\nexport const CaptureStepSchema = z.object({\n /** Random id from the SDK; a retried upload with the same id is stored once. */\n clientId: z.string().min(1).max(64),\n action: z.enum(HOWTO_ACTIONS),\n url: z.string().max(2000),\n pageTitle: z.string().max(300).default(\"\"),\n element: CapturedElementSchema.optional(),\n /** Typed text or chosen option; absent when it was sensitive (`valueRedacted`). */\n value: z.string().max(200).optional(),\n valueRedacted: z.boolean().default(false),\n /** Selectors for the element, so the step can later become an interactive tour step. */\n selectors: z.array(SelectorStrategySchema).max(10).default([]),\n /** Where the element sits in the screenshot. */\n highlight: NormalizedRectSchema.optional(),\n /** Number of regions the SDK blurred in the screenshot before upload. */\n redactions: z.number().int().min(0).max(1000).default(0),\n occurredAt: z.string().datetime().optional(),\n});\nexport type CaptureStep = z.infer<typeof CaptureStepSchema>;\nexport type CaptureStepInput = z.input<typeof CaptureStepSchema>;\n\n/** `GET /api/v1/sdk/capture/session?token=`: what the SDK needs to start recording. */\nexport interface CaptureSessionInfo {\n id: string;\n projectId: string;\n environment: string;\n howToId: string;\n howToTitle: string;\n /** Origin of the dashboard window that opened the app (for `postMessage`). */\n dashboardOrigin: string;\n expiresAt: string;\n /** Steps already recorded (a recording continues across full page loads). */\n stepCount: number;\n /** False when the server has no media storage: record steps without screenshots. */\n screenshots: boolean;\n}\n\nexport { CAPTURE_PARAM, CAPTURE_SCREENSHOT_MAX_BYTES } from \"./howto-limits\";\n\nfunction quoted(s: string | undefined) {\n const t = (s ?? \"\").replace(/\\s+/g, \" \").trim();\n return t.length > 60 ? `“${t.slice(0, 57)}…”` : `“${t}”`;\n}\n\n/**\n * A label as people would say it: icon glyphs and symbols at either end (\"+ New contact\", \"Next →\")\n * and required-field markers (\"Email *\", \"Name:\") removed. Falls back to the raw label when nothing\n * readable is left.\n */\nexport function cleanLabel(label: string | undefined | null): string {\n const raw = (label ?? \"\").replace(/\\s+/g, \" \").trim();\n const cleaned = raw\n .replace(/^[^\\p{L}\\p{N}“\"'(]+/u, \"\")\n .replace(/[\\s:*]+$/u, \"\")\n .replace(/[^\\p{L}\\p{N})”\"'?!.%]+$/u, \"\")\n .trim();\n return cleaned || raw;\n}\n\nconst SEPARATORS = /\\s+[·|•–—-]\\s+|\\s*[|·•]\\s*/;\nconst ID_SEGMENT = /^(?:\\d+|[0-9a-f]{8,}(?:-[0-9a-f]{4,})*|[A-Za-z0-9_-]{20,})$/i;\n\nfunction humanize(segment: string) {\n const words = decodeURIComponent(segment).replace(/[-_+]+/g, \" \").trim();\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : \"\";\n}\n\n/**\n * Name of the page a navigate step opens. A title like \"Contacts · Northwind CRM\" gives \"Contacts\";\n * a title that's just the app's name (no word of the path in it) gives the path instead, so\n * \"/contacts/new\" reads \"Contacts › New\". Ids in the path are skipped.\n */\nexport function pageName(url: string, pageTitle: string | undefined | null): string {\n const title = (pageTitle ?? \"\").replace(/\\s+/g, \" \").trim();\n const parts = title.split(SEPARATORS).map((p) => p.trim()).filter(Boolean);\n if (parts.length > 1) return parts[0]!;\n let segments: string[] = [];\n try {\n segments = new URL(url).pathname.split(\"/\").filter((p) => p && !ID_SEGMENT.test(p));\n } catch {\n segments = [];\n }\n const fromPath = segments.slice(-2).map(humanize).filter(Boolean).join(\" › \");\n if (!fromPath) return title || hostAndPath(url);\n if (!title) return fromPath;\n const lower = title.toLowerCase();\n const mentionsPath = segments.some((seg) => humanize(seg).toLowerCase().split(\" \").some((w) => w.length > 2 && lower.includes(w)));\n return mentionsPath ? title : fromPath;\n}\n\nconst ROLE_NOUN: Record<string, string> = { tab: \"tab\", menuitem: \"menu item\", field: \"field\", dropdown: \"dropdown\", option: \"option\" };\n\n/** Plain-language instruction for a captured action, e.g. `Click “Save”` or `Type “Acme” into “Company”`. */\nexport function describeCaptureStep(step: Pick<CaptureStepInput, \"action\" | \"element\" | \"value\" | \"valueRedacted\" | \"pageTitle\" | \"url\">): string {\n const label = cleanLabel(step.element?.label);\n const role = step.element?.role ?? \"\";\n switch (step.action) {\n case \"navigate\": {\n const where = pageName(step.url, step.pageTitle);\n return where ? `Go to ${quoted(where)}` : \"Open the page\";\n }\n case \"type\": {\n const field = label ? quoted(label) : \"the field\";\n if (step.valueRedacted || !step.value) return `Fill in ${field}`;\n return `Type ${quoted(step.value)} into ${field}`;\n }\n case \"select\":\n if (step.value && label) return `Select ${quoted(step.value)} from ${quoted(label)}`;\n if (step.value) return `Select ${quoted(step.value)}`;\n return label ? `Choose an option in ${quoted(label)}` : \"Choose an option\";\n case \"click\":\n default:\n if (role === \"checkbox\") return label ? `Check ${quoted(label)}` : \"Check the box\";\n if (role === \"switch\") return label ? `Turn ${quoted(label)} on or off` : \"Flip the switch\";\n if (role === \"radio\") return label ? `Select ${quoted(label)}` : \"Select the option\";\n if (role === \"menuitem\") return label ? `Choose ${quoted(label)} from the menu` : \"Choose the menu item\";\n if (role === \"tab\") return label ? `Open the ${quoted(label)} tab` : \"Open the tab\";\n if (label) return `Click ${quoted(label)}`;\n return ROLE_NOUN[role] ? `Click the ${ROLE_NOUN[role]}` : role === \"link\" ? \"Click the link\" : \"Click the button\";\n }\n}\n\nfunction hostAndPath(url: string) {\n try {\n const u = new URL(url);\n return `${u.host}${u.pathname === \"/\" ? \"\" : u.pathname}`;\n } catch {\n return url.slice(0, 80);\n }\n}\n\n/** A point as fractions (0–1) of a screenshot. */\nexport const NormalizedPointSchema = z.object({ x: z.number().min(0).max(1), y: z.number().min(0).max(1) });\nexport const ANNOTATION_COLORS = [\"brand\", \"red\", \"amber\", \"green\", \"black\", \"white\"] as const;\nexport type AnnotationColor = (typeof ANNOTATION_COLORS)[number];\n\n/**\n * A mark drawn over a step's screenshot, in fractions of the full image so it survives cropping and\n * any rendered size: an arrow, a text label or a box. `brand` uses the project's primary colour.\n */\nexport const HowToAnnotationSchema = z.discriminatedUnion(\"type\", [\n z.object({ id: z.string().min(1).max(32), type: z.literal(\"arrow\"), from: NormalizedPointSchema, to: NormalizedPointSchema, color: z.enum(ANNOTATION_COLORS).default(\"brand\") }),\n z.object({ id: z.string().min(1).max(32), type: z.literal(\"text\"), at: NormalizedPointSchema, text: z.string().trim().min(1).max(120), color: z.enum(ANNOTATION_COLORS).default(\"brand\") }),\n z.object({ id: z.string().min(1).max(32), type: z.literal(\"box\"), rect: NormalizedRectSchema, color: z.enum(ANNOTATION_COLORS).default(\"brand\") }),\n]);\nexport type HowToAnnotation = z.infer<typeof HowToAnnotationSchema>;\nexport const MAX_ANNOTATIONS = 30;\n","export * from \"./utils\";\nexport * from \"./platform\";\nexport * from \"./widgets\";\nexport * from \"./targeting\";\nexport * from \"./guide\";\nexport * from \"./events\";\nexport * from \"./sdk-api\";\nexport * from \"./messenger\";\nexport * from \"./capture\";\nexport * from \"./network\";\nexport * from \"./templates\";\nexport * from \"./media\";\nexport * from \"./resource-center\";\nexport * from \"./howto\";\nexport * from \"./page\";\nexport const SDK_API_V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