@feelflow/ffid-sdk 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KMGY6PQY.cjs → chunk-6XEWLARZ.cjs} +47 -12
- package/dist/{chunk-424GEJSP.js → chunk-OOGFUCRJ.js} +47 -12
- 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/{index-DT3wF1vZ.d.cts → index-LPTvxtgt.d.cts} +33 -1
- package/dist/{index-DT3wF1vZ.d.ts → index-LPTvxtgt.d.ts} +33 -1
- package/dist/index.cjs +28 -28
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +47 -12
- package/dist/server/index.d.cts +35 -3
- package/dist/server/index.d.ts +35 -3
- package/dist/server/index.js +47 -12
- package/package.json +1 -1
|
@@ -762,12 +762,29 @@ function createMembersMethods(deps) {
|
|
|
762
762
|
|
|
763
763
|
// src/client/profile-methods.ts
|
|
764
764
|
var EXT_PROFILE_ENDPOINT = "/api/v1/users/ext/me";
|
|
765
|
+
function resolveAuthOverride(options, createError) {
|
|
766
|
+
if (!options || options.accessToken === void 0) {
|
|
767
|
+
return {};
|
|
768
|
+
}
|
|
769
|
+
const token = options.accessToken;
|
|
770
|
+
if (typeof token !== "string" || token.trim() === "") {
|
|
771
|
+
return {
|
|
772
|
+
error: createError(
|
|
773
|
+
"VALIDATION_ERROR",
|
|
774
|
+
"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"
|
|
775
|
+
)
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
return { override: { accessToken: token } };
|
|
779
|
+
}
|
|
765
780
|
function createProfileMethods(deps) {
|
|
766
781
|
const { fetchWithAuth, createError } = deps;
|
|
767
|
-
async function getProfile() {
|
|
768
|
-
|
|
782
|
+
async function getProfile(options) {
|
|
783
|
+
const { override, error } = resolveAuthOverride(options, createError);
|
|
784
|
+
if (error) return { error };
|
|
785
|
+
return fetchWithAuth(EXT_PROFILE_ENDPOINT, void 0, override);
|
|
769
786
|
}
|
|
770
|
-
async function updateProfile(data) {
|
|
787
|
+
async function updateProfile(data, options) {
|
|
771
788
|
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
772
789
|
return {
|
|
773
790
|
error: createError("VALIDATION_ERROR", "data \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059")
|
|
@@ -778,16 +795,22 @@ function createProfileMethods(deps) {
|
|
|
778
795
|
error: createError("VALIDATION_ERROR", "\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044")
|
|
779
796
|
};
|
|
780
797
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
798
|
+
const { override, error } = resolveAuthOverride(options, createError);
|
|
799
|
+
if (error) return { error };
|
|
800
|
+
return fetchWithAuth(
|
|
801
|
+
EXT_PROFILE_ENDPOINT,
|
|
802
|
+
{
|
|
803
|
+
method: "PUT",
|
|
804
|
+
body: JSON.stringify(data)
|
|
805
|
+
},
|
|
806
|
+
override
|
|
807
|
+
);
|
|
785
808
|
}
|
|
786
809
|
return { getProfile, updateProfile };
|
|
787
810
|
}
|
|
788
811
|
|
|
789
812
|
// src/client/version-check.ts
|
|
790
|
-
var SDK_VERSION = "2.
|
|
813
|
+
var SDK_VERSION = "2.15.0";
|
|
791
814
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
792
815
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
793
816
|
function sdkHeaders() {
|
|
@@ -1982,7 +2005,19 @@ function createFFIDClient(config) {
|
|
|
1982
2005
|
function createError(code, message) {
|
|
1983
2006
|
return { code, message };
|
|
1984
2007
|
}
|
|
1985
|
-
function buildFetchOptions(options) {
|
|
2008
|
+
function buildFetchOptions(options, authOverride) {
|
|
2009
|
+
if (authOverride) {
|
|
2010
|
+
return {
|
|
2011
|
+
...options,
|
|
2012
|
+
credentials: "omit",
|
|
2013
|
+
headers: {
|
|
2014
|
+
"Content-Type": "application/json",
|
|
2015
|
+
...sdkHeaders(),
|
|
2016
|
+
...options.headers,
|
|
2017
|
+
Authorization: `Bearer ${authOverride.accessToken}`
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
1986
2021
|
if (authMode === "service-key") {
|
|
1987
2022
|
return {
|
|
1988
2023
|
...options,
|
|
@@ -2029,10 +2064,10 @@ function createFFIDClient(config) {
|
|
|
2029
2064
|
logger,
|
|
2030
2065
|
errorCodes: FFID_ERROR_CODES
|
|
2031
2066
|
});
|
|
2032
|
-
async function fetchWithAuth(endpoint, options = {}) {
|
|
2067
|
+
async function fetchWithAuth(endpoint, options = {}, authOverride) {
|
|
2033
2068
|
const url = `${baseUrl}${endpoint}`;
|
|
2034
2069
|
logger.debug("Fetching:", url);
|
|
2035
|
-
const fetchOptions = buildFetchOptions(options);
|
|
2070
|
+
const fetchOptions = buildFetchOptions(options, authOverride);
|
|
2036
2071
|
let response;
|
|
2037
2072
|
try {
|
|
2038
2073
|
response = await fetch(url, fetchOptions);
|
|
@@ -2045,7 +2080,7 @@ function createFFIDClient(config) {
|
|
|
2045
2080
|
}
|
|
2046
2081
|
};
|
|
2047
2082
|
}
|
|
2048
|
-
if (authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
2083
|
+
if (!authOverride && authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
2049
2084
|
const refreshResult = await refreshAccessToken();
|
|
2050
2085
|
if (!refreshResult.error) {
|
|
2051
2086
|
logger.debug("Token refreshed, retrying request");
|
|
@@ -760,12 +760,29 @@ function createMembersMethods(deps) {
|
|
|
760
760
|
|
|
761
761
|
// src/client/profile-methods.ts
|
|
762
762
|
var EXT_PROFILE_ENDPOINT = "/api/v1/users/ext/me";
|
|
763
|
+
function resolveAuthOverride(options, createError) {
|
|
764
|
+
if (!options || options.accessToken === void 0) {
|
|
765
|
+
return {};
|
|
766
|
+
}
|
|
767
|
+
const token = options.accessToken;
|
|
768
|
+
if (typeof token !== "string" || token.trim() === "") {
|
|
769
|
+
return {
|
|
770
|
+
error: createError(
|
|
771
|
+
"VALIDATION_ERROR",
|
|
772
|
+
"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"
|
|
773
|
+
)
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
return { override: { accessToken: token } };
|
|
777
|
+
}
|
|
763
778
|
function createProfileMethods(deps) {
|
|
764
779
|
const { fetchWithAuth, createError } = deps;
|
|
765
|
-
async function getProfile() {
|
|
766
|
-
|
|
780
|
+
async function getProfile(options) {
|
|
781
|
+
const { override, error } = resolveAuthOverride(options, createError);
|
|
782
|
+
if (error) return { error };
|
|
783
|
+
return fetchWithAuth(EXT_PROFILE_ENDPOINT, void 0, override);
|
|
767
784
|
}
|
|
768
|
-
async function updateProfile(data) {
|
|
785
|
+
async function updateProfile(data, options) {
|
|
769
786
|
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
770
787
|
return {
|
|
771
788
|
error: createError("VALIDATION_ERROR", "data \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059")
|
|
@@ -776,16 +793,22 @@ function createProfileMethods(deps) {
|
|
|
776
793
|
error: createError("VALIDATION_ERROR", "\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044")
|
|
777
794
|
};
|
|
778
795
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
796
|
+
const { override, error } = resolveAuthOverride(options, createError);
|
|
797
|
+
if (error) return { error };
|
|
798
|
+
return fetchWithAuth(
|
|
799
|
+
EXT_PROFILE_ENDPOINT,
|
|
800
|
+
{
|
|
801
|
+
method: "PUT",
|
|
802
|
+
body: JSON.stringify(data)
|
|
803
|
+
},
|
|
804
|
+
override
|
|
805
|
+
);
|
|
783
806
|
}
|
|
784
807
|
return { getProfile, updateProfile };
|
|
785
808
|
}
|
|
786
809
|
|
|
787
810
|
// src/client/version-check.ts
|
|
788
|
-
var SDK_VERSION = "2.
|
|
811
|
+
var SDK_VERSION = "2.15.0";
|
|
789
812
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
790
813
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
791
814
|
function sdkHeaders() {
|
|
@@ -1980,7 +2003,19 @@ function createFFIDClient(config) {
|
|
|
1980
2003
|
function createError(code, message) {
|
|
1981
2004
|
return { code, message };
|
|
1982
2005
|
}
|
|
1983
|
-
function buildFetchOptions(options) {
|
|
2006
|
+
function buildFetchOptions(options, authOverride) {
|
|
2007
|
+
if (authOverride) {
|
|
2008
|
+
return {
|
|
2009
|
+
...options,
|
|
2010
|
+
credentials: "omit",
|
|
2011
|
+
headers: {
|
|
2012
|
+
"Content-Type": "application/json",
|
|
2013
|
+
...sdkHeaders(),
|
|
2014
|
+
...options.headers,
|
|
2015
|
+
Authorization: `Bearer ${authOverride.accessToken}`
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
1984
2019
|
if (authMode === "service-key") {
|
|
1985
2020
|
return {
|
|
1986
2021
|
...options,
|
|
@@ -2027,10 +2062,10 @@ function createFFIDClient(config) {
|
|
|
2027
2062
|
logger,
|
|
2028
2063
|
errorCodes: FFID_ERROR_CODES
|
|
2029
2064
|
});
|
|
2030
|
-
async function fetchWithAuth(endpoint, options = {}) {
|
|
2065
|
+
async function fetchWithAuth(endpoint, options = {}, authOverride) {
|
|
2031
2066
|
const url = `${baseUrl}${endpoint}`;
|
|
2032
2067
|
logger.debug("Fetching:", url);
|
|
2033
|
-
const fetchOptions = buildFetchOptions(options);
|
|
2068
|
+
const fetchOptions = buildFetchOptions(options, authOverride);
|
|
2034
2069
|
let response;
|
|
2035
2070
|
try {
|
|
2036
2071
|
response = await fetch(url, fetchOptions);
|
|
@@ -2043,7 +2078,7 @@ function createFFIDClient(config) {
|
|
|
2043
2078
|
}
|
|
2044
2079
|
};
|
|
2045
2080
|
}
|
|
2046
|
-
if (authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
2081
|
+
if (!authOverride && authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
2047
2082
|
const refreshResult = await refreshAccessToken();
|
|
2048
2083
|
if (!refreshResult.error) {
|
|
2049
2084
|
logger.debug("Token refreshed, retrying request");
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6XEWLARZ_cjs = require('../chunk-6XEWLARZ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDInquiryForm; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDLoginButton; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDOrganizationSwitcher; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDSubscriptionBadge; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDUserMenu; }
|
|
34
34
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { K as FFIDAnnouncementBadge, aj as FFIDAnnouncementBadgeClassNames, ak as FFIDAnnouncementBadgeProps, M as FFIDAnnouncementList, al as FFIDAnnouncementListClassNames, am as FFIDAnnouncementListProps, U as FFIDInquiryForm, V as FFIDInquiryFormCategoryItem, W as FFIDInquiryFormClassNames, X as FFIDInquiryFormOrganization, Y as FFIDInquiryFormPlaceholderContext, Z as FFIDInquiryFormPrefill, _ as FFIDInquiryFormProps, $ as FFIDInquiryFormSubmitData, a0 as FFIDInquiryFormSubmitResult, a2 as FFIDLoginButton, an as FFIDLoginButtonProps, a8 as FFIDOrganizationSwitcher, ao as FFIDOrganizationSwitcherClassNames, ap as FFIDOrganizationSwitcherProps, aa as FFIDSubscriptionBadge, aq as FFIDSubscriptionBadgeClassNames, ar as FFIDSubscriptionBadgeProps, ac as FFIDUserMenu, as as FFIDUserMenuClassNames, at as FFIDUserMenuProps } from '../index-LPTvxtgt.cjs';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { K as FFIDAnnouncementBadge, aj as FFIDAnnouncementBadgeClassNames, ak as FFIDAnnouncementBadgeProps, M as FFIDAnnouncementList, al as FFIDAnnouncementListClassNames, am as FFIDAnnouncementListProps, U as FFIDInquiryForm, V as FFIDInquiryFormCategoryItem, W as FFIDInquiryFormClassNames, X as FFIDInquiryFormOrganization, Y as FFIDInquiryFormPlaceholderContext, Z as FFIDInquiryFormPrefill, _ as FFIDInquiryFormProps, $ as FFIDInquiryFormSubmitData, a0 as FFIDInquiryFormSubmitResult, a2 as FFIDLoginButton, an as FFIDLoginButtonProps, a8 as FFIDOrganizationSwitcher, ao as FFIDOrganizationSwitcherClassNames, ap as FFIDOrganizationSwitcherProps, aa as FFIDSubscriptionBadge, aq as FFIDSubscriptionBadgeClassNames, ar as FFIDSubscriptionBadgeProps, ac as FFIDUserMenu, as as FFIDUserMenuClassNames, at as FFIDUserMenuProps } from '../index-LPTvxtgt.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-
|
|
1
|
+
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-OOGFUCRJ.js';
|
|
@@ -460,6 +460,38 @@ interface FFIDUserProfile {
|
|
|
460
460
|
/** Profile last-updated timestamp (ISO 8601) */
|
|
461
461
|
updatedAt: string;
|
|
462
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* Per-call options for profile methods (`getProfile` / `updateProfile`).
|
|
465
|
+
*
|
|
466
|
+
* Supply `accessToken` to forward an end-user Bearer token for the single call
|
|
467
|
+
* without mutating client-level auth state. Designed for server runtimes (Cloudflare
|
|
468
|
+
* Workers, Edge, Node) that receive a user-scoped Bearer per request and want to
|
|
469
|
+
* act as that user against `/api/v1/users/ext/me`.
|
|
470
|
+
*
|
|
471
|
+
* When `accessToken` is supplied with a non-empty value, it overrides the client's
|
|
472
|
+
* configured auth mode: authentication for that request uses only
|
|
473
|
+
* `Authorization: Bearer <accessToken>` (no service key, no cookie, no token-store
|
|
474
|
+
* lookup, no auto-refresh on 401). Non-auth headers such as `Content-Type` and
|
|
475
|
+
* SDK metadata headers (User-Agent / X-FFID-SDK-Version) are still attached.
|
|
476
|
+
*
|
|
477
|
+
* Runtime semantics:
|
|
478
|
+
* - `accessToken` omitted (or `undefined`) → no override, configured `authMode` is used
|
|
479
|
+
* - `accessToken` is empty string / whitespace-only → rejected as `VALIDATION_ERROR`
|
|
480
|
+
* before any network call (prevents silent impersonation fallback when a caller
|
|
481
|
+
* extracts a missing/blank `Authorization` header into this field)
|
|
482
|
+
* - `accessToken` is a non-empty string → override activated
|
|
483
|
+
*/
|
|
484
|
+
interface FFIDProfileCallOptions {
|
|
485
|
+
/**
|
|
486
|
+
* End-user Bearer token forwarded for this single request.
|
|
487
|
+
*
|
|
488
|
+
* Must be a non-empty string when supplied. Passing `''` or a whitespace-only
|
|
489
|
+
* string is treated as a caller error and surfaces as `VALIDATION_ERROR` —
|
|
490
|
+
* this guards against the common footgun where a server runtime extracts the
|
|
491
|
+
* Bearer from an incoming request without checking the header is present.
|
|
492
|
+
*/
|
|
493
|
+
accessToken?: string;
|
|
494
|
+
}
|
|
463
495
|
/**
|
|
464
496
|
* Request payload for `updateProfile`.
|
|
465
497
|
*
|
|
@@ -1229,4 +1261,4 @@ interface FFIDInquiryFormPlaceholderContext {
|
|
|
1229
1261
|
}
|
|
1230
1262
|
declare function FFIDInquiryForm({ mode, prefill, organizations, preselectedOrganizationId, categories, termsVersion, privacyVersion, termsHref, privacyHref, turnstileToken, turnstileSlot, onSubmit, onChange, separateLegalCheckboxes, messagePlaceholder, requireCategorySelection, unstyled, classNames, locale, className, }: FFIDInquiryFormProps): react_jsx_runtime.JSX.Element;
|
|
1231
1263
|
|
|
1232
|
-
export { type
|
|
1264
|
+
export { type FFIDInquiryFormSubmitData as $, type FFIDSubscription as A, type FFIDSubscriptionContextValue as B, type FFIDAnnouncementsClientConfig as C, type FFIDAnnouncementsApiResponse as D, type AnnouncementListResponse as E, type FFIDSubscriptionStatus as F, type FFIDAnnouncementsLogger as G, type Announcement as H, type AnnouncementStatus as I, type AnnouncementType as J, FFIDAnnouncementBadge as K, type ListAnnouncementsOptions as L, FFIDAnnouncementList as M, type FFIDAnnouncementsError as N, type FFIDAnnouncementsErrorCode as O, type FFIDAnnouncementsServerResponse as P, type FFIDCacheConfig as Q, type FFIDContextValue as R, type FFIDInquiryCategory as S, type FFIDInquiryCategorySite2026 as T, FFIDInquiryForm as U, type FFIDInquiryFormCategoryItem as V, type FFIDInquiryFormClassNames as W, type FFIDInquiryFormOrganization as X, type FFIDInquiryFormPlaceholderContext as Y, type FFIDInquiryFormPrefill as Z, type FFIDInquiryFormProps as _, type FFIDConfig as a, type FFIDInquiryFormSubmitResult as a0, type FFIDJwtClaims as a1, FFIDLoginButton as a2, type FFIDMemberStatus as a3, type FFIDOAuthTokenResponse as a4, type FFIDOAuthUserInfoMemberRole as a5, type FFIDOAuthUserInfoSubscription as a6, type FFIDOrganizationMember as a7, FFIDOrganizationSwitcher as a8, type FFIDSeatModel as a9, FFIDSubscriptionBadge as aa, type FFIDTokenIntrospectionResponse as ab, FFIDUserMenu as ac, FFID_INQUIRY_CATEGORIES as ad, FFID_INQUIRY_CATEGORIES_SITE_2026 as ae, type UseFFIDAnnouncementsOptions as af, type UseFFIDAnnouncementsReturn as ag, isFFIDInquiryCategorySite2026 as ah, useFFIDAnnouncements as ai, type FFIDAnnouncementBadgeClassNames as aj, type FFIDAnnouncementBadgeProps as ak, type FFIDAnnouncementListClassNames as al, type FFIDAnnouncementListProps as am, type FFIDLoginButtonProps as an, type FFIDOrganizationSwitcherClassNames as ao, type FFIDOrganizationSwitcherProps as ap, type FFIDSubscriptionBadgeClassNames as aq, type FFIDSubscriptionBadgeProps as ar, type FFIDUserMenuClassNames as as, type FFIDUserMenuProps as at, type FFIDApiResponse as b, type FFIDSessionResponse as c, type FFIDRedirectResult as d, type FFIDError as e, type FFIDSubscriptionCheckResponse as f, type FFIDListMembersResponse as g, type FFIDMemberRole as h, type FFIDUpdateMemberRoleResponse as i, type FFIDRemoveMemberResponse as j, type FFIDProfileCallOptions as k, type FFIDUserProfile as l, type FFIDUpdateUserProfileRequest as m, type FFIDCreateCheckoutParams as n, type FFIDCheckoutSessionResponse as o, type FFIDCreatePortalParams as p, type FFIDPortalSessionResponse as q, type FFIDVerifyAccessTokenOptions as r, type FFIDOAuthUserInfo as s, type FFIDInquiryCreateParams as t, type FFIDInquiryCreateResponse as u, type FFIDAuthMode as v, type FFIDLogger as w, type FFIDCacheAdapter as x, type FFIDUser as y, type FFIDOrganization as z };
|
|
@@ -460,6 +460,38 @@ interface FFIDUserProfile {
|
|
|
460
460
|
/** Profile last-updated timestamp (ISO 8601) */
|
|
461
461
|
updatedAt: string;
|
|
462
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* Per-call options for profile methods (`getProfile` / `updateProfile`).
|
|
465
|
+
*
|
|
466
|
+
* Supply `accessToken` to forward an end-user Bearer token for the single call
|
|
467
|
+
* without mutating client-level auth state. Designed for server runtimes (Cloudflare
|
|
468
|
+
* Workers, Edge, Node) that receive a user-scoped Bearer per request and want to
|
|
469
|
+
* act as that user against `/api/v1/users/ext/me`.
|
|
470
|
+
*
|
|
471
|
+
* When `accessToken` is supplied with a non-empty value, it overrides the client's
|
|
472
|
+
* configured auth mode: authentication for that request uses only
|
|
473
|
+
* `Authorization: Bearer <accessToken>` (no service key, no cookie, no token-store
|
|
474
|
+
* lookup, no auto-refresh on 401). Non-auth headers such as `Content-Type` and
|
|
475
|
+
* SDK metadata headers (User-Agent / X-FFID-SDK-Version) are still attached.
|
|
476
|
+
*
|
|
477
|
+
* Runtime semantics:
|
|
478
|
+
* - `accessToken` omitted (or `undefined`) → no override, configured `authMode` is used
|
|
479
|
+
* - `accessToken` is empty string / whitespace-only → rejected as `VALIDATION_ERROR`
|
|
480
|
+
* before any network call (prevents silent impersonation fallback when a caller
|
|
481
|
+
* extracts a missing/blank `Authorization` header into this field)
|
|
482
|
+
* - `accessToken` is a non-empty string → override activated
|
|
483
|
+
*/
|
|
484
|
+
interface FFIDProfileCallOptions {
|
|
485
|
+
/**
|
|
486
|
+
* End-user Bearer token forwarded for this single request.
|
|
487
|
+
*
|
|
488
|
+
* Must be a non-empty string when supplied. Passing `''` or a whitespace-only
|
|
489
|
+
* string is treated as a caller error and surfaces as `VALIDATION_ERROR` —
|
|
490
|
+
* this guards against the common footgun where a server runtime extracts the
|
|
491
|
+
* Bearer from an incoming request without checking the header is present.
|
|
492
|
+
*/
|
|
493
|
+
accessToken?: string;
|
|
494
|
+
}
|
|
463
495
|
/**
|
|
464
496
|
* Request payload for `updateProfile`.
|
|
465
497
|
*
|
|
@@ -1229,4 +1261,4 @@ interface FFIDInquiryFormPlaceholderContext {
|
|
|
1229
1261
|
}
|
|
1230
1262
|
declare function FFIDInquiryForm({ mode, prefill, organizations, preselectedOrganizationId, categories, termsVersion, privacyVersion, termsHref, privacyHref, turnstileToken, turnstileSlot, onSubmit, onChange, separateLegalCheckboxes, messagePlaceholder, requireCategorySelection, unstyled, classNames, locale, className, }: FFIDInquiryFormProps): react_jsx_runtime.JSX.Element;
|
|
1231
1263
|
|
|
1232
|
-
export { type
|
|
1264
|
+
export { type FFIDInquiryFormSubmitData as $, type FFIDSubscription as A, type FFIDSubscriptionContextValue as B, type FFIDAnnouncementsClientConfig as C, type FFIDAnnouncementsApiResponse as D, type AnnouncementListResponse as E, type FFIDSubscriptionStatus as F, type FFIDAnnouncementsLogger as G, type Announcement as H, type AnnouncementStatus as I, type AnnouncementType as J, FFIDAnnouncementBadge as K, type ListAnnouncementsOptions as L, FFIDAnnouncementList as M, type FFIDAnnouncementsError as N, type FFIDAnnouncementsErrorCode as O, type FFIDAnnouncementsServerResponse as P, type FFIDCacheConfig as Q, type FFIDContextValue as R, type FFIDInquiryCategory as S, type FFIDInquiryCategorySite2026 as T, FFIDInquiryForm as U, type FFIDInquiryFormCategoryItem as V, type FFIDInquiryFormClassNames as W, type FFIDInquiryFormOrganization as X, type FFIDInquiryFormPlaceholderContext as Y, type FFIDInquiryFormPrefill as Z, type FFIDInquiryFormProps as _, type FFIDConfig as a, type FFIDInquiryFormSubmitResult as a0, type FFIDJwtClaims as a1, FFIDLoginButton as a2, type FFIDMemberStatus as a3, type FFIDOAuthTokenResponse as a4, type FFIDOAuthUserInfoMemberRole as a5, type FFIDOAuthUserInfoSubscription as a6, type FFIDOrganizationMember as a7, FFIDOrganizationSwitcher as a8, type FFIDSeatModel as a9, FFIDSubscriptionBadge as aa, type FFIDTokenIntrospectionResponse as ab, FFIDUserMenu as ac, FFID_INQUIRY_CATEGORIES as ad, FFID_INQUIRY_CATEGORIES_SITE_2026 as ae, type UseFFIDAnnouncementsOptions as af, type UseFFIDAnnouncementsReturn as ag, isFFIDInquiryCategorySite2026 as ah, useFFIDAnnouncements as ai, type FFIDAnnouncementBadgeClassNames as aj, type FFIDAnnouncementBadgeProps as ak, type FFIDAnnouncementListClassNames as al, type FFIDAnnouncementListProps as am, type FFIDLoginButtonProps as an, type FFIDOrganizationSwitcherClassNames as ao, type FFIDOrganizationSwitcherProps as ap, type FFIDSubscriptionBadgeClassNames as aq, type FFIDSubscriptionBadgeProps as ar, type FFIDUserMenuClassNames as as, type FFIDUserMenuProps as at, type FFIDApiResponse as b, type FFIDSessionResponse as c, type FFIDRedirectResult as d, type FFIDError as e, type FFIDSubscriptionCheckResponse as f, type FFIDListMembersResponse as g, type FFIDMemberRole as h, type FFIDUpdateMemberRoleResponse as i, type FFIDRemoveMemberResponse as j, type FFIDProfileCallOptions as k, type FFIDUserProfile as l, type FFIDUpdateUserProfileRequest as m, type FFIDCreateCheckoutParams as n, type FFIDCheckoutSessionResponse as o, type FFIDCreatePortalParams as p, type FFIDPortalSessionResponse as q, type FFIDVerifyAccessTokenOptions as r, type FFIDOAuthUserInfo as s, type FFIDInquiryCreateParams as t, type FFIDInquiryCreateResponse as u, type FFIDAuthMode as v, type FFIDLogger as w, type FFIDCacheAdapter as x, type FFIDUser as y, type FFIDOrganization as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6XEWLARZ_cjs = require('./chunk-6XEWLARZ.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ function createKVCacheAdapter(kv) {
|
|
|
46
46
|
}
|
|
47
47
|
function withFFIDAuth(Component, options = {}) {
|
|
48
48
|
const WrappedComponent = (props) => {
|
|
49
|
-
const { isLoading, isAuthenticated, login } =
|
|
49
|
+
const { isLoading, isAuthenticated, login } = chunk6XEWLARZ_cjs.useFFIDContext();
|
|
50
50
|
const hasRedirected = react.useRef(false);
|
|
51
51
|
react.useEffect(() => {
|
|
52
52
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -74,107 +74,107 @@ var FFID_NEWSLETTER_TYPES = ["inquiry_followup", "general"];
|
|
|
74
74
|
|
|
75
75
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunk6XEWLARZ_cjs.DEFAULT_API_BASE_URL; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDAnnouncementBadge; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDAnnouncementList; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDInquiryForm; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDLoginButton; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDOrganizationSwitcher; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDProvider; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "FFIDSDKError", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDSDKError; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDSubscriptionBadge; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunk6XEWLARZ_cjs.FFIDUserMenu; }
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunk6XEWLARZ_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunk6XEWLARZ_cjs.FFID_INQUIRY_CATEGORIES; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES_SITE_2026", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunk6XEWLARZ_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunk6XEWLARZ_cjs.createFFIDAnnouncementsClient; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunk6XEWLARZ_cjs.createFFIDClient; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "createTokenStore", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunk6XEWLARZ_cjs.createTokenStore; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunk6XEWLARZ_cjs.generateCodeChallenge; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunk6XEWLARZ_cjs.generateCodeVerifier; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "isFFIDInquiryCategorySite2026", {
|
|
148
148
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunk6XEWLARZ_cjs.isFFIDInquiryCategorySite2026; }
|
|
150
150
|
});
|
|
151
151
|
Object.defineProperty(exports, "normalizeRedirectUri", {
|
|
152
152
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunk6XEWLARZ_cjs.normalizeRedirectUri; }
|
|
154
154
|
});
|
|
155
155
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
156
156
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunk6XEWLARZ_cjs.retrieveCodeVerifier; }
|
|
158
158
|
});
|
|
159
159
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
160
160
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunk6XEWLARZ_cjs.storeCodeVerifier; }
|
|
162
162
|
});
|
|
163
163
|
Object.defineProperty(exports, "useFFID", {
|
|
164
164
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunk6XEWLARZ_cjs.useFFID; }
|
|
166
166
|
});
|
|
167
167
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
168
168
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunk6XEWLARZ_cjs.useFFIDAnnouncements; }
|
|
170
170
|
});
|
|
171
171
|
Object.defineProperty(exports, "useSubscription", {
|
|
172
172
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunk6XEWLARZ_cjs.useSubscription; }
|
|
174
174
|
});
|
|
175
175
|
Object.defineProperty(exports, "withSubscription", {
|
|
176
176
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
177
|
+
get: function () { return chunk6XEWLARZ_cjs.withSubscription; }
|
|
178
178
|
});
|
|
179
179
|
exports.FFID_NEWSLETTER_TYPES = FFID_NEWSLETTER_TYPES;
|
|
180
180
|
exports.createKVCacheAdapter = createKVCacheAdapter;
|
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
|
|
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 FFIDCreateCheckoutParams, o as FFIDCheckoutSessionResponse, p as FFIDCreatePortalParams, q as FFIDPortalSessionResponse, r as FFIDVerifyAccessTokenOptions, s as FFIDOAuthUserInfo, t as FFIDInquiryCreateParams, u as FFIDInquiryCreateResponse, v as FFIDAuthMode, w as FFIDLogger, x as FFIDCacheAdapter, y as FFIDUser, z as FFIDOrganization, A as FFIDSubscription, B as FFIDSubscriptionContextValue, C as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, D as FFIDAnnouncementsApiResponse, E as AnnouncementListResponse, G as FFIDAnnouncementsLogger } from './index-LPTvxtgt.cjs';
|
|
2
|
+
export { H as Announcement, I as AnnouncementStatus, J as AnnouncementType, K as FFIDAnnouncementBadge, M as FFIDAnnouncementList, N as FFIDAnnouncementsError, O as FFIDAnnouncementsErrorCode, P as FFIDAnnouncementsServerResponse, Q as FFIDCacheConfig, R as FFIDContextValue, S as FFIDInquiryCategory, T as FFIDInquiryCategorySite2026, U as FFIDInquiryForm, V as FFIDInquiryFormCategoryItem, W as FFIDInquiryFormClassNames, X as FFIDInquiryFormOrganization, Y as FFIDInquiryFormPlaceholderContext, Z as FFIDInquiryFormPrefill, _ as FFIDInquiryFormProps, $ as FFIDInquiryFormSubmitData, a0 as FFIDInquiryFormSubmitResult, a1 as FFIDJwtClaims, a2 as FFIDLoginButton, a3 as FFIDMemberStatus, a4 as FFIDOAuthTokenResponse, a5 as FFIDOAuthUserInfoMemberRole, a6 as FFIDOAuthUserInfoSubscription, a7 as FFIDOrganizationMember, a8 as FFIDOrganizationSwitcher, a9 as FFIDSeatModel, aa as FFIDSubscriptionBadge, ab as FFIDTokenIntrospectionResponse, ac as FFIDUserMenu, ad as FFID_INQUIRY_CATEGORIES, ae as FFID_INQUIRY_CATEGORIES_SITE_2026, af as UseFFIDAnnouncementsOptions, ag as UseFFIDAnnouncementsReturn, ah as isFFIDInquiryCategorySite2026, ai as useFFIDAnnouncements } from './index-LPTvxtgt.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -500,8 +500,8 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
500
500
|
organizationId: string;
|
|
501
501
|
userId: string;
|
|
502
502
|
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
503
|
-
getProfile: () => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
504
|
-
updateProfile: (data: FFIDUpdateUserProfileRequest) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
503
|
+
getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
504
|
+
updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
505
505
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
506
506
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
507
507
|
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
@@ -934,4 +934,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
934
934
|
};
|
|
935
935
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
936
936
|
|
|
937
|
-
export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, 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, 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, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_NEWSLETTER_TYPES, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
|
937
|
+
export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, 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 WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, 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
|
|
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 FFIDCreateCheckoutParams, o as FFIDCheckoutSessionResponse, p as FFIDCreatePortalParams, q as FFIDPortalSessionResponse, r as FFIDVerifyAccessTokenOptions, s as FFIDOAuthUserInfo, t as FFIDInquiryCreateParams, u as FFIDInquiryCreateResponse, v as FFIDAuthMode, w as FFIDLogger, x as FFIDCacheAdapter, y as FFIDUser, z as FFIDOrganization, A as FFIDSubscription, B as FFIDSubscriptionContextValue, C as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, D as FFIDAnnouncementsApiResponse, E as AnnouncementListResponse, G as FFIDAnnouncementsLogger } from './index-LPTvxtgt.js';
|
|
2
|
+
export { H as Announcement, I as AnnouncementStatus, J as AnnouncementType, K as FFIDAnnouncementBadge, M as FFIDAnnouncementList, N as FFIDAnnouncementsError, O as FFIDAnnouncementsErrorCode, P as FFIDAnnouncementsServerResponse, Q as FFIDCacheConfig, R as FFIDContextValue, S as FFIDInquiryCategory, T as FFIDInquiryCategorySite2026, U as FFIDInquiryForm, V as FFIDInquiryFormCategoryItem, W as FFIDInquiryFormClassNames, X as FFIDInquiryFormOrganization, Y as FFIDInquiryFormPlaceholderContext, Z as FFIDInquiryFormPrefill, _ as FFIDInquiryFormProps, $ as FFIDInquiryFormSubmitData, a0 as FFIDInquiryFormSubmitResult, a1 as FFIDJwtClaims, a2 as FFIDLoginButton, a3 as FFIDMemberStatus, a4 as FFIDOAuthTokenResponse, a5 as FFIDOAuthUserInfoMemberRole, a6 as FFIDOAuthUserInfoSubscription, a7 as FFIDOrganizationMember, a8 as FFIDOrganizationSwitcher, a9 as FFIDSeatModel, aa as FFIDSubscriptionBadge, ab as FFIDTokenIntrospectionResponse, ac as FFIDUserMenu, ad as FFID_INQUIRY_CATEGORIES, ae as FFID_INQUIRY_CATEGORIES_SITE_2026, af as UseFFIDAnnouncementsOptions, ag as UseFFIDAnnouncementsReturn, ah as isFFIDInquiryCategorySite2026, ai as useFFIDAnnouncements } from './index-LPTvxtgt.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -500,8 +500,8 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
500
500
|
organizationId: string;
|
|
501
501
|
userId: string;
|
|
502
502
|
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
503
|
-
getProfile: () => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
504
|
-
updateProfile: (data: FFIDUpdateUserProfileRequest) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
503
|
+
getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
504
|
+
updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
505
505
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
506
506
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
507
507
|
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
@@ -934,4 +934,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
|
|
|
934
934
|
};
|
|
935
935
|
type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
|
|
936
936
|
|
|
937
|
-
export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, 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, 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, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_NEWSLETTER_TYPES, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
|
937
|
+
export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, 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 WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFFIDContext } from './chunk-
|
|
2
|
-
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-
|
|
1
|
+
import { useFFIDContext } from './chunk-OOGFUCRJ.js';
|
|
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, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-OOGFUCRJ.js';
|
|
3
3
|
import { useRef, useEffect } from 'react';
|
|
4
4
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
package/dist/server/index.cjs
CHANGED
|
@@ -758,12 +758,29 @@ function createMembersMethods(deps) {
|
|
|
758
758
|
|
|
759
759
|
// src/client/profile-methods.ts
|
|
760
760
|
var EXT_PROFILE_ENDPOINT = "/api/v1/users/ext/me";
|
|
761
|
+
function resolveAuthOverride(options, createError) {
|
|
762
|
+
if (!options || options.accessToken === void 0) {
|
|
763
|
+
return {};
|
|
764
|
+
}
|
|
765
|
+
const token = options.accessToken;
|
|
766
|
+
if (typeof token !== "string" || token.trim() === "") {
|
|
767
|
+
return {
|
|
768
|
+
error: createError(
|
|
769
|
+
"VALIDATION_ERROR",
|
|
770
|
+
"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"
|
|
771
|
+
)
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
return { override: { accessToken: token } };
|
|
775
|
+
}
|
|
761
776
|
function createProfileMethods(deps) {
|
|
762
777
|
const { fetchWithAuth, createError } = deps;
|
|
763
|
-
async function getProfile() {
|
|
764
|
-
|
|
778
|
+
async function getProfile(options) {
|
|
779
|
+
const { override, error } = resolveAuthOverride(options, createError);
|
|
780
|
+
if (error) return { error };
|
|
781
|
+
return fetchWithAuth(EXT_PROFILE_ENDPOINT, void 0, override);
|
|
765
782
|
}
|
|
766
|
-
async function updateProfile(data) {
|
|
783
|
+
async function updateProfile(data, options) {
|
|
767
784
|
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
768
785
|
return {
|
|
769
786
|
error: createError("VALIDATION_ERROR", "data \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059")
|
|
@@ -774,16 +791,22 @@ function createProfileMethods(deps) {
|
|
|
774
791
|
error: createError("VALIDATION_ERROR", "\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044")
|
|
775
792
|
};
|
|
776
793
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
794
|
+
const { override, error } = resolveAuthOverride(options, createError);
|
|
795
|
+
if (error) return { error };
|
|
796
|
+
return fetchWithAuth(
|
|
797
|
+
EXT_PROFILE_ENDPOINT,
|
|
798
|
+
{
|
|
799
|
+
method: "PUT",
|
|
800
|
+
body: JSON.stringify(data)
|
|
801
|
+
},
|
|
802
|
+
override
|
|
803
|
+
);
|
|
781
804
|
}
|
|
782
805
|
return { getProfile, updateProfile };
|
|
783
806
|
}
|
|
784
807
|
|
|
785
808
|
// src/client/version-check.ts
|
|
786
|
-
var SDK_VERSION = "2.
|
|
809
|
+
var SDK_VERSION = "2.15.0";
|
|
787
810
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
788
811
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
789
812
|
function sdkHeaders() {
|
|
@@ -1965,7 +1988,19 @@ function createFFIDClient(config) {
|
|
|
1965
1988
|
function createError(code, message) {
|
|
1966
1989
|
return { code, message };
|
|
1967
1990
|
}
|
|
1968
|
-
function buildFetchOptions(options) {
|
|
1991
|
+
function buildFetchOptions(options, authOverride) {
|
|
1992
|
+
if (authOverride) {
|
|
1993
|
+
return {
|
|
1994
|
+
...options,
|
|
1995
|
+
credentials: "omit",
|
|
1996
|
+
headers: {
|
|
1997
|
+
"Content-Type": "application/json",
|
|
1998
|
+
...sdkHeaders(),
|
|
1999
|
+
...options.headers,
|
|
2000
|
+
Authorization: `Bearer ${authOverride.accessToken}`
|
|
2001
|
+
}
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
1969
2004
|
if (authMode === "service-key") {
|
|
1970
2005
|
return {
|
|
1971
2006
|
...options,
|
|
@@ -2012,10 +2047,10 @@ function createFFIDClient(config) {
|
|
|
2012
2047
|
logger,
|
|
2013
2048
|
errorCodes: FFID_ERROR_CODES
|
|
2014
2049
|
});
|
|
2015
|
-
async function fetchWithAuth(endpoint, options = {}) {
|
|
2050
|
+
async function fetchWithAuth(endpoint, options = {}, authOverride) {
|
|
2016
2051
|
const url = `${baseUrl}${endpoint}`;
|
|
2017
2052
|
logger.debug("Fetching:", url);
|
|
2018
|
-
const fetchOptions = buildFetchOptions(options);
|
|
2053
|
+
const fetchOptions = buildFetchOptions(options, authOverride);
|
|
2019
2054
|
let response;
|
|
2020
2055
|
try {
|
|
2021
2056
|
response = await fetch(url, fetchOptions);
|
|
@@ -2028,7 +2063,7 @@ function createFFIDClient(config) {
|
|
|
2028
2063
|
}
|
|
2029
2064
|
};
|
|
2030
2065
|
}
|
|
2031
|
-
if (authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
2066
|
+
if (!authOverride && authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
2032
2067
|
const refreshResult = await refreshAccessToken();
|
|
2033
2068
|
if (!refreshResult.error) {
|
|
2034
2069
|
logger.debug("Token refreshed, retrying request");
|
package/dist/server/index.d.cts
CHANGED
|
@@ -814,6 +814,38 @@ interface FFIDUserProfile {
|
|
|
814
814
|
/** Profile last-updated timestamp (ISO 8601) */
|
|
815
815
|
updatedAt: string;
|
|
816
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` and
|
|
829
|
+
* SDK metadata headers (User-Agent / X-FFID-SDK-Version) are still attached.
|
|
830
|
+
*
|
|
831
|
+
* Runtime semantics:
|
|
832
|
+
* - `accessToken` omitted (or `undefined`) → no override, configured `authMode` is used
|
|
833
|
+
* - `accessToken` is empty string / whitespace-only → rejected as `VALIDATION_ERROR`
|
|
834
|
+
* before any network call (prevents silent impersonation fallback when a caller
|
|
835
|
+
* extracts a missing/blank `Authorization` header into this field)
|
|
836
|
+
* - `accessToken` is a non-empty string → override activated
|
|
837
|
+
*/
|
|
838
|
+
interface FFIDProfileCallOptions {
|
|
839
|
+
/**
|
|
840
|
+
* End-user Bearer token forwarded for this single request.
|
|
841
|
+
*
|
|
842
|
+
* Must be a non-empty string when supplied. Passing `''` or a whitespace-only
|
|
843
|
+
* string is treated as a caller error and surfaces as `VALIDATION_ERROR` —
|
|
844
|
+
* this guards against the common footgun where a server runtime extracts the
|
|
845
|
+
* Bearer from an incoming request without checking the header is present.
|
|
846
|
+
*/
|
|
847
|
+
accessToken?: string;
|
|
848
|
+
}
|
|
817
849
|
/**
|
|
818
850
|
* Request payload for `updateProfile`.
|
|
819
851
|
*
|
|
@@ -992,8 +1024,8 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
992
1024
|
organizationId: string;
|
|
993
1025
|
userId: string;
|
|
994
1026
|
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
995
|
-
getProfile: () => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
996
|
-
updateProfile: (data: FFIDUpdateUserProfileRequest) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
1027
|
+
getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
1028
|
+
updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
997
1029
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
998
1030
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
999
1031
|
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
@@ -1104,4 +1136,4 @@ interface KVNamespaceLike {
|
|
|
1104
1136
|
*/
|
|
1105
1137
|
declare function createKVCacheAdapter(kv: KVNamespaceLike): FFIDCacheAdapter;
|
|
1106
1138
|
|
|
1107
|
-
export { type FFIDCacheAdapter, type FFIDCacheConfig, type FFIDClient, type FFIDConfig, type FFIDOAuthUserInfo, type FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDResetSessionResponse, type FFIDSubscription, type FFIDUser, type FFIDVerifyAccessTokenOptions, type KVNamespaceLike, type TokenData, type TokenStore, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, createVerifyAccessToken };
|
|
1139
|
+
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 };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -814,6 +814,38 @@ interface FFIDUserProfile {
|
|
|
814
814
|
/** Profile last-updated timestamp (ISO 8601) */
|
|
815
815
|
updatedAt: string;
|
|
816
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` and
|
|
829
|
+
* SDK metadata headers (User-Agent / X-FFID-SDK-Version) are still attached.
|
|
830
|
+
*
|
|
831
|
+
* Runtime semantics:
|
|
832
|
+
* - `accessToken` omitted (or `undefined`) → no override, configured `authMode` is used
|
|
833
|
+
* - `accessToken` is empty string / whitespace-only → rejected as `VALIDATION_ERROR`
|
|
834
|
+
* before any network call (prevents silent impersonation fallback when a caller
|
|
835
|
+
* extracts a missing/blank `Authorization` header into this field)
|
|
836
|
+
* - `accessToken` is a non-empty string → override activated
|
|
837
|
+
*/
|
|
838
|
+
interface FFIDProfileCallOptions {
|
|
839
|
+
/**
|
|
840
|
+
* End-user Bearer token forwarded for this single request.
|
|
841
|
+
*
|
|
842
|
+
* Must be a non-empty string when supplied. Passing `''` or a whitespace-only
|
|
843
|
+
* string is treated as a caller error and surfaces as `VALIDATION_ERROR` —
|
|
844
|
+
* this guards against the common footgun where a server runtime extracts the
|
|
845
|
+
* Bearer from an incoming request without checking the header is present.
|
|
846
|
+
*/
|
|
847
|
+
accessToken?: string;
|
|
848
|
+
}
|
|
817
849
|
/**
|
|
818
850
|
* Request payload for `updateProfile`.
|
|
819
851
|
*
|
|
@@ -992,8 +1024,8 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
992
1024
|
organizationId: string;
|
|
993
1025
|
userId: string;
|
|
994
1026
|
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
995
|
-
getProfile: () => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
996
|
-
updateProfile: (data: FFIDUpdateUserProfileRequest) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
1027
|
+
getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
1028
|
+
updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
997
1029
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
998
1030
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
999
1031
|
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
@@ -1104,4 +1136,4 @@ interface KVNamespaceLike {
|
|
|
1104
1136
|
*/
|
|
1105
1137
|
declare function createKVCacheAdapter(kv: KVNamespaceLike): FFIDCacheAdapter;
|
|
1106
1138
|
|
|
1107
|
-
export { type FFIDCacheAdapter, type FFIDCacheConfig, type FFIDClient, type FFIDConfig, type FFIDOAuthUserInfo, type FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDResetSessionResponse, type FFIDSubscription, type FFIDUser, type FFIDVerifyAccessTokenOptions, type KVNamespaceLike, type TokenData, type TokenStore, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, createVerifyAccessToken };
|
|
1139
|
+
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 };
|
package/dist/server/index.js
CHANGED
|
@@ -757,12 +757,29 @@ function createMembersMethods(deps) {
|
|
|
757
757
|
|
|
758
758
|
// src/client/profile-methods.ts
|
|
759
759
|
var EXT_PROFILE_ENDPOINT = "/api/v1/users/ext/me";
|
|
760
|
+
function resolveAuthOverride(options, createError) {
|
|
761
|
+
if (!options || options.accessToken === void 0) {
|
|
762
|
+
return {};
|
|
763
|
+
}
|
|
764
|
+
const token = options.accessToken;
|
|
765
|
+
if (typeof token !== "string" || token.trim() === "") {
|
|
766
|
+
return {
|
|
767
|
+
error: createError(
|
|
768
|
+
"VALIDATION_ERROR",
|
|
769
|
+
"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"
|
|
770
|
+
)
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
return { override: { accessToken: token } };
|
|
774
|
+
}
|
|
760
775
|
function createProfileMethods(deps) {
|
|
761
776
|
const { fetchWithAuth, createError } = deps;
|
|
762
|
-
async function getProfile() {
|
|
763
|
-
|
|
777
|
+
async function getProfile(options) {
|
|
778
|
+
const { override, error } = resolveAuthOverride(options, createError);
|
|
779
|
+
if (error) return { error };
|
|
780
|
+
return fetchWithAuth(EXT_PROFILE_ENDPOINT, void 0, override);
|
|
764
781
|
}
|
|
765
|
-
async function updateProfile(data) {
|
|
782
|
+
async function updateProfile(data, options) {
|
|
766
783
|
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
767
784
|
return {
|
|
768
785
|
error: createError("VALIDATION_ERROR", "data \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059")
|
|
@@ -773,16 +790,22 @@ function createProfileMethods(deps) {
|
|
|
773
790
|
error: createError("VALIDATION_ERROR", "\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044")
|
|
774
791
|
};
|
|
775
792
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
793
|
+
const { override, error } = resolveAuthOverride(options, createError);
|
|
794
|
+
if (error) return { error };
|
|
795
|
+
return fetchWithAuth(
|
|
796
|
+
EXT_PROFILE_ENDPOINT,
|
|
797
|
+
{
|
|
798
|
+
method: "PUT",
|
|
799
|
+
body: JSON.stringify(data)
|
|
800
|
+
},
|
|
801
|
+
override
|
|
802
|
+
);
|
|
780
803
|
}
|
|
781
804
|
return { getProfile, updateProfile };
|
|
782
805
|
}
|
|
783
806
|
|
|
784
807
|
// src/client/version-check.ts
|
|
785
|
-
var SDK_VERSION = "2.
|
|
808
|
+
var SDK_VERSION = "2.15.0";
|
|
786
809
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
787
810
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
788
811
|
function sdkHeaders() {
|
|
@@ -1964,7 +1987,19 @@ function createFFIDClient(config) {
|
|
|
1964
1987
|
function createError(code, message) {
|
|
1965
1988
|
return { code, message };
|
|
1966
1989
|
}
|
|
1967
|
-
function buildFetchOptions(options) {
|
|
1990
|
+
function buildFetchOptions(options, authOverride) {
|
|
1991
|
+
if (authOverride) {
|
|
1992
|
+
return {
|
|
1993
|
+
...options,
|
|
1994
|
+
credentials: "omit",
|
|
1995
|
+
headers: {
|
|
1996
|
+
"Content-Type": "application/json",
|
|
1997
|
+
...sdkHeaders(),
|
|
1998
|
+
...options.headers,
|
|
1999
|
+
Authorization: `Bearer ${authOverride.accessToken}`
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
2002
|
+
}
|
|
1968
2003
|
if (authMode === "service-key") {
|
|
1969
2004
|
return {
|
|
1970
2005
|
...options,
|
|
@@ -2011,10 +2046,10 @@ function createFFIDClient(config) {
|
|
|
2011
2046
|
logger,
|
|
2012
2047
|
errorCodes: FFID_ERROR_CODES
|
|
2013
2048
|
});
|
|
2014
|
-
async function fetchWithAuth(endpoint, options = {}) {
|
|
2049
|
+
async function fetchWithAuth(endpoint, options = {}, authOverride) {
|
|
2015
2050
|
const url = `${baseUrl}${endpoint}`;
|
|
2016
2051
|
logger.debug("Fetching:", url);
|
|
2017
|
-
const fetchOptions = buildFetchOptions(options);
|
|
2052
|
+
const fetchOptions = buildFetchOptions(options, authOverride);
|
|
2018
2053
|
let response;
|
|
2019
2054
|
try {
|
|
2020
2055
|
response = await fetch(url, fetchOptions);
|
|
@@ -2027,7 +2062,7 @@ function createFFIDClient(config) {
|
|
|
2027
2062
|
}
|
|
2028
2063
|
};
|
|
2029
2064
|
}
|
|
2030
|
-
if (authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
2065
|
+
if (!authOverride && authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
2031
2066
|
const refreshResult = await refreshAccessToken();
|
|
2032
2067
|
if (!refreshResult.error) {
|
|
2033
2068
|
logger.debug("Token refreshed, retrying request");
|