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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Dimensions, StyleSheet } from 'react-native';
|
|
2
|
+
import { BOTTOM_SHEET_MAX_PRECANTAGE_SIZE } from '../../components/UNBottomSheetComponent/UNBottomSheetComponent.constants';
|
|
3
|
+
import { VARIABLES } from '../../styles/variables'; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
|
|
5
|
+
export const getStylesObject = fadeAnim => {
|
|
6
|
+
return StyleSheet.create({
|
|
7
|
+
outsideContainer: {
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
top: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
left: 0
|
|
13
|
+
},
|
|
14
|
+
animation: {
|
|
15
|
+
backgroundColor: 'black',
|
|
16
|
+
flex: 1,
|
|
17
|
+
opacity: fadeAnim
|
|
18
|
+
},
|
|
19
|
+
container: {
|
|
20
|
+
position: 'relative',
|
|
21
|
+
flex: 1,
|
|
22
|
+
marginTop: Dimensions.get('window').height * (1 - BOTTOM_SHEET_MAX_PRECANTAGE_SIZE),
|
|
23
|
+
shadowColor: VARIABLES.COLORS.BLACK,
|
|
24
|
+
shadowOffset: {
|
|
25
|
+
width: 0,
|
|
26
|
+
height: 6
|
|
27
|
+
},
|
|
28
|
+
shadowOpacity: 0.37,
|
|
29
|
+
shadowRadius: 7.49,
|
|
30
|
+
elevation: 12,
|
|
31
|
+
borderTopLeftRadius: 15,
|
|
32
|
+
borderTopRightRadius: 15,
|
|
33
|
+
backgroundColor: VARIABLES.COLORS.WHITE,
|
|
34
|
+
overflow: 'hidden'
|
|
35
|
+
},
|
|
36
|
+
lineContainer: {
|
|
37
|
+
borderTopLeftRadius: 30,
|
|
38
|
+
borderTopRightRadius: 30,
|
|
39
|
+
alignItems: 'center'
|
|
40
|
+
},
|
|
41
|
+
line: {
|
|
42
|
+
width: 35,
|
|
43
|
+
height: 4,
|
|
44
|
+
borderRadius: 2,
|
|
45
|
+
marginTop: 18,
|
|
46
|
+
backgroundColor: VARIABLES.COLORS.SILVER_FLAKE
|
|
47
|
+
},
|
|
48
|
+
outerContent: {
|
|
49
|
+
flex: -1
|
|
50
|
+
},
|
|
51
|
+
innerContent: {
|
|
52
|
+
flex: -1
|
|
53
|
+
},
|
|
54
|
+
closeButton: {
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
width: 36,
|
|
60
|
+
height: 36,
|
|
61
|
+
backgroundColor: VARIABLES.COLORS.WHITE,
|
|
62
|
+
borderRadius: 18,
|
|
63
|
+
padding: 7,
|
|
64
|
+
top: 12,
|
|
65
|
+
right: 12,
|
|
66
|
+
zIndex: 100
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=BottomSheet.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Dimensions","StyleSheet","BOTTOM_SHEET_MAX_PRECANTAGE_SIZE","VARIABLES","getStylesObject","fadeAnim","create","outsideContainer","position","top","bottom","right","left","animation","backgroundColor","flex","opacity","container","marginTop","get","height","shadowColor","COLORS","BLACK","shadowOffset","width","shadowOpacity","shadowRadius","elevation","borderTopLeftRadius","borderTopRightRadius","WHITE","overflow","lineContainer","alignItems","line","borderRadius","SILVER_FLAKE","outerContent","innerContent","closeButton","display","justifyContent","padding","zIndex"],"sources":["BottomSheet.styles.ts"],"sourcesContent":["import { Dimensions, StyleSheet } from 'react-native';\nimport { BOTTOM_SHEET_MAX_PRECANTAGE_SIZE } from '../../components/UNBottomSheetComponent/UNBottomSheetComponent.constants';\nimport { VARIABLES } from '../../styles/variables';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const getStylesObject = (fadeAnim: any) => {\n return StyleSheet.create({\n outsideContainer: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n },\n animation: {\n backgroundColor: 'black',\n flex: 1,\n opacity: fadeAnim,\n },\n container: {\n position: 'relative',\n flex: 1,\n marginTop: Dimensions.get('window').height * (1 - BOTTOM_SHEET_MAX_PRECANTAGE_SIZE),\n shadowColor: VARIABLES.COLORS.BLACK,\n shadowOffset: {\n width: 0,\n height: 6,\n },\n shadowOpacity: 0.37,\n shadowRadius: 7.49,\n elevation: 12,\n borderTopLeftRadius: 15,\n borderTopRightRadius: 15,\n backgroundColor: VARIABLES.COLORS.WHITE,\n overflow: 'hidden'\n },\n lineContainer: {\n borderTopLeftRadius: 30,\n borderTopRightRadius: 30,\n alignItems: 'center'\n },\n line: {\n width: 35,\n height: 4,\n borderRadius: 2,\n marginTop: 18,\n backgroundColor: VARIABLES.COLORS.SILVER_FLAKE,\n },\n outerContent: {\n flex: -1,\n },\n innerContent: {\n flex: -1,\n },\n closeButton: {\n position: 'absolute',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 36,\n height: 36,\n backgroundColor: VARIABLES.COLORS.WHITE,\n borderRadius: 18,\n padding: 7,\n top: 12,\n right: 12,\n zIndex: 100\n }\n });\n};\n"],"mappings":"AAAA,SAASA,UAAT,EAAqBC,UAArB,QAAuC,cAAvC;AACA,SAASC,gCAAT,QAAiD,0EAAjD;AACA,SAASC,SAAT,QAA0B,wBAA1B,C,CAEA;;AACA,OAAO,MAAMC,eAAe,GAAIC,QAAD,IAAmB;EAChD,OAAOJ,UAAU,CAACK,MAAX,CAAkB;IACvBC,gBAAgB,EAAE;MAChBC,QAAQ,EAAE,UADM;MAEhBC,GAAG,EAAE,CAFW;MAGhBC,MAAM,EAAE,CAHQ;MAIhBC,KAAK,EAAE,CAJS;MAKhBC,IAAI,EAAE;IALU,CADK;IAQvBC,SAAS,EAAE;MACTC,eAAe,EAAE,OADR;MAETC,IAAI,EAAE,CAFG;MAGTC,OAAO,EAAEX;IAHA,CARY;IAavBY,SAAS,EAAE;MACTT,QAAQ,EAAE,UADD;MAETO,IAAI,EAAE,CAFG;MAGTG,SAAS,EAAElB,UAAU,CAACmB,GAAX,CAAe,QAAf,EAAyBC,MAAzB,IAAmC,IAAIlB,gCAAvC,CAHF;MAITmB,WAAW,EAAElB,SAAS,CAACmB,MAAV,CAAiBC,KAJrB;MAKTC,YAAY,EAAE;QACZC,KAAK,EAAE,CADK;QAEZL,MAAM,EAAE;MAFI,CALL;MASTM,aAAa,EAAE,IATN;MAUTC,YAAY,EAAE,IAVL;MAWTC,SAAS,EAAE,EAXF;MAYTC,mBAAmB,EAAE,EAZZ;MAaTC,oBAAoB,EAAE,EAbb;MAcThB,eAAe,EAAEX,SAAS,CAACmB,MAAV,CAAiBS,KAdzB;MAeTC,QAAQ,EAAE;IAfD,CAbY;IA8BvBC,aAAa,EAAE;MACbJ,mBAAmB,EAAE,EADR;MAEbC,oBAAoB,EAAE,EAFT;MAGbI,UAAU,EAAE;IAHC,CA9BQ;IAmCvBC,IAAI,EAAE;MACJV,KAAK,EAAE,EADH;MAEJL,MAAM,EAAE,CAFJ;MAGJgB,YAAY,EAAE,CAHV;MAIJlB,SAAS,EAAE,EAJP;MAKJJ,eAAe,EAAEX,SAAS,CAACmB,MAAV,CAAiBe;IAL9B,CAnCiB;IA0CvBC,YAAY,EAAE;MACZvB,IAAI,EAAE,CAAC;IADK,CA1CS;IA6CvBwB,YAAY,EAAE;MACZxB,IAAI,EAAE,CAAC;IADK,CA7CS;IAgDvByB,WAAW,EAAE;MACXhC,QAAQ,EAAE,UADC;MAEXiC,OAAO,EAAE,MAFE;MAGXP,UAAU,EAAE,QAHD;MAIXQ,cAAc,EAAE,QAJL;MAKXjB,KAAK,EAAE,EALI;MAMXL,MAAM,EAAE,EANG;MAOXN,eAAe,EAAEX,SAAS,CAACmB,MAAV,CAAiBS,KAPvB;MAQXK,YAAY,EAAE,EARH;MASXO,OAAO,EAAE,CATE;MAUXlC,GAAG,EAAE,EAVM;MAWXE,KAAK,EAAE,EAXI;MAYXiC,MAAM,EAAE;IAZG;EAhDU,CAAlB,CAAP;AA+DD,CAhEM"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(function (BusEvent) {
|
|
6
|
-
BusEvent["REQUEST_RENDERING"] = "unitRequestRendering";
|
|
7
|
-
BusEvent["CARD_STATUS_CHANGED"] = "cardStatusChanged";
|
|
8
|
-
BusEvent["REQUEST_REFRESH"] = "requestRefresh";
|
|
9
|
-
})(BusEvent || (BusEvent = {}));
|
|
10
|
-
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
11
4
|
export default class EventBus {
|
|
12
5
|
constructor() {
|
|
13
6
|
_defineProperty(this, "eventListeners", {});
|
|
@@ -20,7 +13,7 @@ export default class EventBus {
|
|
|
20
13
|
}
|
|
21
14
|
|
|
22
15
|
event(event, data) {
|
|
23
|
-
|
|
16
|
+
const listeners = this.eventListeners[event.valueOf()];
|
|
24
17
|
|
|
25
18
|
if (Array.isArray(listeners)) {
|
|
26
19
|
listeners.map(listener => {
|
|
@@ -32,7 +25,7 @@ export default class EventBus {
|
|
|
32
25
|
}
|
|
33
26
|
|
|
34
27
|
addListener(event, listener) {
|
|
35
|
-
|
|
28
|
+
const listeners = this.eventListeners[event.valueOf()];
|
|
36
29
|
|
|
37
30
|
if (Array.isArray(listeners)) {
|
|
38
31
|
listeners.push(listener);
|
|
@@ -43,7 +36,7 @@ export default class EventBus {
|
|
|
43
36
|
|
|
44
37
|
removeListener(listener) {
|
|
45
38
|
Object.keys(this.eventListeners).map(eventName => {
|
|
46
|
-
|
|
39
|
+
const listeners = this.eventListeners[eventName];
|
|
47
40
|
|
|
48
41
|
if (listeners) {
|
|
49
42
|
this._remove(listeners, listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["EventBus","constructor","eventListeners","Instance","_instance","event","data","listeners","valueOf","Array","isArray","map","listener","addListener","push","removeListener","Object","keys","eventName","_remove","length","array","item","i","l","splice"],"sources":["EventBus.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { NativeMessage } from '../messages/nativeMessages';\nimport type { WebViewMessageType } from '../messages/webMessages';\n\nexport type BusEventKey = NativeMessage | WebViewMessageType\n\nexport default class EventBus {\n private static _instance: EventBus;\n\n private eventListeners: { [name: string]: Array<(data: any) => void> } = {};\n\n private constructor() {\n this.eventListeners = {};\n }\n\n public static get Instance() {\n return this._instance || (this._instance = new this());\n }\n\n public event(event: BusEventKey, data: any) {\n const listeners = this.eventListeners[event.valueOf()];\n if (Array.isArray(listeners)) {\n listeners.map(listener => {\n if (typeof listener === 'function') {\n listener(data);\n }\n });\n }\n }\n\n public addListener(event: BusEventKey, listener: (data: any) => void) {\n const listeners = this.eventListeners[event.valueOf()];\n if (Array.isArray(listeners)) {\n listeners.push(listener);\n } else {\n this.eventListeners[event.valueOf()] = [listener];\n }\n }\n\n public removeListener(listener: (data: any) => void) {\n Object.keys(this.eventListeners).map(eventName => {\n const listeners = this.eventListeners[eventName];\n if (listeners) {\n this._remove(listeners, listener);\n if (listeners.length === 0) {\n delete this.eventListeners[eventName];\n }\n }\n });\n }\n\n private _remove(array: Array<(data: any) => void>, item: (data: string) => void) {\n if (!array) return;\n for (let i = 0, l = array.length; i < l; i++) {\n if (item === array[i]) array.splice(i, 1);\n }\n }\n}\n"],"mappings":";;AAAA;AAMA,eAAe,MAAMA,QAAN,CAAe;EAKpBC,WAAW,GAAG;IAAA,wCAFmD,EAEnD;;IACpB,KAAKC,cAAL,GAAsB,EAAtB;EACD;;EAEyB,WAARC,QAAQ,GAAG;IAC3B,OAAO,KAAKC,SAAL,KAAmB,KAAKA,SAAL,GAAiB,IAAI,IAAJ,EAApC,CAAP;EACD;;EAEMC,KAAK,CAACA,KAAD,EAAqBC,IAArB,EAAgC;IAC1C,MAAMC,SAAS,GAAG,KAAKL,cAAL,CAAoBG,KAAK,CAACG,OAAN,EAApB,CAAlB;;IACA,IAAIC,KAAK,CAACC,OAAN,CAAcH,SAAd,CAAJ,EAA8B;MAC5BA,SAAS,CAACI,GAAV,CAAcC,QAAQ,IAAI;QACxB,IAAI,OAAOA,QAAP,KAAoB,UAAxB,EAAoC;UAClCA,QAAQ,CAACN,IAAD,CAAR;QACD;MACF,CAJD;IAKD;EACF;;EAEMO,WAAW,CAACR,KAAD,EAAqBO,QAArB,EAAoD;IACpE,MAAML,SAAS,GAAG,KAAKL,cAAL,CAAoBG,KAAK,CAACG,OAAN,EAApB,CAAlB;;IACA,IAAIC,KAAK,CAACC,OAAN,CAAcH,SAAd,CAAJ,EAA8B;MAC5BA,SAAS,CAACO,IAAV,CAAeF,QAAf;IACD,CAFD,MAEO;MACL,KAAKV,cAAL,CAAoBG,KAAK,CAACG,OAAN,EAApB,IAAuC,CAACI,QAAD,CAAvC;IACD;EACF;;EAEMG,cAAc,CAACH,QAAD,EAAgC;IACnDI,MAAM,CAACC,IAAP,CAAY,KAAKf,cAAjB,EAAiCS,GAAjC,CAAqCO,SAAS,IAAI;MAChD,MAAMX,SAAS,GAAG,KAAKL,cAAL,CAAoBgB,SAApB,CAAlB;;MACA,IAAIX,SAAJ,EAAe;QACb,KAAKY,OAAL,CAAaZ,SAAb,EAAwBK,QAAxB;;QACA,IAAIL,SAAS,CAACa,MAAV,KAAqB,CAAzB,EAA4B;UAC1B,OAAO,KAAKlB,cAAL,CAAoBgB,SAApB,CAAP;QACD;MACF;IACF,CARD;EASD;;EAEOC,OAAO,CAACE,KAAD,EAAoCC,IAApC,EAAkE;IAC/E,IAAI,CAACD,KAAL,EAAY;;IACZ,KAAK,IAAIE,CAAC,GAAG,CAAR,EAAWC,CAAC,GAAGH,KAAK,CAACD,MAA1B,EAAkCG,CAAC,GAAGC,CAAtC,EAAyCD,CAAC,EAA1C,EAA8C;MAC5C,IAAID,IAAI,KAAKD,KAAK,CAACE,CAAD,CAAlB,EAAuBF,KAAK,CAACI,MAAN,CAAaF,CAAb,EAAgB,CAAhB;IACxB;EACF;;AAlD2B;;gBAATvB,Q"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import EventBus from '../helpers/EventBus';
|
|
4
|
+
export const useListenerToBus = listeners => {
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
{
|
|
7
|
+
listeners.map(listener => {
|
|
8
|
+
EventBus.Instance.addListener(listener.busEventKey, listener.action);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return () => {
|
|
12
|
+
listeners.map(listener => {
|
|
13
|
+
EventBus.Instance.removeListener(listener.action);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=listenerToBus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","EventBus","useListenerToBus","listeners","map","listener","Instance","addListener","busEventKey","action","removeListener"],"sources":["listenerToBus.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useEffect } from 'react';\nimport EventBus, { BusEventKey } from '../helpers/EventBus';\n\ntype Listener = {\n busEventKey: BusEventKey,\n action: (data: any) => void\n}\n\nexport const useListenerToBus = (listeners: Listener[]) => {\n useEffect(() => {\n {\n listeners.map((listener: {busEventKey: BusEventKey, action: (data: any) => void}) => {\n EventBus.Instance.addListener(listener.busEventKey, listener.action);\n });\n }\n return (() => {\n listeners.map((listener: {busEventKey: BusEventKey, action: (data: any) => void}) => {\n EventBus.Instance.removeListener(listener.action);\n });\n });\n }, []);\n};\n"],"mappings":"AAAA;AACA,SAASA,SAAT,QAA0B,OAA1B;AACA,OAAOC,QAAP,MAAsC,qBAAtC;AAOA,OAAO,MAAMC,gBAAgB,GAAIC,SAAD,IAA2B;EACzDH,SAAS,CAAC,MAAM;IACd;MACEG,SAAS,CAACC,GAAV,CAAeC,QAAD,IAAuE;QACnFJ,QAAQ,CAACK,QAAT,CAAkBC,WAAlB,CAA8BF,QAAQ,CAACG,WAAvC,EAAoDH,QAAQ,CAACI,MAA7D;MACD,CAFD;IAGD;IACD,OAAQ,MAAM;MACZN,SAAS,CAACC,GAAV,CAAeC,QAAD,IAAuE;QACnFJ,QAAQ,CAACK,QAAT,CAAkBI,cAAlB,CAAiCL,QAAQ,CAACI,MAA1C;MACD,CAFD;IAGD,CAJD;EAKD,CAXQ,EAWN,EAXM,CAAT;AAYD,CAbM"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { AppState } from 'react-native';
|
|
4
|
+
|
|
5
|
+
const getIsAppActive = currentAppState => {
|
|
6
|
+
return currentAppState !== 'background' && currentAppState !== 'inactive';
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const useAppStateListener = () => {
|
|
10
|
+
const appState = useRef(AppState.currentState);
|
|
11
|
+
const [isAppActive, setIsAppActive] = useState(getIsAppActive(appState.current));
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
14
|
+
appState.current = nextAppState;
|
|
15
|
+
setIsAppActive(getIsAppActive(appState.current));
|
|
16
|
+
});
|
|
17
|
+
return () => {
|
|
18
|
+
subscription.remove();
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
return isAppActive;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useAppStateListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useState","AppState","getIsAppActive","currentAppState","useAppStateListener","appState","currentState","isAppActive","setIsAppActive","current","subscription","addEventListener","nextAppState","remove"],"sources":["useAppStateListener.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useEffect, useRef, useState } from 'react';\nimport { AppState, AppStateStatus } from 'react-native';\n\nconst getIsAppActive = (currentAppState: AppStateStatus) => {\n return currentAppState !== 'background' && currentAppState !== 'inactive';\n};\n\nexport const useAppStateListener = () => {\n const appState = useRef(AppState.currentState);\n const [isAppActive, setIsAppActive] = useState<boolean>(getIsAppActive(appState.current));\n\n useEffect(() => {\n const subscription = AppState.addEventListener('change', nextAppState => {\n appState.current = nextAppState;\n setIsAppActive(getIsAppActive(appState.current));\n });\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n return isAppActive;\n};\n"],"mappings":"AAAA;AACA,SAASA,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,QAA4C,OAA5C;AACA,SAASC,QAAT,QAAyC,cAAzC;;AAEA,MAAMC,cAAc,GAAIC,eAAD,IAAqC;EAC1D,OAAOA,eAAe,KAAK,YAApB,IAAoCA,eAAe,KAAK,UAA/D;AACD,CAFD;;AAIA,OAAO,MAAMC,mBAAmB,GAAG,MAAM;EACvC,MAAMC,QAAQ,GAAGN,MAAM,CAACE,QAAQ,CAACK,YAAV,CAAvB;EACA,MAAM,CAACC,WAAD,EAAcC,cAAd,IAAgCR,QAAQ,CAAUE,cAAc,CAACG,QAAQ,CAACI,OAAV,CAAxB,CAA9C;EAEAX,SAAS,CAAC,MAAM;IACd,MAAMY,YAAY,GAAGT,QAAQ,CAACU,gBAAT,CAA0B,QAA1B,EAAoCC,YAAY,IAAI;MACvEP,QAAQ,CAACI,OAAT,GAAmBG,YAAnB;MACAJ,cAAc,CAACN,cAAc,CAACG,QAAQ,CAACI,OAAV,CAAf,CAAd;IACD,CAHoB,CAArB;IAKA,OAAO,MAAM;MACXC,YAAY,CAACG,MAAb;IACD,CAFD;EAGD,CATQ,EASN,EATM,CAAT;EAWA,OAAON,WAAP;AACD,CAhBM"}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.tsx"],"sourcesContent":["export * from './components'\n"],"mappings":"AAAA,cAAc,cAAd"}
|
|
1
|
+
{"version":3,"names":["UnitSDK","UNEnvironment"],"sources":["index.tsx"],"sourcesContent":["export * from './components';\n\nexport * from './sharedTypes';\n\nexport { UnitSDK, UNEnvironment } from './unitSdkManager/UnitSdkManager';\n"],"mappings":"AAAA,cAAc,cAAd;AAEA,cAAc,eAAd;AAEA,SAASA,OAAT,EAAkBC,aAAlB,QAAuC,iCAAvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeMessage"],"sources":["index.ts"],"sourcesContent":["export enum NativeMessage {\n IS_SCRIPT_FETCHED = 'isScriptFetched'\n}\n"],"mappings":"AAAA,WAAYA,aAAZ;;WAAYA,a;EAAAA,a;GAAAA,a,KAAAA,a"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BookPaymentMessage"],"sources":["bookPaymentMessage.ts"],"sourcesContent":["import type { UNBookPaymentData } from '../../sharedTypes';\n\nexport enum BookPaymentMessage {\n PAYMENT_CREATED = 'unitPaymentCreated'\n}\n\nexport interface PaymentCreatedEvent {\n data: UNBookPaymentData\n}\n\nexport type BookPaymentEvent =\n| PaymentCreatedEvent\n"],"mappings":"AAEA,WAAYA,kBAAZ;;WAAYA,kB;EAAAA,kB;GAAAA,kB,KAAAA,kB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CardMessage"],"sources":["cardMessage.ts"],"sourcesContent":["import type { UNCardData } from '../../sharedTypes';\n\nexport enum CardMessage {\n CARD_STATUS_CHANGED = 'unitCardStatusChanged'\n}\n\nexport interface CardStatusChangedEvent {\n card: UNCardData;\n}\n\nexport type CardEvent =\n | CardStatusChangedEvent\n"],"mappings":"AAEA,WAAYA,WAAZ;;WAAYA,W;EAAAA,W;GAAAA,W,KAAAA,W"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import type { BookPaymentEvent, BookPaymentMessage } from './bookPaymentMessage';\nimport type { CardEvent, CardMessage } from './cardMessage';\nimport type { PageEvent, PageMessage } from './pageMessage';\nimport type { UnitEvent, UnitMessage } from './unitMessages';\n\nexport type WebViewMessageType =\n | PageMessage\n | CardMessage\n | UnitMessage\n | BookPaymentMessage\n\ntype WebViewEvent =\n | PageEvent\n | UnitEvent\n | CardEvent\n | BookPaymentEvent\n\nexport interface WebViewMessage {\n type: WebViewMessageType,\n details?: WebViewEvent\n}\n"],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PageMessage"],"sources":["pageMessage.ts"],"sourcesContent":["export enum PageMessage {\n PAGE_LOADED = 'pageLoaded',\n PAGE_HEIGHT = 'pageHeight',\n}\n\nexport interface HeightEvent {\n height: number;\n}\n\nexport type PageEvent =\n | HeightEvent\n"],"mappings":"AAAA,WAAYA,WAAZ;;WAAYA,W;EAAAA,W;EAAAA,W;GAAAA,W,KAAAA,W"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["UnitMessage"],"sources":["unitMessages.ts"],"sourcesContent":["export enum UnitMessage {\n UNIT_REQUEST_RENDERING = 'unitRequestRendering',\n UNIT_REQUEST_REFRESH = 'unitRequestRefresh',\n UNIT_REQUEST_CLOSE_FLOW = 'unitRequestCloseFlow',\n UNIT_REQUEST_OPEN_LINK = 'unitRequestOpenLink',\n UNIT_ON_LOAD = 'unitOnLoad'\n}\n\nexport interface RequestRenderingData {\n nativePlace: string;\n nativeComponent: string;\n}\n\nexport interface RequestRenderingEvent {\n data: string;\n}\n\nexport interface RequestRefreshEvent {\n refEvent: string;\n dependencies: string[];\n resourceId: string;\n}\n\nexport interface RequestOpenLinkEvent {\n href: string;\n target: string\n}\n\nexport type UnitEvent =\n | RequestRenderingEvent\n | RequestRefreshEvent\n | RequestOpenLinkEvent\n"],"mappings":"AAAA,WAAYA,WAAZ;;WAAYA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,KAAAA,W"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","UnitAddToWalletButtonView"],"sources":["UNNativeAddToWalletButton.tsx"],"sourcesContent":["import {\n requireNativeComponent,\n} from 'react-native';\n\ntype UnitAddToWalletButtonViewProps = {\n style: object;\n onAddToWalletClicked: () => void;\n};\n\nconst UnitAddToWalletButtonView = requireNativeComponent<UnitAddToWalletButtonViewProps>('UnitAddToWalletButtonView');\n\nexport default UnitAddToWalletButtonView;\n"],"mappings":"AAAA,SACEA,sBADF,QAEO,cAFP;AASA,MAAMC,yBAAyB,GAAGD,sBAAsB,CAAiC,2BAAjC,CAAxD;AAEA,eAAeC,yBAAf"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const webViewId = 'webViewContainer';
|
|
2
|
+
export let PresentationMode;
|
|
3
|
+
|
|
4
|
+
(function (PresentationMode) {
|
|
5
|
+
PresentationMode["CoverInjectedHeight"] = "coverInjectedHeight";
|
|
6
|
+
PresentationMode["Inherit"] = "inherit";
|
|
7
|
+
PresentationMode["Default"] = "deafult";
|
|
8
|
+
})(PresentationMode || (PresentationMode = {}));
|
|
9
|
+
|
|
10
|
+
export const getHtmlBody = (unitComponent, unitComponentProps, presentationMode) => {
|
|
11
|
+
const currentComponent = `<${unitComponent} ${unitComponentProps || ''}> </${unitComponent}>`;
|
|
12
|
+
|
|
13
|
+
switch (presentationMode) {
|
|
14
|
+
case PresentationMode.CoverInjectedHeight:
|
|
15
|
+
return getCoverInjectedHeightBodyScript(currentComponent);
|
|
16
|
+
|
|
17
|
+
case PresentationMode.Inherit:
|
|
18
|
+
return getInheritParentSizeScript(currentComponent);
|
|
19
|
+
|
|
20
|
+
default:
|
|
21
|
+
return currentComponent;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getCoverInjectedHeightBodyScript = currentUnitScript => {
|
|
26
|
+
return `
|
|
27
|
+
<div id=${webViewId}>
|
|
28
|
+
<div style="height: 100%; display: block; padding: 1px;">
|
|
29
|
+
${currentUnitScript}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
`;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const getInheritParentSizeScript = currentUnitScript => {
|
|
36
|
+
return `
|
|
37
|
+
<div style="height: 100vh">
|
|
38
|
+
${currentUnitScript}
|
|
39
|
+
</div>
|
|
40
|
+
`;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=bodyHtml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["webViewId","PresentationMode","getHtmlBody","unitComponent","unitComponentProps","presentationMode","currentComponent","CoverInjectedHeight","getCoverInjectedHeightBodyScript","Inherit","getInheritParentSizeScript","currentUnitScript"],"sources":["bodyHtml.ts"],"sourcesContent":["export const webViewId = 'webViewContainer';\n\nexport enum PresentationMode {\n /*\n CoverInjectedHeight - give id (<webViewId> param) to enable style injection to the root. Then cover the injected height.\n\n Inherit - inherit the parent size by style of 100 view height\n\n Default - return the unit component script\n */\n\n CoverInjectedHeight = 'coverInjectedHeight',\n Inherit = 'inherit',\n Default = 'deafult'\n}\n\nexport const getHtmlBody = (unitComponent: string, unitComponentProps?: string, presentationMode?: PresentationMode) => {\n const currentComponent = `<${unitComponent} ${unitComponentProps || ''}> </${unitComponent}>`;\n\n switch (presentationMode) {\n case PresentationMode.CoverInjectedHeight:\n return getCoverInjectedHeightBodyScript(currentComponent);\n case PresentationMode.Inherit:\n return getInheritParentSizeScript(currentComponent);\n default:\n return currentComponent;\n }\n};\n\nconst getCoverInjectedHeightBodyScript = (currentUnitScript: string) => {\n return `\n <div id=${webViewId}>\n <div style=\"height: 100%; display: block; padding: 1px;\">\n ${currentUnitScript}\n </div>\n </div>\n `;\n};\n\nconst getInheritParentSizeScript = (currentUnitScript: string) => {\n return `\n <div style=\"height: 100vh\">\n ${currentUnitScript}\n </div>\n `;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG,kBAAlB;AAEP,WAAYC,gBAAZ;;WAAYA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;GAAAA,gB,KAAAA,gB;;AAcZ,OAAO,MAAMC,WAAW,GAAG,CAACC,aAAD,EAAwBC,kBAAxB,EAAqDC,gBAArD,KAA6F;EACtH,MAAMC,gBAAgB,GAAI,IAAGH,aAAc,IAAGC,kBAAkB,IAAI,EAAG,OAAMD,aAAc,GAA3F;;EAEA,QAAQE,gBAAR;IACE,KAAKJ,gBAAgB,CAACM,mBAAtB;MACE,OAAOC,gCAAgC,CAACF,gBAAD,CAAvC;;IACF,KAAKL,gBAAgB,CAACQ,OAAtB;MACE,OAAOC,0BAA0B,CAACJ,gBAAD,CAAjC;;IACF;MACE,OAAOA,gBAAP;EANJ;AAQD,CAXM;;AAaP,MAAME,gCAAgC,GAAIG,iBAAD,IAA+B;EACtE,OAAQ;AACV,cAAcX,SAAU;AACxB;AACA,UAAUW,iBAAkB;AAC5B;AACA;AACA,GANE;AAOD,CARD;;AAUA,MAAMD,0BAA0B,GAAIC,iBAAD,IAA+B;EAChE,OAAQ;AACV;AACA,QAAQA,iBAAkB;AAC1B;AACA,GAJE;AAKD,CAND"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CardMessage } from '../../messages/webMessages/cardMessage';
|
|
2
|
+
import { PageMessage } from '../../messages/webMessages/pageMessage';
|
|
3
|
+
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
4
|
+
export const POST_MESSAGE_TO_SDK = `
|
|
5
|
+
const postMessageToSDK = (message) => {
|
|
6
|
+
if ('ReactNativeWebView' in window) {
|
|
7
|
+
const messageString = JSON.stringify(message)
|
|
8
|
+
window['ReactNativeWebView'].postMessage(messageString)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
export const POST_PAGE_HEIGHT = `
|
|
13
|
+
const postHeight = () => {
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
const height = window.document.documentElement.getBoundingClientRect().height
|
|
16
|
+
postMessageToSDK({ type: "${PageMessage.PAGE_HEIGHT}", details: { height } })
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
export const LISTENERS = {
|
|
21
|
+
isPageLoaded: `
|
|
22
|
+
window.addEventListener('DOMContentLoaded', e => {
|
|
23
|
+
postMessageToSDK({ type: "${PageMessage.PAGE_LOADED}" })
|
|
24
|
+
});
|
|
25
|
+
`,
|
|
26
|
+
requestRendering: `
|
|
27
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_RENDERING}", (e) => {
|
|
28
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_RENDERING}", details: { data: JSON.stringify(e.detail) }})
|
|
29
|
+
});
|
|
30
|
+
`,
|
|
31
|
+
onLoad: `
|
|
32
|
+
window.addEventListener("${UnitMessage.UNIT_ON_LOAD}", (e) => {
|
|
33
|
+
postHeight()
|
|
34
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_ON_LOAD}" })
|
|
35
|
+
});
|
|
36
|
+
`,
|
|
37
|
+
requestCloseFlow: `
|
|
38
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}", (e) => {
|
|
39
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}" })
|
|
40
|
+
});
|
|
41
|
+
`,
|
|
42
|
+
requestOpenLink: `
|
|
43
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_OPEN_LINK}", (e) => {
|
|
44
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_OPEN_LINK}", details: e.detail })
|
|
45
|
+
});
|
|
46
|
+
`,
|
|
47
|
+
cardStatusChange: `
|
|
48
|
+
window.addEventListener("${CardMessage.CARD_STATUS_CHANGED}", (e) => {
|
|
49
|
+
const response = e.detail
|
|
50
|
+
response.then((data) => {
|
|
51
|
+
postMessageToSDK({ type: "${CardMessage.CARD_STATUS_CHANGED}", details: { card: JSON.stringify(data.data) }})
|
|
52
|
+
}).catch((e) => {
|
|
53
|
+
console.log(e)
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
`
|
|
57
|
+
};
|
|
58
|
+
export const DISPTACH_RENDERING_EVENT = `
|
|
59
|
+
const dispatchRenderingEvent = (details) => {
|
|
60
|
+
const event = new CustomEvent("${UnitMessage.UNIT_REQUEST_RENDERING}",{ detail: JSON.parse(details) })
|
|
61
|
+
window.dispatchEvent(event)
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
//# sourceMappingURL=bodyScript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CardMessage","PageMessage","UnitMessage","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","PAGE_HEIGHT","LISTENERS","isPageLoaded","PAGE_LOADED","requestRendering","UNIT_REQUEST_RENDERING","onLoad","UNIT_ON_LOAD","requestCloseFlow","UNIT_REQUEST_CLOSE_FLOW","requestOpenLink","UNIT_REQUEST_OPEN_LINK","cardStatusChange","CARD_STATUS_CHANGED","DISPTACH_RENDERING_EVENT"],"sources":["bodyScript.ts"],"sourcesContent":["import { CardMessage } from '../../messages/webMessages/cardMessage';\nimport { PageMessage } from '../../messages/webMessages/pageMessage';\nimport { UnitMessage } from '../../messages/webMessages/unitMessages';\n\nexport const POST_MESSAGE_TO_SDK = `\n const postMessageToSDK = (message) => {\n if ('ReactNativeWebView' in window) {\n const messageString = JSON.stringify(message)\n window['ReactNativeWebView'].postMessage(messageString)\n }\n }\n`;\n\nexport const POST_PAGE_HEIGHT = `\n const postHeight = () => {\n setTimeout(() => {\n const height = window.document.documentElement.getBoundingClientRect().height\n postMessageToSDK({ type: \"${PageMessage.PAGE_HEIGHT}\", details: { height } })\n })\n }\n`;\n\nexport const LISTENERS = {\n isPageLoaded:`\n window.addEventListener('DOMContentLoaded', e => {\n postMessageToSDK({ type: \"${PageMessage.PAGE_LOADED}\" })\n });\n `,\n requestRendering: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_RENDERING}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_RENDERING}\", details: { data: JSON.stringify(e.detail) }})\n });\n `,\n onLoad: `\n window.addEventListener(\"${UnitMessage.UNIT_ON_LOAD}\", (e) => {\n postHeight()\n postMessageToSDK({ type: \"${UnitMessage.UNIT_ON_LOAD}\" })\n });\n `,\n requestCloseFlow: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\" })\n });\n `,\n requestOpenLink: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", details: e.detail })\n });\n `,\n cardStatusChange: `\n window.addEventListener(\"${CardMessage.CARD_STATUS_CHANGED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_STATUS_CHANGED}\", details: { card: JSON.stringify(data.data) }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `\n};\n\nexport const DISPTACH_RENDERING_EVENT = `\n const dispatchRenderingEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_RENDERING}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n`;\n"],"mappings":"AAAA,SAASA,WAAT,QAA4B,wCAA5B;AACA,SAASC,WAAT,QAA4B,wCAA5B;AACA,SAASC,WAAT,QAA4B,yCAA5B;AAEA,OAAO,MAAMC,mBAAmB,GAAI;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,CAPO;AASP,OAAO,MAAMC,gBAAgB,GAAI;AACjC;AACA;AACA;AACA,kCAAkCH,WAAW,CAACI,WAAY;AAC1D;AACA;AACA,CAPO;AASP,OAAO,MAAMC,SAAS,GAAG;EACvBC,YAAY,EAAE;AAChB;AACA,kCAAkCN,WAAW,CAACO,WAAY;AAC1D;AACA,GALyB;EAMvBC,gBAAgB,EAAG;AACrB,+BAA+BP,WAAW,CAACQ,sBAAuB;AAClE,kCAAkCR,WAAW,CAACQ,sBAAuB;AACrE;AACA,GAVyB;EAWvBC,MAAM,EAAG;AACX,+BAA+BT,WAAW,CAACU,YAAa;AACxD;AACA,kCAAkCV,WAAW,CAACU,YAAa;AAC3D;AACA,GAhByB;EAiBvBC,gBAAgB,EAAG;AACrB,+BAA+BX,WAAW,CAACY,uBAAwB;AACnE,kCAAkCZ,WAAW,CAACY,uBAAwB;AACtE;AACA,GArByB;EAsBvBC,eAAe,EAAG;AACpB,+BAA+Bb,WAAW,CAACc,sBAAuB;AAClE,kCAAkCd,WAAW,CAACc,sBAAuB;AACrE;AACA,GA1ByB;EA2BvBC,gBAAgB,EAAG;AACrB,+BAA+BjB,WAAW,CAACkB,mBAAoB;AAC/D;AACA;AACA,oCAAoClB,WAAW,CAACkB,mBAAoB;AACpE;AACA;AACA;AACA;AACA;AApCyB,CAAlB;AAuCP,OAAO,MAAMC,wBAAwB,GAAI;AACzC;AACA,qCAAqCjB,WAAW,CAACQ,sBAAuB;AACxE;AACA;AACA,CALO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["bookPayment.types.ts"],"sourcesContent":["import type { Tags, Relationship } from \"./types\"\n\ntype BookPaymentStatus = \"Sent\" | \"Rejected\"\n\nexport type UNBookPaymentData = {\n type: \"bookPayment\",\n id: string,\n attributes: {\n createdAt: string | Date,\n status: BookPaymentStatus,\n reason: string,\n direction: 'Debit' | 'Credit',\n description: string,\n transactionSummaryOverride?: string,\n amount: string,\n tags: Tags,\n },\n relationships: {\n account: Relationship,\n customer?: Relationship,\n customers?: Relationship,\n counterpartyAccount: Relationship,\n counterpartyCustomer: Relationship,\n transaction: Relationship,\n recurringPayment: Relationship\n }\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["card.types.ts"],"sourcesContent":["import type { Address, FullName, Limits, Relationship, Tags } from \"./types\"\n\nexport type UNCardData = IndividualDebitCard | BusinessDebitCard\n\ntype CardStatus = \"Active\" | \"Inactive\" | \"Stolen\" | \"Lost\" | \"Frozen\" | \"ClosedByCustomer\" | \"SuspectedFraud\"\n\ntype IndividualDebitCard = {\n id: string,\n type: \"individualDebitCard\" | \"individualVirtualDebitCard\",\n attributes: {\n createdAt: string,\n last4Digits: string,\n expirationDate: string,\n status: CardStatus,\n shippingAddress?: Address, /* not exists in virtual card */\n updatedAt?: string,\n design?: string,\n additionalEmbossedText?: string,\n idempotencyKey?: string,\n tags?: Tags,\n limits?: Limits,\n printOnlyBusinessName?: boolean\n },\n relationships: {\n account: Relationship,\n customer: Relationship\n }\n}\n\ntype BusinessDebitCard = {\n id: string,\n type: \"businessDebitCard\" | \"businessVirtualDebitCard\",\n attributes: {\n fullName: FullName,\n dateOfBirth: string,\n address: Address,\n shippingAddress?: Address,\n phone: string,\n email: string,\n createdAt: string,\n last4Digits: string,\n expirationDate: string,\n status: CardStatus,\n updatedAt?: string,\n ssn?: string,\n passport?: string,\n nationality?: string,\n design?: string,\n additionalEmbossedText?: string,\n idempotencyKey?: string,\n tags?: Record<string, string>\n limits?: Limits,\n printOnlyBusinessName?: boolean\n },\n relationships: {\n account: Relationship,\n customer: Relationship\n }\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './bookPayment.types';\nexport * from './card.types';\n"],"mappings":"AAAA,cAAc,qBAAd;AACA,cAAc,cAAd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type Address = {\n street: string,\n street2?: string,\n city: string,\n state: string,\n postalCode: string,\n country: string\n}\n\nexport type Limits = {\n dailyWithdrawal?: string | number,\n dailyPurchase?: string | number,\n monthlyWithdrawal?: string | number,\n monthlyPurchase?: string | number,\n}\n\ntype Data = {\n type: string,\n id: string\n}\n\nexport type Relationship = {\n data:\n | null\n | []\n | Data\n | Data[]\n}\n\nexport type FullName = {\n first: string,\n last: string\n}\n\nexport type Tags = Record<string, string> // TODO: specify Tag type\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["VARIABLES","COLORS","WHITE","BLACK","BLUE","GREY","SILVER_FLAKE"],"sources":["variables.ts"],"sourcesContent":["export const VARIABLES = {\n COLORS: {\n WHITE: '#ffffff',\n BLACK: '#000000',\n BLUE: '#005fF0',\n GREY: '#bbbbbb',\n SILVER_FLAKE: '#D5DDE0'\n }\n};\n"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG;EACvBC,MAAM,EAAE;IACNC,KAAK,EAAE,SADD;IAENC,KAAK,EAAE,SAFD;IAGNC,IAAI,EAAE,SAHA;IAINC,IAAI,EAAE,SAJA;IAKNC,YAAY,EAAE;EALR;AADe,CAAlB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import EventBus from '../helpers/EventBus';
|
|
2
|
+
import { NativeMessage } from '../messages/nativeMessages';
|
|
3
|
+
import { UnitSDK, UNIT_SCRIPT_URL } from './UnitSdkManager';
|
|
4
|
+
let isLoadingScript = false;
|
|
5
|
+
/** globalUnitScript is exported ONLY to our project components **/
|
|
6
|
+
|
|
7
|
+
export let globalUnitScript = '';
|
|
8
|
+
export const fetchUnitScript = async () => {
|
|
9
|
+
const env = UnitSDK.getEnv();
|
|
10
|
+
|
|
11
|
+
if (isLoadingScript || globalUnitScript || !env) {
|
|
12
|
+
// init function is called and success OR in progress
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
isLoadingScript = true;
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const unitScriptRes = await fetch(UNIT_SCRIPT_URL[env]);
|
|
20
|
+
const unitScript = await unitScriptRes.text();
|
|
21
|
+
|
|
22
|
+
if (unitScript) {
|
|
23
|
+
EventBus.Instance.event(NativeMessage.IS_SCRIPT_FETCHED, {
|
|
24
|
+
unitScript
|
|
25
|
+
});
|
|
26
|
+
globalUnitScript = unitScript;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return null;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.log(e);
|
|
32
|
+
return null;
|
|
33
|
+
} finally {
|
|
34
|
+
isLoadingScript = false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=UnitSdk.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EventBus","NativeMessage","UnitSDK","UNIT_SCRIPT_URL","isLoadingScript","globalUnitScript","fetchUnitScript","env","getEnv","unitScriptRes","fetch","unitScript","text","Instance","event","IS_SCRIPT_FETCHED","e","console","log"],"sources":["UnitSdk.api.ts"],"sourcesContent":["import EventBus from '../helpers/EventBus';\nimport { NativeMessage } from '../messages/nativeMessages';\nimport { UnitSDK, UNIT_SCRIPT_URL } from './UnitSdkManager';\n\nlet isLoadingScript = false;\n\n/** globalUnitScript is exported ONLY to our project components **/\nexport let globalUnitScript = '';\n\nexport const fetchUnitScript = async () => {\n const env = UnitSDK.getEnv();\n if (isLoadingScript || globalUnitScript || !env) {\n // init function is called and success OR in progress\n return null;\n }\n isLoadingScript = true;\n try {\n const unitScriptRes = await fetch(UNIT_SCRIPT_URL[env]);\n const unitScript = await unitScriptRes.text();\n if (unitScript) {\n EventBus.Instance.event(NativeMessage.IS_SCRIPT_FETCHED, { unitScript });\n globalUnitScript = unitScript;\n }\n return null;\n } catch (e) {\n console.log(e);\n return null;\n } finally {\n isLoadingScript = false;\n }\n};\n"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,qBAArB;AACA,SAASC,aAAT,QAA8B,4BAA9B;AACA,SAASC,OAAT,EAAkBC,eAAlB,QAAyC,kBAAzC;AAEA,IAAIC,eAAe,GAAG,KAAtB;AAEA;;AACA,OAAO,IAAIC,gBAAgB,GAAG,EAAvB;AAEP,OAAO,MAAMC,eAAe,GAAG,YAAY;EACzC,MAAMC,GAAG,GAAGL,OAAO,CAACM,MAAR,EAAZ;;EACA,IAAIJ,eAAe,IAAIC,gBAAnB,IAAuC,CAACE,GAA5C,EAAiD;IAC/C;IACA,OAAO,IAAP;EACD;;EACDH,eAAe,GAAG,IAAlB;;EACA,IAAI;IACF,MAAMK,aAAa,GAAG,MAAMC,KAAK,CAACP,eAAe,CAACI,GAAD,CAAhB,CAAjC;IACA,MAAMI,UAAU,GAAG,MAAMF,aAAa,CAACG,IAAd,EAAzB;;IACA,IAAID,UAAJ,EAAgB;MACdX,QAAQ,CAACa,QAAT,CAAkBC,KAAlB,CAAwBb,aAAa,CAACc,iBAAtC,EAAyD;QAAEJ;MAAF,CAAzD;MACAN,gBAAgB,GAAGM,UAAnB;IACD;;IACD,OAAO,IAAP;EACD,CARD,CAQE,OAAOK,CAAP,EAAU;IACVC,OAAO,CAACC,GAAR,CAAYF,CAAZ;IACA,OAAO,IAAP;EACD,CAXD,SAWU;IACRZ,eAAe,GAAG,KAAlB;EACD;AACF,CArBM"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import { fetchUnitScript } from './UnitSdk.api';
|
|
4
|
+
export let UNEnvironment;
|
|
5
|
+
|
|
6
|
+
(function (UNEnvironment) {
|
|
7
|
+
UNEnvironment["sandbox"] = "sandbox";
|
|
8
|
+
UNEnvironment["production"] = "production";
|
|
9
|
+
})(UNEnvironment || (UNEnvironment = {}));
|
|
10
|
+
|
|
11
|
+
export const UNIT_SCRIPT_URL = {
|
|
12
|
+
[UNEnvironment.sandbox]: 'https://ui.s.unit.sh/components.js',
|
|
13
|
+
[UNEnvironment.production]: 'https://ui.unit.co/components.js'
|
|
14
|
+
};
|
|
15
|
+
export class UnitSDK {}
|
|
16
|
+
|
|
17
|
+
_defineProperty(UnitSDK, "env", void 0);
|
|
18
|
+
|
|
19
|
+
_defineProperty(UnitSDK, "theme", void 0);
|
|
20
|
+
|
|
21
|
+
_defineProperty(UnitSDK, "init", async (env, theme) => {
|
|
22
|
+
try {
|
|
23
|
+
UnitSDK.env = env;
|
|
24
|
+
UnitSDK.theme = theme;
|
|
25
|
+
await fetchUnitScript();
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.log(e);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
_defineProperty(UnitSDK, "getEnv", () => {
|
|
32
|
+
return UnitSDK.env;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
_defineProperty(UnitSDK, "getTheme", () => {
|
|
36
|
+
return UnitSDK.theme;
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=UnitSdkManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fetchUnitScript","UNEnvironment","UNIT_SCRIPT_URL","sandbox","production","UnitSDK","env","theme","e","console","log"],"sources":["UnitSdkManager.ts"],"sourcesContent":["import { fetchUnitScript } from './UnitSdk.api';\n\nexport enum UNEnvironment {\n sandbox = 'sandbox',\n production = 'production'\n}\n\nexport const UNIT_SCRIPT_URL = {\n [UNEnvironment.sandbox]: 'https://ui.s.unit.sh/components.js',\n [UNEnvironment.production]: 'https://ui.unit.co/components.js'\n};\nexport class UnitSDK {\n protected static env?: UNEnvironment;\n protected static theme?: string;\n\n public static init = async (env: UNEnvironment, theme?: string) => {\n try {\n this.env = env;\n this.theme = theme;\n await fetchUnitScript();\n } catch (e) {\n console.log(e);\n }\n };\n\n public static getEnv = () => {\n return this.env;\n };\n\n public static getTheme = () => {\n return this.theme;\n };\n}\n"],"mappings":";;AAAA,SAASA,eAAT,QAAgC,eAAhC;AAEA,WAAYC,aAAZ;;WAAYA,a;EAAAA,a;EAAAA,a;GAAAA,a,KAAAA,a;;AAKZ,OAAO,MAAMC,eAAe,GAAG;EAC7B,CAACD,aAAa,CAACE,OAAf,GAAyB,oCADI;EAE7B,CAACF,aAAa,CAACG,UAAf,GAA4B;AAFC,CAAxB;AAIP,OAAO,MAAMC,OAAN,CAAc;;gBAARA,O;;gBAAAA,O;;gBAAAA,O,UAIU,OAAOC,GAAP,EAA2BC,KAA3B,KAA8C;EACjE,IAAI;IALKF,OAMP,CAAKC,GAAL,GAAWA,GAAX;IANOD,OAOP,CAAKE,KAAL,GAAaA,KAAb;IACA,MAAMP,eAAe,EAArB;EACD,CAJD,CAIE,OAAOQ,CAAP,EAAU;IACVC,OAAO,CAACC,GAAR,CAAYF,CAAZ;EACD;AACF,C;;gBAZUH,O,YAcY,MAAM;EAC3B,OAfSA,OAeF,CAAKC,GAAZ;AACD,C;;gBAhBUD,O,cAkBc,MAAM;EAC7B,OAnBSA,OAmBF,CAAKE,KAAZ;AACD,C"}
|