Compare commits
1 Commits
develop
...
c575094aad
| Author | SHA1 | Date | |
|---|---|---|---|
| c575094aad |
@@ -1,9 +1,7 @@
|
|||||||
NEXT_PUBLIC_ENV=dev
|
NEXT_PUBLIC_ENV=dev
|
||||||
NEXT_PUBLIC_API_BASE=https://test-contact.kric.com/api
|
NEXT_PUBLIC_API_BASE=https://test-contact.kric.com/api
|
||||||
NEXT_PUBLIC_KART_URL=https://test-kart.kric.com
|
|
||||||
|
|
||||||
ENV=dev
|
ENV=dev
|
||||||
CONTACT_SERVER=http://127.0.0.1:4001
|
CONTACT_SERVER=http://127.0.0.1:4001
|
||||||
API_CONTACT_SERVER=http://127.0.0.1:4001/api/v1
|
API_CONTACT_SERVER=http://127.0.0.1:4001/api/v1
|
||||||
API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1
|
API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1
|
||||||
AUTH_COOKIE_DOMAIN=kric.com
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
NEXT_PUBLIC_ENV=local
|
NEXT_PUBLIC_ENV=local
|
||||||
NEXT_PUBLIC_API_BASE=http://localhost:4000/api
|
NEXT_PUBLIC_API_BASE=http://localhost:4000/api
|
||||||
NEXT_PUBLIC_KART_URL=https://test-kart.kric.com
|
|
||||||
|
|
||||||
ENV=local
|
ENV=local
|
||||||
CONTACT_SERVER=http://localhost:4001
|
CONTACT_SERVER=http://localhost:4001
|
||||||
API_CONTACT_SERVER=http://localhost:4001/api/v1
|
API_CONTACT_SERVER=http://localhost:4001/api/v1
|
||||||
API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1
|
API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1
|
||||||
AUTH_COOKIE_DOMAIN=
|
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
NEXT_PUBLIC_ENV=prod
|
NEXT_PUBLIC_ENV=prod
|
||||||
NEXT_PUBLIC_API_BASE=https://contact.kric.com/api
|
NEXT_PUBLIC_API_BASE=https://contact.kric.com/api
|
||||||
NEXT_PUBLIC_KART_URL=https://kart.kric.com
|
|
||||||
|
|
||||||
ENV=prod
|
ENV=prod
|
||||||
CONTACT_SERVER=http://127.0.0.1:4001
|
CONTACT_SERVER=http://127.0.0.1:4001
|
||||||
API_CONTACT_SERVER=http://127.0.0.1:4001/api/v1
|
API_CONTACT_SERVER=http://127.0.0.1:4001/api/v1
|
||||||
API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1
|
API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1
|
||||||
AUTH_COOKIE_DOMAIN=kric.com
|
|
||||||
|
|||||||
52
AGENTS.md
52
AGENTS.md
@@ -229,7 +229,6 @@ When implementation is complete, report in Korean:
|
|||||||
- Treat the current React version, component style, state management, routing, styling, and test approach as authoritative.
|
- Treat the current React version, component style, state management, routing, styling, and test approach as authoritative.
|
||||||
- Do not perform unrelated class-to-hook, JavaScript-to-TypeScript, state-library, styling-system, or React-to-Next.js migrations.
|
- Do not perform unrelated class-to-hook, JavaScript-to-TypeScript, state-library, styling-system, or React-to-Next.js migrations.
|
||||||
- Keep components focused and follow the repository's established split between presentation, state, data access, and side effects.
|
- Keep components focused and follow the repository's established split between presentation, state, data access, and side effects.
|
||||||
- Do not use nested ternary expressions. Use clear `if`/`else` branches, early returns, or well-named intermediate variables instead; a single, non-nested ternary is acceptable only when it remains immediately readable.
|
|
||||||
- Keep effects dependency-correct and clean up subscriptions, timers, listeners, and in-flight work where applicable.
|
- Keep effects dependency-correct and clean up subscriptions, timers, listeners, and in-flight work where applicable.
|
||||||
- Use stable semantic keys and preserve accessibility, loading, empty, error, disabled, and success states.
|
- Use stable semantic keys and preserve accessibility, loading, empty, error, disabled, and success states.
|
||||||
- Preserve public component props and shared UI contracts unless a coordinated breaking change is explicitly approved.
|
- Preserve public component props and shared UI contracts unless a coordinated breaking change is explicitly approved.
|
||||||
@@ -266,35 +265,6 @@ Before each related task, read the current contents of every matching reference,
|
|||||||
|
|
||||||
If a task spans multiple scopes, read every matching reference. Generated files under `.agent-harness/references/` are read-only copies; edit KriFrontCommon's `.agent/consumer.md` or `.agent/consumer-references/` and recompose instead.
|
If a task spans multiple scopes, read every matching reference. Generated files under `.agent-harness/references/` are read-only copies; edit KriFrontCommon's `.agent/consumer.md` or `.agent/consumer-references/` and recompose instead.
|
||||||
|
|
||||||
## Noti-hub SMS Types
|
|
||||||
|
|
||||||
- `MessageType.SMS = 21`, `LMS = 22`, `MMS = 23`; `ChannelType.SMS = 2` is unchanged. `SMS_TYPE_ARRAY` and `SmsType` include all three.
|
|
||||||
- `LMS_MMS = 22` remains a deprecated source-compatibility alias for LMS only. It does not represent MMS. Enum reverse lookup for 22 returns LMS. Use numeric bulk-list paths; the server no longer accepts LMS_MMS in paths. Numeric 21/22/23 bulk-list requests all return the entire SMS channel, not type-filtered lists.
|
|
||||||
- Requests retain their existing URLs/body shapes. The server chooses the actual type per recipient after substitution: attachment -> MMS; otherwise title or UTF-8 body >= 90 bytes -> LMS; otherwise SMS.
|
|
||||||
- Refresh templates from the save response (`tmplatTy`); display actual delivery types from `sendTy`, not the template or result code. A bulk can contain multiple SMS types. LMS/MMS share result codes; use existing server result labels.
|
|
||||||
- SMS, LMS, MMS and KKO use cancellation code 9998. Verify with `npm run typecheck`, `npm run build`, and `node --test tests/noti-hub-sms.test.mjs`.
|
|
||||||
|
|
||||||
## Noti-hub Reservation Cancellation
|
|
||||||
|
|
||||||
- Import cancellation types, constants, and helpers from `@kri/common/noti-hub` only. They are runtime-neutral and require no optional peers.
|
|
||||||
- Individual current cancellation state is determined by resultCode via isReserveCanceledResult; bulk current state is cancellationStatus (NONE/PARTIAL/ALL). These describe current cancellation state, not cancellation eligibility. cancelDt and cancelUser are request history, not current state.
|
|
||||||
- SendResultInfo, SendInfo, and BulkSendInfo expose optional cancelable. Use isSendCancelable(item), which returns true only for cancelable === true, for cancellation eligibility; missing values from older responses are treated as false. Never infer eligibility from cancelDt, result labels, or result codes.
|
|
||||||
- cancelable reflects query-time state and may change before cancellation. Determine the final outcome from SendCancelResponse counts.
|
|
||||||
- sendIdx is the single-cancel identifier, not cmid. It is absent from the latest abbreviated report (/api/v1/report/last/send/...). Request sendIdx must be a positive integer; bulkSendKey is required and at most 32 characters.
|
|
||||||
- EMAIL_RESERVE_CANCELED_RESULT_CODE is 108 for EMAIL. SMS_KKO_RESERVE_CANCELED_RESULT_CODE is 9998 for SMS, LMS, MMS, and KKO. Unknown message types are not recognized as canceled.
|
|
||||||
- Display the server's resultViewLabel/resultLabel ("예약 취소"). There is no separate result-code list API.
|
|
||||||
- HTTP 200 can contain notCancelableCount. parseSendCancelResponse validates nonnegative integer counts and targetCount = canceledCount + alreadyCanceledCount + notCancelableCount, throwing TypeError on invalid data. Bulk targetCount counts currently registered detail rows; response canceledCount counts only cancellations made by that request.
|
|
||||||
- Existing response fields are unchanged; all added fields on existing types are optional. Verify with npm run typecheck and npm run build.
|
|
||||||
|
|
||||||
## HTTP Streaming
|
|
||||||
|
|
||||||
- `@kri/common/http` HTTP clients expose streamGet/streamPost/streamPut/streamPatch/streamDel, returning HttpStreamResponse (status, statusText, headers, url, nullable body).
|
|
||||||
- Streaming shares ordinary authentication, URL, body and HTTP-error policy. Read body incrementally; no automatic JSON/NDJSON/SSE parsing or reconnect is performed.
|
|
||||||
- Streaming options accept an external AbortSignal. Caller cancellation raises AbortError without an HTTP error notification. Cancel the body when it will not be consumed.
|
|
||||||
- timeoutMs covers connection/headers (and an HTTP error body); idleTimeoutMs covers inactivity after successful headers and resets on consumed chunks. Both default to the client's defaultTimeoutMs (60 seconds by default), and 0 disables that timer for streaming only.
|
|
||||||
- Mid-stream transport/time-out errors reach the body reader. HTTP error statuses use existing HttpError handlers before a stream is returned. A 204 response has body=null.
|
|
||||||
- See HTTP_STREAMING.md for examples and node --test tests/http-stream.test.mjs for focused validation after npm run build.
|
|
||||||
|
|
||||||
## KriUiRegistry Consumer Contract
|
## KriUiRegistry Consumer Contract
|
||||||
|
|
||||||
When implementing or changing frontend UI, use this order:
|
When implementing or changing frontend UI, use this order:
|
||||||
@@ -304,28 +274,6 @@ When implementing or changing frontend UI, use this order:
|
|||||||
3. Otherwise, prefer a suitable shadcn/ui component.
|
3. Otherwise, prefer a suitable shadcn/ui component.
|
||||||
4. Create a custom component only when the preceding options cannot meet the requirement safely.
|
4. Create a custom component only when the preceding options cannot meet the requirement safely.
|
||||||
|
|
||||||
### KriAutoComplete Search Scroll
|
|
||||||
|
|
||||||
- `kri-auto-complete` exposes `resetScrollOnSearch?: boolean` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It defaults to `false`, preserving existing behavior.
|
|
||||||
- When enabled, a search value change (including clearing it) resets the option list scroll to the top on the next animation frame in both `filter` and `inputOnly` modes. Async result updates alone do not trigger another reset.
|
|
||||||
|
|
||||||
### KriAutoComplete Option Tooltip
|
|
||||||
|
|
||||||
- `kri-auto-complete` exposes `optionTooltip?: 'singleLine' | 'wrap'` and `optionTooltipClassName?: string` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It is off by default, preserving existing behavior.
|
|
||||||
- When enabled, hovering an option shows its full `label` in a right-side tooltip. `singleLine` stays on one line until the available viewport width; `wrap` wraps at 28rem. The item depends on the shadcn `tooltip` component and provides its own `TooltipProvider`.
|
|
||||||
|
|
||||||
### KriAutoComplete Search Match
|
|
||||||
|
|
||||||
- `kri-auto-complete` exposes `searchMatch?: 'fuzzy' | 'contains'` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It defaults to `fuzzy` (cmdk's default subsequence scoring), preserving existing behavior.
|
|
||||||
- `contains` keeps only options whose label or value contains the search text as a case-insensitive substring, in the original option order. It applies only when `searchMode` is `filter`.
|
|
||||||
|
|
||||||
### KriEditor SMS Preview
|
|
||||||
|
|
||||||
- `changeSmsType` reports `SMS | LMS | MMS`. Update consumer callbacks to handle `MMS`; this widens the previous callback contract.
|
|
||||||
- Attachment presence (`smsHasAttachment`) takes priority and reports MMS. Otherwise a title or UTF-8 preview size >= `smsMaxBytes` (default 90) reports LMS; the remainder reports SMS. LMS/MMS share `lmsMaxBytes` (default 2000).
|
|
||||||
- UTF-8 byte counting includes `smsPreviewSuffix` and its separating newline, without storing the suffix in the body.
|
|
||||||
- This is a preview. Use the template-save response for saved `tmplatTy` and delivery-result `sendTy` for actual per-recipient type after server substitution. Registry updates require updating installed consumer copies.
|
|
||||||
|
|
||||||
### Required Shared References
|
### Required Shared References
|
||||||
|
|
||||||
Before each related task, read the current contents of every matching reference, even if it was read earlier in the session.
|
Before each related task, read the current contents of every matching reference, even if it was read earlier in the session.
|
||||||
|
|||||||
163
package-lock.json
generated
163
package-lock.json
generated
@@ -11,7 +11,7 @@
|
|||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@dnd-kit/sortable": "^10.0.0",
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@kri/common": "^0.20.0",
|
"@kri/common": "^0.19.5",
|
||||||
"@radix-ui/react-checkbox": "^1.3.3",
|
"@radix-ui/react-checkbox": "^1.3.3",
|
||||||
"@radix-ui/react-dialog": "^1.1.15",
|
"@radix-ui/react-dialog": "^1.1.15",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||||
@@ -41,14 +41,13 @@
|
|||||||
"@tiptap/starter-kit": "^3.12.0",
|
"@tiptap/starter-kit": "^3.12.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"cmdk": "^1.1.1",
|
"cmdk": "^1.1.1",
|
||||||
"cn": "0.5.2",
|
|
||||||
"date-fns": "^4.4.0",
|
"date-fns": "^4.4.0",
|
||||||
"dompurify": "^3.4.10",
|
"dompurify": "^3.4.10",
|
||||||
"echarts": "^6.1.0",
|
"echarts": "^6.1.0",
|
||||||
"echarts-for-react": "^3.0.6",
|
"echarts-for-react": "^3.0.6",
|
||||||
"jotai": "^2.15.1",
|
"jotai": "^2.15.1",
|
||||||
"lucide-react": "^0.553.0",
|
"lucide-react": "^0.553.0",
|
||||||
"next": "^16.4.6",
|
"next": "^16.0.7",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"prettier": "^3.9.6",
|
"prettier": "^3.9.6",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
@@ -61,13 +60,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4",
|
||||||
"@types/node": "^24.19.2",
|
"@types/node": "^20",
|
||||||
"@types/qrcode": "^1.5.6",
|
"@types/qrcode": "^1.5.6",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
"babel-plugin-react-compiler": "1.0.0",
|
"babel-plugin-react-compiler": "1.0.0",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "^16.4.6",
|
"eslint-config-next": "^16.0.7",
|
||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
@@ -1195,13 +1194,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@kri/common": {
|
"node_modules/@kri/common": {
|
||||||
"version": "0.20.0",
|
"version": "0.19.5",
|
||||||
"resolved": "https://gitea.kric.com/api/packages/KRi/npm/%40kri%2Fcommon/-/0.20.0/common-0.20.0.tgz",
|
"resolved": "https://gitea.kric.com/api/packages/KRi/npm/%40kri%2Fcommon/-/0.19.5/common-0.19.5.tgz",
|
||||||
"integrity": "sha512-v6pLvFxePWmdSqG5cK63XwFNrmu4aiZQ1WprKktKVz9CQLpKAKPauQ2mvlQkSn70HXRaJmdwQXUpZHQBFZoE0Q==",
|
"integrity": "sha512-Ib+fO3cak17pcRbmxME7m9XwmiWYN8LM4gA8ZhCmRvEv4dopCTY0b2qO80CJXqUybFV4jRRh50+OajANIRyw4w==",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cn": "0.5.2",
|
"clsx": "^2.1.1",
|
||||||
"crypto-js": "^4.2.0"
|
"crypto-js": "^4.2.0",
|
||||||
|
"tailwind-merge": "^3.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tanstack/react-query": ">=5 <6",
|
"@tanstack/react-query": ">=5 <6",
|
||||||
@@ -1233,15 +1233,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/env": {
|
"node_modules/@next/env": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.2.tgz",
|
||||||
"integrity": "sha512-SunBjJ6t+oBtecS3dTjdVuMhUogP5wD/vrGL5EVuQYM1iS4O5ilL51HkiJ3sPjMzRHiCChvr4dbaSJbR7F3lxA==",
|
"integrity": "sha512-nTUTFH7G5/J/fmpkjVLegOkqyKOP0CEsJcMsyO4UCYeN1su+YMW/MfaSErnJskL7XM+UDK6aTvslxsRCyya/sA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@next/eslint-plugin-next": {
|
"node_modules/@next/eslint-plugin-next": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.4.2.tgz",
|
||||||
"integrity": "sha512-HdqERVOafOD8JaUSAkwf9aSu/1rsHlkN8C5GcXYBH3C/z1MxBhZFxB5rz/xqMMRiIj7r9tIv8OCLQ9JWUxCvWA==",
|
"integrity": "sha512-gCTWlw0e+Y6kajpFyKKgA195jUJCRhlzJE0lV7ufe8a+ghIsANWZ0/FiJwg6DuOG1+OvRbcZDcFBoRh3mNJx0g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1250,9 +1250,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-darwin-arm64": {
|
"node_modules/@next/swc-darwin-arm64": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.2.tgz",
|
||||||
"integrity": "sha512-kJ4VVZkley17xKaJx72QN2IBqjrj7zenCQZaUF0l9ShS/1Mt2kW4+Z5KGG6vgr3L/J562xTOizVyM1iA/u5nlg==",
|
"integrity": "sha512-ONkhFvZNFWlsEHOM/81AtxdyuJP2KRYKYR0JxPwvcu1AuPMMMgcL+wW2luldJvMtZwKtUxoSkCychW5wIeoYSw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1266,9 +1266,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-darwin-x64": {
|
"node_modules/@next/swc-darwin-x64": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.2.tgz",
|
||||||
"integrity": "sha512-eIPGZIqC+8JKaeZmvnCANJQF4xWkkHqSnAAajtFxgwDMAOnCgxNvP52SeWZ41PyVwoe+Le/NQuZSaQ8j7YshSA==",
|
"integrity": "sha512-luPCMbOsCoaF+kXJEUjmjmOZg1lC3BflhmUu+ZmW4tBu2vW/4AXak8JBFvePizGkxVmNiAw/r9ra+6UviCWtWQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1282,15 +1282,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-arm64-gnu": {
|
"node_modules/@next/swc-linux-arm64-gnu": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.2.tgz",
|
||||||
"integrity": "sha512-9nI6O8vvczH2D9ZNdMGqb/3NuT15T9ksOZnAmx9/gjF2cOi74+xxyf1Hk96uIMfm14c9y6wHeBq6SH8g6udvcA==",
|
"integrity": "sha512-xhwFTAncJyaCNy5KqKKuKaIIdCy1/1ZV1s5S1G0hhT7wGMkDTlfJ6aQbfRFnIG/s3/kDrxQ8aycVe+c5QnP8ow==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1301,15 +1298,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-arm64-musl": {
|
"node_modules/@next/swc-linux-arm64-musl": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.2.tgz",
|
||||||
"integrity": "sha512-7/qPhTxDp2ScluOJOhLuhWmlA17o1yZ0SIgpISBCpBxXgtnK4+KGywBpFkfLPiU1rnSM1faFGzYkH6i7JdTrqA==",
|
"integrity": "sha512-T1PNmfbPcxr5ndtWUL/3wQtLXsz808lq6sc2GrNT5k2oquF7UyqZddHSuAewHVsWsGXe6nsl9HoN1YNriVjuSg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1320,15 +1314,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-x64-gnu": {
|
"node_modules/@next/swc-linux-x64-gnu": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.2.tgz",
|
||||||
"integrity": "sha512-oOpbNa8XOW1qCGd9VvzC4fbkkRxEls7/WI6tz+YHC0xRA7KpV1U7DrAnCPjzVyOk/karzWEepCOcTIDmwK8FwQ==",
|
"integrity": "sha512-N9cDUOCGtkJG5PNKDFZUF3xXndrJJcpLp121uAGjIGvO/U2p9tfdNOM9htj7+5f72l0m8rMw/cvYacUJBQoudg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1339,15 +1330,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-x64-musl": {
|
"node_modules/@next/swc-linux-x64-musl": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.2.tgz",
|
||||||
"integrity": "sha512-aM8CZ+OR2EwXaAYw7KGkW2GDmNDsLBIRe1MMRZCJPTdw/xhTD0IMUVO4sf3KqrzuRouGzwwLZn34+gFeVXiUQA==",
|
"integrity": "sha512-yY2uh1YhX6ufuYy2FCbw1dqblbhI57GLYAJfCkqD9auTv6pLrH67Uccjc3QMKBeCYAG6lkgu08ExmX1bbjejjQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1358,9 +1346,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-win32-arm64-msvc": {
|
"node_modules/@next/swc-win32-arm64-msvc": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.2.tgz",
|
||||||
"integrity": "sha512-U0p7/tEtqvHX2crhd841CDwKtp5CFkKXVjOhmfccR3Pvp64sj8KBwRqsvltqLOwVBbj0NtkxwXSDpEHYGbxeXQ==",
|
"integrity": "sha512-j/ArWRIHpMMB6wYLMhr2puTguBt70lNU/Cmjl9p6dTDE8DGknYJMP9PdwPk2dqpCNL/KIX9yfngDvIesxJPmsg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1374,9 +1362,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-win32-x64-msvc": {
|
"node_modules/@next/swc-win32-x64-msvc": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.2.tgz",
|
||||||
"integrity": "sha512-3ZG15/5WIdlTQsIEvc9sPTTSL5XFrlLklIKmfF4fwsDnoAhu6NcBDXsk3mbGxNyo6aVLEGex+fHCv2MahY7a9g==",
|
"integrity": "sha512-AA4edyWHDko3NCSo0x6GomsdgFb0oR1J3MXU1b5xt6FRFg4AucrMPW3S0hCe/9onU0O1BbpGQBsqo1r0Gneu1g==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -3823,13 +3811,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "24.19.2",
|
"version": "20.19.25",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.25.tgz",
|
||||||
"integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==",
|
"integrity": "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": ">=7.24.0 <7.24.7"
|
"undici-types": "~6.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/qrcode": {
|
"node_modules/@types/qrcode": {
|
||||||
@@ -4960,18 +4947,6 @@
|
|||||||
"react-dom": "^18 || ^19 || ^19.0.0-rc"
|
"react-dom": "^18 || ^19 || ^19.0.0-rc"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cn": {
|
|
||||||
"version": "0.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/cn/-/cn-0.5.2.tgz",
|
|
||||||
"integrity": "sha512-wm10E6iuJ37rALOw3D+3cfaXXZSLNMh2uxpQn3dNICqfJM59yXqgbA9/9Iiz155j5kYNLdK6WreNdW3NQtx3OQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
|
||||||
"cn": "bin/cn.mjs"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=22"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/codepage": {
|
"node_modules/codepage": {
|
||||||
"version": "1.15.0",
|
"version": "1.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
|
||||||
@@ -5541,13 +5516,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-config-next": {
|
"node_modules/eslint-config-next": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.4.2.tgz",
|
||||||
"integrity": "sha512-IBGGrVf9E6pL0NGL0hmeicVGeSyv1VEzIWq6IecDqkw+YFByhEtDJS9u1r6s6a1VxK6rssh69KyNFQUgfaacqw==",
|
"integrity": "sha512-P33vjcETMXc+qBjpF77TeJHZLzk6cPcTy8KjpxLucYB3mCIFIORMcZ+cBXcAiIYjE5RM7jyknEEOwMNdnx/ADQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next/eslint-plugin-next": "16.4.6",
|
"@next/eslint-plugin-next": "16.4.2",
|
||||||
"eslint-import-resolver-node": "^0.3.6",
|
"eslint-import-resolver-node": "^0.3.6",
|
||||||
"eslint-import-resolver-typescript": "^3.5.2",
|
"eslint-import-resolver-typescript": "^3.5.2",
|
||||||
"eslint-plugin-import": "^2.32.0",
|
"eslint-plugin-import": "^2.32.0",
|
||||||
@@ -7392,12 +7367,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/next": {
|
"node_modules/next": {
|
||||||
"version": "16.4.6",
|
"version": "16.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/next/-/next-16.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/next/-/next-16.4.2.tgz",
|
||||||
"integrity": "sha512-QZJiYhaZLJMo2KpkQGQIwvmd79WVsAWeYIU554a8d7zArS3si/IRy3lBNV/rtYhE70oLwdLYhPAXLPx8HwcwtA==",
|
"integrity": "sha512-r+oBJojfefUjOiWkBhXgLS+igxX/7BWyK59uHnyOyplMSLtBZ+QLP3okrdYTbrfrbrmNTVWLBPaHDX9KRaIt3w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next/env": "16.4.6",
|
"@next/env": "16.4.2",
|
||||||
"@swc/helpers": "0.5.23",
|
"@swc/helpers": "0.5.23",
|
||||||
"baseline-browser-mapping": "^2.9.19",
|
"baseline-browser-mapping": "^2.9.19",
|
||||||
"caniuse-lite": "^1.0.30001579",
|
"caniuse-lite": "^1.0.30001579",
|
||||||
@@ -7411,14 +7386,14 @@
|
|||||||
"node": ">=20.9.0"
|
"node": ">=20.9.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@next/swc-darwin-arm64": "16.4.6",
|
"@next/swc-darwin-arm64": "16.4.2",
|
||||||
"@next/swc-darwin-x64": "16.4.6",
|
"@next/swc-darwin-x64": "16.4.2",
|
||||||
"@next/swc-linux-arm64-gnu": "16.4.6",
|
"@next/swc-linux-arm64-gnu": "16.4.2",
|
||||||
"@next/swc-linux-arm64-musl": "16.4.6",
|
"@next/swc-linux-arm64-musl": "16.4.2",
|
||||||
"@next/swc-linux-x64-gnu": "16.4.6",
|
"@next/swc-linux-x64-gnu": "16.4.2",
|
||||||
"@next/swc-linux-x64-musl": "16.4.6",
|
"@next/swc-linux-x64-musl": "16.4.2",
|
||||||
"@next/swc-win32-arm64-msvc": "16.4.6",
|
"@next/swc-win32-arm64-msvc": "16.4.2",
|
||||||
"@next/swc-win32-x64-msvc": "16.4.6",
|
"@next/swc-win32-x64-msvc": "16.4.2",
|
||||||
"sharp": "^0.35.5"
|
"sharp": "^0.35.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -8841,6 +8816,15 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tailwind-merge": {
|
||||||
|
"version": "3.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.4.0.tgz",
|
||||||
|
"integrity": "sha512-uSaO4gnW+b3Y2aWoWfFpX62vn2sR3skfhbjsEnaBI81WD1wBLlHZe5sWf0AqjksNdYTbGBEd0UasQMT3SNV15g==",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/dcastil"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tailwindcss": {
|
"node_modules/tailwindcss": {
|
||||||
"version": "4.1.17",
|
"version": "4.1.17",
|
||||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.17.tgz",
|
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.17.tgz",
|
||||||
@@ -9112,11 +9096,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
"version": "7.24.6",
|
"version": "6.21.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
||||||
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
|
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"license": "MIT"
|
|
||||||
},
|
},
|
||||||
"node_modules/unrs-resolver": {
|
"node_modules/unrs-resolver": {
|
||||||
"version": "1.11.1",
|
"version": "1.11.1",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@dnd-kit/sortable": "^10.0.0",
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@kri/common": "^0.20.0",
|
"@kri/common": "^0.19.5",
|
||||||
"@radix-ui/react-checkbox": "^1.3.3",
|
"@radix-ui/react-checkbox": "^1.3.3",
|
||||||
"@radix-ui/react-dialog": "^1.1.15",
|
"@radix-ui/react-dialog": "^1.1.15",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||||
@@ -42,14 +42,13 @@
|
|||||||
"@tiptap/starter-kit": "^3.12.0",
|
"@tiptap/starter-kit": "^3.12.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"cmdk": "^1.1.1",
|
"cmdk": "^1.1.1",
|
||||||
"cn": "0.5.2",
|
|
||||||
"date-fns": "^4.4.0",
|
"date-fns": "^4.4.0",
|
||||||
"dompurify": "^3.4.10",
|
"dompurify": "^3.4.10",
|
||||||
"echarts": "^6.1.0",
|
"echarts": "^6.1.0",
|
||||||
"echarts-for-react": "^3.0.6",
|
"echarts-for-react": "^3.0.6",
|
||||||
"jotai": "^2.15.1",
|
"jotai": "^2.15.1",
|
||||||
"lucide-react": "^0.553.0",
|
"lucide-react": "^0.553.0",
|
||||||
"next": "^16.4.6",
|
"next": "^16.0.7",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"prettier": "^3.9.6",
|
"prettier": "^3.9.6",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
@@ -62,13 +61,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4",
|
||||||
"@types/node": "^24.19.2",
|
"@types/node": "^20",
|
||||||
"@types/qrcode": "^1.5.6",
|
"@types/qrcode": "^1.5.6",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
"babel-plugin-react-compiler": "1.0.0",
|
"babel-plugin-react-compiler": "1.0.0",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "^16.4.6",
|
"eslint-config-next": "^16.0.7",
|
||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { AuthSessionGate } from "@/components/app-shell/AuthSessionGate";
|
|
||||||
import AppMainLayout from "@/components/app-shell/AppMainLayout";
|
import AppMainLayout from "@/components/app-shell/AppMainLayout";
|
||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
@@ -32,8 +31,8 @@ export default async function MainLayoutWrapper({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthSessionGate><AppMainLayout initialFontSize={initialFontSize}>
|
<AppMainLayout initialFontSize={initialFontSize}>
|
||||||
{children}
|
{children}
|
||||||
</AppMainLayout></AuthSessionGate>
|
</AppMainLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { Suspense, useEffect, useMemo, useRef, useState } from "react";
|
import { Suspense, useEffect, useMemo, useState } from "react";
|
||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import { ArrowLeft, RefreshCw } from "lucide-react";
|
import { ArrowLeft, RefreshCw } from "lucide-react";
|
||||||
import { useMounted } from "@kri/common/hooks";
|
import { useMounted } from "@kri/common/hooks";
|
||||||
@@ -37,7 +37,6 @@ const ListContactPageContent = () => {
|
|||||||
const userRole = auth?.user?.userRole ?? 0;
|
const userRole = auth?.user?.userRole ?? 0;
|
||||||
const ctiCallPhase = useCtiCallPhase();
|
const ctiCallPhase = useCtiCallPhase();
|
||||||
const shouldBlockNavigation = CTI_CALL_PHASE.includes(ctiCallPhase);
|
const shouldBlockNavigation = CTI_CALL_PHASE.includes(ctiCallPhase);
|
||||||
const hasObservedCall = useRef(false);
|
|
||||||
|
|
||||||
const queriesEnabled = mounted && prjctIdx > 0;
|
const queriesEnabled = mounted && prjctIdx > 0;
|
||||||
const enabled = queriesEnabled && !!sid;
|
const enabled = queriesEnabled && !!sid;
|
||||||
@@ -75,12 +74,10 @@ const ListContactPageContent = () => {
|
|||||||
const hasGuardEntry = window.history.state?.[CALL_NAVIGATION_GUARD_KEY] === true;
|
const hasGuardEntry = window.history.state?.[CALL_NAVIGATION_GUARD_KEY] === true;
|
||||||
|
|
||||||
if (!shouldBlockNavigation) {
|
if (!shouldBlockNavigation) {
|
||||||
if (hasGuardEntry && hasObservedCall.current) window.history.back();
|
if (hasGuardEntry) window.history.back();
|
||||||
hasObservedCall.current = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasObservedCall.current = true;
|
|
||||||
let isRestoringHistory = false;
|
let isRestoringHistory = false;
|
||||||
|
|
||||||
if (!hasGuardEntry) {
|
if (!hasGuardEntry) {
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { useMounted } from "@kri/common/hooks";
|
import { useMounted } from "@kri/common/hooks";
|
||||||
import AppPageTitle from "@/components/app-shell/AppPageTitle";
|
import AppPageTitle from "@/components/app-shell/AppPageTitle";
|
||||||
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||||
import { useProjectInfoQuery } from "@/query/project";
|
import { useProjectInfoQuery, useSurveyRedirectUrlQuery } from "@/query/project";
|
||||||
import { clientEnv } from "@/lib/env.client";
|
|
||||||
import { SurveyType } from "@/types/project";
|
import { SurveyType } from "@/types/project";
|
||||||
import { SURVEY_TYPE_LABEL } from "@/const/projectConst";
|
import { SURVEY_TYPE_LABEL } from "@/const/projectConst";
|
||||||
|
|
||||||
const SurveyProgressPage = () => {
|
const SurveyProgressPage = () => {
|
||||||
const mounted = useMounted();
|
const mounted = useMounted();
|
||||||
const { selectedProject } = useSelectedProject();
|
const { selectedProject } = useSelectedProject();
|
||||||
|
const openedForRef = useRef<string | null>(null);
|
||||||
|
|
||||||
const prjctIdx = selectedProject?.prjctIdx ?? 0;
|
const prjctIdx = selectedProject?.prjctIdx ?? 0;
|
||||||
const enabled = mounted && prjctIdx > 0;
|
const enabled = mounted && prjctIdx > 0;
|
||||||
@@ -20,7 +21,35 @@ const SurveyProgressPage = () => {
|
|||||||
const projectInfoQuery = useProjectInfoQuery(prjctIdx, enabled);
|
const projectInfoQuery = useProjectInfoQuery(prjctIdx, enabled);
|
||||||
const surveys = projectInfoQuery.data?.surveys ?? [];
|
const surveys = projectInfoQuery.data?.surveys ?? [];
|
||||||
|
|
||||||
const isLoading = !mounted || projectInfoQuery.isLoading;
|
const [activeSurveyIdx, setActiveSurveyIdx] = useState<number | null>(null);
|
||||||
|
const [openedUrl, setOpenedUrl] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const selectedSurvey = surveys.find((s) => s.prjctSurveyIdx === activeSurveyIdx) ?? null;
|
||||||
|
const surveyTy = selectedSurvey?.surveyTy ?? SurveyType.NONE;
|
||||||
|
|
||||||
|
const isKonKiwi = surveyTy === SurveyType.KON || surveyTy === SurveyType.KIWI;
|
||||||
|
const isKiwi = surveyTy === SurveyType.KIWI ? 1 : 0;
|
||||||
|
const pkey = selectedSurvey?.surveyPrjctCd ?? "";
|
||||||
|
|
||||||
|
const redirectUrlEnabled = enabled && !!selectedSurvey && isKonKiwi && !!pkey;
|
||||||
|
const redirectUrlQuery = useSurveyRedirectUrlQuery(isKiwi, pkey, redirectUrlEnabled);
|
||||||
|
|
||||||
|
const targetUrl = !selectedSurvey
|
||||||
|
? null
|
||||||
|
: isKonKiwi
|
||||||
|
? (redirectUrlQuery.data ?? null)
|
||||||
|
: surveyTy === SurveyType.EXTERNAL
|
||||||
|
? (selectedSurvey.surveyDashboardUrl || null)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!targetUrl || openedForRef.current === targetUrl) return;
|
||||||
|
openedForRef.current = targetUrl;
|
||||||
|
window.open(targetUrl, "_blank");
|
||||||
|
setOpenedUrl(targetUrl);
|
||||||
|
}, [targetUrl]);
|
||||||
|
|
||||||
|
const isLoading = !mounted || projectInfoQuery.isLoading || (redirectUrlEnabled && redirectUrlQuery.isLoading);
|
||||||
|
|
||||||
if (isLoading) return <LoadingOverlayAdapter force />;
|
if (isLoading) return <LoadingOverlayAdapter force />;
|
||||||
|
|
||||||
@@ -33,14 +62,7 @@ const SurveyProgressPage = () => {
|
|||||||
) : (
|
) : (
|
||||||
<div className="max-w-[600px] space-y-2">
|
<div className="max-w-[600px] space-y-2">
|
||||||
{surveys.map((survey) => {
|
{surveys.map((survey) => {
|
||||||
const isKonKiwi = survey.surveyTy === SurveyType.KON || survey.surveyTy === SurveyType.KIWI;
|
const hasReport = survey.surveyTy !== SurveyType.NONE;
|
||||||
let targetUrl: string | null = null;
|
|
||||||
if (isKonKiwi && survey.surveyPrjctCd) {
|
|
||||||
const projectType = survey.surveyTy === SurveyType.KIWI ? 1 : 0;
|
|
||||||
targetUrl = `${clientEnv.KART_URL}/Report/Current?projectType=${projectType}&pkey=${encodeURIComponent(survey.surveyPrjctCd)}`;
|
|
||||||
} else if (survey.surveyTy === SurveyType.EXTERNAL) {
|
|
||||||
targetUrl = survey.surveyDashboardUrl || null;
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={survey.prjctSurveyIdx ?? survey.surveyOrder}
|
key={survey.prjctSurveyIdx ?? survey.surveyOrder}
|
||||||
@@ -50,21 +72,37 @@ const SurveyProgressPage = () => {
|
|||||||
<p className="font-semibold">{survey.surveyName}</p>
|
<p className="font-semibold">{survey.surveyName}</p>
|
||||||
<p className="text-xs text-muted-foreground">{SURVEY_TYPE_LABEL[survey.surveyTy]}</p>
|
<p className="text-xs text-muted-foreground">{SURVEY_TYPE_LABEL[survey.surveyTy]}</p>
|
||||||
</div>
|
</div>
|
||||||
{targetUrl ? (
|
<Button
|
||||||
<Button asChild>
|
type="button"
|
||||||
<a href={targetUrl} target="_blank" rel="noopener noreferrer">
|
disabled={!hasReport}
|
||||||
|
onClick={() => setActiveSurveyIdx(survey.prjctSurveyIdx ?? null)}
|
||||||
|
>
|
||||||
바로가기
|
바로가기
|
||||||
</a>
|
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
|
||||||
<Button type="button" disabled>바로가기</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{redirectUrlEnabled && redirectUrlQuery.isError ? (
|
||||||
|
<div role="alert" className="flex items-center gap-2 text-destructive">
|
||||||
|
<span>설문 현황 링크를 불러오지 못했습니다.</span>
|
||||||
|
<Button type="button" variant="outline" onClick={() => void redirectUrlQuery.refetch()}>
|
||||||
|
다시 시도
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{openedUrl ? (
|
||||||
|
<p>
|
||||||
|
새 창에서 열립니다. 열리지 않았다면{" "}
|
||||||
|
<a href={openedUrl} target="_blank" rel="noreferrer" className="text-blue-600 underline">
|
||||||
|
여기
|
||||||
|
</a>
|
||||||
|
를 클릭해 주세요.
|
||||||
|
</p>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import { NextResponse } from "next/server";
|
|
||||||
import { errorToResponse } from "@kri/common/http";
|
|
||||||
import { createContactApi } from "@/lib/http-server";
|
|
||||||
import {isLoginUser} from "@/lib/auth-user";
|
|
||||||
|
|
||||||
export async function GET(_request: Request, context: { params: Promise<{ slug?: string[] }> }) {
|
|
||||||
const { slug = [] } = await context.params;
|
|
||||||
if (slug.length !== 1 || slug[0] !== "my-info")
|
|
||||||
return NextResponse.json({ message: "Not found" }, { status: 404, headers: { "Cache-Control": "no-store" } });
|
|
||||||
try {
|
|
||||||
const api = await createContactApi();
|
|
||||||
const user = await api.get<unknown>("/auth/my-info", { cache: "no-store" });
|
|
||||||
if (!isLoginUser(user)) {
|
|
||||||
return NextResponse.json({ message: "Invalid user response" }, { status: 502, headers: { "Cache-Control": "no-store" } });
|
|
||||||
}
|
|
||||||
return NextResponse.json({ userId: user.userId, userName: user.userName, userCmpn: user.userCmpn, userTeam: user.userTeam, userRole: user.userRole }, { headers: { "Cache-Control": "no-store" } });
|
|
||||||
} catch (error) {
|
|
||||||
const response = errorToResponse(error);
|
|
||||||
response.headers.set("Cache-Control", "no-store");
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,6 +24,28 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
|||||||
return NextResponse.json(result, { status: 200 });
|
return NextResponse.json(result, { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(action === "survey-redirect-url" && slug.length === 3){
|
||||||
|
const [, isKiwi, pkey] = slug;
|
||||||
|
if (!["0", "1"].includes(isKiwi)) {
|
||||||
|
return NextResponse.json({ message: "프로젝트 정보를 확인해 주세요." }, { status: 400 });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Contact backend를 거쳐 KON/KIWI 현황 공유 링크를 발급한다.
|
||||||
|
const result = await contactApi.post<unknown>(
|
||||||
|
`/kart/project/${isKiwi}/${encodeURIComponent(pkey)}/share`,
|
||||||
|
{},
|
||||||
|
{ expectText: true },
|
||||||
|
);
|
||||||
|
const shortUrl = typeof result === "string" && /^https?:\/\//.test(result)
|
||||||
|
? result
|
||||||
|
: null;
|
||||||
|
if (!shortUrl) {
|
||||||
|
return NextResponse.json({ message: "KART 공유 링크 응답을 확인해 주세요." }, { status: 502 });
|
||||||
|
}
|
||||||
|
|
||||||
|
return NextResponse.json(shortUrl, { status: 200 });
|
||||||
|
}
|
||||||
|
|
||||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
return errorToResponse(error);
|
return errorToResponse(error);
|
||||||
|
|||||||
@@ -2,7 +2,25 @@ import {NextRequest, NextResponse} from "next/server";
|
|||||||
import {RouteContext} from "@/types/common";
|
import {RouteContext} from "@/types/common";
|
||||||
import {createContactApi} from "@/lib/http-server";
|
import {createContactApi} from "@/lib/http-server";
|
||||||
import {errorToResponse} from "@kri/common/http";
|
import {errorToResponse} from "@kri/common/http";
|
||||||
import type {ListCallHist} from "@/types/list";
|
import type {ListCallHist, ListCallHistSession} from "@/types/list";
|
||||||
|
|
||||||
|
export const GET = async (_req: NextRequest, context: RouteContext) => {
|
||||||
|
try {
|
||||||
|
const { slug = [] } = await context.params;
|
||||||
|
const [action, agentSessionId] = slug;
|
||||||
|
if (action !== "session" || !agentSessionId) {
|
||||||
|
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||||
|
}
|
||||||
|
|
||||||
|
const contactApi = await createContactApi();
|
||||||
|
const result = await contactApi.get<ListCallHistSession>(
|
||||||
|
`/list-call-hist/session/${encodeURIComponent(agentSessionId)}`,
|
||||||
|
);
|
||||||
|
return NextResponse.json(result, { status: 200 });
|
||||||
|
} catch (error: unknown) {
|
||||||
|
return errorToResponse(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const PUT = async (req: NextRequest, context: RouteContext) => {
|
export const PUT = async (req: NextRequest, context: RouteContext) => {
|
||||||
try {
|
try {
|
||||||
@@ -27,3 +45,21 @@ export const PUT = async (req: NextRequest, context: RouteContext) => {
|
|||||||
return errorToResponse(error);
|
return errorToResponse(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const PATCH = async (_req: NextRequest, context: RouteContext) => {
|
||||||
|
try {
|
||||||
|
const { slug = [] } = await context.params;
|
||||||
|
const [action, agentSessionId] = slug;
|
||||||
|
if (action !== "hangup" || !agentSessionId) {
|
||||||
|
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||||
|
}
|
||||||
|
|
||||||
|
const contactApi = await createContactApi();
|
||||||
|
const result = await contactApi.patch<boolean>(
|
||||||
|
`/list-call-hist/hangup/${encodeURIComponent(agentSessionId)}`,
|
||||||
|
);
|
||||||
|
return NextResponse.json(result, { status: 200 });
|
||||||
|
} catch (error: unknown) {
|
||||||
|
return errorToResponse(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import type { LoginRequest, LoginUser } from "@kri/common";
|
import type { LoginRequest, LoginUser } from "@kri/common";
|
||||||
import {setAuthCookie} from "@/lib/auth-cookie";
|
import {serverEnv} from "@/lib/env.server";
|
||||||
import {createContactApi} from "@/lib/http-server";
|
import {createContactApi} from "@/lib/http-server";
|
||||||
import {errorToResponse} from "@kri/common/http";
|
import {errorToResponse} from "@kri/common/http";
|
||||||
|
import {CookieKeys} from "@/store/cookie/cookie-keys";
|
||||||
|
|
||||||
//?ㅼ젣 Backend
|
//?ㅼ젣 Backend
|
||||||
type LoginResponse = {
|
type LoginResponse = {
|
||||||
@@ -18,7 +19,13 @@ export const POST = async (req: NextRequest) => {
|
|||||||
const result = await contactApi.post<LoginResponse>("/auth/login", body);
|
const result = await contactApi.post<LoginResponse>("/auth/login", body);
|
||||||
|
|
||||||
const res = NextResponse.json(result.user, { status: 200 });
|
const res = NextResponse.json(result.user, { status: 200 });
|
||||||
setAuthCookie(res, result.accessToken);
|
res.cookies.set(CookieKeys.AuthToken, result.accessToken, {
|
||||||
|
httpOnly: true,
|
||||||
|
secure: serverEnv.ENV === "prod",
|
||||||
|
sameSite: "lax",
|
||||||
|
path: "/",
|
||||||
|
maxAge: 24 * 60 * 60, // 24?쒓컙
|
||||||
|
});
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
} catch (error : unknown) {
|
} catch (error : unknown) {
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import {setAuthCookie} from "@/lib/auth-cookie";
|
import {serverEnv} from "@/lib/env.server";
|
||||||
import {createContactApi} from "@/lib/http-server";
|
import {createContactApi} from "@/lib/http-server";
|
||||||
import {errorToResponse} from "@kri/common/http";
|
import {errorToResponse} from "@kri/common/http";
|
||||||
import {RouteContext} from "@/types/common";
|
import {RouteContext} from "@/types/common";
|
||||||
|
import {CookieKeys} from "@/store/cookie/cookie-keys";
|
||||||
|
|
||||||
export async function POST(
|
export async function POST(
|
||||||
_req: NextRequest,
|
_req: NextRequest,
|
||||||
@@ -21,7 +22,13 @@ export async function POST(
|
|||||||
await contactApi.post<boolean>(url);
|
await contactApi.post<boolean>(url);
|
||||||
const res = NextResponse.json({ ok: true });
|
const res = NextResponse.json({ ok: true });
|
||||||
|
|
||||||
setAuthCookie(res, "");
|
res.cookies.set(CookieKeys.AuthToken, "", {
|
||||||
|
httpOnly: true,
|
||||||
|
secure: serverEnv.ENV === "prod",
|
||||||
|
sameSite: "lax",
|
||||||
|
path: "/",
|
||||||
|
maxAge: 0,
|
||||||
|
});
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import type { ReactNode } from "react";
|
|
||||||
import { useAuthSession } from "@/hooks/useAuthSession";
|
|
||||||
|
|
||||||
export function AuthSessionGate({ children }: { children: ReactNode }) {
|
|
||||||
const session = useAuthSession();
|
|
||||||
const user = session.data;
|
|
||||||
const checking = session.isPending || session.isFetching;
|
|
||||||
const identity = user && JSON.stringify([user.userId, user.userRole, user.userTeam, user.userCmpn]);
|
|
||||||
|
|
||||||
return <>
|
|
||||||
{session.isError && !checking && <div role="alert" className="p-8 text-center text-sm">
|
|
||||||
<p>로그인 정보를 확인하지 못했습니다.</p>
|
|
||||||
<button type="button" onClick={() => { void session.refetch(); }}>다시 시도</button>
|
|
||||||
</div>}
|
|
||||||
{user && <div key={identity} hidden={session.isError}>{children}</div>}
|
|
||||||
</>;
|
|
||||||
}
|
|
||||||
@@ -3,15 +3,14 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { MultiSelect } from '@/components/common/multi-select'
|
import { MultiSelect } from '@/components/common/multi-select'
|
||||||
import type { MultiSelectOption, MultiSelectRef, MultiSelectSearchMatch } from '@/components/common/multi-select'
|
import type { MultiSelectOption, MultiSelectRef } from '@/components/common/multi-select'
|
||||||
|
|
||||||
export type { MultiSelectOption, MultiSelectRef, MultiSelectSearchMatch } from '@/components/common/multi-select'
|
export type { MultiSelectOption, MultiSelectRef } from '@/components/common/multi-select'
|
||||||
|
|
||||||
export interface KriAutoCompleteBaseProps<T> {
|
export interface KriAutoCompleteBaseProps<T> {
|
||||||
items: T[]
|
items: T[]
|
||||||
searchable?: boolean
|
searchable?: boolean
|
||||||
searchMode?: 'filter' | 'inputOnly'
|
searchMode?: 'filter' | 'inputOnly'
|
||||||
searchMatch?: MultiSelectSearchMatch
|
|
||||||
defaultSearchValue?: string
|
defaultSearchValue?: string
|
||||||
onSearchValueChange?: (value: string) => void
|
onSearchValueChange?: (value: string) => void
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
@@ -59,7 +58,6 @@ export function KriMultiSelect<T = unknown>({
|
|||||||
onChange,
|
onChange,
|
||||||
searchable = true,
|
searchable = true,
|
||||||
searchMode = 'filter',
|
searchMode = 'filter',
|
||||||
searchMatch = 'contains',
|
|
||||||
defaultSearchValue = '',
|
defaultSearchValue = '',
|
||||||
onSearchValueChange,
|
onSearchValueChange,
|
||||||
maxCount = 1,
|
maxCount = 1,
|
||||||
@@ -102,7 +100,6 @@ export function KriMultiSelect<T = unknown>({
|
|||||||
badgeLabelClassName={badgeLabelClassName}
|
badgeLabelClassName={badgeLabelClassName}
|
||||||
searchable={searchable}
|
searchable={searchable}
|
||||||
searchMode={searchMode}
|
searchMode={searchMode}
|
||||||
searchMatch={searchMatch}
|
|
||||||
defaultSearchValue={defaultSearchValue}
|
defaultSearchValue={defaultSearchValue}
|
||||||
onSearchValueChange={onSearchValueChange}
|
onSearchValueChange={onSearchValueChange}
|
||||||
maxCount={maxCount}
|
maxCount={maxCount}
|
||||||
@@ -138,7 +135,6 @@ function KriSingleSelectInner<T>(
|
|||||||
onChange,
|
onChange,
|
||||||
searchable = true,
|
searchable = true,
|
||||||
searchMode = 'filter',
|
searchMode = 'filter',
|
||||||
searchMatch = 'contains',
|
|
||||||
defaultSearchValue = '',
|
defaultSearchValue = '',
|
||||||
onSearchValueChange,
|
onSearchValueChange,
|
||||||
placeholder = '옵션을 선택하세요',
|
placeholder = '옵션을 선택하세요',
|
||||||
@@ -220,7 +216,6 @@ function KriSingleSelectInner<T>(
|
|||||||
badgeLabelClassName={badgeLabelClassName ?? 'min-w-0 flex-1'}
|
badgeLabelClassName={badgeLabelClassName ?? 'min-w-0 flex-1'}
|
||||||
searchable={searchable}
|
searchable={searchable}
|
||||||
searchMode={searchMode}
|
searchMode={searchMode}
|
||||||
searchMatch={searchMatch}
|
|
||||||
defaultSearchValue={defaultSearchValue}
|
defaultSearchValue={defaultSearchValue}
|
||||||
onSearchValueChange={onSearchValueChange}
|
onSearchValueChange={onSearchValueChange}
|
||||||
preventDeselect={preventDeselect}
|
preventDeselect={preventDeselect}
|
||||||
|
|||||||
@@ -1,247 +0,0 @@
|
|||||||
'use client'
|
|
||||||
|
|
||||||
import { useState, type CSSProperties, type KeyboardEvent } from 'react'
|
|
||||||
import { Check } from 'lucide-react'
|
|
||||||
import { Slider as SliderPrimitive } from 'radix-ui'
|
|
||||||
import { Button } from '@/components/ui/button'
|
|
||||||
import { ColorPicker, ColorPickerArea, ColorPickerHueSlider } from '@/components/common/color-palette/color-picker'
|
|
||||||
import { Input } from '@/components/ui/input'
|
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
|
||||||
import { cn } from '@/lib/utils'
|
|
||||||
import { formatHexColor, isLightHexColor, normalizeHexColor, parseHexColor } from '@/components/common/color-palette/color'
|
|
||||||
|
|
||||||
export const KRI_COLOR_PALETTE_DEFAULT_COLORS = [
|
|
||||||
'#111827', '#4B5563', '#9CA3AF', '#E5E7EB', '#EF4444', '#F97316', '#F59E0B', '#EAB308',
|
|
||||||
'#84CC16', '#22C55E', '#14B8A6', '#06B6D4', '#3B82F6', '#6366F1', '#A855F7', '#EC4899',
|
|
||||||
] as const
|
|
||||||
|
|
||||||
const CUSTOM_PICKER_FALLBACK = '#3B82F6'
|
|
||||||
const CHECKERBOARD = 'repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 0% 50% / 8px 8px'
|
|
||||||
|
|
||||||
export type KriColorPaletteProps = {
|
|
||||||
/** `#RRGGBB` 또는 `#RRGGBBAA` 형식의 색상. 지정되지 않았으면 null */
|
|
||||||
value: string | null
|
|
||||||
onChange: (value: string | null) => void
|
|
||||||
colors?: readonly string[]
|
|
||||||
/** 색상 영역·색조 슬라이더·HEX 입력 노출 여부 */
|
|
||||||
allowCustom?: boolean
|
|
||||||
/**
|
|
||||||
* 투명도 슬라이더 노출 및 `#RRGGBBAA` 입력 허용 여부.
|
|
||||||
* false여도 전달받은 값의 투명도는 표시·보존하며, 사용자가 색을 바꾸면 불투명(`#RRGGBB`)으로 바뀐다.
|
|
||||||
*/
|
|
||||||
allowAlpha?: boolean
|
|
||||||
allowClear?: boolean
|
|
||||||
disabled?: boolean
|
|
||||||
placeholder?: string
|
|
||||||
className?: string
|
|
||||||
'aria-label'?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const swatchStyle = (color: string): CSSProperties => ({
|
|
||||||
background: `linear-gradient(${color}, ${color}), ${CHECKERBOARD}`,
|
|
||||||
})
|
|
||||||
|
|
||||||
export function KriColorPalette({
|
|
||||||
value,
|
|
||||||
onChange,
|
|
||||||
colors = KRI_COLOR_PALETTE_DEFAULT_COLORS,
|
|
||||||
allowCustom = true,
|
|
||||||
allowAlpha = false,
|
|
||||||
allowClear = true,
|
|
||||||
disabled = false,
|
|
||||||
placeholder = '색상 없음',
|
|
||||||
className,
|
|
||||||
'aria-label': ariaLabel = '색상 선택',
|
|
||||||
}: KriColorPaletteProps) {
|
|
||||||
const normalizedValue = normalizeHexColor(value)
|
|
||||||
const parsedValue = parseHexColor(normalizedValue)
|
|
||||||
const currentAlpha = parsedValue?.alpha ?? 255
|
|
||||||
const [open, setOpen] = useState(false)
|
|
||||||
// 프리셋·HEX 입력·제거로 값이 바뀌면 색상 영역을 새 값으로 다시 초기화한다.
|
|
||||||
const [pickerKey, setPickerKey] = useState(0)
|
|
||||||
const [hexDraft, setHexDraft] = useState(normalizedValue ?? '')
|
|
||||||
const [hexDraftSource, setHexDraftSource] = useState(normalizedValue)
|
|
||||||
const [hexInvalid, setHexInvalid] = useState(false)
|
|
||||||
|
|
||||||
if (hexDraftSource !== normalizedValue) {
|
|
||||||
setHexDraftSource(normalizedValue)
|
|
||||||
setHexDraft(normalizedValue ?? '')
|
|
||||||
setHexInvalid(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
const withAlpha = (rgb: string) => formatHexColor(rgb, allowAlpha ? currentAlpha : 255)
|
|
||||||
|
|
||||||
const selectDiscrete = (next: string | null) => {
|
|
||||||
onChange(next)
|
|
||||||
setPickerKey((key) => key + 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlePickerChange = (next: string) => {
|
|
||||||
const parsed = parseHexColor(next)
|
|
||||||
if (!parsed) return
|
|
||||||
const nextValue = withAlpha(parsed.rgb)
|
|
||||||
if (nextValue === normalizedValue) return
|
|
||||||
onChange(nextValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleAlphaChange = (values: number[]) => {
|
|
||||||
const percent = values[0] ?? 100
|
|
||||||
const nextValue = formatHexColor(parsedValue?.rgb ?? CUSTOM_PICKER_FALLBACK, (percent / 100) * 255)
|
|
||||||
if (nextValue === normalizedValue) return
|
|
||||||
onChange(nextValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
const commitHexDraft = () => {
|
|
||||||
if (hexDraft.trim() === '') {
|
|
||||||
setHexDraft(normalizedValue ?? '')
|
|
||||||
setHexInvalid(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 전달받은 값을 그대로 두고 포커스만 이동한 경우(투명도 포함 값 포함)는 변경으로 보지 않는다.
|
|
||||||
if (normalizeHexColor(hexDraft) === normalizedValue) {
|
|
||||||
setHexDraft(normalizedValue ?? '')
|
|
||||||
setHexInvalid(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const parsed = parseHexColor(hexDraft)
|
|
||||||
if (!parsed || (!allowAlpha && parsed.alpha !== 255)) {
|
|
||||||
setHexInvalid(true)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const nextValue = formatHexColor(parsed.rgb, parsed.alpha)
|
|
||||||
setHexInvalid(false)
|
|
||||||
setHexDraft(nextValue)
|
|
||||||
if (nextValue !== normalizedValue) selectDiscrete(nextValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleHexKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
|
|
||||||
if (event.key !== 'Enter') return
|
|
||||||
event.preventDefault()
|
|
||||||
commitHexDraft()
|
|
||||||
}
|
|
||||||
|
|
||||||
const hexFormatLabel = allowAlpha ? '#RRGGBB 또는 #RRGGBBAA' : '#RRGGBB'
|
|
||||||
const alphaPercent = Math.round((currentAlpha / 255) * 100)
|
|
||||||
|
|
||||||
// disabled이면 트리거 상태와 무관하게 팝오버가 열리지 않도록 한다(이미 열린 상태에서 disabled로 바뀐 경우 포함).
|
|
||||||
const resolvedOpen = open && !disabled
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Popover open={resolvedOpen} onOpenChange={(nextOpen) => setOpen(nextOpen && !disabled)}>
|
|
||||||
<PopoverTrigger asChild>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
disabled={disabled}
|
|
||||||
aria-label={`${ariaLabel}: ${normalizedValue ?? placeholder}`}
|
|
||||||
className={cn('w-full justify-start gap-2 px-2 font-normal', className)}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden
|
|
||||||
className={cn('size-4 shrink-0 rounded-sm border', !normalizedValue && 'bg-[linear-gradient(to_bottom_right,transparent_calc(50%-1px),var(--destructive)_calc(50%-1px)_calc(50%+1px),transparent_calc(50%+1px))]')}
|
|
||||||
style={normalizedValue ? swatchStyle(normalizedValue) : undefined}
|
|
||||||
/>
|
|
||||||
<span className={cn('truncate font-mono text-xs', !normalizedValue && 'text-muted-foreground font-sans')}>
|
|
||||||
{normalizedValue ?? placeholder}
|
|
||||||
</span>
|
|
||||||
</Button>
|
|
||||||
</PopoverTrigger>
|
|
||||||
<PopoverContent align="start" className="w-64 space-y-3 p-3">
|
|
||||||
<div className="grid grid-cols-8 gap-1.5" role="group" aria-label="기본 색상">
|
|
||||||
{colors.map((color) => {
|
|
||||||
const parsedColor = parseHexColor(color)
|
|
||||||
if (!parsedColor) return null
|
|
||||||
const selected = parsedColor.rgb === parsedValue?.rgb
|
|
||||||
const checkColorClass = isLightHexColor(parsedColor.rgb) ? 'text-black' : 'text-white'
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
key={parsedColor.rgb}
|
|
||||||
type="button"
|
|
||||||
className="focus-visible:ring-ring flex size-6 items-center justify-center rounded-sm border focus-visible:ring-2 focus-visible:outline-none"
|
|
||||||
style={{ backgroundColor: parsedColor.rgb }}
|
|
||||||
aria-label={`색상 ${parsedColor.rgb}`}
|
|
||||||
aria-pressed={selected}
|
|
||||||
title={parsedColor.rgb}
|
|
||||||
onClick={() => selectDiscrete(withAlpha(parsedColor.rgb))}
|
|
||||||
>
|
|
||||||
{selected ? <Check className={cn('size-3.5', checkColorClass)} /> : null}
|
|
||||||
</button>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{allowCustom ? (
|
|
||||||
<div className="space-y-3 border-t pt-3">
|
|
||||||
<ColorPicker
|
|
||||||
key={pickerKey}
|
|
||||||
inline
|
|
||||||
defaultValue={parsedValue?.rgb ?? CUSTOM_PICKER_FALLBACK}
|
|
||||||
onValueChange={handlePickerChange}
|
|
||||||
className="flex flex-col gap-3"
|
|
||||||
>
|
|
||||||
<ColorPickerArea className="h-32" />
|
|
||||||
<ColorPickerHueSlider aria-label="색조" />
|
|
||||||
</ColorPicker>
|
|
||||||
{allowAlpha ? (
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<SliderPrimitive.Root
|
|
||||||
className="relative flex w-full touch-none items-center select-none"
|
|
||||||
min={0}
|
|
||||||
max={100}
|
|
||||||
step={1}
|
|
||||||
value={[alphaPercent]}
|
|
||||||
onValueChange={handleAlphaChange}
|
|
||||||
aria-label="투명도"
|
|
||||||
>
|
|
||||||
<SliderPrimitive.Track
|
|
||||||
className="relative h-3 w-full grow overflow-hidden rounded-full"
|
|
||||||
style={{ background: CHECKERBOARD }}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="absolute inset-0 rounded-full"
|
|
||||||
style={{ background: `linear-gradient(to right, transparent, ${parsedValue?.rgb ?? CUSTOM_PICKER_FALLBACK})` }}
|
|
||||||
/>
|
|
||||||
</SliderPrimitive.Track>
|
|
||||||
<SliderPrimitive.Thumb className="border-primary/50 bg-background focus-visible:ring-ring block size-4 rounded-full border shadow focus-visible:ring-1 focus-visible:outline-none" />
|
|
||||||
</SliderPrimitive.Root>
|
|
||||||
<span className="text-muted-foreground w-10 shrink-0 text-right font-mono text-xs">{alphaPercent}%</span>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
<div className="space-y-1">
|
|
||||||
<Input
|
|
||||||
value={hexDraft}
|
|
||||||
onChange={(event) => {
|
|
||||||
setHexDraft(event.target.value)
|
|
||||||
setHexInvalid(false)
|
|
||||||
}}
|
|
||||||
onBlur={commitHexDraft}
|
|
||||||
onKeyDown={handleHexKeyDown}
|
|
||||||
placeholder={allowAlpha ? '#RRGGBBAA' : '#RRGGBB'}
|
|
||||||
maxLength={allowAlpha ? 9 : 7}
|
|
||||||
aria-label="HEX 색상 코드"
|
|
||||||
aria-invalid={hexInvalid}
|
|
||||||
className="h-8 font-mono text-sm"
|
|
||||||
/>
|
|
||||||
{hexInvalid ? <p className="text-destructive text-xs">{hexFormatLabel} 형식으로 입력해 주세요.</p> : null}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{allowClear ? (
|
|
||||||
<div className="flex justify-end border-t pt-2">
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
disabled={!normalizedValue}
|
|
||||||
onClick={() => selectDiscrete(null)}
|
|
||||||
>
|
|
||||||
색상 제거
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</PopoverContent>
|
|
||||||
</Popover>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,42 +0,0 @@
|
|||||||
export type ParsedHexColor = {
|
|
||||||
/** `#RRGGBB` (대문자) */
|
|
||||||
rgb: string
|
|
||||||
/** 0~255. 투명도가 없는 값은 255 */
|
|
||||||
alpha: number
|
|
||||||
}
|
|
||||||
|
|
||||||
const HEX_COLOR_PATTERN = /^#?([0-9A-F]{6})([0-9A-F]{2})?$/
|
|
||||||
|
|
||||||
/** `#RRGGBB` 또는 `#RRGGBBAA`(대소문자 무관, `#` 생략 가능)를 해석한다. 형식이 다르면 null. */
|
|
||||||
export const parseHexColor = (value: string | null | undefined): ParsedHexColor | null => {
|
|
||||||
if (!value) return null
|
|
||||||
const match = HEX_COLOR_PATTERN.exec(value.trim().toUpperCase())
|
|
||||||
if (!match) return null
|
|
||||||
return {
|
|
||||||
rgb: `#${match[1]}`,
|
|
||||||
alpha: match[2] ? Number.parseInt(match[2], 16) : 255,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 투명도가 255이면 `#RRGGBB`, 아니면 `#RRGGBBAA`로 만든다. */
|
|
||||||
export const formatHexColor = (rgb: string, alpha = 255): string => {
|
|
||||||
const clamped = Math.max(0, Math.min(255, Math.round(alpha)))
|
|
||||||
if (clamped === 255) return rgb.toUpperCase()
|
|
||||||
return `${rgb.toUpperCase()}${clamped.toString(16).padStart(2, '0').toUpperCase()}`
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 정규화된 hex 문자열. 형식이 다르면 null. */
|
|
||||||
export const normalizeHexColor = (value: string | null | undefined): string | null => {
|
|
||||||
const parsed = parseHexColor(value)
|
|
||||||
return parsed ? formatHexColor(parsed.rgb, parsed.alpha) : null
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 흰 배경 위에 그렸을 때 밝은 색인지 판단한다(투명도 반영). 글자색 대비 결정에 쓴다. */
|
|
||||||
export const isLightHexColor = (value: string): boolean => {
|
|
||||||
const parsed = parseHexColor(value)
|
|
||||||
if (!parsed) return true
|
|
||||||
const ratio = parsed.alpha / 255
|
|
||||||
const channel = (offset: number) => Number.parseInt(parsed.rgb.slice(offset, offset + 2), 16) * ratio + 255 * (1 - ratio)
|
|
||||||
const luminance = (channel(1) * 299 + channel(3) * 587 + channel(5) * 114) / 1000
|
|
||||||
return luminance > 150
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import * as React from "react";
|
|
||||||
|
|
||||||
function useRefWithInit<T>(init: () => T): React.RefObject<T> {
|
|
||||||
const [ref] = React.useState(() => ({ current: init() }));
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { useRefWithInit };
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import { useLayoutEffect } from "radix-ui/internal";
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
function useValueAsRef<T>(value: T) {
|
|
||||||
const ref = React.useRef<T>(value);
|
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
ref.current = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { useValueAsRef };
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
type InputValue = string[] | string;
|
|
||||||
|
|
||||||
interface VisuallyHiddenInputProps<T = InputValue> extends Omit<
|
|
||||||
React.InputHTMLAttributes<HTMLInputElement>,
|
|
||||||
"value" | "checked" | "onReset"
|
|
||||||
> {
|
|
||||||
value?: T;
|
|
||||||
checked?: boolean;
|
|
||||||
control: HTMLElement | null;
|
|
||||||
bubbles?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
function VisuallyHiddenInput<T = InputValue>(
|
|
||||||
props: VisuallyHiddenInputProps<T>,
|
|
||||||
) {
|
|
||||||
const {
|
|
||||||
control,
|
|
||||||
value,
|
|
||||||
checked,
|
|
||||||
bubbles = true,
|
|
||||||
type = "hidden",
|
|
||||||
style,
|
|
||||||
...inputProps
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const isCheckInput = React.useMemo(
|
|
||||||
() => type === "checkbox" || type === "radio" || type === "switch",
|
|
||||||
[type],
|
|
||||||
);
|
|
||||||
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
||||||
|
|
||||||
const prevValueRef = React.useRef<T | boolean | undefined>(
|
|
||||||
isCheckInput ? checked : value,
|
|
||||||
);
|
|
||||||
|
|
||||||
const [measuredSize, setMeasuredSize] = React.useState<{
|
|
||||||
control: HTMLElement;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
} | null>(null);
|
|
||||||
|
|
||||||
const controlSize = React.useMemo<{
|
|
||||||
width?: number;
|
|
||||||
height?: number;
|
|
||||||
}>(
|
|
||||||
() =>
|
|
||||||
control && measuredSize?.control === control
|
|
||||||
? { width: measuredSize.width, height: measuredSize.height }
|
|
||||||
: {},
|
|
||||||
[control, measuredSize],
|
|
||||||
);
|
|
||||||
|
|
||||||
React.useLayoutEffect(() => {
|
|
||||||
if (!control) return;
|
|
||||||
|
|
||||||
if (typeof window === "undefined") return;
|
|
||||||
|
|
||||||
const resizeObserver = new ResizeObserver((entries) => {
|
|
||||||
if (!Array.isArray(entries) || !entries.length) return;
|
|
||||||
|
|
||||||
const entry = entries[0];
|
|
||||||
if (!entry) return;
|
|
||||||
|
|
||||||
let width: number;
|
|
||||||
let height: number;
|
|
||||||
|
|
||||||
if ("borderBoxSize" in entry) {
|
|
||||||
const borderSizeEntry = entry.borderBoxSize;
|
|
||||||
const borderSize = Array.isArray(borderSizeEntry)
|
|
||||||
? borderSizeEntry[0]
|
|
||||||
: borderSizeEntry;
|
|
||||||
width = borderSize.inlineSize;
|
|
||||||
height = borderSize.blockSize;
|
|
||||||
} else {
|
|
||||||
width = control.offsetWidth;
|
|
||||||
height = control.offsetHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
setMeasuredSize({ control, width, height });
|
|
||||||
});
|
|
||||||
|
|
||||||
resizeObserver.observe(control, { box: "border-box" });
|
|
||||||
return () => {
|
|
||||||
resizeObserver.disconnect();
|
|
||||||
};
|
|
||||||
}, [control]);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
const currentValue = isCheckInput ? checked : value;
|
|
||||||
const prevValue = prevValueRef.current;
|
|
||||||
prevValueRef.current = currentValue;
|
|
||||||
|
|
||||||
const input = inputRef.current;
|
|
||||||
if (!input) return;
|
|
||||||
|
|
||||||
const inputProto = window.HTMLInputElement.prototype;
|
|
||||||
const propertyKey = isCheckInput ? "checked" : "value";
|
|
||||||
const eventType = isCheckInput ? "click" : "input";
|
|
||||||
|
|
||||||
let serializedCurrentValue: unknown = value;
|
|
||||||
if (isCheckInput) {
|
|
||||||
serializedCurrentValue = checked;
|
|
||||||
} else if (typeof value === "object" && value !== null) {
|
|
||||||
serializedCurrentValue = JSON.stringify(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
const descriptor = Object.getOwnPropertyDescriptor(inputProto, propertyKey);
|
|
||||||
|
|
||||||
const setter = descriptor?.set;
|
|
||||||
|
|
||||||
if (prevValue !== currentValue && setter) {
|
|
||||||
const event = new Event(eventType, { bubbles });
|
|
||||||
setter.call(input, serializedCurrentValue);
|
|
||||||
input.dispatchEvent(event);
|
|
||||||
}
|
|
||||||
}, [value, checked, bubbles, isCheckInput]);
|
|
||||||
|
|
||||||
const composedStyle = React.useMemo<React.CSSProperties>(() => {
|
|
||||||
return {
|
|
||||||
...style,
|
|
||||||
...(controlSize.width !== undefined && controlSize.height !== undefined
|
|
||||||
? controlSize
|
|
||||||
: {}),
|
|
||||||
border: 0,
|
|
||||||
clip: "rect(0 0 0 0)",
|
|
||||||
clipPath: "inset(50%)",
|
|
||||||
height: "1px",
|
|
||||||
margin: "-1px",
|
|
||||||
overflow: "hidden",
|
|
||||||
padding: 0,
|
|
||||||
position: "absolute",
|
|
||||||
whiteSpace: "nowrap",
|
|
||||||
width: "1px",
|
|
||||||
};
|
|
||||||
}, [style, controlSize]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<input
|
|
||||||
type={type}
|
|
||||||
{...inputProps}
|
|
||||||
ref={inputRef}
|
|
||||||
aria-hidden={isCheckInput}
|
|
||||||
tabIndex={-1}
|
|
||||||
defaultChecked={isCheckInput ? checked : undefined}
|
|
||||||
style={composedStyle}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { VisuallyHiddenInput };
|
|
||||||
@@ -31,7 +31,6 @@ function MultiSelectInner<T>(
|
|||||||
hideSelectAll = false,
|
hideSelectAll = false,
|
||||||
searchable = true,
|
searchable = true,
|
||||||
searchMode = 'filter',
|
searchMode = 'filter',
|
||||||
searchMatch = 'fuzzy',
|
|
||||||
defaultSearchValue = '',
|
defaultSearchValue = '',
|
||||||
onSearchValueChange,
|
onSearchValueChange,
|
||||||
emptyIndicator = '검색 결과가 없습니다.',
|
emptyIndicator = '검색 결과가 없습니다.',
|
||||||
@@ -202,7 +201,6 @@ function MultiSelectInner<T>(
|
|||||||
selectedValues={selectedValues}
|
selectedValues={selectedValues}
|
||||||
searchable={searchable}
|
searchable={searchable}
|
||||||
searchMode={searchMode}
|
searchMode={searchMode}
|
||||||
searchMatch={searchMatch}
|
|
||||||
searchValue={searchValue}
|
searchValue={searchValue}
|
||||||
onSearchValueChange={handleSearchChange}
|
onSearchValueChange={handleSearchChange}
|
||||||
hideSelectAll={hideSelectAll}
|
hideSelectAll={hideSelectAll}
|
||||||
|
|||||||
@@ -11,19 +11,14 @@ import {
|
|||||||
CommandSeparator,
|
CommandSeparator,
|
||||||
} from '@/components/ui/command'
|
} from '@/components/ui/command'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import type { MultiSelectGroup, MultiSelectOption, MultiSelectOptions, MultiSelectSearchMatch } from './types'
|
import type { MultiSelectGroup, MultiSelectOption, MultiSelectOptions } from './types'
|
||||||
import { isGroupedOptions } from './utils'
|
import { isGroupedOptions } from './utils'
|
||||||
|
|
||||||
function containsFilter(value: string, search: string) {
|
|
||||||
return value.toLowerCase().includes(search.toLowerCase()) ? 1 : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MultiSelectContentProps<T> {
|
interface MultiSelectContentProps<T> {
|
||||||
options: MultiSelectOptions<T>
|
options: MultiSelectOptions<T>
|
||||||
selectedValues: string[]
|
selectedValues: string[]
|
||||||
searchable: boolean
|
searchable: boolean
|
||||||
searchMode: 'filter' | 'inputOnly'
|
searchMode: 'filter' | 'inputOnly'
|
||||||
searchMatch?: MultiSelectSearchMatch
|
|
||||||
searchValue: string
|
searchValue: string
|
||||||
onSearchValueChange: (value: string) => void
|
onSearchValueChange: (value: string) => void
|
||||||
hideSelectAll: boolean
|
hideSelectAll: boolean
|
||||||
@@ -101,7 +96,6 @@ export function MultiSelectContent<T>({
|
|||||||
selectedValues,
|
selectedValues,
|
||||||
searchable,
|
searchable,
|
||||||
searchMode,
|
searchMode,
|
||||||
searchMatch = 'fuzzy',
|
|
||||||
searchValue,
|
searchValue,
|
||||||
onSearchValueChange,
|
onSearchValueChange,
|
||||||
hideSelectAll,
|
hideSelectAll,
|
||||||
@@ -117,7 +111,7 @@ export function MultiSelectContent<T>({
|
|||||||
const allSelected = selectableOptions.length > 0 && selectableOptions.every((option) => selectedValues.includes(option.value))
|
const allSelected = selectableOptions.length > 0 && selectableOptions.every((option) => selectedValues.includes(option.value))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Command shouldFilter={searchMode === 'filter'} filter={searchMatch === 'contains' ? containsFilter : undefined}>
|
<Command shouldFilter={searchMode === 'filter'}>
|
||||||
{searchable ? (
|
{searchable ? (
|
||||||
<CommandInput
|
<CommandInput
|
||||||
value={searchValue}
|
value={searchValue}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ export type {
|
|||||||
AnimationConfig,
|
AnimationConfig,
|
||||||
MultiSelectGroup,
|
MultiSelectGroup,
|
||||||
MultiSelectOption,
|
MultiSelectOption,
|
||||||
MultiSelectSearchMatch,
|
|
||||||
MultiSelectOptions,
|
MultiSelectOptions,
|
||||||
MultiSelectProps,
|
MultiSelectProps,
|
||||||
MultiSelectRef,
|
MultiSelectRef,
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ export interface MultiSelectGroup<T = unknown> {
|
|||||||
|
|
||||||
export type MultiSelectOptions<T = unknown> = MultiSelectOption<T>[] | MultiSelectGroup<T>[]
|
export type MultiSelectOptions<T = unknown> = MultiSelectOption<T>[] | MultiSelectGroup<T>[]
|
||||||
export type MultiSelectSelectionMode = 'single' | 'multiple'
|
export type MultiSelectSelectionMode = 'single' | 'multiple'
|
||||||
export type MultiSelectSearchMatch = 'fuzzy' | 'contains'
|
|
||||||
export type MultiSelectVariant = 'default' | 'secondary' | 'destructive' | 'inverted'
|
export type MultiSelectVariant = 'default' | 'secondary' | 'destructive' | 'inverted'
|
||||||
|
|
||||||
export interface MultiSelectResponsiveSettings {
|
export interface MultiSelectResponsiveSettings {
|
||||||
@@ -66,7 +65,6 @@ export interface MultiSelectProps<T = unknown>
|
|||||||
hideSelectAll?: boolean
|
hideSelectAll?: boolean
|
||||||
searchable?: boolean
|
searchable?: boolean
|
||||||
searchMode?: 'filter' | 'inputOnly'
|
searchMode?: 'filter' | 'inputOnly'
|
||||||
searchMatch?: MultiSelectSearchMatch
|
|
||||||
defaultSearchValue?: string
|
defaultSearchValue?: string
|
||||||
onSearchValueChange?: (value: string) => void
|
onSearchValueChange?: (value: string) => void
|
||||||
emptyIndicator?: React.ReactNode
|
emptyIndicator?: React.ReactNode
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect, useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { RotateCcw } from 'lucide-react'
|
|
||||||
import { KriDialog } from '@/components/common/KriDialog'
|
import { KriDialog } from '@/components/common/KriDialog'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
@@ -108,18 +107,6 @@ const ListFilterDialog = ({
|
|||||||
[rows, headerOptions],
|
[rows, headerOptions],
|
||||||
)
|
)
|
||||||
|
|
||||||
// 잠긴 헤더는 조회 조건에 쓰이지 않으므로 초기화 필요 여부 판단에서 제외한다.
|
|
||||||
const isResettable = rows.some((row) => {
|
|
||||||
if (isDisabledHeader(row.headerId)) return false
|
|
||||||
const defaultOperator = getHeaderOption(row.headerId)?.defaultOperator ?? 'eq'
|
|
||||||
return row.operator !== defaultOperator || row.textValue !== '' || row.multiValues.length > 0
|
|
||||||
})
|
|
||||||
|
|
||||||
// 다이얼로그 내 입력만 기본값으로 되돌린다. 실제 반영은 "적용"을 눌러야 이뤄진다.
|
|
||||||
const handleReset = () => {
|
|
||||||
setRows(headerOptions.map((option) => createFilterRow(option.id, headerOptions)))
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
setSubmitting(true)
|
setSubmitting(true)
|
||||||
try {
|
try {
|
||||||
@@ -151,20 +138,7 @@ const ListFilterDialog = ({
|
|||||||
<div className="grid h-11 grid-cols-[1fr_140px_1.4fr] items-center border-b bg-muted px-4 text-sm font-semibold">
|
<div className="grid h-11 grid-cols-[1fr_140px_1.4fr] items-center border-b bg-muted px-4 text-sm font-semibold">
|
||||||
<span>헤더</span>
|
<span>헤더</span>
|
||||||
<span>비교 연산자</span>
|
<span>비교 연산자</span>
|
||||||
<div className="flex items-center justify-between gap-2">
|
|
||||||
<span>값</span>
|
<span>값</span>
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
className="h-7 text-muted-foreground"
|
|
||||||
onClick={handleReset}
|
|
||||||
disabled={submitting || !isResettable}
|
|
||||||
>
|
|
||||||
<RotateCcw className="size-3.5" />
|
|
||||||
초기화
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="max-h-170 overflow-auto">
|
<div className="max-h-170 overflow-auto">
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
} from '@dnd-kit/sortable'
|
} from '@dnd-kit/sortable'
|
||||||
import { CSS } from '@dnd-kit/utilities'
|
import { CSS } from '@dnd-kit/utilities'
|
||||||
import { GripVertical, Plus, Trash2 } from 'lucide-react'
|
import { GripVertical, Plus, Trash2 } from 'lucide-react'
|
||||||
import { KriColorPalette } from '@/components/common/KriColorPalette'
|
|
||||||
import { KriDialog } from '@/components/common/KriDialog'
|
import { KriDialog } from '@/components/common/KriDialog'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { Checkbox } from '@/components/ui/checkbox'
|
import { Checkbox } from '@/components/ui/checkbox'
|
||||||
@@ -45,7 +44,6 @@ export type ListHeaderManageDialogProps = {
|
|||||||
type ListHeaderRowProps = {
|
type ListHeaderRowProps = {
|
||||||
row: listHeader
|
row: listHeader
|
||||||
activeId: number | null
|
activeId: number | null
|
||||||
onHeaderColorChange: (id: number, color: string | null) => void
|
|
||||||
onHeaderNameChange: (id: number, listHderNm: string) => void
|
onHeaderNameChange: (id: number, listHderNm: string) => void
|
||||||
onHeaderTypeChange: (id: number, listHderTy: ListHeaderType) => void
|
onHeaderTypeChange: (id: number, listHderTy: ListHeaderType) => void
|
||||||
onFlagChange: (id: number, field: 'useColView' | 'useFilter' | 'useIntrvwerView' | 'useIntrvwerEdit', checked: boolean) => void
|
onFlagChange: (id: number, field: 'useColView' | 'useFilter' | 'useIntrvwerView' | 'useIntrvwerEdit', checked: boolean) => void
|
||||||
@@ -64,23 +62,13 @@ const isInterviewerEditDisabled = (row: listHeader) =>
|
|||||||
row.listHderTy === ListHeaderConst.CONTACT_INTERVIEWER ||
|
row.listHderTy === ListHeaderConst.CONTACT_INTERVIEWER ||
|
||||||
row.listHderTy === ListHeaderConst.FIELD_INTERVIEWER
|
row.listHderTy === ListHeaderConst.FIELD_INTERVIEWER
|
||||||
|
|
||||||
const ListHeaderRow = ({
|
const ListHeaderRow = ({ row, activeId, onHeaderNameChange, onHeaderTypeChange, onFlagChange, onDelete }: ListHeaderRowProps) => {
|
||||||
row,
|
|
||||||
activeId,
|
|
||||||
onHeaderColorChange,
|
|
||||||
onHeaderNameChange,
|
|
||||||
onHeaderTypeChange,
|
|
||||||
onFlagChange,
|
|
||||||
onDelete,
|
|
||||||
}: ListHeaderRowProps) => {
|
|
||||||
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: row.listHderId })
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: row.listHderId })
|
||||||
const canEditName = isCommonGrade(row.listHderGrad)
|
const canEditName = isCommonGrade(row.listHderGrad)
|
||||||
const canEditType = isCommonGrade(row.listHderGrad)
|
const canEditType = isCommonGrade(row.listHderGrad)
|
||||||
const canDelete = isCommonGrade(row.listHderGrad)
|
const canDelete = isCommonGrade(row.listHderGrad)
|
||||||
const canEditFlags = !isImmutableGrade(row.listHderGrad)
|
const canEditFlags = !isImmutableGrade(row.listHderGrad)
|
||||||
const canSort = isCommonGrade(row.listHderGrad)
|
const canSort = isCommonGrade(row.listHderGrad)
|
||||||
// IMMUTABLE 헤더의 색상은 서버가 저장하지 않으므로 선택을 막는다.
|
|
||||||
const canEditColor = !isImmutableGrade(row.listHderGrad)
|
|
||||||
|
|
||||||
const style: CSSProperties = {
|
const style: CSSProperties = {
|
||||||
transform: CSS.Transform.toString(transform),
|
transform: CSS.Transform.toString(transform),
|
||||||
@@ -98,7 +86,7 @@ const ListHeaderRow = ({
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
style={style}
|
style={style}
|
||||||
className={cn(
|
className={cn(
|
||||||
'h-12 px-4 border-b last:border-b-0 grid grid-cols-[56px_1fr_150px_120px_96px_96px_110px_110px_88px] items-center gap-2',
|
'h-12 px-4 border-b last:border-b-0 grid grid-cols-[56px_1fr_150px_96px_96px_110px_110px_88px] items-center gap-2',
|
||||||
(activeId === row.listHderId || isDragging) && 'bg-muted',
|
(activeId === row.listHderId || isDragging) && 'bg-muted',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@@ -143,12 +131,6 @@ const ListHeaderRow = ({
|
|||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
<KriColorPalette
|
|
||||||
value={row.listHderColor ?? null}
|
|
||||||
onChange={(color) => onHeaderColorChange(row.listHderId, color)}
|
|
||||||
disabled={!canEditColor}
|
|
||||||
aria-label={`${row.listHderNm} 헤더 색상`}
|
|
||||||
/>
|
|
||||||
<div className="flex items-center gap-2 justify-center">
|
<div className="flex items-center gap-2 justify-center">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id={`header-visible-${row.listHderId}`}
|
id={`header-visible-${row.listHderId}`}
|
||||||
@@ -274,16 +256,6 @@ const ListHeaderManageDialog = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleHeaderColorChange = (id: number, listHderColor: string | null) => {
|
|
||||||
setLocalRows((prev) =>
|
|
||||||
prev.map((row) => {
|
|
||||||
if (row.listHderId !== id) return row
|
|
||||||
if (isImmutableGrade(row.listHderGrad)) return row
|
|
||||||
return { ...row, listHderColor }
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleHeaderNameChange = (id: number, listHderNm: string) => {
|
const handleHeaderNameChange = (id: number, listHderNm: string) => {
|
||||||
setLocalRows((prev) =>
|
setLocalRows((prev) =>
|
||||||
prev.map((row) => {
|
prev.map((row) => {
|
||||||
@@ -330,7 +302,6 @@ const ListHeaderManageDialog = ({
|
|||||||
useColView: true,
|
useColView: true,
|
||||||
useIntrvwerView: false,
|
useIntrvwerView: false,
|
||||||
useIntrvwerEdit: false,
|
useIntrvwerEdit: false,
|
||||||
listHderColor: null,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [...prev, nextRow]
|
return [...prev, nextRow]
|
||||||
@@ -340,10 +311,6 @@ const ListHeaderManageDialog = ({
|
|||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
if (saveDisabled || submitting) return
|
if (saveDisabled || submitting) return
|
||||||
const names = localRows.map((row) => row.listHderNm.trim())
|
const names = localRows.map((row) => row.listHderNm.trim())
|
||||||
if (names.some((name) => name.length === 0)) {
|
|
||||||
alert('헤더명을 입력해 주세요.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const duplicateNames = [...new Set(names.filter((name, index) => names.indexOf(name) !== index))]
|
const duplicateNames = [...new Set(names.filter((name, index) => names.indexOf(name) !== index))]
|
||||||
if (duplicateNames.length > 0) {
|
if (duplicateNames.length > 0) {
|
||||||
alert(`중복된 헤더명이 있습니다: ${duplicateNames.join(', ')}`)
|
alert(`중복된 헤더명이 있습니다: ${duplicateNames.join(', ')}`)
|
||||||
@@ -377,10 +344,8 @@ const ListHeaderManageDialog = ({
|
|||||||
let defaultOrder = 0
|
let defaultOrder = 0
|
||||||
let commonOrder = COMMON_GRADE_ORDER_START - 1
|
let commonOrder = COMMON_GRADE_ORDER_START - 1
|
||||||
const orderedRows = localRows.map((row) => {
|
const orderedRows = localRows.map((row) => {
|
||||||
const isCommon = isCommonGrade(row.listHderGrad)
|
const listHderOrder = isCommonGrade(row.listHderGrad) ? (commonOrder += 1) : (defaultOrder += 1)
|
||||||
const listHderOrder = isCommon ? (commonOrder += 1) : (defaultOrder += 1)
|
return { ...row, prjctIdx: row.prjctIdx ?? prjctIdx, listHderOrder }
|
||||||
const listHderNm = isCommon ? row.listHderNm.trim() : row.listHderNm
|
|
||||||
return { ...row, prjctIdx: row.prjctIdx ?? prjctIdx, listHderOrder, listHderNm }
|
|
||||||
})
|
})
|
||||||
await onConfirm(orderedRows)
|
await onConfirm(orderedRows)
|
||||||
handleOpenChange(false)
|
handleOpenChange(false)
|
||||||
@@ -417,11 +382,10 @@ const ListHeaderManageDialog = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rounded-md border overflow-hidden">
|
<div className="rounded-md border overflow-hidden">
|
||||||
<div className="h-11 px-4 border-b bg-muted grid grid-cols-[56px_1fr_150px_120px_96px_96px_110px_110px_88px] items-center gap-2 text-sm font-semibold">
|
<div className="h-11 px-4 border-b bg-muted grid grid-cols-[56px_1fr_150px_96px_96px_110px_110px_88px] items-center gap-2 text-sm font-semibold">
|
||||||
<span>순서</span>
|
<span>순서</span>
|
||||||
<span>헤더명</span>
|
<span>헤더명</span>
|
||||||
<span>헤더 타입</span>
|
<span>헤더 타입</span>
|
||||||
<span>헤더 색상</span>
|
|
||||||
<span>헤더 노출</span>
|
<span>헤더 노출</span>
|
||||||
<span>필터 사용</span>
|
<span>필터 사용</span>
|
||||||
<span>면접원 노출</span>
|
<span>면접원 노출</span>
|
||||||
@@ -443,7 +407,6 @@ const ListHeaderManageDialog = ({
|
|||||||
key={row.listHderId}
|
key={row.listHderId}
|
||||||
row={row}
|
row={row}
|
||||||
activeId={activeId}
|
activeId={activeId}
|
||||||
onHeaderColorChange={handleHeaderColorChange}
|
|
||||||
onHeaderNameChange={handleHeaderNameChange}
|
onHeaderNameChange={handleHeaderNameChange}
|
||||||
onHeaderTypeChange={handleHeaderTypeChange}
|
onHeaderTypeChange={handleHeaderTypeChange}
|
||||||
onFlagChange={handleFlagChange}
|
onFlagChange={handleFlagChange}
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ const ListUploadDialog = ({
|
|||||||
const serverHeader = compareRows[index]
|
const serverHeader = compareRows[index]
|
||||||
// compareRows가 이미 listHderOrder 기준 정렬이라 위치로 순서를 보장한다. listHderOrder 값 자체는
|
// compareRows가 이미 listHderOrder 기준 정렬이라 위치로 순서를 보장한다. listHderOrder 값 자체는
|
||||||
// COMMON 헤더가 101부터 채번되어 index+1과 리터럴하게 같지 않을 수 있으므로(정상), 이름만 비교한다.
|
// COMMON 헤더가 101부터 채번되어 index+1과 리터럴하게 같지 않을 수 있으므로(정상), 이름만 비교한다.
|
||||||
const isMatched = !!serverHeader && serverHeader.listHderNm.trim() === header
|
const isMatched = !!serverHeader && serverHeader.listHderNm === header
|
||||||
const isSettingRequired = !hasCommonHeader && index >= baseHeaderRows.length
|
const isSettingRequired = !hasCommonHeader && index >= baseHeaderRows.length
|
||||||
return {
|
return {
|
||||||
header,
|
header,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
useTemplateListQuery,
|
useTemplateListQuery,
|
||||||
useTemplateQuery,
|
useTemplateQuery,
|
||||||
} from '@/query/message'
|
} from '@/query/message'
|
||||||
import { getNearestFutureDateTime, isPastReserveDateTime, toReserveSendDt } from '@/lib/datetime'
|
import { getNearestFutureDateTime, toReserveSendDt } from '@/lib/datetime'
|
||||||
import type { DialogId } from '@/store/jotai/dialog'
|
import type { DialogId } from '@/store/jotai/dialog'
|
||||||
import { createEmptyListFilter, type ListFilter, type ListFilterTarget, type listHeader } from '@/types/list'
|
import { createEmptyListFilter, type ListFilter, type ListFilterTarget, type listHeader } from '@/types/list'
|
||||||
import { ListHeaderConst } from '@/const/listConst'
|
import { ListHeaderConst } from '@/const/listConst'
|
||||||
@@ -183,10 +183,6 @@ const MessageSendDialog = ({
|
|||||||
alert('예약 발송 일시를 선택해 주세요.')
|
alert('예약 발송 일시를 선택해 주세요.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (scheduleType === 'reserve' && isPastReserveDateTime(reserveAt)) {
|
|
||||||
alert('예약 발송 일시는 현재 시각 이후로 선택해 주세요.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const listFilter = buildListFilter()
|
const listFilter = buildListFilter()
|
||||||
if (target === 'selected' && listFilter.sidSet.length === 0) {
|
if (target === 'selected' && listFilter.sidSet.length === 0) {
|
||||||
alert('수신 대상이 없습니다.')
|
alert('수신 대상이 없습니다.')
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
useTemplateQuery,
|
useTemplateQuery,
|
||||||
} from '@/query/message'
|
} from '@/query/message'
|
||||||
import type { TemplateSummary } from '@kri/common/noti-hub'
|
import type { TemplateSummary } from '@kri/common/noti-hub'
|
||||||
import { getNearestFutureDateTime, isPastReserveDateTime, toReserveSendDt } from '@/lib/datetime'
|
import { getNearestFutureDateTime, toReserveSendDt } from '@/lib/datetime'
|
||||||
import type { DialogId } from '@/store/jotai/dialog'
|
import type { DialogId } from '@/store/jotai/dialog'
|
||||||
import type { MessageSendChannel, PhoneVerificationSendData } from '@/types/message'
|
import type { MessageSendChannel, PhoneVerificationSendData } from '@/types/message'
|
||||||
import MessageSendPreview from '@/components/message-template/MessageSendPreview'
|
import MessageSendPreview from '@/components/message-template/MessageSendPreview'
|
||||||
@@ -127,10 +127,6 @@ const SingleMessageSendDialog = ({
|
|||||||
alert('예약 발송 일시를 선택해 주세요.')
|
alert('예약 발송 일시를 선택해 주세요.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (scheduleType === 'reserve' && isPastReserveDateTime(reserveAt)) {
|
|
||||||
alert('예약 발송 일시는 현재 시각 이후로 선택해 주세요.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setSubmitting(true)
|
setSubmitting(true)
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -8,25 +8,10 @@ import { useTextareaInsert } from './hooks/useTextareaInsert'
|
|||||||
|
|
||||||
type SmsEditorProps = Omit<KriEditorProps, 'mode'> & { mode: 'sms' }
|
type SmsEditorProps = Omit<KriEditorProps, 'mode'> & { mode: 'sms' }
|
||||||
|
|
||||||
type SmsMessageType = 'SMS' | 'LMS' | 'MMS'
|
|
||||||
|
|
||||||
function calculateBytes(value: string): number {
|
function calculateBytes(value: string): number {
|
||||||
return new TextEncoder().encode(value).byteLength
|
return new TextEncoder().encode(value).byteLength
|
||||||
}
|
}
|
||||||
|
|
||||||
// 첨부파일이 있으면 MMS, 제목이 있거나 smsMaxBytes 이상이면 LMS, 나머지는 SMS로 미리보기 판정한다.
|
|
||||||
function getSmsMessageType(hasAttachment: boolean, byteSize: number, smsMaxBytes: number, title: string): SmsMessageType {
|
|
||||||
if (hasAttachment) return 'MMS'
|
|
||||||
if (byteSize >= smsMaxBytes || Boolean(title)) return 'LMS'
|
|
||||||
return 'SMS'
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTextareaMinHeight(hasImages: boolean, hasTitle: boolean): string {
|
|
||||||
if (hasImages) return '160px'
|
|
||||||
if (hasTitle) return '320px'
|
|
||||||
return '360px'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function KriEditorSms({
|
export function KriEditorSms({
|
||||||
label,
|
label,
|
||||||
value,
|
value,
|
||||||
@@ -49,12 +34,12 @@ export function KriEditorSms({
|
|||||||
const [text, setText] = React.useState(value || '')
|
const [text, setText] = React.useState(value || '')
|
||||||
const textareaRef = React.useRef<HTMLTextAreaElement | null>(null)
|
const textareaRef = React.useRef<HTMLTextAreaElement | null>(null)
|
||||||
const latestTextRef = React.useRef(text)
|
const latestTextRef = React.useRef(text)
|
||||||
const lastTypeRef = React.useRef<SmsMessageType | null>(null)
|
const lastTypeRef = React.useRef<'SMS' | 'LMS' | 'MMS' | null>(null)
|
||||||
const { scheduleChange, flushChange } = useDebouncedChange(onChange, debounceMs)
|
const { scheduleChange, flushChange } = useDebouncedChange(onChange, debounceMs)
|
||||||
const textareaInsert = useTextareaInsert(textareaRef)
|
const textareaInsert = useTextareaInsert(textareaRef)
|
||||||
const previewText = smsPreviewSuffix ? `${text}\n${smsPreviewSuffix}` : text
|
const previewText = smsPreviewSuffix ? `${text}\n${smsPreviewSuffix}` : text
|
||||||
const byteSize = React.useMemo(() => calculateBytes(previewText), [previewText])
|
const byteSize = React.useMemo(() => calculateBytes(previewText), [previewText])
|
||||||
const messageType = getSmsMessageType(smsHasAttachment, byteSize, smsMaxBytes, smsTitle)
|
const messageType: 'SMS' | 'LMS' | 'MMS' = smsHasAttachment ? 'MMS' : byteSize >= smsMaxBytes || Boolean(smsTitle) ? 'LMS' : 'SMS'
|
||||||
const maxBytes = messageType === 'SMS' ? smsMaxBytes : lmsMaxBytes
|
const maxBytes = messageType === 'SMS' ? smsMaxBytes : lmsMaxBytes
|
||||||
|
|
||||||
function getBadgeColor(): string {
|
function getBadgeColor(): string {
|
||||||
@@ -142,7 +127,7 @@ export function KriEditorSms({
|
|||||||
onBlur={() => flushChange(latestTextRef.current)}
|
onBlur={() => flushChange(latestTextRef.current)}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
readOnly={isSmsReadOnly}
|
readOnly={isSmsReadOnly}
|
||||||
style={{ minHeight: getTextareaMinHeight(smsImages.length > 0, Boolean(smsTitle)) }}
|
style={{ minHeight: smsImages.length > 0 ? '160px' : smsTitle ? '320px' : '360px' }}
|
||||||
{...textareaInsert.bindSelectionHandlers}
|
{...textareaInsert.bindSelectionHandlers}
|
||||||
/>
|
/>
|
||||||
{smsPreviewSuffix ? (
|
{smsPreviewSuffix ? (
|
||||||
|
|||||||
@@ -39,58 +39,6 @@ import { useImageMapOverlay } from "./hooks/useImageMapOverlay";
|
|||||||
|
|
||||||
type ViewMode = "wysiwyg" | "html";
|
type ViewMode = "wysiwyg" | "html";
|
||||||
|
|
||||||
type ToolbarEndSlotProps = Pick<KriEditorProps, "renderToolbarEnd"> & {
|
|
||||||
editor: Editor;
|
|
||||||
command: KriEditorCommand;
|
|
||||||
view: ViewMode;
|
|
||||||
};
|
|
||||||
|
|
||||||
// command는 ref를 사용하는 함수 묶음이라, 렌더 중 외부 함수에 직접 넘기면 React Compiler가
|
|
||||||
// ref 접근으로 판단한다. 별도 컴포넌트의 props로 전달해 렌더 범위를 분리한다(동작 동일).
|
|
||||||
function ToolbarEndSlot({ renderToolbarEnd, editor, command, view }: Readonly<ToolbarEndSlotProps>) {
|
|
||||||
return <>{renderToolbarEnd?.({ editor, command, view })}</>;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 주입된 정제 함수가 우선이고, 없으면 sanitizeHtml 옵션에 따라 기본 정제기를 사용한다.
|
|
||||||
function sanitizeEditorHtml(
|
|
||||||
html: string,
|
|
||||||
htmlSanitizer: KriEditorProps["htmlSanitizer"],
|
|
||||||
sanitizeEnabled: boolean,
|
|
||||||
allowedCustomHtml: KriEditorProps["allowedCustomHtml"],
|
|
||||||
): string {
|
|
||||||
if (htmlSanitizer) return htmlSanitizer(html);
|
|
||||||
if (sanitizeEnabled) return sanitizeHtml(html, allowedCustomHtml);
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeHtmlDraft(
|
|
||||||
draftRef: { current: string },
|
|
||||||
textareaRef: { current: HTMLTextAreaElement | null },
|
|
||||||
html: string,
|
|
||||||
): void {
|
|
||||||
draftRef.current = html;
|
|
||||||
if (textareaRef.current) textareaRef.current.value = html;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 외부에서 본문이 변경된 경우에만 기존 editor 문서를 갱신한다.
|
|
||||||
function syncEditorContent(editor: Editor, value: string, optimisticHtml: string): void {
|
|
||||||
// 빈 문자열("")은 ProseMirror 스키마상 유효한 문서가 아니라 setContent가 조용히 실패해
|
|
||||||
// 이전 템플릿 본문이 그대로 남는 문제가 있었음 -> 빈 값은 빈 문단으로 정규화해서 비교/설정.
|
|
||||||
const normalizedValue = value || "<p></p>";
|
|
||||||
if (normalizedValue === editor.getHTML() || normalizedValue === optimisticHtml) return;
|
|
||||||
|
|
||||||
editor.commands.setContent(normalizedValue, {
|
|
||||||
emitUpdate: false,
|
|
||||||
parseOptions: { preserveWhitespace: "full" },
|
|
||||||
});
|
|
||||||
|
|
||||||
// resize가 활성화된 TipTap 이미지 NodeView는 노드의 src 변경을 기존 DOM에 반영하지 않는다.
|
|
||||||
// editor 전체 대신 NodeView만 다시 생성해 이미지를 갱신하고 편집 포커스는 유지한다.
|
|
||||||
if (normalizedValue.includes("<img")) {
|
|
||||||
editor.createNodeViews();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getToolbarState(editor: Editor): ToolbarState {
|
function getToolbarState(editor: Editor): ToolbarState {
|
||||||
const ts = editor.getAttributes("textStyle") as { fontSize?: string | null; fontFamily?: string | null; color?: string | null };
|
const ts = editor.getAttributes("textStyle") as { fontSize?: string | null; fontFamily?: string | null; color?: string | null };
|
||||||
const hl = editor.getAttributes("highlight") as { color?: string | null };
|
const hl = editor.getAttributes("highlight") as { color?: string | null };
|
||||||
@@ -122,7 +70,7 @@ function getToolbarState(editor: Editor): ToolbarState {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||||
const {
|
const {
|
||||||
|
|
||||||
label,
|
label,
|
||||||
@@ -186,9 +134,6 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
}, [view]);
|
}, [view]);
|
||||||
|
|
||||||
const htmlDraftRef = useRef<string>(value ?? "");
|
const htmlDraftRef = useRef<string>(value ?? "");
|
||||||
// HTML textarea는 비제어 컴포넌트다. 렌더 중 ref를 읽지 않도록, HTML 보기로 전환하는 시점의
|
|
||||||
// 초안을 state로 보관해 textarea가 마운트될 때의 초기값(defaultValue)으로만 사용한다.
|
|
||||||
const [htmlTextareaSeed, setHtmlTextareaSeed] = useState<string>(value ?? "");
|
|
||||||
const canImageUpload = Boolean(onImageUpload);
|
const canImageUpload = Boolean(onImageUpload);
|
||||||
|
|
||||||
const selectionRef = useRef<{ from: number; to: number } | null>(null);
|
const selectionRef = useRef<{ from: number; to: number } | null>(null);
|
||||||
@@ -526,7 +471,6 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
if (viewRef.current === "wysiwyg") {
|
if (viewRef.current === "wysiwyg") {
|
||||||
const raw = editor.getHTML();
|
const raw = editor.getHTML();
|
||||||
htmlDraftRef.current = raw;
|
htmlDraftRef.current = raw;
|
||||||
setHtmlTextareaSeed(raw);
|
|
||||||
setView("html");
|
setView("html");
|
||||||
|
|
||||||
// WYSIWYG에서 막 넘어온, 사용자가 직접 타이핑하지 않은 HTML이므로
|
// WYSIWYG에서 막 넘어온, 사용자가 직접 타이핑하지 않은 HTML이므로
|
||||||
@@ -548,12 +492,14 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
toast.message(compatibility.reason ?? "현재 HTML은 WYSIWYG로 전환할 수 없습니다.");
|
toast.message(compatibility.reason ?? "현재 HTML은 WYSIWYG로 전환할 수 없습니다.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const safe = sanitizeEditorHtml(raw, htmlSanitizer, sanitizeHtmlOpt, allowedCustomHtml);
|
const safe = htmlSanitizer
|
||||||
|
? htmlSanitizer(raw)
|
||||||
|
: sanitizeHtmlOpt ? sanitizeHtml(raw, allowedCustomHtml) : raw;
|
||||||
|
|
||||||
editor.commands.setContent(safe, { emitUpdate: false, parseOptions: { preserveWhitespace: "full" } });
|
editor.commands.setContent(safe, { emitUpdate: false, parseOptions: { preserveWhitespace: "full" } });
|
||||||
flushChange(preserveEmptyParagraphs(editor.getHTML()));
|
flushChange(preserveEmptyParagraphs(editor.getHTML()));
|
||||||
setView("wysiwyg");
|
setView("wysiwyg");
|
||||||
}, [allowedCustomHtml, editor, flushChange, getCompatibility, htmlSanitizer, sanitizeHtmlOpt, setView, setPreviewSource, setHtmlTextareaSeed]);
|
}, [allowedCustomHtml, editor, flushChange, getCompatibility, htmlSanitizer, sanitizeHtmlOpt]);
|
||||||
|
|
||||||
const formatHtmlView = useCallback(async () => {
|
const formatHtmlView = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
@@ -566,7 +512,7 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
toast.error("HTML 정렬에 실패했습니다.");
|
toast.error("HTML 정렬에 실패했습니다.");
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
}, [scheduleChange, setPreviewSource]);
|
}, [scheduleChange]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!editor) return;
|
if (!editor) return;
|
||||||
@@ -598,28 +544,46 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPreviewSource(value ?? "");
|
setPreviewSource(value ?? "");
|
||||||
if (!editor || value == null) return;
|
if (!editor) return;
|
||||||
|
if (value == null) return;
|
||||||
|
|
||||||
// WYSIWYG로 손실 없이 편집할 수 없는 값은 HTML 보기로 전환해 원문을 유지한다.
|
const compatibility = getCompatibility(value);
|
||||||
if (showHtmlToggle && !getCompatibility(value).compatible) {
|
if (showHtmlToggle && !compatibility.compatible) {
|
||||||
writeHtmlDraft(htmlDraftRef, htmlTextareaRef, value);
|
htmlDraftRef.current = value;
|
||||||
|
if (htmlTextareaRef.current) htmlTextareaRef.current.value = value;
|
||||||
if (viewRef.current !== "html") {
|
if (viewRef.current !== "html") {
|
||||||
viewRef.current = "html";
|
viewRef.current = "html";
|
||||||
setHtmlTextareaSeed(value);
|
|
||||||
setView("html");
|
setView("html");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewRef.current === "html") {
|
if (viewRef.current === "html") {
|
||||||
const isExternalChange = value !== optimisticHtmlRef.current && value !== htmlDraftRef.current;
|
if (getWysiwygCompatibility && value !== optimisticHtmlRef.current && value !== htmlDraftRef.current) {
|
||||||
if (getWysiwygCompatibility && isExternalChange) {
|
htmlDraftRef.current = value;
|
||||||
writeHtmlDraft(htmlDraftRef, htmlTextareaRef, value);
|
if (htmlTextareaRef.current) htmlTextareaRef.current.value = value;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
syncEditorContent(editor, value, optimisticHtmlRef.current);
|
// 빈 문자열("")은 ProseMirror 스키마상 유효한 문서가 아니라 setContent가 조용히 실패해
|
||||||
|
// 이전 템플릿 본문이 그대로 남는 문제가 있었음 -> 빈 값은 빈 문단으로 정규화해서 비교/설정.
|
||||||
|
const normalizedValue = value || "<p></p>";
|
||||||
|
const current = editor.getHTML();
|
||||||
|
|
||||||
|
if (normalizedValue !== current && normalizedValue !== optimisticHtmlRef.current) {
|
||||||
|
// 외부에서 본문이 변경된 경우에만 기존 editor 문서를 갱신한다.
|
||||||
|
editor.commands.setContent(normalizedValue, {
|
||||||
|
emitUpdate: false,
|
||||||
|
parseOptions: {preserveWhitespace: "full"},
|
||||||
|
});
|
||||||
|
|
||||||
|
// resize가 활성화된 TipTap 이미지 NodeView는 노드의 src 변경을 기존 DOM에 반영하지 않는다.
|
||||||
|
// editor 전체 대신 NodeView만 다시 생성해 이미지를 갱신하고 편집 포커스는 유지한다.
|
||||||
|
if (normalizedValue.includes("<img")) {
|
||||||
|
editor.createNodeViews();
|
||||||
|
}
|
||||||
|
}
|
||||||
}, [value, editor, view, getCompatibility, getWysiwygCompatibility, showHtmlToggle]);
|
}, [value, editor, view, getCompatibility, getWysiwygCompatibility, showHtmlToggle]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -684,13 +648,14 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
|
|
||||||
const previewHtml = useMemo(() => {
|
const previewHtml = useMemo(() => {
|
||||||
const preserved = preserveEmptyParagraphs(previewSource);
|
const preserved = preserveEmptyParagraphs(previewSource);
|
||||||
const sanitized = sanitizeEditorHtml(preserved, htmlSanitizer, sanitizeHtmlOpt, allowedCustomHtml);
|
const sanitized = htmlSanitizer
|
||||||
|
? htmlSanitizer(preserved)
|
||||||
|
: sanitizeHtmlOpt ? sanitizeHtml(preserved, allowedCustomHtml) : preserved;
|
||||||
const withLinkStyle = applyLinkPreviewClass(sanitized);
|
const withLinkStyle = applyLinkPreviewClass(sanitized);
|
||||||
return transformPreviewHtml ? transformPreviewHtml(withLinkStyle) : withLinkStyle;
|
return transformPreviewHtml ? transformPreviewHtml(withLinkStyle) : withLinkStyle;
|
||||||
}, [allowedCustomHtml, htmlSanitizer, previewSource, sanitizeHtmlOpt, transformPreviewHtml]);
|
}, [allowedCustomHtml, htmlSanitizer, previewSource, sanitizeHtmlOpt, transformPreviewHtml]);
|
||||||
|
|
||||||
// 이미지맵을 사용할 때만 미리보기에 <area> 영역을 표시한다.
|
const imageMapOverlayBoxes = useImageMapOverlay(previewContainerRef, previewHtml);
|
||||||
const imageMapOverlayBoxes = useImageMapOverlay(previewContainerRef, previewHtml, enableImageMap && showPreview);
|
|
||||||
|
|
||||||
const wysiwygCompatibility = useMemo(
|
const wysiwygCompatibility = useMemo(
|
||||||
() => getCompatibility(view === "html" ? previewSource : (editor?.getHTML() ?? previewSource)),
|
() => getCompatibility(view === "html" ? previewSource : (editor?.getHTML() ?? previewSource)),
|
||||||
@@ -739,11 +704,7 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
onAddRow={addRow}
|
onAddRow={addRow}
|
||||||
onAddColumn={addColumn}
|
onAddColumn={addColumn}
|
||||||
onDeleteTable={deleteTable}
|
onDeleteTable={deleteTable}
|
||||||
customContent={
|
customContent={props.renderToolbarEnd?.({ editor, command, view })}
|
||||||
props.renderToolbarEnd ? (
|
|
||||||
<ToolbarEndSlot renderToolbarEnd={props.renderToolbarEnd} editor={editor} command={command} view={view} />
|
|
||||||
) : undefined
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -757,7 +718,7 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
<textarea
|
<textarea
|
||||||
ref={htmlTextareaRef}
|
ref={htmlTextareaRef}
|
||||||
className="h-[220px] w-full resize-y rounded-md border bg-background p-3 font-mono text-sm outline-none"
|
className="h-[220px] w-full resize-y rounded-md border bg-background p-3 font-mono text-sm outline-none"
|
||||||
defaultValue={htmlTextareaSeed}
|
defaultValue={htmlDraftRef.current}
|
||||||
onMouseDown={(e) => e.stopPropagation()}
|
onMouseDown={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
htmlDraftRef.current = e.target.value;
|
htmlDraftRef.current = e.target.value;
|
||||||
@@ -769,9 +730,9 @@ export function KriEditorWysiwyg(props: Readonly<KriEditorProps>) {
|
|||||||
{...htmlTi.bindSelectionHandlers}
|
{...htmlTi.bindSelectionHandlers}
|
||||||
/>
|
/>
|
||||||
{!wysiwygCompatibility.compatible ? (
|
{!wysiwygCompatibility.compatible ? (
|
||||||
<output className="mt-2 block text-xs text-amber-700">
|
<p className="mt-2 text-xs text-amber-700" role="status">
|
||||||
{wysiwygCompatibility.reason ?? "현재 HTML은 WYSIWYG에서 손실 없이 편집할 수 없습니다."}
|
{wysiwygCompatibility.reason ?? "현재 HTML은 WYSIWYG에서 손실 없이 편집할 수 없습니다."}
|
||||||
</output>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -2,18 +2,16 @@ import { useLayoutEffect, useRef, useState } from "react"
|
|||||||
import { computeImageMapOverlayBoxes, type ImageMapOverlayBox } from "../utils/imageMapOverlay"
|
import { computeImageMapOverlayBoxes, type ImageMapOverlayBox } from "../utils/imageMapOverlay"
|
||||||
|
|
||||||
// previewHtml이 바뀔 때마다(이미지 로드/리사이즈 포함) <map>/<area> 오버레이 위치를 다시 계산한다.
|
// previewHtml이 바뀔 때마다(이미지 로드/리사이즈 포함) <map>/<area> 오버레이 위치를 다시 계산한다.
|
||||||
// enabled가 false이면 계산·관찰하지 않는다.
|
|
||||||
export function useImageMapOverlay(
|
export function useImageMapOverlay(
|
||||||
containerRef: React.RefObject<HTMLElement | null>,
|
containerRef: React.RefObject<HTMLElement | null>,
|
||||||
previewHtml: string,
|
previewHtml: string,
|
||||||
enabled = true,
|
|
||||||
): ImageMapOverlayBox[] {
|
): ImageMapOverlayBox[] {
|
||||||
const [boxes, setBoxes] = useState<ImageMapOverlayBox[]>([])
|
const [boxes, setBoxes] = useState<ImageMapOverlayBox[]>([])
|
||||||
const frameRef = useRef<number | null>(null)
|
const frameRef = useRef<number | null>(null)
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
const container = containerRef.current
|
const container = containerRef.current
|
||||||
if (!enabled || !container) {
|
if (!container) {
|
||||||
setBoxes([])
|
setBoxes([])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -42,7 +40,7 @@ export function useImageMapOverlay(
|
|||||||
resizeObserver.disconnect()
|
resizeObserver.disconnect()
|
||||||
window.removeEventListener("resize", scheduleRecompute)
|
window.removeEventListener("resize", scheduleRecompute)
|
||||||
}
|
}
|
||||||
}, [containerRef, previewHtml, enabled])
|
}, [containerRef, previewHtml])
|
||||||
|
|
||||||
return boxes
|
return boxes
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import { formatKst } from '@kri/common'
|
|||||||
import { isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
|
import { isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
|
||||||
import { substituteVariables } from '@/lib/variableSubstitution'
|
import { substituteVariables } from '@/lib/variableSubstitution'
|
||||||
import { formatKoreanPhoneNumber } from '@/utils/phone'
|
import { formatKoreanPhoneNumber } from '@/utils/phone'
|
||||||
import { isLightHexColor, normalizeHexColor } from '@/components/common/color-palette/color'
|
|
||||||
import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
|
import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
|
||||||
import SingleMessageSendDialog from '@/components/dialog/SingleMessageSendDialog'
|
import SingleMessageSendDialog from '@/components/dialog/SingleMessageSendDialog'
|
||||||
import { ctiClient } from '@/lib/cti/ctiClient'
|
import { ctiClient } from '@/lib/cti/ctiClient'
|
||||||
@@ -53,60 +52,42 @@ export const buildInitialValues = (listHeaders: listHeader[], detail?: ListSearc
|
|||||||
for (const header of listHeaders) {
|
for (const header of listHeaders) {
|
||||||
if (header.listHderTy === ListHeaderConst.SID) continue
|
if (header.listHderTy === ListHeaderConst.SID) continue
|
||||||
if (!isListFieldVisibleForContact(header)) continue
|
if (!isListFieldVisibleForContact(header)) continue
|
||||||
// 사용 허용은 저장 시 코드("0"/"1"/"9")로 보내야 하므로 폼 값은 코드로 둔다.
|
|
||||||
// 문자·알림톡 변수 치환은 resolveListHeaderValue의 라벨을 그대로 사용한다.
|
|
||||||
if (header.listHderTy === ListHeaderConst.IS_USE) {
|
|
||||||
values[header.listHderId] = detail?.use != null ? String(detail.use) : ''
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
values[header.listHderId] = resolveListHeaderValue(header, detail)
|
values[header.listHderId] = resolveListHeaderValue(header, detail)
|
||||||
}
|
}
|
||||||
|
|
||||||
return values
|
return values
|
||||||
}
|
}
|
||||||
|
|
||||||
const IS_USE_OPTIONS = Object.entries(LIST_IS_USE_LABEL).map(([value, label]) => ({ value, label }))
|
|
||||||
|
|
||||||
const disabledContrastClass = 'bg-white disabled:opacity-100 disabled:text-foreground disabled:bg-muted/60'
|
const disabledContrastClass = 'bg-white disabled:opacity-100 disabled:text-foreground disabled:bg-muted/60'
|
||||||
// Input/textarea는 수정 불가 상태에서도 드래그 선택/복사가 가능해야 해서 disabled 대신 readOnly를 쓴다.
|
// Input/textarea는 수정 불가 상태에서도 드래그 선택/복사가 가능해야 해서 disabled 대신 readOnly를 쓴다.
|
||||||
// disabled는 공용 Input 컴포넌트의 disabled:pointer-events-none 때문에 마우스 이벤트 자체를 못 받는다.
|
// disabled는 공용 Input 컴포넌트의 disabled:pointer-events-none 때문에 마우스 이벤트 자체를 못 받는다.
|
||||||
const readOnlyContrastClass = 'bg-white read-only:text-foreground read-only:bg-muted/60'
|
const readOnlyContrastClass = 'bg-white read-only:text-foreground read-only:bg-muted/60'
|
||||||
|
|
||||||
const getCallButtonLabel = (isDialing: boolean, isOnCall: boolean, isEnding: boolean) => {
|
const getCallButtonLabel = (isDialing: boolean, isOnCall: boolean) => {
|
||||||
if (isEnding) return '종료 요청 중'
|
|
||||||
if (isDialing) return '거는 중'
|
if (isDialing) return '거는 중'
|
||||||
if (isOnCall) return '전화 끊기'
|
if (isOnCall) return '전화 끊기'
|
||||||
return '전화'
|
return '전화'
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCallButtonTitle = (isCtiReady: boolean, isDialing: boolean, isEnding: boolean) => {
|
const getCallButtonTitle = (isCtiReady: boolean, isDialing: boolean) => {
|
||||||
if (!isCtiReady) return '전화 시스템에 연결되어 있지 않습니다.'
|
if (!isCtiReady) return '전화 시스템에 연결되어 있지 않습니다.'
|
||||||
if (isDialing) return '전화를 거는 중입니다.'
|
if (isDialing) return '전화를 거는 중입니다.'
|
||||||
if (isEnding) return '통화 종료를 확인하고 있습니다.'
|
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const FieldRow = ({ label, color, children }: { label: string; color?: string | null; children: ReactNode }) => {
|
const FieldRow = ({ label, editable, children }: { label: string; editable?: boolean; children: ReactNode }) => (
|
||||||
// 헤더에 지정한 색상(투명도 포함)이 기본색보다 우선한다. 형식이 잘못된 값은 기본색으로 표시한다.
|
|
||||||
const headerColor = normalizeHexColor(color)
|
|
||||||
const isDarkHeaderColor = headerColor !== null && !isLightHexColor(headerColor)
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Label
|
<Label
|
||||||
className={cn(
|
className={cn(
|
||||||
'w-24 shrink-0 wrap-anywhere rounded-md px-2 py-2.5 text-sm leading-snug font-bold',
|
'w-24 shrink-0 wrap-anywhere rounded-md px-2 py-2.5 text-sm leading-snug font-bold text-foreground',
|
||||||
headerColor === null && 'bg-blue-100',
|
editable && 'bg-blue-100',
|
||||||
isDarkHeaderColor ? 'text-white' : 'text-foreground',
|
|
||||||
)}
|
)}
|
||||||
style={headerColor ? { backgroundColor: headerColor } : undefined}
|
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
</Label>
|
</Label>
|
||||||
<div className="min-w-0 flex-1">{children}</div>
|
<div className="min-w-0 flex-1">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
const ListContactInfoPanel = ({
|
const ListContactInfoPanel = ({
|
||||||
prjctIdx,
|
prjctIdx,
|
||||||
@@ -134,8 +115,7 @@ const ListContactInfoPanel = ({
|
|||||||
const isCtiReady = ctiConnectionStatus === 'open'
|
const isCtiReady = ctiConnectionStatus === 'open'
|
||||||
const ctiCallPhase = useCtiCallPhase()
|
const ctiCallPhase = useCtiCallPhase()
|
||||||
const isDialing = ctiCallPhase === 'dialing'
|
const isDialing = ctiCallPhase === 'dialing'
|
||||||
const isEnding = ctiCallPhase === 'ending'
|
const isOnCall = ctiCallPhase === 'active'
|
||||||
const isOnCall = ctiCallPhase === 'active' || isEnding
|
|
||||||
|
|
||||||
const visibleHeaders = listHeaders
|
const visibleHeaders = listHeaders
|
||||||
.filter((header) => isListFieldVisibleForContact(header))
|
.filter((header) => isListFieldVisibleForContact(header))
|
||||||
@@ -168,7 +148,8 @@ const ListContactInfoPanel = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleCall = (telNum: string, listHderId: number) => {
|
const handleCall = (telNum: string, listHderId: number) => {
|
||||||
if (!isCtiReady || isDialing || isEnding) return
|
if (!isCtiReady || isDialing) return
|
||||||
|
// CTI_HANGUP_PENDING_VENDOR: 외주사 Hangup 명령 동작 확인 후 통화 중 버튼을 활성화하면 즉시 사용할 수 있다.
|
||||||
if (isOnCall) {
|
if (isOnCall) {
|
||||||
ctiClient.hangup()
|
ctiClient.hangup()
|
||||||
return
|
return
|
||||||
@@ -219,9 +200,9 @@ const ListContactInfoPanel = ({
|
|||||||
const value = formValues[header.listHderId] ?? ''
|
const value = formValues[header.listHderId] ?? ''
|
||||||
const onChange = (next: string) => onFieldChange(header.listHderId, next)
|
const onChange = (next: string) => onFieldChange(header.listHderId, next)
|
||||||
|
|
||||||
if (header.listHderTy === ListHeaderConst.MEMO || header.listHderTy === ListHeaderConst.MULTILINE_TEXT) {
|
if (header.listHderTy === ListHeaderConst.MEMO) {
|
||||||
return (
|
return (
|
||||||
<FieldRow key={header.listHderId} label={header.listHderNm} color={header.listHderColor}>
|
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
|
||||||
<textarea
|
<textarea
|
||||||
className={`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${readOnlyContrastClass}`}
|
className={`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${readOnlyContrastClass}`}
|
||||||
value={value}
|
value={value}
|
||||||
@@ -234,7 +215,7 @@ const ListContactInfoPanel = ({
|
|||||||
|
|
||||||
if (header.listHderTy === ListHeaderConst.TEL_NUM) {
|
if (header.listHderTy === ListHeaderConst.TEL_NUM) {
|
||||||
return (
|
return (
|
||||||
<FieldRow key={header.listHderId} label={header.listHderNm} color={header.listHderColor}>
|
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
|
||||||
{/* 모바일(md 미만)은 버튼을 입력란 아래 줄로 내린다. */}
|
{/* 모바일(md 미만)은 버튼을 입력란 아래 줄로 내린다. */}
|
||||||
<div className="flex flex-col gap-2 md:flex-row">
|
<div className="flex flex-col gap-2 md:flex-row">
|
||||||
<Input
|
<Input
|
||||||
@@ -248,12 +229,12 @@ const ListContactInfoPanel = ({
|
|||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className={cn('shrink-0 gap-2', isOnCall && 'bg-accent text-accent-foreground')}
|
className={cn('shrink-0 gap-2', isOnCall && 'bg-accent text-accent-foreground')}
|
||||||
disabled={isEditing || !isCtiReady || isDialing || isEnding}
|
disabled={isEditing || !isCtiReady || isDialing}
|
||||||
title={getCallButtonTitle(isCtiReady, isDialing, isEnding)}
|
title={getCallButtonTitle(isCtiReady, isDialing)}
|
||||||
onClick={() => handleCall(value, header.listHderId)}
|
onClick={() => handleCall(value, header.listHderId)}
|
||||||
>
|
>
|
||||||
<Phone className="h-4 w-4" />
|
<Phone className="h-4 w-4" />
|
||||||
{getCallButtonLabel(isDialing, isOnCall, isEnding)}
|
{getCallButtonLabel(isDialing, isOnCall)}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -288,7 +269,7 @@ const ListContactInfoPanel = ({
|
|||||||
|
|
||||||
if (header.listHderTy === ListHeaderConst.EMAIL) {
|
if (header.listHderTy === ListHeaderConst.EMAIL) {
|
||||||
return (
|
return (
|
||||||
<FieldRow key={header.listHderId} label={header.listHderNm} color={header.listHderColor}>
|
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
|
||||||
<div className="flex flex-col gap-2 md:flex-row">
|
<div className="flex flex-col gap-2 md:flex-row">
|
||||||
<Input
|
<Input
|
||||||
value={value}
|
value={value}
|
||||||
@@ -315,7 +296,7 @@ const ListContactInfoPanel = ({
|
|||||||
|
|
||||||
if (header.listHderTy === ListHeaderConst.FILE) {
|
if (header.listHderTy === ListHeaderConst.FILE) {
|
||||||
return (
|
return (
|
||||||
<FieldRow key={header.listHderId} label={header.listHderNm} color={header.listHderColor}>
|
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="min-w-0 flex-1 truncate text-sm">
|
<div className="min-w-0 flex-1 truncate text-sm">
|
||||||
{value ? (
|
{value ? (
|
||||||
@@ -356,14 +337,14 @@ const ListContactInfoPanel = ({
|
|||||||
|
|
||||||
if (header.listHderTy === ListHeaderConst.IS_USE) {
|
if (header.listHderTy === ListHeaderConst.IS_USE) {
|
||||||
return (
|
return (
|
||||||
<FieldRow key={header.listHderId} label={header.listHderNm} color={header.listHderColor}>
|
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
|
||||||
<KriSingleSelect
|
<KriSingleSelect
|
||||||
items={IS_USE_OPTIONS}
|
items={Object.values(LIST_IS_USE_LABEL)}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={!editable}
|
disabled={!editable}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
getValue={(item) => item.value}
|
getValue={(item) => item}
|
||||||
getLabel={(item) => item.label}
|
getLabel={(item) => item}
|
||||||
searchable={false}
|
searchable={false}
|
||||||
preventDeselect
|
preventDeselect
|
||||||
widthClassName="w-full"
|
widthClassName="w-full"
|
||||||
@@ -376,7 +357,7 @@ const ListContactInfoPanel = ({
|
|||||||
|
|
||||||
if (header.listHderTy === ListHeaderConst.CONTENT_ITEM && (header.filterContents?.length ?? 0) > 0) {
|
if (header.listHderTy === ListHeaderConst.CONTENT_ITEM && (header.filterContents?.length ?? 0) > 0) {
|
||||||
return (
|
return (
|
||||||
<FieldRow key={header.listHderId} label={header.listHderNm} color={header.listHderColor}>
|
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
|
||||||
<KriSingleSelect
|
<KriSingleSelect
|
||||||
items={header.filterContents ?? []}
|
items={header.filterContents ?? []}
|
||||||
value={value}
|
value={value}
|
||||||
@@ -393,7 +374,7 @@ const ListContactInfoPanel = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FieldRow key={header.listHderId} label={header.listHderNm} color={header.listHderColor}>
|
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
|
||||||
<Input
|
<Input
|
||||||
value={value}
|
value={value}
|
||||||
readOnly={!editable}
|
readOnly={!editable}
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import { useAtom } from 'jotai'
|
import { useAtom } from 'jotai'
|
||||||
|
import { HttpError } from '@kri/common/http'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { ListJobProgress } from '@/components/list/ListJobProgress'
|
import { ListJobProgress } from '@/components/list/ListJobProgress'
|
||||||
import { useAuth } from '@/hooks/useAuth'
|
import { useAuth } from '@/hooks/useAuth'
|
||||||
import { isAvailabilityUnsupported, isListJobGone, useListJob, useListJobAvailability, useUploadResetActive } from '@/query/list-job'
|
import { isAvailabilityUnsupported, useListJob, useListJobAvailability, useUploadResetActive } from '@/query/list-job'
|
||||||
import { findTrackedListJob, trackListJob, untrackListJob, useTrackedListJobs } from '@/store/list-job-tracker'
|
import { findTrackedListJob, trackListJob, untrackListJob, useTrackedListJobs } from '@/store/list-job-tracker'
|
||||||
import { listJobLabel } from '@/const/listJobConst'
|
import { listJobLabel } from '@/const/listJobConst'
|
||||||
import { blockerJobLabel, blockerPhaseLabel, blockerUserLabel, describeListJobAvailability } from '@/utils/listJobAvailability'
|
import { blockerJobLabel, blockerPhaseLabel, blockerUserLabel, describeListJobAvailability } from '@/utils/listJobAvailability'
|
||||||
@@ -44,7 +45,7 @@ export function useListJobGate({ prjctIdx, jobType, active, requestLabel, pollWh
|
|||||||
const detail = useListJob(prjctIdx, jobKey, active)
|
const detail = useListJob(prjctIdx, jobKey, active)
|
||||||
const job = detail.data?.jobKey === jobKey ? detail.data : undefined
|
const job = detail.data?.jobKey === jobKey ? detail.data : undefined
|
||||||
const finishedJob = job && !isActiveListJob(job.jobStatus) ? job : undefined
|
const finishedJob = job && !isActiveListJob(job.jobStatus) ? job : undefined
|
||||||
const detailNotFound = isListJobGone(detail.error)
|
const detailNotFound = detail.error instanceof HttpError && detail.error.status === 404
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!active && requestMatches && openRequest.opened) setOpenRequest(null)
|
if (!active && requestMatches && openRequest.opened) setOpenRequest(null)
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import { useEffect } from 'react'
|
|||||||
import { usePathname, useRouter } from 'next/navigation'
|
import { usePathname, useRouter } from 'next/navigation'
|
||||||
import { useAtom } from 'jotai'
|
import { useAtom } from 'jotai'
|
||||||
import { useQueries, useQueryClient } from '@tanstack/react-query'
|
import { useQueries, useQueryClient } from '@tanstack/react-query'
|
||||||
|
import { HttpError } from '@kri/common/http'
|
||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
import { nextApi } from '@/lib/http-client'
|
import { nextApi } from '@/lib/http-client'
|
||||||
import { isListJobGone, listJobKeys, useMyActiveListJobs } from '@/query/list-job'
|
import { listJobKeys, useMyActiveListJobs } from '@/query/list-job'
|
||||||
import { listJobOpenRequestAtom } from '@/store/jotai/list-job'
|
import { listJobOpenRequestAtom } from '@/store/jotai/list-job'
|
||||||
import { useSelectedProject } from '@/hooks/useSelectedProject'
|
import { useSelectedProject } from '@/hooks/useSelectedProject'
|
||||||
import { useDialog } from '@/hooks/useDialog'
|
import { useDialog } from '@/hooks/useDialog'
|
||||||
@@ -89,7 +90,7 @@ export function ListJobWatcher({ userId, prjctIdx }: { userId: string; prjctIdx:
|
|||||||
details.forEach((result, index) => {
|
details.forEach((result, index) => {
|
||||||
const tracked = trackedJobs[index]
|
const tracked = trackedJobs[index]
|
||||||
if (!tracked) return
|
if (!tracked) return
|
||||||
if (isListJobGone(result.error)) {
|
if (result.error instanceof HttpError && result.error.status === 404) {
|
||||||
untrackListJob(tracked.jobKey)
|
untrackListJob(tracked.jobKey)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ const KkoMessageTemplate = () => {
|
|||||||
if (!d.kkoTmplatCd) return fail("kkoTmplatCd", "알림톡 템플릿을 선택해 주세요.");
|
if (!d.kkoTmplatCd) return fail("kkoTmplatCd", "알림톡 템플릿을 선택해 주세요.");
|
||||||
if (!KKO_TEMPLATE_CODE_REGEX.test(d.kkoTmplatCd)) return fail("kkoTmplatCd", "알림톡 템플릿 코드 형식이 올바르지 않습니다.");
|
if (!KKO_TEMPLATE_CODE_REGEX.test(d.kkoTmplatCd)) return fail("kkoTmplatCd", "알림톡 템플릿 코드 형식이 올바르지 않습니다.");
|
||||||
if (isBlank(d.tmplatNm)) return fail("tmplatNm", "알림톡 템플릿 명이 없습니다.");
|
if (isBlank(d.tmplatNm)) return fail("tmplatNm", "알림톡 템플릿 명이 없습니다.");
|
||||||
if (d.tmplatNm.length > 128) return fail("tmplatNm", "알림톡 템플릿 명이 128자를 초과해 저장할 수 없습니다.");
|
if (d.tmplatNm.length > 32) return fail("tmplatNm", "알림톡 템플릿 명이 32자를 초과해 저장할 수 없습니다.");
|
||||||
if (isBlank(d.sendTel)) return fail("sendTel", "발신 전화번호를 입력해 주세요.");
|
if (isBlank(d.sendTel)) return fail("sendTel", "발신 전화번호를 입력해 주세요.");
|
||||||
if (d.sendTel.length > 16) return fail("sendTel", "발신 전화번호는 16자 이하로 입력해주세요.");
|
if (d.sendTel.length > 16) return fail("sendTel", "발신 전화번호는 16자 이하로 입력해주세요.");
|
||||||
return ok();
|
return ok();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import { downloadFile } from "@kri/common/browser";
|
|||||||
import {cn} from "@/lib/utils";
|
import {cn} from "@/lib/utils";
|
||||||
import {ProjectMainTemplateUpdateRequest, ProjectSurvey} from "@/types/project";
|
import {ProjectMainTemplateUpdateRequest, ProjectSurvey} from "@/types/project";
|
||||||
import type { DataVerification } from "@kri/common";
|
import type { DataVerification } from "@kri/common";
|
||||||
import {COMMON_TEXT_REGEX, EMAIL_REGEX, TEMPLATE_TEXT_REGEX} from "@/const/validationConst";
|
import {COMMON_TEXT_REGEX, EMAIL_REGEX} from "@/const/validationConst";
|
||||||
import {formatKoreanPhoneNumber} from "@/utils/phone";
|
import {formatKoreanPhoneNumber} from "@/utils/phone";
|
||||||
import {
|
import {
|
||||||
getTemplateAttachmentNames,
|
getTemplateAttachmentNames,
|
||||||
@@ -243,17 +243,16 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
|||||||
|
|
||||||
if (isBlank(tpl.itrntPrjctCd)) return fail("itrntPrjctCd", "인트라넷 프로젝트 코드가 없습니다.");
|
if (isBlank(tpl.itrntPrjctCd)) return fail("itrntPrjctCd", "인트라넷 프로젝트 코드가 없습니다.");
|
||||||
if (isBlank(tpl.tmplatNm)) return fail("tmplatNm", "템플릿명을 입력해 주세요.");
|
if (isBlank(tpl.tmplatNm)) return fail("tmplatNm", "템플릿명을 입력해 주세요.");
|
||||||
if (tpl.tmplatNm.length > 128) return fail("tmplatNm", "템플릿명은 128자 이하로 입력해주세요.");
|
if (tpl.tmplatNm.length > 32) return fail("tmplatNm", "템플릿명은 32자 이하로 입력해주세요.");
|
||||||
if (!TEMPLATE_TEXT_REGEX.test(tpl.tmplatNm)) return fail("tmplatNm", "템플릿명에 허용되지 않는 문자가 포함되어 있습니다.");
|
if (!COMMON_TEXT_REGEX.test(tpl.tmplatNm)) return fail("tmplatNm", "템플릿명에 허용되지 않는 문자가 포함되어 있습니다.");
|
||||||
if (isBlank(tpl.tmplatBody)) return fail("tmplatBody", "본문을 입력해 주세요.");
|
if (isBlank(tpl.tmplatBody)) return fail("tmplatBody", "본문을 입력해 주세요.");
|
||||||
if (isBlank(tpl.sendNm)) return fail("sendNm", "발신자명을 입력해 주세요.");
|
if (isBlank(tpl.sendNm)) return fail("sendNm", "발신자명을 입력해 주세요.");
|
||||||
if (tpl.sendNm.length > 32) return fail("sendNm", "발신자명은 32자 이하로 입력해주세요.");
|
if (tpl.sendNm.length > 32) return fail("sendNm", "발신자명은 32자 이하로 입력해주세요.");
|
||||||
if (!TEMPLATE_TEXT_REGEX.test(tpl.sendNm)) return fail("sendNm", "발신자명에 허용되지 않는 문자가 포함되어 있습니다.");
|
if (!COMMON_TEXT_REGEX.test(tpl.sendNm)) return fail("sendNm", "발신자명에 허용되지 않는 문자가 포함되어 있습니다.");
|
||||||
|
|
||||||
if (!isBlank(tpl.tmplatTitle)) {
|
if (!isBlank(tpl.tmplatTitle)) {
|
||||||
const titleMaxLength = isSmsTemplate(tpl) ? 64 : 128;
|
if (tpl.tmplatTitle!.length > 128) return fail("tmplatTitle", "제목은 128자 이하로 입력해주세요.");
|
||||||
if (tpl.tmplatTitle!.length > titleMaxLength) return fail("tmplatTitle", `제목은 ${titleMaxLength}자 이하로 입력해주세요.`);
|
if (!COMMON_TEXT_REGEX.test(tpl.tmplatTitle!)) return fail("tmplatTitle", "제목에 허용되지 않는 문자가 포함되어 있습니다.");
|
||||||
if (!TEMPLATE_TEXT_REGEX.test(tpl.tmplatTitle!)) return fail("tmplatTitle", "제목에 허용되지 않는 문자가 포함되어 있습니다.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tpl.tmplatTy === MessageType.EMAIL) {
|
if (tpl.tmplatTy === MessageType.EMAIL) {
|
||||||
|
|||||||
@@ -202,17 +202,6 @@ export const getListColumns = (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.listHderTy === ListHeaderConst.MULTILINE_TEXT) {
|
|
||||||
return {
|
|
||||||
accessorKey: String(header.listHderId),
|
|
||||||
header: header.listHderNm,
|
|
||||||
meta: {
|
|
||||||
maxWidth: 200,
|
|
||||||
},
|
|
||||||
enableSorting: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
accessorKey: String(header.listHderId),
|
accessorKey: String(header.listHderId),
|
||||||
header: header.listHderNm,
|
header: header.listHderNm,
|
||||||
|
|||||||
@@ -5,5 +5,3 @@ export const FONT_SIZE = {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const ALLOW_REDIRECT = new Set(["complete", "screen", "quota"]);
|
export const ALLOW_REDIRECT = new Set(["complete", "screen", "quota"]);
|
||||||
|
|
||||||
export const AUTH_COOKIE_MAX_AGE = 24 * 60 * 60;
|
|
||||||
|
|||||||
@@ -4,12 +4,11 @@ export const CTI_AGENT_GROUP = "KRI_CONTACT";
|
|||||||
|
|
||||||
export const CTI_CALL_PHASE: CtiCallPhase[] = [
|
export const CTI_CALL_PHASE: CtiCallPhase[] = [
|
||||||
'dialing',
|
'dialing',
|
||||||
'active',
|
'active'
|
||||||
'ending'
|
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
// WS 서버가 보내는 발신·통화 중 상태. None(0)은 통화 중 상태가 아니다.
|
// WS 서버가 보내는 CTIAgentStatus 값 중 통화 중 또는 통화 중 재로그인 대기로 간주할 값들
|
||||||
export const CTI_ON_CALL_STATUSES = ["2", "3", "8"] as const;
|
export const CTI_ON_CALL_STATUSES = ["0", "2", "3"] as const;
|
||||||
|
|
||||||
// localStorage에 저장한 CTI 상태의 만료 시간. 마지막 저장(updatedAt) 기준이며 복원 시점에만 검사한다.
|
// localStorage에 저장한 CTI 상태의 만료 시간. 마지막 저장(updatedAt) 기준이며 복원 시점에만 검사한다.
|
||||||
export const CTI_STATE_TTL_MS = 2 * 60 * 60 * 1000;
|
export const CTI_STATE_TTL_MS = 2 * 60 * 60 * 1000;
|
||||||
@@ -27,7 +26,3 @@ export const CTI_AUTO_RECONNECT_BASE_MS = 1000;
|
|||||||
export const CTI_AUTO_RECONNECT_MAX_MS = 15 * 1000;
|
export const CTI_AUTO_RECONNECT_MAX_MS = 15 * 1000;
|
||||||
export const CTI_AUTO_RECONNECT_JITTER_MS = 1000;
|
export const CTI_AUTO_RECONNECT_JITTER_MS = 1000;
|
||||||
|
|
||||||
// 종료 명령의 응답이 없으면 재요청할 수 있게 하되, 실제 종료로 판정하지 않는다.
|
|
||||||
export const CTI_HANGUP_TIMEOUT_MS = 10 * 1000;
|
|
||||||
export const CTI_LOGIN_TIMEOUT_MS = 15 * 1000;
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ export const ListHeaderSpecificConst = {
|
|||||||
EMAIL: 31,
|
EMAIL: 31,
|
||||||
FILE: 81,
|
FILE: 81,
|
||||||
CONTENT_ITEM: 91,
|
CONTENT_ITEM: 91,
|
||||||
// 장문(여러 줄 입력 텍스트). 저장·필터·다운로드는 서버에서 일반 텍스트(99)와 같게 처리한다.
|
|
||||||
MULTILINE_TEXT: 98,
|
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const ListHeaderConst = {
|
export const ListHeaderConst = {
|
||||||
@@ -46,7 +44,6 @@ type ListHeaderType = (typeof ListHeaderConst)[keyof typeof ListHeaderConst];
|
|||||||
|
|
||||||
export const LIST_HEADER_TYPE_ORDER = [
|
export const LIST_HEADER_TYPE_ORDER = [
|
||||||
ListHeaderConst.TEXT,
|
ListHeaderConst.TEXT,
|
||||||
ListHeaderConst.MULTILINE_TEXT,
|
|
||||||
ListHeaderConst.CONTENT_ITEM,
|
ListHeaderConst.CONTENT_ITEM,
|
||||||
ListHeaderConst.TEL_NUM,
|
ListHeaderConst.TEL_NUM,
|
||||||
ListHeaderConst.EMAIL,
|
ListHeaderConst.EMAIL,
|
||||||
@@ -63,7 +60,6 @@ export const LIST_HEADER_TYPE_LABEL = {
|
|||||||
[ListHeaderConst.FIELD_INTERVIEWER]: "면접원",
|
[ListHeaderConst.FIELD_INTERVIEWER]: "면접원",
|
||||||
[ListHeaderConst.MEMO]: "중요 메모",
|
[ListHeaderConst.MEMO]: "중요 메모",
|
||||||
[ListHeaderConst.TEXT]: "일반",
|
[ListHeaderConst.TEXT]: "일반",
|
||||||
[ListHeaderConst.MULTILINE_TEXT]: "장문",
|
|
||||||
[ListHeaderConst.TEL_NUM]: "전화번호",
|
[ListHeaderConst.TEL_NUM]: "전화번호",
|
||||||
[ListHeaderConst.EMAIL]: "이메일",
|
[ListHeaderConst.EMAIL]: "이메일",
|
||||||
[ListHeaderConst.FILE]: "파일 업로드",
|
[ListHeaderConst.FILE]: "파일 업로드",
|
||||||
|
|||||||
@@ -6,14 +6,6 @@
|
|||||||
// 그 외 문자(이모지, 다른 언어 문자, 제어문자 등)는 전부 거부한다.
|
// 그 외 문자(이모지, 다른 언어 문자, 제어문자 등)는 전부 거부한다.
|
||||||
export const COMMON_TEXT_REGEX = /^[가-힣A-Za-z0-9 !@#$%^&*()_+\-={}\[\]:;"'<>,.?/·~]+$/
|
export const COMMON_TEXT_REGEX = /^[가-힣A-Za-z0-9 !@#$%^&*()_+\-={}\[\]:;"'<>,.?/·~]+$/
|
||||||
|
|
||||||
// 메시지 템플릿의 제목·템플릿명·발신자명용. 다국어(스페인어, 일본어 등)와 기호는 허용하고
|
|
||||||
// 제어·서식 문자, 줄/문단 구분자, 이모지만 거부한다.
|
|
||||||
// tsconfig target(ES2017)에서 \p{...} 리터럴 대신 RegExp 생성자로 만든다.
|
|
||||||
export const TEMPLATE_TEXT_REGEX = new RegExp(
|
|
||||||
"^[^\\p{C}\\p{Zl}\\p{Zp}\\p{Emoji_Presentation}\\u{FE0F}\\u{20E3}]+$",
|
|
||||||
"u",
|
|
||||||
)
|
|
||||||
|
|
||||||
// 이메일 기본 형식(로컬@도메인.최상위도메인)만 확인한다. 세부 규칙은 백엔드 검증을 따른다.
|
// 이메일 기본 형식(로컬@도메인.최상위도메인)만 확인한다. 세부 규칙은 백엔드 검증을 따른다.
|
||||||
export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
||||||
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { useAtomValue, useStore } from "jotai";
|
|
||||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { apiError } from "@kri/common/http";
|
|
||||||
import { authStateAtom, useAuth } from "@/hooks/useAuth";
|
|
||||||
import { selectedProjectAtom, selectedProjectHydratedAtom } from "@/store/jotai/project";
|
|
||||||
import { nextApi } from "@/lib/http-client";
|
|
||||||
import { isLoginUser } from "@/lib/auth-user";
|
|
||||||
|
|
||||||
const SESSION_QUERY_KEY = ["auth-session"] as const;
|
|
||||||
|
|
||||||
export function useAuthSession() {
|
|
||||||
const store = useStore();
|
|
||||||
const queryClient = useQueryClient();
|
|
||||||
const router = useRouter();
|
|
||||||
const { setAuth } = useAuth();
|
|
||||||
useAtomValue(selectedProjectAtom);
|
|
||||||
const projectHydrated = useAtomValue(selectedProjectHydratedAtom);
|
|
||||||
const otherQueries = { predicate: (query: { queryKey: readonly unknown[] }) => query.queryKey[0] !== SESSION_QUERY_KEY[0] };
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const refresh = () => {
|
|
||||||
void queryClient.refetchQueries({ queryKey: SESSION_QUERY_KEY, exact: true, type: "active" }, { cancelRefetch: false });
|
|
||||||
};
|
|
||||||
window.addEventListener("focus", refresh);
|
|
||||||
return () => window.removeEventListener("focus", refresh);
|
|
||||||
}, [queryClient]);
|
|
||||||
|
|
||||||
return useQuery({
|
|
||||||
queryKey: SESSION_QUERY_KEY,
|
|
||||||
enabled: projectHydrated,
|
|
||||||
staleTime: 0,
|
|
||||||
gcTime: 0,
|
|
||||||
retry: false,
|
|
||||||
refetchOnMount: "always",
|
|
||||||
refetchOnWindowFocus: "always",
|
|
||||||
meta: { ignoreGlobalLoading: true },
|
|
||||||
queryFn: async ({ signal }) => {
|
|
||||||
const previous = store.get(authStateAtom);
|
|
||||||
try {
|
|
||||||
const user = await nextApi.get<unknown>("/auth/my-info", {
|
|
||||||
cache: "no-store",
|
|
||||||
skipUnauthorizedHandler: true, skipForbiddenHandler: true, skipResponseErrorHandler: true,
|
|
||||||
});
|
|
||||||
signal.throwIfAborted();
|
|
||||||
if (!isLoginUser(user)) throw new Error("Invalid user response");
|
|
||||||
const before = previous.user;
|
|
||||||
const changed = !before || before.userId !== user.userId || before.userRole !== user.userRole ||
|
|
||||||
before.userTeam !== user.userTeam || before.userCmpn !== user.userCmpn;
|
|
||||||
if (changed) {
|
|
||||||
await queryClient.cancelQueries(otherQueries);
|
|
||||||
signal.throwIfAborted();
|
|
||||||
queryClient.removeQueries(otherQueries);
|
|
||||||
queryClient.getMutationCache().clear();
|
|
||||||
}
|
|
||||||
if (changed || before?.userName !== user.userName) setAuth({ user });
|
|
||||||
return user;
|
|
||||||
} catch (reason) {
|
|
||||||
signal.throwIfAborted();
|
|
||||||
const status = apiError(reason).status;
|
|
||||||
if (status === 401 || status === 403) {
|
|
||||||
await queryClient.cancelQueries(otherQueries);
|
|
||||||
signal.throwIfAborted();
|
|
||||||
queryClient.removeQueries(otherQueries);
|
|
||||||
queryClient.getMutationCache().clear();
|
|
||||||
store.set(selectedProjectAtom, null);
|
|
||||||
setAuth({ user: null });
|
|
||||||
router.replace("/login");
|
|
||||||
}
|
|
||||||
throw reason;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import "server-only";
|
|
||||||
import { NextResponse } from "next/server";
|
|
||||||
import { AUTH_COOKIE_MAX_AGE } from "@/const/commonConst";
|
|
||||||
import { serverEnv } from "@/lib/env.server";
|
|
||||||
import { CookieKeys } from "@/store/cookie/cookie-keys";
|
|
||||||
|
|
||||||
/** Issue/renew the normal-login cookie, or expire it when the token is empty. */
|
|
||||||
export function setAuthCookie(response: NextResponse, token: string): void {
|
|
||||||
const production = serverEnv.ENV === "prod";
|
|
||||||
const domain = serverEnv.AUTH_COOKIE_DOMAIN;
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
httpOnly: true,
|
|
||||||
secure: production,
|
|
||||||
sameSite: "lax" as const,
|
|
||||||
path: "/",
|
|
||||||
};
|
|
||||||
// Serialize each cookie separately: ResponseCookies indexes cookies by name,
|
|
||||||
// so setting the shared and host-only variants on one instance loses a header.
|
|
||||||
const append = (value: string, cookieDomain: string | undefined, maxAge: number) => {
|
|
||||||
const cookieResponse = new NextResponse(null);
|
|
||||||
cookieResponse.cookies.set(CookieKeys.AuthToken, value, {
|
|
||||||
...options,
|
|
||||||
...(cookieDomain ? { domain: cookieDomain } : {}),
|
|
||||||
maxAge,
|
|
||||||
});
|
|
||||||
for (const header of cookieResponse.headers.getSetCookie())
|
|
||||||
response.headers.append("Set-Cookie", header);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (domain) append("", undefined, 0);
|
|
||||||
append(token, domain, token ? AUTH_COOKIE_MAX_AGE : 0);
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import {LoginUser} from "@kri/common";
|
|
||||||
|
|
||||||
export function isLoginUser(value: unknown): value is LoginUser {
|
|
||||||
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
||||||
return "userId" in value && typeof value.userId === "string" && value.userId.length > 0 &&
|
|
||||||
"userName" in value && typeof value.userName === "string" &&
|
|
||||||
"userCmpn" in value && typeof value.userCmpn === "string" &&
|
|
||||||
"userTeam" in value && typeof value.userTeam === "string" &&
|
|
||||||
"userRole" in value && typeof value.userRole === "number" && Number.isSafeInteger(value.userRole);
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -32,9 +32,3 @@ const KST_DATE_TIME_FORMAT = new Intl.DateTimeFormat('sv-SE', {
|
|||||||
// 이메일·문자·알림톡 공통 형식이다.
|
// 이메일·문자·알림톡 공통 형식이다.
|
||||||
export const toReserveSendDt = (localDateTime: string): string =>
|
export const toReserveSendDt = (localDateTime: string): string =>
|
||||||
KST_DATE_TIME_FORMAT.format(new Date(localDateTime))
|
KST_DATE_TIME_FORMAT.format(new Date(localDateTime))
|
||||||
|
|
||||||
// 예약 발송 일시(로컬 시각)가 현재 시각보다 이전이거나 해석할 수 없으면 true를 반환한다.
|
|
||||||
export const isPastReserveDateTime = (localDateTime: string): boolean => {
|
|
||||||
const time = new Date(localDateTime).getTime()
|
|
||||||
return Number.isNaN(time) || time < Date.now()
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import { createEnv, env } from "@kri/common/config";
|
|||||||
export const clientEnv = createEnv({
|
export const clientEnv = createEnv({
|
||||||
ENV: env.required("NEXT_PUBLIC_ENV", process.env.NEXT_PUBLIC_ENV),
|
ENV: env.required("NEXT_PUBLIC_ENV", process.env.NEXT_PUBLIC_ENV),
|
||||||
|
|
||||||
KART_URL: env.required("NEXT_PUBLIC_KART_URL", process.env.NEXT_PUBLIC_KART_URL),
|
|
||||||
|
|
||||||
API_BASE: env.required("NEXT_PUBLIC_API_BASE", process.env.NEXT_PUBLIC_API_BASE),
|
API_BASE: env.required("NEXT_PUBLIC_API_BASE", process.env.NEXT_PUBLIC_API_BASE),
|
||||||
|
|
||||||
API_INTERNAL: env.required("NEXT_PUBLIC_API_INTERNAL", process.env.NEXT_PUBLIC_API_INTERNAL),
|
API_INTERNAL: env.required("NEXT_PUBLIC_API_INTERNAL", process.env.NEXT_PUBLIC_API_INTERNAL),
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import { createEnv, env } from "@kri/common/config";
|
|||||||
export const serverEnv = createEnv({
|
export const serverEnv = createEnv({
|
||||||
ENV: env.required("ENV", process.env.ENV),
|
ENV: env.required("ENV", process.env.ENV),
|
||||||
|
|
||||||
AUTH_COOKIE_DOMAIN: env.optional("AUTH_COOKIE_DOMAIN", process.env.AUTH_COOKIE_DOMAIN),
|
|
||||||
|
|
||||||
CONTACT_SERVER: env.required("CONTACT_SERVER", process.env.CONTACT_SERVER),
|
CONTACT_SERVER: env.required("CONTACT_SERVER", process.env.CONTACT_SERVER),
|
||||||
|
|
||||||
API_CONTACT_SERVER: env.required("API_CONTACT_SERVER", process.env.API_CONTACT_SERVER),
|
API_CONTACT_SERVER: env.required("API_CONTACT_SERVER", process.env.API_CONTACT_SERVER),
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ export const Security = createSecurity({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const target = window as Window & {
|
const target = window as Window & {
|
||||||
__kriContactCryptoConfigAlerted?: boolean;
|
__kfpaCryptoConfigAlerted?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (target.__kriContactCryptoConfigAlerted) {
|
if (target.__kfpaCryptoConfigAlerted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
target.__kriContactCryptoConfigAlerted = true;
|
target.__kfpaCryptoConfigAlerted = true;
|
||||||
window.alert(message);
|
window.alert(message);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useSetAtom } from "jotai";
|
|
||||||
import { nextApi } from "@/lib/http-client";
|
import { nextApi } from "@/lib/http-client";
|
||||||
import { useAuth } from "@/hooks/useAuth";
|
import { useAuth } from "@/hooks/useAuth";
|
||||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||||
import { clearTrackedListJobs } from "@/store/list-job-tracker";
|
|
||||||
import { listJobOpenRequestAtom } from "@/store/jotai/list-job";
|
|
||||||
import type { LoginUser } from "@kri/common";
|
import type { LoginUser } from "@kri/common";
|
||||||
|
|
||||||
export const useLoginMutation = () => {
|
export const useLoginMutation = () => {
|
||||||
@@ -34,7 +31,6 @@ export const useLogoutMutation = () => {
|
|||||||
const qc = useQueryClient();
|
const qc = useQueryClient();
|
||||||
const { auth, logout } = useAuth();
|
const { auth, logout } = useAuth();
|
||||||
const { clearSelectedProject } = useSelectedProject();
|
const { clearSelectedProject } = useSelectedProject();
|
||||||
const setListJobOpenRequest = useSetAtom(listJobOpenRequestAtom);
|
|
||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
@@ -53,8 +49,6 @@ export const useLogoutMutation = () => {
|
|||||||
},
|
},
|
||||||
onSettled: () => {
|
onSettled: () => {
|
||||||
clearSelectedProject();
|
clearSelectedProject();
|
||||||
clearTrackedListJobs();
|
|
||||||
setListJobOpenRequest(null);
|
|
||||||
logout();
|
logout();
|
||||||
qc.clear(); // 다음 사용자/세션에 서버상태 남지 않게
|
qc.clear(); // 다음 사용자/세션에 서버상태 남지 않게
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ export const qk = {
|
|||||||
/********** KON, KIWI 프로젝트 관련 KART에서 받아옴 **********/
|
/********** KON, KIWI 프로젝트 관련 KART에서 받아옴 **********/
|
||||||
kartProjectList: (itrntPrjctCd: string, userTeam: string, isKiwi: number, keyword: string) =>
|
kartProjectList: (itrntPrjctCd: string, userTeam: string, isKiwi: number, keyword: string) =>
|
||||||
["kart", "project-list", itrntPrjctCd, userTeam, isKiwi, keyword] as const,
|
["kart", "project-list", itrntPrjctCd, userTeam, isKiwi, keyword] as const,
|
||||||
|
surveyRedirectUrl: (isKiwi: number, pkey: string) =>
|
||||||
|
["kart", "survey-redirect-url", isKiwi, pkey] as const,
|
||||||
/********** KON, KIWI 프로젝트 관련 KART에서 받아옴 **********/
|
/********** KON, KIWI 프로젝트 관련 KART에서 받아옴 **********/
|
||||||
|
|
||||||
/********** 찐 인트라넷 관련 **********/
|
/********** 찐 인트라넷 관련 **********/
|
||||||
|
|||||||
@@ -38,14 +38,6 @@ const fetchAvailability = async (prjctIdx: number, jobType: ListJobType) =>
|
|||||||
/** 신규 API 미배포·롤백 상태. 반복 호출하지 않고 사전 안내만 중단한다. */
|
/** 신규 API 미배포·롤백 상태. 반복 호출하지 않고 사전 안내만 중단한다. */
|
||||||
export const isAvailabilityUnsupported = (error: unknown) => error instanceof HttpError && error.status === 404
|
export const isAvailabilityUnsupported = (error: unknown) => error instanceof HttpError && error.status === 404
|
||||||
|
|
||||||
/**
|
|
||||||
* 작업을 더 이상 조회할 수 없는 경우. 기록을 지우고 반복 조회를 멈춘다.
|
|
||||||
* - 404: 작업이 만료됐거나 내 작업이 아니다.
|
|
||||||
* - 403 PROJECT_ACCESS_DENIED: 프로젝트가 삭제됐거나 접근 권한·배정·상태가 바뀌었다.
|
|
||||||
*/
|
|
||||||
export const isListJobGone = (error: unknown) => error instanceof HttpError
|
|
||||||
&& (error.status === 404 || (error.status === 403 && apiError(error).code === 'PROJECT_ACCESS_DENIED'))
|
|
||||||
|
|
||||||
export function useSubmitListJob(prjctIdx: number) {
|
export function useSubmitListJob(prjctIdx: number) {
|
||||||
const qc = useQueryClient()
|
const qc = useQueryClient()
|
||||||
const { auth } = useAuth()
|
const { auth } = useAuth()
|
||||||
|
|||||||
@@ -131,6 +131,19 @@ export function useKartProjectListQuery(args: {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* KON/KIWI 설문 현황(리포트) 바로가기 URL
|
||||||
|
*/
|
||||||
|
export function useSurveyRedirectUrlQuery(isKiwi: number, pkey: string, enabled: boolean) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: qk.surveyRedirectUrl(isKiwi, pkey),
|
||||||
|
queryFn: () => nextApi.get<string>(`/kart/survey-redirect-url/${isKiwi}/${encodeURIComponent(pkey)}`, { skipForbiddenHandler: true }),
|
||||||
|
enabled: enabled && !!pkey,
|
||||||
|
staleTime: 0,
|
||||||
|
meta: { ignoreGlobalLoading: true },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 프로젝트에 배정된 회사 ID 목록
|
* 프로젝트에 배정된 회사 ID 목록
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export const CookieKeys = {
|
export const CookieKeys = {
|
||||||
FontSize: "kri_fontSize",
|
FontSize: "kri_fontSize",
|
||||||
AuthToken: "kri_internal_authToken",
|
AuthToken: "kri_authToken",
|
||||||
// 필요하면 여기 계속 추가 (예: Theme: "kri_theme", ...)
|
// 필요하면 여기 계속 추가 (예: Theme: "kri_theme", ...)
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useSyncExternalStore } from 'react'
|
import { useSyncExternalStore } from 'react'
|
||||||
import { getLocalStorage, removeLocalStorage, setLocalStorage } from '@/store/storage/secure-storage'
|
import { getLocalStorage, setLocalStorage } from '@/store/storage/secure-storage'
|
||||||
import { StorageKeys } from '@/store/storage/storage-keys'
|
import { StorageKeys } from '@/store/storage/storage-keys'
|
||||||
import { isListJobType, type ListJobType } from '@/types/list-job'
|
import { isListJobType, type ListJobType } from '@/types/list-job'
|
||||||
|
|
||||||
@@ -77,14 +77,6 @@ export const untrackListJob = (jobKey: string) => {
|
|||||||
write(jobs.filter((job) => job.jobKey !== jobKey))
|
write(jobs.filter((job) => job.jobKey !== jobKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 로그아웃 시 다음 사용자에게 기록이 남지 않게 모두 지운다. 진행 중인 작업은 재로그인 후 my-active 조회로 다시 채워진다. */
|
|
||||||
export const clearTrackedListJobs = () => {
|
|
||||||
if (typeof window === 'undefined') return
|
|
||||||
removeLocalStorage(StorageKeys.ListJobs)
|
|
||||||
cache = EMPTY
|
|
||||||
window.dispatchEvent(new Event(CHANGE_EVENT))
|
|
||||||
}
|
|
||||||
|
|
||||||
export const findTrackedListJob = (jobs: TrackedListJob[], userId: string, prjctIdx: number, jobType: ListJobType) =>
|
export const findTrackedListJob = (jobs: TrackedListJob[], userId: string, prjctIdx: number, jobType: ListJobType) =>
|
||||||
jobs.find((job) => job.userId === userId && job.prjctIdx === prjctIdx && job.jobType === jobType)
|
jobs.find((job) => job.userId === userId && job.prjctIdx === prjctIdx && job.jobType === jobType)
|
||||||
|
|
||||||
|
|||||||
@@ -121,11 +121,6 @@ export type listHeader = {
|
|||||||
useIntrvwerView: boolean;
|
useIntrvwerView: boolean;
|
||||||
useIntrvwerEdit: boolean;
|
useIntrvwerEdit: boolean;
|
||||||
filterContents?: string[];
|
filterContents?: string[];
|
||||||
/**
|
|
||||||
* 헤더 색상(`#RRGGBB` 또는 `#RRGGBBAA`). null/빈 문자열은 기본색.
|
|
||||||
* 헤더 저장은 전체 덮어쓰기라 조회한 값을 그대로 다시 보내야 기존 색상이 유지된다.
|
|
||||||
*/
|
|
||||||
listHderColor?: string | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SurveyResultCondition = {
|
export type SurveyResultCondition = {
|
||||||
@@ -313,6 +308,8 @@ export type ListCallHist = ListCallCloseRequest & {
|
|||||||
regDt: string;
|
regDt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ListCallHistSession = ListCallHist;
|
||||||
|
|
||||||
export type ListReserveRequest = {
|
export type ListReserveRequest = {
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: string;
|
sid: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user