react-native-unit-components 1.6.1 → 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/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +6 -6
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +6 -6
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.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 +3 -3
- 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 +2 -2
- 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/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 +4 -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/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/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 +5 -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 +2 -2
- package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
- package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +2 -2
- package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.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 +1 -1
- 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 +1 -1
- 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/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 +1 -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/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/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 +4 -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 +1 -1
- package/lib/typescript/components/UNACHDebitComponent/UNACHDebitComponent.d.ts +1 -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 +2 -2
- package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +1 -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 +1 -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/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/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 +3 -3
- package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +3 -3
- package/src/components/UNAccountComponent/UNAccountComponent.tsx +15 -8
- package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +2 -2
- package/src/components/UNActivityComponent/UNActivityComponent.tsx +14 -7
- package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +1 -1
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +3 -3
- 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 +24 -54
- package/src/components/UNCardComponent/UNCardComponent.utils.ts +2 -49
- package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.tsx +4 -4
- 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/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,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import type WebView from 'react-native-webview';
|
|
4
|
-
import { WebComponent
|
|
4
|
+
import { WebComponent } from '../../webComponent/WebComponent';
|
|
5
5
|
import { Dimensions, Linking, View } from 'react-native';
|
|
6
6
|
import BottomSheet from '../../helpers/BottomSheet/BottomSheet';
|
|
7
7
|
import EventBus from '../../helpers/EventBus';
|
|
@@ -11,13 +11,15 @@ import { CardMessage, CardActivatedEvent, CardStatusChangedEvent } from '../../m
|
|
|
11
11
|
import { useListenerToBus } from '../../hooks/listenerToBus';
|
|
12
12
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
13
13
|
import {
|
|
14
|
+
extractCardIdFromComponentParams,
|
|
14
15
|
getBottomSheetScript,
|
|
15
|
-
|
|
16
|
+
injectHtmlFullScreenHeight,
|
|
17
|
+
isAddToWalletByComponentParams,
|
|
18
|
+
isAddToWalletFromRequestRendering,
|
|
16
19
|
renderingBottomSheetRequest,
|
|
17
20
|
resetHtml,
|
|
18
21
|
} from './UNBottomSheetComponent.utils';
|
|
19
22
|
import { getStylesObject } from './UNBottomSheetComponent.styles';
|
|
20
|
-
import { PresentationMode } from '../../scripts/html/bodyHtml';
|
|
21
23
|
import { useAppStateListener } from '../../hooks/useAppStateListener';
|
|
22
24
|
import { UNAddToWalletBottomSheetItem } from './components/UNAddToWalletBottomSheetItem';
|
|
23
25
|
import { getAccountActionType } from '../UNAccountComponent/UNAccountComponent.utils';
|
|
@@ -25,6 +27,10 @@ import { AccountAction } from '../UNAccountComponent/UNAccountComponent';
|
|
|
25
27
|
import type { AccountChangedEvent } from '../../messages/webMessages/accountMessage';
|
|
26
28
|
import { AccountMessage } from '../../messages/webMessages/accountMessage';
|
|
27
29
|
import { ActivityFiltersChangedEvent, ActivityMessage } from '../../messages/webMessages/activityMessage';
|
|
30
|
+
import { BOTTOM_SHEET_MAX_PERCENTAGE_SIZE } from './UNBottomSheetComponent.constants';
|
|
31
|
+
import { BottomSheetRenderingType, BottomSheetSlotData, NativeComponentData, WebComponentData } from '../../types/internal/bottomSheet.types';
|
|
32
|
+
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
33
|
+
import { BottomSheetNativeMessage, type StartBottomSheetFlowMessage } from '../../messages/nativeMessages/bottomSheetMessage';
|
|
28
34
|
|
|
29
35
|
export enum ScrollState {
|
|
30
36
|
/*
|
|
@@ -49,40 +55,49 @@ export enum ScrollState {
|
|
|
49
55
|
onlyBottomSheet = 'onlyBottomSheet',
|
|
50
56
|
}
|
|
51
57
|
|
|
52
|
-
export type BottomSheetSlotData = {
|
|
53
|
-
// The data that rendered by the web view
|
|
54
|
-
componentName?: WebComponentType,
|
|
55
|
-
componentResourceId?: string,
|
|
56
|
-
requestRenderingEvent: RequestRenderingEvent
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
enum CustomDialog {
|
|
60
|
-
addToWallet
|
|
61
|
-
}
|
|
62
|
-
|
|
63
58
|
export const UNBottomSheetComponent = () => {
|
|
64
59
|
const [isBottomSheetActive, setIsBottomSheetActive] = useState(false);
|
|
65
60
|
const [height, setHeight] = useState(0);
|
|
66
61
|
|
|
62
|
+
const fullScreenHeight = Dimensions.get('window').height * BOTTOM_SHEET_MAX_PERCENTAGE_SIZE;
|
|
63
|
+
|
|
64
|
+
const [renderingType, setRenderingType] = useState<BottomSheetRenderingType>(BottomSheetRenderingType.Slot);
|
|
67
65
|
const [bottomSheetSlotData, setBottomSheetSlotData] = useState<BottomSheetSlotData>();
|
|
68
|
-
const [
|
|
66
|
+
const [webComponentData, setWebComponentData] = useState<WebComponentData>();
|
|
67
|
+
const [nativeComponentData, setNativeComponentData] = useState<NativeComponentData>();
|
|
68
|
+
|
|
69
|
+
const [isAddToWallet, setIsAddToWallet] = useState(false);
|
|
69
70
|
const [scrollState, setScrollState] = useState<ScrollState>(ScrollState.onTop);
|
|
70
71
|
|
|
71
|
-
const [
|
|
72
|
+
const [shouldShowComponent, setShouldShowComponent] = useState(false);
|
|
72
73
|
const [newHeightMessage, setNewHeightMessage] = useState<WebViewMessage | null>(null);
|
|
73
74
|
|
|
74
|
-
const [customDialog, setCustomDialog] = useState<CustomDialog | null>(null);
|
|
75
|
-
|
|
76
75
|
const isAppActive = useAppStateListener();
|
|
77
76
|
|
|
78
77
|
const styles = getStylesObject();
|
|
79
78
|
|
|
80
79
|
const webRef = useRef<WebView>(null);
|
|
81
80
|
|
|
82
|
-
const
|
|
83
|
-
|
|
81
|
+
const startFlow = (rendering: StartBottomSheetFlowMessage) => {
|
|
82
|
+
setRenderingType(rendering.type);
|
|
84
83
|
setIsBottomSheetActive(true);
|
|
85
|
-
|
|
84
|
+
setShouldShowComponent(true);
|
|
85
|
+
switch (rendering.type) {
|
|
86
|
+
case BottomSheetRenderingType.Slot:
|
|
87
|
+
setBottomSheetSlotData(rendering.data);
|
|
88
|
+
setIsAddToWallet(isAddToWalletFromRequestRendering(rendering.data));
|
|
89
|
+
setWebComponentData(undefined);
|
|
90
|
+
break;
|
|
91
|
+
case BottomSheetRenderingType.WebComponent:
|
|
92
|
+
setIsAddToWallet(isAddToWalletByComponentParams(rendering.data));
|
|
93
|
+
isAddToWallet && setHeight(fullScreenHeight);
|
|
94
|
+
setBottomSheetSlotData(undefined);
|
|
95
|
+
setWebComponentData(rendering.data);
|
|
96
|
+
break;
|
|
97
|
+
case BottomSheetRenderingType.NativeComponent:
|
|
98
|
+
setNativeComponentData(rendering.data);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
86
101
|
};
|
|
87
102
|
|
|
88
103
|
const handleCloseFlow = () => {
|
|
@@ -90,88 +105,137 @@ export const UNBottomSheetComponent = () => {
|
|
|
90
105
|
};
|
|
91
106
|
|
|
92
107
|
useEffect(() => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
switch (renderingType) {
|
|
109
|
+
case BottomSheetRenderingType.Slot:
|
|
110
|
+
if (webRef.current && bottomSheetSlotData?.requestRenderingEvent) {
|
|
111
|
+
renderingBottomSheetRequest(webRef.current, bottomSheetSlotData.requestRenderingEvent);
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
114
|
+
case BottomSheetRenderingType.WebComponent:
|
|
115
|
+
if (isAddToWallet) {
|
|
116
|
+
webRef.current?.injectJavaScript('document.activeElement && document.activeElement.blur();');
|
|
117
|
+
setHeight(fullScreenHeight);
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
case BottomSheetRenderingType.NativeComponent:
|
|
121
|
+
break;
|
|
100
122
|
}
|
|
101
|
-
}, [webRef
|
|
123
|
+
}, [webRef, webComponentData, bottomSheetSlotData, nativeComponentData]);
|
|
102
124
|
|
|
103
125
|
useEffect(() => {
|
|
104
126
|
if (!isBottomSheetActive) {
|
|
105
127
|
webRef.current && resetHtml(webRef.current);
|
|
106
128
|
setHeight(0);
|
|
107
|
-
|
|
129
|
+
setShouldShowComponent(false);
|
|
130
|
+
setWebComponentData(undefined);
|
|
131
|
+
setBottomSheetSlotData(undefined);
|
|
132
|
+
setRenderingType(BottomSheetRenderingType.Slot);
|
|
108
133
|
setScrollState(ScrollState.onTop);
|
|
109
|
-
|
|
134
|
+
setIsAddToWallet(false);
|
|
110
135
|
}
|
|
111
136
|
}, [isBottomSheetActive]);
|
|
112
137
|
|
|
113
138
|
useEffect(() => {
|
|
114
|
-
if (
|
|
115
|
-
|
|
139
|
+
if (shouldShowComponent) {
|
|
140
|
+
defineScrollState();
|
|
116
141
|
setNewHeight(newHeightMessage);
|
|
117
142
|
}
|
|
118
|
-
}, [
|
|
143
|
+
}, [shouldShowComponent, newHeightMessage, isAddToWallet]);
|
|
119
144
|
|
|
120
|
-
useListenerToBus({ busEventKey:
|
|
145
|
+
useListenerToBus({ busEventKey: BottomSheetNativeMessage.START_FLOW, action: startFlow });
|
|
121
146
|
useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_CLOSE_FLOW, action: handleCloseFlow });
|
|
122
147
|
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
case WebComponentType.card: {
|
|
134
|
-
if (customDialog === CustomDialog.addToWallet) {
|
|
135
|
-
setScrollState(ScrollState.unScrollable);
|
|
136
|
-
} else {
|
|
137
|
-
setScrollState(ScrollState.onTop);
|
|
148
|
+
const defineScrollState = () => {
|
|
149
|
+
const scrollStateForSlot = () => {
|
|
150
|
+
if (!bottomSheetSlotData?.requestRenderingEvent) return;
|
|
151
|
+
switch (bottomSheetSlotData?.componentName) {
|
|
152
|
+
case WebComponentType.account: {
|
|
153
|
+
const accountActionType = getAccountActionType(bottomSheetSlotData.requestRenderingEvent);
|
|
154
|
+
setScrollState(
|
|
155
|
+
accountActionType === AccountAction.List ? ScrollState.onTop : ScrollState.unScrollable
|
|
156
|
+
);
|
|
157
|
+
break;
|
|
138
158
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
case WebComponentType.card: {
|
|
160
|
+
if (isAddToWallet) {
|
|
161
|
+
setScrollState(ScrollState.unScrollable);
|
|
162
|
+
} else {
|
|
163
|
+
setScrollState(ScrollState.onTop);
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
default: {
|
|
168
|
+
// default web component case
|
|
169
|
+
const nativePlace = bottomSheetSlotData.requestRenderingEvent.data.nativePlace;
|
|
170
|
+
if (nativePlace == 'overFullScreen') {
|
|
171
|
+
setScrollState(ScrollState.onTop);
|
|
172
|
+
} else {
|
|
173
|
+
setScrollState(ScrollState.unScrollable);
|
|
174
|
+
}
|
|
147
175
|
}
|
|
148
176
|
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const scrollStateForWebComponent = () => {
|
|
180
|
+
if (isAddToWallet) {
|
|
181
|
+
setScrollState(ScrollState.unScrollable);
|
|
182
|
+
} else {
|
|
183
|
+
setScrollState(ScrollState.onTop);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
switch (renderingType) {
|
|
188
|
+
case BottomSheetRenderingType.Slot:
|
|
189
|
+
scrollStateForSlot();
|
|
190
|
+
break;
|
|
191
|
+
case BottomSheetRenderingType.WebComponent:
|
|
192
|
+
scrollStateForWebComponent();
|
|
193
|
+
break;
|
|
194
|
+
default:
|
|
195
|
+
setScrollState(ScrollState.onTop);
|
|
149
196
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const setNewHeight = (message: WebViewMessage | null) => {
|
|
200
|
+
if (isAddToWallet) {
|
|
201
|
+
setHeight(fullScreenHeight);
|
|
202
|
+
} else if (message) {
|
|
203
|
+
const nativePlace = bottomSheetSlotData?.requestRenderingEvent.data.nativePlace;
|
|
204
|
+
if (nativePlace == 'overFullScreen') {
|
|
205
|
+
injectHtmlFullScreenHeight(webRef.current, fullScreenHeight);
|
|
206
|
+
setHeight(fullScreenHeight);
|
|
207
|
+
} else {
|
|
208
|
+
setHeight((message.details as HeightEvent).height);
|
|
209
|
+
}
|
|
156
210
|
}
|
|
157
211
|
};
|
|
158
212
|
|
|
159
213
|
const onWebMessage = (message: WebViewMessage) => {
|
|
160
214
|
switch (message.type) {
|
|
161
215
|
case PageMessage.PAGE_HEIGHT:
|
|
162
|
-
requestRenderingEvent && setNewHeightMessage(message);
|
|
216
|
+
bottomSheetSlotData?.requestRenderingEvent && setNewHeightMessage(message);
|
|
163
217
|
break;
|
|
164
218
|
case UnitMessage.UNIT_REQUEST_RENDERING: {
|
|
219
|
+
setRenderingType(BottomSheetRenderingType.Slot);
|
|
165
220
|
const requestRendering = (message.details as RequestRenderingEvent);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
221
|
+
setWebComponentData(undefined);
|
|
222
|
+
if (requestRendering.data.nativeComponent != bottomSheetSlotData?.requestRenderingEvent?.data?.nativeComponent) {
|
|
223
|
+
setIsAddToWallet(requestRendering.data.nativeComponent.includes('action=AddToWallet'));
|
|
170
224
|
|
|
225
|
+
// Animation between bottom sheet screens
|
|
226
|
+
// Close the bottom sheet
|
|
171
227
|
setHeight(0);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
228
|
+
setShouldShowComponent(false);
|
|
229
|
+
|
|
230
|
+
// Update the bottom sheet data
|
|
231
|
+
setBottomSheetSlotData({
|
|
232
|
+
componentResourceId: bottomSheetSlotData?.componentResourceId,
|
|
233
|
+
componentName: bottomSheetSlotData?.componentName,
|
|
234
|
+
requestRenderingEvent: requestRendering
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// Open the bottom sheet
|
|
238
|
+
setTimeout(() => setShouldShowComponent(true), 400);
|
|
175
239
|
}
|
|
176
240
|
break;
|
|
177
241
|
}
|
|
@@ -218,10 +282,12 @@ export const UNBottomSheetComponent = () => {
|
|
|
218
282
|
};
|
|
219
283
|
|
|
220
284
|
const renderBottomSheetItem = () => {
|
|
221
|
-
switch (
|
|
222
|
-
case
|
|
223
|
-
|
|
224
|
-
|
|
285
|
+
switch (renderingType) {
|
|
286
|
+
case BottomSheetRenderingType.Slot:
|
|
287
|
+
if (bottomSheetSlotData?.requestRenderingEvent.data.nativeComponent?.includes('action=AddToWallet') && bottomSheetSlotData?.componentResourceId) {
|
|
288
|
+
return <UNAddToWalletBottomSheetItem renderingType={renderingType} renderingRequest={bottomSheetSlotData.requestRenderingEvent} cardId={bottomSheetSlotData?.componentResourceId} fullScreenHeight={fullScreenHeight}/>;
|
|
289
|
+
}
|
|
290
|
+
|
|
225
291
|
return (
|
|
226
292
|
<WebComponent
|
|
227
293
|
ref={webRef}
|
|
@@ -233,6 +299,15 @@ export const UNBottomSheetComponent = () => {
|
|
|
233
299
|
handleScroll={onScrollWebView}
|
|
234
300
|
/>
|
|
235
301
|
);
|
|
302
|
+
case BottomSheetRenderingType.WebComponent:
|
|
303
|
+
if (webComponentData?.params?.includes('action=AddToWallet')) {
|
|
304
|
+
const cardId = extractCardIdFromComponentParams(webComponentData);
|
|
305
|
+
if (!cardId) return null;
|
|
306
|
+
return <UNAddToWalletBottomSheetItem renderingType={renderingType} webComponentData={webComponentData} cardId={cardId} fullScreenHeight={fullScreenHeight}/>;
|
|
307
|
+
}
|
|
308
|
+
return null;
|
|
309
|
+
case BottomSheetRenderingType.NativeComponent:
|
|
310
|
+
return null;
|
|
236
311
|
}
|
|
237
312
|
};
|
|
238
313
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LISTENERS } from './../../scripts/html/bodyScript';
|
|
2
2
|
import type WebView from 'react-native-webview';
|
|
3
|
-
import { BOTTOM_SHEET_MAX_PERCENTAGE_SIZE } from './UNBottomSheetComponent.constants';
|
|
4
3
|
import type { RequestRenderingEvent } from '../../messages/webMessages/unitMessages';
|
|
4
|
+
import type { BottomSheetSlotData, WebComponentData } from '../../types/internal/bottomSheet.types';
|
|
5
|
+
import { webViewId } from '../../scripts/html/bodyHtml';
|
|
5
6
|
|
|
6
7
|
export const getBottomSheetScript = () => {
|
|
7
8
|
return LISTENERS.requestRefresh;
|
|
@@ -17,15 +18,32 @@ export const renderingBottomSheetRequest = (currentWebView: WebView, renderingRe
|
|
|
17
18
|
export const resetHtml = (currentWebView: WebView) => {
|
|
18
19
|
currentWebView?.injectJavaScript(`
|
|
19
20
|
document.activeElement && document.activeElement.blur();
|
|
20
|
-
document.getElementById('
|
|
21
|
+
document.getElementById('${webViewId}').style.height = null;
|
|
21
22
|
`);
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
export const
|
|
25
|
-
const bottomSheetHeight = windowHeight * BOTTOM_SHEET_MAX_PERCENTAGE_SIZE;
|
|
25
|
+
export const injectHtmlFullScreenHeight = (currentWebView: WebView | null, bottomSheetHeight: number) => {
|
|
26
26
|
currentWebView && currentWebView?.injectJavaScript(`
|
|
27
|
-
document.getElementById('
|
|
27
|
+
document.getElementById('${webViewId}').style.height = '${bottomSheetHeight}px';
|
|
28
28
|
`);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const isAddToWalletFromRequestRendering = (data: BottomSheetSlotData): boolean => {
|
|
32
|
+
return data.requestRenderingEvent?.data?.nativeComponent.includes('AddToWallet') ?? false;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const isAddToWalletByComponentParams = (data: WebComponentData): boolean => {
|
|
36
|
+
return data.params?.includes('AddToWallet') ?? false;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const extractCardIdFromComponentParams = (data: WebComponentData): string | null => {
|
|
40
|
+
const regex = /card-id=(\d+)/;
|
|
41
|
+
const match = data.params?.match(regex);
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
if (match && match[1]) {
|
|
44
|
+
const cardId = match[1];
|
|
45
|
+
return cardId;
|
|
46
|
+
} else {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
31
49
|
};
|
|
@@ -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,22 +1,21 @@
|
|
|
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;
|
|
@@ -45,10 +44,6 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
|
|
|
45
44
|
const [height, setHeight] = useState(0);
|
|
46
45
|
const windowWidth = Dimensions.get('window').width;
|
|
47
46
|
|
|
48
|
-
const walletRef = useRef<UNWallet | null>(null);
|
|
49
|
-
// walletRef can be changed to a state. (After the change of the listener hook)
|
|
50
|
-
// TODO: walletState and checks it works. =)
|
|
51
|
-
|
|
52
47
|
const webRef = useRef<WebView>(null);
|
|
53
48
|
|
|
54
49
|
useImperativeHandle(cardRef, () => ({
|
|
@@ -76,16 +71,6 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
|
|
|
76
71
|
injectRefreshEventIfNeeded(webRef.current, data, props.cardId);
|
|
77
72
|
};
|
|
78
73
|
|
|
79
|
-
const startPushProvisioning = async (data: CardStartPushProvisioningEvent) => {
|
|
80
|
-
if (data.cardId !== props.cardId) return;
|
|
81
|
-
onAddToWalletClicked();
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const getAddToWalletStatus = (data: CardGetAddToWalletStatusEvent) => {
|
|
85
|
-
if (data.cardId !== props.cardId) return;
|
|
86
|
-
getWallets();
|
|
87
|
-
};
|
|
88
|
-
|
|
89
74
|
const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
|
|
90
75
|
if (!props.onLoad) {
|
|
91
76
|
return;
|
|
@@ -109,20 +94,24 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
|
|
|
109
94
|
useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
|
|
110
95
|
useListenerToBus({ busEventKey: CardMessage.CARD_STATUS_CHANGED, action: cardStatusChanged });
|
|
111
96
|
useListenerToBus({ busEventKey: CardMessage.CARD_ACTIVATED, action: cardActivated });
|
|
112
|
-
useListenerToBus({ busEventKey: CardNativeMessage.CARD_START_PUSH_PROVISIONING, action: startPushProvisioning });
|
|
113
|
-
useListenerToBus({ busEventKey: CardNativeMessage.CARD_GET_ADD_TO_WALLET_STATUS, action: getAddToWalletStatus });
|
|
114
97
|
|
|
115
98
|
const handleMessage = (message: WebViewMessage) => {
|
|
116
99
|
if (!message || !message.details) return;
|
|
117
100
|
|
|
118
101
|
switch (message.type) {
|
|
119
102
|
case UnitMessage.UNIT_REQUEST_RENDERING: {
|
|
120
|
-
const
|
|
103
|
+
const slotData: BottomSheetSlotData = {
|
|
121
104
|
componentName: WebComponentType.card,
|
|
122
105
|
componentResourceId: props.cardId,
|
|
123
106
|
requestRenderingEvent: message.details as RequestRenderingEvent
|
|
124
107
|
};
|
|
125
|
-
|
|
108
|
+
|
|
109
|
+
const event = {
|
|
110
|
+
type: BottomSheetRenderingType.Slot,
|
|
111
|
+
data: slotData
|
|
112
|
+
} as SlotRendering;
|
|
113
|
+
|
|
114
|
+
EventBus.Instance.event(BottomSheetNativeMessage.START_FLOW, event);
|
|
126
115
|
break;
|
|
127
116
|
}
|
|
128
117
|
case PageMessage.PAGE_HEIGHT:
|
|
@@ -134,34 +123,15 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
|
|
|
134
123
|
}
|
|
135
124
|
};
|
|
136
125
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
UnitSDK.setCustomerToken(props.customerToken);
|
|
128
|
+
}, [props.customerToken]);
|
|
140
129
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
walletRef.current = walletResponse;
|
|
146
|
-
|
|
147
|
-
const walletStatus: UNCardAddToWalletStatusEvent = { status: walletResponse.status };
|
|
148
|
-
EventBus.Instance.event(CardNativeMessage.CARD_UPDATE_ADD_TO_WALLET_STATUS, walletStatus);
|
|
149
|
-
} catch (error) {
|
|
150
|
-
console.error(error);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const onAddToWalletClicked = async () => {
|
|
155
|
-
try {
|
|
156
|
-
await launchStartCardProvisioning(props.pushProvisioningModule as NativeModule, walletRef.current);
|
|
157
|
-
} catch (error) {
|
|
158
|
-
if (error instanceof Error) {
|
|
159
|
-
const parsedError = JSON.parse(error.message);
|
|
160
|
-
if (parsedError.code === CardAddToWalletErrors.closedNativeWalletScreen) return;
|
|
161
|
-
}
|
|
162
|
-
console.log(error);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (props.pushProvisioningModule) {
|
|
132
|
+
UnitSDK.setPushProvisioningModule(props.pushProvisioningModule);
|
|
163
133
|
}
|
|
164
|
-
};
|
|
134
|
+
}, [props.pushProvisioningModule]);
|
|
165
135
|
|
|
166
136
|
return (
|
|
167
137
|
<View style={{ height }}>
|