@feelflow/ffid-sdk 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/dist/{chunk-424GEJSP.js → chunk-4IWCKZJV.js} +47 -12
- package/dist/{chunk-KMGY6PQY.cjs → chunk-PA6S2M7C.cjs} +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-DbEyptzr.d.cts} +65 -15
- package/dist/{index-DT3wF1vZ.d.ts → index-DbEyptzr.d.ts} +65 -15
- 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 +67 -17
- package/dist/server/index.d.ts +67 -17
- package/dist/server/index.js +47 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -266,6 +266,28 @@ const { data: updated, error: updateError } = await client.updateProfile({
|
|
|
266
266
|
|
|
267
267
|
`updateProfile` に空オブジェクト `{}` を渡すと `VALIDATION_ERROR` が返ります(無意味なラウンドトリップを防止)。
|
|
268
268
|
|
|
269
|
+
#### フィールドのクリア(null を渡す)
|
|
270
|
+
|
|
271
|
+
optional フィールドに `null` を渡すと、FFID backend 側で該当カラムを SQL NULL にクリアします(v2.16.0〜 / #2354)。
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
// 会社名と部署をクリア
|
|
275
|
+
await client.updateProfile({
|
|
276
|
+
companyName: null,
|
|
277
|
+
department: null,
|
|
278
|
+
})
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
値のセマンティクス:
|
|
282
|
+
|
|
283
|
+
| 渡す値 | FFID backend の挙動 |
|
|
284
|
+
| --- | --- |
|
|
285
|
+
| `undefined` / キー未指定 | 未変更(partial update) |
|
|
286
|
+
| `null` | クリア(SQL NULL を書き込む) |
|
|
287
|
+
| `""`(空文字列) | 空文字リテラルをそのまま保存(`null` 扱いには**ならない**) |
|
|
288
|
+
|
|
289
|
+
対応フィールド: `displayName` / `phone` / `companyName` / `department` / `jobTitle` / `preferences`。`timezone` / `locale` は application-level invariant(サーバー側 normalization が string 前提)のため null 非許容。クリアは不可 — キー未指定で現状維持、もしくは新しい有効な値を渡す。
|
|
290
|
+
|
|
269
291
|
## 型定義
|
|
270
292
|
|
|
271
293
|
```typescript
|
|
@@ -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.16.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");
|
|
@@ -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.16.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");
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPA6S2M7C_cjs = require('../chunk-PA6S2M7C.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 chunkPA6S2M7C_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDInquiryForm; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDLoginButton; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDOrganizationSwitcher; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDSubscriptionBadge; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkPA6S2M7C_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-DbEyptzr.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-DbEyptzr.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-4IWCKZJV.js';
|
|
@@ -460,29 +460,79 @@ 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
|
*
|
|
466
498
|
* Mirrors the FFID backend `UpdateUserProfileRequest` shape. All fields are
|
|
467
499
|
* optional — only the supplied keys will be updated (partial update semantics).
|
|
500
|
+
*
|
|
501
|
+
* Per-field value semantics:
|
|
502
|
+
* - `undefined` / key omitted → field is untouched (partial update)
|
|
503
|
+
* - `null` → clears the field (stores SQL NULL in the DB)
|
|
504
|
+
* - `""` (empty string) → stored as a literal empty string, **not** treated as
|
|
505
|
+
* a clear. Use `null` when you want the DB value to become NULL
|
|
506
|
+
*
|
|
507
|
+
* `timezone` and `locale` are intentionally modeled as non-null in this
|
|
508
|
+
* request type (application-level invariant — the DB columns have DEFAULT
|
|
509
|
+
* values but no NOT NULL constraint, yet the server-side normalization
|
|
510
|
+
* pipeline assumes a string is always present). Pass a string to update the
|
|
511
|
+
* value, or omit the key to leave the current value in place. Do not pass
|
|
512
|
+
* `null` to clear — there is no meaningful "no timezone" state for a user.
|
|
513
|
+
*
|
|
514
|
+
* `preferences: null` is accepted and clears the column. Subsequent reads
|
|
515
|
+
* return `{}` because the FFID backend normalizes a null `preferences` column
|
|
516
|
+
* to an empty object (`toUserProfile` helper) before serializing the response —
|
|
517
|
+
* the SDK itself does not transform the payload.
|
|
468
518
|
*/
|
|
469
519
|
interface FFIDUpdateUserProfileRequest {
|
|
470
|
-
/** Display name */
|
|
471
|
-
displayName?: string;
|
|
472
|
-
/** Phone number */
|
|
473
|
-
phone?: string;
|
|
474
|
-
/** Company name */
|
|
475
|
-
companyName?: string;
|
|
476
|
-
/** Department */
|
|
477
|
-
department?: string;
|
|
478
|
-
/** Job title */
|
|
479
|
-
jobTitle?: string;
|
|
480
|
-
/** IANA timezone */
|
|
520
|
+
/** Display name (null clears the field) */
|
|
521
|
+
displayName?: string | null;
|
|
522
|
+
/** Phone number (null clears the field) */
|
|
523
|
+
phone?: string | null;
|
|
524
|
+
/** Company name (null clears the field) */
|
|
525
|
+
companyName?: string | null;
|
|
526
|
+
/** Department (null clears the field) */
|
|
527
|
+
department?: string | null;
|
|
528
|
+
/** Job title (null clears the field) */
|
|
529
|
+
jobTitle?: string | null;
|
|
530
|
+
/** IANA timezone (non-null; omit the key to leave unchanged) */
|
|
481
531
|
timezone?: string;
|
|
482
|
-
/** Locale */
|
|
532
|
+
/** Locale (non-null; omit the key to leave unchanged) */
|
|
483
533
|
locale?: string;
|
|
484
|
-
/** Arbitrary user preferences bag */
|
|
485
|
-
preferences?: Record<string, unknown
|
|
534
|
+
/** Arbitrary user preferences bag (null clears the column; reads return {}) */
|
|
535
|
+
preferences?: Record<string, unknown> | null;
|
|
486
536
|
}
|
|
487
537
|
/**
|
|
488
538
|
* Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
|
|
@@ -1229,4 +1279,4 @@ interface FFIDInquiryFormPlaceholderContext {
|
|
|
1229
1279
|
}
|
|
1230
1280
|
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
1281
|
|
|
1232
|
-
export { type
|
|
1282
|
+
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,29 +460,79 @@ 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
|
*
|
|
466
498
|
* Mirrors the FFID backend `UpdateUserProfileRequest` shape. All fields are
|
|
467
499
|
* optional — only the supplied keys will be updated (partial update semantics).
|
|
500
|
+
*
|
|
501
|
+
* Per-field value semantics:
|
|
502
|
+
* - `undefined` / key omitted → field is untouched (partial update)
|
|
503
|
+
* - `null` → clears the field (stores SQL NULL in the DB)
|
|
504
|
+
* - `""` (empty string) → stored as a literal empty string, **not** treated as
|
|
505
|
+
* a clear. Use `null` when you want the DB value to become NULL
|
|
506
|
+
*
|
|
507
|
+
* `timezone` and `locale` are intentionally modeled as non-null in this
|
|
508
|
+
* request type (application-level invariant — the DB columns have DEFAULT
|
|
509
|
+
* values but no NOT NULL constraint, yet the server-side normalization
|
|
510
|
+
* pipeline assumes a string is always present). Pass a string to update the
|
|
511
|
+
* value, or omit the key to leave the current value in place. Do not pass
|
|
512
|
+
* `null` to clear — there is no meaningful "no timezone" state for a user.
|
|
513
|
+
*
|
|
514
|
+
* `preferences: null` is accepted and clears the column. Subsequent reads
|
|
515
|
+
* return `{}` because the FFID backend normalizes a null `preferences` column
|
|
516
|
+
* to an empty object (`toUserProfile` helper) before serializing the response —
|
|
517
|
+
* the SDK itself does not transform the payload.
|
|
468
518
|
*/
|
|
469
519
|
interface FFIDUpdateUserProfileRequest {
|
|
470
|
-
/** Display name */
|
|
471
|
-
displayName?: string;
|
|
472
|
-
/** Phone number */
|
|
473
|
-
phone?: string;
|
|
474
|
-
/** Company name */
|
|
475
|
-
companyName?: string;
|
|
476
|
-
/** Department */
|
|
477
|
-
department?: string;
|
|
478
|
-
/** Job title */
|
|
479
|
-
jobTitle?: string;
|
|
480
|
-
/** IANA timezone */
|
|
520
|
+
/** Display name (null clears the field) */
|
|
521
|
+
displayName?: string | null;
|
|
522
|
+
/** Phone number (null clears the field) */
|
|
523
|
+
phone?: string | null;
|
|
524
|
+
/** Company name (null clears the field) */
|
|
525
|
+
companyName?: string | null;
|
|
526
|
+
/** Department (null clears the field) */
|
|
527
|
+
department?: string | null;
|
|
528
|
+
/** Job title (null clears the field) */
|
|
529
|
+
jobTitle?: string | null;
|
|
530
|
+
/** IANA timezone (non-null; omit the key to leave unchanged) */
|
|
481
531
|
timezone?: string;
|
|
482
|
-
/** Locale */
|
|
532
|
+
/** Locale (non-null; omit the key to leave unchanged) */
|
|
483
533
|
locale?: string;
|
|
484
|
-
/** Arbitrary user preferences bag */
|
|
485
|
-
preferences?: Record<string, unknown
|
|
534
|
+
/** Arbitrary user preferences bag (null clears the column; reads return {}) */
|
|
535
|
+
preferences?: Record<string, unknown> | null;
|
|
486
536
|
}
|
|
487
537
|
/**
|
|
488
538
|
* Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
|
|
@@ -1229,4 +1279,4 @@ interface FFIDInquiryFormPlaceholderContext {
|
|
|
1229
1279
|
}
|
|
1230
1280
|
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
1281
|
|
|
1232
|
-
export { type
|
|
1282
|
+
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 chunkPA6S2M7C_cjs = require('./chunk-PA6S2M7C.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 } = chunkPA6S2M7C_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 chunkPA6S2M7C_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 chunkPA6S2M7C_cjs.FFIDAnnouncementBadge; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDAnnouncementList; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDInquiryForm; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDLoginButton; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDOrganizationSwitcher; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDProvider; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "FFIDSDKError", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDSDKError; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkPA6S2M7C_cjs.FFIDSubscriptionBadge; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunkPA6S2M7C_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 chunkPA6S2M7C_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 chunkPA6S2M7C_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 chunkPA6S2M7C_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 chunkPA6S2M7C_cjs.createFFIDAnnouncementsClient; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunkPA6S2M7C_cjs.createFFIDClient; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "createTokenStore", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunkPA6S2M7C_cjs.createTokenStore; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunkPA6S2M7C_cjs.generateCodeChallenge; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunkPA6S2M7C_cjs.generateCodeVerifier; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "isFFIDInquiryCategorySite2026", {
|
|
148
148
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunkPA6S2M7C_cjs.isFFIDInquiryCategorySite2026; }
|
|
150
150
|
});
|
|
151
151
|
Object.defineProperty(exports, "normalizeRedirectUri", {
|
|
152
152
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunkPA6S2M7C_cjs.normalizeRedirectUri; }
|
|
154
154
|
});
|
|
155
155
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
156
156
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunkPA6S2M7C_cjs.retrieveCodeVerifier; }
|
|
158
158
|
});
|
|
159
159
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
160
160
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunkPA6S2M7C_cjs.storeCodeVerifier; }
|
|
162
162
|
});
|
|
163
163
|
Object.defineProperty(exports, "useFFID", {
|
|
164
164
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunkPA6S2M7C_cjs.useFFID; }
|
|
166
166
|
});
|
|
167
167
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
168
168
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunkPA6S2M7C_cjs.useFFIDAnnouncements; }
|
|
170
170
|
});
|
|
171
171
|
Object.defineProperty(exports, "useSubscription", {
|
|
172
172
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunkPA6S2M7C_cjs.useSubscription; }
|
|
174
174
|
});
|
|
175
175
|
Object.defineProperty(exports, "withSubscription", {
|
|
176
176
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
177
|
+
get: function () { return chunkPA6S2M7C_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-DbEyptzr.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-DbEyptzr.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-DbEyptzr.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-DbEyptzr.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-4IWCKZJV.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-4IWCKZJV.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.16.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,29 +814,79 @@ 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
|
*
|
|
820
852
|
* Mirrors the FFID backend `UpdateUserProfileRequest` shape. All fields are
|
|
821
853
|
* optional — only the supplied keys will be updated (partial update semantics).
|
|
854
|
+
*
|
|
855
|
+
* Per-field value semantics:
|
|
856
|
+
* - `undefined` / key omitted → field is untouched (partial update)
|
|
857
|
+
* - `null` → clears the field (stores SQL NULL in the DB)
|
|
858
|
+
* - `""` (empty string) → stored as a literal empty string, **not** treated as
|
|
859
|
+
* a clear. Use `null` when you want the DB value to become NULL
|
|
860
|
+
*
|
|
861
|
+
* `timezone` and `locale` are intentionally modeled as non-null in this
|
|
862
|
+
* request type (application-level invariant — the DB columns have DEFAULT
|
|
863
|
+
* values but no NOT NULL constraint, yet the server-side normalization
|
|
864
|
+
* pipeline assumes a string is always present). Pass a string to update the
|
|
865
|
+
* value, or omit the key to leave the current value in place. Do not pass
|
|
866
|
+
* `null` to clear — there is no meaningful "no timezone" state for a user.
|
|
867
|
+
*
|
|
868
|
+
* `preferences: null` is accepted and clears the column. Subsequent reads
|
|
869
|
+
* return `{}` because the FFID backend normalizes a null `preferences` column
|
|
870
|
+
* to an empty object (`toUserProfile` helper) before serializing the response —
|
|
871
|
+
* the SDK itself does not transform the payload.
|
|
822
872
|
*/
|
|
823
873
|
interface FFIDUpdateUserProfileRequest {
|
|
824
|
-
/** Display name */
|
|
825
|
-
displayName?: string;
|
|
826
|
-
/** Phone number */
|
|
827
|
-
phone?: string;
|
|
828
|
-
/** Company name */
|
|
829
|
-
companyName?: string;
|
|
830
|
-
/** Department */
|
|
831
|
-
department?: string;
|
|
832
|
-
/** Job title */
|
|
833
|
-
jobTitle?: string;
|
|
834
|
-
/** IANA timezone */
|
|
874
|
+
/** Display name (null clears the field) */
|
|
875
|
+
displayName?: string | null;
|
|
876
|
+
/** Phone number (null clears the field) */
|
|
877
|
+
phone?: string | null;
|
|
878
|
+
/** Company name (null clears the field) */
|
|
879
|
+
companyName?: string | null;
|
|
880
|
+
/** Department (null clears the field) */
|
|
881
|
+
department?: string | null;
|
|
882
|
+
/** Job title (null clears the field) */
|
|
883
|
+
jobTitle?: string | null;
|
|
884
|
+
/** IANA timezone (non-null; omit the key to leave unchanged) */
|
|
835
885
|
timezone?: string;
|
|
836
|
-
/** Locale */
|
|
886
|
+
/** Locale (non-null; omit the key to leave unchanged) */
|
|
837
887
|
locale?: string;
|
|
838
|
-
/** Arbitrary user preferences bag */
|
|
839
|
-
preferences?: Record<string, unknown
|
|
888
|
+
/** Arbitrary user preferences bag (null clears the column; reads return {}) */
|
|
889
|
+
preferences?: Record<string, unknown> | null;
|
|
840
890
|
}
|
|
841
891
|
/**
|
|
842
892
|
* Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
|
|
@@ -992,8 +1042,8 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
992
1042
|
organizationId: string;
|
|
993
1043
|
userId: string;
|
|
994
1044
|
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
995
|
-
getProfile: () => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
996
|
-
updateProfile: (data: FFIDUpdateUserProfileRequest) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
1045
|
+
getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
1046
|
+
updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
997
1047
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
998
1048
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
999
1049
|
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
@@ -1104,4 +1154,4 @@ interface KVNamespaceLike {
|
|
|
1104
1154
|
*/
|
|
1105
1155
|
declare function createKVCacheAdapter(kv: KVNamespaceLike): FFIDCacheAdapter;
|
|
1106
1156
|
|
|
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 };
|
|
1157
|
+
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,29 +814,79 @@ 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
|
*
|
|
820
852
|
* Mirrors the FFID backend `UpdateUserProfileRequest` shape. All fields are
|
|
821
853
|
* optional — only the supplied keys will be updated (partial update semantics).
|
|
854
|
+
*
|
|
855
|
+
* Per-field value semantics:
|
|
856
|
+
* - `undefined` / key omitted → field is untouched (partial update)
|
|
857
|
+
* - `null` → clears the field (stores SQL NULL in the DB)
|
|
858
|
+
* - `""` (empty string) → stored as a literal empty string, **not** treated as
|
|
859
|
+
* a clear. Use `null` when you want the DB value to become NULL
|
|
860
|
+
*
|
|
861
|
+
* `timezone` and `locale` are intentionally modeled as non-null in this
|
|
862
|
+
* request type (application-level invariant — the DB columns have DEFAULT
|
|
863
|
+
* values but no NOT NULL constraint, yet the server-side normalization
|
|
864
|
+
* pipeline assumes a string is always present). Pass a string to update the
|
|
865
|
+
* value, or omit the key to leave the current value in place. Do not pass
|
|
866
|
+
* `null` to clear — there is no meaningful "no timezone" state for a user.
|
|
867
|
+
*
|
|
868
|
+
* `preferences: null` is accepted and clears the column. Subsequent reads
|
|
869
|
+
* return `{}` because the FFID backend normalizes a null `preferences` column
|
|
870
|
+
* to an empty object (`toUserProfile` helper) before serializing the response —
|
|
871
|
+
* the SDK itself does not transform the payload.
|
|
822
872
|
*/
|
|
823
873
|
interface FFIDUpdateUserProfileRequest {
|
|
824
|
-
/** Display name */
|
|
825
|
-
displayName?: string;
|
|
826
|
-
/** Phone number */
|
|
827
|
-
phone?: string;
|
|
828
|
-
/** Company name */
|
|
829
|
-
companyName?: string;
|
|
830
|
-
/** Department */
|
|
831
|
-
department?: string;
|
|
832
|
-
/** Job title */
|
|
833
|
-
jobTitle?: string;
|
|
834
|
-
/** IANA timezone */
|
|
874
|
+
/** Display name (null clears the field) */
|
|
875
|
+
displayName?: string | null;
|
|
876
|
+
/** Phone number (null clears the field) */
|
|
877
|
+
phone?: string | null;
|
|
878
|
+
/** Company name (null clears the field) */
|
|
879
|
+
companyName?: string | null;
|
|
880
|
+
/** Department (null clears the field) */
|
|
881
|
+
department?: string | null;
|
|
882
|
+
/** Job title (null clears the field) */
|
|
883
|
+
jobTitle?: string | null;
|
|
884
|
+
/** IANA timezone (non-null; omit the key to leave unchanged) */
|
|
835
885
|
timezone?: string;
|
|
836
|
-
/** Locale */
|
|
886
|
+
/** Locale (non-null; omit the key to leave unchanged) */
|
|
837
887
|
locale?: string;
|
|
838
|
-
/** Arbitrary user preferences bag */
|
|
839
|
-
preferences?: Record<string, unknown
|
|
888
|
+
/** Arbitrary user preferences bag (null clears the column; reads return {}) */
|
|
889
|
+
preferences?: Record<string, unknown> | null;
|
|
840
890
|
}
|
|
841
891
|
/**
|
|
842
892
|
* Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
|
|
@@ -992,8 +1042,8 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
992
1042
|
organizationId: string;
|
|
993
1043
|
userId: string;
|
|
994
1044
|
}) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
|
|
995
|
-
getProfile: () => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
996
|
-
updateProfile: (data: FFIDUpdateUserProfileRequest) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
1045
|
+
getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
1046
|
+
updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
|
|
997
1047
|
createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
|
|
998
1048
|
createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
|
|
999
1049
|
listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
|
|
@@ -1104,4 +1154,4 @@ interface KVNamespaceLike {
|
|
|
1104
1154
|
*/
|
|
1105
1155
|
declare function createKVCacheAdapter(kv: KVNamespaceLike): FFIDCacheAdapter;
|
|
1106
1156
|
|
|
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 };
|
|
1157
|
+
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.16.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");
|