File tree Expand file tree Collapse file tree 4 files changed +16
-26
lines changed
backend/src/api/endpoints Expand file tree Collapse file tree 4 files changed +16
-26
lines changed Original file line number Diff line number Diff line change @@ -5,26 +5,21 @@ import { AbstractAPI } from './AbstractApi';
55const basePath = '/accountless_applications' ;
66
77export class AccountlessApplicationAPI extends AbstractAPI {
8- public async createAccountlessApplication ( headers : Headers ) {
9- const headerParams = headers instanceof Headers ? Object . fromEntries ( headers . entries ( ) ) : undefined ;
8+ public async createAccountlessApplication ( params ?: { requestHeaders ?: Headers } ) {
9+ const headerParams = params ?. requestHeaders ? Object . fromEntries ( params . requestHeaders . entries ( ) ) : undefined ;
1010 return this . request < AccountlessApplication > ( {
1111 method : 'POST' ,
1212 path : basePath ,
1313 headerParams,
1414 } ) ;
1515 }
1616
17- public async completeAccountlessApplicationOnboarding ( headers : Headers ) {
18- const headerParams = headers instanceof Headers ? Object . fromEntries ( headers . entries ( ) ) : undefined ;
19-
17+ public async completeAccountlessApplicationOnboarding ( params ?: { requestHeaders ?: Headers } ) {
18+ const headerParams = params ?. requestHeaders ? Object . fromEntries ( params . requestHeaders . entries ( ) ) : undefined ;
2019 return this . request < AccountlessApplication > ( {
2120 method : 'POST' ,
2221 path : joinPaths ( basePath , 'complete' ) ,
2322 headerParams,
2423 } ) ;
2524 }
26-
27- public async abandonAccountlessApplication ( ) {
28- // TODO: Implement abandon functionality
29- }
3025}
Original file line number Diff line number Diff line change @@ -98,16 +98,15 @@ export const KeylessProvider = async (props: KeylessProviderProps) => {
9898 * If the request fails, it will be considered stale after 10 minutes, otherwise it is cached for 24 hours.
9999 */
100100 // Collect metadata
101- let keylessHeaders : Headers = new Headers ( ) ;
102- try {
103- const metadata = await collectKeylessMetadata ( ) ;
104- keylessHeaders = formatMetadataHeaders ( metadata ) ;
105- } catch {
106- // noop
107- }
101+ const keylessHeaders = await collectKeylessMetadata ( )
102+ . then ( formatMetadataHeaders )
103+ . catch ( ( ) => new Headers ( ) ) ;
108104
109105 await clerkDevelopmentCache ?. run (
110- ( ) => client . __experimental_accountlessApplications . completeAccountlessApplicationOnboarding ( keylessHeaders ) ,
106+ ( ) =>
107+ client . __experimental_accountlessApplications . completeAccountlessApplicationOnboarding ( {
108+ requestHeaders : keylessHeaders ,
109+ } ) ,
111110 {
112111 cacheKey : `${ newOrReadKeys . publishableKey } _complete` ,
113112 onSuccessStale : 24 * 60 * 60 * 1000 , // 24 hours
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export async function collectKeylessMetadata(): Promise<MetadataHeaders> {
2626 */
2727function getNextVersion ( ) : string | undefined {
2828 try {
29- return process . title ; // 'next-server (v15.4.5)'
29+ return process . title ?? 'unknown-process-title' ; // 'next-server (v15.4.5)'
3030 } catch {
3131 return undefined ;
3232 }
Original file line number Diff line number Diff line change @@ -137,16 +137,12 @@ async function createOrReadKeyless(): Promise<AccountlessApplication | null> {
137137 const client = createClerkClientWithOptions ( { } ) ;
138138
139139 // Collect metadata
140- let keylessHeaders : Headers = new Headers ( ) ;
141- try {
142- const metadata = await collectKeylessMetadata ( ) ;
143- keylessHeaders = formatMetadataHeaders ( metadata ) ;
144- } catch {
145- // Continue with empty headers if metadata header collection fails
146- }
140+ const keylessHeaders = await collectKeylessMetadata ( )
141+ . then ( formatMetadataHeaders )
142+ . catch ( ( ) => new Headers ( ) ) ;
147143
148144 const accountlessApplication = await client . __experimental_accountlessApplications
149- . createAccountlessApplication ( keylessHeaders )
145+ . createAccountlessApplication ( { requestHeaders : keylessHeaders } )
150146 . catch ( ( ) => null ) ;
151147
152148 if ( accountlessApplication ) {
You can’t perform that action at this time.
0 commit comments