From a05fe8b2ff0edd508fd521cd2dfc9e43bcbf1660 Mon Sep 17 00:00:00 2001 From: rohanharikr Date: Wed, 3 Jul 2024 13:41:26 +0100 Subject: [PATCH] invite section --- src/App.svelte | 75 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 170d27f..2b43cec 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -220,7 +220,7 @@ //this is so we can reset query params to original state const defaultQueryParamStates = { query_params: ["client_id", "redirect_uri", "nonce", "response_type"], - invite_query_params: ["inviter", "client_id", "initiate_login_uri", "events_uri", "return_uri"], + invite_query_params: ["inviter", "client_id", "initiate_login_uri", "return_uri"], query_param_values: { ...queryParams.params, client_id: clientIds.playground, @@ -240,9 +240,8 @@ invite_query_param_values: { ...inviteQueryParams.params, client_id: clientIds.playground, - initiate_login_uri: "https://playground.hello.dev/initiate-login", - events_uri: "https://playground.hello.dev/initiate-login", - return_uri: "https://playground.hello.dev/profile" + initiate_login_uri: "https://playground.hello.dev/", + return_uri: "https://playground.hello.dev/" }, }; @@ -685,6 +684,8 @@ localStorage.removeItem("states"); window.location.reload(); } + + $: canInvite = states.invite_query_param_values.inviter && states.scopes.includes('openid') && states.scopes.includes('name') && states.scopes.includes('email'); ō   Continue with Hellō + +
+ + {#if canInvite} +
+

+ Invite URL + +

+ + {inviteURL} + +
+ {/if} + + +
@@ -1024,7 +1074,7 @@
    {#each Object.entries(queryParams.params) as [param, value]} {#if param === "provider_hint"} -
    +
    {/if} {@const required = queryParams.required.includes(param)}
  • ō   Continue with Hellō + +

    + {#if canInvite} + Use this to test sending invitations + {:else} + To invite others, your must be logged in
    with `name` and `email` scopes + {/if} +

    {#if (result.introspect?.sub || states.invite_query_param_values.inviter) && localStorage.plausible_ignore == "true"}