@feelflow/ffid-sdk 1.2.0 → 1.2.2

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.
@@ -630,6 +630,11 @@ function createFFIDClient(config) {
630
630
  if (!response.ok) {
631
631
  const errorBody = tokenResponse;
632
632
  logger.error("Token refresh failed:", errorBody);
633
+ const irrecoverableErrors = ["token_revoked", "invalid_grant"];
634
+ if (errorBody.error && irrecoverableErrors.includes(errorBody.error)) {
635
+ tokenStore.clearTokens();
636
+ logger.debug("Cleared tokens due to irrecoverable refresh error:", errorBody.error);
637
+ }
633
638
  return {
634
639
  error: {
635
640
  code: errorBody.error ?? FFID_ERROR_CODES.TOKEN_REFRESH_ERROR,
@@ -2018,6 +2023,7 @@ exports.FFIDSubscriptionBadge = FFIDSubscriptionBadge;
2018
2023
  exports.FFIDUserMenu = FFIDUserMenu;
2019
2024
  exports.FFID_ANNOUNCEMENTS_ERROR_CODES = FFID_ANNOUNCEMENTS_ERROR_CODES;
2020
2025
  exports.createFFIDAnnouncementsClient = createFFIDAnnouncementsClient;
2026
+ exports.createFFIDClient = createFFIDClient;
2021
2027
  exports.createTokenStore = createTokenStore;
2022
2028
  exports.generateCodeChallenge = generateCodeChallenge;
2023
2029
  exports.generateCodeVerifier = generateCodeVerifier;
@@ -628,6 +628,11 @@ function createFFIDClient(config) {
628
628
  if (!response.ok) {
629
629
  const errorBody = tokenResponse;
630
630
  logger.error("Token refresh failed:", errorBody);
631
+ const irrecoverableErrors = ["token_revoked", "invalid_grant"];
632
+ if (errorBody.error && irrecoverableErrors.includes(errorBody.error)) {
633
+ tokenStore.clearTokens();
634
+ logger.debug("Cleared tokens due to irrecoverable refresh error:", errorBody.error);
635
+ }
631
636
  return {
632
637
  error: {
633
638
  code: errorBody.error ?? FFID_ERROR_CODES.TOKEN_REFRESH_ERROR,
@@ -2006,4 +2011,4 @@ function FFIDAnnouncementList({
2006
2011
  );
2007
2012
  }
2008
2013
 
2009
- export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useFFIDContext, useSubscription, withSubscription };
2014
+ 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, useFFIDContext, useSubscription, withSubscription };
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkDFZPKRHW_cjs = require('../chunk-DFZPKRHW.cjs');
3
+ var chunk2IGDU2LY_cjs = require('../chunk-2IGDU2LY.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunkDFZPKRHW_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunk2IGDU2LY_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunkDFZPKRHW_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunk2IGDU2LY_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDLoginButton", {
16
16
  enumerable: true,
17
- get: function () { return chunkDFZPKRHW_cjs.FFIDLoginButton; }
17
+ get: function () { return chunk2IGDU2LY_cjs.FFIDLoginButton; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
20
20
  enumerable: true,
21
- get: function () { return chunkDFZPKRHW_cjs.FFIDOrganizationSwitcher; }
21
+ get: function () { return chunk2IGDU2LY_cjs.FFIDOrganizationSwitcher; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
24
24
  enumerable: true,
25
- get: function () { return chunkDFZPKRHW_cjs.FFIDSubscriptionBadge; }
25
+ get: function () { return chunk2IGDU2LY_cjs.FFIDSubscriptionBadge; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDUserMenu", {
28
28
  enumerable: true,
29
- get: function () { return chunkDFZPKRHW_cjs.FFIDUserMenu; }
29
+ get: function () { return chunk2IGDU2LY_cjs.FFIDUserMenu; }
30
30
  });
@@ -1,3 +1,3 @@
1
- export { k as FFIDAnnouncementBadge, J as FFIDAnnouncementBadgeClassNames, K as FFIDAnnouncementBadgeProps, l as FFIDAnnouncementList, M as FFIDAnnouncementListClassNames, N as FFIDAnnouncementListProps, s as FFIDLoginButton, O as FFIDLoginButtonProps, x as FFIDOrganizationSwitcher, P as FFIDOrganizationSwitcherClassNames, Q as FFIDOrganizationSwitcherProps, C as FFIDSubscriptionBadge, R as FFIDSubscriptionBadgeClassNames, S as FFIDSubscriptionBadgeProps, G as FFIDUserMenu, T as FFIDUserMenuClassNames, V as FFIDUserMenuProps } from '../index-BqhbNrX_.cjs';
1
+ export { o as FFIDAnnouncementBadge, J as FFIDAnnouncementBadgeClassNames, K as FFIDAnnouncementBadgeProps, p as FFIDAnnouncementList, M as FFIDAnnouncementListClassNames, N as FFIDAnnouncementListProps, u as FFIDLoginButton, O as FFIDLoginButtonProps, z as FFIDOrganizationSwitcher, P as FFIDOrganizationSwitcherClassNames, Q as FFIDOrganizationSwitcherProps, D as FFIDSubscriptionBadge, R as FFIDSubscriptionBadgeClassNames, S as FFIDSubscriptionBadgeProps, G as FFIDUserMenu, T as FFIDUserMenuClassNames, V as FFIDUserMenuProps } from '../index-Bzwet6m2.cjs';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
- export { k as FFIDAnnouncementBadge, J as FFIDAnnouncementBadgeClassNames, K as FFIDAnnouncementBadgeProps, l as FFIDAnnouncementList, M as FFIDAnnouncementListClassNames, N as FFIDAnnouncementListProps, s as FFIDLoginButton, O as FFIDLoginButtonProps, x as FFIDOrganizationSwitcher, P as FFIDOrganizationSwitcherClassNames, Q as FFIDOrganizationSwitcherProps, C as FFIDSubscriptionBadge, R as FFIDSubscriptionBadgeClassNames, S as FFIDSubscriptionBadgeProps, G as FFIDUserMenu, T as FFIDUserMenuClassNames, V as FFIDUserMenuProps } from '../index-BqhbNrX_.js';
1
+ export { o as FFIDAnnouncementBadge, J as FFIDAnnouncementBadgeClassNames, K as FFIDAnnouncementBadgeProps, p as FFIDAnnouncementList, M as FFIDAnnouncementListClassNames, N as FFIDAnnouncementListProps, u as FFIDLoginButton, O as FFIDLoginButtonProps, z as FFIDOrganizationSwitcher, P as FFIDOrganizationSwitcherClassNames, Q as FFIDOrganizationSwitcherProps, D as FFIDSubscriptionBadge, R as FFIDSubscriptionBadgeClassNames, S as FFIDSubscriptionBadgeProps, G as FFIDUserMenu, T as FFIDUserMenuClassNames, V as FFIDUserMenuProps } from '../index-Bzwet6m2.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-4CVQ5THN.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-FZWW3B4X.js';
@@ -618,4 +618,4 @@ interface FFIDAnnouncementListProps {
618
618
  */
619
619
  declare function FFIDAnnouncementList({ announcements, isLoading, className, classNames, style, formatDate, emptyMessage, loadingRender, renderItem, maxContentLines, }: FFIDAnnouncementListProps): react_jsx_runtime.JSX.Element;
620
620
 
621
- export { type AnnouncementListResponse as A, type FFIDSubscription as B, FFIDSubscriptionBadge as C, type FFIDSubscriptionCheckResponse as D, type FFIDSubscriptionStatus as E, type FFIDConfig as F, FFIDUserMenu as G, type UseFFIDAnnouncementsReturn as H, useFFIDAnnouncements as I, type FFIDAnnouncementBadgeClassNames as J, type FFIDAnnouncementBadgeProps as K, type ListAnnouncementsOptions as L, type FFIDAnnouncementListClassNames as M, type FFIDAnnouncementListProps as N, type FFIDLoginButtonProps as O, type FFIDOrganizationSwitcherClassNames as P, type FFIDOrganizationSwitcherProps as Q, type FFIDSubscriptionBadgeClassNames as R, type FFIDSubscriptionBadgeProps as S, type FFIDUserMenuClassNames as T, type UseFFIDAnnouncementsOptions as U, type FFIDUserMenuProps as V, type FFIDUser as a, type FFIDOrganization as b, type FFIDError as c, type FFIDSubscriptionContextValue as d, type FFIDAnnouncementsClientConfig as e, type FFIDAnnouncementsApiResponse as f, type FFIDAnnouncementsLogger as g, type Announcement as h, type AnnouncementStatus as i, type AnnouncementType as j, FFIDAnnouncementBadge as k, FFIDAnnouncementList as l, type FFIDAnnouncementsError as m, type FFIDAnnouncementsErrorCode as n, type FFIDAnnouncementsServerResponse as o, type FFIDApiResponse as p, type FFIDContextValue as q, type FFIDLogger as r, FFIDLoginButton as s, type FFIDOAuthTokenResponse as t, type FFIDOAuthUserInfo as u, type FFIDOAuthUserInfoMemberRole as v, type FFIDOAuthUserInfoSubscription as w, FFIDOrganizationSwitcher as x, type FFIDSeatModel as y, type FFIDSessionResponse as z };
621
+ export { type AnnouncementListResponse as A, type FFIDSeatModel as B, type FFIDSubscription as C, FFIDSubscriptionBadge as D, type FFIDSubscriptionStatus as E, type FFIDConfig as F, FFIDUserMenu as G, type UseFFIDAnnouncementsReturn as H, useFFIDAnnouncements as I, type FFIDAnnouncementBadgeClassNames as J, type FFIDAnnouncementBadgeProps as K, type ListAnnouncementsOptions as L, type FFIDAnnouncementListClassNames as M, type FFIDAnnouncementListProps as N, type FFIDLoginButtonProps as O, type FFIDOrganizationSwitcherClassNames as P, type FFIDOrganizationSwitcherProps as Q, type FFIDSubscriptionBadgeClassNames as R, type FFIDSubscriptionBadgeProps as S, type FFIDUserMenuClassNames as T, type UseFFIDAnnouncementsOptions as U, type FFIDUserMenuProps as V, type FFIDApiResponse as a, type FFIDSessionResponse as b, type FFIDError as c, type FFIDSubscriptionCheckResponse as d, type FFIDLogger as e, type FFIDUser as f, type FFIDOrganization as g, type FFIDSubscriptionContextValue as h, type FFIDAnnouncementsClientConfig as i, type FFIDAnnouncementsApiResponse as j, type FFIDAnnouncementsLogger as k, type Announcement as l, type AnnouncementStatus as m, type AnnouncementType as n, FFIDAnnouncementBadge as o, FFIDAnnouncementList as p, type FFIDAnnouncementsError as q, type FFIDAnnouncementsErrorCode as r, type FFIDAnnouncementsServerResponse as s, type FFIDContextValue as t, FFIDLoginButton as u, type FFIDOAuthTokenResponse as v, type FFIDOAuthUserInfo as w, type FFIDOAuthUserInfoMemberRole as x, type FFIDOAuthUserInfoSubscription as y, FFIDOrganizationSwitcher as z };
@@ -618,4 +618,4 @@ interface FFIDAnnouncementListProps {
618
618
  */
619
619
  declare function FFIDAnnouncementList({ announcements, isLoading, className, classNames, style, formatDate, emptyMessage, loadingRender, renderItem, maxContentLines, }: FFIDAnnouncementListProps): react_jsx_runtime.JSX.Element;
620
620
 
621
- export { type AnnouncementListResponse as A, type FFIDSubscription as B, FFIDSubscriptionBadge as C, type FFIDSubscriptionCheckResponse as D, type FFIDSubscriptionStatus as E, type FFIDConfig as F, FFIDUserMenu as G, type UseFFIDAnnouncementsReturn as H, useFFIDAnnouncements as I, type FFIDAnnouncementBadgeClassNames as J, type FFIDAnnouncementBadgeProps as K, type ListAnnouncementsOptions as L, type FFIDAnnouncementListClassNames as M, type FFIDAnnouncementListProps as N, type FFIDLoginButtonProps as O, type FFIDOrganizationSwitcherClassNames as P, type FFIDOrganizationSwitcherProps as Q, type FFIDSubscriptionBadgeClassNames as R, type FFIDSubscriptionBadgeProps as S, type FFIDUserMenuClassNames as T, type UseFFIDAnnouncementsOptions as U, type FFIDUserMenuProps as V, type FFIDUser as a, type FFIDOrganization as b, type FFIDError as c, type FFIDSubscriptionContextValue as d, type FFIDAnnouncementsClientConfig as e, type FFIDAnnouncementsApiResponse as f, type FFIDAnnouncementsLogger as g, type Announcement as h, type AnnouncementStatus as i, type AnnouncementType as j, FFIDAnnouncementBadge as k, FFIDAnnouncementList as l, type FFIDAnnouncementsError as m, type FFIDAnnouncementsErrorCode as n, type FFIDAnnouncementsServerResponse as o, type FFIDApiResponse as p, type FFIDContextValue as q, type FFIDLogger as r, FFIDLoginButton as s, type FFIDOAuthTokenResponse as t, type FFIDOAuthUserInfo as u, type FFIDOAuthUserInfoMemberRole as v, type FFIDOAuthUserInfoSubscription as w, FFIDOrganizationSwitcher as x, type FFIDSeatModel as y, type FFIDSessionResponse as z };
621
+ export { type AnnouncementListResponse as A, type FFIDSeatModel as B, type FFIDSubscription as C, FFIDSubscriptionBadge as D, type FFIDSubscriptionStatus as E, type FFIDConfig as F, FFIDUserMenu as G, type UseFFIDAnnouncementsReturn as H, useFFIDAnnouncements as I, type FFIDAnnouncementBadgeClassNames as J, type FFIDAnnouncementBadgeProps as K, type ListAnnouncementsOptions as L, type FFIDAnnouncementListClassNames as M, type FFIDAnnouncementListProps as N, type FFIDLoginButtonProps as O, type FFIDOrganizationSwitcherClassNames as P, type FFIDOrganizationSwitcherProps as Q, type FFIDSubscriptionBadgeClassNames as R, type FFIDSubscriptionBadgeProps as S, type FFIDUserMenuClassNames as T, type UseFFIDAnnouncementsOptions as U, type FFIDUserMenuProps as V, type FFIDApiResponse as a, type FFIDSessionResponse as b, type FFIDError as c, type FFIDSubscriptionCheckResponse as d, type FFIDLogger as e, type FFIDUser as f, type FFIDOrganization as g, type FFIDSubscriptionContextValue as h, type FFIDAnnouncementsClientConfig as i, type FFIDAnnouncementsApiResponse as j, type FFIDAnnouncementsLogger as k, type Announcement as l, type AnnouncementStatus as m, type AnnouncementType as n, FFIDAnnouncementBadge as o, FFIDAnnouncementList as p, type FFIDAnnouncementsError as q, type FFIDAnnouncementsErrorCode as r, type FFIDAnnouncementsServerResponse as s, type FFIDContextValue as t, FFIDLoginButton as u, type FFIDOAuthTokenResponse as v, type FFIDOAuthUserInfo as w, type FFIDOAuthUserInfoMemberRole as x, type FFIDOAuthUserInfoSubscription as y, FFIDOrganizationSwitcher as z };
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkDFZPKRHW_cjs = require('./chunk-DFZPKRHW.cjs');
3
+ var chunk2IGDU2LY_cjs = require('./chunk-2IGDU2LY.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 } = chunkDFZPKRHW_cjs.useFFIDContext();
9
+ const { isLoading, isAuthenticated, login } = chunk2IGDU2LY_cjs.useFFIDContext();
10
10
  const hasRedirected = react.useRef(false);
11
11
  react.useEffect(() => {
12
12
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -31,78 +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 chunkDFZPKRHW_cjs.DEFAULT_API_BASE_URL; }
34
+ get: function () { return chunk2IGDU2LY_cjs.DEFAULT_API_BASE_URL; }
35
35
  });
36
36
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
37
37
  enumerable: true,
38
- get: function () { return chunkDFZPKRHW_cjs.FFIDAnnouncementBadge; }
38
+ get: function () { return chunk2IGDU2LY_cjs.FFIDAnnouncementBadge; }
39
39
  });
40
40
  Object.defineProperty(exports, "FFIDAnnouncementList", {
41
41
  enumerable: true,
42
- get: function () { return chunkDFZPKRHW_cjs.FFIDAnnouncementList; }
42
+ get: function () { return chunk2IGDU2LY_cjs.FFIDAnnouncementList; }
43
43
  });
44
44
  Object.defineProperty(exports, "FFIDLoginButton", {
45
45
  enumerable: true,
46
- get: function () { return chunkDFZPKRHW_cjs.FFIDLoginButton; }
46
+ get: function () { return chunk2IGDU2LY_cjs.FFIDLoginButton; }
47
47
  });
48
48
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
49
49
  enumerable: true,
50
- get: function () { return chunkDFZPKRHW_cjs.FFIDOrganizationSwitcher; }
50
+ get: function () { return chunk2IGDU2LY_cjs.FFIDOrganizationSwitcher; }
51
51
  });
52
52
  Object.defineProperty(exports, "FFIDProvider", {
53
53
  enumerable: true,
54
- get: function () { return chunkDFZPKRHW_cjs.FFIDProvider; }
54
+ get: function () { return chunk2IGDU2LY_cjs.FFIDProvider; }
55
55
  });
56
56
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
57
57
  enumerable: true,
58
- get: function () { return chunkDFZPKRHW_cjs.FFIDSubscriptionBadge; }
58
+ get: function () { return chunk2IGDU2LY_cjs.FFIDSubscriptionBadge; }
59
59
  });
60
60
  Object.defineProperty(exports, "FFIDUserMenu", {
61
61
  enumerable: true,
62
- get: function () { return chunkDFZPKRHW_cjs.FFIDUserMenu; }
62
+ get: function () { return chunk2IGDU2LY_cjs.FFIDUserMenu; }
63
63
  });
64
64
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
65
65
  enumerable: true,
66
- get: function () { return chunkDFZPKRHW_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
66
+ get: function () { return chunk2IGDU2LY_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
67
67
  });
68
68
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
69
69
  enumerable: true,
70
- get: function () { return chunkDFZPKRHW_cjs.createFFIDAnnouncementsClient; }
70
+ get: function () { return chunk2IGDU2LY_cjs.createFFIDAnnouncementsClient; }
71
+ });
72
+ Object.defineProperty(exports, "createFFIDClient", {
73
+ enumerable: true,
74
+ get: function () { return chunk2IGDU2LY_cjs.createFFIDClient; }
71
75
  });
72
76
  Object.defineProperty(exports, "createTokenStore", {
73
77
  enumerable: true,
74
- get: function () { return chunkDFZPKRHW_cjs.createTokenStore; }
78
+ get: function () { return chunk2IGDU2LY_cjs.createTokenStore; }
75
79
  });
76
80
  Object.defineProperty(exports, "generateCodeChallenge", {
77
81
  enumerable: true,
78
- get: function () { return chunkDFZPKRHW_cjs.generateCodeChallenge; }
82
+ get: function () { return chunk2IGDU2LY_cjs.generateCodeChallenge; }
79
83
  });
80
84
  Object.defineProperty(exports, "generateCodeVerifier", {
81
85
  enumerable: true,
82
- get: function () { return chunkDFZPKRHW_cjs.generateCodeVerifier; }
86
+ get: function () { return chunk2IGDU2LY_cjs.generateCodeVerifier; }
83
87
  });
84
88
  Object.defineProperty(exports, "retrieveCodeVerifier", {
85
89
  enumerable: true,
86
- get: function () { return chunkDFZPKRHW_cjs.retrieveCodeVerifier; }
90
+ get: function () { return chunk2IGDU2LY_cjs.retrieveCodeVerifier; }
87
91
  });
88
92
  Object.defineProperty(exports, "storeCodeVerifier", {
89
93
  enumerable: true,
90
- get: function () { return chunkDFZPKRHW_cjs.storeCodeVerifier; }
94
+ get: function () { return chunk2IGDU2LY_cjs.storeCodeVerifier; }
91
95
  });
92
96
  Object.defineProperty(exports, "useFFID", {
93
97
  enumerable: true,
94
- get: function () { return chunkDFZPKRHW_cjs.useFFID; }
98
+ get: function () { return chunk2IGDU2LY_cjs.useFFID; }
95
99
  });
96
100
  Object.defineProperty(exports, "useFFIDAnnouncements", {
97
101
  enumerable: true,
98
- get: function () { return chunkDFZPKRHW_cjs.useFFIDAnnouncements; }
102
+ get: function () { return chunk2IGDU2LY_cjs.useFFIDAnnouncements; }
99
103
  });
100
104
  Object.defineProperty(exports, "useSubscription", {
101
105
  enumerable: true,
102
- get: function () { return chunkDFZPKRHW_cjs.useSubscription; }
106
+ get: function () { return chunk2IGDU2LY_cjs.useSubscription; }
103
107
  });
104
108
  Object.defineProperty(exports, "withSubscription", {
105
109
  enumerable: true,
106
- get: function () { return chunkDFZPKRHW_cjs.withSubscription; }
110
+ get: function () { return chunk2IGDU2LY_cjs.withSubscription; }
107
111
  });
108
112
  exports.withFFIDAuth = withFFIDAuth;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
+ import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDError, d as FFIDSubscriptionCheckResponse, e as FFIDLogger, f as FFIDUser, g as FFIDOrganization, h as FFIDSubscriptionContextValue, i as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, j as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, k as FFIDAnnouncementsLogger } from './index-Bzwet6m2.cjs';
2
+ export { l as Announcement, m as AnnouncementStatus, n as AnnouncementType, o as FFIDAnnouncementBadge, p as FFIDAnnouncementList, q as FFIDAnnouncementsError, r as FFIDAnnouncementsErrorCode, s as FFIDAnnouncementsServerResponse, t as FFIDContextValue, u as FFIDLoginButton, v as FFIDOAuthTokenResponse, w as FFIDOAuthUserInfo, x as FFIDOAuthUserInfoMemberRole, y as FFIDOAuthUserInfoSubscription, z as FFIDOrganizationSwitcher, B as FFIDSeatModel, C as FFIDSubscription, D as FFIDSubscriptionBadge, E as FFIDSubscriptionStatus, G as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, H as UseFFIDAnnouncementsReturn, I as useFFIDAnnouncements } from './index-Bzwet6m2.cjs';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
  import { ReactNode, ComponentType, FC } from 'react';
3
- import { F as FFIDConfig, a as FFIDUser, b as FFIDOrganization, c as FFIDError, d as FFIDSubscriptionContextValue, e as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, f as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, g as FFIDAnnouncementsLogger } from './index-BqhbNrX_.cjs';
4
- export { h as Announcement, i as AnnouncementStatus, j as AnnouncementType, k as FFIDAnnouncementBadge, l as FFIDAnnouncementList, m as FFIDAnnouncementsError, n as FFIDAnnouncementsErrorCode, o as FFIDAnnouncementsServerResponse, p as FFIDApiResponse, q as FFIDContextValue, r as FFIDLogger, s as FFIDLoginButton, t as FFIDOAuthTokenResponse, u as FFIDOAuthUserInfo, v as FFIDOAuthUserInfoMemberRole, w as FFIDOAuthUserInfoSubscription, x as FFIDOrganizationSwitcher, y as FFIDSeatModel, z as FFIDSessionResponse, B as FFIDSubscription, C as FFIDSubscriptionBadge, D as FFIDSubscriptionCheckResponse, E as FFIDSubscriptionStatus, G as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, H as UseFFIDAnnouncementsReturn, I as useFFIDAnnouncements } from './index-BqhbNrX_.cjs';
5
5
 
6
6
  /**
7
7
  * FFID SDK Shared Constants
@@ -84,6 +84,35 @@ declare function storeCodeVerifier(verifier: string): void;
84
84
  */
85
85
  declare function retrieveCodeVerifier(): string | null;
86
86
 
87
+ /** FFID API Client - Supports cookie, token, and service-key auth modes */
88
+
89
+ /** Creates an FFID API client instance */
90
+ declare function createFFIDClient(config: FFIDConfig): {
91
+ getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
92
+ signOut: () => Promise<FFIDApiResponse<void>>;
93
+ redirectToLogin: () => boolean;
94
+ getLoginUrl: (redirectUrl?: string) => string;
95
+ getSignupUrl: (redirectUrl?: string) => string;
96
+ createError: (code: string, message: string) => FFIDError;
97
+ exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
98
+ refreshAccessToken: () => Promise<FFIDApiResponse<void>>;
99
+ checkSubscription: (params: {
100
+ userId: string;
101
+ organizationId: string;
102
+ }) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
103
+ /** Token store (token mode only) */
104
+ tokenStore: TokenStore;
105
+ /** Resolved auth mode */
106
+ authMode: "cookie" | "token" | "service-key";
107
+ /** Resolved logger instance */
108
+ logger: FFIDLogger;
109
+ baseUrl: string;
110
+ serviceCode: string;
111
+ clientId: string;
112
+ };
113
+ /** Type of the FFID client */
114
+ type FFIDClient = ReturnType<typeof createFFIDClient>;
115
+
87
116
  /**
88
117
  * Props for FFIDProvider component
89
118
  */
@@ -310,4 +339,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
310
339
  /** Type of the FFID Announcements client */
311
340
  type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
312
341
 
313
- export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDConfig, FFIDError, FFIDOrganization, FFIDProvider, type FFIDProviderProps, FFIDSubscriptionContextValue, FFIDUser, FFID_ANNOUNCEMENTS_ERROR_CODES, ListAnnouncementsOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
342
+ export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDClient, FFIDConfig, FFIDError, FFIDLogger, FFIDOrganization, FFIDProvider, type FFIDProviderProps, FFIDSessionResponse, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDUser, FFID_ANNOUNCEMENTS_ERROR_CODES, ListAnnouncementsOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import { F as FFIDConfig, a as FFIDApiResponse, b as FFIDSessionResponse, c as FFIDError, d as FFIDSubscriptionCheckResponse, e as FFIDLogger, f as FFIDUser, g as FFIDOrganization, h as FFIDSubscriptionContextValue, i as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, j as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, k as FFIDAnnouncementsLogger } from './index-Bzwet6m2.js';
2
+ export { l as Announcement, m as AnnouncementStatus, n as AnnouncementType, o as FFIDAnnouncementBadge, p as FFIDAnnouncementList, q as FFIDAnnouncementsError, r as FFIDAnnouncementsErrorCode, s as FFIDAnnouncementsServerResponse, t as FFIDContextValue, u as FFIDLoginButton, v as FFIDOAuthTokenResponse, w as FFIDOAuthUserInfo, x as FFIDOAuthUserInfoMemberRole, y as FFIDOAuthUserInfoSubscription, z as FFIDOrganizationSwitcher, B as FFIDSeatModel, C as FFIDSubscription, D as FFIDSubscriptionBadge, E as FFIDSubscriptionStatus, G as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, H as UseFFIDAnnouncementsReturn, I as useFFIDAnnouncements } from './index-Bzwet6m2.js';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
  import { ReactNode, ComponentType, FC } from 'react';
3
- import { F as FFIDConfig, a as FFIDUser, b as FFIDOrganization, c as FFIDError, d as FFIDSubscriptionContextValue, e as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, f as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, g as FFIDAnnouncementsLogger } from './index-BqhbNrX_.js';
4
- export { h as Announcement, i as AnnouncementStatus, j as AnnouncementType, k as FFIDAnnouncementBadge, l as FFIDAnnouncementList, m as FFIDAnnouncementsError, n as FFIDAnnouncementsErrorCode, o as FFIDAnnouncementsServerResponse, p as FFIDApiResponse, q as FFIDContextValue, r as FFIDLogger, s as FFIDLoginButton, t as FFIDOAuthTokenResponse, u as FFIDOAuthUserInfo, v as FFIDOAuthUserInfoMemberRole, w as FFIDOAuthUserInfoSubscription, x as FFIDOrganizationSwitcher, y as FFIDSeatModel, z as FFIDSessionResponse, B as FFIDSubscription, C as FFIDSubscriptionBadge, D as FFIDSubscriptionCheckResponse, E as FFIDSubscriptionStatus, G as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, H as UseFFIDAnnouncementsReturn, I as useFFIDAnnouncements } from './index-BqhbNrX_.js';
5
5
 
6
6
  /**
7
7
  * FFID SDK Shared Constants
@@ -84,6 +84,35 @@ declare function storeCodeVerifier(verifier: string): void;
84
84
  */
85
85
  declare function retrieveCodeVerifier(): string | null;
86
86
 
87
+ /** FFID API Client - Supports cookie, token, and service-key auth modes */
88
+
89
+ /** Creates an FFID API client instance */
90
+ declare function createFFIDClient(config: FFIDConfig): {
91
+ getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
92
+ signOut: () => Promise<FFIDApiResponse<void>>;
93
+ redirectToLogin: () => boolean;
94
+ getLoginUrl: (redirectUrl?: string) => string;
95
+ getSignupUrl: (redirectUrl?: string) => string;
96
+ createError: (code: string, message: string) => FFIDError;
97
+ exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
98
+ refreshAccessToken: () => Promise<FFIDApiResponse<void>>;
99
+ checkSubscription: (params: {
100
+ userId: string;
101
+ organizationId: string;
102
+ }) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
103
+ /** Token store (token mode only) */
104
+ tokenStore: TokenStore;
105
+ /** Resolved auth mode */
106
+ authMode: "cookie" | "token" | "service-key";
107
+ /** Resolved logger instance */
108
+ logger: FFIDLogger;
109
+ baseUrl: string;
110
+ serviceCode: string;
111
+ clientId: string;
112
+ };
113
+ /** Type of the FFID client */
114
+ type FFIDClient = ReturnType<typeof createFFIDClient>;
115
+
87
116
  /**
88
117
  * Props for FFIDProvider component
89
118
  */
@@ -310,4 +339,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
310
339
  /** Type of the FFID Announcements client */
311
340
  type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
312
341
 
313
- export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDConfig, FFIDError, FFIDOrganization, FFIDProvider, type FFIDProviderProps, FFIDSubscriptionContextValue, FFIDUser, FFID_ANNOUNCEMENTS_ERROR_CODES, ListAnnouncementsOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
342
+ export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDClient, FFIDConfig, FFIDError, FFIDLogger, FFIDOrganization, FFIDProvider, type FFIDProviderProps, FFIDSessionResponse, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, FFIDUser, FFID_ANNOUNCEMENTS_ERROR_CODES, ListAnnouncementsOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext } from './chunk-4CVQ5THN.js';
2
- export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-4CVQ5THN.js';
1
+ import { useFFIDContext } from './chunk-FZWW3B4X.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-FZWW3B4X.js';
3
3
  import { useRef, useEffect } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",