react-native-unit-components 1.12.0 → 1.13.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/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +4 -1
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
- package/lib/commonjs/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.js +82 -0
- package/lib/commonjs/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.js.map +1 -0
- package/lib/commonjs/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.utils.js +30 -0
- package/lib/commonjs/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.utils.js.map +1 -0
- package/lib/commonjs/components/UNFundAccountPaymentComponent/index.js +21 -0
- package/lib/commonjs/components/UNFundAccountPaymentComponent/index.js.map +1 -0
- package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js +1 -1
- package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js.map +1 -1
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/messages/webMessages/fundAccountPaymentMessage.js +6 -0
- package/lib/commonjs/messages/webMessages/fundAccountPaymentMessage.js.map +1 -0
- package/lib/commonjs/messages/webMessages/onLoadMessage.js +2 -0
- package/lib/commonjs/messages/webMessages/onLoadMessage.js.map +1 -1
- package/lib/commonjs/types/internal/webComponent.types.js +1 -0
- package/lib/commonjs/types/internal/webComponent.types.js.map +1 -1
- package/lib/commonjs/types/shared/checkDeposit.types.js.map +1 -1
- package/lib/commonjs/types/shared/fundAccountPayment.types.js +6 -0
- package/lib/commonjs/types/shared/fundAccountPayment.types.js.map +1 -0
- package/lib/commonjs/types/shared/index.js +11 -0
- package/lib/commonjs/types/shared/index.js.map +1 -1
- package/lib/commonjs/types/shared/payments.types.js +17 -1
- package/lib/commonjs/types/shared/payments.types.js.map +1 -1
- package/lib/commonjs/types/shared/types.js +10 -0
- package/lib/commonjs/types/shared/types.js.map +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js +4 -0
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
- package/lib/commonjs/unitSdkManager/unitHelpersManager/UnitHelpersManager.js +18 -0
- package/lib/commonjs/unitSdkManager/unitHelpersManager/UnitHelpersManager.js.map +1 -1
- package/lib/commonjs/webComponent/WebComponent.js +4 -3
- package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
- package/lib/commonjs/webComponent/WebComponent.utils.js +2 -2
- package/lib/commonjs/webComponent/WebComponent.utils.js.map +1 -1
- package/lib/commonjs/webComponent/html.js +1 -0
- package/lib/commonjs/webComponent/html.js.map +1 -1
- package/lib/module/components/UNAccountComponent/UNAccountComponent.js +5 -2
- package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
- package/lib/module/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.js +73 -0
- package/lib/module/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.js.map +1 -0
- package/lib/module/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.utils.js +22 -0
- package/lib/module/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.utils.js.map +1 -0
- package/lib/module/components/UNFundAccountPaymentComponent/index.js +2 -0
- package/lib/module/components/UNFundAccountPaymentComponent/index.js.map +1 -0
- package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js +1 -1
- package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js.map +1 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/messages/webMessages/fundAccountPaymentMessage.js +2 -0
- package/lib/module/messages/webMessages/fundAccountPaymentMessage.js.map +1 -0
- package/lib/module/messages/webMessages/onLoadMessage.js +2 -0
- package/lib/module/messages/webMessages/onLoadMessage.js.map +1 -1
- package/lib/module/types/internal/webComponent.types.js +1 -0
- package/lib/module/types/internal/webComponent.types.js.map +1 -1
- package/lib/module/types/shared/checkDeposit.types.js.map +1 -1
- package/lib/module/types/shared/fundAccountPayment.types.js +2 -0
- package/lib/module/types/shared/fundAccountPayment.types.js.map +1 -0
- package/lib/module/types/shared/index.js +1 -0
- package/lib/module/types/shared/index.js.map +1 -1
- package/lib/module/types/shared/payments.types.js +16 -0
- package/lib/module/types/shared/payments.types.js.map +1 -1
- package/lib/module/types/shared/types.js +6 -0
- package/lib/module/types/shared/types.js.map +1 -1
- package/lib/module/unitSdkManager/UnitSdkManager.js +4 -0
- package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
- package/lib/module/unitSdkManager/unitHelpersManager/UnitHelpersManager.js +18 -0
- package/lib/module/unitSdkManager/unitHelpersManager/UnitHelpersManager.js.map +1 -1
- package/lib/module/webComponent/WebComponent.js +4 -3
- package/lib/module/webComponent/WebComponent.js.map +1 -1
- package/lib/module/webComponent/WebComponent.utils.js +2 -2
- package/lib/module/webComponent/WebComponent.utils.js.map +1 -1
- package/lib/module/webComponent/html.js +1 -0
- package/lib/module/webComponent/html.js.map +1 -1
- package/lib/typescript/src/components/UNAccountComponent/UNAccountComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.d.ts +19 -0
- package/lib/typescript/src/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.utils.d.ts +4 -0
- package/lib/typescript/src/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.utils.d.ts.map +1 -0
- package/lib/typescript/src/components/UNFundAccountPaymentComponent/index.d.ts +2 -0
- package/lib/typescript/src/components/UNFundAccountPaymentComponent/index.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/messages/webMessages/fundAccountPaymentMessage.d.ts +6 -0
- package/lib/typescript/src/messages/webMessages/fundAccountPaymentMessage.d.ts.map +1 -0
- package/lib/typescript/src/messages/webMessages/index.d.ts +2 -1
- package/lib/typescript/src/messages/webMessages/index.d.ts.map +1 -1
- package/lib/typescript/src/messages/webMessages/onLoadMessage.d.ts +9 -2
- package/lib/typescript/src/messages/webMessages/onLoadMessage.d.ts.map +1 -1
- package/lib/typescript/src/types/internal/webComponent.types.d.ts +1 -0
- package/lib/typescript/src/types/internal/webComponent.types.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/achCredit.types.d.ts +2 -2
- package/lib/typescript/src/types/shared/achCredit.types.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/bookPayment.types.d.ts +2 -2
- package/lib/typescript/src/types/shared/bookPayment.types.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/checkDeposit.types.d.ts +1 -1
- package/lib/typescript/src/types/shared/checkDeposit.types.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/fundAccountPayment.types.d.ts +38 -0
- package/lib/typescript/src/types/shared/fundAccountPayment.types.d.ts.map +1 -0
- package/lib/typescript/src/types/shared/index.d.ts +1 -0
- package/lib/typescript/src/types/shared/index.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/payments.types.d.ts +28 -1
- package/lib/typescript/src/types/shared/payments.types.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/types.d.ts +7 -4
- package/lib/typescript/src/types/shared/types.d.ts.map +1 -1
- package/lib/typescript/src/unitSdkManager/UnitSdkManager.d.ts +2 -0
- package/lib/typescript/src/unitSdkManager/UnitSdkManager.d.ts.map +1 -1
- package/lib/typescript/src/unitSdkManager/unitHelpersManager/UnitHelpersManager.d.ts +2 -0
- package/lib/typescript/src/unitSdkManager/unitHelpersManager/UnitHelpersManager.d.ts.map +1 -1
- package/lib/typescript/src/webComponent/WebComponent.d.ts.map +1 -1
- package/lib/typescript/src/webComponent/WebComponent.utils.d.ts.map +1 -1
- package/lib/typescript/src/webComponent/html.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/UNAccountComponent/UNAccountComponent.tsx +6 -2
- package/src/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.tsx +107 -0
- package/src/components/UNFundAccountPaymentComponent/UNFundAccountPaymentComponent.utils.ts +24 -0
- package/src/components/UNFundAccountPaymentComponent/index.ts +1 -0
- package/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/messages/webMessages/fundAccountPaymentMessage.ts +8 -0
- package/src/messages/webMessages/index.ts +2 -0
- package/src/messages/webMessages/onLoadMessage.ts +12 -1
- package/src/messages/webMessages/unitMessages.ts +1 -1
- package/src/types/internal/webComponent.types.ts +1 -0
- package/src/types/shared/achCredit.types.ts +2 -2
- package/src/types/shared/bookPayment.types.ts +2 -2
- package/src/types/shared/checkDeposit.types.ts +1 -2
- package/src/types/shared/fundAccountPayment.types.ts +38 -0
- package/src/types/shared/index.ts +1 -0
- package/src/types/shared/payments.types.ts +32 -1
- package/src/types/shared/types.ts +9 -4
- package/src/unitSdkManager/UnitSdkManager.ts +5 -0
- package/src/unitSdkManager/unitHelpersManager/UnitHelpersManager.ts +20 -0
- package/src/webComponent/WebComponent.tsx +4 -3
- package/src/webComponent/WebComponent.utils.ts +2 -2
- package/src/webComponent/html.ts +1 -0
- package/lib/commonjs/utils/SDKInfo.js +0 -13
- package/lib/commonjs/utils/SDKInfo.js.map +0 -1
- package/lib/module/utils/SDKInfo.js +0 -5
- package/lib/module/utils/SDKInfo.js.map +0 -1
- package/lib/typescript/src/utils/SDKInfo.d.ts +0 -2
- package/lib/typescript/src/utils/SDKInfo.d.ts.map +0 -1
- package/src/utils/SDKInfo.ts +0 -5
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* eslint-disable no-case-declarations */
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import type WebView from 'react-native-webview';
|
|
4
|
+
import {
|
|
5
|
+
UnitMessage,
|
|
6
|
+
} from '../../messages/webMessages/unitMessages';
|
|
7
|
+
import { WebComponent } from '../../webComponent/WebComponent';
|
|
8
|
+
import type { WebViewMessage } from '../../messages/webMessages';
|
|
9
|
+
import {
|
|
10
|
+
getFundAccountPaymentParams,
|
|
11
|
+
getFundAccountPaymentScript,
|
|
12
|
+
} from './UNFundAccountPaymentComponent.utils';
|
|
13
|
+
import type { UNFundAccountPaymentData, UNFundAccountPaymentOnLoadData, UNAstraExternalCardData, UNCardData, UNError, UNOnLoadResponse } from '../../types/shared';
|
|
14
|
+
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
15
|
+
import { withReduxStore } from '../../helpers/store/helpers';
|
|
16
|
+
import { SafeAreaView } from 'react-native';
|
|
17
|
+
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
18
|
+
import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';
|
|
19
|
+
import { FundAccountPaymentEvent } from '../../messages/webMessages/fundAccountPaymentMessage';
|
|
20
|
+
export interface UNFundAccountPaymentComponentProps {
|
|
21
|
+
// inputs
|
|
22
|
+
accountId?: string;
|
|
23
|
+
customerToken: string;
|
|
24
|
+
fee?: number;
|
|
25
|
+
isAutoFocus?: boolean;
|
|
26
|
+
|
|
27
|
+
// ui
|
|
28
|
+
theme?: string;
|
|
29
|
+
language?: string;
|
|
30
|
+
|
|
31
|
+
initialStageBackButton?: boolean;
|
|
32
|
+
finalStageDoneButton?: boolean;
|
|
33
|
+
|
|
34
|
+
// events
|
|
35
|
+
onLoad?: (response: UNOnLoadResponse<UNFundAccountPaymentOnLoadData>) => void;
|
|
36
|
+
onPaymentCreated?: (data: UNFundAccountPaymentData) => void;
|
|
37
|
+
onInitialStageBackButtonClicked?: () => void;
|
|
38
|
+
onFinalStageDoneButtonClicked?: () => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const UNFundAccountPaymentComponent = (props: UNFundAccountPaymentComponentProps) => {
|
|
42
|
+
const webRef = useRef<WebView>(null);
|
|
43
|
+
|
|
44
|
+
const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
|
|
45
|
+
if (!props.onLoad) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (RESPONSE_KEYS.errors in response) {
|
|
50
|
+
props.onLoad(response as UNError);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (RESPONSE_KEYS.astraExternalCard in response) {
|
|
55
|
+
// AstraOnLoadResponse
|
|
56
|
+
props.onLoad(response[RESPONSE_KEYS.astraExternalCard] as UNOnLoadResponse<[UNAstraExternalCardData]>);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (RESPONSE_KEYS.accountCards in response) {
|
|
61
|
+
props.onLoad(response[RESPONSE_KEYS.accountCards] as UNOnLoadResponse<[UNCardData]>);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.error('On Load Error: unexpected response type');
|
|
66
|
+
return;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleMessage = (message: WebViewMessage) => {
|
|
70
|
+
switch (message.type) {
|
|
71
|
+
case UnitMessage.UNIT_ON_LOAD:
|
|
72
|
+
handleUnitOnLoad(message.details as UnitOnLoadResponseEvent);
|
|
73
|
+
break;
|
|
74
|
+
case PaymentMessage.PAYMENT_CREATED:
|
|
75
|
+
const fundAccountPayment = message.details as FundAccountPaymentEvent;
|
|
76
|
+
props.onPaymentCreated && props.onPaymentCreated(fundAccountPayment.data as UNFundAccountPaymentData);
|
|
77
|
+
break;
|
|
78
|
+
case PaymentMessage.INITIAL_STAGE_BACK_BUTTON_CLICKED: {
|
|
79
|
+
props.onInitialStageBackButtonClicked && props.onInitialStageBackButtonClicked();
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case PaymentMessage.FINAL_STAGE_DONE_BUTTON_CLICKED: {
|
|
83
|
+
props.onFinalStageDoneButtonClicked && props.onFinalStageDoneButtonClicked();
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<SafeAreaView style={{flex: 1, minHeight: 400}}>
|
|
91
|
+
<WebComponent
|
|
92
|
+
ref={webRef}
|
|
93
|
+
type={WebComponentType.fundAccountPayment}
|
|
94
|
+
presentationMode={PresentationMode.Inherit}
|
|
95
|
+
params={getFundAccountPaymentParams(props)}
|
|
96
|
+
script={getFundAccountPaymentScript()}
|
|
97
|
+
theme={props.theme}
|
|
98
|
+
language={props.language}
|
|
99
|
+
onMessage={message => handleMessage(message)}
|
|
100
|
+
isScrollable={true}
|
|
101
|
+
nestedScrollEnabled={true}
|
|
102
|
+
/>
|
|
103
|
+
</SafeAreaView>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default withReduxStore<UNFundAccountPaymentComponentProps>(UNFundAccountPaymentComponent);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UNFundAccountPaymentComponentProps } from './UNFundAccountPaymentComponent';
|
|
2
|
+
import { LISTENERS } from '../../scripts/html/bodyScript';
|
|
3
|
+
|
|
4
|
+
export const getFundAccountPaymentParams = (props: UNFundAccountPaymentComponentProps) => {
|
|
5
|
+
const accountIdParam = props.accountId ? `account-id="${props.accountId}"` : '';
|
|
6
|
+
const feeParam = props.fee ? `fee="${props.fee}"` : '';
|
|
7
|
+
return `
|
|
8
|
+
customer-token="${props.customerToken}"
|
|
9
|
+
${accountIdParam}
|
|
10
|
+
${feeParam}
|
|
11
|
+
is-auto-focus="${props.isAutoFocus ?? false}"
|
|
12
|
+
initial-stage-back-button="${props.initialStageBackButton ?? false}"
|
|
13
|
+
final-stage-done-button="${props.finalStageDoneButton ?? false}"
|
|
14
|
+
style="height: 100%"
|
|
15
|
+
`;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const getFundAccountPaymentScript = () => {
|
|
19
|
+
return `
|
|
20
|
+
${LISTENERS.unitPaymentCreated}
|
|
21
|
+
${LISTENERS.unitPaymentInitialStageBackButtonClicked}
|
|
22
|
+
${LISTENERS.unitPaymentFinalStageDoneButtonClicked}
|
|
23
|
+
`;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UNFundAccountPaymentComponent, UNFundAccountPaymentComponentProps } from './UNFundAccountPaymentComponent';
|
|
@@ -79,7 +79,7 @@ const UNWhiteLabelAppComponent = (props: UNWhiteLabelAppComponentProps) => {
|
|
|
79
79
|
try {
|
|
80
80
|
const token = await UNStoreManagerHelper.getValue(UserDataKeys.unitCustomerToken);
|
|
81
81
|
if (token) {
|
|
82
|
-
setItemInWindowUnitStore(webRef.current, UserDataKeys.unitCustomerToken, token
|
|
82
|
+
setItemInWindowUnitStore(webRef.current, UserDataKeys.unitCustomerToken, token);
|
|
83
83
|
}
|
|
84
84
|
} catch (e) {
|
|
85
85
|
console.log(e);
|
package/src/components/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './UNBottomSheetComponent';
|
|
|
4
4
|
export * from './UNBookPaymentComponent';
|
|
5
5
|
export * from './UNActivityComponent';
|
|
6
6
|
export * from './UNAccountComponent';
|
|
7
|
+
export * from './UNFundAccountPaymentComponent';
|
|
7
8
|
export * from './UNCheckDepositComponent';
|
|
8
9
|
export * from './UNACHDebitComponent';
|
|
9
10
|
export * from './UNACHCreditComponent';
|
|
@@ -9,6 +9,7 @@ import type { AccountEvent, AccountMessage } from './accountMessage';
|
|
|
9
9
|
import type { CheckEvent, CheckMessage } from './checkMessage';
|
|
10
10
|
import type { ActivityEvent, ActivityMessage } from './activityMessage';
|
|
11
11
|
import type { MultipleCardsEvent, MultipleCardsMessage } from './multipleCardsMessage';
|
|
12
|
+
import { FundAccountPaymentEvent } from './fundAccountPaymentMessage';
|
|
12
13
|
import { PlaidEvent, PlaidMessage } from './plaidMessages';
|
|
13
14
|
import { PayeeManagementMessage, PayeeManagementEvent } from './payeeManagementMessage';
|
|
14
15
|
|
|
@@ -32,6 +33,7 @@ type WebViewEvent =
|
|
|
32
33
|
| BookPaymentEvent
|
|
33
34
|
| PaymentMessage
|
|
34
35
|
| ACHEvent
|
|
36
|
+
| FundAccountPaymentEvent
|
|
35
37
|
| AccountEvent
|
|
36
38
|
| CheckEvent
|
|
37
39
|
| ActivityEvent
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
} from '../../types/shared';
|
|
8
8
|
import type { UNAuthorizationData } from '../../types/shared/authorization.types';
|
|
9
9
|
import type { UNTransactionData } from '../../types/shared/transactions.types';
|
|
10
|
+
import type { UNAstraExternalCardData } from '../../types/shared/payments.types';
|
|
10
11
|
|
|
11
12
|
export enum RESPONSE_KEYS {
|
|
12
13
|
errors = 'errors',
|
|
@@ -16,7 +17,9 @@ export enum RESPONSE_KEYS {
|
|
|
16
17
|
counterpartyAccount = 'counterpartyResult',
|
|
17
18
|
transactions = 'transactionsResult',
|
|
18
19
|
authorizations = 'authorizationsResult',
|
|
19
|
-
repayment = 'repaymentResult'
|
|
20
|
+
repayment = 'repaymentResult',
|
|
21
|
+
astraExternalCard = 'astraCardsResult',
|
|
22
|
+
accountCards = 'accountCardsResult'
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export type CardsOnLoadResponse = {
|
|
@@ -44,6 +47,13 @@ export type ActivityOnLoadResponse = {
|
|
|
44
47
|
[RESPONSE_KEYS.transactions]: UNOnLoadResponseData<[UNTransactionData]>
|
|
45
48
|
}
|
|
46
49
|
|
|
50
|
+
export type FundAccountPaymentOnLoadResponse = {
|
|
51
|
+
// Currently, FundAccountPaymentComponent get 2 on load events: 1- for the external cards, 2- for the internal cards;
|
|
52
|
+
// we may consider unite them.
|
|
53
|
+
[RESPONSE_KEYS.astraExternalCard]?: UNOnLoadResponseData<[UNAstraExternalCardData]>,
|
|
54
|
+
[RESPONSE_KEYS.accountCards]?: UNOnLoadResponseData<[UNCardData]>
|
|
55
|
+
}
|
|
56
|
+
|
|
47
57
|
export type UnitOnLoadResponseSuccessData =
|
|
48
58
|
| CardOnLoadResponse
|
|
49
59
|
| CardsOnLoadResponse
|
|
@@ -51,6 +61,7 @@ export type UnitOnLoadResponseSuccessData =
|
|
|
51
61
|
| AccountsOnLoadResponse
|
|
52
62
|
| AccountOnLoadResponse
|
|
53
63
|
| ActivityOnLoadResponse
|
|
64
|
+
| FundAccountPaymentOnLoadResponse
|
|
54
65
|
|
|
55
66
|
export type UnitOnLoadResponseEvent =
|
|
56
67
|
| UNError
|
|
@@ -5,6 +5,7 @@ export enum WebComponentType {
|
|
|
5
5
|
activity = 'unit-elements-activity',
|
|
6
6
|
slot = 'unit-elements-sdk-slot',
|
|
7
7
|
account = 'unit-elements-account',
|
|
8
|
+
fundAccountPayment = 'unit-elements-fund-account-payment',
|
|
8
9
|
checkDeposit = 'unit-elements-check-deposit',
|
|
9
10
|
achDebitPayment = 'unit-elements-ach-debit-payment',
|
|
10
11
|
achCreditPayment = 'unit-elements-ach-credit-payment',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';
|
|
2
2
|
import type { UNAccountData, UNCounterpartyAccountData } from './account.types';
|
|
3
|
-
import type { UNAchCounterparty, UNCounterpartyVerificationMethod, UNPaymentStatus } from './payments.types';
|
|
3
|
+
import type { UNPaymentType, UNAchCounterparty, UNCounterpartyVerificationMethod, UNPaymentStatus } from './payments.types';
|
|
4
4
|
import type { UNTags, UNRelationship } from './types';
|
|
5
5
|
|
|
6
6
|
export type UNACHOnLoadData = {
|
|
@@ -9,7 +9,7 @@ export type UNACHOnLoadData = {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export type UNACHData = {
|
|
12
|
-
type:
|
|
12
|
+
type: UNPaymentType.AchPayment,
|
|
13
13
|
id: string,
|
|
14
14
|
attributes: {
|
|
15
15
|
createdAt: string | Date,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { UNPaymentStatus } from './payments.types';
|
|
1
|
+
import type { UNPaymentStatus, UNPaymentType } from './payments.types';
|
|
2
2
|
import type { UNTags, UNRelationship } from './types';
|
|
3
3
|
|
|
4
4
|
export type UNBookPaymentData = {
|
|
5
|
-
type:
|
|
5
|
+
type: UNPaymentType.BookPayment,
|
|
6
6
|
id: string,
|
|
7
7
|
attributes: {
|
|
8
8
|
createdAt: string | Date,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { UNRelationship } from './types';
|
|
2
|
+
import type { Cents } from './payments.types';
|
|
2
3
|
|
|
3
4
|
export type UNCheckDepositData = {
|
|
4
5
|
id: string
|
|
@@ -41,8 +42,6 @@ export enum UNCheckDepositStatus {
|
|
|
41
42
|
Returned = 'Returned',
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
export type Cents = number
|
|
45
|
-
|
|
46
45
|
export type UNCheckCounterparty = {
|
|
47
46
|
name: string
|
|
48
47
|
accountNumber: string
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UNCardData } from './card.types';
|
|
2
|
+
import { UNPaymentType, Cents, UNPaymentStatus, UNAstraExternalCardData } from './payments.types';
|
|
3
|
+
import { UNDirection, UNRelationshipData } from './types';
|
|
4
|
+
|
|
5
|
+
export type UNFundAccountPaymentOnLoadData = [UNAstraExternalCardData] | [UNCardData]
|
|
6
|
+
|
|
7
|
+
export type UNFundAccountPaymentData = {
|
|
8
|
+
type: UNPaymentType.CardToCardPayment
|
|
9
|
+
id: string
|
|
10
|
+
attributes: {
|
|
11
|
+
createdAt: Date
|
|
12
|
+
amount: Cents
|
|
13
|
+
direction: UNDirection
|
|
14
|
+
description: string
|
|
15
|
+
status: UNPaymentStatus
|
|
16
|
+
reason?: string
|
|
17
|
+
tags?: {[key: string]: string}
|
|
18
|
+
astraRoutineId: string
|
|
19
|
+
}
|
|
20
|
+
relationships: {
|
|
21
|
+
account: {
|
|
22
|
+
data: UNRelationshipData
|
|
23
|
+
}
|
|
24
|
+
customer?: {
|
|
25
|
+
data: UNRelationshipData
|
|
26
|
+
}
|
|
27
|
+
customers?: {
|
|
28
|
+
data: [UNRelationshipData]
|
|
29
|
+
}
|
|
30
|
+
transaction?: {
|
|
31
|
+
data: [UNRelationshipData]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
card: {
|
|
35
|
+
data: UNRelationshipData
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -10,5 +10,6 @@ export * from './fonts.types';
|
|
|
10
10
|
export * from './error.types';
|
|
11
11
|
export * from './versioning.types';
|
|
12
12
|
export * from './multipleCards.types';
|
|
13
|
+
export * from './fundAccountPayment.types';
|
|
13
14
|
export * from './payeeManagement.types';
|
|
14
15
|
export * from './env.types';
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export enum UNPaymentType {
|
|
2
|
+
AchPayment = 'achPayment',
|
|
3
|
+
BookPayment = 'bookPayment',
|
|
4
|
+
CardToCardPayment = 'cardToCardPayment',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type UNPaymentStatus = 'Sent' | 'Rejected' | 'Pending' | 'Clearing' | 'Canceled' | 'Returned' | 'PendingReview'
|
|
2
8
|
|
|
3
9
|
export type UNAchCounterparty = {
|
|
4
10
|
name: string
|
|
@@ -35,3 +41,28 @@ export enum UNPlaidAccountFilter {
|
|
|
35
41
|
export enum UNCounterpartyVerificationMethod {
|
|
36
42
|
Plaid = 'Plaid',
|
|
37
43
|
}
|
|
44
|
+
|
|
45
|
+
export enum UNCardNetwork {
|
|
46
|
+
Visa = 'Visa',
|
|
47
|
+
Diners = 'Diners',
|
|
48
|
+
Maestro = 'Maestro',
|
|
49
|
+
Generic = 'Generic',
|
|
50
|
+
Discover = 'Discover',
|
|
51
|
+
MasterCard = 'MasterCard',
|
|
52
|
+
AmericanExpress = 'AmericanExpress',
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface UNAstraExternalCardData {
|
|
56
|
+
type: 'astraExternalCard'
|
|
57
|
+
id: string
|
|
58
|
+
attributes: {
|
|
59
|
+
last4Digits: string
|
|
60
|
+
cardNetwork: UNCardNetwork
|
|
61
|
+
fullName: {
|
|
62
|
+
first: string
|
|
63
|
+
last: string
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type Cents = number
|
|
@@ -14,17 +14,17 @@ export type UNLimits = {
|
|
|
14
14
|
monthlyPurchase?: string | number,
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
type
|
|
17
|
+
export type UNRelationshipData = {
|
|
18
18
|
type: string,
|
|
19
|
-
id: string
|
|
19
|
+
id: number | string
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export type UNRelationship = {
|
|
23
23
|
data:
|
|
24
24
|
| null
|
|
25
25
|
| []
|
|
26
|
-
|
|
|
27
|
-
|
|
|
26
|
+
| UNRelationshipData
|
|
27
|
+
| UNRelationshipData[]
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export type UNFullName = {
|
|
@@ -32,4 +32,9 @@ export type UNFullName = {
|
|
|
32
32
|
last: string
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export enum UNDirection {
|
|
36
|
+
Debit = 'Debit',
|
|
37
|
+
Credit = 'Credit',
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
export type UNTags = Record<string, string> // TODO: specify Tag type
|
|
@@ -21,6 +21,7 @@ export class UnitSDK {
|
|
|
21
21
|
protected static fonts?: UNFonts;
|
|
22
22
|
protected static signedNonce?: string;
|
|
23
23
|
protected static pushProvisionModule?: typeof NativeModules;
|
|
24
|
+
protected static sdkVersion = '1.13.0';
|
|
24
25
|
|
|
25
26
|
public static init = async (env: UNEnvironment, theme?: string, language?: string, fonts?: UNFonts, webVersioningStrategy: UNWebVersioningStrategy = UNSDKConstants.webSDKRecommendedStrategy) => {
|
|
26
27
|
try {
|
|
@@ -80,6 +81,10 @@ export class UnitSDK {
|
|
|
80
81
|
return this.customerToken;
|
|
81
82
|
};
|
|
82
83
|
|
|
84
|
+
public static getSdkVersion = () => {
|
|
85
|
+
return this.sdkVersion;
|
|
86
|
+
};
|
|
87
|
+
|
|
83
88
|
public static cleanUserData = () => {
|
|
84
89
|
UNStoreManagerHelper.cleanValue(UserDataKeys.unitCustomerToken);
|
|
85
90
|
UNStoreManagerHelper.cleanValue(UserDataKeys.unitVerifiedToken);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export class UnitHelpersManager {
|
|
2
2
|
redirectUri?: string;
|
|
3
|
+
unitSessionId?: string;
|
|
3
4
|
|
|
4
5
|
constructor() {
|
|
5
6
|
this.init();
|
|
@@ -7,5 +8,24 @@ export class UnitHelpersManager {
|
|
|
7
8
|
|
|
8
9
|
private init = () => {
|
|
9
10
|
this.redirectUri = undefined;
|
|
11
|
+
this.unitSessionId = this.generateUUID();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
private generateUUID = () => {
|
|
15
|
+
let d = new Date().getTime(); //Timestamp
|
|
16
|
+
let d2 = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0; //Time in microseconds since page-load or 0 if unsupported
|
|
17
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
18
|
+
let r = Math.random() * 16; //random number between 0 and 16
|
|
19
|
+
if (d > 0) {
|
|
20
|
+
//Use timestamp until depleted
|
|
21
|
+
r = (d + r) % 16 | 0;
|
|
22
|
+
d = Math.floor(d / 16);
|
|
23
|
+
} else {
|
|
24
|
+
//Use microseconds since page-load if supported
|
|
25
|
+
r = (d2 + r) % 16 | 0;
|
|
26
|
+
d2 = Math.floor(d2 / 16);
|
|
27
|
+
}
|
|
28
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
29
|
+
});
|
|
10
30
|
};
|
|
11
31
|
}
|
|
@@ -95,13 +95,14 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
|
|
|
95
95
|
|
|
96
96
|
const fontFaces = getFontFacesString(UnitSDK.getFonts());
|
|
97
97
|
|
|
98
|
-
const windowInfoParams = `window.UnitMobileSDKConfig['info'] = ${JSON.stringify(infoParams)}
|
|
98
|
+
const windowInfoParams = `window.UnitMobileSDKConfig['info'] = ${JSON.stringify(infoParams)};`;
|
|
99
99
|
const plaidRedirectUriParam = (Platform.OS == 'ios' && UnitSDK.helpers.redirectUri) ? `window.UnitMobileSDKConfig['plaidRedirectUri'] = '${UnitSDK.helpers.redirectUri}/plaid';` : '';
|
|
100
|
+
const unitSessionIdParam = `window.UnitSessionStore.unitSessionId = '${UnitSDK.helpers.unitSessionId}';`;
|
|
100
101
|
|
|
101
102
|
const unitVerifiedCustomerToken = await UNStoreManagerHelper.getValue(UserDataKeys.unitVerifiedToken);
|
|
102
|
-
const windowVerifiedCustomerToken = unitVerifiedCustomerToken ? `window.UnitStore['unitVerifiedCustomerToken'] = '${unitVerifiedCustomerToken}'
|
|
103
|
+
const windowVerifiedCustomerToken = unitVerifiedCustomerToken ? `window.UnitStore['unitVerifiedCustomerToken'] = '${unitVerifiedCustomerToken}';` : '';
|
|
103
104
|
|
|
104
|
-
const windowParams = `${windowInfoParams}
|
|
105
|
+
const windowParams = `${windowInfoParams} ${unitSessionIdParam} ${plaidRedirectUriParam} ${windowVerifiedCustomerToken} ${props.windowParams || ''}`;
|
|
105
106
|
|
|
106
107
|
let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));
|
|
107
108
|
newHtml = newHtml.replace(HTML_PLACEHOLDER.FONT_FACES, fontFaces);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { Share, NativeModules, Platform } from 'react-native';
|
|
3
|
-
import * as SDKInfo from '../utils/SDKInfo';
|
|
4
3
|
import * as AppInfo from '../utils/AppInfo';
|
|
5
4
|
import type { RequestDownloadEvent } from '../messages/webMessages/unitMessages';
|
|
5
|
+
import { UnitSDK } from '../unitSdkManager/UnitSdkManager';
|
|
6
6
|
const { RNShareFile } = NativeModules;
|
|
7
7
|
|
|
8
8
|
export const getInfoParams = async () => {
|
|
@@ -11,7 +11,7 @@ export const getInfoParams = async () => {
|
|
|
11
11
|
const appIdentifier = await AppInfo.getAppIdentifier();
|
|
12
12
|
|
|
13
13
|
const infoParams: { [key: string]: string } = {};
|
|
14
|
-
infoParams['sdkVersion'] =
|
|
14
|
+
infoParams['sdkVersion'] = UnitSDK.getSdkVersion();
|
|
15
15
|
infoParams['sdkPlatform'] = 'React Native';
|
|
16
16
|
infoParams['os'] = Platform.OS == 'android' ? 'Android' : 'iOS';
|
|
17
17
|
infoParams['hostedAppVersion'] = appVersion;
|
package/src/webComponent/html.ts
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getSDKVersion = void 0;
|
|
7
|
-
var _package = _interopRequireDefault(require("../../package.json"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
const getSDKVersion = () => {
|
|
10
|
-
return _package.default.version;
|
|
11
|
-
};
|
|
12
|
-
exports.getSDKVersion = getSDKVersion;
|
|
13
|
-
//# sourceMappingURL=SDKInfo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_package","_interopRequireDefault","require","obj","__esModule","default","getSDKVersion","Package","version","exports"],"sourceRoot":"../../../src","sources":["utils/SDKInfo.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElC,MAAMG,aAAa,GAAGA,CAAA,KAAM;EACjC,OAAOC,gBAAO,CAACC,OAAO;AACxB,CAAC;AAACC,OAAA,CAAAH,aAAA,GAAAA,aAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Package","getSDKVersion","version"],"sourceRoot":"../../../src","sources":["utils/SDKInfo.ts"],"mappings":"AAAA,OAAOA,OAAO,MAAM,oBAAoB;AAExC,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,OAAOD,OAAO,CAACE,OAAO;AACxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SDKInfo.d.ts","sourceRoot":"","sources":["../../../../src/utils/SDKInfo.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,cAEzB,CAAC"}
|