@feelflow/ffid-sdk 4.2.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/FFIDCookieLink-B-9ggxsL.d.cts +864 -0
- package/dist/FFIDCookieLink-B-9ggxsL.d.ts +864 -0
- package/dist/chunk-CISVLEY5.js +1727 -0
- package/dist/{chunk-U4XDH7TI.cjs → chunk-CJA3XQUF.cjs} +36 -3
- package/dist/chunk-PAQ4GZXN.cjs +1787 -0
- package/dist/{chunk-WI645CPU.js → chunk-XAPFTOZN.js} +36 -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/consent/index.cjs +242 -0
- package/dist/consent/index.d.cts +166 -0
- package/dist/consent/index.d.ts +166 -0
- package/dist/consent/index.js +1 -0
- package/dist/{ffid-client-CUOFknXy.d.ts → ffid-client-BaStAONh.d.ts} +20 -1
- package/dist/{ffid-client-CKMGqqPi.d.cts → ffid-client-DgprK2ec.d.cts} +20 -1
- package/dist/{index-DXgTH5vK.d.cts → index-CInGR4I9.d.cts} +16 -1
- package/dist/{index-DXgTH5vK.d.ts → index-CInGR4I9.d.ts} +16 -1
- package/dist/index.cjs +97 -32
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +3 -2
- package/dist/server/index.cjs +134 -3
- package/dist/server/index.d.cts +151 -3
- package/dist/server/index.d.ts +151 -3
- package/dist/server/index.js +128 -4
- package/dist/server/test/index.d.cts +1 -1
- package/dist/server/test/index.d.ts +1 -1
- package/package.json +8 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
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
|
|
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
|
+
export { A as ALL_DENIED_EXCEPT_NECESSARY, i as CONSENT_COOKIE_NAME, k as COOKIE_VERSION, D as DEFAULT_CONSENT_ERROR_MESSAGES, n as FFIDAnalyticsProvider, o as FFIDAnalyticsProviderProps, c as FFIDConsentCategories, q as FFIDConsentCategoryCode, e as FFIDConsentCategoryMetadata, v as FFIDConsentError, w as FFIDConsentErrorCode, x as FFIDConsentMergeStrategy, z as FFIDConsentMergeWarning, F as FFIDConsentResult, E as FFIDConsentSource, a as FFIDConsentState, d as FFIDConsentSyncResult, K as FFIDCookieBanner, L as FFIDCookieBannerClassNames, M as FFIDCookieBannerProps, N as FFIDCookieLink, O as FFIDCookieLinkProps, f as FFIDCookiePolicy, R as FFIDCookieSettings, S as FFIDCookieSettingsClassNames, T as FFIDCookieSettingsProps, Y as FFID_CONSENT_ERROR_CODES, ac as UseFFIDConsentPreferencesReturn, ad as UseFFIDConsentReturn, ag as decodeConsentCookie, ai as encodeConsentCookie, ak as readConsentCookie, am as useFFIDConsent, an as useFFIDConsentPreferences, ao as writeConsentCookie } from './FFIDCookieLink-B-9ggxsL.cjs';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
6
|
+
import 'zod';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* FFID SDK Shared Constants
|
|
@@ -541,6 +543,10 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
541
543
|
listMembers: (params: {
|
|
542
544
|
organizationId: string;
|
|
543
545
|
}) => Promise<FFIDApiResponse<FFIDListMembersResponse>>;
|
|
546
|
+
addMember: {
|
|
547
|
+
(params: FFIDAddMemberParams): Promise<FFIDApiResponse<FFIDAddMemberResponse>>;
|
|
548
|
+
(organizationId: string, data: FFIDAddMemberRequest): Promise<FFIDApiResponse<FFIDAddMemberResponse>>;
|
|
549
|
+
};
|
|
544
550
|
updateMemberRole: (params: {
|
|
545
551
|
organizationId: string;
|
|
546
552
|
userId: string;
|
|
@@ -1202,4 +1208,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
1202
1208
|
};
|
|
1203
1209
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
1204
1210
|
|
|
1205
|
-
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, 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 };
|
|
1211
|
+
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,7 +1,9 @@
|
|
|
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
|
|
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
|
+
export { A as ALL_DENIED_EXCEPT_NECESSARY, i as CONSENT_COOKIE_NAME, k as COOKIE_VERSION, D as DEFAULT_CONSENT_ERROR_MESSAGES, n as FFIDAnalyticsProvider, o as FFIDAnalyticsProviderProps, c as FFIDConsentCategories, q as FFIDConsentCategoryCode, e as FFIDConsentCategoryMetadata, v as FFIDConsentError, w as FFIDConsentErrorCode, x as FFIDConsentMergeStrategy, z as FFIDConsentMergeWarning, F as FFIDConsentResult, E as FFIDConsentSource, a as FFIDConsentState, d as FFIDConsentSyncResult, K as FFIDCookieBanner, L as FFIDCookieBannerClassNames, M as FFIDCookieBannerProps, N as FFIDCookieLink, O as FFIDCookieLinkProps, f as FFIDCookiePolicy, R as FFIDCookieSettings, S as FFIDCookieSettingsClassNames, T as FFIDCookieSettingsProps, Y as FFID_CONSENT_ERROR_CODES, ac as UseFFIDConsentPreferencesReturn, ad as UseFFIDConsentReturn, ag as decodeConsentCookie, ai as encodeConsentCookie, ak as readConsentCookie, am as useFFIDConsent, an as useFFIDConsentPreferences, ao as writeConsentCookie } from './FFIDCookieLink-B-9ggxsL.js';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
6
|
+
import 'zod';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* FFID SDK Shared Constants
|
|
@@ -541,6 +543,10 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
541
543
|
listMembers: (params: {
|
|
542
544
|
organizationId: string;
|
|
543
545
|
}) => Promise<FFIDApiResponse<FFIDListMembersResponse>>;
|
|
546
|
+
addMember: {
|
|
547
|
+
(params: FFIDAddMemberParams): Promise<FFIDApiResponse<FFIDAddMemberResponse>>;
|
|
548
|
+
(organizationId: string, data: FFIDAddMemberRequest): Promise<FFIDApiResponse<FFIDAddMemberResponse>>;
|
|
549
|
+
};
|
|
544
550
|
updateMemberRole: (params: {
|
|
545
551
|
organizationId: string;
|
|
546
552
|
userId: string;
|
|
@@ -1202,4 +1208,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
1202
1208
|
};
|
|
1203
1209
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
1204
1210
|
|
|
1205
|
-
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, 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 };
|
|
1211
|
+
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,6 @@
|
|
|
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-XAPFTOZN.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-XAPFTOZN.js';
|
|
3
|
+
export { ALL_DENIED_EXCEPT_NECESSARY, CONSENT_COOKIE_NAME, COOKIE_VERSION, DEFAULT_CONSENT_ERROR_MESSAGES, FFIDAnalyticsProvider, FFIDConsentError, FFIDCookieBanner, FFIDCookieLink, FFIDCookieSettings, FFID_CONSENT_ERROR_CODES, decodeConsentCookie, encodeConsentCookie, readConsentCookie, useFFIDConsent, useFFIDConsentPreferences, writeConsentCookie } from './chunk-CISVLEY5.js';
|
|
3
4
|
import { useEffect, useRef } from 'react';
|
|
4
5
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
6
|
|
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 = "
|
|
838
|
+
var SDK_VERSION = "5.0.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() {
|
|
@@ -2553,7 +2585,7 @@ function createFFIDClient(config) {
|
|
|
2553
2585
|
fetchWithAuth,
|
|
2554
2586
|
createError
|
|
2555
2587
|
});
|
|
2556
|
-
const { listMembers, updateMemberRole, removeMember } = createMembersMethods({
|
|
2588
|
+
const { listMembers, addMember, updateMemberRole, removeMember } = createMembersMethods({
|
|
2557
2589
|
fetchWithAuth,
|
|
2558
2590
|
createError,
|
|
2559
2591
|
serviceCode: config.serviceCode
|
|
@@ -2637,6 +2669,7 @@ function createFFIDClient(config) {
|
|
|
2637
2669
|
checkServiceAccess,
|
|
2638
2670
|
requireServiceAccess,
|
|
2639
2671
|
listMembers,
|
|
2672
|
+
addMember,
|
|
2640
2673
|
updateMemberRole,
|
|
2641
2674
|
removeMember,
|
|
2642
2675
|
getProfile,
|
|
@@ -2727,6 +2760,97 @@ function createKVCacheAdapter(kv) {
|
|
|
2727
2760
|
};
|
|
2728
2761
|
}
|
|
2729
2762
|
|
|
2763
|
+
// src/consent/storage/encode.ts
|
|
2764
|
+
var COOKIE_VERSION = "v1";
|
|
2765
|
+
var ALL_DENIED_EXCEPT_NECESSARY = {
|
|
2766
|
+
necessary: true,
|
|
2767
|
+
functional: false,
|
|
2768
|
+
analytics: false,
|
|
2769
|
+
marketing: false
|
|
2770
|
+
};
|
|
2771
|
+
var CATEGORY_LETTERS = {
|
|
2772
|
+
n: "necessary",
|
|
2773
|
+
f: "functional",
|
|
2774
|
+
a: "analytics",
|
|
2775
|
+
m: "marketing"
|
|
2776
|
+
};
|
|
2777
|
+
var ORDERED_LETTERS = ["n", "f", "a", "m"];
|
|
2778
|
+
function encodeConsentCookie(cats) {
|
|
2779
|
+
const parts = ORDERED_LETTERS.map((letter) => {
|
|
2780
|
+
const key = CATEGORY_LETTERS[letter];
|
|
2781
|
+
return `${letter}${cats[key] ? "+" : "-"}`;
|
|
2782
|
+
});
|
|
2783
|
+
return `${COOKIE_VERSION}:${parts.join(",")}`;
|
|
2784
|
+
}
|
|
2785
|
+
function decodeConsentCookie(raw) {
|
|
2786
|
+
if (typeof raw !== "string" || raw.length === 0) {
|
|
2787
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2788
|
+
}
|
|
2789
|
+
const colonIdx = raw.indexOf(":");
|
|
2790
|
+
if (colonIdx === -1) {
|
|
2791
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2792
|
+
}
|
|
2793
|
+
const version = raw.slice(0, colonIdx);
|
|
2794
|
+
if (version !== COOKIE_VERSION) {
|
|
2795
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2796
|
+
}
|
|
2797
|
+
const body = raw.slice(colonIdx + 1);
|
|
2798
|
+
if (body.length === 0) {
|
|
2799
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2800
|
+
}
|
|
2801
|
+
const tokens = body.split(",");
|
|
2802
|
+
if (tokens.length !== ORDERED_LETTERS.length) {
|
|
2803
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2804
|
+
}
|
|
2805
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2806
|
+
const result = {};
|
|
2807
|
+
for (const token of tokens) {
|
|
2808
|
+
if (token.length !== 2) {
|
|
2809
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2810
|
+
}
|
|
2811
|
+
const letter = token[0];
|
|
2812
|
+
const value = token[1];
|
|
2813
|
+
if (!CATEGORY_LETTERS[letter] || value !== "+" && value !== "-") {
|
|
2814
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2815
|
+
}
|
|
2816
|
+
if (seen.has(letter)) {
|
|
2817
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2818
|
+
}
|
|
2819
|
+
seen.add(letter);
|
|
2820
|
+
const key = CATEGORY_LETTERS[letter];
|
|
2821
|
+
result[key] = value === "+";
|
|
2822
|
+
}
|
|
2823
|
+
if (result.necessary !== true) {
|
|
2824
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2825
|
+
}
|
|
2826
|
+
return {
|
|
2827
|
+
necessary: true,
|
|
2828
|
+
functional: result.functional ?? false,
|
|
2829
|
+
analytics: result.analytics ?? false,
|
|
2830
|
+
marketing: result.marketing ?? false
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
// src/consent/storage/cookie.ts
|
|
2835
|
+
var CONSENT_COOKIE_NAME = "ffid_consent";
|
|
2836
|
+
|
|
2837
|
+
// src/server/cookie-consent.ts
|
|
2838
|
+
function getFFIDConsentFromCookies(store) {
|
|
2839
|
+
if (!store) return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2840
|
+
const entry = store.get(CONSENT_COOKIE_NAME);
|
|
2841
|
+
if (!entry) return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2842
|
+
return decodeConsentCookie(entry.value);
|
|
2843
|
+
}
|
|
2844
|
+
function getFFIDConsentFromCookieHeader(cookieHeader) {
|
|
2845
|
+
if (typeof cookieHeader !== "string" || cookieHeader.length === 0) {
|
|
2846
|
+
return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2847
|
+
}
|
|
2848
|
+
const raw = cookieHeader.split(";").map((c) => c.trim()).find((c) => c.startsWith(`${CONSENT_COOKIE_NAME}=`));
|
|
2849
|
+
if (!raw) return { ...ALL_DENIED_EXCEPT_NECESSARY };
|
|
2850
|
+
const value = raw.slice(CONSENT_COOKIE_NAME.length + 1);
|
|
2851
|
+
return decodeConsentCookie(decodeURIComponent(value));
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2730
2854
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
2731
2855
|
enumerable: true,
|
|
2732
2856
|
get: function () { return chunkMDHKSVLP_cjs.DEFAULT_API_BASE_URL; }
|
|
@@ -2735,8 +2859,15 @@ Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
|
|
|
2735
2859
|
enumerable: true,
|
|
2736
2860
|
get: function () { return chunkMDHKSVLP_cjs.DEFAULT_OAUTH_SCOPES; }
|
|
2737
2861
|
});
|
|
2862
|
+
exports.ALL_DENIED_EXCEPT_NECESSARY = ALL_DENIED_EXCEPT_NECESSARY;
|
|
2863
|
+
exports.CONSENT_COOKIE_NAME = CONSENT_COOKIE_NAME;
|
|
2864
|
+
exports.COOKIE_VERSION = COOKIE_VERSION;
|
|
2738
2865
|
exports.createFFIDClient = createFFIDClient;
|
|
2739
2866
|
exports.createKVCacheAdapter = createKVCacheAdapter;
|
|
2740
2867
|
exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
|
|
2741
2868
|
exports.createTokenStore = createTokenStore;
|
|
2742
2869
|
exports.createVerifyAccessToken = createVerifyAccessToken;
|
|
2870
|
+
exports.decodeConsentCookie = decodeConsentCookie;
|
|
2871
|
+
exports.encodeConsentCookie = encodeConsentCookie;
|
|
2872
|
+
exports.getFFIDConsentFromCookieHeader = getFFIDConsentFromCookieHeader;
|
|
2873
|
+
exports.getFFIDConsentFromCookies = getFFIDConsentFromCookies;
|
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 { z } from 'zod';
|
|
4
5
|
import '../types-5g_Bg6Ey.cjs';
|
|
5
6
|
|
|
6
7
|
/** Token verification - verifyAccessToken() implementation */
|
|
@@ -57,4 +58,151 @@ interface KVNamespaceLike {
|
|
|
57
58
|
*/
|
|
58
59
|
declare function createKVCacheAdapter(kv: KVNamespaceLike): FFIDCacheAdapter;
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Cookie Consent — Zod schemas (canonical source of truth).
|
|
63
|
+
*
|
|
64
|
+
* Two layers of schemas live in this file:
|
|
65
|
+
*
|
|
66
|
+
* 1. **SDK consumer-facing schemas** (camelCase, discriminated union). These
|
|
67
|
+
* are what `useFFIDConsent()` / `useFFIDConsentPreferences()` surface to
|
|
68
|
+
* React code, and what spec §6.4 documents as the SDK public contract.
|
|
69
|
+
*
|
|
70
|
+
* 2. **Wire schemas** (`*WireSchema`, snake_case envelopes). These mirror the
|
|
71
|
+
* actual FFID API responses from `src/app/api/v1/ext/consent/*`, which
|
|
72
|
+
* follow the FFID server-side convention of snake_case body fields plus
|
|
73
|
+
* nullable `consent` envelopes. `consent-client.ts` parses responses with
|
|
74
|
+
* these and then maps to the consumer-facing types via `mappers.ts`.
|
|
75
|
+
*
|
|
76
|
+
* TypeScript types are derived in `types.ts` via `z.infer<>`.
|
|
77
|
+
* `as` casting is forbidden; cross-trust-boundary data must be safe-parsed.
|
|
78
|
+
*
|
|
79
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §6.4 + §5
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
declare const FFIDConsentCategoryCodeSchema: z.ZodEnum<{
|
|
83
|
+
necessary: "necessary";
|
|
84
|
+
functional: "functional";
|
|
85
|
+
analytics: "analytics";
|
|
86
|
+
marketing: "marketing";
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Consent state per category. `necessary` is enforced to be `true` at both
|
|
90
|
+
* type and runtime levels (`z.literal(true)`). The DB CHECK constraint
|
|
91
|
+
* `ucc_necessary_always_true` mirrors this on the storage side.
|
|
92
|
+
*/
|
|
93
|
+
declare const FFIDConsentCategoriesSchema: z.ZodObject<{
|
|
94
|
+
necessary: z.ZodLiteral<true>;
|
|
95
|
+
functional: z.ZodBoolean;
|
|
96
|
+
analytics: z.ZodBoolean;
|
|
97
|
+
marketing: z.ZodBoolean;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Cookie Consent — TypeScript types derived from Zod schemas.
|
|
102
|
+
*
|
|
103
|
+
* Always derive types via `z.infer<>`; never hand-roll TypeScript types that
|
|
104
|
+
* could drift from the canonical Zod schema. Refs: schemas.ts
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
type FFIDConsentCategoryCode = z.infer<typeof FFIDConsentCategoryCodeSchema>;
|
|
108
|
+
type FFIDConsentCategories = z.infer<typeof FFIDConsentCategoriesSchema>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Server-side cookie consent helpers for RSC / Server Actions.
|
|
112
|
+
*
|
|
113
|
+
* These are intentionally cookie-only (no DB / API calls) so they remain
|
|
114
|
+
* cheap for every request. The semantics mirror `readConsentCookie()` on the
|
|
115
|
+
* client side — fail-safe to `ALL_DENIED_EXCEPT_NECESSARY` on any error.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* // app/page.tsx (Next.js App Router)
|
|
120
|
+
* import { cookies } from 'next/headers'
|
|
121
|
+
* import { getFFIDConsentFromCookies } from '@feelflow/ffid-sdk/server'
|
|
122
|
+
*
|
|
123
|
+
* export default async function Page() {
|
|
124
|
+
* const cookieStore = await cookies()
|
|
125
|
+
* const consent = getFFIDConsentFromCookies(cookieStore)
|
|
126
|
+
* if (consent.analytics) { ... }
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §6.6
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Structural type that matches both `next/headers` `cookies()` return value
|
|
135
|
+
* (`RequestCookies`) and any custom store with a `get(name)` method that
|
|
136
|
+
* returns `{ value }` or `undefined`.
|
|
137
|
+
*/
|
|
138
|
+
interface FFIDCookieStoreLike {
|
|
139
|
+
get(name: string): {
|
|
140
|
+
value: string;
|
|
141
|
+
} | undefined;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Read the FFID consent cookie from a Next.js `cookies()` store (or any
|
|
145
|
+
* compatible object) and decode it.
|
|
146
|
+
*
|
|
147
|
+
* Returns `ALL_DENIED_EXCEPT_NECESSARY` when the cookie is absent,
|
|
148
|
+
* malformed, or the store is undefined — `decodeConsentCookie` never throws.
|
|
149
|
+
*/
|
|
150
|
+
declare function getFFIDConsentFromCookies(store: FFIDCookieStoreLike | undefined | null): FFIDConsentCategories;
|
|
151
|
+
/**
|
|
152
|
+
* Parse a raw cookie header string (`document.cookie` shape: "k=v; k2=v2").
|
|
153
|
+
* Useful when working with raw Request headers in Edge runtimes that don't
|
|
154
|
+
* expose a `cookies()` API.
|
|
155
|
+
*/
|
|
156
|
+
declare function getFFIDConsentFromCookieHeader(cookieHeader: string | null | undefined): FFIDConsentCategories;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Cookie Consent codec — encode / decode the `ffid_consent` 1st-party cookie.
|
|
160
|
+
*
|
|
161
|
+
* Format: `v1:n+,f+,a-,m+`
|
|
162
|
+
* - `v1:` version prefix (forward-compat for v2+)
|
|
163
|
+
* - n=necessary, f=functional, a=analytics, m=marketing
|
|
164
|
+
* - `+` (granted) / `-` (denied)
|
|
165
|
+
*
|
|
166
|
+
* **Safe-parse contract**: `decodeConsentCookie` NEVER throws. Any malformed,
|
|
167
|
+
* truncated, future-version, or otherwise unparseable input returns
|
|
168
|
+
* `ALL_DENIED_EXCEPT_NECESSARY`. Callers are responsible for logging via
|
|
169
|
+
* `cookie_consent_parse_failed` errorId if needed.
|
|
170
|
+
*
|
|
171
|
+
* This codec is **byte-compatible** with the FFID server-side implementation
|
|
172
|
+
* (`src/lib/cookie-consent/codec.ts`). Both implementations must produce and
|
|
173
|
+
* accept the identical wire format — a roundtrip through either codec must
|
|
174
|
+
* yield the same bytes.
|
|
175
|
+
*
|
|
176
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §6.5
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
declare const COOKIE_VERSION: "v1";
|
|
180
|
+
declare const ALL_DENIED_EXCEPT_NECESSARY: FFIDConsentCategories;
|
|
181
|
+
declare function encodeConsentCookie(cats: FFIDConsentCategories): string;
|
|
182
|
+
/**
|
|
183
|
+
* Safely decode the consent cookie string.
|
|
184
|
+
* Returns `ALL_DENIED_EXCEPT_NECESSARY` on any failure (fail-safe).
|
|
185
|
+
*/
|
|
186
|
+
declare function decodeConsentCookie(raw: string | null | undefined): FFIDConsentCategories;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Cookie Consent — browser cookie read/write with read-back verification.
|
|
190
|
+
*
|
|
191
|
+
* Spec §6.5:
|
|
192
|
+
* - Key: `ffid_consent`
|
|
193
|
+
* - 1st-party, SameSite=Lax, Secure (production only — localhost dev uses
|
|
194
|
+
* non-Secure)
|
|
195
|
+
* - TTL: 1 year
|
|
196
|
+
* - Write must be verified by read-back; failure -> caller surfaces
|
|
197
|
+
* `cookie_consent_cookie_write_failed` and falls back to sessionStorage.
|
|
198
|
+
*
|
|
199
|
+
* This module is SSR-safe: all functions become no-ops when `document` is
|
|
200
|
+
* unavailable (server-side rendering), so calling code does not need to
|
|
201
|
+
* `typeof window` check itself.
|
|
202
|
+
*
|
|
203
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §6.5
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
declare const CONSENT_COOKIE_NAME = "ffid_consent";
|
|
207
|
+
|
|
208
|
+
export { ALL_DENIED_EXCEPT_NECESSARY, CONSENT_COOKIE_NAME, COOKIE_VERSION, FFIDCacheAdapter, type FFIDConsentCategories, type FFIDConsentCategoryCode, type FFIDCookieStoreLike, FFIDOAuthUserInfo, FFIDVerifyAccessTokenOptions, type KVNamespaceLike, createKVCacheAdapter, createMemoryCacheAdapter, createVerifyAccessToken, decodeConsentCookie, encodeConsentCookie, getFFIDConsentFromCookieHeader, getFFIDConsentFromCookies };
|
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 { z } from 'zod';
|
|
4
5
|
import '../types-5g_Bg6Ey.js';
|
|
5
6
|
|
|
6
7
|
/** Token verification - verifyAccessToken() implementation */
|
|
@@ -57,4 +58,151 @@ interface KVNamespaceLike {
|
|
|
57
58
|
*/
|
|
58
59
|
declare function createKVCacheAdapter(kv: KVNamespaceLike): FFIDCacheAdapter;
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Cookie Consent — Zod schemas (canonical source of truth).
|
|
63
|
+
*
|
|
64
|
+
* Two layers of schemas live in this file:
|
|
65
|
+
*
|
|
66
|
+
* 1. **SDK consumer-facing schemas** (camelCase, discriminated union). These
|
|
67
|
+
* are what `useFFIDConsent()` / `useFFIDConsentPreferences()` surface to
|
|
68
|
+
* React code, and what spec §6.4 documents as the SDK public contract.
|
|
69
|
+
*
|
|
70
|
+
* 2. **Wire schemas** (`*WireSchema`, snake_case envelopes). These mirror the
|
|
71
|
+
* actual FFID API responses from `src/app/api/v1/ext/consent/*`, which
|
|
72
|
+
* follow the FFID server-side convention of snake_case body fields plus
|
|
73
|
+
* nullable `consent` envelopes. `consent-client.ts` parses responses with
|
|
74
|
+
* these and then maps to the consumer-facing types via `mappers.ts`.
|
|
75
|
+
*
|
|
76
|
+
* TypeScript types are derived in `types.ts` via `z.infer<>`.
|
|
77
|
+
* `as` casting is forbidden; cross-trust-boundary data must be safe-parsed.
|
|
78
|
+
*
|
|
79
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §6.4 + §5
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
declare const FFIDConsentCategoryCodeSchema: z.ZodEnum<{
|
|
83
|
+
necessary: "necessary";
|
|
84
|
+
functional: "functional";
|
|
85
|
+
analytics: "analytics";
|
|
86
|
+
marketing: "marketing";
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Consent state per category. `necessary` is enforced to be `true` at both
|
|
90
|
+
* type and runtime levels (`z.literal(true)`). The DB CHECK constraint
|
|
91
|
+
* `ucc_necessary_always_true` mirrors this on the storage side.
|
|
92
|
+
*/
|
|
93
|
+
declare const FFIDConsentCategoriesSchema: z.ZodObject<{
|
|
94
|
+
necessary: z.ZodLiteral<true>;
|
|
95
|
+
functional: z.ZodBoolean;
|
|
96
|
+
analytics: z.ZodBoolean;
|
|
97
|
+
marketing: z.ZodBoolean;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Cookie Consent — TypeScript types derived from Zod schemas.
|
|
102
|
+
*
|
|
103
|
+
* Always derive types via `z.infer<>`; never hand-roll TypeScript types that
|
|
104
|
+
* could drift from the canonical Zod schema. Refs: schemas.ts
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
type FFIDConsentCategoryCode = z.infer<typeof FFIDConsentCategoryCodeSchema>;
|
|
108
|
+
type FFIDConsentCategories = z.infer<typeof FFIDConsentCategoriesSchema>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Server-side cookie consent helpers for RSC / Server Actions.
|
|
112
|
+
*
|
|
113
|
+
* These are intentionally cookie-only (no DB / API calls) so they remain
|
|
114
|
+
* cheap for every request. The semantics mirror `readConsentCookie()` on the
|
|
115
|
+
* client side — fail-safe to `ALL_DENIED_EXCEPT_NECESSARY` on any error.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* // app/page.tsx (Next.js App Router)
|
|
120
|
+
* import { cookies } from 'next/headers'
|
|
121
|
+
* import { getFFIDConsentFromCookies } from '@feelflow/ffid-sdk/server'
|
|
122
|
+
*
|
|
123
|
+
* export default async function Page() {
|
|
124
|
+
* const cookieStore = await cookies()
|
|
125
|
+
* const consent = getFFIDConsentFromCookies(cookieStore)
|
|
126
|
+
* if (consent.analytics) { ... }
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §6.6
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Structural type that matches both `next/headers` `cookies()` return value
|
|
135
|
+
* (`RequestCookies`) and any custom store with a `get(name)` method that
|
|
136
|
+
* returns `{ value }` or `undefined`.
|
|
137
|
+
*/
|
|
138
|
+
interface FFIDCookieStoreLike {
|
|
139
|
+
get(name: string): {
|
|
140
|
+
value: string;
|
|
141
|
+
} | undefined;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Read the FFID consent cookie from a Next.js `cookies()` store (or any
|
|
145
|
+
* compatible object) and decode it.
|
|
146
|
+
*
|
|
147
|
+
* Returns `ALL_DENIED_EXCEPT_NECESSARY` when the cookie is absent,
|
|
148
|
+
* malformed, or the store is undefined — `decodeConsentCookie` never throws.
|
|
149
|
+
*/
|
|
150
|
+
declare function getFFIDConsentFromCookies(store: FFIDCookieStoreLike | undefined | null): FFIDConsentCategories;
|
|
151
|
+
/**
|
|
152
|
+
* Parse a raw cookie header string (`document.cookie` shape: "k=v; k2=v2").
|
|
153
|
+
* Useful when working with raw Request headers in Edge runtimes that don't
|
|
154
|
+
* expose a `cookies()` API.
|
|
155
|
+
*/
|
|
156
|
+
declare function getFFIDConsentFromCookieHeader(cookieHeader: string | null | undefined): FFIDConsentCategories;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Cookie Consent codec — encode / decode the `ffid_consent` 1st-party cookie.
|
|
160
|
+
*
|
|
161
|
+
* Format: `v1:n+,f+,a-,m+`
|
|
162
|
+
* - `v1:` version prefix (forward-compat for v2+)
|
|
163
|
+
* - n=necessary, f=functional, a=analytics, m=marketing
|
|
164
|
+
* - `+` (granted) / `-` (denied)
|
|
165
|
+
*
|
|
166
|
+
* **Safe-parse contract**: `decodeConsentCookie` NEVER throws. Any malformed,
|
|
167
|
+
* truncated, future-version, or otherwise unparseable input returns
|
|
168
|
+
* `ALL_DENIED_EXCEPT_NECESSARY`. Callers are responsible for logging via
|
|
169
|
+
* `cookie_consent_parse_failed` errorId if needed.
|
|
170
|
+
*
|
|
171
|
+
* This codec is **byte-compatible** with the FFID server-side implementation
|
|
172
|
+
* (`src/lib/cookie-consent/codec.ts`). Both implementations must produce and
|
|
173
|
+
* accept the identical wire format — a roundtrip through either codec must
|
|
174
|
+
* yield the same bytes.
|
|
175
|
+
*
|
|
176
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §6.5
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
declare const COOKIE_VERSION: "v1";
|
|
180
|
+
declare const ALL_DENIED_EXCEPT_NECESSARY: FFIDConsentCategories;
|
|
181
|
+
declare function encodeConsentCookie(cats: FFIDConsentCategories): string;
|
|
182
|
+
/**
|
|
183
|
+
* Safely decode the consent cookie string.
|
|
184
|
+
* Returns `ALL_DENIED_EXCEPT_NECESSARY` on any failure (fail-safe).
|
|
185
|
+
*/
|
|
186
|
+
declare function decodeConsentCookie(raw: string | null | undefined): FFIDConsentCategories;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Cookie Consent — browser cookie read/write with read-back verification.
|
|
190
|
+
*
|
|
191
|
+
* Spec §6.5:
|
|
192
|
+
* - Key: `ffid_consent`
|
|
193
|
+
* - 1st-party, SameSite=Lax, Secure (production only — localhost dev uses
|
|
194
|
+
* non-Secure)
|
|
195
|
+
* - TTL: 1 year
|
|
196
|
+
* - Write must be verified by read-back; failure -> caller surfaces
|
|
197
|
+
* `cookie_consent_cookie_write_failed` and falls back to sessionStorage.
|
|
198
|
+
*
|
|
199
|
+
* This module is SSR-safe: all functions become no-ops when `document` is
|
|
200
|
+
* unavailable (server-side rendering), so calling code does not need to
|
|
201
|
+
* `typeof window` check itself.
|
|
202
|
+
*
|
|
203
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §6.5
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
declare const CONSENT_COOKIE_NAME = "ffid_consent";
|
|
207
|
+
|
|
208
|
+
export { ALL_DENIED_EXCEPT_NECESSARY, CONSENT_COOKIE_NAME, COOKIE_VERSION, FFIDCacheAdapter, type FFIDConsentCategories, type FFIDConsentCategoryCode, type FFIDCookieStoreLike, FFIDOAuthUserInfo, FFIDVerifyAccessTokenOptions, type KVNamespaceLike, createKVCacheAdapter, createMemoryCacheAdapter, createVerifyAccessToken, decodeConsentCookie, encodeConsentCookie, getFFIDConsentFromCookieHeader, getFFIDConsentFromCookies };
|