@feelflow/ffid-sdk 5.24.3 → 5.27.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.d.ts 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, 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 FFIDOAuthUserInfoSubscription, x as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, y as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, z as FFIDAnnouncementsLogger } from './index-BRMn6xT0.js';
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, 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, a1 as FFIDJwtClaims, a2 as FFIDLoginButton, a3 as FFIDOAuthTokenResponse, a4 as FFIDOAuthUserInfoMemberRole, a5 as FFIDOrganizationSwitcher, a6 as FFIDRedirectErrorCode, a7 as FFIDSeatModel, a8 as FFIDServiceAccessDenialReason, a9 as FFIDServiceAccessFailPolicy, aa as FFIDSubscriptionBadge, ab as FFIDTokenIntrospectionResponse, ac as FFIDUserMenu, ad as FFID_INQUIRY_CATEGORIES, ae as FFID_INQUIRY_CATEGORIES_SITE_2026, af as TokenData, ag as UseFFIDAnnouncementsOptions, ah as UseFFIDAnnouncementsReturn, ai as createTokenStore, aj as isFFIDInquiryCategorySite2026, ak as useFFIDAnnouncements } from './index-BRMn6xT0.js';
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-D3S_Pkkv.js';
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 FFIDSeatAssignmentClaim, a5 as FFIDSeatAssignmentStatus, a6 as FFIDSeatModel, a7 as FFIDServiceAccessDenialReason, a8 as FFIDServiceAccessFailPolicy, a9 as FFIDSubscriptionBadge, aa as FFIDUserMenu, ab as FFID_INQUIRY_CATEGORIES, ac as FFID_INQUIRY_CATEGORIES_SITE_2026, ad as TokenData, ae as UseFFIDAnnouncementsOptions, af as UseFFIDAnnouncementsReturn, ag as createTokenStore, ah as isFFIDInquiryCategorySite2026, ai as useFFIDAnnouncements } from './index-D3S_Pkkv.js';
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.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { ReactNode, ComponentType, FC } from 'react';
@@ -1151,6 +1151,218 @@ interface FFIDUpdateUserProfileRequest {
1151
1151
  preferences?: Record<string, unknown> | null;
1152
1152
  }
1153
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
+ seat_assignment?: {
1253
+ organization_id?: unknown;
1254
+ subscription_id?: unknown;
1255
+ status?: unknown;
1256
+ };
1257
+ /**
1258
+ * Optional for backward compat with older FFID (< #4333), and omitted when
1259
+ * the service API key has `token:introspect` without `subscription:read`.
1260
+ */
1261
+ entitlements?: readonly string[];
1262
+ };
1263
+ }
1264
+
1265
+ /** Deployment environments a catalog publication can apply to (single source) */
1266
+ declare const FFID_CATALOG_ENVIRONMENTS: readonly ["staging", "production"];
1267
+ /** Deployment environment a catalog publication applies to */
1268
+ type FFIDCatalogEnvironment = (typeof FFID_CATALOG_ENVIRONMENTS)[number];
1269
+ /**
1270
+ * Tax behavior of a published price.
1271
+ * `inclusive`: displayed price contains Stripe-calculated tax (Personal/Pro).
1272
+ * `exclusive`: tax is added on top of the base price (Team).
1273
+ */
1274
+ type FFIDTaxBehavior = 'inclusive' | 'exclusive';
1275
+ /**
1276
+ * Publication lifecycle statuses (single source — the type, the SDK runtime
1277
+ * validator, and consumer sets all derive from this tuple so a new literal
1278
+ * cannot be added to one side only).
1279
+ */
1280
+ declare const FFID_CATALOG_PUBLICATION_STATUSES: readonly ["approved", "superseded", "revoking", "revoked"];
1281
+ /**
1282
+ * Publication lifecycle status.
1283
+ * - `approved`: sellable — the only status that permits new paid checkout
1284
+ * - `superseded`: replaced by a newer revision (old sessions may sell through
1285
+ * until `sellThroughUntil`)
1286
+ * - `revoking`: emergency stop in progress — never sellable
1287
+ * - `revoked`: emergency stop completed — never sellable
1288
+ */
1289
+ type FFIDCatalogPublicationStatus = (typeof FFID_CATALOG_PUBLICATION_STATUSES)[number];
1290
+ /**
1291
+ * Human-approved publication record binding a catalog revision to the
1292
+ * content/config hashes reviewed at approval time.
1293
+ *
1294
+ * All `*Hash` fields are lowercase SHA-256 hex computed with the shared
1295
+ * canonicalization helpers in `shared/catalog-hash` — consumers re-hash the
1296
+ * content they actually render and must refuse new sales on any mismatch.
1297
+ */
1298
+ interface FFIDCatalogPublication {
1299
+ serviceCode: string;
1300
+ environment: FFIDCatalogEnvironment;
1301
+ catalogVersion: string;
1302
+ praxisCopyHash: string;
1303
+ ffidCheckoutCopyHash: string;
1304
+ legalDisclosureHash: string;
1305
+ taxConfigurationHash: string;
1306
+ paymentConfigurationHash: string;
1307
+ scopeHash: string;
1308
+ /** Monotonically increasing per (service, environment) publication counter */
1309
+ salesEpoch: number;
1310
+ /** FFID-generated immutable human-review approval ID */
1311
+ approvalId: string;
1312
+ /** ISO 8601 timestamp of the recorded human review */
1313
+ reviewedAt: string;
1314
+ /** ISO 8601 timestamp the publication became effective */
1315
+ effectiveAt: string;
1316
+ /** ISO 8601 timestamp the publication was superseded (null while current) */
1317
+ supersededAt: string | null;
1318
+ /** ISO 8601 upper bound for old-session sell-through (null unless superseded) */
1319
+ sellThroughUntil: string | null;
1320
+ /** ISO 8601 timestamp an emergency revoke took effect (null unless revoking/revoked) */
1321
+ revocationEffectiveAt: string | null;
1322
+ status: FFIDCatalogPublicationStatus;
1323
+ }
1324
+ /**
1325
+ * A plan inside a published catalog revision (public-safe snapshot).
1326
+ * Never contains Stripe Product/Price identifiers or other secrets.
1327
+ */
1328
+ interface FFIDPublishedPlan {
1329
+ /**
1330
+ * Plan code — always a lowercase slug (`^[a-z0-9][a-z0-9_-]*$`).
1331
+ * Per-service open set; see the FFID repo's
1332
+ * `docs/04-api/PLAN_CODE_CONTRACT.md` for the full guarantees.
1333
+ */
1334
+ code: string;
1335
+ name: string;
1336
+ description: string | null;
1337
+ /** Monthly price in the catalog currency; null when monthly is not offered */
1338
+ priceMonthly: number | null;
1339
+ /** Yearly price in the catalog currency; null when yearly is not offered */
1340
+ priceYearly: number | null;
1341
+ currency: string;
1342
+ /** Billing intervals actually purchasable for this plan */
1343
+ billingIntervals: FFIDBillingInterval[];
1344
+ taxBehavior: FFIDTaxBehavior;
1345
+ minSeats: number;
1346
+ maxSeats: number | null;
1347
+ displayOrder: number;
1348
+ }
1349
+ /**
1350
+ * Response of GET /api/v1/subscriptions/ext/catalog/{serviceCode}.
1351
+ *
1352
+ * `catalogVersion` always equals `publication.catalogVersion`; it is hoisted
1353
+ * to the top level so consumers can pin the version (e.g. as
1354
+ * `expectedCatalogVersion` for checkout) without digging into the publication.
1355
+ */
1356
+ interface FFIDPublishedCatalog {
1357
+ service: {
1358
+ code: string;
1359
+ name: string;
1360
+ };
1361
+ catalogVersion: string;
1362
+ publication: FFIDCatalogPublication;
1363
+ plans: FFIDPublishedPlan[];
1364
+ }
1365
+
1154
1366
  /** OTP / magic link methods - sendOtp / verifyOtp */
1155
1367
 
1156
1368
  /** Response from sendOtp */
@@ -1395,6 +1607,7 @@ declare function createFFIDClient(config: FFIDConfig): {
1395
1607
  assignSeats: (params: FFIDAssignSeatsParams) => Promise<FFIDApiResponse<FFIDAssignSeatsResponse>>;
1396
1608
  unassignSeat: (params: FFIDUnassignSeatParams) => Promise<FFIDApiResponse<FFIDUnassignSeatResponse>>;
1397
1609
  listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
1610
+ getPublishedCatalog: (serviceCode: string) => Promise<FFIDApiResponse<FFIDPublishedCatalog>>;
1398
1611
  getSubscription: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDSubscriptionDetail>>;
1399
1612
  subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
1400
1613
  changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
@@ -2125,6 +2338,183 @@ declare function hasAccessFromUserinfo(sub: FFIDOAuthUserInfoSubscription | null
2125
2338
  */
2126
2339
  declare function isBlockedFromUserinfo(sub: FFIDOAuthUserInfoSubscription | null | undefined): boolean;
2127
2340
 
2341
+ /**
2342
+ * Catalog approval hash helpers (#4342 / ASDD-PRICING-002 SP4A)
2343
+ *
2344
+ * Shared canonicalization + SHA-256 helpers that FIX the cross-repo hash
2345
+ * contract between FFID (publisher) and consumers (Praxis). Both sides compute
2346
+ * hashes with these helpers and refuse new sales on any mismatch, so the
2347
+ * canonical form below is a compatibility contract:
2348
+ *
2349
+ * 1. Objects serialize with keys sorted by UTF-16 code unit order,
2350
+ * recursively. Arrays keep their element order.
2351
+ * 2. Serialization is `JSON.stringify`-compatible per token (string
2352
+ * escaping, number formatting) with NO whitespace.
2353
+ * 3. `undefined`, non-finite numbers (NaN/±Infinity), functions, symbols,
2354
+ * bigints and non-plain objects (Date, Map, class instances) are
2355
+ * REJECTED with FFIDCatalogHashError — never silently dropped, because a
2356
+ * dropped key would let two semantically different payloads collide.
2357
+ * Only own enumerable string-keyed properties participate; symbol-keyed
2358
+ * properties are ignored (same as `JSON.stringify`).
2359
+ * 4. The hash is lowercase SHA-256 hex over the UTF-8 bytes of the
2360
+ * canonical string (no domain-separation prefix).
2361
+ *
2362
+ * Changing ANY of these rules is a breaking change to published catalog
2363
+ * verification and requires re-publishing catalogs — the fixed test vectors
2364
+ * in `__tests__/catalog-hash.test.ts` exist to make such a change loud.
2365
+ */
2366
+
2367
+ /** Lowercase SHA-256 hex format shared by all catalog approval hashes */
2368
+ declare const CATALOG_HASH_PATTERN: RegExp;
2369
+ /**
2370
+ * Thrown when a value cannot be canonicalized (or an embedded hash is
2371
+ * malformed). Always indicates a programming error on the hashing side —
2372
+ * never caused by end-user input.
2373
+ */
2374
+ declare class FFIDCatalogHashError extends Error {
2375
+ constructor(message: string);
2376
+ }
2377
+ /** JSON value accepted by the canonicalizer */
2378
+ type FFIDCanonicalJsonValue = string | number | boolean | null | FFIDCanonicalJsonValue[] | {
2379
+ [key: string]: FFIDCanonicalJsonValue;
2380
+ };
2381
+ /**
2382
+ * Serializes a JSON-plain value into its canonical string form (see module
2383
+ * doc for the exact rules). Exposed so both sides can debug hash mismatches
2384
+ * by diffing canonical strings instead of opaque digests.
2385
+ */
2386
+ declare function canonicalizeCatalogValue(value: FFIDCanonicalJsonValue): string;
2387
+ /**
2388
+ * Lowercase SHA-256 hex of the UTF-8 bytes of `text`.
2389
+ *
2390
+ * Requires Web Crypto (`globalThis.crypto.subtle`) — available by default in
2391
+ * Node.js >= 19 (Node 18 needs `--experimental-global-webcrypto`), browsers,
2392
+ * and edge runtimes. Throws instead of falling back to a weaker digest so a
2393
+ * missing crypto implementation can never silently change the contract.
2394
+ */
2395
+ declare function sha256Hex(text: string): Promise<string>;
2396
+ /** Canonicalizes `value` and returns its lowercase SHA-256 hex digest. */
2397
+ declare function hashCanonicalJson(value: FFIDCanonicalJsonValue): Promise<string>;
2398
+ /**
2399
+ * Human-approved tax configuration snapshot hashed into
2400
+ * `publication.taxConfigurationHash`. FFID re-computes this from its live
2401
+ * Stripe Tax settings at paid-checkout start and refuses the session on
2402
+ * mismatch.
2403
+ */
2404
+ interface FFIDTaxConfiguration {
2405
+ /** ISO 3166-1 alpha-2 country/region codes where paid sales are allowed */
2406
+ allowedCountries: string[];
2407
+ /** Country/region codes with completed Stripe Tax registrations */
2408
+ stripeTaxRegistrations: string[];
2409
+ /** Whether full billing address collection is required before paid checkout */
2410
+ billingAddressRequired: boolean;
2411
+ /** Stripe Product tax code per plan code (e.g. `txcd_10000000`) */
2412
+ planTaxCodes: Record<string, string>;
2413
+ /** Tax behavior per plan code */
2414
+ planTaxBehaviors: Record<string, FFIDTaxBehavior>;
2415
+ }
2416
+ /**
2417
+ * Human-approved payment configuration snapshot hashed into
2418
+ * `publication.paymentConfigurationHash`.
2419
+ */
2420
+ interface FFIDPaymentConfiguration {
2421
+ environment: FFIDCatalogEnvironment;
2422
+ /** Lowercase ISO 4217 currency (e.g. `jpy`) */
2423
+ currency: string;
2424
+ /** Explicit Stripe payment method allow-list (initial sales: `['card']`) */
2425
+ paymentMethodTypes: string[];
2426
+ /** Stripe Dashboard dynamic payment methods must stay disabled for sales */
2427
+ dynamicPaymentMethodsEnabled: boolean;
2428
+ manualInvoiceAllowed: boolean;
2429
+ customerBalanceAllowed: boolean;
2430
+ delayedPaymentMethodsAllowed: boolean;
2431
+ /** Required Stripe Customer invoice credit balance before checkout (spec: 0) */
2432
+ customerInvoiceBalanceRequired: number;
2433
+ }
2434
+ /** Sales-scope-relevant snapshot of one published plan (subset of the catalog) */
2435
+ interface FFIDScopeHashPlan {
2436
+ code: string;
2437
+ priceMonthly: number | null;
2438
+ priceYearly: number | null;
2439
+ currency: string;
2440
+ billingIntervals: FFIDBillingInterval[];
2441
+ taxBehavior: FFIDTaxBehavior;
2442
+ minSeats: number;
2443
+ }
2444
+ /**
2445
+ * Input of `computeScopeHash` — the published plans' sales conditions plus
2446
+ * the five content/config hashes. Changing any of them changes `scopeHash`,
2447
+ * which invalidates the previous publication approval (fail-closed).
2448
+ */
2449
+ interface FFIDScopeHashInput {
2450
+ plans: FFIDScopeHashPlan[];
2451
+ praxisCopyHash: string;
2452
+ ffidCheckoutCopyHash: string;
2453
+ legalDisclosureHash: string;
2454
+ taxConfigurationHash: string;
2455
+ paymentConfigurationHash: string;
2456
+ }
2457
+ /**
2458
+ * `praxisCopyHash`: hash of the consumer's entire structured sales
2459
+ * presentation (`PRAXIS_SALES_PRESENTATION` — locales, plan display names,
2460
+ * prices, feature matrix, CTAs, eligibility). The consumer re-hashes what it
2461
+ * actually renders and must refuse new sales on mismatch.
2462
+ */
2463
+ declare function computePraxisCopyHash(presentation: Record<string, FFIDCanonicalJsonValue>): Promise<string>;
2464
+ /** `ffidCheckoutCopyHash`: hash of FFID's structured final-confirmation copy */
2465
+ declare function computeFFIDCheckoutCopyHash(checkoutCopy: Record<string, FFIDCanonicalJsonValue>): Promise<string>;
2466
+ /**
2467
+ * `legalDisclosureHash`: hash of the canonical body text of the reviewed
2468
+ * legal disclosure document version. Line endings are normalized to LF before
2469
+ * hashing so the digest is independent of platform line-ending conventions;
2470
+ * the text is otherwise hashed byte-exact (no trimming, no Unicode
2471
+ * normalization).
2472
+ */
2473
+ declare function computeLegalDisclosureHash(canonicalText: string): Promise<string>;
2474
+ /**
2475
+ * `taxConfigurationHash`: hash of the human-approved tax configuration.
2476
+ * Country lists are treated as sets (sorted + deduplicated) so representation
2477
+ * order cannot flip the digest.
2478
+ */
2479
+ declare function computeTaxConfigurationHash(config: FFIDTaxConfiguration): Promise<string>;
2480
+ /**
2481
+ * `paymentConfigurationHash`: hash of the human-approved payment
2482
+ * configuration. `paymentMethodTypes` is treated as a set.
2483
+ */
2484
+ declare function computePaymentConfigurationHash(config: FFIDPaymentConfiguration): Promise<string>;
2485
+ /**
2486
+ * `scopeHash`: hash of the published sales scope — plan codes, amounts,
2487
+ * currency, intervals, tax behavior, minimum seats, plus the five embedded
2488
+ * content/config hashes. Plans are sorted by `code`; duplicate codes are
2489
+ * rejected. Embedded hashes are validated for format so a malformed digest
2490
+ * can never be baked into an approval.
2491
+ */
2492
+ declare function computeScopeHash(input: FFIDScopeHashInput): Promise<string>;
2493
+
2494
+ /** Published catalog methods (#4342 / ASDD-PRICING-002 SP4A) */
2495
+
2496
+ /**
2497
+ * Validates the full published-catalog shape the SDK's compile-time types
2498
+ * promise to consumers:
2499
+ * - `service.code` / `service.name` are non-empty strings
2500
+ * - top-level `catalogVersion` equals `publication.catalogVersion`
2501
+ * - `publication.status` is one of the four known literals (unknown statuses
2502
+ * must fail loud here, NOT be treated as sellable downstream) and
2503
+ * `publication.environment` is a known environment
2504
+ * - the six approval hashes are lowercase SHA-256 hex; `salesEpoch` is a
2505
+ * positive integer; timestamps are present (or explicitly null where the
2506
+ * type allows null)
2507
+ * - every plan carries the full `FFIDPublishedPlan` field set with
2508
+ * cross-field invariants (an offered interval has its price;
2509
+ * `minSeats <= maxSeats`), and no plan field NAME mentions Stripe
2510
+ * (defense-in-depth heuristic — the authoritative no-Stripe-ID guard is
2511
+ * the FFID server's `.strict()` snapshot schema)
2512
+ *
2513
+ * Throws FFIDSDKError on violation so a server regression surfaces at the
2514
+ * SDK boundary instead of silently reaching a consumer's sales gate.
2515
+ */
2516
+ declare function validatePublishedCatalog(catalog: unknown): asserts catalog is FFIDPublishedCatalog;
2517
+
2128
2518
  /**
2129
2519
  * FFID Announcements API Client
2130
2520
  *
@@ -2288,4 +2678,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
2288
2678
  };
2289
2679
  type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
2290
2680
 
2291
- 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, 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 };
2681
+ export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AnnouncementListResponse, BLOCKING_EFFECTIVE_STATUSES, CATALOG_HASH_PATTERN, 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 FFIDCanonicalJsonValue, type FFIDCatalogEnvironment, FFIDCatalogHashError, type FFIDCatalogPublication, type FFIDCatalogPublicationStatus, 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 FFIDPaymentConfiguration, 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 FFIDPublishedCatalog, type FFIDPublishedPlan, type FFIDRedirectErrorCode, type FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDScopeHashInput, type FFIDScopeHashPlan, 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 FFIDTaxBehavior, type FFIDTaxConfiguration, type FFIDTokenIntrospectionResponse, type FFIDUpdateMemberRoleResponse, type FFIDUpdateNotificationPreferencesRequest, type FFIDUpdateUserProfileRequest, FFIDUser, type FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_CATALOG_ENVIRONMENTS, FFID_CATALOG_PUBLICATION_STATUSES, 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, canonicalizeCatalogValue, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, hashCanonicalJson, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, retrieveState, sha256Hex, storeCodeVerifier, storeState, useFFID, useRequireActiveSubscription, useSubscription, validatePublishedCatalog, withFFIDAuth, withSubscription };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext, useSubscription } from './chunk-O3HGRALD.js';
2
- export { ACCESS_GRANTING_EFFECTIVE_STATUSES, BLOCKING_EFFECTIVE_STATUSES, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EFFECTIVE_SUBSCRIPTION_STATUSES, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_ERROR_CODES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, isBlockedFromUserinfo, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, retrieveState, storeCodeVerifier, storeState, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-O3HGRALD.js';
1
+ import { useFFIDContext, useSubscription } from './chunk-JZB2IM7Y.js';
2
+ export { ACCESS_GRANTING_EFFECTIVE_STATUSES, BLOCKING_EFFECTIVE_STATUSES, CATALOG_HASH_PATTERN, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EFFECTIVE_SUBSCRIPTION_STATUSES, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDCatalogHashError, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_CATALOG_ENVIRONMENTS, FFID_CATALOG_PUBLICATION_STATUSES, FFID_ERROR_CODES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, canonicalizeCatalogValue, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, hashCanonicalJson, isBlockedFromUserinfo, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, retrieveState, sha256Hex, storeCodeVerifier, storeState, useFFID, useFFIDAnnouncements, useSubscription, validatePublishedCatalog, withSubscription } from './chunk-JZB2IM7Y.js';
3
3
  export { ALL_DENIED_EXCEPT_NECESSARY, CONSENT_COOKIE_NAME, CONSENT_DISMISSAL_TIMESTAMP_KEY, COOKIE_VERSION, DEFAULT_CONSENT_ERROR_MESSAGES, FFIDAnalyticsProvider, FFIDConsentError, FFIDCookieBanner, FFIDCookieLink, FFIDCookieSettings, FFID_CONSENT_ERROR_CODES, clearConsentDismissalTimestamp, decodeConsentCookie, encodeConsentCookie, readConsentCookie, readConsentDismissalTimestamp, useFFIDConsent, useFFIDConsentPreferences, writeConsentCookie, writeConsentDismissalTimestamp } from './chunk-G7VOX64X.js';
4
4
  import { useEffect, useRef } from 'react';
5
5
  import { jsx, Fragment } from 'react/jsx-runtime';