@feelflow/ffid-sdk 1.5.0 → 1.6.1
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 +87 -1
- package/dist/{chunk-UBQEG3CS.cjs → chunk-C254ATU6.cjs} +30 -5
- package/dist/{chunk-YJFOE2PP.js → chunk-Q5XWUQHV.js} +30 -5
- package/dist/components/index.cjs +7 -7
- 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-DEtyiwFZ.d.cts → index-oF_MAO2T.d.cts} +2 -0
- package/dist/{index-DEtyiwFZ.d.ts → index-oF_MAO2T.d.ts} +2 -0
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@feelflow/ffid-sdk)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
FeelFlow ID Platform SDK
|
|
6
|
+
FeelFlow ID Platform SDK — React/Next.js 向け + サーバーサイドモジュールはフレームワーク非依存。
|
|
7
7
|
|
|
8
8
|
**5行のコードでFFID認証を導入!**
|
|
9
9
|
|
|
@@ -273,6 +273,92 @@ interface FFIDOAuthUserInfoSubscription {
|
|
|
273
273
|
|
|
274
274
|
`seatModel` はシートモデル識別用であり、organization と role は userinfo の解決済み組織文脈として扱います。
|
|
275
275
|
|
|
276
|
+
## React 以外の環境で使う
|
|
277
|
+
|
|
278
|
+
本 SDK は React/Next.js 向けに設計されていますが、一部のモジュールはフレームワーク非依存で利用できます。
|
|
279
|
+
|
|
280
|
+
### サーバーサイドモジュール(React 依存なし)
|
|
281
|
+
|
|
282
|
+
以下の subpath exports は React に一切依存しません。Node.js、Deno、Bun 等で即座に利用できます。
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
// 利用規約・法的文書
|
|
286
|
+
import { createFFIDLegalClient } from '@feelflow/ffid-sdk/legal'
|
|
287
|
+
|
|
288
|
+
// Agency(代理店)管理
|
|
289
|
+
import { createFFIDAgencyClient } from '@feelflow/ffid-sdk/agency'
|
|
290
|
+
|
|
291
|
+
// お知らせ取得
|
|
292
|
+
import { createFFIDAnnouncementsClient } from '@feelflow/ffid-sdk/announcements'
|
|
293
|
+
|
|
294
|
+
// Webhook 署名検証・ハンドラー(※ Node.js crypto が必要)
|
|
295
|
+
import { createFFIDWebhookHandler, verifyWebhookSignature } from '@feelflow/ffid-sdk/webhooks'
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
> **Note**: `webhooks` モジュールは Node.js の `crypto` モジュールと `Buffer` を使用します。Cloudflare Workers で利用する場合は [`nodejs_compat` 互換フラグ](https://developers.cloudflare.com/workers/runtime-apis/nodejs/)を有効にしてください。
|
|
299
|
+
|
|
300
|
+
これらのモジュールは独立した subpath export として公開されているため、メインエントリ (`@feelflow/ffid-sdk`) を経由せず、React の依存が伝播しません。
|
|
301
|
+
|
|
302
|
+
### `createFFIDClient` を非 React 環境で使う
|
|
303
|
+
|
|
304
|
+
非 React 環境では、可能な限り上記の subpath exports(`/legal`、`/webhooks` 等)の個別クライアントを使用してください。メインエントリの `createFFIDClient` を使う必要がある場合、`createFFIDClient` 自体は React を使用しませんが、メインエントリに含まれるため **bundler 環境では React を external に指定する**必要があります。
|
|
305
|
+
|
|
306
|
+
#### Cloudflare Workers
|
|
307
|
+
|
|
308
|
+
ビルドコマンドで `--external` を指定するか、カスタム esbuild 設定で `external` を設定してください。
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# wrangler のビルドコマンド例
|
|
312
|
+
esbuild src/index.ts --bundle --format=esm --external:react --external:react-dom
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### Vue / Nuxt(Vite)
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
// vite.config.ts
|
|
319
|
+
export default defineConfig({
|
|
320
|
+
build: {
|
|
321
|
+
rollupOptions: {
|
|
322
|
+
external: ['react', 'react-dom'],
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
})
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### esbuild
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
esbuild src/index.ts --bundle --external:react --external:react-dom
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### webpack
|
|
335
|
+
|
|
336
|
+
```javascript
|
|
337
|
+
// webpack.config.js
|
|
338
|
+
module.exports = {
|
|
339
|
+
externals: {
|
|
340
|
+
react: 'react',
|
|
341
|
+
'react-dom': 'react-dom',
|
|
342
|
+
},
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
> **Note**: サーバーサイドで bundler を使わずに実行する場合、**subpath exports(`@feelflow/ffid-sdk/legal` 等)を使用すれば** external 設定なしで React がインストールされていなくても動作します。メインエントリ(`@feelflow/ffid-sdk`)を ESM で import する場合は、モジュールグラフが静的に解決されるため React が必要です。
|
|
347
|
+
|
|
348
|
+
### `peerDependencies` は optional です
|
|
349
|
+
|
|
350
|
+
SDK の `package.json` で `react` / `react-dom` は `optional: true` に設定済みです(利用者側での設定は不要)。React をインストールしなくても `npm install` 時に warning は発生しません。
|
|
351
|
+
|
|
352
|
+
```json
|
|
353
|
+
// SDK の package.json に設定済み(参考)
|
|
354
|
+
{
|
|
355
|
+
"peerDependenciesMeta": {
|
|
356
|
+
"react": { "optional": true },
|
|
357
|
+
"react-dom": { "optional": true }
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
276
362
|
## 環境変数
|
|
277
363
|
|
|
278
364
|
オプションで環境変数を使用してデフォルト設定を上書きできます:
|
|
@@ -410,6 +410,7 @@ function createFFIDClient(config) {
|
|
|
410
410
|
const baseUrl = config.apiBaseUrl ?? DEFAULT_API_BASE_URL;
|
|
411
411
|
const authMode = config.authMode ?? "cookie";
|
|
412
412
|
const clientId = config.clientId ?? config.serviceCode;
|
|
413
|
+
const resolvedRedirectUri = config.redirectUri ?? null;
|
|
413
414
|
const serviceApiKey = config.serviceApiKey?.trim();
|
|
414
415
|
const verifyStrategy = config.verifyStrategy ?? "jwt";
|
|
415
416
|
if (authMode === "service-key" && !serviceApiKey) {
|
|
@@ -715,11 +716,21 @@ function createFFIDClient(config) {
|
|
|
715
716
|
async function exchangeCodeForTokens(code, codeVerifier) {
|
|
716
717
|
const url = `${baseUrl}${OAUTH_TOKEN_ENDPOINT}`;
|
|
717
718
|
logger.debug("Exchanging code for tokens:", url);
|
|
719
|
+
const effectiveRedirectUri = resolvedRedirectUri ?? (typeof window !== "undefined" ? window.location.origin + window.location.pathname : null);
|
|
720
|
+
if (!effectiveRedirectUri) {
|
|
721
|
+
logger.error("redirectUri is required for token exchange in SSR environments. Set config.redirectUri explicitly.");
|
|
722
|
+
return {
|
|
723
|
+
error: {
|
|
724
|
+
code: FFID_ERROR_CODES.TOKEN_EXCHANGE_ERROR,
|
|
725
|
+
message: "redirectUri \u304C\u672A\u8A2D\u5B9A\u3067\u3059\u3002SSR\u74B0\u5883\u3067\u306F config.redirectUri \u3092\u660E\u793A\u7684\u306B\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
}
|
|
718
729
|
const body = {
|
|
719
730
|
grant_type: "authorization_code",
|
|
720
731
|
code,
|
|
721
732
|
client_id: clientId,
|
|
722
|
-
redirect_uri:
|
|
733
|
+
redirect_uri: effectiveRedirectUri
|
|
723
734
|
};
|
|
724
735
|
if (codeVerifier) {
|
|
725
736
|
body.code_verifier = codeVerifier;
|
|
@@ -857,11 +868,11 @@ function createFFIDClient(config) {
|
|
|
857
868
|
storeCodeVerifier(verifier);
|
|
858
869
|
generateCodeChallenge(verifier).then((challenge) => {
|
|
859
870
|
const state = generateRandomState();
|
|
860
|
-
const
|
|
871
|
+
const redirectUri = resolvedRedirectUri ?? window.location.origin + window.location.pathname;
|
|
861
872
|
const params = new URLSearchParams({
|
|
862
873
|
response_type: "code",
|
|
863
874
|
client_id: clientId,
|
|
864
|
-
redirect_uri:
|
|
875
|
+
redirect_uri: redirectUri,
|
|
865
876
|
state,
|
|
866
877
|
code_challenge: challenge,
|
|
867
878
|
code_challenge_method: "S256"
|
|
@@ -929,7 +940,8 @@ function createFFIDClient(config) {
|
|
|
929
940
|
logger,
|
|
930
941
|
baseUrl,
|
|
931
942
|
serviceCode: config.serviceCode,
|
|
932
|
-
clientId
|
|
943
|
+
clientId,
|
|
944
|
+
redirectUri: resolvedRedirectUri
|
|
933
945
|
};
|
|
934
946
|
}
|
|
935
947
|
function generateRandomState() {
|
|
@@ -1282,6 +1294,10 @@ function FFIDUserMenu({
|
|
|
1282
1294
|
}) {
|
|
1283
1295
|
const { user, currentOrganization, logout, isLoading, isAuthenticated } = useFFID();
|
|
1284
1296
|
const [isOpen, setIsOpen] = react.useState(false);
|
|
1297
|
+
const [avatarError, setAvatarError] = react.useState(false);
|
|
1298
|
+
react.useEffect(() => {
|
|
1299
|
+
setAvatarError(false);
|
|
1300
|
+
}, [user?.avatarUrl]);
|
|
1285
1301
|
if (!isAuthenticated || !user) {
|
|
1286
1302
|
return null;
|
|
1287
1303
|
}
|
|
@@ -1318,7 +1334,16 @@ function FFIDUserMenu({
|
|
|
1318
1334
|
children: displayName.charAt(0).toUpperCase()
|
|
1319
1335
|
}
|
|
1320
1336
|
);
|
|
1321
|
-
const avatarElement = renderAvatar ? renderAvatar({ avatarUrl: user.avatarUrl, displayName: user.displayName, email: user.email }) : user.avatarUrl && isValidAvatarUrl(user.avatarUrl) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1337
|
+
const avatarElement = renderAvatar ? renderAvatar({ avatarUrl: user.avatarUrl, displayName: user.displayName, email: user.email }) : user.avatarUrl && isValidAvatarUrl(user.avatarUrl) && !avatarError ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1338
|
+
"img",
|
|
1339
|
+
{
|
|
1340
|
+
className: classNames.avatar,
|
|
1341
|
+
src: user.avatarUrl,
|
|
1342
|
+
alt: displayName,
|
|
1343
|
+
onError: () => setAvatarError(true),
|
|
1344
|
+
style: { width: SIZE_AVATAR_MD, height: SIZE_AVATAR_MD, borderRadius: "50%" }
|
|
1345
|
+
}
|
|
1346
|
+
) : defaultAvatar;
|
|
1322
1347
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: [className, classNames.container].filter(Boolean).join(" ") || void 0, style: { position: "relative" }, children: [
|
|
1323
1348
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1324
1349
|
"button",
|
|
@@ -408,6 +408,7 @@ function createFFIDClient(config) {
|
|
|
408
408
|
const baseUrl = config.apiBaseUrl ?? DEFAULT_API_BASE_URL;
|
|
409
409
|
const authMode = config.authMode ?? "cookie";
|
|
410
410
|
const clientId = config.clientId ?? config.serviceCode;
|
|
411
|
+
const resolvedRedirectUri = config.redirectUri ?? null;
|
|
411
412
|
const serviceApiKey = config.serviceApiKey?.trim();
|
|
412
413
|
const verifyStrategy = config.verifyStrategy ?? "jwt";
|
|
413
414
|
if (authMode === "service-key" && !serviceApiKey) {
|
|
@@ -713,11 +714,21 @@ function createFFIDClient(config) {
|
|
|
713
714
|
async function exchangeCodeForTokens(code, codeVerifier) {
|
|
714
715
|
const url = `${baseUrl}${OAUTH_TOKEN_ENDPOINT}`;
|
|
715
716
|
logger.debug("Exchanging code for tokens:", url);
|
|
717
|
+
const effectiveRedirectUri = resolvedRedirectUri ?? (typeof window !== "undefined" ? window.location.origin + window.location.pathname : null);
|
|
718
|
+
if (!effectiveRedirectUri) {
|
|
719
|
+
logger.error("redirectUri is required for token exchange in SSR environments. Set config.redirectUri explicitly.");
|
|
720
|
+
return {
|
|
721
|
+
error: {
|
|
722
|
+
code: FFID_ERROR_CODES.TOKEN_EXCHANGE_ERROR,
|
|
723
|
+
message: "redirectUri \u304C\u672A\u8A2D\u5B9A\u3067\u3059\u3002SSR\u74B0\u5883\u3067\u306F config.redirectUri \u3092\u660E\u793A\u7684\u306B\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
}
|
|
716
727
|
const body = {
|
|
717
728
|
grant_type: "authorization_code",
|
|
718
729
|
code,
|
|
719
730
|
client_id: clientId,
|
|
720
|
-
redirect_uri:
|
|
731
|
+
redirect_uri: effectiveRedirectUri
|
|
721
732
|
};
|
|
722
733
|
if (codeVerifier) {
|
|
723
734
|
body.code_verifier = codeVerifier;
|
|
@@ -855,11 +866,11 @@ function createFFIDClient(config) {
|
|
|
855
866
|
storeCodeVerifier(verifier);
|
|
856
867
|
generateCodeChallenge(verifier).then((challenge) => {
|
|
857
868
|
const state = generateRandomState();
|
|
858
|
-
const
|
|
869
|
+
const redirectUri = resolvedRedirectUri ?? window.location.origin + window.location.pathname;
|
|
859
870
|
const params = new URLSearchParams({
|
|
860
871
|
response_type: "code",
|
|
861
872
|
client_id: clientId,
|
|
862
|
-
redirect_uri:
|
|
873
|
+
redirect_uri: redirectUri,
|
|
863
874
|
state,
|
|
864
875
|
code_challenge: challenge,
|
|
865
876
|
code_challenge_method: "S256"
|
|
@@ -927,7 +938,8 @@ function createFFIDClient(config) {
|
|
|
927
938
|
logger,
|
|
928
939
|
baseUrl,
|
|
929
940
|
serviceCode: config.serviceCode,
|
|
930
|
-
clientId
|
|
941
|
+
clientId,
|
|
942
|
+
redirectUri: resolvedRedirectUri
|
|
931
943
|
};
|
|
932
944
|
}
|
|
933
945
|
function generateRandomState() {
|
|
@@ -1280,6 +1292,10 @@ function FFIDUserMenu({
|
|
|
1280
1292
|
}) {
|
|
1281
1293
|
const { user, currentOrganization, logout, isLoading, isAuthenticated } = useFFID();
|
|
1282
1294
|
const [isOpen, setIsOpen] = useState(false);
|
|
1295
|
+
const [avatarError, setAvatarError] = useState(false);
|
|
1296
|
+
useEffect(() => {
|
|
1297
|
+
setAvatarError(false);
|
|
1298
|
+
}, [user?.avatarUrl]);
|
|
1283
1299
|
if (!isAuthenticated || !user) {
|
|
1284
1300
|
return null;
|
|
1285
1301
|
}
|
|
@@ -1316,7 +1332,16 @@ function FFIDUserMenu({
|
|
|
1316
1332
|
children: displayName.charAt(0).toUpperCase()
|
|
1317
1333
|
}
|
|
1318
1334
|
);
|
|
1319
|
-
const avatarElement = renderAvatar ? renderAvatar({ avatarUrl: user.avatarUrl, displayName: user.displayName, email: user.email }) : user.avatarUrl && isValidAvatarUrl(user.avatarUrl) ? /* @__PURE__ */ jsx(
|
|
1335
|
+
const avatarElement = renderAvatar ? renderAvatar({ avatarUrl: user.avatarUrl, displayName: user.displayName, email: user.email }) : user.avatarUrl && isValidAvatarUrl(user.avatarUrl) && !avatarError ? /* @__PURE__ */ jsx(
|
|
1336
|
+
"img",
|
|
1337
|
+
{
|
|
1338
|
+
className: classNames.avatar,
|
|
1339
|
+
src: user.avatarUrl,
|
|
1340
|
+
alt: displayName,
|
|
1341
|
+
onError: () => setAvatarError(true),
|
|
1342
|
+
style: { width: SIZE_AVATAR_MD, height: SIZE_AVATAR_MD, borderRadius: "50%" }
|
|
1343
|
+
}
|
|
1344
|
+
) : defaultAvatar;
|
|
1320
1345
|
return /* @__PURE__ */ jsxs("div", { className: [className, classNames.container].filter(Boolean).join(" ") || void 0, style: { position: "relative" }, children: [
|
|
1321
1346
|
/* @__PURE__ */ jsx(
|
|
1322
1347
|
"button",
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkC254ATU6_cjs = require('../chunk-C254ATU6.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 chunkC254ATU6_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkC254ATU6_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkC254ATU6_cjs.FFIDLoginButton; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkC254ATU6_cjs.FFIDOrganizationSwitcher; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkC254ATU6_cjs.FFIDSubscriptionBadge; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkC254ATU6_cjs.FFIDUserMenu; }
|
|
30
30
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { p as FFIDAnnouncementBadge, M as FFIDAnnouncementBadgeClassNames, N as FFIDAnnouncementBadgeProps, q as FFIDAnnouncementList, O as FFIDAnnouncementListClassNames, P as FFIDAnnouncementListProps, w as FFIDLoginButton, Q as FFIDLoginButtonProps, B as FFIDOrganizationSwitcher, R as FFIDOrganizationSwitcherClassNames, S as FFIDOrganizationSwitcherProps, E as FFIDSubscriptionBadge, T as FFIDSubscriptionBadgeClassNames, V as FFIDSubscriptionBadgeProps, I as FFIDUserMenu, W as FFIDUserMenuClassNames, X as FFIDUserMenuProps } from '../index-
|
|
1
|
+
export { p as FFIDAnnouncementBadge, M as FFIDAnnouncementBadgeClassNames, N as FFIDAnnouncementBadgeProps, q as FFIDAnnouncementList, O as FFIDAnnouncementListClassNames, P as FFIDAnnouncementListProps, w as FFIDLoginButton, Q as FFIDLoginButtonProps, B as FFIDOrganizationSwitcher, R as FFIDOrganizationSwitcherClassNames, S as FFIDOrganizationSwitcherProps, E as FFIDSubscriptionBadge, T as FFIDSubscriptionBadgeClassNames, V as FFIDSubscriptionBadgeProps, I as FFIDUserMenu, W as FFIDUserMenuClassNames, X as FFIDUserMenuProps } from '../index-oF_MAO2T.cjs';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { p as FFIDAnnouncementBadge, M as FFIDAnnouncementBadgeClassNames, N as FFIDAnnouncementBadgeProps, q as FFIDAnnouncementList, O as FFIDAnnouncementListClassNames, P as FFIDAnnouncementListProps, w as FFIDLoginButton, Q as FFIDLoginButtonProps, B as FFIDOrganizationSwitcher, R as FFIDOrganizationSwitcherClassNames, S as FFIDOrganizationSwitcherProps, E as FFIDSubscriptionBadge, T as FFIDSubscriptionBadgeClassNames, V as FFIDSubscriptionBadgeProps, I as FFIDUserMenu, W as FFIDUserMenuClassNames, X as FFIDUserMenuProps } from '../index-
|
|
1
|
+
export { p as FFIDAnnouncementBadge, M as FFIDAnnouncementBadgeClassNames, N as FFIDAnnouncementBadgeProps, q as FFIDAnnouncementList, O as FFIDAnnouncementListClassNames, P as FFIDAnnouncementListProps, w as FFIDLoginButton, Q as FFIDLoginButtonProps, B as FFIDOrganizationSwitcher, R as FFIDOrganizationSwitcherClassNames, S as FFIDOrganizationSwitcherProps, E as FFIDSubscriptionBadge, T as FFIDSubscriptionBadgeClassNames, V as FFIDSubscriptionBadgeProps, I as FFIDUserMenu, W as FFIDUserMenuClassNames, X as FFIDUserMenuProps } from '../index-oF_MAO2T.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-
|
|
1
|
+
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-Q5XWUQHV.js';
|
|
@@ -137,6 +137,8 @@ interface FFIDConfig {
|
|
|
137
137
|
authMode?: 'cookie' | 'token' | 'service-key' | undefined;
|
|
138
138
|
/** Client ID for token mode (defaults to serviceCode if not set) */
|
|
139
139
|
clientId?: string | undefined;
|
|
140
|
+
/** Custom redirect URI for OAuth flow (defaults to window.location.origin + window.location.pathname) */
|
|
141
|
+
redirectUri?: string | undefined;
|
|
140
142
|
/** Service API key for service-key mode (X-Service-Api-Key header) */
|
|
141
143
|
serviceApiKey?: string | undefined;
|
|
142
144
|
/**
|
|
@@ -137,6 +137,8 @@ interface FFIDConfig {
|
|
|
137
137
|
authMode?: 'cookie' | 'token' | 'service-key' | undefined;
|
|
138
138
|
/** Client ID for token mode (defaults to serviceCode if not set) */
|
|
139
139
|
clientId?: string | undefined;
|
|
140
|
+
/** Custom redirect URI for OAuth flow (defaults to window.location.origin + window.location.pathname) */
|
|
141
|
+
redirectUri?: string | undefined;
|
|
140
142
|
/** Service API key for service-key mode (X-Service-Api-Key header) */
|
|
141
143
|
serviceApiKey?: string | undefined;
|
|
142
144
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkC254ATU6_cjs = require('./chunk-C254ATU6.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
7
7
|
function withFFIDAuth(Component, options = {}) {
|
|
8
8
|
const WrappedComponent = (props) => {
|
|
9
|
-
const { isLoading, isAuthenticated, login } =
|
|
9
|
+
const { isLoading, isAuthenticated, login } = chunkC254ATU6_cjs.useFFIDContext();
|
|
10
10
|
const hasRedirected = react.useRef(false);
|
|
11
11
|
react.useEffect(() => {
|
|
12
12
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -31,82 +31,82 @@ function withFFIDAuth(Component, options = {}) {
|
|
|
31
31
|
|
|
32
32
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkC254ATU6_cjs.DEFAULT_API_BASE_URL; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkC254ATU6_cjs.FFIDAnnouncementBadge; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkC254ATU6_cjs.FFIDAnnouncementList; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkC254ATU6_cjs.FFIDLoginButton; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkC254ATU6_cjs.FFIDOrganizationSwitcher; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkC254ATU6_cjs.FFIDProvider; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkC254ATU6_cjs.FFIDSubscriptionBadge; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkC254ATU6_cjs.FFIDUserMenu; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkC254ATU6_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkC254ATU6_cjs.createFFIDAnnouncementsClient; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkC254ATU6_cjs.createFFIDClient; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "createTokenStore", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkC254ATU6_cjs.createTokenStore; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkC254ATU6_cjs.generateCodeChallenge; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkC254ATU6_cjs.generateCodeVerifier; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkC254ATU6_cjs.retrieveCodeVerifier; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkC254ATU6_cjs.storeCodeVerifier; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "useFFID", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkC254ATU6_cjs.useFFID; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkC254ATU6_cjs.useFFIDAnnouncements; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "useSubscription", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunkC254ATU6_cjs.useSubscription; }
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "withSubscription", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkC254ATU6_cjs.withSubscription; }
|
|
111
111
|
});
|
|
112
112
|
exports.withFFIDAuth = withFFIDAuth;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDError, d as FFIDSubscriptionCheckResponse, e as FFIDOAuthUserInfo, f as FFIDLogger, g as FFIDUser, h as FFIDOrganization, i as FFIDSubscriptionContextValue, j as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, k as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, l as FFIDAnnouncementsLogger } from './index-
|
|
2
|
-
export { m as Announcement, n as AnnouncementStatus, o as AnnouncementType, p as FFIDAnnouncementBadge, q as FFIDAnnouncementList, r as FFIDAnnouncementsError, s as FFIDAnnouncementsErrorCode, t as FFIDAnnouncementsServerResponse, u as FFIDContextValue, v as FFIDJwtClaims, w as FFIDLoginButton, x as FFIDOAuthTokenResponse, y as FFIDOAuthUserInfoMemberRole, z as FFIDOAuthUserInfoSubscription, B as FFIDOrganizationSwitcher, C as FFIDSeatModel, D as FFIDSubscription, E as FFIDSubscriptionBadge, G as FFIDSubscriptionStatus, H as FFIDTokenIntrospectionResponse, I as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, J as UseFFIDAnnouncementsReturn, K as useFFIDAnnouncements } from './index-
|
|
1
|
+
import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDError, d as FFIDSubscriptionCheckResponse, e as FFIDOAuthUserInfo, f as FFIDLogger, g as FFIDUser, h as FFIDOrganization, i as FFIDSubscriptionContextValue, j as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, k as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, l as FFIDAnnouncementsLogger } from './index-oF_MAO2T.cjs';
|
|
2
|
+
export { m as Announcement, n as AnnouncementStatus, o as AnnouncementType, p as FFIDAnnouncementBadge, q as FFIDAnnouncementList, r as FFIDAnnouncementsError, s as FFIDAnnouncementsErrorCode, t as FFIDAnnouncementsServerResponse, u as FFIDContextValue, v as FFIDJwtClaims, w as FFIDLoginButton, x as FFIDOAuthTokenResponse, y as FFIDOAuthUserInfoMemberRole, z as FFIDOAuthUserInfoSubscription, B as FFIDOrganizationSwitcher, C as FFIDSeatModel, D as FFIDSubscription, E as FFIDSubscriptionBadge, G as FFIDSubscriptionStatus, H as FFIDTokenIntrospectionResponse, I as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, J as UseFFIDAnnouncementsReturn, K as useFFIDAnnouncements } from './index-oF_MAO2T.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -108,6 +108,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
108
108
|
baseUrl: string;
|
|
109
109
|
serviceCode: string;
|
|
110
110
|
clientId: string;
|
|
111
|
+
redirectUri: string | null;
|
|
111
112
|
};
|
|
112
113
|
/** Type of the FFID client */
|
|
113
114
|
type FFIDClient = ReturnType<typeof createFFIDClient>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDError, d as FFIDSubscriptionCheckResponse, e as FFIDOAuthUserInfo, f as FFIDLogger, g as FFIDUser, h as FFIDOrganization, i as FFIDSubscriptionContextValue, j as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, k as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, l as FFIDAnnouncementsLogger } from './index-
|
|
2
|
-
export { m as Announcement, n as AnnouncementStatus, o as AnnouncementType, p as FFIDAnnouncementBadge, q as FFIDAnnouncementList, r as FFIDAnnouncementsError, s as FFIDAnnouncementsErrorCode, t as FFIDAnnouncementsServerResponse, u as FFIDContextValue, v as FFIDJwtClaims, w as FFIDLoginButton, x as FFIDOAuthTokenResponse, y as FFIDOAuthUserInfoMemberRole, z as FFIDOAuthUserInfoSubscription, B as FFIDOrganizationSwitcher, C as FFIDSeatModel, D as FFIDSubscription, E as FFIDSubscriptionBadge, G as FFIDSubscriptionStatus, H as FFIDTokenIntrospectionResponse, I as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, J as UseFFIDAnnouncementsReturn, K as useFFIDAnnouncements } from './index-
|
|
1
|
+
import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDError, d as FFIDSubscriptionCheckResponse, e as FFIDOAuthUserInfo, f as FFIDLogger, g as FFIDUser, h as FFIDOrganization, i as FFIDSubscriptionContextValue, j as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, k as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, l as FFIDAnnouncementsLogger } from './index-oF_MAO2T.js';
|
|
2
|
+
export { m as Announcement, n as AnnouncementStatus, o as AnnouncementType, p as FFIDAnnouncementBadge, q as FFIDAnnouncementList, r as FFIDAnnouncementsError, s as FFIDAnnouncementsErrorCode, t as FFIDAnnouncementsServerResponse, u as FFIDContextValue, v as FFIDJwtClaims, w as FFIDLoginButton, x as FFIDOAuthTokenResponse, y as FFIDOAuthUserInfoMemberRole, z as FFIDOAuthUserInfoSubscription, B as FFIDOrganizationSwitcher, C as FFIDSeatModel, D as FFIDSubscription, E as FFIDSubscriptionBadge, G as FFIDSubscriptionStatus, H as FFIDTokenIntrospectionResponse, I as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, J as UseFFIDAnnouncementsReturn, K as useFFIDAnnouncements } from './index-oF_MAO2T.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
5
5
|
|
|
@@ -108,6 +108,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
108
108
|
baseUrl: string;
|
|
109
109
|
serviceCode: string;
|
|
110
110
|
clientId: string;
|
|
111
|
+
redirectUri: string | null;
|
|
111
112
|
};
|
|
112
113
|
/** Type of the FFID client */
|
|
113
114
|
type FFIDClient = ReturnType<typeof createFFIDClient>;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFFIDContext } from './chunk-
|
|
2
|
-
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-
|
|
1
|
+
import { useFFIDContext } from './chunk-Q5XWUQHV.js';
|
|
2
|
+
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-Q5XWUQHV.js';
|
|
3
3
|
import { useRef, useEffect } from 'react';
|
|
4
4
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|