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,10 +1,14 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import { UNWalletCode, type UNWallet, UNWalletName } from '../../../types/shared/wallet.types';
|
|
3
3
|
import { UnitSDK } from '../../../unitSdkManager/UnitSdkManager';
|
|
4
4
|
import { getMobileWalletPayload } from '../../../networking/requests/UNWalletPayloadRequest';
|
|
5
|
-
import { useSelector } from 'react-redux';
|
|
6
|
-
import { selectWallet } from '../../../slices/pushProvisioningSlice';
|
|
5
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
6
|
+
import { selectWallet, setSignedNonce } from '../../../slices/pushProvisioningSlice';
|
|
7
7
|
import { useLaunchInitialize } from './useLaunchInitialize';
|
|
8
|
+
import { UNVPErrorType } from '../types';
|
|
9
|
+
import { promiseRejectToUNVPErrorType } from '../helpers';
|
|
10
|
+
import { UNErrorCodes, UNErrorData } from '../../../types/shared/error.types';
|
|
11
|
+
import { isUNError } from '../../../types/internal/errorHelpers';
|
|
8
12
|
|
|
9
13
|
export type CardToEncryptedPayload = {
|
|
10
14
|
[cardId: string]: string;
|
|
@@ -14,13 +18,19 @@ export const useCardWallet = (cardId: string) => {
|
|
|
14
18
|
const [currentUNWallet, setCurrentUNWallet] = useState<UNWallet>();
|
|
15
19
|
const { signedNonce } = useSelector(selectWallet);
|
|
16
20
|
const { initializePushProvisioning } = useLaunchInitialize();
|
|
21
|
+
const dispatch = useDispatch();
|
|
22
|
+
const isRecoveringSignedNonceRef = useRef<boolean>(false);
|
|
23
|
+
|
|
24
|
+
const shouldRecoverVPSDKForError = (errorType: UNVPErrorType) => {
|
|
25
|
+
const recoveringTypes = [UNVPErrorType.PayloadDecryptionFailed, UNVPErrorType.SessionExpired, UNVPErrorType.InvalidNonce];
|
|
26
|
+
return recoveringTypes.includes(errorType);
|
|
27
|
+
};
|
|
17
28
|
|
|
18
29
|
useEffect(() => {
|
|
19
30
|
const getEncryptedPayload = async () => {
|
|
20
31
|
const env = UnitSDK.getEnv();
|
|
21
32
|
const customerToken = UnitSDK.getCustomerToken();
|
|
22
33
|
if (!env || !customerToken) return;
|
|
23
|
-
|
|
24
34
|
// In case we use flow
|
|
25
35
|
if (!signedNonce) {
|
|
26
36
|
await initializePushProvisioning();
|
|
@@ -37,13 +47,32 @@ export const useCardWallet = (cardId: string) => {
|
|
|
37
47
|
const encryptedPayload = await getEncryptedPayload();
|
|
38
48
|
if (!encryptedPayload) return;
|
|
39
49
|
const walletsResponse = await currentProvisioningModule.launchGetWallets(JSON.stringify({ encPayload: encryptedPayload }));
|
|
40
|
-
|
|
41
50
|
const unWallet: UNWallet | null = parseWalletsResponse(walletsResponse);
|
|
42
51
|
if (!unWallet) return;
|
|
43
52
|
setCurrentUNWallet(unWallet);
|
|
44
53
|
return;
|
|
45
54
|
} catch (error) {
|
|
46
|
-
|
|
55
|
+
console.error('Coudln\'t get card wallet data:', error);
|
|
56
|
+
if (isRecoveringSignedNonceRef.current) return;
|
|
57
|
+
isRecoveringSignedNonceRef.current = true;
|
|
58
|
+
|
|
59
|
+
// handle unit network api errors
|
|
60
|
+
if (isUNError(error)) {
|
|
61
|
+
const errors: UNErrorData[] = error.errors;
|
|
62
|
+
// errors will return in an array but hold only a single error element
|
|
63
|
+
if (errors[0]?.code === UNErrorCodes.INVALID_NONCE) {
|
|
64
|
+
dispatch(setSignedNonce(null));
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// handle VDE SDK errors
|
|
70
|
+
const errorType = promiseRejectToUNVPErrorType(error);
|
|
71
|
+
if (!errorType) return;
|
|
72
|
+
if (shouldRecoverVPSDKForError(errorType)) {
|
|
73
|
+
dispatch(setSignedNonce(null));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
47
76
|
}
|
|
48
77
|
};
|
|
49
78
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export enum UNVPErrorType {
|
|
2
|
+
EmptyAppId = 'EmptyAppId',
|
|
3
|
+
DeviceAuthenticationFailed = 'DeviceAuthenticationFailed',
|
|
4
|
+
DeviceRootDetection = 'DeviceRootDetection',
|
|
5
|
+
HookDetection = 'HookDetection',
|
|
6
|
+
PlayIntegrityCheckFailed = 'PlayIntegrityCheckFailed',
|
|
7
|
+
EmptyEncryptedPayload = 'EmptyEncryptedPayload',
|
|
8
|
+
NoWallets = 'NoWallets',
|
|
9
|
+
InvalidCardId = 'InvalidCardId',
|
|
10
|
+
ProvisioningNotAllowed = 'ProvisioningNotAllowed',
|
|
11
|
+
CancelledByUser = 'CancelledByUser',
|
|
12
|
+
GoogleWalletCreationFailed = 'GoogleWalletCreationFailed',
|
|
13
|
+
UnknownErrorOccurred = 'UnknownErrorOccurred',
|
|
14
|
+
WalletProvisioningInconclusive = 'WalletProvisioningInconclusive',
|
|
15
|
+
WalletProvisioningError = 'WalletProvisioningError',
|
|
16
|
+
NetworkFailure = 'NetworkFailure',
|
|
17
|
+
SessionExpired = 'SessionExpired',
|
|
18
|
+
InvalidInfo = 'InvalidInfo',
|
|
19
|
+
PayloadDecryptionFailed = 'PayloadDecryptionFailed',
|
|
20
|
+
ApiError = 'ApiError',
|
|
21
|
+
InvalidNonce = 'InvalidNonce',
|
|
22
|
+
SDKLockout = 'SDKLockout',
|
|
23
|
+
NoBrowserFound = 'NoBrowserFound',
|
|
24
|
+
TLCMFeatureNotSupported = 'TLCMFeatureNotSupported',
|
|
25
|
+
TLCMUnsupportedWallet = 'TLCMUnsupportedWallet',
|
|
26
|
+
TLCMDetailsNotFoundInPaySdk = 'TLCMDetailsNotFoundInPaySdk',
|
|
27
|
+
TLCMTokenStatusExists = 'TLCMTokenStatusExists',
|
|
28
|
+
TLCMInvalidOperationInput = 'TLCMInvalidOperationInput',
|
|
29
|
+
TLCMInvalidRequest = 'TLCMInvalidRequest',
|
|
30
|
+
TLCMUpdateStatusNotAllowed = 'TLCMUpdateStatusNotAllowed',
|
|
31
|
+
TLCMTokenNotFound = 'TLCMTokenNotFound',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface UNVPError {
|
|
35
|
+
code: string;
|
|
36
|
+
description: string;
|
|
37
|
+
type: UNVPErrorType;
|
|
38
|
+
correlationId: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type UNNativePromiseReject = {
|
|
42
|
+
code: string;
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface UNMobileWalletPayload {
|
|
47
|
+
data: {
|
|
48
|
+
attributes: {
|
|
49
|
+
payload: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
5
|
+
import type { RootState } from '../store';
|
|
6
|
+
import type { NativeMessageType } from '../messages/nativeMessages';
|
|
7
|
+
import type { WebViewMessageType } from '../messages/webMessages';
|
|
8
|
+
|
|
9
|
+
export type BusEventKey = NativeMessageType | WebViewMessageType
|
|
10
|
+
|
|
11
|
+
type EventListener = {
|
|
12
|
+
busEventKey: BusEventKey,
|
|
13
|
+
action: (data: any) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const useListenerToEvent = (listener: EventListener) => {
|
|
17
|
+
const isFirstRun = useRef(true);
|
|
18
|
+
const event = useSelector((state: RootState) => state.sharedEvents.event);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (isFirstRun.current) {
|
|
21
|
+
isFirstRun.current = false;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (event == null || event == undefined || event?.key != listener.busEventKey) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
listener.action(event.data);
|
|
30
|
+
|
|
31
|
+
}, [event]);
|
|
32
|
+
};
|
|
@@ -8,10 +8,12 @@ import type { UnitEvent, UnitMessage } from './unitMessages';
|
|
|
8
8
|
import type { AccountEvent, AccountMessage } from './accountMessage';
|
|
9
9
|
import type { CheckEvent, CheckMessage } from './checkMessage';
|
|
10
10
|
import type { ActivityEvent, ActivityMessage } from './activityMessage';
|
|
11
|
+
import type { MultipleCardsEvent, MultipleCardsMessage } from './multipleCardsMessage';
|
|
11
12
|
|
|
12
13
|
export type WebViewMessageType =
|
|
13
14
|
| PageMessage
|
|
14
15
|
| CardMessage
|
|
16
|
+
| MultipleCardsMessage
|
|
15
17
|
| UnitMessage
|
|
16
18
|
| PaymentMessage
|
|
17
19
|
| AccountMessage
|
|
@@ -22,6 +24,7 @@ type WebViewEvent =
|
|
|
22
24
|
| PageEvent
|
|
23
25
|
| UnitEvent
|
|
24
26
|
| CardEvent
|
|
27
|
+
| MultipleCardsEvent
|
|
25
28
|
| BookPaymentEvent
|
|
26
29
|
| PaymentMessage
|
|
27
30
|
| ACHEvent
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UNCardData } from '../../types/shared';
|
|
2
|
+
|
|
3
|
+
export enum MultipleCardsMessage {
|
|
4
|
+
UNIT_MULTIPLE_CARDS_CARD_CLICKED = 'unitMultipleCardsCardClicked',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type MultipleCardsCardClickedEvent = UNCardData;
|
|
8
|
+
|
|
9
|
+
export type MultipleCardsEvent = MultipleCardsCardClickedEvent
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
UNAccountData,
|
|
3
|
+
UNCounterpartyAccountData,
|
|
4
|
+
UNCardData,
|
|
5
|
+
UNError,
|
|
6
|
+
UNOnLoadResponseData,
|
|
7
|
+
} from '../../types/shared';
|
|
2
8
|
import type { UNAuthorizationData } from '../../types/shared/authorization.types';
|
|
3
9
|
import type { UNTransactionData } from '../../types/shared/transactions.types';
|
|
4
10
|
|
|
5
11
|
export enum RESPONSE_KEYS {
|
|
6
12
|
errors = 'errors',
|
|
7
13
|
card = 'cardResult',
|
|
14
|
+
cards = 'cardsResult',
|
|
8
15
|
account = 'accountResult',
|
|
9
16
|
counterpartyAccount = 'counterpartyResult',
|
|
10
17
|
transactions = 'transactionsResult',
|
|
11
|
-
|
|
18
|
+
authorizations = 'authorizationsResult'
|
|
12
19
|
}
|
|
13
20
|
|
|
21
|
+
export type CardsOnLoadResponse = {
|
|
22
|
+
[RESPONSE_KEYS.cards]: UNOnLoadResponseData<[UNCardData]>
|
|
23
|
+
}
|
|
14
24
|
export type CardOnLoadResponse = {
|
|
15
25
|
[RESPONSE_KEYS.card]: UNOnLoadResponseData<UNCardData>
|
|
16
26
|
}
|
|
@@ -29,12 +39,13 @@ export type ACHOnLoadResponse = {
|
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
export type ActivityOnLoadResponse = {
|
|
32
|
-
[RESPONSE_KEYS.
|
|
42
|
+
[RESPONSE_KEYS.authorizations]: UNOnLoadResponseData<UNAuthorizationData>,
|
|
33
43
|
[RESPONSE_KEYS.transactions]: UNOnLoadResponseData<UNTransactionData>
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
export type UnitOnLoadResponseSuccessData =
|
|
37
47
|
| CardOnLoadResponse
|
|
48
|
+
| CardsOnLoadResponse
|
|
38
49
|
| ACHOnLoadResponse
|
|
39
50
|
| AccountsOnLoadResponse
|
|
40
51
|
| AccountOnLoadResponse
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { APIHeaders, UNIT_SECURE_URL } from '../common/UNNetworkConstants';
|
|
3
3
|
import type { UNEnvironment } from '../../unitSdkManager/UnitSdkManager';
|
|
4
|
+
import type { UNMobileWalletPayload } from '../../helpers/pushProvisioningService/types';
|
|
5
|
+
import type { UNError, UNErrorData } from '../../types/shared/error.types';
|
|
6
|
+
|
|
7
|
+
const isUNMobileWalletPayload = (object: any): object is UNMobileWalletPayload => {
|
|
8
|
+
return 'data' in object &&
|
|
9
|
+
'attributes' in object.data &&
|
|
10
|
+
'payload' in object.data.attributes;
|
|
11
|
+
};
|
|
4
12
|
|
|
5
13
|
// TODO: use apiClient class for handling requests.
|
|
6
14
|
|
|
@@ -28,9 +36,22 @@ export const getMobileWalletPayload = async (customerToken: string, cardId: stri
|
|
|
28
36
|
{
|
|
29
37
|
headers: headers,
|
|
30
38
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
if (!isUNMobileWalletPayload(response.data)) {
|
|
40
|
+
const error: UNErrorData = {title: `Couldn't get mobile wallet payload. Status:${response.status} Response data:${response.data}`};
|
|
41
|
+
throw error;
|
|
42
|
+
} else {
|
|
43
|
+
const encryptedPayload = response.data.data.attributes.payload;
|
|
44
|
+
return encryptedPayload;
|
|
45
|
+
}
|
|
46
|
+
} catch (error: unknown) {
|
|
47
|
+
// Converts the error into a UNError
|
|
48
|
+
if (axios.isAxiosError<UNError>(error) && error.response) {
|
|
49
|
+
const unErrors = error.response.data;
|
|
50
|
+
throw unErrors;
|
|
51
|
+
} else if (error instanceof Error) {
|
|
52
|
+
const unexpectedError: UNErrorData = {title: 'Unexpected error', error: error};
|
|
53
|
+
throw unexpectedError;
|
|
54
|
+
}
|
|
55
|
+
throw {title: `Unexpected error: ${error}`};
|
|
35
56
|
}
|
|
36
57
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import type { RootState } from '../store';
|
|
3
|
+
|
|
4
|
+
export interface ConfigurationState {
|
|
5
|
+
unitScript?: string;
|
|
6
|
+
theme?: string;
|
|
7
|
+
language?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const initialState: ConfigurationState = {};
|
|
11
|
+
|
|
12
|
+
const ConfigurationSlice = createSlice({
|
|
13
|
+
name: 'Configuration',
|
|
14
|
+
initialState: initialState,
|
|
15
|
+
reducers: {
|
|
16
|
+
setUnitScript(state, action: PayloadAction<string | undefined>) {
|
|
17
|
+
state.unitScript = action.payload;
|
|
18
|
+
},
|
|
19
|
+
setTheme(state, action: PayloadAction<string | undefined>) {
|
|
20
|
+
state.theme = action.payload;
|
|
21
|
+
},
|
|
22
|
+
setLanguage(state, action: PayloadAction<string | undefined>) {
|
|
23
|
+
state.language = action.payload;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const { setUnitScript, setLanguage, setTheme } = ConfigurationSlice.actions;
|
|
30
|
+
export const selectConfiguration = (state: RootState) => state.configuration;
|
|
31
|
+
export default ConfigurationSlice.reducer;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
4
|
+
import type { RootState } from '../store';
|
|
5
|
+
import type { SlotRendering, WebComponentRendering } from '../types/internal/bottomSheet.types';
|
|
6
|
+
import type { UNAccountData, UNCardData } from '../types/shared';
|
|
7
|
+
import type { ActivityFiltersChangedEvent } from '../messages/webMessages/activityMessage';
|
|
8
|
+
import type { RequestRefreshEvent } from '../messages/webMessages/unitMessages';
|
|
9
|
+
import type { BottomSheetNativeMessage } from '../messages/nativeMessages/bottomSheetMessage';
|
|
10
|
+
import type { CardMessage } from '../messages/webMessages/cardMessage';
|
|
11
|
+
import type { AccountMessage } from '../messages/webMessages/accountMessage';
|
|
12
|
+
import type { ActivityMessage } from '../messages/webMessages/activityMessage';
|
|
13
|
+
import type { UnitMessage } from '../messages/webMessages/unitMessages';
|
|
14
|
+
import type { MultipleCardsMessage } from '../messages/webMessages/multipleCardsMessage';
|
|
15
|
+
|
|
16
|
+
type EmptyObj = Record<PropertyKey, never>;
|
|
17
|
+
|
|
18
|
+
type SlotRenderingEventState = {
|
|
19
|
+
key: BottomSheetNativeMessage.START_FLOW,
|
|
20
|
+
data: SlotRendering
|
|
21
|
+
}
|
|
22
|
+
type MultipleCardsCardClickedEventState = {
|
|
23
|
+
key: MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED,
|
|
24
|
+
data: UNCardData
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type CardStatusChangedEventState = {
|
|
28
|
+
key: CardMessage.CARD_STATUS_CHANGED,
|
|
29
|
+
data: UNCardData
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type CardActivatedEventState = {
|
|
33
|
+
key: CardMessage.CARD_ACTIVATED,
|
|
34
|
+
data: UNCardData
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type AccountChangedEventState = {
|
|
38
|
+
key: AccountMessage.UNIT_ACCOUNT_CHANGED,
|
|
39
|
+
data: UNAccountData
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type ActivityFiltersChangedEventState = {
|
|
43
|
+
key: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED
|
|
44
|
+
data: ActivityFiltersChangedEvent
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type RequestCloseFlowEventState = {
|
|
48
|
+
key: UnitMessage.UNIT_REQUEST_CLOSE_FLOW,
|
|
49
|
+
data: EmptyObj
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type WebComponentRenderingEventState = {
|
|
53
|
+
key: BottomSheetNativeMessage.START_FLOW,
|
|
54
|
+
data: WebComponentRendering
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type RequestRefreshEventState = {
|
|
58
|
+
key: UnitMessage.UNIT_REQUEST_REFRESH,
|
|
59
|
+
data: RequestRefreshEvent
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//currently left state suffixes to avoid the duplication of the event names
|
|
63
|
+
type SharedEvent =
|
|
64
|
+
SlotRenderingEventState
|
|
65
|
+
| CardStatusChangedEventState
|
|
66
|
+
| CardActivatedEventState
|
|
67
|
+
| MultipleCardsCardClickedEventState
|
|
68
|
+
| AccountChangedEventState
|
|
69
|
+
| ActivityFiltersChangedEventState
|
|
70
|
+
| RequestCloseFlowEventState
|
|
71
|
+
| WebComponentRenderingEventState
|
|
72
|
+
| RequestRefreshEventState
|
|
73
|
+
|
|
74
|
+
type SharedEventsState = {
|
|
75
|
+
event?: SharedEvent
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const initialState: SharedEventsState = {};
|
|
79
|
+
|
|
80
|
+
const SharedEventsSlice = createSlice({
|
|
81
|
+
name: 'SharedEvents',
|
|
82
|
+
initialState: initialState,
|
|
83
|
+
reducers: {
|
|
84
|
+
setEvent(state, action: PayloadAction<SharedEvent>) {
|
|
85
|
+
state.event = action.payload;
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export const { setEvent } = SharedEventsSlice.actions;
|
|
92
|
+
export const selectSharedEvents = (state: RootState) => state.sharedEvents;
|
|
93
|
+
export default SharedEventsSlice.reducer;
|
package/src/store/store.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { configureStore } from '@reduxjs/toolkit';
|
|
2
2
|
import wallet from '../slices/pushProvisioningSlice';
|
|
3
|
+
import configuration from '../slices/ConfigurationSlice';
|
|
4
|
+
import sharedEvents from '../slices/SharedEventsSlice';
|
|
3
5
|
|
|
4
6
|
export const store = configureStore({
|
|
5
7
|
reducer: {
|
|
6
|
-
wallet
|
|
7
|
-
|
|
8
|
+
wallet,
|
|
9
|
+
configuration,
|
|
10
|
+
sharedEvents,
|
|
11
|
+
},
|
|
8
12
|
});
|
|
9
13
|
|
|
10
14
|
export type RootState = ReturnType<typeof store.getState>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import type { UNErrorData } from '../shared/error.types';
|
|
4
|
+
import type { UNError } from '../shared';
|
|
5
|
+
|
|
6
|
+
const isUNErrorData = (obj: any): obj is UNErrorData => {
|
|
7
|
+
return (
|
|
8
|
+
typeof obj === 'object' &&
|
|
9
|
+
'title' in obj
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const isUNErrorDataArray = (arr: any): arr is UNErrorData[] => {
|
|
14
|
+
return (
|
|
15
|
+
Array.isArray(arr) &&
|
|
16
|
+
arr.every((item) => isUNErrorData(item))
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const isUNError = (error: any): error is UNError => {
|
|
21
|
+
return 'errors' in error && isUNErrorDataArray(error.errors);
|
|
22
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export enum WebComponentType {
|
|
2
2
|
card = 'unit-elements-card',
|
|
3
|
+
multipleCards = 'unit-elements-multiple-cards',
|
|
3
4
|
bookPayment = 'unit-elements-book-payment',
|
|
4
5
|
activity = 'unit-elements-activity',
|
|
5
6
|
slot = 'unit-elements-sdk-slot',
|
|
@@ -7,7 +8,6 @@ export enum WebComponentType {
|
|
|
7
8
|
checkDeposit = 'unit-elements-check-deposit',
|
|
8
9
|
achDebitPayment = 'unit-elements-ach-debit-payment',
|
|
9
10
|
achCreditPayment = 'unit-elements-ach-credit-payment',
|
|
10
|
-
|
|
11
11
|
cardAction = 'unit-elements-card-action',
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -2,7 +2,12 @@ import type { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';
|
|
|
2
2
|
import type { UNAuthorizationData } from './authorization.types';
|
|
3
3
|
import type { UNTransactionData } from './transactions.types';
|
|
4
4
|
|
|
5
|
+
export const enum UNActivityComponentPaginationType {
|
|
6
|
+
infiniteScroll = 'infiniteScroll',
|
|
7
|
+
pagination = 'pagination'
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
export type UNActivityOnLoadData = {
|
|
6
|
-
[RESPONSE_KEYS.
|
|
11
|
+
[RESPONSE_KEYS.authorizations]: UNAuthorizationData,
|
|
7
12
|
[RESPONSE_KEYS.transactions]: UNTransactionData,
|
|
8
13
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type UNError = {
|
|
2
|
+
errors: UNErrorData[]
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export type UNErrorData = {
|
|
6
|
+
status?: string,
|
|
7
|
+
title: string,
|
|
8
|
+
detail?: string,
|
|
9
|
+
details?: string,
|
|
10
|
+
meta?: UNErrorMeta
|
|
11
|
+
code?: UNErrorCodes,
|
|
12
|
+
error?: Error
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface UNErrorMeta {
|
|
16
|
+
meta: Record<string, string>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum UNErrorCodes {
|
|
20
|
+
FEATURE_DISABLED = 'feature_disabled',
|
|
21
|
+
INVALID_VALUE = 'invalid_value',
|
|
22
|
+
LIMITS_EXCEEDED = 'limits_exceeded',
|
|
23
|
+
NOT_FOUND = 'not_found',
|
|
24
|
+
ACCOUNT_CUSTOMER_MISMATCH = 'account_customer_mismatch',
|
|
25
|
+
NOT_SUPPORTED_FOR_ACCOUNT_STATUS = 'not_supported_for_account_status',
|
|
26
|
+
NOT_SUPPORTED_FOR_ACCOUNT_TYPE = 'not_supported_for_account_type',
|
|
27
|
+
NOT_SUPPORTED_FOR_CARD = 'not_supported_for_card',
|
|
28
|
+
NOT_SUPPORTED_FOR_CARD_STATUS = 'not_supported_for_card_status',
|
|
29
|
+
NOT_SUPPORTED_FOR_CARD_TYPE = 'not_supported_for_card_type',
|
|
30
|
+
INVALID_NONCE = 'invalid_nonce',
|
|
31
|
+
NOT_SUPPORTED_FOR_PAYMENT_TYPE = 'not_supported_for_payment_type',
|
|
32
|
+
PAYMENT_INVALID = 'payment_invalid',
|
|
33
|
+
UNAUTHORIZED = 'unauthorized',
|
|
34
|
+
FORBIDDEN = 'forbidden',
|
|
35
|
+
ALREADY_EXISTS = 'already_exists',
|
|
36
|
+
CUSTOMER_NAME_UNDELIVERABLE = 'customer_name_undeliverable',
|
|
37
|
+
CUSTOMER_ADDRESS_UNDELIVERABLE = 'customer_address_undeliverable',
|
|
38
|
+
}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
+
import type { UNError } from './error.types';
|
|
2
|
+
|
|
1
3
|
export type UNOnLoadResponseData<T> = {
|
|
2
4
|
data: T,
|
|
3
5
|
}
|
|
4
6
|
|
|
5
|
-
export type UNError = {
|
|
6
|
-
errors: UNErrorData[]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type UNErrorData = {
|
|
10
|
-
status: string,
|
|
11
|
-
title: string,
|
|
12
|
-
detail?: string,
|
|
13
|
-
details?: string,
|
|
14
|
-
meta?: Record<string, string>
|
|
15
|
-
}
|
|
16
|
-
|
|
17
7
|
export type UNOnLoadResponse<T> =
|
|
18
8
|
| UNOnLoadResponseData<T>
|
|
19
9
|
| UNError
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import EventBus from '../helpers/EventBus';
|
|
2
|
-
import { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';
|
|
3
1
|
import { UnitSDK } from './UnitSdkManager';
|
|
4
2
|
|
|
5
3
|
import { getUnitScriptUrl } from './UnitSdkManager.utils.internal';
|
|
4
|
+
import { store } from '../store/store';
|
|
5
|
+
import { setUnitScript, selectConfiguration } from '../slices/ConfigurationSlice';
|
|
6
6
|
|
|
7
7
|
let isLoadingScript = false;
|
|
8
8
|
|
|
9
|
-
/** globalUnitScript is exported ONLY to our project components **/
|
|
10
|
-
export let globalUnitScript = '';
|
|
11
|
-
|
|
12
9
|
export const fetchUnitScript = async () => {
|
|
10
|
+
const configurationState = selectConfiguration(store.getState());
|
|
11
|
+
const globalUnitScript = configurationState.unitScript;
|
|
13
12
|
const env = UnitSDK.getEnv();
|
|
14
13
|
const webVersioningStrategy = UnitSDK.getWebVersioningStrategy();
|
|
15
14
|
if (isLoadingScript || globalUnitScript || !env) {
|
|
@@ -21,9 +20,7 @@ export const fetchUnitScript = async () => {
|
|
|
21
20
|
const unitScriptRes = await fetch(getUnitScriptUrl(env, webVersioningStrategy));
|
|
22
21
|
const unitScript = await unitScriptRes.text();
|
|
23
22
|
if (unitScript) {
|
|
24
|
-
|
|
25
|
-
EventBus.Instance.event(SDKMessage.IS_SCRIPT_FETCHED, scriptFetchData);
|
|
26
|
-
globalUnitScript = unitScript;
|
|
23
|
+
store.dispatch(setUnitScript(unitScript));
|
|
27
24
|
}
|
|
28
25
|
return null;
|
|
29
26
|
} catch (e) {
|
|
@@ -3,7 +3,7 @@ import { UNVersioningStrategyType, UNWebVersioningStrategy } from '../types/shar
|
|
|
3
3
|
const WEB_SDK_RECOMMENDED_STRATEGY: UNWebVersioningStrategy = {
|
|
4
4
|
type: UNVersioningStrategyType.upToNextMinor,
|
|
5
5
|
major: 1,
|
|
6
|
-
minor:
|
|
6
|
+
minor: 3,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export const UNSDKConstants = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { NativeModules } from 'react-native';
|
|
2
|
-
import EventBus from '../helpers/EventBus';
|
|
3
|
-
import { SDKMessage } from '../messages/nativeMessages/sdkMessage';
|
|
4
2
|
import { fetchUnitScript } from './UnitSdk.api';
|
|
5
3
|
import { UnitUiManager } from './unitUiManager/unitUiManager';
|
|
6
4
|
import type { UNFonts } from '../types/shared/fonts.types';
|
|
7
5
|
import { warnClientIfNeeded } from '../utils/webVersioningStrategy.utils';
|
|
8
6
|
import { UNSDKConstants } from './UnitSdk.constants';
|
|
9
7
|
import type { UNWebVersioningStrategy } from '../types/shared';
|
|
8
|
+
import { setTheme, setLanguage } from '../slices/ConfigurationSlice';
|
|
9
|
+
import { store } from '../store/store';
|
|
10
10
|
|
|
11
11
|
export enum UNEnvironment {
|
|
12
12
|
sandbox = 'sandbox',
|
|
@@ -18,8 +18,6 @@ export class UnitSDK {
|
|
|
18
18
|
protected static env?: UNEnvironment;
|
|
19
19
|
protected static webVersioningStrategy: UNWebVersioningStrategy;
|
|
20
20
|
protected static customerToken?: string;
|
|
21
|
-
protected static theme?: string;
|
|
22
|
-
protected static language?: string;
|
|
23
21
|
protected static fonts?: UNFonts;
|
|
24
22
|
protected static signedNonce?: string;
|
|
25
23
|
protected static pushProvisionModule?: typeof NativeModules;
|
|
@@ -28,14 +26,12 @@ export class UnitSDK {
|
|
|
28
26
|
try {
|
|
29
27
|
this.env = env;
|
|
30
28
|
this.webVersioningStrategy = webVersioningStrategy;
|
|
31
|
-
this.theme = theme;
|
|
32
|
-
this.language = language;
|
|
33
29
|
this.fonts = fonts;
|
|
34
|
-
|
|
30
|
+
store.dispatch(setTheme(theme));
|
|
31
|
+
store.dispatch(setLanguage(language));
|
|
35
32
|
this.ui = new UnitUiManager();
|
|
36
33
|
warnClientIfNeeded(this.webVersioningStrategy);
|
|
37
34
|
await fetchUnitScript();
|
|
38
|
-
EventBus.Instance.event(SDKMessage.IS_SDK_INITIALIZED, {});
|
|
39
35
|
} catch (e) {
|
|
40
36
|
console.log(e);
|
|
41
37
|
}
|
|
@@ -50,8 +46,8 @@ export class UnitSDK {
|
|
|
50
46
|
};
|
|
51
47
|
|
|
52
48
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
* @deprecated - Unit SDK is managing the signedNonce, no need to provide it
|
|
50
|
+
*/
|
|
55
51
|
public static setSignedNonce = (signedNonce: string) => {
|
|
56
52
|
this.signedNonce = signedNonce;
|
|
57
53
|
};
|
|
@@ -64,21 +60,13 @@ export class UnitSDK {
|
|
|
64
60
|
return this.webVersioningStrategy;
|
|
65
61
|
};
|
|
66
62
|
|
|
67
|
-
public static getTheme = () => {
|
|
68
|
-
return this.theme;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
public static getLanguage = () => {
|
|
72
|
-
return this.language;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
63
|
public static getFonts = () => {
|
|
76
64
|
return this.fonts;
|
|
77
65
|
};
|
|
78
66
|
|
|
79
67
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
* @deprecated - Unit SDK is managing the signedNonce, no need to provide it
|
|
69
|
+
*/
|
|
82
70
|
public static getSignedNonce = () => {
|
|
83
71
|
return this.signedNonce;
|
|
84
72
|
};
|