react-native-unit-components 1.5.0 → 1.6.1
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/ios/UNAppInfo/UNAppInfo.swift +5 -1
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +44 -2
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.utils.js +18 -11
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +3 -5
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.utils.js +2 -23
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js +2 -1
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +2 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +1 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +1 -0
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
- package/lib/commonjs/components/utils/nativeModulesInfo.js +20 -0
- package/lib/commonjs/components/utils/nativeModulesInfo.js.map +1 -0
- package/lib/commonjs/scripts/html/bodyScript.js +13 -2
- package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
- package/lib/commonjs/webComponent/WebComponent.js +2 -1
- package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
- package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +47 -5
- package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
- package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.utils.js +16 -10
- package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.utils.js.map +1 -1
- package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +3 -5
- package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
- package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.utils.js +1 -21
- package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.utils.js.map +1 -1
- package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js +2 -1
- package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +2 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +1 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -1
- package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
- package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +1 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
- package/lib/module/components/utils/nativeModulesInfo.js +13 -0
- package/lib/module/components/utils/nativeModulesInfo.js.map +1 -0
- package/lib/module/scripts/html/bodyScript.js +13 -2
- package/lib/module/scripts/html/bodyScript.js.map +1 -1
- package/lib/module/webComponent/WebComponent.js +2 -1
- package/lib/module/webComponent/WebComponent.js.map +1 -1
- package/lib/typescript/components/UNACHCreditComponent/UNACHCreditComponent.d.ts +1 -0
- package/lib/typescript/components/UNACHCreditComponent/UNACHCreditComponent.utils.d.ts +4 -1
- package/lib/typescript/components/UNACHDebitComponent/UNACHDebitComponent.utils.d.ts +0 -1
- package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +1 -1
- package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +1 -0
- package/lib/typescript/components/UNCardComponent/UNCardComponent.d.ts +1 -0
- package/lib/typescript/components/utils/nativeModulesInfo.d.ts +1 -0
- package/lib/typescript/scripts/html/bodyScript.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +44 -5
- package/src/components/UNACHCreditComponent/UNACHCreditComponent.utils.ts +14 -11
- package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +4 -8
- package/src/components/UNACHDebitComponent/UNACHDebitComponent.utils.ts +1 -20
- package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +2 -1
- package/src/components/UNActivityComponent/UNActivityComponent.tsx +1 -1
- package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +3 -1
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +6 -0
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.ts +1 -0
- package/src/components/UNCardComponent/UNCardComponent.tsx +1 -0
- package/src/components/UNCardComponent/UNCardComponent.utils.ts +1 -0
- package/src/components/utils/nativeModulesInfo.ts +11 -0
- package/src/scripts/html/bodyScript.ts +13 -3
- package/src/webComponent/WebComponent.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { WebComponent, WebComponentType } from '../../webComponent/WebComponent';
|
|
3
3
|
import { PresentationMode } from '../../scripts/html/bodyHtml';
|
|
4
4
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
5
5
|
import type { UNOnLoadResponse, UNACHData, UNACHOnLoadData, UNError, UNOnLoadResponseData } from '../../sharedTypes';
|
|
6
6
|
import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
|
|
7
|
-
import { View } from 'react-native';
|
|
8
|
-
import {
|
|
9
|
-
import { getACHCreditParams, getACHCreditScript } from './UNACHCreditComponent.utils';
|
|
7
|
+
import { Platform, View } from 'react-native';
|
|
8
|
+
import { getACHCreditParams, getACHCreditScript, injectUnitPlaidResponse } from './UNACHCreditComponent.utils';
|
|
10
9
|
import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';
|
|
11
10
|
import type { ACHEvent } from '../../messages/webMessages/achCreditMessage';
|
|
12
11
|
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
12
|
+
import { PlaidLinkTokenData, PlaidTokenCreatedEvent, RequestExternalSdkEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
13
|
+
import { LinkSuccess, openLink } from 'react-native-plaid-link-sdk';
|
|
14
|
+
import type WebView from 'react-native-webview';
|
|
15
|
+
import { getAndroidPackageName } from '../utils/nativeModulesInfo';
|
|
13
16
|
|
|
14
17
|
export interface UNACHCreditComponentProps {
|
|
15
18
|
accountId: string;
|
|
@@ -18,6 +21,7 @@ export interface UNACHCreditComponentProps {
|
|
|
18
21
|
language?: string;
|
|
19
22
|
isAutoFocus?: boolean;
|
|
20
23
|
fee?: number;
|
|
24
|
+
withPlaid?: boolean;
|
|
21
25
|
onPaymentCreated?: (data: UNACHData) => void;
|
|
22
26
|
onLoad?: (response: UNOnLoadResponse<UNACHOnLoadData>) => void;
|
|
23
27
|
}
|
|
@@ -25,6 +29,19 @@ export interface UNACHCreditComponentProps {
|
|
|
25
29
|
export const UNACHCreditComponent = (props: UNACHCreditComponentProps) => {
|
|
26
30
|
const [height, setHeight] = useState<number>(0);
|
|
27
31
|
const [presentationMode, setPresentationMode] = useState<PresentationMode>(PresentationMode.Inherit);
|
|
32
|
+
const [linkToken, setLinkToken] = useState<string>();
|
|
33
|
+
const [appPackageName, setAppPackageName] = useState<string>();
|
|
34
|
+
const webRef = useRef<WebView>(null);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const setPackageNameForAndroid = async () => {
|
|
38
|
+
if (Platform.OS === 'android') {
|
|
39
|
+
const packageName = await getAndroidPackageName();
|
|
40
|
+
setAppPackageName(packageName);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
setPackageNameForAndroid();
|
|
44
|
+
}, []);
|
|
28
45
|
|
|
29
46
|
const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
|
|
30
47
|
if (!props.onLoad) {
|
|
@@ -72,16 +89,38 @@ export const UNACHCreditComponent = (props: UNACHCreditComponentProps) => {
|
|
|
72
89
|
}
|
|
73
90
|
break;
|
|
74
91
|
}
|
|
92
|
+
case UnitMessage.UNIT_PLAID_TOKEN_CREATED: {
|
|
93
|
+
const linkTokenEvent = message.details as PlaidTokenCreatedEvent;
|
|
94
|
+
const linkTokenData = linkTokenEvent.linkToken as PlaidLinkTokenData;
|
|
95
|
+
setLinkToken(linkTokenData.attributes.linkToken);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
case UnitMessage.UNIT_REQUEST_EXTERNAL_SDK: {
|
|
100
|
+
const externalSdkType = (message.details as RequestExternalSdkEvent).type;
|
|
101
|
+
if (externalSdkType !== 'plaid') return;
|
|
102
|
+
linkToken && openLink({
|
|
103
|
+
tokenConfig: { noLoadingState: false, token: linkToken },
|
|
104
|
+
onSuccess: (success: LinkSuccess) => {
|
|
105
|
+
injectUnitPlaidResponse(webRef.current, success);
|
|
106
|
+
},
|
|
107
|
+
onExit: exit => { console.log(exit); }
|
|
108
|
+
}).catch(e => {
|
|
109
|
+
console.error(e);
|
|
110
|
+
});
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
75
113
|
}
|
|
76
114
|
};
|
|
77
115
|
|
|
78
116
|
const renderACHCreditWebView = () => {
|
|
79
117
|
return (
|
|
80
118
|
<WebComponent
|
|
119
|
+
ref={webRef}
|
|
81
120
|
type={WebComponentType.achCreditPayment}
|
|
82
121
|
presentationMode={presentationMode}
|
|
83
122
|
params={getACHCreditParams(props)}
|
|
84
|
-
script={getACHCreditScript()}
|
|
123
|
+
script={getACHCreditScript(appPackageName)}
|
|
85
124
|
onMessage={(message: WebViewMessage) => handleWebViewMessage(message)}
|
|
86
125
|
isScrollable={false}
|
|
87
126
|
theme={props.theme}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import type { UNACHCreditComponentProps } from './UNACHCreditComponent';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
import type WebView from 'react-native-webview';
|
|
3
|
+
import type { LinkSuccess } from 'react-native-plaid-link-sdk';
|
|
4
|
+
import { DISPATCH_PLAID_RESPONSE, LISTENERS } from '../../scripts/html/bodyScript';
|
|
4
5
|
|
|
5
6
|
export const getACHCreditParams = (props: UNACHCreditComponentProps) => {
|
|
6
7
|
return `
|
|
7
8
|
account-id="${props.accountId}"
|
|
8
9
|
customer-token="${props.customerToken}"
|
|
10
|
+
with-plaid="${props.withPlaid ?? false}"
|
|
9
11
|
is-auto-focus="${props.isAutoFocus ?? false}"
|
|
10
12
|
${props.fee ? `fee="${props.fee}"` : ''}
|
|
11
13
|
style="height: 100%"
|
|
12
14
|
`;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
|
-
export const getACHCreditScript = () => {
|
|
17
|
+
export const getACHCreditScript = (appPackageName?: string) => {
|
|
16
18
|
return `
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}).catch((e) => {
|
|
22
|
-
console.log(e)
|
|
23
|
-
})
|
|
24
|
-
});
|
|
19
|
+
${LISTENERS.unitPlaidTokenCreated}
|
|
20
|
+
${appPackageName && `window.UnitMobileSDKConfig.androidPackageName='${appPackageName}'`}
|
|
21
|
+
${LISTENERS.unitPaymentCreated}
|
|
22
|
+
${DISPATCH_PLAID_RESPONSE}
|
|
25
23
|
`;
|
|
26
24
|
};
|
|
25
|
+
|
|
26
|
+
export const injectUnitPlaidResponse = (currentWeb: WebView | null, success: LinkSuccess) => {
|
|
27
|
+
const successObj = {data: { publicToken: success.publicToken, metadata: success.metadata}};
|
|
28
|
+
currentWeb?.injectJavaScript(`dispatchPlaidEvent(${JSON.stringify(successObj)})`);
|
|
29
|
+
};
|
|
@@ -6,14 +6,14 @@ import type { UNOnLoadResponse, UNACHData, UNError, UNOnLoadResponseData, UNACHO
|
|
|
6
6
|
import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
|
|
7
7
|
import { Platform, View } from 'react-native';
|
|
8
8
|
import { PlaidLinkTokenData, PlaidTokenCreatedEvent, RequestExternalSdkEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
9
|
-
import { getACHDebitParams, getACHDebitScript,
|
|
10
|
-
|
|
9
|
+
import { getACHDebitParams, getACHDebitScript, injectUnitPlaidResponse } from './UNACHDebitComponent.utils';
|
|
11
10
|
import { LinkSuccess, openLink } from 'react-native-plaid-link-sdk';
|
|
12
11
|
import type WebView from 'react-native-webview';
|
|
13
12
|
|
|
14
13
|
import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';
|
|
15
14
|
import type { ACHEvent } from '../../messages/webMessages/achCreditMessage';
|
|
16
15
|
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
16
|
+
import { getAndroidPackageName } from '../utils/nativeModulesInfo';
|
|
17
17
|
|
|
18
18
|
export interface UNACHDebitComponentProps {
|
|
19
19
|
accountId: string;
|
|
@@ -43,10 +43,6 @@ export const UNACHDebitComponent = (props: UNACHDebitComponentProps) => {
|
|
|
43
43
|
setPackageNameForAndroid();
|
|
44
44
|
}, []);
|
|
45
45
|
|
|
46
|
-
const dispatchUnitPlaidResponse = (success: LinkSuccess) => {
|
|
47
|
-
injectUnitPlaidResponse(webRef.current, success);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
46
|
const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
|
|
51
47
|
if (!props.onLoad) {
|
|
52
48
|
return;
|
|
@@ -105,8 +101,8 @@ export const UNACHDebitComponent = (props: UNACHDebitComponentProps) => {
|
|
|
105
101
|
if (externalSdkType !== 'plaid') return;
|
|
106
102
|
linkToken && openLink({
|
|
107
103
|
tokenConfig: { noLoadingState: false, token: linkToken },
|
|
108
|
-
onSuccess: (success) => {
|
|
109
|
-
|
|
104
|
+
onSuccess: (success: LinkSuccess) => {
|
|
105
|
+
injectUnitPlaidResponse(webRef.current, success);
|
|
110
106
|
},
|
|
111
107
|
onExit: exit => { console.log(exit); }
|
|
112
108
|
}).catch(e => {
|
|
@@ -3,9 +3,6 @@ import type { UNACHDebitComponentProps } from './UNACHDebitComponent';
|
|
|
3
3
|
|
|
4
4
|
import type WebView from 'react-native-webview';
|
|
5
5
|
import type { LinkSuccess } from 'react-native-plaid-link-sdk';
|
|
6
|
-
import { NativeModules } from 'react-native';
|
|
7
|
-
const { RNAppInfoModule } = NativeModules;
|
|
8
|
-
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
9
6
|
|
|
10
7
|
export const getACHDebitParams = (props: UNACHDebitComponentProps) => {
|
|
11
8
|
return `
|
|
@@ -17,25 +14,9 @@ export const getACHDebitParams = (props: UNACHDebitComponentProps) => {
|
|
|
17
14
|
`;
|
|
18
15
|
};
|
|
19
16
|
|
|
20
|
-
export const getAndroidPackageName = async () => {
|
|
21
|
-
try {
|
|
22
|
-
const response = await RNAppInfoModule.getAppPackageName();
|
|
23
|
-
return response;
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.error(error);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
17
|
export const getACHDebitScript = (androidPackageName?: string) => {
|
|
30
18
|
return `
|
|
31
|
-
|
|
32
|
-
const response = e.detail
|
|
33
|
-
response.then((data) => {
|
|
34
|
-
postMessageToSDK({ type: "${UnitMessage.UNIT_PLAID_TOKEN_CREATED}", details: { linkToken: data.data }})
|
|
35
|
-
}).catch((e) => {
|
|
36
|
-
console.log(e)
|
|
37
|
-
})
|
|
38
|
-
});
|
|
19
|
+
${LISTENERS.unitPlaidTokenCreated}
|
|
39
20
|
${androidPackageName && `window.UnitMobileSDKConfig.androidPackageName='${androidPackageName}'`}
|
|
40
21
|
${LISTENERS.unitPaymentCreated}
|
|
41
22
|
${DISPATCH_PLAID_RESPONSE}
|
|
@@ -5,9 +5,10 @@ import { WebComponentType } from '../../webComponent/WebComponent';
|
|
|
5
5
|
import type { UNAccountMenuAction } from 'src/sharedTypes';
|
|
6
6
|
|
|
7
7
|
export const getAccountParams = (props: UNAccountComponentProps) => {
|
|
8
|
+
const accountIdParam = props.accountId ? `account-id="${props.accountId}"` : '';
|
|
8
9
|
return `
|
|
9
|
-
account-id="${props.accountId}"
|
|
10
10
|
customer-token="${props.customerToken}"
|
|
11
|
+
${accountIdParam}
|
|
11
12
|
hide-actions-menu-button="${props.hideActionsMenuButton || false}"
|
|
12
13
|
hide-selection-menu-button="${props.hideSelectionMenuButton || false}"
|
|
13
14
|
`;
|
|
@@ -18,8 +18,8 @@ import { ActivityMessage } from '../../messages/webMessages/activityMessage';
|
|
|
18
18
|
const DEFAULT_HEIGHT = Dimensions.get('window').height * 0.5;
|
|
19
19
|
export interface UNActivityComponentProps {
|
|
20
20
|
// inputs
|
|
21
|
-
accountId: string;
|
|
22
21
|
customerToken: string;
|
|
22
|
+
accountId?: string;
|
|
23
23
|
queryFilter?: string
|
|
24
24
|
|
|
25
25
|
// ui
|
|
@@ -5,10 +5,12 @@ import { DISPATCH_REQUEST_REFRESH } from './../../scripts/html/bodyScript';
|
|
|
5
5
|
import type { UNActivityComponentProps } from './UNActivityComponent';
|
|
6
6
|
|
|
7
7
|
export const getActivityParams = (props: UNActivityComponentProps) => {
|
|
8
|
+
const accountIdParam = props.accountId ? `account-id="${props.accountId}"` : '';
|
|
8
9
|
const queryFilterParam = props.queryFilter ? `query-filter="${props.queryFilter}"` : '';
|
|
10
|
+
|
|
9
11
|
return `
|
|
10
|
-
account-id="${props.accountId}"
|
|
11
12
|
customer-token="${props.customerToken}"
|
|
13
|
+
${accountIdParam}
|
|
12
14
|
hide-filter-button="${props.hideFilterButton || false}"
|
|
13
15
|
${queryFilterParam}
|
|
14
16
|
style="height: 100%"
|
|
@@ -12,13 +12,19 @@ import type { BookPaymentEvent } from '../../messages/webMessages/bookPaymentMes
|
|
|
12
12
|
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
13
13
|
|
|
14
14
|
export interface UNBookPaymentComponentProps {
|
|
15
|
+
//inputs
|
|
15
16
|
accountId: string;
|
|
16
17
|
customerToken: string;
|
|
17
18
|
isSameCustomer: boolean;
|
|
18
19
|
counterPartyAccountId: string;
|
|
19
20
|
counterPartyName: string;
|
|
21
|
+
|
|
22
|
+
// ui
|
|
20
23
|
theme?: string;
|
|
21
24
|
language?: string;
|
|
25
|
+
isAutoFocus?: boolean;
|
|
26
|
+
|
|
27
|
+
// events
|
|
22
28
|
onPaymentCreated?: (data: UNBookPaymentData) => void;
|
|
23
29
|
onLoad?: (response: UNOnLoadResponse<UNAccountData>) => void;
|
|
24
30
|
}
|
|
@@ -10,6 +10,7 @@ export const getBookPaymentParams = (props: UNBookPaymentComponentProps) => {
|
|
|
10
10
|
is-same-customer="${props.isSameCustomer}"
|
|
11
11
|
counterparty-account-id="${props.counterPartyAccountId}"
|
|
12
12
|
counterparty-name="${props.counterPartyName}"
|
|
13
|
+
is-auto-focus="${props.isAutoFocus || false}"
|
|
13
14
|
style="height: 100%"
|
|
14
15
|
`;
|
|
15
16
|
};
|
|
@@ -17,6 +17,7 @@ export const getCardParams = (props: UNCardComponentProps) => {
|
|
|
17
17
|
hide-actions-menu-button="${props.hideActionsMenuButton || false}"
|
|
18
18
|
hide-card-title="${props.hideCardTitle || false}"
|
|
19
19
|
hide-sensitive-data-button="${props.hideSensitiveDataButton || false}"
|
|
20
|
+
learn-more-url="${props.learnMoreUrl || ''}"
|
|
20
21
|
`;
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
const { RNAppInfoModule } = NativeModules;
|
|
3
|
+
|
|
4
|
+
export const getAndroidPackageName = async () => {
|
|
5
|
+
try {
|
|
6
|
+
const response = await RNAppInfoModule.getAppPackageName();
|
|
7
|
+
return response;
|
|
8
|
+
} catch (error) {
|
|
9
|
+
console.error(error);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -84,7 +84,7 @@ export const LISTENERS = {
|
|
|
84
84
|
window.addEventListener("${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}", (e) => {
|
|
85
85
|
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}", details: e.detail })
|
|
86
86
|
});
|
|
87
|
-
`,
|
|
87
|
+
`,
|
|
88
88
|
unitPaymentCreated: `
|
|
89
89
|
window.addEventListener("${PaymentMessage.PAYMENT_CREATED}", (e) => {
|
|
90
90
|
const response = e.detail
|
|
@@ -93,8 +93,18 @@ export const LISTENERS = {
|
|
|
93
93
|
}).catch((e) => {
|
|
94
94
|
console.log(e)
|
|
95
95
|
})
|
|
96
|
-
})
|
|
97
|
-
|
|
96
|
+
});
|
|
97
|
+
`,
|
|
98
|
+
unitPlaidTokenCreated: `
|
|
99
|
+
window.addEventListener("${UnitMessage.UNIT_PLAID_TOKEN_CREATED}", (e) => {
|
|
100
|
+
const response = e.detail
|
|
101
|
+
response.then((data) => {
|
|
102
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_PLAID_TOKEN_CREATED}", details: { linkToken: data.data }})
|
|
103
|
+
}).catch((e) => {
|
|
104
|
+
console.log(e)
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
`,
|
|
98
108
|
unitAccountChanged: `
|
|
99
109
|
window.addEventListener("${AccountMessage.UNIT_ACCOUNT_CHANGED}", (e) => {
|
|
100
110
|
const response = e.detail
|
|
@@ -139,7 +139,7 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
|
|
|
139
139
|
onScroll={_onScroll}
|
|
140
140
|
overScrollMode="never"
|
|
141
141
|
injectedJavaScript={unitScript}
|
|
142
|
-
style={{ width: width, flex: 1, opacity: 0.99 }}
|
|
142
|
+
style={{ width: width, flex: 1, opacity: 0.99, backgroundColor: "transparent" }}
|
|
143
143
|
source={{ html: sourceHtml, baseUrl: `https://${baseName}` }}
|
|
144
144
|
onMessage={onMessage}
|
|
145
145
|
androidHardwareAccelerationDisabled
|