Skip to content

Commit

Permalink
fix: hello flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanharikr committed Dec 23, 2024
1 parent 2244e39 commit 1736518
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/lib/components/Request/AuthorizationServer.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { slide } from 'svelte/transition';
import { AUTHZ_SERVERS } from '$lib/constants.js';
import { AUTHZ_SERVERS, HAS_HELLO_DEV_FLAG } from '$lib/constants.js';
import ChevronY from '$components/ChevronY.svelte';
import CopyButton from '../CopyButton.svelte';
import { validateAuthzServer as validate } from '$lib/validate';
Expand All @@ -22,9 +22,10 @@
<ChevronY dir={dropdowns.server ? 'up' : 'down'} />
</button>
{#if dropdowns.server}
{@const showHelloExtended = HAS_HELLO_DEV_FLAG && isHelloMode}
{@const ALL_AUTHZ_SERVERS = [
...AUTHZ_SERVERS.SERVERS,
...(isHelloMode ? AUTHZ_SERVERS.HELLO_EXTEND_SERVERS : [])
...(showHelloExtended ? AUTHZ_SERVERS.HELLO_EXTEND_SERVERS : [])
]}
<ul class="space-y-2 mt-2" transition:slide|local={{ duration: 150 }}>
{#each ALL_AUTHZ_SERVERS as server}
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/Request/HelloParams.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { slide } from 'svelte/transition';
import { PARAMS } from '$lib/constants.js';
import { PARAMS, HAS_HELLO_DEV_FLAG } from '$lib/constants.js';
import ChevronY from '$components/ChevronY.svelte';
import Tooltip from '$components/Tooltip.svelte';
import ProviderHintInput from '$components/Inputs/ProviderHintInput.svelte';
Expand Down Expand Up @@ -29,9 +29,10 @@
/>
</button>
{#if dropdowns.hello}
{@const showHelloExtended = HAS_HELLO_DEV_FLAG && isHelloMode}
{@const ALL_HELLO_PARAMS = [
...PARAMS.HELLO_PARAM.PARAMS,
...(isHelloMode ? PARAMS.HELLO_PARAM.HELLO_EXTEND_PARAMS : [])
...(showHelloExtended ? PARAMS.HELLO_PARAM.HELLO_EXTEND_PARAMS : [])
]}
<ul class="flex flex-col justify-center mt-2 space-y-2" transition:slide={{ duration: 150 }}>
{#each ALL_HELLO_PARAMS as param}
Expand Down
9 changes: 5 additions & 4 deletions src/lib/components/Request/ScopeParam.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { slide } from 'svelte/transition';
import { PARAMS } from '$lib/constants.js';
import { PARAMS, HAS_HELLO_DEV_FLAG } from '$lib/constants.js';
import ChevronY from '$components/ChevronY.svelte';
import Tooltip from '$components/Tooltip.svelte';
import { validateScopes as validate } from '$lib/validate.js';
Expand All @@ -24,7 +24,7 @@
>
<span class="font-medium text-base"> Scope Parameter </span>
<ChevronY dir={dropdowns.scope ? 'up' : 'down'} />
<Tooltip content="Scope Parameter Docs" , href="https://www.hello.dev/docs/scopes/" />
<Tooltip content="Scope Parameter Docs" href="https://www.hello.dev/docs/scopes/" />
</button>

{#if isOverridden}
Expand All @@ -34,13 +34,14 @@
{/if}

{#if dropdowns.scope}
{@const showHelloExtended = HAS_HELLO_DEV_FLAG && isHelloMode}
{@const ALL_STANDARD_SCOEPS = [
...PARAMS.SCOPE_PARAM.STANDARD,
...(isHelloMode ? PARAMS.SCOPE_PARAM.HELLO_EXTEND_STANDARD : [])
...(showHelloExtended ? PARAMS.SCOPE_PARAM.HELLO_EXTEND_STANDARD : [])
]}
{@const ALL_NON_STANDARD_SCOPES = [
...PARAMS.SCOPE_PARAM.NON_STANDARD,
...(isHelloMode ? PARAMS.SCOPE_PARAM.HELLO_EXTEND_NON_STANDARD : [])
...(showHelloExtended ? PARAMS.SCOPE_PARAM.HELLO_EXTEND_NON_STANDARD : [])
]}
<div
class="flex mt-2 space-x-2"
Expand Down
4 changes: 3 additions & 1 deletion src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,6 @@ const AUTHZ_SERVERS = {
]
};

export { PARAMS, AUTHZ_SERVERS, PROFILE_CLAIMS };
const HAS_HELLO_DEV_FLAG = localStorage.getItem('plausible_ignore') === 'true';

export { PARAMS, AUTHZ_SERVERS, PROFILE_CLAIMS, HAS_HELLO_DEV_FLAG };

0 comments on commit 1736518

Please sign in to comment.