@capxul/observability 2.5.2 → 2.5.4

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/README.md CHANGED
@@ -19,26 +19,37 @@ optional and snake_case; the camelCase spellings are retired.
19
19
 
20
20
  ## Two browser privacy profiles (ADR-0020 A6)
21
21
 
22
- One boundary, two named postures, both built on the same sanitizer, slim
23
- bundle, token guard and missing-key opt-out:
22
+ One boundary, two named postures, both built on the same sanitizer, token
23
+ guard and missing-key opt-out:
24
24
 
25
- | | `utilityAppAnalytics` | `productAppAnalytics` |
26
- | --------------- | ------------------------------------------ | -------------------------------- |
27
- | For | capability-URL apps (approval links, docs) | the Capxul product web app |
28
- | Persistence | off | **on** — J1 spans an OTP reload |
29
- | Person profiles | identified-only, nothing identifies | identified-only, identify-driven |
30
- | Autocapture | off | off |
31
- | Session replay | off | **production only**, OTP masked |
32
- | Exceptions | off | on |
25
+ | | `utilityAppAnalytics` | `productAppAnalytics` |
26
+ | --------------- | ------------------------------------------ | --------------------------------------- |
27
+ | For | capability-URL apps (approval links, docs) | the Capxul product web app |
28
+ | Persistence | off | **on** — J1 spans an OTP reload |
29
+ | Person profiles | identified-only, nothing identifies | identified-only, identify-driven |
30
+ | Autocapture | off | off |
31
+ | Session replay | off | **on in every environment**, OTP masked |
32
+ | Exceptions | off | on |
33
33
 
34
34
  Both stamp `capxul_env` and `producer: "browser"` through `before_send`, which
35
35
  also recursively removes URL query strings/fragments (including exception-frame
36
- filenames) and promoted campaign/search values. Pair either with PostHog's
37
- toolbar-free slim module and `createPostHogBrowserPageviewTracker`, which
38
- reports pathname-only initial loads and SPA route changes. Vendor
39
- initialization and pageview capture failures degrade to disabled analytics.
40
- The product profile records ordinary text and input values. It masks inputs
41
- whose `autocomplete` attribute is `one-time-code`.
36
+ filenames) and promoted campaign/search values. Pair either with
37
+ `createPostHogBrowserPageviewTracker`, which reports pathname-only initial
38
+ loads and SPA route changes. Vendor initialization and pageview capture
39
+ failures degrade to disabled analytics. The product profile records ordinary
40
+ text and input values. It masks inputs whose `autocomplete` attribute is
41
+ `one-time-code`.
42
+
43
+ ### Import the standard `posthog-js` build
44
+
45
+ Consumers of `productAppAnalytics` MUST import `posthog-js` (the standard
46
+ `module.js` build). `posthog-js/dist/module.slim` never registers the session
47
+ recording manager and ships no autocapture extensions, so with it the client
48
+ applies the replay options and records nothing (verified 2026-09-02, #1709).
49
+ The standard build loads the recorder lazily from the PostHog host, so the
50
+ bundle cost is the same until a session records. `initializeCapxulBrowserAnalytics`
51
+ warns once in the console when a profile enables replay and the initialized
52
+ client has no session recording manager.
42
53
 
43
54
  ```ts
44
55
  import {
package/dist/index.d.mts CHANGED
@@ -20,7 +20,7 @@ type CapxulErrorCode = (typeof CAPXUL_ERROR_CODES)[number];
20
20
  * into `unknown`; the signer's secure-context probe now names it.
21
21
  * - `unknown`: catch-all when no cause could be determined.
22
22
  */
23
- type FailureMode = "auth-origin-mismatch" | "stale-openfort-cache" | "app-env-allowlist" | "no-secure-context" | "unknown";
23
+ type FailureMode = "auth-origin-mismatch" | "stale-openfort-cache" | "app-env-allowlist" | "no-secure-context" /** #1684: an upstream RPC provider throttled the call (HTTP 429 or JSON-RPC -32005). Retryable. */ | "rate-limited" | "unknown";
24
24
  type CapxulErrorDetails = Record<string, unknown>;
25
25
  type CapxulErrorOptions = {
26
26
  readonly cause?: unknown;
@@ -109,7 +109,7 @@ interface TelemetryPort {
109
109
  }
110
110
  //#endregion
111
111
  //#region src/index.d.ts
112
- declare const TELEMETRY_EVENT_NAMES: readonly ["auth_otp_requested", "auth_otp_delivered", "auth_otp_expired", "auth_verified", "auth_failed", "auth_signed_out", "onboarding_intent_selected", "onboarding_profile_submitted", "onboarding_organization_submitted", "onboarding_dashboard_reached", "provisioning_safe_created", "provisioning_safe_confirmed", "bootstrap_resolved", "bootstrap_failed", "member_activation_started", "member_activation_ready", "member_activation_failed", "organization_creation_started", "organization_creation_ready", "organization_creation_failed", "account_balance_read", "account_balance_failed", "faucet_requested", "faucet_confirmed", "faucet_failed", "org_create_started", "org_safe_created", "org_safe_confirmed", "org_roles_seeded", "org_created", "org_create_failed", "org_invite_sent", "org_invite_accepted", "org_invite_expired", "payment_initiated", "payment_settled", "payment_failed", "deposit_initiated", "deposit_settled", "permission_mirror_verification", "movement_scan_window", "movement_scan_checkpoint", "movement_scan_incident"];
112
+ declare const TELEMETRY_EVENT_NAMES: readonly ["auth_otp_requested", "auth_otp_delivered", "auth_otp_expired", "auth_verified", "auth_failed", "auth_signed_out", "onboarding_intent_selected", "onboarding_profile_submitted", "onboarding_organization_submitted", "onboarding_dashboard_reached", "provisioning_safe_created", "provisioning_safe_confirmed", "bootstrap_resolved", "bootstrap_failed", "member_activation_started", "member_activation_ready", "member_activation_failed", "organization_creation_started", "organization_creation_ready", "organization_creation_failed", "aa_gateway_upstream_fallback", "account_balance_read", "account_balance_failed", "faucet_requested", "faucet_confirmed", "faucet_failed", "org_create_started", "org_safe_created", "org_safe_confirmed", "org_roles_seeded", "org_created", "org_create_failed", "org_invite_sent", "org_invite_accepted", "org_invite_expired", "payment_initiated", "payment_settled", "payment_failed", "deposit_initiated", "deposit_settled", "permission_mirror_verification", "movement_scan_window", "movement_scan_checkpoint", "movement_scan_incident"];
113
113
  type TelemetryEventName = (typeof TELEMETRY_EVENT_NAMES)[number];
114
114
  type NonEmptyTelemetryEventNames = readonly [TelemetryEventName, ...TelemetryEventName[]];
115
115
  type FunnelStepPropertyFilter = {
@@ -559,7 +559,8 @@ declare const OrganizationCreationFailedTelemetryEventSchema: Schema.Struct<{
559
559
  readonly attempt_number: Schema.refine<number, Schema.Number>;
560
560
  readonly stage: Schema.Literals<readonly ["profile", "accountProvisioning", "accountClaim", "preparingFounderAccount", "awaitingFounderAuthorization", "submittingBootstrap", "confirmingBootstrap"]>;
561
561
  readonly error_code: Schema.String;
562
- readonly retryable: Schema.Boolean;
562
+ readonly retryable: Schema.Boolean; /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
563
+ readonly backoff_ms: Schema.optional<Schema.Codec<DurationMs, number, never, never>>;
563
564
  readonly failure_reason: Schema.optional<Schema.Literals<readonly ["deterministic_address_mismatch", "receipt_provider_unavailable", "receipt_mismatch", "block_provider_unavailable", "authority_event_mismatch", "allowance_timestamp_mismatch", "receipt_identity_unavailable", "receipt_identity_mismatch", "contract_code_unavailable", "contract_state_mismatch", "permission_projection_mismatch"]>>;
564
565
  }>;
565
566
  }>;
@@ -625,6 +626,21 @@ declare const FaucetFailedTelemetryEventSchema: Schema.Struct<{
625
626
  readonly reason: Schema.optional<Schema.String>;
626
627
  }>;
627
628
  }>;
629
+ declare const AaGatewayUpstreamFallbackTelemetryEventSchema: Schema.Struct<{
630
+ readonly name: Schema.Literal<"aa_gateway_upstream_fallback">;
631
+ readonly props: Schema.Struct<{
632
+ readonly capxul_env: Schema.Literals<readonly ["development", "staging", "production", "unknown", "local"]>;
633
+ readonly producer: Schema.Literals<readonly ["server", "browser", "sdk", "mcp", "e2e"]>;
634
+ readonly journey_id: Schema.optional<Schema.String>;
635
+ readonly correlation_id: Schema.optional<Schema.String>;
636
+ readonly sdk_version: Schema.optional<Schema.String>;
637
+ readonly method: Schema.String;
638
+ readonly from_upstream: Schema.Literals<readonly ["alchemy", "infura", "public"]>;
639
+ readonly to_upstream: Schema.optional<Schema.Literals<readonly ["alchemy", "infura", "public"]>>;
640
+ readonly failure: Schema.Literals<readonly ["http-429", "http-5xx", "rpc-rate-limit", "timeout", "network"]>;
641
+ readonly status: Schema.optional<Schema.Number>;
642
+ }>;
643
+ }>;
628
644
  declare const OrgCreateStartedTelemetryEventSchema: Schema.Struct<{
629
645
  readonly name: Schema.Literal<"org_create_started">;
630
646
  readonly props: Schema.Struct<{
@@ -1119,7 +1135,8 @@ declare const TELEMETRY_EVENT_SCHEMAS: {
1119
1135
  readonly attempt_number: Schema.refine<number, Schema.Number>;
1120
1136
  readonly stage: Schema.Literals<readonly ["profile", "accountProvisioning", "accountClaim", "preparingFounderAccount", "awaitingFounderAuthorization", "submittingBootstrap", "confirmingBootstrap"]>;
1121
1137
  readonly error_code: Schema.String;
1122
- readonly retryable: Schema.Boolean;
1138
+ readonly retryable: Schema.Boolean; /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
1139
+ readonly backoff_ms: Schema.optional<Schema.Codec<DurationMs, number, never, never>>;
1123
1140
  readonly failure_reason: Schema.optional<Schema.Literals<readonly ["deterministic_address_mismatch", "receipt_provider_unavailable", "receipt_mismatch", "block_provider_unavailable", "authority_event_mismatch", "allowance_timestamp_mismatch", "receipt_identity_unavailable", "receipt_identity_mismatch", "contract_code_unavailable", "contract_state_mismatch", "permission_projection_mismatch"]>>;
1124
1141
  }>;
1125
1142
  }>;
@@ -1185,6 +1202,21 @@ declare const TELEMETRY_EVENT_SCHEMAS: {
1185
1202
  readonly reason: Schema.optional<Schema.String>;
1186
1203
  }>;
1187
1204
  }>;
1205
+ readonly aa_gateway_upstream_fallback: Schema.Struct<{
1206
+ readonly name: Schema.Literal<"aa_gateway_upstream_fallback">;
1207
+ readonly props: Schema.Struct<{
1208
+ readonly capxul_env: Schema.Literals<readonly ["development", "staging", "production", "unknown", "local"]>;
1209
+ readonly producer: Schema.Literals<readonly ["server", "browser", "sdk", "mcp", "e2e"]>;
1210
+ readonly journey_id: Schema.optional<Schema.String>;
1211
+ readonly correlation_id: Schema.optional<Schema.String>;
1212
+ readonly sdk_version: Schema.optional<Schema.String>;
1213
+ readonly method: Schema.String;
1214
+ readonly from_upstream: Schema.Literals<readonly ["alchemy", "infura", "public"]>;
1215
+ readonly to_upstream: Schema.optional<Schema.Literals<readonly ["alchemy", "infura", "public"]>>;
1216
+ readonly failure: Schema.Literals<readonly ["http-429", "http-5xx", "rpc-rate-limit", "timeout", "network"]>;
1217
+ readonly status: Schema.optional<Schema.Number>;
1218
+ }>;
1219
+ }>;
1188
1220
  readonly org_create_started: Schema.Struct<{
1189
1221
  readonly name: Schema.Literal<"org_create_started">;
1190
1222
  readonly props: Schema.Struct<{
@@ -1522,9 +1554,9 @@ interface PostHogUtilityAppOptions {
1522
1554
  /** Back-compat alias for the pre-ADR-0020 name. */
1523
1555
  type PostHogBrowserOptions = PostHogUtilityAppOptions;
1524
1556
  /**
1525
- * ADR-0020 A6 product posture: same sanitizer / slim-bundle / token-guard core
1526
- * as the utility profile, but the three toggles a PRODUCT needs and a
1527
- * capability-URL utility must not have —
1557
+ * ADR-0020 A6 product posture: same sanitizer / token-guard core as the
1558
+ * utility profile, but the three toggles a PRODUCT needs and a capability-URL
1559
+ * utility must not have —
1528
1560
  *
1529
1561
  * - `disable_persistence: false` — J1 spans an OTP reload; without persistence
1530
1562
  * step 1 and step 3 are different anonymous "users" and every multi-page
@@ -1537,6 +1569,15 @@ type PostHogBrowserOptions = PostHogUtilityAppOptions;
1537
1569
  * recorder script loads from PostHog, so external dependency loading is on.
1538
1570
  * (Ruling 2026-09-01: pre-launch, every failure needs its evidence; replay
1539
1571
  * gated to production left staging failures with no recording at all.)
1572
+ * Flags stay ENABLED for this client: posthog-js starts the recorder only
1573
+ * after it loads the project's remote config, and it skips that load when
1574
+ * `advanced_disable_flags` is true ("Remote config is disabled. Falling back
1575
+ * to local config."). With flags disabled the SDK captured events but never
1576
+ * recorded a session (0 replay rows in 7 days, verified 2026-09-02).
1577
+ * The consumer MUST import the standard `posthog-js` build (#1709):
1578
+ * `posthog-js/dist/module.slim` never registers the session recording
1579
+ * manager, so the client applies these options and records nothing.
1580
+ * `initializeCapxulBrowserAnalytics` warns once when that happens.
1540
1581
  *
1541
1582
  * Autocapture stays OFF: funnels run on catalog events, not on DOM guesses.
1542
1583
  */
@@ -1560,7 +1601,7 @@ interface PostHogProductAppOptions {
1560
1601
  readonly disable_conversations: true;
1561
1602
  readonly disable_external_dependency_loading: false;
1562
1603
  readonly person_profiles: "identified_only";
1563
- readonly advanced_disable_flags: true;
1604
+ readonly advanced_disable_flags: false;
1564
1605
  readonly save_campaign_params: false;
1565
1606
  readonly save_referrer: false;
1566
1607
  readonly session_recording: {
@@ -1657,4 +1698,4 @@ declare class InMemoryTelemetryBusAdapter implements TelemetryPort {
1657
1698
  reportHandledError(_error: CapxulError, _context?: HandledErrorReportContext): Effect.Effect<void, never>;
1658
1699
  }
1659
1700
  //#endregion
1660
- export { AccountBalanceFailedTelemetryEventSchema, AccountBalanceReadTelemetryEventSchema, AuthFailedTelemetryEventSchema, AuthOtpDeliveredTelemetryEventSchema, AuthOtpExpiredTelemetryEventSchema, AuthOtpRequestedTelemetryEventSchema, AuthSignedOutTelemetryEventSchema, AuthVerifiedTelemetryEventSchema, BROWSER_GATED_TELEMETRY_EVENTS, BootstrapFailedTelemetryEventSchema, BootstrapResolvedTelemetryEventSchema, CAPXUL_ENVS, CONTRACT_FIRST_TELEMETRY_EVENTS, CapturedNetworkRequestLike, CapxulBrowserAnalyticsInput, CapxulEnv, DepositInitiatedTelemetryEventSchema, DepositSettledTelemetryEventSchema, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, FaucetConfirmedTelemetryEventSchema, FaucetFailedTelemetryEventSchema, FaucetRequestedTelemetryEventSchema, FunnelJourney, FunnelStepPropertyFilter, type HandledErrorReportContext, InMemoryTelemetryBusAdapter, InitializePostHogBrowserAnalyticsInput, Journey, MemberActivationFailedTelemetryEventSchema, MemberActivationReadyTelemetryEventSchema, MemberActivationStartedTelemetryEventSchema, MovementScanCheckpointTelemetryEventSchema, MovementScanIncidentTelemetryEventSchema, MovementScanWindowTelemetryEventSchema, NonEmptyTelemetryEventNames, OnboardingDashboardReachedTelemetryEventSchema, OnboardingIntentSelectedTelemetryEventSchema, OnboardingOrganizationSubmittedTelemetryEventSchema, OnboardingProfileSubmittedTelemetryEventSchema, OrgCreateFailedTelemetryEventSchema, OrgCreateStartedTelemetryEventSchema, OrgCreatedTelemetryEventSchema, OrgInviteAcceptedTelemetryEventSchema, OrgInviteExpiredTelemetryEventSchema, OrgInviteSentTelemetryEventSchema, OrgRolesSeededTelemetryEventSchema, OrgSafeConfirmedTelemetryEventSchema, OrgSafeCreatedTelemetryEventSchema, OrganizationCreationFailedTelemetryEventSchema, OrganizationCreationReadyTelemetryEventSchema, OrganizationCreationStartedTelemetryEventSchema, PII, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, PaymentFailedTelemetryEventSchema, PaymentInitiatedTelemetryEventSchema, PaymentSettledTelemetryEventSchema, PermissionMirrorVerificationTelemetryEventSchema, PointEventJourney, PostHogBeforeSend, PostHogBrowserCapture, PostHogBrowserInitialize, PostHogBrowserOptions, PostHogBrowserPageviewClient, PostHogProductAppOptions, PostHogTelemetryAdapter, PostHogUtilityAppOptions, ProvisioningSafeConfirmedTelemetryEventSchema, ProvisioningSafeCreatedTelemetryEventSchema, RecordingTelemetryAdapter, SYNCABLE_CAPXUL_ENVS, TELEMETRY_EVENT_NAMES, TELEMETRY_EVENT_SCHEMAS, TELEMETRY_JOURNEYS, TELEMETRY_PRODUCERS, TelemetryEnvelopeDefaults, TelemetryEvent, TelemetryEventName, TelemetryGroupInput, TelemetryIdentifyInput, type TelemetryPort, TelemetryProducer, TelemetryProps, TelemetryRedactionOptions, TrackHandler, createCapxulBeforeSend, createPostHogBrowserPageviewTracker, getTrackHandler, initializeCapxulBrowserAnalytics, initializePostHogBrowserAnalytics, maskCapturedNetworkRequest, productAppAnalytics, redactTelemetryEvent, redactTelemetryProps, sanitizePostHogBrowserEvent, setTrackHandler, stampTelemetryEnvelope, track, utilityAppAnalytics };
1701
+ export { AaGatewayUpstreamFallbackTelemetryEventSchema, AccountBalanceFailedTelemetryEventSchema, AccountBalanceReadTelemetryEventSchema, AuthFailedTelemetryEventSchema, AuthOtpDeliveredTelemetryEventSchema, AuthOtpExpiredTelemetryEventSchema, AuthOtpRequestedTelemetryEventSchema, AuthSignedOutTelemetryEventSchema, AuthVerifiedTelemetryEventSchema, BROWSER_GATED_TELEMETRY_EVENTS, BootstrapFailedTelemetryEventSchema, BootstrapResolvedTelemetryEventSchema, CAPXUL_ENVS, CONTRACT_FIRST_TELEMETRY_EVENTS, CapturedNetworkRequestLike, CapxulBrowserAnalyticsInput, CapxulEnv, DepositInitiatedTelemetryEventSchema, DepositSettledTelemetryEventSchema, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, FaucetConfirmedTelemetryEventSchema, FaucetFailedTelemetryEventSchema, FaucetRequestedTelemetryEventSchema, FunnelJourney, FunnelStepPropertyFilter, type HandledErrorReportContext, InMemoryTelemetryBusAdapter, InitializePostHogBrowserAnalyticsInput, Journey, MemberActivationFailedTelemetryEventSchema, MemberActivationReadyTelemetryEventSchema, MemberActivationStartedTelemetryEventSchema, MovementScanCheckpointTelemetryEventSchema, MovementScanIncidentTelemetryEventSchema, MovementScanWindowTelemetryEventSchema, NonEmptyTelemetryEventNames, OnboardingDashboardReachedTelemetryEventSchema, OnboardingIntentSelectedTelemetryEventSchema, OnboardingOrganizationSubmittedTelemetryEventSchema, OnboardingProfileSubmittedTelemetryEventSchema, OrgCreateFailedTelemetryEventSchema, OrgCreateStartedTelemetryEventSchema, OrgCreatedTelemetryEventSchema, OrgInviteAcceptedTelemetryEventSchema, OrgInviteExpiredTelemetryEventSchema, OrgInviteSentTelemetryEventSchema, OrgRolesSeededTelemetryEventSchema, OrgSafeConfirmedTelemetryEventSchema, OrgSafeCreatedTelemetryEventSchema, OrganizationCreationFailedTelemetryEventSchema, OrganizationCreationReadyTelemetryEventSchema, OrganizationCreationStartedTelemetryEventSchema, PII, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, PaymentFailedTelemetryEventSchema, PaymentInitiatedTelemetryEventSchema, PaymentSettledTelemetryEventSchema, PermissionMirrorVerificationTelemetryEventSchema, PointEventJourney, PostHogBeforeSend, PostHogBrowserCapture, PostHogBrowserInitialize, PostHogBrowserOptions, PostHogBrowserPageviewClient, PostHogProductAppOptions, PostHogTelemetryAdapter, PostHogUtilityAppOptions, ProvisioningSafeConfirmedTelemetryEventSchema, ProvisioningSafeCreatedTelemetryEventSchema, RecordingTelemetryAdapter, SYNCABLE_CAPXUL_ENVS, TELEMETRY_EVENT_NAMES, TELEMETRY_EVENT_SCHEMAS, TELEMETRY_JOURNEYS, TELEMETRY_PRODUCERS, TelemetryEnvelopeDefaults, TelemetryEvent, TelemetryEventName, TelemetryGroupInput, TelemetryIdentifyInput, type TelemetryPort, TelemetryProducer, TelemetryProps, TelemetryRedactionOptions, TrackHandler, createCapxulBeforeSend, createPostHogBrowserPageviewTracker, getTrackHandler, initializeCapxulBrowserAnalytics, initializePostHogBrowserAnalytics, maskCapturedNetworkRequest, productAppAnalytics, redactTelemetryEvent, redactTelemetryProps, sanitizePostHogBrowserEvent, setTrackHandler, stampTelemetryEnvelope, track, utilityAppAnalytics };
package/dist/index.mjs CHANGED
@@ -87,6 +87,7 @@ const TELEMETRY_EVENT_NAMES = [
87
87
  "organization_creation_started",
88
88
  "organization_creation_ready",
89
89
  "organization_creation_failed",
90
+ "aa_gateway_upstream_fallback",
90
91
  "account_balance_read",
91
92
  "account_balance_failed",
92
93
  "faucet_requested",
@@ -468,6 +469,28 @@ const FaucetFailedProps = Schema.Struct({
468
469
  ...TelemetryEnvelopeProps,
469
470
  reason: OptionalString
470
471
  });
472
+ const AaGatewayUpstreamFallbackProps = Schema.Struct({
473
+ ...TelemetryEnvelopeProps,
474
+ method: Schema.String,
475
+ from_upstream: Schema.Literals([
476
+ "alchemy",
477
+ "infura",
478
+ "public"
479
+ ]),
480
+ to_upstream: Schema.optional(Schema.Literals([
481
+ "alchemy",
482
+ "infura",
483
+ "public"
484
+ ])),
485
+ failure: Schema.Literals([
486
+ "http-429",
487
+ "http-5xx",
488
+ "rpc-rate-limit",
489
+ "timeout",
490
+ "network"
491
+ ]),
492
+ status: Schema.optional(Schema.Number)
493
+ });
471
494
  const ORG_ID_TELEMETRY_RE = /^org_[0-9A-Za-z]+$/;
472
495
  const OrgIdTelemetrySchema = Schema.String.pipe(Schema.refine((value) => ORG_ID_TELEMETRY_RE.test(value), { message: "must be org_ plus an alphanumeric id" }));
473
496
  const OptionalOrgId = Schema.optional(OrgIdTelemetrySchema);
@@ -518,6 +541,8 @@ const OrganizationCreationFailedProps = Schema.Struct({
518
541
  stage: OnboardingStageSchema,
519
542
  error_code: Schema.String,
520
543
  retryable: Schema.Boolean,
544
+ /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
545
+ backoff_ms: Schema.optional(DurationMsSchema),
521
546
  failure_reason: Schema.optional(Schema.Literals([
522
547
  "deterministic_address_mismatch",
523
548
  "receipt_provider_unavailable",
@@ -768,6 +793,10 @@ const FaucetFailedTelemetryEventSchema = Schema.Struct({
768
793
  name: Schema.Literal("faucet_failed"),
769
794
  props: FaucetFailedProps
770
795
  });
796
+ const AaGatewayUpstreamFallbackTelemetryEventSchema = Schema.Struct({
797
+ name: Schema.Literal("aa_gateway_upstream_fallback"),
798
+ props: AaGatewayUpstreamFallbackProps
799
+ });
771
800
  const OrgCreateStartedTelemetryEventSchema = Schema.Struct({
772
801
  name: Schema.Literal("org_create_started"),
773
802
  props: OrgCreateStartedProps
@@ -866,6 +895,7 @@ const TELEMETRY_EVENT_SCHEMAS = {
866
895
  faucet_requested: FaucetRequestedTelemetryEventSchema,
867
896
  faucet_confirmed: FaucetConfirmedTelemetryEventSchema,
868
897
  faucet_failed: FaucetFailedTelemetryEventSchema,
898
+ aa_gateway_upstream_fallback: AaGatewayUpstreamFallbackTelemetryEventSchema,
869
899
  org_create_started: OrgCreateStartedTelemetryEventSchema,
870
900
  org_safe_created: OrgSafeCreatedTelemetryEventSchema,
871
901
  org_safe_confirmed: OrgSafeConfirmedTelemetryEventSchema,
@@ -1073,7 +1103,7 @@ function productAppAnalytics(input) {
1073
1103
  disable_conversations: true,
1074
1104
  disable_external_dependency_loading: false,
1075
1105
  person_profiles: "identified_only",
1076
- advanced_disable_flags: true,
1106
+ advanced_disable_flags: false,
1077
1107
  save_campaign_params: false,
1078
1108
  save_referrer: false,
1079
1109
  session_recording: {
@@ -1097,11 +1127,29 @@ function initializeCapxulBrowserAnalytics(profile, input, initialize) {
1097
1127
  const key = input.key?.trim();
1098
1128
  if (key === void 0 || key.length === 0) return void 0;
1099
1129
  try {
1100
- return initialize(key, profile(input));
1130
+ const options = profile(input);
1131
+ const client = initialize(key, options);
1132
+ warnWhenReplayHasNoRecorder(options, client);
1133
+ return client;
1101
1134
  } catch {
1102
1135
  return;
1103
1136
  }
1104
1137
  }
1138
+ let replayRecorderWarned = false;
1139
+ /**
1140
+ * #1709: `posthog-js/dist/module.slim` never registers the session recording
1141
+ * manager, so a profile that enables replay records nothing with it. The
1142
+ * client exposes the manager as `sessionRecording` once `init` ran on the
1143
+ * standard build. Warn once per page so the missing build is visible.
1144
+ */
1145
+ function warnWhenReplayHasNoRecorder(options, client) {
1146
+ if (replayRecorderWarned) return;
1147
+ const replayEnabled = typeof options === "object" && options !== null && options.disable_session_recording === false;
1148
+ const recorderMissing = typeof client === "object" && client !== null && client.sessionRecording === void 0;
1149
+ if (!replayEnabled || !recorderMissing) return;
1150
+ replayRecorderWarned = true;
1151
+ console.warn("@capxul/observability: session replay is enabled but the PostHog client has no session recording manager. Import the standard `posthog-js` build; `posthog-js/dist/module.slim` records nothing.");
1152
+ }
1105
1153
  /** The utility profile, pre-bound — the shape ADR-0016's consumers already use. */
1106
1154
  function initializePostHogBrowserAnalytics(input, initialize) {
1107
1155
  return initializeCapxulBrowserAnalytics(utilityAppAnalytics, input, initialize);
@@ -1456,4 +1504,4 @@ function rotr(value, bits) {
1456
1504
  return value >>> bits | value << 32 - bits;
1457
1505
  }
1458
1506
  //#endregion
1459
- export { AccountBalanceFailedTelemetryEventSchema, AccountBalanceReadTelemetryEventSchema, AuthFailedTelemetryEventSchema, AuthOtpDeliveredTelemetryEventSchema, AuthOtpExpiredTelemetryEventSchema, AuthOtpRequestedTelemetryEventSchema, AuthSignedOutTelemetryEventSchema, AuthVerifiedTelemetryEventSchema, BROWSER_GATED_TELEMETRY_EVENTS, BootstrapFailedTelemetryEventSchema, BootstrapResolvedTelemetryEventSchema, CAPXUL_ENVS, CONTRACT_FIRST_TELEMETRY_EVENTS, DepositInitiatedTelemetryEventSchema, DepositSettledTelemetryEventSchema, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, FaucetConfirmedTelemetryEventSchema, FaucetFailedTelemetryEventSchema, FaucetRequestedTelemetryEventSchema, InMemoryTelemetryBusAdapter, MemberActivationFailedTelemetryEventSchema, MemberActivationReadyTelemetryEventSchema, MemberActivationStartedTelemetryEventSchema, MovementScanCheckpointTelemetryEventSchema, MovementScanIncidentTelemetryEventSchema, MovementScanWindowTelemetryEventSchema, OnboardingDashboardReachedTelemetryEventSchema, OnboardingIntentSelectedTelemetryEventSchema, OnboardingOrganizationSubmittedTelemetryEventSchema, OnboardingProfileSubmittedTelemetryEventSchema, OrgCreateFailedTelemetryEventSchema, OrgCreateStartedTelemetryEventSchema, OrgCreatedTelemetryEventSchema, OrgInviteAcceptedTelemetryEventSchema, OrgInviteExpiredTelemetryEventSchema, OrgInviteSentTelemetryEventSchema, OrgRolesSeededTelemetryEventSchema, OrgSafeConfirmedTelemetryEventSchema, OrgSafeCreatedTelemetryEventSchema, OrganizationCreationFailedTelemetryEventSchema, OrganizationCreationReadyTelemetryEventSchema, OrganizationCreationStartedTelemetryEventSchema, PII, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, PaymentFailedTelemetryEventSchema, PaymentInitiatedTelemetryEventSchema, PaymentSettledTelemetryEventSchema, PermissionMirrorVerificationTelemetryEventSchema, PostHogTelemetryAdapter, ProvisioningSafeConfirmedTelemetryEventSchema, ProvisioningSafeCreatedTelemetryEventSchema, RecordingTelemetryAdapter, SYNCABLE_CAPXUL_ENVS, TELEMETRY_EVENT_NAMES, TELEMETRY_EVENT_SCHEMAS, TELEMETRY_JOURNEYS, TELEMETRY_PRODUCERS, createCapxulBeforeSend, createPostHogBrowserPageviewTracker, getTrackHandler, initializeCapxulBrowserAnalytics, initializePostHogBrowserAnalytics, maskCapturedNetworkRequest, productAppAnalytics, redactTelemetryEvent, redactTelemetryProps, sanitizePostHogBrowserEvent, setTrackHandler, stampTelemetryEnvelope, track, utilityAppAnalytics };
1507
+ export { AaGatewayUpstreamFallbackTelemetryEventSchema, AccountBalanceFailedTelemetryEventSchema, AccountBalanceReadTelemetryEventSchema, AuthFailedTelemetryEventSchema, AuthOtpDeliveredTelemetryEventSchema, AuthOtpExpiredTelemetryEventSchema, AuthOtpRequestedTelemetryEventSchema, AuthSignedOutTelemetryEventSchema, AuthVerifiedTelemetryEventSchema, BROWSER_GATED_TELEMETRY_EVENTS, BootstrapFailedTelemetryEventSchema, BootstrapResolvedTelemetryEventSchema, CAPXUL_ENVS, CONTRACT_FIRST_TELEMETRY_EVENTS, DepositInitiatedTelemetryEventSchema, DepositSettledTelemetryEventSchema, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, FaucetConfirmedTelemetryEventSchema, FaucetFailedTelemetryEventSchema, FaucetRequestedTelemetryEventSchema, InMemoryTelemetryBusAdapter, MemberActivationFailedTelemetryEventSchema, MemberActivationReadyTelemetryEventSchema, MemberActivationStartedTelemetryEventSchema, MovementScanCheckpointTelemetryEventSchema, MovementScanIncidentTelemetryEventSchema, MovementScanWindowTelemetryEventSchema, OnboardingDashboardReachedTelemetryEventSchema, OnboardingIntentSelectedTelemetryEventSchema, OnboardingOrganizationSubmittedTelemetryEventSchema, OnboardingProfileSubmittedTelemetryEventSchema, OrgCreateFailedTelemetryEventSchema, OrgCreateStartedTelemetryEventSchema, OrgCreatedTelemetryEventSchema, OrgInviteAcceptedTelemetryEventSchema, OrgInviteExpiredTelemetryEventSchema, OrgInviteSentTelemetryEventSchema, OrgRolesSeededTelemetryEventSchema, OrgSafeConfirmedTelemetryEventSchema, OrgSafeCreatedTelemetryEventSchema, OrganizationCreationFailedTelemetryEventSchema, OrganizationCreationReadyTelemetryEventSchema, OrganizationCreationStartedTelemetryEventSchema, PII, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, PaymentFailedTelemetryEventSchema, PaymentInitiatedTelemetryEventSchema, PaymentSettledTelemetryEventSchema, PermissionMirrorVerificationTelemetryEventSchema, PostHogTelemetryAdapter, ProvisioningSafeConfirmedTelemetryEventSchema, ProvisioningSafeCreatedTelemetryEventSchema, RecordingTelemetryAdapter, SYNCABLE_CAPXUL_ENVS, TELEMETRY_EVENT_NAMES, TELEMETRY_EVENT_SCHEMAS, TELEMETRY_JOURNEYS, TELEMETRY_PRODUCERS, createCapxulBeforeSend, createPostHogBrowserPageviewTracker, getTrackHandler, initializeCapxulBrowserAnalytics, initializePostHogBrowserAnalytics, maskCapturedNetworkRequest, productAppAnalytics, redactTelemetryEvent, redactTelemetryProps, sanitizePostHogBrowserEvent, setTrackHandler, stampTelemetryEnvelope, track, utilityAppAnalytics };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/observability",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",