diff options
author | vnugent <public@vaughnnugent.com> | 2024-03-21 14:33:21 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-03-21 14:33:21 -0400 |
commit | f8aea6453ddb2d56c1ce2ecb6a9e67d1af523c2e (patch) | |
tree | b62d6086e93b8da32a1b5caa2c0981a1c1ed2518 /lib | |
parent | cc29bed99dc9e151315cce75e50d55dca306b532 (diff) |
feat: Add optional svg base64 icons for social OAuth2 connections
Diffstat (limited to 'lib')
-rw-r--r-- | lib/vnlib.browser/src/social/index.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/vnlib.browser/src/social/index.ts b/lib/vnlib.browser/src/social/index.ts index dac3cc9..7d80687 100644 --- a/lib/vnlib.browser/src/social/index.ts +++ b/lib/vnlib.browser/src/social/index.ts @@ -55,6 +55,7 @@ export interface SocialOAuthPortal { readonly id: string; readonly login: string; readonly logout?: string; + readonly icon?: string; } /** @@ -67,6 +68,10 @@ export interface OAuthMethod { */ readonly id: string; /** + * Optional bas64encoded icon image url for the method + */ + readonly icon?: string; + /** * Determines if the current flow is active for this method */ isActiveLogin(): boolean @@ -90,6 +95,10 @@ export interface SocialOauthMethod { */ readonly id: string /** + * Optional bas64encoded icon image url for the method + */ + readonly icon?: string + /** * The endpoint to submit the authentication request to */ loginUrl(): string @@ -214,7 +223,8 @@ export const fromSocialConnections = <T extends SocialOauthMethod>(methods: T[], return map(methods, method => { return{ id: method.id, - + icon: method.icon, + async beginLoginFlow() { //Prepare the login claim` const claim = await prepareLogin() @@ -314,6 +324,7 @@ export const fromSocialPortals = (portals: SocialOAuthPortal[]): SocialOauthMeth return map(portals, p => { return { id: p.id, + icon: p.icon, loginUrl : () => p.login, //Get the logout data from the server getLogoutData: () => ({ url: p.logout!, args: {}}), |