From 63ee0ab049112282d26defdee2d5a9b86fb7e968 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Thu, 22 Oct 2026 15:42:49 +0900 Subject: [PATCH] =?UTF-8?q?261022=5F03=5FENH:=20=EB=B0=9C=EC=86=A1=20?= =?UTF-8?q?=EC=B7=A8=EC=86=8C=20=EA=B0=80=EB=8A=A5=20=EC=97=AC=EB=B6=80=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=EA=B3=BC=20=ED=8C=90=EB=B3=84=20=ED=97=AC?= =?UTF-8?q?=ED=8D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .agent/consumer.md | 4 +++- AGENTS.md | 4 +++- package-lock.json | 4 ++-- package.json | 2 +- src/noti-hub/noti-hub-types.ts | 20 +++++++++++++++++++- src/noti-hub/send-cancellation.ts | 8 ++++++++ 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/.agent/consumer.md b/.agent/consumer.md index cf981dc..3c327f0 100644 --- a/.agent/consumer.md +++ b/.agent/consumer.md @@ -20,7 +20,9 @@ If a task spans multiple scopes, read every matching reference. Generated files ## 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). cancelDt and cancelUser are request history, not current state. +- 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. diff --git a/AGENTS.md b/AGENTS.md index fe4ddd8..187a9bc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -256,7 +256,9 @@ If a task spans multiple scopes, read every matching reference. Generated files ## 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). cancelDt and cancelUser are request history, not current state. +- 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. diff --git a/package-lock.json b/package-lock.json index 63b01a5..d02bc40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@kri/common", - "version": "0.19.3", + "version": "0.19.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@kri/common", - "version": "0.19.3", + "version": "0.19.4", "license": "UNLICENSED", "dependencies": { "clsx": "^2.1.1", diff --git a/package.json b/package.json index 4c0a015..332a5c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kri/common", - "version": "0.19.3", + "version": "0.19.4", "description": "KRI 프런트엔드 공통 유틸리티", "type": "module", "main": "./dist/index.js", diff --git a/src/noti-hub/noti-hub-types.ts b/src/noti-hub/noti-hub-types.ts index 3d41f80..09d78e0 100644 --- a/src/noti-hub/noti-hub-types.ts +++ b/src/noti-hub/noti-hub-types.ts @@ -228,13 +228,19 @@ export type ReportExcelResponse = FileResponse; /** 현재 취소 상태는 cancellationStatus로 판단하며 cancelDt만으로 판단하지 않는다. */ export type BulkSendInfo = { + /** + * 조회 시점의 예약 취소 가능 여부. 취소 버튼 표시·활성화 기준으로 사용한다. + * 조회 이후 상태가 바뀔 수 있으므로 최종 결과는 취소 API 응답(SendCancelResponse) 건수로 판단한다. + * 구버전 응답에서는 값이 없으며(undefined), 이 경우 취소 불가로 취급한다. + */ + cancelable?: boolean; /** 벌크 취소 요청자 이력. */ cancelUser?: string; /** 벌크 취소 요청 일시 이력. 현재 상태 판정에 사용하지 않는다. */ cancelDt?: string; /** 현재 취소 상태인 상세 건수. */ canceledCount?: number; - /** 벌크의 현재 취소 상태. */ + /** 벌크의 현재 취소 상태. 취소 가능 여부는 cancelable로 판단한다. */ cancellationStatus?: SendCancellationStatus; bulkSendKey: string; reqstSvc: string; @@ -256,6 +262,12 @@ export type BulkSendInfo = { * 표시명은 서버의 resultLabel을 그대로 사용한다("예약 취소"). 별도 결과 코드 목록 API는 없다. */ export type SendInfo = { + /** + * 조회 시점의 예약 취소 가능 여부. 취소 버튼 표시·활성화 기준으로 사용한다. + * 조회 이후 상태가 바뀔 수 있으므로 최종 결과는 취소 API 응답(SendCancelResponse) 건수로 판단한다. + * 구버전 응답에서는 값이 없으며(undefined), 이 경우 취소 불가로 취급한다. + */ + cancelable?: boolean; /** 개별 취소 식별자. cmid가 아니다. */ sendIdx?: number; /** 취소 요청자. */ @@ -293,6 +305,12 @@ export type SendInfo = { * 별도 결과 코드 목록 API는 없다. */ export type SendResultInfo = { + /** + * 조회 시점의 예약 취소 가능 여부. 취소 버튼 표시·활성화 기준으로 사용한다. + * 조회 이후 상태가 바뀔 수 있으므로 최종 결과는 취소 API 응답(SendCancelResponse) 건수로 판단한다. + * 구버전 응답에서는 값이 없으며(undefined), 이 경우 취소 불가로 취급한다. + */ + cancelable?: boolean; /** 개별 취소 식별자. cmid가 아니다. 최신 발송 축약 조회에는 제공되지 않는다. */ sendIdx?: number; /** 취소 요청자. */ diff --git a/src/noti-hub/send-cancellation.ts b/src/noti-hub/send-cancellation.ts index a6a6f95..c0cb0c9 100644 --- a/src/noti-hub/send-cancellation.ts +++ b/src/noti-hub/send-cancellation.ts @@ -7,8 +7,16 @@ export const EMAIL_RESERVE_CANCELED_RESULT_CODE = 108; /** 문자(SMS, LMS_MMS)·알림톡(KKO) 예약 취소 결과 코드. */ export const SMS_KKO_RESERVE_CANCELED_RESULT_CODE = 9998; +/** + * 예약 취소 버튼을 활성화할 수 있는지 판단한다. cancelable === true일 때만 true. + * 값이 없으면(구버전 응답) false. cancelDt나 결과 라벨·코드로 추정하지 않는다. + */ +export const isSendCancelable = (item: { cancelable?: boolean }): boolean => + item.cancelable === true; + /** * 채널과 resultCode로 개별 건의 현재 예약 취소 상태를 판단한다. + * 현재 취소 상태 표시용이며, 취소 가능 여부 판단에는 isSendCancelable을 사용한다. * cancelDt는 요청 이력이므로 상태 판정에 사용하지 않는다. 알 수 없는 채널은 false. * 표시명은 서버의 resultViewLabel/resultLabel을 그대로 사용한다("예약 취소"). * 별도 결과 코드 목록 API는 없다.