Skip to content

Commit 6e1a6ed

Browse files
Merge pull request #129 from mxenabled/wes/removeProxy
Remove functionality from the connect widget
2 parents e1d6695 + d391ae2 commit 6e1a6ed

19 files changed

Lines changed: 133 additions & 290 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
- Custom onLoadUrlInBrowser and onLoadUrlInBrowserError props
2121
- uiMessageWebviewUrlScheme is no longer supported. The default scheme of the mx widgets will be used which is "mx". clientRedirectUrl has been the recommended method for redirecting from oauth for [years](https://docs.mx.com/release-notes/2022/#february)
22+
- The proxy property has been removed from the connect widget. Before a connect widget is rendered a widget url should be fetched and then provided to the widget.
2223

2324
### Changed
2425

example/app.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828
"favicon": "./assets/images/favicon.png"
2929
},
3030
"plugins": [
31-
"expo-router",
31+
[
32+
"expo-router",
33+
{
34+
"origin": false
35+
}
36+
],
3237
[
3338
"expo-splash-screen",
3439
{

example/app/connect.tsx

Lines changed: 0 additions & 56 deletions
This file was deleted.

example/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/src/app/connect.tsx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import React, { useEffect, useState } from "react"
2+
import { StyleSheet } from "react-native"
3+
import { SafeAreaView } from "react-native-safe-area-context"
4+
import * as Linking from "expo-linking"
5+
6+
import { ConnectWidget } from "@mxenabled/react-native-widget-sdk"
7+
import { fetchConnectWidgetUrl } from "../shared/api"
8+
9+
const styles = StyleSheet.create({
10+
page: {
11+
backgroundColor: "#ffffff",
12+
paddingTop: 10,
13+
},
14+
})
15+
16+
export default function Connect() {
17+
const clientRedirectUrl = Linking.createURL("connect")
18+
19+
const [url, setUrl] = useState<string | null>(null)
20+
21+
useEffect(() => {
22+
fetchConnectWidgetUrl(clientRedirectUrl).then((url) => {
23+
setUrl(url)
24+
})
25+
}, [clientRedirectUrl])
26+
27+
return (
28+
<SafeAreaView style={styles.page}>
29+
{url && (
30+
<ConnectWidget
31+
url={url}
32+
onSsoUrlLoadError={(error) => {
33+
console.error(`SSO URL load error: ${error}`)
34+
}}
35+
onMessage={(url) => {
36+
console.log(`Got a message: ${url}`)
37+
}}
38+
onInvalidMessageError={(url, _error) => {
39+
console.log(`Got an unknown message: ${url}`)
40+
}}
41+
onLoad={(_payload) => {
42+
console.log("Widget is loading")
43+
}}
44+
onLoaded={(_payload) => {
45+
console.log("Widget has loaded")
46+
}}
47+
onMemberConnected={(payload) => {
48+
console.log(`Member connected with payload: ${JSON.stringify(payload)}`)
49+
}}
50+
onOAuthError={(payload) => {
51+
console.log(`OAuth error with payload: ${JSON.stringify(payload)}`)
52+
}}
53+
onOAuthRequested={(payload) => {
54+
console.log(`OAuth requested with URL: ${payload.url}`)
55+
}}
56+
onStepChange={(payload) => {
57+
console.log(`Moving from ${payload.previous} to ${payload.current}`)
58+
}}
59+
onSelectedInstitution={(payload) => {
60+
console.log(`Selecting ${payload.name}`)
61+
}}
62+
/>
63+
)}
64+
</SafeAreaView>
65+
)
66+
}

0 commit comments

Comments
 (0)