@authsome/ui-core 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,21 @@
1
1
  // src/generated/api-client.ts
2
2
  var AuthClient = class {
3
3
  baseURL;
4
+ publishableKey;
4
5
  fetchFn;
5
6
  constructor(config) {
6
7
  this.baseURL = config.baseURL.replace(/\/+$/, "");
8
+ this.publishableKey = config.publishableKey;
7
9
  this.fetchFn = config.fetch ?? globalThis.fetch.bind(globalThis);
8
10
  }
11
+ /** Set the publishable key sent on every request as X-Publishable-Key. */
12
+ setPublishableKey(key) {
13
+ this.publishableKey = key;
14
+ }
15
+ /** Get the current publishable key. */
16
+ getPublishableKey() {
17
+ return this.publishableKey;
18
+ }
9
19
  // ──────────────────────────────────────────────────
10
20
  // Generated methods
11
21
  // ──────────────────────────────────────────────────
@@ -33,6 +43,240 @@ var AuthClient = class {
33
43
  void 0
34
44
  );
35
45
  }
46
+ /**
47
+ * OpenID Connect Discovery
48
+ * GET /.well-known/openid-configuration
49
+ */
50
+ async oidcDiscovery(token) {
51
+ const path = "/.well-known/openid-configuration";
52
+ return this.request(
53
+ "GET",
54
+ path,
55
+ void 0,
56
+ token
57
+ );
58
+ }
59
+ /**
60
+ * List SCIM Groups
61
+ * GET /scim/v2/Groups
62
+ */
63
+ async scimListGroups(token) {
64
+ const path = "/scim/v2/Groups";
65
+ return this.request(
66
+ "GET",
67
+ path,
68
+ void 0,
69
+ token
70
+ );
71
+ }
72
+ /**
73
+ * Create SCIM Group
74
+ * POST /scim/v2/Groups
75
+ */
76
+ async scimCreateGroup(body, token) {
77
+ const path = "/scim/v2/Groups";
78
+ return this.request(
79
+ "POST",
80
+ path,
81
+ body,
82
+ token
83
+ );
84
+ }
85
+ /**
86
+ * Get SCIM Group
87
+ * GET /scim/v2/Groups/{groupId}
88
+ */
89
+ async scimGetGroup(groupId, token) {
90
+ const path = `/scim/v2/Groups/${groupId}`;
91
+ return this.request(
92
+ "GET",
93
+ path,
94
+ void 0,
95
+ token
96
+ );
97
+ }
98
+ /**
99
+ * Replace SCIM Group
100
+ * PUT /scim/v2/Groups/{groupId}
101
+ */
102
+ async scimReplaceGroup(groupId, body, token) {
103
+ const path = `/scim/v2/Groups/${groupId}`;
104
+ return this.request(
105
+ "PUT",
106
+ path,
107
+ body,
108
+ token
109
+ );
110
+ }
111
+ /**
112
+ * Patch SCIM Group
113
+ * PATCH /scim/v2/Groups/{groupId}
114
+ */
115
+ async scimPatchGroup(groupId, body, token) {
116
+ const path = `/scim/v2/Groups/${groupId}`;
117
+ return this.request(
118
+ "PATCH",
119
+ path,
120
+ body,
121
+ token
122
+ );
123
+ }
124
+ /**
125
+ * Delete SCIM Group
126
+ * DELETE /scim/v2/Groups/{groupId}
127
+ */
128
+ async scimDeleteGroup(groupId, body, token) {
129
+ const path = `/scim/v2/Groups/${groupId}`;
130
+ return this.request(
131
+ "DELETE",
132
+ path,
133
+ body,
134
+ token
135
+ );
136
+ }
137
+ /**
138
+ * SCIM Resource Types
139
+ * GET /scim/v2/ResourceTypes
140
+ */
141
+ async scimResourceTypes(token) {
142
+ const path = "/scim/v2/ResourceTypes";
143
+ return this.request(
144
+ "GET",
145
+ path,
146
+ void 0,
147
+ token
148
+ );
149
+ }
150
+ /**
151
+ * SCIM Schemas
152
+ * GET /scim/v2/Schemas
153
+ */
154
+ async scimSchemas(token) {
155
+ const path = "/scim/v2/Schemas";
156
+ return this.request(
157
+ "GET",
158
+ path,
159
+ void 0,
160
+ token
161
+ );
162
+ }
163
+ /**
164
+ * SCIM Service Provider Configuration
165
+ * GET /scim/v2/ServiceProviderConfig
166
+ */
167
+ async scimServiceProviderConfig(token) {
168
+ const path = "/scim/v2/ServiceProviderConfig";
169
+ return this.request(
170
+ "GET",
171
+ path,
172
+ void 0,
173
+ token
174
+ );
175
+ }
176
+ /**
177
+ * List SCIM Users
178
+ * GET /scim/v2/Users
179
+ */
180
+ async scimListUsers(token) {
181
+ const path = "/scim/v2/Users";
182
+ return this.request(
183
+ "GET",
184
+ path,
185
+ void 0,
186
+ token
187
+ );
188
+ }
189
+ /**
190
+ * Create SCIM User
191
+ * POST /scim/v2/Users
192
+ */
193
+ async scimCreateUser(body, token) {
194
+ const path = "/scim/v2/Users";
195
+ return this.request(
196
+ "POST",
197
+ path,
198
+ body,
199
+ token
200
+ );
201
+ }
202
+ /**
203
+ * Get SCIM User
204
+ * GET /scim/v2/Users/{userId}
205
+ */
206
+ async scimGetUser(userId, token) {
207
+ const path = `/scim/v2/Users/${userId}`;
208
+ return this.request(
209
+ "GET",
210
+ path,
211
+ void 0,
212
+ token
213
+ );
214
+ }
215
+ /**
216
+ * Replace SCIM User
217
+ * PUT /scim/v2/Users/{userId}
218
+ */
219
+ async scimReplaceUser(userId, body, token) {
220
+ const path = `/scim/v2/Users/${userId}`;
221
+ return this.request(
222
+ "PUT",
223
+ path,
224
+ body,
225
+ token
226
+ );
227
+ }
228
+ /**
229
+ * Patch SCIM User
230
+ * PATCH /scim/v2/Users/{userId}
231
+ */
232
+ async scimPatchUser(userId, body, token) {
233
+ const path = `/scim/v2/Users/${userId}`;
234
+ return this.request(
235
+ "PATCH",
236
+ path,
237
+ body,
238
+ token
239
+ );
240
+ }
241
+ /**
242
+ * Delete SCIM User
243
+ * DELETE /scim/v2/Users/{userId}
244
+ */
245
+ async scimDeleteUser(userId, body, token) {
246
+ const path = `/scim/v2/Users/${userId}`;
247
+ return this.request(
248
+ "DELETE",
249
+ path,
250
+ body,
251
+ token
252
+ );
253
+ }
254
+ /**
255
+ * Create application (admin)
256
+ * POST /v1/admin/apps
257
+ */
258
+ async adminCreateApp(body, token) {
259
+ const path = "/v1/admin/apps";
260
+ return this.request(
261
+ "POST",
262
+ path,
263
+ body,
264
+ token
265
+ );
266
+ }
267
+ /**
268
+ * Delete application (admin)
269
+ * DELETE /v1/admin/apps/{appId}
270
+ */
271
+ async adminDeleteApp(appId, body, token) {
272
+ const path = `/v1/admin/apps/${appId}`;
273
+ return this.request(
274
+ "DELETE",
275
+ path,
276
+ body,
277
+ token
278
+ );
279
+ }
36
280
  /**
37
281
  * Get per-app client config overrides
38
282
  * GET /v1/admin/apps/{appId}/client-config
@@ -163,12 +407,530 @@ var AuthClient = class {
163
407
  token
164
408
  );
165
409
  }
410
+ /**
411
+ * List OAuth2 clients
412
+ * GET /v1/admin/oauth/clients
413
+ */
414
+ async listOAuth2Clients(token) {
415
+ const path = "/v1/admin/oauth/clients";
416
+ return this.request(
417
+ "GET",
418
+ path,
419
+ void 0,
420
+ token
421
+ );
422
+ }
423
+ /**
424
+ * Create OAuth2 client
425
+ * POST /v1/admin/oauth/clients
426
+ */
427
+ async createOAuth2Client(body, token) {
428
+ const path = "/v1/admin/oauth/clients";
429
+ return this.request(
430
+ "POST",
431
+ path,
432
+ body,
433
+ token
434
+ );
435
+ }
436
+ /**
437
+ * Delete OAuth2 client
438
+ * DELETE /v1/admin/oauth/clients/{clientId}
439
+ */
440
+ async deleteOAuth2Client(clientId, body, token) {
441
+ const path = `/v1/admin/oauth/clients/${clientId}`;
442
+ return this.request(
443
+ "DELETE",
444
+ path,
445
+ body,
446
+ token
447
+ );
448
+ }
166
449
  /**
167
450
  * List organizations (admin)
168
451
  * GET /v1/admin/orgs
169
452
  */
170
- async adminListOrgs(token) {
453
+ async adminListOrgs() {
171
454
  const path = "/v1/admin/orgs";
455
+ return this.request(
456
+ "GET",
457
+ path,
458
+ void 0
459
+ );
460
+ }
461
+ /**
462
+ * Grant platform-owner role (admin)
463
+ * POST /v1/admin/platform/owners
464
+ */
465
+ async adminGrantPlatformOwner(body, token) {
466
+ const path = "/v1/admin/platform/owners";
467
+ return this.request(
468
+ "POST",
469
+ path,
470
+ body,
471
+ token
472
+ );
473
+ }
474
+ /**
475
+ * Revoke platform-owner role (admin)
476
+ * DELETE /v1/admin/platform/owners/{userID}
477
+ */
478
+ async adminRevokePlatformOwner(userID, body, token) {
479
+ const path = `/v1/admin/platform/owners/${userID}`;
480
+ return this.request(
481
+ "DELETE",
482
+ path,
483
+ body,
484
+ token
485
+ );
486
+ }
487
+ /**
488
+ * List service accounts (admin)
489
+ * GET /v1/admin/service-accounts
490
+ */
491
+ async adminListServiceAccounts(token) {
492
+ const path = "/v1/admin/service-accounts";
493
+ return this.request(
494
+ "GET",
495
+ path,
496
+ void 0,
497
+ token
498
+ );
499
+ }
500
+ /**
501
+ * Create service account (admin)
502
+ * POST /v1/admin/service-accounts
503
+ */
504
+ async adminCreateServiceAccount(body, token) {
505
+ const path = "/v1/admin/service-accounts";
506
+ return this.request(
507
+ "POST",
508
+ path,
509
+ body,
510
+ token
511
+ );
512
+ }
513
+ /**
514
+ * Get service account (admin)
515
+ * GET /v1/admin/service-accounts/{serviceAccountId}
516
+ */
517
+ async adminGetServiceAccount(serviceAccountId, token) {
518
+ const path = `/v1/admin/service-accounts/${serviceAccountId}`;
519
+ return this.request(
520
+ "GET",
521
+ path,
522
+ void 0,
523
+ token
524
+ );
525
+ }
526
+ /**
527
+ * Delete service account (admin)
528
+ * DELETE /v1/admin/service-accounts/{serviceAccountId}
529
+ */
530
+ async adminDeleteServiceAccount(serviceAccountId, body, token) {
531
+ const path = `/v1/admin/service-accounts/${serviceAccountId}`;
532
+ return this.request(
533
+ "DELETE",
534
+ path,
535
+ body,
536
+ token
537
+ );
538
+ }
539
+ /**
540
+ * Create service account API key (admin)
541
+ * POST /v1/admin/service-accounts/{serviceAccountId}/api-keys
542
+ */
543
+ async adminCreateServiceAccountAPIKey(serviceAccountId, body, token) {
544
+ const path = `/v1/admin/service-accounts/${serviceAccountId}/api-keys`;
545
+ return this.request(
546
+ "POST",
547
+ path,
548
+ body,
549
+ token
550
+ );
551
+ }
552
+ /**
553
+ * List all setting definitions
554
+ * GET /v1/admin/settings/definitions
555
+ */
556
+ async listSettingsDefinitions(token) {
557
+ const path = "/v1/admin/settings/definitions";
558
+ return this.request(
559
+ "GET",
560
+ path,
561
+ void 0,
562
+ token
563
+ );
564
+ }
565
+ /**
566
+ * List definitions for a namespace
567
+ * GET /v1/admin/settings/definitions/{namespace}
568
+ */
569
+ async listNamespaceSettingsDefinitions(namespace, token) {
570
+ const path = `/v1/admin/settings/definitions/${namespace}`;
571
+ return this.request(
572
+ "GET",
573
+ path,
574
+ void 0,
575
+ token
576
+ );
577
+ }
578
+ /**
579
+ * Enforce a setting value at a scope
580
+ * PUT /v1/admin/settings/enforce/{key}
581
+ */
582
+ async enforceSetting(key, body, token) {
583
+ const path = `/v1/admin/settings/enforce/${key}`;
584
+ return this.request(
585
+ "PUT",
586
+ path,
587
+ body,
588
+ token
589
+ );
590
+ }
591
+ /**
592
+ * Remove enforcement from a setting
593
+ * DELETE /v1/admin/settings/enforce/{key}
594
+ */
595
+ async unenforceSetting(key, body, token) {
596
+ const path = `/v1/admin/settings/enforce/${key}`;
597
+ return this.request(
598
+ "DELETE",
599
+ path,
600
+ body,
601
+ token
602
+ );
603
+ }
604
+ /**
605
+ * Resolve all settings at a scope
606
+ * GET /v1/admin/settings/resolve
607
+ */
608
+ async resolveSettings(token) {
609
+ const path = "/v1/admin/settings/resolve";
610
+ return this.request(
611
+ "GET",
612
+ path,
613
+ void 0,
614
+ token
615
+ );
616
+ }
617
+ /**
618
+ * Resolve one setting with cascade details
619
+ * GET /v1/admin/settings/resolve/{key}
620
+ */
621
+ async resolveSetting(key, token) {
622
+ const path = `/v1/admin/settings/resolve/${key}`;
623
+ return this.request(
624
+ "GET",
625
+ path,
626
+ void 0,
627
+ token
628
+ );
629
+ }
630
+ /**
631
+ * Set a setting value at a scope
632
+ * PUT /v1/admin/settings/values/{key}
633
+ */
634
+ async setSetting(key, body, token) {
635
+ const path = `/v1/admin/settings/values/${key}`;
636
+ return this.request(
637
+ "PUT",
638
+ path,
639
+ body,
640
+ token
641
+ );
642
+ }
643
+ /**
644
+ * Delete a setting override at a scope
645
+ * DELETE /v1/admin/settings/values/{key}
646
+ */
647
+ async deleteSetting(key, body, token) {
648
+ const path = `/v1/admin/settings/values/${key}`;
649
+ return this.request(
650
+ "DELETE",
651
+ path,
652
+ body,
653
+ token
654
+ );
655
+ }
656
+ /**
657
+ * List social providers (admin)
658
+ * GET /v1/admin/social/providers
659
+ */
660
+ async socialAdminListProviders(app_id, token) {
661
+ const params = new URLSearchParams();
662
+ if (app_id !== void 0) params.set("app_id", String(app_id));
663
+ const qs = params.toString();
664
+ const path = "/v1/admin/social/providers" + (qs ? `?${qs}` : "");
665
+ return this.request(
666
+ "GET",
667
+ path,
668
+ void 0,
669
+ token
670
+ );
671
+ }
672
+ /**
673
+ * List supported social providers
674
+ * GET /v1/admin/social/providers/catalog
675
+ */
676
+ async socialAdminCatalog(token) {
677
+ const path = "/v1/admin/social/providers/catalog";
678
+ return this.request(
679
+ "GET",
680
+ path,
681
+ void 0,
682
+ token
683
+ );
684
+ }
685
+ /**
686
+ * Configure a social provider (admin)
687
+ * PUT /v1/admin/social/providers/{provider}
688
+ */
689
+ async socialAdminUpsertProvider(provider, body, app_id, token) {
690
+ const params = new URLSearchParams();
691
+ if (app_id !== void 0) params.set("app_id", String(app_id));
692
+ const qs = params.toString();
693
+ const path = `/v1/admin/social/providers/${provider}` + (qs ? `?${qs}` : "");
694
+ return this.request(
695
+ "PUT",
696
+ path,
697
+ body,
698
+ token
699
+ );
700
+ }
701
+ /**
702
+ * Delete a social provider (admin)
703
+ * DELETE /v1/admin/social/providers/{provider}
704
+ */
705
+ async socialAdminDeleteProvider(provider, app_id, token) {
706
+ const params = new URLSearchParams();
707
+ if (app_id !== void 0) params.set("app_id", String(app_id));
708
+ const qs = params.toString();
709
+ const path = `/v1/admin/social/providers/${provider}` + (qs ? `?${qs}` : "");
710
+ return this.request(
711
+ "DELETE",
712
+ path,
713
+ void 0,
714
+ token
715
+ );
716
+ }
717
+ /**
718
+ * List SSO connections for an app (admin)
719
+ * GET /v1/admin/sso/connections
720
+ */
721
+ async ssoAdminListConnections(app_id, token) {
722
+ const params = new URLSearchParams();
723
+ if (app_id !== void 0) params.set("app_id", String(app_id));
724
+ const qs = params.toString();
725
+ const path = "/v1/admin/sso/connections" + (qs ? `?${qs}` : "");
726
+ return this.request(
727
+ "GET",
728
+ path,
729
+ void 0,
730
+ token
731
+ );
732
+ }
733
+ /**
734
+ * Create SSO connection (admin)
735
+ * POST /v1/admin/sso/connections
736
+ */
737
+ async ssoAdminCreateConnection(body, token) {
738
+ const path = "/v1/admin/sso/connections";
739
+ return this.request(
740
+ "POST",
741
+ path,
742
+ body,
743
+ token
744
+ );
745
+ }
746
+ /**
747
+ * Get SSO connection (admin)
748
+ * GET /v1/admin/sso/connections/{connectionId}
749
+ */
750
+ async ssoAdminGetConnection(connectionId, token) {
751
+ const path = `/v1/admin/sso/connections/${connectionId}`;
752
+ return this.request(
753
+ "GET",
754
+ path,
755
+ void 0,
756
+ token
757
+ );
758
+ }
759
+ /**
760
+ * Update SSO connection (admin)
761
+ * PUT /v1/admin/sso/connections/{connectionId}
762
+ */
763
+ async ssoAdminUpdateConnection(connectionId, body, token) {
764
+ const path = `/v1/admin/sso/connections/${connectionId}`;
765
+ return this.request(
766
+ "PUT",
767
+ path,
768
+ body,
769
+ token
770
+ );
771
+ }
772
+ /**
773
+ * Delete SSO connection (admin)
774
+ * DELETE /v1/admin/sso/connections/{connectionId}
775
+ */
776
+ async ssoAdminDeleteConnection(connectionId, token) {
777
+ const path = `/v1/admin/sso/connections/${connectionId}`;
778
+ return this.request(
779
+ "DELETE",
780
+ path,
781
+ void 0,
782
+ token
783
+ );
784
+ }
785
+ /**
786
+ * Get stats (admin)
787
+ * GET /v1/admin/stats
788
+ */
789
+ async adminGetStats(token) {
790
+ const path = "/v1/admin/stats";
791
+ return this.request(
792
+ "GET",
793
+ path,
794
+ void 0,
795
+ token
796
+ );
797
+ }
798
+ /**
799
+ * List users (admin)
800
+ * GET /v1/admin/users
801
+ */
802
+ async adminListUsers(token) {
803
+ const path = "/v1/admin/users";
804
+ return this.request(
805
+ "GET",
806
+ path,
807
+ void 0,
808
+ token
809
+ );
810
+ }
811
+ /**
812
+ * Create user (admin)
813
+ * POST /v1/admin/users/create
814
+ */
815
+ async adminCreateUser(body, token) {
816
+ const path = "/v1/admin/users/create";
817
+ return this.request(
818
+ "POST",
819
+ path,
820
+ body,
821
+ token
822
+ );
823
+ }
824
+ /**
825
+ * Get user (admin)
826
+ * GET /v1/admin/users/{userId}
827
+ */
828
+ async adminGetUser(userId, token) {
829
+ const path = `/v1/admin/users/${userId}`;
830
+ return this.request(
831
+ "GET",
832
+ path,
833
+ void 0,
834
+ token
835
+ );
836
+ }
837
+ /**
838
+ * Update user (admin)
839
+ * PATCH /v1/admin/users/{userId}
840
+ */
841
+ async adminUpdateUser(userId, body, token) {
842
+ const path = `/v1/admin/users/${userId}`;
843
+ return this.request(
844
+ "PATCH",
845
+ path,
846
+ body,
847
+ token
848
+ );
849
+ }
850
+ /**
851
+ * Delete user (admin)
852
+ * DELETE /v1/admin/users/{userId}
853
+ */
854
+ async adminDeleteUser(userId, body, token) {
855
+ const path = `/v1/admin/users/${userId}`;
856
+ return this.request(
857
+ "DELETE",
858
+ path,
859
+ body,
860
+ token
861
+ );
862
+ }
863
+ /**
864
+ * Ban user (admin)
865
+ * POST /v1/admin/users/{userId}/ban
866
+ */
867
+ async adminBanUser(userId, body, token) {
868
+ const path = `/v1/admin/users/${userId}/ban`;
869
+ return this.request(
870
+ "POST",
871
+ path,
872
+ body,
873
+ token
874
+ );
875
+ }
876
+ /**
877
+ * Unban user (admin)
878
+ * POST /v1/admin/users/{userId}/unban
879
+ */
880
+ async adminUnbanUser(userId, body, token) {
881
+ const path = `/v1/admin/users/${userId}/unban`;
882
+ return this.request(
883
+ "POST",
884
+ path,
885
+ body,
886
+ token
887
+ );
888
+ }
889
+ /**
890
+ * List coupons
891
+ * GET /v1/billing/coupons
892
+ */
893
+ async listCoupons(token) {
894
+ const path = "/v1/billing/coupons";
895
+ return this.request(
896
+ "GET",
897
+ path,
898
+ void 0,
899
+ token
900
+ );
901
+ }
902
+ /**
903
+ * Create coupon
904
+ * POST /v1/billing/coupons
905
+ */
906
+ async createCoupon(body, token) {
907
+ const path = "/v1/billing/coupons";
908
+ return this.request(
909
+ "POST",
910
+ path,
911
+ body,
912
+ token
913
+ );
914
+ }
915
+ /**
916
+ * Delete coupon
917
+ * DELETE /v1/billing/coupons/{couponId}
918
+ */
919
+ async deleteCoupon(couponId, body, token) {
920
+ const path = `/v1/billing/coupons/${couponId}`;
921
+ return this.request(
922
+ "DELETE",
923
+ path,
924
+ body,
925
+ token
926
+ );
927
+ }
928
+ /**
929
+ * Check feature entitlement
930
+ * GET /v1/billing/entitlements/{featureKey}
931
+ */
932
+ async checkEntitlement(featureKey, token) {
933
+ const path = `/v1/billing/entitlements/${featureKey}`;
172
934
  return this.request(
173
935
  "GET",
174
936
  path,
@@ -177,11 +939,11 @@ var AuthClient = class {
177
939
  );
178
940
  }
179
941
  /**
180
- * List all setting definitions
181
- * GET /v1/admin/settings/definitions
942
+ * List invoices
943
+ * GET /v1/billing/invoices
182
944
  */
183
- async listSettingsDefinitions(token) {
184
- const path = "/v1/admin/settings/definitions";
945
+ async listInvoices(token) {
946
+ const path = "/v1/billing/invoices";
185
947
  return this.request(
186
948
  "GET",
187
949
  path,
@@ -190,11 +952,11 @@ var AuthClient = class {
190
952
  );
191
953
  }
192
954
  /**
193
- * List definitions for a namespace
194
- * GET /v1/admin/settings/definitions/{namespace}
955
+ * Get invoice
956
+ * GET /v1/billing/invoices/{invoiceId}
195
957
  */
196
- async listNamespaceSettingsDefinitions(namespace, token) {
197
- const path = `/v1/admin/settings/definitions/${namespace}`;
958
+ async getInvoice(invoiceId, token) {
959
+ const path = `/v1/billing/invoices/${invoiceId}`;
198
960
  return this.request(
199
961
  "GET",
200
962
  path,
@@ -203,37 +965,37 @@ var AuthClient = class {
203
965
  );
204
966
  }
205
967
  /**
206
- * Enforce a setting value at a scope
207
- * PUT /v1/admin/settings/enforce/{key}
968
+ * Mark invoice as paid
969
+ * POST /v1/billing/invoices/{invoiceId}/pay
208
970
  */
209
- async enforceSetting(key, body, token) {
210
- const path = `/v1/admin/settings/enforce/${key}`;
971
+ async markInvoicePaid(invoiceId, body, token) {
972
+ const path = `/v1/billing/invoices/${invoiceId}/pay`;
211
973
  return this.request(
212
- "PUT",
974
+ "POST",
213
975
  path,
214
976
  body,
215
977
  token
216
978
  );
217
979
  }
218
980
  /**
219
- * Remove enforcement from a setting
220
- * DELETE /v1/admin/settings/enforce/{key}
981
+ * Void an invoice
982
+ * POST /v1/billing/invoices/{invoiceId}/void
221
983
  */
222
- async unenforceSetting(key, body, token) {
223
- const path = `/v1/admin/settings/enforce/${key}`;
984
+ async voidInvoice(invoiceId, body, token) {
985
+ const path = `/v1/billing/invoices/${invoiceId}/void`;
224
986
  return this.request(
225
- "DELETE",
987
+ "POST",
226
988
  path,
227
989
  body,
228
990
  token
229
991
  );
230
992
  }
231
993
  /**
232
- * Resolve all settings at a scope
233
- * GET /v1/admin/settings/resolve
994
+ * List billing plans
995
+ * GET /v1/billing/plans
234
996
  */
235
- async resolveSettings(token) {
236
- const path = "/v1/admin/settings/resolve";
997
+ async listBillingPlans(token) {
998
+ const path = "/v1/billing/plans";
237
999
  return this.request(
238
1000
  "GET",
239
1001
  path,
@@ -242,11 +1004,24 @@ var AuthClient = class {
242
1004
  );
243
1005
  }
244
1006
  /**
245
- * Resolve one setting with cascade details
246
- * GET /v1/admin/settings/resolve/{key}
1007
+ * Create billing plan
1008
+ * POST /v1/billing/plans
247
1009
  */
248
- async resolveSetting(key, token) {
249
- const path = `/v1/admin/settings/resolve/${key}`;
1010
+ async createBillingPlan(body, token) {
1011
+ const path = "/v1/billing/plans";
1012
+ return this.request(
1013
+ "POST",
1014
+ path,
1015
+ body,
1016
+ token
1017
+ );
1018
+ }
1019
+ /**
1020
+ * Get billing plan
1021
+ * GET /v1/billing/plans/{planId}
1022
+ */
1023
+ async getBillingPlan(planId, token) {
1024
+ const path = `/v1/billing/plans/${planId}`;
250
1025
  return this.request(
251
1026
  "GET",
252
1027
  path,
@@ -255,37 +1030,37 @@ var AuthClient = class {
255
1030
  );
256
1031
  }
257
1032
  /**
258
- * Set a setting value at a scope
259
- * PUT /v1/admin/settings/values/{key}
1033
+ * Activate a billing plan
1034
+ * POST /v1/billing/plans/{planId}/activate
260
1035
  */
261
- async setSetting(key, body, token) {
262
- const path = `/v1/admin/settings/values/${key}`;
1036
+ async activateBillingPlan(planId, body, token) {
1037
+ const path = `/v1/billing/plans/${planId}/activate`;
263
1038
  return this.request(
264
- "PUT",
1039
+ "POST",
265
1040
  path,
266
1041
  body,
267
1042
  token
268
1043
  );
269
1044
  }
270
1045
  /**
271
- * Delete a setting override at a scope
272
- * DELETE /v1/admin/settings/values/{key}
1046
+ * Archive a billing plan
1047
+ * POST /v1/billing/plans/{planId}/archive
273
1048
  */
274
- async deleteSetting(key, body, token) {
275
- const path = `/v1/admin/settings/values/${key}`;
1049
+ async archiveBillingPlan(planId, body, token) {
1050
+ const path = `/v1/billing/plans/${planId}/archive`;
276
1051
  return this.request(
277
- "DELETE",
1052
+ "POST",
278
1053
  path,
279
1054
  body,
280
1055
  token
281
1056
  );
282
1057
  }
283
1058
  /**
284
- * Get stats (admin)
285
- * GET /v1/admin/stats
1059
+ * List subscriptions
1060
+ * GET /v1/billing/subscriptions
286
1061
  */
287
- async adminGetStats(token) {
288
- const path = "/v1/admin/stats";
1062
+ async listSubscriptions(token) {
1063
+ const path = "/v1/billing/subscriptions";
289
1064
  return this.request(
290
1065
  "GET",
291
1066
  path,
@@ -294,24 +1069,24 @@ var AuthClient = class {
294
1069
  );
295
1070
  }
296
1071
  /**
297
- * List users (admin)
298
- * GET /v1/admin/users
1072
+ * Create subscription
1073
+ * POST /v1/billing/subscriptions
299
1074
  */
300
- async adminListUsers(token) {
301
- const path = "/v1/admin/users";
1075
+ async createSubscription(body, token) {
1076
+ const path = "/v1/billing/subscriptions";
302
1077
  return this.request(
303
- "GET",
1078
+ "POST",
304
1079
  path,
305
- void 0,
1080
+ body,
306
1081
  token
307
1082
  );
308
1083
  }
309
1084
  /**
310
- * Get user (admin)
311
- * GET /v1/admin/users/{userId}
1085
+ * Get active subscription
1086
+ * GET /v1/billing/subscriptions/active
312
1087
  */
313
- async adminGetUser(userId, token) {
314
- const path = `/v1/admin/users/${userId}`;
1088
+ async getActiveSubscription(token) {
1089
+ const path = "/v1/billing/subscriptions/active";
315
1090
  return this.request(
316
1091
  "GET",
317
1092
  path,
@@ -320,24 +1095,24 @@ var AuthClient = class {
320
1095
  );
321
1096
  }
322
1097
  /**
323
- * Delete user (admin)
324
- * DELETE /v1/admin/users/{userId}
1098
+ * Cancel subscription
1099
+ * POST /v1/billing/subscriptions/{subId}/cancel
325
1100
  */
326
- async adminDeleteUser(userId, body, token) {
327
- const path = `/v1/admin/users/${userId}`;
1101
+ async cancelSubscription(subId, body, token) {
1102
+ const path = `/v1/billing/subscriptions/${subId}/cancel`;
328
1103
  return this.request(
329
- "DELETE",
1104
+ "POST",
330
1105
  path,
331
1106
  body,
332
1107
  token
333
1108
  );
334
1109
  }
335
1110
  /**
336
- * Ban user (admin)
337
- * POST /v1/admin/users/{userId}/ban
1111
+ * Change subscription plan
1112
+ * POST /v1/billing/subscriptions/{subId}/change-plan
338
1113
  */
339
- async adminBanUser(userId, body, token) {
340
- const path = `/v1/admin/users/${userId}/ban`;
1114
+ async changeSubscriptionPlan(subId, body, token) {
1115
+ const path = `/v1/billing/subscriptions/${subId}/change-plan`;
341
1116
  return this.request(
342
1117
  "POST",
343
1118
  path,
@@ -346,11 +1121,24 @@ var AuthClient = class {
346
1121
  );
347
1122
  }
348
1123
  /**
349
- * Unban user (admin)
350
- * POST /v1/admin/users/{userId}/unban
1124
+ * Pause subscription
1125
+ * POST /v1/billing/subscriptions/{subId}/pause
351
1126
  */
352
- async adminUnbanUser(userId, body, token) {
353
- const path = `/v1/admin/users/${userId}/unban`;
1127
+ async pauseSubscription(subId, body, token) {
1128
+ const path = `/v1/billing/subscriptions/${subId}/pause`;
1129
+ return this.request(
1130
+ "POST",
1131
+ path,
1132
+ body,
1133
+ token
1134
+ );
1135
+ }
1136
+ /**
1137
+ * Resume subscription
1138
+ * POST /v1/billing/subscriptions/{subId}/resume
1139
+ */
1140
+ async resumeSubscription(subId, body, token) {
1141
+ const path = `/v1/billing/subscriptions/${subId}/resume`;
354
1142
  return this.request(
355
1143
  "POST",
356
1144
  path,
@@ -358,6 +1146,19 @@ var AuthClient = class {
358
1146
  token
359
1147
  );
360
1148
  }
1149
+ /**
1150
+ * Get usage summary
1151
+ * GET /v1/billing/usage
1152
+ */
1153
+ async getUsageSummary(token) {
1154
+ const path = "/v1/billing/usage";
1155
+ return this.request(
1156
+ "GET",
1157
+ path,
1158
+ void 0,
1159
+ token
1160
+ );
1161
+ }
361
1162
  /**
362
1163
  * Change password
363
1164
  * POST /v1/change-password
@@ -384,6 +1185,42 @@ var AuthClient = class {
384
1185
  token
385
1186
  );
386
1187
  }
1188
+ /**
1189
+ * List consents
1190
+ * GET /v1/consent
1191
+ */
1192
+ async listConsents() {
1193
+ const path = "/v1/consent";
1194
+ return this.request(
1195
+ "GET",
1196
+ path,
1197
+ void 0
1198
+ );
1199
+ }
1200
+ /**
1201
+ * Grant consent
1202
+ * POST /v1/consent/grant
1203
+ */
1204
+ async grantConsent(body) {
1205
+ const path = "/v1/consent/grant";
1206
+ return this.request(
1207
+ "POST",
1208
+ path,
1209
+ body
1210
+ );
1211
+ }
1212
+ /**
1213
+ * Revoke consent
1214
+ * POST /v1/consent/revoke
1215
+ */
1216
+ async revokeConsent(body) {
1217
+ const path = "/v1/consent/revoke";
1218
+ return this.request(
1219
+ "POST",
1220
+ path,
1221
+ body
1222
+ );
1223
+ }
387
1224
  /**
388
1225
  * List devices
389
1226
  * GET /v1/devices
@@ -577,6 +1414,18 @@ var AuthClient = class {
577
1414
  void 0
578
1415
  );
579
1416
  }
1417
+ /**
1418
+ * Introspect token
1419
+ * POST /v1/introspect
1420
+ */
1421
+ async introspectToken(body) {
1422
+ const path = "/v1/introspect";
1423
+ return this.request(
1424
+ "POST",
1425
+ path,
1426
+ body
1427
+ );
1428
+ }
580
1429
  /**
581
1430
  * List API keys
582
1431
  * GET /v1/keys
@@ -718,6 +1567,19 @@ var AuthClient = class {
718
1567
  token
719
1568
  );
720
1569
  }
1570
+ /**
1571
+ * Switch active organization
1572
+ * POST /v1/me/switch-org
1573
+ */
1574
+ async switchOrg(body, token) {
1575
+ const path = "/v1/me/switch-org";
1576
+ return this.request(
1577
+ "POST",
1578
+ path,
1579
+ body,
1580
+ token
1581
+ );
1582
+ }
721
1583
  /**
722
1584
  * MFA challenge
723
1585
  * POST /v1/mfa/challenge
@@ -819,6 +1681,80 @@ var AuthClient = class {
819
1681
  body
820
1682
  );
821
1683
  }
1684
+ /**
1685
+ * OAuth2 Authorization
1686
+ * GET /v1/oauth/authorize
1687
+ */
1688
+ async oauth2Authorize() {
1689
+ const path = "/v1/oauth/authorize";
1690
+ return this.request(
1691
+ "GET",
1692
+ path,
1693
+ void 0
1694
+ );
1695
+ }
1696
+ /**
1697
+ * Device Authorization
1698
+ * POST /v1/oauth/device/authorize
1699
+ */
1700
+ async oauth2DeviceAuthorize(body) {
1701
+ const path = "/v1/oauth/device/authorize";
1702
+ return this.request(
1703
+ "POST",
1704
+ path,
1705
+ body
1706
+ );
1707
+ }
1708
+ /**
1709
+ * Complete device authorization
1710
+ * POST /v1/oauth/device/complete
1711
+ */
1712
+ async oauth2DeviceComplete(body) {
1713
+ const path = "/v1/oauth/device/complete";
1714
+ return this.request(
1715
+ "POST",
1716
+ path,
1717
+ body
1718
+ );
1719
+ }
1720
+ /**
1721
+ * Revoke token
1722
+ * POST /v1/oauth/revoke
1723
+ */
1724
+ async oauth2Revoke(body, token) {
1725
+ const path = "/v1/oauth/revoke";
1726
+ return this.request(
1727
+ "POST",
1728
+ path,
1729
+ body,
1730
+ token
1731
+ );
1732
+ }
1733
+ /**
1734
+ * OAuth2 Token
1735
+ * POST /v1/oauth/token
1736
+ */
1737
+ async oauth2Token(body) {
1738
+ const path = "/v1/oauth/token";
1739
+ return this.request(
1740
+ "POST",
1741
+ path,
1742
+ body
1743
+ );
1744
+ }
1745
+ /**
1746
+ * OIDC UserInfo
1747
+ * GET /v1/oauth/userinfo
1748
+ */
1749
+ async oauth2UserInfo(token) {
1750
+ const path = "/v1/oauth/userinfo";
1751
+ return this.request(
1752
+ "GET",
1753
+ path,
1754
+ void 0,
1755
+ token
1756
+ );
1757
+ }
822
1758
  /**
823
1759
  * List organizations
824
1760
  * GET /v1/orgs
@@ -1068,10 +2004,10 @@ var AuthClient = class {
1068
2004
  }
1069
2005
  /**
1070
2006
  * List passkeys
1071
- * GET /v1/passkeys/
2007
+ * GET /v1/passkeys
1072
2008
  */
1073
2009
  async listPasskeys(token) {
1074
- const path = "/v1/passkeys/";
2010
+ const path = "/v1/passkeys";
1075
2011
  return this.request(
1076
2012
  "GET",
1077
2013
  path,
@@ -1142,6 +2078,30 @@ var AuthClient = class {
1142
2078
  token
1143
2079
  );
1144
2080
  }
2081
+ /**
2082
+ * Start phone authentication
2083
+ * POST /v1/phone/start
2084
+ */
2085
+ async phoneAuthStart(body) {
2086
+ const path = "/v1/phone/start";
2087
+ return this.request(
2088
+ "POST",
2089
+ path,
2090
+ body
2091
+ );
2092
+ }
2093
+ /**
2094
+ * Verify phone OTP
2095
+ * POST /v1/phone/verify
2096
+ */
2097
+ async phoneAuthVerify(body) {
2098
+ const path = "/v1/phone/verify";
2099
+ return this.request(
2100
+ "POST",
2101
+ path,
2102
+ body
2103
+ );
2104
+ }
1145
2105
  /**
1146
2106
  * Refresh tokens
1147
2107
  * POST /v1/refresh
@@ -1444,6 +2404,18 @@ var AuthClient = class {
1444
2404
  body
1445
2405
  );
1446
2406
  }
2407
+ /**
2408
+ * Resend email verification
2409
+ * POST /v1/verify-email/resend
2410
+ */
2411
+ async resendEmailVerification(body) {
2412
+ const path = "/v1/verify-email/resend";
2413
+ return this.request(
2414
+ "POST",
2415
+ path,
2416
+ body
2417
+ );
2418
+ }
1447
2419
  /**
1448
2420
  * List webhooks
1449
2421
  * GET /v1/webhooks
@@ -1520,6 +2492,9 @@ var AuthClient = class {
1520
2492
  if (token) {
1521
2493
  headers["Authorization"] = `Bearer ${token}`;
1522
2494
  }
2495
+ if (this.publishableKey) {
2496
+ headers["X-Publishable-Key"] = this.publishableKey;
2497
+ }
1523
2498
  const response = await this.fetchFn(`${this.baseURL}${path}`, {
1524
2499
  method,
1525
2500
  headers,
@@ -1533,7 +2508,10 @@ var AuthClient = class {
1533
2508
  }
1534
2509
  throw new AuthClientError(
1535
2510
  apiError?.error ?? `Request failed with status ${response.status}`,
1536
- apiError?.code ?? response.status
2511
+ apiError?.code ?? response.status,
2512
+ apiError?.type,
2513
+ apiError
2514
+ // full decoded body so callers can read extras like mfa_ticket / available_methods
1537
2515
  );
1538
2516
  }
1539
2517
  if (response.status === 204) {
@@ -1544,10 +2522,23 @@ var AuthClient = class {
1544
2522
  };
1545
2523
  var AuthClientError = class extends Error {
1546
2524
  code;
1547
- constructor(message, code) {
2525
+ // Stable string error code from the backend envelope (e.g.
2526
+ // "email_not_verified", "captcha_required", "mfa_required"). Lets
2527
+ // the UI branch on specific failure modes instead of pattern-
2528
+ // matching on the human-readable message.
2529
+ type;
2530
+ // Full decoded JSON body when the response body was JSON. Lets
2531
+ // callers read tagged extras the envelope carries beyond
2532
+ // {error, code, type} — e.g. mfa_ticket and available_methods on
2533
+ // a 403 with type:"mfa_required". Undefined when the body wasn't
2534
+ // JSON.
2535
+ details;
2536
+ constructor(message, code, type, details) {
1548
2537
  super(message);
1549
2538
  this.name = "AuthClientError";
1550
2539
  this.code = code;
2540
+ this.type = type;
2541
+ this.details = details;
1551
2542
  }
1552
2543
  };
1553
2544
 
@@ -1644,13 +2635,20 @@ var AuthClient2 = class extends AuthClient {
1644
2635
  *
1645
2636
  * The config describes which auth methods are enabled so SDK
1646
2637
  * components can auto-configure without manual props.
2638
+ *
2639
+ * Reads `baseURL` and `fetchFn` directly off the generated parent
2640
+ * class — earlier generator templates kept a `this.config` ref but
2641
+ * the current embedded template stores fields individually, so the
2642
+ * old `(this as any).config.baseURL` shape produced `undefined` and
2643
+ * the URL constructor threw.
1647
2644
  */
1648
2645
  async fetchClientConfig(publishableKey) {
1649
- const url = new URL("/v1/client-config", this.config.baseURL);
2646
+ const baseURL = this.baseURL;
2647
+ const fetchFn = this.fetchFn ?? globalThis.fetch;
2648
+ const url = new URL("/v1/client-config", baseURL);
1650
2649
  if (publishableKey) {
1651
2650
  url.searchParams.set("key", publishableKey);
1652
2651
  }
1653
- const fetchFn = this.config.fetch ?? globalThis.fetch;
1654
2652
  const res = await fetchFn(url.toString(), {
1655
2653
  method: "GET",
1656
2654
  headers: { "Content-Type": "application/json" }
@@ -1775,6 +2773,26 @@ var AuthManager = class {
1775
2773
  };
1776
2774
  await this.handleAuthResponse(res.user, session);
1777
2775
  } catch (err) {
2776
+ if (err instanceof AuthClientError && err.type === "mfa_required" && err.details) {
2777
+ const ticket = typeof err.details["mfa_ticket"] === "string" ? err.details["mfa_ticket"] : "";
2778
+ const methods = Array.isArray(err.details["available_methods"]) ? err.details["available_methods"] : [];
2779
+ if (ticket) {
2780
+ this.setState({
2781
+ status: "mfa_required",
2782
+ email: credentials.email ?? "",
2783
+ mfaTicket: ticket,
2784
+ availableMethods: methods
2785
+ });
2786
+ return;
2787
+ }
2788
+ }
2789
+ if (err instanceof AuthClientError && err.type === "email_not_verified") {
2790
+ this.setState({
2791
+ status: "email_not_verified",
2792
+ email: credentials.email ?? ""
2793
+ });
2794
+ throw err;
2795
+ }
1778
2796
  this.handleError(err);
1779
2797
  throw err;
1780
2798
  }
@@ -1782,18 +2800,35 @@ var AuthManager = class {
1782
2800
  /** Sign up with email & password. */
1783
2801
  async signUp(data) {
1784
2802
  try {
1785
- const res = await this.client.signUp(data);
1786
- const session = {
1787
- session_token: res.session_token,
1788
- refresh_token: res.refresh_token,
1789
- expires_at: new Date(Date.now() + 36e5).toISOString()
1790
- };
1791
- await this.handleAuthResponse(res.user, session);
2803
+ await this.client.signUp(data);
2804
+ this.setState({
2805
+ status: "verification_pending",
2806
+ email: data.email
2807
+ });
1792
2808
  } catch (err) {
1793
2809
  this.handleError(err);
1794
2810
  throw err;
1795
2811
  }
1796
2812
  }
2813
+ /**
2814
+ * Resend the verification email for an unverified account.
2815
+ *
2816
+ * Always resolves; the backend returns 200 regardless of whether the
2817
+ * email is registered, unregistered, or already verified — that's the
2818
+ * enumeration-resistance contract. UI callers should disable the
2819
+ * button + show a generic "if your email is registered, we sent a new
2820
+ * link" confirmation rather than branching on the response.
2821
+ */
2822
+ async resendVerification(email) {
2823
+ if (!email) return;
2824
+ try {
2825
+ await this.client.resendEmailVerification({ email });
2826
+ } catch (err) {
2827
+ this.onError?.({
2828
+ error: err instanceof Error ? err.message : "resend failed"
2829
+ });
2830
+ }
2831
+ }
1797
2832
  /** Sign out and clear the session. */
1798
2833
  async signOut() {
1799
2834
  const token = this.getSessionToken();
@@ -1807,21 +2842,48 @@ var AuthManager = class {
1807
2842
  await this.clearSession();
1808
2843
  this.setState({ status: "unauthenticated" });
1809
2844
  }
1810
- /** Submit an MFA challenge code. */
1811
- async submitMFACode(enrollmentId, code) {
1812
- this.setState({ status: "loading" });
2845
+ /**
2846
+ * Submit the MFA challenge code against the ticket from the
2847
+ * mfa_required state. On success: real session minted, state →
2848
+ * "authenticated". On bad code: state stays "mfa_required" so
2849
+ * the form can show the error inline; the ticket remains valid
2850
+ * for the 5-minute server-side TTL.
2851
+ *
2852
+ * Throws if called outside the mfa_required state — the caller
2853
+ * has nowhere to send the code.
2854
+ */
2855
+ async submitMFAChallenge(code) {
2856
+ const state = this.state;
2857
+ if (state.status !== "mfa_required") {
2858
+ throw new Error("auth: submitMFAChallenge called outside the mfa_required state");
2859
+ }
1813
2860
  try {
1814
- const res = await this.client.mfaChallenge({ enrollment_id: enrollmentId, code });
2861
+ const res = await this.client.challengeMFA({
2862
+ mfa_ticket: state.mfaTicket,
2863
+ code
2864
+ });
1815
2865
  const session = {
1816
2866
  session_token: res.session_token,
1817
2867
  refresh_token: res.refresh_token,
1818
- expires_at: new Date(Date.now() + 36e5).toISOString()
2868
+ expires_at: res.expires_at ?? new Date(Date.now() + 36e5).toISOString()
1819
2869
  };
1820
2870
  await this.handleAuthResponse(res.user, session);
1821
2871
  } catch (err) {
1822
- this.handleError(err);
2872
+ this.onError?.({
2873
+ error: err instanceof Error ? err.message : "challenge failed"
2874
+ });
2875
+ throw err;
1823
2876
  }
1824
2877
  }
2878
+ /**
2879
+ * @deprecated Use submitMFAChallenge(code). The old enrollment-id
2880
+ * + partial-session shape was removed in the MFA consolidation;
2881
+ * this thin shim only exists so older callers don't break their
2882
+ * build, but the enrollmentId argument is now ignored.
2883
+ */
2884
+ async submitMFACode(_enrollmentId, code) {
2885
+ return this.submitMFAChallenge(code);
2886
+ }
1825
2887
  /** Submit an MFA recovery code. */
1826
2888
  async submitRecoveryCode(code) {
1827
2889
  this.setState({ status: "loading" });
@@ -1866,16 +2928,26 @@ var AuthManager = class {
1866
2928
  if (state.status !== "authenticated") return;
1867
2929
  await this.refreshSession(state.session.refresh_token);
1868
2930
  }
1869
- /** Get the current session token (if authenticated). */
2931
+ /**
2932
+ * Get the current session token (if authenticated). Returns null
2933
+ * during the MFA challenge — there is no real session yet, only a
2934
+ * ticket the challenge handler validates internally.
2935
+ */
1870
2936
  getSessionToken() {
1871
2937
  if (this.state.status === "authenticated") {
1872
2938
  return this.state.session.session_token;
1873
2939
  }
1874
- if (this.state.status === "mfa_required") {
1875
- return this.state.session.session_token;
1876
- }
1877
2940
  return null;
1878
2941
  }
2942
+ /**
2943
+ * Get the active MFA ticket (only set during the mfa_required
2944
+ * state). Form components driving the challenge UI read this to
2945
+ * confirm they have a partial-auth credential before letting the
2946
+ * user submit a code.
2947
+ */
2948
+ getMFATicket() {
2949
+ return this.state.status === "mfa_required" ? this.state.mfaTicket : null;
2950
+ }
1879
2951
  /** Get the current user (if authenticated). */
1880
2952
  getUser() {
1881
2953
  if (this.state.status === "authenticated") {
@@ -2000,22 +3072,9 @@ var AuthManager = class {
2000
3072
  handleError(err) {
2001
3073
  const message = err instanceof AuthClientError ? err.message : "An unexpected error occurred";
2002
3074
  const code = err instanceof AuthClientError ? err.code : void 0;
2003
- if (code === 403 && message.toLowerCase().includes("mfa")) {
2004
- const token = this.getSessionToken();
2005
- if (token) {
2006
- this.setState({
2007
- status: "mfa_required",
2008
- session: {
2009
- session_token: token,
2010
- refresh_token: "",
2011
- expires_at: new Date(Date.now() + 3e5).toISOString()
2012
- }
2013
- });
2014
- return;
2015
- }
2016
- }
3075
+ const type = err instanceof AuthClientError ? err.type : void 0;
2017
3076
  this.setState({ status: "error", error: message });
2018
- this.onError?.({ error: message, code });
3077
+ this.onError?.({ error: message, code, type });
2019
3078
  }
2020
3079
  };
2021
3080