react-native-unit-components 0.1.0 → 1.0.1
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/README.md +157 -2
- package/android/src/main/java/com/unitreactnativecomponents/UnitAddToWalletButtonViewManager.kt +27 -0
- package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsEvent.kt +21 -0
- package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsPackage.kt +2 -1
- package/android/src/main/java/com/unitreactnativecomponents/visapresentation/UNGooglePayView.kt +197 -0
- package/android/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/android/src/main/res/drawable/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable/un_black_googlepay_button_background.xml +6 -0
- package/android/src/main/res/drawable/un_black_googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable/un_black_googlepay_button_content.xml +48 -0
- package/android/src/main/res/drawable/un_black_googlepay_button_no_shadow_background.xml +6 -0
- package/android/src/main/res/drawable/un_black_googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable/un_black_googlepay_button_overlay.xml +12 -0
- package/android/src/main/res/drawable/un_border.xml +6 -0
- package/android/src/main/res/drawable/un_condensed_googlepay.xml +27 -0
- package/android/src/main/res/drawable/un_googlepay_button_background.xml +18 -0
- package/android/src/main/res/drawable/un_googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable/un_googlepay_button_background_image_focused.9.png +0 -0
- package/android/src/main/res/drawable/un_googlepay_button_background_image_pressed.9.png +0 -0
- package/android/src/main/res/drawable/un_googlepay_button_content.xml +48 -0
- package/android/src/main/res/drawable/un_googlepay_button_no_shadow_background.xml +18 -0
- package/android/src/main/res/drawable/un_googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable/un_googlepay_button_no_shadow_background_image_focused.9.png +0 -0
- package/android/src/main/res/drawable/un_googlepay_button_no_shadow_background_image_pressed.9.png +0 -0
- package/android/src/main/res/drawable/un_googlepay_button_overlay.xml +11 -0
- package/android/src/main/res/drawable/un_ic_launcher_foreground.xml +30 -0
- package/android/src/main/res/drawable/un_ic_unit_logo.xml +25 -0
- package/android/src/main/res/drawable/un_ic_visa.xml +13 -0
- package/android/src/main/res/drawable-bg/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-bg/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-ca/un_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-ca/un_black_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-cs/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-cs/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-da/un_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-da/un_black_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-de/un_add_to_googlepay_button_content.xml +60 -0
- package/android/src/main/res/drawable-de/un_black_add_to_googlepay_button_content.xml +60 -0
- package/android/src/main/res/drawable-el/un_add_to_googlepay_button_content.xml +67 -0
- package/android/src/main/res/drawable-el/un_black_add_to_googlepay_button_content.xml +67 -0
- package/android/src/main/res/drawable-es/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-es/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-et/un_add_to_googlepay_button_content.xml +64 -0
- package/android/src/main/res/drawable-et/un_black_add_to_googlepay_button_content.xml +64 -0
- package/android/src/main/res/drawable-fi/un_add_to_googlepay_button_content.xml +39 -0
- package/android/src/main/res/drawable-fi/un_black_add_to_googlepay_button_content.xml +39 -0
- package/android/src/main/res/drawable-fr/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-fr/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-hr/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-hr/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-hu/un_add_to_googlepay_button_content.xml +64 -0
- package/android/src/main/res/drawable-hu/un_black_add_to_googlepay_button_content.xml +64 -0
- package/android/src/main/res/drawable-in/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-in/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-it/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-it/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-iw/un_add_to_googlepay_button_content.xml +41 -0
- package/android/src/main/res/drawable-iw/un_black_add_to_googlepay_button_content.xml +41 -0
- package/android/src/main/res/drawable-ja/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-ja/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-ko/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-ko/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-lt/un_add_to_googlepay_button_content.xml +70 -0
- package/android/src/main/res/drawable-lt/un_black_add_to_googlepay_button_content.xml +70 -0
- package/android/src/main/res/drawable-lv/un_add_to_googlepay_button_content.xml +61 -0
- package/android/src/main/res/drawable-lv/un_black_add_to_googlepay_button_content.xml +61 -0
- package/android/src/main/res/drawable-ms/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-ms/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-nb/un_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-nb/un_black_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-nl/un_add_to_googlepay_button_content.xml +58 -0
- package/android/src/main/res/drawable-nl/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-pl/un_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-pl/un_black_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-pt/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-pt/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-ro/un_add_to_googlepay_button_content.xml +58 -0
- package/android/src/main/res/drawable-ro/un_black_add_to_googlepay_button_content.xml +58 -0
- package/android/src/main/res/drawable-ru/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-ru/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-sk/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-sk/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-sl/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-sl/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-sr/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-sr/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-sv/un_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-sv/un_black_add_to_googlepay_button_content.xml +30 -0
- package/android/src/main/res/drawable-th/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-th/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-tr/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-tr/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-uk/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-uk/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-v21/un_black_googlepay_button_background.xml +7 -0
- package/android/src/main/res/drawable-v21/un_black_googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-v21/un_black_googlepay_button_no_shadow_background.xml +7 -0
- package/android/src/main/res/drawable-v21/un_black_googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-v24/ic_launcher_background.xml +170 -0
- package/android/src/main/res/drawable-v24/un_border.xml +6 -0
- package/android/src/main/res/drawable-v24/un_ic_launcher_foreground.xml +30 -0
- package/android/src/main/res/drawable-v24/un_ic_unit_logo.xml +25 -0
- package/android/src/main/res/drawable-v24/un_ic_visa.xml +13 -0
- package/android/src/main/res/drawable-zh/un_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/drawable-zh/un_black_add_to_googlepay_button_content.xml +54 -0
- package/android/src/main/res/layout/un_black_add_to_googlepay_button.xml +32 -0
- package/android/src/main/res/layout/un_view_google_push_provisioning.xml +45 -0
- package/android/src/main/res/layout/un_white_add_to_googlepay_button.xml +31 -0
- package/android/src/main/res/layout/un_white_add_to_googlepay_button_no_shadow.xml +31 -0
- package/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xhdpi/black_googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/black_googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/googlepay_button_background_image_focused.9.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/googlepay_button_background_image_pressed.9.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/googlepay_button_no_shadow_background_image_focused.9.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/googlepay_button_no_shadow_background_image_pressed.9.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xhdpi/white_googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/black_googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/black_googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/googlepay_button_background_image_focused.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/googlepay_button_background_image_pressed.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/googlepay_button_no_shadow_background_image_focused.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/googlepay_button_no_shadow_background_image_pressed.9.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/black_googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/black_googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_background_image_focused.9.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_background_image_pressed.9.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_no_shadow_background_image_focused.9.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_no_shadow_background_image_pressed.9.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/values/colors.xml +14 -0
- package/android/src/main/res/values/googlepay_strings.xml +7 -0
- package/android/src/main/res/values/strings.xml +4 -0
- package/android/src/main/res/values/themes.xml +16 -0
- package/android/src/main/res/values-night/themes.xml +16 -0
- package/ios/UnitReactNativeComponents.xcodeproj/project.pbxproj +8 -8
- package/ios/UnitReactNativeComponentsViewManager.m +3 -2
- package/ios/UnitReactNativeComponentsViewManager.swift +39 -25
- package/lib/commonjs/assets/images/close.png +0 -0
- package/lib/commonjs/assets/images/index.js +16 -0
- package/lib/commonjs/assets/images/index.js.map +1 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +28 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +20 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +39 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +40 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +9 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +195 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js +23 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js.map +1 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +49 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -0
- package/lib/commonjs/components/{Card/CardComponent.js → UNCardComponent/UNCardComponent.js} +42 -46
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -0
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +42 -0
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -0
- package/lib/commonjs/components/index.js +34 -8
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/custom.d.js +2 -0
- package/lib/commonjs/custom.d.js.map +1 -0
- package/lib/commonjs/helpers/{BottomSheet.js → BottomSheet/BottomSheet.js} +38 -83
- package/lib/commonjs/helpers/BottomSheet/BottomSheet.js.map +1 -0
- package/lib/commonjs/helpers/BottomSheet/BottomSheet.styles.js +82 -0
- package/lib/commonjs/helpers/BottomSheet/BottomSheet.styles.js.map +1 -0
- package/lib/commonjs/helpers/EventBus.js +5 -13
- package/lib/commonjs/helpers/EventBus.js.map +1 -1
- package/lib/commonjs/hooks/listenerToBus.js +31 -0
- package/lib/commonjs/hooks/listenerToBus.js.map +1 -0
- package/lib/commonjs/hooks/useAppStateListener.js +34 -0
- package/lib/commonjs/hooks/useAppStateListener.js.map +1 -0
- package/lib/commonjs/index.js +33 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/messages/nativeMessages/index.js +13 -0
- package/lib/commonjs/messages/nativeMessages/index.js.map +1 -0
- package/lib/commonjs/messages/webMessages/bookPaymentMessage.js +13 -0
- package/lib/commonjs/messages/webMessages/bookPaymentMessage.js.map +1 -0
- package/lib/commonjs/{webComponent → messages}/webMessages/cardMessage.js +1 -1
- package/lib/commonjs/messages/webMessages/cardMessage.js.map +1 -0
- package/lib/commonjs/messages/webMessages/index.js +6 -0
- package/lib/commonjs/messages/webMessages/index.js.map +1 -0
- package/lib/commonjs/{webComponent → messages}/webMessages/pageMessage.js +0 -0
- package/lib/commonjs/messages/webMessages/pageMessage.js.map +1 -0
- package/lib/commonjs/{webComponent → messages}/webMessages/unitMessages.js +0 -0
- package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -0
- package/lib/commonjs/nativeComponent/UNNativeAddToWalletButton.js +13 -0
- package/lib/commonjs/nativeComponent/UNNativeAddToWalletButton.js.map +1 -0
- package/lib/commonjs/scripts/html/bodyHtml.js +52 -0
- package/lib/commonjs/scripts/html/bodyHtml.js.map +1 -0
- package/lib/commonjs/scripts/html/bodyScript.js +78 -0
- package/lib/commonjs/scripts/html/bodyScript.js.map +1 -0
- package/lib/commonjs/sharedTypes/bookPayment.types.js +6 -0
- package/lib/commonjs/sharedTypes/bookPayment.types.js.map +1 -0
- package/lib/commonjs/sharedTypes/card.types.js +6 -0
- package/lib/commonjs/sharedTypes/card.types.js.map +1 -0
- package/lib/commonjs/sharedTypes/index.js +32 -0
- package/lib/commonjs/sharedTypes/index.js.map +1 -0
- package/lib/commonjs/sharedTypes/types.js +2 -0
- package/lib/commonjs/sharedTypes/types.js.map +1 -0
- package/lib/commonjs/styles/variables.js +17 -0
- package/lib/commonjs/styles/variables.js.map +1 -0
- package/lib/commonjs/unitSdkManager/UnitSdk.api.js +54 -0
- package/lib/commonjs/unitSdkManager/UnitSdk.api.js.map +1 -0
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js +51 -0
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -0
- package/lib/commonjs/webComponent/WebComponent.js +47 -15
- package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
- package/lib/commonjs/webComponent/html.js +22 -45
- package/lib/commonjs/webComponent/html.js.map +1 -1
- package/lib/module/assets/images/close.png +0 -0
- package/lib/module/assets/images/index.js +2 -0
- package/lib/module/assets/images/index.js.map +1 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js +13 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +10 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +23 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +26 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +2 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +163 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js +13 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js.map +1 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +29 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.js +65 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +24 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -0
- package/lib/module/components/index.js +4 -2
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/custom.d.js +2 -0
- package/lib/module/custom.d.js.map +1 -0
- package/lib/module/helpers/{BottomSheet.js → BottomSheet/BottomSheet.js} +36 -82
- package/lib/module/helpers/BottomSheet/BottomSheet.js.map +1 -0
- package/lib/module/helpers/BottomSheet/BottomSheet.styles.js +70 -0
- package/lib/module/helpers/BottomSheet/BottomSheet.styles.js.map +1 -0
- package/lib/module/helpers/EventBus.js +4 -11
- package/lib/module/helpers/EventBus.js.map +1 -1
- package/lib/module/hooks/listenerToBus.js +18 -0
- package/lib/module/hooks/listenerToBus.js.map +1 -0
- package/lib/module/hooks/useAppStateListener.js +23 -0
- package/lib/module/hooks/useAppStateListener.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/messages/nativeMessages/index.js +6 -0
- package/lib/module/messages/nativeMessages/index.js.map +1 -0
- package/lib/module/messages/webMessages/bookPaymentMessage.js +6 -0
- package/lib/module/messages/webMessages/bookPaymentMessage.js.map +1 -0
- package/lib/module/messages/webMessages/cardMessage.js +6 -0
- package/lib/module/messages/webMessages/cardMessage.js.map +1 -0
- package/lib/module/messages/webMessages/index.js +2 -0
- package/lib/module/messages/webMessages/index.js.map +1 -0
- package/lib/module/{webComponent → messages}/webMessages/pageMessage.js +0 -0
- package/lib/module/messages/webMessages/pageMessage.js.map +1 -0
- package/lib/module/{webComponent → messages}/webMessages/unitMessages.js +0 -0
- package/lib/module/messages/webMessages/unitMessages.js.map +1 -0
- package/lib/module/nativeComponent/UNNativeAddToWalletButton.js +4 -0
- package/lib/module/nativeComponent/UNNativeAddToWalletButton.js.map +1 -0
- package/lib/module/scripts/html/bodyHtml.js +42 -0
- package/lib/module/scripts/html/bodyHtml.js.map +1 -0
- package/lib/module/scripts/html/bodyScript.js +64 -0
- package/lib/module/scripts/html/bodyScript.js.map +1 -0
- package/lib/module/sharedTypes/bookPayment.types.js +2 -0
- package/lib/module/sharedTypes/bookPayment.types.js.map +1 -0
- package/lib/module/sharedTypes/card.types.js +2 -0
- package/lib/module/sharedTypes/card.types.js.map +1 -0
- package/lib/module/sharedTypes/index.js +3 -0
- package/lib/module/sharedTypes/index.js.map +1 -0
- package/lib/module/sharedTypes/types.js +2 -0
- package/lib/module/sharedTypes/types.js.map +1 -0
- package/lib/module/styles/variables.js +10 -0
- package/lib/module/styles/variables.js.map +1 -0
- package/lib/module/unitSdkManager/UnitSdk.api.js +37 -0
- package/lib/module/unitSdkManager/UnitSdk.api.js.map +1 -0
- package/lib/module/unitSdkManager/UnitSdkManager.js +38 -0
- package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -0
- package/lib/module/webComponent/WebComponent.js +46 -14
- package/lib/module/webComponent/WebComponent.js.map +1 -1
- package/lib/module/webComponent/html.js +18 -44
- package/lib/module/webComponent/html.js.map +1 -1
- package/lib/typescript/assets/images/index.d.ts +1 -0
- package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +6 -0
- package/lib/typescript/components/UNActivityComponent/UNActivityComponent.utils.d.ts +2 -0
- package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +11 -0
- package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.d.ts +3 -0
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +1 -0
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +7 -0
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.d.ts +9 -0
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +5 -0
- package/lib/typescript/components/{Card/CardComponent.d.ts → UNCardComponent/UNCardComponent.d.ts} +3 -1
- package/lib/typescript/components/UNCardComponent/UNCardComponent.utils.d.ts +6 -0
- package/lib/typescript/components/index.d.ts +4 -2
- package/lib/typescript/helpers/{BottomSheet.d.ts → BottomSheet/BottomSheet.d.ts} +3 -0
- package/lib/typescript/helpers/BottomSheet/BottomSheet.styles.d.ts +63 -0
- package/lib/typescript/helpers/EventBus.d.ts +5 -7
- package/lib/typescript/hooks/listenerToBus.d.ts +7 -0
- package/lib/typescript/hooks/useAppStateListener.d.ts +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/messages/nativeMessages/index.d.ts +3 -0
- package/lib/typescript/messages/webMessages/bookPaymentMessage.d.ts +8 -0
- package/lib/typescript/{webComponent → messages}/webMessages/cardMessage.d.ts +3 -2
- package/lib/typescript/messages/webMessages/index.d.ts +11 -0
- package/lib/typescript/{webComponent → messages}/webMessages/pageMessage.d.ts +0 -0
- package/lib/typescript/{webComponent → messages}/webMessages/unitMessages.d.ts +0 -0
- package/lib/typescript/nativeComponent/UNNativeAddToWalletButton.d.ts +6 -0
- package/lib/typescript/scripts/html/bodyHtml.d.ts +7 -0
- package/lib/typescript/scripts/html/bodyScript.d.ts +11 -0
- package/lib/typescript/sharedTypes/bookPayment.types.d.ts +26 -0
- package/lib/typescript/sharedTypes/card.types.d.ts +56 -0
- package/lib/typescript/sharedTypes/index.d.ts +2 -0
- package/lib/typescript/sharedTypes/types.d.ts +27 -0
- package/lib/typescript/styles/variables.d.ts +9 -0
- package/lib/typescript/unitSdkManager/UnitSdk.api.d.ts +3 -0
- package/lib/typescript/unitSdkManager/UnitSdkManager.d.ts +15 -0
- package/lib/typescript/webComponent/WebComponent.d.ts +9 -11
- package/lib/typescript/webComponent/html.d.ts +6 -1
- package/package.json +9 -5
- package/{unit-react-native-components.podspec → react-native-unit-components.podspec} +1 -1
- package/src/assets/images/close.png +0 -0
- package/src/assets/images/index.ts +1 -0
- package/src/components/UNActivityComponent/UNActivityComponent.tsx +21 -0
- package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +11 -0
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +37 -0
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.ts +29 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.ts +1 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.ts +13 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +167 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +34 -0
- package/src/components/UNCardComponent/UNCardComponent.tsx +73 -0
- package/src/components/UNCardComponent/UNCardComponent.utils.ts +28 -0
- package/src/components/index.ts +4 -2
- package/src/custom.d.ts +5 -0
- package/src/helpers/BottomSheet/BottomSheet.styles.ts +70 -0
- package/src/helpers/{BottomSheet.tsx → BottomSheet/BottomSheet.tsx} +74 -110
- package/src/helpers/EventBus.ts +13 -13
- package/src/hooks/listenerToBus.ts +23 -0
- package/src/hooks/useAppStateListener.ts +25 -0
- package/src/index.tsx +5 -1
- package/src/messages/nativeMessages/index.ts +3 -0
- package/src/messages/webMessages/bookPaymentMessage.ts +12 -0
- package/src/{webComponent → messages}/webMessages/cardMessage.ts +4 -2
- package/src/messages/webMessages/index.ts +21 -0
- package/src/{webComponent → messages}/webMessages/pageMessage.ts +1 -1
- package/src/{webComponent → messages}/webMessages/unitMessages.ts +1 -0
- package/src/nativeComponent/UNNativeAddToWalletButton.tsx +12 -0
- package/src/scripts/html/bodyHtml.ts +46 -0
- package/src/scripts/html/bodyScript.ts +67 -0
- package/src/sharedTypes/bookPayment.types.ts +27 -0
- package/src/sharedTypes/card.types.ts +59 -0
- package/src/sharedTypes/index.ts +2 -0
- package/src/sharedTypes/types.ts +35 -0
- package/src/styles/variables.ts +9 -0
- package/src/unitSdkManager/UnitSdk.api.ts +31 -0
- package/src/unitSdkManager/UnitSdkManager.ts +33 -0
- package/src/webComponent/WebComponent.tsx +55 -45
- package/src/webComponent/html.ts +22 -46
- package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsViewManager.kt +0 -19
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +0 -143
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js.map +0 -1
- package/lib/commonjs/components/Card/CardComponent.js.map +0 -1
- package/lib/commonjs/helpers/BottomSheet.js.map +0 -1
- package/lib/commonjs/nativeComponenet/NativeComponentExample.js +0 -19
- package/lib/commonjs/nativeComponenet/NativeComponentExample.js.map +0 -1
- package/lib/commonjs/webComponent/webMessages/cardMessage.js.map +0 -1
- package/lib/commonjs/webComponent/webMessages/pageMessage.js.map +0 -1
- package/lib/commonjs/webComponent/webMessages/unitMessages.js.map +0 -1
- package/lib/module/components/BottomSheet/BottomSheetComponent.js +0 -118
- package/lib/module/components/BottomSheet/BottomSheetComponent.js.map +0 -1
- package/lib/module/components/Card/CardComponent.js +0 -75
- package/lib/module/components/Card/CardComponent.js.map +0 -1
- package/lib/module/helpers/BottomSheet.js.map +0 -1
- package/lib/module/nativeComponenet/NativeComponentExample.js +0 -10
- package/lib/module/nativeComponenet/NativeComponentExample.js.map +0 -1
- package/lib/module/webComponent/webMessages/cardMessage.js +0 -6
- package/lib/module/webComponent/webMessages/cardMessage.js.map +0 -1
- package/lib/module/webComponent/webMessages/pageMessage.js.map +0 -1
- package/lib/module/webComponent/webMessages/unitMessages.js.map +0 -1
- package/lib/typescript/components/BottomSheet/BottomSheetComponent.d.ts +0 -1
- package/lib/typescript/nativeComponenet/NativeComponentExample.d.ts +0 -7
- package/src/components/BottomSheet/BottomSheetComponent.tsx +0 -113
- package/src/components/Card/CardComponent.tsx +0 -75
- package/src/nativeComponenet/NativeComponentExample.tsx +0 -26
|
@@ -4,14 +4,17 @@ import {
|
|
|
4
4
|
BackHandler,
|
|
5
5
|
Dimensions,
|
|
6
6
|
Easing,
|
|
7
|
-
|
|
7
|
+
Image,
|
|
8
|
+
KeyboardAvoidingView,
|
|
8
9
|
LayoutChangeEvent,
|
|
9
10
|
PanResponder,
|
|
10
|
-
StyleSheet,
|
|
11
11
|
TouchableOpacity,
|
|
12
12
|
View,
|
|
13
13
|
} from 'react-native';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
|
+
import { CloseIcon } from '../../assets/images';
|
|
16
|
+
import { BOTTOM_SHEET_MAX_PRECANTAGE_SIZE } from '../../components/UNBottomSheetComponent/UNBottomSheetComponent.constants';
|
|
17
|
+
import { getStylesObject } from './BottomSheet.styles';
|
|
15
18
|
|
|
16
19
|
export interface BottomSheetProps {
|
|
17
20
|
isOpen: boolean
|
|
@@ -19,69 +22,75 @@ export interface BottomSheetProps {
|
|
|
19
22
|
sliderMaxHeight: number
|
|
20
23
|
onOpen: () => void
|
|
21
24
|
onClose: () => void
|
|
25
|
+
height: number,
|
|
22
26
|
animationDuration: number,
|
|
23
27
|
expandToMaxHeightEnabled: boolean
|
|
28
|
+
handleWebViewScroll: () => void
|
|
29
|
+
shouldEnableBottomSheetScroll: boolean
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
const BottomSheet = (props: BottomSheetProps) => {
|
|
27
33
|
const panelHeightValue = useRef(new Animated.Value(props.sliderMaxHeight)).current;
|
|
28
34
|
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
35
|
+
const styles = getStylesObject(fadeAnim);
|
|
36
|
+
const [isPanelOpened, setIsPanelOpened] = useState(props.isOpen);
|
|
37
|
+
const [contentHeight, setContentHeight] = useState<number | undefined>(undefined);
|
|
29
38
|
|
|
30
|
-
const [
|
|
31
|
-
const [contentHeight, setContentHeight] = useState<number | undefined>(undefined)
|
|
39
|
+
const [currentHeight, setCurrentHeight] = useState<number>(props.sliderMaxHeight);
|
|
32
40
|
|
|
33
|
-
const [
|
|
34
|
-
|
|
35
|
-
const [dy, setDy] = useState(0)
|
|
41
|
+
const [dy, setDy] = useState(0);
|
|
36
42
|
|
|
37
43
|
const _parentPanResponder = PanResponder.create({
|
|
38
44
|
onMoveShouldSetPanResponderCapture: (_, gestureState) => {
|
|
39
|
-
return Math.abs(gestureState.dy) > 10
|
|
45
|
+
return props.shouldEnableBottomSheetScroll && Math.abs(gestureState.dy) > 10;
|
|
40
46
|
},
|
|
41
47
|
onPanResponderMove(_, gestureState) {
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
if (props.shouldEnableBottomSheetScroll && gestureState.dy < 5) {
|
|
49
|
+
props.handleWebViewScroll();
|
|
50
|
+
}
|
|
51
|
+
if (currentHeight + gestureState.dy < 0) return;
|
|
52
|
+
if (!props.expandToMaxHeightEnabled && contentHeight && currentHeight + gestureState.dy < sliderMaxHeight - contentHeight) return;
|
|
53
|
+
panelHeightValue.setValue(currentHeight + gestureState.dy);
|
|
54
|
+
setDy(gestureState.dy);
|
|
46
55
|
},
|
|
47
56
|
onPanResponderRelease: () => {
|
|
48
57
|
if (dy > 0) {
|
|
49
|
-
collapse()
|
|
58
|
+
collapse();
|
|
50
59
|
} else if (!props.expandToMaxHeightEnabled) {
|
|
51
|
-
setToContentHeight(contentHeight
|
|
60
|
+
contentHeight && setToContentHeight(contentHeight);
|
|
52
61
|
} else if (dy < 0) {
|
|
53
|
-
expand()
|
|
62
|
+
expand();
|
|
54
63
|
} else {
|
|
55
|
-
expand()
|
|
64
|
+
expand();
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
});
|
|
59
68
|
|
|
60
69
|
useEffect(() => {
|
|
61
70
|
if (props.isOpen && !isPanelOpened) {
|
|
62
|
-
fadeIn()
|
|
71
|
+
fadeIn();
|
|
63
72
|
} else if (isPanelOpened) {
|
|
64
|
-
setContentHeight(0)
|
|
65
|
-
_dismiss()
|
|
73
|
+
setContentHeight(0);
|
|
74
|
+
_dismiss();
|
|
66
75
|
}
|
|
67
|
-
}, [props.isOpen])
|
|
76
|
+
}, [props.isOpen]);
|
|
68
77
|
|
|
69
78
|
useEffect(() => {
|
|
70
79
|
BackHandler.addEventListener('hardwareBackPress', _onBackPress);
|
|
71
|
-
const id = panelHeightValue.addListener(e => setCurrentHeight(e.value))
|
|
80
|
+
const id = panelHeightValue.addListener(e => setCurrentHeight(e.value));
|
|
72
81
|
|
|
73
82
|
return (() => {
|
|
74
83
|
BackHandler.removeEventListener('hardwareBackPress', _onBackPress);
|
|
75
|
-
panelHeightValue.removeListener(id)
|
|
76
|
-
})
|
|
77
|
-
}, [])
|
|
84
|
+
panelHeightValue.removeListener(id);
|
|
85
|
+
});
|
|
86
|
+
}, []);
|
|
78
87
|
|
|
79
88
|
const fadeIn = () => {
|
|
80
89
|
Animated.timing(fadeAnim, {
|
|
81
90
|
toValue: 0.3,
|
|
82
91
|
duration: 500,
|
|
83
92
|
useNativeDriver: false
|
|
84
|
-
}).start(() => { setIsPanelOpened(true) });
|
|
93
|
+
}).start(() => { setIsPanelOpened(true); });
|
|
85
94
|
};
|
|
86
95
|
|
|
87
96
|
const fadeOut = () => {
|
|
@@ -90,8 +99,8 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
90
99
|
duration: 500,
|
|
91
100
|
useNativeDriver: false
|
|
92
101
|
}).start(() => {
|
|
93
|
-
setIsPanelOpened(false)
|
|
94
|
-
props.onClose()
|
|
102
|
+
setIsPanelOpened(false);
|
|
103
|
+
props.onClose();
|
|
95
104
|
});
|
|
96
105
|
};
|
|
97
106
|
|
|
@@ -99,17 +108,17 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
99
108
|
Animated.timing(panelHeightValue, {
|
|
100
109
|
duration: props.animationDuration,
|
|
101
110
|
easing: Easing.quad,
|
|
102
|
-
toValue: sliderMaxHeight - contentHeight
|
|
111
|
+
toValue: sliderMaxHeight - contentHeight,
|
|
103
112
|
useNativeDriver: false,
|
|
104
|
-
}).start()
|
|
105
|
-
}
|
|
113
|
+
}).start();
|
|
114
|
+
};
|
|
106
115
|
|
|
107
116
|
const expand = () => {
|
|
108
117
|
const { animationDuration } = props;
|
|
109
118
|
|
|
110
|
-
if (currentHeight > (sliderMaxHeight - contentHeight
|
|
111
|
-
setToContentHeight(contentHeight
|
|
112
|
-
return
|
|
119
|
+
if (contentHeight && currentHeight > (sliderMaxHeight - contentHeight)) {
|
|
120
|
+
setToContentHeight(contentHeight);
|
|
121
|
+
return;
|
|
113
122
|
}
|
|
114
123
|
|
|
115
124
|
Animated.timing(panelHeightValue, {
|
|
@@ -117,32 +126,16 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
117
126
|
easing: Easing.quad,
|
|
118
127
|
toValue: 0,
|
|
119
128
|
useNativeDriver: false,
|
|
120
|
-
}).start()
|
|
121
|
-
}
|
|
129
|
+
}).start();
|
|
130
|
+
};
|
|
122
131
|
|
|
123
132
|
const collapse = () => {
|
|
124
|
-
if (currentHeight > (sliderMaxHeight - contentHeight
|
|
125
|
-
_dismiss()
|
|
126
|
-
return
|
|
133
|
+
if (contentHeight && currentHeight > (sliderMaxHeight - contentHeight)) {
|
|
134
|
+
_dismiss();
|
|
135
|
+
return;
|
|
127
136
|
}
|
|
128
137
|
|
|
129
|
-
setToContentHeight(contentHeight
|
|
130
|
-
|
|
131
|
-
// Animated.timing(panelHeightValue, {
|
|
132
|
-
// duration: animationDuration,
|
|
133
|
-
// easing: Easing.quad,
|
|
134
|
-
// toValue: sliderMaxHeight - contentHeight!,
|
|
135
|
-
// useNativeDriver: false,
|
|
136
|
-
// }).start(() => {
|
|
137
|
-
// const isPanelOpenedNewValue = !isPanelOpened
|
|
138
|
-
// setIsPanelOpened(isPanelOpenedNewValue)
|
|
139
|
-
// if (isPanelOpenedNewValue) {
|
|
140
|
-
// // onOpen();
|
|
141
|
-
// } else {
|
|
142
|
-
// // onClose();
|
|
143
|
-
// Keyboard.dismiss();
|
|
144
|
-
// }
|
|
145
|
-
// });
|
|
138
|
+
contentHeight && setToContentHeight(contentHeight);
|
|
146
139
|
};
|
|
147
140
|
|
|
148
141
|
const _onBackPress = () => {
|
|
@@ -151,24 +144,24 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
151
144
|
};
|
|
152
145
|
|
|
153
146
|
const _setSize = (e: LayoutChangeEvent) => {
|
|
154
|
-
|
|
155
|
-
if (newContentHeight !== 0) newContentHeight += 42;
|
|
147
|
+
const newContentHeight = e.nativeEvent.layout.height;
|
|
156
148
|
|
|
157
|
-
setContentHeight(newContentHeight)
|
|
158
|
-
setToContentHeight(newContentHeight)
|
|
149
|
+
setContentHeight(newContentHeight);
|
|
150
|
+
setToContentHeight(newContentHeight);
|
|
159
151
|
};
|
|
160
152
|
|
|
161
153
|
const _dismiss = () => {
|
|
162
|
-
const { animationDuration } = props
|
|
154
|
+
const { animationDuration } = props;
|
|
163
155
|
Animated.timing(panelHeightValue, {
|
|
164
156
|
duration: animationDuration,
|
|
165
157
|
easing: Easing.quad,
|
|
166
158
|
toValue: sliderMaxHeight,
|
|
167
159
|
useNativeDriver: false,
|
|
168
160
|
}).start(() => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
161
|
+
null;
|
|
162
|
+
});
|
|
163
|
+
fadeOut();
|
|
164
|
+
};
|
|
172
165
|
|
|
173
166
|
const {
|
|
174
167
|
sliderMaxHeight,
|
|
@@ -178,11 +171,11 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
178
171
|
return (
|
|
179
172
|
<>
|
|
180
173
|
<TouchableOpacity
|
|
181
|
-
style={
|
|
174
|
+
style={styles.outsideContainer} activeOpacity={1}
|
|
182
175
|
onPress={_dismiss}
|
|
183
176
|
>
|
|
184
177
|
<Animated.View
|
|
185
|
-
style={
|
|
178
|
+
style={styles.animation}
|
|
186
179
|
>
|
|
187
180
|
</Animated.View>
|
|
188
181
|
</TouchableOpacity>
|
|
@@ -199,22 +192,30 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
199
192
|
<View
|
|
200
193
|
style={styles.outerContent}
|
|
201
194
|
>
|
|
202
|
-
<TouchableOpacity
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
195
|
+
<TouchableOpacity
|
|
196
|
+
activeOpacity={1}
|
|
197
|
+
style={styles.closeButton}
|
|
198
|
+
onPress={_dismiss}
|
|
199
|
+
>
|
|
200
|
+
<Image source={CloseIcon} />
|
|
206
201
|
</TouchableOpacity>
|
|
202
|
+
|
|
207
203
|
<View
|
|
208
204
|
onLayout={_setSize}
|
|
209
|
-
style={[styles.innerContent]}
|
|
210
205
|
>
|
|
211
|
-
|
|
206
|
+
<KeyboardAvoidingView
|
|
207
|
+
behavior="padding"
|
|
208
|
+
style={{ height: props.height }}
|
|
209
|
+
keyboardVerticalOffset={props.height * (1 - BOTTOM_SHEET_MAX_PRECANTAGE_SIZE)}
|
|
210
|
+
>
|
|
211
|
+
{children}
|
|
212
|
+
</KeyboardAvoidingView>
|
|
212
213
|
</View>
|
|
213
214
|
</View>
|
|
214
215
|
</Animated.View>
|
|
215
216
|
</>
|
|
216
217
|
);
|
|
217
|
-
}
|
|
218
|
+
};
|
|
218
219
|
|
|
219
220
|
BottomSheet.propTypes = {
|
|
220
221
|
children: PropTypes.oneOfType([PropTypes.node]),
|
|
@@ -230,48 +231,11 @@ BottomSheet.propTypes = {
|
|
|
230
231
|
BottomSheet.defaultProps = {
|
|
231
232
|
children: <View />,
|
|
232
233
|
isOpen: true,
|
|
233
|
-
sliderMaxHeight: Dimensions.get('window').height *
|
|
234
|
+
sliderMaxHeight: Dimensions.get('window').height * BOTTOM_SHEET_MAX_PRECANTAGE_SIZE,
|
|
234
235
|
animationDuration: 200,
|
|
235
236
|
onOpen: () => null,
|
|
236
237
|
onClose: () => null,
|
|
237
238
|
expandToMaxHeightEnabled: false
|
|
238
239
|
};
|
|
239
240
|
|
|
240
|
-
const styles = StyleSheet.create({
|
|
241
|
-
container: {
|
|
242
|
-
flex: 1,
|
|
243
|
-
marginTop: 60,
|
|
244
|
-
paddingHorizontal: 12,
|
|
245
|
-
shadowColor: '#000000',
|
|
246
|
-
shadowOffset: {
|
|
247
|
-
width: 0,
|
|
248
|
-
height: 6,
|
|
249
|
-
},
|
|
250
|
-
shadowOpacity: 0.37,
|
|
251
|
-
shadowRadius: 7.49,
|
|
252
|
-
elevation: 12,
|
|
253
|
-
borderTopLeftRadius: 15,
|
|
254
|
-
borderTopRightRadius: 15,
|
|
255
|
-
backgroundColor: '#ffffff',
|
|
256
|
-
},
|
|
257
|
-
lineContainer: {
|
|
258
|
-
borderTopLeftRadius: 30,
|
|
259
|
-
borderTopRightRadius: 30,
|
|
260
|
-
alignItems: 'center'
|
|
261
|
-
},
|
|
262
|
-
line: {
|
|
263
|
-
width: 35,
|
|
264
|
-
height: 4,
|
|
265
|
-
borderRadius: 2,
|
|
266
|
-
marginTop: 18,
|
|
267
|
-
backgroundColor: '#D5DDE0',
|
|
268
|
-
},
|
|
269
|
-
outerContent: {
|
|
270
|
-
flex: -1,
|
|
271
|
-
},
|
|
272
|
-
innerContent: {
|
|
273
|
-
flex: -1,
|
|
274
|
-
},
|
|
275
|
-
});
|
|
276
|
-
|
|
277
241
|
export default BottomSheet;
|
package/src/helpers/EventBus.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import type { NativeMessage } from '../messages/nativeMessages';
|
|
3
|
+
import type { WebViewMessageType } from '../messages/webMessages';
|
|
4
|
+
|
|
5
|
+
export type BusEventKey = NativeMessage | WebViewMessageType
|
|
6
6
|
|
|
7
7
|
export default class EventBus {
|
|
8
8
|
private static _instance: EventBus;
|
|
9
9
|
|
|
10
|
-
private eventListeners: { [name: string]: Array<(data: any) => void> } = {}
|
|
10
|
+
private eventListeners: { [name: string]: Array<(data: any) => void> } = {};
|
|
11
11
|
|
|
12
12
|
private constructor() {
|
|
13
13
|
this.eventListeners = {};
|
|
@@ -17,19 +17,19 @@ export default class EventBus {
|
|
|
17
17
|
return this._instance || (this._instance = new this());
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
public event(event:
|
|
21
|
-
|
|
20
|
+
public event(event: BusEventKey, data: any) {
|
|
21
|
+
const listeners = this.eventListeners[event.valueOf()];
|
|
22
22
|
if (Array.isArray(listeners)) {
|
|
23
23
|
listeners.map(listener => {
|
|
24
24
|
if (typeof listener === 'function') {
|
|
25
25
|
listener(data);
|
|
26
26
|
}
|
|
27
|
-
})
|
|
27
|
+
});
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
public addListener(event:
|
|
32
|
-
|
|
31
|
+
public addListener(event: BusEventKey, listener: (data: any) => void) {
|
|
32
|
+
const listeners = this.eventListeners[event.valueOf()];
|
|
33
33
|
if (Array.isArray(listeners)) {
|
|
34
34
|
listeners.push(listener);
|
|
35
35
|
} else {
|
|
@@ -39,14 +39,14 @@ export default class EventBus {
|
|
|
39
39
|
|
|
40
40
|
public removeListener(listener: (data: any) => void) {
|
|
41
41
|
Object.keys(this.eventListeners).map(eventName => {
|
|
42
|
-
|
|
42
|
+
const listeners = this.eventListeners[eventName];
|
|
43
43
|
if (listeners) {
|
|
44
44
|
this._remove(listeners, listener);
|
|
45
45
|
if (listeners.length === 0) {
|
|
46
46
|
delete this.eventListeners[eventName];
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
})
|
|
49
|
+
});
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
private _remove(array: Array<(data: any) => void>, item: (data: string) => void) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import EventBus, { BusEventKey } from '../helpers/EventBus';
|
|
4
|
+
|
|
5
|
+
type Listener = {
|
|
6
|
+
busEventKey: BusEventKey,
|
|
7
|
+
action: (data: any) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const useListenerToBus = (listeners: Listener[]) => {
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
{
|
|
13
|
+
listeners.map((listener: {busEventKey: BusEventKey, action: (data: any) => void}) => {
|
|
14
|
+
EventBus.Instance.addListener(listener.busEventKey, listener.action);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return (() => {
|
|
18
|
+
listeners.map((listener: {busEventKey: BusEventKey, action: (data: any) => void}) => {
|
|
19
|
+
EventBus.Instance.removeListener(listener.action);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { AppState, AppStateStatus } from 'react-native';
|
|
4
|
+
|
|
5
|
+
const getIsAppActive = (currentAppState: AppStateStatus) => {
|
|
6
|
+
return currentAppState !== 'background' && currentAppState !== 'inactive';
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const useAppStateListener = () => {
|
|
10
|
+
const appState = useRef(AppState.currentState);
|
|
11
|
+
const [isAppActive, setIsAppActive] = useState<boolean>(getIsAppActive(appState.current));
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
15
|
+
appState.current = nextAppState;
|
|
16
|
+
setIsAppActive(getIsAppActive(appState.current));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return () => {
|
|
20
|
+
subscription.remove();
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
return isAppActive;
|
|
25
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UNBookPaymentData } from '../../sharedTypes';
|
|
2
|
+
|
|
3
|
+
export enum BookPaymentMessage {
|
|
4
|
+
PAYMENT_CREATED = 'unitPaymentCreated'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface PaymentCreatedEvent {
|
|
8
|
+
data: UNBookPaymentData
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type BookPaymentEvent =
|
|
12
|
+
| PaymentCreatedEvent
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { UNCardData } from '../../sharedTypes';
|
|
2
|
+
|
|
1
3
|
export enum CardMessage {
|
|
2
|
-
|
|
4
|
+
CARD_STATUS_CHANGED = 'unitCardStatusChanged'
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
export interface CardStatusChangedEvent {
|
|
6
|
-
card:
|
|
8
|
+
card: UNCardData;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export type CardEvent =
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BookPaymentEvent, BookPaymentMessage } from './bookPaymentMessage';
|
|
2
|
+
import type { CardEvent, CardMessage } from './cardMessage';
|
|
3
|
+
import type { PageEvent, PageMessage } from './pageMessage';
|
|
4
|
+
import type { UnitEvent, UnitMessage } from './unitMessages';
|
|
5
|
+
|
|
6
|
+
export type WebViewMessageType =
|
|
7
|
+
| PageMessage
|
|
8
|
+
| CardMessage
|
|
9
|
+
| UnitMessage
|
|
10
|
+
| BookPaymentMessage
|
|
11
|
+
|
|
12
|
+
type WebViewEvent =
|
|
13
|
+
| PageEvent
|
|
14
|
+
| UnitEvent
|
|
15
|
+
| CardEvent
|
|
16
|
+
| BookPaymentEvent
|
|
17
|
+
|
|
18
|
+
export interface WebViewMessage {
|
|
19
|
+
type: WebViewMessageType,
|
|
20
|
+
details?: WebViewEvent
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
requireNativeComponent,
|
|
3
|
+
} from 'react-native';
|
|
4
|
+
|
|
5
|
+
type UnitAddToWalletButtonViewProps = {
|
|
6
|
+
style: object;
|
|
7
|
+
onAddToWalletClicked: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const UnitAddToWalletButtonView = requireNativeComponent<UnitAddToWalletButtonViewProps>('UnitAddToWalletButtonView');
|
|
11
|
+
|
|
12
|
+
export default UnitAddToWalletButtonView;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const webViewId = 'webViewContainer';
|
|
2
|
+
|
|
3
|
+
export enum PresentationMode {
|
|
4
|
+
/*
|
|
5
|
+
CoverInjectedHeight - give id (<webViewId> param) to enable style injection to the root. Then cover the injected height.
|
|
6
|
+
|
|
7
|
+
Inherit - inherit the parent size by style of 100 view height
|
|
8
|
+
|
|
9
|
+
Default - return the unit component script
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
CoverInjectedHeight = 'coverInjectedHeight',
|
|
13
|
+
Inherit = 'inherit',
|
|
14
|
+
Default = 'deafult'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const getHtmlBody = (unitComponent: string, unitComponentProps?: string, presentationMode?: PresentationMode) => {
|
|
18
|
+
const currentComponent = `<${unitComponent} ${unitComponentProps || ''}> </${unitComponent}>`;
|
|
19
|
+
|
|
20
|
+
switch (presentationMode) {
|
|
21
|
+
case PresentationMode.CoverInjectedHeight:
|
|
22
|
+
return getCoverInjectedHeightBodyScript(currentComponent);
|
|
23
|
+
case PresentationMode.Inherit:
|
|
24
|
+
return getInheritParentSizeScript(currentComponent);
|
|
25
|
+
default:
|
|
26
|
+
return currentComponent;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getCoverInjectedHeightBodyScript = (currentUnitScript: string) => {
|
|
31
|
+
return `
|
|
32
|
+
<div id=${webViewId}>
|
|
33
|
+
<div style="height: 100%; display: block; padding: 1px;">
|
|
34
|
+
${currentUnitScript}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const getInheritParentSizeScript = (currentUnitScript: string) => {
|
|
41
|
+
return `
|
|
42
|
+
<div style="height: 100vh">
|
|
43
|
+
${currentUnitScript}
|
|
44
|
+
</div>
|
|
45
|
+
`;
|
|
46
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CardMessage } from '../../messages/webMessages/cardMessage';
|
|
2
|
+
import { PageMessage } from '../../messages/webMessages/pageMessage';
|
|
3
|
+
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
4
|
+
|
|
5
|
+
export const POST_MESSAGE_TO_SDK = `
|
|
6
|
+
const postMessageToSDK = (message) => {
|
|
7
|
+
if ('ReactNativeWebView' in window) {
|
|
8
|
+
const messageString = JSON.stringify(message)
|
|
9
|
+
window['ReactNativeWebView'].postMessage(messageString)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const POST_PAGE_HEIGHT = `
|
|
15
|
+
const postHeight = () => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
const height = window.document.documentElement.getBoundingClientRect().height
|
|
18
|
+
postMessageToSDK({ type: "${PageMessage.PAGE_HEIGHT}", details: { height } })
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const LISTENERS = {
|
|
24
|
+
isPageLoaded:`
|
|
25
|
+
window.addEventListener('DOMContentLoaded', e => {
|
|
26
|
+
postMessageToSDK({ type: "${PageMessage.PAGE_LOADED}" })
|
|
27
|
+
});
|
|
28
|
+
`,
|
|
29
|
+
requestRendering: `
|
|
30
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_RENDERING}", (e) => {
|
|
31
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_RENDERING}", details: { data: JSON.stringify(e.detail) }})
|
|
32
|
+
});
|
|
33
|
+
`,
|
|
34
|
+
onLoad: `
|
|
35
|
+
window.addEventListener("${UnitMessage.UNIT_ON_LOAD}", (e) => {
|
|
36
|
+
postHeight()
|
|
37
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_ON_LOAD}" })
|
|
38
|
+
});
|
|
39
|
+
`,
|
|
40
|
+
requestCloseFlow: `
|
|
41
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}", (e) => {
|
|
42
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}" })
|
|
43
|
+
});
|
|
44
|
+
`,
|
|
45
|
+
requestOpenLink: `
|
|
46
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_OPEN_LINK}", (e) => {
|
|
47
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_OPEN_LINK}", details: e.detail })
|
|
48
|
+
});
|
|
49
|
+
`,
|
|
50
|
+
cardStatusChange: `
|
|
51
|
+
window.addEventListener("${CardMessage.CARD_STATUS_CHANGED}", (e) => {
|
|
52
|
+
const response = e.detail
|
|
53
|
+
response.then((data) => {
|
|
54
|
+
postMessageToSDK({ type: "${CardMessage.CARD_STATUS_CHANGED}", details: { card: JSON.stringify(data.data) }})
|
|
55
|
+
}).catch((e) => {
|
|
56
|
+
console.log(e)
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
`
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const DISPTACH_RENDERING_EVENT = `
|
|
63
|
+
const dispatchRenderingEvent = (details) => {
|
|
64
|
+
const event = new CustomEvent("${UnitMessage.UNIT_REQUEST_RENDERING}",{ detail: JSON.parse(details) })
|
|
65
|
+
window.dispatchEvent(event)
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Tags, Relationship } from "./types"
|
|
2
|
+
|
|
3
|
+
type BookPaymentStatus = "Sent" | "Rejected"
|
|
4
|
+
|
|
5
|
+
export type UNBookPaymentData = {
|
|
6
|
+
type: "bookPayment",
|
|
7
|
+
id: string,
|
|
8
|
+
attributes: {
|
|
9
|
+
createdAt: string | Date,
|
|
10
|
+
status: BookPaymentStatus,
|
|
11
|
+
reason: string,
|
|
12
|
+
direction: 'Debit' | 'Credit',
|
|
13
|
+
description: string,
|
|
14
|
+
transactionSummaryOverride?: string,
|
|
15
|
+
amount: string,
|
|
16
|
+
tags: Tags,
|
|
17
|
+
},
|
|
18
|
+
relationships: {
|
|
19
|
+
account: Relationship,
|
|
20
|
+
customer?: Relationship,
|
|
21
|
+
customers?: Relationship,
|
|
22
|
+
counterpartyAccount: Relationship,
|
|
23
|
+
counterpartyCustomer: Relationship,
|
|
24
|
+
transaction: Relationship,
|
|
25
|
+
recurringPayment: Relationship
|
|
26
|
+
}
|
|
27
|
+
}
|