@quiltt/react-native 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,530 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { forwardRef, useRef, useState, useEffect, useCallback, useMemo, useImperativeHandle } from 'react';
3
+ import { StyleSheet, StatusBar, Platform, SafeAreaView, View, Text, Pressable, ActivityIndicator, Linking } from 'react-native';
4
+ import { useQuilttSession, ConnectorSDKEventType } from '@quiltt/react';
5
+ import { URL } from 'react-native-url-polyfill';
6
+ import { WebView } from 'react-native-webview';
7
+ import { smartEncodeURIComponent, isEncoded, getUserAgent, ErrorReporter, normalizeUrlEncoding, getErrorMessage } from '../utils/index.js';
8
+
9
+ var version = "5.0.2";
10
+
11
+ const AndroidSafeAreaView = ({ testId, children })=>/*#__PURE__*/ jsx(SafeAreaView, {
12
+ testID: testId,
13
+ style: styles$2.AndroidSafeArea,
14
+ children: children
15
+ });
16
+ const styles$2 = StyleSheet.create({
17
+ AndroidSafeArea: {
18
+ flex: 1,
19
+ backgroundColor: 'white',
20
+ paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0
21
+ }
22
+ });
23
+
24
+ const ErrorScreen = ({ testId, error, cta })=>/*#__PURE__*/ jsx(AndroidSafeAreaView, {
25
+ testId: testId,
26
+ children: /*#__PURE__*/ jsxs(View, {
27
+ style: [
28
+ styles$1.container,
29
+ styles$1.padding
30
+ ],
31
+ children: [
32
+ /*#__PURE__*/ jsxs(View, {
33
+ style: {
34
+ flex: 1,
35
+ justifyContent: 'center'
36
+ },
37
+ children: [
38
+ /*#__PURE__*/ jsx(View, {
39
+ style: {
40
+ flexDirection: 'row',
41
+ justifyContent: 'space-between',
42
+ alignItems: 'center',
43
+ marginVertical: 10
44
+ },
45
+ children: /*#__PURE__*/ jsx(Text, {
46
+ style: [
47
+ styles$1.title
48
+ ],
49
+ children: "Cannot connect to the internet."
50
+ })
51
+ }),
52
+ /*#__PURE__*/ jsx(Text, {
53
+ style: [
54
+ styles$1.subtitle
55
+ ],
56
+ children: error
57
+ })
58
+ ]
59
+ }),
60
+ /*#__PURE__*/ jsx(Pressable, {
61
+ style: [
62
+ styles$1.pressable
63
+ ],
64
+ onPress: cta,
65
+ children: /*#__PURE__*/ jsx(Text, {
66
+ style: [
67
+ styles$1.pressableText
68
+ ],
69
+ children: "Exit"
70
+ })
71
+ })
72
+ ]
73
+ })
74
+ });
75
+ const styles$1 = StyleSheet.create({
76
+ container: {
77
+ flex: 1,
78
+ flexDirection: 'column',
79
+ justifyContent: 'flex-start',
80
+ alignItems: 'stretch',
81
+ backgroundColor: '#F3F4F6'
82
+ },
83
+ title: {
84
+ color: '#1F2937',
85
+ fontSize: 30,
86
+ fontWeight: 'bold'
87
+ },
88
+ subtitle: {
89
+ color: 'rgba(107, 114, 128, 1)'
90
+ },
91
+ padding: {
92
+ paddingHorizontal: 16,
93
+ paddingVertical: 24
94
+ },
95
+ pressable: {
96
+ marginTop: 20,
97
+ backgroundColor: '#1F2937',
98
+ padding: 10,
99
+ paddingHorizontal: 25,
100
+ borderRadius: 5
101
+ },
102
+ pressableText: {
103
+ color: '#fff',
104
+ textAlign: 'center'
105
+ }
106
+ });
107
+
108
+ const LoadingScreen = ({ testId })=>/*#__PURE__*/ jsx(AndroidSafeAreaView, {
109
+ testId: testId,
110
+ children: /*#__PURE__*/ jsx(View, {
111
+ style: {
112
+ flex: 1,
113
+ justifyContent: 'center',
114
+ alignItems: 'center'
115
+ },
116
+ children: /*#__PURE__*/ jsx(ActivityIndicator, {
117
+ testID: "activity-indicator",
118
+ size: "large",
119
+ color: "#5928A3"
120
+ })
121
+ })
122
+ });
123
+
124
+ const PREFLIGHT_RETRY_COUNT = 3;
125
+ const parseMetadata = (url, connectorId)=>{
126
+ const metadata = {
127
+ connectorId: url.searchParams.get('connectorId') ?? connectorId
128
+ };
129
+ const profileId = url.searchParams.get('profileId');
130
+ if (profileId) metadata.profileId = profileId;
131
+ const connectionId = url.searchParams.get('connectionId');
132
+ if (connectionId) metadata.connectionId = connectionId;
133
+ const connectorSessionId = url.searchParams.get('connectorSession');
134
+ if (connectorSessionId) metadata.connectorSession = {
135
+ id: connectorSessionId
136
+ };
137
+ return metadata;
138
+ };
139
+ const checkConnectorUrl = async (connectorUrl, errorReporter, retryCount = 0)=>{
140
+ let responseStatus;
141
+ try {
142
+ const response = await fetch(connectorUrl);
143
+ switch(response.status){
144
+ case 200:
145
+ return {
146
+ checked: true
147
+ };
148
+ case 400:
149
+ console.log('Invalid configuration');
150
+ return {
151
+ checked: true
152
+ };
153
+ case 404:
154
+ console.error('Connector not found');
155
+ return {
156
+ checked: true
157
+ };
158
+ default:
159
+ throw new Error('Connector URL is not routable.');
160
+ }
161
+ } catch (error) {
162
+ // Log error for debugging
163
+ console.error(error);
164
+ // Try again
165
+ if (retryCount < PREFLIGHT_RETRY_COUNT) {
166
+ const delay = 50 * 2 ** retryCount;
167
+ await new Promise((resolve)=>setTimeout(resolve, delay));
168
+ console.log(`Retrying connection... Attempt ${retryCount + 1}`);
169
+ return checkConnectorUrl(connectorUrl, errorReporter, retryCount + 1);
170
+ }
171
+ // Report error after retries exhausted
172
+ const errorMessage = getErrorMessage(responseStatus, error);
173
+ const errorToSend = error || new Error(errorMessage);
174
+ const context = {
175
+ connectorUrl,
176
+ responseStatus
177
+ };
178
+ await errorReporter.notify(errorToSend, context);
179
+ // Return errored preflight check
180
+ return {
181
+ checked: true,
182
+ error: errorMessage
183
+ };
184
+ }
185
+ };
186
+ /**
187
+ * Handle opening OAuth URLs with proper encoding detection and normalization
188
+ */ const handleOAuthUrl = (oauthUrl)=>{
189
+ try {
190
+ // Throw error if oauthUrl is null or undefined
191
+ if (oauthUrl == null) {
192
+ throw new Error('OAuth URL missing');
193
+ }
194
+ // Convert to string if it's a URL object
195
+ const urlString = oauthUrl.toString();
196
+ // Throw error if the resulting string is empty
197
+ if (!urlString || urlString.trim() === '') {
198
+ throw new Error('Empty OAuth URL');
199
+ }
200
+ // Normalize the URL encoding
201
+ const normalizedUrl = normalizeUrlEncoding(urlString);
202
+ // Open the normalized URL
203
+ Linking.openURL(normalizedUrl);
204
+ } catch (_error) {
205
+ console.error('OAuth URL handling error');
206
+ // Only try the fallback if oauthUrl is not null
207
+ if (oauthUrl != null) {
208
+ try {
209
+ const fallbackUrl = typeof oauthUrl === 'string' ? oauthUrl : oauthUrl.toString();
210
+ console.log('Attempting fallback OAuth opening');
211
+ Linking.openURL(fallbackUrl);
212
+ } catch (_fallbackError) {
213
+ console.error('Fallback OAuth opening failed');
214
+ }
215
+ }
216
+ }
217
+ };
218
+ const QuilttConnector = /*#__PURE__*/ forwardRef(({ connectorId, connectionId, institution, oauthRedirectUrl, onEvent, onLoad, onExit, onExitSuccess, onExitAbort, onExitError, testId }, ref)=>{
219
+ const webViewRef = useRef(null);
220
+ const { session } = useQuilttSession();
221
+ const [preFlightCheck, setPreFlightCheck] = useState({
222
+ checked: false
223
+ });
224
+ const [errorReporter, setErrorReporter] = useState(null);
225
+ const [userAgent, setUserAgent] = useState('');
226
+ // Initialize error reporter and user agent
227
+ useEffect(()=>{
228
+ let mounted = true;
229
+ const init = async ()=>{
230
+ const agent = await getUserAgent(version);
231
+ if (mounted) {
232
+ setUserAgent(agent);
233
+ setErrorReporter(new ErrorReporter(agent));
234
+ }
235
+ };
236
+ init();
237
+ return ()=>{
238
+ mounted = false;
239
+ };
240
+ }, []);
241
+ // Script to disable scrolling on header
242
+ const disableHeaderScrollScript = `
243
+ (function() {
244
+ const header = document.querySelector('header');
245
+ if (header) {
246
+ header.style.position = 'fixed';
247
+ header.style.top = '0';
248
+ header.style.left = '0';
249
+ header.style.right = '0';
250
+ header.style.zIndex = '1000';
251
+ }
252
+ })();
253
+ `;
254
+ const onLoadEnd = useCallback(()=>{
255
+ if (Platform.OS === 'ios') {
256
+ webViewRef.current?.injectJavaScript(disableHeaderScrollScript);
257
+ }
258
+ }, []);
259
+ // Ensure oauthRedirectUrl is encoded properly - only once
260
+ const safeOAuthRedirectUrl = useMemo(()=>{
261
+ return smartEncodeURIComponent(oauthRedirectUrl);
262
+ }, [
263
+ oauthRedirectUrl
264
+ ]);
265
+ const connectorUrl = useMemo(()=>{
266
+ if (!userAgent) return null;
267
+ const url = new URL(`https://${connectorId}.quiltt.app`);
268
+ // For normal parameters, just append them directly
269
+ url.searchParams.append('mode', 'webview');
270
+ url.searchParams.append('agent', userAgent);
271
+ // For the oauth_redirect_url, we need to be careful
272
+ // If it's already encoded, we need to decode it once to prevent
273
+ // the automatic encoding that happens with searchParams.append
274
+ if (isEncoded(safeOAuthRedirectUrl)) {
275
+ const decodedOnce = decodeURIComponent(safeOAuthRedirectUrl);
276
+ url.searchParams.append('oauth_redirect_url', decodedOnce);
277
+ } else {
278
+ url.searchParams.append('oauth_redirect_url', safeOAuthRedirectUrl);
279
+ }
280
+ return url.toString();
281
+ }, [
282
+ connectorId,
283
+ safeOAuthRedirectUrl,
284
+ userAgent
285
+ ]);
286
+ useEffect(()=>{
287
+ if (preFlightCheck.checked || !connectorUrl || !errorReporter) return;
288
+ const fetchDataAndSetState = async ()=>{
289
+ const connectorUrlStatus = await checkConnectorUrl(connectorUrl, errorReporter);
290
+ setPreFlightCheck(connectorUrlStatus);
291
+ };
292
+ fetchDataAndSetState();
293
+ }, [
294
+ connectorUrl,
295
+ preFlightCheck,
296
+ errorReporter
297
+ ]);
298
+ const initInjectedJavaScript = useCallback(()=>{
299
+ const script = `\
300
+ const options = {\
301
+ source: 'quiltt',\
302
+ type: 'Options',\
303
+ token: '${session?.token}',\
304
+ connectorId: '${connectorId}',\
305
+ connectionId: '${connectionId}',\
306
+ institution: '${institution}', \
307
+ };\
308
+ const compactedOptions = Object.keys(options).reduce((acc, key) => {\
309
+ if (options[key] !== 'undefined') {\
310
+ acc[key] = options[key];\
311
+ }\
312
+ return acc;\
313
+ }, {});\
314
+ window.postMessage(compactedOptions);\
315
+ `;
316
+ webViewRef.current?.injectJavaScript(script);
317
+ }, [
318
+ connectionId,
319
+ connectorId,
320
+ institution,
321
+ session?.token
322
+ ]);
323
+ const isQuilttEvent = useCallback((url)=>url.protocol === 'quilttconnector:', []);
324
+ const shouldRender = useCallback((url)=>!isQuilttEvent(url), [
325
+ isQuilttEvent
326
+ ]);
327
+ const clearLocalStorage = useCallback(()=>{
328
+ const script = 'localStorage.clear();';
329
+ webViewRef.current?.injectJavaScript(script);
330
+ }, []);
331
+ const handleQuilttEvent = useCallback((url)=>{
332
+ url.searchParams.delete('source');
333
+ url.searchParams.append('connectorId', connectorId);
334
+ const metadata = parseMetadata(url, connectorId);
335
+ requestAnimationFrame(()=>{
336
+ const eventType = url.host;
337
+ switch(eventType){
338
+ case 'Load':
339
+ console.log('Event: Load');
340
+ initInjectedJavaScript();
341
+ onEvent?.(ConnectorSDKEventType.Load, metadata);
342
+ onLoad?.(metadata);
343
+ break;
344
+ case 'ExitAbort':
345
+ console.log('Event: ExitAbort');
346
+ clearLocalStorage();
347
+ onEvent?.(ConnectorSDKEventType.ExitAbort, metadata);
348
+ onExit?.(ConnectorSDKEventType.ExitAbort, metadata);
349
+ onExitAbort?.(metadata);
350
+ break;
351
+ case 'ExitError':
352
+ console.log('Event: ExitError');
353
+ clearLocalStorage();
354
+ onEvent?.(ConnectorSDKEventType.ExitError, metadata);
355
+ onExit?.(ConnectorSDKEventType.ExitError, metadata);
356
+ onExitError?.(metadata);
357
+ break;
358
+ case 'ExitSuccess':
359
+ console.log('Event: ExitSuccess');
360
+ clearLocalStorage();
361
+ onEvent?.(ConnectorSDKEventType.ExitSuccess, metadata);
362
+ onExit?.(ConnectorSDKEventType.ExitSuccess, metadata);
363
+ onExitSuccess?.(metadata);
364
+ break;
365
+ case 'Authenticate':
366
+ console.log('Event: Authenticate');
367
+ break;
368
+ case 'Navigate':
369
+ {
370
+ console.log('Event: Navigate');
371
+ const navigateUrl = url.searchParams.get('url');
372
+ if (navigateUrl) {
373
+ if (isEncoded(navigateUrl)) {
374
+ try {
375
+ const decodedUrl = decodeURIComponent(navigateUrl);
376
+ handleOAuthUrl(decodedUrl);
377
+ } catch (_error) {
378
+ console.error('Navigate URL decoding failed, using original');
379
+ handleOAuthUrl(navigateUrl);
380
+ }
381
+ } else {
382
+ handleOAuthUrl(navigateUrl);
383
+ }
384
+ } else {
385
+ console.error('Navigate URL missing from request');
386
+ }
387
+ break;
388
+ }
389
+ // NOTE: The `OauthRequested` is deprecated and should not be used
390
+ default:
391
+ console.log(`Unhandled event: ${eventType}`);
392
+ break;
393
+ }
394
+ });
395
+ }, [
396
+ clearLocalStorage,
397
+ connectorId,
398
+ initInjectedJavaScript,
399
+ onEvent,
400
+ onExit,
401
+ onExitAbort,
402
+ onExitError,
403
+ onExitSuccess,
404
+ onLoad
405
+ ]);
406
+ const requestHandler = useCallback((request)=>{
407
+ const url = new URL(request.url);
408
+ if (isQuilttEvent(url)) {
409
+ handleQuilttEvent(url);
410
+ return false;
411
+ }
412
+ if (shouldRender(url)) {
413
+ return true;
414
+ }
415
+ // Plaid set oauth url by doing window.location.href = url
416
+ // So we use `handleOAuthUrl` as a catch all and assume all url got to this step is Plaid OAuth url
417
+ handleOAuthUrl(url);
418
+ return false;
419
+ }, [
420
+ handleQuilttEvent,
421
+ isQuilttEvent,
422
+ shouldRender
423
+ ]);
424
+ // Expose method to handle OAuth callbacks from parent component
425
+ useImperativeHandle(ref, ()=>({
426
+ handleOAuthCallback: (callbackUrl)=>{
427
+ try {
428
+ console.log('Handling OAuth callback:', callbackUrl);
429
+ const url = new URL(callbackUrl);
430
+ // Extract OAuth callback parameters
431
+ const oauthParams = {};
432
+ url.searchParams.forEach((value, key)=>{
433
+ oauthParams[key] = value;
434
+ });
435
+ // Send OAuth callback data to the connector via postMessage
436
+ // This preserves the connector's state and allows events to fire properly
437
+ const message = {
438
+ source: 'quiltt',
439
+ type: 'OAuthCallback',
440
+ data: {
441
+ url: callbackUrl,
442
+ params: oauthParams
443
+ }
444
+ };
445
+ const script = `
446
+ (function() {
447
+ try {
448
+ window.postMessage(${JSON.stringify(message)});
449
+ console.log('OAuth callback message sent to connector');
450
+ } catch (e) {
451
+ console.error('Failed to send OAuth callback message:', e);
452
+ }
453
+ })();
454
+ true;
455
+ `;
456
+ webViewRef.current?.injectJavaScript(script);
457
+ } catch (error) {
458
+ console.error('Error handling OAuth callback:', error);
459
+ }
460
+ }
461
+ }), []);
462
+ if (!preFlightCheck.checked || !connectorUrl) {
463
+ return /*#__PURE__*/ jsx(LoadingScreen, {
464
+ testId: "loading-screen"
465
+ });
466
+ }
467
+ if (preFlightCheck.error) {
468
+ return /*#__PURE__*/ jsx(ErrorScreen, {
469
+ testId: "error-screen",
470
+ error: preFlightCheck.error,
471
+ cta: ()=>onExitError?.({
472
+ connectorId
473
+ })
474
+ });
475
+ }
476
+ return /*#__PURE__*/ jsx(AndroidSafeAreaView, {
477
+ testId: testId,
478
+ children: /*#__PURE__*/ jsx(WebView, {
479
+ ref: webViewRef,
480
+ // Plaid keeps sending window.location = 'about:srcdoc' and causes some noise in RN
481
+ domStorageEnabled: true,
482
+ javaScriptEnabled: true,
483
+ onLoadEnd: onLoadEnd,
484
+ onShouldStartLoadWithRequest: requestHandler,
485
+ originWhitelist: [
486
+ '*'
487
+ ],
488
+ scrollEnabled: true,
489
+ showsHorizontalScrollIndicator: false,
490
+ showsVerticalScrollIndicator: false,
491
+ source: {
492
+ uri: connectorUrl
493
+ },
494
+ style: styles.webview,
495
+ testID: "webview",
496
+ webviewDebuggingEnabled: true,
497
+ ...Platform.OS === 'ios' ? {
498
+ allowsBackForwardNavigationGestures: false,
499
+ allowsInlineMediaPlayback: true,
500
+ automaticallyAdjustContentInsets: false,
501
+ bounces: false,
502
+ contentInsetAdjustmentBehavior: 'never',
503
+ dataDetectorTypes: 'none',
504
+ decelerationRate: 'normal',
505
+ keyboardDisplayRequiresUserAction: false,
506
+ scrollEventThrottle: 16,
507
+ startInLoadingState: true
508
+ } : {
509
+ androidLayerType: 'hardware',
510
+ cacheEnabled: true,
511
+ cacheMode: 'LOAD_CACHE_ELSE_NETWORK',
512
+ overScrollMode: 'never'
513
+ }
514
+ })
515
+ });
516
+ });
517
+ // Add styles for the WebView container
518
+ const styles = StyleSheet.create({
519
+ webviewContainer: {
520
+ flex: 1,
521
+ backgroundColor: '#ffffff'
522
+ },
523
+ webview: {
524
+ flex: 1,
525
+ overflow: 'hidden'
526
+ }
527
+ });
528
+ QuilttConnector.displayName = 'QuilttConnector';
529
+
530
+ export { QuilttConnector, checkConnectorUrl, handleOAuthUrl };
package/dist/index.cjs ADDED
@@ -0,0 +1,76 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ var base64 = require('base-64');
4
+ var core = require('@quiltt/core');
5
+ var react = require('@quiltt/react');
6
+ var index_cjs = require('./components/index.cjs');
7
+ var index_cjs$1 = require('./providers/index.cjs');
8
+
9
+ // Hermes doesn't have atob
10
+ // https://github.com/facebook/hermes/issues/1178
11
+ if (!global.atob) {
12
+ global.atob = base64.decode;
13
+ }
14
+
15
+ Object.defineProperty(exports, "QuilttSettingsProvider", {
16
+ enumerable: true,
17
+ get: function () { return react.QuilttSettingsProvider; }
18
+ });
19
+ Object.defineProperty(exports, "useLazyQuery", {
20
+ enumerable: true,
21
+ get: function () { return react.useLazyQuery; }
22
+ });
23
+ Object.defineProperty(exports, "useMutation", {
24
+ enumerable: true,
25
+ get: function () { return react.useMutation; }
26
+ });
27
+ Object.defineProperty(exports, "useQuery", {
28
+ enumerable: true,
29
+ get: function () { return react.useQuery; }
30
+ });
31
+ Object.defineProperty(exports, "useQuilttClient", {
32
+ enumerable: true,
33
+ get: function () { return react.useQuilttClient; }
34
+ });
35
+ Object.defineProperty(exports, "useQuilttConnector", {
36
+ enumerable: true,
37
+ get: function () { return react.useQuilttConnector; }
38
+ });
39
+ Object.defineProperty(exports, "useQuilttSession", {
40
+ enumerable: true,
41
+ get: function () { return react.useQuilttSession; }
42
+ });
43
+ Object.defineProperty(exports, "useQuilttSettings", {
44
+ enumerable: true,
45
+ get: function () { return react.useQuilttSettings; }
46
+ });
47
+ Object.defineProperty(exports, "useSession", {
48
+ enumerable: true,
49
+ get: function () { return react.useSession; }
50
+ });
51
+ Object.defineProperty(exports, "useStorage", {
52
+ enumerable: true,
53
+ get: function () { return react.useStorage; }
54
+ });
55
+ Object.defineProperty(exports, "useSubscription", {
56
+ enumerable: true,
57
+ get: function () { return react.useSubscription; }
58
+ });
59
+ Object.keys(core).forEach(function (k) {
60
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
61
+ enumerable: true,
62
+ get: function () { return core[k]; }
63
+ });
64
+ });
65
+ Object.keys(index_cjs).forEach(function (k) {
66
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
67
+ enumerable: true,
68
+ get: function () { return index_cjs[k]; }
69
+ });
70
+ });
71
+ Object.keys(index_cjs$1).forEach(function (k) {
72
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
73
+ enumerable: true,
74
+ get: function () { return index_cjs$1[k]; }
75
+ });
76
+ });
package/dist/index.d.ts CHANGED
@@ -1,59 +1,4 @@
1
1
  export * from '@quiltt/core';
2
- import { ConnectorSDKCallbacks, QuilttAuthProviderProps as QuilttAuthProviderProps$1, QuilttSettingsProviderProps } from '@quiltt/react';
3
2
  export { ApolloQueryResult, DocumentNode, ErrorPolicy, FetchPolicy, MutationHookOptions, MutationResult, NormalizedCacheObject, OperationVariables, QueryHookOptions, QueryResult, QuilttSettingsProvider, SubscriptionHookOptions, SubscriptionResult, TypedDocumentNode, WatchQueryFetchPolicy, useLazyQuery, useMutation, useQuery, useQuilttClient, useQuilttConnector, useQuilttSession, useQuilttSettings, useSession, useStorage, useSubscription } from '@quiltt/react';
4
- import * as react from 'react';
5
- import { FC } from 'react';
6
- import { URL } from 'react-native-url-polyfill';
7
- import { NoticeTransportPayload } from '@honeybadger-io/core/build/src/types';
8
-
9
- declare class ErrorReporter {
10
- private noticeUrl;
11
- private apiKey;
12
- private logger;
13
- private userAgent;
14
- constructor(userAgent: string);
15
- notify(error: Error, context?: any): Promise<void>;
16
- buildPayload(error: Error, localContext?: {}): Promise<Partial<NoticeTransportPayload>>;
17
- }
18
-
19
- type PreFlightCheck = {
20
- checked: boolean;
21
- error?: string;
22
- };
23
- declare const checkConnectorUrl: (connectorUrl: string, errorReporter: ErrorReporter, retryCount?: number) => Promise<PreFlightCheck>;
24
- /**
25
- * Handle opening OAuth URLs with proper encoding detection and normalization
26
- */
27
- declare const handleOAuthUrl: (oauthUrl: URL | string | null | undefined) => void;
28
- type QuilttConnectorHandle = {
29
- handleOAuthCallback: (url: string) => void;
30
- };
31
- declare const QuilttConnector: react.ForwardRefExoticComponent<{
32
- connectorId: string;
33
- connectionId?: string;
34
- institution?: string;
35
- oauthRedirectUrl: string;
36
- testId?: string;
37
- } & ConnectorSDKCallbacks & react.RefAttributes<QuilttConnectorHandle>>;
38
-
39
- type QuilttAuthProviderProps = QuilttAuthProviderProps$1;
40
- /**
41
- * React Native-specific QuilttAuthProvider that injects platform information
42
- * into the GraphQL client's User-Agent header.
43
- *
44
- * If a token is provided, will validate the token against the api and then import
45
- * it into trusted storage. While this process is happening, the component is put
46
- * into a loading state and the children are not rendered to prevent race conditions
47
- * from triggering within the transitionary state.
48
- */
49
- declare const QuilttAuthProvider: FC<QuilttAuthProviderProps>;
50
-
51
- type QuilttProviderProps = QuilttSettingsProviderProps & QuilttAuthProviderProps;
52
- /**
53
- * React Native-specific QuilttProvider that combines settings and auth providers
54
- * with platform-specific GraphQL client configuration.
55
- */
56
- declare const QuilttProvider: FC<QuilttProviderProps>;
57
-
58
- export { QuilttAuthProvider, QuilttConnector, QuilttProvider, checkConnectorUrl, handleOAuthUrl };
59
- export type { PreFlightCheck, QuilttAuthProviderProps, QuilttConnectorHandle };
3
+ export * from './components/index.js';
4
+ export * from './providers/index.js';