react-native-unit-components 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsPackage.kt +9 -12
- package/android/src/main/java/com/unitreactnativecomponents/appInfo/UNAppInfoModule.kt +59 -0
- package/android/src/main/java/com/unitreactnativecomponents/extensions/ContextExtensions.kt +35 -0
- package/ios/Extensions/Bundle+Extensions.swift +23 -0
- package/ios/UNAppInfo/IOSAppInfo.swift +47 -0
- package/ios/UNAppInfo/UNAppInfoExportModule.m +5 -2
- package/ios/UnitReactNativeComponents.xcodeproj/project.pbxproj +34 -0
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +2 -2
- package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +2 -2
- package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +11 -7
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +13 -9
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +4 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +22 -8
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js +7 -2
- package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js.map +1 -1
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +11 -8
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
- package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +86 -0
- package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -0
- package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +41 -0
- package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -0
- package/lib/commonjs/components/UNMultipleCardsComponent/index.js +21 -0
- package/lib/commonjs/components/UNMultipleCardsComponent/index.js.map +1 -0
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/flows/card/UNCardFlows.js +8 -4
- package/lib/commonjs/flows/card/UNCardFlows.js.map +1 -1
- package/lib/commonjs/helpers/pushProvisioningService/helpers.js +34 -0
- package/lib/commonjs/helpers/pushProvisioningService/helpers.js.map +1 -0
- package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js +32 -2
- package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
- package/lib/commonjs/helpers/pushProvisioningService/types.js +41 -0
- package/lib/commonjs/helpers/pushProvisioningService/types.js.map +1 -0
- package/lib/commonjs/hooks/useListenerToEvent.js +26 -0
- package/lib/commonjs/hooks/useListenerToEvent.js.map +1 -0
- package/lib/commonjs/messages/webMessages/index.js.map +1 -1
- package/lib/commonjs/messages/webMessages/multipleCardsMessage.js +12 -0
- package/lib/commonjs/messages/webMessages/multipleCardsMessage.js.map +1 -0
- package/lib/commonjs/messages/webMessages/onLoadMessage.js +2 -1
- package/lib/commonjs/messages/webMessages/onLoadMessage.js.map +1 -1
- package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js +27 -3
- package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js.map +1 -1
- package/lib/commonjs/slices/ConfigurationSlice.js +36 -0
- package/lib/commonjs/slices/ConfigurationSlice.js.map +1 -0
- package/lib/commonjs/slices/SharedEventsSlice.js +28 -0
- package/lib/commonjs/slices/SharedEventsSlice.js.map +1 -0
- package/lib/commonjs/store/store.js +5 -1
- package/lib/commonjs/store/store.js.map +1 -1
- package/lib/commonjs/types/internal/errorHelpers.js +20 -0
- package/lib/commonjs/types/internal/errorHelpers.js.map +1 -0
- package/lib/commonjs/types/internal/webComponent.types.js +1 -0
- package/lib/commonjs/types/internal/webComponent.types.js.map +1 -1
- package/lib/commonjs/types/shared/activity.types.js +7 -0
- package/lib/commonjs/types/shared/activity.types.js.map +1 -1
- package/lib/commonjs/types/shared/error.types.js +29 -0
- package/lib/commonjs/types/shared/error.types.js.map +1 -0
- package/lib/commonjs/types/shared/index.js +22 -0
- package/lib/commonjs/types/shared/index.js.map +1 -1
- package/lib/commonjs/types/shared/multipleCards.types.js +13 -0
- package/lib/commonjs/types/shared/multipleCards.types.js.map +1 -0
- package/lib/commonjs/types/shared/onLoadResponse.types.js +4 -0
- package/lib/commonjs/types/shared/onLoadResponse.types.js.map +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdk.api.js +6 -13
- package/lib/commonjs/unitSdkManager/UnitSdk.api.js.map +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdk.constants.js +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdk.constants.js.map +1 -1
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js +8 -18
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
- package/lib/commonjs/utils/AppInfo.js +49 -0
- package/lib/commonjs/utils/AppInfo.js.map +1 -0
- package/lib/commonjs/utils/SDKInfo.js +13 -0
- package/lib/commonjs/utils/SDKInfo.js.map +1 -0
- package/lib/commonjs/webComponent/WebComponent.js +30 -32
- package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
- package/lib/commonjs/webComponent/WebComponent.utils.js +19 -1
- package/lib/commonjs/webComponent/WebComponent.utils.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 +11 -6
- package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js +13 -8
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +4 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +22 -8
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js +7 -2
- package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js.map +1 -1
- package/lib/module/components/UNCardComponent/UNCardComponent.js +12 -8
- package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
- package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +77 -0
- package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -0
- package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +33 -0
- package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -0
- package/lib/module/components/UNMultipleCardsComponent/index.js +2 -0
- package/lib/module/components/UNMultipleCardsComponent/index.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/flows/card/UNCardFlows.js +8 -3
- package/lib/module/flows/card/UNCardFlows.js.map +1 -1
- package/lib/module/helpers/pushProvisioningService/helpers.js +24 -0
- package/lib/module/helpers/pushProvisioningService/helpers.js.map +1 -0
- package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js +35 -5
- package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
- package/lib/module/helpers/pushProvisioningService/types.js +34 -0
- package/lib/module/helpers/pushProvisioningService/types.js.map +1 -0
- package/lib/module/hooks/useListenerToEvent.js +19 -0
- package/lib/module/hooks/useListenerToEvent.js.map +1 -0
- package/lib/module/messages/webMessages/index.js.map +1 -1
- package/lib/module/messages/webMessages/multipleCardsMessage.js +5 -0
- package/lib/module/messages/webMessages/multipleCardsMessage.js.map +1 -0
- package/lib/module/messages/webMessages/onLoadMessage.js +2 -1
- package/lib/module/messages/webMessages/onLoadMessage.js.map +1 -1
- package/lib/module/networking/requests/UNWalletPayloadRequest.js +27 -3
- package/lib/module/networking/requests/UNWalletPayloadRequest.js.map +1 -1
- package/lib/module/slices/ConfigurationSlice.js +25 -0
- package/lib/module/slices/ConfigurationSlice.js.map +1 -0
- package/lib/module/slices/SharedEventsSlice.js +19 -0
- package/lib/module/slices/SharedEventsSlice.js.map +1 -0
- package/lib/module/store/store.js +5 -1
- package/lib/module/store/store.js.map +1 -1
- package/lib/module/types/internal/errorHelpers.js +12 -0
- package/lib/module/types/internal/errorHelpers.js.map +1 -0
- package/lib/module/types/internal/webComponent.types.js +1 -0
- package/lib/module/types/internal/webComponent.types.js.map +1 -1
- package/lib/module/types/shared/activity.types.js +5 -1
- package/lib/module/types/shared/activity.types.js.map +1 -1
- package/lib/module/types/shared/error.types.js +22 -0
- package/lib/module/types/shared/error.types.js.map +1 -0
- package/lib/module/types/shared/index.js +2 -0
- package/lib/module/types/shared/index.js.map +1 -1
- package/lib/module/types/shared/multipleCards.types.js +6 -0
- package/lib/module/types/shared/multipleCards.types.js.map +1 -0
- package/lib/module/types/shared/onLoadResponse.types.js +1 -1
- package/lib/module/types/shared/onLoadResponse.types.js.map +1 -1
- package/lib/module/unitSdkManager/UnitSdk.api.js +5 -10
- package/lib/module/unitSdkManager/UnitSdk.api.js.map +1 -1
- package/lib/module/unitSdkManager/UnitSdk.constants.js +1 -1
- package/lib/module/unitSdkManager/UnitSdk.constants.js.map +1 -1
- package/lib/module/unitSdkManager/UnitSdkManager.js +8 -17
- package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
- package/lib/module/utils/AppInfo.js +39 -0
- package/lib/module/utils/AppInfo.js.map +1 -0
- package/lib/module/utils/SDKInfo.js +5 -0
- package/lib/module/utils/SDKInfo.js.map +1 -0
- package/lib/module/webComponent/WebComponent.js +33 -34
- package/lib/module/webComponent/WebComponent.js.map +1 -1
- package/lib/module/webComponent/WebComponent.utils.js +15 -0
- package/lib/module/webComponent/WebComponent.utils.js.map +1 -1
- package/lib/typescript/{components → src/components}/UNActivityComponent/UNActivityComponent.d.ts +3 -0
- package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.d.ts +15 -0
- package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.d.ts +3 -0
- package/lib/typescript/src/components/UNMultipleCardsComponent/index.d.ts +1 -0
- package/lib/typescript/{components → src/components}/index.d.ts +1 -0
- package/lib/typescript/src/helpers/pushProvisioningService/helpers.d.ts +4 -0
- package/lib/typescript/src/helpers/pushProvisioningService/types.d.ts +49 -0
- package/lib/typescript/src/hooks/useListenerToEvent.d.ts +9 -0
- package/lib/typescript/{messages → src/messages}/webMessages/index.d.ts +3 -2
- package/lib/typescript/src/messages/webMessages/multipleCardsMessage.d.ts +6 -0
- package/lib/typescript/{messages → src/messages}/webMessages/onLoadMessage.d.ts +7 -3
- package/lib/typescript/{networking → src/networking}/requests/UNWalletPayloadRequest.d.ts +1 -1
- package/lib/typescript/src/slices/ConfigurationSlice.d.ts +10 -0
- package/lib/typescript/src/slices/SharedEventsSlice.d.ts +56 -0
- package/lib/typescript/src/store/store.d.ts +76 -0
- package/lib/typescript/src/types/internal/errorHelpers.d.ts +4 -0
- package/lib/typescript/{types → src/types}/internal/webComponent.types.d.ts +1 -0
- package/lib/typescript/{types → src/types}/shared/activity.types.d.ts +5 -1
- package/lib/typescript/src/types/shared/error.types.d.ts +36 -0
- package/lib/typescript/{types → src/types}/shared/index.d.ts +2 -0
- package/lib/typescript/src/types/shared/multipleCards.types.d.ts +6 -0
- package/lib/typescript/src/types/shared/onLoadResponse.types.d.ts +5 -0
- package/lib/typescript/src/unitSdkManager/UnitSdk.api.d.ts +1 -0
- package/lib/typescript/{unitSdkManager → src/unitSdkManager}/UnitSdkManager.d.ts +4 -8
- package/lib/typescript/src/utils/AppInfo.d.ts +4 -0
- package/lib/typescript/src/utils/SDKInfo.d.ts +1 -0
- package/lib/typescript/{webComponent → src/webComponent}/WebComponent.utils.d.ts +3 -0
- package/package.json +3 -3
- package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +2 -2
- package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +2 -2
- package/src/components/UNAccountComponent/UNAccountComponent.tsx +25 -12
- package/src/components/UNActivityComponent/UNActivityComponent.tsx +33 -16
- package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +4 -1
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +42 -16
- package/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.tsx +7 -2
- package/src/components/UNCardComponent/UNCardComponent.tsx +11 -10
- package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.tsx +119 -0
- package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.ts +36 -0
- package/src/components/UNMultipleCardsComponent/index.ts +3 -0
- package/src/components/index.ts +1 -0
- package/src/flows/card/UNCardFlows.ts +10 -4
- package/src/helpers/pushProvisioningService/helpers.ts +31 -0
- package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +35 -6
- package/src/helpers/pushProvisioningService/types.ts +52 -0
- package/src/hooks/useListenerToEvent.ts +32 -0
- package/src/messages/webMessages/index.ts +3 -0
- package/src/messages/webMessages/multipleCardsMessage.ts +9 -0
- package/src/messages/webMessages/onLoadMessage.ts +14 -3
- package/src/networking/requests/UNWalletPayloadRequest.ts +25 -4
- package/src/slices/ConfigurationSlice.ts +31 -0
- package/src/slices/SharedEventsSlice.ts +93 -0
- package/src/store/store.ts +6 -2
- package/src/types/internal/errorHelpers.ts +22 -0
- package/src/types/internal/webComponent.types.ts +1 -1
- package/src/types/shared/activity.types.ts +6 -1
- package/src/types/shared/error.types.ts +38 -0
- package/src/types/shared/index.ts +2 -0
- package/src/types/shared/multipleCards.types.ts +8 -0
- package/src/types/shared/onLoadResponse.types.ts +2 -12
- package/src/unitSdkManager/UnitSdk.api.ts +5 -8
- package/src/unitSdkManager/UnitSdk.constants.ts +1 -1
- package/src/unitSdkManager/UnitSdkManager.ts +8 -20
- package/src/utils/AppInfo.ts +40 -0
- package/src/utils/SDKInfo.ts +5 -0
- package/src/webComponent/WebComponent.tsx +37 -34
- package/src/webComponent/WebComponent.utils.ts +17 -0
- package/android/src/main/java/com/unitreactnativecomponents/getapplicationid/UNAppInfoModule.kt +0 -35
- package/ios/UNAppInfo/UNAppInfo.swift +0 -23
- package/lib/commonjs/components/utils/nativeModulesInfo.js +0 -20
- package/lib/commonjs/components/utils/nativeModulesInfo.js.map +0 -1
- package/lib/commonjs/helpers/EventBus.js +0 -58
- package/lib/commonjs/helpers/EventBus.js.map +0 -1
- package/lib/commonjs/hooks/listenerToBus.js +0 -34
- package/lib/commonjs/hooks/listenerToBus.js.map +0 -1
- package/lib/module/components/utils/nativeModulesInfo.js +0 -13
- package/lib/module/components/utils/nativeModulesInfo.js.map +0 -1
- package/lib/module/helpers/EventBus.js +0 -51
- package/lib/module/helpers/EventBus.js.map +0 -1
- package/lib/module/hooks/listenerToBus.js +0 -25
- package/lib/module/hooks/listenerToBus.js.map +0 -1
- package/lib/typescript/components/utils/nativeModulesInfo.d.ts +0 -1
- package/lib/typescript/helpers/EventBus.d.ts +0 -13
- package/lib/typescript/hooks/listenerToBus.d.ts +0 -7
- package/lib/typescript/store/store.d.ts +0 -6
- package/lib/typescript/types/shared/onLoadResponse.types.d.ts +0 -14
- package/lib/typescript/unitSdkManager/UnitSdk.api.d.ts +0 -3
- package/src/components/utils/nativeModulesInfo.ts +0 -11
- package/src/helpers/EventBus.ts +0 -58
- package/src/hooks/listenerToBus.ts +0 -31
- /package/lib/typescript/{assets → src/assets}/images/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNACHCreditComponent/UNACHCreditComponent.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNACHCreditComponent/UNACHCreditComponent.utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNACHCreditComponent/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNACHDebitComponent/UNACHDebitComponent.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNACHDebitComponent/UNACHDebitComponent.utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNACHDebitComponent/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNAccountComponent/UNAccountComponent.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNAccountComponent/UNAccountComponent.utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNAccountComponent/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNActivityComponent/UNActivityComponent.utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNActivityComponent/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBookPaymentComponent/UNBookPaymentComponent.utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBookPaymentComponent/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.styles.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.styles.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/components/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNCardComponent/UNCardComponent.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNCardComponent/UNCardComponent.utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNCardComponent/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNCheckDepositComponent/UNCheckDepositComponent.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNCheckDepositComponent/UNCheckDepositComponent.utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/UNCheckDepositComponent/index.d.ts +0 -0
- /package/lib/typescript/{flows → src/flows}/UNFlows.d.ts +0 -0
- /package/lib/typescript/{flows → src/flows}/card/UNCardFlows.d.ts +0 -0
- /package/lib/typescript/{helpers → src/helpers}/BottomSheet/BottomSheet.d.ts +0 -0
- /package/lib/typescript/{helpers → src/helpers}/BottomSheet/BottomSheet.styles.d.ts +0 -0
- /package/lib/typescript/{helpers → src/helpers}/pushProvisioningService/hooks/useCardWallet.d.ts +0 -0
- /package/lib/typescript/{helpers → src/helpers}/pushProvisioningService/hooks/useLaunchInitialize.d.ts +0 -0
- /package/lib/typescript/{helpers → src/helpers}/pushProvisioningService/startProvisioning.d.ts +0 -0
- /package/lib/typescript/{helpers → src/helpers}/store/helpers.d.ts +0 -0
- /package/lib/typescript/{hooks → src/hooks}/useAppStateListener.d.ts +0 -0
- /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
- /package/lib/typescript/{messages → src/messages}/nativeMessages/bottomSheetMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/nativeMessages/cardMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/nativeMessages/index.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/nativeMessages/sdkMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/accountMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/achCreditMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/activityMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/bookPaymentMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/cardMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/checkMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/pageMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/paymentsMessage.d.ts +0 -0
- /package/lib/typescript/{messages → src/messages}/webMessages/unitMessages.d.ts +0 -0
- /package/lib/typescript/{nativeComponent → src/nativeComponent}/UnitAddToWalletButton.d.ts +0 -0
- /package/lib/typescript/{networking → src/networking}/common/UNNetworkConstants.d.ts +0 -0
- /package/lib/typescript/{scripts → src/scripts}/html/bodyHtml.d.ts +0 -0
- /package/lib/typescript/{scripts → src/scripts}/html/bodyScript.d.ts +0 -0
- /package/lib/typescript/{scripts → src/scripts}/html/fontFaces.d.ts +0 -0
- /package/lib/typescript/{slices → src/slices}/pushProvisioningSlice.d.ts +0 -0
- /package/lib/typescript/{store → src/store}/index.d.ts +0 -0
- /package/lib/typescript/{styles → src/styles}/fonts.d.ts +0 -0
- /package/lib/typescript/{styles → src/styles}/variables.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/internal/bottomSheet.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/account.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/achCredit.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/authorization.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/bookPayment.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/card.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/checkDeposit.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/fonts.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/payments.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/transactions.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/versioning.types.d.ts +0 -0
- /package/lib/typescript/{types → src/types}/shared/wallet.types.d.ts +0 -0
- /package/lib/typescript/{unitSdkManager → src/unitSdkManager}/UnitSdk.constants.d.ts +0 -0
- /package/lib/typescript/{unitSdkManager → src/unitSdkManager}/UnitSdkManager.utils.internal.d.ts +0 -0
- /package/lib/typescript/{unitSdkManager → src/unitSdkManager}/unitUiManager/unitUiManager.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/webVersioningStrategy.utils.d.ts +0 -0
- /package/lib/typescript/{webComponent → src/webComponent}/WebComponent.d.ts +0 -0
- /package/lib/typescript/{webComponent → src/webComponent}/html.d.ts +0 -0
|
@@ -1,39 +1,53 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
2
|
import { Dimensions, View } from 'react-native';
|
|
3
3
|
import { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
4
|
-
import { useListenerToBus } from '../../hooks/listenerToBus';
|
|
5
4
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
6
5
|
import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
|
|
7
6
|
import type { UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../types/shared';
|
|
8
7
|
import { WebComponent } from '../../webComponent/WebComponent';
|
|
9
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
getActivityParams,
|
|
10
|
+
getActivityScript,
|
|
11
|
+
injectFiltersChanged,
|
|
12
|
+
injectRefreshEventIfNeeded,
|
|
13
|
+
} from './UNActivityComponent.utils';
|
|
10
14
|
import type WebView from 'react-native-webview';
|
|
11
|
-
import EventBus from '../../helpers/EventBus';
|
|
12
15
|
import type { UNActivityOnLoadData } from '../../types/shared/activity.types';
|
|
13
16
|
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
14
17
|
import { ActivityMessage } from '../../messages/webMessages/activityMessage';
|
|
15
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
BottomSheetRenderingType,
|
|
20
|
+
type BottomSheetSlotData,
|
|
21
|
+
type SlotRendering,
|
|
22
|
+
} from '../../types/internal/bottomSheet.types';
|
|
16
23
|
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
17
24
|
import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
|
|
18
25
|
import { withReduxStore } from '../../helpers/store/helpers';
|
|
26
|
+
import { setEvent } from '../../slices/SharedEventsSlice';
|
|
27
|
+
import { useDispatch } from 'react-redux';
|
|
28
|
+
import { useListenerToEvent } from '../../hooks/useListenerToEvent';
|
|
29
|
+
import type { UNActivityComponentPaginationType } from '../../types/shared';
|
|
19
30
|
|
|
20
31
|
const DEFAULT_HEIGHT = Dimensions.get('window').height * 0.5;
|
|
32
|
+
|
|
21
33
|
export interface UNActivityComponentProps {
|
|
22
34
|
// inputs
|
|
23
35
|
customerToken: string;
|
|
24
36
|
accountId?: string;
|
|
25
|
-
queryFilter?: string
|
|
37
|
+
queryFilter?: string;
|
|
26
38
|
|
|
27
39
|
// ui
|
|
28
40
|
theme?: string;
|
|
29
41
|
language?: string;
|
|
30
42
|
hideFilterButton?: boolean;
|
|
31
|
-
|
|
43
|
+
paginationType?: UNActivityComponentPaginationType;
|
|
44
|
+
transactionsPerPage?: number;
|
|
32
45
|
// event
|
|
33
46
|
onLoad?: (response: UNOnLoadResponse<UNActivityOnLoadData>) => void;
|
|
34
47
|
}
|
|
35
48
|
|
|
36
49
|
const UNActivityComponent = (props: UNActivityComponentProps) => {
|
|
50
|
+
const dispatch = useDispatch();
|
|
37
51
|
const webRef = useRef<WebView>(null);
|
|
38
52
|
const [defaultHeight, setDefaultHeight] = useState<number>();
|
|
39
53
|
|
|
@@ -45,8 +59,11 @@ const UNActivityComponent = (props: UNActivityComponentProps) => {
|
|
|
45
59
|
injectFiltersChanged(webRef.current, query);
|
|
46
60
|
};
|
|
47
61
|
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
useListenerToEvent({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
|
|
63
|
+
useListenerToEvent({
|
|
64
|
+
busEventKey: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED,
|
|
65
|
+
action: dispatchActivityFiltersChanged,
|
|
66
|
+
});
|
|
50
67
|
|
|
51
68
|
const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
|
|
52
69
|
if (!props.onLoad) {
|
|
@@ -58,13 +75,13 @@ const UNActivityComponent = (props: UNActivityComponentProps) => {
|
|
|
58
75
|
return;
|
|
59
76
|
}
|
|
60
77
|
|
|
61
|
-
if (RESPONSE_KEYS.
|
|
78
|
+
if (RESPONSE_KEYS.authorizations in response && RESPONSE_KEYS.transactions in response) {
|
|
62
79
|
// ActivityOnLoadResponse;
|
|
63
80
|
const activityOnLoad: UNOnLoadResponseData<UNActivityOnLoadData> = {
|
|
64
81
|
data: {
|
|
65
|
-
[RESPONSE_KEYS.
|
|
66
|
-
[RESPONSE_KEYS.transactions]: response[RESPONSE_KEYS.transactions].data
|
|
67
|
-
}
|
|
82
|
+
[RESPONSE_KEYS.authorizations]: response[RESPONSE_KEYS.authorizations].data,
|
|
83
|
+
[RESPONSE_KEYS.transactions]: response[RESPONSE_KEYS.transactions].data,
|
|
84
|
+
},
|
|
68
85
|
};
|
|
69
86
|
props.onLoad(activityOnLoad);
|
|
70
87
|
return;
|
|
@@ -80,15 +97,15 @@ const UNActivityComponent = (props: UNActivityComponentProps) => {
|
|
|
80
97
|
const slotData: BottomSheetSlotData = {
|
|
81
98
|
componentName: WebComponentType.activity,
|
|
82
99
|
componentResourceId: props.accountId,
|
|
83
|
-
requestRenderingEvent: message.details as RequestRenderingEvent
|
|
100
|
+
requestRenderingEvent: message.details as RequestRenderingEvent,
|
|
84
101
|
};
|
|
85
102
|
|
|
86
|
-
const
|
|
103
|
+
const data = {
|
|
87
104
|
type: BottomSheetRenderingType.Slot,
|
|
88
|
-
data: slotData
|
|
105
|
+
data: slotData,
|
|
89
106
|
} as SlotRendering;
|
|
90
107
|
|
|
91
|
-
|
|
108
|
+
dispatch(setEvent({ key: BottomSheetNativeMessage.START_FLOW, data }));
|
|
92
109
|
break;
|
|
93
110
|
}
|
|
94
111
|
case UnitMessage.UNIT_ON_LOAD:
|
|
@@ -7,12 +7,15 @@ import { WebComponentType } from '../../types/internal/webComponent.types';
|
|
|
7
7
|
export const getActivityParams = (props: UNActivityComponentProps) => {
|
|
8
8
|
const accountIdParam = props.accountId ? `account-id="${props.accountId}"` : '';
|
|
9
9
|
const queryFilterParam = props.queryFilter ? `query-filter="${props.queryFilter}"` : '';
|
|
10
|
-
|
|
10
|
+
const paginationTypeParam = props.paginationType ? `pagination-type="${props.paginationType}"` : '';
|
|
11
|
+
const transactionsPerPageParam = props.transactionsPerPage ? `transactions-per-page="${props.transactionsPerPage}"` : '';
|
|
11
12
|
return `
|
|
12
13
|
customer-token="${props.customerToken}"
|
|
13
14
|
${accountIdParam}
|
|
14
15
|
hide-filter-button="${props.hideFilterButton || false}"
|
|
15
16
|
${queryFilterParam}
|
|
17
|
+
${paginationTypeParam}
|
|
18
|
+
${transactionsPerPageParam}
|
|
16
19
|
style="height: 100%"
|
|
17
20
|
`;
|
|
18
21
|
};
|
|
@@ -4,11 +4,9 @@ import type WebView from 'react-native-webview';
|
|
|
4
4
|
import { WebComponent } from '../../webComponent/WebComponent';
|
|
5
5
|
import { Dimensions, Linking, View } from 'react-native';
|
|
6
6
|
import BottomSheet from '../../helpers/BottomSheet/BottomSheet';
|
|
7
|
-
import EventBus from '../../helpers/EventBus';
|
|
8
7
|
import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
|
|
9
8
|
import { RequestOpenLinkEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
10
9
|
import { CardMessage, CardActivatedEvent, CardStatusChangedEvent } from '../../messages/webMessages/cardMessage';
|
|
11
|
-
import { useListenerToBus } from '../../hooks/listenerToBus';
|
|
12
10
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
13
11
|
import {
|
|
14
12
|
extractCardIdFromComponentParams,
|
|
@@ -28,10 +26,21 @@ import type { AccountChangedEvent } from '../../messages/webMessages/accountMess
|
|
|
28
26
|
import { AccountMessage } from '../../messages/webMessages/accountMessage';
|
|
29
27
|
import { ActivityFiltersChangedEvent, ActivityMessage } from '../../messages/webMessages/activityMessage';
|
|
30
28
|
import { BOTTOM_SHEET_MAX_PERCENTAGE_SIZE } from './UNBottomSheetComponent.constants';
|
|
31
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
BottomSheetRenderingType,
|
|
31
|
+
BottomSheetSlotData,
|
|
32
|
+
NativeComponentData,
|
|
33
|
+
WebComponentData,
|
|
34
|
+
} from '../../types/internal/bottomSheet.types';
|
|
32
35
|
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
33
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
BottomSheetNativeMessage,
|
|
38
|
+
type StartBottomSheetFlowMessage,
|
|
39
|
+
} from '../../messages/nativeMessages/bottomSheetMessage';
|
|
34
40
|
import { withReduxStore } from '../../helpers/store/helpers';
|
|
41
|
+
import { useListenerToEvent } from '../../hooks/useListenerToEvent';
|
|
42
|
+
import { setEvent } from '../../slices/SharedEventsSlice';
|
|
43
|
+
import { useDispatch } from 'react-redux';
|
|
35
44
|
|
|
36
45
|
export enum ScrollState {
|
|
37
46
|
/*
|
|
@@ -57,6 +66,7 @@ export enum ScrollState {
|
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
const UNBottomSheetComponent = () => {
|
|
69
|
+
const dispatch = useDispatch();
|
|
60
70
|
const [isBottomSheetActive, setIsBottomSheetActive] = useState(false);
|
|
61
71
|
const [height, setHeight] = useState(0);
|
|
62
72
|
|
|
@@ -143,8 +153,8 @@ const UNBottomSheetComponent = () => {
|
|
|
143
153
|
}
|
|
144
154
|
}, [shouldShowComponent, newHeightMessage, isAddToWallet]);
|
|
145
155
|
|
|
146
|
-
|
|
147
|
-
|
|
156
|
+
useListenerToEvent({ busEventKey: BottomSheetNativeMessage.START_FLOW, action: startFlow });
|
|
157
|
+
useListenerToEvent({ busEventKey: UnitMessage.UNIT_REQUEST_CLOSE_FLOW, action: handleCloseFlow });
|
|
148
158
|
|
|
149
159
|
const defineScrollState = () => {
|
|
150
160
|
const scrollStateForSlot = () => {
|
|
@@ -153,7 +163,7 @@ const UNBottomSheetComponent = () => {
|
|
|
153
163
|
case WebComponentType.account: {
|
|
154
164
|
const accountActionType = getAccountActionType(bottomSheetSlotData.requestRenderingEvent);
|
|
155
165
|
setScrollState(
|
|
156
|
-
accountActionType === UNAccountAction.List ? ScrollState.onTop : ScrollState.unScrollable
|
|
166
|
+
accountActionType === UNAccountAction.List ? ScrollState.onTop : ScrollState.unScrollable,
|
|
157
167
|
);
|
|
158
168
|
break;
|
|
159
169
|
}
|
|
@@ -233,7 +243,7 @@ const UNBottomSheetComponent = () => {
|
|
|
233
243
|
setBottomSheetSlotData({
|
|
234
244
|
componentResourceId: bottomSheetSlotData?.componentResourceId,
|
|
235
245
|
componentName: bottomSheetSlotData?.componentName,
|
|
236
|
-
requestRenderingEvent: requestRendering
|
|
246
|
+
requestRenderingEvent: requestRendering,
|
|
237
247
|
});
|
|
238
248
|
|
|
239
249
|
// Open the bottom sheet
|
|
@@ -242,16 +252,28 @@ const UNBottomSheetComponent = () => {
|
|
|
242
252
|
break;
|
|
243
253
|
}
|
|
244
254
|
case CardMessage.CARD_ACTIVATED:
|
|
245
|
-
|
|
255
|
+
dispatch(setEvent({
|
|
256
|
+
key: CardMessage.CARD_ACTIVATED,
|
|
257
|
+
data: (message.details as CardActivatedEvent).card,
|
|
258
|
+
}));
|
|
246
259
|
break;
|
|
247
260
|
case CardMessage.CARD_STATUS_CHANGED:
|
|
248
|
-
|
|
261
|
+
dispatch(setEvent({
|
|
262
|
+
key: CardMessage.CARD_STATUS_CHANGED,
|
|
263
|
+
data: (message.details as CardStatusChangedEvent).card,
|
|
264
|
+
}));
|
|
249
265
|
break;
|
|
250
266
|
case AccountMessage.UNIT_ACCOUNT_CHANGED:
|
|
251
|
-
|
|
267
|
+
dispatch(setEvent({
|
|
268
|
+
key: AccountMessage.UNIT_ACCOUNT_CHANGED,
|
|
269
|
+
data: (message.details as AccountChangedEvent).account,
|
|
270
|
+
}));
|
|
252
271
|
break;
|
|
253
272
|
case ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED:
|
|
254
|
-
|
|
273
|
+
dispatch(setEvent({
|
|
274
|
+
key: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED,
|
|
275
|
+
data: (message.details as ActivityFiltersChangedEvent),
|
|
276
|
+
}));
|
|
255
277
|
break;
|
|
256
278
|
case UnitMessage.UNIT_REQUEST_CLOSE_FLOW:
|
|
257
279
|
handleCloseFlow();
|
|
@@ -287,7 +309,10 @@ const UNBottomSheetComponent = () => {
|
|
|
287
309
|
switch (renderingType) {
|
|
288
310
|
case BottomSheetRenderingType.Slot:
|
|
289
311
|
if (bottomSheetSlotData?.requestRenderingEvent.data.nativeComponent?.includes('action=AddToWallet') && bottomSheetSlotData?.componentResourceId) {
|
|
290
|
-
return <UNAddToWalletBottomSheetItem renderingType={renderingType}
|
|
312
|
+
return <UNAddToWalletBottomSheetItem renderingType={renderingType}
|
|
313
|
+
renderingRequest={bottomSheetSlotData.requestRenderingEvent}
|
|
314
|
+
cardId={bottomSheetSlotData?.componentResourceId}
|
|
315
|
+
fullScreenHeight={fullScreenHeight} />;
|
|
291
316
|
}
|
|
292
317
|
|
|
293
318
|
return (
|
|
@@ -305,7 +330,8 @@ const UNBottomSheetComponent = () => {
|
|
|
305
330
|
if (webComponentData?.params?.includes('action=AddToWallet')) {
|
|
306
331
|
const cardId = extractCardIdFromComponentParams(webComponentData);
|
|
307
332
|
if (!cardId) return null;
|
|
308
|
-
return <UNAddToWalletBottomSheetItem renderingType={renderingType} webComponentData={webComponentData}
|
|
333
|
+
return <UNAddToWalletBottomSheetItem renderingType={renderingType} webComponentData={webComponentData}
|
|
334
|
+
cardId={cardId} fullScreenHeight={fullScreenHeight} />;
|
|
309
335
|
}
|
|
310
336
|
return null;
|
|
311
337
|
case BottomSheetRenderingType.NativeComponent:
|
|
@@ -327,8 +353,8 @@ const UNBottomSheetComponent = () => {
|
|
|
327
353
|
shouldEnableBottomSheetScroll={scrollState !== ScrollState.onlyWebView}
|
|
328
354
|
>
|
|
329
355
|
{isAppActive && renderBottomSheetItem()}
|
|
330
|
-
</BottomSheet
|
|
331
|
-
</View
|
|
356
|
+
</BottomSheet>
|
|
357
|
+
</View>
|
|
332
358
|
);
|
|
333
359
|
};
|
|
334
360
|
|
|
@@ -12,7 +12,8 @@ import { PresentationMode, WebComponentType } from '../../../../types/internal/w
|
|
|
12
12
|
import { useCardWallet } from '../../../../helpers/pushProvisioningService/hooks/useCardWallet';
|
|
13
13
|
import { launchStartCardProvisioning } from '../../../../helpers/pushProvisioningService/startProvisioning';
|
|
14
14
|
import type { WebViewMessage } from '../../../../messages/webMessages';
|
|
15
|
-
import
|
|
15
|
+
import { useDispatch } from 'react-redux';
|
|
16
|
+
import { setEvent } from '../../../../slices/SharedEventsSlice';
|
|
16
17
|
|
|
17
18
|
export interface UNAddToWalletBottomSheetItemProps {
|
|
18
19
|
renderingType: BottomSheetRenderingType
|
|
@@ -23,6 +24,7 @@ export interface UNAddToWalletBottomSheetItemProps {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const UNAddToWalletBottomSheetItem = (props: UNAddToWalletBottomSheetItemProps) => {
|
|
27
|
+
const dispatch = useDispatch();
|
|
26
28
|
const styles = getStylesObject();
|
|
27
29
|
|
|
28
30
|
const webRef = useRef<WebView>(null);
|
|
@@ -55,7 +57,10 @@ export const UNAddToWalletBottomSheetItem = (props: UNAddToWalletBottomSheetItem
|
|
|
55
57
|
injectHtmlFullScreenHeight(webRef.current, props.fullScreenHeight);
|
|
56
58
|
break;
|
|
57
59
|
case UnitMessage.UNIT_REQUEST_CLOSE_FLOW:
|
|
58
|
-
|
|
60
|
+
dispatch(setEvent({
|
|
61
|
+
key: UnitMessage.UNIT_REQUEST_CLOSE_FLOW,
|
|
62
|
+
data: {},
|
|
63
|
+
}));
|
|
59
64
|
break;
|
|
60
65
|
default:
|
|
61
66
|
break;
|
|
@@ -3,9 +3,7 @@ import { 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
|
-
import EventBus from '../../helpers/EventBus';
|
|
7
6
|
import { WebComponent } from '../../webComponent/WebComponent';
|
|
8
|
-
import { useListenerToBus } from '../../hooks/listenerToBus';
|
|
9
7
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
10
8
|
import {
|
|
11
9
|
getCardParams,
|
|
@@ -29,9 +27,10 @@ import { UnitSDK } from '../../unitSdkManager/UnitSdkManager';
|
|
|
29
27
|
import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
|
|
30
28
|
import { useLaunchInitialize } from '../../helpers/pushProvisioningService/hooks/useLaunchInitialize';
|
|
31
29
|
import { selectWallet } from '../../slices/pushProvisioningSlice';
|
|
32
|
-
import { useSelector } from 'react-redux';
|
|
30
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
33
31
|
import { withReduxStoreAndRefForwarding } from '../../helpers/store/helpers';
|
|
34
|
-
|
|
32
|
+
import { useListenerToEvent } from '../../hooks/useListenerToEvent';
|
|
33
|
+
import { setEvent } from '../../slices/SharedEventsSlice';
|
|
35
34
|
|
|
36
35
|
export interface UNCardComponentProps {
|
|
37
36
|
// inputs
|
|
@@ -61,6 +60,8 @@ export interface CardRef {
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function UNCardComponent(props, cardRef) {
|
|
63
|
+
const dispatch = useDispatch();
|
|
64
|
+
|
|
64
65
|
const [height, setHeight] = useState(0);
|
|
65
66
|
|
|
66
67
|
const webRef = useRef<WebView>(null);
|
|
@@ -118,9 +119,9 @@ const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function
|
|
|
118
119
|
return;
|
|
119
120
|
};
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
useListenerToEvent({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
|
|
123
|
+
useListenerToEvent({ busEventKey: CardMessage.CARD_STATUS_CHANGED, action: cardStatusChanged });
|
|
124
|
+
useListenerToEvent({ busEventKey: CardMessage.CARD_ACTIVATED, action: cardActivated });
|
|
124
125
|
|
|
125
126
|
const handleMessage = (message: WebViewMessage) => {
|
|
126
127
|
if (!message || !message.details) return;
|
|
@@ -133,12 +134,12 @@ const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function
|
|
|
133
134
|
requestRenderingEvent: message.details as RequestRenderingEvent,
|
|
134
135
|
};
|
|
135
136
|
|
|
136
|
-
const
|
|
137
|
+
const data = {
|
|
137
138
|
type: BottomSheetRenderingType.Slot,
|
|
138
139
|
data: slotData,
|
|
139
140
|
} as SlotRendering;
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
dispatch(setEvent({ key: BottomSheetNativeMessage.START_FLOW, data }));
|
|
142
143
|
break;
|
|
143
144
|
}
|
|
144
145
|
case PageMessage.PAGE_HEIGHT:
|
|
@@ -178,7 +179,7 @@ const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function
|
|
|
178
179
|
onMessage={message => handleMessage(message)}
|
|
179
180
|
isScrollable={false}
|
|
180
181
|
/>
|
|
181
|
-
</View
|
|
182
|
+
</View>
|
|
182
183
|
);
|
|
183
184
|
|
|
184
185
|
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { Dimensions, View } from 'react-native';
|
|
3
|
+
import type { WebViewMessage } from '../../messages/webMessages';
|
|
4
|
+
import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
|
|
5
|
+
import { WebComponent } from '../../webComponent/WebComponent';
|
|
6
|
+
|
|
7
|
+
import type WebView from 'react-native-webview';
|
|
8
|
+
|
|
9
|
+
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
10
|
+
import { withReduxStore } from '../../helpers/store/helpers';
|
|
11
|
+
import { getMultipleCardsParams, getMultipleCardsScript } from './UNMultipleCardsComponent.utils';
|
|
12
|
+
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
13
|
+
import type { UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
14
|
+
import { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';
|
|
15
|
+
import type {
|
|
16
|
+
UNCardData,
|
|
17
|
+
UNError,
|
|
18
|
+
UNMultipleCardsComponentPaginationType,
|
|
19
|
+
UNMultipleCardsOnLoadData,
|
|
20
|
+
UNOnLoadResponse,
|
|
21
|
+
UNOnLoadResponseData,
|
|
22
|
+
} from '../../types/shared';
|
|
23
|
+
import { MultipleCardsCardClickedEvent, MultipleCardsMessage } from '../../messages/webMessages/multipleCardsMessage';
|
|
24
|
+
|
|
25
|
+
const DEFAULT_HEIGHT = Dimensions.get('window').height * 0.5;
|
|
26
|
+
|
|
27
|
+
export interface UNMultipleCardsComponentProps {
|
|
28
|
+
// inputs
|
|
29
|
+
customerToken: string;
|
|
30
|
+
|
|
31
|
+
// ui
|
|
32
|
+
paginationType?: UNMultipleCardsComponentPaginationType;
|
|
33
|
+
cardsPerPage?: number;
|
|
34
|
+
disableCardClick?: boolean;
|
|
35
|
+
theme?: string;
|
|
36
|
+
language?: string;
|
|
37
|
+
queryFilter?: string;
|
|
38
|
+
hideTitle?: boolean;
|
|
39
|
+
|
|
40
|
+
// events
|
|
41
|
+
onLoad?: (response: UNOnLoadResponse<UNMultipleCardsOnLoadData>) => void;
|
|
42
|
+
onCardClicked?: (card: UNCardData) => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const UNMultipleCardsComponent = (props: UNMultipleCardsComponentProps) => {
|
|
46
|
+
const webRef = useRef<WebView>(null);
|
|
47
|
+
const [defaultHeight, setDefaultHeight] = useState<number>();
|
|
48
|
+
|
|
49
|
+
const cardClicked = (card: UNCardData) => {
|
|
50
|
+
if (props.onCardClicked) {
|
|
51
|
+
props.onCardClicked(card);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
|
|
56
|
+
if (!props.onLoad) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (RESPONSE_KEYS.errors in response) {
|
|
61
|
+
props.onLoad(response as UNError);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (RESPONSE_KEYS.cards in response) {
|
|
66
|
+
// MultipleCardsOnLoadResponse;
|
|
67
|
+
props.onLoad(response[RESPONSE_KEYS.cards] as UNOnLoadResponseData<UNMultipleCardsOnLoadData>);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
console.error('On Load Error: unexpected response type');
|
|
72
|
+
return;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const handleWebViewMessage = (message: WebViewMessage) => {
|
|
76
|
+
if (!message || !message.details) return;
|
|
77
|
+
switch (message.type) {
|
|
78
|
+
case UnitMessage.UNIT_ON_LOAD:
|
|
79
|
+
handleUnitOnLoad(message.details as UnitOnLoadResponseEvent);
|
|
80
|
+
break;
|
|
81
|
+
case PageMessage.PAGE_HEIGHT: {
|
|
82
|
+
const currentHeight = (message.details as HeightEvent).height;
|
|
83
|
+
currentHeight === 0 && setDefaultHeight(DEFAULT_HEIGHT);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED: {
|
|
87
|
+
cardClicked(message.details as MultipleCardsCardClickedEvent);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const renderMultipleCardsWebView = () => {
|
|
93
|
+
return (
|
|
94
|
+
<WebComponent
|
|
95
|
+
ref={webRef}
|
|
96
|
+
type={WebComponentType.multipleCards}
|
|
97
|
+
presentationMode={PresentationMode.Inherit}
|
|
98
|
+
params={getMultipleCardsParams(props)}
|
|
99
|
+
script={getMultipleCardsScript()}
|
|
100
|
+
onMessage={(message: WebViewMessage) => handleWebViewMessage(message)}
|
|
101
|
+
nestedScrollEnabled={true}
|
|
102
|
+
theme={props.theme}
|
|
103
|
+
language={props.language}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
if (!defaultHeight) {
|
|
109
|
+
return renderMultipleCardsWebView();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<View style={{ height: defaultHeight }}>
|
|
114
|
+
{renderMultipleCardsWebView()}
|
|
115
|
+
</View>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export default withReduxStore<UNMultipleCardsComponentProps>(UNMultipleCardsComponent);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { UNMultipleCardsComponentProps } from './UNMultipleCardsComponent';
|
|
2
|
+
import { MultipleCardsMessage } from '../../messages/webMessages/multipleCardsMessage';
|
|
3
|
+
|
|
4
|
+
export const getMultipleCardsParams = (props: UNMultipleCardsComponentProps) => {
|
|
5
|
+
const paginationType = props.paginationType ? `pagination-type="${props.paginationType}"` : '';
|
|
6
|
+
const cardsPerPage = props.cardsPerPage ? `cards-per-page="${props.cardsPerPage}"` : '';
|
|
7
|
+
const queryFilter = props.queryFilter ? `query-filter="${props.queryFilter}"` : '';
|
|
8
|
+
return `
|
|
9
|
+
customer-token="${props.customerToken}"
|
|
10
|
+
${paginationType}
|
|
11
|
+
${cardsPerPage}
|
|
12
|
+
disable-card-click="${props.disableCardClick || false}"
|
|
13
|
+
${queryFilter}
|
|
14
|
+
hide-title="${props.hideTitle || false}"
|
|
15
|
+
style="height: 100%"
|
|
16
|
+
`;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const MULTIPLE_CARDS_LISTENERS = {
|
|
20
|
+
cardClicked: `
|
|
21
|
+
window.addEventListener("${MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED}", (e) => {
|
|
22
|
+
const response = e.detail
|
|
23
|
+
response.then((data) => {
|
|
24
|
+
postMessageToSDK({ type: "${MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED}", details: data.data })
|
|
25
|
+
}).catch((e) => {
|
|
26
|
+
console.log(e)
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
`,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getMultipleCardsScript = () => {
|
|
33
|
+
return `
|
|
34
|
+
${MULTIPLE_CARDS_LISTENERS.cardClicked}
|
|
35
|
+
`;
|
|
36
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import EventBus from '../../helpers/EventBus';
|
|
2
1
|
import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
|
|
3
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BottomSheetRenderingType,
|
|
4
|
+
type WebComponentData,
|
|
5
|
+
type WebComponentRendering,
|
|
6
|
+
} from '../../types/internal/bottomSheet.types';
|
|
4
7
|
import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
|
|
8
|
+
import { useDispatch } from 'react-redux';
|
|
9
|
+
import { setEvent } from '../../slices/SharedEventsSlice';
|
|
5
10
|
|
|
6
11
|
export class UNCardFlows {
|
|
7
12
|
public static startPushProvisioning = async (cardId: string, customerToken: string) => {
|
|
13
|
+
const dispatch = useDispatch(); //todo: can we use hook here?
|
|
8
14
|
try {
|
|
9
15
|
const addToWalletComponentData: WebComponentData = {
|
|
10
16
|
type: WebComponentType.cardAction,
|
|
@@ -12,12 +18,12 @@ export class UNCardFlows {
|
|
|
12
18
|
params: `card-id=${cardId} customer-token=${customerToken} action=AddToWallet`,
|
|
13
19
|
};
|
|
14
20
|
|
|
15
|
-
const
|
|
21
|
+
const data: WebComponentRendering = {
|
|
16
22
|
type: BottomSheetRenderingType.WebComponent,
|
|
17
23
|
data: addToWalletComponentData,
|
|
18
24
|
};
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
dispatch(setEvent({ key: BottomSheetNativeMessage.START_FLOW, data }));
|
|
21
27
|
} catch (error) {
|
|
22
28
|
console.error(error);
|
|
23
29
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { UNNativePromiseReject, UNVPError, UNVPErrorType } from './types';
|
|
3
|
+
|
|
4
|
+
export const isUNVPError = (error: any): error is UNVPError => {
|
|
5
|
+
return 'code' in error &&
|
|
6
|
+
'description' in error &&
|
|
7
|
+
'type' in error &&
|
|
8
|
+
isUNVPErrorType(error.type) &&
|
|
9
|
+
'correlationId' in error;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const isUNVPErrorType = (type: any): type is UNVPErrorType => {
|
|
13
|
+
return Object.values(UNVPErrorType).includes(type);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const isUNNativePromiseReject = (error: any): error is UNNativePromiseReject => {
|
|
17
|
+
return 'code' in error && 'message' in error;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const promiseRejectToUNVPErrorType = (error: any): UNVPErrorType | null => {
|
|
21
|
+
// validate the shape of a promise reject we get from iOS/Android native
|
|
22
|
+
if (!isUNNativePromiseReject(error)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const parsedError = JSON.parse(error.message);
|
|
26
|
+
// validate the shape of an error we get from VDE SDK
|
|
27
|
+
if (!isUNVPError(parsedError)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return parsedError.type;
|
|
31
|
+
};
|