@iqauth/sdk 2.6.4 → 2.8.1

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.
Files changed (117) hide show
  1. package/README.md +173 -1
  2. package/dist/browser-session.d.mts +4 -4
  3. package/dist/browser-session.d.ts +4 -4
  4. package/dist/browser-session.js +212 -46
  5. package/dist/browser-session.mjs +3 -3
  6. package/dist/browser.d.mts +5 -5
  7. package/dist/browser.d.ts +5 -5
  8. package/dist/browser.js +293 -34
  9. package/dist/browser.mjs +5 -5
  10. package/dist/{chunk-BVV54LPI.mjs → chunk-25SSYDIP.mjs} +10 -4
  11. package/dist/{chunk-XAWYUPMO.mjs → chunk-4V7FKOTG.mjs} +242 -22
  12. package/dist/{chunk-6I6RM4MN.mjs → chunk-6PJRLRB4.mjs} +33 -3
  13. package/dist/{chunk-SL3KRS4W.mjs → chunk-CIJORODR.mjs} +23 -1
  14. package/dist/{chunk-LIZYFXH7.mjs → chunk-DFWHSDYQ.mjs} +1 -1
  15. package/dist/chunk-GLXSIGVS.mjs +66 -0
  16. package/dist/{chunk-DJIBN2N7.mjs → chunk-GN37E64I.mjs} +29 -7
  17. package/dist/{chunk-WQWBJSSS.mjs → chunk-HVHNYPDC.mjs} +6 -6
  18. package/dist/chunk-JRDVUWAL.mjs +46 -0
  19. package/dist/{chunk-UNYDG2L4.mjs → chunk-NUO2I65G.mjs} +56 -23
  20. package/dist/{chunk-5T7GHBX6.mjs → chunk-TLET552H.mjs} +36 -0
  21. package/dist/chunk-VYQ3ETCK.mjs +244 -0
  22. package/dist/{chunk-3JULWS6F.mjs → chunk-WCELYTJ3.mjs} +3 -3
  23. package/dist/chunk-WHT6WKTY.mjs +3180 -0
  24. package/dist/{chunk-MKKZULZR.mjs → chunk-WIFG74IK.mjs} +1 -1
  25. package/dist/chunk-WSH4SW7F.mjs +490 -0
  26. package/dist/{chunk-W3F4JYGP.mjs → chunk-ZLJPABB7.mjs} +139 -23
  27. package/dist/cli/index.js +2 -2
  28. package/dist/cli/index.mjs +2 -2
  29. package/dist/{client-BNQe3AgF.d.ts → client-D8L-PaWr.d.mts} +59 -6
  30. package/dist/{client-kYlJFgPv.d.mts → client-DkPL0EPZ.d.ts} +59 -6
  31. package/dist/{doctor-YYNHNMLD.mjs → doctor-JAFXWU3X.mjs} +2 -2
  32. package/dist/errors-Jl1Jtm-6.d.mts +107 -0
  33. package/dist/errors-Jl1Jtm-6.d.ts +107 -0
  34. package/dist/{express-CHpfa7D_.d.ts → express-Budysq4h.d.ts} +2 -2
  35. package/dist/{express-B6_1vBYZ.d.mts → express-DDTA3qV1.d.mts} +2 -2
  36. package/dist/express.d.mts +7 -6
  37. package/dist/express.d.ts +7 -6
  38. package/dist/express.js +563 -85
  39. package/dist/express.mjs +73 -34
  40. package/dist/fastify.d.mts +10 -0
  41. package/dist/fastify.d.ts +10 -0
  42. package/dist/fastify.js +589 -65
  43. package/dist/fastify.mjs +101 -11
  44. package/dist/hono.d.mts +10 -0
  45. package/dist/hono.d.ts +10 -0
  46. package/dist/hono.js +566 -65
  47. package/dist/hono.mjs +78 -11
  48. package/dist/index-Cko-d5po.d.mts +1848 -0
  49. package/dist/index-RNqwEcmY.d.ts +1848 -0
  50. package/dist/index.d.mts +56 -8
  51. package/dist/index.d.ts +56 -8
  52. package/dist/index.js +694 -75
  53. package/dist/index.mjs +30 -10
  54. package/dist/{keys-NLWFAOEM.mjs → keys-6Y776TG2.mjs} +2 -2
  55. package/dist/locales.d.mts +1 -1
  56. package/dist/locales.d.ts +1 -1
  57. package/dist/locales.js +36 -0
  58. package/dist/locales.mjs +1 -1
  59. package/dist/mobile.d.mts +77 -7
  60. package/dist/mobile.d.ts +77 -7
  61. package/dist/mobile.js +307 -46
  62. package/dist/mobile.mjs +98 -3
  63. package/dist/next.d.mts +10 -1
  64. package/dist/next.d.ts +10 -1
  65. package/dist/next.js +596 -205
  66. package/dist/next.mjs +83 -10
  67. package/dist/{provisioningBridge-88xjOS2n.d.mts → provisioningBridge-BXPMZCLe.d.ts} +30 -2
  68. package/dist/{provisioningBridge-DnTfzdZK.d.ts → provisioningBridge-IEycmsgb.d.mts} +30 -2
  69. package/dist/{publishableKey-BaR0HoAH.d.ts → publishableKey-f2kq-rKw.d.mts} +1 -1
  70. package/dist/{publishableKey-BaR0HoAH.d.mts → publishableKey-f2kq-rKw.d.ts} +1 -1
  71. package/dist/react-permissions.d.mts +52 -0
  72. package/dist/react-permissions.d.ts +52 -0
  73. package/dist/react-permissions.js +239 -0
  74. package/dist/react-permissions.mjs +98 -0
  75. package/dist/react.d.mts +9 -1624
  76. package/dist/react.d.ts +9 -1624
  77. package/dist/react.js +882 -73
  78. package/dist/react.mjs +71 -2631
  79. package/dist/{reverify-4UEJXUS6.mjs → reverify-C64QXKJO.mjs} +2 -2
  80. package/dist/server/handlers.d.mts +200 -4
  81. package/dist/server/handlers.d.ts +200 -4
  82. package/dist/server/handlers.js +530 -16
  83. package/dist/server/handlers.mjs +14 -3
  84. package/dist/server.d.mts +171 -8
  85. package/dist/server.d.ts +171 -8
  86. package/dist/server.js +579 -61
  87. package/dist/server.mjs +99 -12
  88. package/dist/service.d.mts +4 -4
  89. package/dist/service.d.ts +4 -4
  90. package/dist/service.js +212 -46
  91. package/dist/service.mjs +3 -3
  92. package/dist/{signIn-CiIBTJIh.d.mts → signIn-CReqfXsh.d.mts} +95 -3
  93. package/dist/{signIn-OCr88Zf8.d.ts → signIn-Cfa1GTpO.d.ts} +95 -3
  94. package/dist/{signIn-4OKLDEIH.mjs → signIn-SHBW6Z4T.mjs} +1 -1
  95. package/dist/test.mjs +3 -3
  96. package/dist/{tokens-DCyzzn8L.d.mts → tokens-9F6ETrzk.d.ts} +9 -2
  97. package/dist/{tokens-aHiGFr_E.d.ts → tokens-B06VtvUi.d.mts} +9 -2
  98. package/dist/{types-DZAflmmq.d.mts → types-Bn8O-OEd.d.mts} +164 -11
  99. package/dist/{types-DZAflmmq.d.ts → types-Bn8O-OEd.d.ts} +164 -11
  100. package/dist/{types-6bNdxesb.d.ts → types-DnU2LhXR.d.mts} +7 -1
  101. package/dist/{types-6bNdxesb.d.mts → types-DnU2LhXR.d.ts} +7 -1
  102. package/dist/webhooks.d.mts +113 -17
  103. package/dist/webhooks.d.ts +113 -17
  104. package/dist/webhooks.js +179 -15
  105. package/dist/webhooks.mjs +7 -1
  106. package/dist/ws.d.mts +2 -2
  107. package/dist/ws.d.ts +2 -2
  108. package/dist/ws.js +80 -30
  109. package/dist/ws.mjs +4 -4
  110. package/docs/error-handling.md +101 -0
  111. package/docs/guides/effective-permissions.md +171 -0
  112. package/docs/guides/invitations.md +65 -0
  113. package/package.json +19 -4
  114. package/dist/chunk-6TDJJER7.mjs +0 -217
  115. package/dist/chunk-UKZLOHZG.mjs +0 -83
  116. package/dist/errors-CDdl24MP.d.mts +0 -52
  117. package/dist/errors-CDdl24MP.d.ts +0 -52
package/dist/index.mjs CHANGED
@@ -1,27 +1,38 @@
1
+ import {
2
+ expandPermissions,
3
+ hasPermission
4
+ } from "./chunk-GLXSIGVS.mjs";
1
5
  import {
2
6
  createProvisioningBridge
3
- } from "./chunk-SL3KRS4W.mjs";
7
+ } from "./chunk-CIJORODR.mjs";
4
8
  import {
5
9
  createTestIssuer
6
- } from "./chunk-MKKZULZR.mjs";
10
+ } from "./chunk-WIFG74IK.mjs";
7
11
  import {
12
+ IQAUTH_SIGNATURE_HEADER,
13
+ LEGACY_SIGNATURE_HEADERS,
8
14
  WebhookSignatureError,
9
15
  isValidWebhookSignature,
16
+ parseWebhookEvent,
10
17
  verifyWebhookSignature
11
- } from "./chunk-UKZLOHZG.mjs";
18
+ } from "./chunk-VYQ3ETCK.mjs";
12
19
  import {
13
20
  verifyWsUpgrade
14
- } from "./chunk-3JULWS6F.mjs";
21
+ } from "./chunk-WCELYTJ3.mjs";
15
22
  import {
16
23
  iqAuthMiddleware
17
- } from "./chunk-BVV54LPI.mjs";
24
+ } from "./chunk-25SSYDIP.mjs";
25
+ import {
26
+ buildUserinfoResponse,
27
+ handleUserinfo
28
+ } from "./chunk-WSH4SW7F.mjs";
18
29
  import {
19
30
  assertPublishableKey,
20
31
  encodePublishableKey,
21
32
  isPublishableKey,
22
33
  isSecretKey,
23
34
  parsePublishableKey
24
- } from "./chunk-WQWBJSSS.mjs";
35
+ } from "./chunk-HVHNYPDC.mjs";
25
36
  import {
26
37
  ApiKeysModule,
27
38
  AppsModule,
@@ -48,17 +59,18 @@ import {
48
59
  UsersModule,
49
60
  VendorsModule,
50
61
  WebhooksModule
51
- } from "./chunk-W3F4JYGP.mjs";
62
+ } from "./chunk-ZLJPABB7.mjs";
52
63
  import {
53
64
  DEFAULT_CLOCK_TOLERANCE_SECONDS,
54
65
  DEFAULT_TOKEN_AUDIENCE,
55
66
  DEFAULT_TOKEN_ISSUER,
56
67
  TokensModule
57
- } from "./chunk-UNYDG2L4.mjs";
68
+ } from "./chunk-NUO2I65G.mjs";
58
69
  import {
59
70
  ErrorCodes,
60
- IQAuthError
61
- } from "./chunk-6I6RM4MN.mjs";
71
+ IQAuthError,
72
+ IQ_AUTH_ERROR_CODES
73
+ } from "./chunk-6PJRLRB4.mjs";
62
74
  import "./chunk-Y6FXYEAI.mjs";
63
75
  export {
64
76
  ApiKeysModule,
@@ -73,10 +85,13 @@ export {
73
85
  ErrorCodes,
74
86
  GdprModule,
75
87
  HierarchyModule,
88
+ IQAUTH_SIGNATURE_HEADER,
76
89
  IQAuthClient,
77
90
  IQAuthError,
91
+ IQ_AUTH_ERROR_CODES,
78
92
  InMemoryOidcStateStore,
79
93
  InvitesModule,
94
+ LEGACY_SIGNATURE_HEADERS,
80
95
  MembershipsModule,
81
96
  MfaModule,
82
97
  OidcModule,
@@ -94,14 +109,19 @@ export {
94
109
  WebhookSignatureError,
95
110
  WebhooksModule,
96
111
  assertPublishableKey,
112
+ buildUserinfoResponse,
97
113
  createProvisioningBridge,
98
114
  createTestIssuer,
99
115
  encodePublishableKey,
116
+ expandPermissions,
117
+ handleUserinfo,
118
+ hasPermission,
100
119
  iqAuthMiddleware,
101
120
  isPublishableKey,
102
121
  isSecretKey,
103
122
  isValidWebhookSignature,
104
123
  parsePublishableKey,
124
+ parseWebhookEvent,
105
125
  verifyWebhookSignature,
106
126
  verifyWsUpgrade
107
127
  };
@@ -10,10 +10,10 @@ async function getCtx(flags) {
10
10
  const env = await loadEnv(flags.get("env-file") || ".env");
11
11
  const baseUrl = flags.get("base-url") || env.IQAUTH_ISSUER;
12
12
  const token = flags.get("token") || env.IQAUTH_ADMIN_TOKEN || env.IQAUTH_SECRET_KEY;
13
- const app = flags.get("app") || env.IQAUTH_APP_ID || env.IQAUTH_APP_KEY;
13
+ const app = flags.get("app") || env.IQAUTH_APP_ID;
14
14
  if (!baseUrl) throw new Error("Missing --base-url (or IQAUTH_ISSUER in env).");
15
15
  if (!token) throw new Error("Missing --token (or IQAUTH_ADMIN_TOKEN / IQAUTH_SECRET_KEY in env).");
16
- if (!app) throw new Error("Missing --app <appId|appKey> (or IQAUTH_APP_ID in env).");
16
+ if (!app) throw new Error("Missing --app <appId> (or IQAUTH_APP_ID in env). The `IQAUTH_APP_KEY` env-var fallback has been removed (Task #130) \u2014 pass --app explicitly.");
17
17
  return { baseUrl, token, app };
18
18
  }
19
19
  async function runKeys(argv) {
@@ -1,4 +1,4 @@
1
- import { I as IQAuthLocaleBundle, a as IQAuthLocaleOverride, b as IQAuthLocaleKey } from './types-6bNdxesb.mjs';
1
+ import { I as IQAuthLocaleBundle, b as IQAuthLocaleOverride, a as IQAuthLocaleKey } from './types-DnU2LhXR.mjs';
2
2
 
3
3
  declare const enUS: IQAuthLocaleBundle;
4
4
 
package/dist/locales.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { I as IQAuthLocaleBundle, a as IQAuthLocaleOverride, b as IQAuthLocaleKey } from './types-6bNdxesb.js';
1
+ import { I as IQAuthLocaleBundle, b as IQAuthLocaleOverride, a as IQAuthLocaleKey } from './types-DnU2LhXR.js';
2
2
 
3
3
  declare const enUS: IQAuthLocaleBundle;
4
4
 
package/dist/locales.js CHANGED
@@ -74,6 +74,7 @@ var enUS = {
74
74
  "signIn.useDifferentAccount": "Use a different account",
75
75
  "signIn.selectTenant": "Choose an organization",
76
76
  "signIn.selectTenantSubtitle": "You belong to multiple organizations. Pick one to continue.",
77
+ "signIn.selectScope": "Choose scope",
77
78
  "signIn.dividerOr": "or",
78
79
  "signIn.preparingExperience": "Preparing your sign-in experience.",
79
80
  "signIn.applicationUnavailable": "Application unavailable",
@@ -162,6 +163,11 @@ var enUS = {
162
163
  "orgSwitcher.createNew": "Create organization",
163
164
  "orgSwitcher.manage": "Manage organization",
164
165
  "orgSwitcher.noOrgs": "You don't belong to any organizations yet.",
166
+ "orgSwitcher.mfaRequiredTitle": "Two-factor verification required",
167
+ "orgSwitcher.mfaRequiredBody": "This organization requires an extra verification step. Continue in the hosted sign-in to finish switching.",
168
+ "orgSwitcher.scopeSelectionRequiredTitle": "Choose what to access",
169
+ "orgSwitcher.scopeSelectionRequiredBody": "This organization needs you to pick which workspace to open. Continue in the hosted sign-in to choose.",
170
+ "orgSwitcher.continueInHostedSignIn": "Continue in hosted sign-in \u2192",
165
171
  "orgProfile.title": "Organization settings",
166
172
  "orgProfile.generalTab": "General",
167
173
  "orgProfile.membersTab": "Members",
@@ -254,6 +260,7 @@ var frFR = {
254
260
  "signIn.useDifferentAccount": "Utiliser un autre compte",
255
261
  "signIn.selectTenant": "Choisir une organisation",
256
262
  "signIn.selectTenantSubtitle": "Vous appartenez \xE0 plusieurs organisations. Choisissez-en une pour continuer.",
263
+ "signIn.selectScope": "Choisir une port\xE9e",
257
264
  "signIn.dividerOr": "ou",
258
265
  "signIn.preparingExperience": "Pr\xE9paration de votre exp\xE9rience de connexion.",
259
266
  "signIn.applicationUnavailable": "Application indisponible",
@@ -342,6 +349,11 @@ var frFR = {
342
349
  "orgSwitcher.createNew": "Cr\xE9er une organisation",
343
350
  "orgSwitcher.manage": "G\xE9rer l'organisation",
344
351
  "orgSwitcher.noOrgs": "Vous n'appartenez encore \xE0 aucune organisation.",
352
+ "orgSwitcher.mfaRequiredTitle": "V\xE9rification en deux \xE9tapes requise",
353
+ "orgSwitcher.mfaRequiredBody": "Cette organisation n\xE9cessite une \xE9tape de v\xE9rification suppl\xE9mentaire. Poursuivez sur la page de connexion h\xE9berg\xE9e pour terminer le changement.",
354
+ "orgSwitcher.scopeSelectionRequiredTitle": "Choisir l'espace \xE0 ouvrir",
355
+ "orgSwitcher.scopeSelectionRequiredBody": "Cette organisation n\xE9cessite que vous choisissiez un espace de travail. Poursuivez sur la page de connexion h\xE9berg\xE9e pour choisir.",
356
+ "orgSwitcher.continueInHostedSignIn": "Continuer sur la connexion h\xE9berg\xE9e \u2192",
345
357
  "orgProfile.title": "Param\xE8tres de l'organisation",
346
358
  "orgProfile.generalTab": "G\xE9n\xE9ral",
347
359
  "orgProfile.membersTab": "Membres",
@@ -434,6 +446,7 @@ var esES = {
434
446
  "signIn.useDifferentAccount": "Usar otra cuenta",
435
447
  "signIn.selectTenant": "Elige una organizaci\xF3n",
436
448
  "signIn.selectTenantSubtitle": "Perteneces a varias organizaciones. Selecciona una para continuar.",
449
+ "signIn.selectScope": "Elegir \xE1mbito",
437
450
  "signIn.dividerOr": "o",
438
451
  "signIn.preparingExperience": "Preparando tu experiencia de inicio de sesi\xF3n.",
439
452
  "signIn.applicationUnavailable": "Aplicaci\xF3n no disponible",
@@ -522,6 +535,11 @@ var esES = {
522
535
  "orgSwitcher.createNew": "Crear organizaci\xF3n",
523
536
  "orgSwitcher.manage": "Gestionar organizaci\xF3n",
524
537
  "orgSwitcher.noOrgs": "A\xFAn no perteneces a ninguna organizaci\xF3n.",
538
+ "orgSwitcher.mfaRequiredTitle": "Se requiere verificaci\xF3n en dos pasos",
539
+ "orgSwitcher.mfaRequiredBody": "Esta organizaci\xF3n requiere un paso de verificaci\xF3n adicional. Contin\xFAa en el inicio de sesi\xF3n alojado para completar el cambio.",
540
+ "orgSwitcher.scopeSelectionRequiredTitle": "Elige a qu\xE9 acceder",
541
+ "orgSwitcher.scopeSelectionRequiredBody": "Esta organizaci\xF3n requiere que elijas un espacio de trabajo. Contin\xFAa en el inicio de sesi\xF3n alojado para elegir.",
542
+ "orgSwitcher.continueInHostedSignIn": "Continuar en el inicio de sesi\xF3n alojado \u2192",
525
543
  "orgProfile.title": "Configuraci\xF3n de la organizaci\xF3n",
526
544
  "orgProfile.generalTab": "Generales",
527
545
  "orgProfile.membersTab": "Miembros",
@@ -614,6 +632,7 @@ var deDE = {
614
632
  "signIn.useDifferentAccount": "Anderes Konto verwenden",
615
633
  "signIn.selectTenant": "Organisation ausw\xE4hlen",
616
634
  "signIn.selectTenantSubtitle": "Sie geh\xF6ren zu mehreren Organisationen. Bitte w\xE4hlen Sie eine aus.",
635
+ "signIn.selectScope": "Bereich ausw\xE4hlen",
617
636
  "signIn.preparingExperience": "Anmeldung wird vorbereitet.",
618
637
  "signIn.applicationUnavailable": "Anwendung nicht verf\xFCgbar",
619
638
  "signIn.applicationNotFound": "Anwendung nicht gefunden",
@@ -702,6 +721,11 @@ var deDE = {
702
721
  "orgSwitcher.createNew": "Organisation erstellen",
703
722
  "orgSwitcher.manage": "Organisation verwalten",
704
723
  "orgSwitcher.noOrgs": "Sie geh\xF6ren noch keiner Organisation an.",
724
+ "orgSwitcher.mfaRequiredTitle": "Zwei-Faktor-Verifizierung erforderlich",
725
+ "orgSwitcher.mfaRequiredBody": "Diese Organisation erfordert einen zus\xE4tzlichen Verifizierungsschritt. Fahren Sie in der gehosteten Anmeldung fort, um den Wechsel abzuschlie\xDFen.",
726
+ "orgSwitcher.scopeSelectionRequiredTitle": "Zugriff ausw\xE4hlen",
727
+ "orgSwitcher.scopeSelectionRequiredBody": "F\xFCr diese Organisation m\xFCssen Sie einen Arbeitsbereich ausw\xE4hlen. Fahren Sie in der gehosteten Anmeldung fort, um auszuw\xE4hlen.",
728
+ "orgSwitcher.continueInHostedSignIn": "In der gehosteten Anmeldung fortfahren \u2192",
705
729
  "orgProfile.title": "Organisationseinstellungen",
706
730
  "orgProfile.generalTab": "Allgemein",
707
731
  "orgProfile.membersTab": "Mitglieder",
@@ -794,6 +818,7 @@ var jaJP = {
794
818
  "signIn.useDifferentAccount": "\u5225\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4F7F\u7528",
795
819
  "signIn.selectTenant": "\u7D44\u7E54\u3092\u9078\u629E",
796
820
  "signIn.selectTenantSubtitle": "\u8907\u6570\u306E\u7D44\u7E54\u306B\u6240\u5C5E\u3057\u3066\u3044\u307E\u3059\u3002\u7D9A\u3051\u308B\u306B\u306F 1 \u3064\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
821
+ "signIn.selectScope": "\u30B9\u30B3\u30FC\u30D7\u3092\u9078\u629E",
797
822
  "signIn.preparingExperience": "\u30B5\u30A4\u30F3\u30A4\u30F3\u306E\u6E96\u5099\u3092\u3057\u3066\u3044\u307E\u3059\u3002",
798
823
  "signIn.applicationUnavailable": "\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u3092\u5229\u7528\u3067\u304D\u307E\u305B\u3093",
799
824
  "signIn.applicationNotFound": "\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
@@ -882,6 +907,11 @@ var jaJP = {
882
907
  "orgSwitcher.createNew": "\u7D44\u7E54\u3092\u4F5C\u6210",
883
908
  "orgSwitcher.manage": "\u7D44\u7E54\u3092\u7BA1\u7406",
884
909
  "orgSwitcher.noOrgs": "\u307E\u3060\u3069\u306E\u7D44\u7E54\u306B\u3082\u6240\u5C5E\u3057\u3066\u3044\u307E\u305B\u3093\u3002",
910
+ "orgSwitcher.mfaRequiredTitle": "\u4E8C\u6BB5\u968E\u8A8D\u8A3C\u304C\u5FC5\u8981\u3067\u3059",
911
+ "orgSwitcher.mfaRequiredBody": "\u3053\u306E\u7D44\u7E54\u3067\u306F\u8FFD\u52A0\u306E\u672C\u4EBA\u78BA\u8A8D\u304C\u5FC5\u8981\u3067\u3059\u3002\u30DB\u30B9\u30C8\u3055\u308C\u305F\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u7D9A\u3051\u3066\u5207\u308A\u66FF\u3048\u3092\u5B8C\u4E86\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
912
+ "orgSwitcher.scopeSelectionRequiredTitle": "\u30A2\u30AF\u30BB\u30B9\u5148\u3092\u9078\u629E",
913
+ "orgSwitcher.scopeSelectionRequiredBody": "\u3053\u306E\u7D44\u7E54\u3067\u306F\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306E\u9078\u629E\u304C\u5FC5\u8981\u3067\u3059\u3002\u30DB\u30B9\u30C8\u3055\u308C\u305F\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
914
+ "orgSwitcher.continueInHostedSignIn": "\u30DB\u30B9\u30C8\u3055\u308C\u305F\u30B5\u30A4\u30F3\u30A4\u30F3\u306B\u9032\u3080 \u2192",
885
915
  "orgProfile.title": "\u7D44\u7E54\u306E\u8A2D\u5B9A",
886
916
  "orgProfile.generalTab": "\u4E00\u822C",
887
917
  "orgProfile.membersTab": "\u30E1\u30F3\u30D0\u30FC",
@@ -974,6 +1004,7 @@ var ptBR = {
974
1004
  "signIn.useDifferentAccount": "Usar outra conta",
975
1005
  "signIn.selectTenant": "Escolher uma organiza\xE7\xE3o",
976
1006
  "signIn.selectTenantSubtitle": "Voc\xEA pertence a v\xE1rias organiza\xE7\xF5es. Escolha uma para continuar.",
1007
+ "signIn.selectScope": "Escolher escopo",
977
1008
  "signIn.preparingExperience": "Preparando sua experi\xEAncia de login.",
978
1009
  "signIn.applicationUnavailable": "Aplicativo indispon\xEDvel",
979
1010
  "signIn.applicationNotFound": "Aplicativo n\xE3o encontrado",
@@ -1061,6 +1092,11 @@ var ptBR = {
1061
1092
  "orgSwitcher.personal": "Conta pessoal",
1062
1093
  "orgSwitcher.createNew": "Criar organiza\xE7\xE3o",
1063
1094
  "orgSwitcher.manage": "Gerenciar organiza\xE7\xE3o",
1095
+ "orgSwitcher.mfaRequiredTitle": "Verifica\xE7\xE3o em duas etapas necess\xE1ria",
1096
+ "orgSwitcher.mfaRequiredBody": "Esta organiza\xE7\xE3o requer uma etapa de verifica\xE7\xE3o adicional. Continue no login hospedado para concluir a troca.",
1097
+ "orgSwitcher.scopeSelectionRequiredTitle": "Escolha o que acessar",
1098
+ "orgSwitcher.scopeSelectionRequiredBody": "Esta organiza\xE7\xE3o exige que voc\xEA escolha um espa\xE7o de trabalho. Continue no login hospedado para escolher.",
1099
+ "orgSwitcher.continueInHostedSignIn": "Continuar no login hospedado \u2192",
1064
1100
  "orgSwitcher.noOrgs": "Voc\xEA ainda n\xE3o pertence a nenhuma organiza\xE7\xE3o.",
1065
1101
  "orgProfile.title": "Configura\xE7\xF5es da organiza\xE7\xE3o",
1066
1102
  "orgProfile.generalTab": "Geral",
package/dist/locales.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  ptBR,
12
12
  resolveBundle,
13
13
  t
14
- } from "./chunk-5T7GHBX6.mjs";
14
+ } from "./chunk-TLET552H.mjs";
15
15
  import "./chunk-Y6FXYEAI.mjs";
16
16
  export {
17
17
  builtInLocales,
package/dist/mobile.d.mts CHANGED
@@ -1,11 +1,81 @@
1
- import { I as IQAuthClient } from './client-kYlJFgPv.mjs';
2
- import { b as IQAuthTokenClientConfig } from './types-DZAflmmq.mjs';
3
- export { E as ErrorCodes, I as IQAuthError } from './errors-CDdl24MP.mjs';
4
- import './tokens-DCyzzn8L.mjs';
1
+ import { I as IQAuthClient } from './client-D8L-PaWr.mjs';
2
+ import { f as IQAuthTokenClientConfig } from './types-Bn8O-OEd.mjs';
3
+ export { E as ErrorCodes, I as IQAuthError } from './errors-Jl1Jtm-6.mjs';
4
+ import './tokens-B06VtvUi.mjs';
5
5
 
6
+ /**
7
+ * Mobile client — wraps IQAuthClient with React Native / Expo–aware behavior.
8
+ *
9
+ * Notable mode: `autoRefresh: 'app-state'`
10
+ * The default per-request "expiring soon" proactive refresh fights with
11
+ * Expo / React Native's app-suspension lifecycle (the JS engine pauses in
12
+ * background, fetch in-flight when the OS suspends the app fails on resume,
13
+ * and the resulting cascade of refresh attempts can blow up with
14
+ * `Network request failed` rather than recovering cleanly).
15
+ *
16
+ * In `'app-state'` mode the SDK:
17
+ * - DISABLES the per-request proactive refresh.
18
+ * - KEEPS the reactive 401 retry on TOKEN_EXPIRED (one attempt).
19
+ * - SUBSCRIBES to `AppState.addEventListener('change', ...)` and triggers
20
+ * a refresh when the app transitions back to `'active'` from background
21
+ * or inactive — but only if a refresh token exists and the access token
22
+ * is within 5 minutes of expiry (or already expired).
23
+ *
24
+ * The AppState listener is started automatically when `'app-state'` mode is
25
+ * selected and react-native is resolvable. Call `client.stop()` to remove
26
+ * the subscription (e.g. in a unit test or on logout).
27
+ */
28
+
29
+ type AppStateStatus = "active" | "background" | "inactive" | string;
30
+ interface AppStateLike {
31
+ currentState: AppStateStatus;
32
+ addEventListener(type: "change", handler: (state: AppStateStatus) => void): {
33
+ remove: () => void;
34
+ } | (() => void) | void;
35
+ removeEventListener?: (type: "change", handler: (state: AppStateStatus) => void) => void;
36
+ }
37
+ interface MobileClientOptions extends IQAuthTokenClientConfig {
38
+ /**
39
+ * Override how AppState is resolved. Defaults to a runtime
40
+ * `require('react-native').AppState`. Tests inject a fake here.
41
+ */
42
+ appState?: AppStateLike | null;
43
+ /**
44
+ * Seconds-of-life-remaining threshold below which a foreground transition
45
+ * triggers a refresh. Default 300 (5 min).
46
+ */
47
+ appStateRefreshLeewaySeconds?: number;
48
+ /**
49
+ * Optional hook invoked when an AppState-triggered refresh fails. The
50
+ * default behavior is to swallow the error so the host app doesn't crash
51
+ * on a foreground tick — the next API call's reactive 401 path will
52
+ * surface the same error to the caller. Use this hook for telemetry.
53
+ */
54
+ onAppStateRefreshError?: (err: unknown) => void;
55
+ }
6
56
  declare class MobileIQAuthClient extends IQAuthClient {
7
- constructor(config: IQAuthTokenClientConfig);
57
+ private appStateSub;
58
+ private appStateMode;
59
+ private leewaySeconds;
60
+ private lastAppState;
61
+ private refreshing;
62
+ private onTokenRefreshCb?;
63
+ private onAppStateRefreshError?;
64
+ constructor(config: MobileClientOptions);
65
+ /** True iff the client is configured for AppState-driven refresh. */
66
+ get isAppStateMode(): boolean;
67
+ private startAppStateListener;
68
+ /**
69
+ * Public hook: call this from your own AppState handler if you've passed
70
+ * `appState: null` to opt out of the auto-subscription. Returns true if a
71
+ * refresh was attempted.
72
+ */
73
+ refreshIfStale(): Promise<boolean>;
74
+ private maybeRefreshOnForeground;
75
+ private isAccessTokenStale;
76
+ /** Remove the AppState subscription. Idempotent. */
77
+ stop(): void;
8
78
  }
9
- declare function createMobileClient(config: IQAuthTokenClientConfig): MobileIQAuthClient;
79
+ declare function createMobileClient(config: MobileClientOptions): MobileIQAuthClient;
10
80
 
11
- export { IQAuthClient, IQAuthTokenClientConfig, MobileIQAuthClient, createMobileClient };
81
+ export { IQAuthClient, IQAuthTokenClientConfig, type MobileClientOptions, MobileIQAuthClient, createMobileClient };
package/dist/mobile.d.ts CHANGED
@@ -1,11 +1,81 @@
1
- import { I as IQAuthClient } from './client-BNQe3AgF.js';
2
- import { b as IQAuthTokenClientConfig } from './types-DZAflmmq.js';
3
- export { E as ErrorCodes, I as IQAuthError } from './errors-CDdl24MP.js';
4
- import './tokens-aHiGFr_E.js';
1
+ import { I as IQAuthClient } from './client-DkPL0EPZ.js';
2
+ import { f as IQAuthTokenClientConfig } from './types-Bn8O-OEd.js';
3
+ export { E as ErrorCodes, I as IQAuthError } from './errors-Jl1Jtm-6.js';
4
+ import './tokens-9F6ETrzk.js';
5
5
 
6
+ /**
7
+ * Mobile client — wraps IQAuthClient with React Native / Expo–aware behavior.
8
+ *
9
+ * Notable mode: `autoRefresh: 'app-state'`
10
+ * The default per-request "expiring soon" proactive refresh fights with
11
+ * Expo / React Native's app-suspension lifecycle (the JS engine pauses in
12
+ * background, fetch in-flight when the OS suspends the app fails on resume,
13
+ * and the resulting cascade of refresh attempts can blow up with
14
+ * `Network request failed` rather than recovering cleanly).
15
+ *
16
+ * In `'app-state'` mode the SDK:
17
+ * - DISABLES the per-request proactive refresh.
18
+ * - KEEPS the reactive 401 retry on TOKEN_EXPIRED (one attempt).
19
+ * - SUBSCRIBES to `AppState.addEventListener('change', ...)` and triggers
20
+ * a refresh when the app transitions back to `'active'` from background
21
+ * or inactive — but only if a refresh token exists and the access token
22
+ * is within 5 minutes of expiry (or already expired).
23
+ *
24
+ * The AppState listener is started automatically when `'app-state'` mode is
25
+ * selected and react-native is resolvable. Call `client.stop()` to remove
26
+ * the subscription (e.g. in a unit test or on logout).
27
+ */
28
+
29
+ type AppStateStatus = "active" | "background" | "inactive" | string;
30
+ interface AppStateLike {
31
+ currentState: AppStateStatus;
32
+ addEventListener(type: "change", handler: (state: AppStateStatus) => void): {
33
+ remove: () => void;
34
+ } | (() => void) | void;
35
+ removeEventListener?: (type: "change", handler: (state: AppStateStatus) => void) => void;
36
+ }
37
+ interface MobileClientOptions extends IQAuthTokenClientConfig {
38
+ /**
39
+ * Override how AppState is resolved. Defaults to a runtime
40
+ * `require('react-native').AppState`. Tests inject a fake here.
41
+ */
42
+ appState?: AppStateLike | null;
43
+ /**
44
+ * Seconds-of-life-remaining threshold below which a foreground transition
45
+ * triggers a refresh. Default 300 (5 min).
46
+ */
47
+ appStateRefreshLeewaySeconds?: number;
48
+ /**
49
+ * Optional hook invoked when an AppState-triggered refresh fails. The
50
+ * default behavior is to swallow the error so the host app doesn't crash
51
+ * on a foreground tick — the next API call's reactive 401 path will
52
+ * surface the same error to the caller. Use this hook for telemetry.
53
+ */
54
+ onAppStateRefreshError?: (err: unknown) => void;
55
+ }
6
56
  declare class MobileIQAuthClient extends IQAuthClient {
7
- constructor(config: IQAuthTokenClientConfig);
57
+ private appStateSub;
58
+ private appStateMode;
59
+ private leewaySeconds;
60
+ private lastAppState;
61
+ private refreshing;
62
+ private onTokenRefreshCb?;
63
+ private onAppStateRefreshError?;
64
+ constructor(config: MobileClientOptions);
65
+ /** True iff the client is configured for AppState-driven refresh. */
66
+ get isAppStateMode(): boolean;
67
+ private startAppStateListener;
68
+ /**
69
+ * Public hook: call this from your own AppState handler if you've passed
70
+ * `appState: null` to opt out of the auto-subscription. Returns true if a
71
+ * refresh was attempted.
72
+ */
73
+ refreshIfStale(): Promise<boolean>;
74
+ private maybeRefreshOnForeground;
75
+ private isAccessTokenStale;
76
+ /** Remove the AppState subscription. Idempotent. */
77
+ stop(): void;
8
78
  }
9
- declare function createMobileClient(config: IQAuthTokenClientConfig): MobileIQAuthClient;
79
+ declare function createMobileClient(config: MobileClientOptions): MobileIQAuthClient;
10
80
 
11
- export { IQAuthClient, IQAuthTokenClientConfig, MobileIQAuthClient, createMobileClient };
81
+ export { IQAuthClient, IQAuthTokenClientConfig, type MobileClientOptions, MobileIQAuthClient, createMobileClient };