@feelflow/ffid-sdk 1.10.0 → 1.13.0

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.
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkOAPA5VKR_cjs = require('../chunk-OAPA5VKR.cjs');
3
+ var chunk7YV3SUEY_cjs = require('../chunk-7YV3SUEY.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunkOAPA5VKR_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunk7YV3SUEY_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunkOAPA5VKR_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunk7YV3SUEY_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDLoginButton", {
16
16
  enumerable: true,
17
- get: function () { return chunkOAPA5VKR_cjs.FFIDLoginButton; }
17
+ get: function () { return chunk7YV3SUEY_cjs.FFIDLoginButton; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
20
20
  enumerable: true,
21
- get: function () { return chunkOAPA5VKR_cjs.FFIDOrganizationSwitcher; }
21
+ get: function () { return chunk7YV3SUEY_cjs.FFIDOrganizationSwitcher; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
24
24
  enumerable: true,
25
- get: function () { return chunkOAPA5VKR_cjs.FFIDSubscriptionBadge; }
25
+ get: function () { return chunk7YV3SUEY_cjs.FFIDSubscriptionBadge; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDUserMenu", {
28
28
  enumerable: true,
29
- get: function () { return chunkOAPA5VKR_cjs.FFIDUserMenu; }
29
+ get: function () { return chunk7YV3SUEY_cjs.FFIDUserMenu; }
30
30
  });
@@ -1,3 +1,3 @@
1
- export { v as FFIDAnnouncementBadge, S as FFIDAnnouncementBadgeClassNames, T as FFIDAnnouncementBadgeProps, w as FFIDAnnouncementList, V as FFIDAnnouncementListClassNames, W as FFIDAnnouncementListProps, E as FFIDLoginButton, X as FFIDLoginButtonProps, J as FFIDOrganizationSwitcher, Y as FFIDOrganizationSwitcherClassNames, Z as FFIDOrganizationSwitcherProps, M as FFIDSubscriptionBadge, _ as FFIDSubscriptionBadgeClassNames, $ as FFIDSubscriptionBadgeProps, P as FFIDUserMenu, a0 as FFIDUserMenuClassNames, a1 as FFIDUserMenuProps } from '../index-DsXjcF0i.cjs';
1
+ export { y as FFIDAnnouncementBadge, W as FFIDAnnouncementBadgeClassNames, X as FFIDAnnouncementBadgeProps, z as FFIDAnnouncementList, Y as FFIDAnnouncementListClassNames, Z as FFIDAnnouncementListProps, I as FFIDLoginButton, _ as FFIDLoginButtonProps, N as FFIDOrganizationSwitcher, $ as FFIDOrganizationSwitcherClassNames, a0 as FFIDOrganizationSwitcherProps, P as FFIDSubscriptionBadge, a1 as FFIDSubscriptionBadgeClassNames, a2 as FFIDSubscriptionBadgeProps, S as FFIDUserMenu, a3 as FFIDUserMenuClassNames, a4 as FFIDUserMenuProps } from '../index-GrAWBpmf.cjs';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
- export { v as FFIDAnnouncementBadge, S as FFIDAnnouncementBadgeClassNames, T as FFIDAnnouncementBadgeProps, w as FFIDAnnouncementList, V as FFIDAnnouncementListClassNames, W as FFIDAnnouncementListProps, E as FFIDLoginButton, X as FFIDLoginButtonProps, J as FFIDOrganizationSwitcher, Y as FFIDOrganizationSwitcherClassNames, Z as FFIDOrganizationSwitcherProps, M as FFIDSubscriptionBadge, _ as FFIDSubscriptionBadgeClassNames, $ as FFIDSubscriptionBadgeProps, P as FFIDUserMenu, a0 as FFIDUserMenuClassNames, a1 as FFIDUserMenuProps } from '../index-DsXjcF0i.js';
1
+ export { y as FFIDAnnouncementBadge, W as FFIDAnnouncementBadgeClassNames, X as FFIDAnnouncementBadgeProps, z as FFIDAnnouncementList, Y as FFIDAnnouncementListClassNames, Z as FFIDAnnouncementListProps, I as FFIDLoginButton, _ as FFIDLoginButtonProps, N as FFIDOrganizationSwitcher, $ as FFIDOrganizationSwitcherClassNames, a0 as FFIDOrganizationSwitcherProps, P as FFIDSubscriptionBadge, a1 as FFIDSubscriptionBadgeClassNames, a2 as FFIDSubscriptionBadgeProps, S as FFIDUserMenu, a3 as FFIDUserMenuClassNames, a4 as FFIDUserMenuProps } from '../index-GrAWBpmf.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-PSSNMEJB.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-KFOIVZEY.js';
@@ -28,6 +28,8 @@ interface FFIDCacheConfig {
28
28
  * Core types for the FeelFlow ID SDK
29
29
  */
30
30
 
31
+ /** Authentication mode for FFID client */
32
+ type FFIDAuthMode = 'cookie' | 'token' | 'service-key';
31
33
  /**
32
34
  * User information from FFID
33
35
  */
@@ -130,6 +132,17 @@ interface FFIDOAuthUserInfo {
130
132
  organizationId?: string | null | undefined;
131
133
  subscription?: FFIDOAuthUserInfoSubscription | undefined;
132
134
  }
135
+ /** Options for verifyAccessToken */
136
+ interface FFIDVerifyAccessTokenOptions {
137
+ /**
138
+ * When true, fetches profile info (email, name, picture) via introspect API
139
+ * after local JWT verification. No effect when verifyStrategy is 'introspect'
140
+ * (profile is always included).
141
+ * Requires {@link FFIDConfig.serviceApiKey} to be configured when using jwt strategy.
142
+ * @default false
143
+ */
144
+ includeProfile?: boolean;
145
+ }
133
146
  /**
134
147
  * SDK configuration options
135
148
  */
@@ -157,7 +170,7 @@ interface FFIDConfig {
157
170
  /** Callback on authentication error */
158
171
  onError?: ((error: FFIDError) => void) | undefined;
159
172
  /** Authentication mode: 'cookie' (default), 'token' (OAuth Bearer), or 'service-key' (server-to-server) */
160
- authMode?: 'cookie' | 'token' | 'service-key' | undefined;
173
+ authMode?: FFIDAuthMode | undefined;
161
174
  /** Client ID for token mode (defaults to serviceCode if not set) */
162
175
  clientId?: string | undefined;
163
176
  /** Custom redirect URI for OAuth flow (defaults to window.location.origin + window.location.pathname) */
@@ -169,14 +182,16 @@ interface FFIDConfig {
169
182
  * - 'jwt': Local JWT verification via JWKS (default, lower latency)
170
183
  * - 'introspect': Remote introspection via /api/v1/oauth/introspect
171
184
  *
172
- * JWT verification returns limited claims (no email/name/picture/subscription).
173
- * Use 'introspect' if you need full user profile data.
185
+ * JWT verification returns limited claims (no email/name/picture/subscription) by default.
186
+ * Use 'introspect' if you always need full user profile data, or pass
187
+ * { includeProfile: true } to verifyAccessToken() for on-demand profile fetching.
174
188
  */
175
189
  verifyStrategy?: 'jwt' | 'introspect' | undefined;
176
190
  /**
177
191
  * Cache configuration for token verification results.
178
192
  * When set, introspect/userinfo responses are cached to reduce API calls.
179
- * Only effective in service-key mode with verifyStrategy: 'introspect'.
193
+ * Effective in service-key mode with verifyStrategy: 'introspect',
194
+ * or with verifyStrategy: 'jwt' when includeProfile: true is used.
180
195
  */
181
196
  cache?: FFIDCacheConfig | undefined;
182
197
  /**
@@ -360,6 +375,18 @@ interface FFIDCreatePortalParams {
360
375
  /** URL to redirect when user exits the portal */
361
376
  returnUrl: string;
362
377
  }
378
+ /**
379
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize)
380
+ *
381
+ * Structured return type so callers can inspect failure reasons
382
+ * instead of receiving a bare `false`.
383
+ */
384
+ type FFIDRedirectResult = {
385
+ success: true;
386
+ } | {
387
+ success: false;
388
+ error: string;
389
+ };
363
390
  /**
364
391
  * OAuth 2.0 token response from FFID token endpoint
365
392
  */
@@ -761,4 +788,4 @@ interface FFIDAnnouncementListProps {
761
788
  */
762
789
  declare function FFIDAnnouncementList({ announcements, isLoading, className, classNames, style, formatDate, emptyMessage, loadingRender, renderItem, maxContentLines, }: FFIDAnnouncementListProps): react_jsx_runtime.JSX.Element;
763
790
 
764
- export { type FFIDSubscriptionBadgeProps as $, type AnnouncementListResponse as A, type FFIDCacheConfig as B, type FFIDContextValue as C, type FFIDJwtClaims as D, FFIDLoginButton as E, type FFIDConfig as F, type FFIDOAuthTokenResponse as G, type FFIDOAuthUserInfoMemberRole as H, type FFIDOAuthUserInfoSubscription as I, FFIDOrganizationSwitcher as J, type FFIDSeatModel as K, type ListAnnouncementsOptions as L, FFIDSubscriptionBadge as M, type FFIDSubscriptionStatus as N, type FFIDTokenIntrospectionResponse as O, FFIDUserMenu as P, type UseFFIDAnnouncementsReturn as Q, useFFIDAnnouncements as R, type FFIDAnnouncementBadgeClassNames as S, type FFIDAnnouncementBadgeProps as T, type UseFFIDAnnouncementsOptions as U, type FFIDAnnouncementListClassNames as V, type FFIDAnnouncementListProps as W, type FFIDLoginButtonProps as X, type FFIDOrganizationSwitcherClassNames as Y, type FFIDOrganizationSwitcherProps as Z, type FFIDSubscriptionBadgeClassNames as _, type FFIDApiResponse as a, type FFIDUserMenuClassNames as a0, type FFIDUserMenuProps as a1, type FFIDSessionResponse as b, type FFIDError as c, type FFIDSubscriptionCheckResponse as d, type FFIDCreateCheckoutParams as e, type FFIDCheckoutSessionResponse as f, type FFIDCreatePortalParams as g, type FFIDPortalSessionResponse as h, type FFIDOAuthUserInfo as i, type FFIDLogger as j, type FFIDCacheAdapter as k, type FFIDUser as l, type FFIDOrganization as m, type FFIDSubscription as n, type FFIDSubscriptionContextValue as o, type FFIDAnnouncementsClientConfig as p, type FFIDAnnouncementsApiResponse as q, type FFIDAnnouncementsLogger as r, type Announcement as s, type AnnouncementStatus as t, type AnnouncementType as u, FFIDAnnouncementBadge as v, FFIDAnnouncementList as w, type FFIDAnnouncementsError as x, type FFIDAnnouncementsErrorCode as y, type FFIDAnnouncementsServerResponse as z };
791
+ export { type FFIDOrganizationSwitcherClassNames as $, type AnnouncementListResponse as A, type FFIDAnnouncementsError as B, type FFIDAnnouncementsErrorCode as C, type FFIDAnnouncementsServerResponse as D, type FFIDCacheConfig as E, type FFIDConfig as F, type FFIDContextValue as G, type FFIDJwtClaims as H, FFIDLoginButton as I, type FFIDOAuthTokenResponse as J, type FFIDOAuthUserInfoMemberRole as K, type ListAnnouncementsOptions as L, type FFIDOAuthUserInfoSubscription as M, FFIDOrganizationSwitcher as N, type FFIDSeatModel as O, FFIDSubscriptionBadge as P, type FFIDSubscriptionStatus as Q, type FFIDTokenIntrospectionResponse as R, FFIDUserMenu as S, type UseFFIDAnnouncementsReturn as T, type UseFFIDAnnouncementsOptions as U, useFFIDAnnouncements as V, type FFIDAnnouncementBadgeClassNames as W, type FFIDAnnouncementBadgeProps as X, type FFIDAnnouncementListClassNames as Y, type FFIDAnnouncementListProps as Z, type FFIDLoginButtonProps as _, type FFIDApiResponse as a, type FFIDOrganizationSwitcherProps as a0, type FFIDSubscriptionBadgeClassNames as a1, type FFIDSubscriptionBadgeProps as a2, type FFIDUserMenuClassNames as a3, type FFIDUserMenuProps as a4, type FFIDSessionResponse as b, type FFIDRedirectResult as c, type FFIDError as d, type FFIDSubscriptionCheckResponse as e, type FFIDCreateCheckoutParams as f, type FFIDCheckoutSessionResponse as g, type FFIDCreatePortalParams as h, type FFIDPortalSessionResponse as i, type FFIDVerifyAccessTokenOptions as j, type FFIDOAuthUserInfo as k, type FFIDAuthMode as l, type FFIDLogger as m, type FFIDCacheAdapter as n, type FFIDUser as o, type FFIDOrganization as p, type FFIDSubscription as q, type FFIDSubscriptionContextValue as r, type FFIDAnnouncementsClientConfig as s, type FFIDAnnouncementsApiResponse as t, type FFIDAnnouncementsLogger as u, type Announcement as v, type AnnouncementStatus as w, type AnnouncementType as x, FFIDAnnouncementBadge as y, FFIDAnnouncementList as z };
@@ -28,6 +28,8 @@ interface FFIDCacheConfig {
28
28
  * Core types for the FeelFlow ID SDK
29
29
  */
30
30
 
31
+ /** Authentication mode for FFID client */
32
+ type FFIDAuthMode = 'cookie' | 'token' | 'service-key';
31
33
  /**
32
34
  * User information from FFID
33
35
  */
@@ -130,6 +132,17 @@ interface FFIDOAuthUserInfo {
130
132
  organizationId?: string | null | undefined;
131
133
  subscription?: FFIDOAuthUserInfoSubscription | undefined;
132
134
  }
135
+ /** Options for verifyAccessToken */
136
+ interface FFIDVerifyAccessTokenOptions {
137
+ /**
138
+ * When true, fetches profile info (email, name, picture) via introspect API
139
+ * after local JWT verification. No effect when verifyStrategy is 'introspect'
140
+ * (profile is always included).
141
+ * Requires {@link FFIDConfig.serviceApiKey} to be configured when using jwt strategy.
142
+ * @default false
143
+ */
144
+ includeProfile?: boolean;
145
+ }
133
146
  /**
134
147
  * SDK configuration options
135
148
  */
@@ -157,7 +170,7 @@ interface FFIDConfig {
157
170
  /** Callback on authentication error */
158
171
  onError?: ((error: FFIDError) => void) | undefined;
159
172
  /** Authentication mode: 'cookie' (default), 'token' (OAuth Bearer), or 'service-key' (server-to-server) */
160
- authMode?: 'cookie' | 'token' | 'service-key' | undefined;
173
+ authMode?: FFIDAuthMode | undefined;
161
174
  /** Client ID for token mode (defaults to serviceCode if not set) */
162
175
  clientId?: string | undefined;
163
176
  /** Custom redirect URI for OAuth flow (defaults to window.location.origin + window.location.pathname) */
@@ -169,14 +182,16 @@ interface FFIDConfig {
169
182
  * - 'jwt': Local JWT verification via JWKS (default, lower latency)
170
183
  * - 'introspect': Remote introspection via /api/v1/oauth/introspect
171
184
  *
172
- * JWT verification returns limited claims (no email/name/picture/subscription).
173
- * Use 'introspect' if you need full user profile data.
185
+ * JWT verification returns limited claims (no email/name/picture/subscription) by default.
186
+ * Use 'introspect' if you always need full user profile data, or pass
187
+ * { includeProfile: true } to verifyAccessToken() for on-demand profile fetching.
174
188
  */
175
189
  verifyStrategy?: 'jwt' | 'introspect' | undefined;
176
190
  /**
177
191
  * Cache configuration for token verification results.
178
192
  * When set, introspect/userinfo responses are cached to reduce API calls.
179
- * Only effective in service-key mode with verifyStrategy: 'introspect'.
193
+ * Effective in service-key mode with verifyStrategy: 'introspect',
194
+ * or with verifyStrategy: 'jwt' when includeProfile: true is used.
180
195
  */
181
196
  cache?: FFIDCacheConfig | undefined;
182
197
  /**
@@ -360,6 +375,18 @@ interface FFIDCreatePortalParams {
360
375
  /** URL to redirect when user exits the portal */
361
376
  returnUrl: string;
362
377
  }
378
+ /**
379
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize)
380
+ *
381
+ * Structured return type so callers can inspect failure reasons
382
+ * instead of receiving a bare `false`.
383
+ */
384
+ type FFIDRedirectResult = {
385
+ success: true;
386
+ } | {
387
+ success: false;
388
+ error: string;
389
+ };
363
390
  /**
364
391
  * OAuth 2.0 token response from FFID token endpoint
365
392
  */
@@ -761,4 +788,4 @@ interface FFIDAnnouncementListProps {
761
788
  */
762
789
  declare function FFIDAnnouncementList({ announcements, isLoading, className, classNames, style, formatDate, emptyMessage, loadingRender, renderItem, maxContentLines, }: FFIDAnnouncementListProps): react_jsx_runtime.JSX.Element;
763
790
 
764
- export { type FFIDSubscriptionBadgeProps as $, type AnnouncementListResponse as A, type FFIDCacheConfig as B, type FFIDContextValue as C, type FFIDJwtClaims as D, FFIDLoginButton as E, type FFIDConfig as F, type FFIDOAuthTokenResponse as G, type FFIDOAuthUserInfoMemberRole as H, type FFIDOAuthUserInfoSubscription as I, FFIDOrganizationSwitcher as J, type FFIDSeatModel as K, type ListAnnouncementsOptions as L, FFIDSubscriptionBadge as M, type FFIDSubscriptionStatus as N, type FFIDTokenIntrospectionResponse as O, FFIDUserMenu as P, type UseFFIDAnnouncementsReturn as Q, useFFIDAnnouncements as R, type FFIDAnnouncementBadgeClassNames as S, type FFIDAnnouncementBadgeProps as T, type UseFFIDAnnouncementsOptions as U, type FFIDAnnouncementListClassNames as V, type FFIDAnnouncementListProps as W, type FFIDLoginButtonProps as X, type FFIDOrganizationSwitcherClassNames as Y, type FFIDOrganizationSwitcherProps as Z, type FFIDSubscriptionBadgeClassNames as _, type FFIDApiResponse as a, type FFIDUserMenuClassNames as a0, type FFIDUserMenuProps as a1, type FFIDSessionResponse as b, type FFIDError as c, type FFIDSubscriptionCheckResponse as d, type FFIDCreateCheckoutParams as e, type FFIDCheckoutSessionResponse as f, type FFIDCreatePortalParams as g, type FFIDPortalSessionResponse as h, type FFIDOAuthUserInfo as i, type FFIDLogger as j, type FFIDCacheAdapter as k, type FFIDUser as l, type FFIDOrganization as m, type FFIDSubscription as n, type FFIDSubscriptionContextValue as o, type FFIDAnnouncementsClientConfig as p, type FFIDAnnouncementsApiResponse as q, type FFIDAnnouncementsLogger as r, type Announcement as s, type AnnouncementStatus as t, type AnnouncementType as u, FFIDAnnouncementBadge as v, FFIDAnnouncementList as w, type FFIDAnnouncementsError as x, type FFIDAnnouncementsErrorCode as y, type FFIDAnnouncementsServerResponse as z };
791
+ export { type FFIDOrganizationSwitcherClassNames as $, type AnnouncementListResponse as A, type FFIDAnnouncementsError as B, type FFIDAnnouncementsErrorCode as C, type FFIDAnnouncementsServerResponse as D, type FFIDCacheConfig as E, type FFIDConfig as F, type FFIDContextValue as G, type FFIDJwtClaims as H, FFIDLoginButton as I, type FFIDOAuthTokenResponse as J, type FFIDOAuthUserInfoMemberRole as K, type ListAnnouncementsOptions as L, type FFIDOAuthUserInfoSubscription as M, FFIDOrganizationSwitcher as N, type FFIDSeatModel as O, FFIDSubscriptionBadge as P, type FFIDSubscriptionStatus as Q, type FFIDTokenIntrospectionResponse as R, FFIDUserMenu as S, type UseFFIDAnnouncementsReturn as T, type UseFFIDAnnouncementsOptions as U, useFFIDAnnouncements as V, type FFIDAnnouncementBadgeClassNames as W, type FFIDAnnouncementBadgeProps as X, type FFIDAnnouncementListClassNames as Y, type FFIDAnnouncementListProps as Z, type FFIDLoginButtonProps as _, type FFIDApiResponse as a, type FFIDOrganizationSwitcherProps as a0, type FFIDSubscriptionBadgeClassNames as a1, type FFIDSubscriptionBadgeProps as a2, type FFIDUserMenuClassNames as a3, type FFIDUserMenuProps as a4, type FFIDSessionResponse as b, type FFIDRedirectResult as c, type FFIDError as d, type FFIDSubscriptionCheckResponse as e, type FFIDCreateCheckoutParams as f, type FFIDCheckoutSessionResponse as g, type FFIDCreatePortalParams as h, type FFIDPortalSessionResponse as i, type FFIDVerifyAccessTokenOptions as j, type FFIDOAuthUserInfo as k, type FFIDAuthMode as l, type FFIDLogger as m, type FFIDCacheAdapter as n, type FFIDUser as o, type FFIDOrganization as p, type FFIDSubscription as q, type FFIDSubscriptionContextValue as r, type FFIDAnnouncementsClientConfig as s, type FFIDAnnouncementsApiResponse as t, type FFIDAnnouncementsLogger as u, type Announcement as v, type AnnouncementStatus as w, type AnnouncementType as x, FFIDAnnouncementBadge as y, FFIDAnnouncementList as z };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkOAPA5VKR_cjs = require('./chunk-OAPA5VKR.cjs');
3
+ var chunk7YV3SUEY_cjs = require('./chunk-7YV3SUEY.cjs');
4
4
  var react = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
@@ -46,7 +46,7 @@ function createKVCacheAdapter(kv) {
46
46
  }
47
47
  function withFFIDAuth(Component, options = {}) {
48
48
  const WrappedComponent = (props) => {
49
- const { isLoading, isAuthenticated, login } = chunkOAPA5VKR_cjs.useFFIDContext();
49
+ const { isLoading, isAuthenticated, login } = chunk7YV3SUEY_cjs.useFFIDContext();
50
50
  const hasRedirected = react.useRef(false);
51
51
  react.useEffect(() => {
52
52
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -71,83 +71,83 @@ function withFFIDAuth(Component, options = {}) {
71
71
 
72
72
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
73
73
  enumerable: true,
74
- get: function () { return chunkOAPA5VKR_cjs.DEFAULT_API_BASE_URL; }
74
+ get: function () { return chunk7YV3SUEY_cjs.DEFAULT_API_BASE_URL; }
75
75
  });
76
76
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
77
77
  enumerable: true,
78
- get: function () { return chunkOAPA5VKR_cjs.FFIDAnnouncementBadge; }
78
+ get: function () { return chunk7YV3SUEY_cjs.FFIDAnnouncementBadge; }
79
79
  });
80
80
  Object.defineProperty(exports, "FFIDAnnouncementList", {
81
81
  enumerable: true,
82
- get: function () { return chunkOAPA5VKR_cjs.FFIDAnnouncementList; }
82
+ get: function () { return chunk7YV3SUEY_cjs.FFIDAnnouncementList; }
83
83
  });
84
84
  Object.defineProperty(exports, "FFIDLoginButton", {
85
85
  enumerable: true,
86
- get: function () { return chunkOAPA5VKR_cjs.FFIDLoginButton; }
86
+ get: function () { return chunk7YV3SUEY_cjs.FFIDLoginButton; }
87
87
  });
88
88
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
89
89
  enumerable: true,
90
- get: function () { return chunkOAPA5VKR_cjs.FFIDOrganizationSwitcher; }
90
+ get: function () { return chunk7YV3SUEY_cjs.FFIDOrganizationSwitcher; }
91
91
  });
92
92
  Object.defineProperty(exports, "FFIDProvider", {
93
93
  enumerable: true,
94
- get: function () { return chunkOAPA5VKR_cjs.FFIDProvider; }
94
+ get: function () { return chunk7YV3SUEY_cjs.FFIDProvider; }
95
95
  });
96
96
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
97
97
  enumerable: true,
98
- get: function () { return chunkOAPA5VKR_cjs.FFIDSubscriptionBadge; }
98
+ get: function () { return chunk7YV3SUEY_cjs.FFIDSubscriptionBadge; }
99
99
  });
100
100
  Object.defineProperty(exports, "FFIDUserMenu", {
101
101
  enumerable: true,
102
- get: function () { return chunkOAPA5VKR_cjs.FFIDUserMenu; }
102
+ get: function () { return chunk7YV3SUEY_cjs.FFIDUserMenu; }
103
103
  });
104
104
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
105
105
  enumerable: true,
106
- get: function () { return chunkOAPA5VKR_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
106
+ get: function () { return chunk7YV3SUEY_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
107
107
  });
108
108
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
109
109
  enumerable: true,
110
- get: function () { return chunkOAPA5VKR_cjs.createFFIDAnnouncementsClient; }
110
+ get: function () { return chunk7YV3SUEY_cjs.createFFIDAnnouncementsClient; }
111
111
  });
112
112
  Object.defineProperty(exports, "createFFIDClient", {
113
113
  enumerable: true,
114
- get: function () { return chunkOAPA5VKR_cjs.createFFIDClient; }
114
+ get: function () { return chunk7YV3SUEY_cjs.createFFIDClient; }
115
115
  });
116
116
  Object.defineProperty(exports, "createTokenStore", {
117
117
  enumerable: true,
118
- get: function () { return chunkOAPA5VKR_cjs.createTokenStore; }
118
+ get: function () { return chunk7YV3SUEY_cjs.createTokenStore; }
119
119
  });
120
120
  Object.defineProperty(exports, "generateCodeChallenge", {
121
121
  enumerable: true,
122
- get: function () { return chunkOAPA5VKR_cjs.generateCodeChallenge; }
122
+ get: function () { return chunk7YV3SUEY_cjs.generateCodeChallenge; }
123
123
  });
124
124
  Object.defineProperty(exports, "generateCodeVerifier", {
125
125
  enumerable: true,
126
- get: function () { return chunkOAPA5VKR_cjs.generateCodeVerifier; }
126
+ get: function () { return chunk7YV3SUEY_cjs.generateCodeVerifier; }
127
127
  });
128
128
  Object.defineProperty(exports, "retrieveCodeVerifier", {
129
129
  enumerable: true,
130
- get: function () { return chunkOAPA5VKR_cjs.retrieveCodeVerifier; }
130
+ get: function () { return chunk7YV3SUEY_cjs.retrieveCodeVerifier; }
131
131
  });
132
132
  Object.defineProperty(exports, "storeCodeVerifier", {
133
133
  enumerable: true,
134
- get: function () { return chunkOAPA5VKR_cjs.storeCodeVerifier; }
134
+ get: function () { return chunk7YV3SUEY_cjs.storeCodeVerifier; }
135
135
  });
136
136
  Object.defineProperty(exports, "useFFID", {
137
137
  enumerable: true,
138
- get: function () { return chunkOAPA5VKR_cjs.useFFID; }
138
+ get: function () { return chunk7YV3SUEY_cjs.useFFID; }
139
139
  });
140
140
  Object.defineProperty(exports, "useFFIDAnnouncements", {
141
141
  enumerable: true,
142
- get: function () { return chunkOAPA5VKR_cjs.useFFIDAnnouncements; }
142
+ get: function () { return chunk7YV3SUEY_cjs.useFFIDAnnouncements; }
143
143
  });
144
144
  Object.defineProperty(exports, "useSubscription", {
145
145
  enumerable: true,
146
- get: function () { return chunkOAPA5VKR_cjs.useSubscription; }
146
+ get: function () { return chunk7YV3SUEY_cjs.useSubscription; }
147
147
  });
148
148
  Object.defineProperty(exports, "withSubscription", {
149
149
  enumerable: true,
150
- get: function () { return chunkOAPA5VKR_cjs.withSubscription; }
150
+ get: function () { return chunk7YV3SUEY_cjs.withSubscription; }
151
151
  });
152
152
  exports.createKVCacheAdapter = createKVCacheAdapter;
153
153
  exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDError, d as FFIDSubscriptionCheckResponse, e as FFIDCreateCheckoutParams, f as FFIDCheckoutSessionResponse, g as FFIDCreatePortalParams, h as FFIDPortalSessionResponse, i as FFIDOAuthUserInfo, j as FFIDLogger, k as FFIDCacheAdapter, l as FFIDUser, m as FFIDOrganization, n as FFIDSubscription, o as FFIDSubscriptionContextValue, p as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, q as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, r as FFIDAnnouncementsLogger } from './index-DsXjcF0i.cjs';
2
- export { s as Announcement, t as AnnouncementStatus, u as AnnouncementType, v as FFIDAnnouncementBadge, w as FFIDAnnouncementList, x as FFIDAnnouncementsError, y as FFIDAnnouncementsErrorCode, z as FFIDAnnouncementsServerResponse, B as FFIDCacheConfig, C as FFIDContextValue, D as FFIDJwtClaims, E as FFIDLoginButton, G as FFIDOAuthTokenResponse, H as FFIDOAuthUserInfoMemberRole, I as FFIDOAuthUserInfoSubscription, J as FFIDOrganizationSwitcher, K as FFIDSeatModel, M as FFIDSubscriptionBadge, N as FFIDSubscriptionStatus, O as FFIDTokenIntrospectionResponse, P as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, Q as UseFFIDAnnouncementsReturn, R as useFFIDAnnouncements } from './index-DsXjcF0i.cjs';
1
+ import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDRedirectResult, d as FFIDError, e as FFIDSubscriptionCheckResponse, f as FFIDCreateCheckoutParams, g as FFIDCheckoutSessionResponse, h as FFIDCreatePortalParams, i as FFIDPortalSessionResponse, j as FFIDVerifyAccessTokenOptions, k as FFIDOAuthUserInfo, l as FFIDAuthMode, m as FFIDLogger, n as FFIDCacheAdapter, o as FFIDUser, p as FFIDOrganization, q as FFIDSubscription, r as FFIDSubscriptionContextValue, s as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, t as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, u as FFIDAnnouncementsLogger } from './index-GrAWBpmf.cjs';
2
+ export { v as Announcement, w as AnnouncementStatus, x as AnnouncementType, y as FFIDAnnouncementBadge, z as FFIDAnnouncementList, B as FFIDAnnouncementsError, C as FFIDAnnouncementsErrorCode, D as FFIDAnnouncementsServerResponse, E as FFIDCacheConfig, G as FFIDContextValue, H as FFIDJwtClaims, I as FFIDLoginButton, J as FFIDOAuthTokenResponse, K as FFIDOAuthUserInfoMemberRole, M as FFIDOAuthUserInfoSubscription, N as FFIDOrganizationSwitcher, O as FFIDSeatModel, P as FFIDSubscriptionBadge, Q as FFIDSubscriptionStatus, R as FFIDTokenIntrospectionResponse, S as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, T as UseFFIDAnnouncementsReturn, V as useFFIDAnnouncements } from './index-GrAWBpmf.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode, ComponentType, FC } from 'react';
5
5
 
@@ -68,27 +68,72 @@ declare function generateCodeVerifier(): string;
68
68
  * @returns base64url-encoded SHA-256 hash
69
69
  */
70
70
  declare function generateCodeChallenge(verifier: string): Promise<string>;
71
+ /** Logger interface matching FFIDLogger for optional warning output */
72
+ interface PKCELogger {
73
+ warn: (...args: unknown[]) => void;
74
+ }
71
75
  /**
72
76
  * Store code verifier in sessionStorage for later retrieval.
73
77
  * Uses window.sessionStorage explicitly to ensure browser Web Storage API.
74
78
  *
75
79
  * @param verifier - The code verifier to store
80
+ * @param logger - Optional logger for warning on storage failure
81
+ * @returns true if stored successfully, false otherwise
76
82
  */
77
- declare function storeCodeVerifier(verifier: string): void;
83
+ declare function storeCodeVerifier(verifier: string, logger?: PKCELogger): boolean;
78
84
  /**
79
85
  * Retrieve and remove the code verifier from sessionStorage.
80
86
  * Uses window.sessionStorage explicitly to ensure browser Web Storage API.
81
87
  *
82
- * Returns null if no verifier is stored.
88
+ * Returns null if no verifier is stored or if storage is unavailable.
83
89
  * Removes the verifier after retrieval (one-time use).
90
+ *
91
+ * @param logger - Optional logger for warning on storage failure
84
92
  */
85
- declare function retrieveCodeVerifier(): string | null;
93
+ declare function retrieveCodeVerifier(logger?: PKCELogger): string | null;
94
+
95
+ /** OTP / magic link methods - sendOtp / verifyOtp */
96
+
97
+ /** Response from sendOtp */
98
+ interface FFIDOtpSendResponse {
99
+ message: string;
100
+ }
101
+ /** Response from verifyOtp */
102
+ interface FFIDOtpVerifyResponse {
103
+ user: {
104
+ id: string;
105
+ email: string;
106
+ displayName: string | null;
107
+ avatarUrl: string | null;
108
+ };
109
+ session: {
110
+ accessToken: string;
111
+ refreshToken: string;
112
+ expiresAt: number;
113
+ expiresIn: number;
114
+ };
115
+ }
116
+
117
+ /** Password reset methods - requestPasswordReset / verifyPasswordResetToken / establishResetSession / confirmPasswordReset */
118
+
119
+ /** Response from requestPasswordReset */
120
+ interface FFIDPasswordResetResponse {
121
+ message: string;
122
+ }
123
+ /** Response from verifyPasswordResetToken */
124
+ interface FFIDPasswordResetVerifyResponse {
125
+ valid: boolean;
126
+ }
127
+ /** Response from establishResetSession */
128
+ type FFIDResetSessionResponse = FFIDPasswordResetResponse;
129
+ /** Response from confirmPasswordReset */
130
+ type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
86
131
 
87
132
  /** Creates an FFID API client instance */
88
133
  declare function createFFIDClient(config: FFIDConfig): {
89
134
  getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
90
135
  signOut: () => Promise<FFIDApiResponse<void>>;
91
- redirectToLogin: () => boolean;
136
+ redirectToLogin: () => Promise<FFIDRedirectResult>;
92
137
  getLoginUrl: (redirectUrl?: string) => string;
93
138
  getSignupUrl: (redirectUrl?: string) => string;
94
139
  createError: (code: string, message: string) => FFIDError;
@@ -100,11 +145,22 @@ declare function createFFIDClient(config: FFIDConfig): {
100
145
  }) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
101
146
  createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
102
147
  createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
103
- verifyAccessToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
148
+ verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
149
+ requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
150
+ verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
151
+ establishResetSession: (accessToken: string, refreshToken: string) => Promise<FFIDApiResponse<FFIDResetSessionResponse>>;
152
+ confirmPasswordReset: (password: string) => Promise<FFIDApiResponse<FFIDPasswordResetConfirmResponse>>;
153
+ sendOtp: (email: string, options?: {
154
+ redirectUrl?: string;
155
+ }) => Promise<FFIDApiResponse<FFIDOtpSendResponse>>;
156
+ verifyOtp: (params: {
157
+ accessToken: string;
158
+ refreshToken: string;
159
+ }) => Promise<FFIDApiResponse<FFIDOtpVerifyResponse>>;
104
160
  /** Token store (token mode only) */
105
161
  tokenStore: TokenStore;
106
162
  /** Resolved auth mode */
107
- authMode: "cookie" | "token" | "service-key";
163
+ authMode: FFIDAuthMode;
108
164
  /** Resolved logger instance */
109
165
  logger: FFIDLogger;
110
166
  baseUrl: string;
@@ -366,4 +422,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
366
422
  /** Type of the FFID Announcements client */
367
423
  type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
368
424
 
369
- export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, FFIDCacheAdapter, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDLogger, FFIDOAuthUserInfo, FFIDOrganization, FFIDPortalSessionResponse, FFIDProvider, type FFIDProviderProps, FFIDSessionResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDUser, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
425
+ export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, FFIDCacheAdapter, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDLogger, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, FFIDPortalSessionResponse, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, type FFIDResetSessionResponse, FFIDSessionResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDError, d as FFIDSubscriptionCheckResponse, e as FFIDCreateCheckoutParams, f as FFIDCheckoutSessionResponse, g as FFIDCreatePortalParams, h as FFIDPortalSessionResponse, i as FFIDOAuthUserInfo, j as FFIDLogger, k as FFIDCacheAdapter, l as FFIDUser, m as FFIDOrganization, n as FFIDSubscription, o as FFIDSubscriptionContextValue, p as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, q as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, r as FFIDAnnouncementsLogger } from './index-DsXjcF0i.js';
2
- export { s as Announcement, t as AnnouncementStatus, u as AnnouncementType, v as FFIDAnnouncementBadge, w as FFIDAnnouncementList, x as FFIDAnnouncementsError, y as FFIDAnnouncementsErrorCode, z as FFIDAnnouncementsServerResponse, B as FFIDCacheConfig, C as FFIDContextValue, D as FFIDJwtClaims, E as FFIDLoginButton, G as FFIDOAuthTokenResponse, H as FFIDOAuthUserInfoMemberRole, I as FFIDOAuthUserInfoSubscription, J as FFIDOrganizationSwitcher, K as FFIDSeatModel, M as FFIDSubscriptionBadge, N as FFIDSubscriptionStatus, O as FFIDTokenIntrospectionResponse, P as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, Q as UseFFIDAnnouncementsReturn, R as useFFIDAnnouncements } from './index-DsXjcF0i.js';
1
+ import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDRedirectResult, d as FFIDError, e as FFIDSubscriptionCheckResponse, f as FFIDCreateCheckoutParams, g as FFIDCheckoutSessionResponse, h as FFIDCreatePortalParams, i as FFIDPortalSessionResponse, j as FFIDVerifyAccessTokenOptions, k as FFIDOAuthUserInfo, l as FFIDAuthMode, m as FFIDLogger, n as FFIDCacheAdapter, o as FFIDUser, p as FFIDOrganization, q as FFIDSubscription, r as FFIDSubscriptionContextValue, s as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, t as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, u as FFIDAnnouncementsLogger } from './index-GrAWBpmf.js';
2
+ export { v as Announcement, w as AnnouncementStatus, x as AnnouncementType, y as FFIDAnnouncementBadge, z as FFIDAnnouncementList, B as FFIDAnnouncementsError, C as FFIDAnnouncementsErrorCode, D as FFIDAnnouncementsServerResponse, E as FFIDCacheConfig, G as FFIDContextValue, H as FFIDJwtClaims, I as FFIDLoginButton, J as FFIDOAuthTokenResponse, K as FFIDOAuthUserInfoMemberRole, M as FFIDOAuthUserInfoSubscription, N as FFIDOrganizationSwitcher, O as FFIDSeatModel, P as FFIDSubscriptionBadge, Q as FFIDSubscriptionStatus, R as FFIDTokenIntrospectionResponse, S as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, T as UseFFIDAnnouncementsReturn, V as useFFIDAnnouncements } from './index-GrAWBpmf.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode, ComponentType, FC } from 'react';
5
5
 
@@ -68,27 +68,72 @@ declare function generateCodeVerifier(): string;
68
68
  * @returns base64url-encoded SHA-256 hash
69
69
  */
70
70
  declare function generateCodeChallenge(verifier: string): Promise<string>;
71
+ /** Logger interface matching FFIDLogger for optional warning output */
72
+ interface PKCELogger {
73
+ warn: (...args: unknown[]) => void;
74
+ }
71
75
  /**
72
76
  * Store code verifier in sessionStorage for later retrieval.
73
77
  * Uses window.sessionStorage explicitly to ensure browser Web Storage API.
74
78
  *
75
79
  * @param verifier - The code verifier to store
80
+ * @param logger - Optional logger for warning on storage failure
81
+ * @returns true if stored successfully, false otherwise
76
82
  */
77
- declare function storeCodeVerifier(verifier: string): void;
83
+ declare function storeCodeVerifier(verifier: string, logger?: PKCELogger): boolean;
78
84
  /**
79
85
  * Retrieve and remove the code verifier from sessionStorage.
80
86
  * Uses window.sessionStorage explicitly to ensure browser Web Storage API.
81
87
  *
82
- * Returns null if no verifier is stored.
88
+ * Returns null if no verifier is stored or if storage is unavailable.
83
89
  * Removes the verifier after retrieval (one-time use).
90
+ *
91
+ * @param logger - Optional logger for warning on storage failure
84
92
  */
85
- declare function retrieveCodeVerifier(): string | null;
93
+ declare function retrieveCodeVerifier(logger?: PKCELogger): string | null;
94
+
95
+ /** OTP / magic link methods - sendOtp / verifyOtp */
96
+
97
+ /** Response from sendOtp */
98
+ interface FFIDOtpSendResponse {
99
+ message: string;
100
+ }
101
+ /** Response from verifyOtp */
102
+ interface FFIDOtpVerifyResponse {
103
+ user: {
104
+ id: string;
105
+ email: string;
106
+ displayName: string | null;
107
+ avatarUrl: string | null;
108
+ };
109
+ session: {
110
+ accessToken: string;
111
+ refreshToken: string;
112
+ expiresAt: number;
113
+ expiresIn: number;
114
+ };
115
+ }
116
+
117
+ /** Password reset methods - requestPasswordReset / verifyPasswordResetToken / establishResetSession / confirmPasswordReset */
118
+
119
+ /** Response from requestPasswordReset */
120
+ interface FFIDPasswordResetResponse {
121
+ message: string;
122
+ }
123
+ /** Response from verifyPasswordResetToken */
124
+ interface FFIDPasswordResetVerifyResponse {
125
+ valid: boolean;
126
+ }
127
+ /** Response from establishResetSession */
128
+ type FFIDResetSessionResponse = FFIDPasswordResetResponse;
129
+ /** Response from confirmPasswordReset */
130
+ type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
86
131
 
87
132
  /** Creates an FFID API client instance */
88
133
  declare function createFFIDClient(config: FFIDConfig): {
89
134
  getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
90
135
  signOut: () => Promise<FFIDApiResponse<void>>;
91
- redirectToLogin: () => boolean;
136
+ redirectToLogin: () => Promise<FFIDRedirectResult>;
92
137
  getLoginUrl: (redirectUrl?: string) => string;
93
138
  getSignupUrl: (redirectUrl?: string) => string;
94
139
  createError: (code: string, message: string) => FFIDError;
@@ -100,11 +145,22 @@ declare function createFFIDClient(config: FFIDConfig): {
100
145
  }) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
101
146
  createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
102
147
  createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
103
- verifyAccessToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
148
+ verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
149
+ requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
150
+ verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
151
+ establishResetSession: (accessToken: string, refreshToken: string) => Promise<FFIDApiResponse<FFIDResetSessionResponse>>;
152
+ confirmPasswordReset: (password: string) => Promise<FFIDApiResponse<FFIDPasswordResetConfirmResponse>>;
153
+ sendOtp: (email: string, options?: {
154
+ redirectUrl?: string;
155
+ }) => Promise<FFIDApiResponse<FFIDOtpSendResponse>>;
156
+ verifyOtp: (params: {
157
+ accessToken: string;
158
+ refreshToken: string;
159
+ }) => Promise<FFIDApiResponse<FFIDOtpVerifyResponse>>;
104
160
  /** Token store (token mode only) */
105
161
  tokenStore: TokenStore;
106
162
  /** Resolved auth mode */
107
- authMode: "cookie" | "token" | "service-key";
163
+ authMode: FFIDAuthMode;
108
164
  /** Resolved logger instance */
109
165
  logger: FFIDLogger;
110
166
  baseUrl: string;
@@ -366,4 +422,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
366
422
  /** Type of the FFID Announcements client */
367
423
  type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
368
424
 
369
- export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, FFIDCacheAdapter, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDLogger, FFIDOAuthUserInfo, FFIDOrganization, FFIDPortalSessionResponse, FFIDProvider, type FFIDProviderProps, FFIDSessionResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDUser, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
425
+ export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, FFIDCacheAdapter, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDLogger, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, FFIDPortalSessionResponse, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, type FFIDResetSessionResponse, FFIDSessionResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext } from './chunk-PSSNMEJB.js';
2
- export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-PSSNMEJB.js';
1
+ import { useFFIDContext } from './chunk-KFOIVZEY.js';
2
+ export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-KFOIVZEY.js';
3
3
  import { useRef, useEffect } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5