@quiltt/react-native 3.6.2 → 3.6.4
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 +20 -0
- package/dist/index.cjs +490 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +158 -154
- package/package.json +9 -8
- package/src/components/AndroidSafeAreaView.tsx +8 -2
- package/src/components/ErrorScreen.tsx +4 -3
- package/src/components/LoadingScreen.tsx +7 -3
- package/src/components/QuilttConnector.tsx +21 -68
- package/src/index.ts +0 -13
- package/src/utils/connector/checkConnectorUrl.ts +47 -0
- package/src/utils/connector/handleOAuthUrl.ts +9 -0
- package/src/utils/connector/handleQuilttEvent.ts +0 -0
- package/src/utils/connector/index.ts +2 -0
- package/src/utils/{ErrorReporter.ts → error/ErrorReporter.ts} +1 -2
- package/src/utils/{ErrorReporterConfig.ts → error/ErrorReporterConfig.ts} +0 -1
- package/src/utils/{getErrorMessage.ts → error/getErrorMessage.ts} +1 -3
- package/src/utils/error/index.ts +2 -0
- package/src/utils/index.ts +2 -2
- package/src/version.ts +1 -1
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 {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getErrorMessage, ErrorReporter } from '../error'
|
|
2
|
+
import { Platform } from 'react-native'
|
|
3
|
+
|
|
4
|
+
const errorReporter = new ErrorReporter(`${Platform.OS} ${Platform.Version}`)
|
|
5
|
+
const PREFLIGHT_RETRY_COUNT = 3
|
|
6
|
+
|
|
7
|
+
export type PreFlightCheck = {
|
|
8
|
+
checked: boolean
|
|
9
|
+
error?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const checkConnectorUrl = async (
|
|
13
|
+
connectorUrl: string,
|
|
14
|
+
retryCount = 0
|
|
15
|
+
): Promise<PreFlightCheck> => {
|
|
16
|
+
let responseStatus
|
|
17
|
+
let error
|
|
18
|
+
let errorOccurred = false
|
|
19
|
+
try {
|
|
20
|
+
const response = await fetch(connectorUrl)
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
console.error(`The URL ${connectorUrl} is not routable.`)
|
|
23
|
+
responseStatus = response.status
|
|
24
|
+
errorOccurred = true
|
|
25
|
+
} else {
|
|
26
|
+
console.log(`The URL ${connectorUrl} is routable.`)
|
|
27
|
+
return { checked: true }
|
|
28
|
+
}
|
|
29
|
+
} catch (e) {
|
|
30
|
+
error = e
|
|
31
|
+
console.error(`An error occurred while checking the connector URL: ${error}`)
|
|
32
|
+
errorOccurred = true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (errorOccurred && retryCount < PREFLIGHT_RETRY_COUNT) {
|
|
36
|
+
const delay = 50 * Math.pow(2, retryCount)
|
|
37
|
+
await new Promise((resolve) => setTimeout(resolve, delay))
|
|
38
|
+
console.log(`Retrying... Attempt number ${retryCount + 1}`)
|
|
39
|
+
return checkConnectorUrl(connectorUrl, retryCount + 1)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const errorMessage = getErrorMessage(responseStatus, error as Error)
|
|
43
|
+
const errorToSend = (error as Error) || new Error(errorMessage)
|
|
44
|
+
const context = { connectorUrl, responseStatus }
|
|
45
|
+
if (responseStatus !== 404) await errorReporter.send(errorToSend, context)
|
|
46
|
+
return { checked: true, error: errorMessage }
|
|
47
|
+
}
|
|
File without changes
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Quick hack to send error to Honeybadger to debug why the connector is not routable
|
|
2
|
-
|
|
3
2
|
import type { Notice, NoticeTransportPayload } from '@honeybadger-io/core/build/src/types'
|
|
4
3
|
import { generateStackTrace, getCauses, makeBacktrace } from '@honeybadger-io/core/build/src/util'
|
|
5
4
|
|
|
6
5
|
import { ErrorReporterConfig } from './ErrorReporterConfig'
|
|
7
|
-
import { version } from '
|
|
6
|
+
import { version } from '../../version'
|
|
8
7
|
|
|
9
8
|
const notifier = {
|
|
10
9
|
name: 'Quiltt React Native SDK Reporter',
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
const getErrorMessage = (responseStatus?: number, error?: Error): string => {
|
|
1
|
+
export const getErrorMessage = (responseStatus?: number, error?: Error): string => {
|
|
2
2
|
if (error)
|
|
3
3
|
return `An error occurred while checking the connector URL: ${error?.name} \n${error?.message}`
|
|
4
4
|
return responseStatus
|
|
5
5
|
? `The URL is not routable. Response status: ${responseStatus}`
|
|
6
6
|
: 'An error occurred while checking the connector URL'
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
export { getErrorMessage }
|
package/src/utils/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './connector'
|
|
2
|
+
export * from './error'
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '3.6.
|
|
2
|
+
export const version = '3.6.4'
|