@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
package/AGENTS.md ADDED
@@ -0,0 +1,73 @@
1
+ # AGENTS.md — wireai-onboarding (agent integration brief)
2
+
3
+ > For an AI agent asked to **install / integrate / consume** this package in a host app.
4
+ > Everything you need to wire it correctly without reading the source is here.
5
+ > (Editing this kit's *own* source instead? Read `CLAUDE.md` — different job.)
6
+ > Full prose + examples: `README.md` → "How to include it in an app (end-to-end)".
7
+
8
+ ## What it is (the goal)
9
+
10
+ A **drop-in React Native onboarding kit** over the OSS `wireai-rn` SDK. One component,
11
+ `<WireOnboarding>`, runs an entire **AI-driven, backend-orchestrated** first-run flow:
12
+ themed native cards (chosen by an LLM, one per turn over A2A), a progress bar, a mid-flow
13
+ value screen, per-step validation, and a completion recap — ending with the user's
14
+ structured answers for the app to persist. The host supplies a tenant config, a theme,
15
+ and brand artwork; the kit owns the flow. **Nearly pure JS — no reanimated, no SVG/icon
16
+ deps.** Peers: `react`, `react-native`, `wireai-rn`, `zod`, and `react-native-safe-area-context`
17
+ (>=4.0.0, for safe-area insets; the host must render a `SafeAreaProvider` ancestor — every
18
+ Expo/RN app already ships it).
19
+
20
+ Use it whenever someone wants "AI / dynamic / personalized onboarding" in an RN/Expo app.
21
+
22
+ ## Public API (import from `wireai-onboarding`)
23
+
24
+ - `WireOnboarding` — the component (props below).
25
+ - `DemoOnboarding` — dev/QA modal trigger to run the flow on demand (no account, re-runnable; place in a `__DEV__` Settings row). Props: `config` (or `null`), `theme`, `illustrations`, `label?`, `onComplete?`, `renderTrigger?`.
26
+ - `wireConfigFromEnv({ appId })` — build `config` from `EXPO_PUBLIC_WIREAI_*` env; returns `null` if keys missing (use as your gate).
27
+ - `themeFromBrand({ primary })` — derive a full theme from one brand color.
28
+ - `mergeTheme`, `defaultOnboardingTheme`, `OnboardingThemeProvider`, `useOnboardingTheme`.
29
+ - `defaultIllustrations` — dependency-free fallback art; spread your own over it.
30
+ - Types: `OnboardingTheme`, `OnboardingResult`, `OnboardingEvent`, `WireOnboardingConfig`, `StepValidator`, `OnboardingCopy`, `IllustrationRegistry`.
31
+
32
+ ## `<WireOnboarding>` props
33
+
34
+ | Prop | Type | Required | Notes |
35
+ |---|---|---|---|
36
+ | `config` | `{ apiKey, serverUrl, appId, metadata? }` | ✅ | A2A transport. `apiKey` (`wai_…`) resolves the tenant server-side; get it from the getwireai console / `register_<app>.py`. |
37
+ | `onComplete` | `(result: { answers, raw }) => void` | ✅ | Terminal recap CTA tapped. Persist `answers` via your profile-update path, then navigate on. |
38
+ | `theme` | `Partial<OnboardingTheme>` | – | Colors + font family names + radius/spacing, deep-merged over a neutral default. For dark/light, pass a different theme per app theme-state. |
39
+ | `illustrations` | `Record<string, ReactNode>` | – | Host artwork for `InterstitialCard`, keyed by name. `{ ...defaultIllustrations, ...myArt }`. |
40
+ | `validators` | `Record<string, StepValidator>` | – | Per base-question key (e.g. `username`). Blocks advance + inline error. |
41
+ | `onSkip` | `() => void` | – | User skipped → navigate on. |
42
+ | `onError` | `(err) => void` | – | Backend error/timeout → host recovery (e.g. static onboarding). Without it, inline retry. |
43
+ | `onEvent` | `(e: OnboardingEvent) => void` | – | `started` / `turn` / `error` — for analytics (kit owns the loop). |
44
+ | `copy` | `Partial<OnboardingCopy>` | – | Localize built-in English strings. |
45
+ | `approxScreens` | `number` | – | Paces the bar; backend `progress.total` wins, so usually unneeded. |
46
+ | `components` | `WireAIComponent[]` | – | Override registered cards (default `onboardingComponents`). |
47
+ | `startMessage` | `string` | – | First backend message. Default `"start"`. |
48
+ | `startTimeoutMs` | `number` | – | First-card watchdog. Default `15000`. |
49
+
50
+ ## Integration steps (ordered)
51
+
52
+ 1. **Tenant key** — create the app in the getwireai console (or run `register_<app>.py`) → `wai_…` key + server URL. Nothing renders without both.
53
+ 2. **Install** — `npm install wireai-onboarding wireai-rn` (react + react-native are peers). A tarball or `git+ssh://…` works for pre-publish/pinned builds.
54
+ 3. **Metro** — `module.exports = withWireOnboarding(getDefaultConfig(__dirname))` (from `wireai-onboarding/metro`); pins one React/RN/wireai-rn/zod copy.
55
+ 4. **Config** — set `EXPO_PUBLIC_WIREAI_API_KEY` / `_SERVER_URL` / `_APP_ID`; build via `wireConfigFromEnv({ appId })`.
56
+ 5. **Fonts** — host must load the font families named in `theme.fonts.regular/medium/bold` (e.g. `expo-font`), else text falls back to system font.
57
+ 6. **Theme** — `themeFromBrand({ primary })` or a full `Partial<OnboardingTheme>`; for dark/light, pick the theme by the app's theme state.
58
+ 7. **Render + continuation** — drop `<WireOnboarding>` into the signup flow; `onComplete` → persist + navigate, `onSkip` → navigate.
59
+ 8. **Gate** — wrap behind a flag (env for dev, remote config for prod) **AND** `config != null`; fall through to existing onboarding when off/unconfigured. Decide who sees it (e.g. new signups only) in host nav logic.
60
+
61
+ ## Gotchas (do not miss)
62
+
63
+ - **EAS / cloud builds:** install via **git URL or registry**, never a local `file:` path *outside the app repo* — EAS won't resolve it.
64
+ - **Single React copy:** always use the `withWireOnboarding` Metro helper (a 2nd React instance crashes RN).
65
+ - **No native rebuild for the kit's own code** (JS + one prebuilt native peer, `react-native-safe-area-context`, that every RN/Expo app already ships). A rebuild is only needed if *your* gating mechanism is a native module (e.g. Firebase Remote Config), or if the app didn't already have safe-area-context installed.
66
+ - **New cards:** registering a card in the kit is not enough — the backend validates emissions; add it to the server `KNOWN_COMPONENTS` + the tenant `allowed_components` (see README → "Backend coupling").
67
+ - **Secrets:** the `apiKey` is a tenant key (safe in the bundle); never log host secrets in `onEvent`.
68
+
69
+ ## Fastest path
70
+
71
+ Run the **`wire-rn-integration`** Claude skill — it performs all the steps above
72
+ automatically (detect conventions → register tenant → install → Metro → theme →
73
+ scaffold screen → wire navigation + fallback → typecheck).