@wireai/activation 0.12.0 → 0.12.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/AGENTS.md +13 -10
- package/CHANGELOG.md +130 -0
- package/INTEGRATION_PROMPT.md +14 -3
- package/README.md +40 -2
- package/dist/analytics/index.d.mts +5 -4
- package/dist/analytics/index.d.ts +5 -4
- package/dist/analytics/index.js +39 -24
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +39 -24
- package/dist/analytics/index.mjs.map +1 -1
- package/dist/coachmarks/index.d.mts +16 -0
- package/dist/coachmarks/index.d.ts +16 -0
- package/dist/coachmarks/index.js +19 -13
- package/dist/coachmarks/index.js.map +1 -1
- package/dist/coachmarks/index.mjs +19 -13
- package/dist/coachmarks/index.mjs.map +1 -1
- package/dist/{currentSession-DsSDHqor.d.mts → currentSession-BlCeDP0f.d.mts} +59 -5
- package/dist/{currentSession-D6RiVtc8.d.ts → currentSession-BxEB37xt.d.ts} +59 -5
- package/dist/index.d.mts +10 -20
- package/dist/index.d.ts +10 -20
- package/dist/index.js +301 -187
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +300 -188
- package/dist/index.mjs.map +1 -1
- package/dist/questionnaire/index.js +41 -19
- package/dist/questionnaire/index.js.map +1 -1
- package/dist/questionnaire/index.mjs +41 -19
- package/dist/questionnaire/index.mjs.map +1 -1
- package/dist/reviews/index.js +41 -19
- package/dist/reviews/index.js.map +1 -1
- package/dist/reviews/index.mjs +41 -19
- package/dist/reviews/index.mjs.map +1 -1
- package/dist/showcase/index.js +15 -6
- package/dist/showcase/index.js.map +1 -1
- package/dist/showcase/index.mjs +15 -6
- package/dist/showcase/index.mjs.map +1 -1
- package/llms.txt +2 -0
- package/package.json +1 -1
- package/src/WireOnboarding.tsx +140 -5
- package/src/activation/wireActivation.ts +8 -1
- package/src/analytics/analyticsFacade.ts +15 -11
- package/src/analytics/reportClientEvent.ts +11 -7
- package/src/coachmarks/runtime.ts +53 -17
- package/src/config/wireConfigFromEnv.ts +46 -2
- package/src/context/deviceId.ts +82 -18
- package/src/index.ts +9 -1
- package/src/questionnaire/runtime.ts +1 -0
- package/src/questionnaire/useQuestionnaireGate.ts +8 -3
- package/src/reviews/runtime.ts +68 -7
- package/src/reviews/useReviewGate.ts +8 -3
- package/src/session-analytics/useLifecycleEvents.ts +57 -27
- package/src/session-analytics/useSessionStart.ts +37 -1
- package/src/types.ts +41 -4
|
@@ -349,16 +349,53 @@ type WireOnboardingProps = {
|
|
|
349
349
|
/** Lifecycle hook for host-side analytics (started / per-turn / error). */
|
|
350
350
|
onEvent?: (event: OnboardingEvent) => void;
|
|
351
351
|
/**
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
352
|
+
* **THIS IS WHERE THE JOIN KEY GOES.** `user_context.device_key` is the ONLY thing that joins an
|
|
353
|
+
* onboarding session to everything the app reports later (analytics, purchases, gate decisions).
|
|
354
|
+
* Build the value with the helper so the wire spelling is decided in one place:
|
|
355
|
+
*
|
|
356
|
+
* ```tsx
|
|
357
|
+
* <WireOnboarding userContext={activationJoinContext(deviceKey)} ... />
|
|
358
|
+
* // no device id of your own? read the kit's:
|
|
359
|
+
* <WireOnboarding userContext={activationJoinContext(resolveAutoDeviceKey({ appId, storage }))} ... />
|
|
360
|
+
* ```
|
|
361
|
+
*
|
|
362
|
+
* SINCE 0.12.2, leaving it out no longer silently empties the funnel: when you pass `storage` and
|
|
363
|
+
* this prop carries no `device_key`, the kit injects its OWN per-install key — the same one the
|
|
364
|
+
* analytics surfaces mint and persist — so the default wiring joins. Anything you DO pass wins
|
|
365
|
+
* verbatim and is never touched. See `autoJoinKey` for the opt-out and the two cases where the kit
|
|
366
|
+
* still cannot fill the gap (no `storage`, or you opted out), which keep warning in dev.
|
|
367
|
+
*
|
|
368
|
+
* Never hand-write `userContext={{ deviceKey }}`: the server's device lookup reads `device_key`,
|
|
369
|
+
* so a misspelled bucket produces a silently empty funnel rather than an error. And never join on
|
|
370
|
+
* `session_id` — an onboarding session id is the A2A `contextId` while an app-event session id is
|
|
371
|
+
* the per-open id, so intersecting those two id spaces returns zero rows every time.
|
|
372
|
+
*
|
|
373
|
+
* SECOND JOB, segmentation: anything else non-PII the app already knows — signup method, referral
|
|
374
|
+
* source, plan tier, a HASHED user id. Same host-injection philosophy as `storage`: the kit
|
|
375
|
+
* collects nothing here; the host passes what it wants. Forwarded to the backend on the session
|
|
376
|
+
* metadata AND on client events so analytics can segment the funnel.
|
|
356
377
|
*
|
|
357
378
|
* MUST NOT contain PII such as raw emails, names, or phone numbers — pass a hash if you need
|
|
358
379
|
* a user key. Values are limited to primitives (`string | number | boolean`); the server caps
|
|
359
380
|
* key count / size and drops deep nesting. Old servers ignore it (backward compatible).
|
|
360
381
|
*/
|
|
361
382
|
userContext?: Record<string, string | number | boolean>;
|
|
383
|
+
/**
|
|
384
|
+
* OPT OUT of the automatic join key. Default `true`.
|
|
385
|
+
*
|
|
386
|
+
* By default (0.12.2+), an onboarding session that was given no `userContext.device_key` gets the
|
|
387
|
+
* kit's own per-install key injected — the SAME id `createAnalytics` / `createWireActivation` mint
|
|
388
|
+
* and persist — so the `activated` funnel joins without the host wiring anything. Pass
|
|
389
|
+
* `autoJoinKey={false}` if you genuinely want an UNLINKED onboarding session; that restores the
|
|
390
|
+
* pre-0.12.2 behavior exactly (nothing injected) and the dev warning fires again.
|
|
391
|
+
*
|
|
392
|
+
* Two things this flag does NOT do. It never overrides a `device_key` you passed — a host-supplied
|
|
393
|
+
* key always wins, whatever this is set to. And it cannot conjure a key without `storage`: with no
|
|
394
|
+
* persistence the kit's id is minted fresh every launch, and a per-launch key corrupts
|
|
395
|
+
* `min_sessions` instead of merely leaving the join empty, so the kit declines to inject and warns
|
|
396
|
+
* in dev instead.
|
|
397
|
+
*/
|
|
398
|
+
autoJoinKey?: boolean;
|
|
362
399
|
/**
|
|
363
400
|
* The host's own user id, so onboarding sessions can be reconciled to real users later
|
|
364
401
|
* (console sessions ↔ your user table / GA4 users). First-class alongside `userContext`.
|
|
@@ -863,6 +900,23 @@ interface ResolveAutoDeviceKeyOptions {
|
|
|
863
900
|
* Never throws: a missing, hung, or rejecting storage adapter degrades to the in-memory id.
|
|
864
901
|
*/
|
|
865
902
|
declare const resolveAutoDeviceKey: (opts?: ResolveAutoDeviceKeyOptions) => string;
|
|
903
|
+
/**
|
|
904
|
+
* The AWAITABLE sibling of {@link resolveAutoDeviceKey}: resolve to the auto `device_key` AFTER the
|
|
905
|
+
* persisted id has been read back (or written, on a first run), so the caller stamps the id this
|
|
906
|
+
* install will keep rather than the one that was minted a millisecond ago.
|
|
907
|
+
*
|
|
908
|
+
* WHY IT EXISTS: `resolveAutoDeviceKey` is synchronous by contract, so a caller firing at mount got
|
|
909
|
+
* the freshly minted id and the persisted one landed milliseconds later. For most events that is
|
|
910
|
+
* noise. For `app.session_started` it is the whole metric: the server computes `min_sessions` by
|
|
911
|
+
* counting distinct opens grouped by `device_key`, so a per-launch key there makes the counter
|
|
912
|
+
* structurally incapable of exceeding 1, and it splits `first_open` off from every event that
|
|
913
|
+
* follows it. Only a caller that can afford one storage read should use this; the fire-and-forget
|
|
914
|
+
* event paths must stay on the sync function.
|
|
915
|
+
*
|
|
916
|
+
* Never throws or rejects: a missing, hung, or rejecting adapter resolves to the in-memory id, and
|
|
917
|
+
* with no `storage` it resolves immediately (there is nothing to hydrate from).
|
|
918
|
+
*/
|
|
919
|
+
declare const hydrateAutoDeviceKey: (opts?: ResolveAutoDeviceKeyOptions) => Promise<string>;
|
|
866
920
|
/** Test-only: forget every auto id + hydration flag so a unit test starts from a clean registry. */
|
|
867
921
|
declare const resetAutoDeviceKeys: () => void;
|
|
868
922
|
|
|
@@ -894,4 +948,4 @@ declare const resetCurrentSessionId: () => void;
|
|
|
894
948
|
*/
|
|
895
949
|
declare const ensureCurrentSessionId: () => string;
|
|
896
950
|
|
|
897
|
-
export {
|
|
951
|
+
export { hydrateAutoDeviceKey as $, AUTO_DEVICE_ID_PREFIX as A, resolveAutoDeviceKey as B, type ClearUserContextOptions as C, type DeviceKeyStorage as D, type EventQueueOptions as E, setCurrentSessionId as F, toAnalyticsEvent as G, type WireOnboardingProps as H, type WireOnboardingConfig as I, type OnboardingEvent as J, type OnboardingCopy as K, type DeviceContext as L, type DeviceFormFactor as M, EXTRA_KEY_PREFIX as N, type OnboardingResult as O, type IdentifyOnboardingOptions as P, type OnboardingProgress as Q, type ResolveAutoDeviceKeyOptions as R, type StepValidator as S, RESERVED_USER_CONTEXT_KEYS as T, type ResolveUserContextOptions as U, type ResolvedUserContext as V, type WireUserContext as W, USER_ID_MAX_LENGTH as X, activationJoinContext as Y, collectDeviceContext as Z, hashEmailFnv1a as _, type AnalyticsEvent as a, identifyOnboarding as a0, isWireScalar as a1, mintDeviceId as a2, namespaceExtra as a3, resolveUserContext as a4, sanitizeUserId as a5, type ClientEvent as b, type ClientEventTarget as c, type ClientEventType as d, type ContextEnvelope as e, type ContextEnvelopeInput as f, type EnvelopeSource as g, type EventQueue as h, WIRE_ONBOARDING_EVENTS as i, type WireOnboardingEventName as j, analyticsUserIdStorageKey as k, buildContextEnvelope as l, clearPiiFromContext as m, clearUserContext as n, createEventQueue as o, deviceIdStorageKey as p, ensureCurrentSessionId as q, getCurrentSessionId as r, looksLikeEmail as s, makeSessionId as t, reportClientEvent as u, reportClientEventAwait as v, reportClientEvents as w, reportClientEventsAwait as x, resetAutoDeviceKeys as y, resetCurrentSessionId as z };
|
|
@@ -349,16 +349,53 @@ type WireOnboardingProps = {
|
|
|
349
349
|
/** Lifecycle hook for host-side analytics (started / per-turn / error). */
|
|
350
350
|
onEvent?: (event: OnboardingEvent) => void;
|
|
351
351
|
/**
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
352
|
+
* **THIS IS WHERE THE JOIN KEY GOES.** `user_context.device_key` is the ONLY thing that joins an
|
|
353
|
+
* onboarding session to everything the app reports later (analytics, purchases, gate decisions).
|
|
354
|
+
* Build the value with the helper so the wire spelling is decided in one place:
|
|
355
|
+
*
|
|
356
|
+
* ```tsx
|
|
357
|
+
* <WireOnboarding userContext={activationJoinContext(deviceKey)} ... />
|
|
358
|
+
* // no device id of your own? read the kit's:
|
|
359
|
+
* <WireOnboarding userContext={activationJoinContext(resolveAutoDeviceKey({ appId, storage }))} ... />
|
|
360
|
+
* ```
|
|
361
|
+
*
|
|
362
|
+
* SINCE 0.12.2, leaving it out no longer silently empties the funnel: when you pass `storage` and
|
|
363
|
+
* this prop carries no `device_key`, the kit injects its OWN per-install key — the same one the
|
|
364
|
+
* analytics surfaces mint and persist — so the default wiring joins. Anything you DO pass wins
|
|
365
|
+
* verbatim and is never touched. See `autoJoinKey` for the opt-out and the two cases where the kit
|
|
366
|
+
* still cannot fill the gap (no `storage`, or you opted out), which keep warning in dev.
|
|
367
|
+
*
|
|
368
|
+
* Never hand-write `userContext={{ deviceKey }}`: the server's device lookup reads `device_key`,
|
|
369
|
+
* so a misspelled bucket produces a silently empty funnel rather than an error. And never join on
|
|
370
|
+
* `session_id` — an onboarding session id is the A2A `contextId` while an app-event session id is
|
|
371
|
+
* the per-open id, so intersecting those two id spaces returns zero rows every time.
|
|
372
|
+
*
|
|
373
|
+
* SECOND JOB, segmentation: anything else non-PII the app already knows — signup method, referral
|
|
374
|
+
* source, plan tier, a HASHED user id. Same host-injection philosophy as `storage`: the kit
|
|
375
|
+
* collects nothing here; the host passes what it wants. Forwarded to the backend on the session
|
|
376
|
+
* metadata AND on client events so analytics can segment the funnel.
|
|
356
377
|
*
|
|
357
378
|
* MUST NOT contain PII such as raw emails, names, or phone numbers — pass a hash if you need
|
|
358
379
|
* a user key. Values are limited to primitives (`string | number | boolean`); the server caps
|
|
359
380
|
* key count / size and drops deep nesting. Old servers ignore it (backward compatible).
|
|
360
381
|
*/
|
|
361
382
|
userContext?: Record<string, string | number | boolean>;
|
|
383
|
+
/**
|
|
384
|
+
* OPT OUT of the automatic join key. Default `true`.
|
|
385
|
+
*
|
|
386
|
+
* By default (0.12.2+), an onboarding session that was given no `userContext.device_key` gets the
|
|
387
|
+
* kit's own per-install key injected — the SAME id `createAnalytics` / `createWireActivation` mint
|
|
388
|
+
* and persist — so the `activated` funnel joins without the host wiring anything. Pass
|
|
389
|
+
* `autoJoinKey={false}` if you genuinely want an UNLINKED onboarding session; that restores the
|
|
390
|
+
* pre-0.12.2 behavior exactly (nothing injected) and the dev warning fires again.
|
|
391
|
+
*
|
|
392
|
+
* Two things this flag does NOT do. It never overrides a `device_key` you passed — a host-supplied
|
|
393
|
+
* key always wins, whatever this is set to. And it cannot conjure a key without `storage`: with no
|
|
394
|
+
* persistence the kit's id is minted fresh every launch, and a per-launch key corrupts
|
|
395
|
+
* `min_sessions` instead of merely leaving the join empty, so the kit declines to inject and warns
|
|
396
|
+
* in dev instead.
|
|
397
|
+
*/
|
|
398
|
+
autoJoinKey?: boolean;
|
|
362
399
|
/**
|
|
363
400
|
* The host's own user id, so onboarding sessions can be reconciled to real users later
|
|
364
401
|
* (console sessions ↔ your user table / GA4 users). First-class alongside `userContext`.
|
|
@@ -863,6 +900,23 @@ interface ResolveAutoDeviceKeyOptions {
|
|
|
863
900
|
* Never throws: a missing, hung, or rejecting storage adapter degrades to the in-memory id.
|
|
864
901
|
*/
|
|
865
902
|
declare const resolveAutoDeviceKey: (opts?: ResolveAutoDeviceKeyOptions) => string;
|
|
903
|
+
/**
|
|
904
|
+
* The AWAITABLE sibling of {@link resolveAutoDeviceKey}: resolve to the auto `device_key` AFTER the
|
|
905
|
+
* persisted id has been read back (or written, on a first run), so the caller stamps the id this
|
|
906
|
+
* install will keep rather than the one that was minted a millisecond ago.
|
|
907
|
+
*
|
|
908
|
+
* WHY IT EXISTS: `resolveAutoDeviceKey` is synchronous by contract, so a caller firing at mount got
|
|
909
|
+
* the freshly minted id and the persisted one landed milliseconds later. For most events that is
|
|
910
|
+
* noise. For `app.session_started` it is the whole metric: the server computes `min_sessions` by
|
|
911
|
+
* counting distinct opens grouped by `device_key`, so a per-launch key there makes the counter
|
|
912
|
+
* structurally incapable of exceeding 1, and it splits `first_open` off from every event that
|
|
913
|
+
* follows it. Only a caller that can afford one storage read should use this; the fire-and-forget
|
|
914
|
+
* event paths must stay on the sync function.
|
|
915
|
+
*
|
|
916
|
+
* Never throws or rejects: a missing, hung, or rejecting adapter resolves to the in-memory id, and
|
|
917
|
+
* with no `storage` it resolves immediately (there is nothing to hydrate from).
|
|
918
|
+
*/
|
|
919
|
+
declare const hydrateAutoDeviceKey: (opts?: ResolveAutoDeviceKeyOptions) => Promise<string>;
|
|
866
920
|
/** Test-only: forget every auto id + hydration flag so a unit test starts from a clean registry. */
|
|
867
921
|
declare const resetAutoDeviceKeys: () => void;
|
|
868
922
|
|
|
@@ -894,4 +948,4 @@ declare const resetCurrentSessionId: () => void;
|
|
|
894
948
|
*/
|
|
895
949
|
declare const ensureCurrentSessionId: () => string;
|
|
896
950
|
|
|
897
|
-
export {
|
|
951
|
+
export { hydrateAutoDeviceKey as $, AUTO_DEVICE_ID_PREFIX as A, resolveAutoDeviceKey as B, type ClearUserContextOptions as C, type DeviceKeyStorage as D, type EventQueueOptions as E, setCurrentSessionId as F, toAnalyticsEvent as G, type WireOnboardingProps as H, type WireOnboardingConfig as I, type OnboardingEvent as J, type OnboardingCopy as K, type DeviceContext as L, type DeviceFormFactor as M, EXTRA_KEY_PREFIX as N, type OnboardingResult as O, type IdentifyOnboardingOptions as P, type OnboardingProgress as Q, type ResolveAutoDeviceKeyOptions as R, type StepValidator as S, RESERVED_USER_CONTEXT_KEYS as T, type ResolveUserContextOptions as U, type ResolvedUserContext as V, type WireUserContext as W, USER_ID_MAX_LENGTH as X, activationJoinContext as Y, collectDeviceContext as Z, hashEmailFnv1a as _, type AnalyticsEvent as a, identifyOnboarding as a0, isWireScalar as a1, mintDeviceId as a2, namespaceExtra as a3, resolveUserContext as a4, sanitizeUserId as a5, type ClientEvent as b, type ClientEventTarget as c, type ClientEventType as d, type ContextEnvelope as e, type ContextEnvelopeInput as f, type EnvelopeSource as g, type EventQueue as h, WIRE_ONBOARDING_EVENTS as i, type WireOnboardingEventName as j, analyticsUserIdStorageKey as k, buildContextEnvelope as l, clearPiiFromContext as m, clearUserContext as n, createEventQueue as o, deviceIdStorageKey as p, ensureCurrentSessionId as q, getCurrentSessionId as r, looksLikeEmail as s, makeSessionId as t, reportClientEvent as u, reportClientEventAwait as v, reportClientEvents as w, reportClientEventsAwait as x, resetAutoDeviceKeys as y, resetCurrentSessionId as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ReactNode } from 'react';
|
|
3
|
-
import { H as WireOnboardingProps, I as WireOnboardingConfig, O as OnboardingResult, S as StepValidator, J as OnboardingEvent, K as OnboardingCopy, c as ClientEventTarget, L as DeviceContext, W as WireUserContext, b as ClientEvent, g as EnvelopeSource } from './currentSession-
|
|
4
|
-
export { A as AUTO_DEVICE_ID_PREFIX, a as AnalyticsEvent, C as ClearUserContextOptions, d as ClientEventType, M as DeviceFormFactor, D as DeviceKeyStorage, N as EXTRA_KEY_PREFIX, P as IdentifyOnboardingOptions, Q as OnboardingProgress, T as RESERVED_USER_CONTEXT_KEYS, R as ResolveAutoDeviceKeyOptions, U as ResolveUserContextOptions, V as ResolvedUserContext, X as USER_ID_MAX_LENGTH, i as WIRE_ONBOARDING_EVENTS, j as WireOnboardingEventName, Y as activationJoinContext, k as analyticsUserIdStorageKey, m as clearPiiFromContext, n as clearUserContext, Z as collectDeviceContext, p as deviceIdStorageKey, q as ensureCurrentSessionId, r as getCurrentSessionId, _ as hashEmailFnv1a, $ as
|
|
3
|
+
import { H as WireOnboardingProps, I as WireOnboardingConfig, O as OnboardingResult, S as StepValidator, J as OnboardingEvent, K as OnboardingCopy, c as ClientEventTarget, L as DeviceContext, W as WireUserContext, b as ClientEvent, g as EnvelopeSource } from './currentSession-BlCeDP0f.mjs';
|
|
4
|
+
export { A as AUTO_DEVICE_ID_PREFIX, a as AnalyticsEvent, C as ClearUserContextOptions, d as ClientEventType, M as DeviceFormFactor, D as DeviceKeyStorage, N as EXTRA_KEY_PREFIX, P as IdentifyOnboardingOptions, Q as OnboardingProgress, T as RESERVED_USER_CONTEXT_KEYS, R as ResolveAutoDeviceKeyOptions, U as ResolveUserContextOptions, V as ResolvedUserContext, X as USER_ID_MAX_LENGTH, i as WIRE_ONBOARDING_EVENTS, j as WireOnboardingEventName, Y as activationJoinContext, k as analyticsUserIdStorageKey, m as clearPiiFromContext, n as clearUserContext, Z as collectDeviceContext, p as deviceIdStorageKey, q as ensureCurrentSessionId, r as getCurrentSessionId, _ as hashEmailFnv1a, $ as hydrateAutoDeviceKey, a0 as identifyOnboarding, a1 as isWireScalar, s as looksLikeEmail, t as makeSessionId, a2 as mintDeviceId, a3 as namespaceExtra, u as reportClientEvent, v as reportClientEventAwait, w as reportClientEvents, x as reportClientEventsAwait, y as resetAutoDeviceKeys, z as resetCurrentSessionId, B as resolveAutoDeviceKey, a4 as resolveUserContext, a5 as sanitizeUserId, F as setCurrentSessionId, G as toAnalyticsEvent } from './currentSession-BlCeDP0f.mjs';
|
|
5
5
|
import { O as OnboardingTheme } from './types-BKfpdZzX.mjs';
|
|
6
6
|
export { a as OnboardingButtonStyle, b as OnboardingColors, c as OnboardingFonts, d as OnboardingRadius, e as OnboardingSpacing } from './types-BKfpdZzX.mjs';
|
|
7
7
|
export { C as CenteredModal, a as CenteredModalHandle, b as CenteredModalProps } from './CenteredModal-C3qQBHsA.mjs';
|
|
@@ -1278,24 +1278,9 @@ declare const readCachedFeatures: (storage: WireOnboardingStorage, key: string)
|
|
|
1278
1278
|
/** Persist `{ features, ts }` under `key` — fire-and-forget, all errors swallowed. */
|
|
1279
1279
|
declare const writeCachedFeatures: (storage: WireOnboardingStorage, key: string, features: WireFeatures) => void;
|
|
1280
1280
|
|
|
1281
|
-
/**
|
|
1282
|
-
* wireConfigFromEnv — stop re-authoring env gating in every app. Reads the Wire AI
|
|
1283
|
-
* tenant key + server URL from the standard Expo public env vars and returns a
|
|
1284
|
-
* ready `WireOnboardingConfig`, or `null` when the key/URL are missing (so a host
|
|
1285
|
-
* can fall through to a static onboarding without writing the `if (!key)` itself).
|
|
1286
|
-
*
|
|
1287
|
-
* EXPO_PUBLIC_WIREAI_API_KEY=... (required)
|
|
1288
|
-
* EXPO_PUBLIC_WIREAI_SERVER_URL=... (required)
|
|
1289
|
-
*
|
|
1290
|
-
* const config = wireConfigFromEnv({ appId: "morrow" });
|
|
1291
|
-
* if (!config) return <StaticOnboarding />;
|
|
1292
|
-
* return <WireOnboarding config={config} ... />;
|
|
1293
|
-
*
|
|
1294
|
-
* `appId` defaults to `EXPO_PUBLIC_WIREAI_APP_ID` (or "default"); pass overrides to
|
|
1295
|
-
* set `appId`/`metadata` or to substitute the key/URL programmatically.
|
|
1296
|
-
*/
|
|
1297
|
-
|
|
1298
1281
|
type WireConfigOverrides = Partial<WireOnboardingConfig>;
|
|
1282
|
+
/** The env vars this helper reads. Exported so a host preflight can assert them itself. */
|
|
1283
|
+
declare const WIRE_ENV_VARS: readonly ["EXPO_PUBLIC_WIREAI_API_KEY", "EXPO_PUBLIC_WIREAI_SERVER_URL", "EXPO_PUBLIC_WIREAI_APP_ID"];
|
|
1299
1284
|
declare const wireConfigFromEnv: (overrides?: WireConfigOverrides) => WireOnboardingConfig | null;
|
|
1300
1285
|
|
|
1301
1286
|
type OnboardingFlagOptions = {
|
|
@@ -1840,6 +1825,11 @@ interface SessionStartConfig {
|
|
|
1840
1825
|
apiKey?: string;
|
|
1841
1826
|
/** Host app version (e.g. "1.4.2"), forwarded for release segmentation. Optional. */
|
|
1842
1827
|
appVersion?: string;
|
|
1828
|
+
/** Tenant/app id — namespaces the auto `device_key` fallback below. */
|
|
1829
|
+
appId?: string;
|
|
1830
|
+
/** Host storage (AsyncStorage subset). Present → `app.session_started` falls back to the kit's
|
|
1831
|
+
* persisted auto `device_key` when the host passes none. Absent → no fallback (see below). */
|
|
1832
|
+
storage?: WireOnboardingStorage;
|
|
1843
1833
|
}
|
|
1844
1834
|
/** Per-open identity the host supplies. All optional: a pre-auth open is device-only. */
|
|
1845
1835
|
interface UseSessionStartOptions {
|
|
@@ -2006,4 +1996,4 @@ interface UseLifecycleEventsOptions {
|
|
|
2006
1996
|
*/
|
|
2007
1997
|
declare const useLifecycleEvents: (config: LifecycleConfig | undefined, options?: UseLifecycleEventsOptions) => void;
|
|
2008
1998
|
|
|
2009
|
-
export { AnimatedSparkle, BACKGROUND_SESSION_MS, type CachedFeatures, CardGridSelectCard, CardHandoff, type CardHandoffProps, type CardHandoffVariant, type CardOption, ChipSelectCard, ClientEvent, ClientEventTarget, CompletionView, DEFAULT_FEATURES_TTL_MS, DemoOnboarding, type DemoOnboardingProps, DeviceContext, DoneBlock, ErrorBlock, FIRST_OPEN_EVENT, IconRegistryProvider, IllustrationProvider, type IllustrationRegistry, InterstitialCard, type LifecycleConfig, type LifecycleEventInput, LoadingBlock, LoadingScreen, NumberStepperCard, type OnboardingAttribution, Button as OnboardingButton, OnboardingCopy, OnboardingEvent, type OnboardingFlagOptions, OnboardingFlow, OnboardingResult, OnboardingScaffold, OnboardingTheme, OnboardingThemeProvider, PLAN_TIER_CONTEXT_KEY, type PlanTier, type PurchaseProps, type ReportFirstOpenOptions, type ReportSessionStartOptions, type ResolveFeaturesOptions, type RevenueCatBridge, type RevenueCatBridgeConfig, type RevenueCatCustomerInfoLike, type RevenueCatEntitlementLike, type RevenueCatErrorLike, type RevenueCatOfferingLike, type RevenueCatPackageLike, type RevenueCatProductLike, type RevenueCatSink, SESSION_STARTED_EVENT, SelectionCard, type SessionStartConfig, StatusCard, StepProgress, StepValidator, TextInputCard, type ThemeFromBrandInput, type UseLifecycleEventsOptions, type UseSessionStartOptions, type UseWireActivation, WIRE_ICON_GLYPHS, WIRE_ICON_NAMES, WIRE_PURCHASE_EVENTS, type WireActivation, type WireActivationConfig, type WireConfigOverrides, WireFeatures, WireFeaturesConfig, WireFeaturesProvider, type WireFeaturesProviderProps, WireIcon, type WireIconFamily, type WireIconGlyph, type WireIconName, type WireIconProps, type WireIconRegistry, type WireLifecycleOptions, WireOnboarding, WireOnboardingConfig, WireOnboardingProps, WireOnboardingStorage, type WirePurchaseEventName, WireUserContext, activeEntitlement, attributionMetadata, bumpActivationRevalidation, createRevenueCatBridge, createWireActivation, defaultIllustrations, defaultOnboardingTheme, defaultWireFeatures, deriveAnswers, describeEntitlement, describeFailure, describePackage, detectAppVersion, detectNativeModel, featuresCacheKey, featuresEqual, fetchWireFeatures, firstOpenStorageKey, getActivationRevalidationVersion, isFeaturesFresh, isOnboardingEnabled, isUserCancelled, lookupIconGlyph, mergeTheme, motionSpec, onboardingComponents, parseWireFeatures, readCachedFeatures, readProgress, reportFirstOpen, reportSessionStart, resetActivationRevalidation, resetFirstOpenLatch, resetSessionStartGuard, resolvePlanTier, subscribeActivationRevalidation, themeFromBrand, useActivationRevalidation, useHostIcon, useIllustration, useLifecycleEvents, useOnboardingTheme, useReducedMotion, useResolvedFeatures, useSessionStart, useWireActivation, useWireFeatures, useWireFeaturesContext, wireConfigFromEnv, wireLifecycleEvents, writeCachedFeatures };
|
|
1999
|
+
export { AnimatedSparkle, BACKGROUND_SESSION_MS, type CachedFeatures, CardGridSelectCard, CardHandoff, type CardHandoffProps, type CardHandoffVariant, type CardOption, ChipSelectCard, ClientEvent, ClientEventTarget, CompletionView, DEFAULT_FEATURES_TTL_MS, DemoOnboarding, type DemoOnboardingProps, DeviceContext, DoneBlock, ErrorBlock, FIRST_OPEN_EVENT, IconRegistryProvider, IllustrationProvider, type IllustrationRegistry, InterstitialCard, type LifecycleConfig, type LifecycleEventInput, LoadingBlock, LoadingScreen, NumberStepperCard, type OnboardingAttribution, Button as OnboardingButton, OnboardingCopy, OnboardingEvent, type OnboardingFlagOptions, OnboardingFlow, OnboardingResult, OnboardingScaffold, OnboardingTheme, OnboardingThemeProvider, PLAN_TIER_CONTEXT_KEY, type PlanTier, type PurchaseProps, type ReportFirstOpenOptions, type ReportSessionStartOptions, type ResolveFeaturesOptions, type RevenueCatBridge, type RevenueCatBridgeConfig, type RevenueCatCustomerInfoLike, type RevenueCatEntitlementLike, type RevenueCatErrorLike, type RevenueCatOfferingLike, type RevenueCatPackageLike, type RevenueCatProductLike, type RevenueCatSink, SESSION_STARTED_EVENT, SelectionCard, type SessionStartConfig, StatusCard, StepProgress, StepValidator, TextInputCard, type ThemeFromBrandInput, type UseLifecycleEventsOptions, type UseSessionStartOptions, type UseWireActivation, WIRE_ENV_VARS, WIRE_ICON_GLYPHS, WIRE_ICON_NAMES, WIRE_PURCHASE_EVENTS, type WireActivation, type WireActivationConfig, type WireConfigOverrides, WireFeatures, WireFeaturesConfig, WireFeaturesProvider, type WireFeaturesProviderProps, WireIcon, type WireIconFamily, type WireIconGlyph, type WireIconName, type WireIconProps, type WireIconRegistry, type WireLifecycleOptions, WireOnboarding, WireOnboardingConfig, WireOnboardingProps, WireOnboardingStorage, type WirePurchaseEventName, WireUserContext, activeEntitlement, attributionMetadata, bumpActivationRevalidation, createRevenueCatBridge, createWireActivation, defaultIllustrations, defaultOnboardingTheme, defaultWireFeatures, deriveAnswers, describeEntitlement, describeFailure, describePackage, detectAppVersion, detectNativeModel, featuresCacheKey, featuresEqual, fetchWireFeatures, firstOpenStorageKey, getActivationRevalidationVersion, isFeaturesFresh, isOnboardingEnabled, isUserCancelled, lookupIconGlyph, mergeTheme, motionSpec, onboardingComponents, parseWireFeatures, readCachedFeatures, readProgress, reportFirstOpen, reportSessionStart, resetActivationRevalidation, resetFirstOpenLatch, resetSessionStartGuard, resolvePlanTier, subscribeActivationRevalidation, themeFromBrand, useActivationRevalidation, useHostIcon, useIllustration, useLifecycleEvents, useOnboardingTheme, useReducedMotion, useResolvedFeatures, useSessionStart, useWireActivation, useWireFeatures, useWireFeaturesContext, wireConfigFromEnv, wireLifecycleEvents, writeCachedFeatures };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ReactNode } from 'react';
|
|
3
|
-
import { H as WireOnboardingProps, I as WireOnboardingConfig, O as OnboardingResult, S as StepValidator, J as OnboardingEvent, K as OnboardingCopy, c as ClientEventTarget, L as DeviceContext, W as WireUserContext, b as ClientEvent, g as EnvelopeSource } from './currentSession-
|
|
4
|
-
export { A as AUTO_DEVICE_ID_PREFIX, a as AnalyticsEvent, C as ClearUserContextOptions, d as ClientEventType, M as DeviceFormFactor, D as DeviceKeyStorage, N as EXTRA_KEY_PREFIX, P as IdentifyOnboardingOptions, Q as OnboardingProgress, T as RESERVED_USER_CONTEXT_KEYS, R as ResolveAutoDeviceKeyOptions, U as ResolveUserContextOptions, V as ResolvedUserContext, X as USER_ID_MAX_LENGTH, i as WIRE_ONBOARDING_EVENTS, j as WireOnboardingEventName, Y as activationJoinContext, k as analyticsUserIdStorageKey, m as clearPiiFromContext, n as clearUserContext, Z as collectDeviceContext, p as deviceIdStorageKey, q as ensureCurrentSessionId, r as getCurrentSessionId, _ as hashEmailFnv1a, $ as
|
|
3
|
+
import { H as WireOnboardingProps, I as WireOnboardingConfig, O as OnboardingResult, S as StepValidator, J as OnboardingEvent, K as OnboardingCopy, c as ClientEventTarget, L as DeviceContext, W as WireUserContext, b as ClientEvent, g as EnvelopeSource } from './currentSession-BxEB37xt.js';
|
|
4
|
+
export { A as AUTO_DEVICE_ID_PREFIX, a as AnalyticsEvent, C as ClearUserContextOptions, d as ClientEventType, M as DeviceFormFactor, D as DeviceKeyStorage, N as EXTRA_KEY_PREFIX, P as IdentifyOnboardingOptions, Q as OnboardingProgress, T as RESERVED_USER_CONTEXT_KEYS, R as ResolveAutoDeviceKeyOptions, U as ResolveUserContextOptions, V as ResolvedUserContext, X as USER_ID_MAX_LENGTH, i as WIRE_ONBOARDING_EVENTS, j as WireOnboardingEventName, Y as activationJoinContext, k as analyticsUserIdStorageKey, m as clearPiiFromContext, n as clearUserContext, Z as collectDeviceContext, p as deviceIdStorageKey, q as ensureCurrentSessionId, r as getCurrentSessionId, _ as hashEmailFnv1a, $ as hydrateAutoDeviceKey, a0 as identifyOnboarding, a1 as isWireScalar, s as looksLikeEmail, t as makeSessionId, a2 as mintDeviceId, a3 as namespaceExtra, u as reportClientEvent, v as reportClientEventAwait, w as reportClientEvents, x as reportClientEventsAwait, y as resetAutoDeviceKeys, z as resetCurrentSessionId, B as resolveAutoDeviceKey, a4 as resolveUserContext, a5 as sanitizeUserId, F as setCurrentSessionId, G as toAnalyticsEvent } from './currentSession-BxEB37xt.js';
|
|
5
5
|
import { O as OnboardingTheme } from './types-BKfpdZzX.js';
|
|
6
6
|
export { a as OnboardingButtonStyle, b as OnboardingColors, c as OnboardingFonts, d as OnboardingRadius, e as OnboardingSpacing } from './types-BKfpdZzX.js';
|
|
7
7
|
export { C as CenteredModal, a as CenteredModalHandle, b as CenteredModalProps } from './CenteredModal-Cdgns6--.js';
|
|
@@ -1278,24 +1278,9 @@ declare const readCachedFeatures: (storage: WireOnboardingStorage, key: string)
|
|
|
1278
1278
|
/** Persist `{ features, ts }` under `key` — fire-and-forget, all errors swallowed. */
|
|
1279
1279
|
declare const writeCachedFeatures: (storage: WireOnboardingStorage, key: string, features: WireFeatures) => void;
|
|
1280
1280
|
|
|
1281
|
-
/**
|
|
1282
|
-
* wireConfigFromEnv — stop re-authoring env gating in every app. Reads the Wire AI
|
|
1283
|
-
* tenant key + server URL from the standard Expo public env vars and returns a
|
|
1284
|
-
* ready `WireOnboardingConfig`, or `null` when the key/URL are missing (so a host
|
|
1285
|
-
* can fall through to a static onboarding without writing the `if (!key)` itself).
|
|
1286
|
-
*
|
|
1287
|
-
* EXPO_PUBLIC_WIREAI_API_KEY=... (required)
|
|
1288
|
-
* EXPO_PUBLIC_WIREAI_SERVER_URL=... (required)
|
|
1289
|
-
*
|
|
1290
|
-
* const config = wireConfigFromEnv({ appId: "morrow" });
|
|
1291
|
-
* if (!config) return <StaticOnboarding />;
|
|
1292
|
-
* return <WireOnboarding config={config} ... />;
|
|
1293
|
-
*
|
|
1294
|
-
* `appId` defaults to `EXPO_PUBLIC_WIREAI_APP_ID` (or "default"); pass overrides to
|
|
1295
|
-
* set `appId`/`metadata` or to substitute the key/URL programmatically.
|
|
1296
|
-
*/
|
|
1297
|
-
|
|
1298
1281
|
type WireConfigOverrides = Partial<WireOnboardingConfig>;
|
|
1282
|
+
/** The env vars this helper reads. Exported so a host preflight can assert them itself. */
|
|
1283
|
+
declare const WIRE_ENV_VARS: readonly ["EXPO_PUBLIC_WIREAI_API_KEY", "EXPO_PUBLIC_WIREAI_SERVER_URL", "EXPO_PUBLIC_WIREAI_APP_ID"];
|
|
1299
1284
|
declare const wireConfigFromEnv: (overrides?: WireConfigOverrides) => WireOnboardingConfig | null;
|
|
1300
1285
|
|
|
1301
1286
|
type OnboardingFlagOptions = {
|
|
@@ -1840,6 +1825,11 @@ interface SessionStartConfig {
|
|
|
1840
1825
|
apiKey?: string;
|
|
1841
1826
|
/** Host app version (e.g. "1.4.2"), forwarded for release segmentation. Optional. */
|
|
1842
1827
|
appVersion?: string;
|
|
1828
|
+
/** Tenant/app id — namespaces the auto `device_key` fallback below. */
|
|
1829
|
+
appId?: string;
|
|
1830
|
+
/** Host storage (AsyncStorage subset). Present → `app.session_started` falls back to the kit's
|
|
1831
|
+
* persisted auto `device_key` when the host passes none. Absent → no fallback (see below). */
|
|
1832
|
+
storage?: WireOnboardingStorage;
|
|
1843
1833
|
}
|
|
1844
1834
|
/** Per-open identity the host supplies. All optional: a pre-auth open is device-only. */
|
|
1845
1835
|
interface UseSessionStartOptions {
|
|
@@ -2006,4 +1996,4 @@ interface UseLifecycleEventsOptions {
|
|
|
2006
1996
|
*/
|
|
2007
1997
|
declare const useLifecycleEvents: (config: LifecycleConfig | undefined, options?: UseLifecycleEventsOptions) => void;
|
|
2008
1998
|
|
|
2009
|
-
export { AnimatedSparkle, BACKGROUND_SESSION_MS, type CachedFeatures, CardGridSelectCard, CardHandoff, type CardHandoffProps, type CardHandoffVariant, type CardOption, ChipSelectCard, ClientEvent, ClientEventTarget, CompletionView, DEFAULT_FEATURES_TTL_MS, DemoOnboarding, type DemoOnboardingProps, DeviceContext, DoneBlock, ErrorBlock, FIRST_OPEN_EVENT, IconRegistryProvider, IllustrationProvider, type IllustrationRegistry, InterstitialCard, type LifecycleConfig, type LifecycleEventInput, LoadingBlock, LoadingScreen, NumberStepperCard, type OnboardingAttribution, Button as OnboardingButton, OnboardingCopy, OnboardingEvent, type OnboardingFlagOptions, OnboardingFlow, OnboardingResult, OnboardingScaffold, OnboardingTheme, OnboardingThemeProvider, PLAN_TIER_CONTEXT_KEY, type PlanTier, type PurchaseProps, type ReportFirstOpenOptions, type ReportSessionStartOptions, type ResolveFeaturesOptions, type RevenueCatBridge, type RevenueCatBridgeConfig, type RevenueCatCustomerInfoLike, type RevenueCatEntitlementLike, type RevenueCatErrorLike, type RevenueCatOfferingLike, type RevenueCatPackageLike, type RevenueCatProductLike, type RevenueCatSink, SESSION_STARTED_EVENT, SelectionCard, type SessionStartConfig, StatusCard, StepProgress, StepValidator, TextInputCard, type ThemeFromBrandInput, type UseLifecycleEventsOptions, type UseSessionStartOptions, type UseWireActivation, WIRE_ICON_GLYPHS, WIRE_ICON_NAMES, WIRE_PURCHASE_EVENTS, type WireActivation, type WireActivationConfig, type WireConfigOverrides, WireFeatures, WireFeaturesConfig, WireFeaturesProvider, type WireFeaturesProviderProps, WireIcon, type WireIconFamily, type WireIconGlyph, type WireIconName, type WireIconProps, type WireIconRegistry, type WireLifecycleOptions, WireOnboarding, WireOnboardingConfig, WireOnboardingProps, WireOnboardingStorage, type WirePurchaseEventName, WireUserContext, activeEntitlement, attributionMetadata, bumpActivationRevalidation, createRevenueCatBridge, createWireActivation, defaultIllustrations, defaultOnboardingTheme, defaultWireFeatures, deriveAnswers, describeEntitlement, describeFailure, describePackage, detectAppVersion, detectNativeModel, featuresCacheKey, featuresEqual, fetchWireFeatures, firstOpenStorageKey, getActivationRevalidationVersion, isFeaturesFresh, isOnboardingEnabled, isUserCancelled, lookupIconGlyph, mergeTheme, motionSpec, onboardingComponents, parseWireFeatures, readCachedFeatures, readProgress, reportFirstOpen, reportSessionStart, resetActivationRevalidation, resetFirstOpenLatch, resetSessionStartGuard, resolvePlanTier, subscribeActivationRevalidation, themeFromBrand, useActivationRevalidation, useHostIcon, useIllustration, useLifecycleEvents, useOnboardingTheme, useReducedMotion, useResolvedFeatures, useSessionStart, useWireActivation, useWireFeatures, useWireFeaturesContext, wireConfigFromEnv, wireLifecycleEvents, writeCachedFeatures };
|
|
1999
|
+
export { AnimatedSparkle, BACKGROUND_SESSION_MS, type CachedFeatures, CardGridSelectCard, CardHandoff, type CardHandoffProps, type CardHandoffVariant, type CardOption, ChipSelectCard, ClientEvent, ClientEventTarget, CompletionView, DEFAULT_FEATURES_TTL_MS, DemoOnboarding, type DemoOnboardingProps, DeviceContext, DoneBlock, ErrorBlock, FIRST_OPEN_EVENT, IconRegistryProvider, IllustrationProvider, type IllustrationRegistry, InterstitialCard, type LifecycleConfig, type LifecycleEventInput, LoadingBlock, LoadingScreen, NumberStepperCard, type OnboardingAttribution, Button as OnboardingButton, OnboardingCopy, OnboardingEvent, type OnboardingFlagOptions, OnboardingFlow, OnboardingResult, OnboardingScaffold, OnboardingTheme, OnboardingThemeProvider, PLAN_TIER_CONTEXT_KEY, type PlanTier, type PurchaseProps, type ReportFirstOpenOptions, type ReportSessionStartOptions, type ResolveFeaturesOptions, type RevenueCatBridge, type RevenueCatBridgeConfig, type RevenueCatCustomerInfoLike, type RevenueCatEntitlementLike, type RevenueCatErrorLike, type RevenueCatOfferingLike, type RevenueCatPackageLike, type RevenueCatProductLike, type RevenueCatSink, SESSION_STARTED_EVENT, SelectionCard, type SessionStartConfig, StatusCard, StepProgress, StepValidator, TextInputCard, type ThemeFromBrandInput, type UseLifecycleEventsOptions, type UseSessionStartOptions, type UseWireActivation, WIRE_ENV_VARS, WIRE_ICON_GLYPHS, WIRE_ICON_NAMES, WIRE_PURCHASE_EVENTS, type WireActivation, type WireActivationConfig, type WireConfigOverrides, WireFeatures, WireFeaturesConfig, WireFeaturesProvider, type WireFeaturesProviderProps, WireIcon, type WireIconFamily, type WireIconGlyph, type WireIconName, type WireIconProps, type WireIconRegistry, type WireLifecycleOptions, WireOnboarding, WireOnboardingConfig, WireOnboardingProps, WireOnboardingStorage, type WirePurchaseEventName, WireUserContext, activeEntitlement, attributionMetadata, bumpActivationRevalidation, createRevenueCatBridge, createWireActivation, defaultIllustrations, defaultOnboardingTheme, defaultWireFeatures, deriveAnswers, describeEntitlement, describeFailure, describePackage, detectAppVersion, detectNativeModel, featuresCacheKey, featuresEqual, fetchWireFeatures, firstOpenStorageKey, getActivationRevalidationVersion, isFeaturesFresh, isOnboardingEnabled, isUserCancelled, lookupIconGlyph, mergeTheme, motionSpec, onboardingComponents, parseWireFeatures, readCachedFeatures, readProgress, reportFirstOpen, reportSessionStart, resetActivationRevalidation, resetFirstOpenLatch, resetSessionStartGuard, resolvePlanTier, subscribeActivationRevalidation, themeFromBrand, useActivationRevalidation, useHostIcon, useIllustration, useLifecycleEvents, useOnboardingTheme, useReducedMotion, useResolvedFeatures, useSessionStart, useWireActivation, useWireFeatures, useWireFeaturesContext, wireConfigFromEnv, wireLifecycleEvents, writeCachedFeatures };
|