@wireai/activation 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/AGENTS.md +73 -0
  2. package/CHANGELOG.md +572 -0
  3. package/INTEGRATION_PROMPT.md +55 -0
  4. package/LICENSE +21 -0
  5. package/README.md +923 -0
  6. package/dist/CenteredModal-C3qQBHsA.d.mts +38 -0
  7. package/dist/CenteredModal-Cdgns6--.d.ts +38 -0
  8. package/dist/coachmarks/index.d.mts +352 -0
  9. package/dist/coachmarks/index.d.ts +352 -0
  10. package/dist/coachmarks/index.js +944 -0
  11. package/dist/coachmarks/index.js.map +1 -0
  12. package/dist/coachmarks/index.mjs +918 -0
  13. package/dist/coachmarks/index.mjs.map +1 -0
  14. package/dist/decision-CFvGY6nP.d.ts +228 -0
  15. package/dist/decision-Cl8OFYzu.d.mts +228 -0
  16. package/dist/index.d.mts +1390 -0
  17. package/dist/index.d.ts +1390 -0
  18. package/dist/index.js +3260 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/index.mjs +3186 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/questionnaire/index.d.mts +249 -0
  23. package/dist/questionnaire/index.d.ts +249 -0
  24. package/dist/questionnaire/index.js +922 -0
  25. package/dist/questionnaire/index.js.map +1 -0
  26. package/dist/questionnaire/index.mjs +906 -0
  27. package/dist/questionnaire/index.mjs.map +1 -0
  28. package/dist/reviews/index.d.mts +213 -0
  29. package/dist/reviews/index.d.ts +213 -0
  30. package/dist/reviews/index.js +1001 -0
  31. package/dist/reviews/index.js.map +1 -0
  32. package/dist/reviews/index.mjs +971 -0
  33. package/dist/reviews/index.mjs.map +1 -0
  34. package/dist/showcase/index.d.mts +119 -0
  35. package/dist/showcase/index.d.ts +119 -0
  36. package/dist/showcase/index.js +660 -0
  37. package/dist/showcase/index.js.map +1 -0
  38. package/dist/showcase/index.mjs +651 -0
  39. package/dist/showcase/index.mjs.map +1 -0
  40. package/dist/types-BKfpdZzX.d.mts +84 -0
  41. package/dist/types-BKfpdZzX.d.ts +84 -0
  42. package/dist/types-CMuOexw0.d.mts +116 -0
  43. package/dist/types-CMuOexw0.d.ts +116 -0
  44. package/dist/types-GL_hQ0TN.d.mts +46 -0
  45. package/dist/types-GL_hQ0TN.d.ts +46 -0
  46. package/llms.txt +36 -0
  47. package/metro/index.d.ts +32 -0
  48. package/metro/index.js +83 -0
  49. package/package.json +171 -0
  50. package/src/DemoOnboarding.tsx +133 -0
  51. package/src/OnboardingFlow.tsx +504 -0
  52. package/src/WireOnboarding.tsx +248 -0
  53. package/src/analytics/analyticsEvent.ts +69 -0
  54. package/src/analytics/reportClientEvent.ts +119 -0
  55. package/src/analytics/sendPreview.ts +73 -0
  56. package/src/attribution/attribution.ts +46 -0
  57. package/src/cards/ChipSelectCard.tsx +265 -0
  58. package/src/cards/InterstitialCard.tsx +299 -0
  59. package/src/cards/NumberStepperCard.tsx +121 -0
  60. package/src/cards/SelectionCard.tsx +270 -0
  61. package/src/cards/StatusCard.tsx +170 -0
  62. package/src/cards/TextInputCard.tsx +147 -0
  63. package/src/cards/index.ts +23 -0
  64. package/src/coachmarks/CoachmarkOverlayHost.tsx +44 -0
  65. package/src/coachmarks/CoachmarkProvider.tsx +108 -0
  66. package/src/coachmarks/GestureHint.tsx +331 -0
  67. package/src/coachmarks/SpotlightOverlay.tsx +254 -0
  68. package/src/coachmarks/coachmarkAnchorRegistry.ts +70 -0
  69. package/src/coachmarks/coachmarkOverlayStore.ts +63 -0
  70. package/src/coachmarks/index.ts +62 -0
  71. package/src/coachmarks/runtime.ts +103 -0
  72. package/src/coachmarks/selectTourSteps.ts +45 -0
  73. package/src/coachmarks/types.ts +58 -0
  74. package/src/coachmarks/useCoachmarkAnchor.ts +49 -0
  75. package/src/coachmarks/useCoachmarkTour.ts +200 -0
  76. package/src/components/AnimatedSparkle.tsx +101 -0
  77. package/src/components/Button.tsx +129 -0
  78. package/src/components/CardHandoff.tsx +212 -0
  79. package/src/components/CardLayout.tsx +103 -0
  80. package/src/components/CenteredModal.tsx +184 -0
  81. package/src/components/CompletionView.tsx +186 -0
  82. package/src/components/DoneBlock.tsx +37 -0
  83. package/src/components/ErrorBlock.tsx +42 -0
  84. package/src/components/Illustration.tsx +36 -0
  85. package/src/components/LoadingBlock.tsx +182 -0
  86. package/src/components/LoadingScreen.tsx +35 -0
  87. package/src/components/OnboardingScaffold.tsx +105 -0
  88. package/src/components/StepProgress.tsx +85 -0
  89. package/src/components/loaderChrome.ts +28 -0
  90. package/src/config/onboardingFlag.ts +39 -0
  91. package/src/config/wireConfigFromEnv.ts +52 -0
  92. package/src/device/deviceContext.ts +158 -0
  93. package/src/features/WireFeaturesProvider.tsx +81 -0
  94. package/src/features/cache.ts +92 -0
  95. package/src/features/defaults.ts +67 -0
  96. package/src/features/fetchWireFeatures.ts +86 -0
  97. package/src/features/index.ts +39 -0
  98. package/src/features/types.ts +61 -0
  99. package/src/features/useWireFeatures.ts +57 -0
  100. package/src/identity/userIdentity.ts +100 -0
  101. package/src/illustrations/defaultIllustrations.tsx +99 -0
  102. package/src/index.ts +159 -0
  103. package/src/motion/centeredModalMotion.ts +45 -0
  104. package/src/motion/motionSpec.ts +133 -0
  105. package/src/motion/useReducedMotion.ts +43 -0
  106. package/src/questionnaire/QuestionnaireGate.tsx +235 -0
  107. package/src/questionnaire/decision.ts +63 -0
  108. package/src/questionnaire/index.ts +54 -0
  109. package/src/questionnaire/runtime.ts +20 -0
  110. package/src/questionnaire/transport.ts +83 -0
  111. package/src/questionnaire/types.ts +182 -0
  112. package/src/questionnaire/useQuestionnaireGate.ts +159 -0
  113. package/src/reviews/ReviewGate.tsx +316 -0
  114. package/src/reviews/ReviewModal.tsx +13 -0
  115. package/src/reviews/decision.ts +120 -0
  116. package/src/reviews/equality.ts +54 -0
  117. package/src/reviews/expo-store-review.d.ts +16 -0
  118. package/src/reviews/feedbackForm.ts +41 -0
  119. package/src/reviews/index.ts +78 -0
  120. package/src/reviews/presentation.ts +29 -0
  121. package/src/reviews/runtime.ts +45 -0
  122. package/src/reviews/storeReview.ts +62 -0
  123. package/src/reviews/transport.ts +89 -0
  124. package/src/reviews/types.ts +172 -0
  125. package/src/reviews/useReviewGate.ts +137 -0
  126. package/src/session/persistedSession.ts +143 -0
  127. package/src/session-analytics/index.ts +18 -0
  128. package/src/session-analytics/reportSessionStart.ts +144 -0
  129. package/src/session-analytics/useSessionStart.ts +114 -0
  130. package/src/showcase/FeatureShowcase.tsx +233 -0
  131. package/src/showcase/index.ts +19 -0
  132. package/src/showcase/selectShowcaseSlides.ts +45 -0
  133. package/src/showcase/showcaseColors.ts +91 -0
  134. package/src/showcase/types.ts +74 -0
  135. package/src/theme/ThemeContext.tsx +38 -0
  136. package/src/theme/defaultTheme.ts +70 -0
  137. package/src/theme/themeFromBrand.ts +93 -0
  138. package/src/theme/types.ts +88 -0
  139. package/src/theme/typography.ts +46 -0
  140. package/src/types.ts +215 -0
  141. package/src/utils/deriveAnswers.ts +43 -0
  142. package/src/utils/readProgress.ts +33 -0
@@ -0,0 +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"],"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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AAE,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 */\nimport type { CoachmarkStorage } from \"./types\";\n\nlet storageSingleton: CoachmarkStorage | null = null;\nlet testing = false;\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.\nlet coachmarksEnabled = true;\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 coachmarksEnabled = value;\n};\n\n/** Whether the coachmarks module is enabled. False → tours/overlays are silently skipped. */\nexport const areCoachmarksEnabled = (): boolean => coachmarksEnabled;\n\n/** Set (or clear) the injected sync gate storage. Called by CoachmarkProvider. */\nexport const setCoachmarkStorage = (storage: CoachmarkStorage | null): void => {\n storageSingleton = storage;\n};\n\n/** The currently-injected gate storage, or null if no provider is mounted. */\nexport const getCoachmarkStorage = (): CoachmarkStorage | null => storageSingleton;\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 testing = value;\n};\n\n/** Whether replay-everything QA mode is on. */\nexport const isCoachmarkTesting = (): boolean => 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 ?? testing) return false;\n const storage = storageOverride ?? storageSingleton;\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 ?? testing) return;\n const storage = storageOverride ?? storageSingleton;\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:myelino`. */\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-onboarding/*` 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/** null = no provider mounted (the signal `useResolvedFeatures` uses to fall back). */\nconst WireFeaturesContext = createContext<WireFeatures | null>(null);\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 Malik saw in Myelino).\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 */\nexport const 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 (Malik, Myelino, 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\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"]}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * OnboardingTheme — the single source of truth for every visual value the kit
3
+ * renders. It deliberately mirrors the SHAPE of the OSS SDK's design tokens
4
+ * (`wire-rn/.../styles/tokens.ts`: colors / radii / spacing / textStyles) so the
5
+ * themed cards port over cleanly — but here EVERY value comes from the theme, so
6
+ * a consumer app can repaint the whole flow to match its brand.
7
+ *
8
+ * WHY a flat-ish object (not nested per-component): a host app already has its
9
+ * own palette; mapping it onto one object once is far less friction than theming
10
+ * each card. Cards read semantic roles (surface, primary, border…), never raw hex.
11
+ */
12
+ type OnboardingColors = {
13
+ /** App background behind the whole flow. */
14
+ background: string;
15
+ /** Card / elevated surface background. */
16
+ surface: string;
17
+ /** Primary body text. */
18
+ text: string;
19
+ /** Secondary / hint / placeholder text. */
20
+ textMuted: string;
21
+ /** Brand / accent — selected states, primary buttons, progress fill. */
22
+ primary: string;
23
+ /** Text/icon color on top of `primary` (e.g. primary button label). */
24
+ onPrimary: string;
25
+ /** A tinted wash of `primary` for selected backgrounds. */
26
+ primarySoft: string;
27
+ /** Hairline borders + unselected outlines. */
28
+ border: string;
29
+ /** Stronger border for emphasis. */
30
+ borderStrong: string;
31
+ /** Disabled control fill. */
32
+ disabled: string;
33
+ success: string;
34
+ warning: string;
35
+ error: string;
36
+ info: string;
37
+ };
38
+ type OnboardingFonts = {
39
+ /** Family for normal-weight text. Pass undefined to use the platform default. */
40
+ regular?: string;
41
+ /** Family for medium-weight text. */
42
+ medium?: string;
43
+ /** Family for bold/heading text. */
44
+ bold?: string;
45
+ /** Base body font size in px. The text scale derives from this × `scale`. */
46
+ baseSize: number;
47
+ /** Multiplier applied to derived sizes (e.g. 1.1 for a larger flow). */
48
+ scale: number;
49
+ };
50
+ type OnboardingRadius = {
51
+ sm: number;
52
+ md: number;
53
+ lg: number;
54
+ full: number;
55
+ };
56
+ type OnboardingSpacing = {
57
+ xs: number;
58
+ sm: number;
59
+ md: number;
60
+ lg: number;
61
+ xl: number;
62
+ };
63
+ /**
64
+ * Button shape + size, as its own token so an app can decide how its CTAs look
65
+ * without touching card internals. Set `radius` to a large value (e.g. 9999) for
66
+ * a fully circled pill, or a small one (e.g. 12) for a rounded rectangle.
67
+ */
68
+ type OnboardingButtonStyle = {
69
+ /** Corner radius. 9999 = fully circled pill; ~12 = rounded rectangle. */
70
+ radius: number;
71
+ /** Minimum touch-target height. */
72
+ height: number;
73
+ /** Horizontal padding (the button's own spacing). */
74
+ paddingX: number;
75
+ };
76
+ type OnboardingTheme = {
77
+ colors: OnboardingColors;
78
+ fonts: OnboardingFonts;
79
+ radius: OnboardingRadius;
80
+ spacing: OnboardingSpacing;
81
+ button: OnboardingButtonStyle;
82
+ };
83
+
84
+ export type { OnboardingTheme as O, OnboardingButtonStyle as a, OnboardingColors as b, OnboardingFonts as c, OnboardingRadius as d, OnboardingSpacing as e };
@@ -0,0 +1,84 @@
1
+ /**
2
+ * OnboardingTheme — the single source of truth for every visual value the kit
3
+ * renders. It deliberately mirrors the SHAPE of the OSS SDK's design tokens
4
+ * (`wire-rn/.../styles/tokens.ts`: colors / radii / spacing / textStyles) so the
5
+ * themed cards port over cleanly — but here EVERY value comes from the theme, so
6
+ * a consumer app can repaint the whole flow to match its brand.
7
+ *
8
+ * WHY a flat-ish object (not nested per-component): a host app already has its
9
+ * own palette; mapping it onto one object once is far less friction than theming
10
+ * each card. Cards read semantic roles (surface, primary, border…), never raw hex.
11
+ */
12
+ type OnboardingColors = {
13
+ /** App background behind the whole flow. */
14
+ background: string;
15
+ /** Card / elevated surface background. */
16
+ surface: string;
17
+ /** Primary body text. */
18
+ text: string;
19
+ /** Secondary / hint / placeholder text. */
20
+ textMuted: string;
21
+ /** Brand / accent — selected states, primary buttons, progress fill. */
22
+ primary: string;
23
+ /** Text/icon color on top of `primary` (e.g. primary button label). */
24
+ onPrimary: string;
25
+ /** A tinted wash of `primary` for selected backgrounds. */
26
+ primarySoft: string;
27
+ /** Hairline borders + unselected outlines. */
28
+ border: string;
29
+ /** Stronger border for emphasis. */
30
+ borderStrong: string;
31
+ /** Disabled control fill. */
32
+ disabled: string;
33
+ success: string;
34
+ warning: string;
35
+ error: string;
36
+ info: string;
37
+ };
38
+ type OnboardingFonts = {
39
+ /** Family for normal-weight text. Pass undefined to use the platform default. */
40
+ regular?: string;
41
+ /** Family for medium-weight text. */
42
+ medium?: string;
43
+ /** Family for bold/heading text. */
44
+ bold?: string;
45
+ /** Base body font size in px. The text scale derives from this × `scale`. */
46
+ baseSize: number;
47
+ /** Multiplier applied to derived sizes (e.g. 1.1 for a larger flow). */
48
+ scale: number;
49
+ };
50
+ type OnboardingRadius = {
51
+ sm: number;
52
+ md: number;
53
+ lg: number;
54
+ full: number;
55
+ };
56
+ type OnboardingSpacing = {
57
+ xs: number;
58
+ sm: number;
59
+ md: number;
60
+ lg: number;
61
+ xl: number;
62
+ };
63
+ /**
64
+ * Button shape + size, as its own token so an app can decide how its CTAs look
65
+ * without touching card internals. Set `radius` to a large value (e.g. 9999) for
66
+ * a fully circled pill, or a small one (e.g. 12) for a rounded rectangle.
67
+ */
68
+ type OnboardingButtonStyle = {
69
+ /** Corner radius. 9999 = fully circled pill; ~12 = rounded rectangle. */
70
+ radius: number;
71
+ /** Minimum touch-target height. */
72
+ height: number;
73
+ /** Horizontal padding (the button's own spacing). */
74
+ paddingX: number;
75
+ };
76
+ type OnboardingTheme = {
77
+ colors: OnboardingColors;
78
+ fonts: OnboardingFonts;
79
+ radius: OnboardingRadius;
80
+ spacing: OnboardingSpacing;
81
+ button: OnboardingButtonStyle;
82
+ };
83
+
84
+ export type { OnboardingTheme as O, OnboardingButtonStyle as a, OnboardingColors as b, OnboardingFonts as c, OnboardingRadius as d, OnboardingSpacing as e };
@@ -0,0 +1,116 @@
1
+ /**
2
+ * The storage the host injects. Deliberately the AsyncStorage-compatible subset so
3
+ * `@react-native-async-storage/async-storage` can be passed as-is, and an MMKV (or
4
+ * any other) wrapper is three one-line methods.
5
+ */
6
+ type WireOnboardingStorage = {
7
+ getItem(key: string): Promise<string | null>;
8
+ setItem(key: string, value: string): Promise<void>;
9
+ removeItem(key: string): Promise<void>;
10
+ };
11
+ /**
12
+ * Matches the backend's session TTL (SESSION_TTL_SECONDS = 3600): an id older than
13
+ * this can't be resumed server-side anyway, so the client mints fresh past it.
14
+ */
15
+ declare const DEFAULT_SESSION_TTL_MS = 3600000;
16
+ /** Storage key for an app's cached session, e.g. `wireai:session:myelino`. */
17
+ declare const sessionStorageKey: (appId: string) => string;
18
+ /** Resolved session for a mount: the id to use + whether it was restored from storage. */
19
+ type LoadedSession = {
20
+ id: string;
21
+ /** True when a stored, still-fresh id was reused — the flow resumes instead of starting. */
22
+ resumed: boolean;
23
+ };
24
+ /**
25
+ * Resolve the session id for this mount: reuse the stored one while it's fresh
26
+ * (→ `resumed: true`), else mint via `makeSessionId`, persist it, and start clean.
27
+ * Never throws; never hangs past the read timeout.
28
+ */
29
+ declare const loadPersistedSession: (storage: WireOnboardingStorage, key: string, ttlMs?: number) => Promise<LoadedSession>;
30
+ /**
31
+ * Read the persisted session WITHOUT minting a fresh one (unlike `loadPersistedSession`).
32
+ * Returns the stored `{ id, ts }` or `undefined` when absent/corrupt/timed-out. Used by the
33
+ * post-onboarding `identifyOnboarding` helper to recover the contextId to bind a user to.
34
+ * Never throws; never hangs past the read timeout.
35
+ */
36
+ declare const peekPersistedSession: (storage: WireOnboardingStorage, key: string) => Promise<{
37
+ id: string;
38
+ ts: number;
39
+ } | undefined>;
40
+ /** Persist `{ id, ts }` under `key` — fire-and-forget, all errors swallowed. */
41
+ declare const savePersistedSession: (storage: WireOnboardingStorage, key: string, id: string) => void;
42
+ /** Remove the cached id (fired on completion) — fire-and-forget, all errors swallowed. */
43
+ declare const clearPersistedSession: (storage: WireOnboardingStorage, key: string) => void;
44
+
45
+ /**
46
+ * Public types for the feature-controls module — the per-module dashboard kill switches.
47
+ *
48
+ * Mirrors the server's `GET /v1/features` response (chohra-med/wireai-onboarding-server):
49
+ * one switch per activation surface, all fail-open. This file is dependency-free (types +
50
+ * the frozen default), so it stays in the CORE barrel — the gating lives in the dep-heavy
51
+ * subpaths (coachmarks / showcase / reviews) that consume these flags.
52
+ */
53
+
54
+ /**
55
+ * The onboarding module's three-way control. The kit needs NO gating for these: the SERVER
56
+ * owns the branch (`ai` = LLM flow, `static` = scripted zero-LLM flow over the same A2A
57
+ * contract, `off` = a terminal StatusCard the kit already reads as completion). Surfaced here
58
+ * only so a host can read the current mode. See the README "Onboarding mode" note.
59
+ */
60
+ type OnboardingMode = "ai" | "static" | "off";
61
+ /**
62
+ * The resolved controls object. Every field is always present after parsing (missing server
63
+ * keys are filled with the fail-open default), so consumers read `flags.coachmarks.enabled`
64
+ * without guarding for absence.
65
+ */
66
+ interface WireFeatures {
67
+ /** Coachmarks / gesture hints (kit-gated in CoachmarkProvider + the overlay host). */
68
+ coachmarks: {
69
+ enabled: boolean;
70
+ };
71
+ /** Pre-onboarding + post-onboarding value bridge (kit-gated in FeatureShowcase). */
72
+ showcase: {
73
+ enabled: boolean;
74
+ };
75
+ /** Onboarding flow. Server-owned branch — informational for the kit (no gating). */
76
+ onboarding: {
77
+ mode: OnboardingMode;
78
+ };
79
+ /** In-app review master switch (kit-gated in useReviewGate / ReviewGate). */
80
+ review: {
81
+ enabled: boolean;
82
+ };
83
+ /** Pre-onboarding questionnaire master switch (kit-gated in the questionnaire module). */
84
+ questionnaire: {
85
+ enabled: boolean;
86
+ };
87
+ /** Reserved — the announcements module is not built yet. No kit surface reads it. */
88
+ announcements: {
89
+ enabled: boolean;
90
+ };
91
+ }
92
+ /**
93
+ * What `fetchWireFeatures` / `useWireFeatures` need to reach the control plane. Same tenant
94
+ * creds as the onboarding flow (`WireOnboardingConfig.serverUrl` + `apiKey`); `storage` is the
95
+ * OPTIONAL last-known cache channel (the same AsyncStorage-compatible subset the session uses).
96
+ */
97
+ interface WireFeaturesConfig {
98
+ /** Base server URL (same as `WireOnboardingConfig.serverUrl`); `/v1/features` is appended. */
99
+ serverUrl?: string;
100
+ /** Tenant API key; sent as `Authorization: Bearer`. */
101
+ apiKey?: string;
102
+ /**
103
+ * App id — scopes the cache key so one device caching flags for two tenants never collides.
104
+ * Optional; falls back to a shared `default` bucket when absent.
105
+ */
106
+ appId?: string;
107
+ /**
108
+ * Host-injected storage (AsyncStorage/MMKV subset) for the last-known-flags cache. Omit and
109
+ * the module still works — it just has no cache to fall back to (defaults on failure).
110
+ */
111
+ storage?: WireOnboardingStorage;
112
+ /** Network timeout in ms before the fetch is abandoned to the fail-open fallback. Default 4000. */
113
+ timeoutMs?: number;
114
+ }
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 };
@@ -0,0 +1,116 @@
1
+ /**
2
+ * The storage the host injects. Deliberately the AsyncStorage-compatible subset so
3
+ * `@react-native-async-storage/async-storage` can be passed as-is, and an MMKV (or
4
+ * any other) wrapper is three one-line methods.
5
+ */
6
+ type WireOnboardingStorage = {
7
+ getItem(key: string): Promise<string | null>;
8
+ setItem(key: string, value: string): Promise<void>;
9
+ removeItem(key: string): Promise<void>;
10
+ };
11
+ /**
12
+ * Matches the backend's session TTL (SESSION_TTL_SECONDS = 3600): an id older than
13
+ * this can't be resumed server-side anyway, so the client mints fresh past it.
14
+ */
15
+ declare const DEFAULT_SESSION_TTL_MS = 3600000;
16
+ /** Storage key for an app's cached session, e.g. `wireai:session:myelino`. */
17
+ declare const sessionStorageKey: (appId: string) => string;
18
+ /** Resolved session for a mount: the id to use + whether it was restored from storage. */
19
+ type LoadedSession = {
20
+ id: string;
21
+ /** True when a stored, still-fresh id was reused — the flow resumes instead of starting. */
22
+ resumed: boolean;
23
+ };
24
+ /**
25
+ * Resolve the session id for this mount: reuse the stored one while it's fresh
26
+ * (→ `resumed: true`), else mint via `makeSessionId`, persist it, and start clean.
27
+ * Never throws; never hangs past the read timeout.
28
+ */
29
+ declare const loadPersistedSession: (storage: WireOnboardingStorage, key: string, ttlMs?: number) => Promise<LoadedSession>;
30
+ /**
31
+ * Read the persisted session WITHOUT minting a fresh one (unlike `loadPersistedSession`).
32
+ * Returns the stored `{ id, ts }` or `undefined` when absent/corrupt/timed-out. Used by the
33
+ * post-onboarding `identifyOnboarding` helper to recover the contextId to bind a user to.
34
+ * Never throws; never hangs past the read timeout.
35
+ */
36
+ declare const peekPersistedSession: (storage: WireOnboardingStorage, key: string) => Promise<{
37
+ id: string;
38
+ ts: number;
39
+ } | undefined>;
40
+ /** Persist `{ id, ts }` under `key` — fire-and-forget, all errors swallowed. */
41
+ declare const savePersistedSession: (storage: WireOnboardingStorage, key: string, id: string) => void;
42
+ /** Remove the cached id (fired on completion) — fire-and-forget, all errors swallowed. */
43
+ declare const clearPersistedSession: (storage: WireOnboardingStorage, key: string) => void;
44
+
45
+ /**
46
+ * Public types for the feature-controls module — the per-module dashboard kill switches.
47
+ *
48
+ * Mirrors the server's `GET /v1/features` response (chohra-med/wireai-onboarding-server):
49
+ * one switch per activation surface, all fail-open. This file is dependency-free (types +
50
+ * the frozen default), so it stays in the CORE barrel — the gating lives in the dep-heavy
51
+ * subpaths (coachmarks / showcase / reviews) that consume these flags.
52
+ */
53
+
54
+ /**
55
+ * The onboarding module's three-way control. The kit needs NO gating for these: the SERVER
56
+ * owns the branch (`ai` = LLM flow, `static` = scripted zero-LLM flow over the same A2A
57
+ * contract, `off` = a terminal StatusCard the kit already reads as completion). Surfaced here
58
+ * only so a host can read the current mode. See the README "Onboarding mode" note.
59
+ */
60
+ type OnboardingMode = "ai" | "static" | "off";
61
+ /**
62
+ * The resolved controls object. Every field is always present after parsing (missing server
63
+ * keys are filled with the fail-open default), so consumers read `flags.coachmarks.enabled`
64
+ * without guarding for absence.
65
+ */
66
+ interface WireFeatures {
67
+ /** Coachmarks / gesture hints (kit-gated in CoachmarkProvider + the overlay host). */
68
+ coachmarks: {
69
+ enabled: boolean;
70
+ };
71
+ /** Pre-onboarding + post-onboarding value bridge (kit-gated in FeatureShowcase). */
72
+ showcase: {
73
+ enabled: boolean;
74
+ };
75
+ /** Onboarding flow. Server-owned branch — informational for the kit (no gating). */
76
+ onboarding: {
77
+ mode: OnboardingMode;
78
+ };
79
+ /** In-app review master switch (kit-gated in useReviewGate / ReviewGate). */
80
+ review: {
81
+ enabled: boolean;
82
+ };
83
+ /** Pre-onboarding questionnaire master switch (kit-gated in the questionnaire module). */
84
+ questionnaire: {
85
+ enabled: boolean;
86
+ };
87
+ /** Reserved — the announcements module is not built yet. No kit surface reads it. */
88
+ announcements: {
89
+ enabled: boolean;
90
+ };
91
+ }
92
+ /**
93
+ * What `fetchWireFeatures` / `useWireFeatures` need to reach the control plane. Same tenant
94
+ * creds as the onboarding flow (`WireOnboardingConfig.serverUrl` + `apiKey`); `storage` is the
95
+ * OPTIONAL last-known cache channel (the same AsyncStorage-compatible subset the session uses).
96
+ */
97
+ interface WireFeaturesConfig {
98
+ /** Base server URL (same as `WireOnboardingConfig.serverUrl`); `/v1/features` is appended. */
99
+ serverUrl?: string;
100
+ /** Tenant API key; sent as `Authorization: Bearer`. */
101
+ apiKey?: string;
102
+ /**
103
+ * App id — scopes the cache key so one device caching flags for two tenants never collides.
104
+ * Optional; falls back to a shared `default` bucket when absent.
105
+ */
106
+ appId?: string;
107
+ /**
108
+ * Host-injected storage (AsyncStorage/MMKV subset) for the last-known-flags cache. Omit and
109
+ * the module still works — it just has no cache to fall back to (defaults on failure).
110
+ */
111
+ storage?: WireOnboardingStorage;
112
+ /** Network timeout in ms before the fetch is abandoned to the fail-open fallback. Default 4000. */
113
+ timeoutMs?: number;
114
+ }
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 };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Shared types for the coachmark / guided-tour overlay engine.
3
+ *
4
+ * Lifted from the Myelino app engine and made kit-generic: the app supplies the
5
+ * anchors + catalog + copy, the kit owns the animation/measure/queue mechanics.
6
+ * Dependency-free on purpose so the type surface can be imported anywhere.
7
+ */
8
+ /** The animated hand/gesture shown over or beside a highlighted target. */
9
+ type GestureKind = "swipe_up" | "swipe_down" | "swipe_left" | "swipe_right" | "tap" | "double_tap" | "pinch" | "zoom" | "none";
10
+ /** Which side of the highlighted target the tooltip pill sits on. */
11
+ type Placement = "top" | "bottom" | "left" | "right" | "center";
12
+ /** A measured on-screen rectangle (window coordinates from measureInWindow). */
13
+ interface TargetRect {
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ }
19
+ /**
20
+ * The host-injected gate storage. SYNCHRONOUS on purpose — a coachmark's
21
+ * "seen?" gate must resolve during render with no async flash (otherwise a ring
22
+ * momentarily paints before the read resolves and says "already seen"). MMKV's
23
+ * `getString`/`set` fit as-is; an in-memory `Map` wrapper works for tests. This
24
+ * is deliberately separate from the async `WireOnboardingStorage` used for
25
+ * session persistence.
26
+ */
27
+ interface CoachmarkStorage {
28
+ getItem(key: string): string | null;
29
+ setItem(key: string, value: string): void;
30
+ }
31
+ /**
32
+ * One step in a guided tour. `anchorId` is looked up in the anchor registry at
33
+ * fire time; omit it for a centered, target-less hint (e.g. a scroll gesture).
34
+ * `id` doubles as the analytics name for the step.
35
+ */
36
+ interface CoachmarkStep {
37
+ id: string;
38
+ message: string;
39
+ gesture?: GestureKind;
40
+ placement?: Placement;
41
+ anchorId?: string;
42
+ /** Extra action when the step is engaged (e.g. navigate to another tab). */
43
+ onEngage?: () => void;
44
+ }
45
+
46
+ export type { CoachmarkStorage as C, GestureKind as G, Placement as P, TargetRect as T, CoachmarkStep as a };