@feelflow/ffid-sdk 10.1.0 → 12.0.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 FFIDOAuthUserInfoSubscription, a as FFIDAccountType, 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 FFIDSeatsSummary, m as FFIDListPlansResponse, n as FFIDPublishedCatalog, o as FFIDSubscriptionDetail, p as FFIDSubscribeParams, q as FFIDSubscribeResponse, r as FFIDChangePlanParams, s as FFIDChangePlanResponse, t as FFIDCancelSubscriptionParams, u as FFIDCancelSubscriptionResponse, v as FFIDCancelPendingDowngradeResponse, w as FFIDPreviewPlanChangeParams, x as FFIDPlanChangePreviewResponse, y as FFIDPreviewSeatChangeParams, z as FFIDSeatChangePreviewResponse, A as FFIDVerifyAccessTokenOptions, B as FFIDOAuthUserInfo, C as FFIDInquiryCreateParams, D as FFIDInquiryCreateResponse, E as FFIDCreditBalance, G as FFIDListCreditHistoryOptions, H as FFIDCreditHistoryPage, I as FFIDCreditPackList, J as FFIDCreatePackCheckoutParams, K as FFIDCreditPackCheckout, L as FFIDCreditConsumeParams, M as FFIDCreditConsumeResult, N as FFIDBuyCreditsUrlParams, T as TokenStore, O as FFIDAuthMode, P as FFIDLogger, Q as FFIDCacheAdapter, R as FFIDUser, S as FFIDOrganization, U as FFIDSubscription, V as FFIDSubscriptionContextValue, W as EffectiveSubscriptionStatus, X as FFIDSubscriptionStatus, Y as FFIDCatalogEnvironment, Z as FFIDBillingInterval, _ as FFIDTaxBehavior, $ as FFIDAnnouncementsClientConfig, a0 as ListAnnouncementsOptions, a1 as FFIDAnnouncementsApiResponse, a2 as AnnouncementListResponse, a3 as FFIDAnnouncementsLogger } from './index-CWGoIgYL.js';
2
- export { a4 as Announcement, a5 as AnnouncementStatus, a6 as AnnouncementType, a7 as EFFECTIVE_SUBSCRIPTION_STATUSES, a8 as FFIDAnnouncementBadge, a9 as FFIDAnnouncementList, aa as FFIDAnnouncementsError, ab as FFIDAnnouncementsErrorCode, ac as FFIDAnnouncementsServerResponse, ad as FFIDApiResponseMeta, ae as FFIDCacheConfig, af as FFIDCatalogPublication, ag as FFIDCatalogPublicationStatus, ah as FFIDContextValue, ai as FFIDCreditBreakdown, aj as FFIDCreditGrantKind, ak as FFIDCreditHistoryItem, al as FFIDCreditHistoryType, am as FFIDCreditPack, an as FFIDCreditsInsufficientDetails, ao as FFIDInquiryAcquisitionSource, ap as FFIDInquiryCategory, aq as FFIDInquiryCategorySite2026, ar as FFIDInquiryForm, as as FFIDInquiryFormCategoryItem, at as FFIDInquiryFormClassNames, au as FFIDInquiryFormLegalLayout, av as FFIDInquiryFormOrganization, aw as FFIDInquiryFormPlaceholderContext, ax as FFIDInquiryFormPrefill, ay as FFIDInquiryFormProps, az as FFIDInquiryFormSubmitData, aA as FFIDInquiryFormSubmitResult, aB as FFIDJwtClaims, aC as FFIDLoginButton, aD as FFIDOAuthUserInfoMemberRole, aE as FFIDOrganizationSwitcher, aF as FFIDPlanChangeLineItem, aG as FFIDPlanChangePreview, aH as FFIDPlanInfo, aI as FFIDPricingModel, aJ as FFIDPublishedPlan, aK as FFIDSeatAssignmentClaim, aL as FFIDSeatAssignmentStatus, aM as FFIDSeatChangeLineItem, aN as FFIDSeatChangePreview, aO as FFIDSeatModel, aP as FFIDServiceAccessDenialReason, aQ as FFIDServiceAccessFailPolicy, aR as FFIDServiceInfo, aS as FFIDSubscriptionBadge, aT as FFIDSubscriptionCheckCredits, aU as FFIDSubscriptionSummary, aV as FFIDSupportedCurrency, aW as FFIDUserMenu, aX as FFID_CATALOG_ENVIRONMENTS, aY as FFID_CATALOG_PUBLICATION_STATUSES, aZ as FFID_CREDITS_CONSUME_MAX_AMOUNT, a_ as FFID_CREDITS_CONSUME_MIN_AMOUNT, a$ as FFID_CREDITS_FEATURE_PATTERN, b0 as FFID_CREDITS_HISTORY_DEFAULT_LIMIT, b1 as FFID_CREDITS_HISTORY_MAX_LIMIT, b2 as FFID_CREDITS_HISTORY_MIN_LIMIT, b3 as FFID_CREDITS_IDEMPOTENCY_KEY_PATTERN, b4 as FFID_CREDITS_LOW_THRESHOLD_PERCENT, b5 as FFID_CREDITS_METADATA_MAX_BYTES, b6 as FFID_CREDIT_GRANT_KINDS, b7 as FFID_CREDIT_HISTORY_TYPES, b8 as FFID_CREDIT_PACK_MAX_QUANTITY, b9 as FFID_CREDIT_PACK_MIN_QUANTITY, ba as FFID_INQUIRY_ACQUISITION_SOURCES, bb as FFID_INQUIRY_CATEGORIES, bc as FFID_INQUIRY_CATEGORIES_SITE_2026, bd as TokenData, be as UseFFIDAnnouncementsOptions, bf as UseFFIDAnnouncementsReturn, bg as createTokenStore, bh as isFFIDInquiryAcquisitionSource, bi as isFFIDInquiryCategorySite2026, bj as useFFIDAnnouncements } from './index-CWGoIgYL.js';
1
+ import { F as FFIDOAuthUserInfoSubscription, a as FFIDAccountType, 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 FFIDSeatsSummary, m as FFIDListPlansResponse, n as FFIDPublishedCatalog, o as FFIDSubscriptionDetail, p as FFIDSubscribeParams, q as FFIDSubscribeResponse, r as FFIDChangePlanParams, s as FFIDChangePlanResponse, t as FFIDCancelSubscriptionParams, u as FFIDCancelSubscriptionResponse, v as FFIDCancelPendingDowngradeResponse, w as FFIDPreviewPlanChangeParams, x as FFIDPlanChangePreviewResponse, y as FFIDPreviewSeatChangeParams, z as FFIDSeatChangePreviewResponse, A as FFIDVerifyAccessTokenOptions, B as FFIDOAuthUserInfo, C as FFIDInquiryCreateParams, D as FFIDInquiryCreateResponse, E as FFIDCreditBalance, G as FFIDListCreditHistoryOptions, H as FFIDCreditHistoryPage, I as FFIDCreditPackList, J as FFIDCreatePackCheckoutParams, K as FFIDCreditPackCheckout, L as FFIDCreditConsumeParams, M as FFIDCreditConsumeResult, N as FFIDBuyCreditsUrlParams, T as TokenStore, O as FFIDAuthMode, P as FFIDLogger, Q as FFIDCacheAdapter, R as FFIDUser, S as FFIDOrganization, U as FFIDSubscription, V as FFIDSubscriptionContextValue, W as EffectiveSubscriptionStatus, X as FFIDSubscriptionStatus, Y as FFIDCatalogEnvironment, Z as FFIDBillingInterval, _ as FFIDTaxBehavior, $ as FFIDAnnouncementsClientConfig, a0 as ListAnnouncementsOptions, a1 as FFIDAnnouncementsApiResponse, a2 as AnnouncementListResponse, a3 as FFIDAnnouncementsLogger } from './index-f9k9reXO.js';
2
+ export { a4 as Announcement, a5 as AnnouncementStatus, a6 as AnnouncementType, a7 as EFFECTIVE_SUBSCRIPTION_STATUSES, a8 as FFIDAnnouncementBadge, a9 as FFIDAnnouncementList, aa as FFIDAnnouncementsError, ab as FFIDAnnouncementsErrorCode, ac as FFIDAnnouncementsServerResponse, ad as FFIDApiResponseMeta, ae as FFIDCacheConfig, af as FFIDCatalogPublication, ag as FFIDCatalogPublicationStatus, ah as FFIDContextValue, ai as FFIDCreditBreakdown, aj as FFIDCreditGrantKind, ak as FFIDCreditHistoryItem, al as FFIDCreditHistoryType, am as FFIDCreditPack, an as FFIDCreditsInsufficientDetails, ao as FFIDInquiryAcquisitionSource, ap as FFIDInquiryCategory, aq as FFIDInquiryCategorySite2026, ar as FFIDInquiryForm, as as FFIDInquiryFormCategoryItem, at as FFIDInquiryFormClassNames, au as FFIDInquiryFormLegalLayout, av as FFIDInquiryFormOrganization, aw as FFIDInquiryFormPlaceholderContext, ax as FFIDInquiryFormPrefill, ay as FFIDInquiryFormProps, az as FFIDInquiryFormSubmitData, aA as FFIDInquiryFormSubmitResult, aB as FFIDJwtClaims, aC as FFIDLoginButton, aD as FFIDOAuthUserInfoMemberRole, aE as FFIDOrganizationSwitcher, aF as FFIDPlanChangeLineItem, aG as FFIDPlanChangePreview, aH as FFIDPlanInfo, aI as FFIDPricingModel, aJ as FFIDPublishedPlan, aK as FFIDSeatAssignmentClaim, aL as FFIDSeatAssignmentStatus, aM as FFIDSeatChangeLineItem, aN as FFIDSeatChangePreview, aO as FFIDSeatModel, aP as FFIDServiceAccessDenialReason, aQ as FFIDServiceAccessFailPolicy, aR as FFIDServiceInfo, aS as FFIDSubscriptionBadge, aT as FFIDSubscriptionCheckCredits, aU as FFIDSubscriptionSummary, aV as FFIDSupportedCurrency, aW as FFIDUserMenu, aX as FFID_CATALOG_ENVIRONMENTS, aY as FFID_CATALOG_PUBLICATION_STATUSES, aZ as FFID_CREDITS_CONSUME_MAX_AMOUNT, a_ as FFID_CREDITS_CONSUME_MIN_AMOUNT, a$ as FFID_CREDITS_FEATURE_PATTERN, b0 as FFID_CREDITS_HISTORY_DEFAULT_LIMIT, b1 as FFID_CREDITS_HISTORY_MAX_LIMIT, b2 as FFID_CREDITS_HISTORY_MIN_LIMIT, b3 as FFID_CREDITS_IDEMPOTENCY_KEY_PATTERN, b4 as FFID_CREDITS_LOW_THRESHOLD_PERCENT, b5 as FFID_CREDITS_METADATA_MAX_BYTES, b6 as FFID_CREDIT_GRANT_KINDS, b7 as FFID_CREDIT_HISTORY_TYPES, b8 as FFID_CREDIT_PACK_MAX_QUANTITY, b9 as FFID_CREDIT_PACK_MIN_QUANTITY, ba as FFID_INQUIRY_ACQUISITION_SOURCES, bb as FFID_INQUIRY_CATEGORIES, bc as FFID_INQUIRY_CATEGORIES_SITE_2026, bd as TokenData, be as UseFFIDAnnouncementsOptions, bf as UseFFIDAnnouncementsReturn, bg as createTokenStore, bh as isFFIDInquiryAcquisitionSource, bi as isFFIDInquiryCategorySite2026, bj as useFFIDAnnouncements } from './index-f9k9reXO.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, n as FFIDAnalyticsProvider, o as FFIDAnalyticsProviderProps, c as FFIDConsentCategories, q as FFIDConsentCategoryCode, e as FFIDConsentCategoryMetadata, v as FFIDConsentError, w as FFIDConsentErrorCode, x as FFIDConsentMergeStrategy, z as FFIDConsentMergeWarning, B as FFIDConsentMergeWarningEvent, F as FFIDConsentResult, H as FFIDConsentSource, a as FFIDConsentState, d as FFIDConsentSyncResult, L as FFIDCookieBanner, M as FFIDCookieBannerClassNames, N as FFIDCookieBannerProps, O as FFIDCookieLink, Q as FFIDCookieLinkProps, f as FFIDCookiePolicy, S as FFIDCookieSettings, T as FFIDCookieSettingsClassNames, U as FFIDCookieSettingsProps, Z as FFID_CONSENT_ERROR_CODES, ad as UseFFIDConsentPreferencesReturn, ae as UseFFIDConsentReturn, af as clearConsentDismissalTimestamp, ai as decodeConsentCookie, ak as encodeConsentCookie, am as readConsentCookie, an as readConsentDismissalTimestamp, ap as useFFIDConsent, aq as useFFIDConsentPreferences, ar as writeConsentCookie, as as writeConsentDismissalTimestamp } from './FFIDCookieLink-yt5SUr-W.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { ReactNode, ComponentType, FC } from 'react';
@@ -207,9 +207,18 @@ interface FFIDAddMemberRequest {
207
207
  interface FFIDAddMemberParams extends FFIDAddMemberRequest {
208
208
  organizationId: string;
209
209
  }
210
+ /** Seat assignment outcome after membership creation; membership exists in every case. */
211
+ type FFIDMemberSeatAssignmentResult = 'assigned' | 'not_applicable' | 'member_limit_reached' | 'failed';
210
212
  /** Response from addMember (ext) */
211
213
  interface FFIDAddMemberResponse {
212
214
  member: FFIDOrganizationMember;
215
+ /**
216
+ * Membership creation can succeed even when seat assignment fails.
217
+ * Omitted by older servers. `not_applicable`/undefined do not prove an active seat.
218
+ * Check the authenticated user's hasAccess and seatAssigned before granting access;
219
+ * do not automatically restore a removed seat on a duplicate-member retry.
220
+ */
221
+ seatAssignment?: FFIDMemberSeatAssignmentResult;
213
222
  }
214
223
  /** Response from updateMemberRole (ext) */
215
224
  interface FFIDUpdateMemberRoleResponse {
@@ -737,6 +746,12 @@ interface FFIDInviteMemberRequest {
737
746
  email: string;
738
747
  /** Role to assign on acceptance (defaults to `member` server-side) */
739
748
  role?: FFIDAssignableMemberRole;
749
+ /**
750
+ * FFID user id recorded as the inviter (FFID #6279). Must be an active owner / admin
751
+ * of the organization. Omit in `token` mode (the signed-in user is recorded); when
752
+ * omitted in `service-key` mode the organization owner is recorded.
753
+ */
754
+ inviterUserId?: string;
740
755
  }
741
756
  /**
742
757
  * Response from inviteMember (ext).
@@ -1390,6 +1405,7 @@ type FFIDSubscriptionErrorCode = (typeof FFID_SUBSCRIPTION_ERROR_CODES)[keyof ty
1390
1405
  * Do not retry automatically; show the credit purchase path.
1391
1406
  * - `CREDITS_IDEMPOTENCY_CONFLICT` (409): the same idempotency key with another amount.
1392
1407
  * A caller bug — do not retry.
1408
+ * - `CREDITS_TURN_CANCELLED` (409): a failed chatbot attempt was cancelled; use a new attempt key.
1393
1409
  * - `CREDITS_NOT_APPLICABLE` (409): the contract's plan is per_seat (not credit-based).
1394
1410
  * - `CREDITS_BALANCE_CAP_EXCEEDED` (409): a grant would push the balance over the cap.
1395
1411
  * - `SEAT_BILLING_NOT_APPLICABLE` (409): seat-count changes on a flat contract.
@@ -1408,6 +1424,7 @@ type FFIDSubscriptionErrorCode = (typeof FFID_SUBSCRIPTION_ERROR_CODES)[keyof ty
1408
1424
  declare const FFID_CREDITS_ERROR_CODES: {
1409
1425
  readonly CREDITS_INSUFFICIENT: "CREDITS_INSUFFICIENT";
1410
1426
  readonly CREDITS_IDEMPOTENCY_CONFLICT: "CREDITS_IDEMPOTENCY_CONFLICT";
1427
+ readonly CREDITS_TURN_CANCELLED: "CREDITS_TURN_CANCELLED";
1411
1428
  readonly CREDITS_NOT_APPLICABLE: "CREDITS_NOT_APPLICABLE";
1412
1429
  readonly CREDITS_BALANCE_CAP_EXCEEDED: "CREDITS_BALANCE_CAP_EXCEEDED";
1413
1430
  readonly SEAT_BILLING_NOT_APPLICABLE: "SEAT_BILLING_NOT_APPLICABLE";
@@ -1498,6 +1515,7 @@ declare function createFFIDClient(config: FFIDConfig): {
1498
1515
  organizationId: string;
1499
1516
  email: string;
1500
1517
  role?: FFIDAssignableMemberRole;
1518
+ inviterUserId?: string;
1501
1519
  }) => Promise<FFIDApiResponse<FFIDInviteMemberResponse>>;
1502
1520
  leaveOrganization: (params: FFIDLeaveOrganizationParams) => Promise<FFIDApiResponse<FFIDLeaveOrganizationResponse>>;
1503
1521
  getAnalyticsConfig: (serviceCode: string, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDAnalyticsConfig>>;
@@ -2958,4 +2976,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
2958
2976
  };
2959
2977
  type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
2960
2978
 
2961
- export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AGENCY_INVITE_COOKIE_MAX_AGE_SEC, AGENCY_INVITE_COOKIE_NAME, AGENCY_INVITE_TOKEN_PARAM, AGENCY_INVITE_TOKEN_REDACTION, type AgencyInviteCookieOptions, AnnouncementListResponse, BLOCKING_EFFECTIVE_STATUSES, CATALOG_HASH_PATTERN, type CaptureAgencyInviteTokenOptions, type CaptureAgencyInviteTokenResult, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EffectiveSubscriptionStatus, type ExchangeCodeForTokensOptions, FFIDAccountType, type FFIDAddMemberParams, type FFIDAddMemberRequest, type FFIDAddMemberResponse, type FFIDAllowedLogoMimeType, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDAssignableMemberRole, type FFIDAuthorizationError, type FFIDAuthorizationErrorDetails, FFIDBillingInterval, FFIDBuyCreditsUrlParams, FFIDCacheAdapter, FFIDCancelPendingDowngradeResponse, FFIDCancelSubscriptionParams, FFIDCancelSubscriptionResponse, type FFIDCanonicalJsonValue, FFIDCatalogEnvironment, FFIDCatalogHashError, FFIDChangePlanParams, FFIDChangePlanResponse, FFIDCheckServiceAccessParams, type FFIDCheckoutSessionResponse, type FFIDClient, type FFIDCompanySizeCode, FFIDConfig, type FFIDCreateCheckoutParams, FFIDCreatePackCheckoutParams, type FFIDCreatePortalParams, FFIDCreditBalance, FFIDCreditConsumeParams, FFIDCreditConsumeResult, FFIDCreditHistoryPage, FFIDCreditPackCheckout, FFIDCreditPackList, type FFIDCreditsClient, type FFIDCreditsErrorCode, FFIDError, type FFIDErrorCode, type FFIDIndustryCode, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, type FFIDInvitationStatus, type FFIDInviteMemberRequest, type FFIDInviteMemberResponse, type FFIDLeaveOrganizationParams, type FFIDLeaveOrganizationResponse, FFIDListCreditHistoryOptions, type FFIDListMembersResponse, FFIDListPlansResponse, type FFIDListingConsentInput, FFIDLogger, type FFIDLoginHistoryEntry, type FFIDLoginHistoryResponse, type FFIDLogoWallEntry, type FFIDLogoWallResponse, 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 FFIDOAuthDenialReason, type FFIDOAuthTokenResponse, FFIDOAuthUserInfo, FFIDOAuthUserInfoSubscription, FFIDOrganization, type FFIDOrganizationDomain, type FFIDOrganizationDomainsResponse, type FFIDOrganizationLogoUploadResponse, type FFIDOrganizationMember, type FFIDOrganizationNotificationPreferences, type FFIDOrganizationNotificationPreferencesResponse, type FFIDOrganizationProfile, type FFIDOrganizationProfileErrorCode, type FFIDOrganizationProfileResponse, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPaymentConfiguration, FFIDPlanChangePreviewResponse, type FFIDPortalSessionResponse, FFIDPreviewPlanChangeParams, 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, FFIDPublishedCatalog, type FFIDRedirectErrorCode, type FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDScopeHashInput, type FFIDScopeHashPlan, FFIDSeatChangePreviewResponse, FFIDSeatsSummary, FFIDServiceAccessDecision, FFIDSessionResponse, FFIDSignOutResult, FFIDSubscribeParams, FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDSubscriptionDetail, type FFIDSubscriptionErrorCode, FFIDSubscriptionStatus, FFIDTaxBehavior, type FFIDTaxConfiguration, type FFIDTokenIntrospectionResponse, type FFIDUpdateMemberRoleResponse, type FFIDUpdateNotificationPreferencesRequest, type FFIDUpdateUserProfileRequest, type FFIDUploadOrganizationLogoParams, type FFIDUpsertOrganizationProfileParams, type FFIDUpsertOrganizationProfileRequest, FFIDUser, type FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_COMPANY_SIZE_CODES, FFID_CREDITS_ERROR_CODES, FFID_ERROR_CODES, FFID_INDUSTRY_CODES, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, FFID_OAUTH_DENIAL_REASONS, FFID_ORGANIZATION_PROFILE_ERROR_CODES, FFID_SUBSCRIPTION_ERROR_CODES, type HandleRedirectCallbackClient, type HandleRedirectCallbackOptions, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type ReadAgencyInviteTokenOptions, type RedirectToAuthorizeOptions, TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, canonicalizeCatalogValue, captureAgencyInviteToken, clearAgencyInviteToken, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, generateCodeChallenge, generateCodeVerifier, getFFIDAuthorizationError, handleRedirectCallback, hasAccessFromUserinfo, hashCanonicalJson, isBlockedFromUserinfo, isFFIDOAuthDenialReason, normalizeRedirectUri, readAgencyInviteCookie, readAgencyInviteToken, redactAgencyInviteToken, retrieveCodeVerifier, retrieveState, sha256Hex, storeCodeVerifier, storeState, useFFID, useRequireActiveSubscription, useSubscription, validatePublishedCatalog, withFFIDAuth, withSubscription };
2979
+ export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AGENCY_INVITE_COOKIE_MAX_AGE_SEC, AGENCY_INVITE_COOKIE_NAME, AGENCY_INVITE_TOKEN_PARAM, AGENCY_INVITE_TOKEN_REDACTION, type AgencyInviteCookieOptions, AnnouncementListResponse, BLOCKING_EFFECTIVE_STATUSES, CATALOG_HASH_PATTERN, type CaptureAgencyInviteTokenOptions, type CaptureAgencyInviteTokenResult, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EffectiveSubscriptionStatus, type ExchangeCodeForTokensOptions, FFIDAccountType, type FFIDAddMemberParams, type FFIDAddMemberRequest, type FFIDAddMemberResponse, type FFIDAllowedLogoMimeType, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDAssignableMemberRole, type FFIDAuthorizationError, type FFIDAuthorizationErrorDetails, FFIDBillingInterval, FFIDBuyCreditsUrlParams, FFIDCacheAdapter, FFIDCancelPendingDowngradeResponse, FFIDCancelSubscriptionParams, FFIDCancelSubscriptionResponse, type FFIDCanonicalJsonValue, FFIDCatalogEnvironment, FFIDCatalogHashError, FFIDChangePlanParams, FFIDChangePlanResponse, FFIDCheckServiceAccessParams, type FFIDCheckoutSessionResponse, type FFIDClient, type FFIDCompanySizeCode, FFIDConfig, type FFIDCreateCheckoutParams, FFIDCreatePackCheckoutParams, type FFIDCreatePortalParams, FFIDCreditBalance, FFIDCreditConsumeParams, FFIDCreditConsumeResult, FFIDCreditHistoryPage, FFIDCreditPackCheckout, FFIDCreditPackList, type FFIDCreditsClient, type FFIDCreditsErrorCode, FFIDError, type FFIDErrorCode, type FFIDIndustryCode, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, type FFIDInvitationStatus, type FFIDInviteMemberRequest, type FFIDInviteMemberResponse, type FFIDLeaveOrganizationParams, type FFIDLeaveOrganizationResponse, FFIDListCreditHistoryOptions, type FFIDListMembersResponse, FFIDListPlansResponse, type FFIDListingConsentInput, FFIDLogger, type FFIDLoginHistoryEntry, type FFIDLoginHistoryResponse, type FFIDLogoWallEntry, type FFIDLogoWallResponse, type FFIDMemberRole, type FFIDMemberSeatAssignmentResult, 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 FFIDOAuthDenialReason, type FFIDOAuthTokenResponse, FFIDOAuthUserInfo, FFIDOAuthUserInfoSubscription, FFIDOrganization, type FFIDOrganizationDomain, type FFIDOrganizationDomainsResponse, type FFIDOrganizationLogoUploadResponse, type FFIDOrganizationMember, type FFIDOrganizationNotificationPreferences, type FFIDOrganizationNotificationPreferencesResponse, type FFIDOrganizationProfile, type FFIDOrganizationProfileErrorCode, type FFIDOrganizationProfileResponse, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPaymentConfiguration, FFIDPlanChangePreviewResponse, type FFIDPortalSessionResponse, FFIDPreviewPlanChangeParams, 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, FFIDPublishedCatalog, type FFIDRedirectErrorCode, type FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDScopeHashInput, type FFIDScopeHashPlan, FFIDSeatChangePreviewResponse, FFIDSeatsSummary, FFIDServiceAccessDecision, FFIDSessionResponse, FFIDSignOutResult, FFIDSubscribeParams, FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDSubscriptionDetail, type FFIDSubscriptionErrorCode, FFIDSubscriptionStatus, FFIDTaxBehavior, type FFIDTaxConfiguration, type FFIDTokenIntrospectionResponse, type FFIDUpdateMemberRoleResponse, type FFIDUpdateNotificationPreferencesRequest, type FFIDUpdateUserProfileRequest, type FFIDUploadOrganizationLogoParams, type FFIDUpsertOrganizationProfileParams, type FFIDUpsertOrganizationProfileRequest, FFIDUser, type FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_COMPANY_SIZE_CODES, FFID_CREDITS_ERROR_CODES, FFID_ERROR_CODES, FFID_INDUSTRY_CODES, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, FFID_OAUTH_DENIAL_REASONS, FFID_ORGANIZATION_PROFILE_ERROR_CODES, FFID_SUBSCRIPTION_ERROR_CODES, type HandleRedirectCallbackClient, type HandleRedirectCallbackOptions, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type ReadAgencyInviteTokenOptions, type RedirectToAuthorizeOptions, TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, canonicalizeCatalogValue, captureAgencyInviteToken, clearAgencyInviteToken, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, generateCodeChallenge, generateCodeVerifier, getFFIDAuthorizationError, handleRedirectCallback, hasAccessFromUserinfo, hashCanonicalJson, isBlockedFromUserinfo, isFFIDOAuthDenialReason, normalizeRedirectUri, readAgencyInviteCookie, readAgencyInviteToken, redactAgencyInviteToken, 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-ITSQIAO5.js';
2
- export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AGENCY_INVITE_COOKIE_MAX_AGE_SEC, AGENCY_INVITE_COOKIE_NAME, AGENCY_INVITE_TOKEN_PARAM, AGENCY_INVITE_TOKEN_REDACTION, 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_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_CATALOG_ENVIRONMENTS, FFID_CATALOG_PUBLICATION_STATUSES, FFID_COMPANY_SIZE_CODES, FFID_CREDITS_CONSUME_MAX_AMOUNT, FFID_CREDITS_CONSUME_MIN_AMOUNT, FFID_CREDITS_ERROR_CODES, FFID_CREDITS_FEATURE_PATTERN, FFID_CREDITS_HISTORY_DEFAULT_LIMIT, FFID_CREDITS_HISTORY_MAX_LIMIT, FFID_CREDITS_HISTORY_MIN_LIMIT, FFID_CREDITS_IDEMPOTENCY_KEY_PATTERN, FFID_CREDITS_LOW_THRESHOLD_PERCENT, FFID_CREDITS_METADATA_MAX_BYTES, FFID_CREDIT_GRANT_KINDS, FFID_CREDIT_HISTORY_TYPES, FFID_CREDIT_PACK_MAX_QUANTITY, FFID_CREDIT_PACK_MIN_QUANTITY, FFID_ERROR_CODES, FFID_INDUSTRY_CODES, FFID_INQUIRY_ACQUISITION_SOURCES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, FFID_OAUTH_DENIAL_REASONS, FFID_ORGANIZATION_PROFILE_ERROR_CODES, FFID_SUBSCRIPTION_ERROR_CODES, canonicalizeCatalogValue, captureAgencyInviteToken, clearAgencyInviteToken, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, getFFIDAuthorizationError, handleRedirectCallback, hasAccessFromUserinfo, hashCanonicalJson, isBlockedFromUserinfo, isFFIDInquiryAcquisitionSource, isFFIDInquiryCategorySite2026, isFFIDOAuthDenialReason, normalizeRedirectUri, readAgencyInviteCookie, readAgencyInviteToken, redactAgencyInviteToken, retrieveCodeVerifier, retrieveState, sha256Hex, storeCodeVerifier, storeState, useFFID, useFFIDAnnouncements, useSubscription, validatePublishedCatalog, withSubscription } from './chunk-ITSQIAO5.js';
1
+ import { useFFIDContext, useSubscription } from './chunk-OL7KVPQ4.js';
2
+ export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AGENCY_INVITE_COOKIE_MAX_AGE_SEC, AGENCY_INVITE_COOKIE_NAME, AGENCY_INVITE_TOKEN_PARAM, AGENCY_INVITE_TOKEN_REDACTION, 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_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_CATALOG_ENVIRONMENTS, FFID_CATALOG_PUBLICATION_STATUSES, FFID_COMPANY_SIZE_CODES, FFID_CREDITS_CONSUME_MAX_AMOUNT, FFID_CREDITS_CONSUME_MIN_AMOUNT, FFID_CREDITS_ERROR_CODES, FFID_CREDITS_FEATURE_PATTERN, FFID_CREDITS_HISTORY_DEFAULT_LIMIT, FFID_CREDITS_HISTORY_MAX_LIMIT, FFID_CREDITS_HISTORY_MIN_LIMIT, FFID_CREDITS_IDEMPOTENCY_KEY_PATTERN, FFID_CREDITS_LOW_THRESHOLD_PERCENT, FFID_CREDITS_METADATA_MAX_BYTES, FFID_CREDIT_GRANT_KINDS, FFID_CREDIT_HISTORY_TYPES, FFID_CREDIT_PACK_MAX_QUANTITY, FFID_CREDIT_PACK_MIN_QUANTITY, FFID_ERROR_CODES, FFID_INDUSTRY_CODES, FFID_INQUIRY_ACQUISITION_SOURCES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, FFID_OAUTH_DENIAL_REASONS, FFID_ORGANIZATION_PROFILE_ERROR_CODES, FFID_SUBSCRIPTION_ERROR_CODES, canonicalizeCatalogValue, captureAgencyInviteToken, clearAgencyInviteToken, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, getFFIDAuthorizationError, handleRedirectCallback, hasAccessFromUserinfo, hashCanonicalJson, isBlockedFromUserinfo, isFFIDInquiryAcquisitionSource, isFFIDInquiryCategorySite2026, isFFIDOAuthDenialReason, normalizeRedirectUri, readAgencyInviteCookie, readAgencyInviteToken, redactAgencyInviteToken, retrieveCodeVerifier, retrieveState, sha256Hex, storeCodeVerifier, storeState, useFFID, useFFIDAnnouncements, useSubscription, validatePublishedCatalog, withSubscription } from './chunk-OL7KVPQ4.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-S2AEBJRX.js';
4
4
  import { useEffect, useRef } from 'react';
5
5
  import { jsx, Fragment } from 'react/jsx-runtime';
@@ -305,6 +305,9 @@ var OAUTH_INTROSPECT_ENDPOINT = "/api/v1/oauth/introspect";
305
305
  var CACHE_KEY_PREFIX = "ffid:introspect:";
306
306
  var HEX_BASE = 16;
307
307
  var HEX_BYTE_WIDTH = 2;
308
+ var HTTP_TOO_MANY_REQUESTS = 429;
309
+ var HTTP_SERVER_ERROR_MIN = 500;
310
+ var HTTP_SERVER_ERROR_LIMIT = 600;
308
311
  function createVerifyAccessToken(deps) {
309
312
  const { authMode, baseUrl, serviceCode, serviceApiKey, verifyStrategy, logger, createError, errorCodes, cache, timeout } = deps;
310
313
  let jwtVerify2 = null;
@@ -359,6 +362,16 @@ function createVerifyAccessToken(deps) {
359
362
  }
360
363
  return verifyViaIntrospect(accessToken);
361
364
  }
365
+ function introspectionUnavailable(status) {
366
+ logger.error("Token introspection unavailable", { status });
367
+ return {
368
+ error: {
369
+ code: errorCodes.NETWORK_ERROR,
370
+ message: `\u30C8\u30FC\u30AF\u30F3\u691C\u8A3C\u30B5\u30FC\u30D3\u30B9\u304C\u4E00\u6642\u7684\u306B\u5229\u7528\u3067\u304D\u307E\u305B\u3093 (status: ${status})`,
371
+ details: { status }
372
+ }
373
+ };
374
+ }
362
375
  async function verifyViaIntrospect(accessToken, cacheKeySuffix) {
363
376
  if (!serviceApiKey) {
364
377
  return {
@@ -416,10 +429,12 @@ function createVerifyAccessToken(deps) {
416
429
  }
417
430
  };
418
431
  }
432
+ const upstreamUnavailable = response.status === HTTP_TOO_MANY_REQUESTS || response.status >= HTTP_SERVER_ERROR_MIN && response.status < HTTP_SERVER_ERROR_LIMIT;
419
433
  let introspectResponse;
420
434
  try {
421
435
  introspectResponse = await response.json();
422
436
  } catch (parseError) {
437
+ if (upstreamUnavailable) return introspectionUnavailable(response.status);
423
438
  logger.error("Parse error during token verification:", parseError);
424
439
  return {
425
440
  error: {
@@ -428,6 +443,7 @@ function createVerifyAccessToken(deps) {
428
443
  }
429
444
  };
430
445
  }
446
+ if (upstreamUnavailable) return introspectionUnavailable(response.status);
431
447
  if (!response.ok) {
432
448
  const errorBody = introspectResponse;
433
449
  return {
@@ -1371,7 +1387,7 @@ var FFID_ORGANIZATION_PROFILE_ERROR_CODES = {
1371
1387
  };
1372
1388
 
1373
1389
  // src/client/version-check.ts
1374
- var SDK_VERSION = "10.1.0";
1390
+ var SDK_VERSION = "12.0.0";
1375
1391
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
1376
1392
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
1377
1393
  function sdkHeaders() {
@@ -1939,7 +1955,7 @@ function createInviteMethods(deps) {
1939
1955
  }).toString();
1940
1956
  return fetchWithAuth(`${EXT_INVITE_ENDPOINT}?${query}`, {
1941
1957
  method: "POST",
1942
- body: JSON.stringify({ email: params.email, role: params.role })
1958
+ body: JSON.stringify({ email: params.email, role: params.role, inviterUserId: params.inviterUserId })
1943
1959
  });
1944
1960
  }
1945
1961
  return { inviteMember };
@@ -2242,6 +2258,25 @@ function createOAuthTokenMethods(deps) {
2242
2258
  return { exchangeCodeForTokens, refreshAccessToken, signOutToken };
2243
2259
  }
2244
2260
 
2261
+ // src/client/request-timeout.ts
2262
+ function withRequestTimeout(options, timeout) {
2263
+ if (timeout === void 0 || options.signal?.aborted) return options;
2264
+ const deadline = AbortSignal.timeout(timeout);
2265
+ if (!options.signal) return { ...options, signal: deadline };
2266
+ const callerSignal = options.signal;
2267
+ const controller = new AbortController();
2268
+ const abortFromCaller = () => abort(callerSignal.reason);
2269
+ const abortFromDeadline = () => abort(deadline.reason);
2270
+ function abort(reason) {
2271
+ callerSignal.removeEventListener("abort", abortFromCaller);
2272
+ deadline.removeEventListener("abort", abortFromDeadline);
2273
+ controller.abort(reason);
2274
+ }
2275
+ callerSignal.addEventListener("abort", abortFromCaller, { once: true });
2276
+ deadline.addEventListener("abort", abortFromDeadline, { once: true });
2277
+ return { ...options, signal: controller.signal };
2278
+ }
2279
+
2245
2280
  // src/client/session.ts
2246
2281
  var SESSION_ENDPOINT = "/api/v1/auth/session";
2247
2282
  var LOGOUT_ENDPOINT = "/api/v1/auth/signout";
@@ -3760,6 +3795,7 @@ function toServiceAccessDecision(response, allowGrace) {
3760
3795
  const isBlocked = response.isBlocked ?? (effectiveStatus === null || effectiveStatus !== null && BLOCKING_EFFECTIVE_STATUSES.includes(effectiveStatus));
3761
3796
  return {
3762
3797
  hasAccess,
3798
+ ...response.seatAssigned !== void 0 ? { seatAssigned: response.seatAssigned } : {},
3763
3799
  effectiveStatus,
3764
3800
  isGrace,
3765
3801
  isBlocked: isBlocked || !hasAccess,
@@ -3966,9 +4002,10 @@ function createFFIDClient(config) {
3966
4002
  async function fetchWithAuth(endpoint, options = {}, authOverride) {
3967
4003
  const url = `${baseUrl}${endpoint}`;
3968
4004
  logger.debug("Fetching:", url);
3969
- const fetchOptions = buildFetchOptions(options, authOverride);
4005
+ let fetchOptions = buildFetchOptions(options, authOverride);
3970
4006
  let response;
3971
4007
  try {
4008
+ fetchOptions = withRequestTimeout(fetchOptions, timeout);
3972
4009
  response = await fetch(url, fetchOptions);
3973
4010
  } catch (error) {
3974
4011
  logger.error("Network error:", error);
@@ -3983,9 +4020,9 @@ function createFFIDClient(config) {
3983
4020
  const refreshResult = await refreshAccessToken();
3984
4021
  if (!refreshResult.error) {
3985
4022
  logger.debug("Token refreshed, retrying request");
3986
- const retryOptions = buildFetchOptions(options);
3987
4023
  try {
3988
- response = await fetch(url, retryOptions);
4024
+ fetchOptions = withRequestTimeout(buildFetchOptions(options), timeout);
4025
+ response = await fetch(url, fetchOptions);
3989
4026
  } catch (retryError) {
3990
4027
  logger.error("Network error on retry:", retryError);
3991
4028
  return {
@@ -4004,6 +4041,15 @@ function createFFIDClient(config) {
4004
4041
  try {
4005
4042
  raw = await response.json();
4006
4043
  } catch (parseError) {
4044
+ if (fetchOptions.signal?.aborted) {
4045
+ logger.error("Response body aborted:", parseError);
4046
+ return {
4047
+ error: {
4048
+ code: FFID_ERROR_CODES.NETWORK_ERROR,
4049
+ message: "\u30EC\u30B9\u30DD\u30F3\u30B9\u306E\u53D7\u4FE1\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F"
4050
+ }
4051
+ };
4052
+ }
4007
4053
  logger.error("Parse error:", parseError, "Status:", response.status);
4008
4054
  return {
4009
4055
  error: {
@@ -4549,6 +4595,19 @@ function generateServerState() {
4549
4595
  globalThis.crypto.getRandomValues(bytes);
4550
4596
  return Array.from(bytes, (b) => b.toString(HEX_RADIX2).padStart(2, "0")).join("");
4551
4597
  }
4598
+ var STORED_STATE_SEPARATOR = ".";
4599
+ function packStoredLoginHandle(handle) {
4600
+ return `${handle.state}${STORED_STATE_SEPARATOR}${handle.codeVerifier}`;
4601
+ }
4602
+ function unpackStoredLoginHandle(stored) {
4603
+ if (!stored) return null;
4604
+ const sep = stored.indexOf(STORED_STATE_SEPARATOR);
4605
+ if (sep <= 0) return null;
4606
+ const state = stored.slice(0, sep);
4607
+ const codeVerifier = stored.slice(sep + STORED_STATE_SEPARATOR.length);
4608
+ if (!codeVerifier) return null;
4609
+ return { state, codeVerifier };
4610
+ }
4552
4611
 
4553
4612
  // src/server/auth/server-oauth-token.ts
4554
4613
  var OAUTH_TOKEN_ENDPOINT2 = "/api/v1/oauth/token";
@@ -4610,7 +4669,7 @@ async function postToken(deps, body, fallbackErrorCode) {
4610
4669
  }
4611
4670
  return { tokens: toTokens(validation.tokens) };
4612
4671
  }
4613
- function exchangeAuthorizationCodeServer(deps, code) {
4672
+ function exchangeAuthorizationCodeServer(deps, code, codeVerifier) {
4614
4673
  return postToken(
4615
4674
  deps,
4616
4675
  {
@@ -4618,7 +4677,8 @@ function exchangeAuthorizationCodeServer(deps, code) {
4618
4677
  code,
4619
4678
  client_id: deps.clientId,
4620
4679
  client_secret: deps.clientSecret,
4621
- redirect_uri: deps.redirectUri
4680
+ redirect_uri: deps.redirectUri,
4681
+ code_verifier: codeVerifier
4622
4682
  },
4623
4683
  FFID_ERROR_CODES.TOKEN_EXCHANGE_ERROR
4624
4684
  );
@@ -4639,6 +4699,7 @@ function refreshTokensServer(deps, refreshToken) {
4639
4699
  // src/server/auth/server-auth-client.ts
4640
4700
  var OAUTH_AUTHORIZE_ENDPOINT2 = "/api/v1/oauth/authorize";
4641
4701
  var SCREEN_HINT_SIGNUP2 = "signup";
4702
+ var CODE_CHALLENGE_METHOD_S256 = "S256";
4642
4703
  function createServerAuthClient(config) {
4643
4704
  if (!config.serviceCode?.trim()) {
4644
4705
  throw new Error("FFID Server Auth: serviceCode \u304C\u672A\u8A2D\u5B9A\u3067\u3059");
@@ -4663,20 +4724,29 @@ function createServerAuthClient(config) {
4663
4724
  redirectUri: config.redirectUri,
4664
4725
  timeout: config.timeout
4665
4726
  };
4666
- function buildAuthorizeUrl(opts) {
4727
+ async function buildAuthorizeUrl(opts) {
4667
4728
  const state = generateServerState();
4729
+ const codeVerifier = generateCodeVerifier();
4730
+ const codeChallenge = await generateCodeChallenge(codeVerifier);
4668
4731
  const params = new URLSearchParams({
4669
4732
  response_type: "code",
4670
4733
  client_id: clientId,
4671
4734
  scope: config.scope,
4672
4735
  redirect_uri: config.redirectUri,
4673
- state
4736
+ state,
4737
+ code_challenge: codeChallenge,
4738
+ code_challenge_method: CODE_CHALLENGE_METHOD_S256
4674
4739
  });
4675
4740
  const organizationId = opts?.organizationId?.trim();
4676
4741
  if (organizationId) params.set("organization_id", organizationId);
4677
4742
  if (opts?.screenHint === SCREEN_HINT_SIGNUP2) params.set("screen_hint", SCREEN_HINT_SIGNUP2);
4678
4743
  if (opts?.prompt) params.set("prompt", opts.prompt);
4679
- return { url: `${apiBaseUrl}${OAUTH_AUTHORIZE_ENDPOINT2}?${params.toString()}`, state };
4744
+ return {
4745
+ url: `${apiBaseUrl}${OAUTH_AUTHORIZE_ENDPOINT2}?${params.toString()}`,
4746
+ // Opaque cookie value: state + verifier. Only `state` and the challenge
4747
+ // reach the URL; the verifier stays in the caller's httpOnly cookie.
4748
+ state: packStoredLoginHandle({ state, codeVerifier })
4749
+ };
4680
4750
  }
4681
4751
  async function handleCallback(input) {
4682
4752
  let url;
@@ -4690,12 +4760,15 @@ function createServerAuthClient(config) {
4690
4760
  }
4691
4761
  };
4692
4762
  }
4763
+ const stored = unpackStoredLoginHandle(input.storedState);
4693
4764
  const returnedState = url.searchParams.get("state") ?? void 0;
4694
- if (!input.storedState || !returnedState || input.storedState !== returnedState) {
4765
+ if (!stored || !returnedState || stored.state !== returnedState) {
4695
4766
  return {
4696
4767
  error: {
4697
4768
  code: FFID_ERROR_CODES.STATE_MISMATCH_ERROR,
4698
- message: "OAuth state \u304C\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002CSRF \u306E\u53EF\u80FD\u6027\u304C\u3042\u308B\u305F\u3081\u8A8D\u8A3C\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F"
4769
+ // Not "CSRF suspected": a state-only cookie written before 12.0.0 also
4770
+ // lands here, once per in-flight login across the upgrade (#6611).
4771
+ message: "OAuth state \u304C\u4E00\u81F4\u3057\u306A\u3044\u304B\u3001\u30ED\u30B0\u30A4\u30F3\u306E\u958B\u59CB\u304B\u3089\u6642\u9593\u304C\u7D4C\u3063\u3066\u3044\u307E\u3059\u3002\u3082\u3046\u4E00\u5EA6\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u304F\u3060\u3055\u3044"
4699
4772
  }
4700
4773
  };
4701
4774
  }
@@ -4712,7 +4785,7 @@ function createServerAuthClient(config) {
4712
4785
  }
4713
4786
  };
4714
4787
  }
4715
- return exchangeAuthorizationCodeServer(deps, code);
4788
+ return exchangeAuthorizationCodeServer(deps, code, stored.codeVerifier);
4716
4789
  }
4717
4790
  function refresh(refreshToken) {
4718
4791
  return refreshTokensServer(deps, refreshToken);
@@ -1,5 +1,5 @@
1
- import { F as FFIDError, a as FFIDLogger, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo, f as FFIDCatalogEnvironment, g as FFIDBillingInterval, h as FFIDTaxBehavior, i as FFIDPublishedCatalog } from '../ffid-client-qcfCWLfs.cjs';
2
- export { j as FFIDAddMemberParams, k as FFIDAddMemberRequest, l as FFIDAddMemberResponse, m as FFIDAllowedLogoMimeType, n as FFIDAssignableMemberRole, o as FFIDCacheConfig, p as FFIDCatalogPublication, q as FFIDCatalogPublicationStatus, r as FFIDClient, s as FFIDCompanySizeCode, t as FFIDConfig, u as FFIDIndustryCode, v as FFIDListMembersResponse, w as FFIDListingConsentInput, x as FFIDLogoWallEntry, y as FFIDLogoWallResponse, z as FFIDMemberRole, A as FFIDOrganization, B as FFIDOrganizationLogoUploadResponse, C as FFIDOrganizationMember, D as FFIDOrganizationProfile, E as FFIDOrganizationProfileErrorCode, G as FFIDOrganizationProfileResponse, H as FFIDOtpSendResponse, I as FFIDOtpVerifyResponse, J as FFIDPasswordResetConfirmResponse, K as FFIDPasswordResetResponse, L as FFIDPasswordResetVerifyResponse, M as FFIDProfileCallOptions, N as FFIDProvisionMemberPlan, O as FFIDProvisionMemberPlanStatus, P as FFIDProvisionMemberResult, Q as FFIDProvisionMemberStatus, R as FFIDProvisionOrganizationDryRun, S as FFIDProvisionOrganizationMemberInput, T as FFIDProvisionOrganizationOutcome, U as FFIDProvisionOrganizationParams, V as FFIDProvisionOrganizationResponse, W as FFIDProvisionUserDryRun, X as FFIDProvisionUserOutcome, Y as FFIDProvisionUserParams, Z as FFIDProvisionUserProfileInput, _ as FFIDProvisionUserResponse, $ as FFIDProvisionedOrganization, a0 as FFIDProvisionedUser, a1 as FFIDPublishedPlan, a2 as FFIDRemoveMemberResponse, a3 as FFIDResetSessionResponse, a4 as FFIDSubscription, a5 as FFIDUpdateMemberRoleResponse, a6 as FFIDUpdateUserProfileRequest, a7 as FFIDUploadOrganizationLogoParams, a8 as FFIDUpsertOrganizationProfileParams, a9 as FFIDUpsertOrganizationProfileRequest, aa as FFIDUser, ab as FFIDUserProfile, ac as FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, ad as FFID_CATALOG_ENVIRONMENTS, ae as FFID_CATALOG_PUBLICATION_STATUSES, af as FFID_COMPANY_SIZE_CODES, ag as FFID_INDUSTRY_CODES, ah as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, ai as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, aj as FFID_ORGANIZATION_PROFILE_ERROR_CODES, ak as TokenData, al as TokenStore, am as createFFIDClient, an as createTokenStore } from '../ffid-client-qcfCWLfs.cjs';
1
+ import { F as FFIDError, a as FFIDLogger, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo, f as FFIDCatalogEnvironment, g as FFIDBillingInterval, h as FFIDTaxBehavior, i as FFIDPublishedCatalog } from '../ffid-client-DW8_m1_M.cjs';
2
+ export { j as FFIDAddMemberParams, k as FFIDAddMemberRequest, l as FFIDAddMemberResponse, m as FFIDAllowedLogoMimeType, n as FFIDAssignableMemberRole, o as FFIDCacheConfig, p as FFIDCatalogPublication, q as FFIDCatalogPublicationStatus, r as FFIDClient, s as FFIDCompanySizeCode, t as FFIDConfig, u as FFIDIndustryCode, v as FFIDListMembersResponse, w as FFIDListingConsentInput, x as FFIDLogoWallEntry, y as FFIDLogoWallResponse, z as FFIDMemberRole, A as FFIDMemberSeatAssignmentResult, B as FFIDOrganization, C as FFIDOrganizationLogoUploadResponse, D as FFIDOrganizationMember, E as FFIDOrganizationProfile, G as FFIDOrganizationProfileErrorCode, H as FFIDOrganizationProfileResponse, I as FFIDOtpSendResponse, J as FFIDOtpVerifyResponse, K as FFIDPasswordResetConfirmResponse, L as FFIDPasswordResetResponse, M as FFIDPasswordResetVerifyResponse, N as FFIDProfileCallOptions, O as FFIDProvisionMemberPlan, P as FFIDProvisionMemberPlanStatus, Q as FFIDProvisionMemberResult, R as FFIDProvisionMemberStatus, S as FFIDProvisionOrganizationDryRun, T as FFIDProvisionOrganizationMemberInput, U as FFIDProvisionOrganizationOutcome, V as FFIDProvisionOrganizationParams, W as FFIDProvisionOrganizationResponse, X as FFIDProvisionUserDryRun, Y as FFIDProvisionUserOutcome, Z as FFIDProvisionUserParams, _ as FFIDProvisionUserProfileInput, $ as FFIDProvisionUserResponse, a0 as FFIDProvisionedOrganization, a1 as FFIDProvisionedUser, a2 as FFIDPublishedPlan, a3 as FFIDRemoveMemberResponse, a4 as FFIDResetSessionResponse, a5 as FFIDSubscription, a6 as FFIDUpdateMemberRoleResponse, a7 as FFIDUpdateUserProfileRequest, a8 as FFIDUploadOrganizationLogoParams, a9 as FFIDUpsertOrganizationProfileParams, aa as FFIDUpsertOrganizationProfileRequest, ab as FFIDUser, ac as FFIDUserProfile, ad as FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, ae as FFID_CATALOG_ENVIRONMENTS, af as FFID_CATALOG_PUBLICATION_STATUSES, ag as FFID_COMPANY_SIZE_CODES, ah as FFID_INDUSTRY_CODES, ai as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, aj as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, ak as FFID_ORGANIZATION_PROFILE_ERROR_CODES, al as TokenData, am as TokenStore, an as createFFIDClient, ao as createTokenStore } from '../ffid-client-DW8_m1_M.cjs';
3
3
  export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-Ce2eXQtB.cjs';
4
4
  import { z } from 'zod';
5
5
  import '../types-Cjb9J0rL.cjs';
@@ -356,14 +356,22 @@ interface BuildAuthorizeUrlOptions {
356
356
  interface BuildAuthorizeUrlResult {
357
357
  /** Authorize URL to 302 the browser to. */
358
358
  url: string;
359
- /** Random `state` — persist in an httpOnly cookie and pass back as `storedState`. */
359
+ /**
360
+ * Opaque value to persist in an httpOnly cookie and pass back as
361
+ * `storedState`. Since 12.0.0 (#6611) it is `<state>.<code_verifier>`, not the
362
+ * raw OAuth `state` — do not compare it with the callback's `state` query
363
+ * yourself, and do not parse it; {@link ServerAuthClient.handleCallback} does.
364
+ */
360
365
  state: string;
361
366
  }
362
367
  /** Input to {@link ServerAuthClient.handleCallback}. */
363
368
  interface HandleCallbackInput {
364
369
  /** The callback request URL (absolute). `code` / `state` are read from its query. */
365
370
  url: string | URL;
366
- /** The `state` previously stored in the httpOnly cookie (undefined if absent). */
371
+ /**
372
+ * The value previously stored in the httpOnly cookie — `result.state` from
373
+ * {@link ServerAuthClient.buildAuthorizeUrl}, verbatim (undefined if absent).
374
+ */
367
375
  storedState: string | undefined;
368
376
  }
369
377
  /**
@@ -380,14 +388,18 @@ type ServerTokenResult = {
380
388
  /** Framework-agnostic confidential / BFF auth client. */
381
389
  interface ServerAuthClient {
382
390
  /**
383
- * Build the authorize URL and a fresh `state`. The caller stores `state` in an
384
- * httpOnly cookie, then 302s to `url`. No `code_challenge` is sent (v1 uses
385
- * `client_secret`, not PKCE).
391
+ * Build the authorize URL with a fresh `state` and a PKCE S256
392
+ * `code_challenge` (#6611). The caller stores the returned `state` (which also
393
+ * carries the `code_verifier`) in an httpOnly cookie, then 302s to `url`.
394
+ * Async since 12.0.0 — the S256 challenge uses Web Crypto `subtle.digest`.
386
395
  */
387
- buildAuthorizeUrl(opts?: BuildAuthorizeUrlOptions): BuildAuthorizeUrlResult;
396
+ buildAuthorizeUrl(opts?: BuildAuthorizeUrlOptions): Promise<BuildAuthorizeUrlResult>;
388
397
  /**
389
- * Validate `state` (CSRF, fail-closed) then exchange `code` for tokens using
390
- * the `client_secret` (server→server, browser never sees the secret or tokens).
398
+ * Validate `state` (CSRF, fail-closed; a stored value without the PKCE
399
+ * verifier is also a mismatch) then exchange `code` for tokens using the
400
+ * `client_secret` and `code_verifier` (server→server; browser JS never reads
401
+ * the secret, the verifier, or the tokens — the verifier and tokens travel only
402
+ * in httpOnly cookies, never in a URL).
391
403
  */
392
404
  handleCallback(input: HandleCallbackInput): Promise<ServerTokenResult>;
393
405
  /** Refresh tokens (`refresh_token` grant, `client_secret`-authenticated). */
@@ -1,5 +1,5 @@
1
- import { F as FFIDError, a as FFIDLogger, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo, f as FFIDCatalogEnvironment, g as FFIDBillingInterval, h as FFIDTaxBehavior, i as FFIDPublishedCatalog } from '../ffid-client-DUbQLYTN.js';
2
- export { j as FFIDAddMemberParams, k as FFIDAddMemberRequest, l as FFIDAddMemberResponse, m as FFIDAllowedLogoMimeType, n as FFIDAssignableMemberRole, o as FFIDCacheConfig, p as FFIDCatalogPublication, q as FFIDCatalogPublicationStatus, r as FFIDClient, s as FFIDCompanySizeCode, t as FFIDConfig, u as FFIDIndustryCode, v as FFIDListMembersResponse, w as FFIDListingConsentInput, x as FFIDLogoWallEntry, y as FFIDLogoWallResponse, z as FFIDMemberRole, A as FFIDOrganization, B as FFIDOrganizationLogoUploadResponse, C as FFIDOrganizationMember, D as FFIDOrganizationProfile, E as FFIDOrganizationProfileErrorCode, G as FFIDOrganizationProfileResponse, H as FFIDOtpSendResponse, I as FFIDOtpVerifyResponse, J as FFIDPasswordResetConfirmResponse, K as FFIDPasswordResetResponse, L as FFIDPasswordResetVerifyResponse, M as FFIDProfileCallOptions, N as FFIDProvisionMemberPlan, O as FFIDProvisionMemberPlanStatus, P as FFIDProvisionMemberResult, Q as FFIDProvisionMemberStatus, R as FFIDProvisionOrganizationDryRun, S as FFIDProvisionOrganizationMemberInput, T as FFIDProvisionOrganizationOutcome, U as FFIDProvisionOrganizationParams, V as FFIDProvisionOrganizationResponse, W as FFIDProvisionUserDryRun, X as FFIDProvisionUserOutcome, Y as FFIDProvisionUserParams, Z as FFIDProvisionUserProfileInput, _ as FFIDProvisionUserResponse, $ as FFIDProvisionedOrganization, a0 as FFIDProvisionedUser, a1 as FFIDPublishedPlan, a2 as FFIDRemoveMemberResponse, a3 as FFIDResetSessionResponse, a4 as FFIDSubscription, a5 as FFIDUpdateMemberRoleResponse, a6 as FFIDUpdateUserProfileRequest, a7 as FFIDUploadOrganizationLogoParams, a8 as FFIDUpsertOrganizationProfileParams, a9 as FFIDUpsertOrganizationProfileRequest, aa as FFIDUser, ab as FFIDUserProfile, ac as FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, ad as FFID_CATALOG_ENVIRONMENTS, ae as FFID_CATALOG_PUBLICATION_STATUSES, af as FFID_COMPANY_SIZE_CODES, ag as FFID_INDUSTRY_CODES, ah as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, ai as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, aj as FFID_ORGANIZATION_PROFILE_ERROR_CODES, ak as TokenData, al as TokenStore, am as createFFIDClient, an as createTokenStore } from '../ffid-client-DUbQLYTN.js';
1
+ import { F as FFIDError, a as FFIDLogger, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo, f as FFIDCatalogEnvironment, g as FFIDBillingInterval, h as FFIDTaxBehavior, i as FFIDPublishedCatalog } from '../ffid-client-ByfZA9sJ.js';
2
+ export { j as FFIDAddMemberParams, k as FFIDAddMemberRequest, l as FFIDAddMemberResponse, m as FFIDAllowedLogoMimeType, n as FFIDAssignableMemberRole, o as FFIDCacheConfig, p as FFIDCatalogPublication, q as FFIDCatalogPublicationStatus, r as FFIDClient, s as FFIDCompanySizeCode, t as FFIDConfig, u as FFIDIndustryCode, v as FFIDListMembersResponse, w as FFIDListingConsentInput, x as FFIDLogoWallEntry, y as FFIDLogoWallResponse, z as FFIDMemberRole, A as FFIDMemberSeatAssignmentResult, B as FFIDOrganization, C as FFIDOrganizationLogoUploadResponse, D as FFIDOrganizationMember, E as FFIDOrganizationProfile, G as FFIDOrganizationProfileErrorCode, H as FFIDOrganizationProfileResponse, I as FFIDOtpSendResponse, J as FFIDOtpVerifyResponse, K as FFIDPasswordResetConfirmResponse, L as FFIDPasswordResetResponse, M as FFIDPasswordResetVerifyResponse, N as FFIDProfileCallOptions, O as FFIDProvisionMemberPlan, P as FFIDProvisionMemberPlanStatus, Q as FFIDProvisionMemberResult, R as FFIDProvisionMemberStatus, S as FFIDProvisionOrganizationDryRun, T as FFIDProvisionOrganizationMemberInput, U as FFIDProvisionOrganizationOutcome, V as FFIDProvisionOrganizationParams, W as FFIDProvisionOrganizationResponse, X as FFIDProvisionUserDryRun, Y as FFIDProvisionUserOutcome, Z as FFIDProvisionUserParams, _ as FFIDProvisionUserProfileInput, $ as FFIDProvisionUserResponse, a0 as FFIDProvisionedOrganization, a1 as FFIDProvisionedUser, a2 as FFIDPublishedPlan, a3 as FFIDRemoveMemberResponse, a4 as FFIDResetSessionResponse, a5 as FFIDSubscription, a6 as FFIDUpdateMemberRoleResponse, a7 as FFIDUpdateUserProfileRequest, a8 as FFIDUploadOrganizationLogoParams, a9 as FFIDUpsertOrganizationProfileParams, aa as FFIDUpsertOrganizationProfileRequest, ab as FFIDUser, ac as FFIDUserProfile, ad as FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, ae as FFID_CATALOG_ENVIRONMENTS, af as FFID_CATALOG_PUBLICATION_STATUSES, ag as FFID_COMPANY_SIZE_CODES, ah as FFID_INDUSTRY_CODES, ai as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, aj as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, ak as FFID_ORGANIZATION_PROFILE_ERROR_CODES, al as TokenData, am as TokenStore, an as createFFIDClient, ao as createTokenStore } from '../ffid-client-ByfZA9sJ.js';
3
3
  export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-Ce2eXQtB.js';
4
4
  import { z } from 'zod';
5
5
  import '../types-Cjb9J0rL.js';
@@ -356,14 +356,22 @@ interface BuildAuthorizeUrlOptions {
356
356
  interface BuildAuthorizeUrlResult {
357
357
  /** Authorize URL to 302 the browser to. */
358
358
  url: string;
359
- /** Random `state` — persist in an httpOnly cookie and pass back as `storedState`. */
359
+ /**
360
+ * Opaque value to persist in an httpOnly cookie and pass back as
361
+ * `storedState`. Since 12.0.0 (#6611) it is `<state>.<code_verifier>`, not the
362
+ * raw OAuth `state` — do not compare it with the callback's `state` query
363
+ * yourself, and do not parse it; {@link ServerAuthClient.handleCallback} does.
364
+ */
360
365
  state: string;
361
366
  }
362
367
  /** Input to {@link ServerAuthClient.handleCallback}. */
363
368
  interface HandleCallbackInput {
364
369
  /** The callback request URL (absolute). `code` / `state` are read from its query. */
365
370
  url: string | URL;
366
- /** The `state` previously stored in the httpOnly cookie (undefined if absent). */
371
+ /**
372
+ * The value previously stored in the httpOnly cookie — `result.state` from
373
+ * {@link ServerAuthClient.buildAuthorizeUrl}, verbatim (undefined if absent).
374
+ */
367
375
  storedState: string | undefined;
368
376
  }
369
377
  /**
@@ -380,14 +388,18 @@ type ServerTokenResult = {
380
388
  /** Framework-agnostic confidential / BFF auth client. */
381
389
  interface ServerAuthClient {
382
390
  /**
383
- * Build the authorize URL and a fresh `state`. The caller stores `state` in an
384
- * httpOnly cookie, then 302s to `url`. No `code_challenge` is sent (v1 uses
385
- * `client_secret`, not PKCE).
391
+ * Build the authorize URL with a fresh `state` and a PKCE S256
392
+ * `code_challenge` (#6611). The caller stores the returned `state` (which also
393
+ * carries the `code_verifier`) in an httpOnly cookie, then 302s to `url`.
394
+ * Async since 12.0.0 — the S256 challenge uses Web Crypto `subtle.digest`.
386
395
  */
387
- buildAuthorizeUrl(opts?: BuildAuthorizeUrlOptions): BuildAuthorizeUrlResult;
396
+ buildAuthorizeUrl(opts?: BuildAuthorizeUrlOptions): Promise<BuildAuthorizeUrlResult>;
388
397
  /**
389
- * Validate `state` (CSRF, fail-closed) then exchange `code` for tokens using
390
- * the `client_secret` (server→server, browser never sees the secret or tokens).
398
+ * Validate `state` (CSRF, fail-closed; a stored value without the PKCE
399
+ * verifier is also a mismatch) then exchange `code` for tokens using the
400
+ * `client_secret` and `code_verifier` (server→server; browser JS never reads
401
+ * the secret, the verifier, or the tokens — the verifier and tokens travel only
402
+ * in httpOnly cookies, never in a URL).
391
403
  */
392
404
  handleCallback(input: HandleCallbackInput): Promise<ServerTokenResult>;
393
405
  /** Refresh tokens (`refresh_token` grant, `client_secret`-authenticated). */