feat(chat): 협상 유의사항 안내 팝업 2종 이식 + 팝업 숨김 저장 API
KT-NEGOWIZ fe_v2 의 서비스 안내 팝업을 우리 구조로 이식.
- frontend: GuideContent(공용 본문, VAT/배송비는 chat init 메타로 동적 표시)
+ ServiceInfoPopup(채팅 진입 시 자동 — 안내 보지 않기/오늘 하루 보지 않기)
+ ServiceGuidePopup(메뉴 유의사항·이용 가이드 버튼 수동 — X/배경/ESC 닫기)
+ useServiceInfoPopup 훅(서버 상태 + localStorage 오늘 하루)
+ apis/auth 에 popupStatus 쿼리·hidePopup 뮤테이션, 헬프데스크 연락처 반영,
한국어 단어 잘림 방지(break-keep)
- backend: GET /v1/auth/popup/status, POST /v1/auth/popup/hide
(authenticate 공통 인증 + supplier_users.hide_service_info 영구 저장), 테스트 4건
- db: supplier_users.hide_service_info 컬럼 — 00-init 테이블 정의 갱신,
기존 DB 보정은 alters/2026-07-07-supplier-users-hide-service-info.sql 별도 파일
(기준선 이후 보정 ALTER 는 alters/ 파일로 관리하도록 규칙 변경)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dc0e78ec73
commit
3c8923c075
21 files changed
+488
-21
No files matched your search
@@ -4,10 +4,13 @@ import { http } from '@/apis/http'
|
||||
import type {
|
||||
CreateAccountRequest,
|
||||
CreateAccountResponse,
|
||||
HidePopupRequest,
|
||||
HidePopupResponse,
|
||||
LoginRequest,
|
||||
LoginResponse,
|
||||
LogoutResponse,
|
||||
MeResponse,
|
||||
PopupStatusResponse,
|
||||
} from './auth.type'
|
||||
|
||||
export const authApi = {
|
||||
@@ -34,4 +37,16 @@ export const authApi = {
|
||||
const res = await http.post<LogoutResponse>('/v1/auth/logout')
|
||||
return res.data
|
||||
},
|
||||
|
||||
/** GET /v1/auth/popup/status — 유저별 팝업 '안내 보지 않기' 저장 상태 */
|
||||
popupStatus: async (): Promise<PopupStatusResponse> => {
|
||||
const res = await http.get<PopupStatusResponse>('/v1/auth/popup/status')
|
||||
return res.data
|
||||
},
|
||||
|
||||
/** POST /v1/auth/popup/hide — 해당 팝업을 다시 표시하지 않도록 영구 저장 */
|
||||
hidePopup: async (body: HidePopupRequest): Promise<HidePopupResponse> => {
|
||||
const res = await http.post<HidePopupResponse>('/v1/auth/popup/hide', body)
|
||||
return res.data
|
||||
},
|
||||
}
|
||||
@@ -2,4 +2,5 @@
|
||||
export const authKeys = {
|
||||
all: ['auth'] as const,
|
||||
me: () => [...authKeys.all, 'me'] as const,
|
||||
popupStatus: () => [...authKeys.all, 'popupStatus'] as const,
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { tokenStorage } from '@/apis/tokenStorage'
|
||||
import { authApi } from './auth.api'
|
||||
import { authKeys } from './auth.keys'
|
||||
import type { CreateAccountRequest, LoginResponse } from './auth.type'
|
||||
import type { CreateAccountRequest, LoginResponse, PopupType } from './auth.type'
|
||||
|
||||
/** 로그인 폼이 다루는 파라미터 (UI 친화적인 camelCase) */
|
||||
export interface LoginParams {
|
||||
@@ -53,3 +53,14 @@ export function useCreateAccountMutation() {
|
||||
mutationFn: (body: CreateAccountRequest) => authApi.createAccount(body),
|
||||
})
|
||||
}
|
||||
|
||||
/** 팝업 '안내 보지 않기' 영구 저장. 성공 시 상태 캐시를 무효화한다. */
|
||||
export function useHidePopupMutation() {
|
||||
const queryClient = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: (popupType: PopupType) => authApi.hidePopup({ popup_type: popupType }),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: authKeys.popupStatus() })
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -18,3 +18,13 @@ export function useMeQuery() {
|
||||
select: toAuthUser,
|
||||
})
|
||||
}
|
||||
|
||||
/** 유저별 팝업 '안내 보지 않기' 저장 상태 조회 */
|
||||
export function usePopupStatusQuery() {
|
||||
return useQuery({
|
||||
queryKey: authKeys.popupStatus(),
|
||||
queryFn: authApi.popupStatus,
|
||||
enabled: tokenStorage.hasToken(),
|
||||
staleTime: 5 * 60 * 1000, // 5분
|
||||
})
|
||||
}
|
||||
@@ -69,6 +69,23 @@ export interface LogoutResponse {
|
||||
result: ApiResult
|
||||
}
|
||||
|
||||
// --- 팝업 숨김 (GET /v1/auth/popup/status, POST /v1/auth/popup/hide) --------
|
||||
/** '안내 보지 않기' 를 서버에 저장하는 팝업 종류 */
|
||||
export type PopupType = 'service_info'
|
||||
|
||||
export interface PopupStatusResponse {
|
||||
result: ApiResult
|
||||
service_info: boolean
|
||||
}
|
||||
|
||||
export interface HidePopupRequest {
|
||||
popup_type: PopupType
|
||||
}
|
||||
|
||||
export interface HidePopupResponse {
|
||||
result: ApiResult
|
||||
}
|
||||
|
||||
/** 앱에서 다루기 편한 현재 유저 형태 (MeResponse 에서 파생) */
|
||||
export interface AuthUser {
|
||||
suId: string
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// 인증 API 모듈 공개 표면.
|
||||
export { authApi } from './auth.api'
|
||||
export { authKeys } from './auth.keys'
|
||||
export { useMeQuery } from './auth.queries'
|
||||
export { useMeQuery, usePopupStatusQuery } from './auth.queries'
|
||||
export {
|
||||
useLoginMutation,
|
||||
useLogoutMutation,
|
||||
useCreateAccountMutation,
|
||||
useHidePopupMutation,
|
||||
type LoginParams,
|
||||
} from './auth.mutations'
|
||||
export * from './auth.type'
|
||||
Reference in new issue
Block a user