-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathconfigSchema.ts
More file actions
83 lines (75 loc) · 2.67 KB
/
configSchema.ts
File metadata and controls
83 lines (75 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { array, boolean, number, object, type ObjectSchema, string } from 'yup';
import type { Cleeng, Config, Content, Features, JWP, Menu, Styling } from '../../types/config';
const contentSchema: ObjectSchema<Content> = object({
contentId: string().optional(),
title: string().optional(),
featured: boolean().optional(),
backgroundColor: string().nullable().optional(),
type: string().oneOf(['playlist', 'continue_watching', 'favorites', 'content_list']).required(),
custom: object().optional(),
filterTags: string().optional(),
}).defined();
const menuSchema: ObjectSchema<Menu> = object().shape({
label: string().defined(),
contentId: string().defined(),
filterTags: string().optional(),
type: string().oneOf(['playlist', 'content_list', 'media']).optional(),
custom: object().optional(),
});
const featuresSchema: ObjectSchema<Features> = object({
recommendationsPlaylist: string().nullable(),
searchPlaylist: string().nullable(),
continueWatchingList: string().nullable(),
favoritesList: string().nullable(),
});
const cleengSchema: ObjectSchema<Cleeng> = object({
id: string().nullable(),
monthlyOffer: string().nullable(),
yearlyOffer: string().nullable(),
useSandbox: boolean().default(true),
});
const jwpSchema: ObjectSchema<JWP> = object({
clientId: string().nullable(),
assetId: number().nullable(),
useSandbox: boolean().default(true),
});
const stylingSchema: ObjectSchema<Styling> = object({
backgroundColor: string().nullable(),
highlightColor: string().nullable(),
headerBackground: string().nullable(),
footerText: string().nullable(),
});
export const configSchema: ObjectSchema<Config> = object({
id: string().optional(),
siteName: string().optional(),
description: string().defined(),
analyticsToken: string().notRequired(),
adConfig: string().notRequired(),
adSchedule: string().notRequired(),
adScheduleUrls: object({
json: string().notRequired().nullable(),
xml: string().notRequired().nullable(),
}).optional(),
adDeliveryMethod: string().oneOf(['csai', 'ssai']).optional(),
siteId: string().defined(),
assets: object({
banner: string().notRequired(),
}),
content: array().of(contentSchema).defined(),
menu: array().of(menuSchema).defined(),
styling: stylingSchema.notRequired(),
features: featuresSchema.notRequired(),
integrations: object({
cleeng: cleengSchema.optional(),
jwp: jwpSchema.optional(),
}),
custom: object().notRequired(),
contentProtection: object()
.shape({
accessModel: string().oneOf(['free', 'freeauth', 'authvod', 'svod']).defined(),
drm: object({
defaultPolicyId: string().defined(),
}).optional(),
})
.optional(),
}).defined();