@ph-cms/client-sdk 0.1.25 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @ph-cms/client-sdk
1
+ # @ph-cms/client-sdk 0.1.27
2
2
 
3
3
  PH-CMS 클라이언트 SDK — 브라우저 및 React 애플리케이션을 위한 통합 클라이언트.
4
4
 
@@ -1472,4 +1472,4 @@ const ttl = getTokenTTL(token); // number (ms) | null
1472
1472
 
1473
1473
  ## License
1474
1474
 
1475
- MIT
1475
+ MIT
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/dist/types.d.ts CHANGED
@@ -7,7 +7,7 @@ export type { StampAvailability, CheckStampAvailabilityParams } from './hooks/us
7
7
  export type { AuthResponse, FirebaseExchangeRequest, LoginRequest, RefreshTokenRequest, RegisterRequest } from '@ph-cms/api-contract';
8
8
  export type { UserDto } from '@ph-cms/api-contract';
9
9
  export type { ChannelDto, CheckHierarchyQuery } from '@ph-cms/api-contract';
10
- export type { ContentDto, ContentMediaDto, CreateContentRequest, ListContentQuery, PagedContentListResponse, UpdateContentRequest } from '@ph-cms/api-contract';
10
+ export type { ContentDto, ContentStatDto, ContentMediaDto, CreateContentRequest, ListContentQuery, PagedContentListResponse, UpdateContentRequest } from '@ph-cms/api-contract';
11
11
  export type { HierarchySetDto } from '@ph-cms/api-contract';
12
12
  export type { PermissionPolicySetDto } from '@ph-cms/api-contract';
13
13
  export type { TermDto } from '@ph-cms/api-contract';
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.27",
4
4
  "description": "Unified PH-CMS Client SDK (React + Core)",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "LICENSE"
31
31
  ],
32
32
  "dependencies": {
33
- "@ph-cms/api-contract": "^0.1.9",
33
+ "@ph-cms/api-contract": "^0.1.10",
34
34
  "@tanstack/react-query": "^5.0.0",
35
35
  "axios": "^1.6.0",
36
36
  "zod": "^3.22.4"