@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,213 @@
1
+ import React__default from 'react';
2
+ import { R as ReviewGateProps, b as ReviewPresentation, U as UseReviewGateOptions, c as ReviewGateController, d as ReviewDecision, f as ReviewStoreConfig, g as ReviewTarget, h as ReviewSubmission } from '../decision-CFvGY6nP.js';
3
+ export { G as GateRules, a as GateSignals, i as RatingRoute, j as ReviewConfig, k as ReviewGateEvent, l as ReviewGateEventName, m as buildReviewSubmission, n as decideReview, e as evaluateGate, r as resolveRules, o as routeRating } from '../decision-CFvGY6nP.js';
4
+ export { C as ReviewModal, a as ReviewModalHandle, b as ReviewModalProps } from '../CenteredModal-Cdgns6--.js';
5
+ import { c as OnboardingFonts } from '../types-BKfpdZzX.js';
6
+ import '../types-GL_hQ0TN.js';
7
+ import '../types-CMuOexw0.js';
8
+
9
+ /**
10
+ * Runtime helpers for the review gate: the `wire_review_*` gate keys and small
11
+ * typed storage accessors. The gate reuses the SAME injected sync storage + global
12
+ * testing flag as the coachmark engine (see coachmarks/runtime), so a host that
13
+ * mounted CoachmarkProvider gets review gating for free — no second storage to wire.
14
+ */
15
+
16
+ /** Once-gate key. Keyed by app version when `oncePerVersion` is on, so a new release re-enables. */
17
+ declare const reviewSeenKey: (id: string, version?: string) => string;
18
+ /** Last-shown timestamp key (epoch ms), for the cooldown rule. */
19
+ declare const reviewLastShownKey: (id: string) => string;
20
+ /** Session-count key, incremented once per gate mount, for the min-sessions rule. */
21
+ declare const reviewSessionsKey: (id: string) => string;
22
+
23
+ /**
24
+ * ReviewGate — the in-app review sentiment gate UI.
25
+ *
26
+ * A NEUTRAL prompt ("Enjoying <app>?") over five tappable stars. The honest split:
27
+ * • 5 stars → the native store review (expo-store-review when available, else the
28
+ * configured store URL). Fires `store_review_requested`.
29
+ * • 1-4 stars → a feather-light feedback form: TWO optional inputs, the "why this
30
+ * rating" opinion box (~4 lines) and a smaller "what can you suggest" box, POSTed
31
+ * to the Wire server (`feedback_text` + `suggestion`). The rating is the only
32
+ * mandatory action, so Send works with either box, both, or neither. Warm
33
+ * thank-you state, never a dead end.
34
+ *
35
+ * The form NEVER asks for identity (no name / email / contact field): the host already
36
+ * identifies the user via `sessionId` + `meta` (e.g. user_id, device_key), which is all
37
+ * the POST body carries alongside the rating and the free text.
38
+ *
39
+ * Every visual value comes from the OnboardingTheme (useOnboardingTheme). Analytics are
40
+ * callback-based (mirroring the coachmark convention): the host wires `onEvent` to its own
41
+ * analytics. No PII in events — feedback text goes ONLY in the POST body.
42
+ *
43
+ * Store-policy: `requestReview` is quota'd and never guaranteed to show; it is called ONLY
44
+ * on the 5-star path, never from a "rate us 5 stars" button. See the README notes.
45
+ */
46
+
47
+ declare const ReviewGate: React__default.FC<ReviewGateProps>;
48
+
49
+ /**
50
+ * centeredModalMotion - the pure entrance spec for the content-agnostic CenteredModal shell.
51
+ *
52
+ * WHY split out: the shell UI (CenteredModal) is RN and cannot run under the kit's node:test
53
+ * runner, but the entrance math is pure and worth pinning. Keep the animation spec here so both
54
+ * the component and the tests read one source, and so any module (reviews, questionnaire) can
55
+ * reuse the shell without depending on another feature module.
56
+ *
57
+ * The centered popup uses RN's built-in `Animated` (native driver), the same idiom as
58
+ * CompletionView/CardHandoff, so the shell stays dependency-free (no reanimated).
59
+ *
60
+ * NOTE: `reviews/presentation.ts` re-exports these under their original names
61
+ * (`REVIEW_MODAL_ANIM`, `entranceFrame`) for back-compat with the reviews public API.
62
+ */
63
+ /**
64
+ * The entrance spec for the centered popup. Values chosen to match the boilerplate's
65
+ * `animated-modal` feel (a springy zoom-in) with the kit's own native-driver idiom:
66
+ * • backdrop fades 0 -> `backdropOpacity`
67
+ * • card springs from `scaleFrom` -> 1 and fades 0 -> 1
68
+ */
69
+ declare const CENTERED_MODAL_ANIM: {
70
+ /** Spring config for the card scale/opacity entrance (mirrors CompletionView's pop). */
71
+ readonly enterSpring: {
72
+ readonly friction: 7;
73
+ readonly tension: 80;
74
+ };
75
+ /** Exit timing in ms (fade + shrink back out before unmount). */
76
+ readonly exitMs: 160;
77
+ /** Card scale at rest (progress 0); grows to 1 at progress 1. */
78
+ readonly scaleFrom: 0.9;
79
+ /** Peak dim of the backdrop at progress 1. */
80
+ readonly backdropOpacity: 0.55;
81
+ };
82
+ /** A single frame of the entrance, for a progress value in [0..1] (clamped). Pure, testable. */
83
+ declare const centeredModalFrame: (progress: number, backdropMax?: number) => {
84
+ cardOpacity: number;
85
+ cardScale: number;
86
+ backdropOpacity: number;
87
+ };
88
+
89
+ /**
90
+ * presentation.ts — the pure presentation + entrance-animation logic for the review gate.
91
+ *
92
+ * WHY split out: the gate UI (ReviewGate/ReviewModal) is RN and can't run under the kit's
93
+ * node:test runner, but the presentation DEFAULT and the entrance math are pure and worth
94
+ * pinning. Keep the animation spec here so both the component and the tests read one source.
95
+ *
96
+ * The centered popup uses RN's built-in `Animated` (native driver) — the same idiom as
97
+ * CompletionView/CardHandoff — so the reviews module stays dependency-free (no reanimated).
98
+ */
99
+
100
+ /** Centered popup by default (Malik's ruling: the bottom-anchored inline card read as wrong). */
101
+ declare const DEFAULT_PRESENTATION: ReviewPresentation;
102
+ /** Resolve the presentation prop → the effective mode. Absent → the centered modal. */
103
+ declare const resolvePresentation: (p?: ReviewPresentation) => ReviewPresentation;
104
+
105
+ declare const useReviewGate: ({ config: configProp, decision: decisionProp, events, storage, isTesting, features, featuresConfig, }: UseReviewGateOptions) => ReviewGateController;
106
+
107
+ /**
108
+ * equality.ts — tiny, dependency-free value-equality helpers used to STABILIZE
109
+ * references across renders.
110
+ *
111
+ * WHY this exists: real integrators pass inline objects — `config={{ id: 'x' }}`,
112
+ * `decision={{ fire: true }}` — whose IDENTITY changes every render even though
113
+ * their VALUES do not. If the review hook let those unstable references flow into
114
+ * a `useMemo`/`useEffect` dependency list (or handed a fresh verdict object back
115
+ * every render), a host that depends on the returned value would re-run its own
116
+ * effect forever → "Maximum update depth exceeded". A library must tolerate inline
117
+ * props without looping; these helpers are how the hook holds a stable reference
118
+ * whenever the underlying values are unchanged.
119
+ *
120
+ * Pure (no React import) so it runs under the kit's node:test runner.
121
+ */
122
+
123
+ /**
124
+ * One-level value-equality of two plain objects (or primitives). Same-reference is
125
+ * equal; two objects are equal when they have the same keys and each value is
126
+ * `Object.is`-equal. Good enough for the flat `config` / `decision` shapes the gate
127
+ * accepts (all leaf values are primitives).
128
+ */
129
+ declare const shallowEqual: (a: unknown, b: unknown) => boolean;
130
+ /**
131
+ * Structural equality of two review verdicts by their contract fields (`fire`,
132
+ * `reason`). A `null`/`undefined` verdict equals only another absent one. Used to
133
+ * decide whether the hook can keep returning the SAME verdict object (so a host
134
+ * that lists `controller.decision` in an effect dep array never loops).
135
+ */
136
+ declare const sameDecision: (a?: ReviewDecision | null, b?: ReviewDecision | null) => boolean;
137
+
138
+ /**
139
+ * feedbackForm — pure sizing helpers for the 1–4★ feedback form, kept out of the
140
+ * React component so the "≈4 lines tall, capped at 5" rule is verifiable in
141
+ * isolation (the reviews module's correctness lives in these pure functions, the
142
+ * same convention as `decision.ts` / `presentation.ts`).
143
+ *
144
+ * Malik's ask: the feedback field should be a multiline box "around 3 to 5 lines"
145
+ * tall, not a single-line input. We size it from the theme's body line-height so
146
+ * it scales with the app's font config.
147
+ */
148
+
149
+ /** Lines the box shows at rest, and the cap it can grow to. */
150
+ declare const FEEDBACK_MIN_LINES = 4;
151
+ declare const FEEDBACK_MAX_LINES = 5;
152
+ interface FeedbackInputHeights {
153
+ /** Resting height — the box opens at ~4 lines so it reads as "write a few words". */
154
+ minHeight: number;
155
+ /** Growth cap — it never balloons past ~5 lines; scroll takes over beyond that. */
156
+ maxHeight: number;
157
+ }
158
+ /**
159
+ * Derive the multiline feedback box's min/max height from the theme's body
160
+ * line-height. `minHeight = MIN_LINES × lineHeight`, capped at
161
+ * `MAX_LINES × lineHeight`, plus the field's vertical padding (top + bottom) so
162
+ * the requested number of text lines is actually visible inside the padding.
163
+ */
164
+ declare const feedbackInputHeights: (fonts: OnboardingFonts, verticalPadding?: number) => FeedbackInputHeights;
165
+
166
+ /** The store deep-link for the current platform, or null if none is configured. */
167
+ declare const storeUrl: (store: ReviewStoreConfig | undefined) => string | null;
168
+ /** Open the configured store listing. Best-effort; resolves false if there was nothing to open. */
169
+ declare const openStoreListing: (store: ReviewStoreConfig | undefined) => Promise<boolean>;
170
+ /**
171
+ * Request the native in-app review when the optional peer is available; otherwise open the
172
+ * store listing. Returns the path taken so the caller can fire the right analytics.
173
+ */
174
+ declare const requestStoreReview: (store?: ReviewStoreConfig) => Promise<"native" | "store_url" | "none">;
175
+
176
+ /**
177
+ * transport.ts — kit → Wire server requests for the review module, all fire-and-forget
178
+ * (analytics/reviews must never break the app). Mirrors analytics/reportClientEvent: a
179
+ * thin fetch wrapper, Bearer tenant key, swallow every error.
180
+ *
181
+ * • submitReview → POST {serverUrl}/v1/reviews (the 1-4 feedback body)
182
+ * • reportAppEvent → POST {serverUrl}/v1/events (generic app.* namespace)
183
+ *
184
+ * `reportAppEvent` is the strategic extension: it lets a host report arbitrary in-app
185
+ * events through the SAME transport (stored server-side as event_type='app_event',
186
+ * question_key=<name>), which is what the backend review-firing rules evaluate on — and
187
+ * it seeds the broader app-analytics stream. Keep payloads minimal + non-PII.
188
+ */
189
+
190
+ /**
191
+ * POST a review (the 1-4 feedback path). Fire-and-forget: a missing target, a build error,
192
+ * a missing `fetch`, or a network failure is swallowed and the call returns immediately.
193
+ */
194
+ declare const submitReview: (target: ReviewTarget | undefined, review: ReviewSubmission) => void;
195
+ /** Options for a reported app event. `deviceKey` groups a device's sessions server-side. */
196
+ interface ReportAppEventOptions {
197
+ /** The onboarding/session id to correlate with, when known. */
198
+ sessionId?: string;
199
+ /** A stable, non-PII device id — the review-decision endpoint reads it for min-sessions. */
200
+ deviceKey?: string;
201
+ /** Small non-PII extras. */
202
+ meta?: Record<string, unknown>;
203
+ }
204
+ /**
205
+ * Report a generic in-app event through the existing events transport. Stored server-side
206
+ * as `event_type='app_event'`, `question_key=<name>`. Fire-and-forget. Keep `name` a short
207
+ * stable identifier and `meta` small + non-PII.
208
+ *
209
+ * reportAppEvent(target, "content_share", { sessionId, deviceKey });
210
+ */
211
+ declare const reportAppEvent: (target: ReviewTarget | undefined, name: string, options?: ReportAppEventOptions) => void;
212
+
213
+ export { DEFAULT_PRESENTATION, FEEDBACK_MAX_LINES, FEEDBACK_MIN_LINES, type FeedbackInputHeights, CENTERED_MODAL_ANIM as REVIEW_MODAL_ANIM, type ReportAppEventOptions, ReviewDecision, ReviewGate, ReviewGateController, ReviewGateProps, ReviewPresentation, ReviewStoreConfig, ReviewSubmission, ReviewTarget, UseReviewGateOptions, centeredModalFrame as entranceFrame, feedbackInputHeights, openStoreListing, reportAppEvent, requestStoreReview, resolvePresentation, reviewLastShownKey, reviewSeenKey, reviewSessionsKey, sameDecision, shallowEqual, storeUrl, submitReview, useReviewGate };