@wireai/activation 0.13.2 → 0.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/AGENTS.md +6 -3
  2. package/CHANGELOG.md +291 -4
  3. package/INTEGRATION_PROMPT.md +7 -1
  4. package/README.md +68 -2
  5. package/dist/analytics/index.d.mts +86 -6
  6. package/dist/analytics/index.d.ts +86 -6
  7. package/dist/analytics/index.js +271 -472
  8. package/dist/analytics/index.js.map +1 -1
  9. package/dist/analytics/index.mjs +269 -471
  10. package/dist/analytics/index.mjs.map +1 -1
  11. package/dist/coachmarks/index.d.mts +15 -2
  12. package/dist/coachmarks/index.d.ts +15 -2
  13. package/dist/coachmarks/index.js +58 -14
  14. package/dist/coachmarks/index.js.map +1 -1
  15. package/dist/coachmarks/index.mjs +58 -14
  16. package/dist/coachmarks/index.mjs.map +1 -1
  17. package/dist/{currentSession-ClkLjcJ0.d.mts → currentSession-DgJf0fRz.d.mts} +4 -4
  18. package/dist/{currentSession-DOVZEWJl.d.ts → currentSession-EOHU64QD.d.ts} +4 -4
  19. package/dist/{decision-Bl_M2y3r.d.mts → decision-Bgo17oH7.d.mts} +1 -1
  20. package/dist/{decision-Cau5KmP6.d.ts → decision-Bkh_LigV.d.ts} +1 -1
  21. package/dist/index.d.mts +27 -4
  22. package/dist/index.d.ts +27 -4
  23. package/dist/index.js +224 -575
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +221 -572
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/questionnaire/index.d.mts +43 -11
  28. package/dist/questionnaire/index.d.ts +43 -11
  29. package/dist/questionnaire/index.js +45 -13
  30. package/dist/questionnaire/index.js.map +1 -1
  31. package/dist/questionnaire/index.mjs +45 -13
  32. package/dist/questionnaire/index.mjs.map +1 -1
  33. package/dist/reviews/index.d.mts +5 -5
  34. package/dist/reviews/index.d.ts +5 -5
  35. package/dist/reviews/index.js +31 -9
  36. package/dist/reviews/index.js.map +1 -1
  37. package/dist/reviews/index.mjs +31 -9
  38. package/dist/reviews/index.mjs.map +1 -1
  39. package/dist/showcase/index.d.mts +1 -1
  40. package/dist/showcase/index.d.ts +1 -1
  41. package/dist/showcase/index.js +7 -2
  42. package/dist/showcase/index.js.map +1 -1
  43. package/dist/showcase/index.mjs +7 -2
  44. package/dist/showcase/index.mjs.map +1 -1
  45. package/dist/{transport-CF_eHwzC.d.mts → transport-B_0SgCBe.d.ts} +44 -5
  46. package/dist/{transport-DsRe4epC.d.ts → transport-j5gFfJhK.d.mts} +44 -5
  47. package/dist/{types-CKFhyrMu.d.mts → types-BpwiRpA8.d.mts} +1 -1
  48. package/dist/{types-CKFhyrMu.d.ts → types-BpwiRpA8.d.ts} +1 -1
  49. package/dist/{types-CNUqMK0D.d.mts → types-Cju-1_jT.d.mts} +42 -2
  50. package/dist/{types-Buj9Lw9t.d.ts → types-h2BZvl1t.d.ts} +42 -2
  51. package/llms.txt +1 -1
  52. package/package.json +6 -1
  53. package/src/OnboardingFlow.tsx +44 -15
  54. package/src/WireOnboarding.tsx +7 -6
  55. package/src/activation/revalidation.ts +9 -1
  56. package/src/activation/wireActivation.ts +3 -3
  57. package/src/analytics/analyticsFacade.ts +2 -2
  58. package/src/analytics/currentSession.ts +10 -0
  59. package/src/analytics/eventQueue.ts +88 -20
  60. package/src/analytics/index.ts +6 -0
  61. package/src/analytics/reportClientEvent.ts +29 -7
  62. package/src/analytics/wireDoctor.ts +330 -0
  63. package/src/cards/CardGridSelectCard.tsx +1 -1
  64. package/src/cards/ChipSelectCard.tsx +2 -2
  65. package/src/cards/SelectionCard.tsx +1 -1
  66. package/src/coachmarks/runtime.ts +72 -3
  67. package/src/coachmarks/useCoachmarkTour.ts +62 -14
  68. package/src/context/deviceId.ts +14 -5
  69. package/src/features/WireFeaturesProvider.tsx +12 -1
  70. package/src/identity/identityRecord.ts +9 -1
  71. package/src/identity/userIdentity.ts +1 -1
  72. package/src/questionnaire/QuestionnaireGate.tsx +90 -10
  73. package/src/questionnaire/index.ts +9 -1
  74. package/src/questionnaire/transport.ts +46 -11
  75. package/src/reviews/ReviewGate.tsx +61 -6
  76. package/src/reviews/index.ts +10 -1
  77. package/src/reviews/runtime.ts +11 -1
  78. package/src/reviews/transport.ts +58 -12
  79. package/src/session-analytics/useLifecycleEvents.ts +1 -1
  80. package/src/theme/ThemeContext.tsx +49 -1
  81. package/src/types.ts +1 -1
  82. package/src/utils/submitResult.ts +39 -0
@@ -1,10 +1,10 @@
1
- export { R as ReportAppEventOptions, r as reportAppEvent } from '../transport-DsRe4epC.js';
2
- import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-DOVZEWJl.js';
3
- export { A as AUTO_DEVICE_ID_PREFIX, a as AnalyticsEvent, C as ClearUserContextOptions, b as ClientEvent, c as ClientEventTarget, d as ClientEventType, e as ContextEnvelope, f as ContextEnvelopeInput, D as DeviceKeyStorage, g as EnvelopeSource, h as EventQueue, R as ResolveAutoDeviceKeyOptions, i as WIRE_ONBOARDING_EVENTS, j as WireOnboardingEventName, k as analyticsUserIdStorageKey, l as buildContextEnvelope, m as clearPiiFromContext, n as clearUserContext, o as createEventQueue, p as deviceIdStorageKey, q as ensureCurrentSessionId, r as getCurrentSessionId, s as looksLikeEmail, t as makeSessionId, u as reportClientEvent, v as reportClientEventAwait, w as reportClientEvents, x as reportClientEventsAwait, y as resetAutoDeviceKeys, z as resetCurrentSessionId, B as resetEventQueueKeys, F as resolveAutoDeviceKey, G as setCurrentSessionId, H as toAnalyticsEvent } from '../currentSession-DOVZEWJl.js';
4
- import '../types-Buj9Lw9t.js';
1
+ export { R as ReportAppEventOptions, r as reportAppEvent } from '../transport-B_0SgCBe.js';
2
+ import { C as ClientEventTarget, W as WireUserContext, E as EventQueueOptions } from '../currentSession-EOHU64QD.js';
3
+ export { A as AUTO_DEVICE_ID_PREFIX, a as AnalyticsEvent, b as ClearUserContextOptions, c as ClientEvent, d as ClientEventType, e as ContextEnvelope, f as ContextEnvelopeInput, D as DeviceKeyStorage, g as EnvelopeSource, h as EventQueue, R as ResolveAutoDeviceKeyOptions, i as WIRE_ONBOARDING_EVENTS, j as WireOnboardingEventName, k as analyticsUserIdStorageKey, l as buildContextEnvelope, m as clearPiiFromContext, n as clearUserContext, o as createEventQueue, p as deviceIdStorageKey, q as ensureCurrentSessionId, r as getCurrentSessionId, s as looksLikeEmail, t as makeSessionId, u as reportClientEvent, v as reportClientEventAwait, w as reportClientEvents, x as reportClientEventsAwait, y as resetAutoDeviceKeys, z as resetCurrentSessionId, B as resetEventQueueKeys, F as resolveAutoDeviceKey, G as setCurrentSessionId, H as toAnalyticsEvent } from '../currentSession-EOHU64QD.js';
4
+ import { W as WireOnboardingStorage } from '../types-BpwiRpA8.js';
5
+ import '../types-h2BZvl1t.js';
5
6
  import '../types-BKfpdZzX.js';
6
7
  import '../types-BcmagF6K.js';
7
- import '../types-CKFhyrMu.js';
8
8
  import 'react';
9
9
  import 'wireai-rn';
10
10
  import 'react-native';
@@ -95,6 +95,86 @@ interface NavigationRefLike {
95
95
  */
96
96
  declare const useScreenTracking: (navigationRef: NavigationRefLike | undefined, options?: ScreenTrackerOptions) => void;
97
97
 
98
+ /**
99
+ * wireDoctor: a DEV-ONLY, opt-in self-check that proves a fresh integration end to end before the
100
+ * first real user ever runs it.
101
+ *
102
+ * WHY IT EXISTS: the `/v1/events` endpoint answers HTTP **200** for a batch it throws away. It
103
+ * reports the refusal in the response body (`{written, skipped, errors:[{reason, field}]}`), so a
104
+ * mis-wired integration looks perfectly healthy from the outside while every event evaporates. A
105
+ * numeric `ts` did exactly that through 0.13.0. This turns that class of loss from something you
106
+ * discover in a funnel report weeks later into something the first run tells you.
107
+ *
108
+ * SHAPE: four independent checks, each a `{name, ok, detail}` unit that can be read (and tested)
109
+ * without the others. The report is data, never a thrown error and never a side effect on the host:
110
+ *
111
+ * 1. `target` : is there a server URL and a key, and do they look like a key and a URL?
112
+ * 2. `reachability`: is the server actually there? (`GET /v1/events/contract`, public and cheap)
113
+ * 3. `storage` : can the offline queue persist? (a write / read / delete probe)
114
+ * 4. `round_trip` : does a REAL event survive REAL server validation? (a `dry_run` POST)
115
+ *
116
+ * NEVER THROWS, under any input, any network condition, or any hostile response object. A doctor
117
+ * that can crash the screen it is diagnosing is worse than no doctor.
118
+ *
119
+ * ⛔ NEVER PRINTS A SECRET. The `target` check reports the key's SHAPE (present / absent, length,
120
+ * whether the prefix is the expected one) and never any character of the key itself, in any
121
+ * `detail`, any log line, or any error. `wireDoctor.test.ts` asserts that with a sentinel key.
122
+ *
123
+ * COSTS A NON-CALLER NOTHING: it is a plain function behind the `./analytics` subpath, the package
124
+ * is `sideEffects: false`, and this module has no top-level side effects, so a host that never
125
+ * imports it never bundles it. It also mints no `globalThis` slot and retains no timer or listener.
126
+ *
127
+ * USAGE (dev builds only):
128
+ *
129
+ * import { wireDoctor } from "@wireai/activation/analytics";
130
+ *
131
+ * const report = await wireDoctor({
132
+ * target: { serverUrl: "https://api.example.com", apiKey: DRIVELINE_KEY },
133
+ * storage: AsyncStorage,
134
+ * });
135
+ * console.log(report.ok, report.checks);
136
+ */
137
+
138
+ /** One diagnosis. `name` is stable and machine-readable; `detail` is for a human reading a console. */
139
+ type WireDoctorCheck = {
140
+ /**
141
+ * Stable id: `target` | `reachability` | `storage` | `round_trip` | `dev_only` | `internal_error`.
142
+ *
143
+ * `dev_only` means ONE thing and only that thing: `__DEV__` is unset or false, so nothing ran.
144
+ * `internal_error` is the separate catch-all for a failure that got past every check's own
145
+ * swallow. They are distinct names because a consumer branching on `dev_only` would otherwise
146
+ * read an internal fault as "this is a release build" and report a healthy skip.
147
+ */
148
+ name: string;
149
+ ok: boolean;
150
+ /** Human-readable result. ⛔ Never contains any part of an API key. */
151
+ detail: string;
152
+ };
153
+ /** What {@link wireDoctor} resolves to. `ok` is true only when EVERY check passed. */
154
+ type WireDoctorReport = {
155
+ ok: boolean;
156
+ checks: WireDoctorCheck[];
157
+ };
158
+ /** Input for {@link wireDoctor}. `storage` is optional: without it the queue runs in-memory only. */
159
+ type WireDoctorOptions = {
160
+ /** The same `{serverUrl, apiKey}` the kit is configured with. */
161
+ target: ClientEventTarget | undefined;
162
+ /**
163
+ * The host storage the offline queue would use (AsyncStorage-compatible). Omit it and the storage
164
+ * check reports the DEGRADED in-memory mode rather than failing.
165
+ */
166
+ storage?: WireOnboardingStorage;
167
+ };
168
+ /**
169
+ * Run the full diagnosis. Resolves a report; NEVER throws and NEVER rejects.
170
+ *
171
+ * DEV-ONLY BY CONTRACT: the `__DEV__` guard is the FIRST statement, so a release build performs no
172
+ * network call, no storage write, and no work at all. The report says it was skipped rather than
173
+ * pretending everything passed, because a green report that never ran is the exact failure mode
174
+ * this whole feature exists to remove.
175
+ */
176
+ declare const wireDoctor: (options: WireDoctorOptions) => Promise<WireDoctorReport>;
177
+
98
178
  /** Arbitrary non-PII event properties. Serialized to the event's `meta` (a JSON string) on the wire. */
99
179
  type AnalyticsProps = Record<string, unknown>;
100
180
  /**
@@ -203,4 +283,4 @@ declare const createAnalytics: (config: CreateAnalyticsConfig, options?: Analyti
203
283
  */
204
284
  declare const useAnalytics: (config: CreateAnalyticsConfig, options?: AnalyticsOptions) => Analytics;
205
285
 
206
- export { type Analytics, type AnalyticsOptions, type AnalyticsProps, type CreateAnalyticsConfig, EventQueueOptions, type NavigationRefLike, type NavigationRouteLike, type NavigationStateLike, type ScreenTracker, type ScreenTrackerOptions, createAnalytics, createScreenTracker, getActiveRouteName, screenTrackingHandler, useAnalytics, useScreenTracking };
286
+ export { type Analytics, type AnalyticsOptions, type AnalyticsProps, ClientEventTarget, type CreateAnalyticsConfig, EventQueueOptions, type NavigationRefLike, type NavigationRouteLike, type NavigationStateLike, type ScreenTracker, type ScreenTrackerOptions, type WireDoctorCheck, type WireDoctorOptions, type WireDoctorReport, createAnalytics, createScreenTracker, getActiveRouteName, screenTrackingHandler, useAnalytics, useScreenTracking, wireDoctor };