Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/sessionize

src/types.ts

256 lines · 5.3 KB · TypeScript
export const SESSIONIZE_API_ORIGIN = 'https://sessionize.com'
export const SESSIONIZE_DEMO_ENDPOINT_ID = 'jl4ktls0'
export const SESSIONIZE_VIEWS = [
	'All',
	'Sessions',
	'Speakers',
	'GridSmart',
] as const

/**
 * Describe the shared Sessionize type exports.
 *
 * @example
 * import describeSessionizeTypes from 'kody:@kody/sessionize/types'
 * const info = describeSessionizeTypes()
 * // => { demoEndpointId: 'jl4ktls0', views: ['All', 'Sessions', 'Speakers', 'GridSmart'] }
 */
export default function describeSessionizeTypes() {
	return {
		demoEndpointId: SESSIONIZE_DEMO_ENDPOINT_ID,
		apiOrigin: SESSIONIZE_API_ORIGIN,
		views: SESSIONIZE_VIEWS,
	}
}

export type SessionizeView = (typeof SESSIONIZE_VIEWS)[number]

export type SessionizeLink = {
	title: string
	url: string
	linkType: string
}

export type SessionizeRoom = {
	id: number
	name: string
	sort: number
}

export type SessionizeCategoryItem = {
	id: number
	name: string
	sort?: number
}

export type SessionizeCategory = {
	id: number
	title: string
	type: string
	sort?: number
	items: Array<SessionizeCategoryItem>
}

export type SessionizeQuestion = {
	id: number
	question: string
	questionType: string
	sort: number
}

export type SessionizeQuestionAnswer = {
	questionId: number
	answerValue: string
}

export type SessionizeSpeakerRef = {
	id: string
	name: string
}

export type SessionizeCategoryRef = {
	id: number
	name: string
	sort?: number
	categoryItems: Array<{ id: number; name: string }>
}

export type SessionizeAllSession = {
	id: string
	title: string
	description: string | null
	startsAt: string | null
	endsAt: string | null
	isServiceSession: boolean
	isPlenumSession: boolean
	speakers: Array<string>
	categoryItems: Array<number>
	questionAnswers: Array<SessionizeQuestionAnswer>
	roomId: number | null
	liveUrl: string | null
	recordingUrl: string | null
	status: string | null
}

export type SessionizeAllSpeaker = {
	id: string
	firstName: string
	lastName: string
	fullName: string
	bio: string | null
	tagLine: string | null
	profilePicture: string | null
	isTopSpeaker: boolean
	links: Array<SessionizeLink>
	sessions: Array<number | string>
	questionAnswers: Array<SessionizeQuestionAnswer>
}

export type SessionizeAllResult = {
	sessions: Array<SessionizeAllSession>
	speakers: Array<SessionizeAllSpeaker>
	questions: Array<SessionizeQuestion>
	categories: Array<SessionizeCategory>
	rooms: Array<SessionizeRoom>
}

export type SessionizeListedSession = {
	id: string
	title: string
	description: string | null
	startsAt: string | null
	endsAt: string | null
	isServiceSession: boolean
	isPlenumSession: boolean
	speakers: Array<SessionizeSpeakerRef>
	categories: Array<SessionizeCategoryRef>
	roomId: number | null
	room: string | null
	liveUrl: string | null
	recordingUrl: string | null
	status: string | null
}

export type SessionizeSessionGroup = {
	groupId: number
	groupName: string
	isDefault: boolean
	sessions: Array<SessionizeListedSession>
}

export type SessionizeListedSpeaker = {
	id: string
	firstName: string
	lastName: string
	fullName: string
	bio: string | null
	tagLine: string | null
	profilePicture: string | null
	isTopSpeaker: boolean
	links: Array<SessionizeLink>
	sessions: Array<{ id: number | string; name: string }>
	questionAnswers: Array<unknown>
}

export type SessionizeScheduleSession = {
	id: string
	title: string
	description: string | null
	startsAt: string | null
	endsAt: string | null
	isServiceSession: boolean
	isPlenumSession: boolean
	speakers: Array<SessionizeSpeakerRef>
	roomId: number | null
	room: string | null
	status: string | null
}

export type SessionizeScheduleRoom = {
	id: number
	name: string
	hasOnlyPlenumSessions?: boolean
	sessions: Array<SessionizeScheduleSession>
}

export type SessionizeScheduleDay = {
	date: string
	isDefault: boolean
	rooms: Array<SessionizeScheduleRoom>
	timeSlots: Array<{
		slotStart: string
		rooms: Array<SessionizeScheduleRoom>
	}>
}

export type EndpointInput = {
	/** Sessionize API / Embed endpoint id from `/api/v2/<id>/view/All`. */
	endpointId: string
}

export type SlimSession = {
	id: string
	title: string
	startsAt: string | null
	endsAt: string | null
	roomId: number | null
	room: string | null
	speakers: Array<SessionizeSpeakerRef>
	categories: Array<{ name: string; values: Array<string> }>
	isServiceSession: boolean
	isPlenumSession: boolean
	status: string | null
}

export type SlimSpeaker = {
	id: string
	fullName: string
	firstName: string
	lastName: string
	tagLine: string | null
	isTopSpeaker: boolean
	profilePicture: string | null
	links: Array<SessionizeLink>
	sessionIds: Array<string>
	sessionTitles: Array<string>
}

export type EventSummary = {
	endpointId: string
	sessionCount: number
	speakerCount: number
	roomCount: number
	categoryCount: number
	rooms: Array<{ id: number; name: string }>
	categories: Array<{
		id: number
		title: string
		type: string
		items: Array<{ id: number; name: string }>
	}>
	sessions: Array<SlimSession>
	speakers: Array<SlimSpeaker>
}

export type ScheduleSlot = {
	startsAt: string | null
	endsAt: string | null
	roomId: number | null
	room: string | null
	session: {
		id: string
		title: string
		isServiceSession: boolean
		isPlenumSession: boolean
		speakers: Array<SessionizeSpeakerRef>
	}
}

export type EventSchedule = {
	endpointId: string
	days: Array<{
		date: string
		rooms: Array<{ id: number; name: string }>
		slots: Array<ScheduleSlot>
	}>
}