-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
203 lines (181 loc) · 4.34 KB
/
index.ts
File metadata and controls
203 lines (181 loc) · 4.34 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// Layouts available in the grid
export const GridType = { FLUID: "fluid" } as const
export type GridType = (typeof GridType)[keyof typeof GridType]
export const TileSize = { SMALL: "small", MEDIUM: "medium", LARGE: "large" }
export type TileSize = (typeof TileSize)[keyof typeof TileSize]
export const PriorityType = { LOW: "low", MEDIUM: "medium", HIGH: "high" } as const //prettier-ignore
export type PriorityType = (typeof PriorityType)[keyof typeof PriorityType]
export const TemperatureView = {
Simple: "simple",
Detailed: "detailed",
Extreme: "extreme",
}
export type TemperatureView = (typeof TemperatureView)[keyof typeof TemperatureView] //prettier-ignore
export const TemperatureUnit = {
Celsius: "Celsius",
Fahrenheit: "Fahrenheit",
Kelvin: "Kelvin",
}
export type TemperatureUnit = (typeof TemperatureUnit)[keyof typeof TemperatureUnit] //prettier-ignore
export type AppRenderManifest = {
version: string
buildTime: string
file: string
hash: string
dataSchemaVersion: string
cssFile?: string
assetsBase?: string
isCached?: boolean
}
export type AppProps = {
manifest: AppRenderManifest
willUpdate: boolean
isCached: boolean
isStaleData: boolean
timeToStaleData?: string
initialState?: unknown
}
export type RendererModule = {
mount: (container: HTMLElement, props: AppProps) => void
update?: (state: unknown) => void
unmount?: (container: HTMLElement) => void
}
export type BaselineRenderer = {
manifest: AppRenderManifest
jsUrl: string
}
export type RendererMeta = {
active?: { hash?: string; version?: string; savedAt: number }
latest?: { hash?: string; version?: string; savedAt: number }
}
export type PriorityMap = Record<string, string>
export type CoordinatedData = unknown
export type CoordinatedPayload = {
schemaVersion: string
updatedAt: string
data?: CoordinatedData
}
export type Layout = {
name: string
responsiveLayouts: ResponsiveLayout[]
}
export type ResponsiveLayout = {
columnCount: number
tiles: Tile[]
}
export type Tile = {
hasAd: boolean
hasExcerpt: boolean
position: number
size: string
}
export type IAB = {
categories: string[]
taxonomy: string
}
export type FeedMeta = {
followedAt: number | null
iab: IAB | null
isBlocked: boolean
isFollowed: boolean
isInitiallyVisible: boolean
layout: Layout
receivedFeedRank: number
recommendations: DiscoveryItem[]
subtitle: string | null
title: string
}
export type DiscoverFeed = {
data: string[]
feeds: Record<string, FeedMeta>
inferredLocalModel: string | null
interestPicker: string | null
recommendedAt: number
surfaceId: string // could be an enum
}
// Discover item from activity feed
export type DiscoveryItem = {
corpusItemId: string
scheduledCorpusItemId: string
url: string
title: string
excerpt: string
topic: string
publisher: string
isTimeSensitive: boolean
imageUrl: string
imageSrcset?: string // Responsive srcset for cached Cloudinary images
originalImageUrl?: string // Original URL before Cloudinary transformation
iconUrl: string | null
tileId: number
receivedRank: number
features: unknown
priority?: string
}
export type DiscoverItemAction = {
name: string
icon?: string
action: () => void
}
export type SponsoredData = Record<string, SponsoredItem[]>
export type SponsoredSections = Record<string, string[]>
export type SponsoredItem = {
block_key: string
caps: {
cap_key: string
day: number
flight?: {
count: number
period: number
}
}
domain: string
excerpt: string
fetchTimestamp?: number
flight_id?: string
format: string
ranking: {
item_score: number
personalization_models: Record<string, number | undefined>
priority: number
}
raw_image_src?: string
image_url: string
shim?: {
click: string
impression: string
report: string
}
sponsor: string
title: string
url: string
}
export type Temperature = {
c: number
f: number
}
export type Conditions = {
url: string
summary: string
iconId: number
temperature: Temperature
}
export type Forecast = {
url: string
summary: string
high: Temperature
low: Temperature
}
export type WeatherData = {
title: string
url: string
provider: string
isSponsored: boolean
score: number
cityName: string
regionCode: string
currentConditions: Conditions
forecast: Forecast
requestId: string
source: string
}