-
Notifications
You must be signed in to change notification settings - Fork 0
feat(admin): 정책 개정 등록 화면 (Phase 1b) #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Smartnewb
wants to merge
1
commit into
main
Choose a base branch
from
feat/policy-change-notice-admin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { z } from 'zod'; | ||
|
|
||
| export const policyDocumentTypeSchema = z.enum([ | ||
| 'TERMS_OF_SERVICE', | ||
| 'PRIVACY_POLICY', | ||
| 'DATA_COLLECTION_CONSENT', | ||
| 'SENSITIVE_INFO_CONSENT', | ||
| 'THIRD_PARTY_PROVISION', | ||
| 'MARKETING_CONSENT', | ||
| 'REFUND_POLICY', | ||
| 'LBS_TERMS', | ||
| 'LOCATION_INFO_CONSENT', | ||
| 'CHILD_SAFETY_POLICY', | ||
| ]); | ||
|
|
||
| export const policyDocumentSchema = z | ||
| .object({ | ||
| documentType: policyDocumentTypeSchema, | ||
| version: z.string().min(1, '버전을 입력해주세요.'), | ||
| diffSummary: z.string().min(1, '신구대조 내용을 입력해주세요.'), | ||
| changeReason: z.string().min(1, '변경사유를 입력해주세요.'), | ||
| contentUrl: z | ||
| .string() | ||
| .optional() | ||
| .refine((v) => !v || /^https?:\/\/.+/.test(v), { | ||
| message: '올바른 URL 형식을 입력해주세요.', | ||
| }), | ||
| noticeStartedAt: z.string().min(1, '공지 시작일을 입력해주세요.'), | ||
| effectiveAt: z.string().min(1, '시행일을 입력해주세요.'), | ||
| noticeVisibleUntil: z.string().optional(), | ||
| isMandatory: z.boolean(), | ||
|
|
||
| // 5축 (개인정보처리방침 / 수집이용동의 / 민감정보동의 / 제3자제공동의) | ||
| axisCollectionItems: z.boolean().optional(), | ||
| axisPurpose: z.boolean().optional(), | ||
| axisRetentionPeriod: z.boolean().optional(), | ||
| axisThirdParty: z.boolean().optional(), | ||
| axisSensitiveInfo: z.boolean().optional(), | ||
|
|
||
| // 불리·중대 변경 (이용약관 / 환불정책) | ||
| adverseOrMaterial: z.boolean().optional(), | ||
|
|
||
| // 마케팅 수신동의 확대 항목 | ||
| marketingMediaExpanded: z.boolean().optional(), | ||
| marketingAdTypeExpanded: z.boolean().optional(), | ||
| marketingNightExpanded: z.boolean().optional(), | ||
|
|
||
| // 위치기반서비스 범위 확대 | ||
| locationScopeExpanded: z.boolean().optional(), | ||
|
|
||
| // 재동의 예외 처리 | ||
| reconsentOverride: z.boolean(), | ||
| reconsentOverrideReason: z.string().optional(), | ||
|
|
||
| // 민감정보 동의 - 개인정보처리방침 §23③ 반영 확인 | ||
| privacyPolicyDisclosureConfirmed: z.boolean().optional(), | ||
|
|
||
| // 필수 항목 - 최소수집 원칙 확인 | ||
| minimalCollectionConfirmed: z.boolean().optional(), | ||
| }) | ||
| .superRefine((data, ctx) => { | ||
| if (data.reconsentOverride && !data.reconsentOverrideReason?.trim()) { | ||
| ctx.addIssue({ | ||
| code: z.ZodIssueCode.custom, | ||
| path: ['reconsentOverrideReason'], | ||
| message: '재동의 예외 처리 시 사유를 입력해주세요.', | ||
| }); | ||
| } | ||
|
|
||
| if (data.noticeStartedAt && data.effectiveAt) { | ||
| const start = new Date(data.noticeStartedAt); | ||
| const effective = new Date(data.effectiveAt); | ||
| if (!Number.isNaN(start.getTime()) && !Number.isNaN(effective.getTime()) && effective < start) { | ||
| ctx.addIssue({ | ||
| code: z.ZodIssueCode.custom, | ||
| path: ['effectiveAt'], | ||
| message: '시행일은 공지 시작일 이후여야 합니다.', | ||
| }); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| export type PolicyDocumentFormValues = z.infer<typeof policyDocumentSchema>; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an operator checks
재동의 예외 처리while on the default terms/refund form, leaves the reason blank, and then switches to any non-adverse document type, the override controls are hidden butreact-hook-formkeepsreconsentOverrideset. This unconditional validation then attaches an error to the hiddenreconsentOverrideReasonfield, so the form cannot be submitted and the user has no visible way to fix it except switching back; scope this check to the same document types that render/send the override fields or clear/unregister it on type changes.Useful? React with 👍 / 👎.