react-native-unit-components 1.11.0 → 1.12.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/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsPackage.kt +2 -0
- package/android/src/main/java/com/unitreactnativecomponents/unStoreManager/UNStoreManager.kt +36 -0
- package/ios/UNStoreManager/UNStoreManager.swift +28 -0
- package/ios/UNStoreManager/UNStoreManagerExportModule.m +8 -0
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +2 -1
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +2 -1
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +36 -51
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +133 -12
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js +62 -19
- package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js +57 -38
- package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js.map +1 -1
- package/lib/commonjs/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js +132 -0
- package/lib/commonjs/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js.map +1 -0
- package/lib/commonjs/components/UNPayeeManagementComponent/UNPayeeManagementComponent.utils.js +96 -0
- package/lib/commonjs/components/UNPayeeManagementComponent/UNPayeeManagementComponent.utils.js.map +1 -0
- package/lib/commonjs/components/UNPayeeManagementComponent/index.js +21 -0
- package/lib/commonjs/components/UNPayeeManagementComponent/index.js.map +1 -0
- package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js +104 -0
- package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js.map +1 -0
- package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.utils.js +37 -0
- package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.utils.js.map +1 -0
- package/lib/commonjs/components/UNWhiteLabelAppComponent/index.js +21 -0
- package/lib/commonjs/components/UNWhiteLabelAppComponent/index.js.map +1 -0
- package/lib/commonjs/components/index.js +22 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +1 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/messages/webMessages/payeeManagementMessage.js +15 -0
- package/lib/commonjs/messages/webMessages/payeeManagementMessage.js.map +1 -0
- package/lib/commonjs/messages/webMessages/plaidMessages.js +14 -0
- package/lib/commonjs/messages/webMessages/plaidMessages.js.map +1 -0
- package/lib/commonjs/messages/webMessages/unitMessages.js +3 -2
- package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -1
- package/lib/commonjs/nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper.js +23 -0
- package/lib/commonjs/nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper.js.map +1 -0
- package/lib/commonjs/networking/common/UNNetworkConstants.js +3 -3
- package/lib/commonjs/networking/common/UNNetworkConstants.js.map +1 -1
- package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js +1 -0
- package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js.map +1 -1
- package/lib/commonjs/scripts/html/bodyHtml.js +1 -1
- package/lib/commonjs/scripts/html/bodyScript.js +110 -4
- package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
- package/lib/commonjs/slices/ConfigurationSlice.js.map +1 -1
- package/lib/commonjs/slices/SharedEventsSlice.js.map +1 -1
- package/lib/commonjs/types/internal/bottomSheet.types.js +5 -0
- package/lib/commonjs/types/internal/bottomSheet.types.js.map +1 -1
- package/lib/commonjs/types/internal/unitStore.types.js +13 -0
- package/lib/commonjs/types/internal/unitStore.types.js.map +1 -0
- package/lib/commonjs/types/internal/webComponent.types.js +2 -0
- package/lib/commonjs/types/internal/webComponent.types.js.map +1 -1
- package/lib/commonjs/types/shared/env.types.js +12 -0
- package/lib/commonjs/types/shared/env.types.js.map +1 -0
- package/lib/commonjs/types/shared/index.js +22 -0
- package/lib/commonjs/types/shared/index.js.map +1 -1
- package/lib/commonjs/types/shared/payeeManagement.types.js +17 -0
- package/lib/commonjs/types/shared/payeeManagement.types.js.map +1 -0
- package/lib/commonjs/types/shared/payments.types.js +18 -1
- package/lib/commonjs/types/shared/payments.types.js.map +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdk.api.js +1 -3
- package/lib/commonjs/unitSdkManager/UnitSdk.api.js.map +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdk.constants.js +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js +10 -6
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdkManager.utils.internal.js +3 -3
- package/lib/commonjs/unitSdkManager/UnitSdkManager.utils.internal.js.map +1 -1
- package/lib/commonjs/unitSdkManager/unitHelpersManager/UnitHelpersManager.js +16 -0
- package/lib/commonjs/unitSdkManager/unitHelpersManager/UnitHelpersManager.js.map +1 -0
- package/lib/commonjs/utils/windowUnitStore.js +11 -0
- package/lib/commonjs/utils/windowUnitStore.js.map +1 -0
- package/lib/commonjs/webComponent/WebComponent.js +51 -14
- package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
- package/lib/commonjs/webComponent/html.js +11 -0
- package/lib/commonjs/webComponent/html.js.map +1 -1
- package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +2 -1
- package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
- package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +2 -1
- package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +37 -52
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +131 -8
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js +63 -21
- package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js +57 -38
- package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js.map +1 -1
- package/lib/module/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js +124 -0
- package/lib/module/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js.map +1 -0
- package/lib/module/components/UNPayeeManagementComponent/UNPayeeManagementComponent.utils.js +82 -0
- package/lib/module/components/UNPayeeManagementComponent/UNPayeeManagementComponent.utils.js.map +1 -0
- package/lib/module/components/UNPayeeManagementComponent/index.js +2 -0
- package/lib/module/components/UNPayeeManagementComponent/index.js.map +1 -0
- package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js +95 -0
- package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js.map +1 -0
- package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.utils.js +28 -0
- package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.utils.js.map +1 -0
- package/lib/module/components/UNWhiteLabelAppComponent/index.js +2 -0
- package/lib/module/components/UNWhiteLabelAppComponent/index.js.map +1 -0
- package/lib/module/components/index.js +2 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/messages/webMessages/payeeManagementMessage.js +9 -0
- package/lib/module/messages/webMessages/payeeManagementMessage.js.map +1 -0
- package/lib/module/messages/webMessages/plaidMessages.js +8 -0
- package/lib/module/messages/webMessages/plaidMessages.js.map +1 -0
- package/lib/module/messages/webMessages/unitMessages.js +3 -2
- package/lib/module/messages/webMessages/unitMessages.js.map +1 -1
- package/lib/module/nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper.js +17 -0
- package/lib/module/nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper.js.map +1 -0
- package/lib/module/networking/common/UNNetworkConstants.js +1 -1
- package/lib/module/networking/common/UNNetworkConstants.js.map +1 -1
- package/lib/module/networking/requests/UNWalletPayloadRequest.js +1 -0
- package/lib/module/networking/requests/UNWalletPayloadRequest.js.map +1 -1
- package/lib/module/scripts/html/bodyHtml.js +1 -1
- package/lib/module/scripts/html/bodyScript.js +109 -3
- package/lib/module/scripts/html/bodyScript.js.map +1 -1
- package/lib/module/slices/ConfigurationSlice.js.map +1 -1
- package/lib/module/slices/SharedEventsSlice.js.map +1 -1
- package/lib/module/types/internal/bottomSheet.types.js +5 -0
- package/lib/module/types/internal/bottomSheet.types.js.map +1 -1
- package/lib/module/types/internal/unitStore.types.js +8 -0
- package/lib/module/types/internal/unitStore.types.js.map +1 -0
- package/lib/module/types/internal/webComponent.types.js +2 -0
- package/lib/module/types/internal/webComponent.types.js.map +1 -1
- package/lib/module/types/shared/env.types.js +6 -0
- package/lib/module/types/shared/env.types.js.map +1 -0
- package/lib/module/types/shared/index.js +2 -0
- package/lib/module/types/shared/index.js.map +1 -1
- package/lib/module/types/shared/payeeManagement.types.js +11 -0
- package/lib/module/types/shared/payeeManagement.types.js.map +1 -0
- package/lib/module/types/shared/payments.types.js +17 -0
- package/lib/module/types/shared/payments.types.js.map +1 -1
- package/lib/module/unitSdkManager/UnitSdk.api.js +2 -4
- package/lib/module/unitSdkManager/UnitSdk.api.js.map +1 -1
- package/lib/module/unitSdkManager/UnitSdk.constants.js +1 -1
- package/lib/module/unitSdkManager/UnitSdkManager.js +8 -5
- package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
- package/lib/module/unitSdkManager/UnitSdkManager.utils.internal.js +1 -1
- package/lib/module/unitSdkManager/UnitSdkManager.utils.internal.js.map +1 -1
- package/lib/module/unitSdkManager/unitHelpersManager/UnitHelpersManager.js +9 -0
- package/lib/module/unitSdkManager/unitHelpersManager/UnitHelpersManager.js.map +1 -0
- package/lib/module/utils/windowUnitStore.js +4 -0
- package/lib/module/utils/windowUnitStore.js.map +1 -0
- package/lib/module/webComponent/WebComponent.js +51 -15
- package/lib/module/webComponent/WebComponent.js.map +1 -1
- package/lib/module/webComponent/html.js +12 -1
- package/lib/module/webComponent/html.js.map +1 -1
- package/lib/typescript/src/components/UNACHCreditComponent/UNACHCreditComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/UNACHDebitComponent/UNACHDebitComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +5 -4
- package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts.map +1 -1
- package/lib/typescript/src/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/UNCardComponent/UNCardComponent.d.ts +1 -1
- package/lib/typescript/src/components/UNCardComponent/UNCardComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.d.ts +27 -0
- package/lib/typescript/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.utils.d.ts +15 -0
- package/lib/typescript/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.utils.d.ts.map +1 -0
- package/lib/typescript/src/components/UNPayeeManagementComponent/index.d.ts +2 -0
- package/lib/typescript/src/components/UNPayeeManagementComponent/index.d.ts.map +1 -0
- package/lib/typescript/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.d.ts +10 -0
- package/lib/typescript/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.utils.d.ts +7 -0
- package/lib/typescript/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.utils.d.ts.map +1 -0
- package/lib/typescript/src/components/UNWhiteLabelAppComponent/index.d.ts +2 -0
- package/lib/typescript/src/components/UNWhiteLabelAppComponent/index.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +2 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/messages/webMessages/index.d.ts +4 -2
- package/lib/typescript/src/messages/webMessages/index.d.ts.map +1 -1
- package/lib/typescript/src/messages/webMessages/payeeManagementMessage.d.ts +19 -0
- package/lib/typescript/src/messages/webMessages/payeeManagementMessage.d.ts.map +1 -0
- package/lib/typescript/src/messages/webMessages/plaidMessages.d.ts +24 -0
- package/lib/typescript/src/messages/webMessages/plaidMessages.d.ts.map +1 -0
- package/lib/typescript/src/messages/webMessages/unitMessages.d.ts +12 -3
- package/lib/typescript/src/messages/webMessages/unitMessages.d.ts.map +1 -1
- package/lib/typescript/src/nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper.d.ts +7 -0
- package/lib/typescript/src/nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper.d.ts.map +1 -0
- package/lib/typescript/src/networking/requests/UNWalletPayloadRequest.d.ts +1 -1
- package/lib/typescript/src/networking/requests/UNWalletPayloadRequest.d.ts.map +1 -1
- package/lib/typescript/src/scripts/html/bodyScript.d.ts +12 -0
- package/lib/typescript/src/scripts/html/bodyScript.d.ts.map +1 -1
- package/lib/typescript/src/slices/ConfigurationSlice.d.ts.map +1 -1
- package/lib/typescript/src/slices/SharedEventsSlice.d.ts +21 -2
- package/lib/typescript/src/slices/SharedEventsSlice.d.ts.map +1 -1
- package/lib/typescript/src/store/store.d.ts +24 -0
- package/lib/typescript/src/store/store.d.ts.map +1 -1
- package/lib/typescript/src/types/internal/bottomSheet.types.d.ts +29 -16
- package/lib/typescript/src/types/internal/bottomSheet.types.d.ts.map +1 -1
- package/lib/typescript/src/types/internal/unitStore.types.d.ts +5 -0
- package/lib/typescript/src/types/internal/unitStore.types.d.ts.map +1 -0
- package/lib/typescript/src/types/internal/webComponent.types.d.ts +3 -1
- package/lib/typescript/src/types/internal/webComponent.types.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/env.types.d.ts +5 -0
- package/lib/typescript/src/types/shared/env.types.d.ts.map +1 -0
- package/lib/typescript/src/types/shared/index.d.ts +2 -0
- package/lib/typescript/src/types/shared/index.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/payeeManagement.types.d.ts +48 -0
- package/lib/typescript/src/types/shared/payeeManagement.types.d.ts.map +1 -0
- package/lib/typescript/src/types/shared/payments.types.d.ts +17 -3
- package/lib/typescript/src/types/shared/payments.types.d.ts.map +1 -1
- package/lib/typescript/src/unitSdkManager/UnitSdk.api.d.ts.map +1 -1
- package/lib/typescript/src/unitSdkManager/UnitSdkManager.d.ts +5 -5
- package/lib/typescript/src/unitSdkManager/UnitSdkManager.d.ts.map +1 -1
- package/lib/typescript/src/unitSdkManager/UnitSdkManager.utils.internal.d.ts +1 -1
- package/lib/typescript/src/unitSdkManager/UnitSdkManager.utils.internal.d.ts.map +1 -1
- package/lib/typescript/src/unitSdkManager/unitHelpersManager/UnitHelpersManager.d.ts +6 -0
- package/lib/typescript/src/unitSdkManager/unitHelpersManager/UnitHelpersManager.d.ts.map +1 -0
- package/lib/typescript/src/utils/windowUnitStore.d.ts +3 -0
- package/lib/typescript/src/utils/windowUnitStore.d.ts.map +1 -0
- package/lib/typescript/src/webComponent/WebComponent.d.ts.map +1 -1
- package/lib/typescript/src/webComponent/html.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +2 -1
- package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +2 -1
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +45 -58
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +153 -9
- package/src/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.tsx +81 -21
- package/src/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.tsx +54 -36
- package/src/components/UNCardComponent/UNCardComponent.tsx +1 -1
- package/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.tsx +153 -0
- package/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.utils.ts +87 -0
- package/src/components/UNPayeeManagementComponent/index.ts +1 -0
- package/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.tsx +124 -0
- package/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.utils.ts +35 -0
- package/src/components/UNWhiteLabelAppComponent/index.ts +1 -0
- package/src/components/index.ts +2 -0
- package/src/index.tsx +1 -1
- package/src/messages/webMessages/index.ts +6 -0
- package/src/messages/webMessages/payeeManagementMessage.ts +26 -0
- package/src/messages/webMessages/plaidMessages.ts +29 -0
- package/src/messages/webMessages/unitMessages.ts +13 -2
- package/src/nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper.ts +19 -0
- package/src/networking/common/UNNetworkConstants.ts +1 -1
- package/src/networking/requests/UNWalletPayloadRequest.ts +2 -1
- package/src/scripts/html/bodyHtml.ts +1 -1
- package/src/scripts/html/bodyScript.ts +113 -3
- package/src/slices/ConfigurationSlice.ts +1 -2
- package/src/slices/SharedEventsSlice.ts +28 -1
- package/src/types/internal/bottomSheet.types.ts +34 -15
- package/src/types/internal/unitStore.types.ts +6 -0
- package/src/types/internal/webComponent.types.ts +2 -0
- package/src/types/shared/env.types.ts +4 -0
- package/src/types/shared/index.ts +2 -0
- package/src/types/shared/payeeManagement.types.ts +49 -0
- package/src/types/shared/payments.types.ts +20 -2
- package/src/unitSdkManager/UnitSdk.api.ts +2 -4
- package/src/unitSdkManager/UnitSdk.constants.ts +1 -1
- package/src/unitSdkManager/UnitSdkManager.ts +12 -6
- package/src/unitSdkManager/UnitSdkManager.utils.internal.ts +3 -1
- package/src/unitSdkManager/unitHelpersManager/UnitHelpersManager.ts +11 -0
- package/src/utils/windowUnitStore.ts +5 -0
- package/src/webComponent/WebComponent.tsx +60 -23
- package/src/webComponent/html.ts +14 -1
|
@@ -4,6 +4,8 @@ import { PageMessage } from '../../messages/webMessages/pageMessage';
|
|
|
4
4
|
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
5
5
|
import { AccountMessage } from '../../messages/webMessages/accountMessage';
|
|
6
6
|
import { ActivityMessage } from '../../messages/webMessages/activityMessage';
|
|
7
|
+
import { PlaidMessage } from '../../messages/webMessages/plaidMessages';
|
|
8
|
+
import { PayeeManagementMessage } from '../../messages/webMessages/payeeManagementMessage';
|
|
7
9
|
|
|
8
10
|
export const POST_MESSAGE_TO_SDK = `
|
|
9
11
|
const postMessageToSDK = (message) => {
|
|
@@ -118,10 +120,10 @@ export const LISTENERS = {
|
|
|
118
120
|
});
|
|
119
121
|
`,
|
|
120
122
|
unitPlaidTokenCreated: `
|
|
121
|
-
window.addEventListener("${
|
|
123
|
+
window.addEventListener("${PlaidMessage.UNIT_PLAID_TOKEN_CREATED}", (e) => {
|
|
122
124
|
const response = e.detail
|
|
123
125
|
response.then((data) => {
|
|
124
|
-
postMessageToSDK({ type: "${
|
|
126
|
+
postMessageToSDK({ type: "${PlaidMessage.UNIT_PLAID_TOKEN_CREATED}", details: { linkToken: data.data }})
|
|
125
127
|
}).catch((e) => {
|
|
126
128
|
console.log(e)
|
|
127
129
|
})
|
|
@@ -142,6 +144,94 @@ export const LISTENERS = {
|
|
|
142
144
|
postMessageToSDK({ type: "${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}", details: e.detail })
|
|
143
145
|
});
|
|
144
146
|
`,
|
|
147
|
+
unitMultiFactorAuthFinished: `
|
|
148
|
+
window.addEventListener("${UnitMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED}", async (e) => {
|
|
149
|
+
const response = await event.detail.response;
|
|
150
|
+
const data = JSON.stringify({
|
|
151
|
+
token: response.data.attributes.token,
|
|
152
|
+
expiration: new Date().getTime() + response.data.attributes.expiresIn * 1000,
|
|
153
|
+
});
|
|
154
|
+
window.UnitStore["unitVerifiedCustomerToken"] = data;
|
|
155
|
+
|
|
156
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED}", details: data })
|
|
157
|
+
});
|
|
158
|
+
`,
|
|
159
|
+
unitWhiteLabelAppOnLoad: `
|
|
160
|
+
window.addEventListener("${UnitMessage.UNIT_WHITE_LABEL_APP_ON_LOAD}", async (event) => {
|
|
161
|
+
const response = event.detail;
|
|
162
|
+
response.then((data) => {
|
|
163
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_WHITE_LABEL_APP_ON_LOAD}", details: data.data })
|
|
164
|
+
}).catch((e) => {
|
|
165
|
+
console.log(e)
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
`,
|
|
169
|
+
unitUnauthorizedToken: `
|
|
170
|
+
window.addEventListener("${UnitMessage.UNIT_UNAUTHORIZED_TOKEN}", (e) => {
|
|
171
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_UNAUTHORIZED_TOKEN}", details: "Clean the current user tokens" })
|
|
172
|
+
});
|
|
173
|
+
`,
|
|
174
|
+
unitConnectedAccountCreated: `
|
|
175
|
+
window.addEventListener("${PayeeManagementMessage.UNIT_CONNECTED_ACCOUNT_CREATED}", (e) => {
|
|
176
|
+
const response = e.detail;
|
|
177
|
+
response.then((data) => {
|
|
178
|
+
postMessageToSDK({ type: "${PayeeManagementMessage.UNIT_CONNECTED_ACCOUNT_CREATED}", details: { account: data.data }})
|
|
179
|
+
}).catch((e) => {
|
|
180
|
+
console.log(e)
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
`,
|
|
184
|
+
unitCounterpartyCreated: `
|
|
185
|
+
window.addEventListener("${PayeeManagementMessage.UNIT_COUNTERPARTY_CREATED}", (e) => {
|
|
186
|
+
const response = e.detail;
|
|
187
|
+
response.then((data) => {
|
|
188
|
+
postMessageToSDK({ type: "${PayeeManagementMessage.UNIT_COUNTERPARTY_CREATED}", details: { counterparty: data.data }})
|
|
189
|
+
}).catch((e) => {
|
|
190
|
+
console.log(e)
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
`,
|
|
194
|
+
unitCounterpartyDeleted: `
|
|
195
|
+
window.addEventListener("${PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED}", (e) => {
|
|
196
|
+
const response = e.detail;
|
|
197
|
+
response.then((data) => {
|
|
198
|
+
postMessageToSDK({ type: "${PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED}", details: { counterparty: data.data }})
|
|
199
|
+
}).catch((e) => {
|
|
200
|
+
console.log(e)
|
|
201
|
+
})
|
|
202
|
+
});
|
|
203
|
+
`,
|
|
204
|
+
unitMicroDepositConnectionCreated: `
|
|
205
|
+
window.addEventListener("${PayeeManagementMessage.UNIT_MICRO_DEPOSIT_CONNECTION_CREATED}", (e) => {
|
|
206
|
+
const response = e.detail;
|
|
207
|
+
response.then((data) => {
|
|
208
|
+
postMessageToSDK({ type: "${PayeeManagementMessage.UNIT_MICRO_DEPOSIT_CONNECTION_CREATED}", details: { account : data.data }})
|
|
209
|
+
}).catch((e) => {
|
|
210
|
+
console.log(e)
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
`,
|
|
214
|
+
unitMicroDepositConnectionRejected: `
|
|
215
|
+
window.addEventListener("${PayeeManagementMessage.UNIT_MICRO_DEPOSIT_CONNECTION_REJECTED}", (e) => {
|
|
216
|
+
const response = e.detail;
|
|
217
|
+
response.then((data) => {
|
|
218
|
+
postMessageToSDK({ type: "${PayeeManagementMessage.UNIT_MICRO_DEPOSIT_CONNECTION_REJECTED}", details: { account : data.data }})
|
|
219
|
+
}).catch((e) => {
|
|
220
|
+
console.log(e)
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
`,
|
|
224
|
+
|
|
225
|
+
unitOpenPlaid: `
|
|
226
|
+
window.addEventListener("${PlaidMessage.UNIT_OPEN_PLAID}", async (e) => {
|
|
227
|
+
const response = event.detail;
|
|
228
|
+
response.then((data) => {
|
|
229
|
+
postMessageToSDK({ type: "${PlaidMessage.UNIT_OPEN_PLAID}", details: data.data })
|
|
230
|
+
}).catch((e) => {
|
|
231
|
+
console.log(e)
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
`
|
|
145
235
|
};
|
|
146
236
|
|
|
147
237
|
export const DISPATCH_RENDERING_EVENT = `
|
|
@@ -164,6 +254,12 @@ export const DISPATCH_REQUEST_REFRESH = `
|
|
|
164
254
|
}
|
|
165
255
|
`;
|
|
166
256
|
|
|
257
|
+
export const SET_ITEM_IN_WINDOW_UNIT_STORE = `
|
|
258
|
+
const setItemInWindowUnitStore = (key, value) => {
|
|
259
|
+
window.UnitStore[key] = value;
|
|
260
|
+
}
|
|
261
|
+
`;
|
|
262
|
+
|
|
167
263
|
export const DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = `
|
|
168
264
|
const dispatchActivityFilterChangedEvent = (details) => {
|
|
169
265
|
const event = new CustomEvent("unitActivityFiltersChanged",{ detail: details});
|
|
@@ -173,7 +269,21 @@ export const DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = `
|
|
|
173
269
|
|
|
174
270
|
export const DISPATCH_PLAID_RESPONSE = `
|
|
175
271
|
const dispatchPlaidEvent = (details) => {
|
|
176
|
-
const event = new CustomEvent("${
|
|
272
|
+
const event = new CustomEvent("${PlaidMessage.UNIT_PLAID_RESPONSE}",{ detail: details })
|
|
273
|
+
window.dispatchEvent(event)
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
276
|
+
|
|
277
|
+
export const DISPATCH_PLAID_EXIT = `
|
|
278
|
+
const dispatchPlaidExit = (details) => {
|
|
279
|
+
const event = new CustomEvent("${PlaidMessage.UNIT_PLAID_EXIT}",{ detail: details })
|
|
280
|
+
window.dispatchEvent(event)
|
|
281
|
+
}
|
|
282
|
+
`;
|
|
283
|
+
|
|
284
|
+
export const DISPATCH_OPEN_PLAID = `
|
|
285
|
+
const dispatchOpenPlaidEvent = (details) => {
|
|
286
|
+
const event = new CustomEvent("${PlaidMessage.UNIT_OPEN_PLAID}",{ detail: details })
|
|
177
287
|
window.dispatchEvent(event)
|
|
178
288
|
}
|
|
179
289
|
`;
|
|
@@ -21,9 +21,8 @@ const ConfigurationSlice = createSlice({
|
|
|
21
21
|
},
|
|
22
22
|
setLanguage(state, action: PayloadAction<string | undefined>) {
|
|
23
23
|
state.language = action.payload;
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
25
|
},
|
|
26
|
-
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
export const { setUnitScript, setLanguage, setTheme } = ConfigurationSlice.actions;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
4
4
|
import type { RootState } from '../store';
|
|
5
|
-
import type { UNAccountData, UNCardData } from '../types/shared';
|
|
5
|
+
import type { UNAccountData, UNCardData, UNPayeeCounterparty } from '../types/shared';
|
|
6
6
|
import type { ActivityFiltersChangedEvent } from '../messages/webMessages/activityMessage';
|
|
7
7
|
import type { RequestRefreshEvent } from '../messages/webMessages/unitMessages';
|
|
8
8
|
import type { BottomSheetNativeMessage } from '../messages/nativeMessages/bottomSheetMessage';
|
|
@@ -12,6 +12,9 @@ import type { ActivityMessage } from '../messages/webMessages/activityMessage';
|
|
|
12
12
|
import type { UnitMessage } from '../messages/webMessages/unitMessages';
|
|
13
13
|
import type { MultipleCardsMessage } from '../messages/webMessages/multipleCardsMessage';
|
|
14
14
|
import { BottomSheetRenderingMessage } from '../messages/nativeMessages/bottomSheetMessage';
|
|
15
|
+
import { PageMessage } from '../messages/webMessages/pageMessage';
|
|
16
|
+
import { OpenPlaidEvent, PlaidMessage } from '../messages/webMessages/plaidMessages';
|
|
17
|
+
import { PayeeManagementMessage } from '../messages/webMessages/payeeManagementMessage';
|
|
15
18
|
|
|
16
19
|
type EmptyObj = Record<PropertyKey, never>;
|
|
17
20
|
|
|
@@ -55,6 +58,26 @@ type RequestRefreshEventState = {
|
|
|
55
58
|
data: RequestRefreshEvent
|
|
56
59
|
}
|
|
57
60
|
|
|
61
|
+
type MultiFactorAuthFinishedEventState = {
|
|
62
|
+
key: UnitMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED,
|
|
63
|
+
data: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type ComponentHeightEventState = {
|
|
67
|
+
key: PageMessage.PAGE_HEIGHT
|
|
68
|
+
data: number | string
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type OpenPlaidEventState = {
|
|
72
|
+
key: PlaidMessage.UNIT_OPEN_PLAID,
|
|
73
|
+
data: OpenPlaidEvent
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type PayeeCounterpartyDeletedEventState = {
|
|
77
|
+
key: PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED,
|
|
78
|
+
data: UNPayeeCounterparty
|
|
79
|
+
}
|
|
80
|
+
|
|
58
81
|
//currently left state suffixes to avoid the duplication of the event names
|
|
59
82
|
type SharedEvent =
|
|
60
83
|
| CardStatusChangedEventState
|
|
@@ -65,6 +88,10 @@ type SharedEvent =
|
|
|
65
88
|
| RequestCloseBottomSheetFlowEventState
|
|
66
89
|
| RequestRenderingBottomSheetEventState
|
|
67
90
|
| RequestRefreshEventState
|
|
91
|
+
| MultiFactorAuthFinishedEventState
|
|
92
|
+
| OpenPlaidEventState
|
|
93
|
+
| ComponentHeightEventState
|
|
94
|
+
| PayeeCounterpartyDeletedEventState
|
|
68
95
|
|
|
69
96
|
type SharedEventsState = {
|
|
70
97
|
event?: SharedEvent
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import type { RequestRenderingEvent } from '../../messages/webMessages/unitMessages';
|
|
2
|
-
import type {
|
|
2
|
+
import type { WebComponentType } from './webComponent.types';
|
|
3
3
|
import {
|
|
4
4
|
UNAddToWalletComponentProps,
|
|
5
5
|
} from '../../nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent';
|
|
6
|
+
import { UNACHCreditComponentProps } from '../../components/UNACHCreditComponent';
|
|
7
|
+
import { UNACHDebitComponentProps } from '../../components/UNACHDebitComponent';
|
|
8
|
+
import { UNCheckDepositComponentProps } from '../../components/UNCheckDepositComponent';
|
|
9
|
+
import { UNBookPaymentComponentProps } from '../../components/UNBookPaymentComponent';
|
|
6
10
|
|
|
7
11
|
export enum BottomSheetNativePlaceType {
|
|
8
12
|
overFullScreen = 'overFullScreen',
|
|
9
13
|
modal = 'modal',
|
|
10
14
|
menu = 'menu',
|
|
15
|
+
contentHeight = 'contentHeight'
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
export enum ScrollState {
|
|
@@ -40,6 +45,10 @@ export enum BottomSheetRenderingType {
|
|
|
40
45
|
|
|
41
46
|
export enum BottomSheetNativeComponentType {
|
|
42
47
|
AddToWalletComponent = 'UNAddToWalletComponent',
|
|
48
|
+
ACHCreditComponent = 'UNACHCreditComponent',
|
|
49
|
+
ACHDebitComponent = 'UNACHDebitComponent',
|
|
50
|
+
CheckDepositComponent = 'UNCheckDepositComponent',
|
|
51
|
+
BookPaymentComponent = 'UNBookPaymentComponent'
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
export type BottomSheetNativeAddToWalletComponentType = {
|
|
@@ -47,7 +56,31 @@ export type BottomSheetNativeAddToWalletComponentType = {
|
|
|
47
56
|
props: UNAddToWalletComponentProps
|
|
48
57
|
}
|
|
49
58
|
|
|
59
|
+
export type BottomSheetNativeACHCreditComponentType = {
|
|
60
|
+
type: BottomSheetNativeComponentType.ACHCreditComponent,
|
|
61
|
+
props: UNACHCreditComponentProps
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type BottomSheetNativeACHDebitComponentType = {
|
|
65
|
+
type: BottomSheetNativeComponentType.ACHDebitComponent,
|
|
66
|
+
props: UNACHDebitComponentProps
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type BottomSheetNativeCheckDepositComponentType = {
|
|
70
|
+
type: BottomSheetNativeComponentType.CheckDepositComponent,
|
|
71
|
+
props: UNCheckDepositComponentProps
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type BottomSheetNativeBookPaymentComponentType = {
|
|
75
|
+
type: BottomSheetNativeComponentType.BookPaymentComponent,
|
|
76
|
+
props: UNBookPaymentComponentProps
|
|
77
|
+
}
|
|
78
|
+
|
|
50
79
|
export type BottomSheetNativeComponent = BottomSheetNativeAddToWalletComponentType
|
|
80
|
+
| BottomSheetNativeACHCreditComponentType
|
|
81
|
+
| BottomSheetNativeACHDebitComponentType
|
|
82
|
+
| BottomSheetNativeCheckDepositComponentType
|
|
83
|
+
| BottomSheetNativeBookPaymentComponentType
|
|
51
84
|
|
|
52
85
|
export type BottomSheetSlotData = {
|
|
53
86
|
// The data that rendered by the web view
|
|
@@ -56,20 +89,6 @@ export type BottomSheetSlotData = {
|
|
|
56
89
|
requestRenderingEvent: RequestRenderingEvent
|
|
57
90
|
}
|
|
58
91
|
|
|
59
|
-
export type BottomSheetComponentData = {
|
|
60
|
-
componentName?: WebComponentType,
|
|
61
|
-
componentResourceId?: string,
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type WebComponentData = {
|
|
65
|
-
type: WebComponentType;
|
|
66
|
-
presentationMode?: PresentationMode,
|
|
67
|
-
params?: string;
|
|
68
|
-
theme?: string;
|
|
69
|
-
language?: string;
|
|
70
|
-
windowParams?: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
92
|
export type NativeComponentData = {
|
|
74
93
|
component: BottomSheetNativeComponent,
|
|
75
94
|
scrollState?: ScrollState,
|
|
@@ -11,6 +11,8 @@ export enum WebComponentType {
|
|
|
11
11
|
cardAction = 'unit-elements-card-action',
|
|
12
12
|
programDetails = 'unit-elements-program-details',
|
|
13
13
|
nextRepayment = 'unit-elements-next-repayment',
|
|
14
|
+
payeeManagement = 'unit-elements-payee-management',
|
|
15
|
+
whiteLabelApp = 'unit-elements-white-label-app',
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export enum PresentationMode {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { UNConnectedAccountStatus, UNConnectionAccountType, UNCounterpartyAccountType, UNCounterpartyPermission, UNCounterpartyType } from './payments.types';
|
|
2
|
+
|
|
3
|
+
export type UNPayeeConnectedAccount = {
|
|
4
|
+
type: 'plaidConnectedAccount'
|
|
5
|
+
id: string
|
|
6
|
+
attributes: {
|
|
7
|
+
mask: string
|
|
8
|
+
name: string
|
|
9
|
+
type: string
|
|
10
|
+
subType: string
|
|
11
|
+
createdAt: string
|
|
12
|
+
updatedAt: string
|
|
13
|
+
status: UNConnectedAccountStatus
|
|
14
|
+
connectionType: UNConnectionAccountType
|
|
15
|
+
}
|
|
16
|
+
relationships: {
|
|
17
|
+
customer: {
|
|
18
|
+
data: {
|
|
19
|
+
type: 'customer'
|
|
20
|
+
id: number
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type UNPayeeCounterparty = {
|
|
27
|
+
id: string,
|
|
28
|
+
type: string,
|
|
29
|
+
attributes: {
|
|
30
|
+
name: string
|
|
31
|
+
bank?: string
|
|
32
|
+
routingNumber: string
|
|
33
|
+
accountNumber: string
|
|
34
|
+
accountType: UNCounterpartyAccountType
|
|
35
|
+
type: UNCounterpartyType
|
|
36
|
+
permissions: UNCounterpartyPermission
|
|
37
|
+
tags?: {[key: string]: string}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export enum UNPayeeManagementMenuItem {
|
|
42
|
+
sendFunds = 'sendFunds',
|
|
43
|
+
delete = 'delete'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export enum UNPayeeManagementComponentPaginationType {
|
|
47
|
+
infiniteScroll = 'infiniteScroll',
|
|
48
|
+
pagination = 'pagination'
|
|
49
|
+
}
|
|
@@ -4,11 +4,29 @@ export type UNAchCounterparty = {
|
|
|
4
4
|
name: string
|
|
5
5
|
accountNumber: string
|
|
6
6
|
routingNumber: string
|
|
7
|
-
accountType:
|
|
7
|
+
accountType: UNCounterpartyAccountType
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
export type UNCounterpartyAccountType = 'Savings' | 'Checking'
|
|
11
11
|
|
|
12
|
+
export enum UNCounterpartyType {
|
|
13
|
+
Business = 'Business',
|
|
14
|
+
Person = 'Person',
|
|
15
|
+
Unknown = 'Unknown',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type UNCounterpartyPermission = 'CreditOnly' | 'CreditAndDebit' | 'DebitOnly'
|
|
19
|
+
|
|
20
|
+
export enum UNConnectedAccountStatus {
|
|
21
|
+
Pending = 'Pending',
|
|
22
|
+
Failed = 'Failed',
|
|
23
|
+
Verified = 'Verified',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export enum UNConnectionAccountType {
|
|
27
|
+
SameDayMicroDeposit = 'SameDayMicroDeposit',
|
|
28
|
+
Instant = 'Instant',
|
|
29
|
+
}
|
|
12
30
|
export enum UNPlaidAccountFilter {
|
|
13
31
|
checking = 'checking',
|
|
14
32
|
savings = 'savings',
|
|
@@ -2,16 +2,14 @@ import { UnitSDK } from './UnitSdkManager';
|
|
|
2
2
|
|
|
3
3
|
import { getUnitScriptUrl } from './UnitSdkManager.utils.internal';
|
|
4
4
|
import { store } from '../store/store';
|
|
5
|
-
import { setUnitScript
|
|
5
|
+
import { setUnitScript } from '../slices/ConfigurationSlice';
|
|
6
6
|
|
|
7
7
|
let isLoadingScript = false;
|
|
8
8
|
|
|
9
9
|
export const fetchUnitScript = async () => {
|
|
10
|
-
const configurationState = selectConfiguration(store.getState());
|
|
11
|
-
const globalUnitScript = configurationState.unitScript;
|
|
12
10
|
const env = UnitSDK.getEnv();
|
|
13
11
|
const webVersioningStrategy = UnitSDK.getWebVersioningStrategy();
|
|
14
|
-
if (isLoadingScript ||
|
|
12
|
+
if (isLoadingScript || !env) {
|
|
15
13
|
// init function is called and success OR in progress
|
|
16
14
|
return null;
|
|
17
15
|
}
|
|
@@ -3,7 +3,7 @@ import { UNVersioningStrategyType, UNWebVersioningStrategy } from '../types/shar
|
|
|
3
3
|
const WEB_SDK_RECOMMENDED_STRATEGY: UNWebVersioningStrategy = {
|
|
4
4
|
type: UNVersioningStrategyType.upToNextMinor,
|
|
5
5
|
major: 1,
|
|
6
|
-
minor:
|
|
6
|
+
minor: 8,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export const UNSDKConstants = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
2
|
import { fetchUnitScript } from './UnitSdk.api';
|
|
3
3
|
import { UnitUiManager } from './unitUiManager/unitUiManager';
|
|
4
4
|
import type { UNFonts } from '../types/shared/fonts.types';
|
|
@@ -7,14 +7,14 @@ import { UNSDKConstants } from './UnitSdk.constants';
|
|
|
7
7
|
import type { UNWebVersioningStrategy } from '../types/shared';
|
|
8
8
|
import { setTheme, setLanguage } from '../slices/ConfigurationSlice';
|
|
9
9
|
import { store } from '../store/store';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
10
|
+
import { UNEnvironment } from '../types/shared/env.types';
|
|
11
|
+
import { UserDataKeys } from '../types/internal/unitStore.types';
|
|
12
|
+
import UNStoreManagerHelper from '../nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper';
|
|
13
|
+
import { UnitHelpersManager } from './unitHelpersManager/UnitHelpersManager';
|
|
15
14
|
|
|
16
15
|
export class UnitSDK {
|
|
17
16
|
public static ui: UnitUiManager;
|
|
17
|
+
public static helpers: UnitHelpersManager;
|
|
18
18
|
protected static env?: UNEnvironment;
|
|
19
19
|
protected static webVersioningStrategy: UNWebVersioningStrategy;
|
|
20
20
|
protected static customerToken?: string;
|
|
@@ -30,6 +30,7 @@ export class UnitSDK {
|
|
|
30
30
|
store.dispatch(setTheme(theme));
|
|
31
31
|
store.dispatch(setLanguage(language));
|
|
32
32
|
this.ui = new UnitUiManager();
|
|
33
|
+
this.helpers = new UnitHelpersManager();
|
|
33
34
|
warnClientIfNeeded(this.webVersioningStrategy);
|
|
34
35
|
await fetchUnitScript();
|
|
35
36
|
} catch (e) {
|
|
@@ -79,4 +80,9 @@ export class UnitSDK {
|
|
|
79
80
|
return this.customerToken;
|
|
80
81
|
};
|
|
81
82
|
|
|
83
|
+
public static cleanUserData = () => {
|
|
84
|
+
UNStoreManagerHelper.cleanValue(UserDataKeys.unitCustomerToken);
|
|
85
|
+
UNStoreManagerHelper.cleanValue(UserDataKeys.unitVerifiedToken);
|
|
86
|
+
};
|
|
87
|
+
|
|
82
88
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { UNWebVersioningStrategy } from '../types/shared';
|
|
2
|
+
import { UNEnvironment } from '../types/shared/env.types';
|
|
2
3
|
import { getWebSdkVersionString } from '../utils/webVersioningStrategy.utils';
|
|
3
|
-
import { UNEnvironment } from './UnitSdkManager';
|
|
4
4
|
|
|
5
5
|
export const getUnitScriptUrl = (env: UNEnvironment, webVersioningStrategy: UNWebVersioningStrategy) => {
|
|
6
6
|
const webSdkVersionString = getWebSdkVersionString(webVersioningStrategy);
|
|
7
|
+
|
|
7
8
|
switch (env) {
|
|
8
9
|
case UNEnvironment.sandbox:
|
|
9
10
|
return `https://ui.s.unit.sh/release/${webSdkVersionString}/components.js`;
|
|
11
|
+
|
|
10
12
|
case UNEnvironment.production:
|
|
11
13
|
return `https://ui.unit.co/release/${webSdkVersionString}/components.js`;
|
|
12
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
3
3
|
import { Linking, Platform } from 'react-native';
|
|
4
4
|
import { useDispatch, useSelector } from 'react-redux';
|
|
5
5
|
import { WebView, WebViewMessageEvent } from 'react-native-webview';
|
|
@@ -21,6 +21,10 @@ import { getFontFacesString } from '../scripts/html/fontFaces';
|
|
|
21
21
|
import type { RootState } from '../store';
|
|
22
22
|
import { setEvent } from '../slices/SharedEventsSlice';
|
|
23
23
|
import * as AppInfo from '../utils/AppInfo';
|
|
24
|
+
import UNStoreManagerHelper from '../nativeModulesHelpers/UNStoreManagerHelper/UNStoreManagerHelper';
|
|
25
|
+
import { UserDataKeys } from '../types/internal/unitStore.types';
|
|
26
|
+
import { useListenerToEvent } from '../hooks/useListenerToEvent';
|
|
27
|
+
import { setItemInWindowUnitStore } from '../utils/windowUnitStore';
|
|
24
28
|
|
|
25
29
|
export interface WebComponentProps {
|
|
26
30
|
type: WebComponentType;
|
|
@@ -36,7 +40,7 @@ export interface WebComponentProps {
|
|
|
36
40
|
windowParams?: string;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
export const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props,
|
|
43
|
+
export const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props, webOutRef) {
|
|
40
44
|
const dispatch = useDispatch();
|
|
41
45
|
const unitScript = useSelector((state: RootState) => state.configuration.unitScript);
|
|
42
46
|
const globalTheme = useSelector((state: RootState) => state.configuration.theme);
|
|
@@ -45,6 +49,10 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
|
|
|
45
49
|
const [baseName, setBaseName] = useState<string>();
|
|
46
50
|
const [infoParams, setInfoParams] = useState<{ [key: string]: string }>({});
|
|
47
51
|
|
|
52
|
+
const webRef = useRef(null);
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
54
|
+
useImperativeHandle(webOutRef, () => webRef.current!);
|
|
55
|
+
|
|
48
56
|
useEffect(() => {
|
|
49
57
|
const getAppName = async () => {
|
|
50
58
|
// For iOS, we extend the app name from the HTML to display a prettier access request message.
|
|
@@ -76,35 +84,51 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
|
|
|
76
84
|
return;
|
|
77
85
|
}
|
|
78
86
|
|
|
79
|
-
const
|
|
80
|
-
|
|
87
|
+
const updateSourceHTML = async () => {
|
|
88
|
+
const componentCurrentTheme = props.theme ?? globalTheme;
|
|
89
|
+
const componentCurrentLanguage = props.language ?? globalLanguage;
|
|
90
|
+
|
|
91
|
+
const themeParam = componentCurrentTheme ? ` theme="${componentCurrentTheme}"` : '';
|
|
92
|
+
const languageParam = componentCurrentLanguage ? ` language="${componentCurrentLanguage}"` : '';
|
|
93
|
+
|
|
94
|
+
const componentParams = (props.params || '') + themeParam + languageParam;
|
|
81
95
|
|
|
82
|
-
|
|
83
|
-
const languageParam = componentCurrentLanguage ? ` language="${componentCurrentLanguage}"` : '';
|
|
96
|
+
const fontFaces = getFontFacesString(UnitSDK.getFonts());
|
|
84
97
|
|
|
85
|
-
|
|
98
|
+
const windowInfoParams = `window.UnitMobileSDKConfig['info'] = ${JSON.stringify(infoParams)}`;
|
|
99
|
+
const plaidRedirectUriParam = (Platform.OS == 'ios' && UnitSDK.helpers.redirectUri) ? `window.UnitMobileSDKConfig['plaidRedirectUri'] = '${UnitSDK.helpers.redirectUri}/plaid';` : '';
|
|
86
100
|
|
|
87
|
-
|
|
101
|
+
const unitVerifiedCustomerToken = await UNStoreManagerHelper.getValue(UserDataKeys.unitVerifiedToken);
|
|
102
|
+
const windowVerifiedCustomerToken = unitVerifiedCustomerToken ? `window.UnitStore['unitVerifiedCustomerToken'] = '${unitVerifiedCustomerToken}'` : '';
|
|
103
|
+
|
|
104
|
+
const windowParams = `${windowInfoParams}; ${plaidRedirectUriParam} ${windowVerifiedCustomerToken}; ${props.windowParams || ''}`;
|
|
105
|
+
|
|
106
|
+
let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));
|
|
107
|
+
newHtml = newHtml.replace(HTML_PLACEHOLDER.FONT_FACES, fontFaces);
|
|
108
|
+
newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');
|
|
109
|
+
newHtml = newHtml.replace(HTML_PLACEHOLDER.WINDOW_PARAMS, windowParams);
|
|
110
|
+
setSourceHtml(newHtml);
|
|
111
|
+
};
|
|
88
112
|
|
|
89
|
-
|
|
90
|
-
const windowParams = `${windowInfoParams}; ${props.windowParams || ''}`;
|
|
113
|
+
updateSourceHTML();
|
|
91
114
|
|
|
92
|
-
let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));
|
|
93
|
-
newHtml = newHtml.replace(HTML_PLACEHOLDER.FONT_FACES, fontFaces);
|
|
94
|
-
newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');
|
|
95
|
-
newHtml = newHtml.replace(HTML_PLACEHOLDER.WINDOW_PARAMS, windowParams);
|
|
96
|
-
setSourceHtml(newHtml);
|
|
97
115
|
}, [props.params, unitScript, props.presentationMode, props.script, props.windowParams, globalTheme, globalLanguage, infoParams]);
|
|
98
116
|
|
|
117
|
+
// Listen and update the live webComponents
|
|
118
|
+
const updateVerifiedCustomerToken = (data: string) => {
|
|
119
|
+
setItemInWindowUnitStore(webRef.current, UserDataKeys.unitVerifiedToken, data);
|
|
120
|
+
};
|
|
121
|
+
useListenerToEvent({ busEventKey: UnitMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED, action: updateVerifiedCustomerToken });
|
|
122
|
+
|
|
99
123
|
const onMessage = (e: WebViewMessageEvent) => {
|
|
100
124
|
const message = JSON.parse(e.nativeEvent.data) as WebViewMessage;
|
|
101
125
|
switch (message.type) {
|
|
102
126
|
case UnitMessage.UNIT_REQUEST_REFRESH:
|
|
103
127
|
message.details &&
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
128
|
+
dispatch(setEvent({
|
|
129
|
+
key: UnitMessage.UNIT_REQUEST_REFRESH,
|
|
130
|
+
data: message.details as RequestRefreshEvent,
|
|
131
|
+
}));
|
|
108
132
|
break;
|
|
109
133
|
case UnitMessage.UNIT_REQUEST_OPEN_LINK:
|
|
110
134
|
// eslint-disable-next-line no-case-declarations
|
|
@@ -114,11 +138,24 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
|
|
|
114
138
|
|
|
115
139
|
case UnitMessage.UNIT_REQUEST_DOWNLOAD:
|
|
116
140
|
message.details &&
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
141
|
+
handleRequestDownload(message.details as RequestDownloadEvent, () => {
|
|
142
|
+
dispatch(setEvent({ key: UnitMessage.UNIT_REQUEST_CLOSE_FLOW, data: {} }));
|
|
143
|
+
});
|
|
144
|
+
break;
|
|
145
|
+
case UnitMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED:
|
|
146
|
+
if (message.details) {
|
|
147
|
+
const data = message.details as string;
|
|
148
|
+
UNStoreManagerHelper.saveValue(UserDataKeys.unitVerifiedToken, data);
|
|
149
|
+
// update existing components - namely, the other webComponents will update their window as well as this webComponent
|
|
150
|
+
dispatch(setEvent({
|
|
151
|
+
key: UnitMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED,
|
|
152
|
+
data,
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
case UnitMessage.UNIT_UNAUTHORIZED_TOKEN:
|
|
157
|
+
UnitSDK.cleanUserData();
|
|
120
158
|
break;
|
|
121
|
-
|
|
122
159
|
default:
|
|
123
160
|
props.onMessage && props.onMessage(message);
|
|
124
161
|
}
|