@feelflow/ffid-sdk 2.20.0 → 3.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 +37 -0
- package/dist/agency/index.cjs +3 -3
- package/dist/agency/index.d.cts +1 -1
- package/dist/agency/index.d.ts +1 -1
- package/dist/agency/index.js +2 -2
- package/dist/announcements/index.cjs +2 -2
- package/dist/announcements/index.js +1 -1
- package/dist/chunk-JEVK2XUM.js +5 -0
- package/dist/{chunk-KNEZ5OUQ.cjs → chunk-JNR4AKL5.cjs} +133 -3
- package/dist/{chunk-YUIITYBE.cjs → chunk-MDHKSVLP.cjs} +2 -0
- package/dist/{chunk-GCUVFSB2.js → chunk-XWI4BFKW.js} +133 -4
- 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/constants-D61jqRIO.d.cts +35 -0
- package/dist/constants-D61jqRIO.d.ts +35 -0
- package/dist/{ffid-client-Cjm_TKUc.d.cts → ffid-client-B26jbUp5.d.cts} +72 -0
- package/dist/{ffid-client-Cjm_TKUc.d.ts → ffid-client-B26jbUp5.d.ts} +72 -0
- package/dist/{index-0D2vYSLq.d.cts → index-C3zyNa4j.d.cts} +37 -1
- package/dist/{index-0D2vYSLq.d.ts → index-C3zyNa4j.d.ts} +37 -1
- package/dist/index.cjs +37 -31
- package/dist/index.d.cts +68 -4
- package/dist/index.d.ts +68 -4
- package/dist/index.js +4 -3
- package/dist/legal/index.cjs +3 -3
- package/dist/legal/index.d.cts +1 -1
- package/dist/legal/index.d.ts +1 -1
- package/dist/legal/index.js +2 -2
- package/dist/server/index.cjs +135 -5
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +130 -4
- package/dist/server/test/index.d.cts +1 -1
- package/dist/server/test/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-QBRM2RRC.js +0 -4
- package/dist/constants-DvTGHPZn.d.cts +0 -10
- package/dist/constants-DvTGHPZn.d.ts +0 -10
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 FFIDListMembersResponse, h as FFIDMemberRole, i as FFIDUpdateMemberRoleResponse, j as FFIDRemoveMemberResponse, k as FFIDProfileCallOptions, l as FFIDUserProfile, m as FFIDUpdateUserProfileRequest, n as
|
|
2
|
-
export {
|
|
1
|
+
import { F as FFIDSubscriptionStatus, a as FFIDConfig, b as FFIDApiResponse, c as FFIDSessionResponse, d as FFIDRedirectResult, e as FFIDError, f as FFIDSubscriptionCheckResponse, g as FFIDListMembersResponse, h as FFIDMemberRole, i as FFIDUpdateMemberRoleResponse, j as FFIDRemoveMemberResponse, k as FFIDProfileCallOptions, l as FFIDUserProfile, m as FFIDUpdateUserProfileRequest, n as FFIDAnalyticsConfig, o as FFIDCreateCheckoutParams, p as FFIDCheckoutSessionResponse, q as FFIDCreatePortalParams, r as FFIDPortalSessionResponse, s as FFIDVerifyAccessTokenOptions, t as FFIDOAuthUserInfo, u as FFIDInquiryCreateParams, v as FFIDInquiryCreateResponse, w as FFIDAuthMode, x as FFIDLogger, y as FFIDCacheAdapter, z as FFIDUser, A as FFIDOrganization, B as FFIDSubscription, C as FFIDSubscriptionContextValue, E as EffectiveSubscriptionStatus, D as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, G as FFIDAnnouncementsApiResponse, H as AnnouncementListResponse, I as FFIDAnnouncementsLogger } from './index-C3zyNa4j.cjs';
|
|
2
|
+
export { J as Announcement, K as AnnouncementStatus, M as AnnouncementType, N as FFIDAnnouncementBadge, O as FFIDAnnouncementList, P as FFIDAnnouncementsError, Q as FFIDAnnouncementsErrorCode, R as FFIDAnnouncementsServerResponse, S as FFIDCacheConfig, T as FFIDContextValue, U as FFIDInquiryCategory, V as FFIDInquiryCategorySite2026, W as FFIDInquiryForm, X as FFIDInquiryFormCategoryItem, Y as FFIDInquiryFormClassNames, Z as FFIDInquiryFormOrganization, _ as FFIDInquiryFormPlaceholderContext, $ as FFIDInquiryFormPrefill, a0 as FFIDInquiryFormProps, a1 as FFIDInquiryFormSubmitData, a2 as FFIDInquiryFormSubmitResult, a3 as FFIDJwtClaims, a4 as FFIDLoginButton, a5 as FFIDMemberStatus, a6 as FFIDOAuthTokenResponse, a7 as FFIDOAuthUserInfoMemberRole, a8 as FFIDOAuthUserInfoSubscription, a9 as FFIDOrganizationMember, aa as FFIDOrganizationSwitcher, ab as FFIDRedirectErrorCode, ac as FFIDSeatModel, ad as FFIDSubscriptionBadge, ae as FFIDTokenIntrospectionResponse, af as FFIDUserMenu, ag as FFID_INQUIRY_CATEGORIES, ah as FFID_INQUIRY_CATEGORIES_SITE_2026, ai as UseFFIDAnnouncementsOptions, aj as UseFFIDAnnouncementsReturn, ak as isFFIDInquiryCategorySite2026, al as useFFIDAnnouncements } from './index-C3zyNa4j.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -11,6 +11,31 @@ import { ReactNode, ComponentType, FC } from 'react';
|
|
|
11
11
|
*/
|
|
12
12
|
/** Default FFID API base URL (production) */
|
|
13
13
|
declare const DEFAULT_API_BASE_URL = "https://id.feelflow.net";
|
|
14
|
+
/**
|
|
15
|
+
* Recommended default OAuth scope set for FFID-connected services (v3.0.0+).
|
|
16
|
+
*
|
|
17
|
+
* Coverage:
|
|
18
|
+
* - `openid email profile` — OIDC standard claims (always required)
|
|
19
|
+
* - `subscription:read` — `/api/v1/subscriptions/ext/*` 系(プラン / 課金 gate)
|
|
20
|
+
* - `legal:read` — `/api/v1/legal/ext` 系(利用規約・同意状態)
|
|
21
|
+
*
|
|
22
|
+
* Add feature-specific scopes on top of this when needed (browser SDK):
|
|
23
|
+
* - `analytics:read` for `/api/v1/ext/analytics/config`
|
|
24
|
+
* - `organization:read` / `organization:write` for `/api/v1/organizations/ext/members`
|
|
25
|
+
* - `subscription:write` for self-serve plan changes
|
|
26
|
+
* - `legal:write` for recording user consent
|
|
27
|
+
* - `profile:read` / `profile:write` for profile UI
|
|
28
|
+
* - `organization:api-key` for org-level API key issuance
|
|
29
|
+
*
|
|
30
|
+
* **Note**: kept as a widened `string` (not `as const`) so consumers can
|
|
31
|
+
* concatenate additional scopes (e.g. `\`${DEFAULT_OAUTH_SCOPES} analytics:read\``)
|
|
32
|
+
* and so it remains assignable to `FFIDConfig.scope: string`. `widget:verify`
|
|
33
|
+
* is intentionally excluded — it is a service-key-only scope (`/api/v1/widget/*`),
|
|
34
|
+
* not used by the browser OAuth flow.
|
|
35
|
+
*
|
|
36
|
+
* Survey: feel-flow/feelflow-id-platform#2656 issuecomment-4324082742
|
|
37
|
+
*/
|
|
38
|
+
declare const DEFAULT_OAUTH_SCOPES = "openid email profile subscription:read legal:read";
|
|
14
39
|
|
|
15
40
|
/**
|
|
16
41
|
* Token Store
|
|
@@ -505,6 +530,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
505
530
|
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
506
531
|
getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
507
532
|
updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
533
|
+
getAnalyticsConfig: (serviceCode: string, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDAnalyticsConfig>>;
|
|
508
534
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
509
535
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
510
536
|
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
@@ -542,6 +568,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
542
568
|
subscribe: (params: FFIDNewsletterSubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterSubscribeResponse>>;
|
|
543
569
|
confirm: (params: FFIDNewsletterConfirmParams) => Promise<FFIDApiResponse<FFIDNewsletterConfirmResponse>>;
|
|
544
570
|
unsubscribe: (params: FFIDNewsletterUnsubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterUnsubscribeResponse>>;
|
|
571
|
+
dispatch: (params: FFIDNewsletterDispatchParams) => Promise<FFIDApiResponse<FFIDNewsletterDispatchResponse>>;
|
|
545
572
|
};
|
|
546
573
|
/** Inquiry methods (create) */
|
|
547
574
|
inquiry: {
|
|
@@ -632,7 +659,7 @@ interface FFIDProviderProps extends FFIDConfig {
|
|
|
632
659
|
* - Automatic session refresh
|
|
633
660
|
* - Token mode: automatic code exchange and token refresh
|
|
634
661
|
*/
|
|
635
|
-
declare function FFIDProvider({ children, serviceCode, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, authMode, clientId, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
|
|
662
|
+
declare function FFIDProvider({ children, serviceCode, scope, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, authMode, clientId, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
|
|
636
663
|
|
|
637
664
|
/**
|
|
638
665
|
* Return type for useFFID hook
|
|
@@ -1081,6 +1108,42 @@ interface FFIDNewsletterUnsubscribeParams {
|
|
|
1081
1108
|
interface FFIDNewsletterUnsubscribeResponse {
|
|
1082
1109
|
ok: true;
|
|
1083
1110
|
}
|
|
1111
|
+
/** Recipient cap on a single dispatch — mirrors NEWSLETTER_DISPATCH_MAX_RECIPIENTS. */
|
|
1112
|
+
declare const FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1000;
|
|
1113
|
+
type FFIDNewsletterCampaignStatus = 'draft' | 'queued' | 'sending' | 'sent' | 'failed' | 'cancelled';
|
|
1114
|
+
type FFIDNewsletterSegment = {
|
|
1115
|
+
type: 'all';
|
|
1116
|
+
} | {
|
|
1117
|
+
type: 'filter';
|
|
1118
|
+
conditions: Record<string, unknown>;
|
|
1119
|
+
};
|
|
1120
|
+
/**
|
|
1121
|
+
* Body source XOR — exactly one of `htmlBody` / `templateId` must be set.
|
|
1122
|
+
* V1 only ships `htmlBody`; `templateId` is reserved for SendGrid dynamic
|
|
1123
|
+
* templates and is rejected server-side until that work lands.
|
|
1124
|
+
*/
|
|
1125
|
+
type FFIDNewsletterBodySource = {
|
|
1126
|
+
htmlBody: string;
|
|
1127
|
+
templateId?: never;
|
|
1128
|
+
} | {
|
|
1129
|
+
templateId: string;
|
|
1130
|
+
htmlBody?: never;
|
|
1131
|
+
};
|
|
1132
|
+
interface FFIDNewsletterDispatchParams {
|
|
1133
|
+
subject: string;
|
|
1134
|
+
/** Optional landing-page URL persisted on `newsletter_campaigns.article_url`. */
|
|
1135
|
+
articleUrl?: string;
|
|
1136
|
+
body: FFIDNewsletterBodySource;
|
|
1137
|
+
/** Defaults to `{ type: 'all' }` server-side when omitted. */
|
|
1138
|
+
segment?: FFIDNewsletterSegment;
|
|
1139
|
+
}
|
|
1140
|
+
interface FFIDNewsletterDispatchResponse {
|
|
1141
|
+
campaignId: string;
|
|
1142
|
+
totalRecipients: number;
|
|
1143
|
+
status: FFIDNewsletterCampaignStatus;
|
|
1144
|
+
sentCount: number;
|
|
1145
|
+
failedCount: number;
|
|
1146
|
+
}
|
|
1084
1147
|
|
|
1085
1148
|
/** Newsletter methods - subscribe / confirm / unsubscribe */
|
|
1086
1149
|
|
|
@@ -1093,6 +1156,7 @@ declare function createNewsletterMethods(deps: NewsletterMethodsDeps): {
|
|
|
1093
1156
|
subscribe: (params: FFIDNewsletterSubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterSubscribeResponse>>;
|
|
1094
1157
|
confirm: (params: FFIDNewsletterConfirmParams) => Promise<FFIDApiResponse<FFIDNewsletterConfirmResponse>>;
|
|
1095
1158
|
unsubscribe: (params: FFIDNewsletterUnsubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterUnsubscribeResponse>>;
|
|
1159
|
+
dispatch: (params: FFIDNewsletterDispatchParams) => Promise<FFIDApiResponse<FFIDNewsletterDispatchResponse>>;
|
|
1096
1160
|
};
|
|
1097
1161
|
type FFIDNewsletterClient = ReturnType<typeof createNewsletterMethods>;
|
|
1098
1162
|
|
|
@@ -1107,4 +1171,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
1107
1171
|
};
|
|
1108
1172
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
1109
1173
|
|
|
1110
|
-
export { AnnouncementListResponse, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, 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 FFIDNewsletterClient, type FFIDNewsletterConfirmParams, type FFIDNewsletterConfirmResponse, 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_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 };
|
|
1174
|
+
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 };
|
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 FFIDListMembersResponse, h as FFIDMemberRole, i as FFIDUpdateMemberRoleResponse, j as FFIDRemoveMemberResponse, k as FFIDProfileCallOptions, l as FFIDUserProfile, m as FFIDUpdateUserProfileRequest, n as
|
|
2
|
-
export {
|
|
1
|
+
import { F as FFIDSubscriptionStatus, a as FFIDConfig, b as FFIDApiResponse, c as FFIDSessionResponse, d as FFIDRedirectResult, e as FFIDError, f as FFIDSubscriptionCheckResponse, g as FFIDListMembersResponse, h as FFIDMemberRole, i as FFIDUpdateMemberRoleResponse, j as FFIDRemoveMemberResponse, k as FFIDProfileCallOptions, l as FFIDUserProfile, m as FFIDUpdateUserProfileRequest, n as FFIDAnalyticsConfig, o as FFIDCreateCheckoutParams, p as FFIDCheckoutSessionResponse, q as FFIDCreatePortalParams, r as FFIDPortalSessionResponse, s as FFIDVerifyAccessTokenOptions, t as FFIDOAuthUserInfo, u as FFIDInquiryCreateParams, v as FFIDInquiryCreateResponse, w as FFIDAuthMode, x as FFIDLogger, y as FFIDCacheAdapter, z as FFIDUser, A as FFIDOrganization, B as FFIDSubscription, C as FFIDSubscriptionContextValue, E as EffectiveSubscriptionStatus, D as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, G as FFIDAnnouncementsApiResponse, H as AnnouncementListResponse, I as FFIDAnnouncementsLogger } from './index-C3zyNa4j.js';
|
|
2
|
+
export { J as Announcement, K as AnnouncementStatus, M as AnnouncementType, N as FFIDAnnouncementBadge, O as FFIDAnnouncementList, P as FFIDAnnouncementsError, Q as FFIDAnnouncementsErrorCode, R as FFIDAnnouncementsServerResponse, S as FFIDCacheConfig, T as FFIDContextValue, U as FFIDInquiryCategory, V as FFIDInquiryCategorySite2026, W as FFIDInquiryForm, X as FFIDInquiryFormCategoryItem, Y as FFIDInquiryFormClassNames, Z as FFIDInquiryFormOrganization, _ as FFIDInquiryFormPlaceholderContext, $ as FFIDInquiryFormPrefill, a0 as FFIDInquiryFormProps, a1 as FFIDInquiryFormSubmitData, a2 as FFIDInquiryFormSubmitResult, a3 as FFIDJwtClaims, a4 as FFIDLoginButton, a5 as FFIDMemberStatus, a6 as FFIDOAuthTokenResponse, a7 as FFIDOAuthUserInfoMemberRole, a8 as FFIDOAuthUserInfoSubscription, a9 as FFIDOrganizationMember, aa as FFIDOrganizationSwitcher, ab as FFIDRedirectErrorCode, ac as FFIDSeatModel, ad as FFIDSubscriptionBadge, ae as FFIDTokenIntrospectionResponse, af as FFIDUserMenu, ag as FFID_INQUIRY_CATEGORIES, ah as FFID_INQUIRY_CATEGORIES_SITE_2026, ai as UseFFIDAnnouncementsOptions, aj as UseFFIDAnnouncementsReturn, ak as isFFIDInquiryCategorySite2026, al as useFFIDAnnouncements } from './index-C3zyNa4j.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -11,6 +11,31 @@ import { ReactNode, ComponentType, FC } from 'react';
|
|
|
11
11
|
*/
|
|
12
12
|
/** Default FFID API base URL (production) */
|
|
13
13
|
declare const DEFAULT_API_BASE_URL = "https://id.feelflow.net";
|
|
14
|
+
/**
|
|
15
|
+
* Recommended default OAuth scope set for FFID-connected services (v3.0.0+).
|
|
16
|
+
*
|
|
17
|
+
* Coverage:
|
|
18
|
+
* - `openid email profile` — OIDC standard claims (always required)
|
|
19
|
+
* - `subscription:read` — `/api/v1/subscriptions/ext/*` 系(プラン / 課金 gate)
|
|
20
|
+
* - `legal:read` — `/api/v1/legal/ext` 系(利用規約・同意状態)
|
|
21
|
+
*
|
|
22
|
+
* Add feature-specific scopes on top of this when needed (browser SDK):
|
|
23
|
+
* - `analytics:read` for `/api/v1/ext/analytics/config`
|
|
24
|
+
* - `organization:read` / `organization:write` for `/api/v1/organizations/ext/members`
|
|
25
|
+
* - `subscription:write` for self-serve plan changes
|
|
26
|
+
* - `legal:write` for recording user consent
|
|
27
|
+
* - `profile:read` / `profile:write` for profile UI
|
|
28
|
+
* - `organization:api-key` for org-level API key issuance
|
|
29
|
+
*
|
|
30
|
+
* **Note**: kept as a widened `string` (not `as const`) so consumers can
|
|
31
|
+
* concatenate additional scopes (e.g. `\`${DEFAULT_OAUTH_SCOPES} analytics:read\``)
|
|
32
|
+
* and so it remains assignable to `FFIDConfig.scope: string`. `widget:verify`
|
|
33
|
+
* is intentionally excluded — it is a service-key-only scope (`/api/v1/widget/*`),
|
|
34
|
+
* not used by the browser OAuth flow.
|
|
35
|
+
*
|
|
36
|
+
* Survey: feel-flow/feelflow-id-platform#2656 issuecomment-4324082742
|
|
37
|
+
*/
|
|
38
|
+
declare const DEFAULT_OAUTH_SCOPES = "openid email profile subscription:read legal:read";
|
|
14
39
|
|
|
15
40
|
/**
|
|
16
41
|
* Token Store
|
|
@@ -505,6 +530,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
505
530
|
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
506
531
|
getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
507
532
|
updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
533
|
+
getAnalyticsConfig: (serviceCode: string, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDAnalyticsConfig>>;
|
|
508
534
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
509
535
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
510
536
|
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
@@ -542,6 +568,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
542
568
|
subscribe: (params: FFIDNewsletterSubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterSubscribeResponse>>;
|
|
543
569
|
confirm: (params: FFIDNewsletterConfirmParams) => Promise<FFIDApiResponse<FFIDNewsletterConfirmResponse>>;
|
|
544
570
|
unsubscribe: (params: FFIDNewsletterUnsubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterUnsubscribeResponse>>;
|
|
571
|
+
dispatch: (params: FFIDNewsletterDispatchParams) => Promise<FFIDApiResponse<FFIDNewsletterDispatchResponse>>;
|
|
545
572
|
};
|
|
546
573
|
/** Inquiry methods (create) */
|
|
547
574
|
inquiry: {
|
|
@@ -632,7 +659,7 @@ interface FFIDProviderProps extends FFIDConfig {
|
|
|
632
659
|
* - Automatic session refresh
|
|
633
660
|
* - Token mode: automatic code exchange and token refresh
|
|
634
661
|
*/
|
|
635
|
-
declare function FFIDProvider({ children, serviceCode, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, authMode, clientId, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
|
|
662
|
+
declare function FFIDProvider({ children, serviceCode, scope, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, authMode, clientId, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
|
|
636
663
|
|
|
637
664
|
/**
|
|
638
665
|
* Return type for useFFID hook
|
|
@@ -1081,6 +1108,42 @@ interface FFIDNewsletterUnsubscribeParams {
|
|
|
1081
1108
|
interface FFIDNewsletterUnsubscribeResponse {
|
|
1082
1109
|
ok: true;
|
|
1083
1110
|
}
|
|
1111
|
+
/** Recipient cap on a single dispatch — mirrors NEWSLETTER_DISPATCH_MAX_RECIPIENTS. */
|
|
1112
|
+
declare const FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1000;
|
|
1113
|
+
type FFIDNewsletterCampaignStatus = 'draft' | 'queued' | 'sending' | 'sent' | 'failed' | 'cancelled';
|
|
1114
|
+
type FFIDNewsletterSegment = {
|
|
1115
|
+
type: 'all';
|
|
1116
|
+
} | {
|
|
1117
|
+
type: 'filter';
|
|
1118
|
+
conditions: Record<string, unknown>;
|
|
1119
|
+
};
|
|
1120
|
+
/**
|
|
1121
|
+
* Body source XOR — exactly one of `htmlBody` / `templateId` must be set.
|
|
1122
|
+
* V1 only ships `htmlBody`; `templateId` is reserved for SendGrid dynamic
|
|
1123
|
+
* templates and is rejected server-side until that work lands.
|
|
1124
|
+
*/
|
|
1125
|
+
type FFIDNewsletterBodySource = {
|
|
1126
|
+
htmlBody: string;
|
|
1127
|
+
templateId?: never;
|
|
1128
|
+
} | {
|
|
1129
|
+
templateId: string;
|
|
1130
|
+
htmlBody?: never;
|
|
1131
|
+
};
|
|
1132
|
+
interface FFIDNewsletterDispatchParams {
|
|
1133
|
+
subject: string;
|
|
1134
|
+
/** Optional landing-page URL persisted on `newsletter_campaigns.article_url`. */
|
|
1135
|
+
articleUrl?: string;
|
|
1136
|
+
body: FFIDNewsletterBodySource;
|
|
1137
|
+
/** Defaults to `{ type: 'all' }` server-side when omitted. */
|
|
1138
|
+
segment?: FFIDNewsletterSegment;
|
|
1139
|
+
}
|
|
1140
|
+
interface FFIDNewsletterDispatchResponse {
|
|
1141
|
+
campaignId: string;
|
|
1142
|
+
totalRecipients: number;
|
|
1143
|
+
status: FFIDNewsletterCampaignStatus;
|
|
1144
|
+
sentCount: number;
|
|
1145
|
+
failedCount: number;
|
|
1146
|
+
}
|
|
1084
1147
|
|
|
1085
1148
|
/** Newsletter methods - subscribe / confirm / unsubscribe */
|
|
1086
1149
|
|
|
@@ -1093,6 +1156,7 @@ declare function createNewsletterMethods(deps: NewsletterMethodsDeps): {
|
|
|
1093
1156
|
subscribe: (params: FFIDNewsletterSubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterSubscribeResponse>>;
|
|
1094
1157
|
confirm: (params: FFIDNewsletterConfirmParams) => Promise<FFIDApiResponse<FFIDNewsletterConfirmResponse>>;
|
|
1095
1158
|
unsubscribe: (params: FFIDNewsletterUnsubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterUnsubscribeResponse>>;
|
|
1159
|
+
dispatch: (params: FFIDNewsletterDispatchParams) => Promise<FFIDApiResponse<FFIDNewsletterDispatchResponse>>;
|
|
1096
1160
|
};
|
|
1097
1161
|
type FFIDNewsletterClient = ReturnType<typeof createNewsletterMethods>;
|
|
1098
1162
|
|
|
@@ -1107,4 +1171,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
1107
1171
|
};
|
|
1108
1172
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
1109
1173
|
|
|
1110
|
-
export { AnnouncementListResponse, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, 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 FFIDNewsletterClient, type FFIDNewsletterConfirmParams, type FFIDNewsletterConfirmResponse, 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_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 };
|
|
1174
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFFIDContext, useSubscription } from './chunk-
|
|
2
|
-
export { DEFAULT_API_BASE_URL, 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-XWI4BFKW.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-XWI4BFKW.js';
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
4
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -99,5 +99,6 @@ function withFFIDAuth(Component, options = {}) {
|
|
|
99
99
|
|
|
100
100
|
// src/newsletter/types.ts
|
|
101
101
|
var FFID_NEWSLETTER_TYPES = ["inquiry_followup", "general"];
|
|
102
|
+
var FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1e3;
|
|
102
103
|
|
|
103
|
-
export { FFID_NEWSLETTER_TYPES, createKVCacheAdapter, createMemoryCacheAdapter, useRequireActiveSubscription, withFFIDAuth };
|
|
104
|
+
export { FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, createKVCacheAdapter, createMemoryCacheAdapter, useRequireActiveSubscription, withFFIDAuth };
|
package/dist/legal/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMDHKSVLP_cjs = require('../chunk-MDHKSVLP.cjs');
|
|
4
4
|
|
|
5
5
|
// src/legal/ffid-legal-client.ts
|
|
6
6
|
var API_PREFIX = "/api/v1/legal/ext";
|
|
@@ -37,7 +37,7 @@ function createFFIDLegalClient(config) {
|
|
|
37
37
|
if (!config.apiKey) {
|
|
38
38
|
throw new Error("FFID Legal Client: apiKey \u304C\u672A\u8A2D\u5B9A\u3067\u3059");
|
|
39
39
|
}
|
|
40
|
-
const baseUrl = config.apiBaseUrl ??
|
|
40
|
+
const baseUrl = config.apiBaseUrl ?? chunkMDHKSVLP_cjs.DEFAULT_API_BASE_URL;
|
|
41
41
|
const logger = config.logger ?? (config.debug ? consoleLogger : noopLogger);
|
|
42
42
|
async function fetchWithApiKey(endpoint, options = {}) {
|
|
43
43
|
const url = `${baseUrl}${API_PREFIX}${endpoint}`;
|
|
@@ -176,7 +176,7 @@ function createFFIDLegalClient(config) {
|
|
|
176
176
|
|
|
177
177
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
178
178
|
enumerable: true,
|
|
179
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunkMDHKSVLP_cjs.DEFAULT_API_BASE_URL; }
|
|
180
180
|
});
|
|
181
181
|
exports.FFID_LEGAL_ERROR_CODES = FFID_LEGAL_ERROR_CODES;
|
|
182
182
|
exports.createFFIDLegalClient = createFFIDLegalClient;
|
package/dist/legal/index.d.cts
CHANGED
package/dist/legal/index.d.ts
CHANGED
package/dist/legal/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_API_BASE_URL } from '../chunk-
|
|
2
|
-
export { DEFAULT_API_BASE_URL } from '../chunk-
|
|
1
|
+
import { DEFAULT_API_BASE_URL } from '../chunk-JEVK2XUM.js';
|
|
2
|
+
export { DEFAULT_API_BASE_URL } from '../chunk-JEVK2XUM.js';
|
|
3
3
|
|
|
4
4
|
// src/legal/ffid-legal-client.ts
|
|
5
5
|
var API_PREFIX = "/api/v1/legal/ext";
|
package/dist/server/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMDHKSVLP_cjs = require('../chunk-MDHKSVLP.cjs');
|
|
4
4
|
var jose = require('jose');
|
|
5
5
|
|
|
6
6
|
// src/auth/token-store.ts
|
|
@@ -803,7 +803,7 @@ function createProfileMethods(deps) {
|
|
|
803
803
|
}
|
|
804
804
|
|
|
805
805
|
// src/client/version-check.ts
|
|
806
|
-
var SDK_VERSION = "
|
|
806
|
+
var SDK_VERSION = "3.0.0";
|
|
807
807
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
808
808
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
809
809
|
function sdkHeaders() {
|
|
@@ -1419,6 +1419,7 @@ function createRedirectMethods(deps) {
|
|
|
1419
1419
|
baseUrl,
|
|
1420
1420
|
clientId,
|
|
1421
1421
|
serviceCode,
|
|
1422
|
+
scope,
|
|
1422
1423
|
resolvedRedirectUri,
|
|
1423
1424
|
logger
|
|
1424
1425
|
} = deps;
|
|
@@ -1427,6 +1428,24 @@ function createRedirectMethods(deps) {
|
|
|
1427
1428
|
logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
|
|
1428
1429
|
return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
|
|
1429
1430
|
}
|
|
1431
|
+
if (authMode === "service-key") {
|
|
1432
|
+
logger.error(
|
|
1433
|
+
"[FFID SDK] service-key \u30E2\u30FC\u30C9\u3067\u306F redirectToAuthorize \u306F\u547C\u3073\u51FA\u305B\u307E\u305B\u3093 \u2014 server-to-server \u7528\u9014\u306E\u305F\u3081 OAuth \u30D6\u30E9\u30A6\u30B6 flow \u3092\u6301\u3061\u307E\u305B\u3093"
|
|
1434
|
+
);
|
|
1435
|
+
return {
|
|
1436
|
+
success: false,
|
|
1437
|
+
error: "service-key \u30E2\u30FC\u30C9\u3067\u306F OAuth \u8A8D\u53EF\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u306F\u5229\u7528\u3067\u304D\u307E\u305B\u3093"
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
if (!scope || !scope.trim()) {
|
|
1441
|
+
logger.error(
|
|
1442
|
+
"[FFID SDK] scope \u304C\u672A\u8A2D\u5B9A\u306E\u305F\u3081 /oauth/authorize \u3092\u547C\u3073\u51FA\u305B\u307E\u305B\u3093 (#2674) \u2014 FFIDConfig.scope \u306B DEFAULT_OAUTH_SCOPES \u307E\u305F\u306F\u660E\u793A\u7684\u306A scope \u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044"
|
|
1443
|
+
);
|
|
1444
|
+
return {
|
|
1445
|
+
success: false,
|
|
1446
|
+
error: "OAuth scope \u304C\u672A\u8A2D\u5B9A\u306E\u305F\u3081\u8A8D\u53EF\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093"
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1430
1449
|
const authorizeKey = buildAuthorizeKey(baseUrl, clientId, options?.organizationId);
|
|
1431
1450
|
const now = Date.now();
|
|
1432
1451
|
const recentCount = getRecentRedirectCount(authorizeKey, now, logger);
|
|
@@ -1459,6 +1478,7 @@ function createRedirectMethods(deps) {
|
|
|
1459
1478
|
const params = new URLSearchParams({
|
|
1460
1479
|
response_type: "code",
|
|
1461
1480
|
client_id: clientId,
|
|
1481
|
+
scope,
|
|
1462
1482
|
redirect_uri: redirectUri,
|
|
1463
1483
|
state,
|
|
1464
1484
|
code_challenge: challenge,
|
|
@@ -1797,6 +1817,63 @@ function createOtpMethods(deps) {
|
|
|
1797
1817
|
};
|
|
1798
1818
|
}
|
|
1799
1819
|
|
|
1820
|
+
// src/client/analytics-methods.ts
|
|
1821
|
+
var EXT_ANALYTICS_CONFIG_ENDPOINT = "/api/v1/ext/analytics/config";
|
|
1822
|
+
function resolveAuthOverride2(options, createError) {
|
|
1823
|
+
if (!options || options.accessToken === void 0) {
|
|
1824
|
+
return {};
|
|
1825
|
+
}
|
|
1826
|
+
const token = options.accessToken;
|
|
1827
|
+
if (typeof token !== "string" || token.trim() === "") {
|
|
1828
|
+
return {
|
|
1829
|
+
error: createError(
|
|
1830
|
+
"VALIDATION_ERROR",
|
|
1831
|
+
"accessToken \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u5217\u3084\u7A7A\u767D\u306E\u307F\u306E\u5024\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093"
|
|
1832
|
+
)
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
return { override: { accessToken: token } };
|
|
1836
|
+
}
|
|
1837
|
+
var ANALYTICS_SERVICE_CODE_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
1838
|
+
function validateServiceCode(serviceCode, createError) {
|
|
1839
|
+
if (typeof serviceCode !== "string" || serviceCode.trim() === "") {
|
|
1840
|
+
return createError(
|
|
1841
|
+
"VALIDATION_ERROR",
|
|
1842
|
+
"serviceCode \u306F\u5FC5\u9808\u306E kebab-case \u6587\u5B57\u5217\u3067\u3059"
|
|
1843
|
+
);
|
|
1844
|
+
}
|
|
1845
|
+
if (!ANALYTICS_SERVICE_CODE_PATTERN.test(serviceCode)) {
|
|
1846
|
+
return createError(
|
|
1847
|
+
"VALIDATION_ERROR",
|
|
1848
|
+
"serviceCode \u306F kebab-case \u5F62\u5F0F (\u82F1\u5C0F\u6587\u5B57\u30FB\u6570\u5B57\u30FB\u30CF\u30A4\u30D5\u30F3) \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"
|
|
1849
|
+
);
|
|
1850
|
+
}
|
|
1851
|
+
return null;
|
|
1852
|
+
}
|
|
1853
|
+
function createAnalyticsMethods(deps) {
|
|
1854
|
+
const { fetchWithAuth, createError } = deps;
|
|
1855
|
+
async function getAnalyticsConfig(serviceCode, options) {
|
|
1856
|
+
const validationError = validateServiceCode(serviceCode, createError);
|
|
1857
|
+
if (validationError) {
|
|
1858
|
+
return { error: validationError };
|
|
1859
|
+
}
|
|
1860
|
+
const { override, error: overrideError } = resolveAuthOverride2(
|
|
1861
|
+
options,
|
|
1862
|
+
createError
|
|
1863
|
+
);
|
|
1864
|
+
if (overrideError) {
|
|
1865
|
+
return { error: overrideError };
|
|
1866
|
+
}
|
|
1867
|
+
const endpoint = `${EXT_ANALYTICS_CONFIG_ENDPOINT}?service=${encodeURIComponent(serviceCode)}`;
|
|
1868
|
+
return fetchWithAuth(
|
|
1869
|
+
endpoint,
|
|
1870
|
+
{ method: "GET" },
|
|
1871
|
+
override
|
|
1872
|
+
);
|
|
1873
|
+
}
|
|
1874
|
+
return { getAnalyticsConfig };
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1800
1877
|
// src/client/contract-wizard-methods.ts
|
|
1801
1878
|
var CONTRACT_WIZARD_PATH = "/contract-wizard";
|
|
1802
1879
|
function buildWizardUrl(baseUrl, flow, params) {
|
|
@@ -1884,6 +1961,7 @@ function createContractWizardMethods(deps) {
|
|
|
1884
1961
|
var EXT_SUBSCRIBE_ENDPOINT2 = "/api/v1/ext/newsletter/subscribe";
|
|
1885
1962
|
var CONFIRM_ENDPOINT = "/api/newsletter/confirm";
|
|
1886
1963
|
var UNSUBSCRIBE_ENDPOINT = "/api/newsletter/unsubscribe";
|
|
1964
|
+
var DISPATCH_ENDPOINT = "/api/v1/newsletter/dispatch";
|
|
1887
1965
|
function trimOrEmpty(s) {
|
|
1888
1966
|
return typeof s === "string" ? s.trim() : "";
|
|
1889
1967
|
}
|
|
@@ -1989,7 +2067,36 @@ function createNewsletterMethods(deps) {
|
|
|
1989
2067
|
}
|
|
1990
2068
|
);
|
|
1991
2069
|
}
|
|
1992
|
-
|
|
2070
|
+
async function dispatch(params) {
|
|
2071
|
+
const subject = trimOrEmpty(params.subject);
|
|
2072
|
+
if (!subject) {
|
|
2073
|
+
return { error: createError("VALIDATION_ERROR", "subject \u306F\u5FC5\u9808\u3067\u3059") };
|
|
2074
|
+
}
|
|
2075
|
+
if (!params.body || typeof params.body !== "object") {
|
|
2076
|
+
return { error: createError("VALIDATION_ERROR", "body \u306F\u5FC5\u9808\u3067\u3059") };
|
|
2077
|
+
}
|
|
2078
|
+
const bodySource = params.body;
|
|
2079
|
+
const hasHtmlBody = typeof bodySource.htmlBody === "string" && bodySource.htmlBody.length > 0;
|
|
2080
|
+
const hasTemplateId = typeof bodySource.templateId === "string" && bodySource.templateId.length > 0;
|
|
2081
|
+
if (hasHtmlBody === hasTemplateId) {
|
|
2082
|
+
return {
|
|
2083
|
+
error: createError(
|
|
2084
|
+
"BODY_SOURCE_REQUIRED",
|
|
2085
|
+
"body \u306F htmlBody \u307E\u305F\u306F templateId \u306E\u3044\u305A\u308C\u304B\u4E00\u65B9\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"
|
|
2086
|
+
)
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
return fetchWithAuth(DISPATCH_ENDPOINT, {
|
|
2090
|
+
method: "POST",
|
|
2091
|
+
body: JSON.stringify({
|
|
2092
|
+
subject,
|
|
2093
|
+
articleUrl: params.articleUrl,
|
|
2094
|
+
body: params.body,
|
|
2095
|
+
segment: params.segment
|
|
2096
|
+
})
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
return { subscribe, confirm, unsubscribe, dispatch };
|
|
1993
2100
|
}
|
|
1994
2101
|
|
|
1995
2102
|
// src/inquiry/ffid-inquiry-client.ts
|
|
@@ -2091,8 +2198,21 @@ function createFFIDClient(config) {
|
|
|
2091
2198
|
if (!config.serviceCode || !config.serviceCode.trim()) {
|
|
2092
2199
|
throw new Error("FFID Client: serviceCode \u304C\u672A\u8A2D\u5B9A\u3067\u3059");
|
|
2093
2200
|
}
|
|
2094
|
-
const
|
|
2201
|
+
const scope = config.scope?.trim() ?? "";
|
|
2202
|
+
const baseUrl = config.apiBaseUrl ?? chunkMDHKSVLP_cjs.DEFAULT_API_BASE_URL;
|
|
2095
2203
|
const authMode = config.authMode ?? "cookie";
|
|
2204
|
+
const VALID_AUTH_MODES = ["cookie", "token", "service-key"];
|
|
2205
|
+
if (!VALID_AUTH_MODES.includes(authMode)) {
|
|
2206
|
+
throw new Error(
|
|
2207
|
+
`FFID Client: authMode \u304C\u4E0D\u6B63\u3067\u3059 (\u53D7\u4FE1: ${JSON.stringify(authMode)}, \u6709\u52B9\u5024: ${VALID_AUTH_MODES.join(" | ")})`
|
|
2208
|
+
);
|
|
2209
|
+
}
|
|
2210
|
+
if (authMode !== "service-key" && !scope) {
|
|
2211
|
+
const received = config.scope === void 0 ? "undefined" : JSON.stringify(config.scope);
|
|
2212
|
+
throw new Error(
|
|
2213
|
+
`FFID Client: scope \u304C\u672A\u8A2D\u5B9A\u3067\u3059 (\u53D7\u4FE1: ${received})\u3002\`DEFAULT_OAUTH_SCOPES\` \u3092 import \u3059\u308B\u304B\u3001\u660E\u793A\u7684\u306B scope \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044 (#2674)`
|
|
2214
|
+
);
|
|
2215
|
+
}
|
|
2096
2216
|
const clientId = config.clientId ?? config.serviceCode;
|
|
2097
2217
|
const rawRedirectUri = config.redirectUri ?? null;
|
|
2098
2218
|
const serviceApiKey = config.serviceApiKey?.trim();
|
|
@@ -2263,6 +2383,7 @@ function createFFIDClient(config) {
|
|
|
2263
2383
|
baseUrl,
|
|
2264
2384
|
clientId,
|
|
2265
2385
|
serviceCode: config.serviceCode,
|
|
2386
|
+
scope,
|
|
2266
2387
|
resolvedRedirectUri,
|
|
2267
2388
|
logger
|
|
2268
2389
|
});
|
|
@@ -2319,6 +2440,10 @@ function createFFIDClient(config) {
|
|
|
2319
2440
|
fetchWithAuth,
|
|
2320
2441
|
createError
|
|
2321
2442
|
});
|
|
2443
|
+
const { getAnalyticsConfig } = createAnalyticsMethods({
|
|
2444
|
+
fetchWithAuth,
|
|
2445
|
+
createError
|
|
2446
|
+
});
|
|
2322
2447
|
const {
|
|
2323
2448
|
requestPasswordReset,
|
|
2324
2449
|
verifyPasswordResetToken,
|
|
@@ -2392,6 +2517,7 @@ function createFFIDClient(config) {
|
|
|
2392
2517
|
removeMember,
|
|
2393
2518
|
getProfile,
|
|
2394
2519
|
updateProfile,
|
|
2520
|
+
getAnalyticsConfig,
|
|
2395
2521
|
createCheckoutSession,
|
|
2396
2522
|
createPortalSession,
|
|
2397
2523
|
listPlans,
|
|
@@ -2479,7 +2605,11 @@ function createKVCacheAdapter(kv) {
|
|
|
2479
2605
|
|
|
2480
2606
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
2481
2607
|
enumerable: true,
|
|
2482
|
-
get: function () { return
|
|
2608
|
+
get: function () { return chunkMDHKSVLP_cjs.DEFAULT_API_BASE_URL; }
|
|
2609
|
+
});
|
|
2610
|
+
Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
|
|
2611
|
+
enumerable: true,
|
|
2612
|
+
get: function () { return chunkMDHKSVLP_cjs.DEFAULT_OAUTH_SCOPES; }
|
|
2483
2613
|
});
|
|
2484
2614
|
exports.createFFIDClient = createFFIDClient;
|
|
2485
2615
|
exports.createKVCacheAdapter = createKVCacheAdapter;
|
package/dist/server/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 FFIDCacheConfig, g as FFIDClient, h as FFIDConfig, i as FFIDOrganization, j as FFIDOtpSendResponse, k as FFIDOtpVerifyResponse, l as FFIDPasswordResetConfirmResponse, m as FFIDPasswordResetResponse, n as FFIDPasswordResetVerifyResponse, o as FFIDProfileCallOptions, p as FFIDResetSessionResponse, q as FFIDSubscription, r as FFIDUpdateUserProfileRequest, s as FFIDUser, t as FFIDUserProfile, T as TokenData, u as TokenStore, v as createFFIDClient, w as createTokenStore } from '../ffid-client-
|
|
3
|
-
export { D as DEFAULT_API_BASE_URL } from '../constants-
|
|
1
|
+
import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo } from '../ffid-client-B26jbUp5.cjs';
|
|
2
|
+
export { f as FFIDCacheConfig, g as FFIDClient, h as FFIDConfig, i as FFIDOrganization, j as FFIDOtpSendResponse, k as FFIDOtpVerifyResponse, l as FFIDPasswordResetConfirmResponse, m as FFIDPasswordResetResponse, n as FFIDPasswordResetVerifyResponse, o as FFIDProfileCallOptions, p as FFIDResetSessionResponse, q as FFIDSubscription, r as FFIDUpdateUserProfileRequest, s as FFIDUser, t as FFIDUserProfile, T as TokenData, u as TokenStore, v as createFFIDClient, w as createTokenStore } from '../ffid-client-B26jbUp5.cjs';
|
|
3
|
+
export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-D61jqRIO.cjs';
|
|
4
4
|
|
|
5
5
|
/** Token verification - verifyAccessToken() implementation */
|
|
6
6
|
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 FFIDCacheConfig, g as FFIDClient, h as FFIDConfig, i as FFIDOrganization, j as FFIDOtpSendResponse, k as FFIDOtpVerifyResponse, l as FFIDPasswordResetConfirmResponse, m as FFIDPasswordResetResponse, n as FFIDPasswordResetVerifyResponse, o as FFIDProfileCallOptions, p as FFIDResetSessionResponse, q as FFIDSubscription, r as FFIDUpdateUserProfileRequest, s as FFIDUser, t as FFIDUserProfile, T as TokenData, u as TokenStore, v as createFFIDClient, w as createTokenStore } from '../ffid-client-
|
|
3
|
-
export { D as DEFAULT_API_BASE_URL } from '../constants-
|
|
1
|
+
import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo } from '../ffid-client-B26jbUp5.js';
|
|
2
|
+
export { f as FFIDCacheConfig, g as FFIDClient, h as FFIDConfig, i as FFIDOrganization, j as FFIDOtpSendResponse, k as FFIDOtpVerifyResponse, l as FFIDPasswordResetConfirmResponse, m as FFIDPasswordResetResponse, n as FFIDPasswordResetVerifyResponse, o as FFIDProfileCallOptions, p as FFIDResetSessionResponse, q as FFIDSubscription, r as FFIDUpdateUserProfileRequest, s as FFIDUser, t as FFIDUserProfile, T as TokenData, u as TokenStore, v as createFFIDClient, w as createTokenStore } from '../ffid-client-B26jbUp5.js';
|
|
3
|
+
export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-D61jqRIO.js';
|
|
4
4
|
|
|
5
5
|
/** Token verification - verifyAccessToken() implementation */
|
|
6
6
|
|