@feelflow/ffid-sdk 2.19.0 → 2.20.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.
@@ -1,1127 +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-Cjm_TKUc.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-Cjm_TKUc.js';
1
3
  export { D as DEFAULT_API_BASE_URL } from '../constants-DvTGHPZn.js';
2
4
 
3
- /**
4
- * Inquiry types exposed by the FFID SDK.
5
- *
6
- * Mirrors the `/api/v1/ext/inquiry` and `/api/contact` endpoints
7
- * with a single shared shape so that consumers can render one
8
- * `<FFIDInquiryForm />` and submit through either endpoint.
9
- */
10
- /**
11
- * Legacy 6-value canonical categories. Retained for historical DB rows
12
- * (the pre-2026 values `general`, `sales`, `support`, `press` still appear
13
- * in older inquiries) and for 2.x backwards compatibility with SDK
14
- * consumers that pinned to this exact set.
15
- *
16
- * Note: `partnership` and `other` intentionally also appear in
17
- * {@link FFID_INQUIRY_CATEGORIES_SITE_2026}; the legacy-only subset is
18
- * `general`, `sales`, `support`, `press`.
19
- *
20
- * @deprecated New integrations should use
21
- * {@link FFID_INQUIRY_CATEGORIES_SITE_2026} (13 values, aligned with
22
- * feelflow-website-2026 `/contact`). This legacy constant remains
23
- * exported for 2.x compatibility and may be removed in 3.x.
24
- */
25
- declare const FFID_INQUIRY_CATEGORIES: readonly ["general", "sales", "support", "partnership", "press", "other"];
26
- /**
27
- * Type alias derived from the legacy 6-value list. Still referenced by
28
- * {@link FFIDInquiryCreateParams.category} so existing callers compile
29
- * without changes; no `@deprecated` on the type itself because the
30
- * actionable migration target is the runtime constant above, and
31
- * propagating `@deprecated` to the type would surface false-positive
32
- * warnings on public API that deliberately accepts both shapes.
33
- */
34
- type FFIDInquiryCategory = (typeof FFID_INQUIRY_CATEGORIES)[number];
35
- /**
36
- * 13-value category list that mirrors feelflow-website-2026
37
- * `/contact` (`feelflow-site/src/lib/contact-schema.ts` `CATEGORY_OPTIONS`).
38
- *
39
- * Source-of-truth ownership: **the site repo is authoritative**; this
40
- * constant is a delayed-sync snapshot shipped through the SDK so
41
- * consumers can get autocomplete without depending on the site repo.
42
- * Drift between site and the FFID admin UI is detected automatically by
43
- * `scripts/sync-inquiry-categories.ts` (SDK-side drift is a separate
44
- * follow-up and today is caught only if the SDK snapshot is updated
45
- * alongside the admin UI constants).
46
- */
47
- declare const FFID_INQUIRY_CATEGORIES_SITE_2026: readonly ["consulting", "saas", "development", "agent-hub", "ai-feel-chatbot", "knowledge-db", "biz-simulator", "discussion-board", "realtime-ai", "partnership", "media", "recruiting", "other"];
48
- type FFIDInquiryCategorySite2026 = (typeof FFID_INQUIRY_CATEGORIES_SITE_2026)[number];
49
- /**
50
- * Parameters for `client.inquiry.create()`. When submitting from a
51
- * server-side SDK (Service API Key), set `source` to a stable
52
- * origin string so admins can trace the submission back.
53
- *
54
- * `category` accepts any string at the SDK boundary to keep the SDK
55
- * forward-compatible with new site-side categories added before the SDK
56
- * re-publishes. FFID ext-endpoint validation (`/api/v1/ext/inquiry`) is
57
- * lenient — `z.string().max(100).optional()` — so unknown strings flow
58
- * through to the DB unchanged. Note: the `(string & {})` arm of the
59
- * union intentionally keeps autocomplete active while allowing arbitrary
60
- * strings; callers using exhaustive `switch` statements should include
61
- * a `default` branch.
62
- */
63
- interface FFIDInquiryCreateParams {
64
- email: string;
65
- name: string;
66
- message: string;
67
- category?: FFIDInquiryCategorySite2026 | FFIDInquiryCategory | (string & {});
68
- company?: string;
69
- phone?: string;
70
- locale?: 'ja' | 'en';
71
- /** Current terms-of-service version the submitter agreed to. */
72
- termsVersion: string;
73
- /** Current privacy-policy version the submitter agreed to. */
74
- privacyVersion: string;
75
- /** Opt-in to the post-inquiry follow-up newsletter (Type A). */
76
- inquiryFollowupOptIn?: boolean;
77
- /** Opt-in to the general marketing newsletter (Type B). */
78
- generalNewsletterOptIn?: boolean;
79
- }
80
- interface FFIDInquiryCreateResponse {
81
- ok: true;
82
- inquiryId: string;
83
- /** True only when the submitter is already a confirmed newsletter subscriber. */
84
- newsletterSubscribed: boolean;
85
- }
86
-
87
- /**
88
- * Newsletter types exposed by the FFID SDK.
89
- *
90
- * 2-layer newsletter model (#2078):
91
- * - `inquiry_followup`: 問い合わせフォローアップ (Type A)
92
- * - `general`: 定期ニュースレター (Type B)
93
- *
94
- * FFID account holders' preferences live in `user_marketing_preferences`;
95
- * anonymous subscribers live in `newsletter_subscribers` with double
96
- * opt-in required.
97
- */
98
- declare const FFID_NEWSLETTER_TYPES: readonly ["inquiry_followup", "general"];
99
- type FFIDNewsletterType = (typeof FFID_NEWSLETTER_TYPES)[number];
100
- interface FFIDNewsletterSubscribeParams {
101
- /** Subscriber email address */
102
- email: string;
103
- /** One or more newsletter types to opt in to */
104
- types: FFIDNewsletterType[];
105
- /** Origin string recorded on the subscriber row (e.g. your service code) */
106
- source: string;
107
- /** ISO 639-1 locale (e.g. 'ja', 'en') */
108
- locale?: string;
109
- }
110
- interface FFIDNewsletterSubscribeResponse {
111
- ok: true;
112
- /** True when a double opt-in confirmation email was sent */
113
- requiresConfirmation: boolean;
114
- /** True when the email matched an existing FFID account; the caller
115
- * must sign in to update preferences. Preferences are NOT modified. */
116
- requiresSignIn: boolean;
117
- }
118
- interface FFIDNewsletterConfirmParams {
119
- /** Confirmation token received in the double opt-in email */
120
- token: string;
121
- }
122
- interface FFIDNewsletterConfirmResponse {
123
- ok: true;
124
- }
125
- interface FFIDNewsletterUnsubscribeParams {
126
- /** Unsubscribe token received in the newsletter footer / List-Unsubscribe header */
127
- token: string;
128
- }
129
- interface FFIDNewsletterUnsubscribeResponse {
130
- ok: true;
131
- }
132
-
133
- /** Cache adapter interface for FFID SDK token verification */
134
- /**
135
- * Pluggable cache adapter interface.
136
- * Implement this to use custom cache backends (Redis, Memcached, etc.)
137
- */
138
- interface FFIDCacheAdapter {
139
- /** Get a cached value by key. Returns null if not found or expired. */
140
- get(key: string): Promise<unknown | null>;
141
- /** Set a value with TTL in seconds. */
142
- set(key: string, value: unknown, ttlSeconds: number): Promise<void>;
143
- /** Delete a cached value. */
144
- delete(key: string): Promise<void>;
145
- }
146
- /** Cache configuration for createFFIDClient */
147
- interface FFIDCacheConfig {
148
- /** Cache adapter instance */
149
- adapter: FFIDCacheAdapter;
150
- /** Cache TTL in seconds (how long to cache userinfo/introspect results) */
151
- ttl: number;
152
- }
153
-
154
- /** Billing interval for subscriptions */
155
- type FFIDBillingInterval = 'monthly' | 'yearly';
156
- /**
157
- * Supported currencies for billing responses.
158
- * Mirrors the platform's `SupportedCurrency` enum (`jpy` = zero-decimal Japanese Yen, `usd` = US Dollar).
159
- */
160
- type FFIDSupportedCurrency = 'jpy' | 'usd';
161
- /** Service information returned by plans endpoint */
162
- interface FFIDServiceInfo {
163
- id: string;
164
- code: string;
165
- name: string;
166
- description: string | null;
167
- isActive: boolean;
168
- createdAt: string;
169
- plans: FFIDPlanInfo[];
170
- }
171
- /** Plan information returned by plans endpoint */
172
- interface FFIDPlanInfo {
173
- id: string;
174
- serviceId: string;
175
- code: string;
176
- name: string;
177
- description: string | null;
178
- minSeats: number;
179
- maxSeats: number | null;
180
- seatSelectionEnabled: boolean;
181
- trialDays: number;
182
- priceMonthly: number;
183
- priceYearly: number | null;
184
- currency: string;
185
- isActive: boolean;
186
- displayOrder: number;
187
- customPricing: boolean;
188
- createdAt: string;
189
- }
190
- /** Response from list plans endpoint */
191
- interface FFIDListPlansResponse {
192
- services: FFIDServiceInfo[];
193
- count: number;
194
- }
195
- /** Subscription details returned by ext API (sanitized, no Stripe IDs) */
196
- interface FFIDSubscriptionDetail {
197
- id: string;
198
- organizationId: string;
199
- organizationName: string;
200
- serviceCode: string;
201
- serviceName: string;
202
- planCode: string;
203
- planName: string;
204
- status: FFIDSubscriptionStatus;
205
- paymentMethod: string | null;
206
- billingInterval: FFIDBillingInterval;
207
- quantity: number;
208
- currentPeriodStart: string | null;
209
- currentPeriodEnd: string | null;
210
- trialStart: string | null;
211
- trialEnd: string | null;
212
- canceledAt: string | null;
213
- cancelAtPeriodEnd: boolean;
214
- /** Pending period-end downgrade info (null = no scheduled downgrade) */
215
- pendingDowngrade: {
216
- planCode: string;
217
- planName: string;
218
- billingInterval: FFIDBillingInterval;
219
- scheduledAt: string;
220
- requestedAt: string;
221
- } | null;
222
- createdAt: string;
223
- }
224
- /** Parameters for subscribing to a plan */
225
- interface FFIDSubscribeParams {
226
- /** Organization ID (UUID) */
227
- organizationId: string;
228
- /** Plan code (e.g., 'free', 'basic', 'pro') */
229
- planCode: string;
230
- /** Billing interval (default: 'monthly') */
231
- billingInterval?: FFIDBillingInterval;
232
- /** Number of seats (default: plan's minSeats) */
233
- quantity?: number;
234
- /** User ID for seat auto-assignment (only needed for service-key mode) */
235
- userId?: string;
236
- }
237
- /** Sanitized subscription fields returned by subscribe/reactivate endpoints (no Stripe IDs) */
238
- interface FFIDSubscriptionSummary {
239
- id: string;
240
- organizationId: string;
241
- serviceId: string;
242
- planId: string;
243
- status: FFIDSubscriptionStatus;
244
- paymentMethod: string | null;
245
- billingInterval: FFIDBillingInterval;
246
- quantity: number;
247
- currentPeriodStart: string | null;
248
- currentPeriodEnd: string | null;
249
- trialStart: string | null;
250
- trialEnd: string | null;
251
- canceledAt: string | null;
252
- cancelAtPeriodEnd: boolean;
253
- createdAt: string;
254
- }
255
- /** Response from subscribe endpoint */
256
- interface FFIDSubscribeResponse {
257
- subscription: FFIDSubscriptionSummary;
258
- service: {
259
- id: string;
260
- code: string;
261
- name: string;
262
- };
263
- plan: {
264
- id: string;
265
- code: string;
266
- name: string;
267
- priceMonthly: number;
268
- priceYearly: number | null;
269
- trialDays: number;
270
- };
271
- /** True if a canceled subscription was reactivated */
272
- reactivated?: boolean;
273
- /** True if Stripe checkout is needed (canceled paid plan reactivation) */
274
- needsCheckout?: boolean;
275
- }
276
- /** Parameters for changing plan */
277
- interface FFIDChangePlanParams {
278
- /** Subscription ID (UUID) */
279
- subscriptionId: string;
280
- /** New plan code */
281
- planCode: string;
282
- /** New billing interval (default: keeps current) */
283
- billingInterval?: FFIDBillingInterval;
284
- }
285
- /** Response from change plan endpoint */
286
- interface FFIDChangePlanResponse {
287
- message: string;
288
- subscription: {
289
- id: string;
290
- organizationId: string;
291
- serviceCode: string;
292
- planCode: string;
293
- planName: string;
294
- billingInterval: FFIDBillingInterval;
295
- status: FFIDSubscriptionStatus;
296
- isUpgrade: boolean;
297
- };
298
- /** Present when downgrade is scheduled for period end instead of immediate */
299
- pendingDowngrade?: {
300
- planCode: string;
301
- planName: string;
302
- scheduledAt: string;
303
- };
304
- }
305
- /** Parameters for canceling subscription */
306
- interface FFIDCancelSubscriptionParams {
307
- /** Subscription ID (UUID) */
308
- subscriptionId: string;
309
- /** Cancellation reason code */
310
- reason?: 'too_expensive' | 'missing_features' | 'switched_service' | 'rarely_used' | 'customer_service' | 'other';
311
- /** Additional cancellation details */
312
- reasonDetails?: string;
313
- }
314
- /** Response from cancel subscription endpoint */
315
- interface FFIDCancelSubscriptionResponse {
316
- message: string;
317
- subscription: {
318
- id: string;
319
- organizationId: string;
320
- status: FFIDSubscriptionStatus;
321
- canceledAt: string | null;
322
- };
323
- }
324
- /** Response from cancel pending downgrade endpoint */
325
- interface FFIDCancelPendingDowngradeResponse {
326
- message: string;
327
- subscription: {
328
- id: string;
329
- organizationId: string;
330
- serviceCode: string;
331
- planCode: string;
332
- billingInterval: FFIDBillingInterval;
333
- status: FFIDSubscriptionStatus;
334
- /** Always null after successful cancellation */
335
- pendingDowngradePlanId: null;
336
- };
337
- }
338
- /** Parameters for previewing plan change */
339
- interface FFIDPreviewPlanChangeParams {
340
- /** Subscription ID (UUID) */
341
- subscriptionId: string;
342
- /** New plan code */
343
- planCode: string;
344
- /** New billing interval (default: keeps current) */
345
- billingInterval?: FFIDBillingInterval;
346
- }
347
- /** Plan change preview line item */
348
- interface FFIDPlanChangeLineItem {
349
- description: string;
350
- amount: number;
351
- }
352
- /** Fields shared by every plan-change preview variant (internal; consumers use `FFIDPlanChangePreview`) */
353
- interface FFIDPlanChangePreviewBase {
354
- /** Discriminant for preview response variants (reserved for future unions with e.g. seat-change previews) */
355
- type: 'plan-change';
356
- /** Current plan display info. `price` is the total for the current quantity (unitPrice × quantity), not per-seat. */
357
- currentPlan: {
358
- name: string;
359
- price: number;
360
- };
361
- /** New plan display info. `price` is the total for the effective quantity (unitPrice × quantity), not per-seat. */
362
- newPlan: {
363
- name: string;
364
- price: number;
365
- };
366
- billingInterval: FFIDBillingInterval;
367
- isUpgrade: boolean;
368
- /** Full amount of the next billing cycle at the new plan's standard price. Never overwritten by Stripe proration data. */
369
- nextInvoiceAmount: number;
370
- nextInvoiceDate: string | null;
371
- currency: FFIDSupportedCurrency;
372
- /** true when amounts are estimated from local prices (no Stripe proration data) */
373
- isEstimate: boolean;
374
- /** Reason why `isEstimate` is true. Only meaningful when `isEstimate === true`. */
375
- estimateReason?: 'no_stripe_data' | 'custom_pricing' | 'stripe_error';
376
- lineItems: FFIDPlanChangeLineItem[];
377
- }
378
- /**
379
- * Plan change proration preview.
380
- *
381
- * `willApplyAtPeriodEnd` is a discriminant that constrains related fields at the type level:
382
- * - `true`: period-end-deferred downgrade. `proratedAmount` is always 0; `effectiveDate` mirrors
383
- * the subscription's `currentPeriodEnd` (may be `null` when the subscription has no active
384
- * billing cycle yet — e.g. a pre-Stripe trial or a subscription whose billing cycle is unset).
385
- * - `false`: immediate change. `effectiveDate` is always `null`; `proratedAmount` is the live
386
- * (possibly Stripe-refined) day-basis difference.
387
- */
388
- type FFIDPlanChangePreview = FFIDPlanChangePreviewBase & ({
389
- willApplyAtPeriodEnd: true;
390
- effectiveDate: string | null;
391
- /** 0 on period-end-deferred changes; charge happens at the next invoice */
392
- proratedAmount: 0;
393
- } | {
394
- willApplyAtPeriodEnd: false;
395
- effectiveDate: null;
396
- /** Prorated difference charged within the current billing period */
397
- proratedAmount: number;
398
- });
399
- /** Response from plan change preview endpoint */
400
- interface FFIDPlanChangePreviewResponse {
401
- preview: FFIDPlanChangePreview;
402
- }
403
- /** Parameters for previewing a seat count change */
404
- interface FFIDPreviewSeatChangeParams {
405
- /** Subscription ID (UUID) */
406
- subscriptionId: string;
407
- /** New seat quantity. Must be an integer within the plan's allowed range. */
408
- quantity: number;
409
- }
410
- /** Seat change preview line item */
411
- interface FFIDSeatChangeLineItem {
412
- description: string;
413
- amount: number;
414
- }
415
- /**
416
- * Seat change proration preview.
417
- *
418
- * Sister type to `FFIDPlanChangePreview`. The shared `type` discriminant lets
419
- * consumers narrow a preview payload without inspecting unrelated fields.
420
- *
421
- * - `isEstimate=true` (default when Stripe is not configured or data is unavailable):
422
- * `proratedAmount` is computed locally as `(newQuantity - currentQuantity) * unitPrice`.
423
- * - `isEstimate=false`: `proratedAmount` reflects Stripe's live proration calculation.
424
- *
425
- * `nextInvoiceAmount` is always a local estimate (`unitPrice * newQuantity`).
426
- *
427
- * `pricingUnavailable=true` indicates the plan uses custom pricing with a zero unit
428
- * price (Enterprise). Consumers should hide monetary amounts in this case.
429
- */
430
- interface FFIDSeatChangePreview {
431
- /** Discriminant for preview response variants (pairs with `FFIDPlanChangePreview.type`) */
432
- type: 'seat-change';
433
- currentQuantity: number;
434
- newQuantity: number;
435
- /** Per-seat price for the current billing interval */
436
- unitPrice: number;
437
- billingInterval: FFIDBillingInterval;
438
- /**
439
- * Prorated cost for the current billing period. Negative when seats are decreased
440
- * (credit). `0` when `pricingUnavailable === true` (Enterprise custom pricing).
441
- */
442
- proratedAmount: number;
443
- /** Next invoice full amount — always a local estimate (`unitPrice * newQuantity`) */
444
- nextInvoiceAmount: number;
445
- nextInvoiceDate: string | null;
446
- currency: FFIDSupportedCurrency;
447
- /** true when proratedAmount is estimated from local prices rather than Stripe proration data */
448
- isEstimate: boolean;
449
- /** true when unit price is 0 due to custom pricing (Enterprise) — hide monetary amounts */
450
- pricingUnavailable?: boolean;
451
- /** Reason why `isEstimate` is true. Only meaningful when `isEstimate === true`. */
452
- estimateReason?: 'no_stripe_data' | 'custom_pricing' | 'stripe_error';
453
- lineItems: FFIDSeatChangeLineItem[];
454
- }
455
- /** Response from seat change preview endpoint */
456
- interface FFIDSeatChangePreviewResponse {
457
- preview: FFIDSeatChangePreview;
458
- }
459
-
460
- /**
461
- * FFID SDK Type Definitions
462
- *
463
- * Core types for the FeelFlow ID SDK
464
- */
465
-
466
- /** Authentication mode for FFID client */
467
- type FFIDAuthMode = 'cookie' | 'token' | 'service-key';
468
- /**
469
- * User information from FFID
470
- */
471
- type FFIDSeatModel = 'organization';
472
- /** Userinfo member role for OAuth responses */
473
- type FFIDOAuthUserInfoMemberRole = 'owner' | 'admin' | 'member' | 'viewer';
474
- interface FFIDUser {
475
- /** User ID (UUID) */
476
- id: string;
477
- /** Email address */
478
- email: string;
479
- /** Display name */
480
- displayName: string | null;
481
- /** Avatar URL */
482
- avatarUrl: string | null;
483
- /** Locale setting (e.g., 'ja', 'en') */
484
- locale: string | null;
485
- /** Timezone (e.g., 'Asia/Tokyo') */
486
- timezone: string | null;
487
- /** Account creation timestamp */
488
- createdAt: string;
489
- }
490
- /**
491
- * Agency branding information for white-label support.
492
- * Included in organization when it is linked to an agency.
493
- */
494
- interface FFIDAgencyBranding {
495
- /** Agency ID (UUID) */
496
- agencyId: string;
497
- /** Agency display name */
498
- agencyName: string;
499
- /** Custom logo URL */
500
- logoUrl?: string;
501
- /** Custom favicon URL */
502
- faviconUrl?: string;
503
- /** Primary brand color (hex) */
504
- primaryColor?: string;
505
- /** Secondary brand color (hex) */
506
- secondaryColor?: string;
507
- /** White-label company name */
508
- companyName?: string;
509
- }
510
- /**
511
- * Organization membership information
512
- */
513
- interface FFIDOrganization {
514
- /** Organization ID (UUID) */
515
- id: string;
516
- /** Organization name */
517
- name: string;
518
- /** URL-safe slug */
519
- slug: string;
520
- /** User's role in this organization */
521
- role: 'owner' | 'admin' | 'member';
522
- /** Membership status */
523
- status: 'active' | 'invited' | 'suspended';
524
- /** Agency branding (null if org is not linked to an agency) */
525
- agencyBranding: FFIDAgencyBranding | null;
526
- }
527
- /**
528
- * Subscription/contract information
529
- */
530
- interface FFIDSubscription {
531
- /** Subscription ID (UUID) */
532
- id: string;
533
- /** Service code (e.g., 'chatbot') */
534
- serviceCode: string;
535
- /** Service display name */
536
- serviceName: string;
537
- /** Plan code (e.g., 'basic', 'pro') */
538
- planCode: string;
539
- /** Plan display name */
540
- planName: string;
541
- /** Subscription status */
542
- status: FFIDSubscriptionStatus;
543
- /** Current billing period end date */
544
- currentPeriodEnd: string | null;
545
- /** Trial end date (null if not a trial or no trial_end set) */
546
- trialEnd: string | null;
547
- /** Service seat model (available when sourced from OAuth userinfo) */
548
- seatModel?: FFIDSeatModel | undefined;
549
- /** Member role in the resolved organization context */
550
- memberRole?: FFIDOAuthUserInfoMemberRole | undefined;
551
- /** Organization ID used to resolve subscription access */
552
- organizationId?: string | null | undefined;
553
- }
554
- /** OAuth userinfo subscription summary */
555
- interface FFIDOAuthUserInfoSubscription {
556
- subscriptionId: string | null;
557
- status: FFIDSubscriptionStatus | null;
558
- planCode: string | null;
559
- seatModel: FFIDSeatModel | null;
560
- memberRole: FFIDOAuthUserInfoMemberRole | null;
561
- organizationId: string | null;
562
- hasSeatAssignment: boolean | null;
563
- }
564
- /** OAuth userinfo response exposed by FFID */
565
- interface FFIDOAuthUserInfo {
566
- sub: string;
567
- email: string | null;
568
- name: string | null;
569
- picture: string | null;
570
- companyName?: string | null | undefined;
571
- department?: string | null | undefined;
572
- position?: string | null | undefined;
573
- phoneNumber?: string | null | undefined;
574
- organizationId?: string | null | undefined;
575
- subscription?: FFIDOAuthUserInfoSubscription | undefined;
576
- }
577
- /** Options for verifyAccessToken */
578
- interface FFIDVerifyAccessTokenOptions {
579
- /**
580
- * When true, fetches profile info (email, name, picture) via introspect API
581
- * after local JWT verification. No effect when verifyStrategy is 'introspect'
582
- * (profile is always included).
583
- * Requires {@link FFIDConfig.serviceApiKey} to be configured when using jwt strategy.
584
- * @default false
585
- */
586
- includeProfile?: boolean;
587
- }
588
- /**
589
- * SDK configuration options
590
- */
591
- interface FFIDConfig {
592
- /** Service code to identify your application */
593
- serviceCode: string;
594
- /** FFID API base URL (defaults to production) */
595
- apiBaseUrl?: string | undefined;
596
- /**
597
- * Enable debug logging (deprecated: use logger instead)
598
- * When true and no logger provided, uses console for logging
599
- * @deprecated Use `logger` option for custom logging
600
- */
601
- debug?: boolean | undefined;
602
- /**
603
- * Custom logger for SDK debug output
604
- * If not provided: uses no-op logger (silent)
605
- * If debug=true and no logger: uses console
606
- */
607
- logger?: FFIDLogger | undefined;
608
- /** Session refresh interval in milliseconds */
609
- refreshInterval?: number | undefined;
610
- /** Callback when authentication state changes */
611
- onAuthStateChange?: ((user: FFIDUser | null) => void) | undefined;
612
- /** Callback on authentication error */
613
- onError?: ((error: FFIDError) => void) | undefined;
614
- /** Authentication mode: 'cookie' (default), 'token' (OAuth Bearer), or 'service-key' (server-to-server) */
615
- authMode?: FFIDAuthMode | undefined;
616
- /** Client ID for token mode (defaults to serviceCode if not set) */
617
- clientId?: string | undefined;
618
- /** Custom redirect URI for OAuth flow (defaults to window.location.origin + window.location.pathname) */
619
- redirectUri?: string | undefined;
620
- /** Service API key for service-key mode (X-Service-Api-Key header) */
621
- serviceApiKey?: string | undefined;
622
- /**
623
- * Token verification strategy for service-key mode.
624
- * - 'jwt': Local JWT verification via JWKS (default, lower latency)
625
- * - 'introspect': Remote introspection via /api/v1/oauth/introspect
626
- *
627
- * JWT verification returns limited claims (no email/name/picture/subscription) by default.
628
- * Use 'introspect' if you always need full user profile data, or pass
629
- * { includeProfile: true } to verifyAccessToken() for on-demand profile fetching.
630
- */
631
- verifyStrategy?: 'jwt' | 'introspect' | undefined;
632
- /**
633
- * Cache configuration for token verification results.
634
- * When set, introspect/userinfo responses are cached to reduce API calls.
635
- * Effective in service-key mode with verifyStrategy: 'introspect',
636
- * or with verifyStrategy: 'jwt' when includeProfile: true is used.
637
- */
638
- cache?: FFIDCacheConfig | undefined;
639
- /**
640
- * Request timeout in milliseconds for FFID API calls.
641
- * Applies to token verification and introspection requests.
642
- * @default undefined (no timeout, uses fetch default)
643
- */
644
- timeout?: number | undefined;
645
- }
646
- /**
647
- * Logger interface for SDK debug output
648
- *
649
- * Allows injection of custom loggers (e.g., winston, pino)
650
- * or use of the built-in console logger when debug is enabled
651
- */
652
- interface FFIDLogger {
653
- /** Debug level logging */
654
- debug: (...args: unknown[]) => void;
655
- /** Info level logging */
656
- info: (...args: unknown[]) => void;
657
- /** Warning level logging */
658
- warn: (...args: unknown[]) => void;
659
- /** Error level logging */
660
- error: (...args: unknown[]) => void;
661
- }
662
- /**
663
- * FFID error object
664
- */
665
- interface FFIDError {
666
- /** Error code */
667
- code: string;
668
- /** Human-readable error message */
669
- message: string;
670
- /** Additional error details */
671
- details?: Record<string, unknown>;
672
- }
673
- /**
674
- * Session response from FFID API
675
- */
676
- interface FFIDSessionResponse {
677
- user: FFIDUser;
678
- organizations: FFIDOrganization[];
679
- subscriptions: FFIDSubscription[];
680
- }
681
- /**
682
- * API response wrapper (discriminated union for type safety)
683
- *
684
- * Either data is present (success) or error is present (failure), never both.
685
- * This pattern ensures callers handle both cases explicitly.
686
- */
687
- type FFIDApiResponse<T> = {
688
- data: T;
689
- error?: undefined;
690
- } | {
691
- data?: undefined;
692
- error: FFIDError;
693
- };
694
- /** Subscription status values matching the FFID platform's SubscriptionStatus type */
695
- type FFIDSubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'canceled' | 'pending_invoice' | 'paused' | 'incomplete' | 'incomplete_expired' | 'unpaid';
696
- interface FFIDSubscriptionCheckResponse {
697
- hasActiveSubscription: boolean;
698
- organizationId: string | null;
699
- subscriptionId: string | null;
700
- status: FFIDSubscriptionStatus | null;
701
- planCode: string | null;
702
- currentPeriodEnd: string | null;
703
- }
704
- /**
705
- * Checkout session response from billing checkout endpoint
706
- */
707
- interface FFIDCheckoutSessionResponse {
708
- /** Stripe Checkout session ID */
709
- sessionId: string;
710
- /** Stripe Checkout session URL (null if session creation had issues) */
711
- url: string | null;
712
- }
713
- /**
714
- * Portal session response from billing portal endpoint
715
- */
716
- interface FFIDPortalSessionResponse {
717
- /** Stripe Billing Portal URL */
718
- url: string;
719
- }
720
- /**
721
- * Parameters for creating a checkout session
722
- */
723
- interface FFIDCreateCheckoutParams {
724
- /** Organization ID (UUID) */
725
- organizationId: string;
726
- /** Subscription ID (UUID) */
727
- subscriptionId: string;
728
- /** URL to redirect after successful checkout */
729
- successUrl: string;
730
- /** URL to redirect after cancelled checkout */
731
- cancelUrl: string;
732
- /** Optional plan ID for upgrade or resubscription */
733
- planId?: string;
734
- }
735
- /**
736
- * Parameters for creating a billing portal session
737
- */
738
- interface FFIDCreatePortalParams {
739
- /** Organization ID (UUID) */
740
- organizationId: string;
741
- /** URL to redirect when user exits the portal */
742
- returnUrl: string;
743
- }
744
-
745
- /** Member role in an organization */
746
- type FFIDMemberRole = 'owner' | 'admin' | 'member' | 'viewer';
747
- /** Member status in an organization */
748
- type FFIDMemberStatus = 'active' | 'invited' | 'suspended';
749
- /** Organization member returned by the ext members API */
750
- interface FFIDOrganizationMember {
751
- /** User ID (UUID) */
752
- userId: string;
753
- /** Email address */
754
- email: string;
755
- /** Display name */
756
- displayName: string | null;
757
- /** Avatar URL */
758
- avatarUrl: string | null;
759
- /** Role in the organization */
760
- role: FFIDMemberRole;
761
- /** Membership status */
762
- status: FFIDMemberStatus;
763
- /** When the user joined */
764
- joinedAt: string | null;
765
- /** When the user was invited */
766
- invitedAt: string | null;
767
- /** Last sign-in timestamp */
768
- lastSignInAt: string | null;
769
- }
770
- /** Response from listMembers (ext) */
771
- interface FFIDListMembersResponse {
772
- organizationId: string;
773
- members: FFIDOrganizationMember[];
774
- }
775
- /** Response from updateMemberRole (ext) */
776
- interface FFIDUpdateMemberRoleResponse {
777
- member: FFIDOrganizationMember;
778
- }
779
- /** Response from removeMember (ext) */
780
- interface FFIDRemoveMemberResponse {
781
- message: string;
782
- }
783
- /**
784
- * User profile for the authenticated user (returned by `getProfile` / `updateProfile`).
785
- *
786
- * Mirrors the FFID backend `UserProfile` shape exposed via
787
- * `GET /api/v1/users/ext/me` and `PUT /api/v1/users/ext/me`.
788
- */
789
- interface FFIDUserProfile {
790
- /** User ID (UUID) */
791
- id: string;
792
- /** Email address */
793
- email: string;
794
- /** Display name (nullable when not set) */
795
- displayName: string | null;
796
- /** Avatar URL (nullable when not set) */
797
- avatarUrl: string | null;
798
- /** Phone number (nullable when not set) */
799
- phone: string | null;
800
- /** Company name (nullable when not set) */
801
- companyName: string | null;
802
- /** Department (nullable when not set) */
803
- department: string | null;
804
- /** Job title (nullable when not set) */
805
- jobTitle: string | null;
806
- /** IANA timezone (e.g. 'Asia/Tokyo') */
807
- timezone: string;
808
- /** Locale (e.g. 'ja', 'en') */
809
- locale: string;
810
- /** Arbitrary user preferences bag */
811
- preferences: Record<string, unknown>;
812
- /** Account creation timestamp (ISO 8601) */
813
- createdAt: string;
814
- /** Profile last-updated timestamp (ISO 8601) */
815
- updatedAt: string;
816
- }
817
- /**
818
- * Per-call options for profile methods (`getProfile` / `updateProfile`).
819
- *
820
- * Supply `accessToken` to forward an end-user Bearer token for the single call
821
- * without mutating client-level auth state. Designed for server runtimes (Cloudflare
822
- * Workers, Edge, Node) that receive a user-scoped Bearer per request and want to
823
- * act as that user against `/api/v1/users/ext/me`.
824
- *
825
- * When `accessToken` is supplied with a non-empty value, it overrides the client's
826
- * configured auth mode: authentication for that request uses only
827
- * `Authorization: Bearer <accessToken>` (no service key, no cookie, no token-store
828
- * lookup, no auto-refresh on 401). Non-auth headers such as `Content-Type` are
829
- * still attached. SDK metadata headers (`User-Agent` / `X-FFID-SDK-Version`) are
830
- * attached on non-browser runtimes only (Node.js / Cloudflare Workers / Edge /
831
- * Deno); browsers receive an empty object to avoid iOS WebKit `fetch()` breakage
832
- * (see #2417).
833
- *
834
- * Runtime semantics:
835
- * - `accessToken` omitted (or `undefined`) → no override, configured `authMode` is used
836
- * - `accessToken` is empty string / whitespace-only → rejected as `VALIDATION_ERROR`
837
- * before any network call (prevents silent impersonation fallback when a caller
838
- * extracts a missing/blank `Authorization` header into this field)
839
- * - `accessToken` is a non-empty string → override activated
840
- */
841
- interface FFIDProfileCallOptions {
842
- /**
843
- * End-user Bearer token forwarded for this single request.
844
- *
845
- * Must be a non-empty string when supplied. Passing `''` or a whitespace-only
846
- * string is treated as a caller error and surfaces as `VALIDATION_ERROR` —
847
- * this guards against the common footgun where a server runtime extracts the
848
- * Bearer from an incoming request without checking the header is present.
849
- */
850
- accessToken?: string;
851
- }
852
- /**
853
- * Request payload for `updateProfile`.
854
- *
855
- * Mirrors the FFID backend `UpdateUserProfileRequest` shape. All fields are
856
- * optional — only the supplied keys will be updated (partial update semantics).
857
- *
858
- * Per-field value semantics:
859
- * - `undefined` / key omitted → field is untouched (partial update)
860
- * - `null` → clears the field (stores SQL NULL in the DB)
861
- * - `""` (empty string) → stored as a literal empty string, **not** treated as
862
- * a clear. Use `null` when you want the DB value to become NULL
863
- *
864
- * `timezone` and `locale` are intentionally modeled as non-null in this
865
- * request type (application-level invariant — the DB columns have DEFAULT
866
- * values but no NOT NULL constraint, yet the server-side normalization
867
- * pipeline assumes a string is always present). Pass a string to update the
868
- * value, or omit the key to leave the current value in place. Do not pass
869
- * `null` to clear — there is no meaningful "no timezone" state for a user.
870
- *
871
- * `preferences: null` is accepted and clears the column. Subsequent reads
872
- * return `{}` because the FFID backend normalizes a null `preferences` column
873
- * to an empty object (`toUserProfile` helper) before serializing the response —
874
- * the SDK itself does not transform the payload.
875
- */
876
- interface FFIDUpdateUserProfileRequest {
877
- /** Display name (null clears the field) */
878
- displayName?: string | null;
879
- /** Phone number (null clears the field) */
880
- phone?: string | null;
881
- /** Company name (null clears the field) */
882
- companyName?: string | null;
883
- /** Department (null clears the field) */
884
- department?: string | null;
885
- /** Job title (null clears the field) */
886
- jobTitle?: string | null;
887
- /** IANA timezone (non-null; omit the key to leave unchanged) */
888
- timezone?: string;
889
- /** Locale (non-null; omit the key to leave unchanged) */
890
- locale?: string;
891
- /** Arbitrary user preferences bag (null clears the column; reads return {}) */
892
- preferences?: Record<string, unknown> | null;
893
- }
894
- /**
895
- * Discriminant for redirect failures that callers need to handle
896
- * programmatically (vs. logging the human-readable `error` string).
897
- *
898
- * - `'redirect_loop_detected'`: `redirectToAuthorize()` detected that the
899
- * same authorize URL (keyed by `baseUrl + client_id + organization_id`)
900
- * has been fired **3 times within 60 seconds**. Caller should surface a
901
- * manual "再度ログインする" UI rather than retry automatically (#2406 / #2411).
902
- *
903
- * SDK 2.18.0 only ships `'redirect_loop_detected'`. Other failure paths
904
- * (SSR environment, PKCE generation failure, empty organizationId) currently
905
- * return `error` without a `code`. New codes will be added in future minor
906
- * versions — treat this union as forward-extensible and do NOT exhaustively
907
- * `switch` over it without a `default` branch for consumer code that must
908
- * stay compatible across SDK upgrades.
909
- */
910
- type FFIDRedirectErrorCode = 'redirect_loop_detected';
911
- /**
912
- * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
913
- *
914
- * Structured return type so callers can inspect failure reasons
915
- * instead of receiving a bare `false`. When `code` is set, branch on it
916
- * for programmatic handling; otherwise log `error` for humans.
917
- */
918
- type FFIDRedirectResult = {
919
- success: true;
920
- } | {
921
- success: false;
922
- error: string;
923
- code?: FFIDRedirectErrorCode;
924
- };
925
-
926
- /** OTP / magic link methods - sendOtp / verifyOtp */
927
-
928
- /** Response from sendOtp */
929
- interface FFIDOtpSendResponse {
930
- message: string;
931
- }
932
- /** Response from verifyOtp */
933
- interface FFIDOtpVerifyResponse {
934
- user: {
935
- id: string;
936
- email: string;
937
- displayName: string | null;
938
- avatarUrl: string | null;
939
- };
940
- session: {
941
- accessToken: string;
942
- refreshToken: string;
943
- expiresAt: number;
944
- expiresIn: number;
945
- };
946
- }
947
-
948
- /** Password reset methods - requestPasswordReset / verifyPasswordResetToken / establishResetSession / confirmPasswordReset */
949
-
950
- /** Response from requestPasswordReset */
951
- interface FFIDPasswordResetResponse {
952
- message: string;
953
- }
954
- /** Response from verifyPasswordResetToken */
955
- interface FFIDPasswordResetVerifyResponse {
956
- valid: boolean;
957
- }
958
- /** Response from establishResetSession */
959
- type FFIDResetSessionResponse = FFIDPasswordResetResponse;
960
- /** Response from confirmPasswordReset */
961
- type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
962
-
963
- /** Contract Wizard navigation methods — URL generation and browser redirect for contract flows */
964
-
965
- /** Options for the new-subscription wizard flow */
966
- interface ContractWizardSubscribeOptions {
967
- /** URL to redirect back to after completion */
968
- redirect?: string;
969
- /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
970
- organizationId?: string;
971
- }
972
- /** Options for the resubscribe wizard flow */
973
- interface ContractWizardResubscribeOptions {
974
- /** Service code to resubscribe to (defaults to SDK's serviceCode) */
975
- serviceCode?: string;
976
- /** URL to redirect back to after completion */
977
- redirect?: string;
978
- /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
979
- organizationId?: string;
980
- }
981
- /** Options for wizard flows that operate on an existing subscription */
982
- interface ContractWizardSubscriptionOptions {
983
- /** URL to redirect back to after completion */
984
- redirect?: string;
985
- /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
986
- organizationId?: string;
987
- }
988
-
989
- /** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
990
-
991
- /** Options for redirectToAuthorize */
992
- interface RedirectToAuthorizeOptions {
993
- /** Target organization ID — triggers org-scoped OAuth re-authorization */
994
- organizationId?: string;
995
- }
996
-
997
- /**
998
- * Token Store
999
- *
1000
- * Manages OAuth 2.0 tokens (access + refresh) with dual-storage support.
1001
- * Falls back to in-memory storage when localStorage is unavailable
1002
- * (e.g., Safari private browsing mode).
1003
- */
1004
- /**
1005
- * Token data stored by the token store
1006
- */
1007
- interface TokenData {
1008
- /** OAuth 2.0 access token */
1009
- accessToken: string;
1010
- /** OAuth 2.0 refresh token */
1011
- refreshToken: string;
1012
- /** Expiration timestamp in milliseconds (Unix epoch) */
1013
- expiresAt: number;
1014
- }
1015
- /**
1016
- * Token store interface for managing OAuth tokens
1017
- */
1018
- interface TokenStore {
1019
- /** Get stored tokens (null if not stored) */
1020
- getTokens(): TokenData | null;
1021
- /** Store new tokens */
1022
- setTokens(tokens: TokenData): void;
1023
- /** Clear all stored tokens */
1024
- clearTokens(): void;
1025
- /** Check if access token is expired (with 30s buffer) */
1026
- isAccessTokenExpired(): boolean;
1027
- }
1028
- /**
1029
- * Create a token store with the specified storage type.
1030
- *
1031
- * When storageType is 'localStorage' (default in browser), falls back
1032
- * to memory if localStorage is not available (e.g., Safari private mode).
1033
- *
1034
- * @param storageType - 'localStorage' (default) or 'memory'
1035
- */
1036
- declare function createTokenStore(storageType?: 'localStorage' | 'memory'): TokenStore;
1037
-
1038
- /** Creates an FFID API client instance */
1039
- declare function createFFIDClient(config: FFIDConfig): {
1040
- getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
1041
- signOut: () => Promise<FFIDApiResponse<void>>;
1042
- redirectToLogin: () => Promise<FFIDRedirectResult>;
1043
- redirectToAuthorize: (options?: RedirectToAuthorizeOptions) => Promise<FFIDRedirectResult>;
1044
- redirectToLogout: (postLogoutRedirectUri?: string) => FFIDRedirectResult;
1045
- getLoginUrl: (redirectUrl?: string) => string;
1046
- getLogoutUrl: (postLogoutRedirectUri?: string) => string;
1047
- getSignupUrl: (redirectUrl?: string) => string;
1048
- createError: (code: string, message: string) => FFIDError;
1049
- exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
1050
- refreshAccessToken: () => Promise<FFIDApiResponse<void>>;
1051
- checkSubscription: (params: {
1052
- userId?: string;
1053
- organizationId: string;
1054
- }) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
1055
- listMembers: (params: {
1056
- organizationId: string;
1057
- }) => Promise<FFIDApiResponse<FFIDListMembersResponse>>;
1058
- updateMemberRole: (params: {
1059
- organizationId: string;
1060
- userId: string;
1061
- role: FFIDMemberRole;
1062
- }) => Promise<FFIDApiResponse<FFIDUpdateMemberRoleResponse>>;
1063
- removeMember: (params: {
1064
- organizationId: string;
1065
- userId: string;
1066
- }) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
1067
- getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
1068
- updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
1069
- createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
1070
- createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
1071
- listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
1072
- getSubscription: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDSubscriptionDetail>>;
1073
- subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
1074
- changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
1075
- cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
1076
- cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
1077
- previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
1078
- previewSeatChange: (params: FFIDPreviewSeatChangeParams) => Promise<FFIDApiResponse<FFIDSeatChangePreviewResponse>>;
1079
- verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
1080
- getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
1081
- redirectToSubscribe: (options?: ContractWizardSubscribeOptions) => FFIDRedirectResult;
1082
- getChangePlanUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
1083
- redirectToChangePlan: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
1084
- getChangeSeatsUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
1085
- redirectToChangeSeats: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
1086
- getRecoverPaymentUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
1087
- redirectToRecoverPayment: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
1088
- getResubscribeUrl: (options?: ContractWizardResubscribeOptions) => string;
1089
- redirectToResubscribe: (options?: ContractWizardResubscribeOptions) => FFIDRedirectResult;
1090
- requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
1091
- verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
1092
- establishResetSession: (accessToken: string, refreshToken: string) => Promise<FFIDApiResponse<FFIDResetSessionResponse>>;
1093
- confirmPasswordReset: (password: string) => Promise<FFIDApiResponse<FFIDPasswordResetConfirmResponse>>;
1094
- sendOtp: (email: string, options?: {
1095
- redirectUrl?: string;
1096
- }) => Promise<FFIDApiResponse<FFIDOtpSendResponse>>;
1097
- verifyOtp: (params: {
1098
- accessToken: string;
1099
- refreshToken: string;
1100
- }) => Promise<FFIDApiResponse<FFIDOtpVerifyResponse>>;
1101
- /** Newsletter methods (subscribe / confirm / unsubscribe) */
1102
- newsletter: {
1103
- subscribe: (params: FFIDNewsletterSubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterSubscribeResponse>>;
1104
- confirm: (params: FFIDNewsletterConfirmParams) => Promise<FFIDApiResponse<FFIDNewsletterConfirmResponse>>;
1105
- unsubscribe: (params: FFIDNewsletterUnsubscribeParams) => Promise<FFIDApiResponse<FFIDNewsletterUnsubscribeResponse>>;
1106
- };
1107
- /** Inquiry methods (create) */
1108
- inquiry: {
1109
- create: (params: FFIDInquiryCreateParams) => Promise<FFIDApiResponse<FFIDInquiryCreateResponse>>;
1110
- };
1111
- /** Token store (token mode only) */
1112
- tokenStore: TokenStore;
1113
- /** Resolved auth mode */
1114
- authMode: FFIDAuthMode;
1115
- /** Resolved logger instance */
1116
- logger: FFIDLogger;
1117
- baseUrl: string;
1118
- serviceCode: string;
1119
- clientId: string;
1120
- redirectUri: string | null;
1121
- };
1122
- /** Type of the FFID client */
1123
- type FFIDClient = ReturnType<typeof createFFIDClient>;
1124
-
1125
5
  /** Token verification - verifyAccessToken() implementation */
1126
6
 
1127
7
  /** Dependencies required by verifyAccessToken */
@@ -1176,4 +56,4 @@ interface KVNamespaceLike {
1176
56
  */
1177
57
  declare function createKVCacheAdapter(kv: KVNamespaceLike): FFIDCacheAdapter;
1178
58
 
1179
- export { type FFIDCacheAdapter, type FFIDCacheConfig, type FFIDClient, type FFIDConfig, type FFIDOAuthUserInfo, type FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDProfileCallOptions, type FFIDResetSessionResponse, type FFIDSubscription, type FFIDUpdateUserProfileRequest, type FFIDUser, type FFIDUserProfile, type FFIDVerifyAccessTokenOptions, type KVNamespaceLike, type TokenData, type TokenStore, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, createVerifyAccessToken };
59
+ export { FFIDCacheAdapter, FFIDOAuthUserInfo, FFIDVerifyAccessTokenOptions, type KVNamespaceLike, createKVCacheAdapter, createMemoryCacheAdapter, createVerifyAccessToken };