@guidelytech/shared 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.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/complaints.ts","../src/capture.ts","../src/templates.ts","../src/howto.ts","../src/snippet.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 { GUIDE_VISIBILITIES, 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),\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 /** Everyone, only identified (logged-in) users, or only anonymous visitors; applied on top of `targeting`. */\n visibility: z.enum(GUIDE_VISIBILITIES).default(\"everyone\"),\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 // Feature flags: a user was bucketed into an experiment variation (properties: experimentKey, variationId, flagKey).\n \"experiment_viewed\",\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 /** Guide keys of the article's \"Show me\" prompts (absent = none); the first one is offered in Help results. */\n walkthroughs?: string[];\n /** The article plays a video. */\n hasVideo?: boolean;\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 /** `dismissResetAt` changes when a teammate resets the user's dismissal; SDKs then drop their cached `dismissedAt`. */\n checklistProgress: Record<string, { completedTaskIds: string[]; completedAt?: string | null; dismissedAt?: string | null; dismissResetAt?: 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\";\nimport type { MessengerComplaint, MessengerComplaintOffer, MessengerComplaintsConfig } from \"./complaints-limits\";\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 /** Complaint categories when the project takes complaints in the messenger (absent from older servers). */\n complaints?: MessengerComplaintsConfig | null;\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 /** Scout offered the complaint form (absent otherwise). */\n complaintOffer?: MessengerComplaintOffer;\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 /** The complaint filed in this conversation, latest first (absent when none). */\n complaint?: MessengerComplaint;\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 FileComplaintResponse {\n complaint: MessengerComplaint;\n conversation: MessengerConversation;\n /** Token of the conversation started for it (absent when it was filed in an existing one). */\n token?: string;\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 /** Guide keys of the article's \"Show me\" prompts (absent = none). */\n walkthroughs?: string[];\n hasVideo?: boolean;\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 /** Key of the interactive tour made from it, when that tour is live in this environment (\"Show me\"). */\n guideKey?: string;\n /** The how-to has a video. */\n hasVideo?: boolean;\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 /** Video made from the how-to (WebM), played above the steps. */\n video?: { url: string };\n}\n","import { z } from \"zod\";\nimport { MAX_COMPLAINT_ANSWER_LENGTH, MAX_COMPLAINT_ATTACHMENT_BYTES, MAX_COMPLAINT_LENGTH } from \"./complaints-limits\";\n\nexport * from \"./complaints-limits\";\n\nexport const FileComplaintSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n categoryId: z.string().min(1).max(64),\n description: z.string().trim().min(1).max(MAX_COMPLAINT_LENGTH),\n /** Answers to the category's extra questions, by field id. */\n answers: z.record(z.string().max(64), z.string().trim().max(MAX_COMPLAINT_ANSWER_LENGTH)).default({}),\n /** Required from visitors the app hasn't identified. */\n email: z.string().trim().toLowerCase().email().max(254).optional().nullable(),\n pageUrl: z.string().max(2000).optional(),\n /** File it in this conversation (send its token in `X-Guidely-Conversation`); otherwise a new one is started. */\n conversationId: z.string().min(1).max(64).optional().nullable(),\n /** One screenshot, base64-encoded (png, jpeg, webp or gif). */\n attachment: z\n .object({\n fileName: z.string().trim().min(1).max(200),\n data: z.string().max(Math.ceil((MAX_COMPLAINT_ATTACHMENT_BYTES * 4) / 3) + 4),\n })\n .optional()\n .nullable(),\n});\nexport type FileComplaintRequest = z.infer<typeof FileComplaintSchema>;\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","/**\n * The script-tag install snippet's stub. It defines `window.Guidely` before the SDK has loaded, so\n * the page can call `Guidely.init(…)` and `Guidely.get().identify(…)` straight away: calls are\n * queued and replayed by the SDK when it arrives (`packages/embed`). If the SDK can't load at all\n * (Guidely unreachable, blocked by an extension), the calls simply do nothing and the page carries on.\n *\n * Queued calls are `[onClient, method, args]` in `Guidely._q`; `Guidely.get()` returns `Guidely._c`,\n * which the SDK upgrades in place to forward to the real client. Flag reads return their fallback\n * until then. ES5 only: it runs on the customer's page before anything else.\n */\nexport const SCRIPT_STUB_METHODS = [\n \"identify\",\n \"track\",\n \"page\",\n \"reset\",\n \"setAccount\",\n \"updateTraits\",\n \"setConsent\",\n \"startGuide\",\n \"stopGuide\",\n \"dismissGuide\",\n \"openMessenger\",\n \"closeMessenger\",\n \"showNewMessage\",\n \"openResourceCenter\",\n \"closeResourceCenter\",\n \"openChecklist\",\n \"closeChecklist\",\n \"completeChecklistTask\",\n \"openComplaint\",\n \"captureException\",\n \"on\",\n] as const;\n\nexport const SCRIPT_STUB = `!function(w){if(w.Guidely)return;var g=w.Guidely={_q:[]},c=g._c={};function q(o,k){o[k]=function(){g._q.push([o===c?1:0,k,[].slice.call(arguments)])}}q(g,\"init\");\"${SCRIPT_STUB_METHODS.join(\" \")}\".split(\" \").forEach(function(k){q(c,k)});c.isFeatureEnabled=function(k,f){return!!f};c.getFeatureValue=function(k,f){return f};g.get=function(){return c}}(window);`;\n\n/** The full script-tag install: stub, init (queued until the SDK loads), then the async SDK script. */\nexport function scriptSnippet(scriptUrl: string, initOptions: string): string {\n return `<script>\n ${SCRIPT_STUB}\n Guidely.init(${initOptions});\n</script>\n<script src=\"${scriptUrl}\" async></script>`;\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 \"./complaints\";\nexport * from \"./capture\";\nexport * from \"./network\";\nexport * from \"./templates\";\nexport * from \"./media\";\nexport * from \"./resource-center\";\nexport * from \"./howto\";\nexport * from \"./page\";\nexport * from \"./snippet\";\nexport const SDK_API_VERSION = \"v1\";\nexport const SHARED_VERSION = \"0.10.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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EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,cAAc,sKAAsK,oBAAoB,KAAK,GAAG,CAAC;AAGvN,SAAS,cAAc,WAAmB,aAA6B;AAC5E,SAAO;AAAA,IACL,WAAW;AAAA,iBACE,WAAW;AAAA;AAAA,eAEb,SAAS;AACxB;;;AC1BO,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;","names":["z","z","z","z","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/complaints.ts","../src/agents.ts","../src/feedback.ts","../src/feedback-limits.ts","../src/capture.ts","../src/templates.ts","../src/howto.ts","../src/snippet.ts","../src/translation-files.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 { GUIDE_VISIBILITIES, RuleGroupSchema, emptyRuleGroup, type RuleGroup } from \"./targeting\";\nimport { contrastIssues } from \"./contrast\";\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 /** Alternative text for `imageUrl` (screen readers); empty = decorative. */\n imageAlt: z.string().max(300).optional(),\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 /**\n * Code block (custom steps only): JavaScript run on the web when the step shows, only while the\n * workspace allows code blocks (an admin setting, off by default). Mobile SDKs never receive it.\n */\n code: z.string().max(20000).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 /** Bypass the project's guide throttling (always eligible as far as throttling goes). */\n ignoreThrottling: z.boolean().optional(),\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 /** Custom CSS scoped to this guide's container (sanitized; see custom-css.ts). Web only. */\n customCss: z.string().max(20000).optional(),\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),\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\n/**\n * When any guide may show: `startAt` / `endAt` are UTC instants; `timezone` (IANA, e.g.\n * `Europe/London`) is the zone they were entered in, kept for display only.\n */\nexport const GuideScheduleSchema = z.object({\n startAt: z.string().datetime().optional(),\n endAt: z.string().datetime().optional(),\n timezone: z.string().max(64).optional(),\n});\nexport type GuideSchedule = z.infer<typeof GuideScheduleSchema>;\n\n/** Locale codes: BCP 47 language tags such as `fr`, `pt-BR`, `zh-Hans`. */\nexport const LOCALE_PATTERN = /^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8}){0,2}$/;\nexport const LocaleSchema = z.string().regex(LOCALE_PATTERN, \"Use a language code such as fr or pt-BR\").max(20);\n\n/**\n * Translations of a guide's text: locale → translation key → text. Keys come from\n * `guideTextEntries` (e.g. `steps.<stepId>.title`); missing keys fall back to the default language.\n */\nexport const GuideLocalizationSchema = z.object({\n translations: z.record(LocaleSchema, z.record(z.string().max(200), z.string().max(50000))).default({}),\n});\nexport type GuideLocalization = z.infer<typeof GuideLocalizationSchema>;\n\n/** Project.settings.localization: the language guides are written in and the languages offered for translation. */\nexport const LocalizationSettingsSchema = z.object({\n defaultLocale: LocaleSchema.default(\"en\"),\n locales: z.array(LocaleSchema).max(50).default([]),\n});\n\n/**\n * Project.settings.guideThrottling: limits automatically launched guides per visitor (guides\n * started by a button, a link, Help or `startGuide()` are never throttled; nor are banners,\n * checklists and hotspot-only guides, which don't interrupt).\n */\nexport const GuideThrottlingSchema = z.object({\n enabled: z.boolean().default(false),\n maxGuides: z.number().int().min(1).max(50).default(1),\n windowHours: z.number().int().min(1).max(720).default(24),\n minGapMinutes: z.number().int().min(0).max(10080).default(0),\n});\n\nexport const GuideConfigSchema = z.object({\n steps: z.array(StepSchema).max(50).default([]),\n /** Everyone, only identified (logged-in) users, or only anonymous visitors; applied on top of `targeting`. */\n visibility: z.enum(GUIDE_VISIBILITIES).default(\"everyone\"),\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 /** Start / end window for any guide kind (surveys also honour `survey.startAt` / `endAt`). */\n schedule: GuideScheduleSchema.optional(),\n /** Translations (see localization.ts). */\n localization: GuideLocalizationSchema.optional(),\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, theme?: Partial<Pick<ProjectTheme, \"primaryColor\" | \"backgroundColor\" | \"textColor\">>): 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 const sched = config.schedule;\n if (sched?.startAt && sched.endAt && Date.parse(sched.endAt) <= Date.parse(sched.startAt)) issues.push({ level: \"error\", message: \"The schedule ends before it starts.\" });\n if (sched?.endAt && Date.parse(sched.endAt) < Date.now()) issues.push({ level: \"warning\", message: \"The schedule has already ended, so nobody will see this guide.\" });\n config.steps.forEach((step, i) => {\n if (step.code && step.type !== \"custom\") issues.push({ level: \"error\", stepId: step.id, message: `Step ${i + 1}: code blocks can only run in custom steps.` });\n if (step.code && mobile) issues.push({ level: \"warning\", stepId: step.id, message: `Step ${i + 1} runs a code block; mobile apps skip it.` });\n });\n const colors = { primaryColor: config.appearance.primaryColor ?? theme?.primaryColor, backgroundColor: config.appearance.backgroundColor ?? theme?.backgroundColor, textColor: config.appearance.textColor ?? theme?.textColor };\n for (const c of contrastIssues(colors)) issues.push({ level: \"warning\", message: `Low contrast: ${c.message}` });\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 customCss?: 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 /** Custom CSS applied to every guide's container (sanitized and scoped like guide CSS). Web only. */\n customCss: z.string().max(20000).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 // Feature flags: a user was bucketed into an experiment variation (properties: experimentKey, variationId, flagKey).\n \"experiment_viewed\",\n // Mobile app lifecycle (mobile/SPEC.md \"Product analytics\"): installs, updates, opens and backgrounding.\n \"app_install\",\n \"app_update\",\n \"app_open\",\n \"app_background\",\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\", \"app_install\", \"app_update\", \"app_open\", \"app_background\"] as const;\n\n/** Mobile app lifecycle events (`autocapture.appLifecycle`). */\nexport const APP_LIFECYCLE_EVENTS = [\"app_install\", \"app_update\", \"app_open\", \"app_background\"] 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 { RuleGroup } from \"./targeting-eval\";\nimport type { ResourceCenterModuleId } from \"./resource-center\";\nimport type { MessengerConfig } from \"./messenger\";\nimport type { AutocaptureSettings, ErrorTrackingSettings, ReplaySettings } from \"./capture\";\nimport type { TaggingSdkConfig } from \"./tagging\";\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 * Set while the guide is a variant of a running guide A/B test. Its targeting already carries the\n * variant's `experiment.bucket` range; SDKs record an `experiment_viewed` exposure\n * (`{ guideExperimentId, variantId, guideId }`) when it shows.\n */\n experiment?: { id: string; variantId: string };\n}\n\n/**\n * The control group of a running guide A/B test: the base guide's targeting, trigger and frequency\n * restricted to the control bucket. SDKs evaluate it like a guide but never render it; when it would\n * show they record the `experiment_viewed` exposure (variant `control`) and its local impression.\n * SDKs that don't know `guideHoldouts` ignore it (control visitors then simply see nothing).\n */\nexport interface GuideHoldout {\n experimentId: string;\n variantId: string;\n guide: PublishedGuide;\n}\n\n/** Project-wide limit on automatically shown guides (Project.settings.guideThrottling). */\nexport interface GuideThrottlingSettings {\n enabled: boolean;\n /** At most this many auto-launched guides per visitor within `windowHours`. */\n maxGuides: number;\n windowHours: number;\n /** Minimum minutes between two auto-launched guides. */\n minGapMinutes: number;\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 /** Guide keys of the article's \"Show me\" prompts (absent = none); the first one is offered in Help results. */\n walkthroughs?: string[];\n /** The article plays a video. */\n hasVideo?: boolean;\n updatedAt: string;\n /** Translations by locale; a `bodyOmitted` translation is fetched with `GET /sdk/articles/:id?locale=`. */\n translations?: Record<string, { title?: string; summary?: string; body?: string; bodyOmitted?: boolean }>;\n}\n\n/** A \"What's new\" entry in the resource center. */\nexport interface ResourceCenterAnnouncement {\n id: string;\n title: string;\n /** Sanitized HTML. */\n body: string;\n publishedAt: string;\n /** Guide id or key started by its \"Show me\" button. */\n guideId?: string | null;\n articleId?: string | null;\n url?: string | null;\n linkLabel?: string | null;\n /** Listed only for members of any of these audiences (absent = everyone). */\n audienceIds?: string[];\n translations?: Record<string, { title?: string; body?: string }>;\n}\n\n/** A section of the resource center, in display order; hidden when disabled or its targeting doesn't match. */\nexport interface ResourceCenterModule {\n id: ResourceCenterModuleId;\n enabled: boolean;\n /** Evaluated by the SDK like guide targeting (absent = everyone). */\n targeting?: RuleGroup | null;\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 /** \"What's new\" (newest first). Absent from servers that predate it. */\n announcements?: ResourceCenterAnnouncement[];\n /** Section order and targeting; absent = every section in the default order. */\n modules?: ResourceCenterModule[];\n /** Translations of the strings above (see `resourceCenterTextEntries`), by locale. */\n translations?: Record<string, Record<string, 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 /** Control groups of running guide A/B tests (see GuideHoldout); absent from older servers. */\n guideHoldouts?: GuideHoldout[];\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 /** Project-wide guide throttling; absent or disabled = no limit. */\n throttling?: GuideThrottlingSettings;\n /** The language guides are written in, and the languages they may be translated into. */\n localization?: { defaultLocale: string; locales: string[] };\n };\n /** Tagged pages and features: the feature attribute and DOM event properties; absent from servers that predate them. */\n tagging?: TaggingSdkConfig;\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 /** `dismissResetAt` changes when a teammate resets the user's dismissal; SDKs then drop their cached `dismissedAt`. */\n checklistProgress: Record<string, { completedTaskIds: string[]; completedAt?: string | null; dismissedAt?: string | null; dismissResetAt?: 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 /** Compact snapshot of the picked element (tag mode: feature rules are proposed from it). */\n elementSnapshot: z.record(z.unknown()).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 /** `tag`: the session tags pages and features (no guide); absent or `guide` for the guide editor. */\n purpose?: \"guide\" | \"tag\";\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\";\nimport type { MessengerComplaint, MessengerComplaintOffer, MessengerComplaintsConfig } from \"./complaints-limits\";\nimport type { MessengerIdeaOffer, MessengerIdeasConfig } from \"./feedback-limits\";\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 /** Complaint categories when the project takes complaints in the messenger (absent from older servers). */\n complaints?: MessengerComplaintsConfig | null;\n /** The Ideas tab (feature requests) when the project turned it on (absent from older servers). */\n ideas?: MessengerIdeasConfig | null;\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 /** Scout offered the complaint form (absent otherwise). */\n complaintOffer?: MessengerComplaintOffer;\n /** Scout offered to file or upvote a feature request (absent otherwise). */\n ideaOffer?: MessengerIdeaOffer;\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 /** The complaint filed in this conversation, latest first (absent when none). */\n complaint?: MessengerComplaint;\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 FileComplaintResponse {\n complaint: MessengerComplaint;\n conversation: MessengerConversation;\n /** Token of the conversation started for it (absent when it was filed in an existing one). */\n token?: string;\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 /** Guide keys of the article's \"Show me\" prompts (absent = none). */\n walkthroughs?: string[];\n hasVideo?: boolean;\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 /** Key of the interactive tour made from it, when that tour is live in this environment (\"Show me\"). */\n guideKey?: string;\n /** The how-to has a video. */\n hasVideo?: boolean;\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 /** Video made from the how-to (WebM), played above the steps. */\n video?: { url: string };\n}\n","import { z } from \"zod\";\nimport { MAX_COMPLAINT_ANSWER_LENGTH, MAX_COMPLAINT_ATTACHMENT_BYTES, MAX_COMPLAINT_LENGTH } from \"./complaints-limits\";\n\nexport * from \"./complaints-limits\";\n\nexport const FileComplaintSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n categoryId: z.string().min(1).max(64),\n description: z.string().trim().min(1).max(MAX_COMPLAINT_LENGTH),\n /** Answers to the category's extra questions, by field id. */\n answers: z.record(z.string().max(64), z.string().trim().max(MAX_COMPLAINT_ANSWER_LENGTH)).default({}),\n /** Required from visitors the app hasn't identified. */\n email: z.string().trim().toLowerCase().email().max(254).optional().nullable(),\n pageUrl: z.string().max(2000).optional(),\n /** File it in this conversation (send its token in `X-Guidely-Conversation`); otherwise a new one is started. */\n conversationId: z.string().min(1).max(64).optional().nullable(),\n /** One screenshot, base64-encoded (png, jpeg, webp or gif). */\n attachment: z\n .object({\n fileName: z.string().trim().min(1).max(200),\n data: z.string().max(Math.ceil((MAX_COMPLAINT_ATTACHMENT_BYTES * 4) / 3) + 4),\n })\n .optional()\n .nullable(),\n});\nexport type FileComplaintRequest = z.infer<typeof FileComplaintSchema>;\n","import { z } from \"zod\";\nimport {\n AGENT_METADATA_MAX_BYTES,\n AGENT_METADATA_MAX_KEYS,\n AGENT_OUTCOMES,\n AGENT_TOOL_CALLS_PER_TURN,\n AGENT_TOOL_STATUSES,\n AGENT_TURN_MAX_TEXT,\n AGENT_TURN_ROLES,\n AGENT_TURNS_PER_BATCH,\n SCOUT_AGENT_ID,\n} from \"./agents-limits\";\nimport { SENSITIVE_PROPERTY_PATTERN } from \"./events-util\";\n\nexport * from \"./agents-limits\";\n\nconst ENVIRONMENTS = [\"development\", \"staging\", \"production\"] as const;\n\n/** A tool call: name, status and latency only. Anything else (arguments, results) is dropped, never stored. */\nexport const AgentToolCallSchema = z\n .object({\n name: z.string().trim().min(1).max(100),\n status: z.enum(AGENT_TOOL_STATUSES).optional(),\n latencyMs: z.number().int().min(0).max(3_600_000).optional(),\n })\n .strip();\n\n/**\n * Flat metadata: string, number, boolean or null values (others, such as nested objects, are dropped).\n * Keys starting with `$` (reserved) and keys that look sensitive (password, token, card…) are dropped;\n * strings are cut to 500 characters, and keys past the count or size limit are left out.\n */\nexport const AgentMetadataSchema = z\n .record(z.string().max(100), z.unknown())\n .transform((m) => {\n const out: Record<string, string | number | boolean | null> = {};\n let size = 0;\n for (const [k, v] of Object.entries(m)) {\n const key = k.trim();\n if (!key || key.startsWith(\"$\") || SENSITIVE_PROPERTY_PATTERN.test(key)) continue;\n if (!(typeof v === \"string\" || typeof v === \"boolean\" || v === null || (typeof v === \"number\" && Number.isFinite(v)))) continue;\n const value = typeof v === \"string\" ? v.slice(0, 500) : v;\n size += key.length + String(value).length;\n if (size > AGENT_METADATA_MAX_BYTES || Object.keys(out).length >= AGENT_METADATA_MAX_KEYS) break;\n out[key] = value;\n }\n return out;\n });\n\nconst id = (max: number) => z.string().trim().min(1).max(max);\nconst optionalId = (max: number) => z.string().trim().max(max).optional().nullable().transform((v) => v || null);\n\nexport const AgentTurnInputSchema = z.object({\n type: z.literal(\"agent.conversation\").optional(),\n conversationId: id(128),\n agentId: id(64).refine((v) => v.toLowerCase() !== SCOUT_AGENT_ID, { message: `\"${SCOUT_AGENT_ID}\" is reserved for Guidely's built-in Scout agent` }),\n agentName: z.string().trim().max(100).optional(),\n turnId: z.string().trim().min(1).max(128).optional(),\n role: z.enum(AGENT_TURN_ROLES),\n text: z.string().max(AGENT_TURN_MAX_TEXT).default(\"\"),\n toolCalls: z.array(AgentToolCallSchema).max(AGENT_TOOL_CALLS_PER_TURN).default([]),\n latencyMs: z.number().int().min(0).max(3_600_000).optional(),\n outcome: z.enum(AGENT_OUTCOMES).optional(),\n taskSuccess: z.boolean().optional(),\n occurredAt: z.string().datetime({ offset: true }).optional(),\n userId: optionalId(256),\n anonymousId: optionalId(128),\n accountId: optionalId(256),\n sessionId: optionalId(128),\n metadata: AgentMetadataSchema.default({}),\n});\nexport type AgentTurn = z.output<typeof AgentTurnInputSchema>;\n\nconst turns = z.array(AgentTurnInputSchema).min(1).max(AGENT_TURNS_PER_BATCH);\nconst sdkInfo = z.object({ name: z.string().max(60), version: z.string().max(30) }).optional();\n\n/** Body of `POST /api/v1/sdk/agent-events` (browser SDK, public key). */\nexport const SdkAgentEventsSchema = z.object({ turns, sdk: sdkInfo });\nexport type SdkAgentEvents = z.output<typeof SdkAgentEventsSchema>;\n\n/**\n * Body of `POST /api/v1/agent-events` (server to server, secret key): `{ turns: [...], environment? }`,\n * a bare array of turns, or a single turn (with `environment` beside its fields).\n */\nexport const AgentEventsRequestSchema = z.preprocess(\n (v) => {\n if (Array.isArray(v)) return { turns: v };\n if (v && typeof v === \"object\" && !(\"turns\" in v)) {\n const { environment, ...turn } = v as Record<string, unknown>;\n return { turns: [turn], environment };\n }\n return v;\n },\n z.object({ turns, environment: z.enum(ENVIRONMENTS).default(\"production\"), sdk: sdkInfo }),\n);\nexport type AgentEventsRequest = z.output<typeof AgentEventsRequestSchema>;\n","import { z } from \"zod\";\nimport { FEEDBACK_PRIORITIES, FEEDBACK_STATUSES, MAX_FEEDBACK_COMMENT, MAX_FEEDBACK_DESCRIPTION, MAX_FEEDBACK_NOTE, MAX_FEEDBACK_TITLE } from \"./feedback-limits\";\n\nexport * from \"./feedback-limits\";\n\n/** Who is asking, as the SDK (or the portal session) knows them. Unverified unless it came from a signed link. */\nconst visitor = {\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n};\n\nexport const FeedbackListRequestSchema = z.object({\n ...visitor,\n q: z.string().trim().max(200).optional(),\n sort: z.enum([\"top\", \"new\", \"trending\"]).default(\"top\"),\n status: z.enum(FEEDBACK_STATUSES).optional(),\n /** \"open\" = not released or declined. */\n filter: z.enum([\"open\", \"all\", \"mine\", \"following\"]).default(\"open\"),\n productArea: z.string().trim().max(60).optional(),\n page: z.number().int().min(1).max(100).default(1),\n});\nexport type FeedbackListRequest = z.infer<typeof FeedbackListRequestSchema>;\n\nexport const FeedbackVisitorSchema = z.object(visitor);\nexport type FeedbackVisitorRequest = z.infer<typeof FeedbackVisitorSchema>;\n\nexport const SubmitFeedbackSchema = z.object({\n ...visitor,\n title: z.string().trim().min(3, \"Give your idea a short title\").max(MAX_FEEDBACK_TITLE),\n description: z.string().trim().max(MAX_FEEDBACK_DESCRIPTION).default(\"\"),\n productArea: z.string().trim().max(60).optional().nullable(),\n priority: z.enum(FEEDBACK_PRIORITIES).default(\"nice_to_have\"),\n /** Filed from this Scout conversation (Scout offered it). */\n conversationId: z.string().min(1).max(64).optional().nullable(),\n pageUrl: z.string().max(2000).optional(),\n});\nexport type SubmitFeedbackRequest = z.infer<typeof SubmitFeedbackSchema>;\n\nexport const FeedbackVoteSchema = z.object({\n ...visitor,\n priority: z.enum(FEEDBACK_PRIORITIES).default(\"nice_to_have\"),\n note: z.string().trim().max(MAX_FEEDBACK_NOTE).optional(),\n conversationId: z.string().min(1).max(64).optional().nullable(),\n});\nexport type FeedbackVoteRequest = z.infer<typeof FeedbackVoteSchema>;\n\nexport const FeedbackFollowSchema = z.object({ ...visitor, follow: z.boolean() });\nexport const FeedbackCommentSchema = z.object({ ...visitor, body: z.string().trim().min(1).max(MAX_FEEDBACK_COMMENT) });\nexport const FeedbackSimilarSchema = z.object({ ...visitor, title: z.string().trim().min(3).max(MAX_FEEDBACK_TITLE) });\nexport const FeedbackUpdatesReadSchema = z.object({ ...visitor, ids: z.array(z.string().min(1).max(64)).max(100).optional() });\n","/** Feedback (feature requests) types and limits shared by the server, the portal and the messenger runtime (zod-free). */\n\n/** Where a request is: shown to end users with FEEDBACK_STATUS_LABEL. */\nexport const FEEDBACK_STATUSES = [\"new\", \"under_review\", \"planned\", \"in_progress\", \"released\", \"declined\"] as const;\nexport type FeedbackStatus = (typeof FEEDBACK_STATUSES)[number];\n\nexport const FEEDBACK_STATUS_LABEL: Record<FeedbackStatus, string> = {\n new: \"New\",\n under_review: \"Under review\",\n planned: \"Planned\",\n in_progress: \"In progress\",\n released: \"Released\",\n declined: \"Declined\",\n};\n\n/** How much a voter needs it; weights 1 / 2 / 3 in the priority score. */\nexport const FEEDBACK_PRIORITIES = [\"nice_to_have\", \"important\", \"critical\"] as const;\nexport type FeedbackPriority = (typeof FEEDBACK_PRIORITIES)[number];\n\nexport const FEEDBACK_PRIORITY_LABEL: Record<FeedbackPriority, string> = { nice_to_have: \"Nice to have\", important: \"Important\", critical: \"Critical\" };\nexport const FEEDBACK_PRIORITY_WEIGHT: Record<FeedbackPriority, number> = { nice_to_have: 1, important: 2, critical: 3 };\n\n/** Events feedback integrations (Slack, webhooks) can get. */\nexport const FEEDBACK_EVENTS = [\"request.created\", \"request.status_changed\", \"request.voted\"] as const;\nexport type FeedbackEvent = (typeof FEEDBACK_EVENTS)[number];\n\nexport const MAX_FEEDBACK_TITLE = 140;\nexport const MAX_FEEDBACK_DESCRIPTION = 4000;\nexport const MAX_FEEDBACK_COMMENT = 2000;\nexport const MAX_FEEDBACK_NOTE = 500;\n\n/** \"#42\" for request number 42. */\nexport const feedbackReference = (number: number) => `#${number}`;\n\n/** A request as end users see it (messenger Ideas tab, portal). */\nexport interface PublicFeedbackRequest {\n id: string;\n number: number;\n title: string;\n description: string;\n status: FeedbackStatus;\n /** Public note shown with the status, when the team wrote one. */\n statusNote: string;\n productArea: string | null;\n votes: number;\n comments: number;\n /** This visitor's vote, if any. */\n myVote: { priority: FeedbackPriority } | null;\n following: boolean;\n /** The visitor submitted it. */\n mine: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface PublicFeedbackComment {\n id: string;\n authorName: string;\n /** \"team\" replies are shown with a badge. */\n authorType: \"user\" | \"team\";\n body: string;\n createdAt: string;\n}\n\nexport interface PublicFeedbackRequestDetail extends PublicFeedbackRequest {\n thread: PublicFeedbackComment[];\n}\n\nexport interface PublicFeedbackList {\n requests: PublicFeedbackRequest[];\n hasMore: boolean;\n}\n\n/** An update about a request the visitor follows (status changed, merged). */\nexport interface FeedbackUpdate {\n id: string;\n requestId: string | null;\n kind: \"status\" | \"merged\" | \"comment\";\n title: string;\n body: string;\n read: boolean;\n createdAt: string;\n}\n\nexport interface FeedbackUpdatesResponse {\n updates: FeedbackUpdate[];\n unread: number;\n}\n\n/** Ideas block of `MessengerConfig`; absent when the project hasn't turned on the Ideas tab. */\nexport interface MessengerIdeasConfig {\n /** Tab and heading title. */\n title: string;\n /** Visitors the app hasn't identified may vote and submit (otherwise they can only browse). */\n anonymous: boolean;\n /** Votes and new ideas need a signed identity: the messenger only browses and links to the portal. */\n readOnly: boolean;\n /** Product areas people may tag new ideas with. */\n productAreas: string[];\n /** The hosted portal is on (the messenger offers \"Open the portal\"). */\n portal: boolean;\n}\n\n/** Scout offered to file or upvote a feature request in a reply. */\nexport interface MessengerIdeaOffer {\n /** The matching request to upvote, or null to suggest a new one. */\n requestId: string | null;\n title: string;\n /** Prefilled description for a new idea (the person's words, summarised). */\n description: string;\n votes?: number;\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 * Mobile SDKs: `app_install`, `app_update`, `app_open` and `app_background` events (ignored on the web).\n * Optional in the type for older stored settings; `resolveCaptureSettings` always fills it.\n */\n appLifecycle?: 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(), appLifecycle: 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, appLifecycle: 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","/**\n * The script-tag install snippet's stub. It defines `window.Guidely` before the SDK has loaded, so\n * the page can call `Guidely.init(…)` and `Guidely.get().identify(…)` straight away: calls are\n * queued and replayed by the SDK when it arrives (`packages/embed`). If the SDK can't load at all\n * (Guidely unreachable, blocked by an extension), the calls simply do nothing and the page carries on.\n *\n * Queued calls are `[onClient, method, args]` in `Guidely._q`; `Guidely.get()` returns `Guidely._c`,\n * which the SDK upgrades in place to forward to the real client. Flag reads return their fallback\n * until then. ES5 only: it runs on the customer's page before anything else.\n */\nexport const SCRIPT_STUB_METHODS = [\n \"identify\",\n \"track\",\n \"page\",\n \"reset\",\n \"setAccount\",\n \"updateTraits\",\n \"setConsent\",\n \"setLocale\",\n \"startGuide\",\n \"stopGuide\",\n \"dismissGuide\",\n \"openMessenger\",\n \"closeMessenger\",\n \"showNewMessage\",\n \"openResourceCenter\",\n \"closeResourceCenter\",\n \"openChecklist\",\n \"closeChecklist\",\n \"completeChecklistTask\",\n \"openComplaint\",\n \"openIdeas\",\n \"captureException\",\n \"agentConversation\",\n \"trackAgentTurn\",\n \"on\",\n] as const;\n\nexport const SCRIPT_STUB = `!function(w){if(w.Guidely)return;var g=w.Guidely={_q:[]},c=g._c={};function q(o,k){o[k]=function(){g._q.push([o===c?1:0,k,[].slice.call(arguments)])}}q(g,\"init\");\"${SCRIPT_STUB_METHODS.join(\" \")}\".split(\" \").forEach(function(k){q(c,k)});c.isFeatureEnabled=function(k,f){return!!f};c.getFeatureValue=function(k,f){return f};g.get=function(){return c}}(window);`;\n\n/** The full script-tag install: stub, init (queued until the SDK loads), then the async SDK script. */\nexport function scriptSnippet(scriptUrl: string, initOptions: string): string {\n return `<script>\n ${SCRIPT_STUB}\n Guidely.init(${initOptions});\n</script>\n<script src=\"${scriptUrl}\" async></script>`;\n}\n","/**\n * Translation exchange files: XLIFF 1.2 (what translation tools and agencies expect) and CSV (for\n * spreadsheets). Both carry one target language; units are identified by their translation key.\n * Import reads XLIFF 1.2 and 2.x (`<trans-unit>` / `<unit>`) and CSVs with a `key` column plus a\n * `target` (or locale-named) column.\n */\n\nexport interface TranslationUnit {\n key: string;\n source: string;\n target: string;\n /** Where the text appears, for translators. */\n note?: string;\n}\n\nexport interface ParsedTranslations {\n targetLocale?: string;\n /** key → translated text (empty translations are left out). */\n entries: Record<string, string>;\n}\n\nfunction xmlEscape(s: string): string {\n return s.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\").replace(/\"/g, \"&quot;\");\n}\n\nfunction xmlUnescape(s: string): string {\n return s\n .replace(/<!\\[CDATA\\[([\\s\\S]*?)\\]\\]>/g, (_, c: string) => c.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\"))\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&quot;/g, '\"')\n .replace(/&apos;/g, \"'\")\n .replace(/&#(\\d+);/g, (_, d: string) => String.fromCodePoint(Number(d)))\n .replace(/&#x([0-9a-f]+);/gi, (_, h: string) => String.fromCodePoint(parseInt(h, 16)))\n .replace(/&amp;/g, \"&\");\n}\n\nexport function toXliff(units: readonly TranslationUnit[], opts: { sourceLocale: string; targetLocale: string; original: string }): string {\n const body = units\n .map(\n (u) =>\n ` <trans-unit id=\"${xmlEscape(u.key)}\">\\n <source>${xmlEscape(u.source)}</source>\\n <target${u.target ? \"\" : ' state=\"needs-translation\"'}>${xmlEscape(u.target)}</target>${u.note ? `\\n <note>${xmlEscape(u.note)}</note>` : \"\"}\\n </trans-unit>`,\n )\n .join(\"\\n\");\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<xliff version=\"1.2\" xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\\n <file original=\"${xmlEscape(opts.original)}\" source-language=\"${xmlEscape(opts.sourceLocale)}\" target-language=\"${xmlEscape(opts.targetLocale)}\" datatype=\"html\">\\n <body>\\n${body}\\n </body>\\n </file>\\n</xliff>\\n`;\n}\n\nexport function parseXliff(xml: string): ParsedTranslations {\n const target = xml.match(/target-language=\"([^\"]+)\"/)?.[1] ?? xml.match(/\\btrgLang=\"([^\"]+)\"/)?.[1];\n const entries: Record<string, string> = {};\n for (const m of xml.matchAll(/<(trans-unit|unit)\\b[^>]*\\bid=\"([^\"]*)\"[^>]*>([\\s\\S]*?)<\\/\\1>/g)) {\n const key = xmlUnescape(m[2]!);\n const t = m[3]!.match(/<target\\b[^>]*>([\\s\\S]*?)<\\/target>/);\n const text = t ? xmlUnescape(t[1]!) : \"\";\n if (key && text.trim()) entries[key] = text;\n }\n return { targetLocale: target ? xmlUnescape(target) : undefined, entries };\n}\n\nfunction csvCell(s: string): string {\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\n}\n\n/** CSV with columns key, context, source, <targetLocale>. */\nexport function toTranslationCsv(units: readonly TranslationUnit[], targetLocale: string): string {\n const rows = [[\"key\", \"context\", \"source\", targetLocale], ...units.map((u) => [u.key, u.note ?? \"\", u.source, u.target])];\n return rows.map((r) => r.map(csvCell).join(\",\")).join(\"\\r\\n\") + \"\\r\\n\";\n}\n\n/** RFC 4180 CSV parsing (quoted fields, doubled quotes, CRLF/LF). */\nexport function parseCsvRows(text: string): string[][] {\n const rows: string[][] = [];\n let row: string[] = [];\n let cell = \"\";\n let quoted = false;\n const src = text.replace(/^\\uFEFF/, \"\");\n for (let i = 0; i < src.length; i++) {\n const ch = src[i]!;\n if (quoted) {\n if (ch === '\"') {\n if (src[i + 1] === '\"') {\n cell += '\"';\n i++;\n } else quoted = false;\n } else cell += ch;\n } else if (ch === '\"') quoted = true;\n else if (ch === \",\") {\n row.push(cell);\n cell = \"\";\n } else if (ch === \"\\n\" || ch === \"\\r\") {\n if (ch === \"\\r\" && src[i + 1] === \"\\n\") i++;\n row.push(cell);\n rows.push(row);\n row = [];\n cell = \"\";\n } else cell += ch;\n }\n if (cell !== \"\" || row.length) {\n row.push(cell);\n rows.push(row);\n }\n return rows.filter((r) => r.some((c) => c.trim() !== \"\"));\n}\n\n/** Reads a translation CSV: the `key` column and the `target` column, else the last column not named key/context/source/label. */\nexport function parseTranslationCsv(text: string): ParsedTranslations {\n const [header, ...rows] = parseCsvRows(text);\n if (!header) return { entries: {} };\n const names = header.map((h) => h.trim());\n const lower = names.map((h) => h.toLowerCase());\n const keyCol = lower.indexOf(\"key\");\n if (keyCol < 0) return { entries: {} };\n let targetCol = lower.indexOf(\"target\");\n if (targetCol < 0) {\n for (let i = names.length - 1; i >= 0; i--) {\n if (![\"key\", \"context\", \"source\", \"label\", \"note\"].includes(lower[i]!)) {\n targetCol = i;\n break;\n }\n }\n }\n if (targetCol < 0) return { entries: {} };\n const entries: Record<string, string> = {};\n for (const r of rows) {\n const key = (r[keyCol] ?? \"\").trim();\n const value = r[targetCol] ?? \"\";\n if (key && value.trim()) entries[key] = value;\n }\n return { targetLocale: lower[targetCol] === \"target\" ? undefined : names[targetCol], entries };\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 \"./complaints\";\nexport * from \"./agents\";\nexport * from \"./feedback\";\nexport * from \"./capture\";\nexport * from \"./network\";\nexport * from \"./templates\";\nexport * from \"./media\";\nexport * from \"./resource-center\";\nexport * from \"./howto\";\nexport * from \"./page\";\nexport * from \"./tagging\";\nexport * from \"./snippet\";\nexport * from \"./localization\";\nexport * from \"./guide-experiments\";\nexport * from \"./custom-css\";\nexport * from \"./contrast\";\nexport * from \"./translation-files\";\nexport const SDK_API_VERSION = \"v1\";\nexport const SHARED_VERSION = \"0.11.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;AAKX,IAAM,cAAc,CAAC,QAAQ,SAAS,WAAW,UA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