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.
Files changed (406) hide show
  1. package/README.md +157 -2
  2. package/android/src/main/java/com/unitreactnativecomponents/UnitAddToWalletButtonViewManager.kt +27 -0
  3. package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsEvent.kt +21 -0
  4. package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsPackage.kt +2 -1
  5. package/android/src/main/java/com/unitreactnativecomponents/visapresentation/UNGooglePayView.kt +197 -0
  6. package/android/src/main/res/drawable/ic_launcher_background.xml +170 -0
  7. package/android/src/main/res/drawable/un_add_to_googlepay_button_content.xml +54 -0
  8. package/android/src/main/res/drawable/un_black_add_to_googlepay_button_content.xml +54 -0
  9. package/android/src/main/res/drawable/un_black_googlepay_button_background.xml +6 -0
  10. package/android/src/main/res/drawable/un_black_googlepay_button_background_image.9.png +0 -0
  11. package/android/src/main/res/drawable/un_black_googlepay_button_content.xml +48 -0
  12. package/android/src/main/res/drawable/un_black_googlepay_button_no_shadow_background.xml +6 -0
  13. package/android/src/main/res/drawable/un_black_googlepay_button_no_shadow_background_image.9.png +0 -0
  14. package/android/src/main/res/drawable/un_black_googlepay_button_overlay.xml +12 -0
  15. package/android/src/main/res/drawable/un_border.xml +6 -0
  16. package/android/src/main/res/drawable/un_condensed_googlepay.xml +27 -0
  17. package/android/src/main/res/drawable/un_googlepay_button_background.xml +18 -0
  18. package/android/src/main/res/drawable/un_googlepay_button_background_image.9.png +0 -0
  19. package/android/src/main/res/drawable/un_googlepay_button_background_image_focused.9.png +0 -0
  20. package/android/src/main/res/drawable/un_googlepay_button_background_image_pressed.9.png +0 -0
  21. package/android/src/main/res/drawable/un_googlepay_button_content.xml +48 -0
  22. package/android/src/main/res/drawable/un_googlepay_button_no_shadow_background.xml +18 -0
  23. package/android/src/main/res/drawable/un_googlepay_button_no_shadow_background_image.9.png +0 -0
  24. package/android/src/main/res/drawable/un_googlepay_button_no_shadow_background_image_focused.9.png +0 -0
  25. package/android/src/main/res/drawable/un_googlepay_button_no_shadow_background_image_pressed.9.png +0 -0
  26. package/android/src/main/res/drawable/un_googlepay_button_overlay.xml +11 -0
  27. package/android/src/main/res/drawable/un_ic_launcher_foreground.xml +30 -0
  28. package/android/src/main/res/drawable/un_ic_unit_logo.xml +25 -0
  29. package/android/src/main/res/drawable/un_ic_visa.xml +13 -0
  30. package/android/src/main/res/drawable-bg/un_add_to_googlepay_button_content.xml +54 -0
  31. package/android/src/main/res/drawable-bg/un_black_add_to_googlepay_button_content.xml +54 -0
  32. package/android/src/main/res/drawable-ca/un_add_to_googlepay_button_content.xml +30 -0
  33. package/android/src/main/res/drawable-ca/un_black_add_to_googlepay_button_content.xml +30 -0
  34. package/android/src/main/res/drawable-cs/un_add_to_googlepay_button_content.xml +54 -0
  35. package/android/src/main/res/drawable-cs/un_black_add_to_googlepay_button_content.xml +54 -0
  36. package/android/src/main/res/drawable-da/un_add_to_googlepay_button_content.xml +30 -0
  37. package/android/src/main/res/drawable-da/un_black_add_to_googlepay_button_content.xml +30 -0
  38. package/android/src/main/res/drawable-de/un_add_to_googlepay_button_content.xml +60 -0
  39. package/android/src/main/res/drawable-de/un_black_add_to_googlepay_button_content.xml +60 -0
  40. package/android/src/main/res/drawable-el/un_add_to_googlepay_button_content.xml +67 -0
  41. package/android/src/main/res/drawable-el/un_black_add_to_googlepay_button_content.xml +67 -0
  42. package/android/src/main/res/drawable-es/un_add_to_googlepay_button_content.xml +54 -0
  43. package/android/src/main/res/drawable-es/un_black_add_to_googlepay_button_content.xml +54 -0
  44. package/android/src/main/res/drawable-et/un_add_to_googlepay_button_content.xml +64 -0
  45. package/android/src/main/res/drawable-et/un_black_add_to_googlepay_button_content.xml +64 -0
  46. package/android/src/main/res/drawable-fi/un_add_to_googlepay_button_content.xml +39 -0
  47. package/android/src/main/res/drawable-fi/un_black_add_to_googlepay_button_content.xml +39 -0
  48. package/android/src/main/res/drawable-fr/un_add_to_googlepay_button_content.xml +54 -0
  49. package/android/src/main/res/drawable-fr/un_black_add_to_googlepay_button_content.xml +54 -0
  50. package/android/src/main/res/drawable-hr/un_add_to_googlepay_button_content.xml +54 -0
  51. package/android/src/main/res/drawable-hr/un_black_add_to_googlepay_button_content.xml +54 -0
  52. package/android/src/main/res/drawable-hu/un_add_to_googlepay_button_content.xml +64 -0
  53. package/android/src/main/res/drawable-hu/un_black_add_to_googlepay_button_content.xml +64 -0
  54. package/android/src/main/res/drawable-in/un_add_to_googlepay_button_content.xml +54 -0
  55. package/android/src/main/res/drawable-in/un_black_add_to_googlepay_button_content.xml +54 -0
  56. package/android/src/main/res/drawable-it/un_add_to_googlepay_button_content.xml +54 -0
  57. package/android/src/main/res/drawable-it/un_black_add_to_googlepay_button_content.xml +54 -0
  58. package/android/src/main/res/drawable-iw/un_add_to_googlepay_button_content.xml +41 -0
  59. package/android/src/main/res/drawable-iw/un_black_add_to_googlepay_button_content.xml +41 -0
  60. package/android/src/main/res/drawable-ja/un_add_to_googlepay_button_content.xml +54 -0
  61. package/android/src/main/res/drawable-ja/un_black_add_to_googlepay_button_content.xml +54 -0
  62. package/android/src/main/res/drawable-ko/un_add_to_googlepay_button_content.xml +54 -0
  63. package/android/src/main/res/drawable-ko/un_black_add_to_googlepay_button_content.xml +54 -0
  64. package/android/src/main/res/drawable-lt/un_add_to_googlepay_button_content.xml +70 -0
  65. package/android/src/main/res/drawable-lt/un_black_add_to_googlepay_button_content.xml +70 -0
  66. package/android/src/main/res/drawable-lv/un_add_to_googlepay_button_content.xml +61 -0
  67. package/android/src/main/res/drawable-lv/un_black_add_to_googlepay_button_content.xml +61 -0
  68. package/android/src/main/res/drawable-ms/un_add_to_googlepay_button_content.xml +54 -0
  69. package/android/src/main/res/drawable-ms/un_black_add_to_googlepay_button_content.xml +54 -0
  70. package/android/src/main/res/drawable-nb/un_add_to_googlepay_button_content.xml +30 -0
  71. package/android/src/main/res/drawable-nb/un_black_add_to_googlepay_button_content.xml +30 -0
  72. package/android/src/main/res/drawable-nl/un_add_to_googlepay_button_content.xml +58 -0
  73. package/android/src/main/res/drawable-nl/un_black_add_to_googlepay_button_content.xml +54 -0
  74. package/android/src/main/res/drawable-pl/un_add_to_googlepay_button_content.xml +30 -0
  75. package/android/src/main/res/drawable-pl/un_black_add_to_googlepay_button_content.xml +30 -0
  76. package/android/src/main/res/drawable-pt/un_add_to_googlepay_button_content.xml +54 -0
  77. package/android/src/main/res/drawable-pt/un_black_add_to_googlepay_button_content.xml +54 -0
  78. package/android/src/main/res/drawable-ro/un_add_to_googlepay_button_content.xml +58 -0
  79. package/android/src/main/res/drawable-ro/un_black_add_to_googlepay_button_content.xml +58 -0
  80. package/android/src/main/res/drawable-ru/un_add_to_googlepay_button_content.xml +54 -0
  81. package/android/src/main/res/drawable-ru/un_black_add_to_googlepay_button_content.xml +54 -0
  82. package/android/src/main/res/drawable-sk/un_add_to_googlepay_button_content.xml +54 -0
  83. package/android/src/main/res/drawable-sk/un_black_add_to_googlepay_button_content.xml +54 -0
  84. package/android/src/main/res/drawable-sl/un_add_to_googlepay_button_content.xml +54 -0
  85. package/android/src/main/res/drawable-sl/un_black_add_to_googlepay_button_content.xml +54 -0
  86. package/android/src/main/res/drawable-sr/un_add_to_googlepay_button_content.xml +54 -0
  87. package/android/src/main/res/drawable-sr/un_black_add_to_googlepay_button_content.xml +54 -0
  88. package/android/src/main/res/drawable-sv/un_add_to_googlepay_button_content.xml +30 -0
  89. package/android/src/main/res/drawable-sv/un_black_add_to_googlepay_button_content.xml +30 -0
  90. package/android/src/main/res/drawable-th/un_add_to_googlepay_button_content.xml +54 -0
  91. package/android/src/main/res/drawable-th/un_black_add_to_googlepay_button_content.xml +54 -0
  92. package/android/src/main/res/drawable-tr/un_add_to_googlepay_button_content.xml +54 -0
  93. package/android/src/main/res/drawable-tr/un_black_add_to_googlepay_button_content.xml +54 -0
  94. package/android/src/main/res/drawable-uk/un_add_to_googlepay_button_content.xml +54 -0
  95. package/android/src/main/res/drawable-uk/un_black_add_to_googlepay_button_content.xml +54 -0
  96. package/android/src/main/res/drawable-v21/un_black_googlepay_button_background.xml +7 -0
  97. package/android/src/main/res/drawable-v21/un_black_googlepay_button_background_image.9.png +0 -0
  98. package/android/src/main/res/drawable-v21/un_black_googlepay_button_no_shadow_background.xml +7 -0
  99. package/android/src/main/res/drawable-v21/un_black_googlepay_button_no_shadow_background_image.9.png +0 -0
  100. package/android/src/main/res/drawable-v24/ic_launcher_background.xml +170 -0
  101. package/android/src/main/res/drawable-v24/un_border.xml +6 -0
  102. package/android/src/main/res/drawable-v24/un_ic_launcher_foreground.xml +30 -0
  103. package/android/src/main/res/drawable-v24/un_ic_unit_logo.xml +25 -0
  104. package/android/src/main/res/drawable-v24/un_ic_visa.xml +13 -0
  105. package/android/src/main/res/drawable-zh/un_add_to_googlepay_button_content.xml +54 -0
  106. package/android/src/main/res/drawable-zh/un_black_add_to_googlepay_button_content.xml +54 -0
  107. package/android/src/main/res/layout/un_black_add_to_googlepay_button.xml +32 -0
  108. package/android/src/main/res/layout/un_view_google_push_provisioning.xml +45 -0
  109. package/android/src/main/res/layout/un_white_add_to_googlepay_button.xml +31 -0
  110. package/android/src/main/res/layout/un_white_add_to_googlepay_button_no_shadow.xml +31 -0
  111. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  112. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  113. package/android/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  114. package/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  115. package/android/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  116. package/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  117. package/android/src/main/res/mipmap-xhdpi/black_googlepay_button_background_image.9.png +0 -0
  118. package/android/src/main/res/mipmap-xhdpi/black_googlepay_button_no_shadow_background_image.9.png +0 -0
  119. package/android/src/main/res/mipmap-xhdpi/googlepay_button_background_image.9.png +0 -0
  120. package/android/src/main/res/mipmap-xhdpi/googlepay_button_background_image_focused.9.png +0 -0
  121. package/android/src/main/res/mipmap-xhdpi/googlepay_button_background_image_pressed.9.png +0 -0
  122. package/android/src/main/res/mipmap-xhdpi/googlepay_button_no_shadow_background_image_focused.9.png +0 -0
  123. package/android/src/main/res/mipmap-xhdpi/googlepay_button_no_shadow_background_image_pressed.9.png +0 -0
  124. package/android/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  125. package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  126. package/android/src/main/res/mipmap-xhdpi/white_googlepay_button_no_shadow_background_image.9.png +0 -0
  127. package/android/src/main/res/mipmap-xxhdpi/black_googlepay_button_background_image.9.png +0 -0
  128. package/android/src/main/res/mipmap-xxhdpi/black_googlepay_button_no_shadow_background_image.9.png +0 -0
  129. package/android/src/main/res/mipmap-xxhdpi/googlepay_button_background_image.9.png +0 -0
  130. package/android/src/main/res/mipmap-xxhdpi/googlepay_button_background_image_focused.9.png +0 -0
  131. package/android/src/main/res/mipmap-xxhdpi/googlepay_button_background_image_pressed.9.png +0 -0
  132. package/android/src/main/res/mipmap-xxhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
  133. package/android/src/main/res/mipmap-xxhdpi/googlepay_button_no_shadow_background_image_focused.9.png +0 -0
  134. package/android/src/main/res/mipmap-xxhdpi/googlepay_button_no_shadow_background_image_pressed.9.png +0 -0
  135. package/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  136. package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  137. package/android/src/main/res/mipmap-xxxhdpi/black_googlepay_button_background_image.9.png +0 -0
  138. package/android/src/main/res/mipmap-xxxhdpi/black_googlepay_button_no_shadow_background_image.9.png +0 -0
  139. package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_background_image.9.png +0 -0
  140. package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_background_image_focused.9.png +0 -0
  141. package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_background_image_pressed.9.png +0 -0
  142. package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
  143. package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_no_shadow_background_image_focused.9.png +0 -0
  144. package/android/src/main/res/mipmap-xxxhdpi/googlepay_button_no_shadow_background_image_pressed.9.png +0 -0
  145. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  146. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  147. package/android/src/main/res/values/colors.xml +14 -0
  148. package/android/src/main/res/values/googlepay_strings.xml +7 -0
  149. package/android/src/main/res/values/strings.xml +4 -0
  150. package/android/src/main/res/values/themes.xml +16 -0
  151. package/android/src/main/res/values-night/themes.xml +16 -0
  152. package/ios/UnitReactNativeComponents.xcodeproj/project.pbxproj +8 -8
  153. package/ios/UnitReactNativeComponentsViewManager.m +3 -2
  154. package/ios/UnitReactNativeComponentsViewManager.swift +39 -25
  155. package/lib/commonjs/assets/images/close.png +0 -0
  156. package/lib/commonjs/assets/images/index.js +16 -0
  157. package/lib/commonjs/assets/images/index.js.map +1 -0
  158. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +28 -0
  159. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -0
  160. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +20 -0
  161. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -0
  162. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +39 -0
  163. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -0
  164. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +40 -0
  165. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -0
  166. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +9 -0
  167. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -0
  168. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +195 -0
  169. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -0
  170. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js +23 -0
  171. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js.map +1 -0
  172. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +49 -0
  173. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -0
  174. package/lib/commonjs/components/{Card/CardComponent.js → UNCardComponent/UNCardComponent.js} +42 -46
  175. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -0
  176. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +42 -0
  177. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -0
  178. package/lib/commonjs/components/index.js +34 -8
  179. package/lib/commonjs/components/index.js.map +1 -1
  180. package/lib/commonjs/custom.d.js +2 -0
  181. package/lib/commonjs/custom.d.js.map +1 -0
  182. package/lib/commonjs/helpers/{BottomSheet.js → BottomSheet/BottomSheet.js} +38 -83
  183. package/lib/commonjs/helpers/BottomSheet/BottomSheet.js.map +1 -0
  184. package/lib/commonjs/helpers/BottomSheet/BottomSheet.styles.js +82 -0
  185. package/lib/commonjs/helpers/BottomSheet/BottomSheet.styles.js.map +1 -0
  186. package/lib/commonjs/helpers/EventBus.js +5 -13
  187. package/lib/commonjs/helpers/EventBus.js.map +1 -1
  188. package/lib/commonjs/hooks/listenerToBus.js +31 -0
  189. package/lib/commonjs/hooks/listenerToBus.js.map +1 -0
  190. package/lib/commonjs/hooks/useAppStateListener.js +34 -0
  191. package/lib/commonjs/hooks/useAppStateListener.js.map +1 -0
  192. package/lib/commonjs/index.js +33 -0
  193. package/lib/commonjs/index.js.map +1 -1
  194. package/lib/commonjs/messages/nativeMessages/index.js +13 -0
  195. package/lib/commonjs/messages/nativeMessages/index.js.map +1 -0
  196. package/lib/commonjs/messages/webMessages/bookPaymentMessage.js +13 -0
  197. package/lib/commonjs/messages/webMessages/bookPaymentMessage.js.map +1 -0
  198. package/lib/commonjs/{webComponent → messages}/webMessages/cardMessage.js +1 -1
  199. package/lib/commonjs/messages/webMessages/cardMessage.js.map +1 -0
  200. package/lib/commonjs/messages/webMessages/index.js +6 -0
  201. package/lib/commonjs/messages/webMessages/index.js.map +1 -0
  202. package/lib/commonjs/{webComponent → messages}/webMessages/pageMessage.js +0 -0
  203. package/lib/commonjs/messages/webMessages/pageMessage.js.map +1 -0
  204. package/lib/commonjs/{webComponent → messages}/webMessages/unitMessages.js +0 -0
  205. package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -0
  206. package/lib/commonjs/nativeComponent/UNNativeAddToWalletButton.js +13 -0
  207. package/lib/commonjs/nativeComponent/UNNativeAddToWalletButton.js.map +1 -0
  208. package/lib/commonjs/scripts/html/bodyHtml.js +52 -0
  209. package/lib/commonjs/scripts/html/bodyHtml.js.map +1 -0
  210. package/lib/commonjs/scripts/html/bodyScript.js +78 -0
  211. package/lib/commonjs/scripts/html/bodyScript.js.map +1 -0
  212. package/lib/commonjs/sharedTypes/bookPayment.types.js +6 -0
  213. package/lib/commonjs/sharedTypes/bookPayment.types.js.map +1 -0
  214. package/lib/commonjs/sharedTypes/card.types.js +6 -0
  215. package/lib/commonjs/sharedTypes/card.types.js.map +1 -0
  216. package/lib/commonjs/sharedTypes/index.js +32 -0
  217. package/lib/commonjs/sharedTypes/index.js.map +1 -0
  218. package/lib/commonjs/sharedTypes/types.js +2 -0
  219. package/lib/commonjs/sharedTypes/types.js.map +1 -0
  220. package/lib/commonjs/styles/variables.js +17 -0
  221. package/lib/commonjs/styles/variables.js.map +1 -0
  222. package/lib/commonjs/unitSdkManager/UnitSdk.api.js +54 -0
  223. package/lib/commonjs/unitSdkManager/UnitSdk.api.js.map +1 -0
  224. package/lib/commonjs/unitSdkManager/UnitSdkManager.js +51 -0
  225. package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -0
  226. package/lib/commonjs/webComponent/WebComponent.js +47 -15
  227. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  228. package/lib/commonjs/webComponent/html.js +22 -45
  229. package/lib/commonjs/webComponent/html.js.map +1 -1
  230. package/lib/module/assets/images/close.png +0 -0
  231. package/lib/module/assets/images/index.js +2 -0
  232. package/lib/module/assets/images/index.js.map +1 -0
  233. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +13 -0
  234. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -0
  235. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +10 -0
  236. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -0
  237. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +23 -0
  238. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -0
  239. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +26 -0
  240. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -0
  241. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +2 -0
  242. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -0
  243. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +163 -0
  244. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -0
  245. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js +13 -0
  246. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js.map +1 -0
  247. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +29 -0
  248. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -0
  249. package/lib/module/components/UNCardComponent/UNCardComponent.js +65 -0
  250. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -0
  251. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +24 -0
  252. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -0
  253. package/lib/module/components/index.js +4 -2
  254. package/lib/module/components/index.js.map +1 -1
  255. package/lib/module/custom.d.js +2 -0
  256. package/lib/module/custom.d.js.map +1 -0
  257. package/lib/module/helpers/{BottomSheet.js → BottomSheet/BottomSheet.js} +36 -82
  258. package/lib/module/helpers/BottomSheet/BottomSheet.js.map +1 -0
  259. package/lib/module/helpers/BottomSheet/BottomSheet.styles.js +70 -0
  260. package/lib/module/helpers/BottomSheet/BottomSheet.styles.js.map +1 -0
  261. package/lib/module/helpers/EventBus.js +4 -11
  262. package/lib/module/helpers/EventBus.js.map +1 -1
  263. package/lib/module/hooks/listenerToBus.js +18 -0
  264. package/lib/module/hooks/listenerToBus.js.map +1 -0
  265. package/lib/module/hooks/useAppStateListener.js +23 -0
  266. package/lib/module/hooks/useAppStateListener.js.map +1 -0
  267. package/lib/module/index.js +2 -0
  268. package/lib/module/index.js.map +1 -1
  269. package/lib/module/messages/nativeMessages/index.js +6 -0
  270. package/lib/module/messages/nativeMessages/index.js.map +1 -0
  271. package/lib/module/messages/webMessages/bookPaymentMessage.js +6 -0
  272. package/lib/module/messages/webMessages/bookPaymentMessage.js.map +1 -0
  273. package/lib/module/messages/webMessages/cardMessage.js +6 -0
  274. package/lib/module/messages/webMessages/cardMessage.js.map +1 -0
  275. package/lib/module/messages/webMessages/index.js +2 -0
  276. package/lib/module/messages/webMessages/index.js.map +1 -0
  277. package/lib/module/{webComponent → messages}/webMessages/pageMessage.js +0 -0
  278. package/lib/module/messages/webMessages/pageMessage.js.map +1 -0
  279. package/lib/module/{webComponent → messages}/webMessages/unitMessages.js +0 -0
  280. package/lib/module/messages/webMessages/unitMessages.js.map +1 -0
  281. package/lib/module/nativeComponent/UNNativeAddToWalletButton.js +4 -0
  282. package/lib/module/nativeComponent/UNNativeAddToWalletButton.js.map +1 -0
  283. package/lib/module/scripts/html/bodyHtml.js +42 -0
  284. package/lib/module/scripts/html/bodyHtml.js.map +1 -0
  285. package/lib/module/scripts/html/bodyScript.js +64 -0
  286. package/lib/module/scripts/html/bodyScript.js.map +1 -0
  287. package/lib/module/sharedTypes/bookPayment.types.js +2 -0
  288. package/lib/module/sharedTypes/bookPayment.types.js.map +1 -0
  289. package/lib/module/sharedTypes/card.types.js +2 -0
  290. package/lib/module/sharedTypes/card.types.js.map +1 -0
  291. package/lib/module/sharedTypes/index.js +3 -0
  292. package/lib/module/sharedTypes/index.js.map +1 -0
  293. package/lib/module/sharedTypes/types.js +2 -0
  294. package/lib/module/sharedTypes/types.js.map +1 -0
  295. package/lib/module/styles/variables.js +10 -0
  296. package/lib/module/styles/variables.js.map +1 -0
  297. package/lib/module/unitSdkManager/UnitSdk.api.js +37 -0
  298. package/lib/module/unitSdkManager/UnitSdk.api.js.map +1 -0
  299. package/lib/module/unitSdkManager/UnitSdkManager.js +38 -0
  300. package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -0
  301. package/lib/module/webComponent/WebComponent.js +46 -14
  302. package/lib/module/webComponent/WebComponent.js.map +1 -1
  303. package/lib/module/webComponent/html.js +18 -44
  304. package/lib/module/webComponent/html.js.map +1 -1
  305. package/lib/typescript/assets/images/index.d.ts +1 -0
  306. package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +6 -0
  307. package/lib/typescript/components/UNActivityComponent/UNActivityComponent.utils.d.ts +2 -0
  308. package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +11 -0
  309. package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.d.ts +3 -0
  310. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +1 -0
  311. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +7 -0
  312. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.d.ts +9 -0
  313. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +5 -0
  314. package/lib/typescript/components/{Card/CardComponent.d.ts → UNCardComponent/UNCardComponent.d.ts} +3 -1
  315. package/lib/typescript/components/UNCardComponent/UNCardComponent.utils.d.ts +6 -0
  316. package/lib/typescript/components/index.d.ts +4 -2
  317. package/lib/typescript/helpers/{BottomSheet.d.ts → BottomSheet/BottomSheet.d.ts} +3 -0
  318. package/lib/typescript/helpers/BottomSheet/BottomSheet.styles.d.ts +63 -0
  319. package/lib/typescript/helpers/EventBus.d.ts +5 -7
  320. package/lib/typescript/hooks/listenerToBus.d.ts +7 -0
  321. package/lib/typescript/hooks/useAppStateListener.d.ts +1 -0
  322. package/lib/typescript/index.d.ts +2 -0
  323. package/lib/typescript/messages/nativeMessages/index.d.ts +3 -0
  324. package/lib/typescript/messages/webMessages/bookPaymentMessage.d.ts +8 -0
  325. package/lib/typescript/{webComponent → messages}/webMessages/cardMessage.d.ts +3 -2
  326. package/lib/typescript/messages/webMessages/index.d.ts +11 -0
  327. package/lib/typescript/{webComponent → messages}/webMessages/pageMessage.d.ts +0 -0
  328. package/lib/typescript/{webComponent → messages}/webMessages/unitMessages.d.ts +0 -0
  329. package/lib/typescript/nativeComponent/UNNativeAddToWalletButton.d.ts +6 -0
  330. package/lib/typescript/scripts/html/bodyHtml.d.ts +7 -0
  331. package/lib/typescript/scripts/html/bodyScript.d.ts +11 -0
  332. package/lib/typescript/sharedTypes/bookPayment.types.d.ts +26 -0
  333. package/lib/typescript/sharedTypes/card.types.d.ts +56 -0
  334. package/lib/typescript/sharedTypes/index.d.ts +2 -0
  335. package/lib/typescript/sharedTypes/types.d.ts +27 -0
  336. package/lib/typescript/styles/variables.d.ts +9 -0
  337. package/lib/typescript/unitSdkManager/UnitSdk.api.d.ts +3 -0
  338. package/lib/typescript/unitSdkManager/UnitSdkManager.d.ts +15 -0
  339. package/lib/typescript/webComponent/WebComponent.d.ts +9 -11
  340. package/lib/typescript/webComponent/html.d.ts +6 -1
  341. package/package.json +9 -5
  342. package/{unit-react-native-components.podspec → react-native-unit-components.podspec} +1 -1
  343. package/src/assets/images/close.png +0 -0
  344. package/src/assets/images/index.ts +1 -0
  345. package/src/components/UNActivityComponent/UNActivityComponent.tsx +21 -0
  346. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +11 -0
  347. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +37 -0
  348. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.ts +29 -0
  349. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.ts +1 -0
  350. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.ts +13 -0
  351. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +167 -0
  352. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +34 -0
  353. package/src/components/UNCardComponent/UNCardComponent.tsx +73 -0
  354. package/src/components/UNCardComponent/UNCardComponent.utils.ts +28 -0
  355. package/src/components/index.ts +4 -2
  356. package/src/custom.d.ts +5 -0
  357. package/src/helpers/BottomSheet/BottomSheet.styles.ts +70 -0
  358. package/src/helpers/{BottomSheet.tsx → BottomSheet/BottomSheet.tsx} +74 -110
  359. package/src/helpers/EventBus.ts +13 -13
  360. package/src/hooks/listenerToBus.ts +23 -0
  361. package/src/hooks/useAppStateListener.ts +25 -0
  362. package/src/index.tsx +5 -1
  363. package/src/messages/nativeMessages/index.ts +3 -0
  364. package/src/messages/webMessages/bookPaymentMessage.ts +12 -0
  365. package/src/{webComponent → messages}/webMessages/cardMessage.ts +4 -2
  366. package/src/messages/webMessages/index.ts +21 -0
  367. package/src/{webComponent → messages}/webMessages/pageMessage.ts +1 -1
  368. package/src/{webComponent → messages}/webMessages/unitMessages.ts +1 -0
  369. package/src/nativeComponent/UNNativeAddToWalletButton.tsx +12 -0
  370. package/src/scripts/html/bodyHtml.ts +46 -0
  371. package/src/scripts/html/bodyScript.ts +67 -0
  372. package/src/sharedTypes/bookPayment.types.ts +27 -0
  373. package/src/sharedTypes/card.types.ts +59 -0
  374. package/src/sharedTypes/index.ts +2 -0
  375. package/src/sharedTypes/types.ts +35 -0
  376. package/src/styles/variables.ts +9 -0
  377. package/src/unitSdkManager/UnitSdk.api.ts +31 -0
  378. package/src/unitSdkManager/UnitSdkManager.ts +33 -0
  379. package/src/webComponent/WebComponent.tsx +55 -45
  380. package/src/webComponent/html.ts +22 -46
  381. package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsViewManager.kt +0 -19
  382. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +0 -143
  383. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js.map +0 -1
  384. package/lib/commonjs/components/Card/CardComponent.js.map +0 -1
  385. package/lib/commonjs/helpers/BottomSheet.js.map +0 -1
  386. package/lib/commonjs/nativeComponenet/NativeComponentExample.js +0 -19
  387. package/lib/commonjs/nativeComponenet/NativeComponentExample.js.map +0 -1
  388. package/lib/commonjs/webComponent/webMessages/cardMessage.js.map +0 -1
  389. package/lib/commonjs/webComponent/webMessages/pageMessage.js.map +0 -1
  390. package/lib/commonjs/webComponent/webMessages/unitMessages.js.map +0 -1
  391. package/lib/module/components/BottomSheet/BottomSheetComponent.js +0 -118
  392. package/lib/module/components/BottomSheet/BottomSheetComponent.js.map +0 -1
  393. package/lib/module/components/Card/CardComponent.js +0 -75
  394. package/lib/module/components/Card/CardComponent.js.map +0 -1
  395. package/lib/module/helpers/BottomSheet.js.map +0 -1
  396. package/lib/module/nativeComponenet/NativeComponentExample.js +0 -10
  397. package/lib/module/nativeComponenet/NativeComponentExample.js.map +0 -1
  398. package/lib/module/webComponent/webMessages/cardMessage.js +0 -6
  399. package/lib/module/webComponent/webMessages/cardMessage.js.map +0 -1
  400. package/lib/module/webComponent/webMessages/pageMessage.js.map +0 -1
  401. package/lib/module/webComponent/webMessages/unitMessages.js.map +0 -1
  402. package/lib/typescript/components/BottomSheet/BottomSheetComponent.d.ts +0 -1
  403. package/lib/typescript/nativeComponenet/NativeComponentExample.d.ts +0 -7
  404. package/src/components/BottomSheet/BottomSheetComponent.tsx +0 -113
  405. package/src/components/Card/CardComponent.tsx +0 -75
  406. package/src/nativeComponenet/NativeComponentExample.tsx +0 -26
package/README.md CHANGED
@@ -1,2 +1,157 @@
1
- # unit-react-native-components
2
- Unit React Native Components
1
+ # React Native SDK
2
+
3
+ ## Installation
4
+
5
+ Add the react-native-unit-components dependency to your project:
6
+
7
+ With npm:
8
+ ```bash
9
+ $ npm install --save react-native-unit-components
10
+ ```
11
+
12
+ With yarn:
13
+ ```bash
14
+ $ yarn add react-native-unit-components
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ### Initialize Unit SDK
20
+ Call to `UnitSDK.init` in your root component with the requested environment and your source.
21
+ This also helps us to improve the app performance.
22
+
23
+ The `UNEnvironment` enum should be used.
24
+ ```js
25
+ enum UNEnvironment {
26
+ sandbox,
27
+ production
28
+ }
29
+ ```
30
+ #### Input:
31
+ | Name | Type | Required | Description |
32
+ | --------------- | ---------------------------- | --------- | -------------------------------------------- |
33
+ | env | UNEnvironment | YES | Unit environment. |
34
+ | theme | string | NO | A URL that specifies the UI configuration. |
35
+
36
+ #### Example:
37
+ ```js
38
+ import React, { useEffect } from 'react';
39
+ import { UnitSDK, UNEnvironment } from 'react-native-unit-components';
40
+
41
+ const THEME = 'A URL that specifies the UI configuration';
42
+
43
+ export default function YourRootComponent() {
44
+ useEffect(() => {
45
+ UnitSDK.init(UNEnvironment.production, THEME);
46
+ }, [])
47
+ }
48
+ ```
49
+
50
+ ### Bottom Sheet Component
51
+
52
+ The `UNBottomSheetComponent` is a View that our SDK controls in order to show menus and forms in your application.
53
+ It is mandatory to have one `UNBottomSheetComponent` when our components are visible.
54
+
55
+ The `UNBottomSheetComponent` have an absolute position and should be able to take the full width the height of the screen.
56
+ We recommend to place the `UNBottomSheetComponent` in your root component of your application.
57
+
58
+ #### The structure of your root component might look as follows:
59
+ ```js
60
+ import React, { useEffect } from 'react';
61
+ import { UNBottomSheetComponent } from 'react-native-unit-components';
62
+
63
+ export default function YourRootComponent() {
64
+ return (
65
+ <>
66
+ <YourComponents />
67
+ <UNBottomSheetComponent />
68
+ </>
69
+ );
70
+ }
71
+ ```
72
+
73
+ ### Components
74
+
75
+ #### Card Component
76
+
77
+ ##### UNCardComponent props:
78
+ | Name | Type | Required | Description |
79
+ | --------------- | ---------------------------- | --------- | -------------------------------------------- |
80
+ | customerToken | string | YES | A Unit Customer token. |
81
+ | cardId | string | YES | Unit card id. |
82
+ | theme | string | No | A URL that specifies the UI configuration. |
83
+ | onStatusChanged | (card: UNCardData) => void | No | Callback for card status changes. |
84
+
85
+ ##### Example:
86
+ ```js
87
+ import React from 'react';
88
+ import { UNCardComponent, UNCardData } from 'react-native-unit-components';
89
+
90
+ export default function YourComponent() {
91
+ return (
92
+ <UNCardComponent
93
+ cardId={'632197'}
94
+ customerToken={''}
95
+ onStatusChanged={(card: UNCardData) => { console.log(card) }}
96
+ />
97
+ );
98
+ }
99
+ ```
100
+
101
+ #### Book Payment Component
102
+
103
+ ##### UNBookPaymentComponent props:
104
+ | Name | Type | Required | Description |
105
+ | --------------------- | -------------------------------------- | --------- | ---------------------------------------------- |
106
+ | customerToken | string | YES | A Unit Customer token. |
107
+ | accountId | string | YES | Unit account id. The account from which money is being sent. |
108
+ | counterPartyAccountId | string | YES | Unit account id. The account which will receive money. |
109
+ | counterPartyName | string | YES | Name of the counterparty. This is the name that will be displayed in the Book Payment UI during the transfer.|
110
+ | isSameCustomer | boolean | NO | Stating whether both accounts belong to the same customer. Allows fetching additional information about the counterparty account. Default "false" |
111
+ | theme | string | No | A URL that specifies the UI configuration. |
112
+ | onPaymentCreated | (bookPayment: BookPaymentType) => void | NO | Callback for the created bookPayment. |
113
+
114
+
115
+ ##### Example:
116
+ ```js
117
+ import React from 'react';
118
+ import { UNBookPaymentComponent } from 'react-native-unit-components';
119
+
120
+ export default function YourComponent() {
121
+ return (
122
+ <UNBookPaymentComponent
123
+ customerToken={''}
124
+ accountId={'1105561'}
125
+ counterPartyAccountId={'1105562'}
126
+ counterPartyName={'Peter Parker"'}
127
+ isSameCustomer={true}
128
+ onPaymentCreated={(bookPayment: BookPaymentType) => { console.log(bookPayment) }}
129
+ />
130
+ );
131
+ }
132
+ ```
133
+
134
+ #### Activity Component
135
+
136
+ ##### UNActivityComponent props:
137
+ | Name | Type | Required | Description |
138
+ | --------------------- | -------------------------------------- | --------- | ---------------------------------------------- |
139
+ | customerToken | string | YES | A Unit Customer token. |
140
+ | accountId | string | No | Unit account id. The account for which the activity will be shown. If not specified: the activity of the customer (all accounts) will be shown |
141
+ | theme | string | No | A URL that specifies the UI configuration. |
142
+
143
+
144
+ ##### Example:
145
+ ```js
146
+ import React from 'react';
147
+ import { UNActivityComponent } from 'react-native-unit-components';
148
+
149
+ export default function YourComponent() {
150
+ return (
151
+ <UNActivityComponent
152
+ customerToken={''}
153
+ accountId={'1105561'}
154
+ />
155
+ );
156
+ }
157
+ ```
@@ -0,0 +1,27 @@
1
+ package com.unitreactnativecomponents
2
+ import com.facebook.react.common.MapBuilder
3
+ import com.facebook.react.uimanager.SimpleViewManager
4
+ import com.facebook.react.uimanager.ThemedReactContext
5
+ import com.facebook.react.uimanager.UIManagerHelper
6
+ import com.unitreactnativecomponents.visapresentation.UNGooglePayView
7
+
8
+
9
+ class UnitAddToWalletButtonViewManager : SimpleViewManager<UNGooglePayView>() {
10
+ override fun getName() = "UnitAddToWalletButtonView"
11
+
12
+ override fun createViewInstance(reactContext: ThemedReactContext): UNGooglePayView {
13
+ val unGooglePayView = UNGooglePayView(reactContext)
14
+ unGooglePayView.onAddToWalletClicked {
15
+ val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
16
+ UIManagerHelper.getEventDispatcherForReactTag(reactContext, unGooglePayView.id)
17
+ ?.dispatchEvent(UnitReactNativeComponentsEvent(surfaceId, unGooglePayView.id))
18
+ }
19
+ return unGooglePayView
20
+ }
21
+
22
+ override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> {
23
+ return MapBuilder.of(
24
+ "onAddToWalletClicked", MapBuilder.of("registrationName","onAddToWalletClicked")
25
+ )
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ package com.unitreactnativecomponents
2
+ import com.facebook.react.bridge.Arguments
3
+ import com.facebook.react.bridge.WritableMap
4
+ import com.facebook.react.uimanager.events.Event
5
+
6
+ class UnitReactNativeComponentsEvent (surfaceId: Int, viewTag: Int) : Event<UnitReactNativeComponentsEvent>() {
7
+ private val kEventName = "onAddToWalletClicked"
8
+
9
+ init {
10
+ super.init(surfaceId, viewTag)
11
+ }
12
+
13
+ override fun getEventData(): WritableMap? {
14
+ //empty data response
15
+ return Arguments.createMap();
16
+ }
17
+
18
+ override fun getEventName(): String {
19
+ return kEventName
20
+ }
21
+ }
@@ -11,6 +11,7 @@ class UnitReactNativeComponentsPackage : ReactPackage {
11
11
  }
12
12
 
13
13
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
14
- return listOf(UnitReactNativeComponentsViewManager())
14
+ return listOf(UnitAddToWalletButtonViewManager())
15
15
  }
16
+
16
17
  }
@@ -0,0 +1,197 @@
1
+ package com.unitreactnativecomponents.visapresentation
2
+
3
+ import android.content.Context
4
+ import android.content.res.Configuration
5
+ import android.util.AttributeSet
6
+ import android.view.LayoutInflater
7
+ import android.view.View
8
+ import android.widget.ImageView
9
+ import android.widget.RelativeLayout
10
+ import android.widget.TextView
11
+ import com.unitreactnativecomponents.R
12
+
13
+ /**
14
+ * This theme enum outlines the background color of your activity
15
+ */
16
+ enum class UNGooglePayButtonTheme {
17
+ Dark,
18
+ Colorful,
19
+ Light;
20
+ }
21
+
22
+ /**
23
+ * This style enum outlines the desired style for your button(Outlined can be applied only with a 'Dark' or 'Colorful' theme)
24
+ */
25
+ enum class UNGooglePayButtonStyle {
26
+ Regular,
27
+ Outlined;
28
+ }
29
+
30
+ /**
31
+ * A class that was created to make Google's branding review implementation easier for Unit customers.
32
+ */
33
+
34
+ class UNGooglePayView @JvmOverloads constructor(
35
+ context: Context,
36
+ attrs: AttributeSet? = null,
37
+ defStyleAttr: Int = 0
38
+ ) : RelativeLayout(context, attrs, defStyleAttr) {
39
+
40
+ private var whiteAddToGooglePayButtonNoShadow: RelativeLayout
41
+ private var blackAddToGooglePayButton: RelativeLayout
42
+ private var whiteAddToGooglePayButton: RelativeLayout
43
+ private var viewLayout: RelativeLayout
44
+ private var onAddToWalletClicked: (() -> Unit)? = null
45
+ private var shouldSetThemeAccordingToSystemTheme = false
46
+ private var isDarkMode = false
47
+
48
+
49
+
50
+ /**
51
+ * This variable holds the style of the 'Add To GPay button'.
52
+ * when it is set it will redisplay the button if it is necessary.
53
+ */
54
+ private var currentStyle: UNGooglePayButtonStyle = UNGooglePayButtonStyle.Regular
55
+ set(value) {
56
+ val hasChanged = field != value
57
+ field = value
58
+ if (hasChanged) {
59
+ display()
60
+ }
61
+ }
62
+
63
+ /**
64
+ * This variable holds the theme of the app's background color.
65
+ * when it is set it will redisplay the button if it is necessary.
66
+ */
67
+ private var currentTheme: UNGooglePayButtonTheme = UNGooglePayButtonTheme.Light
68
+ set(value) {
69
+ val hasChanged = field != value
70
+ field = value
71
+ if (hasChanged) {
72
+ display()
73
+ }
74
+ }
75
+
76
+ init {
77
+ val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
78
+ inflater.inflate(R.layout.un_view_google_push_provisioning, this)
79
+
80
+ whiteAddToGooglePayButtonNoShadow =
81
+ findViewById(R.id.white_add_to_googlepay_button_no_shadow)
82
+ blackAddToGooglePayButton = findViewById(R.id.black_add_to_googlepay_button)
83
+ whiteAddToGooglePayButton = findViewById(R.id.white_add_to_googlepay_button)
84
+ viewLayout = findViewById(R.id.google_view_push_provisioning_layout)
85
+
86
+ blackAddToGooglePayButton.setOnClickListener {
87
+ onAddToWalletClicked?.invoke()
88
+ }
89
+
90
+ whiteAddToGooglePayButton.setOnClickListener {
91
+ onAddToWalletClicked?.invoke()
92
+ }
93
+
94
+ showAddToGooglePlayButton(blackAddToGooglePayButton)
95
+ }
96
+
97
+ fun setStyle(style: UNGooglePayButtonStyle) {
98
+ this.currentStyle = style
99
+ }
100
+
101
+ fun setTheme(theme: UNGooglePayButtonTheme) {
102
+ setThemeAccordingToSystemTheme(false)
103
+ this.currentTheme = theme
104
+ }
105
+
106
+ fun onAddToWalletClicked(callback: () -> Unit) {
107
+ onAddToWalletClicked = callback
108
+ }
109
+
110
+ /**
111
+ * This method will remove all the views related to this class off the screen.
112
+ */
113
+ fun clearGooglePayViews() {
114
+ viewLayout.visibility = INVISIBLE
115
+ whiteAddToGooglePayButtonNoShadow.visibility = INVISIBLE
116
+ blackAddToGooglePayButton.visibility = INVISIBLE
117
+ whiteAddToGooglePayButton.visibility = INVISIBLE
118
+ }
119
+
120
+ /**
121
+ * This private method will display the view according to night mode or it's theme and style.
122
+ */
123
+ private fun display() {
124
+ clearGooglePayViews()
125
+ viewLayout.visibility = VISIBLE
126
+ if (shouldSetThemeAccordingToSystemTheme) {
127
+ showAddToGooglePlayButtonByUserUiMode()
128
+ } else {
129
+ updateViewsAccordingToThemeAndStyle()
130
+ }
131
+ }
132
+
133
+ private fun updateViewsAccordingToThemeAndStyle() {
134
+ when (currentTheme) {
135
+ UNGooglePayButtonTheme.Light -> {
136
+ when (currentStyle) {
137
+ UNGooglePayButtonStyle.Regular -> {
138
+ showAddToGooglePlayButton(blackAddToGooglePayButton)
139
+ }
140
+ UNGooglePayButtonStyle.Outlined -> {
141
+ showAddToGooglePlayButton(whiteAddToGooglePayButtonNoShadow)
142
+ }
143
+ }
144
+ }
145
+ UNGooglePayButtonTheme.Dark, UNGooglePayButtonTheme.Colorful -> {
146
+ when (currentStyle) {
147
+ UNGooglePayButtonStyle.Regular -> {
148
+ showAddToGooglePlayButton(whiteAddToGooglePayButton)
149
+ }
150
+ else -> {
151
+ }
152
+ }
153
+ }
154
+ }
155
+ }
156
+
157
+ /**
158
+ * This method will determine the 'Add to GPay' button theme according to the mobile phone's Night mode if it is set to 'true'.
159
+ */
160
+ fun setThemeAccordingToSystemTheme(shouldSetThemeAccordingToSystemTheme: Boolean) {
161
+ this.shouldSetThemeAccordingToSystemTheme = shouldSetThemeAccordingToSystemTheme
162
+ updateViewAccordingToSystemIfNeeded()
163
+ }
164
+
165
+ fun updateThemeAccordingToSystem() {
166
+ updateViewAccordingToSystemIfNeeded()
167
+ }
168
+
169
+ private fun updateViewAccordingToSystemIfNeeded() {
170
+ if (shouldSetThemeAccordingToSystemTheme) {
171
+ changeThemeAccordingToSystem()
172
+ }
173
+ }
174
+
175
+ private fun changeThemeAccordingToSystem() {
176
+ when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
177
+ Configuration.UI_MODE_NIGHT_YES -> {
178
+ isDarkMode = true
179
+ currentTheme = UNGooglePayButtonTheme.Dark
180
+ }
181
+
182
+ Configuration.UI_MODE_NIGHT_NO -> {
183
+ isDarkMode = false
184
+ currentTheme = UNGooglePayButtonTheme.Light
185
+ }
186
+ }
187
+ }
188
+
189
+ private fun showAddToGooglePlayButtonByUserUiMode() {
190
+ val buttonType = if (isDarkMode) whiteAddToGooglePayButton else blackAddToGooglePayButton
191
+ showAddToGooglePlayButton(buttonType)
192
+ }
193
+
194
+ private fun showAddToGooglePlayButton(button: RelativeLayout) {
195
+ button.visibility = VISIBLE
196
+ }
197
+ }
@@ -0,0 +1,170 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:width="108dp"
4
+ android:height="108dp"
5
+ android:viewportWidth="108"
6
+ android:viewportHeight="108">
7
+ <path
8
+ android:fillColor="#3DDC84"
9
+ android:pathData="M0,0h108v108h-108z" />
10
+ <path
11
+ android:fillColor="#00000000"
12
+ android:pathData="M9,0L9,108"
13
+ android:strokeWidth="0.8"
14
+ android:strokeColor="#33FFFFFF" />
15
+ <path
16
+ android:fillColor="#00000000"
17
+ android:pathData="M19,0L19,108"
18
+ android:strokeWidth="0.8"
19
+ android:strokeColor="#33FFFFFF" />
20
+ <path
21
+ android:fillColor="#00000000"
22
+ android:pathData="M29,0L29,108"
23
+ android:strokeWidth="0.8"
24
+ android:strokeColor="#33FFFFFF" />
25
+ <path
26
+ android:fillColor="#00000000"
27
+ android:pathData="M39,0L39,108"
28
+ android:strokeWidth="0.8"
29
+ android:strokeColor="#33FFFFFF" />
30
+ <path
31
+ android:fillColor="#00000000"
32
+ android:pathData="M49,0L49,108"
33
+ android:strokeWidth="0.8"
34
+ android:strokeColor="#33FFFFFF" />
35
+ <path
36
+ android:fillColor="#00000000"
37
+ android:pathData="M59,0L59,108"
38
+ android:strokeWidth="0.8"
39
+ android:strokeColor="#33FFFFFF" />
40
+ <path
41
+ android:fillColor="#00000000"
42
+ android:pathData="M69,0L69,108"
43
+ android:strokeWidth="0.8"
44
+ android:strokeColor="#33FFFFFF" />
45
+ <path
46
+ android:fillColor="#00000000"
47
+ android:pathData="M79,0L79,108"
48
+ android:strokeWidth="0.8"
49
+ android:strokeColor="#33FFFFFF" />
50
+ <path
51
+ android:fillColor="#00000000"
52
+ android:pathData="M89,0L89,108"
53
+ android:strokeWidth="0.8"
54
+ android:strokeColor="#33FFFFFF" />
55
+ <path
56
+ android:fillColor="#00000000"
57
+ android:pathData="M99,0L99,108"
58
+ android:strokeWidth="0.8"
59
+ android:strokeColor="#33FFFFFF" />
60
+ <path
61
+ android:fillColor="#00000000"
62
+ android:pathData="M0,9L108,9"
63
+ android:strokeWidth="0.8"
64
+ android:strokeColor="#33FFFFFF" />
65
+ <path
66
+ android:fillColor="#00000000"
67
+ android:pathData="M0,19L108,19"
68
+ android:strokeWidth="0.8"
69
+ android:strokeColor="#33FFFFFF" />
70
+ <path
71
+ android:fillColor="#00000000"
72
+ android:pathData="M0,29L108,29"
73
+ android:strokeWidth="0.8"
74
+ android:strokeColor="#33FFFFFF" />
75
+ <path
76
+ android:fillColor="#00000000"
77
+ android:pathData="M0,39L108,39"
78
+ android:strokeWidth="0.8"
79
+ android:strokeColor="#33FFFFFF" />
80
+ <path
81
+ android:fillColor="#00000000"
82
+ android:pathData="M0,49L108,49"
83
+ android:strokeWidth="0.8"
84
+ android:strokeColor="#33FFFFFF" />
85
+ <path
86
+ android:fillColor="#00000000"
87
+ android:pathData="M0,59L108,59"
88
+ android:strokeWidth="0.8"
89
+ android:strokeColor="#33FFFFFF" />
90
+ <path
91
+ android:fillColor="#00000000"
92
+ android:pathData="M0,69L108,69"
93
+ android:strokeWidth="0.8"
94
+ android:strokeColor="#33FFFFFF" />
95
+ <path
96
+ android:fillColor="#00000000"
97
+ android:pathData="M0,79L108,79"
98
+ android:strokeWidth="0.8"
99
+ android:strokeColor="#33FFFFFF" />
100
+ <path
101
+ android:fillColor="#00000000"
102
+ android:pathData="M0,89L108,89"
103
+ android:strokeWidth="0.8"
104
+ android:strokeColor="#33FFFFFF" />
105
+ <path
106
+ android:fillColor="#00000000"
107
+ android:pathData="M0,99L108,99"
108
+ android:strokeWidth="0.8"
109
+ android:strokeColor="#33FFFFFF" />
110
+ <path
111
+ android:fillColor="#00000000"
112
+ android:pathData="M19,29L89,29"
113
+ android:strokeWidth="0.8"
114
+ android:strokeColor="#33FFFFFF" />
115
+ <path
116
+ android:fillColor="#00000000"
117
+ android:pathData="M19,39L89,39"
118
+ android:strokeWidth="0.8"
119
+ android:strokeColor="#33FFFFFF" />
120
+ <path
121
+ android:fillColor="#00000000"
122
+ android:pathData="M19,49L89,49"
123
+ android:strokeWidth="0.8"
124
+ android:strokeColor="#33FFFFFF" />
125
+ <path
126
+ android:fillColor="#00000000"
127
+ android:pathData="M19,59L89,59"
128
+ android:strokeWidth="0.8"
129
+ android:strokeColor="#33FFFFFF" />
130
+ <path
131
+ android:fillColor="#00000000"
132
+ android:pathData="M19,69L89,69"
133
+ android:strokeWidth="0.8"
134
+ android:strokeColor="#33FFFFFF" />
135
+ <path
136
+ android:fillColor="#00000000"
137
+ android:pathData="M19,79L89,79"
138
+ android:strokeWidth="0.8"
139
+ android:strokeColor="#33FFFFFF" />
140
+ <path
141
+ android:fillColor="#00000000"
142
+ android:pathData="M29,19L29,89"
143
+ android:strokeWidth="0.8"
144
+ android:strokeColor="#33FFFFFF" />
145
+ <path
146
+ android:fillColor="#00000000"
147
+ android:pathData="M39,19L39,89"
148
+ android:strokeWidth="0.8"
149
+ android:strokeColor="#33FFFFFF" />
150
+ <path
151
+ android:fillColor="#00000000"
152
+ android:pathData="M49,19L49,89"
153
+ android:strokeWidth="0.8"
154
+ android:strokeColor="#33FFFFFF" />
155
+ <path
156
+ android:fillColor="#00000000"
157
+ android:pathData="M59,19L59,89"
158
+ android:strokeWidth="0.8"
159
+ android:strokeColor="#33FFFFFF" />
160
+ <path
161
+ android:fillColor="#00000000"
162
+ android:pathData="M69,19L69,89"
163
+ android:strokeWidth="0.8"
164
+ android:strokeColor="#33FFFFFF" />
165
+ <path
166
+ android:fillColor="#00000000"
167
+ android:pathData="M79,19L79,89"
168
+ android:strokeWidth="0.8"
169
+ android:strokeColor="#33FFFFFF" />
170
+ </vector>
@@ -0,0 +1,54 @@
1
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+ android:width="91dp"
3
+ android:height="17dp"
4
+ android:viewportWidth="91"
5
+ android:viewportHeight="17">
6
+ <path
7
+ android:pathData="M3.976,2.976L5.768,2.976L9.534,13L7.798,13L6.902,10.438L2.856,10.438L1.946,13L0.21,13L3.976,2.976ZM6.37,8.982L5.306,6L4.914,4.838L4.83,4.838L4.438,6L3.374,8.982L6.37,8.982ZM13.632,13.224C12.988,13.224 12.4047,13.0607 11.882,12.734C11.3593,12.4073 10.9463,11.957 10.643,11.383C10.3397,10.809 10.188,10.158 10.188,9.43C10.188,8.702 10.3397,8.051 10.643,7.477C10.9463,6.903 11.3593,6.4527 11.882,6.126C12.4047,5.7993 12.988,5.636 13.632,5.636C14.136,5.636 14.5887,5.748 14.99,5.972C15.3913,6.196 15.6947,6.4713 15.9,6.798L15.97,6.798L15.9,5.79L15.9,2.976L17.44,2.976L17.44,13L15.97,13L15.97,12.076L15.9,12.076C15.6947,12.3933 15.3913,12.664 14.99,12.888C14.5887,13.112 14.136,13.224 13.632,13.224ZM13.856,11.81C14.2293,11.81 14.577,11.712 14.899,11.516C15.221,11.32 15.48,11.04 15.676,10.676C15.872,10.312 15.97,9.8967 15.97,9.43C15.97,8.9633 15.872,8.5503 15.676,8.191C15.48,7.8317 15.221,7.554 14.899,7.358C14.577,7.162 14.2293,7.064 13.856,7.064C13.4827,7.064 13.1327,7.162 12.806,7.358C12.4793,7.554 12.218,7.8317 12.022,8.191C11.826,8.5503 11.728,8.9633 11.728,9.43C11.728,9.8967 11.826,10.312 12.022,10.676C12.218,11.04 12.4793,11.32 12.806,11.516C13.1327,11.712 13.4827,11.81 13.856,11.81ZM22.364,13.224C21.72,13.224 21.1367,13.0607 20.614,12.734C20.0913,12.4073 19.6783,11.957 19.375,11.383C19.0717,10.809 18.92,10.158 18.92,9.43C18.92,8.702 19.0717,8.051 19.375,7.477C19.6783,6.903 20.0913,6.4527 20.614,6.126C21.1367,5.7993 21.72,5.636 22.364,5.636C22.868,5.636 23.3207,5.748 23.722,5.972C24.1233,6.196 24.4267,6.4713 24.632,6.798L24.702,6.798L24.632,5.79L24.632,2.976L26.172,2.976L26.172,13L24.702,13L24.702,12.076L24.632,12.076C24.4267,12.3933 24.1233,12.664 23.722,12.888C23.3207,13.112 22.868,13.224 22.364,13.224ZM22.588,11.81C22.9613,11.81 23.309,11.712 23.631,11.516C23.953,11.32 24.212,11.04 24.408,10.676C24.604,10.312 24.702,9.8967 24.702,9.43C24.702,8.9633 24.604,8.5503 24.408,8.191C24.212,7.8317 23.953,7.554 23.631,7.358C23.309,7.162 22.9613,7.064 22.588,7.064C22.2147,7.064 21.8647,7.162 21.538,7.358C21.2113,7.554 20.95,7.8317 20.754,8.191C20.558,8.5503 20.46,8.9633 20.46,9.43C20.46,9.8967 20.558,10.312 20.754,10.676C20.95,11.04 21.2113,11.32 21.538,11.516C21.8647,11.712 22.2147,11.81 22.588,11.81ZM34.466,13.112C34.1487,13.112 33.85,13.0607 33.57,12.958C33.29,12.8553 33.0613,12.72 32.884,12.552C32.4827,12.1507 32.282,11.6047 32.282,10.914L32.282,7.218L31.036,7.218L31.036,5.86L32.282,5.86L32.282,3.844L33.822,3.844L33.822,5.86L35.558,5.86L35.558,7.218L33.822,7.218L33.822,10.578C33.822,10.9607 33.8967,11.2313 34.046,11.39C34.186,11.5767 34.4287,11.67 34.774,11.67C34.9327,11.67 35.0727,11.649 35.194,11.607C35.3153,11.565 35.446,11.4973 35.586,11.404L35.586,12.902C35.278,13.042 34.9047,13.112 34.466,13.112ZM40.244,13.224C39.5253,13.224 38.8813,13.0583 38.312,12.727C37.7427,12.3957 37.2993,11.9407 36.982,11.362C36.6647,10.7833 36.506,10.1393 36.506,9.43C36.506,8.7207 36.6647,8.0767 36.982,7.498C37.2993,6.9193 37.7427,6.4643 38.312,6.133C38.8813,5.8017 39.5253,5.636 40.244,5.636C40.9627,5.636 41.6067,5.804 42.176,6.14C42.7453,6.476 43.1887,6.9333 43.506,7.512C43.8233,8.0907 43.982,8.73 43.982,9.43C43.982,10.1393 43.8233,10.7833 43.506,11.362C43.1887,11.9407 42.7453,12.3957 42.176,12.727C41.6067,13.0583 40.9627,13.224 40.244,13.224ZM40.244,11.81C40.636,11.81 41,11.7143 41.336,11.523C41.672,11.3317 41.9403,11.0563 42.141,10.697C42.3417,10.3377 42.442,9.9153 42.442,9.43C42.442,8.9447 42.3417,8.5247 42.141,8.17C41.9403,7.8153 41.672,7.5423 41.336,7.351C41,7.1597 40.636,7.064 40.244,7.064C39.852,7.064 39.488,7.1597 39.152,7.351C38.816,7.5423 38.5477,7.8153 38.347,8.17C38.1463,8.5247 38.046,8.9447 38.046,9.43C38.046,9.9153 38.1463,10.3377 38.347,10.697C38.5477,11.0563 38.816,11.3317 39.152,11.523C39.488,11.7143 39.852,11.81 40.244,11.81Z"
8
+ android:strokeWidth="1"
9
+ android:fillColor="#3C4043"
10
+ android:fillType="evenOdd"
11
+ android:strokeColor="#00000000"/>
12
+ <path
13
+ android:pathData="M69.526,2.6348L69.526,6.7179L72.0439,6.7179C72.6438,6.7179 73.1398,6.5163 73.5322,6.1131C73.9348,5.7109 74.1367,5.2312 74.1367,4.6759C74.1367,4.1318 73.9348,3.6577 73.5322,3.2545C73.1398,2.841 72.6438,2.6339 72.0439,2.6339L69.526,2.6339L69.526,2.6348ZM69.526,8.1551L69.526,12.8914L68.0218,12.8914L68.0218,1.1976L72.0112,1.1976C73.0249,1.1976 73.8854,1.5354 74.5945,2.2102C75.3139,2.8849 75.6736,3.7071 75.6736,4.6759C75.6736,5.667 75.3139,6.4948 74.5945,7.1584C73.8965,7.8228 73.0351,8.1542 72.0112,8.1542L69.526,8.1542L69.526,8.1551Z"
14
+ android:strokeWidth="1"
15
+ android:fillColor="#5F6368"
16
+ android:fillType="evenOdd"
17
+ android:strokeColor="#00000000"/>
18
+ <path
19
+ android:pathData="M77.1936,10.4416C77.1936,10.8336 77.3599,11.1602 77.6926,11.4215C78.0251,11.6828 78.4147,11.8135 78.8614,11.8135C79.4938,11.8135 80.0572,11.5792 80.5533,11.1117C81.0495,10.6432 81.297,10.0935 81.297,9.4626C80.828,9.0921 80.174,8.9073 79.335,8.9073C78.7241,8.9073 78.2149,9.0547 77.8066,9.3487C77.3982,9.6426 77.1936,10.0058 77.1936,10.4416M79.1397,4.6273C80.2515,4.6273 81.1288,4.9241 81.7726,5.5177C82.4154,6.1112 82.7367,6.925 82.7367,7.9591L82.7367,12.8914L81.298,12.8914L81.298,11.7808L81.2325,11.7808C80.6112,12.6953 79.7825,13.1527 78.7474,13.1527C77.8645,13.1527 77.1255,12.8914 76.5321,12.3688C75.938,11.8462 75.6409,11.1929 75.6409,10.4089C75.6409,9.5811 75.9538,8.9231 76.5807,8.4332C77.2076,7.9432 78.0439,7.6978 79.0903,7.6978C79.9834,7.6978 80.7196,7.8611 81.297,8.1877L81.297,7.8443C81.297,7.3217 81.0896,6.8784 80.6758,6.5135C80.2609,6.1485 79.7769,5.9666 79.221,5.9666C78.3811,5.9666 77.7169,6.3203 77.2264,7.0286L75.9015,6.1952C76.6321,5.1499 77.7112,4.6273 79.1397,4.6273"
20
+ android:strokeWidth="1"
21
+ android:fillColor="#5F6368"
22
+ android:fillType="evenOdd"
23
+ android:strokeColor="#00000000"/>
24
+ <path
25
+ android:pathData="M90.993,4.8886l-5.0198,11.5305l-1.5529,0l1.864,-4.0345l-3.3028,-7.496l1.635,0l2.3871,5.7489l0.0327,0l2.3217,-5.7489z"
26
+ android:strokeWidth="1"
27
+ android:fillColor="#5F6368"
28
+ android:fillType="evenOdd"
29
+ android:strokeColor="#00000000"/>
30
+ <path
31
+ android:pathData="M63.448,7.1341C63.448,6.6609 63.4078,6.2045 63.3321,5.7678L56.9883,5.7678L56.9883,8.3557L60.6218,8.3557C60.4657,9.1993 59.9939,9.9171 59.2783,10.3977L59.2783,12.0785L61.4468,12.0785C62.7164,10.9082 63.448,9.1789 63.448,7.1341"
32
+ android:strokeWidth="1"
33
+ android:fillColor="#4285F4"
34
+ android:fillType="evenOdd"
35
+ android:strokeColor="#00000000"/>
36
+ <path
37
+ android:pathData="M56.9883,13.7006C58.8036,13.7006 60.3321,13.1051 61.4467,12.0785L59.2783,10.3977C58.6747,10.8037 57.8974,11.0407 56.9883,11.0407C55.2337,11.0407 53.7445,9.8592 53.2119,8.2671L50.9781,8.2671L50.9781,9.9983C52.0852,12.1933 54.3602,13.7006 56.9883,13.7006"
38
+ android:strokeWidth="1"
39
+ android:fillColor="#34A853"
40
+ android:fillType="evenOdd"
41
+ android:strokeColor="#00000000"/>
42
+ <path
43
+ android:pathData="M53.212,8.267C53.0756,7.8611 53.0008,7.428 53.0008,6.981C53.0008,6.534 53.0756,6.1009 53.212,5.695L53.212,3.9637L50.9781,3.9637C50.5203,4.8709 50.2615,5.8956 50.2615,6.981C50.2615,8.0664 50.5203,9.0912 50.9781,9.9983L53.212,8.267Z"
44
+ android:strokeWidth="1"
45
+ android:fillColor="#FABB05"
46
+ android:fillType="evenOdd"
47
+ android:strokeColor="#00000000"/>
48
+ <path
49
+ android:pathData="M56.9883,2.9213C57.9796,2.9213 58.8681,3.2619 59.5688,3.9292L59.5688,3.9302L61.4888,2.0123C60.3228,0.9278 58.8027,0.2615 56.9883,0.2615C54.3602,0.2615 52.0852,1.7687 50.9781,3.9638L53.2119,5.695C53.7445,4.1028 55.2337,2.9213 56.9883,2.9213"
50
+ android:strokeWidth="1"
51
+ android:fillColor="#E94235"
52
+ android:fillType="evenOdd"
53
+ android:strokeColor="#00000000"/>
54
+ </vector>