@feelflow/ffid-sdk 1.13.0 → 1.14.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.
@@ -437,7 +437,7 @@ function createBillingMethods(deps) {
437
437
  }
438
438
 
439
439
  // src/client/version-check.ts
440
- var SDK_VERSION = "1.13.0";
440
+ var SDK_VERSION = "1.14.0";
441
441
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
442
442
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
443
443
  function sdkHeaders() {
@@ -946,6 +946,7 @@ function base64UrlEncode(buffer) {
946
946
 
947
947
  // src/client/redirect.ts
948
948
  var OAUTH_AUTHORIZE_ENDPOINT = "/api/v1/oauth/authorize";
949
+ var AUTH_LOGOUT_ENDPOINT = "/api/v1/auth/logout";
949
950
  var STATE_RANDOM_BYTES = 16;
950
951
  var HEX_BASE2 = 16;
951
952
  function generateRandomState() {
@@ -1026,7 +1027,25 @@ function createRedirectMethods(deps) {
1026
1027
  }
1027
1028
  return `${baseUrl}/signup?redirect=${encodeURIComponent(redirect)}&service=${encodeURIComponent(serviceCode)}`;
1028
1029
  }
1029
- return { redirectToLogin, redirectToAuthorize, getLoginUrl, getSignupUrl };
1030
+ function getLogoutUrl(postLogoutRedirectUri) {
1031
+ const url = new URL(`${baseUrl}${AUTH_LOGOUT_ENDPOINT}`);
1032
+ url.searchParams.set("client_id", clientId);
1033
+ if (postLogoutRedirectUri != null) {
1034
+ url.searchParams.set("post_logout_redirect_uri", postLogoutRedirectUri);
1035
+ }
1036
+ return url.toString();
1037
+ }
1038
+ function redirectToLogout(postLogoutRedirectUri) {
1039
+ if (typeof window === "undefined") {
1040
+ logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
1041
+ return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
1042
+ }
1043
+ const logoutUrl = getLogoutUrl(postLogoutRedirectUri);
1044
+ logger.debug("Redirecting to logout:", logoutUrl);
1045
+ window.location.href = logoutUrl;
1046
+ return { success: true };
1047
+ }
1048
+ return { redirectToLogin, redirectToAuthorize, getLoginUrl, getSignupUrl, getLogoutUrl, redirectToLogout };
1030
1049
  }
1031
1050
 
1032
1051
  // src/client/password-reset.ts
@@ -1452,7 +1471,7 @@ function createFFIDClient(config) {
1452
1471
  }
1453
1472
  return signOutCookie();
1454
1473
  }
1455
- const { redirectToLogin, getLoginUrl, getSignupUrl } = createRedirectMethods({
1474
+ const { redirectToLogin, getLoginUrl, getSignupUrl, getLogoutUrl, redirectToLogout } = createRedirectMethods({
1456
1475
  authMode,
1457
1476
  baseUrl,
1458
1477
  clientId,
@@ -1513,7 +1532,9 @@ function createFFIDClient(config) {
1513
1532
  getSession,
1514
1533
  signOut,
1515
1534
  redirectToLogin,
1535
+ redirectToLogout,
1516
1536
  getLoginUrl,
1537
+ getLogoutUrl,
1517
1538
  getSignupUrl,
1518
1539
  createError,
1519
1540
  exchangeCodeForTokens,
@@ -435,7 +435,7 @@ function createBillingMethods(deps) {
435
435
  }
436
436
 
437
437
  // src/client/version-check.ts
438
- var SDK_VERSION = "1.13.0";
438
+ var SDK_VERSION = "1.14.0";
439
439
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
440
440
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
441
441
  function sdkHeaders() {
@@ -944,6 +944,7 @@ function base64UrlEncode(buffer) {
944
944
 
945
945
  // src/client/redirect.ts
946
946
  var OAUTH_AUTHORIZE_ENDPOINT = "/api/v1/oauth/authorize";
947
+ var AUTH_LOGOUT_ENDPOINT = "/api/v1/auth/logout";
947
948
  var STATE_RANDOM_BYTES = 16;
948
949
  var HEX_BASE2 = 16;
949
950
  function generateRandomState() {
@@ -1024,7 +1025,25 @@ function createRedirectMethods(deps) {
1024
1025
  }
1025
1026
  return `${baseUrl}/signup?redirect=${encodeURIComponent(redirect)}&service=${encodeURIComponent(serviceCode)}`;
1026
1027
  }
1027
- return { redirectToLogin, redirectToAuthorize, getLoginUrl, getSignupUrl };
1028
+ function getLogoutUrl(postLogoutRedirectUri) {
1029
+ const url = new URL(`${baseUrl}${AUTH_LOGOUT_ENDPOINT}`);
1030
+ url.searchParams.set("client_id", clientId);
1031
+ if (postLogoutRedirectUri != null) {
1032
+ url.searchParams.set("post_logout_redirect_uri", postLogoutRedirectUri);
1033
+ }
1034
+ return url.toString();
1035
+ }
1036
+ function redirectToLogout(postLogoutRedirectUri) {
1037
+ if (typeof window === "undefined") {
1038
+ logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
1039
+ return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
1040
+ }
1041
+ const logoutUrl = getLogoutUrl(postLogoutRedirectUri);
1042
+ logger.debug("Redirecting to logout:", logoutUrl);
1043
+ window.location.href = logoutUrl;
1044
+ return { success: true };
1045
+ }
1046
+ return { redirectToLogin, redirectToAuthorize, getLoginUrl, getSignupUrl, getLogoutUrl, redirectToLogout };
1028
1047
  }
1029
1048
 
1030
1049
  // src/client/password-reset.ts
@@ -1450,7 +1469,7 @@ function createFFIDClient(config) {
1450
1469
  }
1451
1470
  return signOutCookie();
1452
1471
  }
1453
- const { redirectToLogin, getLoginUrl, getSignupUrl } = createRedirectMethods({
1472
+ const { redirectToLogin, getLoginUrl, getSignupUrl, getLogoutUrl, redirectToLogout } = createRedirectMethods({
1454
1473
  authMode,
1455
1474
  baseUrl,
1456
1475
  clientId,
@@ -1511,7 +1530,9 @@ function createFFIDClient(config) {
1511
1530
  getSession,
1512
1531
  signOut,
1513
1532
  redirectToLogin,
1533
+ redirectToLogout,
1514
1534
  getLoginUrl,
1535
+ getLogoutUrl,
1515
1536
  getSignupUrl,
1516
1537
  createError,
1517
1538
  exchangeCodeForTokens,
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunk7YV3SUEY_cjs = require('../chunk-7YV3SUEY.cjs');
3
+ var chunkTMUFELR5_cjs = require('../chunk-TMUFELR5.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunk7YV3SUEY_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunkTMUFELR5_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunk7YV3SUEY_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunkTMUFELR5_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDLoginButton", {
16
16
  enumerable: true,
17
- get: function () { return chunk7YV3SUEY_cjs.FFIDLoginButton; }
17
+ get: function () { return chunkTMUFELR5_cjs.FFIDLoginButton; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
20
20
  enumerable: true,
21
- get: function () { return chunk7YV3SUEY_cjs.FFIDOrganizationSwitcher; }
21
+ get: function () { return chunkTMUFELR5_cjs.FFIDOrganizationSwitcher; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
24
24
  enumerable: true,
25
- get: function () { return chunk7YV3SUEY_cjs.FFIDSubscriptionBadge; }
25
+ get: function () { return chunkTMUFELR5_cjs.FFIDSubscriptionBadge; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDUserMenu", {
28
28
  enumerable: true,
29
- get: function () { return chunk7YV3SUEY_cjs.FFIDUserMenu; }
29
+ get: function () { return chunkTMUFELR5_cjs.FFIDUserMenu; }
30
30
  });
@@ -1,3 +1,3 @@
1
- export { y as FFIDAnnouncementBadge, W as FFIDAnnouncementBadgeClassNames, X as FFIDAnnouncementBadgeProps, z as FFIDAnnouncementList, Y as FFIDAnnouncementListClassNames, Z as FFIDAnnouncementListProps, I as FFIDLoginButton, _ as FFIDLoginButtonProps, N as FFIDOrganizationSwitcher, $ as FFIDOrganizationSwitcherClassNames, a0 as FFIDOrganizationSwitcherProps, P as FFIDSubscriptionBadge, a1 as FFIDSubscriptionBadgeClassNames, a2 as FFIDSubscriptionBadgeProps, S as FFIDUserMenu, a3 as FFIDUserMenuClassNames, a4 as FFIDUserMenuProps } from '../index-GrAWBpmf.cjs';
1
+ export { y as FFIDAnnouncementBadge, W as FFIDAnnouncementBadgeClassNames, X as FFIDAnnouncementBadgeProps, z as FFIDAnnouncementList, Y as FFIDAnnouncementListClassNames, Z as FFIDAnnouncementListProps, I as FFIDLoginButton, _ as FFIDLoginButtonProps, N as FFIDOrganizationSwitcher, $ as FFIDOrganizationSwitcherClassNames, a0 as FFIDOrganizationSwitcherProps, P as FFIDSubscriptionBadge, a1 as FFIDSubscriptionBadgeClassNames, a2 as FFIDSubscriptionBadgeProps, S as FFIDUserMenu, a3 as FFIDUserMenuClassNames, a4 as FFIDUserMenuProps } from '../index-DU-lFo9B.cjs';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
- export { y as FFIDAnnouncementBadge, W as FFIDAnnouncementBadgeClassNames, X as FFIDAnnouncementBadgeProps, z as FFIDAnnouncementList, Y as FFIDAnnouncementListClassNames, Z as FFIDAnnouncementListProps, I as FFIDLoginButton, _ as FFIDLoginButtonProps, N as FFIDOrganizationSwitcher, $ as FFIDOrganizationSwitcherClassNames, a0 as FFIDOrganizationSwitcherProps, P as FFIDSubscriptionBadge, a1 as FFIDSubscriptionBadgeClassNames, a2 as FFIDSubscriptionBadgeProps, S as FFIDUserMenu, a3 as FFIDUserMenuClassNames, a4 as FFIDUserMenuProps } from '../index-GrAWBpmf.js';
1
+ export { y as FFIDAnnouncementBadge, W as FFIDAnnouncementBadgeClassNames, X as FFIDAnnouncementBadgeProps, z as FFIDAnnouncementList, Y as FFIDAnnouncementListClassNames, Z as FFIDAnnouncementListProps, I as FFIDLoginButton, _ as FFIDLoginButtonProps, N as FFIDOrganizationSwitcher, $ as FFIDOrganizationSwitcherClassNames, a0 as FFIDOrganizationSwitcherProps, P as FFIDSubscriptionBadge, a1 as FFIDSubscriptionBadgeClassNames, a2 as FFIDSubscriptionBadgeProps, S as FFIDUserMenu, a3 as FFIDUserMenuClassNames, a4 as FFIDUserMenuProps } from '../index-DU-lFo9B.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-KFOIVZEY.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-WJI7D5C7.js';
@@ -376,7 +376,7 @@ interface FFIDCreatePortalParams {
376
376
  returnUrl: string;
377
377
  }
378
378
  /**
379
- * Result of a redirect operation (redirectToLogin / redirectToAuthorize)
379
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
380
380
  *
381
381
  * Structured return type so callers can inspect failure reasons
382
382
  * instead of receiving a bare `false`.
@@ -376,7 +376,7 @@ interface FFIDCreatePortalParams {
376
376
  returnUrl: string;
377
377
  }
378
378
  /**
379
- * Result of a redirect operation (redirectToLogin / redirectToAuthorize)
379
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
380
380
  *
381
381
  * Structured return type so callers can inspect failure reasons
382
382
  * instead of receiving a bare `false`.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk7YV3SUEY_cjs = require('./chunk-7YV3SUEY.cjs');
3
+ var chunkTMUFELR5_cjs = require('./chunk-TMUFELR5.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 } = chunk7YV3SUEY_cjs.useFFIDContext();
49
+ const { isLoading, isAuthenticated, login } = chunkTMUFELR5_cjs.useFFIDContext();
50
50
  const hasRedirected = react.useRef(false);
51
51
  react.useEffect(() => {
52
52
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -71,83 +71,83 @@ function withFFIDAuth(Component, options = {}) {
71
71
 
72
72
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
73
73
  enumerable: true,
74
- get: function () { return chunk7YV3SUEY_cjs.DEFAULT_API_BASE_URL; }
74
+ get: function () { return chunkTMUFELR5_cjs.DEFAULT_API_BASE_URL; }
75
75
  });
76
76
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
77
77
  enumerable: true,
78
- get: function () { return chunk7YV3SUEY_cjs.FFIDAnnouncementBadge; }
78
+ get: function () { return chunkTMUFELR5_cjs.FFIDAnnouncementBadge; }
79
79
  });
80
80
  Object.defineProperty(exports, "FFIDAnnouncementList", {
81
81
  enumerable: true,
82
- get: function () { return chunk7YV3SUEY_cjs.FFIDAnnouncementList; }
82
+ get: function () { return chunkTMUFELR5_cjs.FFIDAnnouncementList; }
83
83
  });
84
84
  Object.defineProperty(exports, "FFIDLoginButton", {
85
85
  enumerable: true,
86
- get: function () { return chunk7YV3SUEY_cjs.FFIDLoginButton; }
86
+ get: function () { return chunkTMUFELR5_cjs.FFIDLoginButton; }
87
87
  });
88
88
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
89
89
  enumerable: true,
90
- get: function () { return chunk7YV3SUEY_cjs.FFIDOrganizationSwitcher; }
90
+ get: function () { return chunkTMUFELR5_cjs.FFIDOrganizationSwitcher; }
91
91
  });
92
92
  Object.defineProperty(exports, "FFIDProvider", {
93
93
  enumerable: true,
94
- get: function () { return chunk7YV3SUEY_cjs.FFIDProvider; }
94
+ get: function () { return chunkTMUFELR5_cjs.FFIDProvider; }
95
95
  });
96
96
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
97
97
  enumerable: true,
98
- get: function () { return chunk7YV3SUEY_cjs.FFIDSubscriptionBadge; }
98
+ get: function () { return chunkTMUFELR5_cjs.FFIDSubscriptionBadge; }
99
99
  });
100
100
  Object.defineProperty(exports, "FFIDUserMenu", {
101
101
  enumerable: true,
102
- get: function () { return chunk7YV3SUEY_cjs.FFIDUserMenu; }
102
+ get: function () { return chunkTMUFELR5_cjs.FFIDUserMenu; }
103
103
  });
104
104
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
105
105
  enumerable: true,
106
- get: function () { return chunk7YV3SUEY_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
106
+ get: function () { return chunkTMUFELR5_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
107
107
  });
108
108
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
109
109
  enumerable: true,
110
- get: function () { return chunk7YV3SUEY_cjs.createFFIDAnnouncementsClient; }
110
+ get: function () { return chunkTMUFELR5_cjs.createFFIDAnnouncementsClient; }
111
111
  });
112
112
  Object.defineProperty(exports, "createFFIDClient", {
113
113
  enumerable: true,
114
- get: function () { return chunk7YV3SUEY_cjs.createFFIDClient; }
114
+ get: function () { return chunkTMUFELR5_cjs.createFFIDClient; }
115
115
  });
116
116
  Object.defineProperty(exports, "createTokenStore", {
117
117
  enumerable: true,
118
- get: function () { return chunk7YV3SUEY_cjs.createTokenStore; }
118
+ get: function () { return chunkTMUFELR5_cjs.createTokenStore; }
119
119
  });
120
120
  Object.defineProperty(exports, "generateCodeChallenge", {
121
121
  enumerable: true,
122
- get: function () { return chunk7YV3SUEY_cjs.generateCodeChallenge; }
122
+ get: function () { return chunkTMUFELR5_cjs.generateCodeChallenge; }
123
123
  });
124
124
  Object.defineProperty(exports, "generateCodeVerifier", {
125
125
  enumerable: true,
126
- get: function () { return chunk7YV3SUEY_cjs.generateCodeVerifier; }
126
+ get: function () { return chunkTMUFELR5_cjs.generateCodeVerifier; }
127
127
  });
128
128
  Object.defineProperty(exports, "retrieveCodeVerifier", {
129
129
  enumerable: true,
130
- get: function () { return chunk7YV3SUEY_cjs.retrieveCodeVerifier; }
130
+ get: function () { return chunkTMUFELR5_cjs.retrieveCodeVerifier; }
131
131
  });
132
132
  Object.defineProperty(exports, "storeCodeVerifier", {
133
133
  enumerable: true,
134
- get: function () { return chunk7YV3SUEY_cjs.storeCodeVerifier; }
134
+ get: function () { return chunkTMUFELR5_cjs.storeCodeVerifier; }
135
135
  });
136
136
  Object.defineProperty(exports, "useFFID", {
137
137
  enumerable: true,
138
- get: function () { return chunk7YV3SUEY_cjs.useFFID; }
138
+ get: function () { return chunkTMUFELR5_cjs.useFFID; }
139
139
  });
140
140
  Object.defineProperty(exports, "useFFIDAnnouncements", {
141
141
  enumerable: true,
142
- get: function () { return chunk7YV3SUEY_cjs.useFFIDAnnouncements; }
142
+ get: function () { return chunkTMUFELR5_cjs.useFFIDAnnouncements; }
143
143
  });
144
144
  Object.defineProperty(exports, "useSubscription", {
145
145
  enumerable: true,
146
- get: function () { return chunk7YV3SUEY_cjs.useSubscription; }
146
+ get: function () { return chunkTMUFELR5_cjs.useSubscription; }
147
147
  });
148
148
  Object.defineProperty(exports, "withSubscription", {
149
149
  enumerable: true,
150
- get: function () { return chunk7YV3SUEY_cjs.withSubscription; }
150
+ get: function () { return chunkTMUFELR5_cjs.withSubscription; }
151
151
  });
152
152
  exports.createKVCacheAdapter = createKVCacheAdapter;
153
153
  exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDRedirectResult, d as FFIDError, e as FFIDSubscriptionCheckResponse, f as FFIDCreateCheckoutParams, g as FFIDCheckoutSessionResponse, h as FFIDCreatePortalParams, i as FFIDPortalSessionResponse, j as FFIDVerifyAccessTokenOptions, k as FFIDOAuthUserInfo, l as FFIDAuthMode, m as FFIDLogger, n as FFIDCacheAdapter, o as FFIDUser, p as FFIDOrganization, q as FFIDSubscription, r as FFIDSubscriptionContextValue, s as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, t as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, u as FFIDAnnouncementsLogger } from './index-GrAWBpmf.cjs';
2
- export { v as Announcement, w as AnnouncementStatus, x as AnnouncementType, y as FFIDAnnouncementBadge, z as FFIDAnnouncementList, B as FFIDAnnouncementsError, C as FFIDAnnouncementsErrorCode, D as FFIDAnnouncementsServerResponse, E as FFIDCacheConfig, G as FFIDContextValue, H as FFIDJwtClaims, I as FFIDLoginButton, J as FFIDOAuthTokenResponse, K as FFIDOAuthUserInfoMemberRole, M as FFIDOAuthUserInfoSubscription, N as FFIDOrganizationSwitcher, O as FFIDSeatModel, P as FFIDSubscriptionBadge, Q as FFIDSubscriptionStatus, R as FFIDTokenIntrospectionResponse, S as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, T as UseFFIDAnnouncementsReturn, V as useFFIDAnnouncements } from './index-GrAWBpmf.cjs';
1
+ import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDRedirectResult, d as FFIDError, e as FFIDSubscriptionCheckResponse, f as FFIDCreateCheckoutParams, g as FFIDCheckoutSessionResponse, h as FFIDCreatePortalParams, i as FFIDPortalSessionResponse, j as FFIDVerifyAccessTokenOptions, k as FFIDOAuthUserInfo, l as FFIDAuthMode, m as FFIDLogger, n as FFIDCacheAdapter, o as FFIDUser, p as FFIDOrganization, q as FFIDSubscription, r as FFIDSubscriptionContextValue, s as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, t as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, u as FFIDAnnouncementsLogger } from './index-DU-lFo9B.cjs';
2
+ export { v as Announcement, w as AnnouncementStatus, x as AnnouncementType, y as FFIDAnnouncementBadge, z as FFIDAnnouncementList, B as FFIDAnnouncementsError, C as FFIDAnnouncementsErrorCode, D as FFIDAnnouncementsServerResponse, E as FFIDCacheConfig, G as FFIDContextValue, H as FFIDJwtClaims, I as FFIDLoginButton, J as FFIDOAuthTokenResponse, K as FFIDOAuthUserInfoMemberRole, M as FFIDOAuthUserInfoSubscription, N as FFIDOrganizationSwitcher, O as FFIDSeatModel, P as FFIDSubscriptionBadge, Q as FFIDSubscriptionStatus, R as FFIDTokenIntrospectionResponse, S as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, T as UseFFIDAnnouncementsReturn, V as useFFIDAnnouncements } from './index-DU-lFo9B.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode, ComponentType, FC } from 'react';
5
5
 
@@ -134,7 +134,9 @@ declare function createFFIDClient(config: FFIDConfig): {
134
134
  getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
135
135
  signOut: () => Promise<FFIDApiResponse<void>>;
136
136
  redirectToLogin: () => Promise<FFIDRedirectResult>;
137
+ redirectToLogout: (postLogoutRedirectUri?: string) => FFIDRedirectResult;
137
138
  getLoginUrl: (redirectUrl?: string) => string;
139
+ getLogoutUrl: (postLogoutRedirectUri?: string) => string;
138
140
  getSignupUrl: (redirectUrl?: string) => string;
139
141
  createError: (code: string, message: string) => FFIDError;
140
142
  exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDRedirectResult, d as FFIDError, e as FFIDSubscriptionCheckResponse, f as FFIDCreateCheckoutParams, g as FFIDCheckoutSessionResponse, h as FFIDCreatePortalParams, i as FFIDPortalSessionResponse, j as FFIDVerifyAccessTokenOptions, k as FFIDOAuthUserInfo, l as FFIDAuthMode, m as FFIDLogger, n as FFIDCacheAdapter, o as FFIDUser, p as FFIDOrganization, q as FFIDSubscription, r as FFIDSubscriptionContextValue, s as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, t as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, u as FFIDAnnouncementsLogger } from './index-GrAWBpmf.js';
2
- export { v as Announcement, w as AnnouncementStatus, x as AnnouncementType, y as FFIDAnnouncementBadge, z as FFIDAnnouncementList, B as FFIDAnnouncementsError, C as FFIDAnnouncementsErrorCode, D as FFIDAnnouncementsServerResponse, E as FFIDCacheConfig, G as FFIDContextValue, H as FFIDJwtClaims, I as FFIDLoginButton, J as FFIDOAuthTokenResponse, K as FFIDOAuthUserInfoMemberRole, M as FFIDOAuthUserInfoSubscription, N as FFIDOrganizationSwitcher, O as FFIDSeatModel, P as FFIDSubscriptionBadge, Q as FFIDSubscriptionStatus, R as FFIDTokenIntrospectionResponse, S as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, T as UseFFIDAnnouncementsReturn, V as useFFIDAnnouncements } from './index-GrAWBpmf.js';
1
+ import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDRedirectResult, d as FFIDError, e as FFIDSubscriptionCheckResponse, f as FFIDCreateCheckoutParams, g as FFIDCheckoutSessionResponse, h as FFIDCreatePortalParams, i as FFIDPortalSessionResponse, j as FFIDVerifyAccessTokenOptions, k as FFIDOAuthUserInfo, l as FFIDAuthMode, m as FFIDLogger, n as FFIDCacheAdapter, o as FFIDUser, p as FFIDOrganization, q as FFIDSubscription, r as FFIDSubscriptionContextValue, s as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, t as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, u as FFIDAnnouncementsLogger } from './index-DU-lFo9B.js';
2
+ export { v as Announcement, w as AnnouncementStatus, x as AnnouncementType, y as FFIDAnnouncementBadge, z as FFIDAnnouncementList, B as FFIDAnnouncementsError, C as FFIDAnnouncementsErrorCode, D as FFIDAnnouncementsServerResponse, E as FFIDCacheConfig, G as FFIDContextValue, H as FFIDJwtClaims, I as FFIDLoginButton, J as FFIDOAuthTokenResponse, K as FFIDOAuthUserInfoMemberRole, M as FFIDOAuthUserInfoSubscription, N as FFIDOrganizationSwitcher, O as FFIDSeatModel, P as FFIDSubscriptionBadge, Q as FFIDSubscriptionStatus, R as FFIDTokenIntrospectionResponse, S as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, T as UseFFIDAnnouncementsReturn, V as useFFIDAnnouncements } from './index-DU-lFo9B.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode, ComponentType, FC } from 'react';
5
5
 
@@ -134,7 +134,9 @@ declare function createFFIDClient(config: FFIDConfig): {
134
134
  getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
135
135
  signOut: () => Promise<FFIDApiResponse<void>>;
136
136
  redirectToLogin: () => Promise<FFIDRedirectResult>;
137
+ redirectToLogout: (postLogoutRedirectUri?: string) => FFIDRedirectResult;
137
138
  getLoginUrl: (redirectUrl?: string) => string;
139
+ getLogoutUrl: (postLogoutRedirectUri?: string) => string;
138
140
  getSignupUrl: (redirectUrl?: string) => string;
139
141
  createError: (code: string, message: string) => FFIDError;
140
142
  exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext } from './chunk-KFOIVZEY.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-KFOIVZEY.js';
1
+ import { useFFIDContext } from './chunk-WJI7D5C7.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-WJI7D5C7.js';
3
3
  import { useRef, useEffect } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -433,7 +433,7 @@ function createBillingMethods(deps) {
433
433
  }
434
434
 
435
435
  // src/client/version-check.ts
436
- var SDK_VERSION = "1.13.0";
436
+ var SDK_VERSION = "1.14.0";
437
437
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
438
438
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
439
439
  function sdkHeaders() {
@@ -929,6 +929,7 @@ function base64UrlEncode(buffer) {
929
929
 
930
930
  // src/client/redirect.ts
931
931
  var OAUTH_AUTHORIZE_ENDPOINT = "/api/v1/oauth/authorize";
932
+ var AUTH_LOGOUT_ENDPOINT = "/api/v1/auth/logout";
932
933
  var STATE_RANDOM_BYTES = 16;
933
934
  var HEX_BASE2 = 16;
934
935
  function generateRandomState() {
@@ -1009,7 +1010,25 @@ function createRedirectMethods(deps) {
1009
1010
  }
1010
1011
  return `${baseUrl}/signup?redirect=${encodeURIComponent(redirect)}&service=${encodeURIComponent(serviceCode)}`;
1011
1012
  }
1012
- return { redirectToLogin, redirectToAuthorize, getLoginUrl, getSignupUrl };
1013
+ function getLogoutUrl(postLogoutRedirectUri) {
1014
+ const url = new URL(`${baseUrl}${AUTH_LOGOUT_ENDPOINT}`);
1015
+ url.searchParams.set("client_id", clientId);
1016
+ if (postLogoutRedirectUri != null) {
1017
+ url.searchParams.set("post_logout_redirect_uri", postLogoutRedirectUri);
1018
+ }
1019
+ return url.toString();
1020
+ }
1021
+ function redirectToLogout(postLogoutRedirectUri) {
1022
+ if (typeof window === "undefined") {
1023
+ logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
1024
+ return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
1025
+ }
1026
+ const logoutUrl = getLogoutUrl(postLogoutRedirectUri);
1027
+ logger.debug("Redirecting to logout:", logoutUrl);
1028
+ window.location.href = logoutUrl;
1029
+ return { success: true };
1030
+ }
1031
+ return { redirectToLogin, redirectToAuthorize, getLoginUrl, getSignupUrl, getLogoutUrl, redirectToLogout };
1013
1032
  }
1014
1033
 
1015
1034
  // src/client/password-reset.ts
@@ -1435,7 +1454,7 @@ function createFFIDClient(config) {
1435
1454
  }
1436
1455
  return signOutCookie();
1437
1456
  }
1438
- const { redirectToLogin, getLoginUrl, getSignupUrl } = createRedirectMethods({
1457
+ const { redirectToLogin, getLoginUrl, getSignupUrl, getLogoutUrl, redirectToLogout } = createRedirectMethods({
1439
1458
  authMode,
1440
1459
  baseUrl,
1441
1460
  clientId,
@@ -1496,7 +1515,9 @@ function createFFIDClient(config) {
1496
1515
  getSession,
1497
1516
  signOut,
1498
1517
  redirectToLogin,
1518
+ redirectToLogout,
1499
1519
  getLoginUrl,
1520
+ getLogoutUrl,
1500
1521
  getSignupUrl,
1501
1522
  createError,
1502
1523
  exchangeCodeForTokens,
@@ -302,7 +302,7 @@ interface FFIDCreatePortalParams {
302
302
  returnUrl: string;
303
303
  }
304
304
  /**
305
- * Result of a redirect operation (redirectToLogin / redirectToAuthorize)
305
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
306
306
  *
307
307
  * Structured return type so callers can inspect failure reasons
308
308
  * instead of receiving a bare `false`.
@@ -397,7 +397,9 @@ declare function createFFIDClient(config: FFIDConfig): {
397
397
  getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
398
398
  signOut: () => Promise<FFIDApiResponse<void>>;
399
399
  redirectToLogin: () => Promise<FFIDRedirectResult>;
400
+ redirectToLogout: (postLogoutRedirectUri?: string) => FFIDRedirectResult;
400
401
  getLoginUrl: (redirectUrl?: string) => string;
402
+ getLogoutUrl: (postLogoutRedirectUri?: string) => string;
401
403
  getSignupUrl: (redirectUrl?: string) => string;
402
404
  createError: (code: string, message: string) => FFIDError;
403
405
  exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
@@ -302,7 +302,7 @@ interface FFIDCreatePortalParams {
302
302
  returnUrl: string;
303
303
  }
304
304
  /**
305
- * Result of a redirect operation (redirectToLogin / redirectToAuthorize)
305
+ * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
306
306
  *
307
307
  * Structured return type so callers can inspect failure reasons
308
308
  * instead of receiving a bare `false`.
@@ -397,7 +397,9 @@ declare function createFFIDClient(config: FFIDConfig): {
397
397
  getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
398
398
  signOut: () => Promise<FFIDApiResponse<void>>;
399
399
  redirectToLogin: () => Promise<FFIDRedirectResult>;
400
+ redirectToLogout: (postLogoutRedirectUri?: string) => FFIDRedirectResult;
400
401
  getLoginUrl: (redirectUrl?: string) => string;
402
+ getLogoutUrl: (postLogoutRedirectUri?: string) => string;
401
403
  getSignupUrl: (redirectUrl?: string) => string;
402
404
  createError: (code: string, message: string) => FFIDError;
403
405
  exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
@@ -432,7 +432,7 @@ function createBillingMethods(deps) {
432
432
  }
433
433
 
434
434
  // src/client/version-check.ts
435
- var SDK_VERSION = "1.13.0";
435
+ var SDK_VERSION = "1.14.0";
436
436
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
437
437
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
438
438
  function sdkHeaders() {
@@ -928,6 +928,7 @@ function base64UrlEncode(buffer) {
928
928
 
929
929
  // src/client/redirect.ts
930
930
  var OAUTH_AUTHORIZE_ENDPOINT = "/api/v1/oauth/authorize";
931
+ var AUTH_LOGOUT_ENDPOINT = "/api/v1/auth/logout";
931
932
  var STATE_RANDOM_BYTES = 16;
932
933
  var HEX_BASE2 = 16;
933
934
  function generateRandomState() {
@@ -1008,7 +1009,25 @@ function createRedirectMethods(deps) {
1008
1009
  }
1009
1010
  return `${baseUrl}/signup?redirect=${encodeURIComponent(redirect)}&service=${encodeURIComponent(serviceCode)}`;
1010
1011
  }
1011
- return { redirectToLogin, redirectToAuthorize, getLoginUrl, getSignupUrl };
1012
+ function getLogoutUrl(postLogoutRedirectUri) {
1013
+ const url = new URL(`${baseUrl}${AUTH_LOGOUT_ENDPOINT}`);
1014
+ url.searchParams.set("client_id", clientId);
1015
+ if (postLogoutRedirectUri != null) {
1016
+ url.searchParams.set("post_logout_redirect_uri", postLogoutRedirectUri);
1017
+ }
1018
+ return url.toString();
1019
+ }
1020
+ function redirectToLogout(postLogoutRedirectUri) {
1021
+ if (typeof window === "undefined") {
1022
+ logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
1023
+ return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
1024
+ }
1025
+ const logoutUrl = getLogoutUrl(postLogoutRedirectUri);
1026
+ logger.debug("Redirecting to logout:", logoutUrl);
1027
+ window.location.href = logoutUrl;
1028
+ return { success: true };
1029
+ }
1030
+ return { redirectToLogin, redirectToAuthorize, getLoginUrl, getSignupUrl, getLogoutUrl, redirectToLogout };
1012
1031
  }
1013
1032
 
1014
1033
  // src/client/password-reset.ts
@@ -1434,7 +1453,7 @@ function createFFIDClient(config) {
1434
1453
  }
1435
1454
  return signOutCookie();
1436
1455
  }
1437
- const { redirectToLogin, getLoginUrl, getSignupUrl } = createRedirectMethods({
1456
+ const { redirectToLogin, getLoginUrl, getSignupUrl, getLogoutUrl, redirectToLogout } = createRedirectMethods({
1438
1457
  authMode,
1439
1458
  baseUrl,
1440
1459
  clientId,
@@ -1495,7 +1514,9 @@ function createFFIDClient(config) {
1495
1514
  getSession,
1496
1515
  signOut,
1497
1516
  redirectToLogin,
1517
+ redirectToLogout,
1498
1518
  getLoginUrl,
1519
+ getLogoutUrl,
1499
1520
  getSignupUrl,
1500
1521
  createError,
1501
1522
  exchangeCodeForTokens,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",