aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src/components/AppStoreDiscover/common.ts
blob: 277d4910e49598c09d1b0e7e6821d8e8ee2715ba (plain)
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
/**
 * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
import type { PropType } from 'vue'
import type { IAppDiscoverElement } from '../../constants/AppDiscoverTypes.ts'

import { APP_DISCOVER_KNOWN_TYPES } from '../../constants/AppDiscoverTypes.ts'

/**
 * Common Props for all app discover types
 */
export const commonAppDiscoverProps = {
	type: {
		type: String as PropType<IAppDiscoverElement['type']>,
		required: true,
		validator: (v: unknown) => typeof v === 'string' && APP_DISCOVER_KNOWN_TYPES.includes(v as never),
	},

	id: {
		type: String as PropType<IAppDiscoverElement['id']>,
		required: true,
	},

	date: {
		type: Number as PropType<IAppDiscoverElement['date']>,
		required: false,
		default: undefined,
	},

	expiryDate: {
		type: Number as PropType<IAppDiscoverElement['expiryDate']>,
		required: false,
		default: undefined,
	},

	headline: {
		type: Object as PropType<IAppDiscoverElement['headline']>,
		required: false,
		default: () => null,
	},

	link: {
		type: String as PropType<IAppDiscoverElement['link']>,
		required: false,
		default: () => null,
	},
} as const