@capxul/observability 4.20.0-beta.2 → 4.20.0-beta.21

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/dist/index.mjs CHANGED
@@ -1,2236 +1,2 @@
1
- import { a as CHAIN_UPSTREAMS, c as redactSecrets, i as CAPXUL_ERROR_CODES, l as redactUrlSecrets, n as isCapxulOperation, o as FAILURE_MODES, r as normalizeCapxulOperation, s as isCredentialField, t as CAPXUL_OPERATIONS } from "./operations-sJPrehYY.mjs";
2
- import { Effect, Schema, SchemaGetter } from "effect";
3
- //#region ../types/src/index.ts
4
- const EVM_ADDRESS_RE = /^0x[0-9a-f]{40}$/i;
5
- const BYTES32_RE = /^0x[0-9a-f]{64}$/i;
6
- `${"0".repeat(64)}`;
7
- const SUPPORTED_CURRENCIES = [
8
- {
9
- code: "USD",
10
- symbol: "$",
11
- name: "US Dollar"
12
- },
13
- {
14
- code: "NGN",
15
- symbol: "NGN",
16
- name: "Nigerian Naira"
17
- },
18
- {
19
- code: "GHS",
20
- symbol: "GHS",
21
- name: "Ghanaian Cedi"
22
- },
23
- {
24
- code: "KES",
25
- symbol: "KSh",
26
- name: "Kenyan Shilling"
27
- },
28
- {
29
- code: "UGX",
30
- symbol: "USh",
31
- name: "Ugandan Shilling"
32
- }
33
- ];
34
- SUPPORTED_CURRENCIES.map((currency) => currency.code);
35
- Object.fromEntries(SUPPORTED_CURRENCIES.map((currency) => [currency.code, currency.symbol]));
36
- const APP_ID_RE = /^app_[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
37
- Math.floor(Number.MAX_SAFE_INTEGER / 1e3);
38
- //#endregion
39
- //#region src/index.ts
40
- const TELEMETRY_EVENT_NAMES = [
41
- "auth_otp_requested",
42
- "auth_otp_delivered",
43
- "auth_otp_expired",
44
- "auth_verified",
45
- "auth_failed",
46
- "identity_refused",
47
- "auth_signed_out",
48
- "onboarding_intent_selected",
49
- "onboarding_profile_submitted",
50
- "onboarding_organization_submitted",
51
- "onboarding_dashboard_reached",
52
- "provisioning_safe_created",
53
- "provisioning_safe_confirmed",
54
- "bootstrap_resolved",
55
- "bootstrap_failed",
56
- "member_activation_started",
57
- "member_activation_ready",
58
- "member_activation_failed",
59
- "organization_creation_started",
60
- "organization_creation_ready",
61
- "organization_creation_failed",
62
- "chain_upstream_fallback",
63
- "bundler_error",
64
- "receipt_pending",
65
- "operation_retried",
66
- "account_balance_read",
67
- "account_balance_failed",
68
- "faucet_requested",
69
- "faucet_confirmed",
70
- "faucet_failed",
71
- "org_create_started",
72
- "org_safe_created",
73
- "org_safe_confirmed",
74
- "org_roles_seeded",
75
- "org_created",
76
- "org_create_failed",
77
- "org_invite_sent",
78
- "org_invite_accepted",
79
- "org_invite_expired",
80
- "payment_initiated",
81
- "payment_settled",
82
- "payment_failed",
83
- "payment_verification_retry",
84
- "payment_lifecycle_transition",
85
- "quick_pay_external_address_acknowledged",
86
- "deposit_initiated",
87
- "deposit_settled",
88
- "permission_mirror_verification",
89
- "movement_scan_window",
90
- "movement_scan_checkpoint",
91
- "movement_scan_incident",
92
- "indexer_drift_corrected",
93
- "activity_annotation_saved",
94
- "ui_activity_action_completed",
95
- "contact_relationship_changed",
96
- "ui_contact_action_completed",
97
- "access_recovery_completed",
98
- "ui_access_step_completed",
99
- "org_invite_progressed",
100
- "invoice_issued",
101
- "invoice_request_transitioned",
102
- "ui_invoice_step_completed",
103
- "ui_treasury_step_completed",
104
- "ui_receive_step_completed",
105
- "payroll_group_changed",
106
- "payroll_run_transitioned",
107
- "ui_payroll_action_completed",
108
- "cli_diagnostic_completed"
109
- ];
110
- const TELEMETRY_JOURNEYS = {
111
- returning_user_login: {
112
- type: "funnel",
113
- steps: [
114
- "auth_otp_requested",
115
- "auth_otp_delivered",
116
- "auth_verified"
117
- ],
118
- drops_on: ["auth_otp_expired", "auth_failed"]
119
- },
120
- new_user_first_signin: {
121
- type: "funnel",
122
- steps: [
123
- "auth_otp_requested",
124
- "auth_otp_delivered",
125
- "auth_verified",
126
- "provisioning_safe_created",
127
- "provisioning_safe_confirmed"
128
- ],
129
- drops_on: ["auth_otp_expired", "auth_failed"]
130
- },
131
- sign_out_session_close: {
132
- type: "point_event",
133
- point_event: "auth_signed_out"
134
- },
135
- member_activation: {
136
- type: "funnel",
137
- steps: ["member_activation_started", "member_activation_ready"],
138
- drops_on: ["member_activation_failed"]
139
- },
140
- organization_creation_lifecycle: {
141
- type: "funnel",
142
- steps: ["organization_creation_started", "organization_creation_ready"],
143
- drops_on: ["organization_creation_failed"]
144
- },
145
- new_member_personal_dashboard: {
146
- type: "funnel",
147
- steps: [
148
- "auth_verified",
149
- "onboarding_intent_selected",
150
- "onboarding_profile_submitted",
151
- "member_activation_ready",
152
- "onboarding_dashboard_reached"
153
- ],
154
- step_filters: {
155
- onboarding_intent_selected: [{
156
- key: "intent",
157
- value: ["personal"],
158
- operator: "exact",
159
- type: "event"
160
- }, {
161
- key: "entry_point",
162
- value: ["signup"],
163
- operator: "exact",
164
- type: "event"
165
- }],
166
- onboarding_profile_submitted: [{
167
- key: "intent",
168
- value: ["personal"],
169
- operator: "exact",
170
- type: "event"
171
- }],
172
- onboarding_dashboard_reached: [{
173
- key: "intent",
174
- value: ["personal"],
175
- operator: "exact",
176
- type: "event"
177
- }]
178
- }
179
- },
180
- new_member_organization_dashboard: {
181
- type: "funnel",
182
- steps: [
183
- "auth_verified",
184
- "onboarding_intent_selected",
185
- "onboarding_profile_submitted",
186
- "onboarding_organization_submitted",
187
- "member_activation_started",
188
- "member_activation_ready",
189
- "organization_creation_started",
190
- "organization_creation_ready",
191
- "onboarding_dashboard_reached"
192
- ],
193
- step_filters: {
194
- onboarding_intent_selected: [{
195
- key: "intent",
196
- value: ["organization"],
197
- operator: "exact",
198
- type: "event"
199
- }, {
200
- key: "entry_point",
201
- value: ["signup"],
202
- operator: "exact",
203
- type: "event"
204
- }],
205
- onboarding_profile_submitted: [{
206
- key: "intent",
207
- value: ["organization"],
208
- operator: "exact",
209
- type: "event"
210
- }],
211
- onboarding_dashboard_reached: [{
212
- key: "intent",
213
- value: ["organization"],
214
- operator: "exact",
215
- type: "event"
216
- }]
217
- }
218
- },
219
- existing_member_organization_dashboard: {
220
- type: "funnel",
221
- steps: [
222
- "onboarding_intent_selected",
223
- "onboarding_organization_submitted",
224
- "organization_creation_started",
225
- "organization_creation_ready",
226
- "onboarding_dashboard_reached"
227
- ],
228
- step_filters: {
229
- onboarding_intent_selected: [{
230
- key: "intent",
231
- value: ["organization"],
232
- operator: "exact",
233
- type: "event"
234
- }, {
235
- key: "entry_point",
236
- value: ["dashboard"],
237
- operator: "exact",
238
- type: "event"
239
- }],
240
- onboarding_dashboard_reached: [{
241
- key: "intent",
242
- value: ["organization"],
243
- operator: "exact",
244
- type: "event"
245
- }]
246
- }
247
- },
248
- money_on_screen: {
249
- type: "point_event",
250
- point_event: "account_balance_read"
251
- },
252
- fund_account: {
253
- type: "funnel",
254
- steps: ["faucet_requested", "faucet_confirmed"],
255
- drops_on: ["faucet_failed"]
256
- },
257
- org_creation: {
258
- type: "funnel",
259
- steps: [
260
- "org_create_started",
261
- "org_safe_created",
262
- "org_safe_confirmed",
263
- "org_roles_seeded",
264
- "org_created"
265
- ],
266
- drops_on: ["org_create_failed"]
267
- },
268
- org_member_onboarding: {
269
- type: "funnel",
270
- steps: ["org_invite_sent", "org_invite_accepted"],
271
- drops_on: ["org_invite_expired"]
272
- },
273
- direct_payment: {
274
- type: "funnel",
275
- steps: ["payment_initiated", "payment_settled"],
276
- drops_on: ["payment_failed"]
277
- },
278
- deposit: {
279
- type: "funnel",
280
- steps: ["deposit_initiated", "deposit_settled"]
281
- }
282
- };
283
- const PII = Schema.String.pipe(Schema.brand("PII"));
284
- const OptionalString = Schema.optional(Schema.String);
285
- const AddressSchema = Schema.String.pipe(Schema.decodeTo(Schema.String, {
286
- decode: SchemaGetter.transform((value) => value.toLowerCase()),
287
- encode: SchemaGetter.transform((value) => value)
288
- }), Schema.refine((value) => EVM_ADDRESS_RE.test(value), { message: "must be 0x + 40 hex chars" }));
289
- const AppIdSchema = Schema.String.pipe(Schema.refine((value) => APP_ID_RE.test(value), { message: "must be app_ plus a ULID" }));
290
- const BlockNumberSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value >= 0, { message: "must be a non-negative safe integer" }));
291
- const ChainIdSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value > 0, { message: "must be a positive safe integer" }));
292
- const DurationMsSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value >= 0, { message: "must be a non-negative safe integer" }));
293
- const EpochMsSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value >= 0, { message: "must be a non-negative safe integer" }));
294
- const PublishableKeyIdSchema = Schema.String.pipe(Schema.refine((value) => value.length > 0, { message: "must be a non-empty string" }));
295
- const TxHashSchema = Schema.String.pipe(Schema.refine((value) => BYTES32_RE.test(value), { message: "must be 0x + 64 hex chars" }));
296
- const ACCOUNT_ID_TELEMETRY_RE = /^account_[0-9A-Za-z]+$/;
297
- const WEI_AMOUNT_TELEMETRY_RE = /^[0-9]+$/;
298
- const AccountIdSchema = Schema.String.pipe(Schema.refine((value) => ACCOUNT_ID_TELEMETRY_RE.test(value), { message: "must be account_ plus an alphanumeric id" }));
299
- const WeiAmountSchema = Schema.String.pipe(Schema.refine((value) => WEI_AMOUNT_TELEMETRY_RE.test(value), { message: "must be a non-negative integer string" }));
300
- const CurrencyCodeSchema = Schema.String.pipe(Schema.refine((value) => value.length > 0, { message: "must be a non-empty currency code" }));
301
- const BalanceBucketSchema = Schema.Literals(["zero", "nonzero"]);
302
- const OptionalAccountId = Schema.optional(AccountIdSchema);
303
- const OptionalWeiAmount = Schema.optional(WeiAmountSchema);
304
- const OptionalCurrencyCode = Schema.optional(CurrencyCodeSchema);
305
- const OptionalBalanceBucket = Schema.optional(BalanceBucketSchema);
306
- /** Which Safe a money record is about. Declared here so the money-domain
307
- * props below can name it as well as the UI-step props further down. */
308
- const AccountKindSchema = Schema.Literals(["personalSafe", "orgTreasury"]);
309
- const OptionalAccountKind = Schema.optional(AccountKindSchema);
310
- const OptionalAddress = Schema.optional(AddressSchema);
311
- const OptionalAppId = Schema.optional(AppIdSchema);
312
- const OptionalBlockNumber = Schema.optional(BlockNumberSchema);
313
- const OptionalChainId = Schema.optional(ChainIdSchema);
314
- const OptionalDurationMs = Schema.optional(DurationMsSchema);
315
- const OptionalEpochMs = Schema.optional(EpochMsSchema);
316
- const OptionalPublishableKeyId = Schema.optional(PublishableKeyIdSchema);
317
- const OptionalTxHash = Schema.optional(TxHashSchema);
318
- /**
319
- * Environment discriminator (ADR-0020 A1 amendment, 2026-08-07). PostHog
320
- * project 368736 is the SINGLE sink for every environment, so `capxul_env` —
321
- * not project isolation — is what keeps a production surface from reading dev
322
- * traffic. It is REQUIRED on every catalog event and every synced artifact
323
- * filters on it.
324
- *
325
- * `unknown` is a defect marker, not an environment: it means a producer
326
- * reached the transport without declaring where it runs. It is in the union so
327
- * the property is never ABSENT (an absent property is invisible to a filter,
328
- * a present `unknown` is loud), and sync v2 never synthesizes an artifact for
329
- * it.
330
- */
331
- const CAPXUL_ENVS = [
332
- "development",
333
- "staging",
334
- "production",
335
- "unknown",
336
- "local"
337
- ];
338
- /**
339
- * Environments a synced product surface may be built for. `unknown` and
340
- * `local` cannot. This list is deliberately narrower than `CAPXUL_ENVS`.
341
- */
342
- const SYNCABLE_CAPXUL_ENVS = [
343
- "development",
344
- "staging",
345
- "production"
346
- ];
347
- /**
348
- * Which half of the system emitted the event. REQUIRED alongside `capxul_env`
349
- * so a name that two halves can produce (settlement, auth) stays attributable.
350
- */
351
- const TELEMETRY_PRODUCERS = [
352
- "server",
353
- "browser",
354
- "sdk",
355
- "mcp",
356
- "e2e"
357
- ];
358
- /**
359
- * The canonical envelope (ADR-0020 A4): snake_case ONLY. `capxul_env` and
360
- * `producer` are REQUIRED — a boundary that forgets to stamp them fails schema
361
- * decode instead of silently shipping an unattributable event. Call sites do
362
- * not pass them: `stampTelemetryEnvelope` injects them at the emit boundary,
363
- * which is the only place that knows where the process runs.
364
- */
365
- const TelemetryEnvelopeProps = {
366
- capxul_env: Schema.Literals(CAPXUL_ENVS),
367
- producer: Schema.Literals(TELEMETRY_PRODUCERS),
368
- journey_id: OptionalString,
369
- correlation_id: OptionalString,
370
- sdk_version: OptionalString
371
- };
372
- /**
373
- * The cause of a failure, flat (ADR-0023 R7–R8). `failure_mode` is the one
374
- * word from `@capxul/errors`; the `chain_*` keys are the `ChainCause` when the
375
- * failure came from the chain path. Spread into every failure event and posted
376
- * on `$exception`, so one PostHog filter finds a cause wherever it was seen.
377
- */
378
- const FailureModeSchema = Schema.Literals(FAILURE_MODES);
379
- const ChainUpstreamSchema = Schema.Literals(CHAIN_UPSTREAMS);
380
- /**
381
- * The refusing upstream's response headers (#1818): exactly the names in
382
- * `RESPONSE_HEADER_ALLOWLIST`, each optional, so the catalog itself refuses a
383
- * `set-cookie` or `authorization` that a producer let through.
384
- */
385
- const ResponseHeadersSchema = Schema.Struct({
386
- "retry-after": OptionalString,
387
- "www-authenticate": OptionalString,
388
- "content-type": OptionalString,
389
- "x-request-id": OptionalString,
390
- "cf-ray": OptionalString,
391
- "x-ratelimit-remaining": OptionalString,
392
- "x-ratelimit-reset": OptionalString,
393
- server: OptionalString
394
- });
395
- /** One upstream tried, flat (#1818): the `chain_attempts` entry on every producer's row. */
396
- const ChainAttemptSchema = Schema.Struct({
397
- upstream: ChainUpstreamSchema,
398
- failure_mode: FailureModeSchema,
399
- http_status: Schema.optional(Schema.Number),
400
- rpc_code: Schema.optional(Schema.Number),
401
- duration_ms: Schema.Number
402
- });
403
- const ChainCauseTelemetryProps = {
404
- failure_mode: Schema.optional(FailureModeSchema),
405
- chain_upstream: Schema.optional(ChainUpstreamSchema),
406
- chain_method: OptionalString,
407
- chain_retryable: Schema.optional(Schema.Boolean),
408
- chain_http_status: Schema.optional(Schema.Number),
409
- chain_rpc_code: Schema.optional(Schema.Number),
410
- chain_revert_name: OptionalString,
411
- chain_revert_selector: OptionalString,
412
- chain_revert_args: Schema.optional(Schema.Record(Schema.String, Schema.String)),
413
- chain_provider_message: OptionalString,
414
- chain_attempts: Schema.optional(Schema.Array(ChainAttemptSchema)),
415
- chain_response_headers: Schema.optional(ResponseHeadersSchema)
416
- };
417
- /**
418
- * Stamp the required envelope onto an event at its emit boundary. Call-site
419
- * props win on conflict: a relay that already knows the true producer (the
420
- * browser-failure relay stamps `browser` while running on the server) must not
421
- * be overwritten by the transport's own default.
422
- */
423
- function stampTelemetryEnvelope(event, defaults) {
424
- return {
425
- name: event.name,
426
- props: {
427
- ...defaults,
428
- ...event.props
429
- }
430
- };
431
- }
432
- const AuthOtpRequestedProps = Schema.Struct({
433
- ...TelemetryEnvelopeProps,
434
- email: Schema.optional(PII),
435
- email_domain: OptionalString
436
- });
437
- const AuthOtpDeliveredProps = Schema.Struct({
438
- ...TelemetryEnvelopeProps,
439
- durationMs: OptionalDurationMs,
440
- email: Schema.optional(PII),
441
- email_domain: OptionalString,
442
- resendMessageId: OptionalString
443
- });
444
- const AuthOtpExpiredProps = Schema.Struct({
445
- ...TelemetryEnvelopeProps,
446
- email: Schema.optional(PII),
447
- email_domain: OptionalString
448
- });
449
- const AuthVerifiedProps = Schema.Struct({
450
- ...TelemetryEnvelopeProps,
451
- auth_type: OptionalString
452
- });
453
- const AuthFailedProps = Schema.Struct({
454
- ...TelemetryEnvelopeProps,
455
- ...ChainCauseTelemetryProps,
456
- email: Schema.optional(PII),
457
- auth_type: OptionalString,
458
- reason: OptionalString
459
- });
460
- const IdentityRefusedProps = Schema.Struct({
461
- ...TelemetryEnvelopeProps,
462
- /** The refused identity event tag, for example CreateOrganization. */
463
- event: OptionalString,
464
- /** The machine's refusal code: WRONG_STATE, SUPERSEDED or STALE_EPOCH. */
465
- refusal_code: OptionalString,
466
- /** The machine slot the request targeted, for example identity:org. */
467
- slot: OptionalString,
468
- /** The machine state at refusal, for example authenticated:claiming. */
469
- state: OptionalString
470
- });
471
- const AuthSignedOutProps = Schema.Struct(TelemetryEnvelopeProps);
472
- const ProvisioningSafeCreatedProps = Schema.Struct({
473
- ...TelemetryEnvelopeProps,
474
- safe_address: OptionalAddress
475
- });
476
- const ProvisioningSafeConfirmedProps = Schema.Struct({
477
- ...TelemetryEnvelopeProps,
478
- chainId: OptionalChainId,
479
- deployedAt: OptionalEpochMs,
480
- deployedAtBlock: OptionalBlockNumber,
481
- deployTxHash: OptionalTxHash,
482
- durationMs: OptionalDurationMs,
483
- safe_address: OptionalAddress,
484
- userOpHash: OptionalTxHash
485
- });
486
- const BootstrapResolvedProps = Schema.Struct({
487
- ...TelemetryEnvelopeProps,
488
- applicationId: OptionalAppId,
489
- durationMs: OptionalDurationMs,
490
- env: OptionalString,
491
- keyId: OptionalPublishableKeyId,
492
- origin: OptionalString
493
- });
494
- const BootstrapFailedProps = Schema.Struct({
495
- ...TelemetryEnvelopeProps,
496
- ...ChainCauseTelemetryProps,
497
- applicationId: OptionalAppId,
498
- durationMs: OptionalDurationMs,
499
- origin: OptionalString,
500
- provider: OptionalString,
501
- provider_operation: OptionalString,
502
- reason: OptionalString,
503
- target_host: OptionalString
504
- });
505
- /**
506
- * R08 (#1966): which Safe was read, on which chain, of which token. `currency`
507
- * is the DISPLAY code the surface shows ("USD"); it never says which ERC-20 the
508
- * `balanceOf` actually hit, so a reader could not tell a treasury read from a
509
- * personal one, nor USDX from any other dollar-labelled token. The producer
510
- * takes each of these from the authority that already decided it — the verified
511
- * Organization row's chain, the configured token address — never from a label.
512
- * The verified `organization_id` and its group arrive from the backend
513
- * attribution, so they are not repeated here.
514
- */
515
- const AccountBalanceReadProps = Schema.Struct({
516
- ...TelemetryEnvelopeProps,
517
- account_id: OptionalAccountId,
518
- account_kind: OptionalAccountKind,
519
- chain_id: OptionalChainId,
520
- token_address: OptionalAddress,
521
- currency: OptionalCurrencyCode,
522
- balance_bucket: OptionalBalanceBucket,
523
- durationMs: OptionalDurationMs
524
- });
525
- const AccountBalanceFailedProps = Schema.Struct({
526
- ...TelemetryEnvelopeProps,
527
- ...ChainCauseTelemetryProps,
528
- reason: OptionalString
529
- });
530
- const FaucetRequestedProps = Schema.Struct({
531
- ...TelemetryEnvelopeProps,
532
- amount: OptionalWeiAmount,
533
- chainId: OptionalChainId
534
- });
535
- const FaucetConfirmedProps = Schema.Struct({
536
- ...TelemetryEnvelopeProps,
537
- amount: OptionalWeiAmount,
538
- chainId: OptionalChainId,
539
- txHash: OptionalTxHash,
540
- durationMs: OptionalDurationMs
541
- });
542
- const FaucetFailedProps = Schema.Struct({
543
- ...TelemetryEnvelopeProps,
544
- ...ChainCauseTelemetryProps,
545
- reason: OptionalString
546
- });
547
- const ChainServiceSchema = Schema.Literals(["aa-gateway", "backend"]);
548
- const ChainUpstreamFallbackProps = Schema.Struct({
549
- ...TelemetryEnvelopeProps,
550
- service: ChainServiceSchema,
551
- method: Schema.String,
552
- from_upstream: ChainUpstreamSchema,
553
- to_upstream: Schema.optional(ChainUpstreamSchema),
554
- failure_mode: FailureModeSchema,
555
- exhausted: Schema.Boolean,
556
- http_status: Schema.optional(Schema.Number),
557
- rpc_code: Schema.optional(Schema.Number),
558
- response_headers: Schema.optional(ResponseHeadersSchema)
559
- });
560
- const BundlerErrorProps = Schema.Struct({
561
- ...TelemetryEnvelopeProps,
562
- method: Schema.String,
563
- failure_mode: FailureModeSchema,
564
- chain_upstream: ChainUpstreamSchema,
565
- chain_retryable: Schema.Boolean,
566
- http_status: Schema.optional(Schema.Number),
567
- rpc_code: Schema.optional(Schema.Number),
568
- chain_revert_name: OptionalString,
569
- chain_provider_message: OptionalString
570
- });
571
- const ReceiptPendingProps = Schema.Struct({
572
- ...TelemetryEnvelopeProps,
573
- service: ChainServiceSchema,
574
- method: Schema.String,
575
- chain_upstream: ChainUpstreamSchema,
576
- reason: Schema.Literals(["zero_block_hash", "no_receipt"])
577
- });
578
- const OperationRetriedProps = Schema.Struct({
579
- ...TelemetryEnvelopeProps,
580
- operation: Schema.String,
581
- failure_mode: FailureModeSchema,
582
- reason: Schema.optional(Schema.Literal("connection-lost-in-flight")),
583
- connection_id: OptionalString,
584
- connection_count: Schema.optional(Schema.Number),
585
- attempt: Schema.Number,
586
- delay_ms: DurationMsSchema
587
- });
588
- const ORG_ID_TELEMETRY_RE = /^org_[0-9A-Za-z]+$/;
589
- const OrgIdTelemetrySchema = Schema.String.pipe(Schema.refine((value) => ORG_ID_TELEMETRY_RE.test(value), { message: "must be org_ plus an alphanumeric id" }));
590
- const OptionalOrgId = Schema.optional(OrgIdTelemetrySchema);
591
- const AttemptNumberSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value > 0, { message: "must be a positive safe integer" }));
592
- const OnboardingStageSchema = Schema.Literals([
593
- "profile",
594
- "accountProvisioning",
595
- "accountClaim",
596
- "preparingFounderAccount",
597
- "awaitingFounderAuthorization",
598
- "submittingBootstrap",
599
- "confirmingBootstrap"
600
- ]);
601
- const MemberActivationStartedProps = Schema.Struct({
602
- ...TelemetryEnvelopeProps,
603
- $insert_id: Schema.String
604
- });
605
- const MemberActivationReadyProps = Schema.Struct({
606
- ...TelemetryEnvelopeProps,
607
- $insert_id: Schema.String,
608
- duration_ms: DurationMsSchema
609
- });
610
- const MemberActivationFailedProps = Schema.Struct({
611
- ...TelemetryEnvelopeProps,
612
- ...ChainCauseTelemetryProps,
613
- $insert_id: Schema.String,
614
- stage: OnboardingStageSchema,
615
- error_code: Schema.String,
616
- retryable: Schema.Boolean
617
- });
618
- const OrganizationCreationStartedProps = Schema.Struct({
619
- ...TelemetryEnvelopeProps,
620
- $insert_id: Schema.String,
621
- organization_id: OrgIdTelemetrySchema,
622
- attempt_number: AttemptNumberSchema
623
- });
624
- const OrganizationCreationReadyProps = Schema.Struct({
625
- ...TelemetryEnvelopeProps,
626
- $insert_id: Schema.String,
627
- organization_id: OrgIdTelemetrySchema,
628
- attempt_number: AttemptNumberSchema,
629
- duration_ms: DurationMsSchema
630
- });
631
- const OrganizationCreationFailedProps = Schema.Struct({
632
- ...TelemetryEnvelopeProps,
633
- ...ChainCauseTelemetryProps,
634
- $insert_id: Schema.String,
635
- organization_id: OrgIdTelemetrySchema,
636
- attempt_number: AttemptNumberSchema,
637
- stage: OnboardingStageSchema,
638
- error_code: Schema.String,
639
- retryable: Schema.Boolean,
640
- /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
641
- backoff_ms: Schema.optional(DurationMsSchema),
642
- failure_reason: Schema.optional(Schema.Literals([
643
- "deterministic_address_mismatch",
644
- "receipt_provider_unavailable",
645
- "receipt_mismatch",
646
- "block_provider_unavailable",
647
- "authority_event_mismatch",
648
- "allowance_timestamp_mismatch",
649
- "receipt_identity_unavailable",
650
- "receipt_identity_mismatch",
651
- "contract_code_unavailable",
652
- "contract_state_mismatch",
653
- "permission_projection_mismatch"
654
- ]))
655
- });
656
- const OnboardingIntentSchema = Schema.Literals(["personal", "organization"]);
657
- const OnboardingIntentSelectedProps = Schema.Struct({
658
- ...TelemetryEnvelopeProps,
659
- journey_id: Schema.String,
660
- intent: OnboardingIntentSchema,
661
- entry_point: Schema.String
662
- });
663
- const OnboardingProfileSubmittedProps = Schema.Struct({
664
- ...TelemetryEnvelopeProps,
665
- journey_id: Schema.String,
666
- intent: OnboardingIntentSchema
667
- });
668
- const OnboardingOrganizationSubmittedProps = Schema.Struct({
669
- ...TelemetryEnvelopeProps,
670
- journey_id: Schema.String
671
- });
672
- const OnboardingDashboardReachedProps = Schema.Struct({
673
- ...TelemetryEnvelopeProps,
674
- journey_id: Schema.String,
675
- intent: OnboardingIntentSchema,
676
- organization_id: Schema.optional(OrgIdTelemetrySchema)
677
- });
678
- const OrgCreateStartedProps = Schema.Struct({
679
- ...TelemetryEnvelopeProps,
680
- org_id: OptionalOrgId,
681
- email_domain: OptionalString,
682
- template: OptionalString
683
- });
684
- const OrgSafeCreatedProps = Schema.Struct({
685
- ...TelemetryEnvelopeProps,
686
- org_id: OptionalOrgId,
687
- chainId: OptionalChainId,
688
- safe_address: OptionalAddress
689
- });
690
- const OrgSafeConfirmedProps = Schema.Struct({
691
- ...TelemetryEnvelopeProps,
692
- org_id: OptionalOrgId,
693
- chainId: OptionalChainId,
694
- safe_address: OptionalAddress,
695
- durationMs: OptionalDurationMs
696
- });
697
- const OrgRolesSeededProps = Schema.Struct({
698
- ...TelemetryEnvelopeProps,
699
- org_id: OptionalOrgId,
700
- chainId: OptionalChainId,
701
- role: OptionalString,
702
- txHash: OptionalTxHash
703
- });
704
- const OrgCreatedProps = Schema.Struct({
705
- ...TelemetryEnvelopeProps,
706
- org_id: OptionalOrgId,
707
- chainId: OptionalChainId,
708
- safe_address: OptionalAddress,
709
- durationMs: OptionalDurationMs
710
- });
711
- const OrgCreateFailedProps = Schema.Struct({
712
- ...TelemetryEnvelopeProps,
713
- ...ChainCauseTelemetryProps,
714
- org_id: OptionalOrgId,
715
- reason: OptionalString
716
- });
717
- const OrgInviteSentProps = Schema.Struct({
718
- ...TelemetryEnvelopeProps,
719
- org_id: OptionalOrgId,
720
- email_domain: OptionalString,
721
- role: OptionalString,
722
- status: OptionalString
723
- });
724
- const OrgInviteAcceptedProps = Schema.Struct({
725
- ...TelemetryEnvelopeProps,
726
- org_id: OptionalOrgId,
727
- role: OptionalString,
728
- status: OptionalString
729
- });
730
- const OrgInviteExpiredProps = Schema.Struct({
731
- ...TelemetryEnvelopeProps,
732
- org_id: OptionalOrgId,
733
- email_domain: OptionalString,
734
- reason: OptionalString,
735
- role: OptionalString,
736
- status: OptionalString
737
- });
738
- const RecipientLocatorKindSchema = Schema.Literals([
739
- "handle",
740
- "email",
741
- "address",
742
- "party"
743
- ]);
744
- const RecipientResolutionStatusSchema = Schema.Literals([
745
- "known_party",
746
- "new_email",
747
- "external_address"
748
- ]);
749
- const RecipientPartyKindSchema = Schema.Literals([
750
- "person",
751
- "organization",
752
- "unresolved"
753
- ]);
754
- const RecipientTelemetryProps = {
755
- recipient_locator_kind: Schema.optional(RecipientLocatorKindSchema),
756
- recipient_resolution_status: Schema.optional(RecipientResolutionStatusSchema),
757
- recipient_party_id: OptionalString,
758
- recipient_party_kind: Schema.optional(RecipientPartyKindSchema),
759
- recipient_is_capxul_account: Schema.optional(Schema.Boolean),
760
- recipient_handle: OptionalString,
761
- recipient_address: OptionalAddress,
762
- external_address_acknowledged: Schema.optional(Schema.Boolean)
763
- };
764
- const PaymentInitiatedProps = Schema.Struct({
765
- command_id: OptionalString,
766
- execution_id: OptionalString,
767
- payment_lifecycle_id: OptionalString,
768
- ...TelemetryEnvelopeProps,
769
- ...RecipientTelemetryProps,
770
- kind: Schema.String,
771
- payment_id: Schema.String
772
- });
773
- const PaymentLifecycleProps = {
774
- payment_state: OptionalString,
775
- execution_state: OptionalString,
776
- occurred_at: Schema.optional(Schema.Number),
777
- causal_sequence: Schema.optional(Schema.Number),
778
- sponsorship_valid_until: Schema.optional(Schema.Number),
779
- terminal_event_id: OptionalString
780
- };
781
- const PaymentSettledL2Props = Schema.Struct({
782
- ...PaymentLifecycleProps,
783
- ...TelemetryEnvelopeProps,
784
- ...RecipientTelemetryProps,
785
- kind: Schema.String,
786
- chain_id: Schema.Number,
787
- settlement_id: Schema.String,
788
- payment_id: OptionalString,
789
- payment_ids: OptionalString,
790
- command_id: OptionalString,
791
- payment_lifecycle_id: OptionalString,
792
- execution_id: OptionalString,
793
- user_op_hash: OptionalString,
794
- transaction_hash: OptionalString
795
- });
796
- const PaymentFailedL2Props = Schema.Struct({
797
- ...PaymentLifecycleProps,
798
- ...TelemetryEnvelopeProps,
799
- ...ChainCauseTelemetryProps,
800
- ...RecipientTelemetryProps,
801
- kind: Schema.String,
802
- payment_id: Schema.String,
803
- payment_ids: OptionalString,
804
- reason_code: Schema.String,
805
- command_id: OptionalString,
806
- payment_lifecycle_id: OptionalString,
807
- execution_id: OptionalString,
808
- user_op_hash: OptionalString
809
- });
810
- const PaymentVerificationRetryProps = Schema.Struct({
811
- ...PaymentLifecycleProps,
812
- ...TelemetryEnvelopeProps,
813
- ...RecipientTelemetryProps,
814
- command_id: Schema.String,
815
- payment_lifecycle_id: Schema.String,
816
- attempt: Schema.Number,
817
- reason_code: Schema.String,
818
- chain_id: Schema.Number,
819
- delay_ms: DurationMsSchema,
820
- outcome: Schema.Literals(["scheduled", "unresolved"]),
821
- payment_id: OptionalString,
822
- payment_ids: OptionalString,
823
- execution_id: OptionalString,
824
- user_op_hash: OptionalString
825
- });
826
- const PaymentLifecycleTransitionProps = Schema.Struct({
827
- ...TelemetryEnvelopeProps,
828
- ...RecipientTelemetryProps,
829
- payment_id: Schema.String,
830
- payment_lifecycle_id: Schema.String,
831
- command_id: Schema.String,
832
- payment_state: Schema.String,
833
- occurred_at: Schema.Number,
834
- causal_sequence: Schema.Number,
835
- execution_id: OptionalString,
836
- execution_state: OptionalString,
837
- user_op_hash: OptionalString,
838
- sponsorship_valid_until: Schema.optional(Schema.Number),
839
- reason_code: OptionalString
840
- });
841
- const QuickPayExternalAddressAcknowledgedProps = Schema.Struct({
842
- ...TelemetryEnvelopeProps,
843
- recipient_locator_kind: Schema.Literal("address"),
844
- recipient_resolution_status: Schema.Literal("external_address"),
845
- recipient_address: AddressSchema,
846
- external_address_acknowledged: Schema.Literal(true),
847
- organization_id: OptionalOrgId
848
- });
849
- const DepositInitiatedProps = Schema.Struct({
850
- ...TelemetryEnvelopeProps,
851
- scope_kind: Schema.optional(Schema.Literals(["account", "organization"])),
852
- account_kind: Schema.optional(Schema.Literals(["personalSafe", "orgTreasury"])),
853
- chain_id: Schema.optional(Schema.Number),
854
- network: Schema.optional(Schema.Literal("base-sepolia")),
855
- organization_id: OptionalOrgId,
856
- $groups: Schema.optional(Schema.Struct({ organization: OptionalOrgId })),
857
- actor_id: OptionalString,
858
- actor_kind: Schema.optional(Schema.Literal("authenticated")),
859
- distinct_id: OptionalString,
860
- trace_id: OptionalString,
861
- span_id: OptionalString
862
- });
863
- const DepositSettledProps = Schema.Struct({
864
- ...TelemetryEnvelopeProps,
865
- chain_id: Schema.Number,
866
- tx_hash: Schema.String,
867
- log_index: Schema.Number
868
- });
869
- const PermissionMirrorVerificationProps = Schema.Struct({
870
- ...TelemetryEnvelopeProps,
871
- /** The RECEIPT verification outcome. What the mirror then did is separate. */
872
- outcome: Schema.String,
873
- reason: Schema.String,
874
- chain_id: Schema.Number,
875
- retry_count: Schema.Number,
876
- /**
877
- * #1960 R02, consumed by R03. A verified receipt is not an applied Permission:
878
- * these two optional fields let the producer say what the applying mutation
879
- * actually returned, and which command it was, without either fact rewriting
880
- * the receipt outcome above. Absent when application has not happened yet.
881
- */
882
- application_result: Schema.optional(Schema.Literals([
883
- "applied",
884
- "replayed",
885
- "conflicting_replay",
886
- "revision_mismatch"
887
- ])),
888
- command_id: OptionalString,
889
- /**
890
- * #1961 R03. The authorized stored row names the Permission it changed; the
891
- * verified receipt names the chain facts that prove it. Every field is
892
- * optional because a pending or provider-failed verification has neither an
893
- * application result nor a receipt to report.
894
- */
895
- permission_id: OptionalString,
896
- permission_assignment_id: OptionalString,
897
- permission_operation: Schema.optional(Schema.Literals([
898
- "create",
899
- "change",
900
- "assign",
901
- "revoke",
902
- "replace"
903
- ])),
904
- revision: Schema.optional(Schema.Number),
905
- user_op_hash: OptionalString,
906
- transaction_hash: OptionalString,
907
- block_number: Schema.optional(Schema.Number),
908
- log_index: Schema.optional(Schema.Number)
909
- });
910
- const MovementScanWindowProps = Schema.Struct({
911
- ...TelemetryEnvelopeProps,
912
- chain_id: Schema.Number,
913
- token_address: Schema.String,
914
- from_block: Schema.Number,
915
- to_block: Schema.Number,
916
- log_count: Schema.Number,
917
- request_count: Schema.Number,
918
- outcome: Schema.String
919
- });
920
- const MovementScanCheckpointProps = Schema.Struct({
921
- ...TelemetryEnvelopeProps,
922
- chain_id: Schema.Number,
923
- token_address: Schema.String,
924
- next_block: Schema.Number,
925
- anchor_block_number: Schema.Number
926
- });
927
- const MovementScanIncidentProps = Schema.Struct({
928
- ...TelemetryEnvelopeProps,
929
- chain_id: Schema.Number,
930
- token_address: Schema.String,
931
- incident_kind: Schema.String,
932
- anchor_block_number: Schema.Number
933
- });
934
- /**
935
- * One durable row the reconciliation job corrected against Ponder (SPEC D9).
936
- *
937
- * Both block fields are optional and for the same reason: a correction INTO
938
- * drift (a Payment settled in Convex whose Ponder fact a reorg removed) has no
939
- * current block, and a correction that confirms a later fact has one.
940
- *
941
- * `projection_kind` is closed. A later ticket that reconciles a deploy, a
942
- * bootstrap or a grant outcome adds its kind here in the same change; an
943
- * unknown kind must not decode.
944
- */
945
- const IndexerDriftCorrectedProps = Schema.Struct({
946
- ...TelemetryEnvelopeProps,
947
- projection_kind: Schema.Literals([
948
- "member_authority",
949
- "payment_settlement",
950
- "permission_assignment"
951
- ]),
952
- previous_state: Schema.String,
953
- current_state: Schema.String,
954
- previous_block: Schema.optional(Schema.Number),
955
- current_block: Schema.optional(Schema.Number),
956
- logical_event_id: Schema.optional(Schema.String),
957
- scope_kind: Schema.optional(Schema.Literals(["account", "organization"])),
958
- account_id: OptionalAccountId,
959
- reference_id: OptionalString
960
- });
961
- const AuthOtpRequestedTelemetryEventSchema = Schema.Struct({
962
- name: Schema.Literal("auth_otp_requested"),
963
- props: AuthOtpRequestedProps
964
- });
965
- const AuthOtpDeliveredTelemetryEventSchema = Schema.Struct({
966
- name: Schema.Literal("auth_otp_delivered"),
967
- props: AuthOtpDeliveredProps
968
- });
969
- const AuthOtpExpiredTelemetryEventSchema = Schema.Struct({
970
- name: Schema.Literal("auth_otp_expired"),
971
- props: AuthOtpExpiredProps
972
- });
973
- const AuthVerifiedTelemetryEventSchema = Schema.Struct({
974
- name: Schema.Literal("auth_verified"),
975
- props: AuthVerifiedProps
976
- });
977
- const AuthFailedTelemetryEventSchema = Schema.Struct({
978
- name: Schema.Literal("auth_failed"),
979
- props: AuthFailedProps
980
- });
981
- const IdentityRefusedTelemetryEventSchema = Schema.Struct({
982
- name: Schema.Literal("identity_refused"),
983
- props: IdentityRefusedProps
984
- });
985
- const AuthSignedOutTelemetryEventSchema = Schema.Struct({
986
- name: Schema.Literal("auth_signed_out"),
987
- props: AuthSignedOutProps
988
- });
989
- const OnboardingIntentSelectedTelemetryEventSchema = Schema.Struct({
990
- name: Schema.Literal("onboarding_intent_selected"),
991
- props: OnboardingIntentSelectedProps
992
- });
993
- const OnboardingProfileSubmittedTelemetryEventSchema = Schema.Struct({
994
- name: Schema.Literal("onboarding_profile_submitted"),
995
- props: OnboardingProfileSubmittedProps
996
- });
997
- const OnboardingOrganizationSubmittedTelemetryEventSchema = Schema.Struct({
998
- name: Schema.Literal("onboarding_organization_submitted"),
999
- props: OnboardingOrganizationSubmittedProps
1000
- });
1001
- const OnboardingDashboardReachedTelemetryEventSchema = Schema.Struct({
1002
- name: Schema.Literal("onboarding_dashboard_reached"),
1003
- props: OnboardingDashboardReachedProps
1004
- });
1005
- const ProvisioningSafeCreatedTelemetryEventSchema = Schema.Struct({
1006
- name: Schema.Literal("provisioning_safe_created"),
1007
- props: ProvisioningSafeCreatedProps
1008
- });
1009
- const ProvisioningSafeConfirmedTelemetryEventSchema = Schema.Struct({
1010
- name: Schema.Literal("provisioning_safe_confirmed"),
1011
- props: ProvisioningSafeConfirmedProps
1012
- });
1013
- const BootstrapResolvedTelemetryEventSchema = Schema.Struct({
1014
- name: Schema.Literal("bootstrap_resolved"),
1015
- props: BootstrapResolvedProps
1016
- });
1017
- const BootstrapFailedTelemetryEventSchema = Schema.Struct({
1018
- name: Schema.Literal("bootstrap_failed"),
1019
- props: BootstrapFailedProps
1020
- });
1021
- const MemberActivationStartedTelemetryEventSchema = Schema.Struct({
1022
- name: Schema.Literal("member_activation_started"),
1023
- props: MemberActivationStartedProps
1024
- });
1025
- const MemberActivationReadyTelemetryEventSchema = Schema.Struct({
1026
- name: Schema.Literal("member_activation_ready"),
1027
- props: MemberActivationReadyProps
1028
- });
1029
- const MemberActivationFailedTelemetryEventSchema = Schema.Struct({
1030
- name: Schema.Literal("member_activation_failed"),
1031
- props: MemberActivationFailedProps
1032
- });
1033
- const OrganizationCreationStartedTelemetryEventSchema = Schema.Struct({
1034
- name: Schema.Literal("organization_creation_started"),
1035
- props: OrganizationCreationStartedProps
1036
- });
1037
- const OrganizationCreationReadyTelemetryEventSchema = Schema.Struct({
1038
- name: Schema.Literal("organization_creation_ready"),
1039
- props: OrganizationCreationReadyProps
1040
- });
1041
- const OrganizationCreationFailedTelemetryEventSchema = Schema.Struct({
1042
- name: Schema.Literal("organization_creation_failed"),
1043
- props: OrganizationCreationFailedProps
1044
- });
1045
- const AccountBalanceReadTelemetryEventSchema = Schema.Struct({
1046
- name: Schema.Literal("account_balance_read"),
1047
- props: AccountBalanceReadProps
1048
- });
1049
- const AccountBalanceFailedTelemetryEventSchema = Schema.Struct({
1050
- name: Schema.Literal("account_balance_failed"),
1051
- props: AccountBalanceFailedProps
1052
- });
1053
- const FaucetRequestedTelemetryEventSchema = Schema.Struct({
1054
- name: Schema.Literal("faucet_requested"),
1055
- props: FaucetRequestedProps
1056
- });
1057
- const FaucetConfirmedTelemetryEventSchema = Schema.Struct({
1058
- name: Schema.Literal("faucet_confirmed"),
1059
- props: FaucetConfirmedProps
1060
- });
1061
- const FaucetFailedTelemetryEventSchema = Schema.Struct({
1062
- name: Schema.Literal("faucet_failed"),
1063
- props: FaucetFailedProps
1064
- });
1065
- const ChainUpstreamFallbackTelemetryEventSchema = Schema.Struct({
1066
- name: Schema.Literal("chain_upstream_fallback"),
1067
- props: ChainUpstreamFallbackProps
1068
- });
1069
- const BundlerErrorTelemetryEventSchema = Schema.Struct({
1070
- name: Schema.Literal("bundler_error"),
1071
- props: BundlerErrorProps
1072
- });
1073
- const ReceiptPendingTelemetryEventSchema = Schema.Struct({
1074
- name: Schema.Literal("receipt_pending"),
1075
- props: ReceiptPendingProps
1076
- });
1077
- const OperationRetriedTelemetryEventSchema = Schema.Struct({
1078
- name: Schema.Literal("operation_retried"),
1079
- props: OperationRetriedProps
1080
- });
1081
- const OrgCreateStartedTelemetryEventSchema = Schema.Struct({
1082
- name: Schema.Literal("org_create_started"),
1083
- props: OrgCreateStartedProps
1084
- });
1085
- const OrgSafeCreatedTelemetryEventSchema = Schema.Struct({
1086
- name: Schema.Literal("org_safe_created"),
1087
- props: OrgSafeCreatedProps
1088
- });
1089
- const OrgSafeConfirmedTelemetryEventSchema = Schema.Struct({
1090
- name: Schema.Literal("org_safe_confirmed"),
1091
- props: OrgSafeConfirmedProps
1092
- });
1093
- const OrgRolesSeededTelemetryEventSchema = Schema.Struct({
1094
- name: Schema.Literal("org_roles_seeded"),
1095
- props: OrgRolesSeededProps
1096
- });
1097
- const OrgCreatedTelemetryEventSchema = Schema.Struct({
1098
- name: Schema.Literal("org_created"),
1099
- props: OrgCreatedProps
1100
- });
1101
- const OrgCreateFailedTelemetryEventSchema = Schema.Struct({
1102
- name: Schema.Literal("org_create_failed"),
1103
- props: OrgCreateFailedProps
1104
- });
1105
- const OrgInviteSentTelemetryEventSchema = Schema.Struct({
1106
- name: Schema.Literal("org_invite_sent"),
1107
- props: OrgInviteSentProps
1108
- });
1109
- const OrgInviteAcceptedTelemetryEventSchema = Schema.Struct({
1110
- name: Schema.Literal("org_invite_accepted"),
1111
- props: OrgInviteAcceptedProps
1112
- });
1113
- const OrgInviteExpiredTelemetryEventSchema = Schema.Struct({
1114
- name: Schema.Literal("org_invite_expired"),
1115
- props: OrgInviteExpiredProps
1116
- });
1117
- const PaymentInitiatedTelemetryEventSchema = Schema.Struct({
1118
- name: Schema.Literal("payment_initiated"),
1119
- props: PaymentInitiatedProps
1120
- });
1121
- const PaymentSettledTelemetryEventSchema = Schema.Struct({
1122
- name: Schema.Literal("payment_settled"),
1123
- props: PaymentSettledL2Props
1124
- });
1125
- const PaymentFailedTelemetryEventSchema = Schema.Struct({
1126
- name: Schema.Literal("payment_failed"),
1127
- props: PaymentFailedL2Props
1128
- });
1129
- const PaymentVerificationRetryTelemetryEventSchema = Schema.Struct({
1130
- name: Schema.Literal("payment_verification_retry"),
1131
- props: PaymentVerificationRetryProps
1132
- });
1133
- const PaymentLifecycleTransitionTelemetryEventSchema = Schema.Struct({
1134
- name: Schema.Literal("payment_lifecycle_transition"),
1135
- props: PaymentLifecycleTransitionProps
1136
- });
1137
- const QuickPayExternalAddressAcknowledgedTelemetryEventSchema = Schema.Struct({
1138
- name: Schema.Literal("quick_pay_external_address_acknowledged"),
1139
- props: QuickPayExternalAddressAcknowledgedProps
1140
- });
1141
- const DepositInitiatedTelemetryEventSchema = Schema.Struct({
1142
- name: Schema.Literal("deposit_initiated"),
1143
- props: DepositInitiatedProps
1144
- });
1145
- const DepositSettledTelemetryEventSchema = Schema.Struct({
1146
- name: Schema.Literal("deposit_settled"),
1147
- props: DepositSettledProps
1148
- });
1149
- const PermissionMirrorVerificationTelemetryEventSchema = Schema.Struct({
1150
- name: Schema.Literal("permission_mirror_verification"),
1151
- props: PermissionMirrorVerificationProps
1152
- });
1153
- const MovementScanWindowTelemetryEventSchema = Schema.Struct({
1154
- name: Schema.Literal("movement_scan_window"),
1155
- props: MovementScanWindowProps
1156
- });
1157
- const MovementScanCheckpointTelemetryEventSchema = Schema.Struct({
1158
- name: Schema.Literal("movement_scan_checkpoint"),
1159
- props: MovementScanCheckpointProps
1160
- });
1161
- const MovementScanIncidentTelemetryEventSchema = Schema.Struct({
1162
- name: Schema.Literal("movement_scan_incident"),
1163
- props: MovementScanIncidentProps
1164
- });
1165
- const IndexerDriftCorrectedTelemetryEventSchema = Schema.Struct({
1166
- name: Schema.Literal("indexer_drift_corrected"),
1167
- props: IndexerDriftCorrectedProps
1168
- });
1169
- /** The one spelling of "whose scope did this happen in" across every surface. */
1170
- const ScopeKindSchema = Schema.Literals(["account", "organization"]);
1171
- const OptionalReasonCode = Schema.optional(Schema.Literals(CAPXUL_ERROR_CODES));
1172
- const ActivityReferenceProps = {
1173
- reference_kind: Schema.Literals(["payment", "movement"]),
1174
- reference_id: Schema.String
1175
- };
1176
- const ActivityFilterProps = {
1177
- filter_kind: Schema.optional(Schema.Literals([
1178
- "all",
1179
- "payment",
1180
- "movement"
1181
- ])),
1182
- filter_direction: Schema.optional(Schema.Literals([
1183
- "all",
1184
- "in",
1185
- "out",
1186
- "self"
1187
- ])),
1188
- filter_status: Schema.optional(Schema.Array(Schema.Literals([
1189
- "pending",
1190
- "settling",
1191
- "unresolved",
1192
- "pending_claim",
1193
- "scheduled",
1194
- "streaming",
1195
- "settled",
1196
- "cancelled",
1197
- "failed"
1198
- ])))
1199
- };
1200
- const ActivityActionProps = {
1201
- ...TelemetryEnvelopeProps,
1202
- scope_kind: ScopeKindSchema,
1203
- reason_code: OptionalReasonCode
1204
- };
1205
- const ContactRelationshipChangedTelemetryEventSchema = Schema.Struct({
1206
- name: Schema.Literal("contact_relationship_changed"),
1207
- props: Schema.Struct({
1208
- ...TelemetryEnvelopeProps,
1209
- change: Schema.Literals([
1210
- "added",
1211
- "renamed",
1212
- "hidden",
1213
- "restored"
1214
- ]),
1215
- scope_kind: ScopeKindSchema,
1216
- scope_id: Schema.String,
1217
- owner_party_id: Schema.String,
1218
- party_id: Schema.String,
1219
- hidden: Schema.Boolean,
1220
- occurred_at: Schema.Number,
1221
- operation: Schema.Literals([
1222
- CAPXUL_OPERATIONS.addressBook.add,
1223
- CAPXUL_OPERATIONS.addressBook.label,
1224
- CAPXUL_OPERATIONS.addressBook.hide,
1225
- CAPXUL_OPERATIONS.addressBook.unhide
1226
- ])
1227
- })
1228
- });
1229
- const ContactActionProps = {
1230
- ...TelemetryEnvelopeProps,
1231
- scope_kind: ScopeKindSchema,
1232
- party_id: OptionalString,
1233
- reason_code: OptionalReasonCode
1234
- };
1235
- /** One completed online CLI diagnostic. No command input or provider text. */
1236
- const CliDiagnosticCompletedTelemetryEventSchema = Schema.Struct({
1237
- name: Schema.Literal("cli_diagnostic_completed"),
1238
- props: Schema.Struct({
1239
- ...TelemetryEnvelopeProps,
1240
- outcome: Schema.Literals([
1241
- "succeeded",
1242
- "refused",
1243
- "failed",
1244
- "cancelled"
1245
- ]),
1246
- invocation_id: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u)),
1247
- cli_version: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/u))
1248
- })
1249
- });
1250
- const UiContactActionCompletedTelemetryEventSchema = Schema.Struct({
1251
- name: Schema.Literal("ui_contact_action_completed"),
1252
- props: Schema.Union([
1253
- Schema.Struct({
1254
- ...ContactActionProps,
1255
- action: Schema.Literal("add"),
1256
- outcome: Schema.Literals(["opened", "cancelled"])
1257
- }),
1258
- Schema.Struct({
1259
- ...ContactActionProps,
1260
- action: Schema.Literal("refusal"),
1261
- outcome: Schema.Literal("displayed")
1262
- }),
1263
- Schema.Struct({
1264
- ...ContactActionProps,
1265
- action: Schema.Literal("retry"),
1266
- outcome: Schema.Literal("requested")
1267
- })
1268
- ])
1269
- });
1270
- const ActivityAnnotationSavedTelemetryEventSchema = Schema.Struct({
1271
- name: Schema.Literal("activity_annotation_saved"),
1272
- props: Schema.Struct({
1273
- ...TelemetryEnvelopeProps,
1274
- ...ActivityReferenceProps,
1275
- scope_kind: ScopeKindSchema,
1276
- scope_id: Schema.String,
1277
- occurred_at: Schema.Number
1278
- })
1279
- });
1280
- const UiActivityActionCompletedTelemetryEventSchema = Schema.Struct({
1281
- name: Schema.Literal("ui_activity_action_completed"),
1282
- props: Schema.Union([
1283
- Schema.Struct({
1284
- ...ActivityActionProps,
1285
- action: Schema.Literal("read"),
1286
- outcome: Schema.Literals(["partial_displayed", "recovered"]),
1287
- surface: Schema.Literals([
1288
- "transactions",
1289
- "recent",
1290
- "summary"
1291
- ])
1292
- }),
1293
- Schema.Struct({
1294
- ...ActivityActionProps,
1295
- ...ActivityFilterProps,
1296
- action: Schema.Literal("filter"),
1297
- outcome: Schema.Literal("committed")
1298
- }),
1299
- Schema.Struct({
1300
- ...ActivityActionProps,
1301
- action: Schema.Literal("refusal"),
1302
- outcome: Schema.Literal("displayed")
1303
- }),
1304
- Schema.Struct({
1305
- ...ActivityActionProps,
1306
- action: Schema.Literal("retry"),
1307
- outcome: Schema.Literal("requested")
1308
- }),
1309
- Schema.Struct({
1310
- ...ActivityActionProps,
1311
- ...ActivityReferenceProps,
1312
- action: Schema.Literal("detail"),
1313
- outcome: Schema.Literals(["opened", "failed"])
1314
- }),
1315
- Schema.Struct({
1316
- ...ActivityActionProps,
1317
- ...ActivityReferenceProps,
1318
- action: Schema.Literal("receipt"),
1319
- outcome: Schema.Literals([
1320
- "document_rendered",
1321
- "explorer_opened",
1322
- "popup_blocked",
1323
- "failed"
1324
- ])
1325
- }),
1326
- Schema.Struct({
1327
- ...ActivityActionProps,
1328
- ...ActivityFilterProps,
1329
- action: Schema.Literal("export"),
1330
- outcome: Schema.Literals([
1331
- "completed",
1332
- "partial",
1333
- "failed"
1334
- ]),
1335
- row_count: Schema.optional(Schema.Number),
1336
- truncated: Schema.optional(Schema.Boolean)
1337
- })
1338
- ])
1339
- });
1340
- /**
1341
- * Reliability closeout (#1960 R02) — the shape every explicit UI observation
1342
- * below shares. `scope_kind` says whose surface the person was looking at,
1343
- * `organization_id` is the verified Organization the producer resolved (absent
1344
- * on a personal action), and `reason_code` is a catalog error code, never copy.
1345
- */
1346
- const UiStepProps = {
1347
- ...TelemetryEnvelopeProps,
1348
- scope_kind: ScopeKindSchema,
1349
- organization_id: OptionalOrgId,
1350
- reason_code: OptionalReasonCode
1351
- };
1352
- const AccessRecoveryCompletedProps = Schema.Union([Schema.Struct({
1353
- ...TelemetryEnvelopeProps,
1354
- recovery: Schema.Literal("session_restoration"),
1355
- outcome: Schema.Literals([
1356
- "restored",
1357
- "absent",
1358
- "failed"
1359
- ]),
1360
- reason_code: OptionalReasonCode,
1361
- organization_id: OptionalOrgId
1362
- }), Schema.Struct({
1363
- ...TelemetryEnvelopeProps,
1364
- recovery: Schema.Literal("signer_readiness"),
1365
- outcome: Schema.Literals(["ready", "unavailable"]),
1366
- reason_code: OptionalReasonCode,
1367
- organization_id: OptionalOrgId
1368
- })]);
1369
- const AccessRecoveryCompletedTelemetryEventSchema = Schema.Struct({
1370
- name: Schema.Literal("access_recovery_completed"),
1371
- props: AccessRecoveryCompletedProps
1372
- });
1373
- /**
1374
- * R05 (#1963) wired three of these steps at the app's dashboard Access
1375
- * boundary: `dashboard_granted` on the commit of the granted content,
1376
- * `gate_error_displayed` on the mounted error surface, and `retry_selected` on
1377
- * the actual selection. `redirect_completed` stays RESERVED and unproduced —
1378
- * asking for a navigation is not arriving, and the destination page's own
1379
- * normalized pageview already carries the arrival on the same journey, so a
1380
- * second event would add no fact. `capability_refusal_displayed` and
1381
- * `signer_refusal_displayed` belong to the screens that draw those refusals
1382
- * (Recipients, Invoice, Payroll, Quick Pay); Access publishes the contract and
1383
- * the `CanReason` those owners report, and produces neither itself.
1384
- */
1385
- const UiAccessStepCompletedTelemetryEventSchema = Schema.Struct({
1386
- name: Schema.Literal("ui_access_step_completed"),
1387
- props: Schema.Struct({
1388
- ...UiStepProps,
1389
- step: Schema.Literals([
1390
- "dashboard_granted",
1391
- "redirect_completed",
1392
- "gate_error_displayed",
1393
- "retry_selected",
1394
- "capability_refusal_displayed",
1395
- "signer_refusal_displayed"
1396
- ]),
1397
- capability: Schema.optional(Schema.Literals(["spend", "managePeople"])),
1398
- probe: Schema.optional(Schema.Literals([
1399
- "session",
1400
- "membership",
1401
- "lifecycle"
1402
- ])),
1403
- reason: Schema.optional(Schema.Literals([
1404
- "loading",
1405
- "no-permission",
1406
- "org-unavailable"
1407
- ]))
1408
- })
1409
- });
1410
- /**
1411
- * R06 (#1964) wired three of the four progress words to the durable writer that
1412
- * commits each one. `account_ready` comes from `org/memberLifecycle.ts`, for
1413
- * every membership row a claimed personal Account actually advanced.
1414
- * `permission_applied` and `membership_activated` come from
1415
- * `permission/mirror.ts`: the first only when the mirror wrote a NEW Permission
1416
- * state, the second only when that call flipped a `pending_grant` row to
1417
- * `active`. A replay of an applied command writes neither, so it reports
1418
- * neither. `revoked` stays RESERVED and unproduced — no writer revokes a
1419
- * membership yet, and #1459 owns that ceremony.
1420
- */
1421
- const OrgInviteProgressedTelemetryEventSchema = Schema.Struct({
1422
- name: Schema.Literal("org_invite_progressed"),
1423
- props: Schema.Struct({
1424
- ...TelemetryEnvelopeProps,
1425
- organization_id: OrgIdTelemetrySchema,
1426
- progress: Schema.Literals([
1427
- "account_ready",
1428
- "permission_applied",
1429
- "membership_activated",
1430
- "revoked"
1431
- ]),
1432
- /** The invited Party. The initiating actor stays on the envelope's identity. */
1433
- member_party_id: Schema.String,
1434
- occurred_at: Schema.Number
1435
- })
1436
- });
1437
- const InvoiceIssuedTelemetryEventSchema = Schema.Struct({
1438
- name: Schema.Literal("invoice_issued"),
1439
- props: Schema.Struct({
1440
- ...TelemetryEnvelopeProps,
1441
- request_id: Schema.String,
1442
- issuer_scope_kind: ScopeKindSchema,
1443
- issuer_scope_id: Schema.String,
1444
- payer_party_id: OptionalString,
1445
- occurred_at: Schema.Number
1446
- })
1447
- });
1448
- const InvoiceRequestTransitionedTelemetryEventSchema = Schema.Struct({
1449
- name: Schema.Literal("invoice_request_transitioned"),
1450
- props: Schema.Struct({
1451
- ...TelemetryEnvelopeProps,
1452
- request_id: Schema.String,
1453
- transition: Schema.Literals([
1454
- "approval_prepared",
1455
- "declined",
1456
- "cancelled"
1457
- ]),
1458
- actor_scope_kind: ScopeKindSchema,
1459
- actor_scope_id: Schema.String,
1460
- occurred_at: Schema.Number
1461
- })
1462
- });
1463
- const UiInvoiceStepCompletedTelemetryEventSchema = Schema.Struct({
1464
- name: Schema.Literal("ui_invoice_step_completed"),
1465
- props: Schema.Struct({
1466
- ...UiStepProps,
1467
- step: Schema.Literals([
1468
- "opened",
1469
- "previewed",
1470
- "dismissed",
1471
- "submitted",
1472
- "result_displayed",
1473
- "refusal_displayed",
1474
- "retry_selected"
1475
- ]),
1476
- request_id: OptionalString
1477
- })
1478
- });
1479
- const UiTreasuryStepCompletedTelemetryEventSchema = Schema.Struct({
1480
- name: Schema.Literal("ui_treasury_step_completed"),
1481
- props: Schema.Struct({
1482
- ...UiStepProps,
1483
- step: Schema.Literals([
1484
- "balance_displayed",
1485
- "read_refusal_displayed",
1486
- "retry_selected",
1487
- "recovery_completed"
1488
- ]),
1489
- account_kind: Schema.optional(AccountKindSchema)
1490
- })
1491
- });
1492
- const UiReceiveStepCompletedTelemetryEventSchema = Schema.Struct({
1493
- name: Schema.Literal("ui_receive_step_completed"),
1494
- props: Schema.Struct({
1495
- ...UiStepProps,
1496
- step: Schema.Literals([
1497
- "instructions_displayed",
1498
- "address_copied",
1499
- "copy_failed",
1500
- "refusal_displayed",
1501
- "retry_selected"
1502
- ]),
1503
- account_kind: Schema.optional(AccountKindSchema)
1504
- })
1505
- });
1506
- const PayrollGroupChangedTelemetryEventSchema = Schema.Struct({
1507
- name: Schema.Literal("payroll_group_changed"),
1508
- props: Schema.Struct({
1509
- ...TelemetryEnvelopeProps,
1510
- organization_id: OrgIdTelemetrySchema,
1511
- change: Schema.Literals([
1512
- "created",
1513
- "updated",
1514
- "deleted"
1515
- ]),
1516
- group_id: Schema.String,
1517
- member_count: Schema.Number,
1518
- occurred_at: Schema.Number
1519
- })
1520
- });
1521
- const PayrollRunTransitionedTelemetryEventSchema = Schema.Struct({
1522
- name: Schema.Literal("payroll_run_transitioned"),
1523
- props: Schema.Struct({
1524
- ...TelemetryEnvelopeProps,
1525
- organization_id: OrgIdTelemetrySchema,
1526
- transition: Schema.Literals([
1527
- "prepared",
1528
- "authorized",
1529
- "settled"
1530
- ]),
1531
- run_id: Schema.String,
1532
- /**
1533
- * The `paymentCommands` row at `payrollRuns.batchRef` — the durable owner of
1534
- * this run's Payment membership. `payment_count` counts THAT command's
1535
- * `paymentIds`, so an unrelated Payment quoting the run id changes neither.
1536
- */
1537
- command_id: OptionalString,
1538
- payment_count: Schema.optional(Schema.Number),
1539
- occurred_at: Schema.Number
1540
- })
1541
- });
1542
- const UiPayrollActionCompletedTelemetryEventSchema = Schema.Struct({
1543
- name: Schema.Literal("ui_payroll_action_completed"),
1544
- props: Schema.Struct({
1545
- ...UiStepProps,
1546
- action: Schema.Literals([
1547
- "opened",
1548
- "refusal_displayed",
1549
- "recovery_completed",
1550
- "cancelled",
1551
- "submitted_displayed"
1552
- ]),
1553
- run_id: OptionalString
1554
- })
1555
- });
1556
- const TELEMETRY_EVENT_SCHEMAS = {
1557
- contact_relationship_changed: ContactRelationshipChangedTelemetryEventSchema,
1558
- access_recovery_completed: AccessRecoveryCompletedTelemetryEventSchema,
1559
- ui_access_step_completed: UiAccessStepCompletedTelemetryEventSchema,
1560
- org_invite_progressed: OrgInviteProgressedTelemetryEventSchema,
1561
- invoice_issued: InvoiceIssuedTelemetryEventSchema,
1562
- invoice_request_transitioned: InvoiceRequestTransitionedTelemetryEventSchema,
1563
- ui_invoice_step_completed: UiInvoiceStepCompletedTelemetryEventSchema,
1564
- ui_treasury_step_completed: UiTreasuryStepCompletedTelemetryEventSchema,
1565
- ui_receive_step_completed: UiReceiveStepCompletedTelemetryEventSchema,
1566
- payroll_group_changed: PayrollGroupChangedTelemetryEventSchema,
1567
- payroll_run_transitioned: PayrollRunTransitionedTelemetryEventSchema,
1568
- ui_payroll_action_completed: UiPayrollActionCompletedTelemetryEventSchema,
1569
- ui_contact_action_completed: UiContactActionCompletedTelemetryEventSchema,
1570
- cli_diagnostic_completed: CliDiagnosticCompletedTelemetryEventSchema,
1571
- activity_annotation_saved: ActivityAnnotationSavedTelemetryEventSchema,
1572
- ui_activity_action_completed: UiActivityActionCompletedTelemetryEventSchema,
1573
- auth_otp_requested: AuthOtpRequestedTelemetryEventSchema,
1574
- auth_otp_delivered: AuthOtpDeliveredTelemetryEventSchema,
1575
- auth_otp_expired: AuthOtpExpiredTelemetryEventSchema,
1576
- auth_verified: AuthVerifiedTelemetryEventSchema,
1577
- auth_failed: AuthFailedTelemetryEventSchema,
1578
- identity_refused: IdentityRefusedTelemetryEventSchema,
1579
- auth_signed_out: AuthSignedOutTelemetryEventSchema,
1580
- onboarding_intent_selected: OnboardingIntentSelectedTelemetryEventSchema,
1581
- onboarding_profile_submitted: OnboardingProfileSubmittedTelemetryEventSchema,
1582
- onboarding_organization_submitted: OnboardingOrganizationSubmittedTelemetryEventSchema,
1583
- onboarding_dashboard_reached: OnboardingDashboardReachedTelemetryEventSchema,
1584
- provisioning_safe_created: ProvisioningSafeCreatedTelemetryEventSchema,
1585
- provisioning_safe_confirmed: ProvisioningSafeConfirmedTelemetryEventSchema,
1586
- bootstrap_resolved: BootstrapResolvedTelemetryEventSchema,
1587
- bootstrap_failed: BootstrapFailedTelemetryEventSchema,
1588
- member_activation_started: MemberActivationStartedTelemetryEventSchema,
1589
- member_activation_ready: MemberActivationReadyTelemetryEventSchema,
1590
- member_activation_failed: MemberActivationFailedTelemetryEventSchema,
1591
- organization_creation_started: OrganizationCreationStartedTelemetryEventSchema,
1592
- organization_creation_ready: OrganizationCreationReadyTelemetryEventSchema,
1593
- organization_creation_failed: OrganizationCreationFailedTelemetryEventSchema,
1594
- account_balance_read: AccountBalanceReadTelemetryEventSchema,
1595
- account_balance_failed: AccountBalanceFailedTelemetryEventSchema,
1596
- faucet_requested: FaucetRequestedTelemetryEventSchema,
1597
- faucet_confirmed: FaucetConfirmedTelemetryEventSchema,
1598
- faucet_failed: FaucetFailedTelemetryEventSchema,
1599
- chain_upstream_fallback: ChainUpstreamFallbackTelemetryEventSchema,
1600
- bundler_error: BundlerErrorTelemetryEventSchema,
1601
- receipt_pending: ReceiptPendingTelemetryEventSchema,
1602
- operation_retried: OperationRetriedTelemetryEventSchema,
1603
- org_create_started: OrgCreateStartedTelemetryEventSchema,
1604
- org_safe_created: OrgSafeCreatedTelemetryEventSchema,
1605
- org_safe_confirmed: OrgSafeConfirmedTelemetryEventSchema,
1606
- org_roles_seeded: OrgRolesSeededTelemetryEventSchema,
1607
- org_created: OrgCreatedTelemetryEventSchema,
1608
- org_create_failed: OrgCreateFailedTelemetryEventSchema,
1609
- org_invite_sent: OrgInviteSentTelemetryEventSchema,
1610
- org_invite_accepted: OrgInviteAcceptedTelemetryEventSchema,
1611
- org_invite_expired: OrgInviteExpiredTelemetryEventSchema,
1612
- payment_initiated: PaymentInitiatedTelemetryEventSchema,
1613
- payment_settled: PaymentSettledTelemetryEventSchema,
1614
- payment_failed: PaymentFailedTelemetryEventSchema,
1615
- payment_verification_retry: PaymentVerificationRetryTelemetryEventSchema,
1616
- payment_lifecycle_transition: PaymentLifecycleTransitionTelemetryEventSchema,
1617
- quick_pay_external_address_acknowledged: QuickPayExternalAddressAcknowledgedTelemetryEventSchema,
1618
- deposit_initiated: DepositInitiatedTelemetryEventSchema,
1619
- deposit_settled: DepositSettledTelemetryEventSchema,
1620
- permission_mirror_verification: PermissionMirrorVerificationTelemetryEventSchema,
1621
- movement_scan_window: MovementScanWindowTelemetryEventSchema,
1622
- movement_scan_checkpoint: MovementScanCheckpointTelemetryEventSchema,
1623
- movement_scan_incident: MovementScanIncidentTelemetryEventSchema,
1624
- indexer_drift_corrected: IndexerDriftCorrectedTelemetryEventSchema
1625
- };
1626
- const FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS = [];
1627
- /**
1628
- * Contract-first events whose producer is owned by a later domain node.
1629
- *
1630
- * A domain node removes its entry when it adds the producer. The telemetry
1631
- * gate rejects an entry that has a producer.
1632
- */
1633
- const CONTRACT_FIRST_TELEMETRY_EVENTS = [];
1634
- /**
1635
- * Catalog events whose product mapper remains gated on the #1150 frontend
1636
- * adoption. L1 S1 removes their retired SDK-flow producers without inventing
1637
- * replacements inside the identity actor. The telemetry-spine gate enforces
1638
- * planned-XOR-wired: a name must leave this list in the same change that adds
1639
- * its real product-boundary producer.
1640
- */
1641
- const PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS = ["auth_otp_expired"];
1642
- /** Catalogued browser observations whose producers remain owned by app adoption. */
1643
- const BROWSER_GATED_TELEMETRY_EVENTS = [
1644
- "onboarding_intent_selected",
1645
- "onboarding_profile_submitted",
1646
- "onboarding_organization_submitted",
1647
- "onboarding_dashboard_reached",
1648
- "ui_activity_action_completed",
1649
- "ui_contact_action_completed",
1650
- "ui_access_step_completed",
1651
- "ui_invoice_step_completed",
1652
- "ui_treasury_step_completed",
1653
- "ui_receive_step_completed",
1654
- "ui_payroll_action_completed"
1655
- ];
1656
- let trackHandler = () => {};
1657
- function setTrackHandler(handler) {
1658
- const previous = trackHandler;
1659
- trackHandler = handler;
1660
- return previous;
1661
- }
1662
- function getTrackHandler() {
1663
- return trackHandler;
1664
- }
1665
- function track(name, props) {
1666
- trackHandler(name, props);
1667
- }
1668
- function redactTelemetryEvent(event, options = {}) {
1669
- const props = redactTelemetryProps(event.name, event.props, options);
1670
- return props === void 0 ? { name: event.name } : {
1671
- name: event.name,
1672
- props
1673
- };
1674
- }
1675
- function redactTelemetryProps(name, props, options = {}) {
1676
- if (props === void 0) return void 0;
1677
- const clone = cloneProps(props);
1678
- if (options.rawMode === true) return clone;
1679
- for (const key of PII_PROP_KEYS_BY_EVENT[name] ?? []) redactProperty(clone, key);
1680
- return clone;
1681
- }
1682
- /**
1683
- * Remove query strings and fragments from every PostHog URL/referrer/path
1684
- * property before transport. Browser applications may carry emails, draft ids,
1685
- * or other capabilities in the URL; those values must never leave the origin.
1686
- *
1687
- * The callback replaces the event's data with a sanitized copy. Nested values
1688
- * can refer to live clients or configuration; observation must never mutate them.
1689
- */
1690
- function sanitizePostHogBrowserEvent(event, urlPolicy = "path-only") {
1691
- if (event === null) return event;
1692
- const transportToken = event.properties.token;
1693
- const seen = /* @__PURE__ */ new WeakMap();
1694
- event.properties = sanitizePostHogBrowserValue(event.properties, seen, urlPolicy);
1695
- if (transportToken !== void 0) event.properties.token = transportToken;
1696
- if (event.$set !== void 0) event.$set = sanitizePostHogBrowserValue(event.$set, seen, urlPolicy);
1697
- if (event.$set_once !== void 0) event.$set_once = sanitizePostHogBrowserValue(event.$set_once, seen, urlPolicy);
1698
- return event;
1699
- }
1700
- /**
1701
- * Drop local events before transport. Sanitize and stamp every other browser
1702
- * event with `capxul_env` and `producer: "browser"`.
1703
- */
1704
- function createCapxulBeforeSend(capxulEnv, urlPolicy = "path-only") {
1705
- return (event) => {
1706
- if (capxulEnv === "local") return null;
1707
- const sanitized = sanitizePostHogBrowserEvent(event, urlPolicy);
1708
- if (sanitized === null) return sanitized;
1709
- sanitized.properties.capxul_env = capxulEnv;
1710
- sanitized.properties.producer ??= "browser";
1711
- return sanitized;
1712
- };
1713
- }
1714
- function utilityAppAnalytics(input) {
1715
- return {
1716
- api_host: input.host,
1717
- defaults: "2026-01-30",
1718
- autocapture: false,
1719
- capture_pageview: false,
1720
- capture_pageleave: true,
1721
- disable_session_recording: true,
1722
- disable_persistence: true,
1723
- capture_heatmaps: false,
1724
- capture_exceptions: false,
1725
- capture_performance: false,
1726
- disable_surveys: true,
1727
- disable_web_experiments: true,
1728
- disable_product_tours: true,
1729
- disable_conversations: true,
1730
- disable_external_dependency_loading: true,
1731
- person_profiles: "identified_only",
1732
- advanced_disable_flags: true,
1733
- save_campaign_params: false,
1734
- save_referrer: false,
1735
- before_send: createCapxulBeforeSend(input.capxulEnv)
1736
- };
1737
- }
1738
- /** In unstructured bodies, preserve text around explicitly named credentials. */
1739
- const NETWORK_FIELD = /((?:"?)([A-Za-z_][A-Za-z0-9_.-]*)(?:"?)\s*[:=]\s*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^\s,;&}]+)/gu;
1740
- function maskNetworkText(text, context) {
1741
- return redactSecrets(text).replace(NETWORK_FIELD, (whole, prefix, name, value) => {
1742
- if (!isCredentialField(name, context)) return whole;
1743
- const quote = value.startsWith("\"") ? "\"" : value.startsWith("'") ? "'" : "";
1744
- return `${prefix}${quote}[REDACTED]${quote}`;
1745
- });
1746
- }
1747
- function maskNetworkHeaders(headers) {
1748
- if (headers === void 0) return void 0;
1749
- const masked = {};
1750
- for (const [name, value] of Object.entries(headers)) masked[name] = isCredentialField(name, "header") ? "[REDACTED]" : /^(?:location|content-location|referer)$/iu.test(name) ? redactUrlSecrets(value) : maskNetworkText(value);
1751
- return masked;
1752
- }
1753
- function maskJsonValue(value, depth = 0, context) {
1754
- if (typeof value === "function" || typeof value === "symbol") return "[UNREADABLE]";
1755
- if (typeof value === "string") return maskNetworkText(value, context);
1756
- if (typeof value !== "object" || value === null) return value;
1757
- if (depth >= 16) return "[REDACTED]";
1758
- if (Array.isArray(value)) return value.map((item) => maskJsonValue(item, depth + 1, context));
1759
- const masked = Object.create(null);
1760
- for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
1761
- if (!descriptor.enumerable) continue;
1762
- masked[key] = isCredentialField(key, context) ? "[REDACTED]" : !("value" in descriptor) ? "[UNREADABLE]" : typeof descriptor.value === "string" && isPostHogUrlProperty(key) ? redactUrlSecrets(descriptor.value) : maskJsonValue(descriptor.value, depth + 1, context);
1763
- }
1764
- return masked;
1765
- }
1766
- function maskNetworkBody(body, context) {
1767
- try {
1768
- if (typeof body !== "string") return maskJsonValue(body, 0, context);
1769
- let parsed;
1770
- try {
1771
- parsed = JSON.parse(body);
1772
- } catch {
1773
- if (/^[^=&\s]+=[\s\S]*$/u.test(body)) return new URLSearchParams(Array.from(new URLSearchParams(body), ([name, value]) => [name, isCredentialField(name, context) ? "[REDACTED]" : maskNetworkText(value)])).toString();
1774
- return maskNetworkText(body, context);
1775
- }
1776
- return JSON.stringify(maskJsonValue(parsed, 0, context));
1777
- } catch {
1778
- return "[UNREADABLE]";
1779
- }
1780
- }
1781
- /** Keep request evidence while masking credential values at the browser boundary. */
1782
- function maskCapturedNetworkRequest(request) {
1783
- const requestUrl = request.name ?? request.url ?? "";
1784
- let context;
1785
- try {
1786
- const path = new URL(requestUrl, "https://capxul.invalid").pathname;
1787
- if (/\/(?:auth|oauth|sign-in|signin|login|verify-otp|verify-email)(?:\/|$)/iu.test(path)) context = "authentication";
1788
- } catch {}
1789
- return {
1790
- ...request,
1791
- ...request.name === void 0 ? {} : { name: redactUrlSecrets(request.name) },
1792
- ...request.url === void 0 ? {} : { url: redactUrlSecrets(request.url) },
1793
- requestHeaders: maskNetworkHeaders(request.requestHeaders),
1794
- responseHeaders: maskNetworkHeaders(request.responseHeaders),
1795
- requestBody: maskNetworkBody(request.requestBody, context),
1796
- responseBody: maskNetworkBody(request.responseBody)
1797
- };
1798
- }
1799
- function productAppAnalytics(input) {
1800
- return {
1801
- api_host: input.host,
1802
- defaults: "2026-01-30",
1803
- autocapture: false,
1804
- capture_pageview: false,
1805
- capture_pageleave: true,
1806
- disable_session_recording: false,
1807
- disable_persistence: false,
1808
- capture_heatmaps: false,
1809
- capture_exceptions: true,
1810
- capture_performance: {
1811
- network_timing: true,
1812
- web_vitals: false
1813
- },
1814
- disable_surveys: true,
1815
- disable_web_experiments: true,
1816
- disable_product_tours: true,
1817
- disable_conversations: true,
1818
- disable_external_dependency_loading: false,
1819
- person_profiles: "identified_only",
1820
- advanced_disable_flags: false,
1821
- save_campaign_params: false,
1822
- save_referrer: false,
1823
- session_recording: {
1824
- maskAllInputs: true,
1825
- maskInputFn: (text, element) => {
1826
- const autocomplete = element?.getAttribute("autocomplete")?.toLowerCase().split(/\s+/u) ?? [];
1827
- return element?.getAttribute("type")?.toLowerCase() === "password" || autocomplete.some((value) => [
1828
- "one-time-code",
1829
- "current-password",
1830
- "new-password"
1831
- ].includes(value)) || isCredentialField(element?.getAttribute("name") ?? "") || isCredentialField(element?.getAttribute("id") ?? "") ? "*".repeat(text.length) : maskNetworkText(text);
1832
- },
1833
- captureCanvas: { recordCanvas: false },
1834
- recordHeaders: true,
1835
- recordBody: true,
1836
- maskCapturedNetworkRequestFn: maskCapturedNetworkRequest
1837
- },
1838
- before_send: createCapxulBeforeSend(input.capxulEnv, "diagnostic")
1839
- };
1840
- }
1841
- /**
1842
- * Apply a named privacy profile before an application-owned PostHog client
1843
- * initializes. Hosts still own the vendor client and lifecycle; this helper
1844
- * centralizes the security-relevant options and the missing-key opt-out (no
1845
- * key ⇒ no client ⇒ no network call).
1846
- */
1847
- function initializeCapxulBrowserAnalytics(profile, input, initialize) {
1848
- const key = input.key?.trim();
1849
- if (key === void 0 || key.length === 0) return void 0;
1850
- try {
1851
- const options = profile(input);
1852
- const client = initialize(key, options);
1853
- warnWhenReplayHasNoRecorder(options, client);
1854
- return client;
1855
- } catch {
1856
- return;
1857
- }
1858
- }
1859
- let replayRecorderWarned = false;
1860
- /**
1861
- * #1709: `posthog-js/dist/module.slim` never registers the session recording
1862
- * manager, so a profile that enables replay records nothing with it. The
1863
- * client exposes the manager as `sessionRecording` once `init` ran on the
1864
- * standard build. Warn once per page so the missing build is visible.
1865
- */
1866
- function warnWhenReplayHasNoRecorder(options, client) {
1867
- if (replayRecorderWarned) return;
1868
- const replayEnabled = typeof options === "object" && options !== null && options.disable_session_recording === false;
1869
- const recorderMissing = typeof client === "object" && client !== null && client.sessionRecording === void 0;
1870
- if (!replayEnabled || !recorderMissing) return;
1871
- replayRecorderWarned = true;
1872
- 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.");
1873
- }
1874
- /** The utility profile, pre-bound — the shape ADR-0016's consumers already use. */
1875
- function initializePostHogBrowserAnalytics(input, initialize) {
1876
- return initializeCapxulBrowserAnalytics(utilityAppAnalytics, input, initialize);
1877
- }
1878
- /**
1879
- * Build an explicit SPA pageview sink for toolbar-free PostHog clients. The
1880
- * pathname-only input avoids query capabilities, repeated pathnames are
1881
- * deduplicated, and vendor failures remain best-effort.
1882
- */
1883
- function createPostHogBrowserPageviewTracker(client) {
1884
- let previousPathname;
1885
- return (pathname) => {
1886
- if (client === null || client === void 0) return;
1887
- const safePathname = stripUrlQueryAndFragment(pathname);
1888
- if (safePathname === previousPathname) return;
1889
- try {
1890
- Promise.resolve(client.capture("$pageview", { $pathname: safePathname })).catch(() => {});
1891
- previousPathname = safePathname;
1892
- } catch {}
1893
- };
1894
- }
1895
- function sanitizePostHogBrowserValue(value, seen, urlPolicy) {
1896
- if (typeof value !== "object" || value === null || value instanceof Date) return value;
1897
- if (seen.has(value)) return seen.get(value);
1898
- if (Array.isArray(value)) {
1899
- const copy = [];
1900
- seen.set(value, copy);
1901
- for (let index = 0; index < value.length; index++) {
1902
- const item = value[index];
1903
- copy[index] = typeof item === "string" ? maskNetworkText(item) : sanitizePostHogBrowserValue(item, seen, urlPolicy);
1904
- }
1905
- return copy;
1906
- }
1907
- const properties = Object.create(null);
1908
- seen.set(value, properties);
1909
- for (const [key, nestedValue] of Object.entries(value)) {
1910
- if (isPostHogQueryDerivedProperty(key)) continue;
1911
- if (isCredentialField(key)) {
1912
- properties[key] = "[REDACTED]";
1913
- continue;
1914
- }
1915
- if (typeof nestedValue === "string") {
1916
- properties[key] = isPostHogUrlProperty(key) ? urlPolicy === "path-only" ? stripUrlQueryAndFragment(nestedValue) : redactUrlSecrets(nestedValue) : maskNetworkText(nestedValue);
1917
- continue;
1918
- }
1919
- properties[key] = sanitizePostHogBrowserValue(nestedValue, seen, urlPolicy);
1920
- }
1921
- return properties;
1922
- }
1923
- const POSTHOG_QUERY_DERIVED_PROPERTY_NAMES = [
1924
- "utm_source",
1925
- "utm_medium",
1926
- "utm_campaign",
1927
- "utm_content",
1928
- "utm_term",
1929
- "gad_source",
1930
- "mc_cid",
1931
- "gclid",
1932
- "gclsrc",
1933
- "dclid",
1934
- "gbraid",
1935
- "wbraid",
1936
- "fbclid",
1937
- "msclkid",
1938
- "twclid",
1939
- "li_fat_id",
1940
- "igshid",
1941
- "ttclid",
1942
- "rdt_cid",
1943
- "epik",
1944
- "qclid",
1945
- "sccid",
1946
- "irclid",
1947
- "_kx",
1948
- "ph_keyword"
1949
- ];
1950
- function isPostHogQueryDerivedProperty(key) {
1951
- const normalized = key.toLowerCase();
1952
- return POSTHOG_QUERY_DERIVED_PROPERTY_NAMES.some((propertyName) => normalized === propertyName || normalized.endsWith(`_${propertyName}`) || normalized.endsWith(`$${propertyName}`));
1953
- }
1954
- function isPostHogUrlProperty(key) {
1955
- const normalized = key.toLowerCase();
1956
- return normalized.includes("url") || normalized.includes("referrer") || normalized.includes("path") || normalized.includes("filename");
1957
- }
1958
- function stripUrlQueryAndFragment(value) {
1959
- const queryIndex = value.indexOf("?");
1960
- const fragmentIndex = value.indexOf("#");
1961
- if (queryIndex === -1 && fragmentIndex === -1) return value;
1962
- if (queryIndex === -1) return value.slice(0, fragmentIndex);
1963
- if (fragmentIndex === -1) return value.slice(0, queryIndex);
1964
- return value.slice(0, Math.min(queryIndex, fragmentIndex));
1965
- }
1966
- var RecordingTelemetryAdapter = class {
1967
- #events = [];
1968
- #rawMode;
1969
- constructor(options = {}) {
1970
- this.#rawMode = options.rawMode === true;
1971
- }
1972
- get events() {
1973
- return this.#events.map((event) => cloneEvent(event));
1974
- }
1975
- emit(event) {
1976
- return Effect.sync(() => {
1977
- this.#events.push(redactTelemetryEvent(event, { rawMode: this.#rawMode }));
1978
- });
1979
- }
1980
- identify(_input) {
1981
- return Effect.void;
1982
- }
1983
- group(_input) {
1984
- return Effect.void;
1985
- }
1986
- reset() {
1987
- return Effect.void;
1988
- }
1989
- reportHandledError(_error, _context) {
1990
- return Effect.void;
1991
- }
1992
- clear() {
1993
- this.#events.length = 0;
1994
- }
1995
- };
1996
- var PostHogTelemetryAdapter = class {
1997
- #capture;
1998
- constructor(deps) {
1999
- this.#capture = deps.capture;
2000
- }
2001
- emit(event) {
2002
- return Effect.sync(() => {
2003
- try {
2004
- Promise.resolve(this.#capture(event.name, redactTelemetryProps(event.name, event.props))).catch(() => {});
2005
- } catch {}
2006
- });
2007
- }
2008
- identify(_input) {
2009
- return Effect.void;
2010
- }
2011
- group(_input) {
2012
- return Effect.void;
2013
- }
2014
- reset() {
2015
- return Effect.void;
2016
- }
2017
- reportHandledError(_error, _context) {
2018
- return Effect.void;
2019
- }
2020
- };
2021
- var InMemoryTelemetryBusAdapter = class {
2022
- #subscribers = /* @__PURE__ */ new Set();
2023
- #rawMode;
2024
- constructor(options = {}) {
2025
- this.#rawMode = options.rawMode === true;
2026
- }
2027
- subscribe(handler) {
2028
- this.#subscribers.add(handler);
2029
- return () => {
2030
- this.#subscribers.delete(handler);
2031
- };
2032
- }
2033
- emit(event) {
2034
- return Effect.sync(() => {
2035
- const delivered = redactTelemetryEvent(event, { rawMode: this.#rawMode });
2036
- for (const handler of this.#subscribers) try {
2037
- handler(cloneEvent(delivered));
2038
- } catch {}
2039
- });
2040
- }
2041
- identify(_input) {
2042
- return Effect.void;
2043
- }
2044
- group(_input) {
2045
- return Effect.void;
2046
- }
2047
- reset() {
2048
- return Effect.void;
2049
- }
2050
- reportHandledError(_error, _context) {
2051
- return Effect.void;
2052
- }
2053
- };
2054
- const PII_PROP_KEYS_BY_EVENT = {
2055
- auth_otp_requested: ["email"],
2056
- auth_otp_delivered: ["email"],
2057
- auth_otp_expired: ["email"],
2058
- auth_failed: ["email"]
2059
- };
2060
- function redactProperty(props, key) {
2061
- const value = props[key];
2062
- if (typeof value === "string") props[key] = sha256Hex(value).slice(0, 12);
2063
- }
2064
- function cloneEvent(event) {
2065
- if (event.props === void 0) return { name: event.name };
2066
- return {
2067
- name: event.name,
2068
- props: cloneProps(event.props)
2069
- };
2070
- }
2071
- function cloneProps(props) {
2072
- const cloned = {};
2073
- for (const [key, value] of Object.entries(props)) cloned[key] = cloneTelemetryValue(value);
2074
- return cloned;
2075
- }
2076
- function cloneTelemetryValue(value) {
2077
- if (Array.isArray(value)) return value.map(cloneTelemetryValue);
2078
- if (value === null || typeof value !== "object") return value;
2079
- if (Object.getPrototypeOf(value) !== Object.prototype) return value;
2080
- const cloned = {};
2081
- for (const [key, nested] of Object.entries(value)) cloned[key] = cloneTelemetryValue(nested);
2082
- return cloned;
2083
- }
2084
- const SHA256_INITIAL_HASH = [
2085
- 1779033703,
2086
- 3144134277,
2087
- 1013904242,
2088
- 2773480762,
2089
- 1359893119,
2090
- 2600822924,
2091
- 528734635,
2092
- 1541459225
2093
- ];
2094
- const SHA256_K = [
2095
- 1116352408,
2096
- 1899447441,
2097
- 3049323471,
2098
- 3921009573,
2099
- 961987163,
2100
- 1508970993,
2101
- 2453635748,
2102
- 2870763221,
2103
- 3624381080,
2104
- 310598401,
2105
- 607225278,
2106
- 1426881987,
2107
- 1925078388,
2108
- 2162078206,
2109
- 2614888103,
2110
- 3248222580,
2111
- 3835390401,
2112
- 4022224774,
2113
- 264347078,
2114
- 604807628,
2115
- 770255983,
2116
- 1249150122,
2117
- 1555081692,
2118
- 1996064986,
2119
- 2554220882,
2120
- 2821834349,
2121
- 2952996808,
2122
- 3210313671,
2123
- 3336571891,
2124
- 3584528711,
2125
- 113926993,
2126
- 338241895,
2127
- 666307205,
2128
- 773529912,
2129
- 1294757372,
2130
- 1396182291,
2131
- 1695183700,
2132
- 1986661051,
2133
- 2177026350,
2134
- 2456956037,
2135
- 2730485921,
2136
- 2820302411,
2137
- 3259730800,
2138
- 3345764771,
2139
- 3516065817,
2140
- 3600352804,
2141
- 4094571909,
2142
- 275423344,
2143
- 430227734,
2144
- 506948616,
2145
- 659060556,
2146
- 883997877,
2147
- 958139571,
2148
- 1322822218,
2149
- 1537002063,
2150
- 1747873779,
2151
- 1955562222,
2152
- 2024104815,
2153
- 2227730452,
2154
- 2361852424,
2155
- 2428436474,
2156
- 2756734187,
2157
- 3204031479,
2158
- 3329325298
2159
- ];
2160
- function sha256Hex(input) {
2161
- const padded = padSha256Message(new TextEncoder().encode(input));
2162
- const view = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
2163
- const words = /* @__PURE__ */ new Uint32Array(64);
2164
- let h0 = SHA256_INITIAL_HASH[0];
2165
- let h1 = SHA256_INITIAL_HASH[1];
2166
- let h2 = SHA256_INITIAL_HASH[2];
2167
- let h3 = SHA256_INITIAL_HASH[3];
2168
- let h4 = SHA256_INITIAL_HASH[4];
2169
- let h5 = SHA256_INITIAL_HASH[5];
2170
- let h6 = SHA256_INITIAL_HASH[6];
2171
- let h7 = SHA256_INITIAL_HASH[7];
2172
- for (let offset = 0; offset < padded.byteLength; offset += 64) {
2173
- for (let i = 0; i < 16; i++) words[i] = view.getUint32(offset + i * 4);
2174
- for (let i = 16; i < 64; i++) {
2175
- const s0 = rotr(words[i - 15], 7) ^ rotr(words[i - 15], 18) ^ words[i - 15] >>> 3;
2176
- const s1 = rotr(words[i - 2], 17) ^ rotr(words[i - 2], 19) ^ words[i - 2] >>> 10;
2177
- words[i] = words[i - 16] + s0 + words[i - 7] + s1 >>> 0;
2178
- }
2179
- let a = h0;
2180
- let b = h1;
2181
- let c = h2;
2182
- let d = h3;
2183
- let e = h4;
2184
- let f = h5;
2185
- let g = h6;
2186
- let h = h7;
2187
- for (let i = 0; i < 64; i++) {
2188
- const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
2189
- const ch = e & f ^ ~e & g;
2190
- const temp1 = h + s1 + ch + SHA256_K[i] + words[i] >>> 0;
2191
- const temp2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
2192
- h = g;
2193
- g = f;
2194
- f = e;
2195
- e = d + temp1 >>> 0;
2196
- d = c;
2197
- c = b;
2198
- b = a;
2199
- a = temp1 + temp2 >>> 0;
2200
- }
2201
- h0 = h0 + a >>> 0;
2202
- h1 = h1 + b >>> 0;
2203
- h2 = h2 + c >>> 0;
2204
- h3 = h3 + d >>> 0;
2205
- h4 = h4 + e >>> 0;
2206
- h5 = h5 + f >>> 0;
2207
- h6 = h6 + g >>> 0;
2208
- h7 = h7 + h >>> 0;
2209
- }
2210
- return [
2211
- h0,
2212
- h1,
2213
- h2,
2214
- h3,
2215
- h4,
2216
- h5,
2217
- h6,
2218
- h7
2219
- ].map((word) => word.toString(16).padStart(8, "0")).join("");
2220
- }
2221
- function padSha256Message(bytes) {
2222
- const bitLength = bytes.byteLength * 8;
2223
- const zeroPadLength = (64 - (bytes.byteLength + 1 + 8) % 64) % 64;
2224
- const output = new Uint8Array(bytes.byteLength + 1 + zeroPadLength + 8);
2225
- output.set(bytes);
2226
- output[bytes.byteLength] = 128;
2227
- const view = new DataView(output.buffer);
2228
- view.setUint32(output.byteLength - 8, Math.floor(bitLength / 4294967296));
2229
- view.setUint32(output.byteLength - 4, bitLength >>> 0);
2230
- return output;
2231
- }
2232
- function rotr(value, bits) {
2233
- return value >>> bits | value << 32 - bits;
2234
- }
2235
- //#endregion
2236
- export { AccessRecoveryCompletedTelemetryEventSchema, AccountBalanceFailedTelemetryEventSchema, AccountBalanceReadTelemetryEventSchema, ActivityAnnotationSavedTelemetryEventSchema, AuthFailedTelemetryEventSchema, AuthOtpDeliveredTelemetryEventSchema, AuthOtpExpiredTelemetryEventSchema, AuthOtpRequestedTelemetryEventSchema, AuthSignedOutTelemetryEventSchema, AuthVerifiedTelemetryEventSchema, BROWSER_GATED_TELEMETRY_EVENTS, BootstrapFailedTelemetryEventSchema, BootstrapResolvedTelemetryEventSchema, BundlerErrorTelemetryEventSchema, CAPXUL_ENVS, CAPXUL_OPERATIONS, CONTRACT_FIRST_TELEMETRY_EVENTS, ChainAttemptSchema, ChainUpstreamFallbackTelemetryEventSchema, ChainUpstreamSchema, CliDiagnosticCompletedTelemetryEventSchema, ContactRelationshipChangedTelemetryEventSchema, DepositInitiatedTelemetryEventSchema, DepositSettledTelemetryEventSchema, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, FailureModeSchema, FaucetConfirmedTelemetryEventSchema, FaucetFailedTelemetryEventSchema, FaucetRequestedTelemetryEventSchema, IdentityRefusedTelemetryEventSchema, InMemoryTelemetryBusAdapter, IndexerDriftCorrectedTelemetryEventSchema, InvoiceIssuedTelemetryEventSchema, InvoiceRequestTransitionedTelemetryEventSchema, MemberActivationFailedTelemetryEventSchema, MemberActivationReadyTelemetryEventSchema, MemberActivationStartedTelemetryEventSchema, MovementScanCheckpointTelemetryEventSchema, MovementScanIncidentTelemetryEventSchema, MovementScanWindowTelemetryEventSchema, OnboardingDashboardReachedTelemetryEventSchema, OnboardingIntentSelectedTelemetryEventSchema, OnboardingOrganizationSubmittedTelemetryEventSchema, OnboardingProfileSubmittedTelemetryEventSchema, OperationRetriedTelemetryEventSchema, OrgCreateFailedTelemetryEventSchema, OrgCreateStartedTelemetryEventSchema, OrgCreatedTelemetryEventSchema, OrgInviteAcceptedTelemetryEventSchema, OrgInviteExpiredTelemetryEventSchema, OrgInviteProgressedTelemetryEventSchema, OrgInviteSentTelemetryEventSchema, OrgRolesSeededTelemetryEventSchema, OrgSafeConfirmedTelemetryEventSchema, OrgSafeCreatedTelemetryEventSchema, OrganizationCreationFailedTelemetryEventSchema, OrganizationCreationReadyTelemetryEventSchema, OrganizationCreationStartedTelemetryEventSchema, PII, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, PaymentFailedTelemetryEventSchema, PaymentInitiatedTelemetryEventSchema, PaymentLifecycleTransitionTelemetryEventSchema, PaymentSettledTelemetryEventSchema, PaymentVerificationRetryTelemetryEventSchema, PayrollGroupChangedTelemetryEventSchema, PayrollRunTransitionedTelemetryEventSchema, PermissionMirrorVerificationTelemetryEventSchema, PostHogTelemetryAdapter, ProvisioningSafeConfirmedTelemetryEventSchema, ProvisioningSafeCreatedTelemetryEventSchema, QuickPayExternalAddressAcknowledgedTelemetryEventSchema, ReceiptPendingTelemetryEventSchema, RecordingTelemetryAdapter, ResponseHeadersSchema, SYNCABLE_CAPXUL_ENVS, TELEMETRY_EVENT_NAMES, TELEMETRY_EVENT_SCHEMAS, TELEMETRY_JOURNEYS, TELEMETRY_PRODUCERS, UiAccessStepCompletedTelemetryEventSchema, UiActivityActionCompletedTelemetryEventSchema, UiContactActionCompletedTelemetryEventSchema, UiInvoiceStepCompletedTelemetryEventSchema, UiPayrollActionCompletedTelemetryEventSchema, UiReceiveStepCompletedTelemetryEventSchema, UiTreasuryStepCompletedTelemetryEventSchema, createCapxulBeforeSend, createPostHogBrowserPageviewTracker, getTrackHandler, initializeCapxulBrowserAnalytics, initializePostHogBrowserAnalytics, isCapxulOperation, maskCapturedNetworkRequest, normalizeCapxulOperation, productAppAnalytics, redactTelemetryEvent, redactTelemetryProps, sanitizePostHogBrowserEvent, setTrackHandler, stampTelemetryEnvelope, track, utilityAppAnalytics };
1
+ import { $ as OnboardingIntentSelectedTelemetryEventSchema, $t as redactTelemetryProps, A as FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, At as ReceiptPendingTelemetryEventSchema, B as MemberActivationFailedTelemetryEventSchema, Bt as UiContactActionCompletedTelemetryEventSchema, C as CliCommandCompletedTelemetryEventSchema, Ct as PayrollGroupChangedTelemetryEventSchema, D as ContactRelationshipChangedTelemetryEventSchema, Dt as ProvisioningSafeConfirmedTelemetryEventSchema, E as CliFirstUsedTelemetryEventSchema, Et as PostHogTelemetryAdapter, F as IdentityRefusedTelemetryEventSchema, Ft as TELEMETRY_EVENT_SCHEMAS, G as MovementScanWindowTelemetryEventSchema, Gt as createCapxulBeforeSend, H as MemberActivationStartedTelemetryEventSchema, Ht as UiPayrollActionCompletedTelemetryEventSchema, I as InMemoryTelemetryBusAdapter, It as TELEMETRY_JOURNEYS, J as NativeAuthorizationDeniedTelemetryEventSchema, Jt as initializeCapxulBrowserAnalytics, K as NativeAuthorizationAcceptedTelemetryEventSchema, Kt as createPostHogBrowserPageviewTracker, L as IndexerDriftCorrectedTelemetryEventSchema, Lt as TELEMETRY_PRODUCERS, M as FaucetConfirmedTelemetryEventSchema, Mt as ResponseHeadersSchema, N as FaucetFailedTelemetryEventSchema, Nt as SYNCABLE_CAPXUL_ENVS, O as DepositInitiatedTelemetryEventSchema, Ot as ProvisioningSafeCreatedTelemetryEventSchema, P as FaucetRequestedTelemetryEventSchema, Pt as TELEMETRY_EVENT_NAMES, Q as OnboardingDashboardReachedTelemetryEventSchema, Qt as redactTelemetryEvent, R as InvoiceIssuedTelemetryEventSchema, Rt as UiAccessStepCompletedTelemetryEventSchema, S as ChainUpstreamSchema, St as PaymentVerificationRetryTelemetryEventSchema, T as CliDiagnosticCompletedTelemetryEventSchema, Tt as PermissionMirrorVerificationTelemetryEventSchema, U as MovementScanCheckpointTelemetryEventSchema, Ut as UiReceiveStepCompletedTelemetryEventSchema, V as MemberActivationReadyTelemetryEventSchema, Vt as UiInvoiceStepCompletedTelemetryEventSchema, W as MovementScanIncidentTelemetryEventSchema, Wt as UiTreasuryStepCompletedTelemetryEventSchema, X as NativeAuthorizationReviewedTelemetryEventSchema, Xt as maskCapturedNetworkRequest, Y as NativeAuthorizationFailedTelemetryEventSchema, Yt as initializePostHogBrowserAnalytics, Z as NativeAuthorizationStartedTelemetryEventSchema, Zt as productAppAnalytics, _ as CLI_COMMAND_NAMES, _t as PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, a as AuthFailedTelemetryEventSchema, an as CAPXUL_OPERATIONS, at as OrgCreatedTelemetryEventSchema, b as ChainAttemptSchema, bt as PaymentLifecycleTransitionTelemetryEventSchema, c as AuthOtpRequestedTelemetryEventSchema, ct as OrgInviteProgressedTelemetryEventSchema, d as BROWSER_GATED_TELEMETRY_EVENTS, dt as OrgSafeConfirmedTelemetryEventSchema, en as sanitizePostHogBrowserEvent, et as OnboardingOrganizationSubmittedTelemetryEventSchema, f as BootstrapFailedTelemetryEventSchema, ft as OrgSafeCreatedTelemetryEventSchema, g as CLI_CAPABILITIES, gt as PII, h as CAPXUL_ENVS, ht as OrganizationCreationStartedTelemetryEventSchema, i as ActivityAnnotationSavedTelemetryEventSchema, in as utilityAppAnalytics, it as OrgCreateStartedTelemetryEventSchema, j as FailureModeSchema, jt as RecordingTelemetryAdapter, k as DepositSettledTelemetryEventSchema, kt as QuickPayExternalAddressAcknowledgedTelemetryEventSchema, l as AuthSignedOutTelemetryEventSchema, lt as OrgInviteSentTelemetryEventSchema, m as BundlerErrorTelemetryEventSchema, mt as OrganizationCreationReadyTelemetryEventSchema, n as AccountBalanceFailedTelemetryEventSchema, nn as stampTelemetryEnvelope, nt as OperationRetriedTelemetryEventSchema, o as AuthOtpDeliveredTelemetryEventSchema, on as isCapxulOperation, ot as OrgInviteAcceptedTelemetryEventSchema, p as BootstrapResolvedTelemetryEventSchema, pt as OrganizationCreationFailedTelemetryEventSchema, q as NativeAuthorizationConnectedTelemetryEventSchema, qt as getTrackHandler, r as AccountBalanceReadTelemetryEventSchema, rn as track, rt as OrgCreateFailedTelemetryEventSchema, s as AuthOtpExpiredTelemetryEventSchema, sn as normalizeCapxulOperation, st as OrgInviteExpiredTelemetryEventSchema, t as AccessRecoveryCompletedTelemetryEventSchema, tn as setTrackHandler, tt as OnboardingProfileSubmittedTelemetryEventSchema, u as AuthVerifiedTelemetryEventSchema, ut as OrgRolesSeededTelemetryEventSchema, v as CLI_INVOCATION_KINDS, vt as PaymentFailedTelemetryEventSchema, w as CliCommandStartedTelemetryEventSchema, wt as PayrollRunTransitionedTelemetryEventSchema, x as ChainUpstreamFallbackTelemetryEventSchema, xt as PaymentSettledTelemetryEventSchema, y as CONTRACT_FIRST_TELEMETRY_EVENTS, yt as PaymentInitiatedTelemetryEventSchema, z as InvoiceRequestTransitionedTelemetryEventSchema, zt as UiActivityActionCompletedTelemetryEventSchema } from "./src-CCuVZt-H.mjs";
2
+ export { AccessRecoveryCompletedTelemetryEventSchema, AccountBalanceFailedTelemetryEventSchema, AccountBalanceReadTelemetryEventSchema, ActivityAnnotationSavedTelemetryEventSchema, AuthFailedTelemetryEventSchema, AuthOtpDeliveredTelemetryEventSchema, AuthOtpExpiredTelemetryEventSchema, AuthOtpRequestedTelemetryEventSchema, AuthSignedOutTelemetryEventSchema, AuthVerifiedTelemetryEventSchema, BROWSER_GATED_TELEMETRY_EVENTS, BootstrapFailedTelemetryEventSchema, BootstrapResolvedTelemetryEventSchema, BundlerErrorTelemetryEventSchema, CAPXUL_ENVS, CAPXUL_OPERATIONS, CLI_CAPABILITIES, CLI_COMMAND_NAMES, CLI_INVOCATION_KINDS, CONTRACT_FIRST_TELEMETRY_EVENTS, ChainAttemptSchema, ChainUpstreamFallbackTelemetryEventSchema, ChainUpstreamSchema, CliCommandCompletedTelemetryEventSchema, CliCommandStartedTelemetryEventSchema, CliDiagnosticCompletedTelemetryEventSchema, CliFirstUsedTelemetryEventSchema, ContactRelationshipChangedTelemetryEventSchema, DepositInitiatedTelemetryEventSchema, DepositSettledTelemetryEventSchema, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, FailureModeSchema, FaucetConfirmedTelemetryEventSchema, FaucetFailedTelemetryEventSchema, FaucetRequestedTelemetryEventSchema, IdentityRefusedTelemetryEventSchema, InMemoryTelemetryBusAdapter, IndexerDriftCorrectedTelemetryEventSchema, InvoiceIssuedTelemetryEventSchema, InvoiceRequestTransitionedTelemetryEventSchema, MemberActivationFailedTelemetryEventSchema, MemberActivationReadyTelemetryEventSchema, MemberActivationStartedTelemetryEventSchema, MovementScanCheckpointTelemetryEventSchema, MovementScanIncidentTelemetryEventSchema, MovementScanWindowTelemetryEventSchema, NativeAuthorizationAcceptedTelemetryEventSchema, NativeAuthorizationConnectedTelemetryEventSchema, NativeAuthorizationDeniedTelemetryEventSchema, NativeAuthorizationFailedTelemetryEventSchema, NativeAuthorizationReviewedTelemetryEventSchema, NativeAuthorizationStartedTelemetryEventSchema, OnboardingDashboardReachedTelemetryEventSchema, OnboardingIntentSelectedTelemetryEventSchema, OnboardingOrganizationSubmittedTelemetryEventSchema, OnboardingProfileSubmittedTelemetryEventSchema, OperationRetriedTelemetryEventSchema, OrgCreateFailedTelemetryEventSchema, OrgCreateStartedTelemetryEventSchema, OrgCreatedTelemetryEventSchema, OrgInviteAcceptedTelemetryEventSchema, OrgInviteExpiredTelemetryEventSchema, OrgInviteProgressedTelemetryEventSchema, OrgInviteSentTelemetryEventSchema, OrgRolesSeededTelemetryEventSchema, OrgSafeConfirmedTelemetryEventSchema, OrgSafeCreatedTelemetryEventSchema, OrganizationCreationFailedTelemetryEventSchema, OrganizationCreationReadyTelemetryEventSchema, OrganizationCreationStartedTelemetryEventSchema, PII, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, PaymentFailedTelemetryEventSchema, PaymentInitiatedTelemetryEventSchema, PaymentLifecycleTransitionTelemetryEventSchema, PaymentSettledTelemetryEventSchema, PaymentVerificationRetryTelemetryEventSchema, PayrollGroupChangedTelemetryEventSchema, PayrollRunTransitionedTelemetryEventSchema, PermissionMirrorVerificationTelemetryEventSchema, PostHogTelemetryAdapter, ProvisioningSafeConfirmedTelemetryEventSchema, ProvisioningSafeCreatedTelemetryEventSchema, QuickPayExternalAddressAcknowledgedTelemetryEventSchema, ReceiptPendingTelemetryEventSchema, RecordingTelemetryAdapter, ResponseHeadersSchema, SYNCABLE_CAPXUL_ENVS, TELEMETRY_EVENT_NAMES, TELEMETRY_EVENT_SCHEMAS, TELEMETRY_JOURNEYS, TELEMETRY_PRODUCERS, UiAccessStepCompletedTelemetryEventSchema, UiActivityActionCompletedTelemetryEventSchema, UiContactActionCompletedTelemetryEventSchema, UiInvoiceStepCompletedTelemetryEventSchema, UiPayrollActionCompletedTelemetryEventSchema, UiReceiveStepCompletedTelemetryEventSchema, UiTreasuryStepCompletedTelemetryEventSchema, createCapxulBeforeSend, createPostHogBrowserPageviewTracker, getTrackHandler, initializeCapxulBrowserAnalytics, initializePostHogBrowserAnalytics, isCapxulOperation, maskCapturedNetworkRequest, normalizeCapxulOperation, productAppAnalytics, redactTelemetryEvent, redactTelemetryProps, sanitizePostHogBrowserEvent, setTrackHandler, stampTelemetryEnvelope, track, utilityAppAnalytics };