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
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import React, { useEffect, useRef
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import type WebView from 'react-native-webview';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { PresentationMode } from '../../../scripts/html/bodyHtml';
|
|
6
|
-
import { WebComponent, WebComponentType } from '../../../webComponent/WebComponent';
|
|
7
|
-
import { renderingBottomSheetRequest } from '../UNBottomSheetComponent.utils';
|
|
3
|
+
import { WebComponent } from '../../../webComponent/WebComponent';
|
|
4
|
+
import { injectHtmlFullScreenHeight, renderingBottomSheetRequest } from '../UNBottomSheetComponent.utils';
|
|
8
5
|
import { getStylesObject } from './UNAddToWalletBottomSheetItem.styles';
|
|
9
6
|
import { ActivityIndicator } from 'react-native';
|
|
10
|
-
import {
|
|
11
|
-
import type { RequestRenderingEvent } from '../../../messages/webMessages/unitMessages';
|
|
7
|
+
import { UnitMessage, type RequestRenderingEvent } from '../../../messages/webMessages/unitMessages';
|
|
12
8
|
import UnitAddToWalletButtonView from '../../../nativeComponent/UnitAddToWalletButton';
|
|
13
|
-
import { UNCardAddToWalletStatus } from '../../../
|
|
9
|
+
import { UNCardAddToWalletStatus } from '../../../types/shared/wallet.types';
|
|
10
|
+
import { BottomSheetRenderingType, WebComponentData } from '../../../types/internal/bottomSheet.types';
|
|
11
|
+
import { PresentationMode, WebComponentType } from '../../../types/internal/webComponent.types';
|
|
12
|
+
import { useCardWallet } from '../../../helpers/pushProvisioningService/hooks/useCardWallet';
|
|
13
|
+
import { launchStartCardProvisioning } from '../../../helpers/pushProvisioningService/startProvisioning';
|
|
14
|
+
import type { WebViewMessage } from '../../../messages/webMessages';
|
|
15
|
+
import EventBus from '../../../helpers/EventBus';
|
|
14
16
|
|
|
15
17
|
export interface UNAddToWalletBottomSheetItemProps {
|
|
18
|
+
renderingType: BottomSheetRenderingType
|
|
16
19
|
renderingRequest?: RequestRenderingEvent
|
|
17
|
-
|
|
20
|
+
webComponentData?: WebComponentData
|
|
21
|
+
cardId: string,
|
|
22
|
+
fullScreenHeight: number
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
export const UNAddToWalletBottomSheetItem = (props: UNAddToWalletBottomSheetItemProps) => {
|
|
@@ -22,52 +27,78 @@ export const UNAddToWalletBottomSheetItem = (props: UNAddToWalletBottomSheetItem
|
|
|
22
27
|
|
|
23
28
|
const webRef = useRef<WebView>(null);
|
|
24
29
|
|
|
25
|
-
const { renderingRequest, cardId } = props;
|
|
26
|
-
|
|
27
|
-
const [addToWalletStatus, setAddToWalletStatus] = useState<UNCardAddToWalletStatus>(UNCardAddToWalletStatus.pending);
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (!cardId) return;
|
|
31
|
-
const event: CardGetAddToWalletStatusEvent = { cardId };
|
|
32
|
-
EventBus.Instance.event(CardNativeMessage.CARD_GET_ADD_TO_WALLET_STATUS, event);
|
|
33
|
-
}, [cardId]);
|
|
30
|
+
const { renderingType, renderingRequest, webComponentData, cardId } = props;
|
|
31
|
+
const { currentUNWallet } = useCardWallet(cardId);
|
|
34
32
|
|
|
35
33
|
useEffect(() => {
|
|
36
34
|
if (!webRef.current) return;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const isCardInWallet = addToWalletStatus === UNCardAddToWalletStatus.addedToWallet;
|
|
40
|
-
webRef.current.injectJavaScript(`window.UnitMobileSDKConfig["isCardInWallet"] = ${isCardInWallet}`);
|
|
35
|
+
const currentWalletStatus = currentUNWallet?.status ?? UNCardAddToWalletStatus.pending;
|
|
36
|
+
if (currentWalletStatus === UNCardAddToWalletStatus.pending) return;
|
|
41
37
|
|
|
42
|
-
if (renderingRequest) {
|
|
38
|
+
if (renderingType === BottomSheetRenderingType.Slot && renderingRequest) {
|
|
39
|
+
const isCardInWallet = currentWalletStatus === UNCardAddToWalletStatus.addedToWallet;
|
|
40
|
+
webRef.current.injectJavaScript(`window.UnitMobileSDKConfig["isCardInWallet"] = ${isCardInWallet}`);
|
|
43
41
|
renderingBottomSheetRequest(webRef.current, renderingRequest);
|
|
44
42
|
}
|
|
45
|
-
}, [webRef.current, renderingRequest, addToWalletStatus]);
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
}, [webRef.current, renderingRequest, currentUNWallet]);
|
|
45
|
+
|
|
46
|
+
const handleAddToWalletClicked = () => {
|
|
47
|
+
if (!currentUNWallet) return;
|
|
48
|
+
launchStartCardProvisioning(currentUNWallet);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const handleWebComponentMessage = (message: WebViewMessage) => {
|
|
52
|
+
if (!message || !message.type) return;
|
|
53
|
+
switch (message.type) {
|
|
54
|
+
case UnitMessage.UNIT_ON_LOAD:
|
|
55
|
+
injectHtmlFullScreenHeight(webRef.current, props.fullScreenHeight);
|
|
56
|
+
break;
|
|
57
|
+
case UnitMessage.UNIT_REQUEST_CLOSE_FLOW:
|
|
58
|
+
EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW, {});
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
break;
|
|
50
62
|
}
|
|
51
63
|
};
|
|
52
64
|
|
|
53
|
-
|
|
65
|
+
const shouldShowWebComponent = () => {
|
|
66
|
+
// Show .Slot, since it need to be loaded when we inject the requestRendering
|
|
67
|
+
// Otherwise show web component only if the card is in wallet or ready to be provisioned.
|
|
54
68
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
69
|
+
const isSlot = renderingType === BottomSheetRenderingType.Slot;
|
|
70
|
+
|
|
71
|
+
const gotWalletStatus = currentUNWallet &&
|
|
72
|
+
(currentUNWallet.status === UNCardAddToWalletStatus.readyToProvisioning ||
|
|
73
|
+
currentUNWallet.status === UNCardAddToWalletStatus.addedToWallet);
|
|
74
|
+
|
|
75
|
+
return isSlot || gotWalletStatus;
|
|
59
76
|
};
|
|
60
77
|
|
|
61
78
|
return (
|
|
62
79
|
<>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
{
|
|
81
|
+
shouldShowWebComponent() &&
|
|
82
|
+
<WebComponent
|
|
83
|
+
ref={webRef}
|
|
84
|
+
type={renderingType === BottomSheetRenderingType.WebComponent ? WebComponentType.cardAction : WebComponentType.slot}
|
|
85
|
+
presentationMode={PresentationMode.CoverInjectedHeight}
|
|
86
|
+
params={webComponentData?.params}
|
|
87
|
+
isScrollable={false}
|
|
88
|
+
onMessage={handleWebComponentMessage}
|
|
89
|
+
windowParams={renderingType === BottomSheetRenderingType.WebComponent ? `window.UnitMobileSDKConfig["isCardInWallet"] = ${currentUNWallet?.status === UNCardAddToWalletStatus.addedToWallet}` : ''}
|
|
90
|
+
/>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
(currentUNWallet == undefined || currentUNWallet?.status === UNCardAddToWalletStatus.pending) &&
|
|
95
|
+
<ActivityIndicator style={styles.loader} />
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
{
|
|
99
|
+
currentUNWallet?.status === UNCardAddToWalletStatus.readyToProvisioning &&
|
|
100
|
+
<UnitAddToWalletButtonView style={styles.addToWalletButton} onAddToWalletClicked={handleAddToWalletClicked} />
|
|
101
|
+
}
|
|
71
102
|
</>
|
|
72
103
|
);
|
|
73
104
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import React, { useImperativeHandle, useRef, useState } from 'react';
|
|
2
|
-
import { Dimensions,
|
|
1
|
+
import React, { useImperativeHandle, useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { Dimensions, View } from 'react-native';
|
|
3
3
|
import type WebView from 'react-native-webview';
|
|
4
4
|
import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
|
|
5
5
|
import { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
6
6
|
import EventBus from '../../helpers/EventBus';
|
|
7
|
-
import { WebComponent
|
|
7
|
+
import { WebComponent } from '../../webComponent/WebComponent';
|
|
8
8
|
import { useListenerToBus } from '../../hooks/listenerToBus';
|
|
9
9
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
10
|
-
import { getCardParams, getCardScript, injectRefreshEventIfNeeded,
|
|
11
|
-
import {
|
|
12
|
-
import type { UNOnLoadResponse, UNCardData, UNError, UNCardMenuAction } from '../../sharedTypes';
|
|
10
|
+
import { getCardParams, getCardScript, injectRefreshEventIfNeeded, injectOpenActionsMenuScript, injectRequestCardActionScript } from './UNCardComponent.utils';
|
|
11
|
+
import type { UNOnLoadResponse, UNCardData, UNError, UNCardMenuAction } from '../../types/shared';
|
|
13
12
|
import { CardMessage } from '../../messages/webMessages/cardMessage';
|
|
14
|
-
import { launchGetWallets } from './UNCardComponent.utils';
|
|
15
13
|
import type { NativeModules } from 'react-native';
|
|
16
|
-
import type { UNWallet } from 'src/sharedTypes/wallet.types';
|
|
17
|
-
import { CardAddToWalletErrors, UNCardAddToWalletStatusEvent, CardGetAddToWalletStatusEvent, CardNativeMessage, CardStartPushProvisioningEvent } from '../../messages/nativeMessages/cardMessage';
|
|
18
|
-
import type { BottomSheetSlotData } from '../UNBottomSheetComponent/UNBottomSheetComponent';
|
|
19
14
|
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
15
|
+
import { BottomSheetRenderingType, SlotRendering, type BottomSheetSlotData } from '../../types/internal/bottomSheet.types';
|
|
16
|
+
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
17
|
+
import { UnitSDK } from '../../unitSdkManager/UnitSdkManager';
|
|
18
|
+
import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
|
|
20
19
|
export interface UNCardComponentProps {
|
|
21
20
|
// inputs
|
|
22
21
|
cardId: string;
|
|
23
22
|
customerToken: string;
|
|
23
|
+
learnMoreUrl?: string;
|
|
24
24
|
|
|
25
25
|
// ui
|
|
26
26
|
theme?: string;
|
|
@@ -44,10 +44,6 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
|
|
|
44
44
|
const [height, setHeight] = useState(0);
|
|
45
45
|
const windowWidth = Dimensions.get('window').width;
|
|
46
46
|
|
|
47
|
-
const walletRef = useRef<UNWallet | null>(null);
|
|
48
|
-
// walletRef can be changed to a state. (After the change of the listener hook)
|
|
49
|
-
// TODO: walletState and checks it works. =)
|
|
50
|
-
|
|
51
47
|
const webRef = useRef<WebView>(null);
|
|
52
48
|
|
|
53
49
|
useImperativeHandle(cardRef, () => ({
|
|
@@ -75,16 +71,6 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
|
|
|
75
71
|
injectRefreshEventIfNeeded(webRef.current, data, props.cardId);
|
|
76
72
|
};
|
|
77
73
|
|
|
78
|
-
const startPushProvisioning = async (data: CardStartPushProvisioningEvent) => {
|
|
79
|
-
if (data.cardId !== props.cardId) return;
|
|
80
|
-
onAddToWalletClicked();
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const getAddToWalletStatus = (data: CardGetAddToWalletStatusEvent) => {
|
|
84
|
-
if (data.cardId !== props.cardId) return;
|
|
85
|
-
getWallets();
|
|
86
|
-
};
|
|
87
|
-
|
|
88
74
|
const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
|
|
89
75
|
if (!props.onLoad) {
|
|
90
76
|
return;
|
|
@@ -108,20 +94,24 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
|
|
|
108
94
|
useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
|
|
109
95
|
useListenerToBus({ busEventKey: CardMessage.CARD_STATUS_CHANGED, action: cardStatusChanged });
|
|
110
96
|
useListenerToBus({ busEventKey: CardMessage.CARD_ACTIVATED, action: cardActivated });
|
|
111
|
-
useListenerToBus({ busEventKey: CardNativeMessage.CARD_START_PUSH_PROVISIONING, action: startPushProvisioning });
|
|
112
|
-
useListenerToBus({ busEventKey: CardNativeMessage.CARD_GET_ADD_TO_WALLET_STATUS, action: getAddToWalletStatus });
|
|
113
97
|
|
|
114
98
|
const handleMessage = (message: WebViewMessage) => {
|
|
115
99
|
if (!message || !message.details) return;
|
|
116
100
|
|
|
117
101
|
switch (message.type) {
|
|
118
102
|
case UnitMessage.UNIT_REQUEST_RENDERING: {
|
|
119
|
-
const
|
|
103
|
+
const slotData: BottomSheetSlotData = {
|
|
120
104
|
componentName: WebComponentType.card,
|
|
121
105
|
componentResourceId: props.cardId,
|
|
122
106
|
requestRenderingEvent: message.details as RequestRenderingEvent
|
|
123
107
|
};
|
|
124
|
-
|
|
108
|
+
|
|
109
|
+
const event = {
|
|
110
|
+
type: BottomSheetRenderingType.Slot,
|
|
111
|
+
data: slotData
|
|
112
|
+
} as SlotRendering;
|
|
113
|
+
|
|
114
|
+
EventBus.Instance.event(BottomSheetNativeMessage.START_FLOW, event);
|
|
125
115
|
break;
|
|
126
116
|
}
|
|
127
117
|
case PageMessage.PAGE_HEIGHT:
|
|
@@ -133,34 +123,15 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
|
|
|
133
123
|
}
|
|
134
124
|
};
|
|
135
125
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
UnitSDK.setCustomerToken(props.customerToken);
|
|
128
|
+
}, [props.customerToken]);
|
|
139
129
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
walletRef.current = walletResponse;
|
|
145
|
-
|
|
146
|
-
const walletStatus: UNCardAddToWalletStatusEvent = { status: walletResponse.status };
|
|
147
|
-
EventBus.Instance.event(CardNativeMessage.CARD_UPDATE_ADD_TO_WALLET_STATUS, walletStatus);
|
|
148
|
-
} catch (error) {
|
|
149
|
-
console.error(error);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const onAddToWalletClicked = async () => {
|
|
154
|
-
try {
|
|
155
|
-
await launchStartCardProvisioning(props.pushProvisioningModule as NativeModule, walletRef.current);
|
|
156
|
-
} catch (error) {
|
|
157
|
-
if (error instanceof Error) {
|
|
158
|
-
const parsedError = JSON.parse(error.message);
|
|
159
|
-
if (parsedError.code === CardAddToWalletErrors.closedNativeWalletScreen) return;
|
|
160
|
-
}
|
|
161
|
-
console.log(error);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (props.pushProvisioningModule) {
|
|
132
|
+
UnitSDK.setPushProvisioningModule(props.pushProvisioningModule);
|
|
162
133
|
}
|
|
163
|
-
};
|
|
134
|
+
}, [props.pushProvisioningModule]);
|
|
164
135
|
|
|
165
136
|
return (
|
|
166
137
|
<View style={{ height }}>
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { DISPATCH_REQUEST_REFRESH } from './../../scripts/html/bodyScript';
|
|
2
2
|
import type WebView from 'react-native-webview';
|
|
3
3
|
import type { UNCardComponentProps } from './UNCardComponent';
|
|
4
|
-
import { WebComponentType } from '../../webComponent/WebComponent';
|
|
5
|
-
import type { NativeModules } from 'react-native';
|
|
6
|
-
import { getMobileWalletPayload } from './networking/requests/UNWalletPayloadRequest';
|
|
7
|
-
import { UNWallet, UNWalletCode, UNWalletName } from '../../../src/sharedTypes/wallet.types';
|
|
8
4
|
import type { RequestRefreshEvent } from '../../messages/webMessages/unitMessages';
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
5
|
+
import type { UNCardMenuAction } from '../../types/shared';
|
|
6
|
+
import { WebComponentType } from '../../types/internal/webComponent.types';
|
|
11
7
|
|
|
12
8
|
export const getCardParams = (props: UNCardComponentProps) => {
|
|
13
9
|
return `
|
|
@@ -17,6 +13,7 @@ export const getCardParams = (props: UNCardComponentProps) => {
|
|
|
17
13
|
hide-actions-menu-button="${props.hideActionsMenuButton || false}"
|
|
18
14
|
hide-card-title="${props.hideCardTitle || false}"
|
|
19
15
|
hide-sensitive-data-button="${props.hideSensitiveDataButton || false}"
|
|
16
|
+
learn-more-url="${props.learnMoreUrl || ''}"
|
|
20
17
|
`;
|
|
21
18
|
};
|
|
22
19
|
|
|
@@ -37,46 +34,3 @@ export const injectRefreshEventIfNeeded = (currentWeb: WebView | null, requestRe
|
|
|
37
34
|
currentWeb?.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);
|
|
38
35
|
}
|
|
39
36
|
};
|
|
40
|
-
|
|
41
|
-
export const launchGetWallets = async (customerToken: string, cardId: string, pushProvisioningModule: typeof NativeModules) => {
|
|
42
|
-
try {
|
|
43
|
-
const env = UnitSDK.getEnv();
|
|
44
|
-
if (!env) return null;
|
|
45
|
-
|
|
46
|
-
const encryptedPayload = await getMobileWalletPayload(customerToken, cardId, env);
|
|
47
|
-
if (!encryptedPayload) return null;
|
|
48
|
-
|
|
49
|
-
const walletsResponse = await pushProvisioningModule.launchGetWallets(JSON.stringify({ encPayload: encryptedPayload }));
|
|
50
|
-
const parsedWalletsResponse = JSON.parse(walletsResponse);
|
|
51
|
-
const wallets = parsedWalletsResponse.wallets;
|
|
52
|
-
|
|
53
|
-
if (!wallets) return null;
|
|
54
|
-
if (wallets[0].code === UNWalletCode.Apple) {
|
|
55
|
-
return ({ name: UNWalletName.Apple, code: UNWalletCode.Apple, status: wallets[0].status });
|
|
56
|
-
} else {
|
|
57
|
-
const googleWallet = wallets.filter((wallet: { name: UNWalletName }) => {
|
|
58
|
-
return wallet.name === UNWalletName.Google;
|
|
59
|
-
});
|
|
60
|
-
if (!googleWallet) return;
|
|
61
|
-
return ({ name: UNWalletName.Google, code: UNWalletCode.Google, status: googleWallet[0].status });
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
return Promise.reject(error);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const launchStartCardProvisioning = async (pushProvisioningModule: typeof NativeModules, wallet: UNWallet | null) => {
|
|
70
|
-
try {
|
|
71
|
-
const response = await pushProvisioningModule.launchStartCardProvisioning(
|
|
72
|
-
JSON.stringify({
|
|
73
|
-
walletCode: wallet?.code,
|
|
74
|
-
walletName: wallet?.name
|
|
75
|
-
}));
|
|
76
|
-
return response;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
catch (error) {
|
|
80
|
-
return Promise.reject(error);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { View, NativeModules, Platform } from 'react-native';
|
|
3
|
-
import { WebComponent
|
|
4
|
-
import { PresentationMode } from '../../scripts/html/bodyHtml';
|
|
3
|
+
import { WebComponent } from '../../webComponent/WebComponent';
|
|
5
4
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
6
5
|
import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
|
|
7
6
|
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
8
7
|
import { getCheckDepositParams, getCheckDepositScript } from './UNCheckDepositComponent.utils';
|
|
9
8
|
import { CheckMessage } from '../../messages/webMessages/checkMessage';
|
|
10
|
-
import type { UNCheckDepositData } from '../../
|
|
11
|
-
import type { UNAccountData, UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../
|
|
9
|
+
import type { UNCheckDepositData } from '../../types/shared/checkDeposit.types';
|
|
10
|
+
import type { UNAccountData, UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../types/shared';
|
|
12
11
|
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
12
|
+
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
13
13
|
|
|
14
14
|
const { Camera } = NativeModules;
|
|
15
15
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
const { RNAppInfoModule } = NativeModules;
|
|
3
|
+
|
|
4
|
+
export const getAndroidPackageName = async () => {
|
|
5
|
+
try {
|
|
6
|
+
const response = await RNAppInfoModule.getAppPackageName();
|
|
7
|
+
return response;
|
|
8
|
+
} catch (error) {
|
|
9
|
+
console.error(error);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UNCardFlows } from './card/UNCardFlows';
|
|
2
|
+
import { UnitSDK } from '../unitSdkManager/UnitSdkManager';
|
|
3
|
+
|
|
4
|
+
export class UNFlows {
|
|
5
|
+
constructor() {
|
|
6
|
+
console.log('new Flows instance created');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public async startPushProvisioning(cardId: string, customerToken: string) {
|
|
10
|
+
UnitSDK.setCustomerToken(customerToken);
|
|
11
|
+
UNCardFlows.startPushProvisioning(cardId, customerToken);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import EventBus from '../../helpers/EventBus';
|
|
2
|
+
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
3
|
+
import { BottomSheetRenderingType, type WebComponentData, type WebComponentRendering } from '../../types/internal/bottomSheet.types';
|
|
4
|
+
import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
|
|
5
|
+
|
|
6
|
+
export class UNCardFlows {
|
|
7
|
+
public static startPushProvisioning = async (cardId: string, customerToken: string) => {
|
|
8
|
+
try {
|
|
9
|
+
const addToWalletComponentData: WebComponentData = {
|
|
10
|
+
type: WebComponentType.cardAction,
|
|
11
|
+
presentationMode: PresentationMode.CoverInjectedHeight,
|
|
12
|
+
params: `card-id=${cardId} customer-token=${customerToken} action=AddToWallet`,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const event: WebComponentRendering = {
|
|
16
|
+
type: BottomSheetRenderingType.WebComponent,
|
|
17
|
+
data: addToWalletComponentData,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
EventBus.Instance.event(BottomSheetNativeMessage.START_FLOW, event);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error(error);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { UNWalletCode, type UNWallet, UNWalletName } from '../../../types/shared/wallet.types';
|
|
3
|
+
import { UnitSDK } from '../../../unitSdkManager/UnitSdkManager';
|
|
4
|
+
import { getMobileWalletPayload } from '../../../networking/requests/UNWalletPayloadRequest';
|
|
5
|
+
|
|
6
|
+
export type CardToEncryptedPayload = {
|
|
7
|
+
[cardId: string]: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const useCardWallet = (cardId: string) => {
|
|
11
|
+
const [currentUNWallet, setCurrentUNWallet] = useState<UNWallet>();
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const getEncryptedPayload = async () => {
|
|
15
|
+
const env = UnitSDK.getEnv();
|
|
16
|
+
const customerToken = UnitSDK.getCustomerToken();
|
|
17
|
+
if (!env || !customerToken) return;
|
|
18
|
+
|
|
19
|
+
const encryptedPayload = await getMobileWalletPayload(customerToken, cardId, env);
|
|
20
|
+
return encryptedPayload;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const getCardWalletData = async () => {
|
|
24
|
+
const currentProvisioningModule = UnitSDK.getPushProvisionModule();
|
|
25
|
+
if (!currentProvisioningModule) return;
|
|
26
|
+
try {
|
|
27
|
+
const encryptedPayload = await getEncryptedPayload();
|
|
28
|
+
const walletsResponse = await currentProvisioningModule.launchGetWallets(JSON.stringify({ encPayload: encryptedPayload }));
|
|
29
|
+
|
|
30
|
+
const unWallet: UNWallet | null = parseWalletsResponse(walletsResponse);
|
|
31
|
+
if (!unWallet) return;
|
|
32
|
+
setCurrentUNWallet(unWallet);
|
|
33
|
+
return;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
return Promise.reject(error);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
getCardWalletData();
|
|
40
|
+
|
|
41
|
+
}, [cardId]);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
currentUNWallet
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const parseWalletsResponse = (walletsResponse: string): UNWallet | null => {
|
|
50
|
+
try {
|
|
51
|
+
const parsedWalletsResponse = JSON.parse(walletsResponse);
|
|
52
|
+
const wallets = parsedWalletsResponse.wallets;
|
|
53
|
+
|
|
54
|
+
if (!wallets) return null;
|
|
55
|
+
if (wallets[0].code === UNWalletCode.Apple) {
|
|
56
|
+
return ({ name: UNWalletName.Apple, code: UNWalletCode.Apple, status: wallets[0].status });
|
|
57
|
+
} else {
|
|
58
|
+
const googleWallet = wallets.filter((wallet: { name: UNWalletName }) => {
|
|
59
|
+
return wallet.name === UNWalletName.Google;
|
|
60
|
+
});
|
|
61
|
+
if (!googleWallet) return null;
|
|
62
|
+
return ({ name: UNWalletName.Google, code: UNWalletCode.Google, status: googleWallet[0].status });
|
|
63
|
+
}
|
|
64
|
+
} catch (error) {
|
|
65
|
+
throw new Error('Error parsing wallet response');
|
|
66
|
+
}
|
|
67
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UNWallet } from '../../types/shared/wallet.types';
|
|
2
|
+
import { UnitSDK } from '../../unitSdkManager/UnitSdkManager';
|
|
3
|
+
|
|
4
|
+
export const launchStartCardProvisioning = async (wallet: UNWallet | null) => {
|
|
5
|
+
const pushProvisioningModule = UnitSDK.getPushProvisionModule();
|
|
6
|
+
if (!pushProvisioningModule) return;
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
const response = await pushProvisioningModule.launchStartCardProvisioning(
|
|
10
|
+
JSON.stringify({
|
|
11
|
+
walletCode: wallet?.code,
|
|
12
|
+
walletName: wallet?.name
|
|
13
|
+
}));
|
|
14
|
+
return response;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
catch (error) {
|
|
18
|
+
return Promise.reject(error);
|
|
19
|
+
}
|
|
20
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type {NativeComponentRendering, WebComponentRendering, SlotRendering } from '../../types/internal/bottomSheet.types';
|
|
2
|
+
|
|
3
|
+
export enum BottomSheetNativeMessage {
|
|
4
|
+
START_FLOW = 'startBottomSheetFlow',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export enum CardAddToWalletErrors {
|
|
8
|
+
closedNativeWalletScreen = 'VP_ERROR_302'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type StartBottomSheetFlowMessage = SlotRendering | WebComponentRendering | NativeComponentRendering
|
|
12
|
+
|
|
13
|
+
export type BottomSheetNativeEvent = |
|
|
14
|
+
StartBottomSheetFlowMessage
|
|
15
|
+
// BottomSheetChangeFlowMessage - probably, we want to add this message event in the future to alternate between flows
|
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export enum CardNativeMessage {
|
|
4
|
-
CARD_GET_ADD_TO_WALLET_STATUS = 'cardGetAddToWalletStatus',
|
|
5
|
-
CARD_UPDATE_ADD_TO_WALLET_STATUS = 'cardUpdateAddToWalletStatus',
|
|
6
|
-
CARD_START_PUSH_PROVISIONING = 'cardStartPushProvisioning'
|
|
7
|
-
}
|
|
8
|
-
|
|
1
|
+
// Should we remove it ?
|
|
9
2
|
export enum CardAddToWalletErrors {
|
|
10
3
|
closedNativeWalletScreen = 'VP_ERROR_302'
|
|
11
4
|
}
|
|
12
|
-
export interface UNCardAddToWalletStatusEvent {
|
|
13
|
-
status: UNCardAddToWalletStatus
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface CardGetAddToWalletStatusEvent {
|
|
17
|
-
cardId: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface CardStartPushProvisioningEvent {
|
|
21
|
-
cardId: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type CardNativeEvent =
|
|
25
|
-
| UNCardAddToWalletStatusEvent
|
|
26
|
-
| CardGetAddToWalletStatusEvent
|
|
27
|
-
| CardStartPushProvisioningEvent
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BottomSheetNativeEvent, BottomSheetNativeMessage } from './bottomSheetMessage';
|
|
2
2
|
import type { SDKEvent, SDKMessage } from './sdkMessage';
|
|
3
3
|
|
|
4
4
|
export type NativeMessageType =
|
|
5
5
|
| SDKMessage
|
|
6
|
-
|
|
|
6
|
+
| BottomSheetNativeMessage
|
|
7
7
|
|
|
8
8
|
export type NativeEvent =
|
|
9
|
-
| CardNativeEvent
|
|
10
9
|
| SDKEvent
|
|
10
|
+
| BottomSheetNativeEvent
|
|
11
11
|
|
|
12
12
|
export interface NativeMessage {
|
|
13
13
|
type: NativeMessageType,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {UNAccountData, UNCounterpartyAccountData, UNCardData, UNError, UNOnLoadResponseData } from '../../
|
|
2
|
-
import type { UNAuthorizationData } from '../../
|
|
3
|
-
import type { UNTransactionData } from '../../
|
|
1
|
+
import type {UNAccountData, UNCounterpartyAccountData, UNCardData, UNError, UNOnLoadResponseData } from '../../types/shared';
|
|
2
|
+
import type { UNAuthorizationData } from '../../types/shared/authorization.types';
|
|
3
|
+
import type { UNTransactionData } from '../../types/shared/transactions.types';
|
|
4
4
|
|
|
5
5
|
export enum RESPONSE_KEYS {
|
|
6
6
|
errors = 'errors',
|
|
@@ -9,9 +9,10 @@ export enum UnitMessage {
|
|
|
9
9
|
UNIT_REQUEST_DOWNLOAD = 'unitRequestDownload',
|
|
10
10
|
UNIT_PLAID_TOKEN_CREATED = 'unitPlaidLinkTokenCreated',
|
|
11
11
|
UNIT_REQUEST_EXTERNAL_SDK = 'unitRequestExternalSdk',
|
|
12
|
-
UNIT_PLAID_RESPONSE = 'unitPlaidResponse'
|
|
13
|
-
|
|
12
|
+
UNIT_PLAID_RESPONSE = 'unitPlaidResponse',
|
|
13
|
+
PAGE_HEIGHT = 'PAGE_HEIGHT'
|
|
14
14
|
}
|
|
15
|
+
|
|
15
16
|
export interface RequestRenderingEvent {
|
|
16
17
|
data: RequestRenderingEventData
|
|
17
18
|
}
|