@ph-cms/client-sdk 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/context.d.ts CHANGED
@@ -22,6 +22,8 @@ export interface PHCMSContextType {
22
22
  hasToken: boolean;
23
23
  /** Manually trigger a refetch of the current user profile. */
24
24
  refreshUser: () => Promise<void>;
25
+ /** Returns the current valid PH-CMS access token (만료 시 자동 갱신, 없으면 null). */
26
+ getToken: () => Promise<string | null>;
25
27
  }
26
28
  export interface PHCMSProviderProps {
27
29
  client: PHCMSClient;
package/dist/context.js CHANGED
@@ -98,6 +98,7 @@ const PHCMSInternalProvider = ({ client, channelUid, children }) => {
98
98
  hasToken,
99
99
  channelUid,
100
100
  refreshUser,
101
+ getToken: () => client.getToken(),
101
102
  };
102
103
  }, [client, user, isError, isLoading, hasToken, channelUid, refreshUser]);
103
104
  return react_1.default.createElement(PHCMSContext.Provider, { value: value }, children);
@@ -240,6 +240,7 @@ export declare const useAuth: () => {
240
240
  username?: string;
241
241
  }, unknown>;
242
242
  logout: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
243
+ getToken: () => Promise<string | null>;
243
244
  loginStatus: import("@tanstack/react-query").UseMutationResult<{
244
245
  refreshToken: string;
245
246
  user: {
@@ -9,7 +9,7 @@ const AUTH_ME_QUERY_KEY = ['auth', 'me'];
9
9
  * Returns both the current auth status and the actions.
10
10
  */
11
11
  const useAuth = () => {
12
- const { user, isAuthenticated, isLoading, refreshUser, channelUid } = (0, context_1.usePHCMSContext)();
12
+ const { user, isAuthenticated, isLoading, refreshUser, channelUid, getToken } = (0, context_1.usePHCMSContext)();
13
13
  const client = (0, context_1.usePHCMS)();
14
14
  const queryClient = (0, react_query_1.useQueryClient)();
15
15
  const loginMutation = (0, react_query_1.useMutation)({
@@ -78,6 +78,7 @@ const useAuth = () => {
78
78
  loginAnonymous: loginAnonymousMutation.mutateAsync,
79
79
  upgradeAnonymous: upgradeAnonymousMutation.mutateAsync,
80
80
  logout: logoutMutation.mutateAsync,
81
+ getToken,
81
82
  // Access to mutation objects for loading/error states if needed
82
83
  loginStatus: loginMutation,
83
84
  loginWithFirebaseStatus: loginWithFirebaseMutation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ph-cms/client-sdk",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Unified PH-CMS Client SDK (React + Core)",
5
5
  "keywords": [],
6
6
  "license": "MIT",