@wireai/activation 0.9.0 → 0.9.2
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.
- package/CHANGELOG.md +39 -0
- package/dist/analytics/index.d.mts +3 -3
- package/dist/analytics/index.d.ts +3 -3
- package/dist/analytics/index.js +9 -5
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +9 -5
- package/dist/analytics/index.mjs.map +1 -1
- package/dist/{currentSession-Bs2JfTJ8.d.mts → currentSession-CRRQLbAq.d.mts} +16 -0
- package/dist/{currentSession-61dcm3V-.d.ts → currentSession-Dj0cN3Rg.d.ts} +16 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/dist/questionnaire/index.js +2 -1
- package/dist/questionnaire/index.js.map +1 -1
- package/dist/questionnaire/index.mjs +2 -1
- package/dist/questionnaire/index.mjs.map +1 -1
- package/dist/reviews/index.d.mts +1 -1
- package/dist/reviews/index.d.ts +1 -1
- package/dist/reviews/index.js.map +1 -1
- package/dist/reviews/index.mjs.map +1 -1
- package/dist/{transport-DzU-TqZz.d.ts → transport-B31G0Cib.d.ts} +51 -9
- package/dist/{transport-f5VVB5hH.d.mts → transport-Bzb-bcB2.d.mts} +51 -9
- package/package.json +1 -1
- package/src/WireOnboarding.tsx +15 -4
- package/src/analytics/eventQueue.ts +28 -9
- package/src/questionnaire/transport.ts +9 -1
- package/src/reviews/transport.ts +51 -9
- package/src/session/persistedSession.ts +17 -0
- package/src/types.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
All notable changes to `@wireai/activation` (formerly `wireai-onboarding`).
|
|
4
4
|
Historical entries below the rename keep the old package name on purpose.
|
|
5
5
|
|
|
6
|
+
## [0.9.1] — 2026-07-17
|
|
7
|
+
|
|
8
|
+
### Fixed: the review-decision wire is now documented as it actually is
|
|
9
|
+
|
|
10
|
+
No API change — `fetchReviewDecision` and `FetchReviewDecisionOptions` are byte-compatible
|
|
11
|
+
with 0.9.0. What changes is that the kit stops asserting things about the server that are not
|
|
12
|
+
true, and pins the wire with tests.
|
|
13
|
+
|
|
14
|
+
- **The "prod 422s without `session_id`" comment was stale and is corrected.** The server
|
|
15
|
+
relaxed `session_id` to optional on 2026-07-16 and the relaxation **is deployed**: the live
|
|
16
|
+
route declares `session_id` as `required: false`, and an unauthenticated call carrying no
|
|
17
|
+
params at all answers `401`, not `422` — query validation runs before the handler's auth
|
|
18
|
+
check, so a required param would have 422'd first. A session-less review gate reaches the
|
|
19
|
+
firing brain today.
|
|
20
|
+
- **`FetchReviewDecisionOptions` stays closed at `sessionId` / `deviceKey` — deliberately.**
|
|
21
|
+
The deployed `GET /v1/reviews/decision` declares exactly those two query params plus the
|
|
22
|
+
`Authorization` header. Hosts that hand-rolled this fetch invented `user_id` and
|
|
23
|
+
`session_count` params on the belief that "the server ignores what it doesn't read, so
|
|
24
|
+
passing it is always safe". They are no-ops: the route declares neither, and `session_count`
|
|
25
|
+
appears nowhere in the deployed API. Adding them to the kit would have made the call site
|
|
26
|
+
read as though identity and a session counter reach the firing brain when neither does.
|
|
27
|
+
Identity goes in `deviceKey`; a client-side session floor is `ReviewConfig.minSessions`.
|
|
28
|
+
- **`arm` is documented as load-bearing.** `fetchReviewDecision` already returns
|
|
29
|
+
`ReviewDecisionResponse` (`{fire, reason, arm}`). Narrowing it to `{fire, reason}` on the way
|
|
30
|
+
to the gate silently kills per-arm attribution across a reweighting; the docs now say so and
|
|
31
|
+
a regression test pins it.
|
|
32
|
+
- **`timeoutFallbackMs` is surfaced where the race actually happens.** It already exists on
|
|
33
|
+
`ReviewConfig` and is fully implemented in `useReviewGate` (local rules stay parked until the
|
|
34
|
+
decision lands or the window expires). The transport docs now point at it, because a host
|
|
35
|
+
running its own dwell timer in parallel with the fetch builds a race a slow server loses — an
|
|
36
|
+
in-flight `{fire:false}` arrives after the local timer already showed the prompt.
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- `src/reviews/transport.test.ts` — the transport had **no test file at all**. 11 tests pin the
|
|
41
|
+
wire contract (only `session_id` + `device_key` are sent; a session-less call is legal), the
|
|
42
|
+
incident semantics (`{fire:false}` survives, never collapsed to null; `arm` survives), and
|
|
43
|
+
"no opinion is the only null" (non-2xx / non-boolean `fire` / unreachable → `null`).
|
|
44
|
+
|
|
6
45
|
## [0.1.0] — 2026-07-12
|
|
7
46
|
|
|
8
47
|
### Renamed: `wireai-onboarding` is now `@wireai/activation`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { R as ReportAppEventOptions, r as reportAppEvent } from '../transport-
|
|
2
|
-
import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-
|
|
3
|
-
export { A as AnalyticsEvent, C as ClientEvent, a as ClientEventTarget, b as ClientEventType, c as ContextEnvelope, d as ContextEnvelopeInput, e as EnvelopeSource, f as EventQueue, g as WIRE_ONBOARDING_EVENTS, h as WireOnboardingEventName, i as buildContextEnvelope, j as createEventQueue, k as getCurrentSessionId, m as makeSessionId, r as reportClientEvent, l as reportClientEvents, n as resetCurrentSessionId, s as setCurrentSessionId, t as toAnalyticsEvent } from '../currentSession-
|
|
1
|
+
export { R as ReportAppEventOptions, r as reportAppEvent } from '../transport-Bzb-bcB2.mjs';
|
|
2
|
+
import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-CRRQLbAq.mjs';
|
|
3
|
+
export { A as AnalyticsEvent, C as ClientEvent, a as ClientEventTarget, b as ClientEventType, c as ContextEnvelope, d as ContextEnvelopeInput, e as EnvelopeSource, f as EventQueue, g as WIRE_ONBOARDING_EVENTS, h as WireOnboardingEventName, i as buildContextEnvelope, j as createEventQueue, k as getCurrentSessionId, m as makeSessionId, r as reportClientEvent, l as reportClientEvents, n as resetCurrentSessionId, s as setCurrentSessionId, t as toAnalyticsEvent } from '../currentSession-CRRQLbAq.mjs';
|
|
4
4
|
import '../types-CNUqMK0D.mjs';
|
|
5
5
|
import '../types-BKfpdZzX.mjs';
|
|
6
6
|
import '../types-BcmagF6K.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { R as ReportAppEventOptions, r as reportAppEvent } from '../transport-
|
|
2
|
-
import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-
|
|
3
|
-
export { A as AnalyticsEvent, C as ClientEvent, a as ClientEventTarget, b as ClientEventType, c as ContextEnvelope, d as ContextEnvelopeInput, e as EnvelopeSource, f as EventQueue, g as WIRE_ONBOARDING_EVENTS, h as WireOnboardingEventName, i as buildContextEnvelope, j as createEventQueue, k as getCurrentSessionId, m as makeSessionId, r as reportClientEvent, l as reportClientEvents, n as resetCurrentSessionId, s as setCurrentSessionId, t as toAnalyticsEvent } from '../currentSession-
|
|
1
|
+
export { R as ReportAppEventOptions, r as reportAppEvent } from '../transport-B31G0Cib.js';
|
|
2
|
+
import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-Dj0cN3Rg.js';
|
|
3
|
+
export { A as AnalyticsEvent, C as ClientEvent, a as ClientEventTarget, b as ClientEventType, c as ContextEnvelope, d as ContextEnvelopeInput, e as EnvelopeSource, f as EventQueue, g as WIRE_ONBOARDING_EVENTS, h as WireOnboardingEventName, i as buildContextEnvelope, j as createEventQueue, k as getCurrentSessionId, m as makeSessionId, r as reportClientEvent, l as reportClientEvents, n as resetCurrentSessionId, s as setCurrentSessionId, t as toAnalyticsEvent } from '../currentSession-Dj0cN3Rg.js';
|
|
4
4
|
import '../types-Buj9Lw9t.js';
|
|
5
5
|
import '../types-BKfpdZzX.js';
|
|
6
6
|
import '../types-BcmagF6K.js';
|
package/dist/analytics/index.js
CHANGED
|
@@ -860,8 +860,9 @@ var createEventQueue = (options) => {
|
|
|
860
860
|
} catch {
|
|
861
861
|
}
|
|
862
862
|
})();
|
|
863
|
+
const DROP_STATUSES = /* @__PURE__ */ new Set([400, 404, 413, 422]);
|
|
863
864
|
const postBatch = async (events) => {
|
|
864
|
-
if (!(target == null ? void 0 : target.serverUrl) || events.length === 0) return
|
|
865
|
+
if (!(target == null ? void 0 : target.serverUrl) || events.length === 0) return "retry";
|
|
865
866
|
const controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
|
|
866
867
|
const timer = setTimeout(() => controller == null ? void 0 : controller.abort(), 15e3);
|
|
867
868
|
try {
|
|
@@ -874,9 +875,12 @@ var createEventQueue = (options) => {
|
|
|
874
875
|
body: JSON.stringify({ events }),
|
|
875
876
|
signal: controller == null ? void 0 : controller.signal
|
|
876
877
|
});
|
|
877
|
-
|
|
878
|
+
if (res && res.ok) return "ok";
|
|
879
|
+
const status = res == null ? void 0 : res.status;
|
|
880
|
+
if (typeof status === "number" && DROP_STATUSES.has(status)) return "drop";
|
|
881
|
+
return "retry";
|
|
878
882
|
} catch {
|
|
879
|
-
return
|
|
883
|
+
return "retry";
|
|
880
884
|
} finally {
|
|
881
885
|
clearTimeout(timer);
|
|
882
886
|
}
|
|
@@ -908,8 +912,8 @@ var createEventQueue = (options) => {
|
|
|
908
912
|
try {
|
|
909
913
|
while (pending.length > 0) {
|
|
910
914
|
const batch = pending.slice(0, batchSize);
|
|
911
|
-
const
|
|
912
|
-
if (
|
|
915
|
+
const result = await postBatch(batch.map((item) => item.event));
|
|
916
|
+
if (result === "retry") {
|
|
913
917
|
scheduleRetry();
|
|
914
918
|
return;
|
|
915
919
|
}
|