@feelflow/ffid-sdk 1.11.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.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkWZZP7SQB_cjs = require('./chunk-WZZP7SQB.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 } = chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 chunkWZZP7SQB_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 FFIDVerifyAccessTokenOptions, j as FFIDOAuthUserInfo, k as FFIDAuthMode, l as FFIDLogger, m as FFIDCacheAdapter, n as FFIDUser, o as FFIDOrganization, p as FFIDSubscription, q as FFIDSubscriptionContextValue, r as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, s as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, t as FFIDAnnouncementsLogger } from './index-DMgtXEt5.cjs';
2
- export { u as Announcement, v as AnnouncementStatus, w as AnnouncementType, x as FFIDAnnouncementBadge, y as FFIDAnnouncementList, z as FFIDAnnouncementsError, B as FFIDAnnouncementsErrorCode, C as FFIDAnnouncementsServerResponse, D as FFIDCacheConfig, E as FFIDContextValue, G as FFIDJwtClaims, H as FFIDLoginButton, I as FFIDOAuthTokenResponse, J as FFIDOAuthUserInfoMemberRole, K as FFIDOAuthUserInfoSubscription, M as FFIDOrganizationSwitcher, N as FFIDSeatModel, O as FFIDSubscriptionBadge, P as FFIDSubscriptionStatus, Q as FFIDTokenIntrospectionResponse, R as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, S as UseFFIDAnnouncementsReturn, T as useFFIDAnnouncements } from './index-DMgtXEt5.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: () => Promise<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;
@@ -101,6 +146,17 @@ declare function createFFIDClient(config: FFIDConfig): {
101
146
  createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
102
147
  createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
103
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 */
@@ -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, 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 };
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 FFIDVerifyAccessTokenOptions, j as FFIDOAuthUserInfo, k as FFIDAuthMode, l as FFIDLogger, m as FFIDCacheAdapter, n as FFIDUser, o as FFIDOrganization, p as FFIDSubscription, q as FFIDSubscriptionContextValue, r as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, s as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, t as FFIDAnnouncementsLogger } from './index-DMgtXEt5.js';
2
- export { u as Announcement, v as AnnouncementStatus, w as AnnouncementType, x as FFIDAnnouncementBadge, y as FFIDAnnouncementList, z as FFIDAnnouncementsError, B as FFIDAnnouncementsErrorCode, C as FFIDAnnouncementsServerResponse, D as FFIDCacheConfig, E as FFIDContextValue, G as FFIDJwtClaims, H as FFIDLoginButton, I as FFIDOAuthTokenResponse, J as FFIDOAuthUserInfoMemberRole, K as FFIDOAuthUserInfoSubscription, M as FFIDOrganizationSwitcher, N as FFIDSeatModel, O as FFIDSubscriptionBadge, P as FFIDSubscriptionStatus, Q as FFIDTokenIntrospectionResponse, R as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, S as UseFFIDAnnouncementsReturn, T as useFFIDAnnouncements } from './index-DMgtXEt5.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: () => Promise<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;
@@ -101,6 +146,17 @@ declare function createFFIDClient(config: FFIDConfig): {
101
146
  createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
102
147
  createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
103
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 */
@@ -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, 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 };
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-GW23IWNE.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-GW23IWNE.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