@feelflow/ffid-sdk 1.17.0 → 1.19.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-4LRZTABD.js → chunk-3IV7STDJ.js} +180 -2
- package/dist/{chunk-4L5JIETV.cjs → chunk-543CO3HP.cjs} +180 -2
- package/dist/components/index.cjs +7 -7
- 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/{index-B9sSp8kZ.d.cts → index-p4dJw3qR.d.cts} +42 -6
- package/dist/{index-B9sSp8kZ.d.ts → index-p4dJw3qR.d.ts} +42 -6
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +208 -3
- package/dist/index.d.ts +208 -3
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +180 -2
- package/dist/server/index.d.cts +246 -5
- package/dist/server/index.d.ts +246 -5
- package/dist/server/index.js +180 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk543CO3HP_cjs = require('./chunk-543CO3HP.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ function createKVCacheAdapter(kv) {
|
|
|
46
46
|
}
|
|
47
47
|
function withFFIDAuth(Component, options = {}) {
|
|
48
48
|
const WrappedComponent = (props) => {
|
|
49
|
-
const { isLoading, isAuthenticated, login } =
|
|
49
|
+
const { isLoading, isAuthenticated, login } = chunk543CO3HP_cjs.useFFIDContext();
|
|
50
50
|
const hasRedirected = react.useRef(false);
|
|
51
51
|
react.useEffect(() => {
|
|
52
52
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -71,83 +71,83 @@ function withFFIDAuth(Component, options = {}) {
|
|
|
71
71
|
|
|
72
72
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunk543CO3HP_cjs.DEFAULT_API_BASE_URL; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunk543CO3HP_cjs.FFIDAnnouncementBadge; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunk543CO3HP_cjs.FFIDAnnouncementList; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunk543CO3HP_cjs.FFIDLoginButton; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunk543CO3HP_cjs.FFIDOrganizationSwitcher; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunk543CO3HP_cjs.FFIDProvider; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunk543CO3HP_cjs.FFIDSubscriptionBadge; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunk543CO3HP_cjs.FFIDUserMenu; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunk543CO3HP_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunk543CO3HP_cjs.createFFIDAnnouncementsClient; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunk543CO3HP_cjs.createFFIDClient; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "createTokenStore", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunk543CO3HP_cjs.createTokenStore; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunk543CO3HP_cjs.generateCodeChallenge; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunk543CO3HP_cjs.generateCodeVerifier; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunk543CO3HP_cjs.retrieveCodeVerifier; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunk543CO3HP_cjs.storeCodeVerifier; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "useFFID", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunk543CO3HP_cjs.useFFID; }
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunk543CO3HP_cjs.useFFIDAnnouncements; }
|
|
143
143
|
});
|
|
144
144
|
Object.defineProperty(exports, "useSubscription", {
|
|
145
145
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunk543CO3HP_cjs.useSubscription; }
|
|
147
147
|
});
|
|
148
148
|
Object.defineProperty(exports, "withSubscription", {
|
|
149
149
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
150
|
+
get: function () { return chunk543CO3HP_cjs.withSubscription; }
|
|
151
151
|
});
|
|
152
152
|
exports.createKVCacheAdapter = createKVCacheAdapter;
|
|
153
153
|
exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F 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 FFIDListMembersResponse, h as FFIDMemberRole, i as FFIDUpdateMemberRoleResponse, j as FFIDRemoveMemberResponse, k as FFIDCreateCheckoutParams, l as FFIDCheckoutSessionResponse, m as FFIDCreatePortalParams, n as FFIDPortalSessionResponse, o as FFIDVerifyAccessTokenOptions, p as FFIDOAuthUserInfo, q as FFIDAuthMode, r as FFIDLogger, s as FFIDCacheAdapter, t as FFIDUser, u as FFIDOrganization, v as FFIDSubscription, w as FFIDSubscriptionContextValue, x as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, y as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, z as FFIDAnnouncementsLogger } from './index-p4dJw3qR.cjs';
|
|
2
|
+
export { B as Announcement, C as AnnouncementStatus, D as AnnouncementType, E as FFIDAnnouncementBadge, G as FFIDAnnouncementList, H as FFIDAnnouncementsError, I as FFIDAnnouncementsErrorCode, J as FFIDAnnouncementsServerResponse, K as FFIDCacheConfig, M as FFIDContextValue, N as FFIDJwtClaims, O as FFIDLoginButton, P as FFIDMemberStatus, Q as FFIDOAuthTokenResponse, R as FFIDOAuthUserInfoMemberRole, S as FFIDOAuthUserInfoSubscription, T as FFIDOrganizationMember, U as FFIDOrganizationSwitcher, V as FFIDSeatModel, W as FFIDSubscriptionBadge, X as FFIDTokenIntrospectionResponse, Y as FFIDUserMenu, Z as UseFFIDAnnouncementsOptions, _ as UseFFIDAnnouncementsReturn, $ as useFFIDAnnouncements } from './index-p4dJw3qR.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -92,6 +92,193 @@ declare function storeCodeVerifier(verifier: string, logger?: PKCELogger): boole
|
|
|
92
92
|
*/
|
|
93
93
|
declare function retrieveCodeVerifier(logger?: PKCELogger): string | null;
|
|
94
94
|
|
|
95
|
+
/** Billing interval for subscriptions */
|
|
96
|
+
type FFIDBillingInterval = 'monthly' | 'yearly';
|
|
97
|
+
/** Service information returned by plans endpoint */
|
|
98
|
+
interface FFIDServiceInfo {
|
|
99
|
+
id: string;
|
|
100
|
+
code: string;
|
|
101
|
+
name: string;
|
|
102
|
+
description: string | null;
|
|
103
|
+
isActive: boolean;
|
|
104
|
+
createdAt: string;
|
|
105
|
+
plans: FFIDPlanInfo[];
|
|
106
|
+
}
|
|
107
|
+
/** Plan information returned by plans endpoint */
|
|
108
|
+
interface FFIDPlanInfo {
|
|
109
|
+
id: string;
|
|
110
|
+
serviceId: string;
|
|
111
|
+
code: string;
|
|
112
|
+
name: string;
|
|
113
|
+
description: string | null;
|
|
114
|
+
minSeats: number;
|
|
115
|
+
maxSeats: number | null;
|
|
116
|
+
trialDays: number;
|
|
117
|
+
priceMonthly: number;
|
|
118
|
+
priceYearly: number | null;
|
|
119
|
+
currency: string;
|
|
120
|
+
isActive: boolean;
|
|
121
|
+
displayOrder: number;
|
|
122
|
+
customPricing: boolean;
|
|
123
|
+
createdAt: string;
|
|
124
|
+
}
|
|
125
|
+
/** Response from list plans endpoint */
|
|
126
|
+
interface FFIDListPlansResponse {
|
|
127
|
+
services: FFIDServiceInfo[];
|
|
128
|
+
count: number;
|
|
129
|
+
}
|
|
130
|
+
/** Subscription details returned by ext API (sanitized, no Stripe IDs) */
|
|
131
|
+
interface FFIDSubscriptionDetail {
|
|
132
|
+
id: string;
|
|
133
|
+
organizationId: string;
|
|
134
|
+
organizationName: string;
|
|
135
|
+
serviceCode: string;
|
|
136
|
+
serviceName: string;
|
|
137
|
+
planCode: string;
|
|
138
|
+
planName: string;
|
|
139
|
+
status: FFIDSubscriptionStatus;
|
|
140
|
+
paymentMethod: string | null;
|
|
141
|
+
billingInterval: FFIDBillingInterval;
|
|
142
|
+
quantity: number;
|
|
143
|
+
currentPeriodStart: string | null;
|
|
144
|
+
currentPeriodEnd: string | null;
|
|
145
|
+
trialStart: string | null;
|
|
146
|
+
trialEnd: string | null;
|
|
147
|
+
canceledAt: string | null;
|
|
148
|
+
cancelAtPeriodEnd: boolean;
|
|
149
|
+
createdAt: string;
|
|
150
|
+
}
|
|
151
|
+
/** Parameters for subscribing to a plan */
|
|
152
|
+
interface FFIDSubscribeParams {
|
|
153
|
+
/** Organization ID (UUID) */
|
|
154
|
+
organizationId: string;
|
|
155
|
+
/** Plan code (e.g., 'free', 'basic', 'pro') */
|
|
156
|
+
planCode: string;
|
|
157
|
+
/** Billing interval (default: 'monthly') */
|
|
158
|
+
billingInterval?: FFIDBillingInterval;
|
|
159
|
+
/** Number of seats (default: plan's minSeats) */
|
|
160
|
+
quantity?: number;
|
|
161
|
+
/** User ID for seat auto-assignment (only needed for service-key mode) */
|
|
162
|
+
userId?: string;
|
|
163
|
+
}
|
|
164
|
+
/** Sanitized subscription fields returned by subscribe/reactivate endpoints (no Stripe IDs) */
|
|
165
|
+
interface FFIDSubscriptionSummary {
|
|
166
|
+
id: string;
|
|
167
|
+
organizationId: string;
|
|
168
|
+
serviceId: string;
|
|
169
|
+
planId: string;
|
|
170
|
+
status: FFIDSubscriptionStatus;
|
|
171
|
+
paymentMethod: string | null;
|
|
172
|
+
billingInterval: FFIDBillingInterval;
|
|
173
|
+
quantity: number;
|
|
174
|
+
currentPeriodStart: string | null;
|
|
175
|
+
currentPeriodEnd: string | null;
|
|
176
|
+
trialStart: string | null;
|
|
177
|
+
trialEnd: string | null;
|
|
178
|
+
canceledAt: string | null;
|
|
179
|
+
cancelAtPeriodEnd: boolean;
|
|
180
|
+
createdAt: string;
|
|
181
|
+
}
|
|
182
|
+
/** Response from subscribe endpoint */
|
|
183
|
+
interface FFIDSubscribeResponse {
|
|
184
|
+
subscription: FFIDSubscriptionSummary;
|
|
185
|
+
service: {
|
|
186
|
+
id: string;
|
|
187
|
+
code: string;
|
|
188
|
+
name: string;
|
|
189
|
+
};
|
|
190
|
+
plan: {
|
|
191
|
+
id: string;
|
|
192
|
+
code: string;
|
|
193
|
+
name: string;
|
|
194
|
+
priceMonthly: number;
|
|
195
|
+
priceYearly: number | null;
|
|
196
|
+
trialDays: number;
|
|
197
|
+
};
|
|
198
|
+
/** True if a canceled subscription was reactivated */
|
|
199
|
+
reactivated?: boolean;
|
|
200
|
+
/** True if Stripe checkout is needed (canceled paid plan reactivation) */
|
|
201
|
+
needsCheckout?: boolean;
|
|
202
|
+
}
|
|
203
|
+
/** Parameters for changing plan */
|
|
204
|
+
interface FFIDChangePlanParams {
|
|
205
|
+
/** Subscription ID (UUID) */
|
|
206
|
+
subscriptionId: string;
|
|
207
|
+
/** New plan code */
|
|
208
|
+
planCode: string;
|
|
209
|
+
/** New billing interval (default: keeps current) */
|
|
210
|
+
billingInterval?: FFIDBillingInterval;
|
|
211
|
+
}
|
|
212
|
+
/** Response from change plan endpoint */
|
|
213
|
+
interface FFIDChangePlanResponse {
|
|
214
|
+
message: string;
|
|
215
|
+
subscription: {
|
|
216
|
+
id: string;
|
|
217
|
+
organizationId: string;
|
|
218
|
+
serviceCode: string;
|
|
219
|
+
planCode: string;
|
|
220
|
+
planName: string;
|
|
221
|
+
billingInterval: FFIDBillingInterval;
|
|
222
|
+
status: FFIDSubscriptionStatus;
|
|
223
|
+
isUpgrade: boolean;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/** Parameters for canceling subscription */
|
|
227
|
+
interface FFIDCancelSubscriptionParams {
|
|
228
|
+
/** Subscription ID (UUID) */
|
|
229
|
+
subscriptionId: string;
|
|
230
|
+
/** Cancellation reason code */
|
|
231
|
+
reason?: 'too_expensive' | 'missing_features' | 'switched_service' | 'rarely_used' | 'customer_service' | 'other';
|
|
232
|
+
/** Additional cancellation details */
|
|
233
|
+
reasonDetails?: string;
|
|
234
|
+
}
|
|
235
|
+
/** Response from cancel subscription endpoint */
|
|
236
|
+
interface FFIDCancelSubscriptionResponse {
|
|
237
|
+
message: string;
|
|
238
|
+
subscription: {
|
|
239
|
+
id: string;
|
|
240
|
+
organizationId: string;
|
|
241
|
+
status: FFIDSubscriptionStatus;
|
|
242
|
+
canceledAt: string | null;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/** Parameters for previewing plan change */
|
|
246
|
+
interface FFIDPreviewPlanChangeParams {
|
|
247
|
+
/** Subscription ID (UUID) */
|
|
248
|
+
subscriptionId: string;
|
|
249
|
+
/** New plan code */
|
|
250
|
+
planCode: string;
|
|
251
|
+
/** New billing interval (default: keeps current) */
|
|
252
|
+
billingInterval?: FFIDBillingInterval;
|
|
253
|
+
}
|
|
254
|
+
/** Plan change preview line item */
|
|
255
|
+
interface FFIDPlanChangeLineItem {
|
|
256
|
+
description: string;
|
|
257
|
+
amount: number;
|
|
258
|
+
}
|
|
259
|
+
/** Response from plan change preview endpoint */
|
|
260
|
+
interface FFIDPlanChangePreviewResponse {
|
|
261
|
+
preview: {
|
|
262
|
+
currentPlan: {
|
|
263
|
+
name: string;
|
|
264
|
+
price: number;
|
|
265
|
+
};
|
|
266
|
+
newPlan: {
|
|
267
|
+
name: string;
|
|
268
|
+
price: number;
|
|
269
|
+
};
|
|
270
|
+
billingInterval: FFIDBillingInterval;
|
|
271
|
+
isUpgrade: boolean;
|
|
272
|
+
proratedAmount: number;
|
|
273
|
+
nextInvoiceAmount: number;
|
|
274
|
+
nextInvoiceDate: string | null;
|
|
275
|
+
currency: string;
|
|
276
|
+
isEstimate: boolean;
|
|
277
|
+
estimateReason?: string;
|
|
278
|
+
lineItems: FFIDPlanChangeLineItem[];
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
95
282
|
/** OTP / magic link methods - sendOtp / verifyOtp */
|
|
96
283
|
|
|
97
284
|
/** Response from sendOtp */
|
|
@@ -154,8 +341,26 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
154
341
|
userId: string;
|
|
155
342
|
organizationId: string;
|
|
156
343
|
}) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
|
|
344
|
+
listMembers: (params: {
|
|
345
|
+
organizationId: string;
|
|
346
|
+
}) => Promise<FFIDApiResponse<FFIDListMembersResponse>>;
|
|
347
|
+
updateMemberRole: (params: {
|
|
348
|
+
organizationId: string;
|
|
349
|
+
userId: string;
|
|
350
|
+
role: FFIDMemberRole;
|
|
351
|
+
}) => Promise<FFIDApiResponse<FFIDUpdateMemberRoleResponse>>;
|
|
352
|
+
removeMember: (params: {
|
|
353
|
+
organizationId: string;
|
|
354
|
+
userId: string;
|
|
355
|
+
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
157
356
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
158
357
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
358
|
+
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
359
|
+
getSubscription: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDSubscriptionDetail>>;
|
|
360
|
+
subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
|
|
361
|
+
changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
|
|
362
|
+
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
363
|
+
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
159
364
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
160
365
|
requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
|
|
161
366
|
verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
|
|
@@ -436,4 +641,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
|
|
|
436
641
|
/** Type of the FFID Announcements client */
|
|
437
642
|
type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
|
|
438
643
|
|
|
439
|
-
export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, FFIDCacheAdapter, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDLogger, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, FFIDPortalSessionResponse, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, type FFIDResetSessionResponse, FFIDSessionResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
|
644
|
+
export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F 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 FFIDListMembersResponse, h as FFIDMemberRole, i as FFIDUpdateMemberRoleResponse, j as FFIDRemoveMemberResponse, k as FFIDCreateCheckoutParams, l as FFIDCheckoutSessionResponse, m as FFIDCreatePortalParams, n as FFIDPortalSessionResponse, o as FFIDVerifyAccessTokenOptions, p as FFIDOAuthUserInfo, q as FFIDAuthMode, r as FFIDLogger, s as FFIDCacheAdapter, t as FFIDUser, u as FFIDOrganization, v as FFIDSubscription, w as FFIDSubscriptionContextValue, x as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, y as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, z as FFIDAnnouncementsLogger } from './index-p4dJw3qR.js';
|
|
2
|
+
export { B as Announcement, C as AnnouncementStatus, D as AnnouncementType, E as FFIDAnnouncementBadge, G as FFIDAnnouncementList, H as FFIDAnnouncementsError, I as FFIDAnnouncementsErrorCode, J as FFIDAnnouncementsServerResponse, K as FFIDCacheConfig, M as FFIDContextValue, N as FFIDJwtClaims, O as FFIDLoginButton, P as FFIDMemberStatus, Q as FFIDOAuthTokenResponse, R as FFIDOAuthUserInfoMemberRole, S as FFIDOAuthUserInfoSubscription, T as FFIDOrganizationMember, U as FFIDOrganizationSwitcher, V as FFIDSeatModel, W as FFIDSubscriptionBadge, X as FFIDTokenIntrospectionResponse, Y as FFIDUserMenu, Z as UseFFIDAnnouncementsOptions, _ as UseFFIDAnnouncementsReturn, $ as useFFIDAnnouncements } from './index-p4dJw3qR.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -92,6 +92,193 @@ declare function storeCodeVerifier(verifier: string, logger?: PKCELogger): boole
|
|
|
92
92
|
*/
|
|
93
93
|
declare function retrieveCodeVerifier(logger?: PKCELogger): string | null;
|
|
94
94
|
|
|
95
|
+
/** Billing interval for subscriptions */
|
|
96
|
+
type FFIDBillingInterval = 'monthly' | 'yearly';
|
|
97
|
+
/** Service information returned by plans endpoint */
|
|
98
|
+
interface FFIDServiceInfo {
|
|
99
|
+
id: string;
|
|
100
|
+
code: string;
|
|
101
|
+
name: string;
|
|
102
|
+
description: string | null;
|
|
103
|
+
isActive: boolean;
|
|
104
|
+
createdAt: string;
|
|
105
|
+
plans: FFIDPlanInfo[];
|
|
106
|
+
}
|
|
107
|
+
/** Plan information returned by plans endpoint */
|
|
108
|
+
interface FFIDPlanInfo {
|
|
109
|
+
id: string;
|
|
110
|
+
serviceId: string;
|
|
111
|
+
code: string;
|
|
112
|
+
name: string;
|
|
113
|
+
description: string | null;
|
|
114
|
+
minSeats: number;
|
|
115
|
+
maxSeats: number | null;
|
|
116
|
+
trialDays: number;
|
|
117
|
+
priceMonthly: number;
|
|
118
|
+
priceYearly: number | null;
|
|
119
|
+
currency: string;
|
|
120
|
+
isActive: boolean;
|
|
121
|
+
displayOrder: number;
|
|
122
|
+
customPricing: boolean;
|
|
123
|
+
createdAt: string;
|
|
124
|
+
}
|
|
125
|
+
/** Response from list plans endpoint */
|
|
126
|
+
interface FFIDListPlansResponse {
|
|
127
|
+
services: FFIDServiceInfo[];
|
|
128
|
+
count: number;
|
|
129
|
+
}
|
|
130
|
+
/** Subscription details returned by ext API (sanitized, no Stripe IDs) */
|
|
131
|
+
interface FFIDSubscriptionDetail {
|
|
132
|
+
id: string;
|
|
133
|
+
organizationId: string;
|
|
134
|
+
organizationName: string;
|
|
135
|
+
serviceCode: string;
|
|
136
|
+
serviceName: string;
|
|
137
|
+
planCode: string;
|
|
138
|
+
planName: string;
|
|
139
|
+
status: FFIDSubscriptionStatus;
|
|
140
|
+
paymentMethod: string | null;
|
|
141
|
+
billingInterval: FFIDBillingInterval;
|
|
142
|
+
quantity: number;
|
|
143
|
+
currentPeriodStart: string | null;
|
|
144
|
+
currentPeriodEnd: string | null;
|
|
145
|
+
trialStart: string | null;
|
|
146
|
+
trialEnd: string | null;
|
|
147
|
+
canceledAt: string | null;
|
|
148
|
+
cancelAtPeriodEnd: boolean;
|
|
149
|
+
createdAt: string;
|
|
150
|
+
}
|
|
151
|
+
/** Parameters for subscribing to a plan */
|
|
152
|
+
interface FFIDSubscribeParams {
|
|
153
|
+
/** Organization ID (UUID) */
|
|
154
|
+
organizationId: string;
|
|
155
|
+
/** Plan code (e.g., 'free', 'basic', 'pro') */
|
|
156
|
+
planCode: string;
|
|
157
|
+
/** Billing interval (default: 'monthly') */
|
|
158
|
+
billingInterval?: FFIDBillingInterval;
|
|
159
|
+
/** Number of seats (default: plan's minSeats) */
|
|
160
|
+
quantity?: number;
|
|
161
|
+
/** User ID for seat auto-assignment (only needed for service-key mode) */
|
|
162
|
+
userId?: string;
|
|
163
|
+
}
|
|
164
|
+
/** Sanitized subscription fields returned by subscribe/reactivate endpoints (no Stripe IDs) */
|
|
165
|
+
interface FFIDSubscriptionSummary {
|
|
166
|
+
id: string;
|
|
167
|
+
organizationId: string;
|
|
168
|
+
serviceId: string;
|
|
169
|
+
planId: string;
|
|
170
|
+
status: FFIDSubscriptionStatus;
|
|
171
|
+
paymentMethod: string | null;
|
|
172
|
+
billingInterval: FFIDBillingInterval;
|
|
173
|
+
quantity: number;
|
|
174
|
+
currentPeriodStart: string | null;
|
|
175
|
+
currentPeriodEnd: string | null;
|
|
176
|
+
trialStart: string | null;
|
|
177
|
+
trialEnd: string | null;
|
|
178
|
+
canceledAt: string | null;
|
|
179
|
+
cancelAtPeriodEnd: boolean;
|
|
180
|
+
createdAt: string;
|
|
181
|
+
}
|
|
182
|
+
/** Response from subscribe endpoint */
|
|
183
|
+
interface FFIDSubscribeResponse {
|
|
184
|
+
subscription: FFIDSubscriptionSummary;
|
|
185
|
+
service: {
|
|
186
|
+
id: string;
|
|
187
|
+
code: string;
|
|
188
|
+
name: string;
|
|
189
|
+
};
|
|
190
|
+
plan: {
|
|
191
|
+
id: string;
|
|
192
|
+
code: string;
|
|
193
|
+
name: string;
|
|
194
|
+
priceMonthly: number;
|
|
195
|
+
priceYearly: number | null;
|
|
196
|
+
trialDays: number;
|
|
197
|
+
};
|
|
198
|
+
/** True if a canceled subscription was reactivated */
|
|
199
|
+
reactivated?: boolean;
|
|
200
|
+
/** True if Stripe checkout is needed (canceled paid plan reactivation) */
|
|
201
|
+
needsCheckout?: boolean;
|
|
202
|
+
}
|
|
203
|
+
/** Parameters for changing plan */
|
|
204
|
+
interface FFIDChangePlanParams {
|
|
205
|
+
/** Subscription ID (UUID) */
|
|
206
|
+
subscriptionId: string;
|
|
207
|
+
/** New plan code */
|
|
208
|
+
planCode: string;
|
|
209
|
+
/** New billing interval (default: keeps current) */
|
|
210
|
+
billingInterval?: FFIDBillingInterval;
|
|
211
|
+
}
|
|
212
|
+
/** Response from change plan endpoint */
|
|
213
|
+
interface FFIDChangePlanResponse {
|
|
214
|
+
message: string;
|
|
215
|
+
subscription: {
|
|
216
|
+
id: string;
|
|
217
|
+
organizationId: string;
|
|
218
|
+
serviceCode: string;
|
|
219
|
+
planCode: string;
|
|
220
|
+
planName: string;
|
|
221
|
+
billingInterval: FFIDBillingInterval;
|
|
222
|
+
status: FFIDSubscriptionStatus;
|
|
223
|
+
isUpgrade: boolean;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/** Parameters for canceling subscription */
|
|
227
|
+
interface FFIDCancelSubscriptionParams {
|
|
228
|
+
/** Subscription ID (UUID) */
|
|
229
|
+
subscriptionId: string;
|
|
230
|
+
/** Cancellation reason code */
|
|
231
|
+
reason?: 'too_expensive' | 'missing_features' | 'switched_service' | 'rarely_used' | 'customer_service' | 'other';
|
|
232
|
+
/** Additional cancellation details */
|
|
233
|
+
reasonDetails?: string;
|
|
234
|
+
}
|
|
235
|
+
/** Response from cancel subscription endpoint */
|
|
236
|
+
interface FFIDCancelSubscriptionResponse {
|
|
237
|
+
message: string;
|
|
238
|
+
subscription: {
|
|
239
|
+
id: string;
|
|
240
|
+
organizationId: string;
|
|
241
|
+
status: FFIDSubscriptionStatus;
|
|
242
|
+
canceledAt: string | null;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/** Parameters for previewing plan change */
|
|
246
|
+
interface FFIDPreviewPlanChangeParams {
|
|
247
|
+
/** Subscription ID (UUID) */
|
|
248
|
+
subscriptionId: string;
|
|
249
|
+
/** New plan code */
|
|
250
|
+
planCode: string;
|
|
251
|
+
/** New billing interval (default: keeps current) */
|
|
252
|
+
billingInterval?: FFIDBillingInterval;
|
|
253
|
+
}
|
|
254
|
+
/** Plan change preview line item */
|
|
255
|
+
interface FFIDPlanChangeLineItem {
|
|
256
|
+
description: string;
|
|
257
|
+
amount: number;
|
|
258
|
+
}
|
|
259
|
+
/** Response from plan change preview endpoint */
|
|
260
|
+
interface FFIDPlanChangePreviewResponse {
|
|
261
|
+
preview: {
|
|
262
|
+
currentPlan: {
|
|
263
|
+
name: string;
|
|
264
|
+
price: number;
|
|
265
|
+
};
|
|
266
|
+
newPlan: {
|
|
267
|
+
name: string;
|
|
268
|
+
price: number;
|
|
269
|
+
};
|
|
270
|
+
billingInterval: FFIDBillingInterval;
|
|
271
|
+
isUpgrade: boolean;
|
|
272
|
+
proratedAmount: number;
|
|
273
|
+
nextInvoiceAmount: number;
|
|
274
|
+
nextInvoiceDate: string | null;
|
|
275
|
+
currency: string;
|
|
276
|
+
isEstimate: boolean;
|
|
277
|
+
estimateReason?: string;
|
|
278
|
+
lineItems: FFIDPlanChangeLineItem[];
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
95
282
|
/** OTP / magic link methods - sendOtp / verifyOtp */
|
|
96
283
|
|
|
97
284
|
/** Response from sendOtp */
|
|
@@ -154,8 +341,26 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
154
341
|
userId: string;
|
|
155
342
|
organizationId: string;
|
|
156
343
|
}) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
|
|
344
|
+
listMembers: (params: {
|
|
345
|
+
organizationId: string;
|
|
346
|
+
}) => Promise<FFIDApiResponse<FFIDListMembersResponse>>;
|
|
347
|
+
updateMemberRole: (params: {
|
|
348
|
+
organizationId: string;
|
|
349
|
+
userId: string;
|
|
350
|
+
role: FFIDMemberRole;
|
|
351
|
+
}) => Promise<FFIDApiResponse<FFIDUpdateMemberRoleResponse>>;
|
|
352
|
+
removeMember: (params: {
|
|
353
|
+
organizationId: string;
|
|
354
|
+
userId: string;
|
|
355
|
+
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
157
356
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
158
357
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
358
|
+
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
359
|
+
getSubscription: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDSubscriptionDetail>>;
|
|
360
|
+
subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
|
|
361
|
+
changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
|
|
362
|
+
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
363
|
+
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
159
364
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
160
365
|
requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
|
|
161
366
|
verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
|
|
@@ -436,4 +641,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
|
|
|
436
641
|
/** Type of the FFID Announcements client */
|
|
437
642
|
type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
|
|
438
643
|
|
|
439
|
-
export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, FFIDCacheAdapter, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDLogger, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, FFIDPortalSessionResponse, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, type FFIDResetSessionResponse, FFIDSessionResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
|
644
|
+
export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFFIDContext } from './chunk-
|
|
2
|
-
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-
|
|
1
|
+
import { useFFIDContext } from './chunk-3IV7STDJ.js';
|
|
2
|
+
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-3IV7STDJ.js';
|
|
3
3
|
import { useRef, useEffect } from 'react';
|
|
4
4
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|