@guidelytech/shared 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -964,7 +964,7 @@ function templateConfig(id) {
964
964
 
965
965
  // src/index.ts
966
966
  var SDK_API_VERSION = "v1";
967
- var SHARED_VERSION = "0.2.0";
967
+ var SHARED_VERSION = "0.2.1";
968
968
  // Annotate the CommonJS export names for ESM import in node:
969
969
  0 && (module.exports = {
970
970
  ADVANCE_ON,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/targeting.ts","../src/targeting-eval.ts","../src/guide.ts","../src/events.ts","../src/events-util.ts","../src/sdk-api.ts","../src/messenger.ts","../src/templates.ts"],"sourcesContent":["export * from \"./utils\";\nexport * from \"./targeting\";\nexport * from \"./guide\";\nexport * from \"./events\";\nexport * from \"./sdk-api\";\nexport * from \"./messenger\";\nexport * from \"./templates\";\nexport const SDK_API_VERSION = \"v1\";\nexport const SHARED_VERSION = \"0.2.0\";\n","/** FNV-1a 32-bit hash; deterministic across SDK and server for rollout bucketing. */\nexport function fnv1a(input: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < input.length; i++) {\n h ^= input.charCodeAt(i);\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return h >>> 0;\n}\n\n/** Deterministic 0-99 bucket for percentage rollouts. */\nexport function rolloutBucket(subject: string, salt: string): number {\n return fnv1a(`${salt}:${subject}`) % 100;\n}\n\nexport function slugify(input: string): string {\n return input\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 64) || \"untitled\";\n}\n\nconst ALPHABET = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n/** URL-safe random id. Uses crypto when available, falls back to Math.random (ids are not secrets). */\nexport function randomId(size = 16): string {\n const g: any = typeof globalThis !== \"undefined\" ? globalThis : {};\n let bytes: Uint8Array;\n if (g.crypto && typeof g.crypto.getRandomValues === \"function\") {\n bytes = new Uint8Array(size);\n g.crypto.getRandomValues(bytes);\n } else {\n bytes = new Uint8Array(size);\n for (let i = 0; i < size; i++) bytes[i] = Math.floor(Math.random() * 256);\n }\n let out = \"\";\n for (let i = 0; i < size; i++) out += ALPHABET[(bytes[i] as number) % ALPHABET.length];\n return out;\n}\n\nexport function isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/** Safe nested getter: get(obj, \"account.plan\") */\nexport function getPath(obj: unknown, path: string): unknown {\n if (!path) return obj;\n let cur: any = obj;\n for (const part of path.split(\".\")) {\n if (cur == null) return undefined;\n cur = cur[part];\n }\n return cur;\n}\n\nexport function clamp(n: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, n));\n}\n\n/** Glob-style URL pattern match: `*` matches any chars except `/`, `**` matches anything. */\nexport function matchUrlPattern(pattern: string, url: string): boolean {\n if (!pattern) return true;\n if (pattern === url) return true;\n const escaped = pattern\n .replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*\\*/g, \"__GLOBSTAR__\")\n .replace(/\\*/g, \"[^/]*\")\n .replace(/__GLOBSTAR__/g, \".*\");\n const re = new RegExp(`^${escaped}$`);\n return re.test(url) || re.test(stripOrigin(url));\n}\n\nexport function stripOrigin(url: string): string {\n try {\n const u = new URL(url);\n return u.pathname + u.search + u.hash;\n } catch {\n return url;\n }\n}\n\n/** Safe regexp construction with a length cap to limit ReDoS exposure. */\nexport function safeRegExp(source: string, flags = \"i\"): RegExp | null {\n if (!source || source.length > 200) return null;\n try {\n return new RegExp(source, flags);\n } catch {\n return null;\n }\n}\n","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","/**\n * Zod-free targeting evaluation. Imported by the browser SDK via `@guidelytech/shared/runtime`\n * so the runtime bundle does not pull in zod. Schemas live in ./targeting.ts.\n */\nimport { getPath, matchUrlPattern, rolloutBucket, safeRegExp } from \"./utils\";\n\nexport const RULE_OPERATORS = [\n \"equals\",\n \"not_equals\",\n \"contains\",\n \"not_contains\",\n \"starts_with\",\n \"ends_with\",\n \"exists\",\n \"not_exists\",\n \"gt\",\n \"gte\",\n \"lt\",\n \"lte\",\n \"in\",\n \"not_in\",\n \"regex\",\n \"is_true\",\n \"is_false\",\n \"before\",\n \"after\",\n] as const;\nexport type RuleOperator = (typeof RULE_OPERATORS)[number];\n\nexport const RULE_FIELDS = [\n \"user.attribute\",\n \"account.attribute\",\n \"user.role\",\n \"user.plan\",\n \"url.path\",\n \"url.full\",\n \"url.query\",\n \"device.type\",\n \"device.browser\",\n \"device.os\",\n \"visitor.firstVisit\",\n \"visitor.returning\",\n \"event.seen\",\n \"guide.completed\",\n \"guide.dismissed\",\n \"guide.seen\",\n \"checklist.completed\",\n \"audience.member\",\n \"datetime.now\",\n \"datetime.dayOfWeek\",\n \"datetime.hour\",\n \"rollout.percentage\",\n \"environment\",\n \"locale\",\n] as const;\nexport type RuleField = (typeof RULE_FIELDS)[number];\n\nexport interface Rule {\n id: string;\n field: RuleField;\n /** For attribute/query/event fields: the attribute key, query param name, event name, guide id... */\n key?: string;\n op: RuleOperator;\n value?: string | number | boolean | string[];\n /** When true, the rule is negated (exclusion rule). */\n negate?: boolean;\n}\n\nexport type RuleGroup = {\n id: string;\n op: \"and\" | \"or\";\n rules: Array<Rule | RuleGroup>;\n negate?: boolean;\n};\n\nexport function isRuleGroup(r: Rule | RuleGroup): r is RuleGroup {\n return (r as RuleGroup).rules !== undefined;\n}\n\nexport function emptyRuleGroup(id = \"root\"): RuleGroup {\n return { id, op: \"and\", rules: [] };\n}\n\n/** Everything targeting evaluation can see. Built by the SDK (browser) or the server. */\nexport interface TargetingContext {\n userId?: string | null;\n anonymousId: string;\n userAttributes: Record<string, unknown>;\n accountAttributes: Record<string, unknown>;\n url: string;\n path: string;\n query: Record<string, string>;\n device: { type: \"desktop\" | \"tablet\" | \"mobile\"; browser?: string; os?: string };\n firstVisit: boolean;\n eventsSeen: Set<string> | string[];\n completedGuides: Set<string> | string[];\n dismissedGuides: Set<string> | string[];\n seenGuides: Set<string> | string[];\n completedChecklists: Set<string> | string[];\n audienceIds: Set<string> | string[];\n now: Date;\n environment: string;\n locale?: string;\n /** Salt for rollout (guide id). Set per guide before evaluating. */\n rolloutSalt?: string;\n}\n\nfunction has(set: Set<string> | string[] | undefined, v: string): boolean {\n if (!set) return false;\n return set instanceof Set ? set.has(v) : set.includes(v);\n}\n\nfunction resolveField(rule: Rule, ctx: TargetingContext): unknown {\n switch (rule.field) {\n case \"user.attribute\":\n return rule.key ? getPath(ctx.userAttributes, rule.key) : undefined;\n case \"account.attribute\":\n return rule.key ? getPath(ctx.accountAttributes, rule.key) : undefined;\n case \"user.role\":\n return ctx.userAttributes.role;\n case \"user.plan\":\n return ctx.userAttributes.plan ?? ctx.accountAttributes.plan;\n case \"url.path\":\n return ctx.path;\n case \"url.full\":\n return ctx.url;\n case \"url.query\":\n return rule.key ? ctx.query[rule.key] : undefined;\n case \"device.type\":\n return ctx.device.type;\n case \"device.browser\":\n return ctx.device.browser;\n case \"device.os\":\n return ctx.device.os;\n case \"visitor.firstVisit\":\n return ctx.firstVisit;\n case \"visitor.returning\":\n return !ctx.firstVisit;\n case \"event.seen\":\n return rule.key ? has(ctx.eventsSeen, rule.key) : false;\n case \"guide.completed\":\n return rule.key ? has(ctx.completedGuides, rule.key) : false;\n case \"guide.dismissed\":\n return rule.key ? has(ctx.dismissedGuides, rule.key) : false;\n case \"guide.seen\":\n return rule.key ? has(ctx.seenGuides, rule.key) : false;\n case \"checklist.completed\":\n return rule.key ? has(ctx.completedChecklists, rule.key) : false;\n case \"audience.member\":\n return rule.key ? has(ctx.audienceIds, rule.key) : false;\n case \"datetime.now\":\n return ctx.now.toISOString();\n case \"datetime.dayOfWeek\":\n return ctx.now.getDay();\n case \"datetime.hour\":\n return ctx.now.getHours();\n case \"rollout.percentage\":\n return rolloutBucket(ctx.userId || ctx.anonymousId, ctx.rolloutSalt || \"guidely\");\n case \"environment\":\n return ctx.environment;\n case \"locale\":\n return ctx.locale;\n default:\n return undefined;\n }\n}\n\nfunction toNumber(v: unknown): number | null {\n if (typeof v === \"number\") return v;\n if (typeof v === \"string\" && v.trim() !== \"\" && !Number.isNaN(Number(v))) return Number(v);\n if (v instanceof Date) return v.getTime();\n return null;\n}\n\nfunction toDateMs(v: unknown): number | null {\n if (v instanceof Date) return v.getTime();\n if (typeof v === \"string\") {\n const t = Date.parse(v);\n return Number.isNaN(t) ? null : t;\n }\n if (typeof v === \"number\") return v;\n return null;\n}\n\nexport function compare(op: RuleOperator, actual: unknown, expected: Rule[\"value\"]): boolean {\n switch (op) {\n case \"exists\":\n return actual !== undefined && actual !== null && actual !== \"\";\n case \"not_exists\":\n return actual === undefined || actual === null || actual === \"\";\n case \"is_true\":\n return actual === true || actual === \"true\";\n case \"is_false\":\n return actual === false || actual === \"false\";\n case \"equals\":\n if (typeof actual === \"boolean\") return String(actual) === String(expected);\n return String(actual ?? \"\") === String(expected ?? \"\");\n case \"not_equals\":\n return String(actual ?? \"\") !== String(expected ?? \"\");\n case \"contains\":\n return typeof actual === \"string\" && actual.toLowerCase().includes(String(expected ?? \"\").toLowerCase());\n case \"not_contains\":\n return !(typeof actual === \"string\" && actual.toLowerCase().includes(String(expected ?? \"\").toLowerCase()));\n case \"starts_with\":\n return typeof actual === \"string\" && actual.startsWith(String(expected ?? \"\"));\n case \"ends_with\":\n return typeof actual === \"string\" && actual.endsWith(String(expected ?? \"\"));\n case \"gt\":\n case \"gte\":\n case \"lt\":\n case \"lte\": {\n const a = toNumber(actual);\n const b = toNumber(expected);\n if (a === null || b === null) return false;\n return op === \"gt\" ? a > b : op === \"gte\" ? a >= b : op === \"lt\" ? a < b : a <= b;\n }\n case \"in\": {\n const list = Array.isArray(expected) ? expected : String(expected ?? \"\").split(\",\").map((s) => s.trim());\n return list.includes(String(actual ?? \"\"));\n }\n case \"not_in\": {\n const list = Array.isArray(expected) ? expected : String(expected ?? \"\").split(\",\").map((s) => s.trim());\n return !list.includes(String(actual ?? \"\"));\n }\n case \"regex\": {\n const re = safeRegExp(String(expected ?? \"\"));\n return !!re && typeof actual === \"string\" && re.test(actual);\n }\n case \"before\": {\n const a = toDateMs(actual);\n const b = toDateMs(expected);\n return a !== null && b !== null && a < b;\n }\n case \"after\": {\n const a = toDateMs(actual);\n const b = toDateMs(expected);\n return a !== null && b !== null && a > b;\n }\n default:\n return false;\n }\n}\n\nexport function evaluateRule(rule: Rule, ctx: TargetingContext): boolean {\n let result: boolean;\n if (rule.field === \"url.path\" || rule.field === \"url.full\") {\n const actual = String(resolveField(rule, ctx) ?? \"\");\n if (rule.op === \"equals\") result = matchUrlPattern(String(rule.value ?? \"\"), actual);\n else if (rule.op === \"not_equals\") result = !matchUrlPattern(String(rule.value ?? \"\"), actual);\n else result = compare(rule.op, actual, rule.value);\n } else {\n result = compare(rule.op, resolveField(rule, ctx), rule.value);\n }\n return rule.negate ? !result : result;\n}\n\n/** Evaluate a rule tree. An empty group matches everyone. */\nexport function evaluateRules(group: RuleGroup | null | undefined, ctx: TargetingContext): boolean {\n if (!group || group.rules.length === 0) return group?.negate ? false : true;\n const results = group.rules.map((r) => (isRuleGroup(r) ? evaluateRules(r, ctx) : evaluateRule(r, ctx)));\n const value = group.op === \"and\" ? results.every(Boolean) : results.some(Boolean);\n return group.negate ? !value : value;\n}\n\n/** Fields whose evaluation requires server-held data. Used by docs/UI to annotate rules. */\nexport const SERVER_ASSISTED_FIELDS: RuleField[] = [\"audience.member\", \"guide.completed\", \"guide.dismissed\", \"guide.seen\", \"checklist.completed\"];\n\nexport function describeRule(rule: Rule): string {\n const subject = rule.key ? `${rule.field}[${rule.key}]` : rule.field;\n const v = Array.isArray(rule.value) ? rule.value.join(\", \") : rule.value === undefined ? \"\" : String(rule.value);\n return `${rule.negate ? \"NOT \" : \"\"}${subject} ${rule.op.replace(/_/g, \" \")}${v ? ` \"${v}\"` : \"\"}`;\n}\n","import { z } from \"zod\";\nimport { RuleGroupSchema, emptyRuleGroup, type RuleGroup } from \"./targeting\";\n\nexport const GUIDE_KINDS = [\"flow\", \"modal\", \"tooltip\", \"banner\", \"checklist\", \"survey\", \"announcement\"] as const;\nexport type GuideKind = (typeof GUIDE_KINDS)[number];\n\nexport const GUIDE_STATUSES = [\"draft\", \"published\", \"paused\", \"archived\"] as const;\nexport type GuideStatus = (typeof GUIDE_STATUSES)[number];\n\nexport const STEP_TYPES = [\"modal\", \"tooltip\", \"popover\", \"spotlight\", \"hotspot\", \"banner\", \"slideout\", \"checklist\", \"custom\", \"survey\"] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n\nexport const PLACEMENTS = [\"top\", \"top-start\", \"top-end\", \"right\", \"right-start\", \"right-end\", \"bottom\", \"bottom-start\", \"bottom-end\", \"left\", \"left-start\", \"left-end\", \"auto\"] as const;\nexport type Placement = (typeof PLACEMENTS)[number];\n\nexport const SELECTOR_KINDS = [\"css\", \"id\", \"data-attr\", \"aria\", \"text\", \"xpath\"] as const;\nexport const SelectorStrategySchema = z.object({\n kind: z.enum(SELECTOR_KINDS),\n value: z.string().min(1).max(1000),\n /** Optional human-readable label captured at pick time. */\n label: z.string().max(200).optional(),\n});\nexport type SelectorStrategy = z.infer<typeof SelectorStrategySchema>;\n\nexport const TargetSchema = z.object({\n /** Ordered strategies; the first one resolving to exactly one element wins. */\n selectors: z.array(SelectorStrategySchema).max(10),\n /** How long to wait for the element before applying fallback. */\n waitMs: z.number().int().min(0).max(60000).default(5000),\n /** What to do when the element never shows up. */\n fallback: z.enum([\"skip\", \"show_as_modal\", \"end_guide\", \"wait\"]).default(\"skip\"),\n /** Scroll the element into view before positioning. */\n scrollIntoView: z.boolean().default(true),\n /** Text snapshot captured at pick time; used for authoring warnings. */\n textSnapshot: z.string().max(200).optional(),\n});\nexport type StepTarget = z.infer<typeof TargetSchema>;\n\nexport const BUTTON_ACTIONS = [\"next\", \"back\", \"dismiss\", \"complete\", \"skip\", \"url\", \"start_guide\", \"event\", \"open_resource_center\", \"none\"] as const;\nexport const ButtonSchema = z.object({\n id: z.string().min(1),\n label: z.string().min(1).max(80),\n action: z.enum(BUTTON_ACTIONS),\n variant: z.enum([\"primary\", \"secondary\", \"ghost\", \"link\"]).default(\"primary\"),\n /** url for `url`, guide id for `start_guide`, event name for `event`, step id for `next` branch override */\n value: z.string().max(2000).optional(),\n newTab: z.boolean().optional(),\n});\nexport type StepButton = z.infer<typeof ButtonSchema>;\n\nexport const StepBranchSchema = z.object({\n id: z.string(),\n /** Rule group evaluated against targeting context when leaving the step. */\n when: RuleGroupSchema,\n /** Step id to jump to. */\n goTo: z.string(),\n});\n\nexport const ADVANCE_ON = [\"button\", \"element_click\", \"element_visible\", \"event\", \"delay\", \"any\"] as const;\n\nexport const StepSchema = z.object({\n id: z.string().min(1).max(64),\n type: z.enum(STEP_TYPES),\n title: z.string().max(200).default(\"\"),\n /** Sanitized HTML body (links, images, lists, formatting). */\n body: z.string().max(20000).default(\"\"),\n imageUrl: z.string().url().max(2000).optional().or(z.literal(\"\")),\n buttons: z.array(ButtonSchema).max(6).default([]),\n target: TargetSchema.optional(),\n placement: z.enum(PLACEMENTS).default(\"auto\"),\n /** Pixel offset between anchor and card. */\n offset: z.number().int().min(0).max(64).default(10),\n showOverlay: z.boolean().default(false),\n showProgress: z.boolean().default(true),\n showClose: z.boolean().default(true),\n dismissOnOutsideClick: z.boolean().default(false),\n /** Highlight padding for spotlight. */\n spotlightPadding: z.number().int().min(0).max(64).default(6),\n /** Banner/slideout position. */\n position: z.enum([\"top\", \"bottom\", \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\", \"center\"]).default(\"bottom-right\"),\n /** URL pattern this step belongs to (for multi-page flows). */\n url: z.string().max(500).optional(),\n /** Automatic advancement. */\n advanceOn: z.enum(ADVANCE_ON).default(\"button\"),\n advanceValue: z.string().max(500).optional(),\n advanceDelayMs: z.number().int().min(0).max(600000).optional(),\n branches: z.array(StepBranchSchema).max(10).default([]),\n width: z.number().int().min(200).max(900).optional(),\n /** Step-level targeting: skip step when rules do not match. */\n targeting: RuleGroupSchema.optional(),\n /** Hotspot pulse dot settings. */\n hotspot: z.object({ size: z.number().int().min(8).max(40).default(14), pulse: z.boolean().default(true), openOn: z.enum([\"click\", \"hover\"]).default(\"click\") }).optional(),\n /** Custom step: arbitrary sanitized HTML with no chrome. */\n customHtml: z.string().max(50000).optional(),\n});\nexport type GuideStep = z.infer<typeof StepSchema>;\nexport type GuideStepInput = z.input<typeof StepSchema>;\n\nexport const TRIGGER_TYPES = [\"page_load\", \"url_match\", \"event\", \"element_click\", \"element_visible\", \"manual\", \"delay\", \"after_guide\", \"segment_enter\"] as const;\nexport const TriggerSchema = z.object({\n type: z.enum(TRIGGER_TYPES).default(\"page_load\"),\n /** url pattern, event name, selector, guide id, audience id depending on type */\n value: z.string().max(1000).optional(),\n delayMs: z.number().int().min(0).max(600000).default(0),\n /** Also require URL to match this pattern (any trigger). */\n urlPattern: z.string().max(500).optional(),\n});\nexport type TriggerConfig = z.infer<typeof TriggerSchema>;\n\nexport const FrequencySchema = z.object({\n mode: z.enum([\"once\", \"once_per_session\", \"every_time\", \"interval\"]).default(\"once\"),\n intervalHours: z.number().int().min(1).max(8760).optional(),\n maxImpressions: z.number().int().min(1).max(1000).optional(),\n /** Hours to wait after dismissal before eligible again (when not `once`). */\n cooldownHours: z.number().int().min(0).max(8760).default(0),\n /** Lower number wins when multiple guides qualify. */\n priority: z.number().int().min(0).max(1000).default(100),\n /** Guide ids that must not be active at the same time. */\n mutuallyExclusiveWith: z.array(z.string()).max(50).default([]),\n /** Re-show if dismissed (otherwise dismissal counts as completion for frequency). */\n reshowAfterDismiss: z.boolean().default(false),\n});\nexport type FrequencyConfig = z.infer<typeof FrequencySchema>;\n\nexport const AppearanceSchema = z.object({\n theme: z.enum([\"light\", \"dark\", \"auto\"]).default(\"auto\"),\n primaryColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n borderRadius: z.number().int().min(0).max(32).optional(),\n fontFamily: z.string().max(200).optional(),\n overlayOpacity: z.number().min(0).max(1).optional(),\n zIndex: z.number().int().min(1).max(2147483647).optional(),\n preset: z.string().max(50).optional(),\n animation: z.enum([\"fade\", \"slide\", \"none\"]).default(\"fade\"),\n});\nexport type Appearance = z.infer<typeof AppearanceSchema>;\n\nexport const ChecklistTaskSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1).max(200),\n description: z.string().max(2000).default(\"\"),\n /** How the task completes. */\n completion: z.enum([\"manual\", \"event\", \"guide_completed\", \"url_visited\", \"click\"]).default(\"manual\"),\n completionValue: z.string().max(500).optional(),\n /** Optional action when clicking the task. */\n action: z.enum([\"none\", \"start_guide\", \"url\", \"event\"]).default(\"none\"),\n actionValue: z.string().max(2000).optional(),\n required: z.boolean().default(true),\n});\nexport type ChecklistTask = z.infer<typeof ChecklistTaskSchema>;\n\nexport const ChecklistConfigSchema = z.object({\n tasks: z.array(ChecklistTaskSchema).min(1).max(30),\n ordered: z.boolean().default(false),\n launcherLabel: z.string().max(60).default(\"Getting started\"),\n position: z.enum([\"bottom-right\", \"bottom-left\"]).default(\"bottom-right\"),\n completionTitle: z.string().max(200).default(\"You're all set!\"),\n completionBody: z.string().max(2000).default(\"\"),\n autoOpen: z.boolean().default(true),\n dismissible: z.boolean().default(true),\n});\nexport type ChecklistConfig = z.infer<typeof ChecklistConfigSchema>;\n\nexport const SURVEY_QUESTION_TYPES = [\"nps\", \"csat\", \"thumbs\", \"single_choice\", \"multiple_choice\", \"text\", \"rating\"] as const;\nexport const SurveyQuestionSchema = z.object({\n id: z.string().min(1),\n type: z.enum(SURVEY_QUESTION_TYPES),\n title: z.string().min(1).max(500),\n description: z.string().max(1000).default(\"\"),\n required: z.boolean().default(true),\n options: z.array(z.object({ id: z.string(), label: z.string().max(200) })).max(20).default([]),\n scaleMax: z.number().int().min(2).max(10).optional(),\n lowLabel: z.string().max(60).optional(),\n highLabel: z.string().max(60).optional(),\n placeholder: z.string().max(200).optional(),\n /** Conditional follow-up: show only when a previous answer matches. */\n showWhen: z.object({ questionId: z.string(), op: z.enum([\"equals\", \"lte\", \"gte\", \"in\"]), value: z.union([z.string(), z.number(), z.array(z.string())]) }).optional(),\n});\nexport type SurveyQuestion = z.infer<typeof SurveyQuestionSchema>;\n\nexport const SurveyConfigSchema = z.object({\n questions: z.array(SurveyQuestionSchema).min(1).max(20),\n thankYouTitle: z.string().max(200).default(\"Thanks for your feedback!\"),\n thankYouBody: z.string().max(2000).default(\"\"),\n position: z.enum([\"bottom-right\", \"bottom-left\", \"center\"]).default(\"bottom-right\"),\n startAt: z.string().datetime().optional(),\n endAt: z.string().datetime().optional(),\n});\nexport type SurveyConfig = z.infer<typeof SurveyConfigSchema>;\n\nexport const GuideConfigSchema = z.object({\n steps: z.array(StepSchema).max(50).default([]),\n targeting: RuleGroupSchema.default(() => emptyRuleGroup()),\n trigger: TriggerSchema.default({}),\n frequency: FrequencySchema.default({}),\n appearance: AppearanceSchema.default({}),\n checklist: ChecklistConfigSchema.optional(),\n survey: SurveyConfigSchema.optional(),\n /** Restrict guide to url pattern(s) (applied before trigger). */\n urlPatterns: z.array(z.string().max(500)).max(20).default([]),\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 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 (!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] as const;\nexport type EventName = (typeof EVENT_NAMES)[number];\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\";\n","/** Reserved property names that are stripped from `properties` to avoid collecting sensitive data. */\nexport const SENSITIVE_PROPERTY_PATTERN = /(password|passwd|secret|token|credit|card|cvv|ssn|iban)/i;\n\nexport const MAX_PROPERTY_BYTES = 8 * 1024;\n\nexport function sanitizeProperties(props: Record<string, unknown> | undefined): Record<string, unknown> {\n if (!props) return {};\n const out: Record<string, unknown> = {};\n let size = 0;\n for (const [k, v] of Object.entries(props)) {\n if (SENSITIVE_PROPERTY_PATTERN.test(k)) continue;\n if (typeof v === \"function\" || typeof v === \"symbol\") continue;\n const str = typeof v === \"string\" ? v : JSON.stringify(v ?? null);\n size += k.length + (str?.length ?? 0);\n if (size > MAX_PROPERTY_BYTES) break;\n out[k.slice(0, 100)] = typeof v === \"string\" ? v.slice(0, 1000) : v;\n }\n return out;\n}\n","import { z } from \"zod\";\nimport { GuideConfigSchema, ProjectThemeSchema, type GuideKind, type GuideConfig } from \"./guide\";\nimport type { MessengerConfig } from \"./messenger\";\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 updatedAt: 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: Array<{ id: string; name: string; description: string; order: number }>;\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 };\n generatedAt: string;\n}\n\nexport const IdentifyRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().min(1).max(256).optional().nullable(),\n traits: z.record(z.unknown()).optional(),\n account: z\n .object({ id: z.string().min(1).max(256), traits: z.record(z.unknown()).optional() })\n .optional()\n .nullable(),\n sessionId: z.string().max(128).optional(),\n url: z.string().max(2000).optional(),\n});\nexport type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;\n\n/** Server-held state the SDK needs for targeting & frequency. */\nexport interface IdentifyResponse {\n endUserId: string;\n audienceIds: string[];\n guideState: Record<\n string,\n { impressions: number; completedAt?: string | null; dismissedAt?: string | null; lastShownAt?: string | null }\n >;\n checklistProgress: Record<string, { completedTaskIds: string[]; completedAt?: string | null; dismissedAt?: string | null }>;\n surveysSubmitted: string[];\n firstSeenAt: string;\n}\n\nexport const ChecklistProgressRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int().optional(),\n completedTaskIds: z.array(z.string().max(64)).max(100),\n dismissed: z.boolean().optional(),\n completed: z.boolean().optional(),\n});\nexport type ChecklistProgressRequest = z.infer<typeof ChecklistProgressRequestSchema>;\n\nexport const SurveyResponseRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n accountId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int(),\n answers: z.record(z.union([z.string().max(5000), z.number(), z.boolean(), z.array(z.string().max(500)).max(50)])),\n responseId: z.string().min(8).max(64),\n});\nexport type SurveyResponseRequest = z.infer<typeof SurveyResponseRequestSchema>;\n\nexport const GuideStateUpdateSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n updates: z\n .array(\n z.object({\n guideId: z.string(),\n impression: z.boolean().optional(),\n completed: z.boolean().optional(),\n dismissed: z.boolean().optional(),\n }),\n )\n .max(50),\n});\n\nexport const AuthoringPickSchema = z.object({\n stepId: z.string().max(64).optional(),\n selectors: z.array(z.object({ kind: z.string(), value: z.string().max(1000), label: z.string().max(200).optional() })).max(10),\n textSnapshot: z.string().max(200).optional(),\n url: z.string().max(2000).optional(),\n rect: z.object({ x: z.number(), y: z.number(), width: z.number(), height: z.number() }).optional(),\n});\nexport type AuthoringPick = z.infer<typeof AuthoringPickSchema>;\n\n/**\n * Static, script-free copy of the page an authoring session is connected to. The SDK posts it to\n * the dashboard (never to the API) so the editor canvas can show the customer's real app.\n */\nexport interface AppSnapshot {\n /** Full HTML document (doctype included) with scripts and Guidely UI removed and a `<base>` pointing at `url`. */\n html: string;\n url: string;\n title: string;\n /** Viewport the snapshot was taken at, in CSS pixels. */\n width: number;\n height: number;\n capturedAt: string;\n}\n\nexport interface AuthoringSessionInfo {\n id: string;\n projectId: string;\n environment: string;\n guideId: string | null;\n dashboardOrigin: string;\n expiresAt: string;\n /** Draft guide config to preview while authoring (not published). */\n draft: { id: string; key: string; name: string; kind: GuideKind; config: GuideConfig } | null;\n}\n\nexport const PublishedGuideSchema = z.object({\n id: z.string(),\n key: z.string(),\n name: z.string(),\n kind: z.string(),\n version: z.number(),\n config: GuideConfigSchema,\n publishedAt: z.string(),\n});\n\nexport interface ApiError {\n error: { code: string; message: string; details?: unknown };\n}\n","import { z } from \"zod\";\n\n/** Messenger settings delivered to the SDK in `SdkConfigResponse.messenger`. */\nexport interface MessengerConfig {\n enabled: boolean;\n /** Display name of the AI agent (\"Scout\"). */\n name: string;\n greeting: string;\n /** Scout answers with AI; when false every conversation goes to the team inbox. */\n aiAvailable: boolean;\n handoffEnabled: boolean;\n launcher: { position: \"bottom-right\" | \"bottom-left\" };\n}\n\nexport const MESSAGE_AUTHORS = [\"user\", \"scout\", \"agent\", \"system\"] as const;\nexport type MessageAuthor = (typeof MESSAGE_AUTHORS)[number];\nexport type ConversationStatus = \"bot\" | \"open\" | \"closed\";\n\nexport interface MessengerCitation {\n articleId: string;\n title: string;\n}\n\nexport interface MessengerSuggestedGuide {\n key: string;\n name: string;\n}\n\nexport interface MessengerMessage {\n id: string;\n author: MessageAuthor;\n /** Team member name for `agent` messages. */\n authorName?: string | null;\n body: string;\n citations: MessengerCitation[];\n suggestedGuides: MessengerSuggestedGuide[];\n status: \"pending\" | \"complete\" | \"failed\";\n createdAt: string;\n}\n\nexport interface MessengerConversation {\n id: string;\n status: ConversationStatus;\n subject: string;\n lastMessageAt: string;\n lastMessagePreview: string;\n unread: number;\n rating: number | null;\n}\n\nexport const MAX_MESSAGE_LENGTH = 4000;\nconst messageText = z.string().trim().min(1).max(MAX_MESSAGE_LENGTH);\n\nexport const StartConversationSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n message: messageText,\n pageUrl: z.string().max(2000).optional(),\n});\nexport type StartConversationRequest = z.infer<typeof StartConversationSchema>;\n\nexport interface StartConversationResponse {\n conversation: MessengerConversation;\n /** Secret that authorises this browser to read and post in the conversation. Store it; it is not shown again. */\n token: string;\n messages: MessengerMessage[];\n}\n\nexport const ConversationLookupSchema = z.object({\n tokens: z.array(z.string().min(16).max(128)).max(50),\n});\n\nexport interface ConversationLookupResponse {\n conversations: Array<MessengerConversation & { token: string }>;\n}\n\nexport const PostMessageSchema = z.object({ message: messageText });\n\nexport const ConversationRatingSchema = z.object({\n rating: z.number().int().min(1).max(5),\n comment: z.string().max(1000).optional(),\n});\n\nexport interface ConversationMessagesResponse {\n conversation: MessengerConversation;\n messages: MessengerMessage[];\n}\n\n/**\n * Server-sent events streamed by `POST /sdk/conversations` and `POST /sdk/conversations/:id/messages`\n * while Scout replies. `conversation` (start only) carries the new conversation and its token, `message`\n * each stored message, `delta` reply text as it is generated, and `done` the final stored message.\n */\nexport type ScoutStreamEvent =\n | { event: \"conversation\"; data: StartConversationResponse }\n | { event: \"message\"; data: MessengerMessage }\n | { event: \"delta\"; data: { messageId: string; text: string } }\n | { event: \"done\"; data: { message: MessengerMessage; conversation: MessengerConversation } }\n | { event: \"error\"; data: { message: string } };\n\n/** Article list entry for the messenger Help tab (bodies are fetched on demand). */\nexport interface SdkArticleSummary {\n id: string;\n slug: string;\n title: string;\n summary: string;\n collectionId: string | null;\n externalUrl: string | null;\n updatedAt: string;\n}\n\nexport interface SdkArticlesResponse {\n collections: Array<{ id: string; name: string; description: string; order: number }>;\n articles: SdkArticleSummary[];\n}\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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E,IAAI,QAAQ,IAAI,OAAO,OAAO,CAAC,EAAE,IAAI,MAAM,OAAO,qBAAqB,IAAI,UAAU,CAAC,EAAE;AAAA,IACvG;AAAA,EACF;AACF;AAEO,SAAS,eAAe,IAAY;AACzC,QAAM,IAAI,gBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AACjD,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,EAAE,UAAU,GAAG,QAAQ,kBAAkB,MAAM,EAAE,MAAM,EAAE;AAClE;;;ATxLO,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;","names":["import_zod","import_zod","import_zod","import_zod"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/targeting.ts","../src/targeting-eval.ts","../src/guide.ts","../src/events.ts","../src/events-util.ts","../src/sdk-api.ts","../src/messenger.ts","../src/templates.ts"],"sourcesContent":["export * from \"./utils\";\nexport * from \"./targeting\";\nexport * from \"./guide\";\nexport * from \"./events\";\nexport * from \"./sdk-api\";\nexport * from \"./messenger\";\nexport * from \"./templates\";\nexport const SDK_API_VERSION = \"v1\";\nexport const SHARED_VERSION = \"0.2.1\";\n","/** FNV-1a 32-bit hash; deterministic across SDK and server for rollout bucketing. */\nexport function fnv1a(input: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < input.length; i++) {\n h ^= input.charCodeAt(i);\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return h >>> 0;\n}\n\n/** Deterministic 0-99 bucket for percentage rollouts. */\nexport function rolloutBucket(subject: string, salt: string): number {\n return fnv1a(`${salt}:${subject}`) % 100;\n}\n\nexport function slugify(input: string): string {\n return input\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 64) || \"untitled\";\n}\n\nconst ALPHABET = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n/** URL-safe random id. Uses crypto when available, falls back to Math.random (ids are not secrets). */\nexport function randomId(size = 16): string {\n const g: any = typeof globalThis !== \"undefined\" ? globalThis : {};\n let bytes: Uint8Array;\n if (g.crypto && typeof g.crypto.getRandomValues === \"function\") {\n bytes = new Uint8Array(size);\n g.crypto.getRandomValues(bytes);\n } else {\n bytes = new Uint8Array(size);\n for (let i = 0; i < size; i++) bytes[i] = Math.floor(Math.random() * 256);\n }\n let out = \"\";\n for (let i = 0; i < size; i++) out += ALPHABET[(bytes[i] as number) % ALPHABET.length];\n return out;\n}\n\nexport function isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/** Safe nested getter: get(obj, \"account.plan\") */\nexport function getPath(obj: unknown, path: string): unknown {\n if (!path) return obj;\n let cur: any = obj;\n for (const part of path.split(\".\")) {\n if (cur == null) return undefined;\n cur = cur[part];\n }\n return cur;\n}\n\nexport function clamp(n: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, n));\n}\n\n/** Glob-style URL pattern match: `*` matches any chars except `/`, `**` matches anything. */\nexport function matchUrlPattern(pattern: string, url: string): boolean {\n if (!pattern) return true;\n if (pattern === url) return true;\n const escaped = pattern\n .replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*\\*/g, \"__GLOBSTAR__\")\n .replace(/\\*/g, \"[^/]*\")\n .replace(/__GLOBSTAR__/g, \".*\");\n const re = new RegExp(`^${escaped}$`);\n return re.test(url) || re.test(stripOrigin(url));\n}\n\nexport function stripOrigin(url: string): string {\n try {\n const u = new URL(url);\n return u.pathname + u.search + u.hash;\n } catch {\n return url;\n }\n}\n\n/** Safe regexp construction with a length cap to limit ReDoS exposure. */\nexport function safeRegExp(source: string, flags = \"i\"): RegExp | null {\n if (!source || source.length > 200) return null;\n try {\n return new RegExp(source, flags);\n } catch {\n return null;\n }\n}\n","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","/**\n * Zod-free targeting evaluation. Imported by the browser SDK via `@guidelytech/shared/runtime`\n * so the runtime bundle does not pull in zod. Schemas live in ./targeting.ts.\n */\nimport { getPath, matchUrlPattern, rolloutBucket, safeRegExp } from \"./utils\";\n\nexport const RULE_OPERATORS = [\n \"equals\",\n \"not_equals\",\n \"contains\",\n \"not_contains\",\n \"starts_with\",\n \"ends_with\",\n \"exists\",\n \"not_exists\",\n \"gt\",\n \"gte\",\n \"lt\",\n \"lte\",\n \"in\",\n \"not_in\",\n \"regex\",\n \"is_true\",\n \"is_false\",\n \"before\",\n \"after\",\n] as const;\nexport type RuleOperator = (typeof RULE_OPERATORS)[number];\n\nexport const RULE_FIELDS = [\n \"user.attribute\",\n \"account.attribute\",\n \"user.role\",\n \"user.plan\",\n \"url.path\",\n \"url.full\",\n \"url.query\",\n \"device.type\",\n \"device.browser\",\n \"device.os\",\n \"visitor.firstVisit\",\n \"visitor.returning\",\n \"event.seen\",\n \"guide.completed\",\n \"guide.dismissed\",\n \"guide.seen\",\n \"checklist.completed\",\n \"audience.member\",\n \"datetime.now\",\n \"datetime.dayOfWeek\",\n \"datetime.hour\",\n \"rollout.percentage\",\n \"environment\",\n \"locale\",\n] as const;\nexport type RuleField = (typeof RULE_FIELDS)[number];\n\nexport interface Rule {\n id: string;\n field: RuleField;\n /** For attribute/query/event fields: the attribute key, query param name, event name, guide id... */\n key?: string;\n op: RuleOperator;\n value?: string | number | boolean | string[];\n /** When true, the rule is negated (exclusion rule). */\n negate?: boolean;\n}\n\nexport type RuleGroup = {\n id: string;\n op: \"and\" | \"or\";\n rules: Array<Rule | RuleGroup>;\n negate?: boolean;\n};\n\nexport function isRuleGroup(r: Rule | RuleGroup): r is RuleGroup {\n return (r as RuleGroup).rules !== undefined;\n}\n\nexport function emptyRuleGroup(id = \"root\"): RuleGroup {\n return { id, op: \"and\", rules: [] };\n}\n\n/** Everything targeting evaluation can see. Built by the SDK (browser) or the server. */\nexport interface TargetingContext {\n userId?: string | null;\n anonymousId: string;\n userAttributes: Record<string, unknown>;\n accountAttributes: Record<string, unknown>;\n url: string;\n path: string;\n query: Record<string, string>;\n device: { type: \"desktop\" | \"tablet\" | \"mobile\"; browser?: string; os?: string };\n firstVisit: boolean;\n eventsSeen: Set<string> | string[];\n completedGuides: Set<string> | string[];\n dismissedGuides: Set<string> | string[];\n seenGuides: Set<string> | string[];\n completedChecklists: Set<string> | string[];\n audienceIds: Set<string> | string[];\n now: Date;\n environment: string;\n locale?: string;\n /** Salt for rollout (guide id). Set per guide before evaluating. */\n rolloutSalt?: string;\n}\n\nfunction has(set: Set<string> | string[] | undefined, v: string): boolean {\n if (!set) return false;\n return set instanceof Set ? set.has(v) : set.includes(v);\n}\n\nfunction resolveField(rule: Rule, ctx: TargetingContext): unknown {\n switch (rule.field) {\n case \"user.attribute\":\n return rule.key ? getPath(ctx.userAttributes, rule.key) : undefined;\n case \"account.attribute\":\n return rule.key ? getPath(ctx.accountAttributes, rule.key) : undefined;\n case \"user.role\":\n return ctx.userAttributes.role;\n case \"user.plan\":\n return ctx.userAttributes.plan ?? ctx.accountAttributes.plan;\n case \"url.path\":\n return ctx.path;\n case \"url.full\":\n return ctx.url;\n case \"url.query\":\n return rule.key ? ctx.query[rule.key] : undefined;\n case \"device.type\":\n return ctx.device.type;\n case \"device.browser\":\n return ctx.device.browser;\n case \"device.os\":\n return ctx.device.os;\n case \"visitor.firstVisit\":\n return ctx.firstVisit;\n case \"visitor.returning\":\n return !ctx.firstVisit;\n case \"event.seen\":\n return rule.key ? has(ctx.eventsSeen, rule.key) : false;\n case \"guide.completed\":\n return rule.key ? has(ctx.completedGuides, rule.key) : false;\n case \"guide.dismissed\":\n return rule.key ? has(ctx.dismissedGuides, rule.key) : false;\n case \"guide.seen\":\n return rule.key ? has(ctx.seenGuides, rule.key) : false;\n case \"checklist.completed\":\n return rule.key ? has(ctx.completedChecklists, rule.key) : false;\n case \"audience.member\":\n return rule.key ? has(ctx.audienceIds, rule.key) : false;\n case \"datetime.now\":\n return ctx.now.toISOString();\n case \"datetime.dayOfWeek\":\n return ctx.now.getDay();\n case \"datetime.hour\":\n return ctx.now.getHours();\n case \"rollout.percentage\":\n return rolloutBucket(ctx.userId || ctx.anonymousId, ctx.rolloutSalt || \"guidely\");\n case \"environment\":\n return ctx.environment;\n case \"locale\":\n return ctx.locale;\n default:\n return undefined;\n }\n}\n\nfunction toNumber(v: unknown): number | null {\n if (typeof v === \"number\") return v;\n if (typeof v === \"string\" && v.trim() !== \"\" && !Number.isNaN(Number(v))) return Number(v);\n if (v instanceof Date) return v.getTime();\n return null;\n}\n\nfunction toDateMs(v: unknown): number | null {\n if (v instanceof Date) return v.getTime();\n if (typeof v === \"string\") {\n const t = Date.parse(v);\n return Number.isNaN(t) ? null : t;\n }\n if (typeof v === \"number\") return v;\n return null;\n}\n\nexport function compare(op: RuleOperator, actual: unknown, expected: Rule[\"value\"]): boolean {\n switch (op) {\n case \"exists\":\n return actual !== undefined && actual !== null && actual !== \"\";\n case \"not_exists\":\n return actual === undefined || actual === null || actual === \"\";\n case \"is_true\":\n return actual === true || actual === \"true\";\n case \"is_false\":\n return actual === false || actual === \"false\";\n case \"equals\":\n if (typeof actual === \"boolean\") return String(actual) === String(expected);\n return String(actual ?? \"\") === String(expected ?? \"\");\n case \"not_equals\":\n return String(actual ?? \"\") !== String(expected ?? \"\");\n case \"contains\":\n return typeof actual === \"string\" && actual.toLowerCase().includes(String(expected ?? \"\").toLowerCase());\n case \"not_contains\":\n return !(typeof actual === \"string\" && actual.toLowerCase().includes(String(expected ?? \"\").toLowerCase()));\n case \"starts_with\":\n return typeof actual === \"string\" && actual.startsWith(String(expected ?? \"\"));\n case \"ends_with\":\n return typeof actual === \"string\" && actual.endsWith(String(expected ?? \"\"));\n case \"gt\":\n case \"gte\":\n case \"lt\":\n case \"lte\": {\n const a = toNumber(actual);\n const b = toNumber(expected);\n if (a === null || b === null) return false;\n return op === \"gt\" ? a > b : op === \"gte\" ? a >= b : op === \"lt\" ? a < b : a <= b;\n }\n case \"in\": {\n const list = Array.isArray(expected) ? expected : String(expected ?? \"\").split(\",\").map((s) => s.trim());\n return list.includes(String(actual ?? \"\"));\n }\n case \"not_in\": {\n const list = Array.isArray(expected) ? expected : String(expected ?? \"\").split(\",\").map((s) => s.trim());\n return !list.includes(String(actual ?? \"\"));\n }\n case \"regex\": {\n const re = safeRegExp(String(expected ?? \"\"));\n return !!re && typeof actual === \"string\" && re.test(actual);\n }\n case \"before\": {\n const a = toDateMs(actual);\n const b = toDateMs(expected);\n return a !== null && b !== null && a < b;\n }\n case \"after\": {\n const a = toDateMs(actual);\n const b = toDateMs(expected);\n return a !== null && b !== null && a > b;\n }\n default:\n return false;\n }\n}\n\nexport function evaluateRule(rule: Rule, ctx: TargetingContext): boolean {\n let result: boolean;\n if (rule.field === \"url.path\" || rule.field === \"url.full\") {\n const actual = String(resolveField(rule, ctx) ?? \"\");\n if (rule.op === \"equals\") result = matchUrlPattern(String(rule.value ?? \"\"), actual);\n else if (rule.op === \"not_equals\") result = !matchUrlPattern(String(rule.value ?? \"\"), actual);\n else result = compare(rule.op, actual, rule.value);\n } else {\n result = compare(rule.op, resolveField(rule, ctx), rule.value);\n }\n return rule.negate ? !result : result;\n}\n\n/** Evaluate a rule tree. An empty group matches everyone. */\nexport function evaluateRules(group: RuleGroup | null | undefined, ctx: TargetingContext): boolean {\n if (!group || group.rules.length === 0) return group?.negate ? false : true;\n const results = group.rules.map((r) => (isRuleGroup(r) ? evaluateRules(r, ctx) : evaluateRule(r, ctx)));\n const value = group.op === \"and\" ? results.every(Boolean) : results.some(Boolean);\n return group.negate ? !value : value;\n}\n\n/** Fields whose evaluation requires server-held data. Used by docs/UI to annotate rules. */\nexport const SERVER_ASSISTED_FIELDS: RuleField[] = [\"audience.member\", \"guide.completed\", \"guide.dismissed\", \"guide.seen\", \"checklist.completed\"];\n\nexport function describeRule(rule: Rule): string {\n const subject = rule.key ? `${rule.field}[${rule.key}]` : rule.field;\n const v = Array.isArray(rule.value) ? rule.value.join(\", \") : rule.value === undefined ? \"\" : String(rule.value);\n return `${rule.negate ? \"NOT \" : \"\"}${subject} ${rule.op.replace(/_/g, \" \")}${v ? ` \"${v}\"` : \"\"}`;\n}\n","import { z } from \"zod\";\nimport { RuleGroupSchema, emptyRuleGroup, type RuleGroup } from \"./targeting\";\n\nexport const GUIDE_KINDS = [\"flow\", \"modal\", \"tooltip\", \"banner\", \"checklist\", \"survey\", \"announcement\"] as const;\nexport type GuideKind = (typeof GUIDE_KINDS)[number];\n\nexport const GUIDE_STATUSES = [\"draft\", \"published\", \"paused\", \"archived\"] as const;\nexport type GuideStatus = (typeof GUIDE_STATUSES)[number];\n\nexport const STEP_TYPES = [\"modal\", \"tooltip\", \"popover\", \"spotlight\", \"hotspot\", \"banner\", \"slideout\", \"checklist\", \"custom\", \"survey\"] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n\nexport const PLACEMENTS = [\"top\", \"top-start\", \"top-end\", \"right\", \"right-start\", \"right-end\", \"bottom\", \"bottom-start\", \"bottom-end\", \"left\", \"left-start\", \"left-end\", \"auto\"] as const;\nexport type Placement = (typeof PLACEMENTS)[number];\n\nexport const SELECTOR_KINDS = [\"css\", \"id\", \"data-attr\", \"aria\", \"text\", \"xpath\"] as const;\nexport const SelectorStrategySchema = z.object({\n kind: z.enum(SELECTOR_KINDS),\n value: z.string().min(1).max(1000),\n /** Optional human-readable label captured at pick time. */\n label: z.string().max(200).optional(),\n});\nexport type SelectorStrategy = z.infer<typeof SelectorStrategySchema>;\n\nexport const TargetSchema = z.object({\n /** Ordered strategies; the first one resolving to exactly one element wins. */\n selectors: z.array(SelectorStrategySchema).max(10),\n /** How long to wait for the element before applying fallback. */\n waitMs: z.number().int().min(0).max(60000).default(5000),\n /** What to do when the element never shows up. */\n fallback: z.enum([\"skip\", \"show_as_modal\", \"end_guide\", \"wait\"]).default(\"skip\"),\n /** Scroll the element into view before positioning. */\n scrollIntoView: z.boolean().default(true),\n /** Text snapshot captured at pick time; used for authoring warnings. */\n textSnapshot: z.string().max(200).optional(),\n});\nexport type StepTarget = z.infer<typeof TargetSchema>;\n\nexport const BUTTON_ACTIONS = [\"next\", \"back\", \"dismiss\", \"complete\", \"skip\", \"url\", \"start_guide\", \"event\", \"open_resource_center\", \"none\"] as const;\nexport const ButtonSchema = z.object({\n id: z.string().min(1),\n label: z.string().min(1).max(80),\n action: z.enum(BUTTON_ACTIONS),\n variant: z.enum([\"primary\", \"secondary\", \"ghost\", \"link\"]).default(\"primary\"),\n /** url for `url`, guide id for `start_guide`, event name for `event`, step id for `next` branch override */\n value: z.string().max(2000).optional(),\n newTab: z.boolean().optional(),\n});\nexport type StepButton = z.infer<typeof ButtonSchema>;\n\nexport const StepBranchSchema = z.object({\n id: z.string(),\n /** Rule group evaluated against targeting context when leaving the step. */\n when: RuleGroupSchema,\n /** Step id to jump to. */\n goTo: z.string(),\n});\n\nexport const ADVANCE_ON = [\"button\", \"element_click\", \"element_visible\", \"event\", \"delay\", \"any\"] as const;\n\nexport const StepSchema = z.object({\n id: z.string().min(1).max(64),\n type: z.enum(STEP_TYPES),\n title: z.string().max(200).default(\"\"),\n /** Sanitized HTML body (links, images, lists, formatting). */\n body: z.string().max(20000).default(\"\"),\n imageUrl: z.string().url().max(2000).optional().or(z.literal(\"\")),\n buttons: z.array(ButtonSchema).max(6).default([]),\n target: TargetSchema.optional(),\n placement: z.enum(PLACEMENTS).default(\"auto\"),\n /** Pixel offset between anchor and card. */\n offset: z.number().int().min(0).max(64).default(10),\n showOverlay: z.boolean().default(false),\n showProgress: z.boolean().default(true),\n showClose: z.boolean().default(true),\n dismissOnOutsideClick: z.boolean().default(false),\n /** Highlight padding for spotlight. */\n spotlightPadding: z.number().int().min(0).max(64).default(6),\n /** Banner/slideout position. */\n position: z.enum([\"top\", \"bottom\", \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\", \"center\"]).default(\"bottom-right\"),\n /** URL pattern this step belongs to (for multi-page flows). */\n url: z.string().max(500).optional(),\n /** Automatic advancement. */\n advanceOn: z.enum(ADVANCE_ON).default(\"button\"),\n advanceValue: z.string().max(500).optional(),\n advanceDelayMs: z.number().int().min(0).max(600000).optional(),\n branches: z.array(StepBranchSchema).max(10).default([]),\n width: z.number().int().min(200).max(900).optional(),\n /** Step-level targeting: skip step when rules do not match. */\n targeting: RuleGroupSchema.optional(),\n /** Hotspot pulse dot settings. */\n hotspot: z.object({ size: z.number().int().min(8).max(40).default(14), pulse: z.boolean().default(true), openOn: z.enum([\"click\", \"hover\"]).default(\"click\") }).optional(),\n /** Custom step: arbitrary sanitized HTML with no chrome. */\n customHtml: z.string().max(50000).optional(),\n});\nexport type GuideStep = z.infer<typeof StepSchema>;\nexport type GuideStepInput = z.input<typeof StepSchema>;\n\nexport const TRIGGER_TYPES = [\"page_load\", \"url_match\", \"event\", \"element_click\", \"element_visible\", \"manual\", \"delay\", \"after_guide\", \"segment_enter\"] as const;\nexport const TriggerSchema = z.object({\n type: z.enum(TRIGGER_TYPES).default(\"page_load\"),\n /** url pattern, event name, selector, guide id, audience id depending on type */\n value: z.string().max(1000).optional(),\n delayMs: z.number().int().min(0).max(600000).default(0),\n /** Also require URL to match this pattern (any trigger). */\n urlPattern: z.string().max(500).optional(),\n});\nexport type TriggerConfig = z.infer<typeof TriggerSchema>;\n\nexport const FrequencySchema = z.object({\n mode: z.enum([\"once\", \"once_per_session\", \"every_time\", \"interval\"]).default(\"once\"),\n intervalHours: z.number().int().min(1).max(8760).optional(),\n maxImpressions: z.number().int().min(1).max(1000).optional(),\n /** Hours to wait after dismissal before eligible again (when not `once`). */\n cooldownHours: z.number().int().min(0).max(8760).default(0),\n /** Lower number wins when multiple guides qualify. */\n priority: z.number().int().min(0).max(1000).default(100),\n /** Guide ids that must not be active at the same time. */\n mutuallyExclusiveWith: z.array(z.string()).max(50).default([]),\n /** Re-show if dismissed (otherwise dismissal counts as completion for frequency). */\n reshowAfterDismiss: z.boolean().default(false),\n});\nexport type FrequencyConfig = z.infer<typeof FrequencySchema>;\n\nexport const AppearanceSchema = z.object({\n theme: z.enum([\"light\", \"dark\", \"auto\"]).default(\"auto\"),\n primaryColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n borderRadius: z.number().int().min(0).max(32).optional(),\n fontFamily: z.string().max(200).optional(),\n overlayOpacity: z.number().min(0).max(1).optional(),\n zIndex: z.number().int().min(1).max(2147483647).optional(),\n preset: z.string().max(50).optional(),\n animation: z.enum([\"fade\", \"slide\", \"none\"]).default(\"fade\"),\n});\nexport type Appearance = z.infer<typeof AppearanceSchema>;\n\nexport const ChecklistTaskSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1).max(200),\n description: z.string().max(2000).default(\"\"),\n /** How the task completes. */\n completion: z.enum([\"manual\", \"event\", \"guide_completed\", \"url_visited\", \"click\"]).default(\"manual\"),\n completionValue: z.string().max(500).optional(),\n /** Optional action when clicking the task. */\n action: z.enum([\"none\", \"start_guide\", \"url\", \"event\"]).default(\"none\"),\n actionValue: z.string().max(2000).optional(),\n required: z.boolean().default(true),\n});\nexport type ChecklistTask = z.infer<typeof ChecklistTaskSchema>;\n\nexport const ChecklistConfigSchema = z.object({\n tasks: z.array(ChecklistTaskSchema).min(1).max(30),\n ordered: z.boolean().default(false),\n launcherLabel: z.string().max(60).default(\"Getting started\"),\n position: z.enum([\"bottom-right\", \"bottom-left\"]).default(\"bottom-right\"),\n completionTitle: z.string().max(200).default(\"You're all set!\"),\n completionBody: z.string().max(2000).default(\"\"),\n autoOpen: z.boolean().default(true),\n dismissible: z.boolean().default(true),\n});\nexport type ChecklistConfig = z.infer<typeof ChecklistConfigSchema>;\n\nexport const SURVEY_QUESTION_TYPES = [\"nps\", \"csat\", \"thumbs\", \"single_choice\", \"multiple_choice\", \"text\", \"rating\"] as const;\nexport const SurveyQuestionSchema = z.object({\n id: z.string().min(1),\n type: z.enum(SURVEY_QUESTION_TYPES),\n title: z.string().min(1).max(500),\n description: z.string().max(1000).default(\"\"),\n required: z.boolean().default(true),\n options: z.array(z.object({ id: z.string(), label: z.string().max(200) })).max(20).default([]),\n scaleMax: z.number().int().min(2).max(10).optional(),\n lowLabel: z.string().max(60).optional(),\n highLabel: z.string().max(60).optional(),\n placeholder: z.string().max(200).optional(),\n /** Conditional follow-up: show only when a previous answer matches. */\n showWhen: z.object({ questionId: z.string(), op: z.enum([\"equals\", \"lte\", \"gte\", \"in\"]), value: z.union([z.string(), z.number(), z.array(z.string())]) }).optional(),\n});\nexport type SurveyQuestion = z.infer<typeof SurveyQuestionSchema>;\n\nexport const SurveyConfigSchema = z.object({\n questions: z.array(SurveyQuestionSchema).min(1).max(20),\n thankYouTitle: z.string().max(200).default(\"Thanks for your feedback!\"),\n thankYouBody: z.string().max(2000).default(\"\"),\n position: z.enum([\"bottom-right\", \"bottom-left\", \"center\"]).default(\"bottom-right\"),\n startAt: z.string().datetime().optional(),\n endAt: z.string().datetime().optional(),\n});\nexport type SurveyConfig = z.infer<typeof SurveyConfigSchema>;\n\nexport const GuideConfigSchema = z.object({\n steps: z.array(StepSchema).max(50).default([]),\n targeting: RuleGroupSchema.default(() => emptyRuleGroup()),\n trigger: TriggerSchema.default({}),\n frequency: FrequencySchema.default({}),\n appearance: AppearanceSchema.default({}),\n checklist: ChecklistConfigSchema.optional(),\n survey: SurveyConfigSchema.optional(),\n /** Restrict guide to url pattern(s) (applied before trigger). */\n urlPatterns: z.array(z.string().max(500)).max(20).default([]),\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 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 (!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] as const;\nexport type EventName = (typeof EVENT_NAMES)[number];\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\";\n","/** Reserved property names that are stripped from `properties` to avoid collecting sensitive data. */\nexport const SENSITIVE_PROPERTY_PATTERN = /(password|passwd|secret|token|credit|card|cvv|ssn|iban)/i;\n\nexport const MAX_PROPERTY_BYTES = 8 * 1024;\n\nexport function sanitizeProperties(props: Record<string, unknown> | undefined): Record<string, unknown> {\n if (!props) return {};\n const out: Record<string, unknown> = {};\n let size = 0;\n for (const [k, v] of Object.entries(props)) {\n if (SENSITIVE_PROPERTY_PATTERN.test(k)) continue;\n if (typeof v === \"function\" || typeof v === \"symbol\") continue;\n const str = typeof v === \"string\" ? v : JSON.stringify(v ?? null);\n size += k.length + (str?.length ?? 0);\n if (size > MAX_PROPERTY_BYTES) break;\n out[k.slice(0, 100)] = typeof v === \"string\" ? v.slice(0, 1000) : v;\n }\n return out;\n}\n","import { z } from \"zod\";\nimport { GuideConfigSchema, ProjectThemeSchema, type GuideKind, type GuideConfig } from \"./guide\";\nimport type { MessengerConfig } from \"./messenger\";\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 updatedAt: 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: Array<{ id: string; name: string; description: string; order: number }>;\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 };\n generatedAt: string;\n}\n\nexport const IdentifyRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().min(1).max(256).optional().nullable(),\n traits: z.record(z.unknown()).optional(),\n account: z\n .object({ id: z.string().min(1).max(256), traits: z.record(z.unknown()).optional() })\n .optional()\n .nullable(),\n sessionId: z.string().max(128).optional(),\n url: z.string().max(2000).optional(),\n});\nexport type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;\n\n/** Server-held state the SDK needs for targeting & frequency. */\nexport interface IdentifyResponse {\n endUserId: string;\n audienceIds: string[];\n guideState: Record<\n string,\n { impressions: number; completedAt?: string | null; dismissedAt?: string | null; lastShownAt?: string | null }\n >;\n checklistProgress: Record<string, { completedTaskIds: string[]; completedAt?: string | null; dismissedAt?: string | null }>;\n surveysSubmitted: string[];\n firstSeenAt: string;\n}\n\nexport const ChecklistProgressRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int().optional(),\n completedTaskIds: z.array(z.string().max(64)).max(100),\n dismissed: z.boolean().optional(),\n completed: z.boolean().optional(),\n});\nexport type ChecklistProgressRequest = z.infer<typeof ChecklistProgressRequestSchema>;\n\nexport const SurveyResponseRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n accountId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int(),\n answers: z.record(z.union([z.string().max(5000), z.number(), z.boolean(), z.array(z.string().max(500)).max(50)])),\n responseId: z.string().min(8).max(64),\n});\nexport type SurveyResponseRequest = z.infer<typeof SurveyResponseRequestSchema>;\n\nexport const GuideStateUpdateSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n updates: z\n .array(\n z.object({\n guideId: z.string(),\n impression: z.boolean().optional(),\n completed: z.boolean().optional(),\n dismissed: z.boolean().optional(),\n }),\n )\n .max(50),\n});\n\nexport const AuthoringPickSchema = z.object({\n stepId: z.string().max(64).optional(),\n selectors: z.array(z.object({ kind: z.string(), value: z.string().max(1000), label: z.string().max(200).optional() })).max(10),\n textSnapshot: z.string().max(200).optional(),\n url: z.string().max(2000).optional(),\n rect: z.object({ x: z.number(), y: z.number(), width: z.number(), height: z.number() }).optional(),\n});\nexport type AuthoringPick = z.infer<typeof AuthoringPickSchema>;\n\n/**\n * Static, script-free copy of the page an authoring session is connected to. The SDK posts it to\n * the dashboard (never to the API) so the editor canvas can show the customer's real app.\n */\nexport interface AppSnapshot {\n /** Full HTML document (doctype included) with scripts and Guidely UI removed and a `<base>` pointing at `url`. */\n html: string;\n url: string;\n title: string;\n /** Viewport the snapshot was taken at, in CSS pixels. */\n width: number;\n height: number;\n capturedAt: string;\n}\n\nexport interface AuthoringSessionInfo {\n id: string;\n projectId: string;\n environment: string;\n guideId: string | null;\n dashboardOrigin: string;\n expiresAt: string;\n /** Draft guide config to preview while authoring (not published). */\n draft: { id: string; key: string; name: string; kind: GuideKind; config: GuideConfig } | null;\n}\n\nexport const PublishedGuideSchema = z.object({\n id: z.string(),\n key: z.string(),\n name: z.string(),\n kind: z.string(),\n version: z.number(),\n config: GuideConfigSchema,\n publishedAt: z.string(),\n});\n\nexport interface ApiError {\n error: { code: string; message: string; details?: unknown };\n}\n","import { z } from \"zod\";\n\n/** Messenger settings delivered to the SDK in `SdkConfigResponse.messenger`. */\nexport interface MessengerConfig {\n enabled: boolean;\n /** Display name of the AI agent (\"Scout\"). */\n name: string;\n greeting: string;\n /** Scout answers with AI; when false every conversation goes to the team inbox. */\n aiAvailable: boolean;\n handoffEnabled: boolean;\n launcher: { position: \"bottom-right\" | \"bottom-left\" };\n}\n\nexport const MESSAGE_AUTHORS = [\"user\", \"scout\", \"agent\", \"system\"] as const;\nexport type MessageAuthor = (typeof MESSAGE_AUTHORS)[number];\nexport type ConversationStatus = \"bot\" | \"open\" | \"closed\";\n\nexport interface MessengerCitation {\n articleId: string;\n title: string;\n}\n\nexport interface MessengerSuggestedGuide {\n key: string;\n name: string;\n}\n\nexport interface MessengerMessage {\n id: string;\n author: MessageAuthor;\n /** Team member name for `agent` messages. */\n authorName?: string | null;\n body: string;\n citations: MessengerCitation[];\n suggestedGuides: MessengerSuggestedGuide[];\n status: \"pending\" | \"complete\" | \"failed\";\n createdAt: string;\n}\n\nexport interface MessengerConversation {\n id: string;\n status: ConversationStatus;\n subject: string;\n lastMessageAt: string;\n lastMessagePreview: string;\n unread: number;\n rating: number | null;\n}\n\nexport const MAX_MESSAGE_LENGTH = 4000;\nconst messageText = z.string().trim().min(1).max(MAX_MESSAGE_LENGTH);\n\nexport const StartConversationSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n message: messageText,\n pageUrl: z.string().max(2000).optional(),\n});\nexport type StartConversationRequest = z.infer<typeof StartConversationSchema>;\n\nexport interface StartConversationResponse {\n conversation: MessengerConversation;\n /** Secret that authorises this browser to read and post in the conversation. Store it; it is not shown again. */\n token: string;\n messages: MessengerMessage[];\n}\n\nexport const ConversationLookupSchema = z.object({\n tokens: z.array(z.string().min(16).max(128)).max(50),\n});\n\nexport interface ConversationLookupResponse {\n conversations: Array<MessengerConversation & { token: string }>;\n}\n\nexport const PostMessageSchema = z.object({ message: messageText });\n\nexport const ConversationRatingSchema = z.object({\n rating: z.number().int().min(1).max(5),\n comment: z.string().max(1000).optional(),\n});\n\nexport interface ConversationMessagesResponse {\n conversation: MessengerConversation;\n messages: MessengerMessage[];\n}\n\n/**\n * Server-sent events streamed by `POST /sdk/conversations` and `POST /sdk/conversations/:id/messages`\n * while Scout replies. `conversation` (start only) carries the new conversation and its token, `message`\n * each stored message, `delta` reply text as it is generated, and `done` the final stored message.\n */\nexport type ScoutStreamEvent =\n | { event: \"conversation\"; data: StartConversationResponse }\n | { event: \"message\"; data: MessengerMessage }\n | { event: \"delta\"; data: { messageId: string; text: string } }\n | { event: \"done\"; data: { message: MessengerMessage; conversation: MessengerConversation } }\n | { event: \"error\"; data: { message: string } };\n\n/** Article list entry for the messenger Help tab (bodies are fetched on demand). */\nexport interface SdkArticleSummary {\n id: string;\n slug: string;\n title: string;\n summary: string;\n collectionId: string | null;\n externalUrl: string | null;\n updatedAt: string;\n}\n\nexport interface SdkArticlesResponse {\n collections: Array<{ id: string; name: string; description: string; order: number }>;\n articles: SdkArticleSummary[];\n}\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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,MAAM,UAAU,IAAI;AAAA,MAClE,WAAW,EAAE,IAAI,QAAQ,IAAI,OAAO,OAAO,CAAC,EAAE,IAAI,MAAM,OAAO,qBAAqB,IAAI,UAAU,CAAC,EAAE;AAAA,IACvG;AAAA,EACF;AACF;AAEO,SAAS,eAAe,IAAY;AACzC,QAAM,IAAI,gBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AACjD,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,EAAE,UAAU,GAAG,QAAQ,kBAAkB,MAAM,EAAE,MAAM,EAAE;AAClE;;;ATxLO,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;","names":["import_zod","import_zod","import_zod","import_zod"]}
package/dist/index.d.cts CHANGED
@@ -3351,6 +3351,6 @@ declare function templateConfig(id: string): {
3351
3351
  } | null;
3352
3352
 
3353
3353
  declare const SDK_API_VERSION = "v1";
3354
- declare const SHARED_VERSION = "0.2.0";
3354
+ declare const SHARED_VERSION = "0.2.1";
3355
3355
 
3356
3356
  export { ADVANCE_ON, type ApiError, type AppSnapshot, type Appearance, AppearanceSchema, type AuthoringPick, AuthoringPickSchema, type AuthoringSessionInfo, BUTTON_ACTIONS, ButtonSchema, type ChecklistConfig, ChecklistConfigSchema, type ChecklistProgressRequest, ChecklistProgressRequestSchema, type ChecklistTask, ChecklistTaskSchema, type ConversationLookupResponse, ConversationLookupSchema, type ConversationMessagesResponse, ConversationRatingSchema, type ConversationStatus, EVENT_NAMES, type EventBatch, EventBatchSchema, type EventName, type FrequencyConfig, FrequencySchema, GUIDE_KINDS, GUIDE_LIFECYCLE_EVENTS, GUIDE_STATUSES, GUIDE_TEMPLATES, type GuideConfig, type GuideConfigInput, GuideConfigSchema, type GuideKind, GuideStateUpdateSchema, type GuideStatus, type GuideStep, type GuideStepInput, type GuideTemplate, type IdentifyRequest, IdentifyRequestSchema, type IdentifyResponse, MAX_MESSAGE_LENGTH, MESSAGE_AUTHORS, type MessageAuthor, type MessengerCitation, type MessengerConfig, type MessengerConversation, type MessengerMessage, type MessengerSuggestedGuide, PLACEMENTS, type Placement, PostMessageSchema, type ProjectTheme, ProjectThemeSchema, type PublishedGuide, PublishedGuideSchema, type ResourceCenterArticle, type ResourceCenterConfig, Rule, RuleGroup, RuleGroupSchema, RuleSchema, SDK_API_VERSION, SELECTOR_KINDS, SHARED_VERSION, STEP_TYPES, SURVEY_QUESTION_TYPES, type ScoutStreamEvent, type SdkArticleSummary, type SdkArticlesResponse, type SdkConfigResponse, type SdkEvent, SdkEventSchema, type SelectorStrategy, SelectorStrategySchema, type StartConversationRequest, type StartConversationResponse, StartConversationSchema, StepBranchSchema, type StepButton, StepSchema, type StepTarget, type StepType, type SurveyConfig, SurveyConfigSchema, type SurveyQuestion, SurveyQuestionSchema, type SurveyResponseRequest, SurveyResponseRequestSchema, TRIGGER_TYPES, TargetSchema, type TriggerConfig, TriggerSchema, type ValidationIssue, defaultGuideConfig, defaultStep, templateConfig, validateGuideConfig, visibleButtons };
package/dist/index.d.ts CHANGED
@@ -3351,6 +3351,6 @@ declare function templateConfig(id: string): {
3351
3351
  } | null;
3352
3352
 
3353
3353
  declare const SDK_API_VERSION = "v1";
3354
- declare const SHARED_VERSION = "0.2.0";
3354
+ declare const SHARED_VERSION = "0.2.1";
3355
3355
 
3356
3356
  export { ADVANCE_ON, type ApiError, type AppSnapshot, type Appearance, AppearanceSchema, type AuthoringPick, AuthoringPickSchema, type AuthoringSessionInfo, BUTTON_ACTIONS, ButtonSchema, type ChecklistConfig, ChecklistConfigSchema, type ChecklistProgressRequest, ChecklistProgressRequestSchema, type ChecklistTask, ChecklistTaskSchema, type ConversationLookupResponse, ConversationLookupSchema, type ConversationMessagesResponse, ConversationRatingSchema, type ConversationStatus, EVENT_NAMES, type EventBatch, EventBatchSchema, type EventName, type FrequencyConfig, FrequencySchema, GUIDE_KINDS, GUIDE_LIFECYCLE_EVENTS, GUIDE_STATUSES, GUIDE_TEMPLATES, type GuideConfig, type GuideConfigInput, GuideConfigSchema, type GuideKind, GuideStateUpdateSchema, type GuideStatus, type GuideStep, type GuideStepInput, type GuideTemplate, type IdentifyRequest, IdentifyRequestSchema, type IdentifyResponse, MAX_MESSAGE_LENGTH, MESSAGE_AUTHORS, type MessageAuthor, type MessengerCitation, type MessengerConfig, type MessengerConversation, type MessengerMessage, type MessengerSuggestedGuide, PLACEMENTS, type Placement, PostMessageSchema, type ProjectTheme, ProjectThemeSchema, type PublishedGuide, PublishedGuideSchema, type ResourceCenterArticle, type ResourceCenterConfig, Rule, RuleGroup, RuleGroupSchema, RuleSchema, SDK_API_VERSION, SELECTOR_KINDS, SHARED_VERSION, STEP_TYPES, SURVEY_QUESTION_TYPES, type ScoutStreamEvent, type SdkArticleSummary, type SdkArticlesResponse, type SdkConfigResponse, type SdkEvent, SdkEventSchema, type SelectorStrategy, SelectorStrategySchema, type StartConversationRequest, type StartConversationResponse, StartConversationSchema, StepBranchSchema, type StepButton, StepSchema, type StepTarget, type StepType, type SurveyConfig, SurveyConfigSchema, type SurveyQuestion, SurveyQuestionSchema, type SurveyResponseRequest, SurveyResponseRequestSchema, TRIGGER_TYPES, TargetSchema, type TriggerConfig, TriggerSchema, type ValidationIssue, defaultGuideConfig, defaultStep, templateConfig, validateGuideConfig, visibleButtons };
package/dist/index.js CHANGED
@@ -592,7 +592,7 @@ function templateConfig(id) {
592
592
 
593
593
  // src/index.ts
594
594
  var SDK_API_VERSION = "v1";
595
- var SHARED_VERSION = "0.2.0";
595
+ var SHARED_VERSION = "0.2.1";
596
596
  export {
597
597
  ADVANCE_ON,
598
598
  AppearanceSchema,
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/templates.ts","../src/index.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { RULE_FIELDS, RULE_OPERATORS, type Rule, type RuleGroup } from \"./targeting-eval\";\n\nexport * from \"./targeting-eval\";\n\nexport const RuleSchema: z.ZodType<Rule> = z.object({\n id: z.string().min(1),\n field: z.enum(RULE_FIELDS),\n key: z.string().max(200).optional(),\n op: z.enum(RULE_OPERATORS),\n value: z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]).optional(),\n negate: z.boolean().optional(),\n});\n\nexport const RuleGroupSchema: z.ZodType<RuleGroup> = z.lazy(() =>\n z.object({\n id: z.string().min(1),\n op: z.enum([\"and\", \"or\"]),\n rules: z.array(z.union([RuleSchema, RuleGroupSchema])).max(100),\n negate: z.boolean().optional(),\n }),\n);\n","import { z } from \"zod\";\nimport { 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\nexport const SELECTOR_KINDS = [\"css\", \"id\", \"data-attr\", \"aria\", \"text\", \"xpath\"] as const;\nexport const SelectorStrategySchema = z.object({\n kind: z.enum(SELECTOR_KINDS),\n value: z.string().min(1).max(1000),\n /** Optional human-readable label captured at pick time. */\n label: z.string().max(200).optional(),\n});\nexport type SelectorStrategy = z.infer<typeof SelectorStrategySchema>;\n\nexport const TargetSchema = z.object({\n /** Ordered strategies; the first one resolving to exactly one element wins. */\n selectors: z.array(SelectorStrategySchema).max(10),\n /** How long to wait for the element before applying fallback. */\n waitMs: z.number().int().min(0).max(60000).default(5000),\n /** What to do when the element never shows up. */\n fallback: z.enum([\"skip\", \"show_as_modal\", \"end_guide\", \"wait\"]).default(\"skip\"),\n /** Scroll the element into view before positioning. */\n scrollIntoView: z.boolean().default(true),\n /** Text snapshot captured at pick time; used for authoring warnings. */\n textSnapshot: z.string().max(200).optional(),\n});\nexport type StepTarget = z.infer<typeof TargetSchema>;\n\nexport const BUTTON_ACTIONS = [\"next\", \"back\", \"dismiss\", \"complete\", \"skip\", \"url\", \"start_guide\", \"event\", \"open_resource_center\", \"none\"] as const;\nexport const ButtonSchema = z.object({\n id: z.string().min(1),\n label: z.string().min(1).max(80),\n action: z.enum(BUTTON_ACTIONS),\n variant: z.enum([\"primary\", \"secondary\", \"ghost\", \"link\"]).default(\"primary\"),\n /** url for `url`, guide id for `start_guide`, event name for `event`, step id for `next` branch override */\n value: z.string().max(2000).optional(),\n newTab: z.boolean().optional(),\n});\nexport type StepButton = z.infer<typeof ButtonSchema>;\n\nexport const StepBranchSchema = z.object({\n id: z.string(),\n /** Rule group evaluated against targeting context when leaving the step. */\n when: RuleGroupSchema,\n /** Step id to jump to. */\n goTo: z.string(),\n});\n\nexport const ADVANCE_ON = [\"button\", \"element_click\", \"element_visible\", \"event\", \"delay\", \"any\"] as const;\n\nexport const StepSchema = z.object({\n id: z.string().min(1).max(64),\n type: z.enum(STEP_TYPES),\n title: z.string().max(200).default(\"\"),\n /** Sanitized HTML body (links, images, lists, formatting). */\n body: z.string().max(20000).default(\"\"),\n imageUrl: z.string().url().max(2000).optional().or(z.literal(\"\")),\n buttons: z.array(ButtonSchema).max(6).default([]),\n target: TargetSchema.optional(),\n placement: z.enum(PLACEMENTS).default(\"auto\"),\n /** Pixel offset between anchor and card. */\n offset: z.number().int().min(0).max(64).default(10),\n showOverlay: z.boolean().default(false),\n showProgress: z.boolean().default(true),\n showClose: z.boolean().default(true),\n dismissOnOutsideClick: z.boolean().default(false),\n /** Highlight padding for spotlight. */\n spotlightPadding: z.number().int().min(0).max(64).default(6),\n /** Banner/slideout position. */\n position: z.enum([\"top\", \"bottom\", \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\", \"center\"]).default(\"bottom-right\"),\n /** URL pattern this step belongs to (for multi-page flows). */\n url: z.string().max(500).optional(),\n /** Automatic advancement. */\n advanceOn: z.enum(ADVANCE_ON).default(\"button\"),\n advanceValue: z.string().max(500).optional(),\n advanceDelayMs: z.number().int().min(0).max(600000).optional(),\n branches: z.array(StepBranchSchema).max(10).default([]),\n width: z.number().int().min(200).max(900).optional(),\n /** Step-level targeting: skip step when rules do not match. */\n targeting: RuleGroupSchema.optional(),\n /** Hotspot pulse dot settings. */\n hotspot: z.object({ size: z.number().int().min(8).max(40).default(14), pulse: z.boolean().default(true), openOn: z.enum([\"click\", \"hover\"]).default(\"click\") }).optional(),\n /** Custom step: arbitrary sanitized HTML with no chrome. */\n customHtml: z.string().max(50000).optional(),\n});\nexport type GuideStep = z.infer<typeof StepSchema>;\nexport type GuideStepInput = z.input<typeof StepSchema>;\n\nexport const TRIGGER_TYPES = [\"page_load\", \"url_match\", \"event\", \"element_click\", \"element_visible\", \"manual\", \"delay\", \"after_guide\", \"segment_enter\"] as const;\nexport const TriggerSchema = z.object({\n type: z.enum(TRIGGER_TYPES).default(\"page_load\"),\n /** url pattern, event name, selector, guide id, audience id depending on type */\n value: z.string().max(1000).optional(),\n delayMs: z.number().int().min(0).max(600000).default(0),\n /** Also require URL to match this pattern (any trigger). */\n urlPattern: z.string().max(500).optional(),\n});\nexport type TriggerConfig = z.infer<typeof TriggerSchema>;\n\nexport const FrequencySchema = z.object({\n mode: z.enum([\"once\", \"once_per_session\", \"every_time\", \"interval\"]).default(\"once\"),\n intervalHours: z.number().int().min(1).max(8760).optional(),\n maxImpressions: z.number().int().min(1).max(1000).optional(),\n /** Hours to wait after dismissal before eligible again (when not `once`). */\n cooldownHours: z.number().int().min(0).max(8760).default(0),\n /** Lower number wins when multiple guides qualify. */\n priority: z.number().int().min(0).max(1000).default(100),\n /** Guide ids that must not be active at the same time. */\n mutuallyExclusiveWith: z.array(z.string()).max(50).default([]),\n /** Re-show if dismissed (otherwise dismissal counts as completion for frequency). */\n reshowAfterDismiss: z.boolean().default(false),\n});\nexport type FrequencyConfig = z.infer<typeof FrequencySchema>;\n\nexport const AppearanceSchema = z.object({\n theme: z.enum([\"light\", \"dark\", \"auto\"]).default(\"auto\"),\n primaryColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n borderRadius: z.number().int().min(0).max(32).optional(),\n fontFamily: z.string().max(200).optional(),\n overlayOpacity: z.number().min(0).max(1).optional(),\n zIndex: z.number().int().min(1).max(2147483647).optional(),\n preset: z.string().max(50).optional(),\n animation: z.enum([\"fade\", \"slide\", \"none\"]).default(\"fade\"),\n});\nexport type Appearance = z.infer<typeof AppearanceSchema>;\n\nexport const ChecklistTaskSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1).max(200),\n description: z.string().max(2000).default(\"\"),\n /** How the task completes. */\n completion: z.enum([\"manual\", \"event\", \"guide_completed\", \"url_visited\", \"click\"]).default(\"manual\"),\n completionValue: z.string().max(500).optional(),\n /** Optional action when clicking the task. */\n action: z.enum([\"none\", \"start_guide\", \"url\", \"event\"]).default(\"none\"),\n actionValue: z.string().max(2000).optional(),\n required: z.boolean().default(true),\n});\nexport type ChecklistTask = z.infer<typeof ChecklistTaskSchema>;\n\nexport const ChecklistConfigSchema = z.object({\n tasks: z.array(ChecklistTaskSchema).min(1).max(30),\n ordered: z.boolean().default(false),\n launcherLabel: z.string().max(60).default(\"Getting started\"),\n position: z.enum([\"bottom-right\", \"bottom-left\"]).default(\"bottom-right\"),\n completionTitle: z.string().max(200).default(\"You're all set!\"),\n completionBody: z.string().max(2000).default(\"\"),\n autoOpen: z.boolean().default(true),\n dismissible: z.boolean().default(true),\n});\nexport type ChecklistConfig = z.infer<typeof ChecklistConfigSchema>;\n\nexport const SURVEY_QUESTION_TYPES = [\"nps\", \"csat\", \"thumbs\", \"single_choice\", \"multiple_choice\", \"text\", \"rating\"] as const;\nexport const SurveyQuestionSchema = z.object({\n id: z.string().min(1),\n type: z.enum(SURVEY_QUESTION_TYPES),\n title: z.string().min(1).max(500),\n description: z.string().max(1000).default(\"\"),\n required: z.boolean().default(true),\n options: z.array(z.object({ id: z.string(), label: z.string().max(200) })).max(20).default([]),\n scaleMax: z.number().int().min(2).max(10).optional(),\n lowLabel: z.string().max(60).optional(),\n highLabel: z.string().max(60).optional(),\n placeholder: z.string().max(200).optional(),\n /** Conditional follow-up: show only when a previous answer matches. */\n showWhen: z.object({ questionId: z.string(), op: z.enum([\"equals\", \"lte\", \"gte\", \"in\"]), value: z.union([z.string(), z.number(), z.array(z.string())]) }).optional(),\n});\nexport type SurveyQuestion = z.infer<typeof SurveyQuestionSchema>;\n\nexport const SurveyConfigSchema = z.object({\n questions: z.array(SurveyQuestionSchema).min(1).max(20),\n thankYouTitle: z.string().max(200).default(\"Thanks for your feedback!\"),\n thankYouBody: z.string().max(2000).default(\"\"),\n position: z.enum([\"bottom-right\", \"bottom-left\", \"center\"]).default(\"bottom-right\"),\n startAt: z.string().datetime().optional(),\n endAt: z.string().datetime().optional(),\n});\nexport type SurveyConfig = z.infer<typeof SurveyConfigSchema>;\n\nexport const GuideConfigSchema = z.object({\n steps: z.array(StepSchema).max(50).default([]),\n targeting: RuleGroupSchema.default(() => emptyRuleGroup()),\n trigger: TriggerSchema.default({}),\n frequency: FrequencySchema.default({}),\n appearance: AppearanceSchema.default({}),\n checklist: ChecklistConfigSchema.optional(),\n survey: SurveyConfigSchema.optional(),\n /** Restrict guide to url pattern(s) (applied before trigger). */\n urlPatterns: z.array(z.string().max(500)).max(20).default([]),\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 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 (!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] as const;\nexport type EventName = (typeof EVENT_NAMES)[number];\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\";\n","import { z } from \"zod\";\nimport { GuideConfigSchema, ProjectThemeSchema, type GuideKind, type GuideConfig } from \"./guide\";\nimport type { MessengerConfig } from \"./messenger\";\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 updatedAt: 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: Array<{ id: string; name: string; description: string; order: number }>;\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 };\n generatedAt: string;\n}\n\nexport const IdentifyRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().min(1).max(256).optional().nullable(),\n traits: z.record(z.unknown()).optional(),\n account: z\n .object({ id: z.string().min(1).max(256), traits: z.record(z.unknown()).optional() })\n .optional()\n .nullable(),\n sessionId: z.string().max(128).optional(),\n url: z.string().max(2000).optional(),\n});\nexport type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;\n\n/** Server-held state the SDK needs for targeting & frequency. */\nexport interface IdentifyResponse {\n endUserId: string;\n audienceIds: string[];\n guideState: Record<\n string,\n { impressions: number; completedAt?: string | null; dismissedAt?: string | null; lastShownAt?: string | null }\n >;\n checklistProgress: Record<string, { completedTaskIds: string[]; completedAt?: string | null; dismissedAt?: string | null }>;\n surveysSubmitted: string[];\n firstSeenAt: string;\n}\n\nexport const ChecklistProgressRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int().optional(),\n completedTaskIds: z.array(z.string().max(64)).max(100),\n dismissed: z.boolean().optional(),\n completed: z.boolean().optional(),\n});\nexport type ChecklistProgressRequest = z.infer<typeof ChecklistProgressRequestSchema>;\n\nexport const SurveyResponseRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n accountId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int(),\n answers: z.record(z.union([z.string().max(5000), z.number(), z.boolean(), z.array(z.string().max(500)).max(50)])),\n responseId: z.string().min(8).max(64),\n});\nexport type SurveyResponseRequest = z.infer<typeof SurveyResponseRequestSchema>;\n\nexport const GuideStateUpdateSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n updates: z\n .array(\n z.object({\n guideId: z.string(),\n impression: z.boolean().optional(),\n completed: z.boolean().optional(),\n dismissed: z.boolean().optional(),\n }),\n )\n .max(50),\n});\n\nexport const AuthoringPickSchema = z.object({\n stepId: z.string().max(64).optional(),\n selectors: z.array(z.object({ kind: z.string(), value: z.string().max(1000), label: z.string().max(200).optional() })).max(10),\n textSnapshot: z.string().max(200).optional(),\n url: z.string().max(2000).optional(),\n rect: z.object({ x: z.number(), y: z.number(), width: z.number(), height: z.number() }).optional(),\n});\nexport type AuthoringPick = z.infer<typeof AuthoringPickSchema>;\n\n/**\n * Static, script-free copy of the page an authoring session is connected to. The SDK posts it to\n * the dashboard (never to the API) so the editor canvas can show the customer's real app.\n */\nexport interface AppSnapshot {\n /** Full HTML document (doctype included) with scripts and Guidely UI removed and a `<base>` pointing at `url`. */\n html: string;\n url: string;\n title: string;\n /** Viewport the snapshot was taken at, in CSS pixels. */\n width: number;\n height: number;\n capturedAt: string;\n}\n\nexport interface AuthoringSessionInfo {\n id: string;\n projectId: string;\n environment: string;\n guideId: string | null;\n dashboardOrigin: string;\n expiresAt: string;\n /** Draft guide config to preview while authoring (not published). */\n draft: { id: string; key: string; name: string; kind: GuideKind; config: GuideConfig } | null;\n}\n\nexport const PublishedGuideSchema = z.object({\n id: z.string(),\n key: z.string(),\n name: z.string(),\n kind: z.string(),\n version: z.number(),\n config: GuideConfigSchema,\n publishedAt: z.string(),\n});\n\nexport interface ApiError {\n error: { code: string; message: string; details?: unknown };\n}\n","import { z } from \"zod\";\n\n/** Messenger settings delivered to the SDK in `SdkConfigResponse.messenger`. */\nexport interface MessengerConfig {\n enabled: boolean;\n /** Display name of the AI agent (\"Scout\"). */\n name: string;\n greeting: string;\n /** Scout answers with AI; when false every conversation goes to the team inbox. */\n aiAvailable: boolean;\n handoffEnabled: boolean;\n launcher: { position: \"bottom-right\" | \"bottom-left\" };\n}\n\nexport const MESSAGE_AUTHORS = [\"user\", \"scout\", \"agent\", \"system\"] as const;\nexport type MessageAuthor = (typeof MESSAGE_AUTHORS)[number];\nexport type ConversationStatus = \"bot\" | \"open\" | \"closed\";\n\nexport interface MessengerCitation {\n articleId: string;\n title: string;\n}\n\nexport interface MessengerSuggestedGuide {\n key: string;\n name: string;\n}\n\nexport interface MessengerMessage {\n id: string;\n author: MessageAuthor;\n /** Team member name for `agent` messages. */\n authorName?: string | null;\n body: string;\n citations: MessengerCitation[];\n suggestedGuides: MessengerSuggestedGuide[];\n status: \"pending\" | \"complete\" | \"failed\";\n createdAt: string;\n}\n\nexport interface MessengerConversation {\n id: string;\n status: ConversationStatus;\n subject: string;\n lastMessageAt: string;\n lastMessagePreview: string;\n unread: number;\n rating: number | null;\n}\n\nexport const MAX_MESSAGE_LENGTH = 4000;\nconst messageText = z.string().trim().min(1).max(MAX_MESSAGE_LENGTH);\n\nexport const StartConversationSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n message: messageText,\n pageUrl: z.string().max(2000).optional(),\n});\nexport type StartConversationRequest = z.infer<typeof StartConversationSchema>;\n\nexport interface StartConversationResponse {\n conversation: MessengerConversation;\n /** Secret that authorises this browser to read and post in the conversation. Store it; it is not shown again. */\n token: string;\n messages: MessengerMessage[];\n}\n\nexport const ConversationLookupSchema = z.object({\n tokens: z.array(z.string().min(16).max(128)).max(50),\n});\n\nexport interface ConversationLookupResponse {\n conversations: Array<MessengerConversation & { token: string }>;\n}\n\nexport const PostMessageSchema = z.object({ message: messageText });\n\nexport const ConversationRatingSchema = z.object({\n rating: z.number().int().min(1).max(5),\n comment: z.string().max(1000).optional(),\n});\n\nexport interface ConversationMessagesResponse {\n conversation: MessengerConversation;\n messages: MessengerMessage[];\n}\n\n/**\n * Server-sent events streamed by `POST /sdk/conversations` and `POST /sdk/conversations/:id/messages`\n * while Scout replies. `conversation` (start only) carries the new conversation and its token, `message`\n * each stored message, `delta` reply text as it is generated, and `done` the final stored message.\n */\nexport type ScoutStreamEvent =\n | { event: \"conversation\"; data: StartConversationResponse }\n | { event: \"message\"; data: MessengerMessage }\n | { event: \"delta\"; data: { messageId: string; text: string } }\n | { event: \"done\"; data: { message: MessengerMessage; conversation: MessengerConversation } }\n | { event: \"error\"; data: { message: string } };\n\n/** Article list entry for the messenger Help tab (bodies are fetched on demand). */\nexport interface SdkArticleSummary {\n id: string;\n slug: string;\n title: string;\n summary: string;\n collectionId: string | null;\n externalUrl: string | null;\n updatedAt: string;\n}\n\nexport interface SdkArticlesResponse {\n collections: Array<{ id: string; name: string; description: string; order: number }>;\n articles: SdkArticleSummary[];\n}\n","import { GuideConfigSchema, type GuideConfigInput, type GuideKind } from \"./guide\";\n\nexport interface GuideTemplate {\n id: string;\n name: string;\n description: string;\n kind: GuideKind;\n category: \"onboarding\" | \"feature\" | \"setup\" | \"forms\" | \"announcement\" | \"help\" | \"feedback\";\n config: GuideConfigInput;\n}\n\nconst nav = (opts: { last?: boolean; first?: boolean } = {}) =>\n [\n ...(opts.first ? [] : [{ id: \"back\", label: \"Back\", action: \"back\" as const, variant: \"ghost\" as const }]),\n opts.last\n ? { id: \"done\", label: \"Finish\", action: \"complete\" as const, variant: \"primary\" as const }\n : { id: \"next\", label: \"Next\", action: \"next\" as const, variant: \"primary\" as const },\n ];\n\nexport const GUIDE_TEMPLATES: GuideTemplate[] = [\n {\n id: \"new-user-onboarding\",\n name: \"New-user onboarding tour\",\n description: \"A welcome modal followed by three anchored steps that introduce the main navigation.\",\n kind: \"flow\",\n category: \"onboarding\",\n config: {\n steps: [\n { id: \"welcome\", type: \"modal\", title: \"Welcome aboard 👋\", body: \"<p>We'll show you around in under a minute. You can skip at any time.</p>\", showOverlay: true, buttons: [{ id: \"skip\", label: \"Skip tour\", action: \"dismiss\", variant: \"ghost\" }, { id: \"start\", label: \"Show me around\", action: \"next\" }] },\n { id: \"nav\", type: \"tooltip\", title: \"Your navigation\", body: \"<p>Everything lives in the sidebar. Switch between dashboards, contacts and settings here.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='sidebar']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", buttons: nav() },\n { id: \"create\", type: \"spotlight\", title: \"Create your first record\", body: \"<p>Use the primary button to add something new. We'll highlight it for you.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='primary-action']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", showOverlay: true, buttons: nav() },\n { id: \"help\", type: \"tooltip\", title: \"Need help later?\", body: \"<p>Open the help menu any time to replay this tour or browse the resource center.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='help']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: nav({ last: true }) },\n ],\n trigger: { type: \"page_load\" },\n frequency: { mode: \"once\", priority: 10 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"visitor.firstVisit\", op: \"is_true\" }] },\n },\n },\n {\n id: \"feature-discovery\",\n name: \"First-time feature discovery\",\n description: \"A hotspot that draws attention to a new capability and expands into a tooltip.\",\n kind: \"tooltip\",\n category: \"feature\",\n config: {\n steps: [{ id: \"hotspot\", type: \"hotspot\", title: \"New: smart filters\", body: \"<p>Filters now understand natural language. Try <em>“deals closing this month”</em>.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='filters']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: [{ id: \"got-it\", label: \"Got it\", action: \"complete\" }], hotspot: { size: 14, pulse: true, openOn: \"click\" }, showProgress: false }],\n trigger: { type: \"element_visible\", value: \"[data-tour='filters']\" },\n frequency: { mode: \"once\", maxImpressions: 3, priority: 50 },\n },\n },\n {\n id: \"setup-wizard\",\n name: \"Setup wizard\",\n description: \"Multi-step modal wizard that walks a new admin through initial configuration with branching.\",\n kind: \"flow\",\n category: \"setup\",\n config: {\n steps: [\n { id: \"intro\", type: \"modal\", title: \"Let's set up your workspace\", body: \"<p>Three quick steps: invite your team, connect a data source, and choose a plan.</p>\", showOverlay: true, buttons: [{ id: \"later\", label: \"Later\", action: \"dismiss\", variant: \"ghost\" }, { id: \"go\", label: \"Start setup\", action: \"next\" }] },\n { id: \"team\", type: \"popover\", title: \"Invite teammates\", body: \"<p>Guidely works best with your whole team. Add a few emails here.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='invite']\" }], waitMs: 5000, fallback: \"show_as_modal\", scrollIntoView: true }, buttons: nav() },\n { id: \"data\", type: \"popover\", title: \"Connect a data source\", body: \"<p>Import contacts from a CSV or connect your CRM.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='import']\" }], waitMs: 5000, fallback: \"show_as_modal\", scrollIntoView: true }, buttons: nav() },\n { id: \"done\", type: \"modal\", title: \"You're ready 🎉\", body: \"<p>That's it. Explore the dashboard, and open the help menu if you get stuck.</p>\", showOverlay: true, buttons: nav({ last: true }) },\n ],\n trigger: { type: \"page_load\", urlPattern: \"/dashboard\" },\n frequency: { mode: \"once\", priority: 20 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"user.role\", op: \"equals\", value: \"admin\" }] },\n },\n },\n {\n id: \"form-completion\",\n name: \"Form completion helper\",\n description: \"Tooltips that advance as the user fills out each field of a form.\",\n kind: \"flow\",\n category: \"forms\",\n config: {\n steps: [\n { id: \"name\", type: \"tooltip\", title: \"Name the contact\", body: \"<p>Use their full name so search works well.</p>\", target: { selectors: [{ kind: \"css\", value: \"input[name='name']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", advanceOn: \"element_click\", advanceValue: \"input[name='email']\", buttons: [] },\n { id: \"email\", type: \"tooltip\", title: \"Add an email\", body: \"<p>We'll use it for sequences and reminders.</p>\", target: { selectors: [{ kind: \"css\", value: \"input[name='email']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", buttons: nav() },\n { id: \"save\", type: \"spotlight\", title: \"Save\", body: \"<p>Hit save, and your contact appears in the list.</p>\", target: { selectors: [{ kind: \"css\", value: \"button[type='submit']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"top\", showOverlay: true, buttons: nav({ last: true }) },\n ],\n trigger: { type: \"url_match\", value: \"/contacts/new\" },\n frequency: { mode: \"once\", priority: 40 },\n },\n },\n {\n id: \"workflow-walkthrough\",\n name: \"Complex workflow walkthrough\",\n description: \"A multi-page flow that follows the user across routes with URL-aware steps.\",\n kind: \"flow\",\n category: \"onboarding\",\n config: {\n steps: [\n { id: \"start\", type: \"modal\", title: \"Close your first deal\", body: \"<p>We'll go from pipeline to closed-won in four steps.</p>\", showOverlay: true, buttons: [{ id: \"skip\", label: \"Not now\", action: \"dismiss\", variant: \"ghost\" }, { id: \"next\", label: \"Let's go\", action: \"next\" }] },\n { id: \"pipeline\", type: \"tooltip\", title: \"Open the pipeline\", body: \"<p>Click here to see your deals by stage.</p>\", url: \"/dashboard\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='nav-deals']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", advanceOn: \"element_click\", advanceValue: \"[data-tour='nav-deals']\", buttons: [] },\n { id: \"drag\", type: \"spotlight\", title: \"Move a deal\", body: \"<p>Drag a card to the next stage, or use the stage menu.</p>\", url: \"/deals\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='deal-card']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", showOverlay: true, buttons: nav() },\n { id: \"won\", type: \"tooltip\", title: \"Mark as won\", body: \"<p>When it closes, mark it won to update your forecast.</p>\", url: \"/deals\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='mark-won']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"left\", buttons: nav({ last: true }) },\n ],\n trigger: { type: \"manual\" },\n frequency: { mode: \"every_time\", priority: 30 },\n },\n },\n {\n id: \"feature-announcement\",\n name: \"New feature announcement\",\n description: \"A centered modal with an image announcing a new capability.\",\n kind: \"announcement\",\n category: \"announcement\",\n config: {\n steps: [{ id: \"announce\", type: \"modal\", title: \"Introducing Reports 2.0\", body: \"<p>Build custom reports with drag-and-drop metrics, scheduled emails and shareable links.</p><ul><li>12 new chart types</li><li>Export to CSV and PDF</li></ul>\", imageUrl: \"https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=800&q=60\", showOverlay: true, buttons: [{ id: \"later\", label: \"Maybe later\", action: \"dismiss\", variant: \"ghost\" }, { id: \"try\", label: \"Try it now\", action: \"url\", value: \"/reports\" }], showProgress: false }],\n trigger: { type: \"page_load\", delayMs: 1500 },\n frequency: { mode: \"once\", priority: 60 },\n },\n },\n {\n id: \"contextual-tooltip\",\n name: \"Contextual tooltip\",\n description: \"A single tooltip that appears when a specific element becomes visible.\",\n kind: \"tooltip\",\n category: \"help\",\n config: {\n steps: [{ id: \"tip\", type: \"tooltip\", title: \"Pro tip\", body: \"<p>Press <strong>⌘K</strong> to jump anywhere.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='search']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: [{ id: \"ok\", label: \"Got it\", action: \"complete\" }], showProgress: false }],\n trigger: { type: \"element_visible\", value: \"[data-tour='search']\", delayMs: 500 },\n frequency: { mode: \"once\", priority: 80 },\n },\n },\n {\n id: \"product-update-banner\",\n name: \"Product update notification\",\n description: \"A dismissible top banner linking to release notes.\",\n kind: \"banner\",\n category: \"announcement\",\n config: {\n steps: [{ id: \"banner\", type: \"banner\", title: \"\", body: \"<p><strong>Scheduled maintenance</strong> on Saturday 02:00–03:00 UTC. <a href='/status'>Read more</a>.</p>\", position: \"top\", placement: \"top\", buttons: [{ id: \"dismiss\", label: \"Dismiss\", action: \"dismiss\", variant: \"ghost\" }], showProgress: false }],\n trigger: { type: \"page_load\" },\n frequency: { mode: \"once_per_session\", priority: 90 },\n },\n },\n {\n id: \"onboarding-checklist\",\n name: \"User onboarding checklist\",\n description: \"A persistent checklist with four tasks that complete automatically from events.\",\n kind: \"checklist\",\n category: \"onboarding\",\n config: {\n steps: [],\n checklist: {\n tasks: [\n { id: \"profile\", title: \"Complete your profile\", description: \"Add a photo and your role.\", completion: \"event\", completionValue: \"profile_completed\", action: \"url\", actionValue: \"/settings/profile\" },\n { id: \"contact\", title: \"Add your first contact\", description: \"Import or create a contact.\", completion: \"event\", completionValue: \"contact_created\", action: \"url\", actionValue: \"/contacts/new\" },\n { id: \"deal\", title: \"Create a deal\", description: \"Track your first opportunity.\", completion: \"event\", completionValue: \"deal_created\", action: \"url\", actionValue: \"/deals\" },\n { id: \"tour\", title: \"Take the product tour\", description: \"A 60-second walkthrough.\", completion: \"guide_completed\", completionValue: \"new-user-onboarding\", action: \"start_guide\", actionValue: \"new-user-onboarding\", required: false },\n ],\n ordered: false,\n launcherLabel: \"Getting started\",\n position: \"bottom-right\",\n completionTitle: \"You're all set! 🎉\",\n completionBody: \"You've completed onboarding. Explore the rest of the app at your own pace.\",\n autoOpen: true,\n dismissible: true,\n },\n trigger: { type: \"page_load\" },\n frequency: { mode: \"every_time\", priority: 200 },\n },\n },\n {\n id: \"nps-survey\",\n name: \"NPS survey\",\n description: \"Net Promoter Score with a conditional follow-up question.\",\n kind: \"survey\",\n category: \"feedback\",\n config: {\n steps: [],\n survey: {\n questions: [\n { id: \"nps\", type: \"nps\", title: \"How likely are you to recommend us to a colleague?\", lowLabel: \"Not likely\", highLabel: \"Very likely\" },\n { id: \"why-low\", type: \"text\", title: \"What could we do better?\", required: false, placeholder: \"Tell us more…\", showWhen: { questionId: \"nps\", op: \"lte\", value: 6 } },\n { id: \"why-high\", type: \"text\", title: \"What do you like most?\", required: false, placeholder: \"Tell us more…\", showWhen: { questionId: \"nps\", op: \"gte\", value: 9 } },\n ],\n position: \"bottom-right\",\n },\n trigger: { type: \"page_load\", delayMs: 5000 },\n frequency: { mode: \"interval\", intervalHours: 2160, priority: 150 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"visitor.returning\", op: \"is_true\" }] },\n },\n },\n];\n\nexport function templateConfig(id: string) {\n const t = GUIDE_TEMPLATES.find((x) => x.id === id);\n if (!t) return null;\n return { template: t, config: GuideConfigSchema.parse(t.config) };\n}\n","export * from \"./utils\";\nexport * from \"./targeting\";\nexport * from \"./guide\";\nexport * from \"./events\";\nexport * from \"./sdk-api\";\nexport * from \"./messenger\";\nexport * from \"./templates\";\nexport const SDK_API_VERSION = \"v1\";\nexport const SHARED_VERSION = \"0.2.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,eA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AAO,OAAO,sDAAsD,UAAU,cAAc,WAAW,cAAc;AAAA,UACxI,EAAE,IAAI,WAAW,MAAM,QAAQ,OAAO,4BAA4B,UAAU,OAAO,aAAa,sBAAiB,UAAU,EAAE,YAAY,OAAO,IAAI,OAAO,OAAO,EAAE,EAAE;AAAA,UACtK,EAAE,IAAI,YAAY,MAAM,QAAQ,OAAO,0BAA0B,UAAU,OAAO,aAAa,sBAAiB,UAAU,EAAE,YAAY,OAAO,IAAI,OAAO,OAAO,EAAE,EAAE;AAAA,QACvK;AAAA,QACA,UAAU;AAAA,MACZ;AAAA,MACA,SAAS,EAAE,MAAM,aAAa,SAAS,IAAK;AAAA,MAC5C,WAAW,EAAE,MAAM,YAAY,eAAe,MAAM,UAAU,IAAI;AAAA,MAClE,WAAW,EAAE,IAAI,QAAQ,IAAI,OAAO,OAAO,CAAC,EAAE,IAAI,MAAM,OAAO,qBAAqB,IAAI,UAAU,CAAC,EAAE;AAAA,IACvG;AAAA,EACF;AACF;AAEO,SAAS,eAAe,IAAY;AACzC,QAAM,IAAI,gBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AACjD,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,EAAE,UAAU,GAAG,QAAQ,kBAAkB,MAAM,EAAE,MAAM,EAAE;AAClE;;;ACxLO,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;","names":["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/templates.ts","../src/index.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { RULE_FIELDS, RULE_OPERATORS, type Rule, type RuleGroup } from \"./targeting-eval\";\n\nexport * from \"./targeting-eval\";\n\nexport const RuleSchema: z.ZodType<Rule> = z.object({\n id: z.string().min(1),\n field: z.enum(RULE_FIELDS),\n key: z.string().max(200).optional(),\n op: z.enum(RULE_OPERATORS),\n value: z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]).optional(),\n negate: z.boolean().optional(),\n});\n\nexport const RuleGroupSchema: z.ZodType<RuleGroup> = z.lazy(() =>\n z.object({\n id: z.string().min(1),\n op: z.enum([\"and\", \"or\"]),\n rules: z.array(z.union([RuleSchema, RuleGroupSchema])).max(100),\n negate: z.boolean().optional(),\n }),\n);\n","import { z } from \"zod\";\nimport { 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\nexport const SELECTOR_KINDS = [\"css\", \"id\", \"data-attr\", \"aria\", \"text\", \"xpath\"] as const;\nexport const SelectorStrategySchema = z.object({\n kind: z.enum(SELECTOR_KINDS),\n value: z.string().min(1).max(1000),\n /** Optional human-readable label captured at pick time. */\n label: z.string().max(200).optional(),\n});\nexport type SelectorStrategy = z.infer<typeof SelectorStrategySchema>;\n\nexport const TargetSchema = z.object({\n /** Ordered strategies; the first one resolving to exactly one element wins. */\n selectors: z.array(SelectorStrategySchema).max(10),\n /** How long to wait for the element before applying fallback. */\n waitMs: z.number().int().min(0).max(60000).default(5000),\n /** What to do when the element never shows up. */\n fallback: z.enum([\"skip\", \"show_as_modal\", \"end_guide\", \"wait\"]).default(\"skip\"),\n /** Scroll the element into view before positioning. */\n scrollIntoView: z.boolean().default(true),\n /** Text snapshot captured at pick time; used for authoring warnings. */\n textSnapshot: z.string().max(200).optional(),\n});\nexport type StepTarget = z.infer<typeof TargetSchema>;\n\nexport const BUTTON_ACTIONS = [\"next\", \"back\", \"dismiss\", \"complete\", \"skip\", \"url\", \"start_guide\", \"event\", \"open_resource_center\", \"none\"] as const;\nexport const ButtonSchema = z.object({\n id: z.string().min(1),\n label: z.string().min(1).max(80),\n action: z.enum(BUTTON_ACTIONS),\n variant: z.enum([\"primary\", \"secondary\", \"ghost\", \"link\"]).default(\"primary\"),\n /** url for `url`, guide id for `start_guide`, event name for `event`, step id for `next` branch override */\n value: z.string().max(2000).optional(),\n newTab: z.boolean().optional(),\n});\nexport type StepButton = z.infer<typeof ButtonSchema>;\n\nexport const StepBranchSchema = z.object({\n id: z.string(),\n /** Rule group evaluated against targeting context when leaving the step. */\n when: RuleGroupSchema,\n /** Step id to jump to. */\n goTo: z.string(),\n});\n\nexport const ADVANCE_ON = [\"button\", \"element_click\", \"element_visible\", \"event\", \"delay\", \"any\"] as const;\n\nexport const StepSchema = z.object({\n id: z.string().min(1).max(64),\n type: z.enum(STEP_TYPES),\n title: z.string().max(200).default(\"\"),\n /** Sanitized HTML body (links, images, lists, formatting). */\n body: z.string().max(20000).default(\"\"),\n imageUrl: z.string().url().max(2000).optional().or(z.literal(\"\")),\n buttons: z.array(ButtonSchema).max(6).default([]),\n target: TargetSchema.optional(),\n placement: z.enum(PLACEMENTS).default(\"auto\"),\n /** Pixel offset between anchor and card. */\n offset: z.number().int().min(0).max(64).default(10),\n showOverlay: z.boolean().default(false),\n showProgress: z.boolean().default(true),\n showClose: z.boolean().default(true),\n dismissOnOutsideClick: z.boolean().default(false),\n /** Highlight padding for spotlight. */\n spotlightPadding: z.number().int().min(0).max(64).default(6),\n /** Banner/slideout position. */\n position: z.enum([\"top\", \"bottom\", \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\", \"center\"]).default(\"bottom-right\"),\n /** URL pattern this step belongs to (for multi-page flows). */\n url: z.string().max(500).optional(),\n /** Automatic advancement. */\n advanceOn: z.enum(ADVANCE_ON).default(\"button\"),\n advanceValue: z.string().max(500).optional(),\n advanceDelayMs: z.number().int().min(0).max(600000).optional(),\n branches: z.array(StepBranchSchema).max(10).default([]),\n width: z.number().int().min(200).max(900).optional(),\n /** Step-level targeting: skip step when rules do not match. */\n targeting: RuleGroupSchema.optional(),\n /** Hotspot pulse dot settings. */\n hotspot: z.object({ size: z.number().int().min(8).max(40).default(14), pulse: z.boolean().default(true), openOn: z.enum([\"click\", \"hover\"]).default(\"click\") }).optional(),\n /** Custom step: arbitrary sanitized HTML with no chrome. */\n customHtml: z.string().max(50000).optional(),\n});\nexport type GuideStep = z.infer<typeof StepSchema>;\nexport type GuideStepInput = z.input<typeof StepSchema>;\n\nexport const TRIGGER_TYPES = [\"page_load\", \"url_match\", \"event\", \"element_click\", \"element_visible\", \"manual\", \"delay\", \"after_guide\", \"segment_enter\"] as const;\nexport const TriggerSchema = z.object({\n type: z.enum(TRIGGER_TYPES).default(\"page_load\"),\n /** url pattern, event name, selector, guide id, audience id depending on type */\n value: z.string().max(1000).optional(),\n delayMs: z.number().int().min(0).max(600000).default(0),\n /** Also require URL to match this pattern (any trigger). */\n urlPattern: z.string().max(500).optional(),\n});\nexport type TriggerConfig = z.infer<typeof TriggerSchema>;\n\nexport const FrequencySchema = z.object({\n mode: z.enum([\"once\", \"once_per_session\", \"every_time\", \"interval\"]).default(\"once\"),\n intervalHours: z.number().int().min(1).max(8760).optional(),\n maxImpressions: z.number().int().min(1).max(1000).optional(),\n /** Hours to wait after dismissal before eligible again (when not `once`). */\n cooldownHours: z.number().int().min(0).max(8760).default(0),\n /** Lower number wins when multiple guides qualify. */\n priority: z.number().int().min(0).max(1000).default(100),\n /** Guide ids that must not be active at the same time. */\n mutuallyExclusiveWith: z.array(z.string()).max(50).default([]),\n /** Re-show if dismissed (otherwise dismissal counts as completion for frequency). */\n reshowAfterDismiss: z.boolean().default(false),\n});\nexport type FrequencyConfig = z.infer<typeof FrequencySchema>;\n\nexport const AppearanceSchema = z.object({\n theme: z.enum([\"light\", \"dark\", \"auto\"]).default(\"auto\"),\n primaryColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),\n borderRadius: z.number().int().min(0).max(32).optional(),\n fontFamily: z.string().max(200).optional(),\n overlayOpacity: z.number().min(0).max(1).optional(),\n zIndex: z.number().int().min(1).max(2147483647).optional(),\n preset: z.string().max(50).optional(),\n animation: z.enum([\"fade\", \"slide\", \"none\"]).default(\"fade\"),\n});\nexport type Appearance = z.infer<typeof AppearanceSchema>;\n\nexport const ChecklistTaskSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1).max(200),\n description: z.string().max(2000).default(\"\"),\n /** How the task completes. */\n completion: z.enum([\"manual\", \"event\", \"guide_completed\", \"url_visited\", \"click\"]).default(\"manual\"),\n completionValue: z.string().max(500).optional(),\n /** Optional action when clicking the task. */\n action: z.enum([\"none\", \"start_guide\", \"url\", \"event\"]).default(\"none\"),\n actionValue: z.string().max(2000).optional(),\n required: z.boolean().default(true),\n});\nexport type ChecklistTask = z.infer<typeof ChecklistTaskSchema>;\n\nexport const ChecklistConfigSchema = z.object({\n tasks: z.array(ChecklistTaskSchema).min(1).max(30),\n ordered: z.boolean().default(false),\n launcherLabel: z.string().max(60).default(\"Getting started\"),\n position: z.enum([\"bottom-right\", \"bottom-left\"]).default(\"bottom-right\"),\n completionTitle: z.string().max(200).default(\"You're all set!\"),\n completionBody: z.string().max(2000).default(\"\"),\n autoOpen: z.boolean().default(true),\n dismissible: z.boolean().default(true),\n});\nexport type ChecklistConfig = z.infer<typeof ChecklistConfigSchema>;\n\nexport const SURVEY_QUESTION_TYPES = [\"nps\", \"csat\", \"thumbs\", \"single_choice\", \"multiple_choice\", \"text\", \"rating\"] as const;\nexport const SurveyQuestionSchema = z.object({\n id: z.string().min(1),\n type: z.enum(SURVEY_QUESTION_TYPES),\n title: z.string().min(1).max(500),\n description: z.string().max(1000).default(\"\"),\n required: z.boolean().default(true),\n options: z.array(z.object({ id: z.string(), label: z.string().max(200) })).max(20).default([]),\n scaleMax: z.number().int().min(2).max(10).optional(),\n lowLabel: z.string().max(60).optional(),\n highLabel: z.string().max(60).optional(),\n placeholder: z.string().max(200).optional(),\n /** Conditional follow-up: show only when a previous answer matches. */\n showWhen: z.object({ questionId: z.string(), op: z.enum([\"equals\", \"lte\", \"gte\", \"in\"]), value: z.union([z.string(), z.number(), z.array(z.string())]) }).optional(),\n});\nexport type SurveyQuestion = z.infer<typeof SurveyQuestionSchema>;\n\nexport const SurveyConfigSchema = z.object({\n questions: z.array(SurveyQuestionSchema).min(1).max(20),\n thankYouTitle: z.string().max(200).default(\"Thanks for your feedback!\"),\n thankYouBody: z.string().max(2000).default(\"\"),\n position: z.enum([\"bottom-right\", \"bottom-left\", \"center\"]).default(\"bottom-right\"),\n startAt: z.string().datetime().optional(),\n endAt: z.string().datetime().optional(),\n});\nexport type SurveyConfig = z.infer<typeof SurveyConfigSchema>;\n\nexport const GuideConfigSchema = z.object({\n steps: z.array(StepSchema).max(50).default([]),\n targeting: RuleGroupSchema.default(() => emptyRuleGroup()),\n trigger: TriggerSchema.default({}),\n frequency: FrequencySchema.default({}),\n appearance: AppearanceSchema.default({}),\n checklist: ChecklistConfigSchema.optional(),\n survey: SurveyConfigSchema.optional(),\n /** Restrict guide to url pattern(s) (applied before trigger). */\n urlPatterns: z.array(z.string().max(500)).max(20).default([]),\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 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 (!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] as const;\nexport type EventName = (typeof EVENT_NAMES)[number];\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\";\n","import { z } from \"zod\";\nimport { GuideConfigSchema, ProjectThemeSchema, type GuideKind, type GuideConfig } from \"./guide\";\nimport type { MessengerConfig } from \"./messenger\";\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 updatedAt: 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: Array<{ id: string; name: string; description: string; order: number }>;\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 };\n generatedAt: string;\n}\n\nexport const IdentifyRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().min(1).max(256).optional().nullable(),\n traits: z.record(z.unknown()).optional(),\n account: z\n .object({ id: z.string().min(1).max(256), traits: z.record(z.unknown()).optional() })\n .optional()\n .nullable(),\n sessionId: z.string().max(128).optional(),\n url: z.string().max(2000).optional(),\n});\nexport type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;\n\n/** Server-held state the SDK needs for targeting & frequency. */\nexport interface IdentifyResponse {\n endUserId: string;\n audienceIds: string[];\n guideState: Record<\n string,\n { impressions: number; completedAt?: string | null; dismissedAt?: string | null; lastShownAt?: string | null }\n >;\n checklistProgress: Record<string, { completedTaskIds: string[]; completedAt?: string | null; dismissedAt?: string | null }>;\n surveysSubmitted: string[];\n firstSeenAt: string;\n}\n\nexport const ChecklistProgressRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int().optional(),\n completedTaskIds: z.array(z.string().max(64)).max(100),\n dismissed: z.boolean().optional(),\n completed: z.boolean().optional(),\n});\nexport type ChecklistProgressRequest = z.infer<typeof ChecklistProgressRequestSchema>;\n\nexport const SurveyResponseRequestSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n accountId: z.string().max(256).optional().nullable(),\n guideVersion: z.number().int(),\n answers: z.record(z.union([z.string().max(5000), z.number(), z.boolean(), z.array(z.string().max(500)).max(50)])),\n responseId: z.string().min(8).max(64),\n});\nexport type SurveyResponseRequest = z.infer<typeof SurveyResponseRequestSchema>;\n\nexport const GuideStateUpdateSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n updates: z\n .array(\n z.object({\n guideId: z.string(),\n impression: z.boolean().optional(),\n completed: z.boolean().optional(),\n dismissed: z.boolean().optional(),\n }),\n )\n .max(50),\n});\n\nexport const AuthoringPickSchema = z.object({\n stepId: z.string().max(64).optional(),\n selectors: z.array(z.object({ kind: z.string(), value: z.string().max(1000), label: z.string().max(200).optional() })).max(10),\n textSnapshot: z.string().max(200).optional(),\n url: z.string().max(2000).optional(),\n rect: z.object({ x: z.number(), y: z.number(), width: z.number(), height: z.number() }).optional(),\n});\nexport type AuthoringPick = z.infer<typeof AuthoringPickSchema>;\n\n/**\n * Static, script-free copy of the page an authoring session is connected to. The SDK posts it to\n * the dashboard (never to the API) so the editor canvas can show the customer's real app.\n */\nexport interface AppSnapshot {\n /** Full HTML document (doctype included) with scripts and Guidely UI removed and a `<base>` pointing at `url`. */\n html: string;\n url: string;\n title: string;\n /** Viewport the snapshot was taken at, in CSS pixels. */\n width: number;\n height: number;\n capturedAt: string;\n}\n\nexport interface AuthoringSessionInfo {\n id: string;\n projectId: string;\n environment: string;\n guideId: string | null;\n dashboardOrigin: string;\n expiresAt: string;\n /** Draft guide config to preview while authoring (not published). */\n draft: { id: string; key: string; name: string; kind: GuideKind; config: GuideConfig } | null;\n}\n\nexport const PublishedGuideSchema = z.object({\n id: z.string(),\n key: z.string(),\n name: z.string(),\n kind: z.string(),\n version: z.number(),\n config: GuideConfigSchema,\n publishedAt: z.string(),\n});\n\nexport interface ApiError {\n error: { code: string; message: string; details?: unknown };\n}\n","import { z } from \"zod\";\n\n/** Messenger settings delivered to the SDK in `SdkConfigResponse.messenger`. */\nexport interface MessengerConfig {\n enabled: boolean;\n /** Display name of the AI agent (\"Scout\"). */\n name: string;\n greeting: string;\n /** Scout answers with AI; when false every conversation goes to the team inbox. */\n aiAvailable: boolean;\n handoffEnabled: boolean;\n launcher: { position: \"bottom-right\" | \"bottom-left\" };\n}\n\nexport const MESSAGE_AUTHORS = [\"user\", \"scout\", \"agent\", \"system\"] as const;\nexport type MessageAuthor = (typeof MESSAGE_AUTHORS)[number];\nexport type ConversationStatus = \"bot\" | \"open\" | \"closed\";\n\nexport interface MessengerCitation {\n articleId: string;\n title: string;\n}\n\nexport interface MessengerSuggestedGuide {\n key: string;\n name: string;\n}\n\nexport interface MessengerMessage {\n id: string;\n author: MessageAuthor;\n /** Team member name for `agent` messages. */\n authorName?: string | null;\n body: string;\n citations: MessengerCitation[];\n suggestedGuides: MessengerSuggestedGuide[];\n status: \"pending\" | \"complete\" | \"failed\";\n createdAt: string;\n}\n\nexport interface MessengerConversation {\n id: string;\n status: ConversationStatus;\n subject: string;\n lastMessageAt: string;\n lastMessagePreview: string;\n unread: number;\n rating: number | null;\n}\n\nexport const MAX_MESSAGE_LENGTH = 4000;\nconst messageText = z.string().trim().min(1).max(MAX_MESSAGE_LENGTH);\n\nexport const StartConversationSchema = z.object({\n anonymousId: z.string().min(1).max(128),\n userId: z.string().max(256).optional().nullable(),\n message: messageText,\n pageUrl: z.string().max(2000).optional(),\n});\nexport type StartConversationRequest = z.infer<typeof StartConversationSchema>;\n\nexport interface StartConversationResponse {\n conversation: MessengerConversation;\n /** Secret that authorises this browser to read and post in the conversation. Store it; it is not shown again. */\n token: string;\n messages: MessengerMessage[];\n}\n\nexport const ConversationLookupSchema = z.object({\n tokens: z.array(z.string().min(16).max(128)).max(50),\n});\n\nexport interface ConversationLookupResponse {\n conversations: Array<MessengerConversation & { token: string }>;\n}\n\nexport const PostMessageSchema = z.object({ message: messageText });\n\nexport const ConversationRatingSchema = z.object({\n rating: z.number().int().min(1).max(5),\n comment: z.string().max(1000).optional(),\n});\n\nexport interface ConversationMessagesResponse {\n conversation: MessengerConversation;\n messages: MessengerMessage[];\n}\n\n/**\n * Server-sent events streamed by `POST /sdk/conversations` and `POST /sdk/conversations/:id/messages`\n * while Scout replies. `conversation` (start only) carries the new conversation and its token, `message`\n * each stored message, `delta` reply text as it is generated, and `done` the final stored message.\n */\nexport type ScoutStreamEvent =\n | { event: \"conversation\"; data: StartConversationResponse }\n | { event: \"message\"; data: MessengerMessage }\n | { event: \"delta\"; data: { messageId: string; text: string } }\n | { event: \"done\"; data: { message: MessengerMessage; conversation: MessengerConversation } }\n | { event: \"error\"; data: { message: string } };\n\n/** Article list entry for the messenger Help tab (bodies are fetched on demand). */\nexport interface SdkArticleSummary {\n id: string;\n slug: string;\n title: string;\n summary: string;\n collectionId: string | null;\n externalUrl: string | null;\n updatedAt: string;\n}\n\nexport interface SdkArticlesResponse {\n collections: Array<{ id: string; name: string; description: string; order: number }>;\n articles: SdkArticleSummary[];\n}\n","import { GuideConfigSchema, type GuideConfigInput, type GuideKind } from \"./guide\";\n\nexport interface GuideTemplate {\n id: string;\n name: string;\n description: string;\n kind: GuideKind;\n category: \"onboarding\" | \"feature\" | \"setup\" | \"forms\" | \"announcement\" | \"help\" | \"feedback\";\n config: GuideConfigInput;\n}\n\nconst nav = (opts: { last?: boolean; first?: boolean } = {}) =>\n [\n ...(opts.first ? [] : [{ id: \"back\", label: \"Back\", action: \"back\" as const, variant: \"ghost\" as const }]),\n opts.last\n ? { id: \"done\", label: \"Finish\", action: \"complete\" as const, variant: \"primary\" as const }\n : { id: \"next\", label: \"Next\", action: \"next\" as const, variant: \"primary\" as const },\n ];\n\nexport const GUIDE_TEMPLATES: GuideTemplate[] = [\n {\n id: \"new-user-onboarding\",\n name: \"New-user onboarding tour\",\n description: \"A welcome modal followed by three anchored steps that introduce the main navigation.\",\n kind: \"flow\",\n category: \"onboarding\",\n config: {\n steps: [\n { id: \"welcome\", type: \"modal\", title: \"Welcome aboard 👋\", body: \"<p>We'll show you around in under a minute. You can skip at any time.</p>\", showOverlay: true, buttons: [{ id: \"skip\", label: \"Skip tour\", action: \"dismiss\", variant: \"ghost\" }, { id: \"start\", label: \"Show me around\", action: \"next\" }] },\n { id: \"nav\", type: \"tooltip\", title: \"Your navigation\", body: \"<p>Everything lives in the sidebar. Switch between dashboards, contacts and settings here.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='sidebar']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", buttons: nav() },\n { id: \"create\", type: \"spotlight\", title: \"Create your first record\", body: \"<p>Use the primary button to add something new. We'll highlight it for you.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='primary-action']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", showOverlay: true, buttons: nav() },\n { id: \"help\", type: \"tooltip\", title: \"Need help later?\", body: \"<p>Open the help menu any time to replay this tour or browse the resource center.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='help']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: nav({ last: true }) },\n ],\n trigger: { type: \"page_load\" },\n frequency: { mode: \"once\", priority: 10 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"visitor.firstVisit\", op: \"is_true\" }] },\n },\n },\n {\n id: \"feature-discovery\",\n name: \"First-time feature discovery\",\n description: \"A hotspot that draws attention to a new capability and expands into a tooltip.\",\n kind: \"tooltip\",\n category: \"feature\",\n config: {\n steps: [{ id: \"hotspot\", type: \"hotspot\", title: \"New: smart filters\", body: \"<p>Filters now understand natural language. Try <em>“deals closing this month”</em>.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='filters']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: [{ id: \"got-it\", label: \"Got it\", action: \"complete\" }], hotspot: { size: 14, pulse: true, openOn: \"click\" }, showProgress: false }],\n trigger: { type: \"element_visible\", value: \"[data-tour='filters']\" },\n frequency: { mode: \"once\", maxImpressions: 3, priority: 50 },\n },\n },\n {\n id: \"setup-wizard\",\n name: \"Setup wizard\",\n description: \"Multi-step modal wizard that walks a new admin through initial configuration with branching.\",\n kind: \"flow\",\n category: \"setup\",\n config: {\n steps: [\n { id: \"intro\", type: \"modal\", title: \"Let's set up your workspace\", body: \"<p>Three quick steps: invite your team, connect a data source, and choose a plan.</p>\", showOverlay: true, buttons: [{ id: \"later\", label: \"Later\", action: \"dismiss\", variant: \"ghost\" }, { id: \"go\", label: \"Start setup\", action: \"next\" }] },\n { id: \"team\", type: \"popover\", title: \"Invite teammates\", body: \"<p>Guidely works best with your whole team. Add a few emails here.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='invite']\" }], waitMs: 5000, fallback: \"show_as_modal\", scrollIntoView: true }, buttons: nav() },\n { id: \"data\", type: \"popover\", title: \"Connect a data source\", body: \"<p>Import contacts from a CSV or connect your CRM.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='import']\" }], waitMs: 5000, fallback: \"show_as_modal\", scrollIntoView: true }, buttons: nav() },\n { id: \"done\", type: \"modal\", title: \"You're ready 🎉\", body: \"<p>That's it. Explore the dashboard, and open the help menu if you get stuck.</p>\", showOverlay: true, buttons: nav({ last: true }) },\n ],\n trigger: { type: \"page_load\", urlPattern: \"/dashboard\" },\n frequency: { mode: \"once\", priority: 20 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"user.role\", op: \"equals\", value: \"admin\" }] },\n },\n },\n {\n id: \"form-completion\",\n name: \"Form completion helper\",\n description: \"Tooltips that advance as the user fills out each field of a form.\",\n kind: \"flow\",\n category: \"forms\",\n config: {\n steps: [\n { id: \"name\", type: \"tooltip\", title: \"Name the contact\", body: \"<p>Use their full name so search works well.</p>\", target: { selectors: [{ kind: \"css\", value: \"input[name='name']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", advanceOn: \"element_click\", advanceValue: \"input[name='email']\", buttons: [] },\n { id: \"email\", type: \"tooltip\", title: \"Add an email\", body: \"<p>We'll use it for sequences and reminders.</p>\", target: { selectors: [{ kind: \"css\", value: \"input[name='email']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", buttons: nav() },\n { id: \"save\", type: \"spotlight\", title: \"Save\", body: \"<p>Hit save, and your contact appears in the list.</p>\", target: { selectors: [{ kind: \"css\", value: \"button[type='submit']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"top\", showOverlay: true, buttons: nav({ last: true }) },\n ],\n trigger: { type: \"url_match\", value: \"/contacts/new\" },\n frequency: { mode: \"once\", priority: 40 },\n },\n },\n {\n id: \"workflow-walkthrough\",\n name: \"Complex workflow walkthrough\",\n description: \"A multi-page flow that follows the user across routes with URL-aware steps.\",\n kind: \"flow\",\n category: \"onboarding\",\n config: {\n steps: [\n { id: \"start\", type: \"modal\", title: \"Close your first deal\", body: \"<p>We'll go from pipeline to closed-won in four steps.</p>\", showOverlay: true, buttons: [{ id: \"skip\", label: \"Not now\", action: \"dismiss\", variant: \"ghost\" }, { id: \"next\", label: \"Let's go\", action: \"next\" }] },\n { id: \"pipeline\", type: \"tooltip\", title: \"Open the pipeline\", body: \"<p>Click here to see your deals by stage.</p>\", url: \"/dashboard\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='nav-deals']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"right\", advanceOn: \"element_click\", advanceValue: \"[data-tour='nav-deals']\", buttons: [] },\n { id: \"drag\", type: \"spotlight\", title: \"Move a deal\", body: \"<p>Drag a card to the next stage, or use the stage menu.</p>\", url: \"/deals\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='deal-card']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", showOverlay: true, buttons: nav() },\n { id: \"won\", type: \"tooltip\", title: \"Mark as won\", body: \"<p>When it closes, mark it won to update your forecast.</p>\", url: \"/deals\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='mark-won']\" }], waitMs: 8000, fallback: \"skip\", scrollIntoView: true }, placement: \"left\", buttons: nav({ last: true }) },\n ],\n trigger: { type: \"manual\" },\n frequency: { mode: \"every_time\", priority: 30 },\n },\n },\n {\n id: \"feature-announcement\",\n name: \"New feature announcement\",\n description: \"A centered modal with an image announcing a new capability.\",\n kind: \"announcement\",\n category: \"announcement\",\n config: {\n steps: [{ id: \"announce\", type: \"modal\", title: \"Introducing Reports 2.0\", body: \"<p>Build custom reports with drag-and-drop metrics, scheduled emails and shareable links.</p><ul><li>12 new chart types</li><li>Export to CSV and PDF</li></ul>\", imageUrl: \"https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=800&q=60\", showOverlay: true, buttons: [{ id: \"later\", label: \"Maybe later\", action: \"dismiss\", variant: \"ghost\" }, { id: \"try\", label: \"Try it now\", action: \"url\", value: \"/reports\" }], showProgress: false }],\n trigger: { type: \"page_load\", delayMs: 1500 },\n frequency: { mode: \"once\", priority: 60 },\n },\n },\n {\n id: \"contextual-tooltip\",\n name: \"Contextual tooltip\",\n description: \"A single tooltip that appears when a specific element becomes visible.\",\n kind: \"tooltip\",\n category: \"help\",\n config: {\n steps: [{ id: \"tip\", type: \"tooltip\", title: \"Pro tip\", body: \"<p>Press <strong>⌘K</strong> to jump anywhere.</p>\", target: { selectors: [{ kind: \"data-attr\", value: \"[data-tour='search']\" }], waitMs: 5000, fallback: \"skip\", scrollIntoView: true }, placement: \"bottom\", buttons: [{ id: \"ok\", label: \"Got it\", action: \"complete\" }], showProgress: false }],\n trigger: { type: \"element_visible\", value: \"[data-tour='search']\", delayMs: 500 },\n frequency: { mode: \"once\", priority: 80 },\n },\n },\n {\n id: \"product-update-banner\",\n name: \"Product update notification\",\n description: \"A dismissible top banner linking to release notes.\",\n kind: \"banner\",\n category: \"announcement\",\n config: {\n steps: [{ id: \"banner\", type: \"banner\", title: \"\", body: \"<p><strong>Scheduled maintenance</strong> on Saturday 02:00–03:00 UTC. <a href='/status'>Read more</a>.</p>\", position: \"top\", placement: \"top\", buttons: [{ id: \"dismiss\", label: \"Dismiss\", action: \"dismiss\", variant: \"ghost\" }], showProgress: false }],\n trigger: { type: \"page_load\" },\n frequency: { mode: \"once_per_session\", priority: 90 },\n },\n },\n {\n id: \"onboarding-checklist\",\n name: \"User onboarding checklist\",\n description: \"A persistent checklist with four tasks that complete automatically from events.\",\n kind: \"checklist\",\n category: \"onboarding\",\n config: {\n steps: [],\n checklist: {\n tasks: [\n { id: \"profile\", title: \"Complete your profile\", description: \"Add a photo and your role.\", completion: \"event\", completionValue: \"profile_completed\", action: \"url\", actionValue: \"/settings/profile\" },\n { id: \"contact\", title: \"Add your first contact\", description: \"Import or create a contact.\", completion: \"event\", completionValue: \"contact_created\", action: \"url\", actionValue: \"/contacts/new\" },\n { id: \"deal\", title: \"Create a deal\", description: \"Track your first opportunity.\", completion: \"event\", completionValue: \"deal_created\", action: \"url\", actionValue: \"/deals\" },\n { id: \"tour\", title: \"Take the product tour\", description: \"A 60-second walkthrough.\", completion: \"guide_completed\", completionValue: \"new-user-onboarding\", action: \"start_guide\", actionValue: \"new-user-onboarding\", required: false },\n ],\n ordered: false,\n launcherLabel: \"Getting started\",\n position: \"bottom-right\",\n completionTitle: \"You're all set! 🎉\",\n completionBody: \"You've completed onboarding. Explore the rest of the app at your own pace.\",\n autoOpen: true,\n dismissible: true,\n },\n trigger: { type: \"page_load\" },\n frequency: { mode: \"every_time\", priority: 200 },\n },\n },\n {\n id: \"nps-survey\",\n name: \"NPS survey\",\n description: \"Net Promoter Score with a conditional follow-up question.\",\n kind: \"survey\",\n category: \"feedback\",\n config: {\n steps: [],\n survey: {\n questions: [\n { id: \"nps\", type: \"nps\", title: \"How likely are you to recommend us to a colleague?\", lowLabel: \"Not likely\", highLabel: \"Very likely\" },\n { id: \"why-low\", type: \"text\", title: \"What could we do better?\", required: false, placeholder: \"Tell us more…\", showWhen: { questionId: \"nps\", op: \"lte\", value: 6 } },\n { id: \"why-high\", type: \"text\", title: \"What do you like most?\", required: false, placeholder: \"Tell us more…\", showWhen: { questionId: \"nps\", op: \"gte\", value: 9 } },\n ],\n position: \"bottom-right\",\n },\n trigger: { type: \"page_load\", delayMs: 5000 },\n frequency: { mode: \"interval\", intervalHours: 2160, priority: 150 },\n targeting: { id: \"root\", op: \"and\", rules: [{ id: \"r1\", field: \"visitor.returning\", op: \"is_true\" }] },\n },\n },\n];\n\nexport function templateConfig(id: string) {\n const t = GUIDE_TEMPLATES.find((x) => x.id === id);\n if (!t) return null;\n return { template: t, config: GuideConfigSchema.parse(t.config) };\n}\n","export * from \"./utils\";\nexport * from \"./targeting\";\nexport * from \"./guide\";\nexport * from \"./events\";\nexport * from \"./sdk-api\";\nexport * from \"./messenger\";\nexport * from \"./templates\";\nexport const SDK_API_VERSION = \"v1\";\nexport const SHARED_VERSION = \"0.2.1\";\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;AAG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AE,YAAY,OAAO,IAAI,OAAO,OAAO,EAAE,EAAE;AAAA,UACtK,EAAE,IAAI,YAAY,MAAM,QAAQ,OAAO,0BAA0B,UAAU,OAAO,aAAa,sBAAiB,UAAU,EAAE,YAAY,OAAO,IAAI,OAAO,OAAO,EAAE,EAAE;AAAA,QACvK;AAAA,QACA,UAAU;AAAA,MACZ;AAAA,MACA,SAAS,EAAE,MAAM,aAAa,SAAS,IAAK;AAAA,MAC5C,WAAW,EAAE,MAAM,YAAY,eAAe,MAAM,UAAU,IAAI;AAAA,MAClE,WAAW,EAAE,IAAI,QAAQ,IAAI,OAAO,OAAO,CAAC,EAAE,IAAI,MAAM,OAAO,qBAAqB,IAAI,UAAU,CAAC,EAAE;AAAA,IACvG;AAAA,EACF;AACF;AAEO,SAAS,eAAe,IAAY;AACzC,QAAM,IAAI,gBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AACjD,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,EAAE,UAAU,GAAG,QAAQ,kBAAkB,MAAM,EAAE,MAAM,EAAE;AAClE;;;ACxLO,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;","names":["z","z","z","z","z","z"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guidelytech/shared",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Shared schemas, types and pure utilities for Guidely",
5
5
  "license": "MIT",
6
6
  "type": "module",