@feelflow/ffid-sdk 4.1.0 → 4.3.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/README.md +66 -0
- package/dist/{chunk-P7HSNT4U.js → chunk-35UOD62N.js} +156 -3
- package/dist/{chunk-OYCNHBMG.cjs → chunk-5MO7G2JW.cjs} +156 -3
- 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-ZcJhRbD6.d.cts → ffid-client-BaStAONh.d.ts} +110 -11
- package/dist/{ffid-client-ZcJhRbD6.d.ts → ffid-client-DgprK2ec.d.cts} +110 -11
- package/dist/{index-Cn8-3hgb.d.cts → index-CInGR4I9.d.cts} +102 -11
- package/dist/{index-Cn8-3hgb.d.ts → index-CInGR4I9.d.ts} +102 -11
- package/dist/index.cjs +32 -32
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +156 -3
- package/dist/server/index.d.cts +3 -2
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.js +156 -3
- package/dist/server/test/index.d.cts +2 -1
- package/dist/server/test/index.d.ts +2 -1
- package/dist/types-5g_Bg6Ey.d.cts +37 -0
- package/dist/types-5g_Bg6Ey.d.ts +37 -0
- package/dist/webhooks/index.d.cts +18 -0
- package/dist/webhooks/index.d.ts +18 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5MO7G2JW_cjs = require('./chunk-5MO7G2JW.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
@@ -53,8 +53,8 @@ function defaultRedirect(url) {
|
|
|
53
53
|
}
|
|
54
54
|
function useRequireActiveSubscription(options) {
|
|
55
55
|
const { redirectTo, allowGrace = true, onRedirect } = options;
|
|
56
|
-
const { isLoading, error } =
|
|
57
|
-
const { effectiveStatus, isBlocked, isGrace } =
|
|
56
|
+
const { isLoading, error } = chunk5MO7G2JW_cjs.useFFIDContext();
|
|
57
|
+
const { effectiveStatus, isBlocked, isGrace } = chunk5MO7G2JW_cjs.useSubscription();
|
|
58
58
|
const hasFetchError = error !== null && effectiveStatus === null;
|
|
59
59
|
const shouldRedirect = !isLoading && !hasFetchError && (isBlocked || !allowGrace && isGrace || effectiveStatus === null);
|
|
60
60
|
react.useEffect(() => {
|
|
@@ -75,7 +75,7 @@ function useRequireActiveSubscription(options) {
|
|
|
75
75
|
}
|
|
76
76
|
function withFFIDAuth(Component, options = {}) {
|
|
77
77
|
const WrappedComponent = (props) => {
|
|
78
|
-
const { isLoading, isAuthenticated, login } =
|
|
78
|
+
const { isLoading, isAuthenticated, login } = chunk5MO7G2JW_cjs.useFFIDContext();
|
|
79
79
|
const hasRedirected = react.useRef(false);
|
|
80
80
|
react.useEffect(() => {
|
|
81
81
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -104,115 +104,115 @@ var FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1e3;
|
|
|
104
104
|
|
|
105
105
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunk5MO7G2JW_cjs.DEFAULT_API_BASE_URL; }
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
|
|
110
110
|
enumerable: true,
|
|
111
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunk5MO7G2JW_cjs.DEFAULT_OAUTH_SCOPES; }
|
|
112
112
|
});
|
|
113
113
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
114
114
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDAnnouncementBadge; }
|
|
116
116
|
});
|
|
117
117
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
118
118
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDAnnouncementList; }
|
|
120
120
|
});
|
|
121
121
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
122
122
|
enumerable: true,
|
|
123
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDInquiryForm; }
|
|
124
124
|
});
|
|
125
125
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
126
126
|
enumerable: true,
|
|
127
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDLoginButton; }
|
|
128
128
|
});
|
|
129
129
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
130
130
|
enumerable: true,
|
|
131
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDOrganizationSwitcher; }
|
|
132
132
|
});
|
|
133
133
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
134
134
|
enumerable: true,
|
|
135
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDProvider; }
|
|
136
136
|
});
|
|
137
137
|
Object.defineProperty(exports, "FFIDSDKError", {
|
|
138
138
|
enumerable: true,
|
|
139
|
-
get: function () { return
|
|
139
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDSDKError; }
|
|
140
140
|
});
|
|
141
141
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
142
142
|
enumerable: true,
|
|
143
|
-
get: function () { return
|
|
143
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDSubscriptionBadge; }
|
|
144
144
|
});
|
|
145
145
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
146
146
|
enumerable: true,
|
|
147
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunk5MO7G2JW_cjs.FFIDUserMenu; }
|
|
148
148
|
});
|
|
149
149
|
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
150
150
|
enumerable: true,
|
|
151
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunk5MO7G2JW_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
152
152
|
});
|
|
153
153
|
Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES", {
|
|
154
154
|
enumerable: true,
|
|
155
|
-
get: function () { return
|
|
155
|
+
get: function () { return chunk5MO7G2JW_cjs.FFID_INQUIRY_CATEGORIES; }
|
|
156
156
|
});
|
|
157
157
|
Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES_SITE_2026", {
|
|
158
158
|
enumerable: true,
|
|
159
|
-
get: function () { return
|
|
159
|
+
get: function () { return chunk5MO7G2JW_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
|
|
160
160
|
});
|
|
161
161
|
Object.defineProperty(exports, "computeEffectiveStatusFromSession", {
|
|
162
162
|
enumerable: true,
|
|
163
|
-
get: function () { return
|
|
163
|
+
get: function () { return chunk5MO7G2JW_cjs.computeEffectiveStatusFromSession; }
|
|
164
164
|
});
|
|
165
165
|
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
166
166
|
enumerable: true,
|
|
167
|
-
get: function () { return
|
|
167
|
+
get: function () { return chunk5MO7G2JW_cjs.createFFIDAnnouncementsClient; }
|
|
168
168
|
});
|
|
169
169
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
170
170
|
enumerable: true,
|
|
171
|
-
get: function () { return
|
|
171
|
+
get: function () { return chunk5MO7G2JW_cjs.createFFIDClient; }
|
|
172
172
|
});
|
|
173
173
|
Object.defineProperty(exports, "createTokenStore", {
|
|
174
174
|
enumerable: true,
|
|
175
|
-
get: function () { return
|
|
175
|
+
get: function () { return chunk5MO7G2JW_cjs.createTokenStore; }
|
|
176
176
|
});
|
|
177
177
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
178
178
|
enumerable: true,
|
|
179
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunk5MO7G2JW_cjs.generateCodeChallenge; }
|
|
180
180
|
});
|
|
181
181
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
182
182
|
enumerable: true,
|
|
183
|
-
get: function () { return
|
|
183
|
+
get: function () { return chunk5MO7G2JW_cjs.generateCodeVerifier; }
|
|
184
184
|
});
|
|
185
185
|
Object.defineProperty(exports, "isFFIDInquiryCategorySite2026", {
|
|
186
186
|
enumerable: true,
|
|
187
|
-
get: function () { return
|
|
187
|
+
get: function () { return chunk5MO7G2JW_cjs.isFFIDInquiryCategorySite2026; }
|
|
188
188
|
});
|
|
189
189
|
Object.defineProperty(exports, "normalizeRedirectUri", {
|
|
190
190
|
enumerable: true,
|
|
191
|
-
get: function () { return
|
|
191
|
+
get: function () { return chunk5MO7G2JW_cjs.normalizeRedirectUri; }
|
|
192
192
|
});
|
|
193
193
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
194
194
|
enumerable: true,
|
|
195
|
-
get: function () { return
|
|
195
|
+
get: function () { return chunk5MO7G2JW_cjs.retrieveCodeVerifier; }
|
|
196
196
|
});
|
|
197
197
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
198
198
|
enumerable: true,
|
|
199
|
-
get: function () { return
|
|
199
|
+
get: function () { return chunk5MO7G2JW_cjs.storeCodeVerifier; }
|
|
200
200
|
});
|
|
201
201
|
Object.defineProperty(exports, "useFFID", {
|
|
202
202
|
enumerable: true,
|
|
203
|
-
get: function () { return
|
|
203
|
+
get: function () { return chunk5MO7G2JW_cjs.useFFID; }
|
|
204
204
|
});
|
|
205
205
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
206
206
|
enumerable: true,
|
|
207
|
-
get: function () { return
|
|
207
|
+
get: function () { return chunk5MO7G2JW_cjs.useFFIDAnnouncements; }
|
|
208
208
|
});
|
|
209
209
|
Object.defineProperty(exports, "useSubscription", {
|
|
210
210
|
enumerable: true,
|
|
211
|
-
get: function () { return
|
|
211
|
+
get: function () { return chunk5MO7G2JW_cjs.useSubscription; }
|
|
212
212
|
});
|
|
213
213
|
Object.defineProperty(exports, "withSubscription", {
|
|
214
214
|
enumerable: true,
|
|
215
|
-
get: function () { return
|
|
215
|
+
get: function () { return chunk5MO7G2JW_cjs.withSubscription; }
|
|
216
216
|
});
|
|
217
217
|
exports.FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS;
|
|
218
218
|
exports.FFID_NEWSLETTER_TYPES = FFID_NEWSLETTER_TYPES;
|
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
|
|
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 FFIDListMembersResponse, j as FFIDAddMemberParams, k as FFIDAddMemberResponse, l as FFIDAddMemberRequest, m as FFIDMemberRole, n as FFIDUpdateMemberRoleResponse, o as FFIDRemoveMemberResponse, p as FFIDProfileCallOptions, q as FFIDUserProfile, r as FFIDUpdateUserProfileRequest, s as FFIDAnalyticsConfig, t as FFIDCreateCheckoutParams, u as FFIDCheckoutSessionResponse, v as FFIDCreatePortalParams, w as FFIDPortalSessionResponse, x as FFIDVerifyAccessTokenOptions, y as FFIDOAuthUserInfo, z as FFIDInquiryCreateParams, A as FFIDInquiryCreateResponse, B as FFIDAuthMode, C as FFIDLogger, D as FFIDCacheAdapter, E as FFIDUser, G as FFIDOrganization, H as FFIDSubscription, I as FFIDSubscriptionContextValue, J as EffectiveSubscriptionStatus, K as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, M as FFIDAnnouncementsApiResponse, N as AnnouncementListResponse, O as FFIDAnnouncementsLogger } from './index-CInGR4I9.cjs';
|
|
2
|
+
export { P as Announcement, Q as AnnouncementStatus, R as AnnouncementType, S as FFIDAnnouncementBadge, T as FFIDAnnouncementList, U as FFIDAnnouncementsError, V as FFIDAnnouncementsErrorCode, W as FFIDAnnouncementsServerResponse, X as FFIDAssignableMemberRole, Y as FFIDCacheConfig, Z as FFIDContextValue, _ as FFIDInquiryCategory, $ as FFIDInquiryCategorySite2026, a0 as FFIDInquiryForm, a1 as FFIDInquiryFormCategoryItem, a2 as FFIDInquiryFormClassNames, a3 as FFIDInquiryFormLegalLayout, a4 as FFIDInquiryFormOrganization, a5 as FFIDInquiryFormPlaceholderContext, a6 as FFIDInquiryFormPrefill, a7 as FFIDInquiryFormProps, a8 as FFIDInquiryFormSubmitData, a9 as FFIDInquiryFormSubmitResult, aa as FFIDJwtClaims, ab as FFIDLoginButton, ac as FFIDMemberStatus, ad as FFIDOAuthTokenResponse, ae as FFIDOAuthUserInfoMemberRole, af as FFIDOAuthUserInfoSubscription, ag as FFIDOrganizationMember, ah as FFIDOrganizationSwitcher, ai as FFIDRedirectErrorCode, aj as FFIDSeatModel, ak as FFIDServiceAccessDenialReason, al as FFIDServiceAccessFailPolicy, am as FFIDSubscriptionBadge, an as FFIDTokenIntrospectionResponse, ao as FFIDUserMenu, ap as FFID_INQUIRY_CATEGORIES, aq as FFID_INQUIRY_CATEGORIES_SITE_2026, ar as UseFFIDAnnouncementsOptions, as as UseFFIDAnnouncementsReturn, at as isFFIDInquiryCategorySite2026, au as useFFIDAnnouncements } from './index-CInGR4I9.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -536,9 +536,15 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
536
536
|
userId?: string;
|
|
537
537
|
organizationId: string;
|
|
538
538
|
}) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
|
|
539
|
+
checkServiceAccess: (params: FFIDCheckServiceAccessParams) => Promise<FFIDApiResponse<FFIDServiceAccessDecision>>;
|
|
540
|
+
requireServiceAccess: (params: FFIDCheckServiceAccessParams) => Promise<FFIDApiResponse<FFIDServiceAccessDecision>>;
|
|
539
541
|
listMembers: (params: {
|
|
540
542
|
organizationId: string;
|
|
541
543
|
}) => Promise<FFIDApiResponse<FFIDListMembersResponse>>;
|
|
544
|
+
addMember: {
|
|
545
|
+
(params: FFIDAddMemberParams): Promise<FFIDApiResponse<FFIDAddMemberResponse>>;
|
|
546
|
+
(organizationId: string, data: FFIDAddMemberRequest): Promise<FFIDApiResponse<FFIDAddMemberResponse>>;
|
|
547
|
+
};
|
|
542
548
|
updateMemberRole: (params: {
|
|
543
549
|
organizationId: string;
|
|
544
550
|
userId: string;
|
|
@@ -1200,4 +1206,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
1200
1206
|
};
|
|
1201
1207
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
1202
1208
|
|
|
1203
|
-
export { AnnouncementListResponse, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EffectiveSubscriptionStatus, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, 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, 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, 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, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };
|
|
1209
|
+
export { AnnouncementListResponse, 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, 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, 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
|
|
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 FFIDListMembersResponse, j as FFIDAddMemberParams, k as FFIDAddMemberResponse, l as FFIDAddMemberRequest, m as FFIDMemberRole, n as FFIDUpdateMemberRoleResponse, o as FFIDRemoveMemberResponse, p as FFIDProfileCallOptions, q as FFIDUserProfile, r as FFIDUpdateUserProfileRequest, s as FFIDAnalyticsConfig, t as FFIDCreateCheckoutParams, u as FFIDCheckoutSessionResponse, v as FFIDCreatePortalParams, w as FFIDPortalSessionResponse, x as FFIDVerifyAccessTokenOptions, y as FFIDOAuthUserInfo, z as FFIDInquiryCreateParams, A as FFIDInquiryCreateResponse, B as FFIDAuthMode, C as FFIDLogger, D as FFIDCacheAdapter, E as FFIDUser, G as FFIDOrganization, H as FFIDSubscription, I as FFIDSubscriptionContextValue, J as EffectiveSubscriptionStatus, K as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, M as FFIDAnnouncementsApiResponse, N as AnnouncementListResponse, O as FFIDAnnouncementsLogger } from './index-CInGR4I9.js';
|
|
2
|
+
export { P as Announcement, Q as AnnouncementStatus, R as AnnouncementType, S as FFIDAnnouncementBadge, T as FFIDAnnouncementList, U as FFIDAnnouncementsError, V as FFIDAnnouncementsErrorCode, W as FFIDAnnouncementsServerResponse, X as FFIDAssignableMemberRole, Y as FFIDCacheConfig, Z as FFIDContextValue, _ as FFIDInquiryCategory, $ as FFIDInquiryCategorySite2026, a0 as FFIDInquiryForm, a1 as FFIDInquiryFormCategoryItem, a2 as FFIDInquiryFormClassNames, a3 as FFIDInquiryFormLegalLayout, a4 as FFIDInquiryFormOrganization, a5 as FFIDInquiryFormPlaceholderContext, a6 as FFIDInquiryFormPrefill, a7 as FFIDInquiryFormProps, a8 as FFIDInquiryFormSubmitData, a9 as FFIDInquiryFormSubmitResult, aa as FFIDJwtClaims, ab as FFIDLoginButton, ac as FFIDMemberStatus, ad as FFIDOAuthTokenResponse, ae as FFIDOAuthUserInfoMemberRole, af as FFIDOAuthUserInfoSubscription, ag as FFIDOrganizationMember, ah as FFIDOrganizationSwitcher, ai as FFIDRedirectErrorCode, aj as FFIDSeatModel, ak as FFIDServiceAccessDenialReason, al as FFIDServiceAccessFailPolicy, am as FFIDSubscriptionBadge, an as FFIDTokenIntrospectionResponse, ao as FFIDUserMenu, ap as FFID_INQUIRY_CATEGORIES, aq as FFID_INQUIRY_CATEGORIES_SITE_2026, ar as UseFFIDAnnouncementsOptions, as as UseFFIDAnnouncementsReturn, at as isFFIDInquiryCategorySite2026, au as useFFIDAnnouncements } from './index-CInGR4I9.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -536,9 +536,15 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
536
536
|
userId?: string;
|
|
537
537
|
organizationId: string;
|
|
538
538
|
}) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
|
|
539
|
+
checkServiceAccess: (params: FFIDCheckServiceAccessParams) => Promise<FFIDApiResponse<FFIDServiceAccessDecision>>;
|
|
540
|
+
requireServiceAccess: (params: FFIDCheckServiceAccessParams) => Promise<FFIDApiResponse<FFIDServiceAccessDecision>>;
|
|
539
541
|
listMembers: (params: {
|
|
540
542
|
organizationId: string;
|
|
541
543
|
}) => Promise<FFIDApiResponse<FFIDListMembersResponse>>;
|
|
544
|
+
addMember: {
|
|
545
|
+
(params: FFIDAddMemberParams): Promise<FFIDApiResponse<FFIDAddMemberResponse>>;
|
|
546
|
+
(organizationId: string, data: FFIDAddMemberRequest): Promise<FFIDApiResponse<FFIDAddMemberResponse>>;
|
|
547
|
+
};
|
|
542
548
|
updateMemberRole: (params: {
|
|
543
549
|
organizationId: string;
|
|
544
550
|
userId: string;
|
|
@@ -1200,4 +1206,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
1200
1206
|
};
|
|
1201
1207
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
1202
1208
|
|
|
1203
|
-
export { AnnouncementListResponse, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EffectiveSubscriptionStatus, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, 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, 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, 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, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };
|
|
1209
|
+
export { AnnouncementListResponse, 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, 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, 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 { 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, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-
|
|
1
|
+
import { useFFIDContext, useSubscription } from './chunk-35UOD62N.js';
|
|
2
|
+
export { 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, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-35UOD62N.js';
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
4
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
package/dist/server/index.cjs
CHANGED
|
@@ -705,6 +705,7 @@ function createSubscriptionMethods(deps) {
|
|
|
705
705
|
var EXT_MEMBERS_ENDPOINT = "/api/v1/organizations/ext/members";
|
|
706
706
|
function createMembersMethods(deps) {
|
|
707
707
|
const { fetchWithAuth, createError, serviceCode } = deps;
|
|
708
|
+
const assignableRoles = /* @__PURE__ */ new Set(["admin", "member", "viewer"]);
|
|
708
709
|
function buildQuery(organizationId) {
|
|
709
710
|
return new URLSearchParams({ organizationId, serviceCode }).toString();
|
|
710
711
|
}
|
|
@@ -718,6 +719,37 @@ function createMembersMethods(deps) {
|
|
|
718
719
|
`${EXT_MEMBERS_ENDPOINT}?${buildQuery(params.organizationId)}`
|
|
719
720
|
);
|
|
720
721
|
}
|
|
722
|
+
function normalizeAddMemberArgs(paramsOrOrganizationId, data) {
|
|
723
|
+
if (typeof paramsOrOrganizationId === "string") {
|
|
724
|
+
const params = {
|
|
725
|
+
organizationId: paramsOrOrganizationId,
|
|
726
|
+
email: data?.email ?? ""
|
|
727
|
+
};
|
|
728
|
+
if (data?.role !== void 0) params.role = data.role;
|
|
729
|
+
return params;
|
|
730
|
+
}
|
|
731
|
+
return paramsOrOrganizationId;
|
|
732
|
+
}
|
|
733
|
+
async function addMember(paramsOrOrganizationId, data) {
|
|
734
|
+
const params = normalizeAddMemberArgs(paramsOrOrganizationId, data);
|
|
735
|
+
if (!params.organizationId || !params.email) {
|
|
736
|
+
return {
|
|
737
|
+
error: createError("VALIDATION_ERROR", "organizationId \u3068 email \u306F\u5FC5\u9808\u3067\u3059")
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
if (params.role !== void 0 && !assignableRoles.has(params.role)) {
|
|
741
|
+
return {
|
|
742
|
+
error: createError("VALIDATION_ERROR", "role \u306F admin\u3001member\u3001viewer \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044")
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
return fetchWithAuth(
|
|
746
|
+
`${EXT_MEMBERS_ENDPOINT}?${buildQuery(params.organizationId)}`,
|
|
747
|
+
{
|
|
748
|
+
method: "POST",
|
|
749
|
+
body: JSON.stringify({ email: params.email, role: params.role })
|
|
750
|
+
}
|
|
751
|
+
);
|
|
752
|
+
}
|
|
721
753
|
async function updateMemberRole(params) {
|
|
722
754
|
if (!params.organizationId || !params.userId) {
|
|
723
755
|
return {
|
|
@@ -750,7 +782,7 @@ function createMembersMethods(deps) {
|
|
|
750
782
|
}
|
|
751
783
|
);
|
|
752
784
|
}
|
|
753
|
-
return { listMembers, updateMemberRole, removeMember };
|
|
785
|
+
return { listMembers, addMember, updateMemberRole, removeMember };
|
|
754
786
|
}
|
|
755
787
|
|
|
756
788
|
// src/client/profile-methods.ts
|
|
@@ -803,7 +835,7 @@ function createProfileMethods(deps) {
|
|
|
803
835
|
}
|
|
804
836
|
|
|
805
837
|
// src/client/version-check.ts
|
|
806
|
-
var SDK_VERSION = "4.
|
|
838
|
+
var SDK_VERSION = "4.3.0";
|
|
807
839
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
808
840
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
809
841
|
function sdkHeaders() {
|
|
@@ -2180,6 +2212,73 @@ var FFID_ERROR_CODES = {
|
|
|
2180
2212
|
TOKEN_VERIFICATION_ERROR: "TOKEN_VERIFICATION_ERROR"
|
|
2181
2213
|
};
|
|
2182
2214
|
var EXT_CHECK_ENDPOINT = "/api/v1/subscriptions/ext/check";
|
|
2215
|
+
var DEFAULT_ALLOW_GRACE = true;
|
|
2216
|
+
var DEFAULT_SERVICE_ACCESS_FAIL_POLICY = "failClosed";
|
|
2217
|
+
var SERVICE_ACCESS_DENIED_CODE = "SERVICE_ACCESS_DENIED";
|
|
2218
|
+
var ACCESS_GRANTING_EFFECTIVE_STATUSES = ["active", "past_due_grace"];
|
|
2219
|
+
var BLOCKING_EFFECTIVE_STATUSES = [
|
|
2220
|
+
"blocked",
|
|
2221
|
+
"canceled",
|
|
2222
|
+
"expired",
|
|
2223
|
+
"trial_expired"
|
|
2224
|
+
];
|
|
2225
|
+
function resolveServiceAccessDenialReason(params, allowGrace) {
|
|
2226
|
+
if (params.hasAccess) {
|
|
2227
|
+
return null;
|
|
2228
|
+
}
|
|
2229
|
+
if (params.effectiveStatus === null) {
|
|
2230
|
+
return "no_subscription";
|
|
2231
|
+
}
|
|
2232
|
+
if (params.isGrace && !allowGrace) {
|
|
2233
|
+
return "grace_disallowed";
|
|
2234
|
+
}
|
|
2235
|
+
if (params.effectiveStatus === "active" || params.effectiveStatus === "past_due_grace") {
|
|
2236
|
+
return "blocked";
|
|
2237
|
+
}
|
|
2238
|
+
return params.effectiveStatus;
|
|
2239
|
+
}
|
|
2240
|
+
function toServiceAccessDecision(response, allowGrace) {
|
|
2241
|
+
const effectiveStatus = response.effectiveStatus ?? null;
|
|
2242
|
+
const serverHasAccess = response.hasAccess ?? (effectiveStatus !== null && ACCESS_GRANTING_EFFECTIVE_STATUSES.includes(effectiveStatus));
|
|
2243
|
+
const isGrace = response.isGrace ?? effectiveStatus === "past_due_grace";
|
|
2244
|
+
const hasAccess = serverHasAccess && (allowGrace || !isGrace);
|
|
2245
|
+
const isBlocked = response.isBlocked ?? (effectiveStatus === null || effectiveStatus !== null && BLOCKING_EFFECTIVE_STATUSES.includes(effectiveStatus));
|
|
2246
|
+
return {
|
|
2247
|
+
hasAccess,
|
|
2248
|
+
effectiveStatus,
|
|
2249
|
+
isGrace,
|
|
2250
|
+
isBlocked: isBlocked || !hasAccess,
|
|
2251
|
+
allowGrace,
|
|
2252
|
+
failPolicy: DEFAULT_SERVICE_ACCESS_FAIL_POLICY,
|
|
2253
|
+
denialReason: resolveServiceAccessDenialReason({ effectiveStatus, hasAccess, isGrace }, allowGrace),
|
|
2254
|
+
organizationId: response.organizationId,
|
|
2255
|
+
subscriptionId: response.subscriptionId,
|
|
2256
|
+
status: response.status,
|
|
2257
|
+
planCode: response.planCode,
|
|
2258
|
+
currentPeriodEnd: response.currentPeriodEnd,
|
|
2259
|
+
gracePeriodEndsAt: response.gracePeriodEndsAt ?? null,
|
|
2260
|
+
reactivatable: response.reactivatable ?? false
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
function failClosedServiceAccessDecision(params, error) {
|
|
2264
|
+
return {
|
|
2265
|
+
hasAccess: false,
|
|
2266
|
+
effectiveStatus: null,
|
|
2267
|
+
isGrace: false,
|
|
2268
|
+
isBlocked: true,
|
|
2269
|
+
allowGrace: params.allowGrace ?? DEFAULT_ALLOW_GRACE,
|
|
2270
|
+
failPolicy: DEFAULT_SERVICE_ACCESS_FAIL_POLICY,
|
|
2271
|
+
denialReason: "ffid_unreachable",
|
|
2272
|
+
organizationId: params.organizationId || null,
|
|
2273
|
+
subscriptionId: null,
|
|
2274
|
+
status: null,
|
|
2275
|
+
planCode: null,
|
|
2276
|
+
currentPeriodEnd: null,
|
|
2277
|
+
gracePeriodEndsAt: null,
|
|
2278
|
+
reactivatable: false,
|
|
2279
|
+
error
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2183
2282
|
function resolveRedirectUri(raw, logger) {
|
|
2184
2283
|
if (raw === null) return null;
|
|
2185
2284
|
try {
|
|
@@ -2418,6 +2517,57 @@ function createFFIDClient(config) {
|
|
|
2418
2517
|
`${EXT_CHECK_ENDPOINT}?${query.toString()}`
|
|
2419
2518
|
);
|
|
2420
2519
|
}
|
|
2520
|
+
async function checkServiceAccess(params) {
|
|
2521
|
+
const failPolicy = params.failPolicy ?? DEFAULT_SERVICE_ACCESS_FAIL_POLICY;
|
|
2522
|
+
if (failPolicy !== DEFAULT_SERVICE_ACCESS_FAIL_POLICY) {
|
|
2523
|
+
return {
|
|
2524
|
+
error: createError(
|
|
2525
|
+
"VALIDATION_ERROR",
|
|
2526
|
+
`failPolicy \u306F ${DEFAULT_SERVICE_ACCESS_FAIL_POLICY} \u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059`
|
|
2527
|
+
)
|
|
2528
|
+
};
|
|
2529
|
+
}
|
|
2530
|
+
const subscriptionParams = {
|
|
2531
|
+
organizationId: params.organizationId
|
|
2532
|
+
};
|
|
2533
|
+
if (params.userId !== void 0) {
|
|
2534
|
+
subscriptionParams.userId = params.userId;
|
|
2535
|
+
}
|
|
2536
|
+
const subscriptionResult = await checkSubscription(subscriptionParams);
|
|
2537
|
+
if (subscriptionResult.error) {
|
|
2538
|
+
if (subscriptionResult.error.code === "VALIDATION_ERROR") {
|
|
2539
|
+
return { error: subscriptionResult.error };
|
|
2540
|
+
}
|
|
2541
|
+
return {
|
|
2542
|
+
data: failClosedServiceAccessDecision(params, subscriptionResult.error)
|
|
2543
|
+
};
|
|
2544
|
+
}
|
|
2545
|
+
return {
|
|
2546
|
+
data: toServiceAccessDecision(
|
|
2547
|
+
subscriptionResult.data,
|
|
2548
|
+
params.allowGrace ?? DEFAULT_ALLOW_GRACE
|
|
2549
|
+
)
|
|
2550
|
+
};
|
|
2551
|
+
}
|
|
2552
|
+
async function requireServiceAccess(params) {
|
|
2553
|
+
const result = await checkServiceAccess(params);
|
|
2554
|
+
if (result.error) {
|
|
2555
|
+
return result;
|
|
2556
|
+
}
|
|
2557
|
+
if (!result.data.hasAccess) {
|
|
2558
|
+
const error = createError(
|
|
2559
|
+
SERVICE_ACCESS_DENIED_CODE,
|
|
2560
|
+
`FFID service access denied: ${result.data.denialReason ?? "unknown"}`
|
|
2561
|
+
);
|
|
2562
|
+
if (result.data.error) {
|
|
2563
|
+
error.details = { cause: result.data.error };
|
|
2564
|
+
}
|
|
2565
|
+
return {
|
|
2566
|
+
error
|
|
2567
|
+
};
|
|
2568
|
+
}
|
|
2569
|
+
return result;
|
|
2570
|
+
}
|
|
2421
2571
|
const { createCheckoutSession, createPortalSession } = createBillingMethods({
|
|
2422
2572
|
fetchWithAuth,
|
|
2423
2573
|
createError
|
|
@@ -2435,7 +2585,7 @@ function createFFIDClient(config) {
|
|
|
2435
2585
|
fetchWithAuth,
|
|
2436
2586
|
createError
|
|
2437
2587
|
});
|
|
2438
|
-
const { listMembers, updateMemberRole, removeMember } = createMembersMethods({
|
|
2588
|
+
const { listMembers, addMember, updateMemberRole, removeMember } = createMembersMethods({
|
|
2439
2589
|
fetchWithAuth,
|
|
2440
2590
|
createError,
|
|
2441
2591
|
serviceCode: config.serviceCode
|
|
@@ -2516,7 +2666,10 @@ function createFFIDClient(config) {
|
|
|
2516
2666
|
exchangeCodeForTokens,
|
|
2517
2667
|
refreshAccessToken,
|
|
2518
2668
|
checkSubscription,
|
|
2669
|
+
checkServiceAccess,
|
|
2670
|
+
requireServiceAccess,
|
|
2519
2671
|
listMembers,
|
|
2672
|
+
addMember,
|
|
2520
2673
|
updateMemberRole,
|
|
2521
2674
|
removeMember,
|
|
2522
2675
|
getProfile,
|
package/dist/server/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo } from '../ffid-client-
|
|
2
|
-
export { f as
|
|
1
|
+
import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo } from '../ffid-client-DgprK2ec.cjs';
|
|
2
|
+
export { f as FFIDAddMemberParams, g as FFIDAddMemberRequest, h as FFIDAddMemberResponse, i as FFIDAssignableMemberRole, j as FFIDCacheConfig, k as FFIDClient, l as FFIDConfig, m as FFIDListMembersResponse, n as FFIDMemberRole, o as FFIDOrganization, p as FFIDOrganizationMember, q as FFIDOtpSendResponse, r as FFIDOtpVerifyResponse, s as FFIDPasswordResetConfirmResponse, t as FFIDPasswordResetResponse, u as FFIDPasswordResetVerifyResponse, v as FFIDProfileCallOptions, w as FFIDRemoveMemberResponse, x as FFIDResetSessionResponse, y as FFIDSubscription, z as FFIDUpdateMemberRoleResponse, A as FFIDUpdateUserProfileRequest, B as FFIDUser, C as FFIDUserProfile, T as TokenData, D as TokenStore, E as createFFIDClient, G as createTokenStore } from '../ffid-client-DgprK2ec.cjs';
|
|
3
3
|
export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-D61jqRIO.cjs';
|
|
4
|
+
import '../types-5g_Bg6Ey.cjs';
|
|
4
5
|
|
|
5
6
|
/** Token verification - verifyAccessToken() implementation */
|
|
6
7
|
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo } from '../ffid-client-
|
|
2
|
-
export { f as
|
|
1
|
+
import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo } from '../ffid-client-BaStAONh.js';
|
|
2
|
+
export { f as FFIDAddMemberParams, g as FFIDAddMemberRequest, h as FFIDAddMemberResponse, i as FFIDAssignableMemberRole, j as FFIDCacheConfig, k as FFIDClient, l as FFIDConfig, m as FFIDListMembersResponse, n as FFIDMemberRole, o as FFIDOrganization, p as FFIDOrganizationMember, q as FFIDOtpSendResponse, r as FFIDOtpVerifyResponse, s as FFIDPasswordResetConfirmResponse, t as FFIDPasswordResetResponse, u as FFIDPasswordResetVerifyResponse, v as FFIDProfileCallOptions, w as FFIDRemoveMemberResponse, x as FFIDResetSessionResponse, y as FFIDSubscription, z as FFIDUpdateMemberRoleResponse, A as FFIDUpdateUserProfileRequest, B as FFIDUser, C as FFIDUserProfile, T as TokenData, D as TokenStore, E as createFFIDClient, G as createTokenStore } from '../ffid-client-BaStAONh.js';
|
|
3
3
|
export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-D61jqRIO.js';
|
|
4
|
+
import '../types-5g_Bg6Ey.js';
|
|
4
5
|
|
|
5
6
|
/** Token verification - verifyAccessToken() implementation */
|
|
6
7
|
|