@feelflow/ffid-sdk 5.24.2 → 5.25.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 chunkQMWUOVZK_cjs = require('./chunk-QMWUOVZK.cjs');
3
+ var chunkZFKXOTFF_cjs = require('./chunk-ZFKXOTFF.cjs');
4
4
  var chunkH5O2CCAY_cjs = require('./chunk-H5O2CCAY.cjs');
5
5
  var react = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
@@ -54,8 +54,8 @@ function defaultRedirect(url) {
54
54
  }
55
55
  function useRequireActiveSubscription(options) {
56
56
  const { redirectTo, allowGrace = true, onRedirect } = options;
57
- const { isLoading, error } = chunkQMWUOVZK_cjs.useFFIDContext();
58
- const { effectiveStatus, isBlocked, isGrace } = chunkQMWUOVZK_cjs.useSubscription();
57
+ const { isLoading, error } = chunkZFKXOTFF_cjs.useFFIDContext();
58
+ const { effectiveStatus, isBlocked, isGrace } = chunkZFKXOTFF_cjs.useSubscription();
59
59
  const hasFetchError = error !== null && effectiveStatus === null;
60
60
  const shouldRedirect = !isLoading && !hasFetchError && (isBlocked || !allowGrace && isGrace || effectiveStatus === null);
61
61
  react.useEffect(() => {
@@ -76,7 +76,7 @@ function useRequireActiveSubscription(options) {
76
76
  }
77
77
  function withFFIDAuth(Component, options = {}) {
78
78
  const WrappedComponent = (props) => {
79
- const { isLoading, isAuthenticated, login } = chunkQMWUOVZK_cjs.useFFIDContext();
79
+ const { isLoading, isAuthenticated, login } = chunkZFKXOTFF_cjs.useFFIDContext();
80
80
  const hasRedirected = react.useRef(false);
81
81
  react.useEffect(() => {
82
82
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -105,155 +105,155 @@ var FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1e3;
105
105
 
106
106
  Object.defineProperty(exports, "ACCESS_GRANTING_EFFECTIVE_STATUSES", {
107
107
  enumerable: true,
108
- get: function () { return chunkQMWUOVZK_cjs.ACCESS_GRANTING_EFFECTIVE_STATUSES; }
108
+ get: function () { return chunkZFKXOTFF_cjs.ACCESS_GRANTING_EFFECTIVE_STATUSES; }
109
109
  });
110
110
  Object.defineProperty(exports, "BLOCKING_EFFECTIVE_STATUSES", {
111
111
  enumerable: true,
112
- get: function () { return chunkQMWUOVZK_cjs.BLOCKING_EFFECTIVE_STATUSES; }
112
+ get: function () { return chunkZFKXOTFF_cjs.BLOCKING_EFFECTIVE_STATUSES; }
113
113
  });
114
114
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
115
115
  enumerable: true,
116
- get: function () { return chunkQMWUOVZK_cjs.DEFAULT_API_BASE_URL; }
116
+ get: function () { return chunkZFKXOTFF_cjs.DEFAULT_API_BASE_URL; }
117
117
  });
118
118
  Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
119
119
  enumerable: true,
120
- get: function () { return chunkQMWUOVZK_cjs.DEFAULT_OAUTH_SCOPES; }
120
+ get: function () { return chunkZFKXOTFF_cjs.DEFAULT_OAUTH_SCOPES; }
121
121
  });
122
122
  Object.defineProperty(exports, "EFFECTIVE_SUBSCRIPTION_STATUSES", {
123
123
  enumerable: true,
124
- get: function () { return chunkQMWUOVZK_cjs.EFFECTIVE_SUBSCRIPTION_STATUSES; }
124
+ get: function () { return chunkZFKXOTFF_cjs.EFFECTIVE_SUBSCRIPTION_STATUSES; }
125
125
  });
126
126
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
127
127
  enumerable: true,
128
- get: function () { return chunkQMWUOVZK_cjs.FFIDAnnouncementBadge; }
128
+ get: function () { return chunkZFKXOTFF_cjs.FFIDAnnouncementBadge; }
129
129
  });
130
130
  Object.defineProperty(exports, "FFIDAnnouncementList", {
131
131
  enumerable: true,
132
- get: function () { return chunkQMWUOVZK_cjs.FFIDAnnouncementList; }
132
+ get: function () { return chunkZFKXOTFF_cjs.FFIDAnnouncementList; }
133
133
  });
134
134
  Object.defineProperty(exports, "FFIDInquiryForm", {
135
135
  enumerable: true,
136
- get: function () { return chunkQMWUOVZK_cjs.FFIDInquiryForm; }
136
+ get: function () { return chunkZFKXOTFF_cjs.FFIDInquiryForm; }
137
137
  });
138
138
  Object.defineProperty(exports, "FFIDLoginButton", {
139
139
  enumerable: true,
140
- get: function () { return chunkQMWUOVZK_cjs.FFIDLoginButton; }
140
+ get: function () { return chunkZFKXOTFF_cjs.FFIDLoginButton; }
141
141
  });
142
142
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
143
143
  enumerable: true,
144
- get: function () { return chunkQMWUOVZK_cjs.FFIDOrganizationSwitcher; }
144
+ get: function () { return chunkZFKXOTFF_cjs.FFIDOrganizationSwitcher; }
145
145
  });
146
146
  Object.defineProperty(exports, "FFIDProvider", {
147
147
  enumerable: true,
148
- get: function () { return chunkQMWUOVZK_cjs.FFIDProvider; }
148
+ get: function () { return chunkZFKXOTFF_cjs.FFIDProvider; }
149
149
  });
150
150
  Object.defineProperty(exports, "FFIDSDKError", {
151
151
  enumerable: true,
152
- get: function () { return chunkQMWUOVZK_cjs.FFIDSDKError; }
152
+ get: function () { return chunkZFKXOTFF_cjs.FFIDSDKError; }
153
153
  });
154
154
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
155
155
  enumerable: true,
156
- get: function () { return chunkQMWUOVZK_cjs.FFIDSubscriptionBadge; }
156
+ get: function () { return chunkZFKXOTFF_cjs.FFIDSubscriptionBadge; }
157
157
  });
158
158
  Object.defineProperty(exports, "FFIDUserMenu", {
159
159
  enumerable: true,
160
- get: function () { return chunkQMWUOVZK_cjs.FFIDUserMenu; }
160
+ get: function () { return chunkZFKXOTFF_cjs.FFIDUserMenu; }
161
161
  });
162
162
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
163
163
  enumerable: true,
164
- get: function () { return chunkQMWUOVZK_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
164
+ get: function () { return chunkZFKXOTFF_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
165
165
  });
166
166
  Object.defineProperty(exports, "FFID_ERROR_CODES", {
167
167
  enumerable: true,
168
- get: function () { return chunkQMWUOVZK_cjs.FFID_ERROR_CODES; }
168
+ get: function () { return chunkZFKXOTFF_cjs.FFID_ERROR_CODES; }
169
169
  });
170
170
  Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES", {
171
171
  enumerable: true,
172
- get: function () { return chunkQMWUOVZK_cjs.FFID_INQUIRY_CATEGORIES; }
172
+ get: function () { return chunkZFKXOTFF_cjs.FFID_INQUIRY_CATEGORIES; }
173
173
  });
174
174
  Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES_SITE_2026", {
175
175
  enumerable: true,
176
- get: function () { return chunkQMWUOVZK_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
176
+ get: function () { return chunkZFKXOTFF_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
177
177
  });
178
178
  Object.defineProperty(exports, "clearState", {
179
179
  enumerable: true,
180
- get: function () { return chunkQMWUOVZK_cjs.cleanupStateStorage; }
180
+ get: function () { return chunkZFKXOTFF_cjs.cleanupStateStorage; }
181
181
  });
182
182
  Object.defineProperty(exports, "computeEffectiveStatusFromSession", {
183
183
  enumerable: true,
184
- get: function () { return chunkQMWUOVZK_cjs.computeEffectiveStatusFromSession; }
184
+ get: function () { return chunkZFKXOTFF_cjs.computeEffectiveStatusFromSession; }
185
185
  });
186
186
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
187
187
  enumerable: true,
188
- get: function () { return chunkQMWUOVZK_cjs.createFFIDAnnouncementsClient; }
188
+ get: function () { return chunkZFKXOTFF_cjs.createFFIDAnnouncementsClient; }
189
189
  });
190
190
  Object.defineProperty(exports, "createFFIDClient", {
191
191
  enumerable: true,
192
- get: function () { return chunkQMWUOVZK_cjs.createFFIDClient; }
192
+ get: function () { return chunkZFKXOTFF_cjs.createFFIDClient; }
193
193
  });
194
194
  Object.defineProperty(exports, "createTokenStore", {
195
195
  enumerable: true,
196
- get: function () { return chunkQMWUOVZK_cjs.createTokenStore; }
196
+ get: function () { return chunkZFKXOTFF_cjs.createTokenStore; }
197
197
  });
198
198
  Object.defineProperty(exports, "generateCodeChallenge", {
199
199
  enumerable: true,
200
- get: function () { return chunkQMWUOVZK_cjs.generateCodeChallenge; }
200
+ get: function () { return chunkZFKXOTFF_cjs.generateCodeChallenge; }
201
201
  });
202
202
  Object.defineProperty(exports, "generateCodeVerifier", {
203
203
  enumerable: true,
204
- get: function () { return chunkQMWUOVZK_cjs.generateCodeVerifier; }
204
+ get: function () { return chunkZFKXOTFF_cjs.generateCodeVerifier; }
205
205
  });
206
206
  Object.defineProperty(exports, "handleRedirectCallback", {
207
207
  enumerable: true,
208
- get: function () { return chunkQMWUOVZK_cjs.handleRedirectCallback; }
208
+ get: function () { return chunkZFKXOTFF_cjs.handleRedirectCallback; }
209
209
  });
210
210
  Object.defineProperty(exports, "hasAccessFromUserinfo", {
211
211
  enumerable: true,
212
- get: function () { return chunkQMWUOVZK_cjs.hasAccessFromUserinfo; }
212
+ get: function () { return chunkZFKXOTFF_cjs.hasAccessFromUserinfo; }
213
213
  });
214
214
  Object.defineProperty(exports, "isBlockedFromUserinfo", {
215
215
  enumerable: true,
216
- get: function () { return chunkQMWUOVZK_cjs.isBlockedFromUserinfo; }
216
+ get: function () { return chunkZFKXOTFF_cjs.isBlockedFromUserinfo; }
217
217
  });
218
218
  Object.defineProperty(exports, "isFFIDInquiryCategorySite2026", {
219
219
  enumerable: true,
220
- get: function () { return chunkQMWUOVZK_cjs.isFFIDInquiryCategorySite2026; }
220
+ get: function () { return chunkZFKXOTFF_cjs.isFFIDInquiryCategorySite2026; }
221
221
  });
222
222
  Object.defineProperty(exports, "normalizeRedirectUri", {
223
223
  enumerable: true,
224
- get: function () { return chunkQMWUOVZK_cjs.normalizeRedirectUri; }
224
+ get: function () { return chunkZFKXOTFF_cjs.normalizeRedirectUri; }
225
225
  });
226
226
  Object.defineProperty(exports, "retrieveCodeVerifier", {
227
227
  enumerable: true,
228
- get: function () { return chunkQMWUOVZK_cjs.retrieveCodeVerifier; }
228
+ get: function () { return chunkZFKXOTFF_cjs.retrieveCodeVerifier; }
229
229
  });
230
230
  Object.defineProperty(exports, "retrieveState", {
231
231
  enumerable: true,
232
- get: function () { return chunkQMWUOVZK_cjs.retrieveState; }
232
+ get: function () { return chunkZFKXOTFF_cjs.retrieveState; }
233
233
  });
234
234
  Object.defineProperty(exports, "storeCodeVerifier", {
235
235
  enumerable: true,
236
- get: function () { return chunkQMWUOVZK_cjs.storeCodeVerifier; }
236
+ get: function () { return chunkZFKXOTFF_cjs.storeCodeVerifier; }
237
237
  });
238
238
  Object.defineProperty(exports, "storeState", {
239
239
  enumerable: true,
240
- get: function () { return chunkQMWUOVZK_cjs.storeState; }
240
+ get: function () { return chunkZFKXOTFF_cjs.storeState; }
241
241
  });
242
242
  Object.defineProperty(exports, "useFFID", {
243
243
  enumerable: true,
244
- get: function () { return chunkQMWUOVZK_cjs.useFFID; }
244
+ get: function () { return chunkZFKXOTFF_cjs.useFFID; }
245
245
  });
246
246
  Object.defineProperty(exports, "useFFIDAnnouncements", {
247
247
  enumerable: true,
248
- get: function () { return chunkQMWUOVZK_cjs.useFFIDAnnouncements; }
248
+ get: function () { return chunkZFKXOTFF_cjs.useFFIDAnnouncements; }
249
249
  });
250
250
  Object.defineProperty(exports, "useSubscription", {
251
251
  enumerable: true,
252
- get: function () { return chunkQMWUOVZK_cjs.useSubscription; }
252
+ get: function () { return chunkZFKXOTFF_cjs.useSubscription; }
253
253
  });
254
254
  Object.defineProperty(exports, "withSubscription", {
255
255
  enumerable: true,
256
- get: function () { return chunkQMWUOVZK_cjs.withSubscription; }
256
+ get: function () { return chunkZFKXOTFF_cjs.withSubscription; }
257
257
  });
258
258
  Object.defineProperty(exports, "ALL_DENIED_EXCEPT_NECESSARY", {
259
259
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FFIDSubscriptionStatus, a as FFIDPrompt, b as FFIDConfig, c as FFIDApiResponse, d as FFIDSessionResponse, e as FFIDSignOutResult, f as FFIDRedirectResult, g as FFIDError, h as FFIDSubscriptionCheckResponse, i as FFIDCheckServiceAccessParams, j as FFIDServiceAccessDecision, k as FFIDAnalyticsConfig, l as FFIDVerifyAccessTokenOptions, m as FFIDOAuthUserInfo, n as FFIDInquiryCreateParams, o as FFIDInquiryCreateResponse, p as FFIDAuthMode, q as FFIDLogger, r as FFIDCacheAdapter, s as FFIDUser, t as FFIDOrganization, u as FFIDSubscription, v as FFIDSubscriptionContextValue, E as EffectiveSubscriptionStatus, w as FFIDOAuthUserInfoSubscription, x as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, y as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, z as FFIDAnnouncementsLogger } from './index-GqflEaKi.cjs';
2
- export { B as Announcement, C as AnnouncementStatus, D as AnnouncementType, G as EFFECTIVE_SUBSCRIPTION_STATUSES, H as FFIDAnnouncementBadge, I as FFIDAnnouncementList, J as FFIDAnnouncementsError, K as FFIDAnnouncementsErrorCode, M as FFIDAnnouncementsServerResponse, N as FFIDApiResponseMeta, O as FFIDCacheConfig, P as FFIDContextValue, Q as FFIDInquiryCategory, R as FFIDInquiryCategorySite2026, S as FFIDInquiryForm, T as FFIDInquiryFormCategoryItem, U as FFIDInquiryFormClassNames, V as FFIDInquiryFormLegalLayout, W as FFIDInquiryFormOrganization, X as FFIDInquiryFormPlaceholderContext, Y as FFIDInquiryFormPrefill, Z as FFIDInquiryFormProps, _ as FFIDInquiryFormSubmitData, $ as FFIDInquiryFormSubmitResult, a0 as FFIDJwtClaims, a1 as FFIDLoginButton, a2 as FFIDOAuthTokenResponse, a3 as FFIDOAuthUserInfoMemberRole, a4 as FFIDOrganizationSwitcher, a5 as FFIDRedirectErrorCode, a6 as FFIDSeatModel, a7 as FFIDServiceAccessDenialReason, a8 as FFIDServiceAccessFailPolicy, a9 as FFIDSubscriptionBadge, aa as FFIDTokenIntrospectionResponse, ab as FFIDUserMenu, ac as FFID_INQUIRY_CATEGORIES, ad as FFID_INQUIRY_CATEGORIES_SITE_2026, ae as UseFFIDAnnouncementsOptions, af as UseFFIDAnnouncementsReturn, ag as isFFIDInquiryCategorySite2026, ah as useFFIDAnnouncements } from './index-GqflEaKi.cjs';
1
+ import { F as FFIDSubscriptionStatus, a as FFIDOAuthUserInfoSubscription, b as FFIDPrompt, c as FFIDConfig, d as FFIDApiResponse, e as FFIDSessionResponse, f as FFIDSignOutResult, g as FFIDError, h as FFIDSubscriptionCheckResponse, i as FFIDCheckServiceAccessParams, j as FFIDServiceAccessDecision, k as FFIDAnalyticsConfig, l as FFIDVerifyAccessTokenOptions, m as FFIDOAuthUserInfo, n as FFIDInquiryCreateParams, o as FFIDInquiryCreateResponse, T as TokenStore, p as FFIDAuthMode, q as FFIDLogger, r as FFIDCacheAdapter, s as FFIDUser, t as FFIDOrganization, u as FFIDSubscription, v as FFIDSubscriptionContextValue, E as EffectiveSubscriptionStatus, w as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, x as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, y as FFIDAnnouncementsLogger } from './index-Dd6CMIBd.cjs';
2
+ export { z as Announcement, B as AnnouncementStatus, C as AnnouncementType, D as EFFECTIVE_SUBSCRIPTION_STATUSES, G as FFIDAnnouncementBadge, H as FFIDAnnouncementList, I as FFIDAnnouncementsError, J as FFIDAnnouncementsErrorCode, K as FFIDAnnouncementsServerResponse, M as FFIDApiResponseMeta, N as FFIDCacheConfig, O as FFIDContextValue, P as FFIDInquiryCategory, Q as FFIDInquiryCategorySite2026, R as FFIDInquiryForm, S as FFIDInquiryFormCategoryItem, U as FFIDInquiryFormClassNames, V as FFIDInquiryFormLegalLayout, W as FFIDInquiryFormOrganization, X as FFIDInquiryFormPlaceholderContext, Y as FFIDInquiryFormPrefill, Z as FFIDInquiryFormProps, _ as FFIDInquiryFormSubmitData, $ as FFIDInquiryFormSubmitResult, a0 as FFIDJwtClaims, a1 as FFIDLoginButton, a2 as FFIDOAuthUserInfoMemberRole, a3 as FFIDOrganizationSwitcher, a4 as FFIDSeatModel, a5 as FFIDServiceAccessDenialReason, a6 as FFIDServiceAccessFailPolicy, a7 as FFIDSubscriptionBadge, a8 as FFIDUserMenu, a9 as FFID_INQUIRY_CATEGORIES, aa as FFID_INQUIRY_CATEGORIES_SITE_2026, ab as TokenData, ac as UseFFIDAnnouncementsOptions, ad as UseFFIDAnnouncementsReturn, ae as createTokenStore, af as isFFIDInquiryCategorySite2026, ag as useFFIDAnnouncements } from './index-Dd6CMIBd.cjs';
3
3
  export { A as ALL_DENIED_EXCEPT_NECESSARY, i as CONSENT_COOKIE_NAME, j as CONSENT_DISMISSAL_TIMESTAMP_KEY, l as COOKIE_VERSION, D as DEFAULT_CONSENT_ERROR_MESSAGES, o as FFIDAnalyticsProvider, p as FFIDAnalyticsProviderProps, c as FFIDConsentCategories, r as FFIDConsentCategoryCode, e as FFIDConsentCategoryMetadata, w as FFIDConsentError, x as FFIDConsentErrorCode, y as FFIDConsentMergeStrategy, B as FFIDConsentMergeWarning, E as FFIDConsentMergeWarningEvent, F as FFIDConsentResult, I as FFIDConsentSource, a as FFIDConsentState, d as FFIDConsentSyncResult, M as FFIDCookieBanner, N as FFIDCookieBannerClassNames, O as FFIDCookieBannerProps, Q as FFIDCookieLink, R as FFIDCookieLinkProps, f as FFIDCookiePolicy, T as FFIDCookieSettings, U as FFIDCookieSettingsClassNames, V as FFIDCookieSettingsProps, _ as FFID_CONSENT_ERROR_CODES, ae as UseFFIDConsentPreferencesReturn, af as UseFFIDConsentReturn, ag as clearConsentDismissalTimestamp, aj as decodeConsentCookie, al as encodeConsentCookie, an as readConsentCookie, ao as readConsentDismissalTimestamp, aq as useFFIDConsent, ar as useFFIDConsentPreferences, as as writeConsentCookie, at as writeConsentDismissalTimestamp } from './FFIDCookieLink-BJgVcJyw.cjs';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { ReactNode, ComponentType, FC } from 'react';
@@ -39,47 +39,6 @@ declare const DEFAULT_API_BASE_URL = "https://id.feelflow.net";
39
39
  */
40
40
  declare const DEFAULT_OAUTH_SCOPES = "openid email profile subscription:read legal:read";
41
41
 
42
- /**
43
- * Token Store
44
- *
45
- * Manages OAuth 2.0 tokens (access + refresh) with dual-storage support.
46
- * Falls back to in-memory storage when localStorage is unavailable
47
- * (e.g., Safari private browsing mode).
48
- */
49
- /**
50
- * Token data stored by the token store
51
- */
52
- interface TokenData {
53
- /** OAuth 2.0 access token */
54
- accessToken: string;
55
- /** OAuth 2.0 refresh token */
56
- refreshToken: string;
57
- /** Expiration timestamp in milliseconds (Unix epoch) */
58
- expiresAt: number;
59
- }
60
- /**
61
- * Token store interface for managing OAuth tokens
62
- */
63
- interface TokenStore {
64
- /** Get stored tokens (null if not stored) */
65
- getTokens(): TokenData | null;
66
- /** Store new tokens */
67
- setTokens(tokens: TokenData): void;
68
- /** Clear all stored tokens */
69
- clearTokens(): void;
70
- /** Check if access token is expired (with 30s buffer) */
71
- isAccessTokenExpired(): boolean;
72
- }
73
- /**
74
- * Create a token store with the specified storage type.
75
- *
76
- * When storageType is 'localStorage' (default in browser), falls back
77
- * to memory if localStorage is not available (e.g., Safari private mode).
78
- *
79
- * @param storageType - 'localStorage' (default) or 'memory'
80
- */
81
- declare function createTokenStore(storageType?: 'localStorage' | 'memory'): TokenStore;
82
-
83
42
  /**
84
43
  * Generate a random code verifier (43-128 characters, RFC 7636 Section 4.1).
85
44
  *
@@ -1192,6 +1151,112 @@ interface FFIDUpdateUserProfileRequest {
1192
1151
  preferences?: Record<string, unknown> | null;
1193
1152
  }
1194
1153
 
1154
+ /**
1155
+ * OAuth flow types: client-side redirect results and OAuth token / RFC 7662
1156
+ * introspection payloads.
1157
+ *
1158
+ * Extracted from `types/index.ts` to keep that barrel under the 800-line hard
1159
+ * limit (`scripts/check-file-size.sh`). Re-exported from `types/index.ts`, so
1160
+ * the public API is unchanged — import from `@feelflow/ffid-sdk` as before.
1161
+ */
1162
+
1163
+ /**
1164
+ * Discriminant for redirect failures that callers need to handle
1165
+ * programmatically (vs. logging the human-readable `error` string).
1166
+ *
1167
+ * - `'redirect_loop_detected'`: `redirectToAuthorize()` detected that the
1168
+ * same authorize URL (keyed by `baseUrl + client_id + organization_id`)
1169
+ * has been fired **3 times within 60 seconds**. Caller should surface a
1170
+ * manual "再度ログインする" UI rather than retry automatically (#2406 / #2411).
1171
+ *
1172
+ * - `'state_persistence_failed'`: `redirectToAuthorize()` could not persist
1173
+ * the OAuth CSRF `state` (storage unavailable / quota). Redirect is aborted
1174
+ * fail-closed (#4136) — callers should surface a manual retry UI.
1175
+ *
1176
+ * Other failure paths (SSR environment, PKCE generation failure, empty
1177
+ * organizationId) currently return `error` without a `code`. Treat this union
1178
+ * as forward-extensible and do NOT exhaustively `switch` over it without a
1179
+ * `default` branch for consumer code that must stay compatible across SDK
1180
+ * upgrades.
1181
+ */
1182
+ type FFIDRedirectErrorCode = 'redirect_loop_detected' | 'state_persistence_failed';
1183
+ /**
1184
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
1185
+ *
1186
+ * Structured return type so callers can inspect failure reasons
1187
+ * instead of receiving a bare `false`. When `code` is set, branch on it
1188
+ * for programmatic handling; otherwise log `error` for humans.
1189
+ *
1190
+ * `loopDetectionDisabled` (#4119): set to `true` when sessionStorage is
1191
+ * unavailable (iOS WebKit private mode / eviction) so redirect-loop detection
1192
+ * ran **fail-open** — the redirect fired, but repeated-redirect protection is
1193
+ * disabled for this browser session. Callers that need loop protection on
1194
+ * such browsers should add their own max-retry guard.
1195
+ */
1196
+ type FFIDRedirectResult = {
1197
+ success: true;
1198
+ loopDetectionDisabled?: boolean;
1199
+ } | {
1200
+ success: false;
1201
+ error: string;
1202
+ code?: FFIDRedirectErrorCode;
1203
+ };
1204
+ /**
1205
+ * OAuth 2.0 token response from FFID token endpoint
1206
+ */
1207
+ interface FFIDOAuthTokenResponse {
1208
+ access_token: string;
1209
+ token_type: 'Bearer';
1210
+ expires_in: number;
1211
+ refresh_token: string;
1212
+ }
1213
+ /**
1214
+ * RFC 7662 Token Introspection response (raw format from server)
1215
+ *
1216
+ * Used internally by verifyAccessToken(). Consumers receive the normalized
1217
+ * FFIDOAuthUserInfo type instead.
1218
+ *
1219
+ * @see https://tools.ietf.org/html/rfc7662
1220
+ */
1221
+ interface FFIDTokenIntrospectionResponse {
1222
+ active: boolean;
1223
+ sub?: string;
1224
+ email?: string;
1225
+ /** Whether the user's email is verified (#3791). Optional for backward compat with older FFID. */
1226
+ email_verified?: boolean;
1227
+ name?: string;
1228
+ picture?: string | null;
1229
+ company_name?: string | null;
1230
+ department?: string | null;
1231
+ position?: string | null;
1232
+ phone_number?: string | null;
1233
+ scope?: string | null;
1234
+ exp?: number;
1235
+ iat?: number;
1236
+ iss?: string;
1237
+ token_type?: 'Bearer';
1238
+ client_id?: string;
1239
+ organization_id?: string | null;
1240
+ organization_name?: string | null;
1241
+ subscription?: {
1242
+ subscription_id: string | null;
1243
+ status: FFIDOAuthUserInfoSubscription['status'];
1244
+ /** Optional for backward compat with older FFID (< 5.3.0 / #3353). */
1245
+ effective_status?: FFIDOAuthUserInfoSubscription['effectiveStatus'];
1246
+ plan_code: string | null;
1247
+ seat_model: FFIDOAuthUserInfoSubscription['seatModel'];
1248
+ member_role: FFIDOAuthUserInfoSubscription['memberRole'];
1249
+ organization_id: string | null;
1250
+ organization_name?: string | null;
1251
+ has_seat_assignment?: boolean;
1252
+ /**
1253
+ * Optional for backward compat with older FFID (< #4333), and omitted when
1254
+ * the service API key has `token:introspect` without `subscription:read`.
1255
+ */
1256
+ entitlements?: readonly string[];
1257
+ };
1258
+ }
1259
+
1195
1260
  /** OTP / magic link methods - sendOtp / verifyOtp */
1196
1261
 
1197
1262
  /** Response from sendOtp */
@@ -1478,6 +1543,11 @@ declare function createFFIDClient(config: FFIDConfig): {
1478
1543
  };
1479
1544
  /** Token store (token mode only) */
1480
1545
  tokenStore: TokenStore;
1546
+ /**
1547
+ * Return the currently-valid access token, or null (token mode only; #4318).
1548
+ * Live-reads the store and applies the 30s expiry buffer.
1549
+ */
1550
+ getAccessToken: () => string | null;
1481
1551
  /** Resolved auth mode */
1482
1552
  authMode: FFIDAuthMode;
1483
1553
  /** Resolved logger instance */
@@ -1643,7 +1713,7 @@ interface FFIDProviderProps extends FFIDConfig {
1643
1713
  * - Automatic session refresh
1644
1714
  * - Token mode: automatic code exchange and token refresh
1645
1715
  */
1646
- declare function FFIDProvider({ children, serviceCode, scope, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, authMode, clientId, timeout, cleanCallbackUrl, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
1716
+ declare function FFIDProvider({ children, serviceCode, scope, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, authMode, clientId, timeout, tokenStore, cleanCallbackUrl, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
1647
1717
 
1648
1718
  /**
1649
1719
  * Return type for useFFID hook
@@ -1707,6 +1777,14 @@ interface UseFFIDReturn {
1707
1777
  switchOrganization: (organizationId: string) => void;
1708
1778
  /** Refresh session data */
1709
1779
  refresh: () => Promise<void>;
1780
+ /**
1781
+ * Token mode: return the currently-valid access token, or `null` when there is
1782
+ * none or it is expired (30s buffer). Live-reads the shared token store on each
1783
+ * call, so a token refreshed in the background — or cleared on logout — is
1784
+ * reflected without the host caching or polling it. Always `null` in
1785
+ * cookie / service-key mode. Stable function reference (#4318).
1786
+ */
1787
+ getAccessToken: () => string | null;
1710
1788
  /** Get login URL with redirect parameter */
1711
1789
  getLoginUrl: (redirectUrl?: string) => string;
1712
1790
  /** Get signup URL with redirect parameter */
@@ -2316,4 +2394,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
2316
2394
  };
2317
2395
  type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
2318
2396
 
2319
- export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AnnouncementListResponse, BLOCKING_EFFECTIVE_STATUSES, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EffectiveSubscriptionStatus, type ExchangeCodeForTokensOptions, type FFIDAddMemberParams, type FFIDAddMemberRequest, type FFIDAddMemberResponse, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDAssignableMemberRole, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckServiceAccessParams, type FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, type FFIDCreateCheckoutParams, type FFIDCreatePortalParams, FFIDError, type FFIDErrorCode, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, type FFIDInvitationStatus, type FFIDInviteMemberRequest, type FFIDInviteMemberResponse, type FFIDLeaveOrganizationParams, type FFIDLeaveOrganizationResponse, type FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, type FFIDLoginHistoryEntry, type FFIDLoginHistoryResponse, type FFIDMemberRole, type FFIDMemberStatus, type FFIDNewsletterBodySource, type FFIDNewsletterCampaignStatus, type FFIDNewsletterClient, type FFIDNewsletterConfirmParams, type FFIDNewsletterConfirmResponse, type FFIDNewsletterDispatchParams, type FFIDNewsletterDispatchResponse, type FFIDNewsletterSegment, type FFIDNewsletterSubscribeParams, type FFIDNewsletterSubscribeResponse, type FFIDNewsletterType, type FFIDNewsletterUnsubscribeParams, type FFIDNewsletterUnsubscribeResponse, FFIDOAuthUserInfo, FFIDOAuthUserInfoSubscription, FFIDOrganization, type FFIDOrganizationDomain, type FFIDOrganizationDomainsResponse, type FFIDOrganizationMember, type FFIDOrganizationNotificationPreferences, type FFIDOrganizationNotificationPreferencesResponse, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreview, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, type FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, type FFIDPreviewSeatChangeParams, type FFIDProfileCallOptions, FFIDProvider, type FFIDProviderProps, type FFIDProvisionMemberPlan, type FFIDProvisionMemberPlanStatus, type FFIDProvisionMemberResult, type FFIDProvisionMemberStatus, type FFIDProvisionOrganizationDryRun, type FFIDProvisionOrganizationMemberInput, type FFIDProvisionOrganizationOutcome, type FFIDProvisionOrganizationParams, type FFIDProvisionOrganizationResponse, type FFIDProvisionUserDryRun, type FFIDProvisionUserOutcome, type FFIDProvisionUserParams, type FFIDProvisionUserProfileInput, type FFIDProvisionUserResponse, type FFIDProvisionedOrganization, type FFIDProvisionedUser, FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDSeatChangeLineItem, type FFIDSeatChangePreview, type FFIDSeatChangePreviewResponse, FFIDServiceAccessDecision, type FFIDServiceInfo, FFIDSessionResponse, FFIDSignOutResult, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, type FFIDSupportedCurrency, type FFIDUpdateMemberRoleResponse, type FFIDUpdateNotificationPreferencesRequest, type FFIDUpdateUserProfileRequest, FFIDUser, type FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_ERROR_CODES, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, type HandleRedirectCallbackClient, type HandleRedirectCallbackOptions, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, retrieveState, storeCodeVerifier, storeState, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };
2397
+ export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AnnouncementListResponse, BLOCKING_EFFECTIVE_STATUSES, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EffectiveSubscriptionStatus, type ExchangeCodeForTokensOptions, type FFIDAddMemberParams, type FFIDAddMemberRequest, type FFIDAddMemberResponse, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDAssignableMemberRole, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckServiceAccessParams, type FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, type FFIDCreateCheckoutParams, type FFIDCreatePortalParams, FFIDError, type FFIDErrorCode, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, type FFIDInvitationStatus, type FFIDInviteMemberRequest, type FFIDInviteMemberResponse, type FFIDLeaveOrganizationParams, type FFIDLeaveOrganizationResponse, type FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, type FFIDLoginHistoryEntry, type FFIDLoginHistoryResponse, type FFIDMemberRole, type FFIDMemberStatus, type FFIDNewsletterBodySource, type FFIDNewsletterCampaignStatus, type FFIDNewsletterClient, type FFIDNewsletterConfirmParams, type FFIDNewsletterConfirmResponse, type FFIDNewsletterDispatchParams, type FFIDNewsletterDispatchResponse, type FFIDNewsletterSegment, type FFIDNewsletterSubscribeParams, type FFIDNewsletterSubscribeResponse, type FFIDNewsletterType, type FFIDNewsletterUnsubscribeParams, type FFIDNewsletterUnsubscribeResponse, type FFIDOAuthTokenResponse, FFIDOAuthUserInfo, FFIDOAuthUserInfoSubscription, FFIDOrganization, type FFIDOrganizationDomain, type FFIDOrganizationDomainsResponse, type FFIDOrganizationMember, type FFIDOrganizationNotificationPreferences, type FFIDOrganizationNotificationPreferencesResponse, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreview, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, type FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, type FFIDPreviewSeatChangeParams, type FFIDProfileCallOptions, FFIDProvider, type FFIDProviderProps, type FFIDProvisionMemberPlan, type FFIDProvisionMemberPlanStatus, type FFIDProvisionMemberResult, type FFIDProvisionMemberStatus, type FFIDProvisionOrganizationDryRun, type FFIDProvisionOrganizationMemberInput, type FFIDProvisionOrganizationOutcome, type FFIDProvisionOrganizationParams, type FFIDProvisionOrganizationResponse, type FFIDProvisionUserDryRun, type FFIDProvisionUserOutcome, type FFIDProvisionUserParams, type FFIDProvisionUserProfileInput, type FFIDProvisionUserResponse, type FFIDProvisionedOrganization, type FFIDProvisionedUser, type FFIDRedirectErrorCode, type FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDSeatChangeLineItem, type FFIDSeatChangePreview, type FFIDSeatChangePreviewResponse, FFIDServiceAccessDecision, type FFIDServiceInfo, FFIDSessionResponse, FFIDSignOutResult, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, type FFIDSupportedCurrency, type FFIDTokenIntrospectionResponse, type FFIDUpdateMemberRoleResponse, type FFIDUpdateNotificationPreferencesRequest, type FFIDUpdateUserProfileRequest, FFIDUser, type FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_ERROR_CODES, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, type HandleRedirectCallbackClient, type HandleRedirectCallbackOptions, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, retrieveState, storeCodeVerifier, storeState, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };