react-native-unit-components 1.5.0 → 1.7.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/ios/UNAppInfo/UNAppInfo.swift +5 -1
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +50 -8
- 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 +9 -11
- 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.js +12 -6
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js +5 -4
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +12 -6
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +4 -3
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +6 -6
- 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/UNBottomSheetComponent/UNBottomSheetComponent.js +159 -74
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +28 -8
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js +49 -37
- package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +1 -1
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +20 -50
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +5 -53
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js +6 -6
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.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/flows/UNFlows.js +19 -0
- package/lib/commonjs/flows/UNFlows.js.map +1 -0
- package/lib/commonjs/flows/card/UNCardFlows.js +33 -0
- package/lib/commonjs/flows/card/UNCardFlows.js.map +1 -0
- package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js +70 -0
- package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -0
- package/lib/commonjs/helpers/pushProvisioningService/startProvisioning.js +22 -0
- package/lib/commonjs/helpers/pushProvisioningService/startProvisioning.js.map +1 -0
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/messages/nativeMessages/bottomSheetMessage.js +17 -0
- package/lib/commonjs/messages/nativeMessages/bottomSheetMessage.js.map +1 -0
- package/lib/commonjs/messages/nativeMessages/cardMessage.js +2 -8
- package/lib/commonjs/messages/nativeMessages/cardMessage.js.map +1 -1
- package/lib/commonjs/messages/nativeMessages/index.js.map +1 -1
- package/lib/commonjs/messages/webMessages/accountMessage.js.map +1 -1
- package/lib/commonjs/messages/webMessages/achCreditMessage.js.map +1 -1
- package/lib/commonjs/messages/webMessages/bookPaymentMessage.js.map +1 -1
- package/lib/commonjs/messages/webMessages/cardMessage.js.map +1 -1
- package/lib/commonjs/messages/webMessages/checkMessage.js.map +1 -1
- package/lib/commonjs/messages/webMessages/onLoadMessage.js.map +1 -1
- package/lib/commonjs/messages/webMessages/unitMessages.js +1 -0
- package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -1
- package/lib/commonjs/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.js +1 -1
- package/lib/commonjs/networking/common/UNNetworkConstants.js.map +1 -0
- package/lib/commonjs/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.js +3 -1
- package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js.map +1 -0
- package/lib/commonjs/scripts/html/bodyHtml.js +4 -10
- package/lib/commonjs/scripts/html/bodyHtml.js.map +1 -1
- package/lib/commonjs/scripts/html/bodyScript.js +13 -2
- package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
- package/lib/commonjs/types/internal/bottomSheet.types.js +14 -0
- package/lib/commonjs/types/internal/bottomSheet.types.js.map +1 -0
- package/lib/commonjs/types/internal/webComponent.types.js +27 -0
- package/lib/commonjs/types/internal/webComponent.types.js.map +1 -0
- package/lib/commonjs/types/shared/achCredit.types.js.map +1 -0
- package/lib/commonjs/types/shared/activity.types.js.map +1 -0
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js +20 -2
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
- package/lib/commonjs/unitSdkManager/unitUiManager/unitUiManager.js +21 -0
- package/lib/commonjs/unitSdkManager/unitUiManager/unitUiManager.js.map +1 -0
- package/lib/commonjs/webComponent/WebComponent.js +6 -16
- package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
- package/lib/commonjs/webComponent/html.js +3 -1
- package/lib/commonjs/webComponent/html.js.map +1 -1
- package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +49 -7
- 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 +5 -7
- 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.js +10 -4
- package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
- package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js +3 -2
- package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js +10 -4
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +3 -2
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +2 -2
- 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/UNBottomSheetComponent/UNBottomSheetComponent.js +159 -74
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +23 -6
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js +51 -39
- package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +1 -1
- package/lib/module/components/UNCardComponent/UNCardComponent.js +20 -51
- package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
- package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +2 -48
- package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js +2 -2
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.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/flows/UNFlows.js +12 -0
- package/lib/module/flows/UNFlows.js.map +1 -0
- package/lib/module/flows/card/UNCardFlows.js +25 -0
- package/lib/module/flows/card/UNCardFlows.js.map +1 -0
- package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js +63 -0
- package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -0
- package/lib/module/helpers/pushProvisioningService/startProvisioning.js +15 -0
- package/lib/module/helpers/pushProvisioningService/startProvisioning.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/messages/nativeMessages/bottomSheetMessage.js +9 -0
- package/lib/module/messages/nativeMessages/bottomSheetMessage.js.map +1 -0
- package/lib/module/messages/nativeMessages/cardMessage.js +1 -6
- package/lib/module/messages/nativeMessages/cardMessage.js.map +1 -1
- package/lib/module/messages/nativeMessages/index.js.map +1 -1
- package/lib/module/messages/webMessages/accountMessage.js.map +1 -1
- package/lib/module/messages/webMessages/achCreditMessage.js.map +1 -1
- package/lib/module/messages/webMessages/bookPaymentMessage.js.map +1 -1
- package/lib/module/messages/webMessages/cardMessage.js.map +1 -1
- package/lib/module/messages/webMessages/checkMessage.js.map +1 -1
- package/lib/module/messages/webMessages/onLoadMessage.js.map +1 -1
- package/lib/module/messages/webMessages/unitMessages.js +1 -0
- package/lib/module/messages/webMessages/unitMessages.js.map +1 -1
- package/lib/module/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.js +1 -1
- package/lib/module/networking/common/UNNetworkConstants.js.map +1 -0
- package/lib/module/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.js +4 -1
- package/lib/module/networking/requests/UNWalletPayloadRequest.js.map +1 -0
- package/lib/module/scripts/html/bodyHtml.js +1 -6
- package/lib/module/scripts/html/bodyHtml.js.map +1 -1
- package/lib/module/scripts/html/bodyScript.js +13 -2
- package/lib/module/scripts/html/bodyScript.js.map +1 -1
- package/lib/module/types/internal/bottomSheet.types.js +7 -0
- package/lib/module/types/internal/bottomSheet.types.js.map +1 -0
- package/lib/module/types/internal/webComponent.types.js +19 -0
- package/lib/module/types/internal/webComponent.types.js.map +1 -0
- package/lib/module/types/shared/achCredit.types.js.map +1 -0
- package/lib/module/types/shared/activity.types.js.map +1 -0
- package/lib/module/unitSdkManager/UnitSdkManager.js +20 -2
- package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
- package/lib/module/unitSdkManager/unitUiManager/unitUiManager.js +14 -0
- package/lib/module/unitSdkManager/unitUiManager/unitUiManager.js.map +1 -0
- package/lib/module/webComponent/WebComponent.js +5 -14
- package/lib/module/webComponent/WebComponent.js.map +1 -1
- package/lib/module/webComponent/html.js +3 -1
- package/lib/module/webComponent/html.js.map +1 -1
- package/lib/typescript/components/UNACHCreditComponent/UNACHCreditComponent.d.ts +2 -1
- package/lib/typescript/components/UNACHCreditComponent/UNACHCreditComponent.utils.d.ts +4 -1
- package/lib/typescript/components/UNACHDebitComponent/UNACHDebitComponent.d.ts +1 -1
- package/lib/typescript/components/UNACHDebitComponent/UNACHDebitComponent.utils.d.ts +0 -1
- package/lib/typescript/components/UNAccountComponent/UNAccountComponent.d.ts +3 -3
- package/lib/typescript/components/UNAccountComponent/UNAccountComponent.utils.d.ts +1 -1
- package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +3 -3
- package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +2 -1
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +0 -7
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +5 -1
- package/lib/typescript/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.d.ts +6 -2
- package/lib/typescript/components/UNCardComponent/UNCardComponent.d.ts +2 -1
- package/lib/typescript/components/UNCardComponent/UNCardComponent.utils.d.ts +1 -9
- package/lib/typescript/components/UNCheckDepositComponent/UNCheckDepositComponent.d.ts +2 -2
- package/lib/typescript/components/utils/nativeModulesInfo.d.ts +1 -0
- package/lib/typescript/flows/UNFlows.d.ts +4 -0
- package/lib/typescript/flows/card/UNCardFlows.d.ts +3 -0
- package/lib/typescript/helpers/pushProvisioningService/hooks/useCardWallet.d.ts +7 -0
- package/lib/typescript/helpers/pushProvisioningService/startProvisioning.d.ts +2 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/messages/nativeMessages/bottomSheetMessage.d.ts +9 -0
- package/lib/typescript/messages/nativeMessages/cardMessage.d.ts +0 -16
- package/lib/typescript/messages/nativeMessages/index.d.ts +3 -3
- package/lib/typescript/messages/webMessages/accountMessage.d.ts +1 -1
- package/lib/typescript/messages/webMessages/achCreditMessage.d.ts +1 -1
- package/lib/typescript/messages/webMessages/bookPaymentMessage.d.ts +1 -1
- package/lib/typescript/messages/webMessages/cardMessage.d.ts +1 -1
- package/lib/typescript/messages/webMessages/checkMessage.d.ts +1 -1
- package/lib/typescript/messages/webMessages/onLoadMessage.d.ts +3 -3
- package/lib/typescript/messages/webMessages/unitMessages.d.ts +2 -1
- package/lib/typescript/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.d.ts +1 -1
- package/lib/typescript/scripts/html/bodyHtml.d.ts +1 -5
- package/lib/typescript/scripts/html/bodyScript.d.ts +1 -0
- package/lib/typescript/types/internal/bottomSheet.types.d.ts +35 -0
- package/lib/typescript/types/internal/webComponent.types.d.ts +16 -0
- package/lib/typescript/{sharedTypes → types/shared}/achCredit.types.d.ts +1 -1
- package/lib/typescript/{sharedTypes → types/shared}/activity.types.d.ts +1 -1
- package/lib/typescript/unitSdkManager/UnitSdkManager.d.ts +9 -0
- package/lib/typescript/unitSdkManager/unitUiManager/unitUiManager.d.ts +6 -0
- package/lib/typescript/webComponent/WebComponent.d.ts +2 -11
- package/lib/typescript/webComponent/html.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +47 -8
- package/src/components/UNACHCreditComponent/UNACHCreditComponent.utils.ts +14 -11
- package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +7 -11
- package/src/components/UNACHDebitComponent/UNACHDebitComponent.utils.ts +1 -20
- package/src/components/UNAccountComponent/UNAccountComponent.tsx +15 -8
- package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +4 -3
- package/src/components/UNActivityComponent/UNActivityComponent.tsx +15 -8
- package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +4 -2
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +9 -3
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.ts +1 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +151 -76
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +24 -6
- package/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.tsx +72 -41
- package/src/components/UNCardComponent/UNCardComponent.tsx +25 -54
- package/src/components/UNCardComponent/UNCardComponent.utils.ts +3 -49
- package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.tsx +4 -4
- package/src/components/utils/nativeModulesInfo.ts +11 -0
- package/src/flows/UNFlows.ts +13 -0
- package/src/flows/card/UNCardFlows.ts +25 -0
- package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +67 -0
- package/src/helpers/pushProvisioningService/startProvisioning.ts +20 -0
- package/src/index.tsx +1 -1
- package/src/messages/nativeMessages/bottomSheetMessage.ts +15 -0
- package/src/messages/nativeMessages/cardMessage.ts +1 -24
- package/src/messages/nativeMessages/index.ts +3 -3
- package/src/messages/webMessages/accountMessage.ts +1 -1
- package/src/messages/webMessages/achCreditMessage.ts +1 -1
- package/src/messages/webMessages/bookPaymentMessage.ts +1 -1
- package/src/messages/webMessages/cardMessage.ts +1 -1
- package/src/messages/webMessages/checkMessage.ts +1 -1
- package/src/messages/webMessages/onLoadMessage.ts +3 -3
- package/src/messages/webMessages/unitMessages.ts +3 -2
- package/src/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.ts +1 -1
- package/src/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.ts +3 -1
- package/src/scripts/html/bodyHtml.ts +2 -14
- package/src/scripts/html/bodyScript.ts +13 -3
- package/src/types/internal/bottomSheet.types.ts +43 -0
- package/src/types/internal/webComponent.types.ts +26 -0
- package/src/{sharedTypes → types/shared}/achCredit.types.ts +1 -1
- package/src/{sharedTypes → types/shared}/activity.types.ts +1 -1
- package/src/unitSdkManager/UnitSdkManager.ts +28 -2
- package/src/unitSdkManager/unitUiManager/unitUiManager.ts +13 -0
- package/src/webComponent/WebComponent.tsx +7 -15
- package/src/webComponent/html.ts +3 -1
- package/lib/commonjs/components/UNCardComponent/networking/common/UNNetworkConstants.js.map +0 -1
- package/lib/commonjs/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js.map +0 -1
- package/lib/commonjs/sharedTypes/achCredit.types.js.map +0 -1
- package/lib/commonjs/sharedTypes/activity.types.js.map +0 -1
- package/lib/module/components/UNCardComponent/networking/common/UNNetworkConstants.js.map +0 -1
- package/lib/module/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js.map +0 -1
- package/lib/module/sharedTypes/achCredit.types.js.map +0 -1
- package/lib/module/sharedTypes/activity.types.js.map +0 -1
- /package/lib/commonjs/{sharedTypes → types/shared}/account.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/account.types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/achCredit.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/activity.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/authorization.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/authorization.types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/bookPayment.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/bookPayment.types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/card.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/card.types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/checkDeposit.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/checkDeposit.types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/index.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/index.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/onLoadResponse.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/onLoadResponse.types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/payments.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/payments.types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/transactions.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/transactions.types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/types.js.map +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/wallet.types.js +0 -0
- /package/lib/commonjs/{sharedTypes → types/shared}/wallet.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/account.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/account.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/achCredit.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/activity.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/authorization.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/authorization.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/bookPayment.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/bookPayment.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/card.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/card.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/checkDeposit.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/checkDeposit.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/index.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/index.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/onLoadResponse.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/onLoadResponse.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/payments.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/payments.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/transactions.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/transactions.types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/types.js.map +0 -0
- /package/lib/module/{sharedTypes → types/shared}/wallet.types.js +0 -0
- /package/lib/module/{sharedTypes → types/shared}/wallet.types.js.map +0 -0
- /package/lib/typescript/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/account.types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/authorization.types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/bookPayment.types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/card.types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/checkDeposit.types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/index.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/onLoadResponse.types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/payments.types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/transactions.types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/types.d.ts +0 -0
- /package/lib/typescript/{sharedTypes → types/shared}/wallet.types.d.ts +0 -0
- /package/src/{sharedTypes → types/shared}/account.types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/authorization.types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/bookPayment.types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/card.types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/checkDeposit.types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/index.ts +0 -0
- /package/src/{sharedTypes → types/shared}/onLoadResponse.types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/payments.types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/transactions.types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/types.ts +0 -0
- /package/src/{sharedTypes → types/shared}/wallet.types.ts +0 -0
|
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getMobileWalletPayload = void 0;
|
|
7
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8
8
|
var _UNNetworkConstants = require("../common/UNNetworkConstants");
|
|
9
|
-
var _UnitSdkManager = require("
|
|
9
|
+
var _UnitSdkManager = require("../../unitSdkManager/UnitSdkManager");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
// TODO: use apiClient class for handling requests.
|
|
12
|
+
|
|
11
13
|
const getMobileWalletPayload = async (customerToken, cardId, env) => {
|
|
12
14
|
const headers = {
|
|
13
15
|
'Content-Type': _UNNetworkConstants.APIHeaders.CONTENT_TYPE,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_axios","_interopRequireDefault","require","_UNNetworkConstants","_UnitSdkManager","obj","__esModule","default","getMobileWalletPayload","customerToken","cardId","env","headers","APIHeaders","CONTENT_TYPE","data","attributes","signedNonce","UnitSDK","getSignedNonce","baseURL","UNIT_SECURE_URL","response","axios","post","encryptedPayload","payload","error","Promise","reject","exports"],"sources":["UNWalletPayloadRequest.ts"],"sourcesContent":["import axios from 'axios';\nimport { APIHeaders, UNIT_SECURE_URL } from '../common/UNNetworkConstants';\nimport { UnitSDK, UNEnvironment } from '../../unitSdkManager/UnitSdkManager';\n\n// TODO: use apiClient class for handling requests.\n\nexport const getMobileWalletPayload = async (customerToken: string, cardId: string, env: UNEnvironment) => {\n const headers = {\n 'Content-Type': APIHeaders.CONTENT_TYPE,\n 'Authorization': `Bearer ${customerToken}`,\n };\n\n const data = {\n data: {\n attributes: {\n signedNonce: UnitSDK.getSignedNonce(),\n },\n },\n };\n\n const baseURL = `${UNIT_SECURE_URL[env as keyof typeof UNEnvironment]}/cards/${cardId}/mobile-wallet-payload`;\n try {\n const response = await axios.post(\n baseURL,\n data,\n {\n headers: headers,\n });\n const encryptedPayload = response.data.data.attributes.payload;\n return encryptedPayload;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAA6E,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE7E;;AAEO,MAAMG,sBAAsB,GAAG,MAAAA,CAAOC,aAAqB,EAAEC,MAAc,EAAEC,GAAkB,KAAK;EACzG,MAAMC,OAAO,GAAG;IACd,cAAc,EAAEC,8BAAU,CAACC,YAAY;IACvC,eAAe,EAAG,UAASL,aAAc;EAC3C,CAAC;EAED,MAAMM,IAAI,GAAG;IACXA,IAAI,EAAE;MACJC,UAAU,EAAE;QACVC,WAAW,EAAEC,uBAAO,CAACC,cAAc;MACrC;IACF;EACF,CAAC;EAED,MAAMC,OAAO,GAAI,GAAEC,mCAAe,CAACV,GAAG,CAAgC,UAASD,MAAO,wBAAuB;EAC7G,IAAI;IACF,MAAMY,QAAQ,GAAG,MAAMC,cAAK,CAACC,IAAI,CAC/BJ,OAAO,EACPL,IAAI,EACJ;MACEH,OAAO,EAAEA;IACX,CAAC,CAAC;IACJ,MAAMa,gBAAgB,GAAGH,QAAQ,CAACP,IAAI,CAACA,IAAI,CAACC,UAAU,CAACU,OAAO;IAC9D,OAAOD,gBAAgB;EACzB,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAOC,OAAO,CAACC,MAAM,CAACF,KAAK,CAAC;EAC9B;AACF,CAAC;AAACG,OAAA,CAAAtB,sBAAA,GAAAA,sBAAA"}
|
|
@@ -3,22 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.webViewId = exports.getHtmlBody =
|
|
6
|
+
exports.webViewId = exports.getHtmlBody = void 0;
|
|
7
|
+
var _webComponent = require("../../types/internal/webComponent.types");
|
|
7
8
|
const webViewId = 'webViewContainer';
|
|
8
9
|
exports.webViewId = webViewId;
|
|
9
|
-
let PresentationMode;
|
|
10
|
-
exports.PresentationMode = PresentationMode;
|
|
11
|
-
(function (PresentationMode) {
|
|
12
|
-
PresentationMode["CoverInjectedHeight"] = "coverInjectedHeight";
|
|
13
|
-
PresentationMode["Inherit"] = "inherit";
|
|
14
|
-
PresentationMode["Default"] = "deafult";
|
|
15
|
-
})(PresentationMode || (exports.PresentationMode = PresentationMode = {}));
|
|
16
10
|
const getHtmlBody = (unitComponent, unitComponentProps, presentationMode) => {
|
|
17
11
|
const currentComponent = `<${unitComponent} ${unitComponentProps || ''} }> </${unitComponent}>`;
|
|
18
12
|
switch (presentationMode) {
|
|
19
|
-
case PresentationMode.CoverInjectedHeight:
|
|
13
|
+
case _webComponent.PresentationMode.CoverInjectedHeight:
|
|
20
14
|
return getCoverInjectedHeightBodyScript(currentComponent);
|
|
21
|
-
case PresentationMode.Inherit:
|
|
15
|
+
case _webComponent.PresentationMode.Inherit:
|
|
22
16
|
return getInheritParentSizeScript(currentComponent);
|
|
23
17
|
default:
|
|
24
18
|
return currentComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_webComponent","require","webViewId","exports","getHtmlBody","unitComponent","unitComponentProps","presentationMode","currentComponent","PresentationMode","CoverInjectedHeight","getCoverInjectedHeightBodyScript","Inherit","getInheritParentSizeScript","currentUnitScript"],"sources":["bodyHtml.ts"],"sourcesContent":["import { PresentationMode } from '../../types/internal/webComponent.types';\n\nexport const webViewId = 'webViewContainer';\n\nexport const getHtmlBody = (unitComponent: string, unitComponentProps?: string, presentationMode?: PresentationMode) => {\n const currentComponent = `<${unitComponent} ${unitComponentProps || ''} }> </${unitComponent}>`;\n\n switch (presentationMode) {\n case PresentationMode.CoverInjectedHeight:\n return getCoverInjectedHeightBodyScript(currentComponent);\n case PresentationMode.Inherit:\n return getInheritParentSizeScript(currentComponent);\n default:\n return currentComponent;\n }\n};\n\nconst getCoverInjectedHeightBodyScript = (currentUnitScript: string) => {\n return `\n <div id=${webViewId}>\n <div style=\"height: 100%; display: block; padding: 1px;\">\n ${currentUnitScript}\n </div>\n </div>\n `;\n};\n\nconst getInheritParentSizeScript = (currentUnitScript: string) => {\n return `\n <div style=\"height: 100vh\">\n ${currentUnitScript}\n </div>\n `;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEO,MAAMC,SAAS,GAAG,kBAAkB;AAACC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAErC,MAAME,WAAW,GAAGA,CAACC,aAAqB,EAAEC,kBAA2B,EAAEC,gBAAmC,KAAK;EACtH,MAAMC,gBAAgB,GAAI,IAAGH,aAAc,IAAGC,kBAAkB,IAAI,EAAG,SAAQD,aAAc,GAAE;EAE/F,QAAQE,gBAAgB;IACtB,KAAKE,8BAAgB,CAACC,mBAAmB;MACvC,OAAOC,gCAAgC,CAACH,gBAAgB,CAAC;IAC3D,KAAKC,8BAAgB,CAACG,OAAO;MAC3B,OAAOC,0BAA0B,CAACL,gBAAgB,CAAC;IACrD;MACE,OAAOA,gBAAgB;EAAC;AAE9B,CAAC;AAACL,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAEF,MAAMO,gCAAgC,GAAIG,iBAAyB,IAAK;EACtE,OAAQ;AACV,cAAcZ,SAAU;AACxB;AACA,UAAUY,iBAAkB;AAC5B;AACA;AACA,GAAG;AACH,CAAC;AAED,MAAMD,0BAA0B,GAAIC,iBAAyB,IAAK;EAChE,OAAQ;AACV;AACA,QAAQA,iBAAkB;AAC1B;AACA,GAAG;AACH,CAAC"}
|
|
@@ -89,7 +89,7 @@ const LISTENERS = {
|
|
|
89
89
|
window.addEventListener("${_unitMessages.UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}", (e) => {
|
|
90
90
|
postMessageToSDK({ type: "${_unitMessages.UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}", details: e.detail })
|
|
91
91
|
});
|
|
92
|
-
`,
|
|
92
|
+
`,
|
|
93
93
|
unitPaymentCreated: `
|
|
94
94
|
window.addEventListener("${_paymentsMessage.PaymentMessage.PAYMENT_CREATED}", (e) => {
|
|
95
95
|
const response = e.detail
|
|
@@ -98,7 +98,18 @@ const LISTENERS = {
|
|
|
98
98
|
}).catch((e) => {
|
|
99
99
|
console.log(e)
|
|
100
100
|
})
|
|
101
|
-
})
|
|
101
|
+
});
|
|
102
|
+
`,
|
|
103
|
+
unitPlaidTokenCreated: `
|
|
104
|
+
window.addEventListener("${_unitMessages.UnitMessage.UNIT_PLAID_TOKEN_CREATED}", (e) => {
|
|
105
|
+
const response = e.detail
|
|
106
|
+
response.then((data) => {
|
|
107
|
+
postMessageToSDK({ type: "${_unitMessages.UnitMessage.UNIT_PLAID_TOKEN_CREATED}", details: { linkToken: data.data }})
|
|
108
|
+
}).catch((e) => {
|
|
109
|
+
console.log(e)
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
`,
|
|
102
113
|
unitAccountChanged: `
|
|
103
114
|
window.addEventListener("${_accountMessage.AccountMessage.UNIT_ACCOUNT_CHANGED}", (e) => {
|
|
104
115
|
const response = e.detail
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_paymentsMessage","require","_cardMessage","_pageMessage","_unitMessages","_accountMessage","_activityMessage","POST_MESSAGE_TO_SDK","exports","POST_PAGE_HEIGHT","PageMessage","PAGE_HEIGHT","LISTENERS","isPageLoaded","PAGE_LOADED","requestRendering","UnitMessage","UNIT_REQUEST_RENDERING","requestRefresh","UNIT_REQUEST_REFRESH","onLoad","UNIT_ON_LOAD","requestCloseFlow","UNIT_REQUEST_CLOSE_FLOW","requestOpenLink","UNIT_REQUEST_OPEN_LINK","unitRequestDownload","UNIT_REQUEST_DOWNLOAD","cardActivated","CardMessage","CARD_ACTIVATED","cardStatusChange","CARD_STATUS_CHANGED","unitRequestExternalSdk","UNIT_REQUEST_EXTERNAL_SDK","unitPaymentCreated","PaymentMessage","PAYMENT_CREATED","unitAccountChanged","AccountMessage","UNIT_ACCOUNT_CHANGED","unitActivityFiltersChanged","ActivityMessage","UNIT_ACTIVITY_FILTERS_CHANGED","DISPATCH_RENDERING_EVENT","DISPATCH_REQUEST_REFRESH","DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT","DISPATCH_PLAID_RESPONSE","UNIT_PLAID_RESPONSE","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_CARD_ACTION","DISPATCH_REQUEST_ACCOUNT_ACTION"],"sources":["bodyScript.ts"],"sourcesContent":["import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';\nimport { CardMessage } from '../../messages/webMessages/cardMessage';\nimport { PageMessage } from '../../messages/webMessages/pageMessage';\nimport { UnitMessage } from '../../messages/webMessages/unitMessages';\nimport { AccountMessage } from '../../messages/webMessages/accountMessage';\nimport { ActivityMessage } from '../../messages/webMessages/activityMessage';\n\nexport const POST_MESSAGE_TO_SDK = `\n const postMessageToSDK = (message) => {\n if ('ReactNativeWebView' in window) {\n const messageString = JSON.stringify(message)\n window['ReactNativeWebView'].postMessage(messageString)\n }\n }\n`;\n\nexport const POST_PAGE_HEIGHT = `\n const postHeight = () => {\n setTimeout(() => {\n const height = window.document.documentElement.getBoundingClientRect().height\n postMessageToSDK({ type: \"${PageMessage.PAGE_HEIGHT}\", details: { height } })\n })\n }\n`;\n\nexport const LISTENERS = {\n isPageLoaded: `\n window.addEventListener('DOMContentLoaded', e => {\n postMessageToSDK({ type: \"${PageMessage.PAGE_LOADED}\" })\n });\n `,\n requestRendering: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_RENDERING}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_RENDERING}\", details: { data: e.detail }})\n });\n `,\n requestRefresh: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_REFRESH}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_REFRESH}\", details: e.detail })\n });\n `,\n onLoad: `\n window.addEventListener(\"${UnitMessage.UNIT_ON_LOAD}\", (e) => {\n postHeight()\n postMessageToSDK({ type: \"${UnitMessage.UNIT_ON_LOAD}\", details: e.detail })\n });\n `,\n requestCloseFlow: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\" })\n });\n `,\n requestOpenLink: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", details: e.detail })\n });\n `,\n unitRequestDownload: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_DOWNLOAD}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_DOWNLOAD}\", details: e.detail })\n });\n `,\n cardActivated: `\n window.addEventListener(\"${CardMessage.CARD_ACTIVATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_ACTIVATED}\", details: { card: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n cardStatusChange: `\n window.addEventListener(\"${CardMessage.CARD_STATUS_CHANGED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_STATUS_CHANGED}\", details: { card: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitRequestExternalSdk: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}\", details: e.detail })\n });\n`,\n unitPaymentCreated: `\n window.addEventListener(\"${PaymentMessage.PAYMENT_CREATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${PaymentMessage.PAYMENT_CREATED}\", details: { data: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });`\n ,\n unitAccountChanged: `\n window.addEventListener(\"${AccountMessage.UNIT_ACCOUNT_CHANGED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${AccountMessage.UNIT_ACCOUNT_CHANGED}\", details: { account: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitActivityFiltersChanged: `\n window.addEventListener(\"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\", (e) => {\n postMessageToSDK({ type: \"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\", details: e.detail })\n });\n `\n};\n\nexport const DISPATCH_RENDERING_EVENT = `\n const dispatchRenderingEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_RENDERING}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_REQUEST_REFRESH = `\n const dispatchRefreshEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_REFRESH}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = `\n const dispatchActivityFilterChangedEvent = (details) => {\n const event = new CustomEvent(\"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\",{ detail: details });\n window.dispatchEvent(event);\n }\n`;\n\nexport const DISPATCH_PLAID_RESPONSE = `\n const dispatchPlaidEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_PLAID_RESPONSE}\",{ detail: details })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_OPEN_ACTIONS_MENU = `\n const dispatchOpenActionsMenu = (componentName) => {\n document.querySelector(componentName).dispatchEvent(new CustomEvent(\"unitRequestOpenActionsMenu\"))\n }\n`;\n\nexport const DISPATCH_REQUEST_CARD_ACTION = `\n const dispatchRequestCardAction = (action) => {\n document.querySelector(\"unit-elements-card\").dispatchEvent(new CustomEvent(\"unitRequestCardAction\", {detail: {action: action}}))\n }\n`;\n\nexport const DISPATCH_REQUEST_ACCOUNT_ACTION = `\n const dispatchRequestAccountAction = (action) => {\n document.querySelector(\"unit-elements-account\").dispatchEvent(new CustomEvent(\"unitRequestAccountAction\", {detail: {action: action}}))\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAA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C,OAAA,CAAAyC,0BAAA,GAAAA,0BAAA;AAEK,MAAMC,4BAA4B,GAAI;AAC7C;AACA;AACA;AACA,CAAC;AAAC1C,OAAA,CAAA0C,4BAAA,GAAAA,4BAAA;AAEK,MAAMC,+BAA+B,GAAI;AAChD;AACA;AACA;AACA,CAAC;AAAC3C,OAAA,CAAA2C,+BAAA,GAAAA,+BAAA"}
|
|
1
|
+
{"version":3,"names":["_paymentsMessage","require","_cardMessage","_pageMessage","_unitMessages","_accountMessage","_activityMessage","POST_MESSAGE_TO_SDK","exports","POST_PAGE_HEIGHT","PageMessage","PAGE_HEIGHT","LISTENERS","isPageLoaded","PAGE_LOADED","requestRendering","UnitMessage","UNIT_REQUEST_RENDERING","requestRefresh","UNIT_REQUEST_REFRESH","onLoad","UNIT_ON_LOAD","requestCloseFlow","UNIT_REQUEST_CLOSE_FLOW","requestOpenLink","UNIT_REQUEST_OPEN_LINK","unitRequestDownload","UNIT_REQUEST_DOWNLOAD","cardActivated","CardMessage","CARD_ACTIVATED","cardStatusChange","CARD_STATUS_CHANGED","unitRequestExternalSdk","UNIT_REQUEST_EXTERNAL_SDK","unitPaymentCreated","PaymentMessage","PAYMENT_CREATED","unitPlaidTokenCreated","UNIT_PLAID_TOKEN_CREATED","unitAccountChanged","AccountMessage","UNIT_ACCOUNT_CHANGED","unitActivityFiltersChanged","ActivityMessage","UNIT_ACTIVITY_FILTERS_CHANGED","DISPATCH_RENDERING_EVENT","DISPATCH_REQUEST_REFRESH","DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT","DISPATCH_PLAID_RESPONSE","UNIT_PLAID_RESPONSE","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_CARD_ACTION","DISPATCH_REQUEST_ACCOUNT_ACTION"],"sources":["bodyScript.ts"],"sourcesContent":["import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';\nimport { CardMessage } from '../../messages/webMessages/cardMessage';\nimport { PageMessage } from '../../messages/webMessages/pageMessage';\nimport { UnitMessage } from '../../messages/webMessages/unitMessages';\nimport { AccountMessage } from '../../messages/webMessages/accountMessage';\nimport { ActivityMessage } from '../../messages/webMessages/activityMessage';\n\nexport const POST_MESSAGE_TO_SDK = `\n const postMessageToSDK = (message) => {\n if ('ReactNativeWebView' in window) {\n const messageString = JSON.stringify(message)\n window['ReactNativeWebView'].postMessage(messageString)\n }\n }\n`;\n\nexport const POST_PAGE_HEIGHT = `\n const postHeight = () => {\n setTimeout(() => {\n const height = window.document.documentElement.getBoundingClientRect().height\n postMessageToSDK({ type: \"${PageMessage.PAGE_HEIGHT}\", details: { height } })\n })\n }\n`;\n\nexport const LISTENERS = {\n isPageLoaded: `\n window.addEventListener('DOMContentLoaded', e => {\n postMessageToSDK({ type: \"${PageMessage.PAGE_LOADED}\" })\n });\n `,\n requestRendering: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_RENDERING}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_RENDERING}\", details: { data: e.detail }})\n });\n `,\n requestRefresh: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_REFRESH}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_REFRESH}\", details: e.detail })\n });\n `,\n onLoad: `\n window.addEventListener(\"${UnitMessage.UNIT_ON_LOAD}\", (e) => {\n postHeight()\n postMessageToSDK({ type: \"${UnitMessage.UNIT_ON_LOAD}\", details: e.detail })\n });\n `,\n requestCloseFlow: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\" })\n });\n `,\n requestOpenLink: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", details: e.detail })\n });\n `,\n unitRequestDownload: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_DOWNLOAD}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_DOWNLOAD}\", details: e.detail })\n });\n `,\n cardActivated: `\n window.addEventListener(\"${CardMessage.CARD_ACTIVATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_ACTIVATED}\", details: { card: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n cardStatusChange: `\n window.addEventListener(\"${CardMessage.CARD_STATUS_CHANGED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_STATUS_CHANGED}\", details: { card: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitRequestExternalSdk: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}\", details: e.detail })\n });\n `,\n unitPaymentCreated: `\n window.addEventListener(\"${PaymentMessage.PAYMENT_CREATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${PaymentMessage.PAYMENT_CREATED}\", details: { data: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitPlaidTokenCreated: `\n window.addEventListener(\"${UnitMessage.UNIT_PLAID_TOKEN_CREATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_PLAID_TOKEN_CREATED}\", details: { linkToken: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitAccountChanged: `\n window.addEventListener(\"${AccountMessage.UNIT_ACCOUNT_CHANGED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${AccountMessage.UNIT_ACCOUNT_CHANGED}\", details: { account: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitActivityFiltersChanged: `\n window.addEventListener(\"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\", (e) => {\n postMessageToSDK({ type: \"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\", details: e.detail })\n });\n `\n};\n\nexport const DISPATCH_RENDERING_EVENT = `\n const dispatchRenderingEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_RENDERING}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_REQUEST_REFRESH = `\n const dispatchRefreshEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_REFRESH}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = `\n const dispatchActivityFilterChangedEvent = (details) => {\n const event = new CustomEvent(\"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\",{ detail: details });\n window.dispatchEvent(event);\n }\n`;\n\nexport const DISPATCH_PLAID_RESPONSE = `\n const dispatchPlaidEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_PLAID_RESPONSE}\",{ detail: details })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_OPEN_ACTIONS_MENU = `\n const dispatchOpenActionsMenu = (componentName) => {\n document.querySelector(componentName).dispatchEvent(new CustomEvent(\"unitRequestOpenActionsMenu\"))\n }\n`;\n\nexport const DISPATCH_REQUEST_CARD_ACTION = `\n const dispatchRequestCardAction = (action) => {\n document.querySelector(\"unit-elements-card\").dispatchEvent(new CustomEvent(\"unitRequestCardAction\", {detail: {action: action}}))\n }\n`;\n\nexport const DISPATCH_REQUEST_ACCOUNT_ACTION = `\n const dispatchRequestAccountAction = (action) => {\n document.querySelector(\"unit-elements-account\").dispatchEvent(new CustomEvent(\"unitRequestAccountAction\", {detail: {action: action}}))\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,I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OAAA,CAAAwC,sCAAA,GAAAA,sCAAA;AAEK,MAAMC,uBAAuB,GAAI;AACxC;AACA,qCAAqCjC,yBAAW,CAACkC,mBAAoB;AACrE;AACA;AACA,CAAC;AAAC1C,OAAA,CAAAyC,uBAAA,GAAAA,uBAAA;AAEK,MAAME,0BAA0B,GAAI;AAC3C;AACA;AACA;AACA,CAAC;AAAC3C,OAAA,CAAA2C,0BAAA,GAAAA,0BAAA;AAEK,MAAMC,4BAA4B,GAAI;AAC7C;AACA;AACA;AACA,CAAC;AAAC5C,OAAA,CAAA4C,4BAAA,GAAAA,4BAAA;AAEK,MAAMC,+BAA+B,GAAI;AAChD;AACA;AACA;AACA,CAAC;AAAC7C,OAAA,CAAA6C,+BAAA,GAAAA,+BAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BottomSheetRenderingType = void 0;
|
|
7
|
+
let BottomSheetRenderingType;
|
|
8
|
+
exports.BottomSheetRenderingType = BottomSheetRenderingType;
|
|
9
|
+
(function (BottomSheetRenderingType) {
|
|
10
|
+
BottomSheetRenderingType[BottomSheetRenderingType["Slot"] = 0] = "Slot";
|
|
11
|
+
BottomSheetRenderingType[BottomSheetRenderingType["WebComponent"] = 1] = "WebComponent";
|
|
12
|
+
BottomSheetRenderingType[BottomSheetRenderingType["NativeComponent"] = 2] = "NativeComponent";
|
|
13
|
+
})(BottomSheetRenderingType || (exports.BottomSheetRenderingType = BottomSheetRenderingType = {}));
|
|
14
|
+
//# sourceMappingURL=bottomSheet.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BottomSheetRenderingType","exports"],"sources":["bottomSheet.types.ts"],"sourcesContent":["import type { RequestRenderingEvent } from '../../messages/webMessages/unitMessages';\nimport type { PresentationMode, WebComponentType } from './webComponent.types';\n\nexport enum BottomSheetRenderingType {\n Slot,\n WebComponent,\n NativeComponent\n}\n\nexport type BottomSheetSlotData = {\n // The data that rendered by the web view\n componentName?: WebComponentType,\n componentResourceId?: string,\n requestRenderingEvent: RequestRenderingEvent\n}\n\nexport type WebComponentData = {\n type: WebComponentType;\n presentationMode?: PresentationMode,\n params?: string;\n theme?: string;\n language?: string;\n windowParams?: string;\n}\n\nexport type NativeComponentData = {\n component: React.ReactNode,\n}\n\nexport interface SlotRendering {\n type: BottomSheetRenderingType.Slot,\n data: BottomSheetSlotData\n}\n\nexport interface WebComponentRendering {\n type: BottomSheetRenderingType.WebComponent,\n data: WebComponentData\n}\n\nexport interface NativeComponentRendering {\n type: BottomSheetRenderingType.NativeComponent,\n data: NativeComponentData\n}\n"],"mappings":";;;;;;IAGYA,wBAAwB;AAAAC,OAAA,CAAAD,wBAAA,GAAAA,wBAAA;AAAA,WAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;AAAA,GAAxBA,wBAAwB,KAAAC,OAAA,CAAAD,wBAAA,GAAxBA,wBAAwB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WebComponentType = exports.PresentationMode = void 0;
|
|
7
|
+
let WebComponentType;
|
|
8
|
+
exports.WebComponentType = WebComponentType;
|
|
9
|
+
(function (WebComponentType) {
|
|
10
|
+
WebComponentType["card"] = "unit-elements-card";
|
|
11
|
+
WebComponentType["bookPayment"] = "unit-elements-book-payment";
|
|
12
|
+
WebComponentType["activity"] = "unit-elements-activity";
|
|
13
|
+
WebComponentType["slot"] = "unit-elements-sdk-slot";
|
|
14
|
+
WebComponentType["account"] = "unit-elements-account";
|
|
15
|
+
WebComponentType["checkDeposit"] = "unit-elements-check-deposit";
|
|
16
|
+
WebComponentType["achDebitPayment"] = "unit-elements-ach-debit-payment";
|
|
17
|
+
WebComponentType["achCreditPayment"] = "unit-elements-ach-credit-payment";
|
|
18
|
+
WebComponentType["cardAction"] = "unit-elements-card-action";
|
|
19
|
+
})(WebComponentType || (exports.WebComponentType = WebComponentType = {}));
|
|
20
|
+
let PresentationMode;
|
|
21
|
+
exports.PresentationMode = PresentationMode;
|
|
22
|
+
(function (PresentationMode) {
|
|
23
|
+
PresentationMode["CoverInjectedHeight"] = "coverInjectedHeight";
|
|
24
|
+
PresentationMode["Inherit"] = "inherit";
|
|
25
|
+
PresentationMode["Default"] = "deafult";
|
|
26
|
+
})(PresentationMode || (exports.PresentationMode = PresentationMode = {}));
|
|
27
|
+
//# sourceMappingURL=webComponent.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WebComponentType","exports","PresentationMode"],"sources":["webComponent.types.ts"],"sourcesContent":["export enum WebComponentType {\n card = 'unit-elements-card',\n bookPayment = 'unit-elements-book-payment',\n activity = 'unit-elements-activity',\n slot = 'unit-elements-sdk-slot',\n account = 'unit-elements-account',\n checkDeposit = 'unit-elements-check-deposit',\n achDebitPayment = 'unit-elements-ach-debit-payment',\n achCreditPayment = 'unit-elements-ach-credit-payment',\n\n cardAction = 'unit-elements-card-action',\n}\n\nexport enum PresentationMode {\n /*\n CoverInjectedHeight - give id (<webViewId> param) to enable style injection to the root. Then cover the injected height.\n\n Inherit - inherit the parent size by style of 100 view height\n\n Default - return the unit component script\n */\n\n CoverInjectedHeight = 'coverInjectedHeight',\n Inherit = 'inherit',\n Default = 'deafult'\n}\n"],"mappings":";;;;;;IAAYA,gBAAgB;AAAAC,OAAA,CAAAD,gBAAA,GAAAA,gBAAA;AAAA,WAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;AAAA,GAAhBA,gBAAgB,KAAAC,OAAA,CAAAD,gBAAA,GAAhBA,gBAAgB;AAAA,IAahBE,gBAAgB;AAAAD,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAAA,WAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;AAAA,GAAhBA,gBAAgB,KAAAD,OAAA,CAAAC,gBAAA,GAAhBA,gBAAgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["achCredit.types.ts"],"sourcesContent":["import type { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';\nimport type { UNAccountData, UNCounterpartyAccountData } from './account.types';\nimport type { UNAchCounterparty, UNCounterpartyVerificationMethod, UNPaymentStatus } from './payments.types';\nimport type { UNTags, UNRelationship } from './types';\n\nexport type UNACHOnLoadData = {\n [RESPONSE_KEYS.account]: UNAccountData,\n [RESPONSE_KEYS.counterpartyAccount]: [UNCounterpartyAccountData]\n}\n\nexport type UNACHData = {\n type: 'achPayment',\n id: string,\n attributes: {\n createdAt: string | Date,\n status: UNPaymentStatus,\n settlementDate?: Date,\n reason: string,\n direction: 'Debit' | 'Credit',\n description: string,\n transactionSummaryOverride?: string,\n amount: string,\n tags: UNTags,\n addenda?: string\n\t\tcounterparty: UNAchCounterparty\n\t\texpectedCompletionDate?: Date\n\t\tcounterpartyVerificationMethod?:keyof typeof UNCounterpartyVerificationMethod\n\t\tsameDay?: boolean\n },\n relationships: {\n account: UNRelationship,\n customer?: UNRelationship,\n customers?: UNRelationship,\n counterpartyAccount: UNRelationship,\n counterpartyCustomer: UNRelationship,\n transaction: UNRelationship,\n recurringPayment: UNRelationship\n }\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["activity.types.ts"],"sourcesContent":["import type { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';\nimport type { UNAuthorizationData } from './authorization.types';\nimport type { UNTransactionData } from './transactions.types';\n\nexport type UNActivityOnLoadData = {\n [RESPONSE_KEYS.authorization]: UNAuthorizationData,\n [RESPONSE_KEYS.transactions]: UNTransactionData,\n}\n"],"mappings":""}
|
|
@@ -7,6 +7,7 @@ exports.UnitSDK = exports.UNIT_SCRIPT_URL = exports.UNEnvironment = void 0;
|
|
|
7
7
|
var _EventBus = _interopRequireDefault(require("../helpers/EventBus"));
|
|
8
8
|
var _sdkMessage = require("../messages/nativeMessages/sdkMessage");
|
|
9
9
|
var _UnitSdk = require("./UnitSdk.api");
|
|
10
|
+
var _unitUiManager = require("./unitUiManager/unitUiManager");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
13
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
@@ -17,28 +18,39 @@ exports.UNEnvironment = UNEnvironment;
|
|
|
17
18
|
UNEnvironment["sandbox"] = "sandbox";
|
|
18
19
|
UNEnvironment["production"] = "production";
|
|
19
20
|
})(UNEnvironment || (exports.UNEnvironment = UNEnvironment = {}));
|
|
21
|
+
const UNIT_WEB_VERSION = '1';
|
|
20
22
|
const UNIT_SCRIPT_URL = {
|
|
21
|
-
[UNEnvironment.sandbox]:
|
|
22
|
-
[UNEnvironment.production]:
|
|
23
|
+
[UNEnvironment.sandbox]: `https://ui.s.unit.sh/release/${UNIT_WEB_VERSION}/components.js`,
|
|
24
|
+
[UNEnvironment.production]: `https://ui.unit.co/release/${UNIT_WEB_VERSION}/components.js`
|
|
23
25
|
};
|
|
24
26
|
exports.UNIT_SCRIPT_URL = UNIT_SCRIPT_URL;
|
|
25
27
|
class UnitSDK {}
|
|
26
28
|
exports.UnitSDK = UnitSDK;
|
|
27
29
|
_defineProperty(UnitSDK, "env", void 0);
|
|
30
|
+
_defineProperty(UnitSDK, "customerToken", void 0);
|
|
28
31
|
_defineProperty(UnitSDK, "theme", void 0);
|
|
29
32
|
_defineProperty(UnitSDK, "language", void 0);
|
|
30
33
|
_defineProperty(UnitSDK, "signedNonce", void 0);
|
|
34
|
+
_defineProperty(UnitSDK, "pushProvisionModule", void 0);
|
|
35
|
+
_defineProperty(UnitSDK, "ui", void 0);
|
|
31
36
|
_defineProperty(UnitSDK, "init", async (env, theme, language) => {
|
|
32
37
|
try {
|
|
33
38
|
UnitSDK.env = env;
|
|
34
39
|
UnitSDK.theme = theme;
|
|
35
40
|
UnitSDK.language = language;
|
|
41
|
+
UnitSDK.ui = new _unitUiManager.UnitUiManager();
|
|
36
42
|
await (0, _UnitSdk.fetchUnitScript)();
|
|
37
43
|
_EventBus.default.Instance.event(_sdkMessage.SDKMessage.IS_SDK_INITIALIZED, {});
|
|
38
44
|
} catch (e) {
|
|
39
45
|
console.log(e);
|
|
40
46
|
}
|
|
41
47
|
});
|
|
48
|
+
_defineProperty(UnitSDK, "setPushProvisioningModule", pushProvisionModule => {
|
|
49
|
+
UnitSDK.pushProvisionModule = pushProvisionModule;
|
|
50
|
+
});
|
|
51
|
+
_defineProperty(UnitSDK, "getPushProvisionModule", () => {
|
|
52
|
+
return UnitSDK.pushProvisionModule;
|
|
53
|
+
});
|
|
42
54
|
_defineProperty(UnitSDK, "setSignedNonce", signedNonce => {
|
|
43
55
|
UnitSDK.signedNonce = signedNonce;
|
|
44
56
|
});
|
|
@@ -54,4 +66,10 @@ _defineProperty(UnitSDK, "getLanguage", () => {
|
|
|
54
66
|
_defineProperty(UnitSDK, "getSignedNonce", () => {
|
|
55
67
|
return UnitSDK.signedNonce;
|
|
56
68
|
});
|
|
69
|
+
_defineProperty(UnitSDK, "setCustomerToken", customerToken => {
|
|
70
|
+
UnitSDK.customerToken = customerToken;
|
|
71
|
+
});
|
|
72
|
+
_defineProperty(UnitSDK, "getCustomerToken", () => {
|
|
73
|
+
return UnitSDK.customerToken;
|
|
74
|
+
});
|
|
57
75
|
//# sourceMappingURL=UnitSdkManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_EventBus","_interopRequireDefault","require","_sdkMessage","_UnitSdk","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","UNEnvironment","exports","UNIT_SCRIPT_URL","sandbox","production","UnitSDK","env","theme","language","fetchUnitScript","EventBus","Instance","event","SDKMessage","IS_SDK_INITIALIZED","e","console","log","signedNonce"],"sources":["UnitSdkManager.ts"],"sourcesContent":["import EventBus from '../helpers/EventBus';\nimport { SDKMessage } from '../messages/nativeMessages/sdkMessage';\nimport { fetchUnitScript } from './UnitSdk.api';\n\nexport enum UNEnvironment {\n sandbox = 'sandbox',\n production = 'production'\n}\n\nexport const UNIT_SCRIPT_URL = {\n [UNEnvironment.sandbox]:
|
|
1
|
+
{"version":3,"names":["_EventBus","_interopRequireDefault","require","_sdkMessage","_UnitSdk","_unitUiManager","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","UNEnvironment","exports","UNIT_WEB_VERSION","UNIT_SCRIPT_URL","sandbox","production","UnitSDK","env","theme","language","ui","UnitUiManager","fetchUnitScript","EventBus","Instance","event","SDKMessage","IS_SDK_INITIALIZED","e","console","log","pushProvisionModule","signedNonce","customerToken"],"sources":["UnitSdkManager.ts"],"sourcesContent":["import type { NativeModules } from 'react-native';\nimport EventBus from '../helpers/EventBus';\nimport { SDKMessage } from '../messages/nativeMessages/sdkMessage';\nimport { fetchUnitScript } from './UnitSdk.api';\nimport { UnitUiManager } from './unitUiManager/unitUiManager';\n\nexport enum UNEnvironment {\n sandbox = 'sandbox',\n production = 'production'\n}\n\nconst UNIT_WEB_VERSION = '1';\n\nexport const UNIT_SCRIPT_URL = {\n [UNEnvironment.sandbox]: `https://ui.s.unit.sh/release/${UNIT_WEB_VERSION}/components.js`,\n [UNEnvironment.production]: `https://ui.unit.co/release/${UNIT_WEB_VERSION}/components.js`\n};\nexport class UnitSDK {\n protected static env?: UNEnvironment;\n protected static customerToken?: string;\n protected static theme?: string;\n protected static language?: string;\n\n protected static signedNonce?: string;\n protected static pushProvisionModule?: typeof NativeModules;\n\n public static ui: UnitUiManager;\n\n public static init = async (env: UNEnvironment, theme?: string, language?: string) => {\n try {\n this.env = env;\n this.theme = theme;\n this.language = language;\n this.ui = new UnitUiManager();\n await fetchUnitScript();\n EventBus.Instance.event(SDKMessage.IS_SDK_INITIALIZED, {});\n } catch (e) {\n console.log(e);\n }\n };\n\n public static setPushProvisioningModule = (pushProvisionModule: typeof NativeModules) => {\n this.pushProvisionModule = pushProvisionModule;\n };\n\n public static getPushProvisionModule = () => {\n return this.pushProvisionModule;\n };\n\n public static setSignedNonce = (signedNonce: string) => {\n this.signedNonce = signedNonce;\n };\n\n public static getEnv = () => {\n return this.env;\n };\n\n public static getTheme = () => {\n return this.theme;\n };\n\n public static getLanguage = () => {\n return this.language;\n };\n\n public static getSignedNonce = () => {\n return this.signedNonce;\n };\n\n public static setCustomerToken = (customerToken: string) => {\n this.customerToken = customerToken;\n };\n\n public static getCustomerToken = () => {\n return this.customerToken;\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAA8D,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA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,eAAA,CA9CU4B,OAAO,oBAgDa,MAAM;EACnC,OAjDSA,OAAO,CAiDJgB,WAAW;AACzB,CAAC;AAAA5C,eAAA,CAlDU4B,OAAO,sBAoDgBiB,aAAqB,IAAK;EApDjDjB,OAAO,CAqDXiB,aAAa,GAAGA,aAAa;AACpC,CAAC;AAAA7C,eAAA,CAtDU4B,OAAO,sBAwDe,MAAM;EACrC,OAzDSA,OAAO,CAyDJiB,aAAa;AAC3B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UnitUiManager = void 0;
|
|
7
|
+
var _UNFlows = require("../../flows/UNFlows");
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
10
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
|
+
class UnitUiManager {
|
|
12
|
+
constructor() {
|
|
13
|
+
_defineProperty(this, "flows", new _UNFlows.UNFlows());
|
|
14
|
+
_defineProperty(this, "init", () => {
|
|
15
|
+
this.flows = new _UNFlows.UNFlows();
|
|
16
|
+
});
|
|
17
|
+
this.init();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.UnitUiManager = UnitUiManager;
|
|
21
|
+
//# sourceMappingURL=unitUiManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_UNFlows","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","UnitUiManager","constructor","UNFlows","flows","init","exports"],"sources":["unitUiManager.ts"],"sourcesContent":["import { UNFlows } from '../../flows/UNFlows';\n\nexport class UnitUiManager {\n public flows: UNFlows = new UNFlows();\n\n constructor() {\n this.init();\n }\n\n private init = () => {\n this.flows = new UNFlows();\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAA8C,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAEvC,MAAMU,aAAa,CAAC;EAGzBC,WAAWA,CAAA,EAAG;IAAAxB,eAAA,gBAFU,IAAIyB,gBAAO,EAAE;IAAAzB,eAAA,eAMtB,MAAM;MACnB,IAAI,CAAC0B,KAAK,GAAG,IAAID,gBAAO,EAAE;IAC5B,CAAC;IALC,IAAI,CAACE,IAAI,EAAE;EACb;AAKF;AAACC,OAAA,CAAAL,aAAA,GAAAA,aAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.WebComponent = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _reactNativeWebview = require("react-native-webview");
|
|
@@ -24,18 +24,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
24
24
|
const {
|
|
25
25
|
UNAppInfo
|
|
26
26
|
} = _reactNative.NativeModules;
|
|
27
|
-
let WebComponentType;
|
|
28
|
-
exports.WebComponentType = WebComponentType;
|
|
29
|
-
(function (WebComponentType) {
|
|
30
|
-
WebComponentType["card"] = "unit-elements-card";
|
|
31
|
-
WebComponentType["bookPayment"] = "unit-elements-book-payment";
|
|
32
|
-
WebComponentType["activity"] = "unit-elements-activity";
|
|
33
|
-
WebComponentType["slot"] = "unit-elements-sdk-slot";
|
|
34
|
-
WebComponentType["account"] = "unit-elements-account";
|
|
35
|
-
WebComponentType["checkDeposit"] = "unit-elements-check-deposit";
|
|
36
|
-
WebComponentType["achDebitPayment"] = "unit-elements-ach-debit-payment";
|
|
37
|
-
WebComponentType["achCreditPayment"] = "unit-elements-ach-credit-payment";
|
|
38
|
-
})(WebComponentType || (exports.WebComponentType = WebComponentType = {}));
|
|
39
27
|
const WebComponent = /*#__PURE__*/_react.default.forwardRef(function WebComponent(props, webRef) {
|
|
40
28
|
const [unitScript, setUnitScript] = (0, _react.useState)(_UnitSdk.globalUnitScript);
|
|
41
29
|
const [sourceHtml, setSourceHtml] = (0, _react.useState)(null);
|
|
@@ -86,8 +74,9 @@ const WebComponent = /*#__PURE__*/_react.default.forwardRef(function WebComponen
|
|
|
86
74
|
const componentParams = (props.params || '') + themeParam + languageParam;
|
|
87
75
|
let newHtml = _html.default.replace(_html.HTML_PLACEHOLDER.BODY, (0, _bodyHtml.getHtmlBody)(props.type.valueOf(), componentParams, props.presentationMode));
|
|
88
76
|
newHtml = newHtml.replace(_html.HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');
|
|
77
|
+
newHtml = newHtml.replace(_html.HTML_PLACEHOLDER.WINDOW_PARAMS, props.windowParams || '');
|
|
89
78
|
setSourceHtml(newHtml);
|
|
90
|
-
}, [props.params, unitScript, props.presentationMode, componentCurrentTheme, componentCurrentLanguage, props.script]);
|
|
79
|
+
}, [props.params, unitScript, props.presentationMode, componentCurrentTheme, componentCurrentLanguage, props.script, props.windowParams]);
|
|
91
80
|
const onMessage = e => {
|
|
92
81
|
const message = JSON.parse(e.nativeEvent.data);
|
|
93
82
|
switch (message.type) {
|
|
@@ -96,7 +85,7 @@ const WebComponent = /*#__PURE__*/_react.default.forwardRef(function WebComponen
|
|
|
96
85
|
break;
|
|
97
86
|
case _unitMessages.UnitMessage.UNIT_REQUEST_DOWNLOAD:
|
|
98
87
|
message.details && (0, _WebComponent.handleRequestDownload)(message.details, () => {
|
|
99
|
-
_EventBus.default.Instance.event(_unitMessages.UnitMessage.UNIT_REQUEST_CLOSE_FLOW);
|
|
88
|
+
_EventBus.default.Instance.event(_unitMessages.UnitMessage.UNIT_REQUEST_CLOSE_FLOW, {});
|
|
100
89
|
});
|
|
101
90
|
break;
|
|
102
91
|
default:
|
|
@@ -127,7 +116,8 @@ const WebComponent = /*#__PURE__*/_react.default.forwardRef(function WebComponen
|
|
|
127
116
|
style: {
|
|
128
117
|
width: width,
|
|
129
118
|
flex: 1,
|
|
130
|
-
opacity: 0.99
|
|
119
|
+
opacity: 0.99,
|
|
120
|
+
backgroundColor: 'transparent'
|
|
131
121
|
},
|
|
132
122
|
source: {
|
|
133
123
|
html: sourceHtml,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeWebview","_EventBus","_interopRequireDefault","_html","_unitMessages","_listenerToBus","_bodyHtml","_UnitSdk","_UnitSdkManager","_sdkMessage","_WebComponent","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UNAppInfo","NativeModules","WebComponentType","exports","WebComponent","React","forwardRef","props","webRef","unitScript","setUnitScript","useState","globalUnitScript","sourceHtml","setSourceHtml","componentCurrentTheme","setComponentCurrentTheme","theme","UnitSDK","getTheme","componentCurrentLanguage","setComponentCurrentLanguage","language","getLanguage","baseName","setBaseName","width","updateUnitScript","data","updateInitializedParams","useListenerToBus","busEventKey","SDKMessage","IS_SCRIPT_FETCHED","action","IS_SDK_INITIALIZED","useEffect","getAppName","Platform","OS","name","getBundleName","replace","error","console","fetchUnitScript","themeParam","languageParam","componentParams","params","newHtml","html","HTML_PLACEHOLDER","BODY","getHtmlBody","type","valueOf","presentationMode","SCRIPT_FROM_NATIVE","script","onMessage","e","message","JSON","parse","nativeEvent","UnitMessage","UNIT_REQUEST_REFRESH","details","EventBus","Instance","event","UNIT_REQUEST_DOWNLOAD","handleRequestDownload","UNIT_REQUEST_CLOSE_FLOW","_onScroll","handleScroll","createElement","WebView","ref","originWhitelist","mediaPlaybackRequiresUserAction","allowsInlineMediaPlayback","cacheEnabled","scrollEnabled","isScrollable","nestedScrollEnabled","onScroll","overScrollMode","injectedJavaScript","style","flex","opacity","source","baseUrl","androidHardwareAccelerationDisabled"],"sources":["WebComponent.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useState } from 'react';\nimport { NativeModules, Platform } from 'react-native';\nimport { WebView, WebViewMessageEvent } from 'react-native-webview';\nimport EventBus from '../helpers/EventBus';\nimport html, { HTML_PLACEHOLDER } from './html';\nimport { RequestRefreshEvent, UnitMessage, RequestDownloadEvent } from '../messages/webMessages/unitMessages';\nimport { useListenerToBus } from '../hooks/listenerToBus';\nimport { getHtmlBody, PresentationMode } from '../scripts/html/bodyHtml';\nimport { fetchUnitScript, globalUnitScript } from '../unitSdkManager/UnitSdk.api';\nimport { UnitSDK } from '../unitSdkManager/UnitSdkManager';\nimport type { WebViewMessage } from '../messages/webMessages';\nimport { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';\nimport { handleRequestDownload } from './WebComponent.utils';\n\nconst { UNAppInfo } = NativeModules;\n\nexport interface WebComponentProps {\n type: WebComponentType;\n presentationMode?: PresentationMode,\n params?: string;\n theme?: string;\n language?: string;\n onMessage?: (message: WebViewMessage) => void;\n script?: string;\n isScrollable?: boolean,\n nestedScrollEnabled?: boolean,\n handleScroll?: (event: any) => void,\n width?: number;\n}\n\nexport enum WebComponentType {\n card = 'unit-elements-card',\n bookPayment = 'unit-elements-book-payment',\n activity = 'unit-elements-activity',\n slot = 'unit-elements-sdk-slot',\n account = 'unit-elements-account',\n checkDeposit = 'unit-elements-check-deposit',\n achDebitPayment = 'unit-elements-ach-debit-payment',\n achCreditPayment = 'unit-elements-ach-credit-payment'\n}\n\nexport const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props, webRef) {\n const [unitScript, setUnitScript] = useState<string | undefined>(globalUnitScript);\n const [sourceHtml, setSourceHtml] = useState<string | null>(null);\n const [componentCurrentTheme, setComponentCurrentTheme] = useState<string | undefined>(props.theme ?? UnitSDK.getTheme());\n const [componentCurrentLanguage, setComponentCurrentLanguage] = useState<string | undefined>(props.language ?? UnitSDK.getLanguage());\n const [baseName, setBaseName] = useState<string>();\n const width = props.width ?? '100%';\n\n const updateUnitScript = (data: SdkScriptFetched) => {\n setUnitScript(data.unitScript);\n };\n\n const updateInitializedParams = () => {\n setComponentCurrentTheme(props.theme ?? UnitSDK.getTheme());\n setComponentCurrentLanguage(props.language ?? UnitSDK.getLanguage());\n };\n\n useListenerToBus({ busEventKey: SDKMessage.IS_SCRIPT_FETCHED, action: updateUnitScript });\n useListenerToBus({ busEventKey: SDKMessage.IS_SDK_INITIALIZED, action: updateInitializedParams });\n\n useEffect(() => {\n\n const getAppName = async () => {\n // For iOS, we extend the app name from the HTML to display a prettier access request message.\n // On Android, there is no request message sent from HTML.\n try {\n if (Platform.OS == 'ios') {\n const name = await UNAppInfo.getBundleName();\n setBaseName(name.replace(/ /g, '-'));\n } else { // android\n setBaseName('unit');\n }\n } catch (error: any) {\n console.error(error);\n }\n };\n\n getAppName();\n }, []);\n\n useEffect(() => {\n if (!unitScript) {\n fetchUnitScript();\n return;\n }\n\n const themeParam = componentCurrentTheme ? ` theme=\"${componentCurrentTheme}\"` : '';\n const languageParam = componentCurrentLanguage ? ` language=\"${componentCurrentLanguage}\"` : '';\n\n const componentParams = (props.params || '') + themeParam + languageParam;\n let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));\n newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');\n setSourceHtml(newHtml);\n }, [props.params, unitScript, props.presentationMode, componentCurrentTheme, componentCurrentLanguage, props.script]);\n\n const onMessage = (e: WebViewMessageEvent) => {\n const message = JSON.parse(e.nativeEvent.data) as WebViewMessage;\n switch (message.type) {\n case UnitMessage.UNIT_REQUEST_REFRESH:\n message.details &&\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_REFRESH, message.details as RequestRefreshEvent);\n break;\n case UnitMessage.UNIT_REQUEST_DOWNLOAD:\n message.details &&\n handleRequestDownload(message.details as RequestDownloadEvent, () => {\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW);\n });\n break;\n default:\n props.onMessage && props.onMessage(message);\n }\n };\n\n if (!sourceHtml) return null;\n\n const _onScroll = (event: any) => {\n if (props.handleScroll) {\n props.handleScroll(event);\n }\n\n return null;\n };\n\n if (!baseName) {\n return null;\n }\n\n return (\n <WebView\n ref={webRef}\n originWhitelist={['*']}\n mediaPlaybackRequiresUserAction={false}\n allowsInlineMediaPlayback={true}\n cacheEnabled={false}\n scrollEnabled={props.isScrollable}\n nestedScrollEnabled={props.nestedScrollEnabled}\n onScroll={_onScroll}\n overScrollMode=\"never\"\n injectedJavaScript={unitScript}\n style={{ width: width, flex: 1, opacity: 0.99 }}\n source={{ html: sourceHtml, baseUrl: `https://${baseName}` }}\n onMessage={onMessage}\n androidHardwareAccelerationDisabled\n />\n );\n});\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAV,OAAA;AAEA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAA6D,SAAAI,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAlB,wBAAAc,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,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ACtBC,kBAAkB,EAAEhF,UAAW;IAC/BiF,KAAK,EAAE;MAAEhE,KAAK,EAAEA,KAAK;MAAEiE,IAAI,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAK,CAAE;IAChDC,MAAM,EAAE;MAAE1C,IAAI,EAAEtC,UAAU;MAAEiF,OAAO,EAAG,WAAUtE,QAAS;IAAE,CAAE;IAC7DoC,SAAS,EAAEA,SAAU;IACrBmC,mCAAmC;EAAA,EACnC;AAEN,CAAC,CAAC;AAAC5F,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeWebview","_EventBus","_interopRequireDefault","_html","_unitMessages","_listenerToBus","_bodyHtml","_UnitSdk","_UnitSdkManager","_sdkMessage","_WebComponent","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UNAppInfo","NativeModules","WebComponent","React","forwardRef","props","webRef","unitScript","setUnitScript","useState","globalUnitScript","sourceHtml","setSourceHtml","componentCurrentTheme","setComponentCurrentTheme","theme","UnitSDK","getTheme","componentCurrentLanguage","setComponentCurrentLanguage","language","getLanguage","baseName","setBaseName","width","updateUnitScript","data","updateInitializedParams","useListenerToBus","busEventKey","SDKMessage","IS_SCRIPT_FETCHED","action","IS_SDK_INITIALIZED","useEffect","getAppName","Platform","OS","name","getBundleName","replace","error","console","fetchUnitScript","themeParam","languageParam","componentParams","params","newHtml","html","HTML_PLACEHOLDER","BODY","getHtmlBody","type","valueOf","presentationMode","SCRIPT_FROM_NATIVE","script","WINDOW_PARAMS","windowParams","onMessage","e","message","JSON","parse","nativeEvent","UnitMessage","UNIT_REQUEST_REFRESH","details","EventBus","Instance","event","UNIT_REQUEST_DOWNLOAD","handleRequestDownload","UNIT_REQUEST_CLOSE_FLOW","_onScroll","handleScroll","createElement","WebView","ref","originWhitelist","mediaPlaybackRequiresUserAction","allowsInlineMediaPlayback","cacheEnabled","scrollEnabled","isScrollable","nestedScrollEnabled","onScroll","overScrollMode","injectedJavaScript","style","flex","opacity","backgroundColor","source","baseUrl","androidHardwareAccelerationDisabled","exports"],"sources":["WebComponent.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useState } from 'react';\nimport { NativeModules, Platform } from 'react-native';\nimport { WebView, WebViewMessageEvent } from 'react-native-webview';\nimport EventBus from '../helpers/EventBus';\nimport html, { HTML_PLACEHOLDER } from './html';\nimport { RequestRefreshEvent, UnitMessage, RequestDownloadEvent } from '../messages/webMessages/unitMessages';\nimport { useListenerToBus } from '../hooks/listenerToBus';\nimport { getHtmlBody } from '../scripts/html/bodyHtml';\nimport { fetchUnitScript, globalUnitScript } from '../unitSdkManager/UnitSdk.api';\nimport { UnitSDK } from '../unitSdkManager/UnitSdkManager';\nimport type { WebViewMessage } from '../messages/webMessages';\nimport { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';\nimport { handleRequestDownload } from './WebComponent.utils';\nimport type { PresentationMode, WebComponentType } from '../types/internal/webComponent.types';\n\nconst { UNAppInfo } = NativeModules;\n\nexport interface WebComponentProps {\n type: WebComponentType;\n presentationMode?: PresentationMode,\n params?: string;\n theme?: string;\n language?: string;\n onMessage?: (message: WebViewMessage) => void;\n script?: string;\n isScrollable?: boolean,\n nestedScrollEnabled?: boolean,\n handleScroll?: (event: any) => void,\n width?: number;\n windowParams?: string;\n}\n\nexport const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props, webRef) {\n const [unitScript, setUnitScript] = useState<string | undefined>(globalUnitScript);\n const [sourceHtml, setSourceHtml] = useState<string | null>(null);\n const [componentCurrentTheme, setComponentCurrentTheme] = useState<string | undefined>(props.theme ?? UnitSDK.getTheme());\n const [componentCurrentLanguage, setComponentCurrentLanguage] = useState<string | undefined>(props.language ?? UnitSDK.getLanguage());\n const [baseName, setBaseName] = useState<string>();\n const width = props.width ?? '100%';\n\n const updateUnitScript = (data: SdkScriptFetched) => {\n setUnitScript(data.unitScript);\n };\n\n const updateInitializedParams = () => {\n setComponentCurrentTheme(props.theme ?? UnitSDK.getTheme());\n setComponentCurrentLanguage(props.language ?? UnitSDK.getLanguage());\n };\n\n useListenerToBus({ busEventKey: SDKMessage.IS_SCRIPT_FETCHED, action: updateUnitScript });\n useListenerToBus({ busEventKey: SDKMessage.IS_SDK_INITIALIZED, action: updateInitializedParams });\n\n useEffect(() => {\n\n const getAppName = async () => {\n // For iOS, we extend the app name from the HTML to display a prettier access request message.\n // On Android, there is no request message sent from HTML.\n try {\n if (Platform.OS == 'ios') {\n const name = await UNAppInfo.getBundleName();\n setBaseName(name.replace(/ /g, '-'));\n } else { // android\n setBaseName('unit');\n }\n } catch (error: any) {\n console.error(error);\n }\n };\n\n getAppName();\n }, []);\n\n useEffect(() => {\n if (!unitScript) {\n fetchUnitScript();\n return;\n }\n\n const themeParam = componentCurrentTheme ? ` theme=\"${componentCurrentTheme}\"` : '';\n const languageParam = componentCurrentLanguage ? ` language=\"${componentCurrentLanguage}\"` : '';\n\n const componentParams = (props.params || '') + themeParam + languageParam;\n let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));\n newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');\n newHtml = newHtml.replace(HTML_PLACEHOLDER.WINDOW_PARAMS, props.windowParams || '');\n setSourceHtml(newHtml);\n }, [props.params, unitScript, props.presentationMode, componentCurrentTheme, componentCurrentLanguage, props.script, props.windowParams]);\n\n const onMessage = (e: WebViewMessageEvent) => {\n const message = JSON.parse(e.nativeEvent.data) as WebViewMessage;\n switch (message.type) {\n case UnitMessage.UNIT_REQUEST_REFRESH:\n message.details &&\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_REFRESH, message.details as RequestRefreshEvent);\n break;\n case UnitMessage.UNIT_REQUEST_DOWNLOAD:\n message.details &&\n handleRequestDownload(message.details as RequestDownloadEvent, () => {\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW, {});\n });\n break;\n default:\n props.onMessage && props.onMessage(message);\n }\n };\n\n if (!sourceHtml) return null;\n\n const _onScroll = (event: any) => {\n if (props.handleScroll) {\n props.handleScroll(event);\n }\n\n return null;\n };\n\n if (!baseName) {\n return null;\n }\n\n return (\n <WebView\n ref={webRef}\n originWhitelist={['*']}\n mediaPlaybackRequiresUserAction={false}\n allowsInlineMediaPlayback={true}\n cacheEnabled={false}\n scrollEnabled={props.isScrollable}\n nestedScrollEnabled={props.nestedScrollEnabled}\n onScroll={_onScroll}\n overScrollMode=\"never\"\n injectedJavaScript={unitScript}\n style={{ width: width, flex: 1, opacity: 0.99, backgroundColor: 'transparent' }}\n source={{ html: sourceHtml, baseUrl: `https://${baseName}` }}\n onMessage={onMessage}\n androidHardwareAccelerationDisabled\n />\n );\n});\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAV,OAAA;AAEA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAA6D,SAAAI,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,k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,EAAE,KAAM;IACpBC,aAAa,EAAE/E,KAAK,CAACgF,YAAa;IAClCC,mBAAmB,EAAEjF,KAAK,CAACiF,mBAAoB;IAC/CC,QAAQ,EAAEZ,SAAU;IACpBa,cAAc,EAAC,OAAO;IACtBC,kBAAkB,EAAElF,UAAW;IAC/BmF,KAAK,EAAE;MAAElE,KAAK,EAAEA,KAAK;MAAEmE,IAAI,EAAE,CAAC;MAAEC,OAAO,EAAE,IAAI;MAAEC,eAAe,EAAE;IAAc,CAAE;IAChFC,MAAM,EAAE;MAAE7C,IAAI,EAAEtC,UAAU;MAAEoF,OAAO,EAAG,WAAUzE,QAAS;IAAE,CAAE;IAC7DsC,SAAS,EAAEA,SAAU;IACrBoC,mCAAmC;EAAA,EACnC;AAEN,CAAC,CAAC;AAACC,OAAA,CAAA/F,YAAA,GAAAA,YAAA"}
|
|
@@ -9,7 +9,8 @@ var _bodyScript = require("../scripts/html/bodyScript");
|
|
|
9
9
|
const HTML_PLACEHOLDER = {
|
|
10
10
|
SCRIPT_UNIT: '<SCRIPT_UNIT>',
|
|
11
11
|
BODY: '<BODY_HTML_CODE>',
|
|
12
|
-
SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>'
|
|
12
|
+
SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>',
|
|
13
|
+
WINDOW_PARAMS: '<WINDOW_PARAMS>'
|
|
13
14
|
};
|
|
14
15
|
exports.HTML_PLACEHOLDER = HTML_PLACEHOLDER;
|
|
15
16
|
const htmlText = `
|
|
@@ -24,6 +25,7 @@ const htmlText = `
|
|
|
24
25
|
os: "${_reactNative.Platform.OS}",
|
|
25
26
|
walletName: "${_reactNative.Platform.OS === 'ios' ? 'Apple' : 'Google'}",
|
|
26
27
|
}
|
|
28
|
+
${HTML_PLACEHOLDER.WINDOW_PARAMS}
|
|
27
29
|
</script>
|
|
28
30
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
|
|
29
31
|
</head>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_bodyScript","HTML_PLACEHOLDER","SCRIPT_UNIT","BODY","SCRIPT_FROM_NATIVE","exports","htmlText","Platform","OS","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","LISTENERS","isPageLoaded","onLoad","unitRequestDownload","requestRendering","requestOpenLink","requestCloseFlow","cardActivated","cardStatusChange","unitRequestExternalSdk","unitAccountChanged","unitActivityFiltersChanged","DISPATCH_RENDERING_EVENT","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_CARD_ACTION","DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT","DISPATCH_REQUEST_ACCOUNT_ACTION","_default","default"],"sources":["html.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport { DISPATCH_RENDERING_EVENT, LISTENERS, POST_MESSAGE_TO_SDK, POST_PAGE_HEIGHT, DISPATCH_REQUEST_CARD_ACTION, DISPATCH_OPEN_ACTIONS_MENU, DISPATCH_REQUEST_ACCOUNT_ACTION, DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT } from '../scripts/html/bodyScript';\n\nexport const HTML_PLACEHOLDER = {\n SCRIPT_UNIT: '<SCRIPT_UNIT>',\n BODY: '<BODY_HTML_CODE>',\n SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>'\n};\n\nconst htmlText = `\n <!DOCTYPE html>\n <html lang=\"en\">\n\n <head lang=\"en\">\n <title>Unit Web SDK Demo</title>\n <script>\n window.UnitMobileSDK = true\n window.UnitMobileSDKConfig = {\n os: \"${Platform.OS}\",\n walletName: \"${Platform.OS === 'ios' ? 'Apple' : 'Google'}\",\n }\n </script>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=0\">\n </head>\n\n <body style=\"margin: 0;\">\n ${HTML_PLACEHOLDER.BODY}\n\n <script>\n ${POST_MESSAGE_TO_SDK}\n\n ${POST_PAGE_HEIGHT}\n\n ${LISTENERS.isPageLoaded}\n\n ${LISTENERS.onLoad}\n\n ${LISTENERS.unitRequestDownload}\n\n ${LISTENERS.requestRendering}\n\n ${LISTENERS.requestOpenLink}\n\n ${LISTENERS.requestCloseFlow}\n\n ${LISTENERS.cardActivated}\n\n ${LISTENERS.cardStatusChange}\n\n ${LISTENERS.unitRequestExternalSdk}\n\n ${LISTENERS.unitAccountChanged}\n\n ${LISTENERS.unitActivityFiltersChanged}\n\n ${DISPATCH_RENDERING_EVENT}\n\n ${DISPATCH_OPEN_ACTIONS_MENU}\n\n ${DISPATCH_REQUEST_CARD_ACTION}\n\n ${DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT}\n\n ${DISPATCH_REQUEST_ACCOUNT_ACTION}\n\n ${HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE}\n </script>\n </body>\n </html>\n`;\n\nexport default htmlText;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,GAAG;EAC9BC,WAAW,EAAE,eAAe;EAC5BC,IAAI,EAAE,kBAAkB;EACxBC,kBAAkB,EAAE;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_bodyScript","HTML_PLACEHOLDER","SCRIPT_UNIT","BODY","SCRIPT_FROM_NATIVE","WINDOW_PARAMS","exports","htmlText","Platform","OS","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","LISTENERS","isPageLoaded","onLoad","unitRequestDownload","requestRendering","requestOpenLink","requestCloseFlow","cardActivated","cardStatusChange","unitRequestExternalSdk","unitAccountChanged","unitActivityFiltersChanged","DISPATCH_RENDERING_EVENT","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_CARD_ACTION","DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT","DISPATCH_REQUEST_ACCOUNT_ACTION","_default","default"],"sources":["html.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport { DISPATCH_RENDERING_EVENT, LISTENERS, POST_MESSAGE_TO_SDK, POST_PAGE_HEIGHT, DISPATCH_REQUEST_CARD_ACTION, DISPATCH_OPEN_ACTIONS_MENU, DISPATCH_REQUEST_ACCOUNT_ACTION, DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT } from '../scripts/html/bodyScript';\n\nexport const HTML_PLACEHOLDER = {\n SCRIPT_UNIT: '<SCRIPT_UNIT>',\n BODY: '<BODY_HTML_CODE>',\n SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>',\n WINDOW_PARAMS: '<WINDOW_PARAMS>'\n};\n\nconst htmlText = `\n <!DOCTYPE html>\n <html lang=\"en\">\n\n <head lang=\"en\">\n <title>Unit Web SDK Demo</title>\n <script>\n window.UnitMobileSDK = true\n window.UnitMobileSDKConfig = {\n os: \"${Platform.OS}\",\n walletName: \"${Platform.OS === 'ios' ? 'Apple' : 'Google'}\",\n }\n ${HTML_PLACEHOLDER.WINDOW_PARAMS}\n </script>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=0\">\n </head>\n\n <body style=\"margin: 0;\">\n ${HTML_PLACEHOLDER.BODY}\n\n <script>\n ${POST_MESSAGE_TO_SDK}\n\n ${POST_PAGE_HEIGHT}\n\n ${LISTENERS.isPageLoaded}\n\n ${LISTENERS.onLoad}\n\n ${LISTENERS.unitRequestDownload}\n\n ${LISTENERS.requestRendering}\n\n ${LISTENERS.requestOpenLink}\n\n ${LISTENERS.requestCloseFlow}\n\n ${LISTENERS.cardActivated}\n\n ${LISTENERS.cardStatusChange}\n\n ${LISTENERS.unitRequestExternalSdk}\n\n ${LISTENERS.unitAccountChanged}\n\n ${LISTENERS.unitActivityFiltersChanged}\n\n ${DISPATCH_RENDERING_EVENT}\n\n ${DISPATCH_OPEN_ACTIONS_MENU}\n\n ${DISPATCH_REQUEST_CARD_ACTION}\n\n ${DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT}\n\n ${DISPATCH_REQUEST_ACCOUNT_ACTION}\n\n ${HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE}\n </script>\n </body>\n </html>\n`;\n\nexport default htmlText;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,GAAG;EAC9BC,WAAW,EAAE,eAAe;EAC5BC,IAAI,EAAE,kBAAkB;EACxBC,kBAAkB,EAAE,sBAAsB;EAC1CC,aAAa,EAAE;AACjB,CAAC;AAACC,OAAA,CAAAL,gBAAA,GAAAA,gBAAA;AAEF,MAAMM,QAAQ,GAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAaC,qBAAQ,CAACC,EAAG;AACzB,qBAAqBD,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,OAAO,GAAG,QAAS;AAChE;AACA,MAAMR,gBAAgB,CAACI,aAAc;AACrC;AACA;AACA;AACA;AACA;AACA,MAAMJ,gBAAgB,CAACE,IAAK;AAC5B;AACA;AACA,QAAQO,+BAAoB;AAC5B;AACA,QAAQC,4BAAiB;AACzB;AACA,QAAQC,qBAAS,CAACC,YAAa;AAC/B;AACA,QAAQD,qBAAS,CAACE,MAAO;AACzB;AACA,QAAQF,qBAAS,CAACG,mBAAoB;AACtC;AACA,QAAQH,qBAAS,CAACI,gBAAiB;AACnC;AACA,QAAQJ,qBAAS,CAACK,eAAgB;AAClC;AACA,QAAQL,qBAAS,CAACM,gBAAiB;AACnC;AACA,QAAQN,qBAAS,CAACO,aAAc;AAChC;AACA,QAAQP,qBAAS,CAACQ,gBAAiB;AACnC;AACA,QAAQR,qBAAS,CAACS,sBAAuB;AACzC;AACA,QAAQT,qBAAS,CAACU,kBAAmB;AACrC;AACA,QAAQV,qBAAS,CAACW,0BAA2B;AAC7C;AACA,QAAQC,oCAAyB;AACjC;AACA,QAAQC,sCAA2B;AACnC;AACA,QAAQC,wCAA6B;AACrC;AACA,QAAQC,kDAAuC;AAC/C;AACA,QAAQC,2CAAgC;AACxC;AACA,QAAQ3B,gBAAgB,CAACG,kBAAmB;AAC5C;AACA;AACA;AACA,CAAC;AAAC,IAAAyB,QAAA,GAEatB,QAAQ;AAAAD,OAAA,CAAAwB,OAAA,GAAAD,QAAA"}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { WebComponent
|
|
3
|
-
import { PresentationMode } from '../../scripts/html/bodyHtml';
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { WebComponent } from '../../webComponent/WebComponent';
|
|
4
3
|
import { PageMessage } from '../../messages/webMessages/pageMessage';
|
|
5
|
-
import { View } from 'react-native';
|
|
6
|
-
import {
|
|
7
|
-
import { getACHCreditParams, getACHCreditScript } from './UNACHCreditComponent.utils';
|
|
4
|
+
import { Platform, View } from 'react-native';
|
|
5
|
+
import { getACHCreditParams, getACHCreditScript, injectUnitPlaidResponse } from './UNACHCreditComponent.utils';
|
|
8
6
|
import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';
|
|
9
7
|
import { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';
|
|
8
|
+
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
9
|
+
import { openLink } from 'react-native-plaid-link-sdk';
|
|
10
|
+
import { getAndroidPackageName } from '../utils/nativeModulesInfo';
|
|
11
|
+
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
10
12
|
export const UNACHCreditComponent = props => {
|
|
11
13
|
const [height, setHeight] = useState(0);
|
|
12
14
|
const [presentationMode, setPresentationMode] = useState(PresentationMode.Inherit);
|
|
15
|
+
const [linkToken, setLinkToken] = useState();
|
|
16
|
+
const [appPackageName, setAppPackageName] = useState();
|
|
17
|
+
const webRef = useRef(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const setPackageNameForAndroid = async () => {
|
|
20
|
+
if (Platform.OS === 'android') {
|
|
21
|
+
const packageName = await getAndroidPackageName();
|
|
22
|
+
setAppPackageName(packageName);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
setPackageNameForAndroid();
|
|
26
|
+
}, []);
|
|
13
27
|
const handleUnitOnLoad = response => {
|
|
14
28
|
if (!props.onLoad) {
|
|
15
29
|
return;
|
|
@@ -53,14 +67,42 @@ export const UNACHCreditComponent = props => {
|
|
|
53
67
|
}
|
|
54
68
|
break;
|
|
55
69
|
}
|
|
70
|
+
case UnitMessage.UNIT_PLAID_TOKEN_CREATED:
|
|
71
|
+
{
|
|
72
|
+
const linkTokenEvent = message.details;
|
|
73
|
+
const linkTokenData = linkTokenEvent.linkToken;
|
|
74
|
+
setLinkToken(linkTokenData.attributes.linkToken);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case UnitMessage.UNIT_REQUEST_EXTERNAL_SDK:
|
|
78
|
+
{
|
|
79
|
+
const externalSdkType = message.details.type;
|
|
80
|
+
if (externalSdkType !== 'plaid') return;
|
|
81
|
+
linkToken && openLink({
|
|
82
|
+
tokenConfig: {
|
|
83
|
+
noLoadingState: false,
|
|
84
|
+
token: linkToken
|
|
85
|
+
},
|
|
86
|
+
onSuccess: success => {
|
|
87
|
+
injectUnitPlaidResponse(webRef.current, success);
|
|
88
|
+
},
|
|
89
|
+
onExit: exit => {
|
|
90
|
+
console.log(exit);
|
|
91
|
+
}
|
|
92
|
+
}).catch(e => {
|
|
93
|
+
console.error(e);
|
|
94
|
+
});
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
56
97
|
}
|
|
57
98
|
};
|
|
58
99
|
const renderACHCreditWebView = () => {
|
|
59
100
|
return /*#__PURE__*/React.createElement(WebComponent, {
|
|
101
|
+
ref: webRef,
|
|
60
102
|
type: WebComponentType.achCreditPayment,
|
|
61
103
|
presentationMode: presentationMode,
|
|
62
104
|
params: getACHCreditParams(props),
|
|
63
|
-
script: getACHCreditScript(),
|
|
105
|
+
script: getACHCreditScript(appPackageName),
|
|
64
106
|
onMessage: message => handleWebViewMessage(message),
|
|
65
107
|
isScrollable: false,
|
|
66
108
|
theme: props.theme,
|