@feelflow/ffid-sdk 0.2.0 → 1.0.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.
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkA6YJDYIX_cjs = require('../chunk-A6YJDYIX.cjs');
3
+ var chunk53CYDXU3_cjs = require('../chunk-53CYDXU3.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunkA6YJDYIX_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunk53CYDXU3_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunkA6YJDYIX_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunk53CYDXU3_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDLoginButton", {
16
16
  enumerable: true,
17
- get: function () { return chunkA6YJDYIX_cjs.FFIDLoginButton; }
17
+ get: function () { return chunk53CYDXU3_cjs.FFIDLoginButton; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
20
20
  enumerable: true,
21
- get: function () { return chunkA6YJDYIX_cjs.FFIDOrganizationSwitcher; }
21
+ get: function () { return chunk53CYDXU3_cjs.FFIDOrganizationSwitcher; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
24
24
  enumerable: true,
25
- get: function () { return chunkA6YJDYIX_cjs.FFIDSubscriptionBadge; }
25
+ get: function () { return chunk53CYDXU3_cjs.FFIDSubscriptionBadge; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDUserMenu", {
28
28
  enumerable: true,
29
- get: function () { return chunkA6YJDYIX_cjs.FFIDUserMenu; }
29
+ get: function () { return chunk53CYDXU3_cjs.FFIDUserMenu; }
30
30
  });
@@ -1,3 +1,3 @@
1
- export { k as FFIDAnnouncementBadge, B as FFIDAnnouncementBadgeClassNames, C as FFIDAnnouncementBadgeProps, l as FFIDAnnouncementList, D as FFIDAnnouncementListClassNames, E as FFIDAnnouncementListProps, s as FFIDLoginButton, G as FFIDLoginButtonProps, t as FFIDOrganizationSwitcher, H as FFIDOrganizationSwitcherClassNames, I as FFIDOrganizationSwitcherProps, w as FFIDSubscriptionBadge, J as FFIDSubscriptionBadgeClassNames, K as FFIDSubscriptionBadgeProps, x as FFIDUserMenu, M as FFIDUserMenuClassNames, N as FFIDUserMenuProps } from '../index-B92_OuFc.cjs';
1
+ export { k as FFIDAnnouncementBadge, C as FFIDAnnouncementBadgeClassNames, D as FFIDAnnouncementBadgeProps, l as FFIDAnnouncementList, E as FFIDAnnouncementListClassNames, G as FFIDAnnouncementListProps, s as FFIDLoginButton, H as FFIDLoginButtonProps, u as FFIDOrganizationSwitcher, I as FFIDOrganizationSwitcherClassNames, J as FFIDOrganizationSwitcherProps, x as FFIDSubscriptionBadge, K as FFIDSubscriptionBadgeClassNames, M as FFIDSubscriptionBadgeProps, y as FFIDUserMenu, N as FFIDUserMenuClassNames, O as FFIDUserMenuProps } from '../index-DKBSoAHg.cjs';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
- export { k as FFIDAnnouncementBadge, B as FFIDAnnouncementBadgeClassNames, C as FFIDAnnouncementBadgeProps, l as FFIDAnnouncementList, D as FFIDAnnouncementListClassNames, E as FFIDAnnouncementListProps, s as FFIDLoginButton, G as FFIDLoginButtonProps, t as FFIDOrganizationSwitcher, H as FFIDOrganizationSwitcherClassNames, I as FFIDOrganizationSwitcherProps, w as FFIDSubscriptionBadge, J as FFIDSubscriptionBadgeClassNames, K as FFIDSubscriptionBadgeProps, x as FFIDUserMenu, M as FFIDUserMenuClassNames, N as FFIDUserMenuProps } from '../index-B92_OuFc.js';
1
+ export { k as FFIDAnnouncementBadge, C as FFIDAnnouncementBadgeClassNames, D as FFIDAnnouncementBadgeProps, l as FFIDAnnouncementList, E as FFIDAnnouncementListClassNames, G as FFIDAnnouncementListProps, s as FFIDLoginButton, H as FFIDLoginButtonProps, u as FFIDOrganizationSwitcher, I as FFIDOrganizationSwitcherClassNames, J as FFIDOrganizationSwitcherProps, x as FFIDSubscriptionBadge, K as FFIDSubscriptionBadgeClassNames, M as FFIDSubscriptionBadgeProps, y as FFIDUserMenu, N as FFIDUserMenuClassNames, O as FFIDUserMenuProps } from '../index-DKBSoAHg.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-VXBUXOLF.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-GAAFEPIY.js';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * FFID SDK Shared Constants
3
+ *
4
+ * Constants shared across all SDK entry points.
5
+ * Centralizing these prevents drift during domain/URL changes.
6
+ */
7
+ /** Default FFID API base URL (production) */
8
+ declare const DEFAULT_API_BASE_URL = "https://id.feelflow.co.jp";
9
+
10
+ export { DEFAULT_API_BASE_URL as D };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * FFID SDK Shared Constants
3
+ *
4
+ * Constants shared across all SDK entry points.
5
+ * Centralizing these prevents drift during domain/URL changes.
6
+ */
7
+ /** Default FFID API base URL (production) */
8
+ declare const DEFAULT_API_BASE_URL = "https://id.feelflow.co.jp";
9
+
10
+ export { DEFAULT_API_BASE_URL as D };
@@ -25,6 +25,26 @@ interface FFIDUser {
25
25
  /** Account creation timestamp */
26
26
  createdAt: string;
27
27
  }
28
+ /**
29
+ * Agency branding information for white-label support.
30
+ * Included in organization when it is linked to an agency.
31
+ */
32
+ interface FFIDAgencyBranding {
33
+ /** Agency ID (UUID) */
34
+ agencyId: string;
35
+ /** Agency display name */
36
+ agencyName: string;
37
+ /** Custom logo URL */
38
+ logoUrl?: string;
39
+ /** Custom favicon URL */
40
+ faviconUrl?: string;
41
+ /** Primary brand color (hex) */
42
+ primaryColor?: string;
43
+ /** Secondary brand color (hex) */
44
+ secondaryColor?: string;
45
+ /** White-label company name */
46
+ companyName?: string;
47
+ }
28
48
  /**
29
49
  * Organization membership information
30
50
  */
@@ -39,6 +59,8 @@ interface FFIDOrganization {
39
59
  role: 'owner' | 'admin' | 'member';
40
60
  /** Membership status */
41
61
  status: 'active' | 'invited' | 'suspended';
62
+ /** Agency branding (null if org is not linked to an agency) */
63
+ agencyBranding: FFIDAgencyBranding | null;
42
64
  }
43
65
  /**
44
66
  * Subscription/contract information
@@ -85,6 +107,10 @@ interface FFIDConfig {
85
107
  onAuthStateChange?: ((user: FFIDUser | null) => void) | undefined;
86
108
  /** Callback on authentication error */
87
109
  onError?: ((error: FFIDError) => void) | undefined;
110
+ /** Authentication mode: 'cookie' (default) or 'token' (OAuth Bearer) */
111
+ authMode?: 'cookie' | 'token' | undefined;
112
+ /** Client ID for token mode (defaults to serviceCode if not set) */
113
+ clientId?: string | undefined;
88
114
  }
89
115
  /**
90
116
  * FFID context value provided to consumers
@@ -180,6 +206,15 @@ type FFIDApiResponse<T> = {
180
206
  data?: undefined;
181
207
  error: FFIDError;
182
208
  };
209
+ /**
210
+ * OAuth 2.0 token response from FFID token endpoint
211
+ */
212
+ interface FFIDOAuthTokenResponse {
213
+ access_token: string;
214
+ token_type: 'Bearer';
215
+ expires_in: number;
216
+ refresh_token: string;
217
+ }
183
218
 
184
219
  /**
185
220
  * FFID Announcements SDK Type Definitions
@@ -542,4 +577,4 @@ interface FFIDAnnouncementListProps {
542
577
  */
543
578
  declare function FFIDAnnouncementList({ announcements, isLoading, className, classNames, style, formatDate, emptyMessage, loadingRender, renderItem, maxContentLines, }: FFIDAnnouncementListProps): react_jsx_runtime.JSX.Element;
544
579
 
545
- export { type AnnouncementListResponse as A, type FFIDAnnouncementBadgeClassNames as B, type FFIDAnnouncementBadgeProps as C, type FFIDAnnouncementListClassNames as D, type FFIDAnnouncementListProps as E, type FFIDConfig as F, type FFIDLoginButtonProps as G, type FFIDOrganizationSwitcherClassNames as H, type FFIDOrganizationSwitcherProps as I, type FFIDSubscriptionBadgeClassNames as J, type FFIDSubscriptionBadgeProps as K, type ListAnnouncementsOptions as L, type FFIDUserMenuClassNames as M, type FFIDUserMenuProps as N, type UseFFIDAnnouncementsOptions as U, 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, FFIDOrganizationSwitcher as t, type FFIDSessionResponse as u, type FFIDSubscription as v, FFIDSubscriptionBadge as w, FFIDUserMenu as x, type UseFFIDAnnouncementsReturn as y, useFFIDAnnouncements as z };
580
+ export { type AnnouncementListResponse as A, useFFIDAnnouncements as B, type FFIDAnnouncementBadgeClassNames as C, type FFIDAnnouncementBadgeProps as D, type FFIDAnnouncementListClassNames as E, type FFIDConfig as F, type FFIDAnnouncementListProps as G, type FFIDLoginButtonProps as H, type FFIDOrganizationSwitcherClassNames as I, type FFIDOrganizationSwitcherProps as J, type FFIDSubscriptionBadgeClassNames as K, type ListAnnouncementsOptions as L, type FFIDSubscriptionBadgeProps as M, type FFIDUserMenuClassNames as N, type FFIDUserMenuProps as O, type UseFFIDAnnouncementsOptions as U, 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, FFIDOrganizationSwitcher as u, type FFIDSessionResponse as v, type FFIDSubscription as w, FFIDSubscriptionBadge as x, FFIDUserMenu as y, type UseFFIDAnnouncementsReturn as z };
@@ -25,6 +25,26 @@ interface FFIDUser {
25
25
  /** Account creation timestamp */
26
26
  createdAt: string;
27
27
  }
28
+ /**
29
+ * Agency branding information for white-label support.
30
+ * Included in organization when it is linked to an agency.
31
+ */
32
+ interface FFIDAgencyBranding {
33
+ /** Agency ID (UUID) */
34
+ agencyId: string;
35
+ /** Agency display name */
36
+ agencyName: string;
37
+ /** Custom logo URL */
38
+ logoUrl?: string;
39
+ /** Custom favicon URL */
40
+ faviconUrl?: string;
41
+ /** Primary brand color (hex) */
42
+ primaryColor?: string;
43
+ /** Secondary brand color (hex) */
44
+ secondaryColor?: string;
45
+ /** White-label company name */
46
+ companyName?: string;
47
+ }
28
48
  /**
29
49
  * Organization membership information
30
50
  */
@@ -39,6 +59,8 @@ interface FFIDOrganization {
39
59
  role: 'owner' | 'admin' | 'member';
40
60
  /** Membership status */
41
61
  status: 'active' | 'invited' | 'suspended';
62
+ /** Agency branding (null if org is not linked to an agency) */
63
+ agencyBranding: FFIDAgencyBranding | null;
42
64
  }
43
65
  /**
44
66
  * Subscription/contract information
@@ -85,6 +107,10 @@ interface FFIDConfig {
85
107
  onAuthStateChange?: ((user: FFIDUser | null) => void) | undefined;
86
108
  /** Callback on authentication error */
87
109
  onError?: ((error: FFIDError) => void) | undefined;
110
+ /** Authentication mode: 'cookie' (default) or 'token' (OAuth Bearer) */
111
+ authMode?: 'cookie' | 'token' | undefined;
112
+ /** Client ID for token mode (defaults to serviceCode if not set) */
113
+ clientId?: string | undefined;
88
114
  }
89
115
  /**
90
116
  * FFID context value provided to consumers
@@ -180,6 +206,15 @@ type FFIDApiResponse<T> = {
180
206
  data?: undefined;
181
207
  error: FFIDError;
182
208
  };
209
+ /**
210
+ * OAuth 2.0 token response from FFID token endpoint
211
+ */
212
+ interface FFIDOAuthTokenResponse {
213
+ access_token: string;
214
+ token_type: 'Bearer';
215
+ expires_in: number;
216
+ refresh_token: string;
217
+ }
183
218
 
184
219
  /**
185
220
  * FFID Announcements SDK Type Definitions
@@ -542,4 +577,4 @@ interface FFIDAnnouncementListProps {
542
577
  */
543
578
  declare function FFIDAnnouncementList({ announcements, isLoading, className, classNames, style, formatDate, emptyMessage, loadingRender, renderItem, maxContentLines, }: FFIDAnnouncementListProps): react_jsx_runtime.JSX.Element;
544
579
 
545
- export { type AnnouncementListResponse as A, type FFIDAnnouncementBadgeClassNames as B, type FFIDAnnouncementBadgeProps as C, type FFIDAnnouncementListClassNames as D, type FFIDAnnouncementListProps as E, type FFIDConfig as F, type FFIDLoginButtonProps as G, type FFIDOrganizationSwitcherClassNames as H, type FFIDOrganizationSwitcherProps as I, type FFIDSubscriptionBadgeClassNames as J, type FFIDSubscriptionBadgeProps as K, type ListAnnouncementsOptions as L, type FFIDUserMenuClassNames as M, type FFIDUserMenuProps as N, type UseFFIDAnnouncementsOptions as U, 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, FFIDOrganizationSwitcher as t, type FFIDSessionResponse as u, type FFIDSubscription as v, FFIDSubscriptionBadge as w, FFIDUserMenu as x, type UseFFIDAnnouncementsReturn as y, useFFIDAnnouncements as z };
580
+ export { type AnnouncementListResponse as A, useFFIDAnnouncements as B, type FFIDAnnouncementBadgeClassNames as C, type FFIDAnnouncementBadgeProps as D, type FFIDAnnouncementListClassNames as E, type FFIDConfig as F, type FFIDAnnouncementListProps as G, type FFIDLoginButtonProps as H, type FFIDOrganizationSwitcherClassNames as I, type FFIDOrganizationSwitcherProps as J, type FFIDSubscriptionBadgeClassNames as K, type ListAnnouncementsOptions as L, type FFIDSubscriptionBadgeProps as M, type FFIDUserMenuClassNames as N, type FFIDUserMenuProps as O, type UseFFIDAnnouncementsOptions as U, 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, FFIDOrganizationSwitcher as u, type FFIDSessionResponse as v, type FFIDSubscription as w, FFIDSubscriptionBadge as x, FFIDUserMenu as y, type UseFFIDAnnouncementsReturn as z };
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkA6YJDYIX_cjs = require('./chunk-A6YJDYIX.cjs');
3
+ var chunk53CYDXU3_cjs = require('./chunk-53CYDXU3.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 } = chunkA6YJDYIX_cjs.useFFIDContext();
9
+ const { isLoading, isAuthenticated, login } = chunk53CYDXU3_cjs.useFFIDContext();
10
10
  const hasRedirected = react.useRef(false);
11
11
  react.useEffect(() => {
12
12
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -31,58 +31,78 @@ function withFFIDAuth(Component, options = {}) {
31
31
 
32
32
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
33
33
  enumerable: true,
34
- get: function () { return chunkA6YJDYIX_cjs.DEFAULT_API_BASE_URL; }
34
+ get: function () { return chunk53CYDXU3_cjs.DEFAULT_API_BASE_URL; }
35
35
  });
36
36
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
37
37
  enumerable: true,
38
- get: function () { return chunkA6YJDYIX_cjs.FFIDAnnouncementBadge; }
38
+ get: function () { return chunk53CYDXU3_cjs.FFIDAnnouncementBadge; }
39
39
  });
40
40
  Object.defineProperty(exports, "FFIDAnnouncementList", {
41
41
  enumerable: true,
42
- get: function () { return chunkA6YJDYIX_cjs.FFIDAnnouncementList; }
42
+ get: function () { return chunk53CYDXU3_cjs.FFIDAnnouncementList; }
43
43
  });
44
44
  Object.defineProperty(exports, "FFIDLoginButton", {
45
45
  enumerable: true,
46
- get: function () { return chunkA6YJDYIX_cjs.FFIDLoginButton; }
46
+ get: function () { return chunk53CYDXU3_cjs.FFIDLoginButton; }
47
47
  });
48
48
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
49
49
  enumerable: true,
50
- get: function () { return chunkA6YJDYIX_cjs.FFIDOrganizationSwitcher; }
50
+ get: function () { return chunk53CYDXU3_cjs.FFIDOrganizationSwitcher; }
51
51
  });
52
52
  Object.defineProperty(exports, "FFIDProvider", {
53
53
  enumerable: true,
54
- get: function () { return chunkA6YJDYIX_cjs.FFIDProvider; }
54
+ get: function () { return chunk53CYDXU3_cjs.FFIDProvider; }
55
55
  });
56
56
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
57
57
  enumerable: true,
58
- get: function () { return chunkA6YJDYIX_cjs.FFIDSubscriptionBadge; }
58
+ get: function () { return chunk53CYDXU3_cjs.FFIDSubscriptionBadge; }
59
59
  });
60
60
  Object.defineProperty(exports, "FFIDUserMenu", {
61
61
  enumerable: true,
62
- get: function () { return chunkA6YJDYIX_cjs.FFIDUserMenu; }
62
+ get: function () { return chunk53CYDXU3_cjs.FFIDUserMenu; }
63
63
  });
64
64
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
65
65
  enumerable: true,
66
- get: function () { return chunkA6YJDYIX_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
66
+ get: function () { return chunk53CYDXU3_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
67
67
  });
68
68
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
69
69
  enumerable: true,
70
- get: function () { return chunkA6YJDYIX_cjs.createFFIDAnnouncementsClient; }
70
+ get: function () { return chunk53CYDXU3_cjs.createFFIDAnnouncementsClient; }
71
+ });
72
+ Object.defineProperty(exports, "createTokenStore", {
73
+ enumerable: true,
74
+ get: function () { return chunk53CYDXU3_cjs.createTokenStore; }
75
+ });
76
+ Object.defineProperty(exports, "generateCodeChallenge", {
77
+ enumerable: true,
78
+ get: function () { return chunk53CYDXU3_cjs.generateCodeChallenge; }
79
+ });
80
+ Object.defineProperty(exports, "generateCodeVerifier", {
81
+ enumerable: true,
82
+ get: function () { return chunk53CYDXU3_cjs.generateCodeVerifier; }
83
+ });
84
+ Object.defineProperty(exports, "retrieveCodeVerifier", {
85
+ enumerable: true,
86
+ get: function () { return chunk53CYDXU3_cjs.retrieveCodeVerifier; }
87
+ });
88
+ Object.defineProperty(exports, "storeCodeVerifier", {
89
+ enumerable: true,
90
+ get: function () { return chunk53CYDXU3_cjs.storeCodeVerifier; }
71
91
  });
72
92
  Object.defineProperty(exports, "useFFID", {
73
93
  enumerable: true,
74
- get: function () { return chunkA6YJDYIX_cjs.useFFID; }
94
+ get: function () { return chunk53CYDXU3_cjs.useFFID; }
75
95
  });
76
96
  Object.defineProperty(exports, "useFFIDAnnouncements", {
77
97
  enumerable: true,
78
- get: function () { return chunkA6YJDYIX_cjs.useFFIDAnnouncements; }
98
+ get: function () { return chunk53CYDXU3_cjs.useFFIDAnnouncements; }
79
99
  });
80
100
  Object.defineProperty(exports, "useSubscription", {
81
101
  enumerable: true,
82
- get: function () { return chunkA6YJDYIX_cjs.useSubscription; }
102
+ get: function () { return chunk53CYDXU3_cjs.useSubscription; }
83
103
  });
84
104
  Object.defineProperty(exports, "withSubscription", {
85
105
  enumerable: true,
86
- get: function () { return chunkA6YJDYIX_cjs.withSubscription; }
106
+ get: function () { return chunk53CYDXU3_cjs.withSubscription; }
87
107
  });
88
108
  exports.withFFIDAuth = withFFIDAuth;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  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-B92_OuFc.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 FFIDOrganizationSwitcher, u as FFIDSessionResponse, v as FFIDSubscription, w as FFIDSubscriptionBadge, x as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, y as UseFFIDAnnouncementsReturn, z as useFFIDAnnouncements } from './index-B92_OuFc.cjs';
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-DKBSoAHg.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 FFIDOrganizationSwitcher, v as FFIDSessionResponse, w as FFIDSubscription, x as FFIDSubscriptionBadge, y as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, z as UseFFIDAnnouncementsReturn, B as useFFIDAnnouncements } from './index-DKBSoAHg.cjs';
5
5
 
6
6
  /**
7
7
  * FFID SDK Shared Constants
@@ -12,6 +12,78 @@ export { h as Announcement, i as AnnouncementStatus, j as AnnouncementType, k as
12
12
  /** Default FFID API base URL (production) */
13
13
  declare const DEFAULT_API_BASE_URL = "https://id.feelflow.co.jp";
14
14
 
15
+ /**
16
+ * Token Store
17
+ *
18
+ * Manages OAuth 2.0 tokens (access + refresh) with dual-storage support.
19
+ * Falls back to in-memory storage when localStorage is unavailable
20
+ * (e.g., Safari private browsing mode).
21
+ */
22
+ /**
23
+ * Token data stored by the token store
24
+ */
25
+ interface TokenData {
26
+ /** OAuth 2.0 access token */
27
+ accessToken: string;
28
+ /** OAuth 2.0 refresh token */
29
+ refreshToken: string;
30
+ /** Expiration timestamp in milliseconds (Unix epoch) */
31
+ expiresAt: number;
32
+ }
33
+ /**
34
+ * Token store interface for managing OAuth tokens
35
+ */
36
+ interface TokenStore {
37
+ /** Get stored tokens (null if not stored) */
38
+ getTokens(): TokenData | null;
39
+ /** Store new tokens */
40
+ setTokens(tokens: TokenData): void;
41
+ /** Clear all stored tokens */
42
+ clearTokens(): void;
43
+ /** Check if access token is expired (with 30s buffer) */
44
+ isAccessTokenExpired(): boolean;
45
+ }
46
+ /**
47
+ * Create a token store with the specified storage type.
48
+ *
49
+ * When storageType is 'localStorage' (default in browser), falls back
50
+ * to memory if localStorage is not available (e.g., Safari private mode).
51
+ *
52
+ * @param storageType - 'localStorage' (default) or 'memory'
53
+ */
54
+ declare function createTokenStore(storageType?: 'localStorage' | 'memory'): TokenStore;
55
+
56
+ /**
57
+ * Generate a random code verifier (43-128 characters, RFC 7636 Section 4.1).
58
+ *
59
+ * Uses crypto.getRandomValues for cryptographic randomness.
60
+ */
61
+ declare function generateCodeVerifier(): string;
62
+ /**
63
+ * Generate S256 code challenge from a code verifier (RFC 7636 Section 4.2).
64
+ *
65
+ * Computes SHA-256 hash of the verifier, then base64url-encodes the result.
66
+ *
67
+ * @param verifier - The code verifier string
68
+ * @returns base64url-encoded SHA-256 hash
69
+ */
70
+ declare function generateCodeChallenge(verifier: string): Promise<string>;
71
+ /**
72
+ * Store code verifier in sessionStorage for later retrieval.
73
+ * Uses window.sessionStorage explicitly to ensure browser Web Storage API.
74
+ *
75
+ * @param verifier - The code verifier to store
76
+ */
77
+ declare function storeCodeVerifier(verifier: string): void;
78
+ /**
79
+ * Retrieve and remove the code verifier from sessionStorage.
80
+ * Uses window.sessionStorage explicitly to ensure browser Web Storage API.
81
+ *
82
+ * Returns null if no verifier is stored.
83
+ * Removes the verifier after retrieval (one-time use).
84
+ */
85
+ declare function retrieveCodeVerifier(): string | null;
86
+
15
87
  /**
16
88
  * Props for FFIDProvider component
17
89
  */
@@ -27,8 +99,9 @@ interface FFIDProviderProps extends FFIDConfig {
27
99
  * - User authentication state
28
100
  * - Organization switching
29
101
  * - Automatic session refresh
102
+ * - Token mode: automatic code exchange and token refresh
30
103
  */
31
- declare function FFIDProvider({ children, serviceCode, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
104
+ declare function FFIDProvider({ children, serviceCode, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, authMode, clientId, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
32
105
 
33
106
  /**
34
107
  * Return type for useFFID hook
@@ -233,4 +306,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
233
306
  /** Type of the FFID Announcements client */
234
307
  type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
235
308
 
236
- 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 UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, useFFID, useSubscription, withFFIDAuth, withSubscription };
309
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  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-B92_OuFc.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 FFIDOrganizationSwitcher, u as FFIDSessionResponse, v as FFIDSubscription, w as FFIDSubscriptionBadge, x as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, y as UseFFIDAnnouncementsReturn, z as useFFIDAnnouncements } from './index-B92_OuFc.js';
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-DKBSoAHg.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 FFIDOrganizationSwitcher, v as FFIDSessionResponse, w as FFIDSubscription, x as FFIDSubscriptionBadge, y as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, z as UseFFIDAnnouncementsReturn, B as useFFIDAnnouncements } from './index-DKBSoAHg.js';
5
5
 
6
6
  /**
7
7
  * FFID SDK Shared Constants
@@ -12,6 +12,78 @@ export { h as Announcement, i as AnnouncementStatus, j as AnnouncementType, k as
12
12
  /** Default FFID API base URL (production) */
13
13
  declare const DEFAULT_API_BASE_URL = "https://id.feelflow.co.jp";
14
14
 
15
+ /**
16
+ * Token Store
17
+ *
18
+ * Manages OAuth 2.0 tokens (access + refresh) with dual-storage support.
19
+ * Falls back to in-memory storage when localStorage is unavailable
20
+ * (e.g., Safari private browsing mode).
21
+ */
22
+ /**
23
+ * Token data stored by the token store
24
+ */
25
+ interface TokenData {
26
+ /** OAuth 2.0 access token */
27
+ accessToken: string;
28
+ /** OAuth 2.0 refresh token */
29
+ refreshToken: string;
30
+ /** Expiration timestamp in milliseconds (Unix epoch) */
31
+ expiresAt: number;
32
+ }
33
+ /**
34
+ * Token store interface for managing OAuth tokens
35
+ */
36
+ interface TokenStore {
37
+ /** Get stored tokens (null if not stored) */
38
+ getTokens(): TokenData | null;
39
+ /** Store new tokens */
40
+ setTokens(tokens: TokenData): void;
41
+ /** Clear all stored tokens */
42
+ clearTokens(): void;
43
+ /** Check if access token is expired (with 30s buffer) */
44
+ isAccessTokenExpired(): boolean;
45
+ }
46
+ /**
47
+ * Create a token store with the specified storage type.
48
+ *
49
+ * When storageType is 'localStorage' (default in browser), falls back
50
+ * to memory if localStorage is not available (e.g., Safari private mode).
51
+ *
52
+ * @param storageType - 'localStorage' (default) or 'memory'
53
+ */
54
+ declare function createTokenStore(storageType?: 'localStorage' | 'memory'): TokenStore;
55
+
56
+ /**
57
+ * Generate a random code verifier (43-128 characters, RFC 7636 Section 4.1).
58
+ *
59
+ * Uses crypto.getRandomValues for cryptographic randomness.
60
+ */
61
+ declare function generateCodeVerifier(): string;
62
+ /**
63
+ * Generate S256 code challenge from a code verifier (RFC 7636 Section 4.2).
64
+ *
65
+ * Computes SHA-256 hash of the verifier, then base64url-encodes the result.
66
+ *
67
+ * @param verifier - The code verifier string
68
+ * @returns base64url-encoded SHA-256 hash
69
+ */
70
+ declare function generateCodeChallenge(verifier: string): Promise<string>;
71
+ /**
72
+ * Store code verifier in sessionStorage for later retrieval.
73
+ * Uses window.sessionStorage explicitly to ensure browser Web Storage API.
74
+ *
75
+ * @param verifier - The code verifier to store
76
+ */
77
+ declare function storeCodeVerifier(verifier: string): void;
78
+ /**
79
+ * Retrieve and remove the code verifier from sessionStorage.
80
+ * Uses window.sessionStorage explicitly to ensure browser Web Storage API.
81
+ *
82
+ * Returns null if no verifier is stored.
83
+ * Removes the verifier after retrieval (one-time use).
84
+ */
85
+ declare function retrieveCodeVerifier(): string | null;
86
+
15
87
  /**
16
88
  * Props for FFIDProvider component
17
89
  */
@@ -27,8 +99,9 @@ interface FFIDProviderProps extends FFIDConfig {
27
99
  * - User authentication state
28
100
  * - Organization switching
29
101
  * - Automatic session refresh
102
+ * - Token mode: automatic code exchange and token refresh
30
103
  */
31
- declare function FFIDProvider({ children, serviceCode, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
104
+ declare function FFIDProvider({ children, serviceCode, apiBaseUrl, debug, logger, refreshInterval, onAuthStateChange, onError, authMode, clientId, }: FFIDProviderProps): react_jsx_runtime.JSX.Element;
32
105
 
33
106
  /**
34
107
  * Return type for useFFID hook
@@ -233,4 +306,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
233
306
  /** Type of the FFID Announcements client */
234
307
  type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
235
308
 
236
- 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 UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, useFFID, useSubscription, withFFIDAuth, withSubscription };
309
+ 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 };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext } from './chunk-VXBUXOLF.js';
2
- export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-VXBUXOLF.js';
1
+ import { useFFIDContext } from './chunk-GAAFEPIY.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-GAAFEPIY.js';
3
3
  import { useRef, useEffect } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -1,11 +1,4 @@
1
- /**
2
- * FFID SDK Shared Constants
3
- *
4
- * Constants shared across all SDK entry points.
5
- * Centralizing these prevents drift during domain/URL changes.
6
- */
7
- /** Default FFID API base URL (production) */
8
- declare const DEFAULT_API_BASE_URL = "https://id.feelflow.co.jp";
1
+ export { D as DEFAULT_API_BASE_URL } from '../constants-BeWMWOOd.cjs';
9
2
 
10
3
  /**
11
4
  * FFID Legal SDK Type Definitions
@@ -329,4 +322,4 @@ declare function createFFIDLegalClient(config: FFIDLegalClientConfig): {
329
322
  /** Type of the FFID Legal client */
330
323
  type FFIDLegalClient = ReturnType<typeof createFFIDLegalClient>;
331
324
 
332
- export { DEFAULT_API_BASE_URL, type FFIDAgreementCheckResult, type FFIDAgreementMethod, type FFIDLegalApiResponse, type FFIDLegalClient, type FFIDLegalClientConfig, type FFIDLegalDocument, type FFIDLegalDocumentType, type FFIDLegalError, type FFIDLegalErrorCode, type FFIDLegalLogger, type FFIDLegalSdkErrorCode, type FFIDLegalServerError, type FFIDLegalServerErrorCode, type FFIDLegalServerResponse, type FFIDPendingAgreement, type FFIDPendingAgreementsResponse, type FFIDRecordAgreementRequest, type FFIDRecordAgreementResponse, type FFIDServiceUserAgreement, FFID_LEGAL_ERROR_CODES, createFFIDLegalClient };
325
+ export { type FFIDAgreementCheckResult, type FFIDAgreementMethod, type FFIDLegalApiResponse, type FFIDLegalClient, type FFIDLegalClientConfig, type FFIDLegalDocument, type FFIDLegalDocumentType, type FFIDLegalError, type FFIDLegalErrorCode, type FFIDLegalLogger, type FFIDLegalSdkErrorCode, type FFIDLegalServerError, type FFIDLegalServerErrorCode, type FFIDLegalServerResponse, type FFIDPendingAgreement, type FFIDPendingAgreementsResponse, type FFIDRecordAgreementRequest, type FFIDRecordAgreementResponse, type FFIDServiceUserAgreement, FFID_LEGAL_ERROR_CODES, createFFIDLegalClient };
@@ -1,11 +1,4 @@
1
- /**
2
- * FFID SDK Shared Constants
3
- *
4
- * Constants shared across all SDK entry points.
5
- * Centralizing these prevents drift during domain/URL changes.
6
- */
7
- /** Default FFID API base URL (production) */
8
- declare const DEFAULT_API_BASE_URL = "https://id.feelflow.co.jp";
1
+ export { D as DEFAULT_API_BASE_URL } from '../constants-BeWMWOOd.js';
9
2
 
10
3
  /**
11
4
  * FFID Legal SDK Type Definitions
@@ -329,4 +322,4 @@ declare function createFFIDLegalClient(config: FFIDLegalClientConfig): {
329
322
  /** Type of the FFID Legal client */
330
323
  type FFIDLegalClient = ReturnType<typeof createFFIDLegalClient>;
331
324
 
332
- export { DEFAULT_API_BASE_URL, type FFIDAgreementCheckResult, type FFIDAgreementMethod, type FFIDLegalApiResponse, type FFIDLegalClient, type FFIDLegalClientConfig, type FFIDLegalDocument, type FFIDLegalDocumentType, type FFIDLegalError, type FFIDLegalErrorCode, type FFIDLegalLogger, type FFIDLegalSdkErrorCode, type FFIDLegalServerError, type FFIDLegalServerErrorCode, type FFIDLegalServerResponse, type FFIDPendingAgreement, type FFIDPendingAgreementsResponse, type FFIDRecordAgreementRequest, type FFIDRecordAgreementResponse, type FFIDServiceUserAgreement, FFID_LEGAL_ERROR_CODES, createFFIDLegalClient };
325
+ export { type FFIDAgreementCheckResult, type FFIDAgreementMethod, type FFIDLegalApiResponse, type FFIDLegalClient, type FFIDLegalClientConfig, type FFIDLegalDocument, type FFIDLegalDocumentType, type FFIDLegalError, type FFIDLegalErrorCode, type FFIDLegalLogger, type FFIDLegalSdkErrorCode, type FFIDLegalServerError, type FFIDLegalServerErrorCode, type FFIDLegalServerResponse, type FFIDPendingAgreement, type FFIDPendingAgreementsResponse, type FFIDRecordAgreementRequest, type FFIDRecordAgreementResponse, type FFIDServiceUserAgreement, FFID_LEGAL_ERROR_CODES, createFFIDLegalClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "0.2.0",
3
+ "version": "1.0.1",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",
@@ -50,6 +50,11 @@
50
50
  "types": "./dist/announcements/index.d.ts",
51
51
  "import": "./dist/announcements/index.js",
52
52
  "require": "./dist/announcements/index.cjs"
53
+ },
54
+ "./agency": {
55
+ "types": "./dist/agency/index.d.ts",
56
+ "import": "./dist/agency/index.js",
57
+ "require": "./dist/agency/index.cjs"
53
58
  }
54
59
  },
55
60
  "files": [