2024-04-07 06:08:34 +01:00
|
|
|
import { goto } from '$app/navigation';
|
2025-11-24 01:00:50 +01:00
|
|
|
import { resolve } from '$app/paths';
|
2024-04-07 06:08:34 +01:00
|
|
|
|
2023-09-11 11:47:30 +01:00
|
|
|
export function genQuizPin(): number {
|
2025-11-01 15:49:29 +01:00
|
|
|
const minm = 100000;
|
|
|
|
|
const maxm = 999999;
|
2023-09-11 11:47:30 +01:00
|
|
|
return Math.floor(Math.random() * (maxm - minm + 1)) + minm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function generateSitename(orgName: string): string {
|
|
|
|
|
return orgName
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.replace(/\s+/g, '-')
|
|
|
|
|
.replace(/[^a-zA-Z0-9-]/g, '');
|
|
|
|
|
}
|
2024-04-07 06:08:34 +01:00
|
|
|
|
|
|
|
|
export function openUpgradeModal() {
|
|
|
|
|
const url = new URL(window.location.href);
|
|
|
|
|
|
|
|
|
|
url.searchParams.set('upgrade', 'true');
|
|
|
|
|
|
|
|
|
|
const searchParams = url.searchParams.toString();
|
|
|
|
|
|
2025-11-24 01:00:50 +01:00
|
|
|
goto(resolve(window.location.pathname + `?${searchParams}`, {}));
|
|
|
|
|
}
|