@feelflow/ffid-sdk 5.5.0 → 5.7.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/{chunk-JKP3MBTT.cjs → chunk-FXIDKFXQ.cjs} +16 -6
- package/dist/{chunk-WNYMSUHN.js → chunk-YAJN36SD.js} +16 -6
- package/dist/components/index.cjs +8 -8
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{ffid-client-CARfFhtf.d.cts → ffid-client-C0k2PTbO.d.ts} +72 -54
- package/dist/{ffid-client-w1s-JnFf.d.ts → ffid-client-CknwTgly.d.cts} +72 -54
- package/dist/{index-lAvUS_oz.d.cts → index-EFp_ZgK9.d.cts} +33 -55
- package/dist/{index-lAvUS_oz.d.ts → index-EFp_ZgK9.d.ts} +33 -55
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +87 -4
- package/dist/index.d.ts +87 -4
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +10 -3
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +10 -3
- package/dist/server/test/index.d.cts +2 -2
- package/dist/server/test/index.d.ts +2 -2
- package/dist/{types-5g_Bg6Ey.d.cts → types-s3y11uT6.d.cts} +22 -1
- package/dist/{types-5g_Bg6Ey.d.ts → types-s3y11uT6.d.ts} +22 -1
- package/dist/webhooks/index.d.cts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -41,6 +41,10 @@ interface FFIDCacheConfig {
|
|
|
41
41
|
* branch on a single value:
|
|
42
42
|
*
|
|
43
43
|
* - `active` — normal paying subscription; grant full access.
|
|
44
|
+
* - `active_canceling` — paying subscription with `cancel_at_period_end=true`.
|
|
45
|
+
* Access stays live until `currentPeriodEnd`; callers SHOULD surface a
|
|
46
|
+
* "cancellation scheduled" badge and a reactivation CTA. Session-only
|
|
47
|
+
* refinement of `active` — see the asymmetry note below.
|
|
44
48
|
* - `past_due_grace` — payment failed but FFID is still retrying. Service
|
|
45
49
|
* SHOULD keep access and surface a recovery banner.
|
|
46
50
|
* - `blocked` — payment dunning exhausted (`past_due` over grace,
|
|
@@ -53,10 +57,27 @@ interface FFIDCacheConfig {
|
|
|
53
57
|
* This is the FFID-internal runtime-expired case (see
|
|
54
58
|
* `getEffectiveSubscriptionStatus` on the server). Deny access.
|
|
55
59
|
*
|
|
60
|
+
* **SDK / server asymmetry — `active_canceling` is session-only (#3460).**
|
|
61
|
+
* The backend `EffectiveSubscriptionStatus` in
|
|
62
|
+
* `src/lib/common/subscription-helpers.ts` does NOT currently include
|
|
63
|
+
* `active_canceling`; cancellation-scheduled subscriptions surface as plain
|
|
64
|
+
* `'active'` on `/api/v1/subscriptions/ext/check` and `/oauth/userinfo`, and
|
|
65
|
+
* consumers that branch on the server verdict will not see the new literal.
|
|
66
|
+
* The SDK enriches `computeEffectiveStatusFromSession` with
|
|
67
|
+
* `cancelAtPeriodEnd` (carried on `FFIDSubscription` for FFID backends from
|
|
68
|
+
* #3460 onward — older backends omit the field and the helper defaults to
|
|
69
|
+
* `false`, preserving the pre-#3460 `'active'` verdict) so `useSubscription`
|
|
70
|
+
* can surface a "cancellation scheduled" badge without waiting for an
|
|
71
|
+
* `/ext/check` round-trip. The asymmetry is safe because the new literal is
|
|
72
|
+
* access-granting (no security regression on the userinfo path); when the
|
|
73
|
+
* server's `EffectiveSubscriptionStatus` is later extended to emit
|
|
74
|
+
* `active_canceling`, this docstring MUST be updated to drop the
|
|
75
|
+
* session-only note.
|
|
76
|
+
*
|
|
56
77
|
* @see /api/v1/subscriptions/ext/check
|
|
57
78
|
* @see docs/03-implementation/EXPIRED_CONTRACT_HANDLING.md
|
|
58
79
|
*/
|
|
59
|
-
type EffectiveSubscriptionStatus = 'active' | 'past_due_grace' | 'blocked' | 'canceled' | 'trial_expired' | 'expired';
|
|
80
|
+
type EffectiveSubscriptionStatus = 'active' | 'active_canceling' | 'past_due_grace' | 'blocked' | 'canceled' | 'trial_expired' | 'expired';
|
|
60
81
|
|
|
61
82
|
/**
|
|
62
83
|
* Canonical service-access types for subscription lifecycle decisions.
|
|
@@ -230,6 +251,16 @@ interface FFIDSubscription {
|
|
|
230
251
|
currentPeriodEnd: string | null;
|
|
231
252
|
/** Trial end date (null if not a trial or no trial_end set) */
|
|
232
253
|
trialEnd: string | null;
|
|
254
|
+
/**
|
|
255
|
+
* Whether the subscription is scheduled to cancel at the end of the current
|
|
256
|
+
* billing period (Stripe `cancel_at_period_end`). Optional for backward
|
|
257
|
+
* compatibility with FFID backends that pre-date #3460 — when absent,
|
|
258
|
+
* `useSubscription` treats the value as `false` and surfaces plain `active`.
|
|
259
|
+
* When `true` and the period has not yet ended, `effectiveStatus` becomes
|
|
260
|
+
* `active_canceling` so consumers can render a cancellation-scheduled badge
|
|
261
|
+
* + reactivation CTA without losing access.
|
|
262
|
+
*/
|
|
263
|
+
cancelAtPeriodEnd?: boolean;
|
|
233
264
|
/** Service seat model (available when sourced from OAuth userinfo) */
|
|
234
265
|
seatModel?: FFIDSeatModel | undefined;
|
|
235
266
|
/** Member role in the resolved organization context */
|
|
@@ -606,59 +637,6 @@ interface FFIDCreatePortalParams {
|
|
|
606
637
|
returnUrl: string;
|
|
607
638
|
}
|
|
608
639
|
|
|
609
|
-
/** Member role in an organization */
|
|
610
|
-
type FFIDMemberRole = 'owner' | 'admin' | 'member' | 'viewer';
|
|
611
|
-
/** Member role assignable through organization member management APIs */
|
|
612
|
-
type FFIDAssignableMemberRole = Exclude<FFIDMemberRole, 'owner'>;
|
|
613
|
-
/** Member status in an organization */
|
|
614
|
-
type FFIDMemberStatus = 'active' | 'invited' | 'suspended';
|
|
615
|
-
/** Organization member returned by the ext members API */
|
|
616
|
-
interface FFIDOrganizationMember {
|
|
617
|
-
/** User ID (UUID) */
|
|
618
|
-
userId: string;
|
|
619
|
-
/** Email address */
|
|
620
|
-
email: string;
|
|
621
|
-
/** Display name */
|
|
622
|
-
displayName: string | null;
|
|
623
|
-
/** Avatar URL */
|
|
624
|
-
avatarUrl: string | null;
|
|
625
|
-
/** Role in the organization */
|
|
626
|
-
role: FFIDMemberRole;
|
|
627
|
-
/** Membership status */
|
|
628
|
-
status: FFIDMemberStatus;
|
|
629
|
-
/** When the user joined */
|
|
630
|
-
joinedAt: string | null;
|
|
631
|
-
/** When the user was invited */
|
|
632
|
-
invitedAt: string | null;
|
|
633
|
-
/** Last sign-in timestamp */
|
|
634
|
-
lastSignInAt: string | null;
|
|
635
|
-
}
|
|
636
|
-
/** Response from listMembers (ext) */
|
|
637
|
-
interface FFIDListMembersResponse {
|
|
638
|
-
organizationId: string;
|
|
639
|
-
members: FFIDOrganizationMember[];
|
|
640
|
-
}
|
|
641
|
-
/** Request body for addMember (ext) */
|
|
642
|
-
interface FFIDAddMemberRequest {
|
|
643
|
-
email: string;
|
|
644
|
-
role?: FFIDAssignableMemberRole;
|
|
645
|
-
}
|
|
646
|
-
/** Params object for addMember (ext), matching the existing organization members methods */
|
|
647
|
-
interface FFIDAddMemberParams extends FFIDAddMemberRequest {
|
|
648
|
-
organizationId: string;
|
|
649
|
-
}
|
|
650
|
-
/** Response from addMember (ext) */
|
|
651
|
-
interface FFIDAddMemberResponse {
|
|
652
|
-
member: FFIDOrganizationMember;
|
|
653
|
-
}
|
|
654
|
-
/** Response from updateMemberRole (ext) */
|
|
655
|
-
interface FFIDUpdateMemberRoleResponse {
|
|
656
|
-
member: FFIDOrganizationMember;
|
|
657
|
-
}
|
|
658
|
-
/** Response from removeMember (ext) */
|
|
659
|
-
interface FFIDRemoveMemberResponse {
|
|
660
|
-
message: string;
|
|
661
|
-
}
|
|
662
640
|
/**
|
|
663
641
|
* User profile for the authenticated user (returned by `getProfile` / `updateProfile`).
|
|
664
642
|
*
|
|
@@ -1570,4 +1548,4 @@ interface FFIDInquiryFormPlaceholderContext {
|
|
|
1570
1548
|
}
|
|
1571
1549
|
declare function FFIDInquiryForm({ mode, prefill, organizations, preselectedOrganizationId, categories, termsVersion, privacyVersion, termsHref, privacyHref, turnstileToken, turnstileSlot, onSubmit, onChange, legalLayout, messagePlaceholder, requireCategorySelection, unstyled, classNames, locale, className, }: FFIDInquiryFormProps): react_jsx_runtime.JSX.Element;
|
|
1572
1550
|
|
|
1573
|
-
export { type
|
|
1551
|
+
export { type FFIDInquiryFormPrefill as $, type FFIDSubscriptionContextValue as A, type FFIDOAuthUserInfoSubscription as B, type FFIDAnnouncementsClientConfig as C, type FFIDAnnouncementsApiResponse as D, type EffectiveSubscriptionStatus as E, type FFIDSubscriptionStatus as F, type AnnouncementListResponse as G, type FFIDAnnouncementsLogger as H, type Announcement as I, type AnnouncementStatus as J, type AnnouncementType as K, type ListAnnouncementsOptions as L, FFIDAnnouncementBadge as M, FFIDAnnouncementList as N, type FFIDAnnouncementsError as O, type FFIDAnnouncementsErrorCode as P, type FFIDAnnouncementsServerResponse as Q, type FFIDCacheConfig as R, type FFIDContextValue as S, type FFIDInquiryCategory as T, type FFIDInquiryCategorySite2026 as U, FFIDInquiryForm as V, type FFIDInquiryFormCategoryItem as W, type FFIDInquiryFormClassNames as X, type FFIDInquiryFormLegalLayout as Y, type FFIDInquiryFormOrganization as Z, type FFIDInquiryFormPlaceholderContext as _, type FFIDConfig as a, type FFIDInquiryFormProps as a0, type FFIDInquiryFormSubmitData as a1, type FFIDInquiryFormSubmitResult as a2, type FFIDJwtClaims as a3, FFIDLoginButton as a4, type FFIDOAuthTokenResponse as a5, type FFIDOAuthUserInfoMemberRole as a6, FFIDOrganizationSwitcher as a7, type FFIDRedirectErrorCode as a8, type FFIDSeatModel as a9, type FFIDServiceAccessDenialReason as aa, type FFIDServiceAccessFailPolicy as ab, FFIDSubscriptionBadge as ac, type FFIDTokenIntrospectionResponse as ad, FFIDUserMenu as ae, FFID_INQUIRY_CATEGORIES as af, FFID_INQUIRY_CATEGORIES_SITE_2026 as ag, type UseFFIDAnnouncementsOptions as ah, type UseFFIDAnnouncementsReturn as ai, isFFIDInquiryCategorySite2026 as aj, useFFIDAnnouncements as ak, type FFIDAnnouncementBadgeClassNames as al, type FFIDAnnouncementBadgeProps as am, type FFIDAnnouncementListClassNames as an, type FFIDAnnouncementListProps as ao, type FFIDLoginButtonProps as ap, type FFIDOrganizationSwitcherClassNames as aq, type FFIDOrganizationSwitcherProps as ar, type FFIDSubscriptionBadgeClassNames as as, type FFIDSubscriptionBadgeProps as at, type FFIDUserMenuClassNames as au, type FFIDUserMenuProps as av, type FFIDApiResponse as b, type FFIDSessionResponse as c, type FFIDRedirectResult as d, type FFIDError as e, type FFIDSubscriptionCheckResponse as f, type FFIDCheckServiceAccessParams as g, type FFIDServiceAccessDecision as h, type FFIDProfileCallOptions as i, type FFIDUserProfile as j, type FFIDUpdateUserProfileRequest as k, type FFIDAnalyticsConfig as l, type FFIDCreateCheckoutParams as m, type FFIDCheckoutSessionResponse as n, type FFIDCreatePortalParams as o, type FFIDPortalSessionResponse as p, type FFIDVerifyAccessTokenOptions as q, type FFIDOAuthUserInfo as r, type FFIDInquiryCreateParams as s, type FFIDInquiryCreateResponse as t, type FFIDAuthMode as u, type FFIDLogger as v, type FFIDCacheAdapter as w, type FFIDUser as x, type FFIDOrganization as y, type FFIDSubscription as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFXIDKFXQ_cjs = require('./chunk-FXIDKFXQ.cjs');
|
|
4
4
|
var chunkQ5SZVLNB_cjs = require('./chunk-Q5SZVLNB.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -54,8 +54,8 @@ function defaultRedirect(url) {
|
|
|
54
54
|
}
|
|
55
55
|
function useRequireActiveSubscription(options) {
|
|
56
56
|
const { redirectTo, allowGrace = true, onRedirect } = options;
|
|
57
|
-
const { isLoading, error } =
|
|
58
|
-
const { effectiveStatus, isBlocked, isGrace } =
|
|
57
|
+
const { isLoading, error } = chunkFXIDKFXQ_cjs.useFFIDContext();
|
|
58
|
+
const { effectiveStatus, isBlocked, isGrace } = chunkFXIDKFXQ_cjs.useSubscription();
|
|
59
59
|
const hasFetchError = error !== null && effectiveStatus === null;
|
|
60
60
|
const shouldRedirect = !isLoading && !hasFetchError && (isBlocked || !allowGrace && isGrace || effectiveStatus === null);
|
|
61
61
|
react.useEffect(() => {
|
|
@@ -76,7 +76,7 @@ function useRequireActiveSubscription(options) {
|
|
|
76
76
|
}
|
|
77
77
|
function withFFIDAuth(Component, options = {}) {
|
|
78
78
|
const WrappedComponent = (props) => {
|
|
79
|
-
const { isLoading, isAuthenticated, login } =
|
|
79
|
+
const { isLoading, isAuthenticated, login } = chunkFXIDKFXQ_cjs.useFFIDContext();
|
|
80
80
|
const hasRedirected = react.useRef(false);
|
|
81
81
|
react.useEffect(() => {
|
|
82
82
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -105,131 +105,131 @@ var FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1e3;
|
|
|
105
105
|
|
|
106
106
|
Object.defineProperty(exports, "ACCESS_GRANTING_EFFECTIVE_STATUSES", {
|
|
107
107
|
enumerable: true,
|
|
108
|
-
get: function () { return
|
|
108
|
+
get: function () { return chunkFXIDKFXQ_cjs.ACCESS_GRANTING_EFFECTIVE_STATUSES; }
|
|
109
109
|
});
|
|
110
110
|
Object.defineProperty(exports, "BLOCKING_EFFECTIVE_STATUSES", {
|
|
111
111
|
enumerable: true,
|
|
112
|
-
get: function () { return
|
|
112
|
+
get: function () { return chunkFXIDKFXQ_cjs.BLOCKING_EFFECTIVE_STATUSES; }
|
|
113
113
|
});
|
|
114
114
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
115
115
|
enumerable: true,
|
|
116
|
-
get: function () { return
|
|
116
|
+
get: function () { return chunkFXIDKFXQ_cjs.DEFAULT_API_BASE_URL; }
|
|
117
117
|
});
|
|
118
118
|
Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
|
|
119
119
|
enumerable: true,
|
|
120
|
-
get: function () { return
|
|
120
|
+
get: function () { return chunkFXIDKFXQ_cjs.DEFAULT_OAUTH_SCOPES; }
|
|
121
121
|
});
|
|
122
122
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
123
123
|
enumerable: true,
|
|
124
|
-
get: function () { return
|
|
124
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDAnnouncementBadge; }
|
|
125
125
|
});
|
|
126
126
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
127
127
|
enumerable: true,
|
|
128
|
-
get: function () { return
|
|
128
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDAnnouncementList; }
|
|
129
129
|
});
|
|
130
130
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
131
131
|
enumerable: true,
|
|
132
|
-
get: function () { return
|
|
132
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDInquiryForm; }
|
|
133
133
|
});
|
|
134
134
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
135
135
|
enumerable: true,
|
|
136
|
-
get: function () { return
|
|
136
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDLoginButton; }
|
|
137
137
|
});
|
|
138
138
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
139
139
|
enumerable: true,
|
|
140
|
-
get: function () { return
|
|
140
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDOrganizationSwitcher; }
|
|
141
141
|
});
|
|
142
142
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
143
143
|
enumerable: true,
|
|
144
|
-
get: function () { return
|
|
144
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDProvider; }
|
|
145
145
|
});
|
|
146
146
|
Object.defineProperty(exports, "FFIDSDKError", {
|
|
147
147
|
enumerable: true,
|
|
148
|
-
get: function () { return
|
|
148
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDSDKError; }
|
|
149
149
|
});
|
|
150
150
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
151
151
|
enumerable: true,
|
|
152
|
-
get: function () { return
|
|
152
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDSubscriptionBadge; }
|
|
153
153
|
});
|
|
154
154
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
155
155
|
enumerable: true,
|
|
156
|
-
get: function () { return
|
|
156
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFIDUserMenu; }
|
|
157
157
|
});
|
|
158
158
|
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
159
159
|
enumerable: true,
|
|
160
|
-
get: function () { return
|
|
160
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
161
161
|
});
|
|
162
162
|
Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES", {
|
|
163
163
|
enumerable: true,
|
|
164
|
-
get: function () { return
|
|
164
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFID_INQUIRY_CATEGORIES; }
|
|
165
165
|
});
|
|
166
166
|
Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES_SITE_2026", {
|
|
167
167
|
enumerable: true,
|
|
168
|
-
get: function () { return
|
|
168
|
+
get: function () { return chunkFXIDKFXQ_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
|
|
169
169
|
});
|
|
170
170
|
Object.defineProperty(exports, "computeEffectiveStatusFromSession", {
|
|
171
171
|
enumerable: true,
|
|
172
|
-
get: function () { return
|
|
172
|
+
get: function () { return chunkFXIDKFXQ_cjs.computeEffectiveStatusFromSession; }
|
|
173
173
|
});
|
|
174
174
|
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
175
175
|
enumerable: true,
|
|
176
|
-
get: function () { return
|
|
176
|
+
get: function () { return chunkFXIDKFXQ_cjs.createFFIDAnnouncementsClient; }
|
|
177
177
|
});
|
|
178
178
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
179
179
|
enumerable: true,
|
|
180
|
-
get: function () { return
|
|
180
|
+
get: function () { return chunkFXIDKFXQ_cjs.createFFIDClient; }
|
|
181
181
|
});
|
|
182
182
|
Object.defineProperty(exports, "createTokenStore", {
|
|
183
183
|
enumerable: true,
|
|
184
|
-
get: function () { return
|
|
184
|
+
get: function () { return chunkFXIDKFXQ_cjs.createTokenStore; }
|
|
185
185
|
});
|
|
186
186
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
187
187
|
enumerable: true,
|
|
188
|
-
get: function () { return
|
|
188
|
+
get: function () { return chunkFXIDKFXQ_cjs.generateCodeChallenge; }
|
|
189
189
|
});
|
|
190
190
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
191
191
|
enumerable: true,
|
|
192
|
-
get: function () { return
|
|
192
|
+
get: function () { return chunkFXIDKFXQ_cjs.generateCodeVerifier; }
|
|
193
193
|
});
|
|
194
194
|
Object.defineProperty(exports, "hasAccessFromUserinfo", {
|
|
195
195
|
enumerable: true,
|
|
196
|
-
get: function () { return
|
|
196
|
+
get: function () { return chunkFXIDKFXQ_cjs.hasAccessFromUserinfo; }
|
|
197
197
|
});
|
|
198
198
|
Object.defineProperty(exports, "isBlockedFromUserinfo", {
|
|
199
199
|
enumerable: true,
|
|
200
|
-
get: function () { return
|
|
200
|
+
get: function () { return chunkFXIDKFXQ_cjs.isBlockedFromUserinfo; }
|
|
201
201
|
});
|
|
202
202
|
Object.defineProperty(exports, "isFFIDInquiryCategorySite2026", {
|
|
203
203
|
enumerable: true,
|
|
204
|
-
get: function () { return
|
|
204
|
+
get: function () { return chunkFXIDKFXQ_cjs.isFFIDInquiryCategorySite2026; }
|
|
205
205
|
});
|
|
206
206
|
Object.defineProperty(exports, "normalizeRedirectUri", {
|
|
207
207
|
enumerable: true,
|
|
208
|
-
get: function () { return
|
|
208
|
+
get: function () { return chunkFXIDKFXQ_cjs.normalizeRedirectUri; }
|
|
209
209
|
});
|
|
210
210
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
211
211
|
enumerable: true,
|
|
212
|
-
get: function () { return
|
|
212
|
+
get: function () { return chunkFXIDKFXQ_cjs.retrieveCodeVerifier; }
|
|
213
213
|
});
|
|
214
214
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
215
215
|
enumerable: true,
|
|
216
|
-
get: function () { return
|
|
216
|
+
get: function () { return chunkFXIDKFXQ_cjs.storeCodeVerifier; }
|
|
217
217
|
});
|
|
218
218
|
Object.defineProperty(exports, "useFFID", {
|
|
219
219
|
enumerable: true,
|
|
220
|
-
get: function () { return
|
|
220
|
+
get: function () { return chunkFXIDKFXQ_cjs.useFFID; }
|
|
221
221
|
});
|
|
222
222
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
223
223
|
enumerable: true,
|
|
224
|
-
get: function () { return
|
|
224
|
+
get: function () { return chunkFXIDKFXQ_cjs.useFFIDAnnouncements; }
|
|
225
225
|
});
|
|
226
226
|
Object.defineProperty(exports, "useSubscription", {
|
|
227
227
|
enumerable: true,
|
|
228
|
-
get: function () { return
|
|
228
|
+
get: function () { return chunkFXIDKFXQ_cjs.useSubscription; }
|
|
229
229
|
});
|
|
230
230
|
Object.defineProperty(exports, "withSubscription", {
|
|
231
231
|
enumerable: true,
|
|
232
|
-
get: function () { return
|
|
232
|
+
get: function () { return chunkFXIDKFXQ_cjs.withSubscription; }
|
|
233
233
|
});
|
|
234
234
|
Object.defineProperty(exports, "ALL_DENIED_EXCEPT_NECESSARY", {
|
|
235
235
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FFIDSubscriptionStatus, a as FFIDConfig, b as FFIDApiResponse, c as FFIDSessionResponse, d as FFIDRedirectResult, e as FFIDError, f as FFIDSubscriptionCheckResponse, g as FFIDCheckServiceAccessParams, h as FFIDServiceAccessDecision, i as
|
|
2
|
-
export {
|
|
1
|
+
import { F as FFIDSubscriptionStatus, a as FFIDConfig, b as FFIDApiResponse, c as FFIDSessionResponse, d as FFIDRedirectResult, e as FFIDError, f as FFIDSubscriptionCheckResponse, g as FFIDCheckServiceAccessParams, h as FFIDServiceAccessDecision, i as FFIDProfileCallOptions, j as FFIDUserProfile, k as FFIDUpdateUserProfileRequest, l as FFIDAnalyticsConfig, m as FFIDCreateCheckoutParams, n as FFIDCheckoutSessionResponse, o as FFIDCreatePortalParams, p as FFIDPortalSessionResponse, q as FFIDVerifyAccessTokenOptions, r as FFIDOAuthUserInfo, s as FFIDInquiryCreateParams, t as FFIDInquiryCreateResponse, u as FFIDAuthMode, v as FFIDLogger, w as FFIDCacheAdapter, x as FFIDUser, y as FFIDOrganization, z as FFIDSubscription, A as FFIDSubscriptionContextValue, E as EffectiveSubscriptionStatus, B as FFIDOAuthUserInfoSubscription, C as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, D as FFIDAnnouncementsApiResponse, G as AnnouncementListResponse, H as FFIDAnnouncementsLogger } from './index-EFp_ZgK9.cjs';
|
|
2
|
+
export { I as Announcement, J as AnnouncementStatus, K as AnnouncementType, M as FFIDAnnouncementBadge, N as FFIDAnnouncementList, O as FFIDAnnouncementsError, P as FFIDAnnouncementsErrorCode, Q as FFIDAnnouncementsServerResponse, R as FFIDCacheConfig, S as FFIDContextValue, T as FFIDInquiryCategory, U as FFIDInquiryCategorySite2026, V as FFIDInquiryForm, W as FFIDInquiryFormCategoryItem, X as FFIDInquiryFormClassNames, Y as FFIDInquiryFormLegalLayout, Z as FFIDInquiryFormOrganization, _ as FFIDInquiryFormPlaceholderContext, $ as FFIDInquiryFormPrefill, a0 as FFIDInquiryFormProps, a1 as FFIDInquiryFormSubmitData, a2 as FFIDInquiryFormSubmitResult, a3 as FFIDJwtClaims, a4 as FFIDLoginButton, a5 as FFIDOAuthTokenResponse, a6 as FFIDOAuthUserInfoMemberRole, a7 as FFIDOrganizationSwitcher, a8 as FFIDRedirectErrorCode, a9 as FFIDSeatModel, aa as FFIDServiceAccessDenialReason, ab as FFIDServiceAccessFailPolicy, ac as FFIDSubscriptionBadge, ad as FFIDTokenIntrospectionResponse, ae as FFIDUserMenu, af as FFID_INQUIRY_CATEGORIES, ag as FFID_INQUIRY_CATEGORIES_SITE_2026, ah as UseFFIDAnnouncementsOptions, ai as UseFFIDAnnouncementsReturn, aj as isFFIDInquiryCategorySite2026, ak as useFFIDAnnouncements } from './index-EFp_ZgK9.cjs';
|
|
3
3
|
export { A as ALL_DENIED_EXCEPT_NECESSARY, i as CONSENT_COOKIE_NAME, j as CONSENT_DISMISSAL_TIMESTAMP_KEY, l as COOKIE_VERSION, D as DEFAULT_CONSENT_ERROR_MESSAGES, o as FFIDAnalyticsProvider, p as FFIDAnalyticsProviderProps, c as FFIDConsentCategories, r as FFIDConsentCategoryCode, e as FFIDConsentCategoryMetadata, w as FFIDConsentError, x as FFIDConsentErrorCode, y as FFIDConsentMergeStrategy, B as FFIDConsentMergeWarning, E as FFIDConsentMergeWarningEvent, F as FFIDConsentResult, I as FFIDConsentSource, a as FFIDConsentState, d as FFIDConsentSyncResult, M as FFIDCookieBanner, N as FFIDCookieBannerClassNames, O as FFIDCookieBannerProps, Q as FFIDCookieLink, R as FFIDCookieLinkProps, f as FFIDCookiePolicy, T as FFIDCookieSettings, U as FFIDCookieSettingsClassNames, V as FFIDCookieSettingsProps, _ as FFID_CONSENT_ERROR_CODES, ae as UseFFIDConsentPreferencesReturn, af as UseFFIDConsentReturn, ag as clearConsentDismissalTimestamp, aj as decodeConsentCookie, al as encodeConsentCookie, an as readConsentCookie, ao as readConsentDismissalTimestamp, aq as useFFIDConsent, ar as useFFIDConsentPreferences, as as writeConsentCookie, at as writeConsentDismissalTimestamp } from './FFIDCookieLink-CE01gYc4.cjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
@@ -428,6 +428,67 @@ interface FFIDSeatChangePreviewResponse {
|
|
|
428
428
|
preview: FFIDSeatChangePreview;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
/** Member role in an organization */
|
|
432
|
+
type FFIDMemberRole = 'owner' | 'admin' | 'member' | 'viewer';
|
|
433
|
+
/** Member role assignable through organization member management APIs */
|
|
434
|
+
type FFIDAssignableMemberRole = Exclude<FFIDMemberRole, 'owner'>;
|
|
435
|
+
/** Member status in an organization */
|
|
436
|
+
type FFIDMemberStatus = 'active' | 'invited' | 'suspended';
|
|
437
|
+
/** Organization member returned by the ext members API */
|
|
438
|
+
interface FFIDOrganizationMember {
|
|
439
|
+
/** User ID (UUID) */
|
|
440
|
+
userId: string;
|
|
441
|
+
/** Email address */
|
|
442
|
+
email: string;
|
|
443
|
+
/** Display name */
|
|
444
|
+
displayName: string | null;
|
|
445
|
+
/** Avatar URL */
|
|
446
|
+
avatarUrl: string | null;
|
|
447
|
+
/** Role in the organization */
|
|
448
|
+
role: FFIDMemberRole;
|
|
449
|
+
/** Membership status */
|
|
450
|
+
status: FFIDMemberStatus;
|
|
451
|
+
/**
|
|
452
|
+
* Whether the member's email address is confirmed.
|
|
453
|
+
*
|
|
454
|
+
* `null` means FFID could not determine the auth user confirmation state
|
|
455
|
+
* (for example, the auth user row was not readable).
|
|
456
|
+
*/
|
|
457
|
+
emailVerified: boolean | null;
|
|
458
|
+
/** When the user joined */
|
|
459
|
+
joinedAt: string | null;
|
|
460
|
+
/** When the user was invited */
|
|
461
|
+
invitedAt: string | null;
|
|
462
|
+
/** Last sign-in timestamp */
|
|
463
|
+
lastSignInAt: string | null;
|
|
464
|
+
}
|
|
465
|
+
/** Response from listMembers (ext) */
|
|
466
|
+
interface FFIDListMembersResponse {
|
|
467
|
+
organizationId: string;
|
|
468
|
+
members: FFIDOrganizationMember[];
|
|
469
|
+
}
|
|
470
|
+
/** Request body for addMember (ext) */
|
|
471
|
+
interface FFIDAddMemberRequest {
|
|
472
|
+
email: string;
|
|
473
|
+
role?: FFIDAssignableMemberRole;
|
|
474
|
+
}
|
|
475
|
+
/** Params object for addMember (ext), matching the existing organization members methods */
|
|
476
|
+
interface FFIDAddMemberParams extends FFIDAddMemberRequest {
|
|
477
|
+
organizationId: string;
|
|
478
|
+
}
|
|
479
|
+
/** Response from addMember (ext) */
|
|
480
|
+
interface FFIDAddMemberResponse {
|
|
481
|
+
member: FFIDOrganizationMember;
|
|
482
|
+
}
|
|
483
|
+
/** Response from updateMemberRole (ext) */
|
|
484
|
+
interface FFIDUpdateMemberRoleResponse {
|
|
485
|
+
member: FFIDOrganizationMember;
|
|
486
|
+
}
|
|
487
|
+
/** Response from removeMember (ext) */
|
|
488
|
+
interface FFIDRemoveMemberResponse {
|
|
489
|
+
message: string;
|
|
490
|
+
}
|
|
491
|
+
|
|
431
492
|
/** OTP / magic link methods - sendOtp / verifyOtp */
|
|
432
493
|
|
|
433
494
|
/** Response from sendOtp */
|
|
@@ -1028,6 +1089,20 @@ interface ComputeEffectiveStatusInput {
|
|
|
1028
1089
|
* `blocked`.
|
|
1029
1090
|
*/
|
|
1030
1091
|
pastDueSince?: string | null | undefined;
|
|
1092
|
+
/**
|
|
1093
|
+
* Whether the subscription is scheduled to cancel at the end of the
|
|
1094
|
+
* current billing period (`cancel_at_period_end=true` in Stripe).
|
|
1095
|
+
*
|
|
1096
|
+
* Optional / defaults to `false` for backward compatibility — pre-#3460
|
|
1097
|
+
* callers do not pass this field and MUST keep observing `'active'` for
|
|
1098
|
+
* the same inputs. When `true` and the period has not yet ended, the
|
|
1099
|
+
* `'active'` branch returns `'active_canceling'` so consumers can render
|
|
1100
|
+
* a "cancellation scheduled" badge + reactivation CTA without losing
|
|
1101
|
+
* access. Has no effect on any other DB status branch — runtime
|
|
1102
|
+
* `expired` still wins inside `'active'`, and Stripe does not set
|
|
1103
|
+
* `cancel_at_period_end` on terminal states.
|
|
1104
|
+
*/
|
|
1105
|
+
cancelAtPeriodEnd?: boolean | undefined;
|
|
1031
1106
|
}
|
|
1032
1107
|
/**
|
|
1033
1108
|
* Compute an `EffectiveSubscriptionStatus` from the fields available in the
|
|
@@ -1070,6 +1145,13 @@ declare function computeEffectiveStatusFromSession(input: ComputeEffectiveStatus
|
|
|
1070
1145
|
* caller that needs to fan in on the same access predicate. Mirrors the FFID
|
|
1071
1146
|
* backend constants in `src/app/api/v1/subscriptions/ext/check/route.ts`
|
|
1072
1147
|
* (route-local) — change there forces a sync here in the same PR.
|
|
1148
|
+
*
|
|
1149
|
+
* `active_canceling` (post-#3460) is included for forward compatibility:
|
|
1150
|
+
* the FFID backend currently collapses cancellation-scheduled subscriptions
|
|
1151
|
+
* back to `active` on `/ext/check`, but if a future change promotes
|
|
1152
|
+
* `cancel_at_period_end` into the server's `EffectiveSubscriptionStatus`
|
|
1153
|
+
* mapping the userinfo path will already treat it as access-granting
|
|
1154
|
+
* without an additional SDK release.
|
|
1073
1155
|
*/
|
|
1074
1156
|
declare const ACCESS_GRANTING_EFFECTIVE_STATUSES: readonly EffectiveSubscriptionStatus[];
|
|
1075
1157
|
/**
|
|
@@ -1084,7 +1166,8 @@ declare const BLOCKING_EFFECTIVE_STATUSES: readonly EffectiveSubscriptionStatus[
|
|
|
1084
1166
|
* Decide whether the `/oauth/userinfo` subscription summary grants access.
|
|
1085
1167
|
*
|
|
1086
1168
|
* Returns `true` iff `sub.effectiveStatus` is in
|
|
1087
|
-
* {@link ACCESS_GRANTING_EFFECTIVE_STATUSES} (`active
|
|
1169
|
+
* {@link ACCESS_GRANTING_EFFECTIVE_STATUSES} (`active`, `active_canceling`,
|
|
1170
|
+
* or `past_due_grace`).
|
|
1088
1171
|
*
|
|
1089
1172
|
* Conservative fallback rules (security-critical — treat as part of the
|
|
1090
1173
|
* contract, not implementation detail):
|
|
@@ -1312,4 +1395,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
1312
1395
|
};
|
|
1313
1396
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
1314
1397
|
|
|
1315
|
-
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, FFIDAddMemberParams, FFIDAddMemberRequest, FFIDAddMemberResponse, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckServiceAccessParams, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, 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 FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreview, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, type FFIDPreviewSeatChangeParams, FFIDProfileCallOptions, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDSeatChangeLineItem, type FFIDSeatChangePreview, type FFIDSeatChangePreviewResponse, FFIDServiceAccessDecision, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, type FFIDSupportedCurrency, FFIDUpdateMemberRoleResponse, FFIDUpdateUserProfileRequest, FFIDUser, FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, hasAccessFromUserinfo, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };
|
|
1398
|
+
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 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, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, type FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, 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 FFIDOrganizationMember, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreview, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, type FFIDPreviewSeatChangeParams, FFIDProfileCallOptions, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDSeatChangeLineItem, type FFIDSeatChangePreview, type FFIDSeatChangePreviewResponse, FFIDServiceAccessDecision, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, type FFIDSupportedCurrency, type FFIDUpdateMemberRoleResponse, FFIDUpdateUserProfileRequest, FFIDUser, FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, hasAccessFromUserinfo, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FFIDSubscriptionStatus, a as FFIDConfig, b as FFIDApiResponse, c as FFIDSessionResponse, d as FFIDRedirectResult, e as FFIDError, f as FFIDSubscriptionCheckResponse, g as FFIDCheckServiceAccessParams, h as FFIDServiceAccessDecision, i as
|
|
2
|
-
export {
|
|
1
|
+
import { F as FFIDSubscriptionStatus, a as FFIDConfig, b as FFIDApiResponse, c as FFIDSessionResponse, d as FFIDRedirectResult, e as FFIDError, f as FFIDSubscriptionCheckResponse, g as FFIDCheckServiceAccessParams, h as FFIDServiceAccessDecision, i as FFIDProfileCallOptions, j as FFIDUserProfile, k as FFIDUpdateUserProfileRequest, l as FFIDAnalyticsConfig, m as FFIDCreateCheckoutParams, n as FFIDCheckoutSessionResponse, o as FFIDCreatePortalParams, p as FFIDPortalSessionResponse, q as FFIDVerifyAccessTokenOptions, r as FFIDOAuthUserInfo, s as FFIDInquiryCreateParams, t as FFIDInquiryCreateResponse, u as FFIDAuthMode, v as FFIDLogger, w as FFIDCacheAdapter, x as FFIDUser, y as FFIDOrganization, z as FFIDSubscription, A as FFIDSubscriptionContextValue, E as EffectiveSubscriptionStatus, B as FFIDOAuthUserInfoSubscription, C as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, D as FFIDAnnouncementsApiResponse, G as AnnouncementListResponse, H as FFIDAnnouncementsLogger } from './index-EFp_ZgK9.js';
|
|
2
|
+
export { I as Announcement, J as AnnouncementStatus, K as AnnouncementType, M as FFIDAnnouncementBadge, N as FFIDAnnouncementList, O as FFIDAnnouncementsError, P as FFIDAnnouncementsErrorCode, Q as FFIDAnnouncementsServerResponse, R as FFIDCacheConfig, S as FFIDContextValue, T as FFIDInquiryCategory, U as FFIDInquiryCategorySite2026, V as FFIDInquiryForm, W as FFIDInquiryFormCategoryItem, X as FFIDInquiryFormClassNames, Y as FFIDInquiryFormLegalLayout, Z as FFIDInquiryFormOrganization, _ as FFIDInquiryFormPlaceholderContext, $ as FFIDInquiryFormPrefill, a0 as FFIDInquiryFormProps, a1 as FFIDInquiryFormSubmitData, a2 as FFIDInquiryFormSubmitResult, a3 as FFIDJwtClaims, a4 as FFIDLoginButton, a5 as FFIDOAuthTokenResponse, a6 as FFIDOAuthUserInfoMemberRole, a7 as FFIDOrganizationSwitcher, a8 as FFIDRedirectErrorCode, a9 as FFIDSeatModel, aa as FFIDServiceAccessDenialReason, ab as FFIDServiceAccessFailPolicy, ac as FFIDSubscriptionBadge, ad as FFIDTokenIntrospectionResponse, ae as FFIDUserMenu, af as FFID_INQUIRY_CATEGORIES, ag as FFID_INQUIRY_CATEGORIES_SITE_2026, ah as UseFFIDAnnouncementsOptions, ai as UseFFIDAnnouncementsReturn, aj as isFFIDInquiryCategorySite2026, ak as useFFIDAnnouncements } from './index-EFp_ZgK9.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-CE01gYc4.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
@@ -428,6 +428,67 @@ interface FFIDSeatChangePreviewResponse {
|
|
|
428
428
|
preview: FFIDSeatChangePreview;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
/** Member role in an organization */
|
|
432
|
+
type FFIDMemberRole = 'owner' | 'admin' | 'member' | 'viewer';
|
|
433
|
+
/** Member role assignable through organization member management APIs */
|
|
434
|
+
type FFIDAssignableMemberRole = Exclude<FFIDMemberRole, 'owner'>;
|
|
435
|
+
/** Member status in an organization */
|
|
436
|
+
type FFIDMemberStatus = 'active' | 'invited' | 'suspended';
|
|
437
|
+
/** Organization member returned by the ext members API */
|
|
438
|
+
interface FFIDOrganizationMember {
|
|
439
|
+
/** User ID (UUID) */
|
|
440
|
+
userId: string;
|
|
441
|
+
/** Email address */
|
|
442
|
+
email: string;
|
|
443
|
+
/** Display name */
|
|
444
|
+
displayName: string | null;
|
|
445
|
+
/** Avatar URL */
|
|
446
|
+
avatarUrl: string | null;
|
|
447
|
+
/** Role in the organization */
|
|
448
|
+
role: FFIDMemberRole;
|
|
449
|
+
/** Membership status */
|
|
450
|
+
status: FFIDMemberStatus;
|
|
451
|
+
/**
|
|
452
|
+
* Whether the member's email address is confirmed.
|
|
453
|
+
*
|
|
454
|
+
* `null` means FFID could not determine the auth user confirmation state
|
|
455
|
+
* (for example, the auth user row was not readable).
|
|
456
|
+
*/
|
|
457
|
+
emailVerified: boolean | null;
|
|
458
|
+
/** When the user joined */
|
|
459
|
+
joinedAt: string | null;
|
|
460
|
+
/** When the user was invited */
|
|
461
|
+
invitedAt: string | null;
|
|
462
|
+
/** Last sign-in timestamp */
|
|
463
|
+
lastSignInAt: string | null;
|
|
464
|
+
}
|
|
465
|
+
/** Response from listMembers (ext) */
|
|
466
|
+
interface FFIDListMembersResponse {
|
|
467
|
+
organizationId: string;
|
|
468
|
+
members: FFIDOrganizationMember[];
|
|
469
|
+
}
|
|
470
|
+
/** Request body for addMember (ext) */
|
|
471
|
+
interface FFIDAddMemberRequest {
|
|
472
|
+
email: string;
|
|
473
|
+
role?: FFIDAssignableMemberRole;
|
|
474
|
+
}
|
|
475
|
+
/** Params object for addMember (ext), matching the existing organization members methods */
|
|
476
|
+
interface FFIDAddMemberParams extends FFIDAddMemberRequest {
|
|
477
|
+
organizationId: string;
|
|
478
|
+
}
|
|
479
|
+
/** Response from addMember (ext) */
|
|
480
|
+
interface FFIDAddMemberResponse {
|
|
481
|
+
member: FFIDOrganizationMember;
|
|
482
|
+
}
|
|
483
|
+
/** Response from updateMemberRole (ext) */
|
|
484
|
+
interface FFIDUpdateMemberRoleResponse {
|
|
485
|
+
member: FFIDOrganizationMember;
|
|
486
|
+
}
|
|
487
|
+
/** Response from removeMember (ext) */
|
|
488
|
+
interface FFIDRemoveMemberResponse {
|
|
489
|
+
message: string;
|
|
490
|
+
}
|
|
491
|
+
|
|
431
492
|
/** OTP / magic link methods - sendOtp / verifyOtp */
|
|
432
493
|
|
|
433
494
|
/** Response from sendOtp */
|
|
@@ -1028,6 +1089,20 @@ interface ComputeEffectiveStatusInput {
|
|
|
1028
1089
|
* `blocked`.
|
|
1029
1090
|
*/
|
|
1030
1091
|
pastDueSince?: string | null | undefined;
|
|
1092
|
+
/**
|
|
1093
|
+
* Whether the subscription is scheduled to cancel at the end of the
|
|
1094
|
+
* current billing period (`cancel_at_period_end=true` in Stripe).
|
|
1095
|
+
*
|
|
1096
|
+
* Optional / defaults to `false` for backward compatibility — pre-#3460
|
|
1097
|
+
* callers do not pass this field and MUST keep observing `'active'` for
|
|
1098
|
+
* the same inputs. When `true` and the period has not yet ended, the
|
|
1099
|
+
* `'active'` branch returns `'active_canceling'` so consumers can render
|
|
1100
|
+
* a "cancellation scheduled" badge + reactivation CTA without losing
|
|
1101
|
+
* access. Has no effect on any other DB status branch — runtime
|
|
1102
|
+
* `expired` still wins inside `'active'`, and Stripe does not set
|
|
1103
|
+
* `cancel_at_period_end` on terminal states.
|
|
1104
|
+
*/
|
|
1105
|
+
cancelAtPeriodEnd?: boolean | undefined;
|
|
1031
1106
|
}
|
|
1032
1107
|
/**
|
|
1033
1108
|
* Compute an `EffectiveSubscriptionStatus` from the fields available in the
|
|
@@ -1070,6 +1145,13 @@ declare function computeEffectiveStatusFromSession(input: ComputeEffectiveStatus
|
|
|
1070
1145
|
* caller that needs to fan in on the same access predicate. Mirrors the FFID
|
|
1071
1146
|
* backend constants in `src/app/api/v1/subscriptions/ext/check/route.ts`
|
|
1072
1147
|
* (route-local) — change there forces a sync here in the same PR.
|
|
1148
|
+
*
|
|
1149
|
+
* `active_canceling` (post-#3460) is included for forward compatibility:
|
|
1150
|
+
* the FFID backend currently collapses cancellation-scheduled subscriptions
|
|
1151
|
+
* back to `active` on `/ext/check`, but if a future change promotes
|
|
1152
|
+
* `cancel_at_period_end` into the server's `EffectiveSubscriptionStatus`
|
|
1153
|
+
* mapping the userinfo path will already treat it as access-granting
|
|
1154
|
+
* without an additional SDK release.
|
|
1073
1155
|
*/
|
|
1074
1156
|
declare const ACCESS_GRANTING_EFFECTIVE_STATUSES: readonly EffectiveSubscriptionStatus[];
|
|
1075
1157
|
/**
|
|
@@ -1084,7 +1166,8 @@ declare const BLOCKING_EFFECTIVE_STATUSES: readonly EffectiveSubscriptionStatus[
|
|
|
1084
1166
|
* Decide whether the `/oauth/userinfo` subscription summary grants access.
|
|
1085
1167
|
*
|
|
1086
1168
|
* Returns `true` iff `sub.effectiveStatus` is in
|
|
1087
|
-
* {@link ACCESS_GRANTING_EFFECTIVE_STATUSES} (`active
|
|
1169
|
+
* {@link ACCESS_GRANTING_EFFECTIVE_STATUSES} (`active`, `active_canceling`,
|
|
1170
|
+
* or `past_due_grace`).
|
|
1088
1171
|
*
|
|
1089
1172
|
* Conservative fallback rules (security-critical — treat as part of the
|
|
1090
1173
|
* contract, not implementation detail):
|
|
@@ -1312,4 +1395,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
1312
1395
|
};
|
|
1313
1396
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
1314
1397
|
|
|
1315
|
-
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, FFIDAddMemberParams, FFIDAddMemberRequest, FFIDAddMemberResponse, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckServiceAccessParams, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, 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 FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreview, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, type FFIDPreviewSeatChangeParams, FFIDProfileCallOptions, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDSeatChangeLineItem, type FFIDSeatChangePreview, type FFIDSeatChangePreviewResponse, FFIDServiceAccessDecision, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, type FFIDSupportedCurrency, FFIDUpdateMemberRoleResponse, FFIDUpdateUserProfileRequest, FFIDUser, FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, hasAccessFromUserinfo, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };
|
|
1398
|
+
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 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, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, type FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, 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 FFIDOrganizationMember, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreview, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, type FFIDPreviewSeatChangeParams, FFIDProfileCallOptions, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDSeatChangeLineItem, type FFIDSeatChangePreview, type FFIDSeatChangePreviewResponse, FFIDServiceAccessDecision, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, type FFIDSupportedCurrency, type FFIDUpdateMemberRoleResponse, FFIDUpdateUserProfileRequest, FFIDUser, FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, hasAccessFromUserinfo, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFFIDContext, useSubscription } from './chunk-
|
|
2
|
-
export { ACCESS_GRANTING_EFFECTIVE_STATUSES, BLOCKING_EFFECTIVE_STATUSES, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, hasAccessFromUserinfo, isBlockedFromUserinfo, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-
|
|
1
|
+
import { useFFIDContext, useSubscription } from './chunk-YAJN36SD.js';
|
|
2
|
+
export { ACCESS_GRANTING_EFFECTIVE_STATUSES, BLOCKING_EFFECTIVE_STATUSES, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, hasAccessFromUserinfo, isBlockedFromUserinfo, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-YAJN36SD.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-KJ7FUNA6.js';
|
|
4
4
|
import { useEffect, useRef } from 'react';
|
|
5
5
|
import { jsx, Fragment } from 'react/jsx-runtime';
|