@wireai/activation 0.13.2 → 0.13.5

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.
Files changed (82) hide show
  1. package/AGENTS.md +6 -3
  2. package/CHANGELOG.md +291 -4
  3. package/INTEGRATION_PROMPT.md +7 -1
  4. package/README.md +68 -2
  5. package/dist/analytics/index.d.mts +86 -6
  6. package/dist/analytics/index.d.ts +86 -6
  7. package/dist/analytics/index.js +271 -472
  8. package/dist/analytics/index.js.map +1 -1
  9. package/dist/analytics/index.mjs +269 -471
  10. package/dist/analytics/index.mjs.map +1 -1
  11. package/dist/coachmarks/index.d.mts +15 -2
  12. package/dist/coachmarks/index.d.ts +15 -2
  13. package/dist/coachmarks/index.js +58 -14
  14. package/dist/coachmarks/index.js.map +1 -1
  15. package/dist/coachmarks/index.mjs +58 -14
  16. package/dist/coachmarks/index.mjs.map +1 -1
  17. package/dist/{currentSession-ClkLjcJ0.d.mts → currentSession-DgJf0fRz.d.mts} +4 -4
  18. package/dist/{currentSession-DOVZEWJl.d.ts → currentSession-EOHU64QD.d.ts} +4 -4
  19. package/dist/{decision-Bl_M2y3r.d.mts → decision-Bgo17oH7.d.mts} +1 -1
  20. package/dist/{decision-Cau5KmP6.d.ts → decision-Bkh_LigV.d.ts} +1 -1
  21. package/dist/index.d.mts +27 -4
  22. package/dist/index.d.ts +27 -4
  23. package/dist/index.js +224 -575
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +221 -572
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/questionnaire/index.d.mts +43 -11
  28. package/dist/questionnaire/index.d.ts +43 -11
  29. package/dist/questionnaire/index.js +45 -13
  30. package/dist/questionnaire/index.js.map +1 -1
  31. package/dist/questionnaire/index.mjs +45 -13
  32. package/dist/questionnaire/index.mjs.map +1 -1
  33. package/dist/reviews/index.d.mts +5 -5
  34. package/dist/reviews/index.d.ts +5 -5
  35. package/dist/reviews/index.js +31 -9
  36. package/dist/reviews/index.js.map +1 -1
  37. package/dist/reviews/index.mjs +31 -9
  38. package/dist/reviews/index.mjs.map +1 -1
  39. package/dist/showcase/index.d.mts +1 -1
  40. package/dist/showcase/index.d.ts +1 -1
  41. package/dist/showcase/index.js +7 -2
  42. package/dist/showcase/index.js.map +1 -1
  43. package/dist/showcase/index.mjs +7 -2
  44. package/dist/showcase/index.mjs.map +1 -1
  45. package/dist/{transport-CF_eHwzC.d.mts → transport-B_0SgCBe.d.ts} +44 -5
  46. package/dist/{transport-DsRe4epC.d.ts → transport-j5gFfJhK.d.mts} +44 -5
  47. package/dist/{types-CKFhyrMu.d.mts → types-BpwiRpA8.d.mts} +1 -1
  48. package/dist/{types-CKFhyrMu.d.ts → types-BpwiRpA8.d.ts} +1 -1
  49. package/dist/{types-CNUqMK0D.d.mts → types-Cju-1_jT.d.mts} +42 -2
  50. package/dist/{types-Buj9Lw9t.d.ts → types-h2BZvl1t.d.ts} +42 -2
  51. package/llms.txt +1 -1
  52. package/package.json +6 -1
  53. package/src/OnboardingFlow.tsx +44 -15
  54. package/src/WireOnboarding.tsx +7 -6
  55. package/src/activation/revalidation.ts +9 -1
  56. package/src/activation/wireActivation.ts +3 -3
  57. package/src/analytics/analyticsFacade.ts +2 -2
  58. package/src/analytics/currentSession.ts +10 -0
  59. package/src/analytics/eventQueue.ts +88 -20
  60. package/src/analytics/index.ts +6 -0
  61. package/src/analytics/reportClientEvent.ts +29 -7
  62. package/src/analytics/wireDoctor.ts +330 -0
  63. package/src/cards/CardGridSelectCard.tsx +1 -1
  64. package/src/cards/ChipSelectCard.tsx +2 -2
  65. package/src/cards/SelectionCard.tsx +1 -1
  66. package/src/coachmarks/runtime.ts +72 -3
  67. package/src/coachmarks/useCoachmarkTour.ts +62 -14
  68. package/src/context/deviceId.ts +14 -5
  69. package/src/features/WireFeaturesProvider.tsx +12 -1
  70. package/src/identity/identityRecord.ts +9 -1
  71. package/src/identity/userIdentity.ts +1 -1
  72. package/src/questionnaire/QuestionnaireGate.tsx +90 -10
  73. package/src/questionnaire/index.ts +9 -1
  74. package/src/questionnaire/transport.ts +46 -11
  75. package/src/reviews/ReviewGate.tsx +61 -6
  76. package/src/reviews/index.ts +10 -1
  77. package/src/reviews/runtime.ts +11 -1
  78. package/src/reviews/transport.ts +58 -12
  79. package/src/session-analytics/useLifecycleEvents.ts +1 -1
  80. package/src/theme/ThemeContext.tsx +49 -1
  81. package/src/types.ts +1 -1
  82. package/src/utils/submitResult.ts +39 -0
@@ -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,UAAA,EAAY,QAAA;AAAA,EACZ,WAAA,EAAa;AACf,CAAA;AAOA,IAAM,UAAA,GAAwD,CAAC,EAAE,IAAA,EAAM,OAAM,KAAM;AACjF,EAAA,MAAM,EAAE,GAAA,EAAK,KAAA,EAAO,MAAA,EAAO,GAAI,QAAQ,MAAM;AAC3C,IAAA,MAAM,IAAI,IAAA,GAAO,GAAA;AACjB,IAAA,MAAM,IAAI,CAAA,GAAI,CAAA;AACd,IAAA,OAAO;AAAA,MACL,GAAA,EAAK,EAAE,aAAA,EAAe,KAAA,EAAgB,YAAY,UAAA,EAAqB,GAAA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AAA,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":["import React, { useEffect, useMemo, type ReactNode } from \"react\";\nimport { 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/** Well-known key into the runtime-global symbol registry — one coachmark runtime across bundles. */\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};\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\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.\n */\nexport const setCoachmarksEnabled = (value: boolean): void => {\n coachmarkRuntime().coachmarksEnabled = value;\n};\n\n/** Whether the coachmarks module is enabled. False → tours/overlays are silently skipped. */\nexport const areCoachmarksEnabled = (): boolean => coachmarkRuntime().coachmarksEnabled;\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\nconst CONTEXT_SYMBOL = Symbol.for(\"wireai.features.context\");\nconst globalObj = global 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 */\nimport React, { createContext, useContext, useMemo } from \"react\";\nimport { mergeTheme } from \"./defaultTheme\";\nimport type { OnboardingTheme } from \"./types\";\n\nconst OnboardingThemeContext = createContext<OnboardingTheme | null>(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/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,UAAA,EAAY,QAAA;AAAA,EACZ,WAAA,EAAa;AACf,CAAA;AAOA,IAAM,UAAA,GAAwD,CAAC,EAAE,IAAA,EAAM,OAAM,KAAM;AACjF,EAAA,MAAM,EAAE,GAAA,EAAK,KAAA,EAAO,MAAA,EAAO,GAAI,QAAQ,MAAM;AAC3C,IAAA,MAAM,IAAI,IAAA,GAAO,GAAA;AACjB,IAAA,MAAM,IAAI,CAAA,GAAI,CAAA;AACd,IAAA,OAAO;AAAA,MACL,GAAA,EAAK,EAAE,aAAA,EAAe,KAAA,EAAgB,YAAY,UAAA,EAAqB,GAAA,EAAK,OAAO,IAAA,EAAK;AAAA,MACxF,KAAA,EAAO,EAAE,KAAA,EAAO,CAAA,EAAG,MAAA,EAAQ,OAAO,IAAA,EAAM,YAAA,EAAc,CAAA,EAAG,eAAA,EAAiB,KAAA,EAAM;AAAA,MAChF,MAAA,EAAQ,EAAE,KAAA,EAAO,CAAA,EAAG,MAAA,EAAQ,OAAO,IAAA,EAAM,YAAA,EA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,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":["import React, { useEffect, useMemo, type ReactNode } from \"react\";\nimport { 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,10 +1,49 @@
1
- import { k as ReviewTarget, g as ReviewDecisionResponse, j as ReviewSubmission } from './types-CNUqMK0D.mjs';
1
+ import { k as ReviewTarget, S as SubmitResult, g as ReviewDecisionResponse, j as ReviewSubmission } from './types-h2BZvl1t.js';
2
2
 
3
3
  /**
4
- * POST a review (the 1-4 feedback path). Fire-and-forget: a missing target, a build error,
5
- * a missing `fetch`, or a network failure is swallowed and the call returns immediately.
4
+ * What became of a review POST the SHARED three-outcome verdict, re-exported under the name the
5
+ * reviews surface has always published. The split is load-bearing and the reasoning lives once, in
6
+ * `utils/submitResult.ts`, because `submitQuestionnaireResponse` answers the identical question.
7
+ * See `submitReview` below for what reads it.
6
8
  */
7
- declare const submitReview: (target: ReviewTarget | undefined, review: ReviewSubmission) => void;
9
+ type ReviewSubmitResult = SubmitResult;
10
+ /**
11
+ * POST a review (the 1-4 feedback path, and the text-less 5-star row).
12
+ *
13
+ * NON-BLOCKING, and ACKED. It never throws and never makes a caller wait — the request is fired
14
+ * synchronously and the UI is free to advance on the next line — but it RESOLVES with what became
15
+ * of the row.
16
+ *
17
+ * WHY THE RETURN VALUE EXISTS: a 1-4 star rating with mandatory free text is the kit's most
18
+ * valuable payload and it has no persisted queue behind it (unlike `analytics/eventQueue`). If the
19
+ * response is dropped on the floor, a caller cannot tell a delivered submission from one that died
20
+ * in the socket, so it must latch the rating as posted and a detractor who rated offline is lost
21
+ * AND never asked again. Reading the ack is what lets `ReviewGate` keep an undelivered row
22
+ * recoverable.
23
+ *
24
+ * ── WHY IT IS NOT A BOOLEAN ──────────────────────────────────────────────────────────────────
25
+ *
26
+ * It was, for exactly one unpublished release, and the boolean was the bug. `false` meant both
27
+ * "nothing reached the server" and "the server answered non-2xx", and the one caller that reads
28
+ * this (`ReviewGate.postOnce`) treats `false` as "still owed" and re-posts. But the server mints
29
+ * its own row id (`create_review` / `_new_id()`) and `CreateReviewRequest` carries no id, so there
30
+ * is NO idempotency key on the wire: a 502 returned AFTER the insert commits means the re-post
31
+ * writes a SECOND row, double-counting `count` and corrupting `avg` — the precise corruption the
32
+ * one-row latch exists to prevent. A response of any status proves the server was reached, and
33
+ * that is a different question from whether it liked the row. So the two are different values.
34
+ *
35
+ * ── THE RESIDUAL, STATED HONESTLY ────────────────────────────────────────────────────────────
36
+ *
37
+ * `unsent` is not proof the server never got the row. A connection dropped after the request was
38
+ * written — or after the row committed — surfaces as a thrown/rejected `fetch` here, exactly like
39
+ * an offline device. Retrying only on `unsent` is therefore SAFER, not SAFE: it removes the
40
+ * double-post the server itself told us about, and leaves the narrow window where the answer never
41
+ * made it back onto the wire. Closing that window needs a CLIENT-MINTED IDEMPOTENCY KEY the server
42
+ * upserts on, which is a server change (`CreateReviewRequest` + `create_review`) and is not
43
+ * something the kit can fake. Until it exists, prefer losing a row over inventing one: a lost
44
+ * detractor is a gap in the data, a duplicated one is a lie in the data.
45
+ */
46
+ declare const submitReview: (target: ReviewTarget | undefined, review: ReviewSubmission) => Promise<ReviewSubmitResult>;
8
47
  /**
9
48
  * Options for the best-effort review decision fetch.
10
49
  *
@@ -124,4 +163,4 @@ interface ReportAppEventOptions {
124
163
  */
125
164
  declare const reportAppEvent: (target: ReviewTarget | undefined, name: string, options?: ReportAppEventOptions) => void;
126
165
 
127
- export { type FetchReviewDecisionOptions as F, type ReportAppEventOptions as R, fetchReviewDecision as f, reportAppEvent as r, submitReview as s };
166
+ export { type FetchReviewDecisionOptions as F, type ReportAppEventOptions as R, type ReviewSubmitResult as a, fetchReviewDecision as f, reportAppEvent as r, submitReview as s };
@@ -1,10 +1,49 @@
1
- import { k as ReviewTarget, g as ReviewDecisionResponse, j as ReviewSubmission } from './types-Buj9Lw9t.js';
1
+ import { k as ReviewTarget, S as SubmitResult, g as ReviewDecisionResponse, j as ReviewSubmission } from './types-Cju-1_jT.mjs';
2
2
 
3
3
  /**
4
- * POST a review (the 1-4 feedback path). Fire-and-forget: a missing target, a build error,
5
- * a missing `fetch`, or a network failure is swallowed and the call returns immediately.
4
+ * What became of a review POST the SHARED three-outcome verdict, re-exported under the name the
5
+ * reviews surface has always published. The split is load-bearing and the reasoning lives once, in
6
+ * `utils/submitResult.ts`, because `submitQuestionnaireResponse` answers the identical question.
7
+ * See `submitReview` below for what reads it.
6
8
  */
7
- declare const submitReview: (target: ReviewTarget | undefined, review: ReviewSubmission) => void;
9
+ type ReviewSubmitResult = SubmitResult;
10
+ /**
11
+ * POST a review (the 1-4 feedback path, and the text-less 5-star row).
12
+ *
13
+ * NON-BLOCKING, and ACKED. It never throws and never makes a caller wait — the request is fired
14
+ * synchronously and the UI is free to advance on the next line — but it RESOLVES with what became
15
+ * of the row.
16
+ *
17
+ * WHY THE RETURN VALUE EXISTS: a 1-4 star rating with mandatory free text is the kit's most
18
+ * valuable payload and it has no persisted queue behind it (unlike `analytics/eventQueue`). If the
19
+ * response is dropped on the floor, a caller cannot tell a delivered submission from one that died
20
+ * in the socket, so it must latch the rating as posted and a detractor who rated offline is lost
21
+ * AND never asked again. Reading the ack is what lets `ReviewGate` keep an undelivered row
22
+ * recoverable.
23
+ *
24
+ * ── WHY IT IS NOT A BOOLEAN ──────────────────────────────────────────────────────────────────
25
+ *
26
+ * It was, for exactly one unpublished release, and the boolean was the bug. `false` meant both
27
+ * "nothing reached the server" and "the server answered non-2xx", and the one caller that reads
28
+ * this (`ReviewGate.postOnce`) treats `false` as "still owed" and re-posts. But the server mints
29
+ * its own row id (`create_review` / `_new_id()`) and `CreateReviewRequest` carries no id, so there
30
+ * is NO idempotency key on the wire: a 502 returned AFTER the insert commits means the re-post
31
+ * writes a SECOND row, double-counting `count` and corrupting `avg` — the precise corruption the
32
+ * one-row latch exists to prevent. A response of any status proves the server was reached, and
33
+ * that is a different question from whether it liked the row. So the two are different values.
34
+ *
35
+ * ── THE RESIDUAL, STATED HONESTLY ────────────────────────────────────────────────────────────
36
+ *
37
+ * `unsent` is not proof the server never got the row. A connection dropped after the request was
38
+ * written — or after the row committed — surfaces as a thrown/rejected `fetch` here, exactly like
39
+ * an offline device. Retrying only on `unsent` is therefore SAFER, not SAFE: it removes the
40
+ * double-post the server itself told us about, and leaves the narrow window where the answer never
41
+ * made it back onto the wire. Closing that window needs a CLIENT-MINTED IDEMPOTENCY KEY the server
42
+ * upserts on, which is a server change (`CreateReviewRequest` + `create_review`) and is not
43
+ * something the kit can fake. Until it exists, prefer losing a row over inventing one: a lost
44
+ * detractor is a gap in the data, a duplicated one is a lie in the data.
45
+ */
46
+ declare const submitReview: (target: ReviewTarget | undefined, review: ReviewSubmission) => Promise<ReviewSubmitResult>;
8
47
  /**
9
48
  * Options for the best-effort review decision fetch.
10
49
  *
@@ -124,4 +163,4 @@ interface ReportAppEventOptions {
124
163
  */
125
164
  declare const reportAppEvent: (target: ReviewTarget | undefined, name: string, options?: ReportAppEventOptions) => void;
126
165
 
127
- export { type FetchReviewDecisionOptions as F, type ReportAppEventOptions as R, fetchReviewDecision as f, reportAppEvent as r, submitReview as s };
166
+ export { type FetchReviewDecisionOptions as F, type ReportAppEventOptions as R, type ReviewSubmitResult as a, fetchReviewDecision as f, reportAppEvent as r, submitReview as s };
@@ -113,4 +113,4 @@ interface WireFeaturesConfig {
113
113
  timeoutMs?: number;
114
114
  }
115
115
 
116
- export { DEFAULT_SESSION_TTL_MS as D, type LoadedSession as L, type OnboardingMode as O, type WireFeatures as W, type WireFeaturesConfig as a, type WireOnboardingStorage as b, clearPersistedSession as c, sessionStorageKey as d, loadPersistedSession as l, peekPersistedSession as p, savePersistedSession as s };
116
+ export { DEFAULT_SESSION_TTL_MS as D, type LoadedSession as L, type OnboardingMode as O, type WireOnboardingStorage as W, type WireFeatures as a, type WireFeaturesConfig as b, clearPersistedSession as c, sessionStorageKey as d, loadPersistedSession as l, peekPersistedSession as p, savePersistedSession as s };
@@ -113,4 +113,4 @@ interface WireFeaturesConfig {
113
113
  timeoutMs?: number;
114
114
  }
115
115
 
116
- export { DEFAULT_SESSION_TTL_MS as D, type LoadedSession as L, type OnboardingMode as O, type WireFeatures as W, type WireFeaturesConfig as a, type WireOnboardingStorage as b, clearPersistedSession as c, sessionStorageKey as d, loadPersistedSession as l, peekPersistedSession as p, savePersistedSession as s };
116
+ export { DEFAULT_SESSION_TTL_MS as D, type LoadedSession as L, type OnboardingMode as O, type WireOnboardingStorage as W, type WireFeatures as a, type WireFeaturesConfig as b, clearPersistedSession as c, sessionStorageKey as d, loadPersistedSession as l, peekPersistedSession as p, savePersistedSession as s };
@@ -1,6 +1,46 @@
1
1
  import { O as OnboardingTheme } from './types-BKfpdZzX.mjs';
2
2
  import { C as CoachmarkStorage } from './types-BcmagF6K.mjs';
3
- import { W as WireFeatures, a as WireFeaturesConfig } from './types-CKFhyrMu.mjs';
3
+ import { a as WireFeatures, b as WireFeaturesConfig } from './types-BpwiRpA8.mjs';
4
+
5
+ /**
6
+ * submitResult — the ONE delivery verdict every user-payload POST in this kit reports back.
7
+ *
8
+ * WHY IT IS SHARED, AND WHY IT IS NOT A BOOLEAN. Two surfaces post a payload the user typed —
9
+ * `submitReview` (`reviews/transport.ts`) and `submitQuestionnaireResponse`
10
+ * (`questionnaire/transport.ts`) — and NEITHER has a persisted queue behind it (unlike
11
+ * `analytics/eventQueue`, with its `maxSize`/`maxRetries`/backoff). Both sit behind a permanent
12
+ * once-gate: the host writes `wire_review_<id>_seen` / `wire_questionnaire_<id>_<ver>_seen` when the
13
+ * gate resolves, so a payload that dies in the socket is lost AND the user is never asked again.
14
+ * Reading the fate of the request is the only thing that lets a caller keep an undelivered payload
15
+ * recoverable, so the two surfaces must answer the same question in the same words.
16
+ *
17
+ * • `accepted` — the server answered 2xx. Stored.
18
+ * • `rejected` — the server ANSWERED, non-2xx. It was reached; it either stored the payload and
19
+ * lost the ack (a gateway 502 after the write commits) or deliberately refused it.
20
+ * Either way the server owns the outcome and a re-post risks a SECOND row.
21
+ * • `unsent` — nothing came back at all: no target, a missing/throwing `fetch`, a rejected
22
+ * request. **This is the ONLY outcome a caller may retry on.**
23
+ *
24
+ * ── WHY THREE VALUES AND NOT TWO (pinned here so the defect cannot move surface) ───────────────
25
+ *
26
+ * `submitReview` was a boolean for exactly one unpublished release, and the boolean WAS the bug.
27
+ * `false` meant both "nothing reached the server" and "the server answered non-2xx", and the caller
28
+ * treats `false` as "still owed" and re-posts. But the server mints its own row id
29
+ * (`create_review` / `_new_id()`), and neither `CreateReviewRequest` nor the questionnaire response
30
+ * body carries a client id, so there is NO idempotency key on the wire: a 502 returned AFTER the
31
+ * insert commits means the re-post writes a SECOND row. A response of any status proves the server
32
+ * was reached, and that is a different question from whether it liked the payload.
33
+ *
34
+ * ── THE RESIDUAL, STATED HONESTLY ─────────────────────────────────────────────────────────────
35
+ *
36
+ * `unsent` is not proof the server never got it. A connection dropped after the request was written
37
+ * — or after the row committed — surfaces as a thrown/rejected `fetch`, exactly like an offline
38
+ * device. Retrying only on `unsent` is therefore SAFER, not SAFE. Closing that window needs a
39
+ * CLIENT-MINTED IDEMPOTENCY KEY the server upserts on, which is a server change and not something
40
+ * the kit can fake. Until it exists, prefer losing a row over inventing one: a lost detractor is a
41
+ * gap in the data, a duplicated one is a lie in the data.
42
+ */
43
+ type SubmitResult = "accepted" | "rejected" | "unsent";
4
44
 
5
45
  /**
6
46
  * The firing verdict — the SAME contract on both sides of the seam. `decideReview`
@@ -161,4 +201,4 @@ interface ReviewGateController {
161
201
  markResolved: () => void;
162
202
  }
163
203
 
164
- export type { ReviewGateProps as R, UseReviewGateOptions as U, ReviewPresentation as a, ReviewGateController as b, ReviewDecision as c, ReviewStoreConfig as d, RatingRoute as e, ReviewConfig as f, ReviewDecisionResponse as g, ReviewGateEvent as h, ReviewGateEventName as i, ReviewSubmission as j, ReviewTarget as k };
204
+ export type { ReviewGateProps as R, SubmitResult as S, UseReviewGateOptions as U, ReviewPresentation as a, ReviewGateController as b, ReviewDecision as c, ReviewStoreConfig as d, RatingRoute as e, ReviewConfig as f, ReviewDecisionResponse as g, ReviewGateEvent as h, ReviewGateEventName as i, ReviewSubmission as j, ReviewTarget as k };