@quiltt/react-native 3.8.2 → 3.9.0
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.
- package/CHANGELOG.md +15 -0
- package/dist/index.js +59 -41
- package/package.json +9 -8
- package/src/components/QuilttConnector.tsx +58 -43
- package/src/version.ts +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @quiltt/react-native
|
|
2
2
|
|
|
3
|
+
## 3.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#307](https://github.com/quiltt/quiltt-js/pull/307) [`d0033cd`](https://github.com/quiltt/quiltt-js/commit/d0033cdbdaf33f9227afa55c9a6078156809a563) Thanks [@rubendinho](https://github.com/rubendinho)! - - Significantly reduce bundle size by migrating @apollo/client to "deep entrypoint import style"
|
|
8
|
+
- Bump @apollo/client to v3.11.8
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [#305](https://github.com/quiltt/quiltt-js/pull/305) [`803a4d0`](https://github.com/quiltt/quiltt-js/commit/803a4d09e458ed2e72781fcd475ad5f9639f2bf2) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Optimize connector WebView implementation
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`803a4d0`](https://github.com/quiltt/quiltt-js/commit/803a4d09e458ed2e72781fcd475ad5f9639f2bf2), [`d0033cd`](https://github.com/quiltt/quiltt-js/commit/d0033cdbdaf33f9227afa55c9a6078156809a563)]:
|
|
15
|
+
- @quiltt/react@3.9.0
|
|
16
|
+
- @quiltt/core@3.9.0
|
|
17
|
+
|
|
3
18
|
## 3.8.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,13 @@ export * from '@quiltt/core';
|
|
|
3
3
|
import { useQuilttSession, ConnectorSDKEventType } from '@quiltt/react';
|
|
4
4
|
export { QuilttAuthProvider, QuilttProvider, QuilttSettingsProvider, useQuilttClient, useQuilttConnector, useQuilttSession, useQuilttSettings, useSession, useStorage } from '@quiltt/react';
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
-
import { useRef,
|
|
6
|
+
import { useRef, useState, useMemo, useEffect, useCallback } from 'react';
|
|
7
7
|
import { StyleSheet, Platform, StatusBar, SafeAreaView, View, Text, Pressable, ActivityIndicator, Linking } from 'react-native';
|
|
8
8
|
import { URL } from 'react-native-url-polyfill';
|
|
9
9
|
import { WebView } from 'react-native-webview';
|
|
10
10
|
import { generateStackTrace, makeBacktrace, getCauses } from '@honeybadger-io/core/build/src/util';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
const version = '3.8.2';
|
|
12
|
+
var version = "3.9.0";
|
|
14
13
|
|
|
15
14
|
const ErrorReporterConfig = {
|
|
16
15
|
honeybadger_api_key: 'undefined'
|
|
@@ -257,6 +256,9 @@ const handleOAuthUrl = (oauthUrl)=>{
|
|
|
257
256
|
const QuilttConnector = ({ testId, connectorId, connectionId, institution, oauthRedirectUrl, onEvent, onLoad, onExit, onExitSuccess, onExitAbort, onExitError })=>{
|
|
258
257
|
const webViewRef = useRef(null);
|
|
259
258
|
const { session } = useQuilttSession();
|
|
259
|
+
const [preFlightCheck, setPreFlightCheck] = useState({
|
|
260
|
+
checked: false
|
|
261
|
+
});
|
|
260
262
|
const encodedOAuthRedirectUrl = useMemo(()=>encodeURIComponent(oauthRedirectUrl), [
|
|
261
263
|
oauthRedirectUrl
|
|
262
264
|
]);
|
|
@@ -270,9 +272,6 @@ const QuilttConnector = ({ testId, connectorId, connectionId, institution, oauth
|
|
|
270
272
|
connectorId,
|
|
271
273
|
encodedOAuthRedirectUrl
|
|
272
274
|
]);
|
|
273
|
-
const [preFlightCheck, setPreFlightCheck] = useState({
|
|
274
|
-
checked: false
|
|
275
|
-
});
|
|
276
275
|
useEffect(()=>{
|
|
277
276
|
if (preFlightCheck.checked) return;
|
|
278
277
|
const fetchDataAndSetState = async ()=>{
|
|
@@ -321,40 +320,42 @@ const QuilttConnector = ({ testId, connectorId, connectionId, institution, oauth
|
|
|
321
320
|
url.searchParams.delete('source');
|
|
322
321
|
url.searchParams.append('connectorId', connectorId);
|
|
323
322
|
const metadata = Object.fromEntries(url.searchParams);
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
323
|
+
requestAnimationFrame(()=>{
|
|
324
|
+
const eventType = url.host;
|
|
325
|
+
switch(eventType){
|
|
326
|
+
case 'Load':
|
|
327
|
+
initInjectedJavaScript();
|
|
328
|
+
onEvent?.(ConnectorSDKEventType.Load, metadata);
|
|
329
|
+
onLoad?.(metadata);
|
|
330
|
+
break;
|
|
331
|
+
case 'ExitAbort':
|
|
332
|
+
clearLocalStorage();
|
|
333
|
+
onEvent?.(ConnectorSDKEventType.ExitAbort, metadata);
|
|
334
|
+
onExit?.(ConnectorSDKEventType.ExitAbort, metadata);
|
|
335
|
+
onExitAbort?.(metadata);
|
|
336
|
+
break;
|
|
337
|
+
case 'ExitError':
|
|
338
|
+
clearLocalStorage();
|
|
339
|
+
onEvent?.(ConnectorSDKEventType.ExitError, metadata);
|
|
340
|
+
onExit?.(ConnectorSDKEventType.ExitError, metadata);
|
|
341
|
+
onExitError?.(metadata);
|
|
342
|
+
break;
|
|
343
|
+
case 'ExitSuccess':
|
|
344
|
+
clearLocalStorage();
|
|
345
|
+
onEvent?.(ConnectorSDKEventType.ExitSuccess, metadata);
|
|
346
|
+
onExit?.(ConnectorSDKEventType.ExitSuccess, metadata);
|
|
347
|
+
onExitSuccess?.(metadata);
|
|
348
|
+
break;
|
|
349
|
+
case 'Authenticate':
|
|
350
|
+
break;
|
|
351
|
+
case 'OauthRequested':
|
|
352
|
+
handleOAuthUrl(new URL(url.searchParams.get('oauthUrl')));
|
|
353
|
+
break;
|
|
354
|
+
default:
|
|
355
|
+
console.log('unhandled event', url);
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
358
359
|
}, [
|
|
359
360
|
clearLocalStorage,
|
|
360
361
|
connectorId,
|
|
@@ -410,7 +411,24 @@ const QuilttConnector = ({ testId, connectorId, connectionId, institution, oauth
|
|
|
410
411
|
onShouldStartLoadWithRequest: requestHandler,
|
|
411
412
|
javaScriptEnabled: true,
|
|
412
413
|
domStorageEnabled: true,
|
|
413
|
-
webviewDebuggingEnabled: true
|
|
414
|
+
webviewDebuggingEnabled: true,
|
|
415
|
+
bounces: false,
|
|
416
|
+
scrollEnabled: true,
|
|
417
|
+
automaticallyAdjustContentInsets: false,
|
|
418
|
+
contentInsetAdjustmentBehavior: "never" // Controls how the WebView adjusts its content layout relative to safe areas and system UI
|
|
419
|
+
,
|
|
420
|
+
...Platform.OS === 'ios' ? {
|
|
421
|
+
decelerationRate: 'normal',
|
|
422
|
+
keyboardDisplayRequiresUserAction: false,
|
|
423
|
+
dataDetectorTypes: 'none',
|
|
424
|
+
allowsInlineMediaPlayback: true,
|
|
425
|
+
allowsBackForwardNavigationGestures: false,
|
|
426
|
+
startInLoadingState: true
|
|
427
|
+
} : {
|
|
428
|
+
androidLayerType: 'hardware',
|
|
429
|
+
cacheEnabled: true,
|
|
430
|
+
cacheMode: 'LOAD_CACHE_ELSE_NETWORK'
|
|
431
|
+
}
|
|
414
432
|
})
|
|
415
433
|
});
|
|
416
434
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quiltt/react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "React Native components for Quiltt Connector",
|
|
5
5
|
"homepage": "https://github.com/quiltt/quiltt-js/tree/main/packages/react-native#readme",
|
|
6
6
|
"repository": {
|
|
@@ -25,20 +25,22 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@honeybadger-io/core": "6.6.0",
|
|
28
|
-
"
|
|
29
|
-
"@quiltt/
|
|
28
|
+
"lodash.debounce": "4.0.8",
|
|
29
|
+
"@quiltt/core": "3.9.0",
|
|
30
|
+
"@quiltt/react": "3.9.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@biomejs/biome": "1.9.4",
|
|
33
34
|
"@types/base-64": "1.0.2",
|
|
34
|
-
"@types/
|
|
35
|
+
"@types/lodash.debounce": "4.0.9",
|
|
36
|
+
"@types/node": "22.10.2",
|
|
35
37
|
"@types/react": "18.3.12",
|
|
36
38
|
"base-64": "1.0.0",
|
|
37
39
|
"bunchee": "5.6.1",
|
|
38
40
|
"react": "18.3.1",
|
|
39
|
-
"react-native": "0.76.
|
|
41
|
+
"react-native": "0.76.5",
|
|
40
42
|
"react-native-url-polyfill": "2.0.0",
|
|
41
|
-
"react-native-webview": "13.12.
|
|
43
|
+
"react-native-webview": "13.12.5",
|
|
42
44
|
"rimraf": "6.0.1",
|
|
43
45
|
"typescript": "5.6.3"
|
|
44
46
|
},
|
|
@@ -54,8 +56,7 @@
|
|
|
54
56
|
},
|
|
55
57
|
"scripts": {
|
|
56
58
|
"addApiKey": "node scripts/addApiKey.js",
|
|
57
|
-
"
|
|
58
|
-
"build": "pnpm run addApiKey && pnpm run addVersion && bunchee",
|
|
59
|
+
"build": "pnpm run addApiKey && bunchee",
|
|
59
60
|
"clean": "rimraf .turbo dist",
|
|
60
61
|
"dev": "bunchee --watch",
|
|
61
62
|
"lint": "TIMING=1 biome check src/ tests/ --fix",
|
|
@@ -4,12 +4,8 @@ import { URL } from 'react-native-url-polyfill' // https://github.com/facebook/r
|
|
|
4
4
|
import { WebView } from 'react-native-webview'
|
|
5
5
|
import type { ShouldStartLoadRequest } from 'react-native-webview/lib/WebViewTypes'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
type ConnectorSDKCallbacks,
|
|
10
|
-
ConnectorSDKEventType,
|
|
11
|
-
useQuilttSession,
|
|
12
|
-
} from '@quiltt/react'
|
|
7
|
+
import { ConnectorSDKEventType, useQuilttSession } from '@quiltt/react'
|
|
8
|
+
import type { ConnectorSDKCallbackMetadata, ConnectorSDKCallbacks } from '@quiltt/react'
|
|
13
9
|
|
|
14
10
|
import { ErrorReporter, getErrorMessage } from '../utils'
|
|
15
11
|
import { version } from '../version'
|
|
@@ -85,6 +81,7 @@ const QuilttConnector = ({
|
|
|
85
81
|
}: QuilttConnectorProps) => {
|
|
86
82
|
const webViewRef = useRef<WebView>(null)
|
|
87
83
|
const { session } = useQuilttSession()
|
|
84
|
+
const [preFlightCheck, setPreFlightCheck] = useState<PreFlightCheck>({ checked: false })
|
|
88
85
|
|
|
89
86
|
const encodedOAuthRedirectUrl = useMemo(
|
|
90
87
|
() => encodeURIComponent(oauthRedirectUrl),
|
|
@@ -99,8 +96,6 @@ const QuilttConnector = ({
|
|
|
99
96
|
return url.toString()
|
|
100
97
|
}, [connectorId, encodedOAuthRedirectUrl])
|
|
101
98
|
|
|
102
|
-
const [preFlightCheck, setPreFlightCheck] = useState<PreFlightCheck>({ checked: false })
|
|
103
|
-
|
|
104
99
|
useEffect(() => {
|
|
105
100
|
if (preFlightCheck.checked) return
|
|
106
101
|
const fetchDataAndSetState = async () => {
|
|
@@ -146,41 +141,43 @@ const QuilttConnector = ({
|
|
|
146
141
|
url.searchParams.append('connectorId', connectorId)
|
|
147
142
|
const metadata = Object.fromEntries(url.searchParams) as ConnectorSDKCallbackMetadata
|
|
148
143
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
144
|
+
requestAnimationFrame(() => {
|
|
145
|
+
const eventType = url.host
|
|
146
|
+
switch (eventType) {
|
|
147
|
+
case 'Load':
|
|
148
|
+
initInjectedJavaScript()
|
|
149
|
+
onEvent?.(ConnectorSDKEventType.Load, metadata)
|
|
150
|
+
onLoad?.(metadata)
|
|
151
|
+
break
|
|
152
|
+
case 'ExitAbort':
|
|
153
|
+
clearLocalStorage()
|
|
154
|
+
onEvent?.(ConnectorSDKEventType.ExitAbort, metadata)
|
|
155
|
+
onExit?.(ConnectorSDKEventType.ExitAbort, metadata)
|
|
156
|
+
onExitAbort?.(metadata)
|
|
157
|
+
break
|
|
158
|
+
case 'ExitError':
|
|
159
|
+
clearLocalStorage()
|
|
160
|
+
onEvent?.(ConnectorSDKEventType.ExitError, metadata)
|
|
161
|
+
onExit?.(ConnectorSDKEventType.ExitError, metadata)
|
|
162
|
+
onExitError?.(metadata)
|
|
163
|
+
break
|
|
164
|
+
case 'ExitSuccess':
|
|
165
|
+
clearLocalStorage()
|
|
166
|
+
onEvent?.(ConnectorSDKEventType.ExitSuccess, metadata)
|
|
167
|
+
onExit?.(ConnectorSDKEventType.ExitSuccess, metadata)
|
|
168
|
+
onExitSuccess?.(metadata)
|
|
169
|
+
break
|
|
170
|
+
case 'Authenticate':
|
|
171
|
+
// TODO: handle Authenticate
|
|
172
|
+
break
|
|
173
|
+
case 'OauthRequested':
|
|
174
|
+
handleOAuthUrl(new URL(url.searchParams.get('oauthUrl') as string))
|
|
175
|
+
break
|
|
176
|
+
default:
|
|
177
|
+
console.log('unhandled event', url)
|
|
178
|
+
break
|
|
179
|
+
}
|
|
180
|
+
})
|
|
184
181
|
},
|
|
185
182
|
[
|
|
186
183
|
clearLocalStorage,
|
|
@@ -236,6 +233,24 @@ const QuilttConnector = ({
|
|
|
236
233
|
javaScriptEnabled
|
|
237
234
|
domStorageEnabled // To enable localStorage in Android webview
|
|
238
235
|
webviewDebuggingEnabled
|
|
236
|
+
bounces={false} // Controls the bouncing effect when scrolling past content boundaries (iOS only)
|
|
237
|
+
scrollEnabled={true} // Enables scrolling within the WebView
|
|
238
|
+
automaticallyAdjustContentInsets={false} // Disables automatic padding adjustments based on navigation bars/safe areas
|
|
239
|
+
contentInsetAdjustmentBehavior="never" // Controls how the WebView adjusts its content layout relative to safe areas and system UI
|
|
240
|
+
{...(Platform.OS === 'ios'
|
|
241
|
+
? {
|
|
242
|
+
decelerationRate: 'normal',
|
|
243
|
+
keyboardDisplayRequiresUserAction: false,
|
|
244
|
+
dataDetectorTypes: 'none',
|
|
245
|
+
allowsInlineMediaPlayback: true,
|
|
246
|
+
allowsBackForwardNavigationGestures: false,
|
|
247
|
+
startInLoadingState: true,
|
|
248
|
+
}
|
|
249
|
+
: {
|
|
250
|
+
androidLayerType: 'hardware',
|
|
251
|
+
cacheEnabled: true,
|
|
252
|
+
cacheMode: 'LOAD_CACHE_ELSE_NETWORK',
|
|
253
|
+
})}
|
|
239
254
|
/>
|
|
240
255
|
</AndroidSafeAreaView>
|
|
241
256
|
)
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const version = '3.8.2'
|
|
1
|
+
export { version } from '../package.json'
|