hh-contracts 0.0.73 → 0.0.75
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/build/common/constants/{icon-keys.constant.js → icon.constants.js} +7 -1
- package/build/common/constants/index.js +1 -1
- package/build/common/constants/locales.constant.js +3 -3
- package/build/hotels/contracts/find-hotel.contract.js +2 -0
- package/build/hotels/contracts/index.js +1 -1
- package/build/hotels/hotel.model.js +1 -0
- package/build/hotels/hotels.api.js +7 -5
- package/build/hotels/index.js +2 -1
- package/build/hotels/sites/contracts/find-hotel-site-page-by-lang.contract.js +56 -0
- package/build/hotels/sites/contracts/index.js +17 -0
- package/build/hotels/sites/index.js +17 -0
- package/build/hotels/{contracts → themes/contracts}/find-hotel-theme.contract.js +5 -5
- package/build/hotels/themes/contracts/index.js +17 -0
- package/build/hotels/themes/index.js +1 -0
- package/build/index.js +1 -0
- package/build/pages/constants/block-type.constant.js +11 -0
- package/build/pages/constants/cta-actions.constant.js +7 -0
- package/build/pages/constants/hero.constants.js +15 -0
- package/build/pages/constants/image-loading.constant.js +8 -0
- package/build/pages/constants/index.js +21 -0
- package/build/pages/constants/media.constants.js +17 -0
- package/build/pages/index.js +18 -0
- package/build/pages/models/blocks/base-block.schema.js +44 -0
- package/build/pages/models/blocks/block.schemas.js +69 -0
- package/build/pages/models/blocks/cta.schema.js +80 -0
- package/build/pages/models/blocks/hero-block.schema.js +58 -0
- package/build/pages/models/blocks/html-block.schema.js +46 -0
- package/build/pages/models/blocks/index.js +22 -0
- package/build/pages/models/blocks/media.schemas.js +84 -0
- package/build/pages/models/index.js +18 -0
- package/build/pages/models/page.schema.js +62 -0
- package/common/constants/{icon-keys.constant.ts → icon.constants.ts} +8 -0
- package/common/constants/index.ts +1 -1
- package/common/constants/locales.constant.ts +1 -1
- package/hotels/contracts/find-hotel.contract.ts +1 -0
- package/hotels/contracts/index.ts +1 -1
- package/hotels/hotel.model.ts +1 -0
- package/hotels/hotels.api.ts +6 -4
- package/hotels/index.ts +2 -1
- package/hotels/sites/contracts/find-hotel-site-page-by-lang.contract.ts +26 -0
- package/hotels/sites/contracts/index.ts +1 -0
- package/hotels/sites/index.ts +1 -0
- package/hotels/themes/contracts/find-hotel-theme.contract.ts +13 -0
- package/hotels/themes/contracts/index.ts +1 -0
- package/hotels/themes/index.ts +1 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/pages/constants/block-type.constant.ts +11 -0
- package/pages/constants/cta-actions.constant.ts +5 -0
- package/pages/constants/hero.constants.ts +18 -0
- package/pages/constants/image-loading.constant.ts +8 -0
- package/pages/constants/index.ts +5 -0
- package/pages/constants/media.constants.ts +20 -0
- package/pages/index.ts +2 -0
- package/pages/models/blocks/base-block.schema.ts +11 -0
- package/pages/models/blocks/block.schemas.ts +57 -0
- package/pages/models/blocks/cta.schema.ts +58 -0
- package/pages/models/blocks/hero-block.schema.ts +27 -0
- package/pages/models/blocks/html-block.schema.ts +14 -0
- package/pages/models/blocks/index.ts +6 -0
- package/pages/models/blocks/media.schemas.ts +66 -0
- package/pages/models/index.ts +2 -0
- package/pages/models/page.schema.ts +31 -0
- package/hotels/contracts/find-hotel-theme.contract.ts +0 -13
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
IMAGE_LOADING,
|
|
4
|
+
IMAGE_LOADING_VALUES,
|
|
5
|
+
MEDIA_PRIORITIES,
|
|
6
|
+
MEDIA_PRIORITY_VALUES,
|
|
7
|
+
MEDIA_TYPES,
|
|
8
|
+
} from '../../constants';
|
|
9
|
+
|
|
10
|
+
// Базовые медиа типы
|
|
11
|
+
const BaseMediaSchema = z.object({
|
|
12
|
+
key: z.string(),
|
|
13
|
+
priority: z.array(z.enum(MEDIA_PRIORITY_VALUES)).default([MEDIA_PRIORITIES.all]),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const MediaSourceSchema = z.object({
|
|
17
|
+
src: z.url(),
|
|
18
|
+
media: z.string().optional(),
|
|
19
|
+
type: z.string().optional(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const ImageMediaSchema = BaseMediaSchema.extend({
|
|
23
|
+
type: z.literal(MEDIA_TYPES.image),
|
|
24
|
+
sources: z.array(MediaSourceSchema),
|
|
25
|
+
alt: z.string().optional(),
|
|
26
|
+
loading: z.enum(IMAGE_LOADING_VALUES).default(IMAGE_LOADING.lazy),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const VideoMediaSchema = BaseMediaSchema.extend({
|
|
30
|
+
type: z.literal(MEDIA_TYPES.video),
|
|
31
|
+
src: z.url(),
|
|
32
|
+
poster: z.url().optional(),
|
|
33
|
+
muted: z.boolean().default(true),
|
|
34
|
+
loop: z.boolean().default(false),
|
|
35
|
+
autoplay: z.boolean().default(true),
|
|
36
|
+
controls: z.boolean().default(false),
|
|
37
|
+
alt: z.string().optional(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const SliderImageSchema = z.object({
|
|
41
|
+
key: z.string(),
|
|
42
|
+
src: z.url(),
|
|
43
|
+
alt: z.string().optional(),
|
|
44
|
+
title: z.string().optional(),
|
|
45
|
+
description: z.string().optional(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const SliderMediaSchema = BaseMediaSchema.extend({
|
|
49
|
+
type: z.literal(MEDIA_TYPES.slider),
|
|
50
|
+
images: z.array(SliderImageSchema),
|
|
51
|
+
autoplay: z.boolean().default(true),
|
|
52
|
+
interval: z.number().min(1000).default(5000),
|
|
53
|
+
showDots: z.boolean().default(true),
|
|
54
|
+
showArrows: z.boolean().default(true),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const MediaSchema = z.discriminatedUnion('type', [
|
|
58
|
+
ImageMediaSchema,
|
|
59
|
+
VideoMediaSchema,
|
|
60
|
+
SliderMediaSchema,
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
export type TMediaConfig = z.infer<typeof MediaSchema>;
|
|
64
|
+
export type TImageMedia = z.infer<typeof ImageMediaSchema>;
|
|
65
|
+
export type TVideoMedia = z.infer<typeof VideoMediaSchema>;
|
|
66
|
+
export type TSliderMedia = z.infer<typeof SliderMediaSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { AppStatuses, LanguageKeysSchema, SlugSchema } from '../../common';
|
|
3
|
+
import { BlocksTranslationSchema, BlockSchema } from './blocks';
|
|
4
|
+
|
|
5
|
+
const MetaSchema = z.object({
|
|
6
|
+
slug: SlugSchema,
|
|
7
|
+
status: z.enum(AppStatuses.PAGE_VALUES),
|
|
8
|
+
revision: z.number().int().nonnegative().default(0),
|
|
9
|
+
revalidate: z.number().int().positive().default(300),
|
|
10
|
+
tags: z.array(z.string()).default([]),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const PageLangTranslationSchema = z.object({
|
|
14
|
+
seo: z
|
|
15
|
+
.object({
|
|
16
|
+
title: z.string().optional(),
|
|
17
|
+
description: z.string().optional(),
|
|
18
|
+
ogImage: z.string().optional(),
|
|
19
|
+
})
|
|
20
|
+
.default({}),
|
|
21
|
+
blocks: BlocksTranslationSchema.default({}),
|
|
22
|
+
});
|
|
23
|
+
const TranslationsSchema = z.record(LanguageKeysSchema, PageLangTranslationSchema);
|
|
24
|
+
|
|
25
|
+
export const PageSchema = z.object({
|
|
26
|
+
meta: MetaSchema,
|
|
27
|
+
blocks: z.array(BlockSchema),
|
|
28
|
+
translations: TranslationsSchema,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type TPage = z.infer<typeof PageSchema>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
import { HTTP_METHODS } from '../../common';
|
|
3
|
-
import { ThemePersistedSchema } from '../themes/theme.models';
|
|
4
|
-
import { HOTELS_API, HOTELS_CONTROLLER } from '../hotels.api';
|
|
5
|
-
|
|
6
|
-
export namespace FindHotelThemeContract {
|
|
7
|
-
export const getUrl = HOTELS_API.findTheme;
|
|
8
|
-
export const endpoint = HOTELS_CONTROLLER.endpoints.findTheme;
|
|
9
|
-
export const httpMethod = HTTP_METHODS.get;
|
|
10
|
-
|
|
11
|
-
export const ResponseSchema = ThemePersistedSchema;
|
|
12
|
-
export type TResponse = z.infer<typeof ResponseSchema>;
|
|
13
|
-
}
|