@encatch/schema 1.3.0 โ 1.4.0
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/dist/esm/index.js +849 -575
- package/dist/esm/index.js.map +3 -3
- package/dist/types/helpers/csat-emoji-helper.d.ts +52 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/internal/type-assert.d.ts +19 -0
- package/dist/types/schemas/api/fetch-feedback-schema.d.ts +128 -72
- package/dist/types/schemas/api/submit-feedback-schema.d.ts +314 -25
- package/dist/types/schemas/fields/answer-schema.d.ts +121 -17
- package/dist/types/schemas/fields/app-props-schema.d.ts +82 -36
- package/dist/types/schemas/fields/field-schema.d.ts +135 -85
- package/dist/types/schemas/fields/form-properties-schema.d.ts +88 -36
- package/dist/types/schemas/fields/theme-schema.d.ts +23 -0
- package/dist/types/schemas/fields/translations-schema.d.ts +75 -0
- package/package.json +2 -2
- package/dist/types/schemas/fields/translations-example.d.ts +0 -10
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Canonical CSAT default emojis when `overrideEmoji` is unset (index 0 = point 1). */
|
|
2
|
+
export declare const CSAT_DEFAULT_EMOJIS_BY_SCALE: Record<number, readonly string[]>;
|
|
3
|
+
/** Emoji picker categories for CSAT custom overrides. */
|
|
4
|
+
export declare const CSAT_EMOJI_CATEGORIES: readonly [{
|
|
5
|
+
readonly id: "unhappy";
|
|
6
|
+
readonly label: "Unhappy";
|
|
7
|
+
readonly emojis: readonly ["๐ก", "๐ ", "๐ค", "๐", "๐", "๐", "๐ข", "๐ญ", "๐ฐ", "๐จ"];
|
|
8
|
+
}, {
|
|
9
|
+
readonly id: "neutral";
|
|
10
|
+
readonly label: "Neutral";
|
|
11
|
+
readonly emojis: readonly ["๐", "๐", "๐", "๐ถ", "๐ฅฒ"];
|
|
12
|
+
}, {
|
|
13
|
+
readonly id: "happy";
|
|
14
|
+
readonly label: "Happy";
|
|
15
|
+
readonly emojis: readonly ["๐", "๐", "๐", "๐", "๐", "๐คฉ", "๐", "๐ฅฐ", "๐"];
|
|
16
|
+
}, {
|
|
17
|
+
readonly id: "gestures";
|
|
18
|
+
readonly label: "Gestures";
|
|
19
|
+
readonly emojis: readonly ["๐", "๐", "๐", "๐", "๐ค", "โ๏ธ"];
|
|
20
|
+
}, {
|
|
21
|
+
readonly id: "hearts";
|
|
22
|
+
readonly label: "Hearts";
|
|
23
|
+
readonly emojis: readonly ["โค๏ธ", "๐งก", "๐", "๐", "๐", "๐", "๐"];
|
|
24
|
+
}, {
|
|
25
|
+
readonly id: "symbols";
|
|
26
|
+
readonly label: "Symbols";
|
|
27
|
+
readonly emojis: readonly ["โญ", "๐", "๐ฏ", "โ
", "โ", "โ ๏ธ"];
|
|
28
|
+
}, {
|
|
29
|
+
readonly id: "celebration";
|
|
30
|
+
readonly label: "Celebration";
|
|
31
|
+
readonly emojis: readonly ["๐", "๐ฅณ", "๐", "๐", "๐ฅ"];
|
|
32
|
+
}];
|
|
33
|
+
/** Flat allowed palette derived from categories (used for validation). */
|
|
34
|
+
export declare const CSAT_EMOJI_PALETTE: readonly string[];
|
|
35
|
+
export type CsatEmojiCategory = (typeof CSAT_EMOJI_CATEGORIES)[number];
|
|
36
|
+
export type CsatEmojiPaletteItem = (typeof CSAT_EMOJI_PALETTE)[number];
|
|
37
|
+
export declare function isCsatEmojiPaletteItem(value: string): value is CsatEmojiPaletteItem;
|
|
38
|
+
/** Default override values when custom emojis are enabled โ every emoji must exist in CSAT_EMOJI_PALETTE. */
|
|
39
|
+
export declare function getDefaultOverrideEmojiForScale(scale: number): string[];
|
|
40
|
+
export declare function parseOverrideEmoji(overrideEmoji: string | undefined | null): string[] | null;
|
|
41
|
+
export declare function serializeOverrideEmoji(emojis: readonly string[]): string;
|
|
42
|
+
export declare function validateOverrideEmojiForScale(overrideEmoji: string | undefined | null, scale: number): {
|
|
43
|
+
valid: boolean;
|
|
44
|
+
emojis: string[] | null;
|
|
45
|
+
error?: string;
|
|
46
|
+
};
|
|
47
|
+
/** Returns emojis for each scale point (index 0 = point 1). Falls back to defaults when unset. */
|
|
48
|
+
export declare function resolveCsatEmojis(scale: number, overrideEmoji?: string | null): string[];
|
|
49
|
+
/** Emoji for a 1-based CSAT point value. */
|
|
50
|
+
export declare function getCsatEmojiForPoint(point: number, scale: number, overrideEmoji?: string | null): string;
|
|
51
|
+
/** Trim custom emojis when scale shrinks; pad with defaults when scale grows (caller may require re-pick). */
|
|
52
|
+
export declare function trimOverrideEmojiForScale(overrideEmoji: string | undefined | null, newScale: number): string | undefined;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,17 +3,18 @@ export { AnnotationMarkerSchema, AnnotationSchema, SignatureAnswerSchema, FileUp
|
|
|
3
3
|
export { externalPublishingPropertiesSchema, publicationStatusSchema, feedbackConfigurationSchema, PublicationStatuses, type PublicationStatus, type FeedbackConfiguration, type ExternalPublishingProperties, } from "./schemas/fields/form-schema";
|
|
4
4
|
export { otherConfigurationPropertiesSchema, appearancePropertiesSchema, formPropertiesSchema, type FormProperties, type OtherConfigurationProperties, type AppearanceProperties, } from "./schemas/fields/form-properties-schema";
|
|
5
5
|
export { OtherFieldsSchema, LanguageFieldSchema, LanguagesSchema, OtherFieldsTranslationSchema, type OtherFields, type OtherFieldsTranslation, type LanguageField, type Languages, } from "./schemas/fields/other-screen-schema";
|
|
6
|
-
export { positionSchema, themeModeSchema, shareableModeSchema, previousButtonModeSchema, featureSettingsSchema, themeColorsSchema, themesSchema, themeConfigurationSchema, Positions, ThemeModes, ShareableModes, PreviousButtonModes, type Position, type FeatureSettings, type ThemeColors, type Themes, type ThemeMode, type ShareableMode, type PreviousButtonMode, type ThemeConfiguration, } from "./schemas/fields/theme-schema";
|
|
6
|
+
export { positionSchema, themeModeSchema, shareableModeSchema, previousButtonModeSchema, inAppDisplayTypeSchema, featureSettingsSchema, themeColorsSchema, themesSchema, themeConfigurationSchema, Positions, ThemeModes, ShareableModes, PreviousButtonModes, InAppDisplayTypes, type Position, type FeatureSettings, type InAppDisplayType, type ThemeColors, type Themes, type ThemeMode, type ShareableMode, type PreviousButtonMode, type ThemeConfiguration, } from "./schemas/fields/theme-schema";
|
|
7
7
|
export { focalPointSchema, imageAttachmentSchema, videoAttachmentSchema, colorAttachmentSchema, gradientAttachmentSchema, layoutAttachmentSchema, stackLayoutSchema, floatLayoutSchema, splitLayoutSchema, wallpaperLayoutSchema, sectionLayoutVariantSchema, layoutSurfaceSchema, sectionLayoutSchema, LayoutAttachmentTypes, LayoutTypes, type FocalPoint, type ImageAttachment, type VideoAttachment, type ColorAttachment, type GradientAttachment, type LayoutAttachment, type StackLayout, type FloatLayout, type SplitLayout, type WallpaperLayout, type SectionLayoutVariant, type LayoutSurface, type SectionLayout, } from "./schemas/fields/layout-schema";
|
|
8
8
|
export { translationEntrySchema, ratingQuestionTranslationSchema, singleChoiceQuestionTranslationSchema, multipleChoiceQuestionTranslationSchema, npsQuestionTranslationSchema, shortAnswerQuestionTranslationSchema, longAnswerQuestionTranslationSchema, videoAudioQuestionTranslationSchema, dateQuestionTranslationSchema, signatureQuestionTranslationSchema, schedulerQuestionTranslationSchema, qnaWithAiQuestionTranslationSchema, paymentsUpiQuestionTranslationSchema, nestedSelectionQuestionTranslationSchema, annotationQuestionTranslationSchema, welcomeQuestionTranslationSchema, thankYouQuestionTranslationSchema, messagePanelQuestionTranslationSchema, yesNoQuestionTranslationSchema, consentQuestionTranslationSchema, ratingMatrixQuestionTranslationSchema, matrixSingleChoiceQuestionTranslationSchema, matrixMultipleChoiceQuestionTranslationSchema, questionTranslationSchema, sectionTranslationSchema, sectionTranslationsByLanguageSchema, questionCentricTranslationsSchema, translationsSchema, TranslationProvider, createTranslationProvider, type TranslationEntry, type RatingQuestionTranslation, type SingleChoiceQuestionTranslation, type MultipleChoiceQuestionTranslation, type NpsQuestionTranslation, type ShortAnswerQuestionTranslation, type LongAnswerQuestionTranslation, type VideoAudioQuestionTranslation, type DateQuestionTranslation, type SignatureQuestionTranslation, type SchedulerQuestionTranslation, type QnaWithAiQuestionTranslation, type PaymentsUpiQuestionTranslation, type NestedSelectionQuestionTranslation, type AnnotationQuestionTranslation, type WelcomeQuestionTranslation, type ThankYouQuestionTranslation, type MessagePanelQuestionTranslation, type YesNoQuestionTranslation, type ConsentQuestionTranslation, type RatingMatrixQuestionTranslation, type MatrixSingleChoiceQuestionTranslation, type MatrixMultipleChoiceQuestionTranslation, type QuestionTranslation, type SectionTranslation, type SectionTranslationsByLanguage, type QuestionCentricTranslations, type Translations, } from "./schemas/fields/translations-schema";
|
|
9
9
|
export { platformCompletionCtaSchema, completionCtaSecondarySchema, completionCtaSchema, type PlatformCompletionCta, type CompletionCtaSecondary, type CompletionCta, type CompletionCtaAction, } from "./schemas/fields/completion-cta-schema";
|
|
10
10
|
export { customEventFieldOperatorSchema, customEventFieldSchema, conditionalIfMetadataSchema, queryOutputSchema, conditionalIfSchema, triggerActionSchema, conditionalWhenSchema, filterConditionSchema, categorySpecificFiltersSchema, whoSchema, audienceSegmentSchema, audienceTriggerPropertiesSchema, type CustomEventFieldOperator, type CustomEventField, type ConditionalIfMetadata, type QueryOutput, type ConditionalIf, type TriggerAction, type ConditionalWhen, type FilterCondition, type CategorySpecificFilters, type Who, type AudienceSegment, type AudienceTriggerProperties, } from "./schemas/fields/auto-trigger-schema";
|
|
11
11
|
export { masterPropertiesSchema, type MasterProperties, } from "./schemas/fields/other-properties-schema";
|
|
12
12
|
export { deviceThemeSchema, deviceInfoSchema, sessionInfoSchema, deviceSessionInfoSchema, userPropertiesSchema, userInfoSchema, DeviceThemes, type DeviceTheme, type DeviceInfo, type SessionInfo, type DeviceSessionInfo, type UserProperties, type UserInfo, } from "./schemas/api/other-schema";
|
|
13
|
-
export { formConfigSchema, questionResponseSchema, responseSchema, matchedTriggerPropertiesSchema, baseSubmitFeedbackSchema, partialFeedbackSchema, submitFeedbackSchema, feedbackRequestSchema, type FormConfig, type QuestionResponse, type Response, type MatchedTriggerProperties, type BaseSubmitFeedback, type PartialFeedback, type SubmitFeedback, type FeedbackRequest, } from "./schemas/api/submit-feedback-schema";
|
|
13
|
+
export { formConfigSchema, questionResponseSchema, responseSchema, matchedTriggerPropertiesSchema, baseSubmitFeedbackSchema, partialFeedbackSchema, submitFeedbackSchema, feedbackRequestSchema, formDetailsSchema, submitFormRequestSchema, type FormConfig, type QuestionResponse, type Response, type MatchedTriggerProperties, type BaseSubmitFeedback, type PartialFeedback, type SubmitFeedback, type FeedbackRequest, type FormDetails, type FormDetailsResponse, type SubmitFormRequest, } from "./schemas/api/submit-feedback-schema";
|
|
14
14
|
export { feedbackConfigurationItemSchema, fetchFormConfigSchema, fetchConfigurationListSchema, fetchFeedbackDetailsSchema, formConfigurationResponseSchema, questionnaireFieldsResponseSchema, fetchFeedbackDetailsResponseSchema, fetchConfigurationListResponseSchema, logicJumpRuleSchema, logicJumpRulesSchema, type FeedbackConfigurationItem, type FetchFormConfig, type FetchConfigurationListRequest, type FetchFeedbackDetailsRequest, type FormConfigurationResponse, type QuestionnaireFieldsResponse, type FetchFeedbackDetailsResponse, type FetchConfigurationListResponse, type LogicJumpRule, type LogicJumpRules, } from "./schemas/api/fetch-feedback-schema";
|
|
15
15
|
export { RefineTextParams, RefineTextResponse, RefineTextData, refineTextDataSchema, refineTextParamsSchema, refineTextResponseSchema, } from "./schemas/api/refine-text-schema";
|
|
16
16
|
export { objectToCamel, objectToSnake, toSnake, toCamel, toPascal, objectToPascal, } from "./helpers/case-convert-helper";
|
|
17
17
|
export type { ObjectToCamel, ObjectToSnake, ToSnake, ToCamel, ToPascal, ObjectToPascal, } from "./helpers/case-convert-helper";
|
|
18
|
+
export { CSAT_DEFAULT_EMOJIS_BY_SCALE, CSAT_EMOJI_CATEGORIES, CSAT_EMOJI_PALETTE, getCsatEmojiForPoint, getDefaultOverrideEmojiForScale, isCsatEmojiPaletteItem, parseOverrideEmoji, resolveCsatEmojis, serializeOverrideEmoji, trimOverrideEmojiForScale, validateOverrideEmojiForScale, type CsatEmojiCategory, type CsatEmojiPaletteItem, } from "./helpers/csat-emoji-helper";
|
|
18
19
|
export { currentModeSchema, appPropsSchema, CurrentModes, type CurrentMode, type AppProps, } from "./schemas/fields/app-props-schema";
|
|
19
20
|
export { z } from "zod";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile-time helpers used to guarantee that the hand-authored, Zod-free
|
|
3
|
+
* public interfaces stay in lock-step with their Zod `z.infer` counterparts.
|
|
4
|
+
*
|
|
5
|
+
* These are pure type-level utilities โ they emit no runtime code and are never
|
|
6
|
+
* re-exported from the package entrypoint, so they never leak into consumer
|
|
7
|
+
* (SDK) type bundles.
|
|
8
|
+
*/
|
|
9
|
+
/** True when `A` and `B` are mutually assignable (tuple-wrapped to avoid union distribution). */
|
|
10
|
+
export type MutuallyAssignable<A, B> = [A] extends [B] ? [B] extends [A] ? true : false : false;
|
|
11
|
+
/** True when `A` and `B` expose the exact same set of top-level keys. */
|
|
12
|
+
export type SameKeys<A, B> = [keyof A] extends [keyof B] ? [keyof B] extends [keyof A] ? true : false : false;
|
|
13
|
+
/**
|
|
14
|
+
* True when interface `I` is a faithful, drift-free representation of schema
|
|
15
|
+
* type `S` โ i.e. structurally interchangeable AND with an identical key set.
|
|
16
|
+
*/
|
|
17
|
+
export type MatchesSchema<I, S> = MutuallyAssignable<I, S> extends true ? SameKeys<I, S> extends true ? true : false : false;
|
|
18
|
+
/** Compiles only when `T` is exactly `true`; otherwise raises a type error. */
|
|
19
|
+
export type AssertTrue<T extends true> = T;
|