You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
998 B
29 lines
998 B
export function audienceTicketUrl(_slug: string, ticketCode: string): string {
|
|
const origin = typeof window !== 'undefined' ? window.location.origin : ''
|
|
const code = encodeURIComponent(ticketCode)
|
|
return `${origin}/t/${code}`
|
|
}
|
|
|
|
export function audienceCheckinUrl(slug: string, sessionId?: number | null): string {
|
|
const origin = typeof window !== 'undefined' ? window.location.origin : ''
|
|
const basePath = (import.meta.env.BASE_URL || '/').replace(/\/$/, '')
|
|
const s = encodeURIComponent(slug)
|
|
const url = `${origin}${basePath}/c/${s}/checkin`
|
|
if (sessionId) return `${url}?session=${sessionId}`
|
|
return url
|
|
}
|
|
|
|
export function ticketCodeSuffix(ticketCode: string): string {
|
|
const t = ticketCode.trim()
|
|
if (!t) return ''
|
|
return t.slice(-4).toUpperCase()
|
|
}
|
|
|
|
export function extractTicketCode(raw: string): string {
|
|
const t = raw.trim()
|
|
if (!t) return ''
|
|
const match = t.match(/\/t\/([A-Za-z0-9_-]+)/i)
|
|
if (match?.[1]) return match[1]
|
|
return t.replace(/\s+/g, '')
|
|
}
|