@feelflow/ffid-sdk 5.24.3 → 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.
@@ -114,6 +114,14 @@ function isSessionEligibleSubscriptionStatus(value) {
114
114
  function hasOwnKey(value, key) {
115
115
  return Object.prototype.hasOwnProperty.call(value, key);
116
116
  }
117
+ function normalizeEntitlements(raw) {
118
+ if (!Array.isArray(raw)) return [];
119
+ return raw.flatMap((code) => {
120
+ if (typeof code !== "string") return [];
121
+ const trimmed = code.trim();
122
+ return trimmed.length > 0 ? [trimmed] : [];
123
+ });
124
+ }
117
125
  function normalizeUserinfo(raw) {
118
126
  const hasOrganizationId = hasOwnKey(raw, "organization_id");
119
127
  const hasOrganizationName = hasOwnKey(raw, "organization_name");
@@ -154,7 +162,10 @@ function normalizeUserinfo(raw) {
154
162
  // `'active_canceling'`) for legacy backends. Defaulting to `false`
155
163
  // here keeps the downstream contract a plain boolean.
156
164
  cancelAtPeriodEnd: raw.subscription.cancel_at_period_end ?? false,
157
- currentPeriodEnd: raw.subscription.current_period_end ?? null
165
+ currentPeriodEnd: raw.subscription.current_period_end ?? null,
166
+ // #4333: legacy FFID (< this issue) omits the field on the wire; the
167
+ // guard defaults to `[]` so consumers always get a plain string[].
168
+ entitlements: normalizeEntitlements(raw.subscription.entitlements)
158
169
  } : void 0
159
170
  };
160
171
  }
@@ -441,7 +452,11 @@ function createVerifyAccessToken(deps) {
441
452
  member_role: introspectResponse.subscription.member_role,
442
453
  organization_id: introspectResponse.subscription.organization_id,
443
454
  organization_name: introspectResponse.subscription.organization_name ?? null,
444
- has_seat_assignment: introspectResponse.subscription.has_seat_assignment ?? false
455
+ has_seat_assignment: introspectResponse.subscription.has_seat_assignment ?? false,
456
+ // #4333: forward pack entitlement codes through the introspect →
457
+ // userinfo normalization boundary. normalizeUserinfo guards the
458
+ // value, so an older FFID that omits it degrades to `[]`.
459
+ entitlements: introspectResponse.subscription.entitlements
445
460
  }
446
461
  } : base;
447
462
  const userinfo = normalizeUserinfo(raw);
@@ -1254,7 +1269,7 @@ function validateTokenResponse(tokenResponse) {
1254
1269
  }
1255
1270
 
1256
1271
  // src/client/version-check.ts
1257
- var SDK_VERSION = "5.24.3";
1272
+ var SDK_VERSION = "5.25.0";
1258
1273
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
1259
1274
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
1260
1275
  function sdkHeaders() {
@@ -116,6 +116,14 @@ function isSessionEligibleSubscriptionStatus(value) {
116
116
  function hasOwnKey(value, key) {
117
117
  return Object.prototype.hasOwnProperty.call(value, key);
118
118
  }
119
+ function normalizeEntitlements(raw) {
120
+ if (!Array.isArray(raw)) return [];
121
+ return raw.flatMap((code) => {
122
+ if (typeof code !== "string") return [];
123
+ const trimmed = code.trim();
124
+ return trimmed.length > 0 ? [trimmed] : [];
125
+ });
126
+ }
119
127
  function normalizeUserinfo(raw) {
120
128
  const hasOrganizationId = hasOwnKey(raw, "organization_id");
121
129
  const hasOrganizationName = hasOwnKey(raw, "organization_name");
@@ -156,7 +164,10 @@ function normalizeUserinfo(raw) {
156
164
  // `'active_canceling'`) for legacy backends. Defaulting to `false`
157
165
  // here keeps the downstream contract a plain boolean.
158
166
  cancelAtPeriodEnd: raw.subscription.cancel_at_period_end ?? false,
159
- currentPeriodEnd: raw.subscription.current_period_end ?? null
167
+ currentPeriodEnd: raw.subscription.current_period_end ?? null,
168
+ // #4333: legacy FFID (< this issue) omits the field on the wire; the
169
+ // guard defaults to `[]` so consumers always get a plain string[].
170
+ entitlements: normalizeEntitlements(raw.subscription.entitlements)
160
171
  } : void 0
161
172
  };
162
173
  }
@@ -443,7 +454,11 @@ function createVerifyAccessToken(deps) {
443
454
  member_role: introspectResponse.subscription.member_role,
444
455
  organization_id: introspectResponse.subscription.organization_id,
445
456
  organization_name: introspectResponse.subscription.organization_name ?? null,
446
- has_seat_assignment: introspectResponse.subscription.has_seat_assignment ?? false
457
+ has_seat_assignment: introspectResponse.subscription.has_seat_assignment ?? false,
458
+ // #4333: forward pack entitlement codes through the introspect →
459
+ // userinfo normalization boundary. normalizeUserinfo guards the
460
+ // value, so an older FFID that omits it degrades to `[]`.
461
+ entitlements: introspectResponse.subscription.entitlements
447
462
  }
448
463
  } : base;
449
464
  const userinfo = normalizeUserinfo(raw);
@@ -1256,7 +1271,7 @@ function validateTokenResponse(tokenResponse) {
1256
1271
  }
1257
1272
 
1258
1273
  // src/client/version-check.ts
1259
- var SDK_VERSION = "5.24.3";
1274
+ var SDK_VERSION = "5.25.0";
1260
1275
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
1261
1276
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
1262
1277
  function sdkHeaders() {
@@ -1,34 +1,34 @@
1
1
  'use strict';
2
2
 
3
- var chunkAMVL7J2G_cjs = require('../chunk-AMVL7J2G.cjs');
3
+ var chunkZFKXOTFF_cjs = require('../chunk-ZFKXOTFF.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunkAMVL7J2G_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunkZFKXOTFF_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunkAMVL7J2G_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunkZFKXOTFF_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDInquiryForm", {
16
16
  enumerable: true,
17
- get: function () { return chunkAMVL7J2G_cjs.FFIDInquiryForm; }
17
+ get: function () { return chunkZFKXOTFF_cjs.FFIDInquiryForm; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDLoginButton", {
20
20
  enumerable: true,
21
- get: function () { return chunkAMVL7J2G_cjs.FFIDLoginButton; }
21
+ get: function () { return chunkZFKXOTFF_cjs.FFIDLoginButton; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
24
24
  enumerable: true,
25
- get: function () { return chunkAMVL7J2G_cjs.FFIDOrganizationSwitcher; }
25
+ get: function () { return chunkZFKXOTFF_cjs.FFIDOrganizationSwitcher; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
28
28
  enumerable: true,
29
- get: function () { return chunkAMVL7J2G_cjs.FFIDSubscriptionBadge; }
29
+ get: function () { return chunkZFKXOTFF_cjs.FFIDSubscriptionBadge; }
30
30
  });
31
31
  Object.defineProperty(exports, "FFIDUserMenu", {
32
32
  enumerable: true,
33
- get: function () { return chunkAMVL7J2G_cjs.FFIDUserMenu; }
33
+ get: function () { return chunkZFKXOTFF_cjs.FFIDUserMenu; }
34
34
  });
@@ -1,3 +1,3 @@
1
- export { H as FFIDAnnouncementBadge, al as FFIDAnnouncementBadgeClassNames, am as FFIDAnnouncementBadgeProps, I as FFIDAnnouncementList, an as FFIDAnnouncementListClassNames, ao as FFIDAnnouncementListProps, S as FFIDInquiryForm, U as FFIDInquiryFormCategoryItem, V as FFIDInquiryFormClassNames, W as FFIDInquiryFormLegalLayout, X as FFIDInquiryFormOrganization, Y as FFIDInquiryFormPlaceholderContext, Z as FFIDInquiryFormPrefill, _ as FFIDInquiryFormProps, $ as FFIDInquiryFormSubmitData, a0 as FFIDInquiryFormSubmitResult, a2 as FFIDLoginButton, ap as FFIDLoginButtonProps, a5 as FFIDOrganizationSwitcher, aq as FFIDOrganizationSwitcherClassNames, ar as FFIDOrganizationSwitcherProps, aa as FFIDSubscriptionBadge, as as FFIDSubscriptionBadgeClassNames, at as FFIDSubscriptionBadgeProps, ac as FFIDUserMenu, au as FFIDUserMenuClassNames, av as FFIDUserMenuProps } from '../index-BRMn6xT0.cjs';
1
+ export { G as FFIDAnnouncementBadge, ah as FFIDAnnouncementBadgeClassNames, ai as FFIDAnnouncementBadgeProps, H as FFIDAnnouncementList, aj as FFIDAnnouncementListClassNames, ak as FFIDAnnouncementListProps, 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, a1 as FFIDLoginButton, al as FFIDLoginButtonProps, a3 as FFIDOrganizationSwitcher, am as FFIDOrganizationSwitcherClassNames, an as FFIDOrganizationSwitcherProps, a7 as FFIDSubscriptionBadge, ao as FFIDSubscriptionBadgeClassNames, ap as FFIDSubscriptionBadgeProps, a8 as FFIDUserMenu, aq as FFIDUserMenuClassNames, ar as FFIDUserMenuProps } from '../index-Dd6CMIBd.cjs';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
- export { H as FFIDAnnouncementBadge, al as FFIDAnnouncementBadgeClassNames, am as FFIDAnnouncementBadgeProps, I as FFIDAnnouncementList, an as FFIDAnnouncementListClassNames, ao as FFIDAnnouncementListProps, S as FFIDInquiryForm, U as FFIDInquiryFormCategoryItem, V as FFIDInquiryFormClassNames, W as FFIDInquiryFormLegalLayout, X as FFIDInquiryFormOrganization, Y as FFIDInquiryFormPlaceholderContext, Z as FFIDInquiryFormPrefill, _ as FFIDInquiryFormProps, $ as FFIDInquiryFormSubmitData, a0 as FFIDInquiryFormSubmitResult, a2 as FFIDLoginButton, ap as FFIDLoginButtonProps, a5 as FFIDOrganizationSwitcher, aq as FFIDOrganizationSwitcherClassNames, ar as FFIDOrganizationSwitcherProps, aa as FFIDSubscriptionBadge, as as FFIDSubscriptionBadgeClassNames, at as FFIDSubscriptionBadgeProps, ac as FFIDUserMenu, au as FFIDUserMenuClassNames, av as FFIDUserMenuProps } from '../index-BRMn6xT0.js';
1
+ export { G as FFIDAnnouncementBadge, ah as FFIDAnnouncementBadgeClassNames, ai as FFIDAnnouncementBadgeProps, H as FFIDAnnouncementList, aj as FFIDAnnouncementListClassNames, ak as FFIDAnnouncementListProps, 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, a1 as FFIDLoginButton, al as FFIDLoginButtonProps, a3 as FFIDOrganizationSwitcher, am as FFIDOrganizationSwitcherClassNames, an as FFIDOrganizationSwitcherProps, a7 as FFIDSubscriptionBadge, ao as FFIDSubscriptionBadgeClassNames, ap as FFIDSubscriptionBadgeProps, a8 as FFIDUserMenu, aq as FFIDUserMenuClassNames, ar as FFIDUserMenuProps } from '../index-Dd6CMIBd.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-O3HGRALD.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-HIKX4AVY.js';
@@ -1345,6 +1345,57 @@ interface FFIDUpdateUserProfileRequest {
1345
1345
  preferences?: Record<string, unknown> | null;
1346
1346
  }
1347
1347
 
1348
+ /**
1349
+ * OAuth flow types: client-side redirect results and OAuth token / RFC 7662
1350
+ * introspection payloads.
1351
+ *
1352
+ * Extracted from `types/index.ts` to keep that barrel under the 800-line hard
1353
+ * limit (`scripts/check-file-size.sh`). Re-exported from `types/index.ts`, so
1354
+ * the public API is unchanged — import from `@feelflow/ffid-sdk` as before.
1355
+ */
1356
+
1357
+ /**
1358
+ * Discriminant for redirect failures that callers need to handle
1359
+ * programmatically (vs. logging the human-readable `error` string).
1360
+ *
1361
+ * - `'redirect_loop_detected'`: `redirectToAuthorize()` detected that the
1362
+ * same authorize URL (keyed by `baseUrl + client_id + organization_id`)
1363
+ * has been fired **3 times within 60 seconds**. Caller should surface a
1364
+ * manual "再度ログインする" UI rather than retry automatically (#2406 / #2411).
1365
+ *
1366
+ * - `'state_persistence_failed'`: `redirectToAuthorize()` could not persist
1367
+ * the OAuth CSRF `state` (storage unavailable / quota). Redirect is aborted
1368
+ * fail-closed (#4136) — callers should surface a manual retry UI.
1369
+ *
1370
+ * Other failure paths (SSR environment, PKCE generation failure, empty
1371
+ * organizationId) currently return `error` without a `code`. Treat this union
1372
+ * as forward-extensible and do NOT exhaustively `switch` over it without a
1373
+ * `default` branch for consumer code that must stay compatible across SDK
1374
+ * upgrades.
1375
+ */
1376
+ type FFIDRedirectErrorCode = 'redirect_loop_detected' | 'state_persistence_failed';
1377
+ /**
1378
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
1379
+ *
1380
+ * Structured return type so callers can inspect failure reasons
1381
+ * instead of receiving a bare `false`. When `code` is set, branch on it
1382
+ * for programmatic handling; otherwise log `error` for humans.
1383
+ *
1384
+ * `loopDetectionDisabled` (#4119): set to `true` when sessionStorage is
1385
+ * unavailable (iOS WebKit private mode / eviction) so redirect-loop detection
1386
+ * ran **fail-open** — the redirect fired, but repeated-redirect protection is
1387
+ * disabled for this browser session. Callers that need loop protection on
1388
+ * such browsers should add their own max-retry guard.
1389
+ */
1390
+ type FFIDRedirectResult = {
1391
+ success: true;
1392
+ loopDetectionDisabled?: boolean;
1393
+ } | {
1394
+ success: false;
1395
+ error: string;
1396
+ code?: FFIDRedirectErrorCode;
1397
+ };
1398
+
1348
1399
  /**
1349
1400
  * FFID SDK Type Definitions
1350
1401
  *
@@ -1488,6 +1539,19 @@ interface FFIDOAuthUserInfoSubscription {
1488
1539
  * round-trip.
1489
1540
  */
1490
1541
  currentPeriodEnd: string | null;
1542
+ /**
1543
+ * Per-service entitlement codes (e.g. `praxis.pack.<slug>.access`) granting
1544
+ * access to one-time / single-pack purchases not encoded in the plan tier
1545
+ * (#4333, SDK 5.25.0). Read this list to gate per-pack access; an empty
1546
+ * array means "no pack entitlements" (the normal case for Pro / Team tiers
1547
+ * that unlock packs via `planCode`).
1548
+ *
1549
+ * The `normalizeUserinfo` boundary defaults this to `[]` when the server
1550
+ * omits it (older FFID pre-#4333) or when the introspect path uses a service
1551
+ * API key without `subscription:read`, so consumers always see a plain
1552
+ * `readonly string[]` and never branch on an "unknown" sentinel.
1553
+ */
1554
+ entitlements: readonly string[];
1491
1555
  }
1492
1556
  /**
1493
1557
  * Unified user-identity shape returned by `getSession()` (→ `/oauth/userinfo`)
@@ -1789,47 +1853,6 @@ interface FFIDAnalyticsConfig {
1789
1853
  */
1790
1854
  isActive: boolean;
1791
1855
  }
1792
- /**
1793
- * Discriminant for redirect failures that callers need to handle
1794
- * programmatically (vs. logging the human-readable `error` string).
1795
- *
1796
- * - `'redirect_loop_detected'`: `redirectToAuthorize()` detected that the
1797
- * same authorize URL (keyed by `baseUrl + client_id + organization_id`)
1798
- * has been fired **3 times within 60 seconds**. Caller should surface a
1799
- * manual "再度ログインする" UI rather than retry automatically (#2406 / #2411).
1800
- *
1801
- * - `'state_persistence_failed'`: `redirectToAuthorize()` could not persist
1802
- * the OAuth CSRF `state` (storage unavailable / quota). Redirect is aborted
1803
- * fail-closed (#4136) — callers should surface a manual retry UI.
1804
- *
1805
- * Other failure paths (SSR environment, PKCE generation failure, empty
1806
- * organizationId) currently return `error` without a `code`. Treat this union
1807
- * as forward-extensible and do NOT exhaustively `switch` over it without a
1808
- * `default` branch for consumer code that must stay compatible across SDK
1809
- * upgrades.
1810
- */
1811
- type FFIDRedirectErrorCode = 'redirect_loop_detected' | 'state_persistence_failed';
1812
- /**
1813
- * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
1814
- *
1815
- * Structured return type so callers can inspect failure reasons
1816
- * instead of receiving a bare `false`. When `code` is set, branch on it
1817
- * for programmatic handling; otherwise log `error` for humans.
1818
- *
1819
- * `loopDetectionDisabled` (#4119): set to `true` when sessionStorage is
1820
- * unavailable (iOS WebKit private mode / eviction) so redirect-loop detection
1821
- * ran **fail-open** — the redirect fired, but repeated-redirect protection is
1822
- * disabled for this browser session. Callers that need loop protection on
1823
- * such browsers should add their own max-retry guard.
1824
- */
1825
- type FFIDRedirectResult = {
1826
- success: true;
1827
- loopDetectionDisabled?: boolean;
1828
- } | {
1829
- success: false;
1830
- error: string;
1831
- code?: FFIDRedirectErrorCode;
1832
- };
1833
1856
 
1834
1857
  /** OTP / magic link methods - sendOtp / verifyOtp */
1835
1858
 
@@ -1345,6 +1345,57 @@ interface FFIDUpdateUserProfileRequest {
1345
1345
  preferences?: Record<string, unknown> | null;
1346
1346
  }
1347
1347
 
1348
+ /**
1349
+ * OAuth flow types: client-side redirect results and OAuth token / RFC 7662
1350
+ * introspection payloads.
1351
+ *
1352
+ * Extracted from `types/index.ts` to keep that barrel under the 800-line hard
1353
+ * limit (`scripts/check-file-size.sh`). Re-exported from `types/index.ts`, so
1354
+ * the public API is unchanged — import from `@feelflow/ffid-sdk` as before.
1355
+ */
1356
+
1357
+ /**
1358
+ * Discriminant for redirect failures that callers need to handle
1359
+ * programmatically (vs. logging the human-readable `error` string).
1360
+ *
1361
+ * - `'redirect_loop_detected'`: `redirectToAuthorize()` detected that the
1362
+ * same authorize URL (keyed by `baseUrl + client_id + organization_id`)
1363
+ * has been fired **3 times within 60 seconds**. Caller should surface a
1364
+ * manual "再度ログインする" UI rather than retry automatically (#2406 / #2411).
1365
+ *
1366
+ * - `'state_persistence_failed'`: `redirectToAuthorize()` could not persist
1367
+ * the OAuth CSRF `state` (storage unavailable / quota). Redirect is aborted
1368
+ * fail-closed (#4136) — callers should surface a manual retry UI.
1369
+ *
1370
+ * Other failure paths (SSR environment, PKCE generation failure, empty
1371
+ * organizationId) currently return `error` without a `code`. Treat this union
1372
+ * as forward-extensible and do NOT exhaustively `switch` over it without a
1373
+ * `default` branch for consumer code that must stay compatible across SDK
1374
+ * upgrades.
1375
+ */
1376
+ type FFIDRedirectErrorCode = 'redirect_loop_detected' | 'state_persistence_failed';
1377
+ /**
1378
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
1379
+ *
1380
+ * Structured return type so callers can inspect failure reasons
1381
+ * instead of receiving a bare `false`. When `code` is set, branch on it
1382
+ * for programmatic handling; otherwise log `error` for humans.
1383
+ *
1384
+ * `loopDetectionDisabled` (#4119): set to `true` when sessionStorage is
1385
+ * unavailable (iOS WebKit private mode / eviction) so redirect-loop detection
1386
+ * ran **fail-open** — the redirect fired, but repeated-redirect protection is
1387
+ * disabled for this browser session. Callers that need loop protection on
1388
+ * such browsers should add their own max-retry guard.
1389
+ */
1390
+ type FFIDRedirectResult = {
1391
+ success: true;
1392
+ loopDetectionDisabled?: boolean;
1393
+ } | {
1394
+ success: false;
1395
+ error: string;
1396
+ code?: FFIDRedirectErrorCode;
1397
+ };
1398
+
1348
1399
  /**
1349
1400
  * FFID SDK Type Definitions
1350
1401
  *
@@ -1488,6 +1539,19 @@ interface FFIDOAuthUserInfoSubscription {
1488
1539
  * round-trip.
1489
1540
  */
1490
1541
  currentPeriodEnd: string | null;
1542
+ /**
1543
+ * Per-service entitlement codes (e.g. `praxis.pack.<slug>.access`) granting
1544
+ * access to one-time / single-pack purchases not encoded in the plan tier
1545
+ * (#4333, SDK 5.25.0). Read this list to gate per-pack access; an empty
1546
+ * array means "no pack entitlements" (the normal case for Pro / Team tiers
1547
+ * that unlock packs via `planCode`).
1548
+ *
1549
+ * The `normalizeUserinfo` boundary defaults this to `[]` when the server
1550
+ * omits it (older FFID pre-#4333) or when the introspect path uses a service
1551
+ * API key without `subscription:read`, so consumers always see a plain
1552
+ * `readonly string[]` and never branch on an "unknown" sentinel.
1553
+ */
1554
+ entitlements: readonly string[];
1491
1555
  }
1492
1556
  /**
1493
1557
  * Unified user-identity shape returned by `getSession()` (→ `/oauth/userinfo`)
@@ -1789,47 +1853,6 @@ interface FFIDAnalyticsConfig {
1789
1853
  */
1790
1854
  isActive: boolean;
1791
1855
  }
1792
- /**
1793
- * Discriminant for redirect failures that callers need to handle
1794
- * programmatically (vs. logging the human-readable `error` string).
1795
- *
1796
- * - `'redirect_loop_detected'`: `redirectToAuthorize()` detected that the
1797
- * same authorize URL (keyed by `baseUrl + client_id + organization_id`)
1798
- * has been fired **3 times within 60 seconds**. Caller should surface a
1799
- * manual "再度ログインする" UI rather than retry automatically (#2406 / #2411).
1800
- *
1801
- * - `'state_persistence_failed'`: `redirectToAuthorize()` could not persist
1802
- * the OAuth CSRF `state` (storage unavailable / quota). Redirect is aborted
1803
- * fail-closed (#4136) — callers should surface a manual retry UI.
1804
- *
1805
- * Other failure paths (SSR environment, PKCE generation failure, empty
1806
- * organizationId) currently return `error` without a `code`. Treat this union
1807
- * as forward-extensible and do NOT exhaustively `switch` over it without a
1808
- * `default` branch for consumer code that must stay compatible across SDK
1809
- * upgrades.
1810
- */
1811
- type FFIDRedirectErrorCode = 'redirect_loop_detected' | 'state_persistence_failed';
1812
- /**
1813
- * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
1814
- *
1815
- * Structured return type so callers can inspect failure reasons
1816
- * instead of receiving a bare `false`. When `code` is set, branch on it
1817
- * for programmatic handling; otherwise log `error` for humans.
1818
- *
1819
- * `loopDetectionDisabled` (#4119): set to `true` when sessionStorage is
1820
- * unavailable (iOS WebKit private mode / eviction) so redirect-loop detection
1821
- * ran **fail-open** — the redirect fired, but repeated-redirect protection is
1822
- * disabled for this browser session. Callers that need loop protection on
1823
- * such browsers should add their own max-retry guard.
1824
- */
1825
- type FFIDRedirectResult = {
1826
- success: true;
1827
- loopDetectionDisabled?: boolean;
1828
- } | {
1829
- success: false;
1830
- error: string;
1831
- code?: FFIDRedirectErrorCode;
1832
- };
1833
1856
 
1834
1857
  /** OTP / magic link methods - sendOtp / verifyOtp */
1835
1858
 
@@ -354,6 +354,19 @@ interface FFIDOAuthUserInfoSubscription {
354
354
  * round-trip.
355
355
  */
356
356
  currentPeriodEnd: string | null;
357
+ /**
358
+ * Per-service entitlement codes (e.g. `praxis.pack.<slug>.access`) granting
359
+ * access to one-time / single-pack purchases not encoded in the plan tier
360
+ * (#4333, SDK 5.25.0). Read this list to gate per-pack access; an empty
361
+ * array means "no pack entitlements" (the normal case for Pro / Team tiers
362
+ * that unlock packs via `planCode`).
363
+ *
364
+ * The `normalizeUserinfo` boundary defaults this to `[]` when the server
365
+ * omits it (older FFID pre-#4333) or when the introspect path uses a service
366
+ * API key without `subscription:read`, so consumers always see a plain
367
+ * `readonly string[]` and never branch on an "unknown" sentinel.
368
+ */
369
+ entitlements: readonly string[];
357
370
  }
358
371
  /**
359
372
  * Unified user-identity shape returned by `getSession()` (→ `/oauth/userinfo`)
@@ -811,97 +824,6 @@ interface FFIDAnalyticsConfig {
811
824
  */
812
825
  isActive: boolean;
813
826
  }
814
- /**
815
- * Discriminant for redirect failures that callers need to handle
816
- * programmatically (vs. logging the human-readable `error` string).
817
- *
818
- * - `'redirect_loop_detected'`: `redirectToAuthorize()` detected that the
819
- * same authorize URL (keyed by `baseUrl + client_id + organization_id`)
820
- * has been fired **3 times within 60 seconds**. Caller should surface a
821
- * manual "再度ログインする" UI rather than retry automatically (#2406 / #2411).
822
- *
823
- * - `'state_persistence_failed'`: `redirectToAuthorize()` could not persist
824
- * the OAuth CSRF `state` (storage unavailable / quota). Redirect is aborted
825
- * fail-closed (#4136) — callers should surface a manual retry UI.
826
- *
827
- * Other failure paths (SSR environment, PKCE generation failure, empty
828
- * organizationId) currently return `error` without a `code`. Treat this union
829
- * as forward-extensible and do NOT exhaustively `switch` over it without a
830
- * `default` branch for consumer code that must stay compatible across SDK
831
- * upgrades.
832
- */
833
- type FFIDRedirectErrorCode = 'redirect_loop_detected' | 'state_persistence_failed';
834
- /**
835
- * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
836
- *
837
- * Structured return type so callers can inspect failure reasons
838
- * instead of receiving a bare `false`. When `code` is set, branch on it
839
- * for programmatic handling; otherwise log `error` for humans.
840
- *
841
- * `loopDetectionDisabled` (#4119): set to `true` when sessionStorage is
842
- * unavailable (iOS WebKit private mode / eviction) so redirect-loop detection
843
- * ran **fail-open** — the redirect fired, but repeated-redirect protection is
844
- * disabled for this browser session. Callers that need loop protection on
845
- * such browsers should add their own max-retry guard.
846
- */
847
- type FFIDRedirectResult = {
848
- success: true;
849
- loopDetectionDisabled?: boolean;
850
- } | {
851
- success: false;
852
- error: string;
853
- code?: FFIDRedirectErrorCode;
854
- };
855
- /**
856
- * OAuth 2.0 token response from FFID token endpoint
857
- */
858
- interface FFIDOAuthTokenResponse {
859
- access_token: string;
860
- token_type: 'Bearer';
861
- expires_in: number;
862
- refresh_token: string;
863
- }
864
- /**
865
- * RFC 7662 Token Introspection response (raw format from server)
866
- *
867
- * Used internally by verifyAccessToken(). Consumers receive the normalized
868
- * FFIDOAuthUserInfo type instead.
869
- *
870
- * @see https://tools.ietf.org/html/rfc7662
871
- */
872
- interface FFIDTokenIntrospectionResponse {
873
- active: boolean;
874
- sub?: string;
875
- email?: string;
876
- /** Whether the user's email is verified (#3791). Optional for backward compat with older FFID. */
877
- email_verified?: boolean;
878
- name?: string;
879
- picture?: string | null;
880
- company_name?: string | null;
881
- department?: string | null;
882
- position?: string | null;
883
- phone_number?: string | null;
884
- scope?: string | null;
885
- exp?: number;
886
- iat?: number;
887
- iss?: string;
888
- token_type?: 'Bearer';
889
- client_id?: string;
890
- organization_id?: string | null;
891
- organization_name?: string | null;
892
- subscription?: {
893
- subscription_id: string | null;
894
- status: FFIDOAuthUserInfoSubscription['status'];
895
- /** Optional for backward compat with older FFID (< 5.3.0 / #3353). */
896
- effective_status?: FFIDOAuthUserInfoSubscription['effectiveStatus'];
897
- plan_code: string | null;
898
- seat_model: FFIDOAuthUserInfoSubscription['seatModel'];
899
- member_role: FFIDOAuthUserInfoSubscription['memberRole'];
900
- organization_id: string | null;
901
- organization_name?: string | null;
902
- has_seat_assignment?: boolean;
903
- };
904
- }
905
827
 
906
828
  /**
907
829
  * FFID Announcements SDK Type Definitions
@@ -1602,4 +1524,4 @@ interface FFIDInquiryFormPlaceholderContext {
1602
1524
  }
1603
1525
  declare function FFIDInquiryForm({ mode, prefill, organizations, preselectedOrganizationId, categories, termsVersion, privacyVersion, termsHref, privacyHref, turnstileToken, turnstileSlot, onSubmit, onChange, legalLayout, messagePlaceholder, requireCategorySelection, unstyled, classNames, locale, className, }: FFIDInquiryFormProps): react_jsx_runtime.JSX.Element;
1604
1526
 
1605
- export { type FFIDInquiryFormSubmitData as $, type AnnouncementListResponse as A, type Announcement as B, type AnnouncementStatus as C, type AnnouncementType as D, type EffectiveSubscriptionStatus as E, type FFIDSubscriptionStatus as F, EFFECTIVE_SUBSCRIPTION_STATUSES as G, FFIDAnnouncementBadge as H, FFIDAnnouncementList as I, type FFIDAnnouncementsError as J, type FFIDAnnouncementsErrorCode as K, type ListAnnouncementsOptions as L, type FFIDAnnouncementsServerResponse as M, type FFIDApiResponseMeta as N, type FFIDCacheConfig as O, type FFIDContextValue as P, type FFIDInquiryCategory as Q, type FFIDInquiryCategorySite2026 as R, FFIDInquiryForm as S, type TokenStore as T, type FFIDInquiryFormCategoryItem as U, type FFIDInquiryFormClassNames as V, type FFIDInquiryFormLegalLayout as W, type FFIDInquiryFormOrganization as X, type FFIDInquiryFormPlaceholderContext as Y, type FFIDInquiryFormPrefill as Z, type FFIDInquiryFormProps as _, type FFIDPrompt as a, type FFIDInquiryFormSubmitResult as a0, type FFIDJwtClaims as a1, FFIDLoginButton as a2, type FFIDOAuthTokenResponse as a3, type FFIDOAuthUserInfoMemberRole as a4, FFIDOrganizationSwitcher as a5, type FFIDRedirectErrorCode as a6, type FFIDSeatModel as a7, type FFIDServiceAccessDenialReason as a8, type FFIDServiceAccessFailPolicy as a9, FFIDSubscriptionBadge as aa, type FFIDTokenIntrospectionResponse as ab, FFIDUserMenu as ac, FFID_INQUIRY_CATEGORIES as ad, FFID_INQUIRY_CATEGORIES_SITE_2026 as ae, type TokenData as af, type UseFFIDAnnouncementsOptions as ag, type UseFFIDAnnouncementsReturn as ah, createTokenStore as ai, isFFIDInquiryCategorySite2026 as aj, useFFIDAnnouncements as ak, type FFIDAnnouncementBadgeClassNames as al, type FFIDAnnouncementBadgeProps as am, type FFIDAnnouncementListClassNames as an, type FFIDAnnouncementListProps as ao, type FFIDLoginButtonProps as ap, type FFIDOrganizationSwitcherClassNames as aq, type FFIDOrganizationSwitcherProps as ar, type FFIDSubscriptionBadgeClassNames as as, type FFIDSubscriptionBadgeProps as at, type FFIDUserMenuClassNames as au, type FFIDUserMenuProps as av, type FFIDConfig as b, type FFIDApiResponse as c, type FFIDSessionResponse as d, type FFIDSignOutResult as e, type FFIDRedirectResult as f, type FFIDError as g, type FFIDSubscriptionCheckResponse as h, type FFIDCheckServiceAccessParams as i, type FFIDServiceAccessDecision as j, type FFIDAnalyticsConfig as k, type FFIDVerifyAccessTokenOptions as l, type FFIDOAuthUserInfo as m, type FFIDInquiryCreateParams as n, type FFIDInquiryCreateResponse as o, type FFIDAuthMode as p, type FFIDLogger as q, type FFIDCacheAdapter as r, type FFIDUser as s, type FFIDOrganization as t, type FFIDSubscription as u, type FFIDSubscriptionContextValue as v, type FFIDOAuthUserInfoSubscription as w, type FFIDAnnouncementsClientConfig as x, type FFIDAnnouncementsApiResponse as y, type FFIDAnnouncementsLogger as z };
1527
+ export { type FFIDInquiryFormSubmitResult as $, type AnnouncementListResponse as A, type AnnouncementStatus as B, type AnnouncementType as C, EFFECTIVE_SUBSCRIPTION_STATUSES as D, type EffectiveSubscriptionStatus as E, type FFIDSubscriptionStatus as F, FFIDAnnouncementBadge as G, FFIDAnnouncementList as H, type FFIDAnnouncementsError as I, type FFIDAnnouncementsErrorCode as J, type FFIDAnnouncementsServerResponse as K, type ListAnnouncementsOptions as L, type FFIDApiResponseMeta as M, type FFIDCacheConfig as N, type FFIDContextValue as O, type FFIDInquiryCategory as P, type FFIDInquiryCategorySite2026 as Q, FFIDInquiryForm as R, type FFIDInquiryFormCategoryItem as S, type TokenStore as T, type FFIDInquiryFormClassNames as U, type FFIDInquiryFormLegalLayout as V, type FFIDInquiryFormOrganization as W, type FFIDInquiryFormPlaceholderContext as X, type FFIDInquiryFormPrefill as Y, type FFIDInquiryFormProps as Z, type FFIDInquiryFormSubmitData as _, type FFIDOAuthUserInfoSubscription as a, type FFIDJwtClaims as a0, FFIDLoginButton as a1, type FFIDOAuthUserInfoMemberRole as a2, FFIDOrganizationSwitcher as a3, type FFIDSeatModel as a4, type FFIDServiceAccessDenialReason as a5, type FFIDServiceAccessFailPolicy as a6, FFIDSubscriptionBadge as a7, FFIDUserMenu as a8, FFID_INQUIRY_CATEGORIES as a9, FFID_INQUIRY_CATEGORIES_SITE_2026 as aa, type TokenData as ab, type UseFFIDAnnouncementsOptions as ac, type UseFFIDAnnouncementsReturn as ad, createTokenStore as ae, isFFIDInquiryCategorySite2026 as af, useFFIDAnnouncements as ag, type FFIDAnnouncementBadgeClassNames as ah, type FFIDAnnouncementBadgeProps as ai, type FFIDAnnouncementListClassNames as aj, type FFIDAnnouncementListProps as ak, type FFIDLoginButtonProps as al, type FFIDOrganizationSwitcherClassNames as am, type FFIDOrganizationSwitcherProps as an, type FFIDSubscriptionBadgeClassNames as ao, type FFIDSubscriptionBadgeProps as ap, type FFIDUserMenuClassNames as aq, type FFIDUserMenuProps as ar, type FFIDPrompt as b, type FFIDConfig as c, type FFIDApiResponse as d, type FFIDSessionResponse as e, type FFIDSignOutResult as f, type FFIDError as g, type FFIDSubscriptionCheckResponse as h, type FFIDCheckServiceAccessParams as i, type FFIDServiceAccessDecision as j, type FFIDAnalyticsConfig as k, type FFIDVerifyAccessTokenOptions as l, type FFIDOAuthUserInfo as m, type FFIDInquiryCreateParams as n, type FFIDInquiryCreateResponse as o, type FFIDAuthMode as p, type FFIDLogger as q, type FFIDCacheAdapter as r, type FFIDUser as s, type FFIDOrganization as t, type FFIDSubscription as u, type FFIDSubscriptionContextValue as v, type FFIDAnnouncementsClientConfig as w, type FFIDAnnouncementsApiResponse as x, type FFIDAnnouncementsLogger as y, type Announcement as z };