@wireai/activation 0.14.2 → 0.14.3
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/CHANGELOG.md +71 -0
- package/README.md +12 -2
- package/dist/coachmarks/index.d.mts +12 -4
- package/dist/coachmarks/index.d.ts +12 -4
- package/dist/coachmarks/index.js +205 -56
- package/dist/coachmarks/index.js.map +1 -1
- package/dist/coachmarks/index.mjs +157 -7
- package/dist/coachmarks/index.mjs.map +1 -1
- package/dist/showcase/index.js +235 -46
- package/dist/showcase/index.js.map +1 -1
- package/dist/showcase/index.mjs +201 -10
- package/dist/showcase/index.mjs.map +1 -1
- package/metro/index.js +16 -5
- package/package.json +1 -1
- package/src/coachmarks/GestureHint.tsx +16 -7
- package/src/coachmarks/SpotlightOverlay.tsx +19 -13
- package/src/coachmarks/index.ts +7 -2
- package/src/coachmarks/reanimated.ts +342 -0
- package/src/showcase/FeatureShowcase.tsx +25 -9
- package/src/showcase/blazejOnboarding.ts +136 -0
- package/src/showcase/index.ts +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/coachmarks/GestureHint.tsx","../../src/coachmarks/runtime.ts","../../src/features/defaults.ts","../../src/features/cache.ts","../../src/features/fetchWireFeatures.ts","../../src/features/useWireFeatures.ts","../../src/features/WireFeaturesProvider.tsx","../../src/theme/defaultTheme.ts","../../src/theme/ThemeContext.tsx","../../src/showcase/showcaseColors.ts","../../src/showcase/FeatureShowcase.tsx","../../src/showcase/selectShowcaseSlides.ts"],"names":["useEffect","createContext","useContext","useMemo","useRef","useState","_a","jsx","View","styles","StyleSheet","jsxs","React"],"mappings":";;;;;;;AAuDA,IAAM,QAAA,GAAW,GAAA;AACjB,IAAM,MAAA,GAAS,GAAA;AACf,IAAM,SAAA,GAAY,GAAA;AAQlB,IAAM,cAAA,GAAyC;AAAA,EAC7C,QAAA,EAAU,MAAA;AAAA,EACV,UAAA,EAAY,QAAA;AAAA,EACZ,U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import { StyleSheet, View } from \"react-native\";\nimport Animated, {\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withDelay,\n withRepeat,\n withSequence,\n withTiming,\n} from \"react-native-reanimated\";\n\nimport type { GestureKind } from \"./types\";\n\n/**\n * Abstract gesture pictogram shown beside a coachmark tooltip. Pure reanimated —\n * every animation runs on the UI thread (shared values + worklets), never\n * setState, so it costs nothing on the JS thread. Honors Reduce Motion by\n * dropping the motion loop and rendering the glyph static.\n *\n * NO drawn-hand anatomy. Swipes render the standard two-finger swipe glyph: two\n * rounded vertical capsules (an abstract index + middle finger, slightly\n * different heights) with a short, fading motion track trailing behind them along\n * the swipe axis. The whole glyph is rotated per direction (up/down/left/right)\n * and the capsules slide along the axis, fading, in a UI-thread loop. Pinch/zoom\n * reuse the two-capsule abstraction spreading apart. Tap / double-tap render a\n * minimal pulsing tap-target (ring + dot).\n *\n * Every glyph is a self-drawn primitive built from Views/borders (no vector-icon\n * dependency, like AnimatedSparkle). Pass `renderHand` — the glyph slot — to\n * substitute your own node while keeping the tuned motion. (The name is kept for\n * backward compatibility; despite it, the default is a glyph, not a drawn hand.)\n *\n * NOTE: the coachmark path (SpotlightOverlay) and the showcase path\n * (FeatureShowcase) both SKIP this component for `tap` / `double_tap` — those\n * steps show only the highlight ring + tooltip, no glyph. The tap visual here\n * exists for direct / standalone use.\n */\nexport interface GestureHintProps {\n type: GestureKind;\n /** Overall glyph size in px. */\n size?: number;\n /** Glyph color. Defaults to white (reads on the dark blur backdrop). */\n color?: string;\n /**\n * Provide a custom glyph node in place of the default self-drawn primitive; it\n * inherits the tuned motion (slide+fade for swipes, pulse for tap). Kept as\n * `renderHand` for backward compatibility — despite the name it is just the\n * glyph slot, no longer a drawn hand.\n */\n renderHand?: (props: { size: number; color: string }) => ReactNode;\n}\n\n/** Travel distance for the directional swipe loop (local glyph axis). */\nconst TRAVEL = 26;\nconst SWIPE_MS = 700;\nconst TAP_MS = 320;\nconst SPREAD_MS = 620;\n\n/**\n * Per-direction rotation of the whole glyph. Canonical orientation is \"up\":\n * capsules point up, travel up, motion track trailing below. Rotating the\n * container reorients both the capsules and the track together, and rotates the\n * local translate axis so the same upward loop reads correctly per direction.\n */\nconst GLYPH_ROTATION: Record<string, string> = {\n swipe_up: \"0deg\",\n swipe_down: \"180deg\",\n swipe_left: \"-90deg\",\n swipe_right: \"90deg\",\n};\n\n/**\n * The two-finger abstraction: two rounded vertical capsules side by side with\n * slightly different heights (index taller than middle), aligned at the base —\n * the standard swipe pictogram look. Self-drawn from Views only.\n */\nconst FingerPair: React.FC<{ size: number; color: string }> = ({ size, color }) => {\n const { row, index, middle } = useMemo(() => {\n const w = size * 0.2;\n const r = w / 2;\n return {\n row: { flexDirection: \"row\" as const, alignItems: \"flex-end\" as const, gap: size * 0.08 },\n index: { width: w, height: size * 0.54, borderRadius: r, backgroundColor: color },\n middle: { width: w, height: size * 0.44, borderRadius: r, backgroundColor: color },\n };\n }, [size, color]);\n\n return (\n <View style={row} pointerEvents=\"none\">\n <View style={index} />\n <View style={middle} />\n </View>\n );\n};\n\n/**\n * A short, tapering motion track that sits behind the capsules (below, in the\n * canonical \"up\" orientation) — two slim, fading ticks that shrink and dim with\n * distance. Subtle: it reads as the path the fingers just travelled, not a comet\n * tail. Static (the capsules carry the motion via the slide loop).\n */\nconst MotionTrack: React.FC<{ size: number; color: string }> = ({ size, color }) => {\n const { wrap, tick0, tick1 } = useMemo(() => {\n const h = Math.max(2, size * 0.05);\n return {\n wrap: { alignItems: \"center\" as const, marginTop: size * 0.1, gap: size * 0.06 },\n tick0: {\n width: size * 0.3,\n height: h,\n borderRadius: h / 2,\n backgroundColor: color,\n opacity: 0.4,\n },\n tick1: {\n width: size * 0.18,\n height: h,\n borderRadius: h / 2,\n backgroundColor: color,\n opacity: 0.16,\n },\n };\n }, [size, color]);\n\n return (\n <View style={wrap} pointerEvents=\"none\">\n <View style={tick0} />\n <View style={tick1} />\n </View>\n );\n};\n\nconst GestureHintComponent: React.FC<GestureHintProps> = ({\n type,\n size = 34,\n color = \"white\",\n renderHand,\n}) => {\n const translate = useSharedValue(0);\n const opacity = useSharedValue(1);\n const pulse = useSharedValue(1);\n const spread = useSharedValue(0);\n const reduced = useReducedMotion();\n\n const isSwipe =\n type === \"swipe_up\" ||\n type === \"swipe_down\" ||\n type === \"swipe_left\" ||\n type === \"swipe_right\";\n const isSpread = type === \"pinch\" || type === \"zoom\";\n const isTap = type === \"tap\" || type === \"double_tap\";\n\n useEffect(() => {\n if (type === \"none\" || reduced) return undefined;\n\n if (isTap) {\n pulse.value = withRepeat(\n withSequence(\n withTiming(0.82, { duration: TAP_MS }),\n withTiming(1, { duration: TAP_MS }),\n ),\n -1,\n false,\n );\n opacity.value = withRepeat(\n withSequence(\n withTiming(0.55, { duration: TAP_MS }),\n withTiming(1, { duration: TAP_MS }),\n ),\n -1,\n false,\n );\n return undefined;\n }\n\n if (isSpread) {\n // Two capsules easing apart and back — a minimal pinch/zoom abstraction.\n spread.value = withRepeat(\n withSequence(\n withTiming(size * 0.26, { duration: SPREAD_MS }),\n withTiming(0, { duration: SPREAD_MS }),\n ),\n -1,\n false,\n );\n return undefined;\n }\n\n // Directional swipe: slide the capsules along the local \"up\" axis, fading\n // out, then snap back and repeat. The container rotation (below) reorients\n // this loop per direction, so the local motion is always the same.\n translate.value = withRepeat(\n withSequence(\n withTiming(0, { duration: 0 }),\n withTiming(-TRAVEL, { duration: SWIPE_MS }),\n withDelay(140, withTiming(0, { duration: 0 })),\n ),\n -1,\n false,\n );\n opacity.value = withRepeat(\n withSequence(\n withTiming(1, { duration: SWIPE_MS / 2 }),\n withTiming(0, { duration: SWIPE_MS / 2 }),\n withDelay(140, withTiming(1, { duration: 0 })),\n ),\n -1,\n false,\n );\n return undefined;\n }, [type, reduced, isTap, isSpread, translate, opacity, pulse, spread, size]);\n\n const swipeAnimatedStyle = useAnimatedStyle(() => ({\n opacity: opacity.value,\n transform: [{ translateY: translate.value }],\n }));\n const tapAnimatedStyle = useAnimatedStyle(() => ({\n opacity: opacity.value,\n transform: [{ scale: pulse.value }],\n }));\n const spreadLeftStyle = useAnimatedStyle(() => ({\n transform: [{ translateX: -spread.value }],\n }));\n const spreadRightStyle = useAnimatedStyle(() => ({\n transform: [{ translateX: spread.value }],\n }));\n\n if (type === \"none\") return null;\n\n const customGlyph = renderHand ? renderHand({ size, color }) : null;\n\n if (isSwipe) {\n return (\n <View\n style={{ transform: [{ rotate: GLYPH_ROTATION[type] ?? \"0deg\" }] }}\n pointerEvents=\"none\"\n >\n <View style={styles.swipeStack}>\n <Animated.View style={swipeAnimatedStyle} pointerEvents=\"none\">\n {customGlyph ?? <FingerPair size={size} color={color} />}\n </Animated.View>\n <MotionTrack size={size} color={color} />\n </View>\n </View>\n );\n }\n\n if (isSpread) {\n const w = size * 0.2;\n const capsule = {\n width: w,\n height: size * 0.5,\n borderRadius: w / 2,\n backgroundColor: color,\n };\n return (\n <View style={[styles.spreadRow, { gap: size * 0.12 }]} pointerEvents=\"none\">\n <Animated.View style={spreadLeftStyle}>\n <View style={capsule} />\n </Animated.View>\n <Animated.View style={spreadRightStyle}>\n <View style={capsule} />\n </Animated.View>\n </View>\n );\n }\n\n // tap / double_tap — a minimal pulsing tap-target (ring + center dot).\n const ringSize = size * 0.86;\n const ringBorder = Math.max(2, size * 0.08);\n const dotSize = size * 0.32;\n return (\n <View style={[styles.tapWrap, { width: size, height: size }]} pointerEvents=\"none\">\n {customGlyph ? (\n <Animated.View style={tapAnimatedStyle} pointerEvents=\"none\">\n {customGlyph}\n </Animated.View>\n ) : (\n <>\n <Animated.View\n style={[\n styles.tapRing,\n {\n width: ringSize,\n height: ringSize,\n borderRadius: ringSize / 2,\n borderWidth: ringBorder,\n borderColor: color,\n },\n tapAnimatedStyle,\n ]}\n pointerEvents=\"none\"\n />\n <View\n style={{\n position: \"absolute\",\n width: dotSize,\n height: dotSize,\n borderRadius: dotSize / 2,\n backgroundColor: color,\n }}\n />\n </>\n )}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n swipeStack: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n spreadRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n tapWrap: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n tapRing: {\n backgroundColor: \"transparent\",\n },\n});\n\nexport const GestureHint = React.memo(GestureHintComponent);\nGestureHint.displayName = \"GestureHint\";\n\nexport default GestureHint;\n","/**\n * Module-level runtime for the coachmark engine: the injected sync storage, the\n * global `isTestingCoachmark` flag, and the seen-gate helpers built on top.\n *\n * WHY module singletons (not just context): the tour hooks and the anchor\n * registry are driven imperatively from anywhere in the tree (a screen deep\n * under the navigator), while the storage + testing flag are configured once at\n * the root by `CoachmarkProvider`. Singletons let a hook read the gate without\n * every call site threading the storage through props. The provider is still the\n * single writer — it calls `setCoachmarkStorage` / `setCoachmarkTesting` on mount.\n *\n * ── WHY A globalThis SLOT, NOT PLAIN MODULE VARIABLES ─────────────────────────────────────────\n * These three values used to be plain module `let`s, and this module is inlined by tsup into FOUR\n * dist bundles (`./coachmarks`, `./reviews`, `./questionnaire`, `./showcase`). Under `dist`\n * resolution — node `import`/`require`, SSR, jest, RN-web, anything that is not Metro — a host that\n * mounts `CoachmarkProvider` from `@wireai/activation/coachmarks` wrote the COACHMARKS copy, while\n * `useReviewGate` from `@wireai/activation/reviews` read the REVIEWS copy, which was still `null`.\n * Everything downstream then failed silently: `readInt(null, …)` returns 0, so `bumpSessionCount`\n * returns 1 forever and the fail-closed `minSessions: 2` default is unsatisfiable (the gate NEVER\n * fires); the `seen` once-gate never persists; and a tenant's coachmarks kill switch never reaches\n * the reviews bundle. Metro masked it by collapsing every subpath back to one `src/` file through\n * the `react-native` export condition, which is a bundler accident, not a guarantee.\n *\n * Same remedy this repo already applies to `currentSession`, the auto device-key registry and the\n * activation revalidation counter: ONE record in a `globalThis` slot keyed by `Symbol.for(...)`, so\n * every inlined copy of this module addresses the SAME state.\n */\nimport type { CoachmarkStorage } from \"./types\";\n\n/**\n * Well-known key into the runtime-global symbol registry — one coachmark runtime across bundles.\n *\n * @globalSlot LATCH — the RUNTIME RECORD is created once and its identity is then stable. A second\n * write replaces the record `subscribeCoachmarksEnabled` registered its listeners on, so a\n * kill-switch flip notifies an orphaned set while a tour that believes it is running paints nothing\n * — the exact limbo `coachmarkKillSwitch` canaries. Its FIELDS (`storage`, `testing`,\n * `coachmarksEnabled`, `listeners`) are live, which is why every accessor calls `coachmarkRuntime()`\n * instead of holding the record, and why `coachmarksEnabled` is subscribable rather than sampled.\n */\nconst COACHMARK_RUNTIME_SLOT: unique symbol = Symbol.for(\"@wireai/activation:coachmarkRuntime\");\n\n/** The shared runtime: the provider-injected storage, the QA replay flag, and the kill switch. */\ntype CoachmarkRuntime = {\n storage: CoachmarkStorage | null;\n testing: boolean;\n // The coachmarks feature kill switch (from GET /v1/features). Default true = fail-open: with no\n // flags fetched, coachmarks behave exactly as before. CoachmarkProvider writes it from the\n // resolved flags. Disabled → the tour never ARMS and the overlay `show()` is a no-op, so nothing\n // paints and — critically — no once-gate is written, so re-enabling replays the tour correctly.\n coachmarksEnabled: boolean;\n // Subscribers to the kill switch. OPTIONAL on the type (never on the behaviour) so a record left\n // in the registry by an inlined copy from an OLDER kit version — which had no listener set — is\n // upgraded in place rather than read as corrupt.\n listeners?: Set<() => void>;\n};\n\ntype GlobalWithCoachmarkRuntime = typeof globalThis & {\n [COACHMARK_RUNTIME_SLOT]?: CoachmarkRuntime;\n};\n\nconst runtimeGlobal = globalThis as GlobalWithCoachmarkRuntime;\n\nconst coachmarkRuntime = (): CoachmarkRuntime => {\n const existing = runtimeGlobal[COACHMARK_RUNTIME_SLOT];\n if (existing) return existing;\n const created: CoachmarkRuntime = { storage: null, testing: false, coachmarksEnabled: true };\n runtimeGlobal[COACHMARK_RUNTIME_SLOT] = created;\n return created;\n};\n\nconst enabledListeners = (): Set<() => void> => {\n const runtime = coachmarkRuntime();\n if (!runtime.listeners) runtime.listeners = new Set();\n return runtime.listeners;\n};\n\n/**\n * Wake the subscribers on a MICROTASK, never synchronously.\n *\n * `CoachmarkProvider` writes this flag during its RENDER phase on purpose (so a child's mount\n * effect already sees the resolved value). Notifying from there synchronously would schedule a\n * React update while a *different* component is rendering. Every subscriber reads the value\n * through `areCoachmarksEnabled()` at render time anyway, so the notification only has to wake\n * the components that are not already re-rendering — one microtask later is soon enough, and it\n * keeps the write side legal from anywhere.\n */\nconst notifyCoachmarksEnabled = (): void => {\n if (enabledListeners().size === 0) return;\n void Promise.resolve().then(() => {\n for (const listener of [...enabledListeners()]) {\n try {\n listener();\n } catch {\n // A broken subscriber must never break the kill switch for the others.\n }\n }\n });\n};\n\n/**\n * Set the coachmarks master switch (from the resolved feature flags). Default true (fail-open).\n * Written by CoachmarkProvider; read imperatively by the tour arm + the overlay store, and\n * SUBSCRIBED to by `useCoachmarkTour` (see `subscribeCoachmarksEnabled`).\n *\n * No-ops when the value is unchanged, which matters because the provider writes it on every\n * render — without that guard every render would fan out a notification.\n */\nexport const setCoachmarksEnabled = (value: boolean): void => {\n const runtime = coachmarkRuntime();\n if (runtime.coachmarksEnabled === value) return;\n runtime.coachmarksEnabled = value;\n notifyCoachmarksEnabled();\n};\n\n/** Whether the coachmarks module is enabled. False → tours/overlays are silently skipped. */\nexport const areCoachmarksEnabled = (): boolean => coachmarkRuntime().coachmarksEnabled;\n\n/**\n * Subscribe to kill-switch flips. Returns the unsubscribe function — the `useSyncExternalStore`\n * contract, and deliberately the SAME shape as `coachmarkOverlay.subscribe` next door rather than\n * a second pattern to keep correct.\n *\n * WHY IT EXISTS: the flag is a mutable `globalThis` value, so on its own it can only be SAMPLED.\n * A tour that samples it cannot notice a tenant flipping it off mid-flight — the overlay's\n * `show()` quietly becomes a no-op while the tour still believes it is running, so nothing paints,\n * nothing can be tapped to advance, and no terminal path is reachable. `useCoachmarkTour`\n * subscribes instead. The listener set lives in the SAME `globalThis` record as the flag, so every\n * inlined copy of this module shares one subscriber list.\n */\nexport const subscribeCoachmarksEnabled = (listener: () => void): (() => void) => {\n const listeners = enabledListeners();\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n};\n\n/** Set (or clear) the injected sync gate storage. Called by CoachmarkProvider. */\nexport const setCoachmarkStorage = (storage: CoachmarkStorage | null): void => {\n coachmarkRuntime().storage = storage;\n};\n\n/** The currently-injected gate storage, or null if no provider is mounted. */\nexport const getCoachmarkStorage = (): CoachmarkStorage | null => coachmarkRuntime().storage;\n\n/**\n * Toggle the global QA replay flag. When true, EVERY seen-gate reads as unseen\n * and every seen-write is suppressed, so every tour + showcase replays on each\n * mount. The app flips ONE boolean to QA the whole coachmark surface.\n */\nexport const setCoachmarkTesting = (value: boolean): void => {\n coachmarkRuntime().testing = value;\n};\n\n/** Whether replay-everything QA mode is on. */\nexport const isCoachmarkTesting = (): boolean => coachmarkRuntime().testing;\n\n/** Gate key for a tour: `wire_coachmark_<tourId>_seen`. */\nexport const coachmarkGateKey = (tourId: string): string =>\n `wire_coachmark_${tourId}_seen`;\n\n/** Gate key for a feature showcase: `wire_showcase_<id>_seen`. */\nexport const showcaseGateKey = (showcaseId: string): string =>\n `wire_showcase_${showcaseId}_seen`;\n\n/** Marker value written for a seen gate. */\nconst SEEN_VALUE = \"1\";\n\n/**\n * Read a seen gate. Testing mode ALWAYS reports unseen (so everything replays).\n * A missing storage (no provider) also reports unseen — the safe default is to\n * show the hint rather than silently swallow it. `storageOverride` /\n * `testingOverride` let a self-contained component (e.g. FeatureShowcase) pass\n * its own storage without relying on the provider singleton.\n */\nexport const hasSeenGate = (\n key: string,\n storageOverride?: CoachmarkStorage | null,\n testingOverride?: boolean,\n): boolean => {\n if (testingOverride ?? isCoachmarkTesting()) return false;\n const storage = storageOverride ?? getCoachmarkStorage();\n if (!storage) return false;\n try {\n return storage.getItem(key) === SEEN_VALUE;\n } catch {\n return false;\n }\n};\n\n/**\n * Mark a gate seen. Suppressed in testing mode (so replay never persists) and a\n * no-op without storage. Best-effort — a throwing adapter never breaks the tour.\n */\nexport const markSeenGate = (\n key: string,\n storageOverride?: CoachmarkStorage | null,\n testingOverride?: boolean,\n): void => {\n if (testingOverride ?? isCoachmarkTesting()) return;\n const storage = storageOverride ?? getCoachmarkStorage();\n if (!storage) return;\n try {\n storage.setItem(key, SEEN_VALUE);\n } catch {\n // Best-effort: a failed write just means the hint may show once more.\n }\n};\n","/**\n * The fail-open defaults + a tolerant parser for the server's flags payload.\n *\n * THE CONTRACT: fail-open, never fail-dark. An absent server object, a missing module key, a\n * malformed value, or an unreachable endpoint must resolve to the MOST PERMISSIVE state — every\n * module ON, onboarding `ai` — so a control-plane outage can only ever be more permissive than\n * the dashboard intends. It can never dark a tenant's activation. Matches the server's own\n * documented fail-open default (FEATURES.md: \"local defaults — every module on, onboarding ai\").\n */\nimport type { OnboardingMode, WireFeatures } from \"./types\";\n\n/**\n * ALL ON, onboarding `ai`. Frozen + module-level so its reference is stable across every call\n * (consumers that list resolved flags in an effect dep array never loop on a fresh identity).\n */\nexport const defaultWireFeatures: WireFeatures = Object.freeze({\n coachmarks: Object.freeze({ enabled: true }),\n showcase: Object.freeze({ enabled: true }),\n onboarding: Object.freeze({ mode: \"ai\" as OnboardingMode }),\n review: Object.freeze({ enabled: true }),\n questionnaire: Object.freeze({ enabled: true }),\n announcements: Object.freeze({ enabled: true }),\n}) as WireFeatures;\n\nconst VALID_MODES: readonly OnboardingMode[] = [\"ai\", \"static\", \"off\"];\n\n/** Read a `{ enabled: boolean }` module, defaulting to ON when absent/malformed (fail-open). */\nconst readEnabled = (raw: unknown): { enabled: boolean } => {\n if (raw && typeof raw === \"object\" && typeof (raw as { enabled?: unknown }).enabled === \"boolean\") {\n return { enabled: (raw as { enabled: boolean }).enabled };\n }\n return { enabled: true };\n};\n\n/**\n * Narrow the server's (untrusted) JSON to a complete `WireFeatures`. Every field is filled with\n * its fail-open default when the server omits it or sends the wrong type, so a partial or\n * malformed payload degrades PERMISSIVELY rather than throwing. A non-object input (null, array,\n * string) → the full defaults. Never throws.\n */\nexport const parseWireFeatures = (raw: unknown): WireFeatures => {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return defaultWireFeatures;\n const src = raw as Record<string, unknown>;\n const modeRaw = (src.onboarding as { mode?: unknown } | undefined)?.mode;\n const mode: OnboardingMode =\n typeof modeRaw === \"string\" && VALID_MODES.includes(modeRaw as OnboardingMode)\n ? (modeRaw as OnboardingMode)\n : \"ai\";\n return {\n coachmarks: readEnabled(src.coachmarks),\n showcase: readEnabled(src.showcase),\n onboarding: { mode },\n review: readEnabled(src.review),\n questionnaire: readEnabled(src.questionnaire),\n announcements: readEnabled(src.announcements),\n };\n};\n\n/** Value-equality of two resolved flags — lets the hook hold a stable reference across churn. */\nexport const featuresEqual = (a: WireFeatures, b: WireFeatures): boolean =>\n a === b ||\n (a.coachmarks.enabled === b.coachmarks.enabled &&\n a.showcase.enabled === b.showcase.enabled &&\n a.onboarding.mode === b.onboarding.mode &&\n a.review.enabled === b.review.enabled &&\n a.questionnaire.enabled === b.questionnaire.enabled &&\n a.announcements.enabled === b.announcements.enabled);\n","/**\n * The last-known-flags cache — persisted through the host's optional `storage`.\n *\n * WHY: the fetch is best-effort and fail-open. When the control plane is unreachable we serve the\n * LAST value we saw rather than snapping to defaults, so a tenant that intentionally disabled a\n * module during an incident keeps it disabled across an outage instead of flapping back on. That\n * is \"stale-while-error\": a fresh cache (< TTL) is trusted, and on a fetch error even a STALE\n * cache is served (any age beats a guess). Every operation is best-effort — a broken/hung storage\n * degrades to defaults, never a throw and never a stuck gate (mirrors persistedSession).\n */\nimport { parseWireFeatures } from \"./defaults\";\nimport type { WireFeatures } from \"./types\";\nimport type { WireOnboardingStorage } from \"../session/persistedSession\";\n\n/**\n * TTL for a cached flags entry, aligned to the server's `Cache-Control: private, max-age=300`.\n * A cache younger than this is \"fresh\"; older is \"stale\" (still served on a fetch error).\n */\nexport const DEFAULT_FEATURES_TTL_MS = 300_000;\n\n/** Ceiling on the storage read so a hung adapter degrades to defaults, never a stuck resolve. */\nconst READ_TIMEOUT_MS = 1_500;\n\n/** Storage key for a tenant's cached flags, e.g. `wireai:features:acme`. */\nexport const featuresCacheKey = (appId?: string): string =>\n `wireai:features:${appId && appId.length > 0 ? appId : \"default\"}`;\n\n/** A cached flags entry: the resolved flags + the epoch-ms they were fetched. */\nexport interface CachedFeatures {\n features: WireFeatures;\n /** Age of the entry in ms at read time. */\n ageMs: number;\n}\n\nconst withTimeout = <T>(p: Promise<T>, ms: number): Promise<T | undefined> => {\n let timer: ReturnType<typeof setTimeout>;\n const timeout = new Promise<undefined>((resolve) => {\n timer = setTimeout(() => resolve(undefined), ms);\n });\n return Promise.race([p, timeout]).finally(() => clearTimeout(timer));\n};\n\n/** Whether a cache entry is still within the TTL (server max-age aligned). */\nexport const isFeaturesFresh = (ageMs: number, ttlMs: number = DEFAULT_FEATURES_TTL_MS): boolean =>\n ageMs >= 0 && ageMs < ttlMs;\n\n/**\n * Read the cached flags for `key`, or `undefined` when absent/corrupt/timed-out. Returns the\n * value AND its age so a caller can apply a TTL (fresh) or ignore it (stale-while-error). Never\n * throws; never hangs past the read timeout. The stored value is re-parsed through\n * `parseWireFeatures`, so a partially-corrupt entry still degrades fail-open.\n */\nexport const readCachedFeatures = async (\n storage: WireOnboardingStorage,\n key: string,\n): Promise<CachedFeatures | undefined> => {\n let raw: string | null | undefined;\n try {\n raw = await withTimeout(storage.getItem(key), READ_TIMEOUT_MS);\n } catch {\n return undefined;\n }\n if (!raw) return undefined;\n try {\n const parsed: unknown = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && typeof (parsed as { ts?: unknown }).ts === \"number\") {\n const ts = (parsed as { ts: number }).ts;\n return {\n features: parseWireFeatures((parsed as { features?: unknown }).features),\n ageMs: Date.now() - ts,\n };\n }\n } catch {\n // Corrupt entry → treat as absent; the caller falls back to defaults / a fresh fetch.\n }\n return undefined;\n};\n\n/** Persist `{ features, ts }` under `key` — fire-and-forget, all errors swallowed. */\nexport const writeCachedFeatures = (\n storage: WireOnboardingStorage,\n key: string,\n features: WireFeatures,\n): void => {\n try {\n void storage\n .setItem(key, JSON.stringify({ features, ts: Date.now() }))\n .catch(() => {});\n } catch {\n // Best-effort: a failed write just means the next launch has no cache to fall back to.\n }\n};\n","/**\n * fetchWireFeatures — read the per-module kill switches from `GET {serverUrl}/v1/features`.\n *\n * Contract (server: chohra-med/wireai-onboarding-server, routers/onboarding.py):\n * GET {serverUrl}/v1/features\n * Authorization: Bearer {apiKey}\n * 200 → { coachmarks:{enabled}, showcase:{enabled}, onboarding:{mode}, review:{enabled},\n * announcements:{enabled} } (Cache-Control: private, max-age=300)\n *\n * THE CONTRACT — fail-open, never fail-dark. Unreachable, timed-out, unauthorized (401),\n * server-error (5xx), or malformed JSON all resolve to the LAST CACHED value, else the\n * all-on defaults. No throw ever reaches the host: this is timeout-capped and swallows every\n * error, exactly like the session's best-effort reads. A control-plane outage can only ever be\n * MORE permissive than the dashboard intends — it can never dark a tenant's activation.\n */\nimport { readCachedFeatures, featuresCacheKey, writeCachedFeatures } from \"./cache\";\nimport { defaultWireFeatures, parseWireFeatures } from \"./defaults\";\nimport type { WireFeatures, WireFeaturesConfig } from \"./types\";\nimport type { WireOnboardingStorage } from \"../session/persistedSession\";\n\nconst DEFAULT_TIMEOUT_MS = 4_000;\n\n/** The fail-open fallback: last cached value (any age — stale-while-error), else defaults. */\nconst failOpen = async (\n storage: WireOnboardingStorage | undefined,\n key: string,\n): Promise<WireFeatures> => {\n if (!storage) return defaultWireFeatures;\n const cached = await readCachedFeatures(storage, key);\n return cached?.features ?? defaultWireFeatures;\n};\n\n/** GET with a hard timeout via AbortController (falls back to no-abort where unsupported). */\nconst fetchWithTimeout = async (\n url: string,\n apiKey: string,\n timeoutMs: number,\n): Promise<Response> => {\n const controller =\n typeof AbortController !== \"undefined\" ? new AbortController() : undefined;\n const timer = setTimeout(() => controller?.abort(), timeoutMs);\n try {\n return await fetch(url, {\n method: \"GET\",\n headers: { Accept: \"application/json\", Authorization: `Bearer ${apiKey}` },\n signal: controller?.signal,\n });\n } finally {\n clearTimeout(timer);\n }\n};\n\n/**\n * Resolve the tenant's feature flags. Attempts the network once; on ANY failure returns the\n * cached value (any age), else the all-on defaults. On success, persists the fresh value to the\n * cache (fire-and-forget) and returns it. Never throws.\n *\n * const flags = await fetchWireFeatures({ serverUrl, apiKey, appId, storage });\n * if (!flags.coachmarks.enabled) { /* skip the tour * / }\n */\nexport const fetchWireFeatures = async (\n config?: WireFeaturesConfig,\n): Promise<WireFeatures> => {\n const key = featuresCacheKey(config?.appId);\n const storage = config?.storage;\n\n // Nothing to fetch (no creds) → cache, else defaults. Lets a host mount the provider before\n // its config is ready without ever darking.\n if (!config?.serverUrl || !config?.apiKey) return failOpen(storage, key);\n\n const url = `${config.serverUrl.replace(/\\/$/, \"\")}/v1/features`;\n const timeoutMs = config.timeoutMs && config.timeoutMs > 0 ? config.timeoutMs : DEFAULT_TIMEOUT_MS;\n\n try {\n const res = await fetchWithTimeout(url, config.apiKey, timeoutMs);\n // 401 (bad/rotated key), 5xx, any non-2xx → last-known, never dark.\n if (!res || !res.ok) return failOpen(storage, key);\n const json: unknown = await res.json(); // throws on malformed body → caught below\n const features = parseWireFeatures(json);\n if (storage) writeCachedFeatures(storage, key, features);\n return features;\n } catch {\n // Timeout/abort, network error, missing fetch, or malformed JSON — all fail open.\n return failOpen(storage, key);\n }\n};\n","/**\n * useWireFeatures — resolve the tenant's feature flags for a component tree, once per mount.\n *\n * Returns the all-on defaults immediately (fail-open), then swaps to the fetched value when the\n * network resolves. When no `serverUrl`+`apiKey` is supplied it never fetches and just returns\n * defaults, so a host that never adopts flags sees ZERO behavior change and ZERO network calls.\n *\n * frequent_rules #11 (unstable inline props): the config is idiomatically passed inline\n * (`config={{ serverUrl, apiKey }}`), a fresh identity every render. We stabilize the fetch key\n * by VALUE so the effect fires once per real credential change, and we only swap the returned\n * flags object when its VALUES change — so a host that lists the returned flags in an effect dep\n * array settles in a bounded number of commits instead of looping (enforced by the canary suite).\n */\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { defaultWireFeatures, featuresEqual } from \"./defaults\";\nimport { fetchWireFeatures } from \"./fetchWireFeatures\";\nimport type { WireFeatures, WireFeaturesConfig } from \"./types\";\n\n/** Hold a stable reference for a value while its CONTENT is unchanged (see reviews/equality.ts). */\nconst useStableValue = <T,>(value: T, isEqual: (a: T, b: T) => boolean): T => {\n const ref = useRef(value);\n if (!isEqual(ref.current, value)) ref.current = value;\n return ref.current;\n};\n\n/** The credential slice that actually drives a refetch — stabilized by value. */\nconst sameFetchKey = (a: WireFeaturesConfig | undefined, b: WireFeaturesConfig | undefined): boolean =>\n a?.serverUrl === b?.serverUrl && a?.apiKey === b?.apiKey && a?.appId === b?.appId;\n\nexport const useWireFeatures = (config?: WireFeaturesConfig): WireFeatures => {\n const stableConfig = useStableValue(config, sameFetchKey);\n const [flags, setFlags] = useState<WireFeatures>(defaultWireFeatures);\n\n const canFetch = !!stableConfig?.serverUrl && !!stableConfig?.apiKey;\n\n useEffect(() => {\n if (!canFetch) {\n // No creds → stay on the all-on defaults (and reset if creds were removed).\n setFlags((prev) => (featuresEqual(prev, defaultWireFeatures) ? prev : defaultWireFeatures));\n return;\n }\n let alive = true;\n // fetchWireFeatures never throws — the .then always runs with a fail-open value.\n void fetchWireFeatures(stableConfig).then((next) => {\n if (!alive) return;\n // Only adopt a NEW reference on a real value change, so a host effect keyed on the\n // returned flags doesn't loop (frequent_rules #11).\n setFlags((prev) => (featuresEqual(prev, next) ? prev : next));\n });\n return () => {\n alive = false;\n };\n }, [canFetch, stableConfig]);\n\n return flags;\n};\n","/**\n * WireFeaturesProvider + useResolvedFeatures — the OPTIONAL one-fetch-serves-all-modules layer.\n *\n * Mount `WireFeaturesProvider` once near your app root with the tenant `config` and it fetches the\n * flags ONCE; every gated surface below it (coachmarks / showcase / reviews) reads the same\n * resolved value from context instead of each fetching its own. It is entirely optional: with no\n * provider, every surface falls back to its own lazy fetch (when given a config) or to the all-on\n * defaults, so modules work with zero setup and a host that never adopts flags is unchanged.\n *\n * NOTE on the built npm subpaths: React context is shared across the kit's subpath entries in the\n * SOURCE-consumption path (the monorepo apps) and in this test suite — one module instance, one\n * context. If you consume the built `@wireai/activation/*` subpaths as separate bundles, pass the\n * resolved flags (or a `featuresConfig`) to each surface explicitly instead of relying on context.\n */\nimport React, { createContext, useContext, useMemo } from \"react\";\n\nimport { defaultWireFeatures } from \"./defaults\";\nimport { useWireFeatures } from \"./useWireFeatures\";\nimport type { WireFeatures, WireFeaturesConfig } from \"./types\";\n\n/**\n * @globalSlot LATCH — the React context object is minted by the first copy of this module to load\n * and every later copy ADOPTS it (the `if (!…)` guard below). A second write would re-split the\n * identity the guard exists to keep whole: the provider would publish into one context while a\n * subpath bundle's `useContext` read another, and `useResolvedFeatures`' null fallback would serve\n * the all-on defaults with no crash and no warning. Because it is a latch, and only because of\n * that, the module-local `const WireFeaturesContext` below may cache it.\n */\nconst CONTEXT_SYMBOL = Symbol.for(\"wireai.features.context\");\n// `globalThis`, not `global`: the other nine `Symbol.for` slots in this kit all use it, and `global`\n// simply does not exist in a plain browser (RN-web / SSR-in-the-browser), where this line would\n// throw a ReferenceError before the provider could render anything.\nconst globalObj = globalThis as any;\n\nif (!globalObj[CONTEXT_SYMBOL]) {\n globalObj[CONTEXT_SYMBOL] = createContext<WireFeatures | null>(null);\n}\nconst WireFeaturesContext = globalObj[CONTEXT_SYMBOL];\n\nexport interface WireFeaturesProviderProps {\n /** Tenant creds (+ optional storage) to fetch the flags once for the whole tree. */\n config?: WireFeaturesConfig;\n /**\n * Pre-resolved flags to provide directly instead of fetching (e.g. you already have them, or\n * you drive them from your own remote-config). Takes precedence over `config`.\n */\n flags?: WireFeatures;\n children: React.ReactNode;\n}\n\n/**\n * Fetch (or accept) the flags once and broadcast them to descendants. The provider VALUE is\n * memoized (performance rule #6) so a fresh object each render doesn't re-render every consumer.\n */\nexport const WireFeaturesProvider: React.FC<WireFeaturesProviderProps> = ({\n config,\n flags,\n children,\n}) => {\n // Always call the hook (rules of hooks); when `flags` is supplied we pass no config so it\n // never fetches and the explicit flags win below.\n const fetched = useWireFeatures(flags ? undefined : config);\n const value = flags ?? fetched;\n const stable = useMemo(() => value, [value]);\n return <WireFeaturesContext.Provider value={stable}>{children}</WireFeaturesContext.Provider>;\n};\n\nWireFeaturesProvider.displayName = \"WireFeaturesProvider\";\n\n/** Raw context read — `null` when no `WireFeaturesProvider` is mounted above. */\nexport const useWireFeaturesContext = (): WireFeatures | null =>\n useContext(WireFeaturesContext);\n\n/** Options for `useResolvedFeatures`: an explicit override and/or a lazy-fetch config. */\nexport interface ResolveFeaturesOptions {\n /** Explicit flags — win over everything (a surface's own `features` prop). */\n flags?: WireFeatures;\n /** Lazy-fetch config, used ONLY when there is no explicit `flags` and no provider above. */\n config?: WireFeaturesConfig;\n}\n\n/**\n * The resolution every gated surface uses. Precedence:\n * 1. explicit `options.flags` (a surface's own prop) →\n * 2. the nearest `WireFeaturesProvider` (context) →\n * 3. a lazy fetch from `options.config` (serverUrl + apiKey) →\n * 4. the all-on defaults.\n * Always fail-open, always a stable reference for a given value (so it's safe in effect deps).\n */\nexport const useResolvedFeatures = (options?: ResolveFeaturesOptions): WireFeatures => {\n const ctx = useWireFeaturesContext();\n // Only lazily fetch when nothing else provides the flags — otherwise pass no config so the\n // hook stays inert (defaults, no network). The hook is always called (rules of hooks).\n const shouldFetch = !options?.flags && ctx == null;\n const fetched = useWireFeatures(shouldFetch ? options?.config : undefined);\n return options?.flags ?? ctx ?? fetched ?? defaultWireFeatures;\n};\n","/**\n * defaultOnboardingTheme — a neutral, light, brand-agnostic baseline. Consumers\n * pass a `Partial<OnboardingTheme>` that is deep-merged over this (see\n * `mergeTheme`), so they only override what differs from neutral.\n */\nimport type { OnboardingTheme } from \"./types\";\n\nexport const defaultOnboardingTheme: OnboardingTheme = {\n colors: {\n background: \"#FFFFFF\",\n surface: \"#F7F7F8\",\n text: \"#101114\",\n textMuted: \"#6B7280\",\n primary: \"#111111\",\n onPrimary: \"#FFFFFF\",\n primarySoft: \"rgba(17,17,17,0.06)\",\n border: \"#E4E4E7\",\n borderStrong: \"#C7C7CC\",\n disabled: \"#EBEBEB\",\n success: \"#16A34A\",\n warning: \"#D97706\",\n error: \"#DC2626\",\n info: \"#2563EB\",\n },\n fonts: {\n regular: undefined,\n medium: undefined,\n bold: undefined,\n baseSize: 16,\n scale: 1,\n },\n radius: {\n sm: 8,\n md: 12,\n lg: 16,\n full: 9999,\n },\n spacing: {\n xs: 4,\n sm: 8,\n md: 16,\n lg: 24,\n xl: 32,\n },\n // Circled (pill) CTA by default; an app can pass `button: { radius: 12 }` for\n // a rounded rectangle, or override height/paddingX to match its design system.\n button: {\n radius: 9999,\n height: 52,\n paddingX: 24,\n },\n};\n\n/**\n * Deep-merge a partial theme over the default. Two levels deep is enough — the\n * theme is intentionally shallow (colors/fonts/radius/spacing), so we merge each\n * known sub-object and leave scalars to overwrite.\n */\nexport const mergeTheme = (\n override?: Partial<OnboardingTheme>,\n): OnboardingTheme => {\n if (!override) return defaultOnboardingTheme;\n return {\n colors: { ...defaultOnboardingTheme.colors, ...override.colors },\n fonts: { ...defaultOnboardingTheme.fonts, ...override.fonts },\n radius: { ...defaultOnboardingTheme.radius, ...override.radius },\n spacing: { ...defaultOnboardingTheme.spacing, ...override.spacing },\n button: { ...defaultOnboardingTheme.button, ...override.button },\n };\n};\n","/**\n * ThemeContext — provides the resolved OnboardingTheme to every shell element and\n * themed card via `useOnboardingTheme()`. WHY a context rather than prop-drilling:\n * the cards are mounted by the SDK's ComponentRenderer (not by us), so we can't\n * pass them props directly — they must read the theme from context.\n *\n * ── WHY THE CONTEXT LIVES ON A `Symbol.for` SLOT ───────────────────────────────────────────────\n *\n * It was a plain `createContext(...)`, and tsup inlines this module into FIVE dist bundles\n * (`.`, `./reviews`, `./questionnaire`, `./coachmarks`, `./showcase`) — so each one carried its own\n * context instance. `OnboardingThemeProvider` is exported ONLY from the root barrel, so on any\n * `dist` resolution path (plain RN CLI, `unstable_enablePackageExports: false`, node, jest, SSR) a\n * host that wrapped its tree in `<OnboardingThemeProvider>` and rendered `<ReviewGate>` from\n * `@wireai/activation/reviews` was writing one context and reading another. Nothing crashed and\n * nothing warned: `useOnboardingTheme`'s `ctx ?? mergeTheme()` fallback quietly served the NEUTRAL\n * default theme, so the tenant's brand simply did not apply to the gate. On-device this was masked\n * only because Metro's `react-native` export condition collapses every subpath back to this one\n * `src/` file — the same \"bundler accident, not a guarantee\" the `currentSession` header names, and\n * the same root cause as the optional-peers bug 0.13.3 fixed.\n *\n * The bundler-agnostic fix, exactly as `coachmarks/runtime`, `analytics/currentSession`,\n * `context/deviceId` and `features/WireFeaturesProvider` already do it: park the ONE context on a\n * well-known `globalThis` slot keyed by `Symbol.for(...)`. `Symbol.for` uses the runtime-global\n * symbol registry, so every inlined copy of this module resolves the SAME symbol, finds the slot\n * already filled, and reuses that instance — one context identity however many copies exist.\n * `globalThis` is present and identical in Hermes/React Native, Node and SSR (we never touch\n * `window`), so this is safe on every host. `test/canary/themeContextIdentity.test.tsx` measures it\n * in the BUILT artifact, because the defect is invisible in source.\n */\nimport React, { createContext, useContext, useMemo } from \"react\";\nimport { mergeTheme } from \"./defaultTheme\";\nimport type { OnboardingTheme } from \"./types\";\n\n/**\n * Well-known key into the runtime-global symbol registry. `Symbol.for` (NOT a plain `Symbol()`) is\n * what makes this cross-bundle: it returns the SAME symbol for the same string across every copy of\n * this module, so duplicated inlined copies all address one slot.\n *\n * @globalSlot LATCH — the React context object is minted by the first copy of this module to load\n * and every later copy ADOPTS it (the `if (!…)` guard below says so in one line). A second write\n * re-splits the identity: `<OnboardingThemeProvider>` (root barrel only) publishes into one context\n * while `<ReviewGate>` from a subpath reads another, and `useOnboardingTheme`'s `ctx ?? mergeTheme()`\n * fallback quietly serves the NEUTRAL theme. Because it is a latch, and only because of that, the\n * module-local `const OnboardingThemeContext` below may cache it.\n */\nconst THEME_CONTEXT_SLOT: unique symbol = Symbol.for(\"@wireai/activation:themeContext\");\n\ntype GlobalWithThemeContext = typeof globalThis & {\n [THEME_CONTEXT_SLOT]?: React.Context<OnboardingTheme | null>;\n};\n\nconst themeGlobal = globalThis as GlobalWithThemeContext;\n\n// First copy to load creates the context; every later copy adopts it. Never overwrite an existing\n// slot — a second `createContext` here would re-split the identity this guard exists to keep whole.\nif (!themeGlobal[THEME_CONTEXT_SLOT]) {\n themeGlobal[THEME_CONTEXT_SLOT] = createContext<OnboardingTheme | null>(null);\n}\nconst OnboardingThemeContext = themeGlobal[THEME_CONTEXT_SLOT] as React.Context<OnboardingTheme | null>;\n\nexport type OnboardingThemeProviderProps = {\n /** Partial overrides merged over the neutral default theme. */\n theme?: Partial<OnboardingTheme>;\n children: React.ReactNode;\n};\n\nexport const OnboardingThemeProvider: React.FC<OnboardingThemeProviderProps> = ({\n theme,\n children,\n}) => {\n const resolved = useMemo(() => mergeTheme(theme), [theme]);\n return (\n <OnboardingThemeContext.Provider value={resolved}>\n {children}\n </OnboardingThemeContext.Provider>\n );\n};\n\n/**\n * Read the active theme. Falls back to the default theme when used outside a\n * provider so a stray card never crashes — it just renders neutral.\n */\nexport const useOnboardingTheme = (): OnboardingTheme => {\n const ctx = useContext(OnboardingThemeContext);\n return ctx ?? mergeTheme();\n};\n","import type { OnboardingColors } from \"@blazejkustra/react-native-onboarding\";\n\nimport type { OnboardingTheme } from \"../theme/types\";\n\n/**\n * Map the kit's semantic `OnboardingTheme` onto the color contract of\n * `@blazejkustra/react-native-onboarding` (what `FeatureShowcase` wraps).\n *\n * ⚠️ CRITICAL — that package's color NAMES do NOT line up with the kit's roles.\n * From its source (`utils/theme.ts` + the button/panel components):\n * • `background.primary` → the PRIMARY BUTTON background, the highlighted intro\n * title word (`OnboardingIntroPanel`), and the image\n * hero panel (`OnboardingImageContainer`). It is the\n * package's BRAND / ACTION color — NOT a screen bg.\n * • `background.secondary` → the screen / modal / step-panel background.\n * • `background.label` → the step-label chip background.\n * • `background.accent` → the SECONDARY (outline) button border ONLY.\n * • `text.contrast` → the primary button label (sits on `background.primary`).\n * • `text.primary` → body copy; `text.secondary` → hints/subtitles.\n *\n * The earlier mapping set `background.primary` to the kit's `background`, which\n * painted the primary CTA in the app's SCREEN background color — an invisible /\n * wrong-colored button (white-on-white in light, dark-on-dark in dark mode). The\n * primary button must be the brand `accent`. Keep this in sync with the package's\n * actual usage, not its key names.\n *\n * ⚠️ CONSEQUENCE of the fix above (the 0.3.2 flood): because `background.primary`\n * is ONE key driving THREE surfaces, painting it `accent` also paints the large\n * IMAGE HERO PANEL (`OnboardingImageContainer`'s `colorBg`) in the accent — a\n * full-bleed wash that dominates the first slide and \"hides\" the app's brand.\n * The package offers no per-surface color key to split them, BUT it does expose a\n * `background?: () => ReactNode` render prop that REPLACES that hero panel fill\n * outright (see `showcasePanelBackground` + `FeatureShowcase`). So the button\n * keeps `accent` here and the panel is calmed separately — one accent value, two\n * different surfaces, cleanly split.\n */\nexport const showcaseColorsFromTheme = (\n t: OnboardingTheme,\n accent: string,\n): OnboardingColors => ({\n background: {\n // Brand action color → primary button bg + intro highlight + image hero panel.\n // (The hero panel is overridden to a calm surface via the package's\n // `background` render prop — see showcasePanelBackground — so in practice\n // this only paints the primary button + the intro highlight word.)\n primary: accent,\n // Neutral screen / modal / step-panel background.\n secondary: t.colors.background,\n // Step-label chip background (a soft wash of the brand).\n label: t.colors.primarySoft,\n // Secondary (outline) button border.\n accent,\n },\n text: {\n primary: t.colors.text,\n secondary: t.colors.textMuted,\n // Primary button label — sits on `background.primary` (the accent).\n contrast: t.colors.onPrimary,\n },\n});\n\n/**\n * Opacity of the accent tint layered over the theme surface for the showcase's\n * image hero panel. Kept in a calm 8–12% band so the panel reads as a subtle\n * brand wash — a hint of the accent, never the full-bleed flood that `accent`\n * as a solid fill produced (the 0.3.1 → 0.3.2 bug seen in a host app).\n */\nexport const SHOWCASE_PANEL_TINT_OPACITY = 0.1;\n\n/** The calm hero-panel background: a neutral surface base + a faint accent tint. */\nexport interface ShowcasePanelBackground {\n /** The calm base fill — the theme SURFACE, deliberately NOT the accent. */\n base: string;\n /** A very subtle accent wash layered over the base (8–12% opacity). */\n tint: { color: string; opacity: number };\n}\n\n/**\n * Background for the showcase's image/hero panel, fed to the underlying\n * package's `background` render prop (which REPLACES its `bg.primary`-filled\n * `colorBg`). Returns a neutral surface base with a faint accent tint on top, so\n * the panel is calm and on-brand instead of an accent flood. The primary button\n * and intro highlight keep the full accent (they read `bg.primary` directly).\n */\nexport const showcasePanelBackground = (\n t: OnboardingTheme,\n accent: string,\n): ShowcasePanelBackground => ({\n base: t.colors.surface,\n tint: { color: accent, opacity: SHOWCASE_PANEL_TINT_OPACITY },\n});\n","import Onboarding, {\n type OnboardingColors,\n type OnboardingFonts,\n type OnboardingProps,\n type OnboardingStep,\n} from \"@blazejkustra/react-native-onboarding\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { type ImageSourcePropType, StyleSheet, View } from \"react-native\";\n\nimport { GestureHint } from \"../coachmarks/GestureHint\";\nimport { hasSeenGate, markSeenGate, showcaseGateKey } from \"../coachmarks/runtime\";\nimport { useResolvedFeatures } from \"../features/WireFeaturesProvider\";\nimport { useOnboardingTheme } from \"../theme/ThemeContext\";\nimport type { OnboardingTheme } from \"../theme/types\";\nimport { showcaseColorsFromTheme, showcasePanelBackground } from \"./showcaseColors\";\nimport type { FeatureShowcaseProps } from \"./types\";\n\n/** 1×1 transparent GIF — the fallback for a slide with no image (the underlying\n * package requires an image area per step). */\nconst TRANSPARENT_PX: ImageSourcePropType = {\n uri: \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\",\n};\n\nconst mergeThemeOver = (\n base: OnboardingTheme,\n override?: Partial<OnboardingTheme>,\n): OnboardingTheme => {\n if (!override) return base;\n return {\n colors: { ...base.colors, ...override.colors },\n fonts: { ...base.fonts, ...override.fonts },\n radius: { ...base.radius, ...override.radius },\n spacing: { ...base.spacing, ...override.spacing },\n button: { ...base.button, ...override.button },\n };\n};\n\n/**\n * FeatureShowcase — the pre-onboarding \"app intro\" slides.\n *\n * Wraps `@blazejkustra/react-native-onboarding`: the app supplies a declarative\n * `ShowcaseConfig` (slides + optional intro panel) and the kit maps it to the\n * package's API, bakes in the Wire onboarding theme colors, overlays the\n * perf-tuned GestureHint on any slide that asks for one, and gates the whole\n * thing once through the same sync storage as the coachmark tours\n * (`wire_showcase_<id>_seen`; the global testing flag bypasses it).\n *\n * When the gate says \"seen\", it renders nothing and calls `onDone` from an\n * effect (never during render).\n */\nconst _FeatureShowcase: React.FC<FeatureShowcaseProps> = ({\n config,\n onDone,\n theme: themeOverride,\n accentColor,\n buttonLabel = \"Next\",\n storage,\n isTesting,\n features,\n featuresConfig,\n}) => {\n const active = useOnboardingTheme();\n const t = useMemo(\n () => mergeThemeOver(active, themeOverride),\n [active, themeOverride],\n );\n const accent = accentColor ?? t.colors.primary;\n\n // Feature kill switch: disabled → treat like \"already seen\" (render nothing, call onDone so the\n // host flow continues) but WITHOUT writing the seen gate, so re-enabling replays the showcase.\n const flags = useResolvedFeatures({ flags: features, config: featuresConfig });\n const disabled = !flags.showcase.enabled;\n\n const gateKey = showcaseGateKey(config.id);\n const seen = useMemo(\n () => hasSeenGate(gateKey, storage, isTesting),\n [gateKey, storage, isTesting],\n );\n // Either already-seen OR feature-disabled short-circuits the showcase. Only the seen path is a\n // gate write (in `finish`); the disabled path never persists, so it replays when re-enabled.\n const skip = seen || disabled;\n\n const doneRef = useRef(false);\n const finish = useCallback(() => {\n if (doneRef.current) return;\n doneRef.current = true;\n markSeenGate(gateKey, storage, isTesting);\n onDone();\n }, [gateKey, storage, isTesting, onDone]);\n\n // Already seen OR disabled → skip without rendering; call onDone from an effect so the host's\n // navigation continues (never write the gate here — `finish` owns the seen write).\n useEffect(() => {\n if (skip && !doneRef.current) {\n doneRef.current = true;\n onDone();\n }\n }, [skip, onDone]);\n\n const [activeIndex, setActiveIndex] = useState(0);\n\n const steps: OnboardingStep[] = useMemo(\n () =>\n config.slides.map((slide) => ({\n title: slide.title,\n description: slide.description,\n buttonLabel: slide.buttonLabel ?? buttonLabel,\n image: slide.image ?? TRANSPARENT_PX,\n position: slide.imagePosition ?? \"top\",\n })),\n [config.slides, buttonLabel],\n );\n\n const introPanel: OnboardingProps[\"introPanel\"] = useMemo(\n () =>\n config.introPanel\n ? {\n title: config.introPanel.title,\n subtitle: config.introPanel.subtitle,\n button: config.introPanel.button,\n image: config.introPanel.image,\n }\n : { button: buttonLabel },\n [config.introPanel, buttonLabel],\n );\n\n // The package's color KEYS don't match the kit's role names — most importantly\n // its `background.primary` drives the PRIMARY BUTTON (not the screen bg), so the\n // accent must land there. See showcaseColorsFromTheme for the full contract.\n const colors: OnboardingColors = useMemo(\n () => showcaseColorsFromTheme(t, accent),\n [t, accent],\n );\n\n // Calm the large image/hero panel. The package's `background.primary` is a\n // SINGLE key that fills the primary button, the intro highlight AND this hero\n // panel — painting it `accent` (correct for the button) also flooded the first\n // slide with the app color (0.3.1). The package exposes a\n // `background` render prop that REPLACES that panel fill outright, so we keep\n // the button accent (via `colors`) and paint the panel a calm surface + faint\n // accent tint here. See showcasePanelBackground.\n const panelBg = useMemo(() => showcasePanelBackground(t, accent), [t, accent]);\n const renderPanelBackground = useCallback(\n () => (\n <View\n style={[\n styles.panelBase,\n { backgroundColor: panelBg.base, borderRadius: t.radius.md },\n ]}\n >\n <View\n style={[\n StyleSheet.absoluteFill,\n {\n backgroundColor: panelBg.tint.color,\n opacity: panelBg.tint.opacity,\n },\n ]}\n />\n </View>\n ),\n [panelBg, t.radius.md],\n );\n\n const fonts: OnboardingFonts = useMemo(\n () => ({\n introTitle: t.fonts.bold,\n introSubtitle: t.fonts.regular,\n introButton: t.fonts.bold,\n stepLabel: t.fonts.medium,\n stepTitle: t.fonts.bold,\n stepDescription: t.fonts.regular,\n stepButton: t.fonts.bold,\n primaryButton: t.fonts.bold,\n secondaryButton: t.fonts.medium,\n }),\n [t],\n );\n\n if (skip) return null;\n\n const activeGesture = config.slides[activeIndex]?.gesture;\n // Same rule as the coachmark path: tap / double-tap slides show no glyph.\n const showGesture =\n !!activeGesture &&\n activeGesture !== \"none\" &&\n activeGesture !== \"tap\" &&\n activeGesture !== \"double_tap\";\n\n return (\n <View style={styles.fill}>\n <Onboarding\n introPanel={introPanel}\n steps={steps}\n colors={colors}\n fonts={fonts}\n background={renderPanelBackground}\n onComplete={finish}\n onSkip={finish}\n onStepChange={setActiveIndex}\n />\n\n {/* Perf-tuned gesture glyph overlaid on the active slide, if it asks for\n one (tap / double-tap slides show no glyph — same rule as coachmarks). */}\n {showGesture && (\n <View style={styles.gestureLayer} pointerEvents=\"none\">\n <GestureHint type={activeGesture} color={accent} />\n </View>\n )}\n </View>\n );\n};\n\nexport const FeatureShowcase = React.memo(_FeatureShowcase);\nFeatureShowcase.displayName = \"FeatureShowcase\";\n\nconst styles = StyleSheet.create({\n fill: { flex: 1 },\n // Fills the package's animated background box; clips the accent tint to the\n // rounded corners so the calm panel reads as a card, not a bleed.\n panelBase: { flex: 1, overflow: \"hidden\" },\n gestureLayer: {\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n paddingBottom: 140,\n },\n});\n\nexport default FeatureShowcase;\n","/**\n * selectShowcaseSlides — the value-bridge selection seam for the feature showcase.\n *\n * The recommended shape (v0.2.1+) renders the showcase AS A PERSONALIZED VALUE\n * BRIDGE right AFTER the AI onboarding completes: the user just told you what they\n * want in `result.answers`, so you show only the 2-3 slides that answer it, in the\n * most-relevant-first order — \"you said you want X → here's how the app does X\"\n * (the Duolingo / Headspace terminal-moment pattern). The host declares the full\n * slide catalog once and passes an ordered id list computed from the answers:\n *\n * // Full deck, declared order (pre-onboarding placement, or thin answers):\n * const slides = selectShowcaseSlides(catalog);\n *\n * // Personalized bridge, post-onboarding: subset + order chosen from answers:\n * const slides = selectShowcaseSlides(catalog, idsFromAnswers(result.answers));\n *\n * Contract (identical to `selectTourSteps`):\n * - `selection` absent → returns the catalog unchanged (identity / declared order).\n * - `selection` present → returns only catalog entries whose `id` appears in\n * `selection`, ordered by `selection` (unknown ids are skipped; duplicates in\n * `selection` are ignored after the first match).\n *\n * v2 SERVER SEAM (document-only, not built here): the onboarding server's final\n * turn will later return an ordered `showcase: string[]` slide-key list chosen\n * server-side from the same answers. The host passes it straight in as `selection`\n * — same catalog, same contract, AI is a drop-in. Old kits that don't read the new\n * field simply ignore it, so shipping the extra field is backward-safe.\n */\nexport const selectShowcaseSlides = <T extends { id: string }>(\n catalog: T[],\n selection?: string[],\n): T[] => {\n if (!selection) return catalog;\n\n const byId = new Map(catalog.map((item) => [item.id, item]));\n const seen = new Set<string>();\n const ordered: T[] = [];\n for (const id of selection) {\n if (seen.has(id)) continue;\n seen.add(id);\n const item = byId.get(id);\n if (item) ordered.push(item);\n }\n return ordered;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/motion/useReducedMotion.ts","../../src/coachmarks/reanimated.ts","../../src/coachmarks/GestureHint.tsx","../../src/coachmarks/runtime.ts","../../src/features/defaults.ts","../../src/features/cache.ts","../../src/features/fetchWireFeatures.ts","../../src/features/useWireFeatures.ts","../../src/features/WireFeaturesProvider.tsx","../../src/theme/defaultTheme.ts","../../src/theme/ThemeContext.tsx","../../src/showcase/blazejOnboarding.ts","../../src/showcase/showcaseColors.ts","../../src/showcase/FeatureShowcase.tsx","../../src/showcase/selectShowcaseSlides.ts"],"names":["StaticAnimatedView","_a","api","useReducedMotion","View","useEffect","cached","useRef","useState","createContext","useContext","runtimeRequire","useMemo","jsx","styles","StyleSheet","jsxs","React"],"mappings":";;;;;;;;;;AAgBA,IAAI,SAAA,GAAY,KAAA;AAET,IAAM,mBAAmB,MAAe;AAC7C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,SAAS,CAAA;AAEhD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,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IACZ,QAAA,EAAU,UAAA;AAAA,IACV,GAAA,EAAK,CAAA;AAAA,IACL,IAAA,EAAM,CAAA;AAAA,IACN,KAAA,EAAO,CAAA;AAAA,IACP,MAAA,EAAQ,CAAA;AAAA,IACR,UAAA,EAAY,QAAA;AAAA,IACZ,cAAA,EAAgB,UAAA;AAAA,IAChB,aAAA,EAAe;AAAA;AAEnB,CAAC,CAAA;;;AC3NM,IAAM,oBAAA,GAAuB,CAClC,OAAA,EACA,SAAA,KACQ;AACR,EAAA,IAAI,CAAC,WAAW,OAAO,OAAA;AAEvB,EAAA,MAAM,IAAA,GAAO,IAAI,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,CAAC,IAAA,KAAS,CAAC,IAAA,CAAK,EAAA,EAAI,IAAI,CAAC,CAAC,CAAA;AAC3D,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,UAAe,EAAC;AACtB,EAAA,KAAA,MAAW,MAAM,SAAA,EAAW;AAC1B,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,EAAE,CAAA,EAAG;AAClB,IAAA,IAAA,CAAK,IAAI,EAAE,CAAA;AACX,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,GAAA,CAAI,EAAE,CAAA;AACxB,IAAA,IAAI,IAAA,EAAM,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA;AAAA,EAC7B;AACA,EAAA,OAAO,OAAA;AACT","file":"index.mjs","sourcesContent":["/**\n * useReducedMotion — the kit's ONE reduce-motion gate. Reads the OS setting via\n * AccessibilityInfo and stays subscribed to `reduceMotionChanged`, so every\n * animated component lands on its final frame (or a ~120ms fade) the moment the\n * user flips the setting — no restart needed.\n *\n * This closes the gap documented in ai_rules/rules/performance.md §3: every\n * animation in the kit must consume this hook (usually through the pure helpers\n * in motionSpec.ts: `entranceSpec` / `stateChangeDuration` / `loopEnabled`).\n */\nimport { useEffect, useState } from \"react\";\nimport { AccessibilityInfo } from \"react-native\";\n\n// Last-known value, module-level: cards remount every turn (keyed on message id),\n// and a `useState(false)` default would flash one animated frame per turn for a\n// reduce-motion user before the async read resolves.\nlet lastKnown = false;\n\nexport const useReducedMotion = (): boolean => {\n const [reduced, setReduced] = useState(lastKnown);\n\n useEffect(() => {\n let mounted = true;\n AccessibilityInfo.isReduceMotionEnabled()\n .then((value) => {\n lastKnown = value;\n if (mounted) setReduced(value);\n })\n .catch(() => {\n // Unavailable (e.g. some test envs): keep the last-known value.\n });\n const sub = AccessibilityInfo.addEventListener(\"reduceMotionChanged\", (value) => {\n lastKnown = value;\n setReduced(value);\n });\n return () => {\n mounted = false;\n sub?.remove();\n };\n }, []);\n\n return reduced;\n};\n","/**\n * reanimated — resolve `react-native-reanimated`, lazily and optionally.\n *\n * ── WHY THIS DOES NOT BREAK THE NO-NATIVE-DEPENDENCY POLICY ──────────────────────────────\n *\n * `react-native-reanimated` is an OPTIONAL peer of the coachmarks subpath. `SpotlightOverlay` and\n * `GestureHint` animate with it WHEN it is installed, and fall back to a STATIC render of the same\n * visual when it is not — same ring, same tooltip, same glyph, same copy, same gestures, just\n * without motion. So a host that never installs it can still run the guided tour and the feature\n * showcase, and an Expo Go / Lite build is not forced into a native module it cannot take.\n *\n * Before this file, both components did `import Animated, { … } from \"react-native-reanimated\"` at\n * module scope, and `coachmarks/index.ts` re-exports them with no wildcard escape — so importing\n * ANYTHING from `@wireai/activation/coachmarks` (even `setCoachmarkStorage`) dragged the peer in,\n * and a host without it hit a Metro resolution failure. `@wireai/activation/showcase` inherited the\n * same edge through `GestureHint`. This resolver removes it. Same class as the 0.14.2 `expo-blur`\n * fix (`expoBlur.ts`), same shape, one size up.\n *\n * ── THE SPECIFIER MUST BE A STRING LITERAL, INSIDE A TRY/CATCH ───────────────────────────\n *\n * This follows `icons/expoIcons.ts` and `coachmarks/expoBlur.ts` exactly, and expoIcons' header\n * carries the full autopsy. In short: Metro collects dependencies STATICALLY, matching a call whose\n * callee is literally the identifier `require` and whose argument is literally a string — an\n * aliased callee (`const req = require; req(name)`) or a variable specifier is collected NOWHERE,\n * so the module never enters the bundle (that shape shipped broken in 0.8.0). And the call sitting\n * inside a TRY/CATCH is literally how Metro marks the dependency `isOptional`, which is what lets\n * an absent peer degrade instead of failing the build. Do NOT \"simplify\" either half away.\n *\n * ── WHY THE EXPORTS ARE BARE FUNCTIONS WITH THE PEER'S OWN NAMES ─────────────────────────\n *\n * The call sites import `useAnimatedStyle` / `useAnimatedProps` / `withTiming` … from HERE instead\n * of from the peer, and call them unqualified, exactly as before. That is load-bearing, not style:\n * reanimated's Babel plugin decides what to workletize by the CALLEE NAME (`react-native-worklets`\n * `plugin/index.js` → `reanimatedFunctionHooks` / `reanimatedFunctionArgsToWorkletize`; it reads\n * `callee.name`, or `callee.property.name` for a member call, and never checks which module the\n * name came from). Keeping the names identical keeps every worklet in `SpotlightOverlay` and\n * `GestureHint` workletized byte-for-byte on a host that HAS the peer. Rename them and the\n * animations silently stop running on the UI thread.\n *\n * ── THE DEGRADE: THE FINAL FRAME, NOT A DEAD ONE ─────────────────────────────────────────\n *\n * The shim resolves every animation to its RESTING value — `withTiming(to)` is `to`,\n * `withSequence(a, b)` is `b`, `withRepeat(x)` is `x` — so a component lands on the pose it would\n * have settled into anyway (ring at scale 1, glyph at full opacity, blur at BLUR_INTENSITY) rather\n * than on frame zero, which for the blur would have meant a fully transparent overlay. Shared\n * values are state-backed so a write from an effect actually reaches the next render; reanimated's\n * own values do not need this because they drive the UI thread directly. The kit's own\n * AccessibilityInfo-backed `useReducedMotion` stands in for the peer's, so the reduce-motion\n * contract in ai_rules/rules/performance.md §3 holds with or without the peer.\n *\n * This is also what `ai_rules/rules/frequent_rules.md` #1 prescribes: when the kit needs motion\n * without the optional peer, it uses core React Native, never Reanimated.\n */\nimport {\n createElement,\n forwardRef,\n useReducer,\n useRef,\n type ComponentType,\n type ReactNode,\n} from \"react\";\nimport { View, type ViewProps, type ViewStyle } from \"react-native\";\n\nimport { useReducedMotion as useOsReducedMotion } from \"../motion/useReducedMotion\";\n\n// Metro injects a module-scoped `require`; it is ABSENT in a pure-ESM runtime (the kit's own tests\n// run under `node --test` as ESM). Declared locally so this type-checks without ambient Node types;\n// the `typeof` guard keeps the reference ESM-safe.\ndeclare const require: ((id: string) => unknown) | undefined;\n\n/** A `require`-like resolver. Injectable in tests; production uses the guarded literal require. */\nexport type OptionalRequire = (moduleName: string) => unknown;\n\n/** A reanimated shared value, narrowed to the one member the kit uses. */\nexport interface SharedValue<T> {\n value: T;\n}\n\n/** Props `Animated.View` accepts on top of a plain View (layout-animation descriptors). */\nexport interface AnimatedViewProps extends ViewProps {\n entering?: unknown;\n exiting?: unknown;\n children?: ReactNode;\n}\n\n/** A component built by `createAnimatedComponent`: its own props plus reanimated's driven props. */\nexport type AnimatedComponent<P> = ComponentType<P & { animatedProps?: object }>;\n\n/** The slice of reanimated the coachmark surfaces actually use. */\nexport interface ReanimatedApi {\n /** True when the real peer resolved; false when this is the static fallback. */\n present: boolean;\n View: ComponentType<AnimatedViewProps>;\n createAnimatedComponent: <P extends object>(component: ComponentType<P>) => AnimatedComponent<P>;\n useSharedValue: <T>(initial: T) => SharedValue<T>;\n useAnimatedStyle: (factory: () => ViewStyle) => ViewStyle;\n useAnimatedProps: <P extends object>(factory: () => P) => P;\n useReducedMotion: () => boolean;\n withTiming: (toValue: number, config?: object) => number;\n withRepeat: (animation: number, count?: number, reverse?: boolean) => number;\n withSequence: (...animations: number[]) => number;\n withDelay: (ms: number, animation: number) => number;\n /** The `entering` / `exiting` descriptors, or undefined when the peer is absent. */\n fadeIn: (durationMs: number) => unknown;\n fadeOut: (durationMs: number) => unknown;\n}\n\n/**\n * The production resolver. The specifier is a LITERAL so Metro collects it (see the header); the\n * `moduleName` parameter exists only to keep the `OptionalRequire` seam shape, so anything other\n * than the one module this file owns resolves to undefined.\n */\nconst runtimeRequire: OptionalRequire = (moduleName) => {\n if (moduleName !== \"react-native-reanimated\") return undefined;\n if (typeof require !== \"function\") return undefined;\n try {\n return require(\"react-native-reanimated\");\n } catch {\n return undefined;\n }\n};\n\n/**\n * TEST-ONLY seam. `SpotlightOverlay` / `GestureHint` have frozen public props, so neither can take\n * a `requireModule` the way `WireIcon` does — this lets a component render exercise the PRESENT\n * path. Production never sets it; `runtimeRequire` is the only resolver.\n */\nlet testRequire: OptionalRequire | undefined;\nexport const __setReanimatedRequireForTests = (fn: OptionalRequire | undefined): void => {\n testRequire = fn;\n cached = undefined;\n};\n\n// ── the static fallback ───────────────────────────────────────────────────────\n\n/**\n * A shared value that re-renders its owner on write. Reanimated's own value drives the UI thread\n * and deliberately does NOT re-render; here the render IS the only output, so a value written from\n * an effect (`intensity.value = withTiming(26)`) has to reach it or the overlay would sit on frame\n * zero forever — a fully transparent blur. The box identity is stable for the component's lifetime,\n * exactly like the real one, so it stays safe in a dependency list.\n */\nconst useStaticSharedValue = <T,>(initial: T): SharedValue<T> => {\n const [, bump] = useReducer((n: number): number => n + 1, 0);\n const box = useRef<SharedValue<T> | null>(null);\n if (box.current === null) {\n let current = initial;\n box.current = {\n get value(): T {\n return current;\n },\n set value(next: T) {\n if (Object.is(next, current)) return;\n current = next;\n bump();\n },\n };\n }\n return box.current;\n};\n\n/** Run a worklet body on the JS side. It must never throw into the render — degrade, don't crash. */\nconst runWorklet = <R extends object>(factory: () => R, fallback: R): R => {\n try {\n return factory() ?? fallback;\n } catch {\n return fallback;\n }\n};\n\n/** `Animated.View` without the peer: a plain View, with the layout-animation props dropped. */\nconst StaticAnimatedView = forwardRef<View, AnimatedViewProps>(function StaticAnimatedView(\n { entering: _entering, exiting: _exiting, children, ...rest },\n ref,\n) {\n return createElement(View, { ...rest, ref }, children);\n});\n\n/**\n * `createAnimatedComponent` without the peer. The wrapper MERGES `animatedProps` into the real\n * props, because that object is the only carrier for values the worklet would have driven (the\n * spotlight's blur `intensity`). Built once per wrapped component at the call site's `useMemo`, so\n * the returned type identity is stable and React never remounts the subtree.\n */\nconst staticCreateAnimatedComponent = <P extends object>(\n component: ComponentType<P>,\n): AnimatedComponent<P> =>\n function StaticAnimatedComponent({ animatedProps, ...rest }) {\n return createElement(component, { ...(rest as P), ...(animatedProps as object) });\n };\n\n/**\n * The peer-absent API. Every animation resolves to its RESTING value, so components render the\n * frame they would have settled on. Nothing here schedules work, allocates a native module, or\n * throws.\n */\nconst staticApi: ReanimatedApi = {\n present: false,\n View: StaticAnimatedView,\n createAnimatedComponent: staticCreateAnimatedComponent,\n useSharedValue: useStaticSharedValue,\n useAnimatedStyle: (factory) => runWorklet(factory, {}),\n useAnimatedProps: (factory) => runWorklet(factory, {} as never),\n useReducedMotion: useOsReducedMotion,\n withTiming: (toValue) => toValue,\n withRepeat: (animation) => animation,\n withSequence: (...animations) => animations[animations.length - 1] ?? 0,\n withDelay: (_ms, animation) => animation,\n fadeIn: () => undefined,\n fadeOut: () => undefined,\n};\n\n// ── the real peer ─────────────────────────────────────────────────────────────\n\nconst isFunction = (value: unknown): boolean => typeof value === \"function\";\n\n/** A React component is a function, or an object carrying `$$typeof` (memo / forwardRef). */\nconst isComponent = (value: unknown): boolean =>\n typeof value === \"function\" || (!!value && typeof value === \"object\" && \"$$typeof\" in value);\n\n/**\n * Build the API from a resolved module namespace, or undefined when it is not the module we expect.\n *\n * The hooks are NAMED exports; `View` and `createAnimatedComponent` live on the DEFAULT export (the\n * `Animated` object). A CJS interop wrapper puts everything one level down under `default`, so both\n * are looked up on the namespace first and the default second. EVERY member is verified before the\n * namespace is accepted: a partial module must degrade to the static fallback, never crash halfway\n * through a render.\n */\nconst fromModule = (mod: unknown): ReanimatedApi | undefined => {\n if (!mod || typeof mod !== \"object\") return undefined;\n const ns = mod as Record<string, unknown>;\n const def =\n ns.default && typeof ns.default === \"object\"\n ? (ns.default as Record<string, unknown>)\n : undefined;\n const pick = (name: string): unknown => ns[name] ?? def?.[name];\n\n const view = def?.View ?? ns.View;\n const createAnimated = def?.createAnimatedComponent ?? ns.createAnimatedComponent;\n const hooks = {\n useSharedValue: pick(\"useSharedValue\"),\n useAnimatedStyle: pick(\"useAnimatedStyle\"),\n useAnimatedProps: pick(\"useAnimatedProps\"),\n useReducedMotion: pick(\"useReducedMotion\"),\n withTiming: pick(\"withTiming\"),\n withRepeat: pick(\"withRepeat\"),\n withSequence: pick(\"withSequence\"),\n withDelay: pick(\"withDelay\"),\n };\n const fadeIn = pick(\"FadeIn\");\n const fadeOut = pick(\"FadeOut\");\n\n if (!isComponent(view) || !isFunction(createAnimated)) return undefined;\n if (Object.values(hooks).some((member) => !isFunction(member))) return undefined;\n if (!fadeIn || !fadeOut) return undefined;\n\n // The single narrowing seam. Everything above proved the members exist and are callable; the peer\n // is untyped here (it is resolved through `unknown`), so the cast happens once, at the boundary,\n // and the exported signatures above are the contract from here on.\n const api = {\n present: true,\n View: view,\n createAnimatedComponent: createAnimated,\n ...hooks,\n fadeIn: (durationMs: number) => (fadeIn as { duration: (ms: number) => unknown }).duration(durationMs),\n fadeOut: (durationMs: number) => (fadeOut as { duration: (ms: number) => unknown }).duration(durationMs),\n } as unknown as ReanimatedApi;\n return api;\n};\n\n/**\n * Module-level memo. Holds the RESOLVED api (real or static), so an absent peer costs exactly one\n * failed require per process, not one per mount — and, more importantly, so the implementation can\n * never change between two renders of the same component, which would break the rules of hooks.\n */\nlet cached: ReanimatedApi | undefined;\n\n/** Reset the memo. TEST-ONLY seam — production never calls it. */\nexport const resetReanimatedModuleCache = (): void => {\n cached = undefined;\n};\n\n/**\n * Resolve the reanimated API, or the static fallback when the peer is absent/unresolvable.\n * Never throws and never returns undefined: an absent animation library must degrade to a still\n * frame, never break the tour.\n */\nexport const resolveReanimated = (\n requireModule: OptionalRequire = testRequire ?? runtimeRequire,\n): ReanimatedApi => {\n try {\n if (cached === undefined || requireModule !== runtimeRequire) {\n const resolved = fromModule(requireModule(\"react-native-reanimated\")) ?? staticApi;\n // Don't poison the module memo from an injected test require.\n if (requireModule === runtimeRequire) cached = resolved;\n return resolved;\n }\n return cached;\n } catch {\n return staticApi;\n }\n};\n\n// ── the call-site surface: the peer's own names, resolved lazily ──────────────\n//\n// Each one delegates on every call, so nothing is resolved at import time. `api()` is memoized, so\n// the delegation is a property read.\n\nconst api = (): ReanimatedApi => resolveReanimated();\n\n/**\n * The `Animated` namespace, with `View` behind a getter so merely importing this module never\n * touches the peer. The component identity it returns is stable (the peer's own `Animated.View`, or\n * the module-level `StaticAnimatedView`), so React never remounts the tree under it.\n */\nexport const Animated: {\n readonly View: ComponentType<AnimatedViewProps>;\n createAnimatedComponent: <P extends object>(component: ComponentType<P>) => AnimatedComponent<P>;\n} = {\n get View() {\n return api().View;\n },\n createAnimatedComponent: (component) => api().createAnimatedComponent(component),\n};\n\n/** Layout-animation descriptors. `.duration()` is the only builder the kit uses. */\nexport const FadeIn = { duration: (durationMs: number): unknown => api().fadeIn(durationMs) };\nexport const FadeOut = { duration: (durationMs: number): unknown => api().fadeOut(durationMs) };\n\nexport const useSharedValue = <T,>(initial: T): SharedValue<T> => api().useSharedValue(initial);\nexport const useAnimatedStyle = (factory: () => ViewStyle): ViewStyle =>\n api().useAnimatedStyle(factory);\nexport const useAnimatedProps = <P extends object>(factory: () => P): P =>\n api().useAnimatedProps(factory);\nexport const useReducedMotion = (): boolean => api().useReducedMotion();\nexport const withTiming = (toValue: number, config?: object): number =>\n api().withTiming(toValue, config);\nexport const withRepeat = (animation: number, count?: number, reverse?: boolean): number =>\n api().withRepeat(animation, count, reverse);\nexport const withSequence = (...animations: number[]): number => api().withSequence(...animations);\nexport const withDelay = (ms: number, animation: number): number => api().withDelay(ms, animation);\n","import React, { useEffect, useMemo, type ReactNode } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport {\n Animated,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withDelay,\n withRepeat,\n withSequence,\n withTiming,\n} from \"./reanimated\";\nimport type { GestureKind } from \"./types\";\n\n/**\n * Abstract gesture pictogram shown beside a coachmark tooltip. With the OPTIONAL\n * `react-native-reanimated` peer installed every animation runs on the UI thread\n * (shared values + worklets), never setState, so it costs nothing on the JS\n * thread. Honors Reduce Motion by dropping the motion loop and rendering the\n * glyph static.\n *\n * The peer is reached through the guarded lazy require in `reanimated.ts`, never\n * a static import, so `@wireai/activation/coachmarks` (and `/showcase`, which\n * reaches this component through FeatureShowcase) builds on a host that never\n * installed it. Absent, the glyph renders STATICALLY at its resting frame — the\n * same capsules, ring, dot and motion track, at full opacity and no travel, with\n * one render instead of a UI-thread loop. The pictogram never disappears.\n *\n * NO drawn-hand anatomy. Swipes render the standard two-finger swipe glyph: two\n * rounded vertical capsules (an abstract index + middle finger, slightly\n * different heights) with a short, fading motion track trailing behind them along\n * the swipe axis. The whole glyph is rotated per direction (up/down/left/right)\n * and the capsules slide along the axis, fading, in a UI-thread loop. Pinch/zoom\n * reuse the two-capsule abstraction spreading apart. Tap / double-tap render a\n * minimal pulsing tap-target (ring + dot).\n *\n * Every glyph is a self-drawn primitive built from Views/borders (no vector-icon\n * dependency, like AnimatedSparkle). Pass `renderHand` — the glyph slot — to\n * substitute your own node while keeping the tuned motion. (The name is kept for\n * backward compatibility; despite it, the default is a glyph, not a drawn hand.)\n *\n * NOTE: the coachmark path (SpotlightOverlay) and the showcase path\n * (FeatureShowcase) both SKIP this component for `tap` / `double_tap` — those\n * steps show only the highlight ring + tooltip, no glyph. The tap visual here\n * exists for direct / standalone use.\n */\nexport interface GestureHintProps {\n type: GestureKind;\n /** Overall glyph size in px. */\n size?: number;\n /** Glyph color. Defaults to white (reads on the dark blur backdrop). */\n color?: string;\n /**\n * Provide a custom glyph node in place of the default self-drawn primitive; it\n * inherits the tuned motion (slide+fade for swipes, pulse for tap). Kept as\n * `renderHand` for backward compatibility — despite the name it is just the\n * glyph slot, no longer a drawn hand.\n */\n renderHand?: (props: { size: number; color: string }) => ReactNode;\n}\n\n/** Travel distance for the directional swipe loop (local glyph axis). */\nconst TRAVEL = 26;\nconst SWIPE_MS = 700;\nconst TAP_MS = 320;\nconst SPREAD_MS = 620;\n\n/**\n * Per-direction rotation of the whole glyph. Canonical orientation is \"up\":\n * capsules point up, travel up, motion track trailing below. Rotating the\n * container reorients both the capsules and the track together, and rotates the\n * local translate axis so the same upward loop reads correctly per direction.\n */\nconst GLYPH_ROTATION: Record<string, string> = {\n swipe_up: \"0deg\",\n swipe_down: \"180deg\",\n swipe_left: \"-90deg\",\n swipe_right: \"90deg\",\n};\n\n/**\n * The two-finger abstraction: two rounded vertical capsules side by side with\n * slightly different heights (index taller than middle), aligned at the base —\n * the standard swipe pictogram look. Self-drawn from Views only.\n */\nconst FingerPair: React.FC<{ size: number; color: string }> = ({ size, color }) => {\n const { row, index, middle } = useMemo(() => {\n const w = size * 0.2;\n const r = w / 2;\n return {\n row: { flexDirection: \"row\" as const, alignItems: \"flex-end\" as const, gap: size * 0.08 },\n index: { width: w, height: size * 0.54, borderRadius: r, backgroundColor: color },\n middle: { width: w, height: size * 0.44, borderRadius: r, backgroundColor: color },\n };\n }, [size, color]);\n\n return (\n <View style={row} pointerEvents=\"none\">\n <View style={index} />\n <View style={middle} />\n </View>\n );\n};\n\n/**\n * A short, tapering motion track that sits behind the capsules (below, in the\n * canonical \"up\" orientation) — two slim, fading ticks that shrink and dim with\n * distance. Subtle: it reads as the path the fingers just travelled, not a comet\n * tail. Static (the capsules carry the motion via the slide loop).\n */\nconst MotionTrack: React.FC<{ size: number; color: string }> = ({ size, color }) => {\n const { wrap, tick0, tick1 } = useMemo(() => {\n const h = Math.max(2, size * 0.05);\n return {\n wrap: { alignItems: \"center\" as const, marginTop: size * 0.1, gap: size * 0.06 },\n tick0: {\n width: size * 0.3,\n height: h,\n borderRadius: h / 2,\n backgroundColor: color,\n opacity: 0.4,\n },\n tick1: {\n width: size * 0.18,\n height: h,\n borderRadius: h / 2,\n backgroundColor: color,\n opacity: 0.16,\n },\n };\n }, [size, color]);\n\n return (\n <View style={wrap} pointerEvents=\"none\">\n <View style={tick0} />\n <View style={tick1} />\n </View>\n );\n};\n\nconst GestureHintComponent: React.FC<GestureHintProps> = ({\n type,\n size = 34,\n color = \"white\",\n renderHand,\n}) => {\n const translate = useSharedValue(0);\n const opacity = useSharedValue(1);\n const pulse = useSharedValue(1);\n const spread = useSharedValue(0);\n const reduced = useReducedMotion();\n\n const isSwipe =\n type === \"swipe_up\" ||\n type === \"swipe_down\" ||\n type === \"swipe_left\" ||\n type === \"swipe_right\";\n const isSpread = type === \"pinch\" || type === \"zoom\";\n const isTap = type === \"tap\" || type === \"double_tap\";\n\n useEffect(() => {\n if (type === \"none\" || reduced) return undefined;\n\n if (isTap) {\n pulse.value = withRepeat(\n withSequence(\n withTiming(0.82, { duration: TAP_MS }),\n withTiming(1, { duration: TAP_MS }),\n ),\n -1,\n false,\n );\n opacity.value = withRepeat(\n withSequence(\n withTiming(0.55, { duration: TAP_MS }),\n withTiming(1, { duration: TAP_MS }),\n ),\n -1,\n false,\n );\n return undefined;\n }\n\n if (isSpread) {\n // Two capsules easing apart and back — a minimal pinch/zoom abstraction.\n spread.value = withRepeat(\n withSequence(\n withTiming(size * 0.26, { duration: SPREAD_MS }),\n withTiming(0, { duration: SPREAD_MS }),\n ),\n -1,\n false,\n );\n return undefined;\n }\n\n // Directional swipe: slide the capsules along the local \"up\" axis, fading\n // out, then snap back and repeat. The container rotation (below) reorients\n // this loop per direction, so the local motion is always the same.\n translate.value = withRepeat(\n withSequence(\n withTiming(0, { duration: 0 }),\n withTiming(-TRAVEL, { duration: SWIPE_MS }),\n withDelay(140, withTiming(0, { duration: 0 })),\n ),\n -1,\n false,\n );\n opacity.value = withRepeat(\n withSequence(\n withTiming(1, { duration: SWIPE_MS / 2 }),\n withTiming(0, { duration: SWIPE_MS / 2 }),\n withDelay(140, withTiming(1, { duration: 0 })),\n ),\n -1,\n false,\n );\n return undefined;\n }, [type, reduced, isTap, isSpread, translate, opacity, pulse, spread, size]);\n\n const swipeAnimatedStyle = useAnimatedStyle(() => ({\n opacity: opacity.value,\n transform: [{ translateY: translate.value }],\n }));\n const tapAnimatedStyle = useAnimatedStyle(() => ({\n opacity: opacity.value,\n transform: [{ scale: pulse.value }],\n }));\n const spreadLeftStyle = useAnimatedStyle(() => ({\n transform: [{ translateX: -spread.value }],\n }));\n const spreadRightStyle = useAnimatedStyle(() => ({\n transform: [{ translateX: spread.value }],\n }));\n\n if (type === \"none\") return null;\n\n const customGlyph = renderHand ? renderHand({ size, color }) : null;\n\n if (isSwipe) {\n return (\n <View\n style={{ transform: [{ rotate: GLYPH_ROTATION[type] ?? \"0deg\" }] }}\n pointerEvents=\"none\"\n >\n <View style={styles.swipeStack}>\n <Animated.View style={swipeAnimatedStyle} pointerEvents=\"none\">\n {customGlyph ?? <FingerPair size={size} color={color} />}\n </Animated.View>\n <MotionTrack size={size} color={color} />\n </View>\n </View>\n );\n }\n\n if (isSpread) {\n const w = size * 0.2;\n const capsule = {\n width: w,\n height: size * 0.5,\n borderRadius: w / 2,\n backgroundColor: color,\n };\n return (\n <View style={[styles.spreadRow, { gap: size * 0.12 }]} pointerEvents=\"none\">\n <Animated.View style={spreadLeftStyle}>\n <View style={capsule} />\n </Animated.View>\n <Animated.View style={spreadRightStyle}>\n <View style={capsule} />\n </Animated.View>\n </View>\n );\n }\n\n // tap / double_tap — a minimal pulsing tap-target (ring + center dot).\n const ringSize = size * 0.86;\n const ringBorder = Math.max(2, size * 0.08);\n const dotSize = size * 0.32;\n return (\n <View style={[styles.tapWrap, { width: size, height: size }]} pointerEvents=\"none\">\n {customGlyph ? (\n <Animated.View style={tapAnimatedStyle} pointerEvents=\"none\">\n {customGlyph}\n </Animated.View>\n ) : (\n <>\n <Animated.View\n style={[\n styles.tapRing,\n {\n width: ringSize,\n height: ringSize,\n borderRadius: ringSize / 2,\n borderWidth: ringBorder,\n borderColor: color,\n },\n tapAnimatedStyle,\n ]}\n pointerEvents=\"none\"\n />\n <View\n style={{\n position: \"absolute\",\n width: dotSize,\n height: dotSize,\n borderRadius: dotSize / 2,\n backgroundColor: color,\n }}\n />\n </>\n )}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n swipeStack: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n spreadRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n tapWrap: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n tapRing: {\n backgroundColor: \"transparent\",\n },\n});\n\nexport const GestureHint = React.memo(GestureHintComponent);\nGestureHint.displayName = \"GestureHint\";\n\nexport default GestureHint;\n","/**\n * Module-level runtime for the coachmark engine: the injected sync storage, the\n * global `isTestingCoachmark` flag, and the seen-gate helpers built on top.\n *\n * WHY module singletons (not just context): the tour hooks and the anchor\n * registry are driven imperatively from anywhere in the tree (a screen deep\n * under the navigator), while the storage + testing flag are configured once at\n * the root by `CoachmarkProvider`. Singletons let a hook read the gate without\n * every call site threading the storage through props. The provider is still the\n * single writer — it calls `setCoachmarkStorage` / `setCoachmarkTesting` on mount.\n *\n * ── WHY A globalThis SLOT, NOT PLAIN MODULE VARIABLES ─────────────────────────────────────────\n * These three values used to be plain module `let`s, and this module is inlined by tsup into FOUR\n * dist bundles (`./coachmarks`, `./reviews`, `./questionnaire`, `./showcase`). Under `dist`\n * resolution — node `import`/`require`, SSR, jest, RN-web, anything that is not Metro — a host that\n * mounts `CoachmarkProvider` from `@wireai/activation/coachmarks` wrote the COACHMARKS copy, while\n * `useReviewGate` from `@wireai/activation/reviews` read the REVIEWS copy, which was still `null`.\n * Everything downstream then failed silently: `readInt(null, …)` returns 0, so `bumpSessionCount`\n * returns 1 forever and the fail-closed `minSessions: 2` default is unsatisfiable (the gate NEVER\n * fires); the `seen` once-gate never persists; and a tenant's coachmarks kill switch never reaches\n * the reviews bundle. Metro masked it by collapsing every subpath back to one `src/` file through\n * the `react-native` export condition, which is a bundler accident, not a guarantee.\n *\n * Same remedy this repo already applies to `currentSession`, the auto device-key registry and the\n * activation revalidation counter: ONE record in a `globalThis` slot keyed by `Symbol.for(...)`, so\n * every inlined copy of this module addresses the SAME state.\n */\nimport type { CoachmarkStorage } from \"./types\";\n\n/**\n * Well-known key into the runtime-global symbol registry — one coachmark runtime across bundles.\n *\n * @globalSlot LATCH — the RUNTIME RECORD is created once and its identity is then stable. A second\n * write replaces the record `subscribeCoachmarksEnabled` registered its listeners on, so a\n * kill-switch flip notifies an orphaned set while a tour that believes it is running paints nothing\n * — the exact limbo `coachmarkKillSwitch` canaries. Its FIELDS (`storage`, `testing`,\n * `coachmarksEnabled`, `listeners`) are live, which is why every accessor calls `coachmarkRuntime()`\n * instead of holding the record, and why `coachmarksEnabled` is subscribable rather than sampled.\n */\nconst COACHMARK_RUNTIME_SLOT: unique symbol = Symbol.for(\"@wireai/activation:coachmarkRuntime\");\n\n/** The shared runtime: the provider-injected storage, the QA replay flag, and the kill switch. */\ntype CoachmarkRuntime = {\n storage: CoachmarkStorage | null;\n testing: boolean;\n // The coachmarks feature kill switch (from GET /v1/features). Default true = fail-open: with no\n // flags fetched, coachmarks behave exactly as before. CoachmarkProvider writes it from the\n // resolved flags. Disabled → the tour never ARMS and the overlay `show()` is a no-op, so nothing\n // paints and — critically — no once-gate is written, so re-enabling replays the tour correctly.\n coachmarksEnabled: boolean;\n // Subscribers to the kill switch. OPTIONAL on the type (never on the behaviour) so a record left\n // in the registry by an inlined copy from an OLDER kit version — which had no listener set — is\n // upgraded in place rather than read as corrupt.\n listeners?: Set<() => void>;\n};\n\ntype GlobalWithCoachmarkRuntime = typeof globalThis & {\n [COACHMARK_RUNTIME_SLOT]?: CoachmarkRuntime;\n};\n\nconst runtimeGlobal = globalThis as GlobalWithCoachmarkRuntime;\n\nconst coachmarkRuntime = (): CoachmarkRuntime => {\n const existing = runtimeGlobal[COACHMARK_RUNTIME_SLOT];\n if (existing) return existing;\n const created: CoachmarkRuntime = { storage: null, testing: false, coachmarksEnabled: true };\n runtimeGlobal[COACHMARK_RUNTIME_SLOT] = created;\n return created;\n};\n\nconst enabledListeners = (): Set<() => void> => {\n const runtime = coachmarkRuntime();\n if (!runtime.listeners) runtime.listeners = new Set();\n return runtime.listeners;\n};\n\n/**\n * Wake the subscribers on a MICROTASK, never synchronously.\n *\n * `CoachmarkProvider` writes this flag during its RENDER phase on purpose (so a child's mount\n * effect already sees the resolved value). Notifying from there synchronously would schedule a\n * React update while a *different* component is rendering. Every subscriber reads the value\n * through `areCoachmarksEnabled()` at render time anyway, so the notification only has to wake\n * the components that are not already re-rendering — one microtask later is soon enough, and it\n * keeps the write side legal from anywhere.\n */\nconst notifyCoachmarksEnabled = (): void => {\n if (enabledListeners().size === 0) return;\n void Promise.resolve().then(() => {\n for (const listener of [...enabledListeners()]) {\n try {\n listener();\n } catch {\n // A broken subscriber must never break the kill switch for the others.\n }\n }\n });\n};\n\n/**\n * Set the coachmarks master switch (from the resolved feature flags). Default true (fail-open).\n * Written by CoachmarkProvider; read imperatively by the tour arm + the overlay store, and\n * SUBSCRIBED to by `useCoachmarkTour` (see `subscribeCoachmarksEnabled`).\n *\n * No-ops when the value is unchanged, which matters because the provider writes it on every\n * render — without that guard every render would fan out a notification.\n */\nexport const setCoachmarksEnabled = (value: boolean): void => {\n const runtime = coachmarkRuntime();\n if (runtime.coachmarksEnabled === value) return;\n runtime.coachmarksEnabled = value;\n notifyCoachmarksEnabled();\n};\n\n/** Whether the coachmarks module is enabled. False → tours/overlays are silently skipped. */\nexport const areCoachmarksEnabled = (): boolean => coachmarkRuntime().coachmarksEnabled;\n\n/**\n * Subscribe to kill-switch flips. Returns the unsubscribe function — the `useSyncExternalStore`\n * contract, and deliberately the SAME shape as `coachmarkOverlay.subscribe` next door rather than\n * a second pattern to keep correct.\n *\n * WHY IT EXISTS: the flag is a mutable `globalThis` value, so on its own it can only be SAMPLED.\n * A tour that samples it cannot notice a tenant flipping it off mid-flight — the overlay's\n * `show()` quietly becomes a no-op while the tour still believes it is running, so nothing paints,\n * nothing can be tapped to advance, and no terminal path is reachable. `useCoachmarkTour`\n * subscribes instead. The listener set lives in the SAME `globalThis` record as the flag, so every\n * inlined copy of this module shares one subscriber list.\n */\nexport const subscribeCoachmarksEnabled = (listener: () => void): (() => void) => {\n const listeners = enabledListeners();\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n};\n\n/** Set (or clear) the injected sync gate storage. Called by CoachmarkProvider. */\nexport const setCoachmarkStorage = (storage: CoachmarkStorage | null): void => {\n coachmarkRuntime().storage = storage;\n};\n\n/** The currently-injected gate storage, or null if no provider is mounted. */\nexport const getCoachmarkStorage = (): CoachmarkStorage | null => coachmarkRuntime().storage;\n\n/**\n * Toggle the global QA replay flag. When true, EVERY seen-gate reads as unseen\n * and every seen-write is suppressed, so every tour + showcase replays on each\n * mount. The app flips ONE boolean to QA the whole coachmark surface.\n */\nexport const setCoachmarkTesting = (value: boolean): void => {\n coachmarkRuntime().testing = value;\n};\n\n/** Whether replay-everything QA mode is on. */\nexport const isCoachmarkTesting = (): boolean => coachmarkRuntime().testing;\n\n/** Gate key for a tour: `wire_coachmark_<tourId>_seen`. */\nexport const coachmarkGateKey = (tourId: string): string =>\n `wire_coachmark_${tourId}_seen`;\n\n/** Gate key for a feature showcase: `wire_showcase_<id>_seen`. */\nexport const showcaseGateKey = (showcaseId: string): string =>\n `wire_showcase_${showcaseId}_seen`;\n\n/** Marker value written for a seen gate. */\nconst SEEN_VALUE = \"1\";\n\n/**\n * Read a seen gate. Testing mode ALWAYS reports unseen (so everything replays).\n * A missing storage (no provider) also reports unseen — the safe default is to\n * show the hint rather than silently swallow it. `storageOverride` /\n * `testingOverride` let a self-contained component (e.g. FeatureShowcase) pass\n * its own storage without relying on the provider singleton.\n */\nexport const hasSeenGate = (\n key: string,\n storageOverride?: CoachmarkStorage | null,\n testingOverride?: boolean,\n): boolean => {\n if (testingOverride ?? isCoachmarkTesting()) return false;\n const storage = storageOverride ?? getCoachmarkStorage();\n if (!storage) return false;\n try {\n return storage.getItem(key) === SEEN_VALUE;\n } catch {\n return false;\n }\n};\n\n/**\n * Mark a gate seen. Suppressed in testing mode (so replay never persists) and a\n * no-op without storage. Best-effort — a throwing adapter never breaks the tour.\n */\nexport const markSeenGate = (\n key: string,\n storageOverride?: CoachmarkStorage | null,\n testingOverride?: boolean,\n): void => {\n if (testingOverride ?? isCoachmarkTesting()) return;\n const storage = storageOverride ?? getCoachmarkStorage();\n if (!storage) return;\n try {\n storage.setItem(key, SEEN_VALUE);\n } catch {\n // Best-effort: a failed write just means the hint may show once more.\n }\n};\n","/**\n * The fail-open defaults + a tolerant parser for the server's flags payload.\n *\n * THE CONTRACT: fail-open, never fail-dark. An absent server object, a missing module key, a\n * malformed value, or an unreachable endpoint must resolve to the MOST PERMISSIVE state — every\n * module ON, onboarding `ai` — so a control-plane outage can only ever be more permissive than\n * the dashboard intends. It can never dark a tenant's activation. Matches the server's own\n * documented fail-open default (FEATURES.md: \"local defaults — every module on, onboarding ai\").\n */\nimport type { OnboardingMode, WireFeatures } from \"./types\";\n\n/**\n * ALL ON, onboarding `ai`. Frozen + module-level so its reference is stable across every call\n * (consumers that list resolved flags in an effect dep array never loop on a fresh identity).\n */\nexport const defaultWireFeatures: WireFeatures = Object.freeze({\n coachmarks: Object.freeze({ enabled: true }),\n showcase: Object.freeze({ enabled: true }),\n onboarding: Object.freeze({ mode: \"ai\" as OnboardingMode }),\n review: Object.freeze({ enabled: true }),\n questionnaire: Object.freeze({ enabled: true }),\n announcements: Object.freeze({ enabled: true }),\n}) as WireFeatures;\n\nconst VALID_MODES: readonly OnboardingMode[] = [\"ai\", \"static\", \"off\"];\n\n/** Read a `{ enabled: boolean }` module, defaulting to ON when absent/malformed (fail-open). */\nconst readEnabled = (raw: unknown): { enabled: boolean } => {\n if (raw && typeof raw === \"object\" && typeof (raw as { enabled?: unknown }).enabled === \"boolean\") {\n return { enabled: (raw as { enabled: boolean }).enabled };\n }\n return { enabled: true };\n};\n\n/**\n * Narrow the server's (untrusted) JSON to a complete `WireFeatures`. Every field is filled with\n * its fail-open default when the server omits it or sends the wrong type, so a partial or\n * malformed payload degrades PERMISSIVELY rather than throwing. A non-object input (null, array,\n * string) → the full defaults. Never throws.\n */\nexport const parseWireFeatures = (raw: unknown): WireFeatures => {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return defaultWireFeatures;\n const src = raw as Record<string, unknown>;\n const modeRaw = (src.onboarding as { mode?: unknown } | undefined)?.mode;\n const mode: OnboardingMode =\n typeof modeRaw === \"string\" && VALID_MODES.includes(modeRaw as OnboardingMode)\n ? (modeRaw as OnboardingMode)\n : \"ai\";\n return {\n coachmarks: readEnabled(src.coachmarks),\n showcase: readEnabled(src.showcase),\n onboarding: { mode },\n review: readEnabled(src.review),\n questionnaire: readEnabled(src.questionnaire),\n announcements: readEnabled(src.announcements),\n };\n};\n\n/** Value-equality of two resolved flags — lets the hook hold a stable reference across churn. */\nexport const featuresEqual = (a: WireFeatures, b: WireFeatures): boolean =>\n a === b ||\n (a.coachmarks.enabled === b.coachmarks.enabled &&\n a.showcase.enabled === b.showcase.enabled &&\n a.onboarding.mode === b.onboarding.mode &&\n a.review.enabled === b.review.enabled &&\n a.questionnaire.enabled === b.questionnaire.enabled &&\n a.announcements.enabled === b.announcements.enabled);\n","/**\n * The last-known-flags cache — persisted through the host's optional `storage`.\n *\n * WHY: the fetch is best-effort and fail-open. When the control plane is unreachable we serve the\n * LAST value we saw rather than snapping to defaults, so a tenant that intentionally disabled a\n * module during an incident keeps it disabled across an outage instead of flapping back on. That\n * is \"stale-while-error\": a fresh cache (< TTL) is trusted, and on a fetch error even a STALE\n * cache is served (any age beats a guess). Every operation is best-effort — a broken/hung storage\n * degrades to defaults, never a throw and never a stuck gate (mirrors persistedSession).\n */\nimport { parseWireFeatures } from \"./defaults\";\nimport type { WireFeatures } from \"./types\";\nimport type { WireOnboardingStorage } from \"../session/persistedSession\";\n\n/**\n * TTL for a cached flags entry, aligned to the server's `Cache-Control: private, max-age=300`.\n * A cache younger than this is \"fresh\"; older is \"stale\" (still served on a fetch error).\n */\nexport const DEFAULT_FEATURES_TTL_MS = 300_000;\n\n/** Ceiling on the storage read so a hung adapter degrades to defaults, never a stuck resolve. */\nconst READ_TIMEOUT_MS = 1_500;\n\n/** Storage key for a tenant's cached flags, e.g. `wireai:features:acme`. */\nexport const featuresCacheKey = (appId?: string): string =>\n `wireai:features:${appId && appId.length > 0 ? appId : \"default\"}`;\n\n/** A cached flags entry: the resolved flags + the epoch-ms they were fetched. */\nexport interface CachedFeatures {\n features: WireFeatures;\n /** Age of the entry in ms at read time. */\n ageMs: number;\n}\n\nconst withTimeout = <T>(p: Promise<T>, ms: number): Promise<T | undefined> => {\n let timer: ReturnType<typeof setTimeout>;\n const timeout = new Promise<undefined>((resolve) => {\n timer = setTimeout(() => resolve(undefined), ms);\n });\n return Promise.race([p, timeout]).finally(() => clearTimeout(timer));\n};\n\n/** Whether a cache entry is still within the TTL (server max-age aligned). */\nexport const isFeaturesFresh = (ageMs: number, ttlMs: number = DEFAULT_FEATURES_TTL_MS): boolean =>\n ageMs >= 0 && ageMs < ttlMs;\n\n/**\n * Read the cached flags for `key`, or `undefined` when absent/corrupt/timed-out. Returns the\n * value AND its age so a caller can apply a TTL (fresh) or ignore it (stale-while-error). Never\n * throws; never hangs past the read timeout. The stored value is re-parsed through\n * `parseWireFeatures`, so a partially-corrupt entry still degrades fail-open.\n */\nexport const readCachedFeatures = async (\n storage: WireOnboardingStorage,\n key: string,\n): Promise<CachedFeatures | undefined> => {\n let raw: string | null | undefined;\n try {\n raw = await withTimeout(storage.getItem(key), READ_TIMEOUT_MS);\n } catch {\n return undefined;\n }\n if (!raw) return undefined;\n try {\n const parsed: unknown = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && typeof (parsed as { ts?: unknown }).ts === \"number\") {\n const ts = (parsed as { ts: number }).ts;\n return {\n features: parseWireFeatures((parsed as { features?: unknown }).features),\n ageMs: Date.now() - ts,\n };\n }\n } catch {\n // Corrupt entry → treat as absent; the caller falls back to defaults / a fresh fetch.\n }\n return undefined;\n};\n\n/** Persist `{ features, ts }` under `key` — fire-and-forget, all errors swallowed. */\nexport const writeCachedFeatures = (\n storage: WireOnboardingStorage,\n key: string,\n features: WireFeatures,\n): void => {\n try {\n void storage\n .setItem(key, JSON.stringify({ features, ts: Date.now() }))\n .catch(() => {});\n } catch {\n // Best-effort: a failed write just means the next launch has no cache to fall back to.\n }\n};\n","/**\n * fetchWireFeatures — read the per-module kill switches from `GET {serverUrl}/v1/features`.\n *\n * Contract (server: chohra-med/wireai-onboarding-server, routers/onboarding.py):\n * GET {serverUrl}/v1/features\n * Authorization: Bearer {apiKey}\n * 200 → { coachmarks:{enabled}, showcase:{enabled}, onboarding:{mode}, review:{enabled},\n * announcements:{enabled} } (Cache-Control: private, max-age=300)\n *\n * THE CONTRACT — fail-open, never fail-dark. Unreachable, timed-out, unauthorized (401),\n * server-error (5xx), or malformed JSON all resolve to the LAST CACHED value, else the\n * all-on defaults. No throw ever reaches the host: this is timeout-capped and swallows every\n * error, exactly like the session's best-effort reads. A control-plane outage can only ever be\n * MORE permissive than the dashboard intends — it can never dark a tenant's activation.\n */\nimport { readCachedFeatures, featuresCacheKey, writeCachedFeatures } from \"./cache\";\nimport { defaultWireFeatures, parseWireFeatures } from \"./defaults\";\nimport type { WireFeatures, WireFeaturesConfig } from \"./types\";\nimport type { WireOnboardingStorage } from \"../session/persistedSession\";\n\nconst DEFAULT_TIMEOUT_MS = 4_000;\n\n/** The fail-open fallback: last cached value (any age — stale-while-error), else defaults. */\nconst failOpen = async (\n storage: WireOnboardingStorage | undefined,\n key: string,\n): Promise<WireFeatures> => {\n if (!storage) return defaultWireFeatures;\n const cached = await readCachedFeatures(storage, key);\n return cached?.features ?? defaultWireFeatures;\n};\n\n/** GET with a hard timeout via AbortController (falls back to no-abort where unsupported). */\nconst fetchWithTimeout = async (\n url: string,\n apiKey: string,\n timeoutMs: number,\n): Promise<Response> => {\n const controller =\n typeof AbortController !== \"undefined\" ? new AbortController() : undefined;\n const timer = setTimeout(() => controller?.abort(), timeoutMs);\n try {\n return await fetch(url, {\n method: \"GET\",\n headers: { Accept: \"application/json\", Authorization: `Bearer ${apiKey}` },\n signal: controller?.signal,\n });\n } finally {\n clearTimeout(timer);\n }\n};\n\n/**\n * Resolve the tenant's feature flags. Attempts the network once; on ANY failure returns the\n * cached value (any age), else the all-on defaults. On success, persists the fresh value to the\n * cache (fire-and-forget) and returns it. Never throws.\n *\n * const flags = await fetchWireFeatures({ serverUrl, apiKey, appId, storage });\n * if (!flags.coachmarks.enabled) { /* skip the tour * / }\n */\nexport const fetchWireFeatures = async (\n config?: WireFeaturesConfig,\n): Promise<WireFeatures> => {\n const key = featuresCacheKey(config?.appId);\n const storage = config?.storage;\n\n // Nothing to fetch (no creds) → cache, else defaults. Lets a host mount the provider before\n // its config is ready without ever darking.\n if (!config?.serverUrl || !config?.apiKey) return failOpen(storage, key);\n\n const url = `${config.serverUrl.replace(/\\/$/, \"\")}/v1/features`;\n const timeoutMs = config.timeoutMs && config.timeoutMs > 0 ? config.timeoutMs : DEFAULT_TIMEOUT_MS;\n\n try {\n const res = await fetchWithTimeout(url, config.apiKey, timeoutMs);\n // 401 (bad/rotated key), 5xx, any non-2xx → last-known, never dark.\n if (!res || !res.ok) return failOpen(storage, key);\n const json: unknown = await res.json(); // throws on malformed body → caught below\n const features = parseWireFeatures(json);\n if (storage) writeCachedFeatures(storage, key, features);\n return features;\n } catch {\n // Timeout/abort, network error, missing fetch, or malformed JSON — all fail open.\n return failOpen(storage, key);\n }\n};\n","/**\n * useWireFeatures — resolve the tenant's feature flags for a component tree, once per mount.\n *\n * Returns the all-on defaults immediately (fail-open), then swaps to the fetched value when the\n * network resolves. When no `serverUrl`+`apiKey` is supplied it never fetches and just returns\n * defaults, so a host that never adopts flags sees ZERO behavior change and ZERO network calls.\n *\n * frequent_rules #11 (unstable inline props): the config is idiomatically passed inline\n * (`config={{ serverUrl, apiKey }}`), a fresh identity every render. We stabilize the fetch key\n * by VALUE so the effect fires once per real credential change, and we only swap the returned\n * flags object when its VALUES change — so a host that lists the returned flags in an effect dep\n * array settles in a bounded number of commits instead of looping (enforced by the canary suite).\n */\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { defaultWireFeatures, featuresEqual } from \"./defaults\";\nimport { fetchWireFeatures } from \"./fetchWireFeatures\";\nimport type { WireFeatures, WireFeaturesConfig } from \"./types\";\n\n/** Hold a stable reference for a value while its CONTENT is unchanged (see reviews/equality.ts). */\nconst useStableValue = <T,>(value: T, isEqual: (a: T, b: T) => boolean): T => {\n const ref = useRef(value);\n if (!isEqual(ref.current, value)) ref.current = value;\n return ref.current;\n};\n\n/** The credential slice that actually drives a refetch — stabilized by value. */\nconst sameFetchKey = (a: WireFeaturesConfig | undefined, b: WireFeaturesConfig | undefined): boolean =>\n a?.serverUrl === b?.serverUrl && a?.apiKey === b?.apiKey && a?.appId === b?.appId;\n\nexport const useWireFeatures = (config?: WireFeaturesConfig): WireFeatures => {\n const stableConfig = useStableValue(config, sameFetchKey);\n const [flags, setFlags] = useState<WireFeatures>(defaultWireFeatures);\n\n const canFetch = !!stableConfig?.serverUrl && !!stableConfig?.apiKey;\n\n useEffect(() => {\n if (!canFetch) {\n // No creds → stay on the all-on defaults (and reset if creds were removed).\n setFlags((prev) => (featuresEqual(prev, defaultWireFeatures) ? prev : defaultWireFeatures));\n return;\n }\n let alive = true;\n // fetchWireFeatures never throws — the .then always runs with a fail-open value.\n void fetchWireFeatures(stableConfig).then((next) => {\n if (!alive) return;\n // Only adopt a NEW reference on a real value change, so a host effect keyed on the\n // returned flags doesn't loop (frequent_rules #11).\n setFlags((prev) => (featuresEqual(prev, next) ? prev : next));\n });\n return () => {\n alive = false;\n };\n }, [canFetch, stableConfig]);\n\n return flags;\n};\n","/**\n * WireFeaturesProvider + useResolvedFeatures — the OPTIONAL one-fetch-serves-all-modules layer.\n *\n * Mount `WireFeaturesProvider` once near your app root with the tenant `config` and it fetches the\n * flags ONCE; every gated surface below it (coachmarks / showcase / reviews) reads the same\n * resolved value from context instead of each fetching its own. It is entirely optional: with no\n * provider, every surface falls back to its own lazy fetch (when given a config) or to the all-on\n * defaults, so modules work with zero setup and a host that never adopts flags is unchanged.\n *\n * NOTE on the built npm subpaths: React context is shared across the kit's subpath entries in the\n * SOURCE-consumption path (the monorepo apps) and in this test suite — one module instance, one\n * context. If you consume the built `@wireai/activation/*` subpaths as separate bundles, pass the\n * resolved flags (or a `featuresConfig`) to each surface explicitly instead of relying on context.\n */\nimport React, { createContext, useContext, useMemo } from \"react\";\n\nimport { defaultWireFeatures } from \"./defaults\";\nimport { useWireFeatures } from \"./useWireFeatures\";\nimport type { WireFeatures, WireFeaturesConfig } from \"./types\";\n\n/**\n * @globalSlot LATCH — the React context object is minted by the first copy of this module to load\n * and every later copy ADOPTS it (the `if (!…)` guard below). A second write would re-split the\n * identity the guard exists to keep whole: the provider would publish into one context while a\n * subpath bundle's `useContext` read another, and `useResolvedFeatures`' null fallback would serve\n * the all-on defaults with no crash and no warning. Because it is a latch, and only because of\n * that, the module-local `const WireFeaturesContext` below may cache it.\n */\nconst CONTEXT_SYMBOL = Symbol.for(\"wireai.features.context\");\n// `globalThis`, not `global`: the other nine `Symbol.for` slots in this kit all use it, and `global`\n// simply does not exist in a plain browser (RN-web / SSR-in-the-browser), where this line would\n// throw a ReferenceError before the provider could render anything.\nconst globalObj = globalThis as any;\n\nif (!globalObj[CONTEXT_SYMBOL]) {\n globalObj[CONTEXT_SYMBOL] = createContext<WireFeatures | null>(null);\n}\nconst WireFeaturesContext = globalObj[CONTEXT_SYMBOL];\n\nexport interface WireFeaturesProviderProps {\n /** Tenant creds (+ optional storage) to fetch the flags once for the whole tree. */\n config?: WireFeaturesConfig;\n /**\n * Pre-resolved flags to provide directly instead of fetching (e.g. you already have them, or\n * you drive them from your own remote-config). Takes precedence over `config`.\n */\n flags?: WireFeatures;\n children: React.ReactNode;\n}\n\n/**\n * Fetch (or accept) the flags once and broadcast them to descendants. The provider VALUE is\n * memoized (performance rule #6) so a fresh object each render doesn't re-render every consumer.\n */\nexport const WireFeaturesProvider: React.FC<WireFeaturesProviderProps> = ({\n config,\n flags,\n children,\n}) => {\n // Always call the hook (rules of hooks); when `flags` is supplied we pass no config so it\n // never fetches and the explicit flags win below.\n const fetched = useWireFeatures(flags ? undefined : config);\n const value = flags ?? fetched;\n const stable = useMemo(() => value, [value]);\n return <WireFeaturesContext.Provider value={stable}>{children}</WireFeaturesContext.Provider>;\n};\n\nWireFeaturesProvider.displayName = \"WireFeaturesProvider\";\n\n/** Raw context read — `null` when no `WireFeaturesProvider` is mounted above. */\nexport const useWireFeaturesContext = (): WireFeatures | null =>\n useContext(WireFeaturesContext);\n\n/** Options for `useResolvedFeatures`: an explicit override and/or a lazy-fetch config. */\nexport interface ResolveFeaturesOptions {\n /** Explicit flags — win over everything (a surface's own `features` prop). */\n flags?: WireFeatures;\n /** Lazy-fetch config, used ONLY when there is no explicit `flags` and no provider above. */\n config?: WireFeaturesConfig;\n}\n\n/**\n * The resolution every gated surface uses. Precedence:\n * 1. explicit `options.flags` (a surface's own prop) →\n * 2. the nearest `WireFeaturesProvider` (context) →\n * 3. a lazy fetch from `options.config` (serverUrl + apiKey) →\n * 4. the all-on defaults.\n * Always fail-open, always a stable reference for a given value (so it's safe in effect deps).\n */\nexport const useResolvedFeatures = (options?: ResolveFeaturesOptions): WireFeatures => {\n const ctx = useWireFeaturesContext();\n // Only lazily fetch when nothing else provides the flags — otherwise pass no config so the\n // hook stays inert (defaults, no network). The hook is always called (rules of hooks).\n const shouldFetch = !options?.flags && ctx == null;\n const fetched = useWireFeatures(shouldFetch ? options?.config : undefined);\n return options?.flags ?? ctx ?? fetched ?? defaultWireFeatures;\n};\n","/**\n * defaultOnboardingTheme — a neutral, light, brand-agnostic baseline. Consumers\n * pass a `Partial<OnboardingTheme>` that is deep-merged over this (see\n * `mergeTheme`), so they only override what differs from neutral.\n */\nimport type { OnboardingTheme } from \"./types\";\n\nexport const defaultOnboardingTheme: OnboardingTheme = {\n colors: {\n background: \"#FFFFFF\",\n surface: \"#F7F7F8\",\n text: \"#101114\",\n textMuted: \"#6B7280\",\n primary: \"#111111\",\n onPrimary: \"#FFFFFF\",\n primarySoft: \"rgba(17,17,17,0.06)\",\n border: \"#E4E4E7\",\n borderStrong: \"#C7C7CC\",\n disabled: \"#EBEBEB\",\n success: \"#16A34A\",\n warning: \"#D97706\",\n error: \"#DC2626\",\n info: \"#2563EB\",\n },\n fonts: {\n regular: undefined,\n medium: undefined,\n bold: undefined,\n baseSize: 16,\n scale: 1,\n },\n radius: {\n sm: 8,\n md: 12,\n lg: 16,\n full: 9999,\n },\n spacing: {\n xs: 4,\n sm: 8,\n md: 16,\n lg: 24,\n xl: 32,\n },\n // Circled (pill) CTA by default; an app can pass `button: { radius: 12 }` for\n // a rounded rectangle, or override height/paddingX to match its design system.\n button: {\n radius: 9999,\n height: 52,\n paddingX: 24,\n },\n};\n\n/**\n * Deep-merge a partial theme over the default. Two levels deep is enough — the\n * theme is intentionally shallow (colors/fonts/radius/spacing), so we merge each\n * known sub-object and leave scalars to overwrite.\n */\nexport const mergeTheme = (\n override?: Partial<OnboardingTheme>,\n): OnboardingTheme => {\n if (!override) return defaultOnboardingTheme;\n return {\n colors: { ...defaultOnboardingTheme.colors, ...override.colors },\n fonts: { ...defaultOnboardingTheme.fonts, ...override.fonts },\n radius: { ...defaultOnboardingTheme.radius, ...override.radius },\n spacing: { ...defaultOnboardingTheme.spacing, ...override.spacing },\n button: { ...defaultOnboardingTheme.button, ...override.button },\n };\n};\n","/**\n * ThemeContext — provides the resolved OnboardingTheme to every shell element and\n * themed card via `useOnboardingTheme()`. WHY a context rather than prop-drilling:\n * the cards are mounted by the SDK's ComponentRenderer (not by us), so we can't\n * pass them props directly — they must read the theme from context.\n *\n * ── WHY THE CONTEXT LIVES ON A `Symbol.for` SLOT ───────────────────────────────────────────────\n *\n * It was a plain `createContext(...)`, and tsup inlines this module into FIVE dist bundles\n * (`.`, `./reviews`, `./questionnaire`, `./coachmarks`, `./showcase`) — so each one carried its own\n * context instance. `OnboardingThemeProvider` is exported ONLY from the root barrel, so on any\n * `dist` resolution path (plain RN CLI, `unstable_enablePackageExports: false`, node, jest, SSR) a\n * host that wrapped its tree in `<OnboardingThemeProvider>` and rendered `<ReviewGate>` from\n * `@wireai/activation/reviews` was writing one context and reading another. Nothing crashed and\n * nothing warned: `useOnboardingTheme`'s `ctx ?? mergeTheme()` fallback quietly served the NEUTRAL\n * default theme, so the tenant's brand simply did not apply to the gate. On-device this was masked\n * only because Metro's `react-native` export condition collapses every subpath back to this one\n * `src/` file — the same \"bundler accident, not a guarantee\" the `currentSession` header names, and\n * the same root cause as the optional-peers bug 0.13.3 fixed.\n *\n * The bundler-agnostic fix, exactly as `coachmarks/runtime`, `analytics/currentSession`,\n * `context/deviceId` and `features/WireFeaturesProvider` already do it: park the ONE context on a\n * well-known `globalThis` slot keyed by `Symbol.for(...)`. `Symbol.for` uses the runtime-global\n * symbol registry, so every inlined copy of this module resolves the SAME symbol, finds the slot\n * already filled, and reuses that instance — one context identity however many copies exist.\n * `globalThis` is present and identical in Hermes/React Native, Node and SSR (we never touch\n * `window`), so this is safe on every host. `test/canary/themeContextIdentity.test.tsx` measures it\n * in the BUILT artifact, because the defect is invisible in source.\n */\nimport React, { createContext, useContext, useMemo } from \"react\";\nimport { mergeTheme } from \"./defaultTheme\";\nimport type { OnboardingTheme } from \"./types\";\n\n/**\n * Well-known key into the runtime-global symbol registry. `Symbol.for` (NOT a plain `Symbol()`) is\n * what makes this cross-bundle: it returns the SAME symbol for the same string across every copy of\n * this module, so duplicated inlined copies all address one slot.\n *\n * @globalSlot LATCH — the React context object is minted by the first copy of this module to load\n * and every later copy ADOPTS it (the `if (!…)` guard below says so in one line). A second write\n * re-splits the identity: `<OnboardingThemeProvider>` (root barrel only) publishes into one context\n * while `<ReviewGate>` from a subpath reads another, and `useOnboardingTheme`'s `ctx ?? mergeTheme()`\n * fallback quietly serves the NEUTRAL theme. Because it is a latch, and only because of that, the\n * module-local `const OnboardingThemeContext` below may cache it.\n */\nconst THEME_CONTEXT_SLOT: unique symbol = Symbol.for(\"@wireai/activation:themeContext\");\n\ntype GlobalWithThemeContext = typeof globalThis & {\n [THEME_CONTEXT_SLOT]?: React.Context<OnboardingTheme | null>;\n};\n\nconst themeGlobal = globalThis as GlobalWithThemeContext;\n\n// First copy to load creates the context; every later copy adopts it. Never overwrite an existing\n// slot — a second `createContext` here would re-split the identity this guard exists to keep whole.\nif (!themeGlobal[THEME_CONTEXT_SLOT]) {\n themeGlobal[THEME_CONTEXT_SLOT] = createContext<OnboardingTheme | null>(null);\n}\nconst OnboardingThemeContext = themeGlobal[THEME_CONTEXT_SLOT] as React.Context<OnboardingTheme | null>;\n\nexport type OnboardingThemeProviderProps = {\n /** Partial overrides merged over the neutral default theme. */\n theme?: Partial<OnboardingTheme>;\n children: React.ReactNode;\n};\n\nexport const OnboardingThemeProvider: React.FC<OnboardingThemeProviderProps> = ({\n theme,\n children,\n}) => {\n const resolved = useMemo(() => mergeTheme(theme), [theme]);\n return (\n <OnboardingThemeContext.Provider value={resolved}>\n {children}\n </OnboardingThemeContext.Provider>\n );\n};\n\n/**\n * Read the active theme. Falls back to the default theme when used outside a\n * provider so a stray card never crashes — it just renders neutral.\n */\nexport const useOnboardingTheme = (): OnboardingTheme => {\n const ctx = useContext(OnboardingThemeContext);\n return ctx ?? mergeTheme();\n};\n","/**\n * blazejOnboarding — resolve `@blazejkustra/react-native-onboarding`, lazily and optionally.\n *\n * ── WHY THIS DOES NOT BREAK THE NO-NATIVE-DEPENDENCY POLICY ──────────────────────────────\n *\n * `@blazejkustra/react-native-onboarding` is an OPTIONAL peer of the showcase subpath — it is the\n * slide pager `FeatureShowcase` wraps. Before this file, `FeatureShowcase.tsx` imported its default\n * export at module scope, and `showcase/index.ts` re-exports the component with no wildcard escape,\n * so importing ANYTHING from `@wireai/activation/showcase` (even `selectShowcaseSlides`) dragged\n * the peer in, and a host that skipped the \"optional\" peer hit a Metro resolution failure. This\n * resolver removes that static edge. Same class and same shape as the 0.14.2 `expo-blur` fix\n * (`coachmarks/expoBlur.ts`), whose header carries the reasoning in full.\n *\n * The TYPES stay statically imported on purpose: a type-only import is erased by every toolchain\n * (babel, esbuild and sucrase all drop it), so it creates no runtime edge and no bundle dependency,\n * and `showcaseColors.ts` already relies on exactly that.\n *\n * ── THE SPECIFIER MUST BE A STRING LITERAL, INSIDE A TRY/CATCH ───────────────────────────\n *\n * Metro collects dependencies statically and matches only a call whose callee is literally the\n * identifier `require` and whose argument is literally a string; the try/catch around it is what\n * marks the dependency `isOptional`. Both halves are load-bearing — see `icons/expoIcons.ts` for\n * the full autopsy of the 0.8.0 shape that aliased the callee and was collected nowhere.\n *\n * ── THE DEGRADE ─────────────────────────────────────────────────────────────────────────\n *\n * Absent → `FeatureShowcase` renders null and calls `onDone` from an effect, which is the SAME path\n * the feature kill switch already takes. The host's flow always advances (a showcase that cannot\n * render must never strand the user on a blank screen), and the seen-gate is deliberately NOT\n * written, so installing the peer later still plays the showcase once.\n */\nimport type { ComponentType } from \"react\";\n\nimport type { OnboardingProps } from \"@blazejkustra/react-native-onboarding\";\n\n// Metro injects a module-scoped `require`; it is ABSENT in a pure-ESM runtime (the kit's own tests\n// run under `node --test` as ESM). Declared locally so this type-checks without ambient Node types;\n// the `typeof` guard keeps the reference ESM-safe.\ndeclare const require: ((id: string) => unknown) | undefined;\n\n/** A `require`-like resolver. Injectable in tests; production uses the guarded literal require. */\nexport type OptionalRequire = (moduleName: string) => unknown;\n\n/** The pager component `FeatureShowcase` wraps. */\nexport type OnboardingComponent = ComponentType<OnboardingProps>;\n\nconst MODULE_NAME = \"@blazejkustra/react-native-onboarding\";\n\n/**\n * The production resolver. The specifier is a LITERAL so Metro collects it (see the header); the\n * `moduleName` parameter exists only to keep the `OptionalRequire` seam shape, so anything other\n * than the one module this file owns resolves to undefined.\n */\nconst runtimeRequire: OptionalRequire = (moduleName) => {\n if (moduleName !== MODULE_NAME) return undefined;\n if (typeof require !== \"function\") return undefined;\n try {\n return require(\"@blazejkustra/react-native-onboarding\");\n } catch {\n return undefined;\n }\n};\n\n/**\n * TEST-ONLY seam. `FeatureShowcase`'s public props are frozen, so it cannot take a `requireModule`\n * the way `WireIcon` does — this lets a component render exercise the PRESENT path without the peer\n * installed. Production never sets it; `runtimeRequire` is the only resolver.\n */\nlet testRequire: OptionalRequire | undefined;\nexport const __setShowcaseOnboardingRequireForTests = (fn: OptionalRequire | undefined): void => {\n testRequire = fn;\n cached = undefined;\n};\n\n/**\n * Read the component off the module. The package ships it as a DEFAULT export; a CJS build may put\n * the component directly on `module.exports` instead, so both shapes are accepted.\n */\nconst interop = (mod: unknown): unknown => {\n if (typeof mod === \"function\") return mod;\n if (!mod || typeof mod !== \"object\") return undefined;\n const ns = mod as Record<string, unknown>;\n if (ns.default) return ns.default;\n // `module.exports = forwardRef(...)`: the component IS the namespace, and it is an object rather\n // than a function, so it would slip past the check above.\n if (\"$$typeof\" in ns) return ns;\n return undefined;\n};\n\n/**\n * Narrow an unknown export to something mountable: a real component (function or class) or a\n * React.memo / forwardRef wrapper (an object carrying `$$typeof`). Reject anything else rather than\n * handing the reconciler a non-component.\n */\nconst asComponent = (value: unknown): OnboardingComponent | undefined => {\n if (typeof value === \"function\") return value as OnboardingComponent;\n if (value && typeof value === \"object\" && \"$$typeof\" in (value as object)) {\n return value as OnboardingComponent;\n }\n return undefined;\n};\n\n/**\n * Module-level memo. `null` = \"we looked and it is not there\" (distinct from \"not looked yet\"), so\n * an absent peer costs exactly one failed require per process, not one per showcase mount.\n */\nlet cached: OnboardingComponent | null | undefined;\n\n/** Reset the memo. TEST-ONLY seam — production never calls it. */\nexport const resetShowcaseOnboardingCache = (): void => {\n cached = undefined;\n};\n\n/**\n * Resolve the pager component, or undefined when the peer is absent/unresolvable. Never throws: an\n * absent showcase must advance the host's flow, never break it.\n *\n * `requireModule` is injectable so tests can exercise BOTH the found and absent paths without\n * installing the peer (same convention as `resolveBlurView` / `resolveIconFamily`).\n */\nexport const resolveShowcaseOnboarding = (\n requireModule: OptionalRequire = testRequire ?? runtimeRequire,\n): OnboardingComponent | undefined => {\n try {\n if (cached === undefined || requireModule !== runtimeRequire) {\n const component = asComponent(interop(requireModule(MODULE_NAME)));\n // Don't poison the module memo from an injected test require.\n if (requireModule === runtimeRequire) cached = component ?? null;\n return component;\n }\n if (cached === null) return undefined;\n return cached;\n } catch {\n return undefined;\n }\n};\n","import type { OnboardingColors } from \"@blazejkustra/react-native-onboarding\";\n\nimport type { OnboardingTheme } from \"../theme/types\";\n\n/**\n * Map the kit's semantic `OnboardingTheme` onto the color contract of\n * `@blazejkustra/react-native-onboarding` (what `FeatureShowcase` wraps).\n *\n * ⚠️ CRITICAL — that package's color NAMES do NOT line up with the kit's roles.\n * From its source (`utils/theme.ts` + the button/panel components):\n * • `background.primary` → the PRIMARY BUTTON background, the highlighted intro\n * title word (`OnboardingIntroPanel`), and the image\n * hero panel (`OnboardingImageContainer`). It is the\n * package's BRAND / ACTION color — NOT a screen bg.\n * • `background.secondary` → the screen / modal / step-panel background.\n * • `background.label` → the step-label chip background.\n * • `background.accent` → the SECONDARY (outline) button border ONLY.\n * • `text.contrast` → the primary button label (sits on `background.primary`).\n * • `text.primary` → body copy; `text.secondary` → hints/subtitles.\n *\n * The earlier mapping set `background.primary` to the kit's `background`, which\n * painted the primary CTA in the app's SCREEN background color — an invisible /\n * wrong-colored button (white-on-white in light, dark-on-dark in dark mode). The\n * primary button must be the brand `accent`. Keep this in sync with the package's\n * actual usage, not its key names.\n *\n * ⚠️ CONSEQUENCE of the fix above (the 0.3.2 flood): because `background.primary`\n * is ONE key driving THREE surfaces, painting it `accent` also paints the large\n * IMAGE HERO PANEL (`OnboardingImageContainer`'s `colorBg`) in the accent — a\n * full-bleed wash that dominates the first slide and \"hides\" the app's brand.\n * The package offers no per-surface color key to split them, BUT it does expose a\n * `background?: () => ReactNode` render prop that REPLACES that hero panel fill\n * outright (see `showcasePanelBackground` + `FeatureShowcase`). So the button\n * keeps `accent` here and the panel is calmed separately — one accent value, two\n * different surfaces, cleanly split.\n */\nexport const showcaseColorsFromTheme = (\n t: OnboardingTheme,\n accent: string,\n): OnboardingColors => ({\n background: {\n // Brand action color → primary button bg + intro highlight + image hero panel.\n // (The hero panel is overridden to a calm surface via the package's\n // `background` render prop — see showcasePanelBackground — so in practice\n // this only paints the primary button + the intro highlight word.)\n primary: accent,\n // Neutral screen / modal / step-panel background.\n secondary: t.colors.background,\n // Step-label chip background (a soft wash of the brand).\n label: t.colors.primarySoft,\n // Secondary (outline) button border.\n accent,\n },\n text: {\n primary: t.colors.text,\n secondary: t.colors.textMuted,\n // Primary button label — sits on `background.primary` (the accent).\n contrast: t.colors.onPrimary,\n },\n});\n\n/**\n * Opacity of the accent tint layered over the theme surface for the showcase's\n * image hero panel. Kept in a calm 8–12% band so the panel reads as a subtle\n * brand wash — a hint of the accent, never the full-bleed flood that `accent`\n * as a solid fill produced (the 0.3.1 → 0.3.2 bug seen in a host app).\n */\nexport const SHOWCASE_PANEL_TINT_OPACITY = 0.1;\n\n/** The calm hero-panel background: a neutral surface base + a faint accent tint. */\nexport interface ShowcasePanelBackground {\n /** The calm base fill — the theme SURFACE, deliberately NOT the accent. */\n base: string;\n /** A very subtle accent wash layered over the base (8–12% opacity). */\n tint: { color: string; opacity: number };\n}\n\n/**\n * Background for the showcase's image/hero panel, fed to the underlying\n * package's `background` render prop (which REPLACES its `bg.primary`-filled\n * `colorBg`). Returns a neutral surface base with a faint accent tint on top, so\n * the panel is calm and on-brand instead of an accent flood. The primary button\n * and intro highlight keep the full accent (they read `bg.primary` directly).\n */\nexport const showcasePanelBackground = (\n t: OnboardingTheme,\n accent: string,\n): ShowcasePanelBackground => ({\n base: t.colors.surface,\n tint: { color: accent, opacity: SHOWCASE_PANEL_TINT_OPACITY },\n});\n","import type {\n OnboardingColors,\n OnboardingFonts,\n OnboardingProps,\n OnboardingStep,\n} from \"@blazejkustra/react-native-onboarding\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { type ImageSourcePropType, StyleSheet, View } from \"react-native\";\n\nimport { GestureHint } from \"../coachmarks/GestureHint\";\nimport { hasSeenGate, markSeenGate, showcaseGateKey } from \"../coachmarks/runtime\";\nimport { useResolvedFeatures } from \"../features/WireFeaturesProvider\";\nimport { useOnboardingTheme } from \"../theme/ThemeContext\";\nimport type { OnboardingTheme } from \"../theme/types\";\nimport { resolveShowcaseOnboarding } from \"./blazejOnboarding\";\nimport { showcaseColorsFromTheme, showcasePanelBackground } from \"./showcaseColors\";\nimport type { FeatureShowcaseProps } from \"./types\";\n\n/** 1×1 transparent GIF — the fallback for a slide with no image (the underlying\n * package requires an image area per step). */\nconst TRANSPARENT_PX: ImageSourcePropType = {\n uri: \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\",\n};\n\nconst mergeThemeOver = (\n base: OnboardingTheme,\n override?: Partial<OnboardingTheme>,\n): OnboardingTheme => {\n if (!override) return base;\n return {\n colors: { ...base.colors, ...override.colors },\n fonts: { ...base.fonts, ...override.fonts },\n radius: { ...base.radius, ...override.radius },\n spacing: { ...base.spacing, ...override.spacing },\n button: { ...base.button, ...override.button },\n };\n};\n\n/**\n * FeatureShowcase — the pre-onboarding \"app intro\" slides.\n *\n * Wraps `@blazejkustra/react-native-onboarding`: the app supplies a declarative\n * `ShowcaseConfig` (slides + optional intro panel) and the kit maps it to the\n * package's API, bakes in the Wire onboarding theme colors, overlays the\n * perf-tuned GestureHint on any slide that asks for one, and gates the whole\n * thing once through the same sync storage as the coachmark tours\n * (`wire_showcase_<id>_seen`; the global testing flag bypasses it).\n *\n * When the gate says \"seen\", it renders nothing and calls `onDone` from an\n * effect (never during render).\n *\n * The underlying package is an OPTIONAL peer, resolved through the guarded lazy\n * require in `blazejOnboarding.ts` rather than a static import, so the showcase\n * subpath builds on a host that never installed it. Absent, this takes the SAME\n * path as the kill switch — render null, call `onDone`, write no gate — so the\n * host's flow always advances and the showcase still plays once if the peer is\n * added later.\n */\nconst _FeatureShowcase: React.FC<FeatureShowcaseProps> = ({\n config,\n onDone,\n theme: themeOverride,\n accentColor,\n buttonLabel = \"Next\",\n storage,\n isTesting,\n features,\n featuresConfig,\n}) => {\n const active = useOnboardingTheme();\n const t = useMemo(\n () => mergeThemeOver(active, themeOverride),\n [active, themeOverride],\n );\n const accent = accentColor ?? t.colors.primary;\n\n // Feature kill switch: disabled → treat like \"already seen\" (render nothing, call onDone so the\n // host flow continues) but WITHOUT writing the seen gate, so re-enabling replays the showcase.\n const flags = useResolvedFeatures({ flags: features, config: featuresConfig });\n const disabled = !flags.showcase.enabled;\n\n // The optional pager peer. Resolved once, on first render, instead of at module scope — so\n // merely importing this file (and thus the showcase subpath) never needs it. Absent → treated\n // exactly like the kill switch below: no render, no gate write, `onDone` from the effect.\n const Onboarding = useMemo(() => resolveShowcaseOnboarding(), []);\n\n const gateKey = showcaseGateKey(config.id);\n const seen = useMemo(\n () => hasSeenGate(gateKey, storage, isTesting),\n [gateKey, storage, isTesting],\n );\n // Already-seen, feature-disabled OR the peer missing short-circuits the showcase. Only the seen\n // path is a gate write (in `finish`); the other two never persist, so the showcase replays once\n // the feature is re-enabled or the peer is installed.\n const skip = seen || disabled || !Onboarding;\n\n const doneRef = useRef(false);\n const finish = useCallback(() => {\n if (doneRef.current) return;\n doneRef.current = true;\n markSeenGate(gateKey, storage, isTesting);\n onDone();\n }, [gateKey, storage, isTesting, onDone]);\n\n // Already seen OR disabled → skip without rendering; call onDone from an effect so the host's\n // navigation continues (never write the gate here — `finish` owns the seen write).\n useEffect(() => {\n if (skip && !doneRef.current) {\n doneRef.current = true;\n onDone();\n }\n }, [skip, onDone]);\n\n const [activeIndex, setActiveIndex] = useState(0);\n\n const steps: OnboardingStep[] = useMemo(\n () =>\n config.slides.map((slide) => ({\n title: slide.title,\n description: slide.description,\n buttonLabel: slide.buttonLabel ?? buttonLabel,\n image: slide.image ?? TRANSPARENT_PX,\n position: slide.imagePosition ?? \"top\",\n })),\n [config.slides, buttonLabel],\n );\n\n const introPanel: OnboardingProps[\"introPanel\"] = useMemo(\n () =>\n config.introPanel\n ? {\n title: config.introPanel.title,\n subtitle: config.introPanel.subtitle,\n button: config.introPanel.button,\n image: config.introPanel.image,\n }\n : { button: buttonLabel },\n [config.introPanel, buttonLabel],\n );\n\n // The package's color KEYS don't match the kit's role names — most importantly\n // its `background.primary` drives the PRIMARY BUTTON (not the screen bg), so the\n // accent must land there. See showcaseColorsFromTheme for the full contract.\n const colors: OnboardingColors = useMemo(\n () => showcaseColorsFromTheme(t, accent),\n [t, accent],\n );\n\n // Calm the large image/hero panel. The package's `background.primary` is a\n // SINGLE key that fills the primary button, the intro highlight AND this hero\n // panel — painting it `accent` (correct for the button) also flooded the first\n // slide with the app color (0.3.1). The package exposes a\n // `background` render prop that REPLACES that panel fill outright, so we keep\n // the button accent (via `colors`) and paint the panel a calm surface + faint\n // accent tint here. See showcasePanelBackground.\n const panelBg = useMemo(() => showcasePanelBackground(t, accent), [t, accent]);\n const renderPanelBackground = useCallback(\n () => (\n <View\n style={[\n styles.panelBase,\n { backgroundColor: panelBg.base, borderRadius: t.radius.md },\n ]}\n >\n <View\n style={[\n StyleSheet.absoluteFill,\n {\n backgroundColor: panelBg.tint.color,\n opacity: panelBg.tint.opacity,\n },\n ]}\n />\n </View>\n ),\n [panelBg, t.radius.md],\n );\n\n const fonts: OnboardingFonts = useMemo(\n () => ({\n introTitle: t.fonts.bold,\n introSubtitle: t.fonts.regular,\n introButton: t.fonts.bold,\n stepLabel: t.fonts.medium,\n stepTitle: t.fonts.bold,\n stepDescription: t.fonts.regular,\n stepButton: t.fonts.bold,\n primaryButton: t.fonts.bold,\n secondaryButton: t.fonts.medium,\n }),\n [t],\n );\n\n // `!Onboarding` is already folded into `skip`; it is repeated here so the narrowing is explicit\n // to the reader and to the compiler at the JSX below.\n if (skip || !Onboarding) return null;\n\n const activeGesture = config.slides[activeIndex]?.gesture;\n // Same rule as the coachmark path: tap / double-tap slides show no glyph.\n const showGesture =\n !!activeGesture &&\n activeGesture !== \"none\" &&\n activeGesture !== \"tap\" &&\n activeGesture !== \"double_tap\";\n\n return (\n <View style={styles.fill}>\n <Onboarding\n introPanel={introPanel}\n steps={steps}\n colors={colors}\n fonts={fonts}\n background={renderPanelBackground}\n onComplete={finish}\n onSkip={finish}\n onStepChange={setActiveIndex}\n />\n\n {/* Perf-tuned gesture glyph overlaid on the active slide, if it asks for\n one (tap / double-tap slides show no glyph — same rule as coachmarks). */}\n {showGesture && (\n <View style={styles.gestureLayer} pointerEvents=\"none\">\n <GestureHint type={activeGesture} color={accent} />\n </View>\n )}\n </View>\n );\n};\n\nexport const FeatureShowcase = React.memo(_FeatureShowcase);\nFeatureShowcase.displayName = \"FeatureShowcase\";\n\nconst styles = StyleSheet.create({\n fill: { flex: 1 },\n // Fills the package's animated background box; clips the accent tint to the\n // rounded corners so the calm panel reads as a card, not a bleed.\n panelBase: { flex: 1, overflow: \"hidden\" },\n gestureLayer: {\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n paddingBottom: 140,\n },\n});\n\nexport default FeatureShowcase;\n","/**\n * selectShowcaseSlides — the value-bridge selection seam for the feature showcase.\n *\n * The recommended shape (v0.2.1+) renders the showcase AS A PERSONALIZED VALUE\n * BRIDGE right AFTER the AI onboarding completes: the user just told you what they\n * want in `result.answers`, so you show only the 2-3 slides that answer it, in the\n * most-relevant-first order — \"you said you want X → here's how the app does X\"\n * (the Duolingo / Headspace terminal-moment pattern). The host declares the full\n * slide catalog once and passes an ordered id list computed from the answers:\n *\n * // Full deck, declared order (pre-onboarding placement, or thin answers):\n * const slides = selectShowcaseSlides(catalog);\n *\n * // Personalized bridge, post-onboarding: subset + order chosen from answers:\n * const slides = selectShowcaseSlides(catalog, idsFromAnswers(result.answers));\n *\n * Contract (identical to `selectTourSteps`):\n * - `selection` absent → returns the catalog unchanged (identity / declared order).\n * - `selection` present → returns only catalog entries whose `id` appears in\n * `selection`, ordered by `selection` (unknown ids are skipped; duplicates in\n * `selection` are ignored after the first match).\n *\n * v2 SERVER SEAM (document-only, not built here): the onboarding server's final\n * turn will later return an ordered `showcase: string[]` slide-key list chosen\n * server-side from the same answers. The host passes it straight in as `selection`\n * — same catalog, same contract, AI is a drop-in. Old kits that don't read the new\n * field simply ignore it, so shipping the extra field is backward-safe.\n */\nexport const selectShowcaseSlides = <T extends { id: string }>(\n catalog: T[],\n selection?: string[],\n): T[] => {\n if (!selection) return catalog;\n\n const byId = new Map(catalog.map((item) => [item.id, item]));\n const seen = new Set<string>();\n const ordered: T[] = [];\n for (const id of selection) {\n if (seen.has(id)) continue;\n seen.add(id);\n const item = byId.get(id);\n if (item) ordered.push(item);\n }\n return ordered;\n};\n"]}
|
package/metro/index.js
CHANGED
|
@@ -71,11 +71,16 @@ const SINGLE_INSTANCE_DEPS = ['react', 'react-native', 'wireai-rn', 'zod'];
|
|
|
71
71
|
* only thing holding it up.
|
|
72
72
|
*
|
|
73
73
|
* ONLY modules read through a guarded require/import belong here. A module the kit imports
|
|
74
|
-
* STATICALLY at module scope
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
74
|
+
* STATICALLY at module scope must NOT be stubbed: an empty module would turn a loud build-time
|
|
75
|
+
* "Unable to resolve module" into a silent `undefined` component that crashes at render, which is
|
|
76
|
+
* strictly worse. That exclusion used to name `react-native-reanimated` and
|
|
77
|
+
* `@blazejkustra/react-native-onboarding` — as of 0.14.3 both are guarded (`coachmarks/reanimated.ts`,
|
|
78
|
+
* `showcase/blazejOnboarding.ts`) and so they belong on the list, not in the exclusion. The kit now
|
|
79
|
+
* has NO statically-imported optional peer: every module it can live without is reached through a
|
|
80
|
+
* guard, and everything it imports statically (react, react-native, react-native-safe-area-context,
|
|
81
|
+
* wireai-rn, zod) is a REQUIRED peer whose absence must stay a hard build error.
|
|
82
|
+
* `test/canary/metroResolution.test.tsx` keeps this list in sync with the source by asking Metro
|
|
83
|
+
* which deps it marks optional.
|
|
79
84
|
*/
|
|
80
85
|
const OPTIONAL_MODULES = [
|
|
81
86
|
// src/icons/expoIcons.ts — icon families; absent → WireIcon renders null.
|
|
@@ -91,6 +96,12 @@ const OPTIONAL_MODULES = [
|
|
|
91
96
|
'expo-haptics',
|
|
92
97
|
// src/coachmarks/expoBlur.ts — the coachmark spotlight frost; absent → plain dimmed scrim.
|
|
93
98
|
'expo-blur',
|
|
99
|
+
// src/coachmarks/reanimated.ts — the coachmark/showcase animation engine; absent → the overlay
|
|
100
|
+
// and the gesture glyph render statically, at their resting frame.
|
|
101
|
+
'react-native-reanimated',
|
|
102
|
+
// src/showcase/blazejOnboarding.ts — the FeatureShowcase slide pager; absent → the showcase
|
|
103
|
+
// renders null and calls onDone, so the host's flow still advances.
|
|
104
|
+
'@blazejkustra/react-native-onboarding',
|
|
94
105
|
];
|
|
95
106
|
|
|
96
107
|
function withWireOnboarding(config, options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wireai/activation",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Premium, fully-themable drop-in AI onboarding kit for React Native / Expo, on top of the open-source wireai-rn SDK.",
|
|
6
6
|
"author": "Malik Chohra <malik@getwireai.com>",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, type ReactNode } from "react";
|
|
2
2
|
import { StyleSheet, View } from "react-native";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Animated,
|
|
4
6
|
useAnimatedStyle,
|
|
5
7
|
useReducedMotion,
|
|
6
8
|
useSharedValue,
|
|
@@ -8,15 +10,22 @@ import Animated, {
|
|
|
8
10
|
withRepeat,
|
|
9
11
|
withSequence,
|
|
10
12
|
withTiming,
|
|
11
|
-
} from "
|
|
12
|
-
|
|
13
|
+
} from "./reanimated";
|
|
13
14
|
import type { GestureKind } from "./types";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* Abstract gesture pictogram shown beside a coachmark tooltip.
|
|
17
|
-
* every animation runs on the UI thread
|
|
18
|
-
* setState, so it costs nothing on the JS
|
|
19
|
-
* dropping the motion loop and rendering the
|
|
17
|
+
* Abstract gesture pictogram shown beside a coachmark tooltip. With the OPTIONAL
|
|
18
|
+
* `react-native-reanimated` peer installed every animation runs on the UI thread
|
|
19
|
+
* (shared values + worklets), never setState, so it costs nothing on the JS
|
|
20
|
+
* thread. Honors Reduce Motion by dropping the motion loop and rendering the
|
|
21
|
+
* glyph static.
|
|
22
|
+
*
|
|
23
|
+
* The peer is reached through the guarded lazy require in `reanimated.ts`, never
|
|
24
|
+
* a static import, so `@wireai/activation/coachmarks` (and `/showcase`, which
|
|
25
|
+
* reaches this component through FeatureShowcase) builds on a host that never
|
|
26
|
+
* installed it. Absent, the glyph renders STATICALLY at its resting frame — the
|
|
27
|
+
* same capsules, ring, dot and motion track, at full opacity and no travel, with
|
|
28
|
+
* one render instead of a UI-thread loop. The pictogram never disappears.
|
|
20
29
|
*
|
|
21
30
|
* NO drawn-hand anatomy. Swipes render the standard two-finger swipe glyph: two
|
|
22
31
|
* rounded vertical capsules (an abstract index + middle finger, slightly
|