|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getAccountChooserUrl( emailOrDomain, service, url, template ) { |
|
|
const accountChooserUrl = new URL( 'https://accounts.google.com/AccountChooser' ); |
|
|
|
|
|
accountChooserUrl.searchParams.append( 'service', service ); |
|
|
accountChooserUrl.searchParams.append( 'continue', url ); |
|
|
|
|
|
if ( emailOrDomain.includes( '@' ) ) { |
|
|
accountChooserUrl.searchParams.append( 'Email', emailOrDomain ); |
|
|
} else { |
|
|
accountChooserUrl.searchParams.append( 'hd', emailOrDomain ); |
|
|
} |
|
|
|
|
|
if ( template ) { |
|
|
accountChooserUrl.searchParams.append( 'ltmpl', template ); |
|
|
} |
|
|
|
|
|
return accountChooserUrl.href; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getGmailUrl( emailOrDomain ) { |
|
|
return getAccountChooserUrl( emailOrDomain, 'mail', 'https://mail.google.com/mail/' ); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getGoogleAdminUrl( emailOrDomain ) { |
|
|
return getAccountChooserUrl( emailOrDomain, 'CPanel', 'https://admin.google.com/' ); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getGoogleAdminWithTosUrl( domainName ) { |
|
|
return getAccountChooserUrl( |
|
|
domainName, |
|
|
'CPanel', |
|
|
`https://admin.google.com/${ domainName }/AcceptTermsOfService` |
|
|
); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getGoogleCalendarUrl( emailOrDomain ) { |
|
|
return getAccountChooserUrl( emailOrDomain, 'cl', 'https://calendar.google.com/calendar/' ); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getGoogleDocsUrl( emailOrDomain ) { |
|
|
return getAccountChooserUrl( emailOrDomain, 'wise', 'https://docs.google.com/document/', 'docs' ); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getGoogleDriveUrl( emailOrDomain ) { |
|
|
return getAccountChooserUrl( emailOrDomain, 'wise', 'https://drive.google.com/drive/' ); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getGoogleSheetsUrl( emailOrDomain ) { |
|
|
return getAccountChooserUrl( |
|
|
emailOrDomain, |
|
|
'wise', |
|
|
'https://docs.google.com/spreadsheets/', |
|
|
'sheets' |
|
|
); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getGoogleSlidesUrl( emailOrDomain ) { |
|
|
return getAccountChooserUrl( |
|
|
emailOrDomain, |
|
|
'wise', |
|
|
'https://docs.google.com/presentation/', |
|
|
'slides' |
|
|
); |
|
|
} |
|
|
|