@apolitical/component-library 8.11.1 → 8.11.2-ck
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/discussion/shared/interfaces/error.interface.d.ts +22 -0
- package/discussion/shared/interfaces/index.d.ts +1 -0
- package/helpers/intl.d.ts +3 -0
- package/index.js +113 -113
- package/index.mjs +5186 -5085
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes returned by the backend for 422 validation errors
|
|
3
|
+
*/
|
|
4
|
+
export type TDiscussionErrorCode = 'INSUFFICIENT_WORD_COUNT' | 'EMAIL_ADDRESS_DETECTED' | 'AI_MODERATION_REJECTED';
|
|
5
|
+
/**
|
|
6
|
+
* Custom error interface for discussion-related errors.
|
|
7
|
+
* Extends the standard Error with an optional HTTP status code and error code.
|
|
8
|
+
*/
|
|
9
|
+
export interface IDiscussionError extends Error {
|
|
10
|
+
/** HTTP status code associated with the error */
|
|
11
|
+
status?: number;
|
|
12
|
+
/** Specific error code for categorizing the error type */
|
|
13
|
+
errorCode?: TDiscussionErrorCode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Type guard to check if an error is a discussion error with status code
|
|
17
|
+
*/
|
|
18
|
+
export declare function isDiscussionModerationError(error: unknown): error is IDiscussionError;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a discussion error with the given message, status code, and error code
|
|
21
|
+
*/
|
|
22
|
+
export declare function createDiscussionModerationError(message: string, status?: number, errorCode?: TDiscussionErrorCode): IDiscussionError;
|
|
@@ -2,6 +2,7 @@ export * from './activity.interface';
|
|
|
2
2
|
export * from './community.category.interface';
|
|
3
3
|
export * from './context.interface';
|
|
4
4
|
export * from './discussion.interface';
|
|
5
|
+
export * from './error.interface';
|
|
5
6
|
export * from './payload.interface';
|
|
6
7
|
export * from './reaction.interface';
|
|
7
8
|
export * from './user.interface';
|
package/helpers/intl.d.ts
CHANGED
|
@@ -186,6 +186,9 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
186
186
|
discussion_form_error_loggedOut: string;
|
|
187
187
|
discussion_form_error_noPermission: string;
|
|
188
188
|
discussion_form_error_alreadyExists: string;
|
|
189
|
+
discussion_form_error_insufficientWordCount: string;
|
|
190
|
+
discussion_form_error_emailDetected: string;
|
|
191
|
+
discussion_form_error_moderationRejected: string;
|
|
189
192
|
discussion_form_title_question: string;
|
|
190
193
|
discussion_form_placeholder_question: string;
|
|
191
194
|
discussion_form_explainer_question: string;
|