@capxul/observability 4.2.0 → 4.20.0-beta.10

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