diff --git a/.changeset/new-teachers-reflect.md b/.changeset/new-teachers-reflect.md new file mode 100644 index 00000000000..701998797bd --- /dev/null +++ b/.changeset/new-teachers-reflect.md @@ -0,0 +1,5 @@ +--- +'@clerk/clerk-js': minor +--- + +Add a confirmation state that the Application has been successfully claimed on the Keyless prompt. diff --git a/packages/clerk-js/src/ui/components/KeylessPrompt/index.tsx b/packages/clerk-js/src/ui/components/KeylessPrompt/index.tsx index d4dbb690918..bf2c3a3f2b7 100644 --- a/packages/clerk-js/src/ui/components/KeylessPrompt/index.tsx +++ b/packages/clerk-js/src/ui/components/KeylessPrompt/index.tsx @@ -24,7 +24,10 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => { const [isExpanded, setIsExpanded] = useState(false); const claimed = Boolean(useRevalidateEnvironment().authConfig.claimedAt); - const isForcedExpanded = claimed || isExpanded; + const success = false; + const appName = useRevalidateEnvironment().displayConfig.applicationName; + + const isForcedExpanded = claimed || success || isExpanded; const baseElementStyles = css` box-sizing: border-box; @@ -50,6 +53,32 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => { text-decoration: none; `; + const mainCTAStyles = css` + ${baseElementStyles}; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 1.75rem; + max-width: 14.625rem; + padding: 0.25rem 0.625rem; + border-radius: 0.375rem; + font-size: 0.75rem; + font-weight: 500; + letter-spacing: 0.12px; + color: ${claimed ? 'white' : success ? 'white' : '#fde047'}; + text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.32); + white-space: nowrap; + user-select: none; + background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30.5%, rgba(0, 0, 0, 0.05) 100%), #454545; + box-shadow: + 0px 0px 0px 1px rgba(255, 255, 255, 0.04) inset, + 0px 1px 0px 0px rgba(255, 255, 255, 0.04) inset, + 0px 0px 0px 1px rgba(0, 0, 0, 0.12), + 0px 1.5px 2px 0px rgba(0, 0, 0, 0.48), + 0px 0px 4px 0px rgba(243, 107, 22, 0) inset; + `; + return ( { flexDirection: 'column', alignItems: 'flex-center', justifyContent: 'flex-center', - height: '8.75rem', + height: success ? 'fit-content' : '8.563rem', overflow: 'hidden', width: 'fit-content', minWidth: '16.125rem', @@ -108,7 +137,31 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => { gap: t.space.$2, })} > - {claimed ? ( + {success ? ( + + + + + + + ) : claimed ? ( {

{ cursor: pointer; ${!claimed && + !success && `&::after { content: attr(data-text); z-index: 1; @@ -218,7 +278,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => { transparent 60%, transparent 100% ); - background-size: 260% 100%; + background-size: 275% 100%; background-clip: text; filter: blur(1.2px); animation: text-shimmer 12s 1s 1 ease-out forwards; @@ -244,7 +304,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => { transparent 65%, transparent 100% ); - background-size: 260% 100%; + background-size: 275% 100%; background-clip: text; animation: text-shimmer 12s 1s 1 ease-out forwards; -webkit-user-select: none; @@ -276,7 +336,11 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => { `}; `} > - {claimed ? 'Missing environment keys' : 'Clerk is in keyless mode'} + {success + ? 'Application claim completed' + : claimed + ? 'Missing environment keys' + : 'Clerk is in keyless mode'}

@@ -290,7 +354,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => { css={css` color: #8c8c8c; transition: color 130ms ease-out; - display: ${isExpanded && !claimed ? 'block' : 'none'}; + display: ${isExpanded && !claimed && !success ? 'block' : 'none'}; :hover { color: #eeeeee; @@ -352,7 +416,24 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => { } `} > - {claimed ? ( + {success ? ( + <> + Your application{' '} + + {appName} + {' '} + has been successfully claimed. + + ) : claimed ? ( <> You claimed this application but haven't set keys in your environment. Get them from the Clerk Dashboard. @@ -365,67 +446,58 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {

- {isForcedExpanded && ( - + Dismiss + + ) : ( + - {claimed ? 'Get API keys' : 'Claim application'} - - )} + } + `} + > + {claimed ? 'Get API keys' : 'Claim application'} + + ))}