@@ -156,25 +156,33 @@ export default function AppContent({
156156 // Check if we should actually fetch the token
157157 // Only fetch if the user is authenticated and has access token
158158 if ( ! tokens ?. accessToken ) {
159- console . log ( "No access token available, skipping Stripe Terminal token fetch" ) ;
159+ console . log (
160+ "No access token available, skipping Stripe Terminal token fetch" ,
161+ ) ;
160162 throw new Error ( "Authentication required for Stripe Terminal connection" ) ;
161163 }
162164
163165 // Check rate limiting
164166 if ( now - lastTokenFetch < TOKEN_FETCH_COOLDOWN ) {
165- const waitTime = Math . ceil ( ( TOKEN_FETCH_COOLDOWN - ( now - lastTokenFetch ) ) / 1000 ) ;
166- console . warn ( `Rate limited: Please wait ${ waitTime } seconds before retrying` ) ;
167+ const waitTime = Math . ceil (
168+ ( TOKEN_FETCH_COOLDOWN - ( now - lastTokenFetch ) ) / 1000 ,
169+ ) ;
170+ console . warn (
171+ `Rate limited: Please wait ${ waitTime } seconds before retrying` ,
172+ ) ;
167173 throw new Error (
168174 `Rate limited: Please wait ${ waitTime } seconds before retrying` ,
169175 ) ;
170176 }
171177
172178 if ( tokenFetchAttempts >= MAX_TOKEN_FETCH_ATTEMPTS ) {
173- console . error ( `Maximum token fetch attempts (${ MAX_TOKEN_FETCH_ATTEMPTS } ) exceeded` ) ;
179+ console . error (
180+ `Maximum token fetch attempts (${ MAX_TOKEN_FETCH_ATTEMPTS } ) exceeded` ,
181+ ) ;
174182 setTimeout ( ( ) => {
175183 setTokenFetchAttempts ( 0 ) ;
176184 setLastTokenFetch ( 0 ) ;
177- } , 60000 ) ;
185+ } , 60000 ) ;
178186 throw new Error (
179187 `Maximum token fetch attempts (${ MAX_TOKEN_FETCH_ATTEMPTS } ) exceeded. Please wait before retrying.` ,
180188 ) ;
@@ -195,13 +203,15 @@ export default function AppContent({
195203
196204 const newToken = token . terminal_connection_token . secret ;
197205 const newExpiry = now + TOKEN_CACHE_DURATION ;
198-
206+
199207 // Cache the token
200208 setCachedToken ( newToken ) ;
201209 setTokenExpiry ( newExpiry ) ;
202210 setTokenFetchAttempts ( 0 ) ;
203211
204- console . log ( "Successfully fetched and cached Stripe Terminal connection token" ) ;
212+ console . log (
213+ "Successfully fetched and cached Stripe Terminal connection token" ,
214+ ) ;
205215 return newToken ;
206216 } catch ( error ) {
207217 console . error ( "Token fetch failed:" , error ) ;
@@ -216,7 +226,9 @@ export default function AppContent({
216226 TOKEN_FETCH_COOLDOWN * Math . pow ( 2 , tokenFetchAttempts ) ,
217227 30000 ,
218228 ) ; // Max 30 seconds
219- console . warn ( `Rate limited (429). Please wait ${ Math . ceil ( backoffTime / 1000 ) } seconds before retrying.` ) ;
229+ console . warn (
230+ `Rate limited (429). Please wait ${ Math . ceil ( backoffTime / 1000 ) } seconds before retrying.` ,
231+ ) ;
220232 throw new Error (
221233 `Rate limited (429). Please wait ${ Math . ceil ( backoffTime / 1000 ) } seconds before retrying.` ,
222234 ) ;
@@ -273,8 +285,10 @@ export default function AppContent({
273285 // return;
274286 // }
275287 try {
276- const biometricsRequired = await AsyncStorage . getItem ( "biometrics_required" ) ;
277-
288+ const biometricsRequired = await AsyncStorage . getItem (
289+ "biometrics_required" ,
290+ ) ;
291+
278292 if ( biometricsRequired !== "true" ) {
279293 console . log ( "Biometric authentication not required, bypassing..." ) ;
280294 setIsAuthenticated ( true ) ;
0 commit comments