@feelflow/ffid-sdk 10.1.0 → 11.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.
@@ -961,12 +961,19 @@ interface FFIDBuyCreditsUrlParams {
961
961
  type FFIDSubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'canceled' | 'pending_invoice' | 'paused' | 'incomplete' | 'incomplete_expired' | 'unpaid';
962
962
  interface FFIDSubscriptionCheckResponse {
963
963
  hasActiveSubscription: boolean;
964
+ /**
965
+ * Active seat for the requested user; null for organization-only checks.
966
+ * Older servers omit this field. User access requires hasAccess AND
967
+ * seatAssigned === true; an omitted/null value is not proof of a seat.
968
+ */
969
+ seatAssigned?: boolean | null;
964
970
  /**
965
971
  * Canonical access decision returned by FFID's `/subscriptions/ext/check`.
966
972
  *
967
973
  * This is the server-side source of truth for service gates. Consumers
968
974
  * should not recompute access from `currentPeriodEnd`, `past_due_since`, or
969
975
  * local payment timestamps.
976
+ * This is contract access; user access also requires seatAssigned === true.
970
977
  */
971
978
  hasAccess?: boolean;
972
979
  /** True when `effectiveStatus === 'past_due_grace'`. */
@@ -996,9 +1003,11 @@ interface FFIDSubscriptionCheckResponse {
996
1003
  */
997
1004
  pricingModel?: FFIDPricingModel | null;
998
1005
  /**
999
- * Credit balance summary — flat plans only (10.0.0). `null` for per_seat, for no
1000
- * subscription, **and** when FFID could not read the ledger, so `null` does not
1001
- * mean "not flat" (use `pricingModel`). Never affects `hasAccess`.
1006
+ * Credit balance summary — paid flat plans only (10.0.0). `null` for per_seat, for a
1007
+ * `free` plan (flat on the unified ladder since #6547, but outside credits — consume /
1008
+ * balance return 409 `CREDITS_NOT_APPLICABLE`), for no subscription, **and** when FFID
1009
+ * could not read the ledger, so `null` does not mean "not flat" (use `pricingModel`).
1010
+ * Never affects `hasAccess`.
1002
1011
  */
1003
1012
  credits?: FFIDSubscriptionCheckCredits | null;
1004
1013
  /**
@@ -1045,7 +1054,10 @@ interface FFIDServiceAccessError {
1045
1054
  details?: unknown;
1046
1055
  }
1047
1056
  interface FFIDServiceAccessDecision {
1057
+ /** Contract access; user access also requires seatAssigned === true. */
1048
1058
  hasAccess: boolean;
1059
+ /** User's active seat, passed through when returned. Gate user access with === true. */
1060
+ seatAssigned?: boolean | null;
1049
1061
  effectiveStatus: EffectiveSubscriptionStatus | null;
1050
1062
  isGrace: boolean;
1051
1063
  isBlocked: boolean;
@@ -1210,9 +1222,18 @@ interface FFIDAddMemberRequest {
1210
1222
  interface FFIDAddMemberParams extends FFIDAddMemberRequest {
1211
1223
  organizationId: string;
1212
1224
  }
1225
+ /** Seat assignment outcome after membership creation; membership exists in every case. */
1226
+ type FFIDMemberSeatAssignmentResult = 'assigned' | 'not_applicable' | 'member_limit_reached' | 'failed';
1213
1227
  /** Response from addMember (ext) */
1214
1228
  interface FFIDAddMemberResponse {
1215
1229
  member: FFIDOrganizationMember;
1230
+ /**
1231
+ * Membership creation can succeed even when seat assignment fails.
1232
+ * Omitted by older servers. `not_applicable`/undefined do not prove an active seat.
1233
+ * Check the authenticated user's hasAccess and seatAssigned before granting access;
1234
+ * do not automatically restore a removed seat on a duplicate-member retry.
1235
+ */
1236
+ seatAssignment?: FFIDMemberSeatAssignmentResult;
1216
1237
  }
1217
1238
  /** Response from updateMemberRole (ext) */
1218
1239
  interface FFIDUpdateMemberRoleResponse {
@@ -2431,11 +2452,10 @@ interface FFIDConfig {
2431
2452
  */
2432
2453
  cache?: FFIDCacheConfig | undefined;
2433
2454
  /**
2434
- * Request timeout in milliseconds for FFID API calls. Applies to server-side
2435
- * token verification / introspection and, in `token` mode, to the client-side
2436
- * OAuth operations (code exchange / refresh / revoke) — including via the
2437
- * `FFIDProvider` `timeout` prop (#4260). On timeout the fetch is aborted and
2438
- * surfaced through the normal error path (e.g. `NETWORK_ERROR`).
2455
+ * Per-HTTP timeout (ms): shared JSON APIs (e.g. checkSubscription/getProfile),
2456
+ * token verification/introspection, token OAuth exchange/refresh/revoke; also FFIDProvider.timeout.
2457
+ * Shared JSON includes body and preserves signals; refresh/retry have separate deadlines.
2458
+ * Excludes token getSession, cookie signOut, public/newsletter/inquiry; not a method deadline.
2439
2459
  * @default undefined (no timeout, uses fetch default)
2440
2460
  */
2441
2461
  timeout?: number | undefined;
@@ -2801,6 +2821,7 @@ declare function createFFIDClient(config: FFIDConfig): {
2801
2821
  organizationId: string;
2802
2822
  email: string;
2803
2823
  role?: FFIDAssignableMemberRole;
2824
+ inviterUserId?: string;
2804
2825
  }) => Promise<FFIDApiResponse<FFIDInviteMemberResponse>>;
2805
2826
  leaveOrganization: (params: FFIDLeaveOrganizationParams) => Promise<FFIDApiResponse<FFIDLeaveOrganizationResponse>>;
2806
2827
  getAnalyticsConfig: (serviceCode: string, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDAnalyticsConfig>>;
@@ -2887,4 +2908,4 @@ declare function createFFIDClient(config: FFIDConfig): {
2887
2908
  /** Type of the FFID client */
2888
2909
  type FFIDClient = ReturnType<typeof createFFIDClient>;
2889
2910
 
2890
- export { type FFIDProvisionedOrganization as $, type FFIDOrganization as A, type FFIDOrganizationLogoUploadResponse as B, type FFIDOrganizationMember as C, type FFIDOrganizationProfile as D, type FFIDOrganizationProfileErrorCode as E, type FFIDError as F, type FFIDOrganizationProfileResponse as G, type FFIDOtpSendResponse as H, type FFIDOtpVerifyResponse as I, type FFIDPasswordResetConfirmResponse as J, type FFIDPasswordResetResponse as K, type FFIDPasswordResetVerifyResponse as L, type FFIDProfileCallOptions as M, type FFIDProvisionMemberPlan as N, type FFIDProvisionMemberPlanStatus as O, type FFIDProvisionMemberResult as P, type FFIDProvisionMemberStatus as Q, type FFIDProvisionOrganizationDryRun as R, type FFIDProvisionOrganizationMemberInput as S, type FFIDProvisionOrganizationOutcome as T, type FFIDProvisionOrganizationParams as U, type FFIDProvisionOrganizationResponse as V, type FFIDProvisionUserDryRun as W, type FFIDProvisionUserOutcome as X, type FFIDProvisionUserParams as Y, type FFIDProvisionUserProfileInput as Z, type FFIDProvisionUserResponse as _, type FFIDLogger as a, type FFIDProvisionedUser as a0, type FFIDPublishedPlan as a1, type FFIDRemoveMemberResponse as a2, type FFIDResetSessionResponse as a3, type FFIDSubscription as a4, type FFIDUpdateMemberRoleResponse as a5, type FFIDUpdateUserProfileRequest as a6, type FFIDUploadOrganizationLogoParams as a7, type FFIDUpsertOrganizationProfileParams as a8, type FFIDUpsertOrganizationProfileRequest as a9, type FFIDUser as aa, type FFIDUserProfile as ab, FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES as ac, FFID_CATALOG_ENVIRONMENTS as ad, FFID_CATALOG_PUBLICATION_STATUSES as ae, FFID_COMPANY_SIZE_CODES as af, FFID_INDUSTRY_CODES as ag, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES as ah, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB as ai, FFID_ORGANIZATION_PROFILE_ERROR_CODES as aj, type TokenData as ak, type TokenStore as al, createFFIDClient as am, createTokenStore as an, type FFIDCacheAdapter as b, type FFIDVerifyAccessTokenOptions as c, type FFIDApiResponse as d, type FFIDOAuthUserInfo as e, type FFIDCatalogEnvironment as f, type FFIDBillingInterval as g, type FFIDTaxBehavior as h, type FFIDPublishedCatalog as i, type FFIDAddMemberParams as j, type FFIDAddMemberRequest as k, type FFIDAddMemberResponse as l, type FFIDAllowedLogoMimeType as m, type FFIDAssignableMemberRole as n, type FFIDCacheConfig as o, type FFIDCatalogPublication as p, type FFIDCatalogPublicationStatus as q, type FFIDClient as r, type FFIDCompanySizeCode as s, type FFIDConfig as t, type FFIDIndustryCode as u, type FFIDListMembersResponse as v, type FFIDListingConsentInput as w, type FFIDLogoWallEntry as x, type FFIDLogoWallResponse as y, type FFIDMemberRole as z };
2911
+ export { type FFIDProvisionUserResponse as $, type FFIDMemberSeatAssignmentResult as A, type FFIDOrganization as B, type FFIDOrganizationLogoUploadResponse as C, type FFIDOrganizationMember as D, type FFIDOrganizationProfile as E, type FFIDError as F, type FFIDOrganizationProfileErrorCode as G, type FFIDOrganizationProfileResponse as H, type FFIDOtpSendResponse as I, type FFIDOtpVerifyResponse as J, type FFIDPasswordResetConfirmResponse as K, type FFIDPasswordResetResponse as L, type FFIDPasswordResetVerifyResponse as M, type FFIDProfileCallOptions as N, type FFIDProvisionMemberPlan as O, type FFIDProvisionMemberPlanStatus as P, type FFIDProvisionMemberResult as Q, type FFIDProvisionMemberStatus as R, type FFIDProvisionOrganizationDryRun as S, type FFIDProvisionOrganizationMemberInput as T, type FFIDProvisionOrganizationOutcome as U, type FFIDProvisionOrganizationParams as V, type FFIDProvisionOrganizationResponse as W, type FFIDProvisionUserDryRun as X, type FFIDProvisionUserOutcome as Y, type FFIDProvisionUserParams as Z, type FFIDProvisionUserProfileInput as _, type FFIDLogger as a, type FFIDProvisionedOrganization as a0, type FFIDProvisionedUser as a1, type FFIDPublishedPlan as a2, type FFIDRemoveMemberResponse as a3, type FFIDResetSessionResponse as a4, type FFIDSubscription as a5, type FFIDUpdateMemberRoleResponse as a6, type FFIDUpdateUserProfileRequest as a7, type FFIDUploadOrganizationLogoParams as a8, type FFIDUpsertOrganizationProfileParams as a9, type FFIDUpsertOrganizationProfileRequest as aa, type FFIDUser as ab, type FFIDUserProfile as ac, FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES as ad, FFID_CATALOG_ENVIRONMENTS as ae, FFID_CATALOG_PUBLICATION_STATUSES as af, FFID_COMPANY_SIZE_CODES as ag, FFID_INDUSTRY_CODES as ah, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES as ai, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB as aj, FFID_ORGANIZATION_PROFILE_ERROR_CODES as ak, type TokenData as al, type TokenStore as am, createFFIDClient as an, createTokenStore as ao, type FFIDCacheAdapter as b, type FFIDVerifyAccessTokenOptions as c, type FFIDApiResponse as d, type FFIDOAuthUserInfo as e, type FFIDCatalogEnvironment as f, type FFIDBillingInterval as g, type FFIDTaxBehavior as h, type FFIDPublishedCatalog as i, type FFIDAddMemberParams as j, type FFIDAddMemberRequest as k, type FFIDAddMemberResponse as l, type FFIDAllowedLogoMimeType as m, type FFIDAssignableMemberRole as n, type FFIDCacheConfig as o, type FFIDCatalogPublication as p, type FFIDCatalogPublicationStatus as q, type FFIDClient as r, type FFIDCompanySizeCode as s, type FFIDConfig as t, type FFIDIndustryCode as u, type FFIDListMembersResponse as v, type FFIDListingConsentInput as w, type FFIDLogoWallEntry as x, type FFIDLogoWallResponse as y, type FFIDMemberRole as z };
@@ -909,12 +909,19 @@ interface FFIDBuyCreditsUrlParams {
909
909
  type FFIDSubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'canceled' | 'pending_invoice' | 'paused' | 'incomplete' | 'incomplete_expired' | 'unpaid';
910
910
  interface FFIDSubscriptionCheckResponse {
911
911
  hasActiveSubscription: boolean;
912
+ /**
913
+ * Active seat for the requested user; null for organization-only checks.
914
+ * Older servers omit this field. User access requires hasAccess AND
915
+ * seatAssigned === true; an omitted/null value is not proof of a seat.
916
+ */
917
+ seatAssigned?: boolean | null;
912
918
  /**
913
919
  * Canonical access decision returned by FFID's `/subscriptions/ext/check`.
914
920
  *
915
921
  * This is the server-side source of truth for service gates. Consumers
916
922
  * should not recompute access from `currentPeriodEnd`, `past_due_since`, or
917
923
  * local payment timestamps.
924
+ * This is contract access; user access also requires seatAssigned === true.
918
925
  */
919
926
  hasAccess?: boolean;
920
927
  /** True when `effectiveStatus === 'past_due_grace'`. */
@@ -944,9 +951,11 @@ interface FFIDSubscriptionCheckResponse {
944
951
  */
945
952
  pricingModel?: FFIDPricingModel | null;
946
953
  /**
947
- * Credit balance summary — flat plans only (10.0.0). `null` for per_seat, for no
948
- * subscription, **and** when FFID could not read the ledger, so `null` does not
949
- * mean "not flat" (use `pricingModel`). Never affects `hasAccess`.
954
+ * Credit balance summary — paid flat plans only (10.0.0). `null` for per_seat, for a
955
+ * `free` plan (flat on the unified ladder since #6547, but outside credits — consume /
956
+ * balance return 409 `CREDITS_NOT_APPLICABLE`), for no subscription, **and** when FFID
957
+ * could not read the ledger, so `null` does not mean "not flat" (use `pricingModel`).
958
+ * Never affects `hasAccess`.
950
959
  */
951
960
  credits?: FFIDSubscriptionCheckCredits | null;
952
961
  /**
@@ -993,7 +1002,10 @@ interface FFIDServiceAccessError {
993
1002
  details?: unknown;
994
1003
  }
995
1004
  interface FFIDServiceAccessDecision {
1005
+ /** Contract access; user access also requires seatAssigned === true. */
996
1006
  hasAccess: boolean;
1007
+ /** User's active seat, passed through when returned. Gate user access with === true. */
1008
+ seatAssigned?: boolean | null;
997
1009
  effectiveStatus: EffectiveSubscriptionStatus | null;
998
1010
  isGrace: boolean;
999
1011
  isBlocked: boolean;
@@ -1351,11 +1363,10 @@ interface FFIDConfig {
1351
1363
  */
1352
1364
  cache?: FFIDCacheConfig | undefined;
1353
1365
  /**
1354
- * Request timeout in milliseconds for FFID API calls. Applies to server-side
1355
- * token verification / introspection and, in `token` mode, to the client-side
1356
- * OAuth operations (code exchange / refresh / revoke) — including via the
1357
- * `FFIDProvider` `timeout` prop (#4260). On timeout the fetch is aborted and
1358
- * surfaced through the normal error path (e.g. `NETWORK_ERROR`).
1366
+ * Per-HTTP timeout (ms): shared JSON APIs (e.g. checkSubscription/getProfile),
1367
+ * token verification/introspection, token OAuth exchange/refresh/revoke; also FFIDProvider.timeout.
1368
+ * Shared JSON includes body and preserves signals; refresh/retry have separate deadlines.
1369
+ * Excludes token getSession, cookie signOut, public/newsletter/inquiry; not a method deadline.
1359
1370
  * @default undefined (no timeout, uses fetch default)
1360
1371
  */
1361
1372
  timeout?: number | undefined;
@@ -909,12 +909,19 @@ interface FFIDBuyCreditsUrlParams {
909
909
  type FFIDSubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'canceled' | 'pending_invoice' | 'paused' | 'incomplete' | 'incomplete_expired' | 'unpaid';
910
910
  interface FFIDSubscriptionCheckResponse {
911
911
  hasActiveSubscription: boolean;
912
+ /**
913
+ * Active seat for the requested user; null for organization-only checks.
914
+ * Older servers omit this field. User access requires hasAccess AND
915
+ * seatAssigned === true; an omitted/null value is not proof of a seat.
916
+ */
917
+ seatAssigned?: boolean | null;
912
918
  /**
913
919
  * Canonical access decision returned by FFID's `/subscriptions/ext/check`.
914
920
  *
915
921
  * This is the server-side source of truth for service gates. Consumers
916
922
  * should not recompute access from `currentPeriodEnd`, `past_due_since`, or
917
923
  * local payment timestamps.
924
+ * This is contract access; user access also requires seatAssigned === true.
918
925
  */
919
926
  hasAccess?: boolean;
920
927
  /** True when `effectiveStatus === 'past_due_grace'`. */
@@ -944,9 +951,11 @@ interface FFIDSubscriptionCheckResponse {
944
951
  */
945
952
  pricingModel?: FFIDPricingModel | null;
946
953
  /**
947
- * Credit balance summary — flat plans only (10.0.0). `null` for per_seat, for no
948
- * subscription, **and** when FFID could not read the ledger, so `null` does not
949
- * mean "not flat" (use `pricingModel`). Never affects `hasAccess`.
954
+ * Credit balance summary — paid flat plans only (10.0.0). `null` for per_seat, for a
955
+ * `free` plan (flat on the unified ladder since #6547, but outside credits — consume /
956
+ * balance return 409 `CREDITS_NOT_APPLICABLE`), for no subscription, **and** when FFID
957
+ * could not read the ledger, so `null` does not mean "not flat" (use `pricingModel`).
958
+ * Never affects `hasAccess`.
950
959
  */
951
960
  credits?: FFIDSubscriptionCheckCredits | null;
952
961
  /**
@@ -993,7 +1002,10 @@ interface FFIDServiceAccessError {
993
1002
  details?: unknown;
994
1003
  }
995
1004
  interface FFIDServiceAccessDecision {
1005
+ /** Contract access; user access also requires seatAssigned === true. */
996
1006
  hasAccess: boolean;
1007
+ /** User's active seat, passed through when returned. Gate user access with === true. */
1008
+ seatAssigned?: boolean | null;
997
1009
  effectiveStatus: EffectiveSubscriptionStatus | null;
998
1010
  isGrace: boolean;
999
1011
  isBlocked: boolean;
@@ -1351,11 +1363,10 @@ interface FFIDConfig {
1351
1363
  */
1352
1364
  cache?: FFIDCacheConfig | undefined;
1353
1365
  /**
1354
- * Request timeout in milliseconds for FFID API calls. Applies to server-side
1355
- * token verification / introspection and, in `token` mode, to the client-side
1356
- * OAuth operations (code exchange / refresh / revoke) — including via the
1357
- * `FFIDProvider` `timeout` prop (#4260). On timeout the fetch is aborted and
1358
- * surfaced through the normal error path (e.g. `NETWORK_ERROR`).
1366
+ * Per-HTTP timeout (ms): shared JSON APIs (e.g. checkSubscription/getProfile),
1367
+ * token verification/introspection, token OAuth exchange/refresh/revoke; also FFIDProvider.timeout.
1368
+ * Shared JSON includes body and preserves signals; refresh/retry have separate deadlines.
1369
+ * Excludes token getSession, cookie signOut, public/newsletter/inquiry; not a method deadline.
1359
1370
  * @default undefined (no timeout, uses fetch default)
1360
1371
  */
1361
1372
  timeout?: number | undefined;