@quiltt/react-native 3.6.1 → 3.6.3

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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @quiltt/react-native
2
2
 
3
+ ## 3.6.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#240](https://github.com/quiltt/quiltt-js/pull/240) [`96556d4`](https://github.com/quiltt/quiltt-js/commit/96556d4e4d29b1a5623b78f60d97c49a974e44e8) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Pre-transpile '@quiltt/react-native' code before publish
8
+
9
+ - Updated dependencies [[`96556d4`](https://github.com/quiltt/quiltt-js/commit/96556d4e4d29b1a5623b78f60d97c49a974e44e8)]:
10
+ - @quiltt/core@3.6.3
11
+ - @quiltt/react@3.6.3
12
+
13
+ ## 3.6.2
14
+
15
+ ### Patch Changes
16
+
17
+ - [#236](https://github.com/quiltt/quiltt-js/pull/236) [`85c0be1`](https://github.com/quiltt/quiltt-js/commit/85c0be16803381de5dbd89a7295e326228542080) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Fix config loading
18
+
19
+ - Updated dependencies [[`85c0be1`](https://github.com/quiltt/quiltt-js/commit/85c0be16803381de5dbd89a7295e326228542080)]:
20
+ - @quiltt/core@3.6.2
21
+ - @quiltt/react@3.6.2
22
+
3
23
  ## 3.6.1
4
24
 
5
25
  ### Patch Changes
@@ -1,20 +1,21 @@
1
- import { decode } from 'base-64';
2
- export * from '@quiltt/core';
3
- import { useQuilttSession, ConnectorSDKEventType } from '@quiltt/react';
4
- export { QuilttAuthProvider, QuilttProvider, QuilttSettingsProvider, useQuilttClient, useQuilttConnector, useQuilttSession, useQuilttSettings, useSession, useStorage } from '@quiltt/react';
5
- import { jsx, jsxs } from 'react/jsx-runtime';
6
- import { useRef, useMemo, useState, useCallback, useEffect } from 'react';
7
- import { StyleSheet, Platform, StatusBar, SafeAreaView, View, Text, Pressable, ActivityIndicator, Linking } from 'react-native';
8
- import { URL } from 'react-native-url-polyfill';
9
- import { WebView } from 'react-native-webview';
10
- import { generateStackTrace, makeBacktrace, getCauses } from '@honeybadger-io/core/build/src/util';
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 jsxRuntime = require('react/jsx-runtime');
7
+ var react$1 = require('react');
8
+ var reactNative = require('react-native');
9
+ var reactNativeUrlPolyfill = require('react-native-url-polyfill');
10
+ var reactNativeWebview = require('react-native-webview');
11
+ var util = require('@honeybadger-io/core/build/src/util');
11
12
 
12
13
  const ErrorReporterConfig = {
13
14
  honeybadger_api_key: 'undefined'
14
15
  };
15
16
 
16
17
  // Generated by genversion.
17
- const version = '3.6.1';
18
+ const version = '3.6.3';
18
19
 
19
20
  // Quick hack to send error to Honeybadger to debug why the connector is not routable
20
21
  const notifier = {
@@ -62,8 +63,8 @@ class ErrorReporter {
62
63
  }
63
64
  async buildPayload(error, localContext = {}) {
64
65
  const notice = error;
65
- notice.stack = generateStackTrace();
66
- notice.backtrace = makeBacktrace(notice.stack);
66
+ notice.stack = util.generateStackTrace();
67
+ notice.backtrace = util.makeBacktrace(notice.stack);
67
68
  return {
68
69
  notifier,
69
70
  error: {
@@ -72,7 +73,7 @@ class ErrorReporter {
72
73
  backtrace: notice.backtrace,
73
74
  // fingerprint: this.calculateFingerprint(notice),
74
75
  tags: notice.tags || [],
75
- causes: getCauses(notice, this.logger)
76
+ causes: util.getCauses(notice, this.logger)
76
77
  },
77
78
  request: {
78
79
  url: notice.url,
@@ -100,46 +101,46 @@ const getErrorMessage = (responseStatus, error)=>{
100
101
  return responseStatus ? `The URL is not routable. Response status: ${responseStatus}` : 'An error occurred while checking the connector URL';
101
102
  };
102
103
 
103
- const AndroidSafeAreaView = ({ children })=>/*#__PURE__*/ jsx(SafeAreaView, {
104
+ const AndroidSafeAreaView = ({ children })=>/*#__PURE__*/ jsxRuntime.jsx(reactNative.SafeAreaView, {
104
105
  style: styles$1.AndroidSafeArea,
105
106
  children: children
106
107
  });
107
- const styles$1 = StyleSheet.create({
108
+ const styles$1 = reactNative.StyleSheet.create({
108
109
  AndroidSafeArea: {
109
110
  flex: 1,
110
111
  backgroundColor: 'white',
111
- paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0
112
+ paddingTop: reactNative.Platform.OS === 'android' ? reactNative.StatusBar.currentHeight : 0
112
113
  }
113
114
  });
114
115
 
115
- const ErrorScreen = ({ error, cta })=>/*#__PURE__*/ jsx(AndroidSafeAreaView, {
116
- children: /*#__PURE__*/ jsxs(View, {
116
+ const ErrorScreen = ({ error, cta })=>/*#__PURE__*/ jsxRuntime.jsx(AndroidSafeAreaView, {
117
+ children: /*#__PURE__*/ jsxRuntime.jsxs(reactNative.View, {
117
118
  style: [
118
119
  styles.container,
119
120
  styles.padding
120
121
  ],
121
122
  children: [
122
- /*#__PURE__*/ jsxs(View, {
123
+ /*#__PURE__*/ jsxRuntime.jsxs(reactNative.View, {
123
124
  style: {
124
125
  flex: 1,
125
126
  justifyContent: 'center'
126
127
  },
127
128
  children: [
128
- /*#__PURE__*/ jsx(View, {
129
+ /*#__PURE__*/ jsxRuntime.jsx(reactNative.View, {
129
130
  style: {
130
131
  flexDirection: 'row',
131
132
  justifyContent: 'space-between',
132
133
  alignItems: 'center',
133
134
  marginVertical: 10
134
135
  },
135
- children: /*#__PURE__*/ jsx(Text, {
136
+ children: /*#__PURE__*/ jsxRuntime.jsx(reactNative.Text, {
136
137
  style: [
137
138
  styles.title
138
139
  ],
139
140
  children: "Cannot connect to the internet."
140
141
  })
141
142
  }),
142
- /*#__PURE__*/ jsx(Text, {
143
+ /*#__PURE__*/ jsxRuntime.jsx(reactNative.Text, {
143
144
  style: [
144
145
  styles.subtitle
145
146
  ],
@@ -147,12 +148,12 @@ const ErrorScreen = ({ error, cta })=>/*#__PURE__*/ jsx(AndroidSafeAreaView, {
147
148
  })
148
149
  ]
149
150
  }),
150
- /*#__PURE__*/ jsx(Pressable, {
151
+ /*#__PURE__*/ jsxRuntime.jsx(reactNative.Pressable, {
151
152
  style: [
152
153
  styles.pressable
153
154
  ],
154
155
  onPress: cta,
155
- children: /*#__PURE__*/ jsx(Text, {
156
+ children: /*#__PURE__*/ jsxRuntime.jsx(reactNative.Text, {
156
157
  style: [
157
158
  styles.pressableText
158
159
  ],
@@ -162,7 +163,7 @@ const ErrorScreen = ({ error, cta })=>/*#__PURE__*/ jsx(AndroidSafeAreaView, {
162
163
  ]
163
164
  })
164
165
  });
165
- const styles = StyleSheet.create({
166
+ const styles = reactNative.StyleSheet.create({
166
167
  container: {
167
168
  flex: 1,
168
169
  flexDirection: 'column',
@@ -195,30 +196,30 @@ const styles = StyleSheet.create({
195
196
  }
196
197
  });
197
198
 
198
- const LoadingScreen = ()=>/*#__PURE__*/ jsx(AndroidSafeAreaView, {
199
- children: /*#__PURE__*/ jsx(View, {
199
+ const LoadingScreen = ()=>/*#__PURE__*/ jsxRuntime.jsx(AndroidSafeAreaView, {
200
+ children: /*#__PURE__*/ jsxRuntime.jsx(reactNative.View, {
200
201
  style: {
201
202
  flex: 1,
202
203
  justifyContent: 'center',
203
204
  alignItems: 'center'
204
205
  },
205
- children: /*#__PURE__*/ jsx(ActivityIndicator, {
206
+ children: /*#__PURE__*/ jsxRuntime.jsx(reactNative.ActivityIndicator, {
206
207
  size: "large",
207
208
  color: "#0000ff"
208
209
  })
209
210
  })
210
211
  });
211
212
 
212
- const errorReporter = new ErrorReporter(`${Platform.OS} ${Platform.Version}`);
213
+ const errorReporter = new ErrorReporter(`${reactNative.Platform.OS} ${reactNative.Platform.Version}`);
213
214
  const PREFLIGHT_RETRY_COUNT = 3;
214
215
  const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirectUrl, onEvent, onLoad, onExit, onExitSuccess, onExitAbort, onExitError })=>{
215
- const webViewRef = useRef(null);
216
- const { session } = useQuilttSession();
217
- const encodedOAuthRedirectUrl = useMemo(()=>encodeURIComponent(oauthRedirectUrl), [
216
+ const webViewRef = react$1.useRef(null);
217
+ const { session } = react.useQuilttSession();
218
+ const encodedOAuthRedirectUrl = react$1.useMemo(()=>encodeURIComponent(oauthRedirectUrl), [
218
219
  oauthRedirectUrl
219
220
  ]);
220
- const connectorUrl = useMemo(()=>{
221
- const url = new URL(`https://${connectorId}.quiltt.app`);
221
+ const connectorUrl = react$1.useMemo(()=>{
222
+ const url = new reactNativeUrlPolyfill.URL(`https://${connectorId}.quiltt.app`);
222
223
  url.searchParams.append('mode', 'webview');
223
224
  url.searchParams.append('oauth_redirect_url', encodedOAuthRedirectUrl);
224
225
  url.searchParams.append('agent', `react-native-${version}`);
@@ -227,10 +228,10 @@ const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirect
227
228
  connectorId,
228
229
  encodedOAuthRedirectUrl
229
230
  ]);
230
- const [preFlightCheck, setPreFlightCheck] = useState({
231
+ const [preFlightCheck, setPreFlightCheck] = react$1.useState({
231
232
  checked: false
232
233
  });
233
- const checkConnectorUrl = useCallback(async (retryCount = 0)=>{
234
+ const checkConnectorUrl = react$1.useCallback(async (retryCount = 0)=>{
234
235
  let responseStatus;
235
236
  let error;
236
237
  let errorOccurred = false;
@@ -274,7 +275,7 @@ const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirect
274
275
  }, [
275
276
  connectorUrl
276
277
  ]);
277
- useEffect(()=>{
278
+ react$1.useEffect(()=>{
278
279
  if (preFlightCheck.checked) return;
279
280
  const fetchDataAndSetState = async ()=>{
280
281
  const connectorUrlStatus = await checkConnectorUrl();
@@ -285,7 +286,7 @@ const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirect
285
286
  checkConnectorUrl,
286
287
  preFlightCheck
287
288
  ]);
288
- const initInjectedJavaScript = useCallback(()=>{
289
+ const initInjectedJavaScript = react$1.useCallback(()=>{
289
290
  const script = `\
290
291
  const options = {\
291
292
  source: 'quiltt',\
@@ -313,14 +314,14 @@ const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirect
313
314
  // allowedListUrl & shouldRender ensure we are only rendering Quiltt, MX and Plaid content in Webview
314
315
  // For other urls, we assume those are bank urls, which needs to be handle in external browser.
315
316
  // @todo Convert it to a list from Quiltt Server to prevent MX/ Plaid changes.
316
- const allowedListUrl = useMemo(()=>[
317
+ const allowedListUrl = react$1.useMemo(()=>[
317
318
  'quiltt.app',
318
319
  'quiltt.dev',
319
320
  'moneydesktop.com',
320
321
  'cdn.plaid.com/link/v2/stable/link.html'
321
322
  ], []);
322
- const isQuilttEvent = useCallback((url)=>url.protocol === 'quilttconnector:', []);
323
- const shouldRender = useCallback((url)=>{
323
+ const isQuilttEvent = react$1.useCallback((url)=>url.protocol === 'quilttconnector:', []);
324
+ const shouldRender = react$1.useCallback((url)=>{
324
325
  if (isQuilttEvent(url)) return false;
325
326
  if (url.protocol !== 'https:') {
326
327
  return false;
@@ -334,14 +335,14 @@ const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirect
334
335
  const script = 'localStorage.clear();';
335
336
  webViewRef.current?.injectJavaScript(script);
336
337
  };
337
- const handleOAuthUrl = useCallback((oauthUrl)=>{
338
+ const handleOAuthUrl = react$1.useCallback((oauthUrl)=>{
338
339
  if (oauthUrl.protocol !== 'https:') {
339
340
  console.log(`handleOAuthUrl - Skipping non https url - ${oauthUrl.href}`);
340
341
  return;
341
342
  }
342
- Linking.openURL(oauthUrl.href);
343
+ reactNative.Linking.openURL(oauthUrl.href);
343
344
  }, []);
344
- const handleQuilttEvent = useCallback((url)=>{
345
+ const handleQuilttEvent = react$1.useCallback((url)=>{
345
346
  url.searchParams.delete('source');
346
347
  url.searchParams.append('connectorId', connectorId);
347
348
  const metadata = Object.fromEntries(url.searchParams);
@@ -349,31 +350,31 @@ const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirect
349
350
  switch(eventType){
350
351
  case 'Load':
351
352
  initInjectedJavaScript();
352
- onEvent?.(ConnectorSDKEventType.Load, metadata);
353
+ onEvent?.(react.ConnectorSDKEventType.Load, metadata);
353
354
  onLoad?.(metadata);
354
355
  break;
355
356
  case 'ExitAbort':
356
357
  clearLocalStorage();
357
- onEvent?.(ConnectorSDKEventType.ExitAbort, metadata);
358
- onExit?.(ConnectorSDKEventType.ExitAbort, metadata);
358
+ onEvent?.(react.ConnectorSDKEventType.ExitAbort, metadata);
359
+ onExit?.(react.ConnectorSDKEventType.ExitAbort, metadata);
359
360
  onExitAbort?.(metadata);
360
361
  break;
361
362
  case 'ExitError':
362
363
  clearLocalStorage();
363
- onEvent?.(ConnectorSDKEventType.ExitError, metadata);
364
- onExit?.(ConnectorSDKEventType.ExitError, metadata);
364
+ onEvent?.(react.ConnectorSDKEventType.ExitError, metadata);
365
+ onExit?.(react.ConnectorSDKEventType.ExitError, metadata);
365
366
  onExitError?.(metadata);
366
367
  break;
367
368
  case 'ExitSuccess':
368
369
  clearLocalStorage();
369
- onEvent?.(ConnectorSDKEventType.ExitSuccess, metadata);
370
- onExit?.(ConnectorSDKEventType.ExitSuccess, metadata);
370
+ onEvent?.(react.ConnectorSDKEventType.ExitSuccess, metadata);
371
+ onExit?.(react.ConnectorSDKEventType.ExitSuccess, metadata);
371
372
  onExitSuccess?.(metadata);
372
373
  break;
373
374
  case 'Authenticate':
374
375
  break;
375
376
  case 'OauthRequested':
376
- handleOAuthUrl(new URL(url.searchParams.get('oauthUrl')));
377
+ handleOAuthUrl(new reactNativeUrlPolyfill.URL(url.searchParams.get('oauthUrl')));
377
378
  break;
378
379
  default:
379
380
  console.log('unhandled event', url);
@@ -390,8 +391,8 @@ const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirect
390
391
  onExitSuccess,
391
392
  onLoad
392
393
  ]);
393
- const requestHandler = useCallback((request)=>{
394
- const url = new URL(request.url);
394
+ const requestHandler = react$1.useCallback((request)=>{
395
+ const url = new reactNativeUrlPolyfill.URL(request.url);
395
396
  if (isQuilttEvent(url)) {
396
397
  handleQuilttEvent(url);
397
398
  return false;
@@ -407,15 +408,15 @@ const QuilttConnector = ({ connectorId, connectionId, institution, oauthRedirect
407
408
  isQuilttEvent,
408
409
  shouldRender
409
410
  ]);
410
- if (!preFlightCheck.checked) return /*#__PURE__*/ jsx(LoadingScreen, {});
411
- if (preFlightCheck.error) return /*#__PURE__*/ jsx(ErrorScreen, {
411
+ if (!preFlightCheck.checked) return /*#__PURE__*/ jsxRuntime.jsx(LoadingScreen, {});
412
+ if (preFlightCheck.error) return /*#__PURE__*/ jsxRuntime.jsx(ErrorScreen, {
412
413
  error: preFlightCheck.error,
413
414
  cta: ()=>onExitError?.({
414
415
  connectorId
415
416
  })
416
417
  });
417
- return /*#__PURE__*/ jsx(AndroidSafeAreaView, {
418
- children: /*#__PURE__*/ jsx(WebView, {
418
+ return /*#__PURE__*/ jsxRuntime.jsx(AndroidSafeAreaView, {
419
+ children: /*#__PURE__*/ jsxRuntime.jsx(reactNativeWebview.WebView, {
419
420
  ref: webViewRef,
420
421
  // Plaid keep sending window.location = 'about:srcdoc' and causes some noise in RN
421
422
  // All whitelists are now handled in requestHandler, handleQuilttEvent and handleOAuthUrl
@@ -437,7 +438,49 @@ QuilttConnector.displayName = 'QuilttConnector';
437
438
  // Hermes doesn't have atob
438
439
  // https://github.com/facebook/hermes/issues/1178
439
440
  if (!global.atob) {
440
- global.atob = decode;
441
+ global.atob = base64.decode;
441
442
  }
442
443
 
443
- export { QuilttConnector };
444
+ Object.defineProperty(exports, "QuilttAuthProvider", {
445
+ enumerable: true,
446
+ get: function () { return react.QuilttAuthProvider; }
447
+ });
448
+ Object.defineProperty(exports, "QuilttProvider", {
449
+ enumerable: true,
450
+ get: function () { return react.QuilttProvider; }
451
+ });
452
+ Object.defineProperty(exports, "QuilttSettingsProvider", {
453
+ enumerable: true,
454
+ get: function () { return react.QuilttSettingsProvider; }
455
+ });
456
+ Object.defineProperty(exports, "useQuilttClient", {
457
+ enumerable: true,
458
+ get: function () { return react.useQuilttClient; }
459
+ });
460
+ Object.defineProperty(exports, "useQuilttConnector", {
461
+ enumerable: true,
462
+ get: function () { return react.useQuilttConnector; }
463
+ });
464
+ Object.defineProperty(exports, "useQuilttSession", {
465
+ enumerable: true,
466
+ get: function () { return react.useQuilttSession; }
467
+ });
468
+ Object.defineProperty(exports, "useQuilttSettings", {
469
+ enumerable: true,
470
+ get: function () { return react.useQuilttSettings; }
471
+ });
472
+ Object.defineProperty(exports, "useSession", {
473
+ enumerable: true,
474
+ get: function () { return react.useSession; }
475
+ });
476
+ Object.defineProperty(exports, "useStorage", {
477
+ enumerable: true,
478
+ get: function () { return react.useStorage; }
479
+ });
480
+ exports.QuilttConnector = QuilttConnector;
481
+ Object.keys(core).forEach(function (k) {
482
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
483
+ enumerable: true,
484
+ get: function () { return core[k]; }
485
+ });
486
+ });
@@ -0,0 +1,17 @@
1
+ export * from '@quiltt/core';
2
+ import { ConnectorSDKCallbacks } from '@quiltt/react';
3
+ export { QuilttAuthProvider, QuilttProvider, QuilttSettingsProvider, useQuilttClient, useQuilttConnector, useQuilttSession, useQuilttSettings, useSession, useStorage } from '@quiltt/react';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+
6
+ type QuilttConnectorProps = {
7
+ connectorId: string;
8
+ connectionId?: string;
9
+ institution?: string;
10
+ oauthRedirectUrl: string;
11
+ } & ConnectorSDKCallbacks;
12
+ declare const QuilttConnector: {
13
+ ({ connectorId, connectionId, institution, oauthRedirectUrl, onEvent, onLoad, onExit, onExitSuccess, onExitAbort, onExitError, }: QuilttConnectorProps): react_jsx_runtime.JSX.Element;
14
+ displayName: string;
15
+ };
16
+
17
+ export { QuilttConnector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quiltt/react-native",
3
- "version": "3.6.1",
3
+ "version": "3.6.3",
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": {
@@ -11,13 +11,12 @@
11
11
  "license": "MIT",
12
12
  "type": "module",
13
13
  "exports": {
14
- ".": {
15
- "import": "./dist/index.js",
14
+ "require": {
15
+ "import": "./dist/index.cjs",
16
16
  "types": "./dist/index.d.ts"
17
17
  }
18
18
  },
19
- "main": "./dist/index.js",
20
- "module": "./dist/index.js",
19
+ "main": "./dist/index.cjs",
21
20
  "types": "./dist/index.d.ts",
22
21
  "files": [
23
22
  "dist/**",
@@ -26,8 +25,8 @@
26
25
  ],
27
26
  "dependencies": {
28
27
  "@honeybadger-io/core": "6.6.0",
29
- "@quiltt/core": "3.6.1",
30
- "@quiltt/react": "3.6.1"
28
+ "@quiltt/react": "3.6.3",
29
+ "@quiltt/core": "3.6.3"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@apollo/client": "3.9.9",
package/src/index.ts CHANGED
@@ -6,19 +6,6 @@ if (!global.atob) {
6
6
  global.atob = decode
7
7
  }
8
8
 
9
- /* export type {
10
- ConnectorSDK,
11
- ConnectorSDKCallbacks,
12
- ConnectorSDKOnEventCallback,
13
- ConnectorSDKOnLoadCallback,
14
- ConnectorSDKOnExitSuccessCallback,
15
- ConnectorSDKOnExitAbortCallback,
16
- ConnectorSDKOnExitErrorCallback,
17
- ConnectorSDKEventType,
18
- ConnectorSDKCallbackMetadata,
19
- ConnectorSDKConnectOptions,
20
- } */
21
-
22
9
  export * from '@quiltt/core'
23
10
 
24
11
  export {
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '3.6.1'
2
+ export const version = '3.6.3'