react-native-unit-components 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +22 -18
  2. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  3. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +22 -18
  4. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  5. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +5 -10
  6. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  7. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +7 -12
  8. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  9. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +1 -0
  10. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  11. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +27 -10
  12. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -1
  13. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +9 -6
  14. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  15. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +20 -0
  16. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  17. package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js +14 -6
  18. package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js.map +1 -1
  19. package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js +31 -55
  20. package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js.map +1 -1
  21. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +6 -10
  22. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  23. package/lib/commonjs/components/UNCheckPaymentComponent/UNCheckPaymentComponent.js +96 -0
  24. package/lib/commonjs/components/UNCheckPaymentComponent/UNCheckPaymentComponent.js.map +1 -0
  25. package/lib/commonjs/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.js +36 -0
  26. package/lib/commonjs/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.js.map +1 -0
  27. package/lib/commonjs/components/UNCheckPaymentComponent/index.js +21 -0
  28. package/lib/commonjs/components/UNCheckPaymentComponent/index.js.map +1 -0
  29. package/lib/commonjs/components/UNCreateCardComponent/UNCreateCardComponent.js +6 -7
  30. package/lib/commonjs/components/UNCreateCardComponent/UNCreateCardComponent.js.map +1 -1
  31. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +6 -11
  32. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -1
  33. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +1 -1
  34. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -1
  35. package/lib/commonjs/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js +10 -18
  36. package/lib/commonjs/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js.map +1 -1
  37. package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js +5 -10
  38. package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js.map +1 -1
  39. package/lib/commonjs/components/index.js +11 -0
  40. package/lib/commonjs/components/index.js.map +1 -1
  41. package/lib/commonjs/flows/card/UNCardFlows.js +2 -6
  42. package/lib/commonjs/flows/card/UNCardFlows.js.map +1 -1
  43. package/lib/commonjs/helpers/BottomSheet/BottomSheet.js +13 -3
  44. package/lib/commonjs/helpers/BottomSheet/BottomSheet.js.map +1 -1
  45. package/lib/commonjs/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.js +4 -2
  46. package/lib/commonjs/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.js.map +1 -1
  47. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  48. package/lib/commonjs/hooks/useEventListener.js +31 -0
  49. package/lib/commonjs/hooks/useEventListener.js.map +1 -0
  50. package/lib/commonjs/hooks/useSafeAreaDimensions.js +53 -0
  51. package/lib/commonjs/hooks/useSafeAreaDimensions.js.map +1 -0
  52. package/lib/commonjs/messages/webMessages/checkPaymentMessage.js +6 -0
  53. package/lib/commonjs/messages/webMessages/checkPaymentMessage.js.map +1 -0
  54. package/lib/commonjs/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.js +2 -7
  55. package/lib/commonjs/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.js.map +1 -1
  56. package/lib/commonjs/store/store.js +0 -2
  57. package/lib/commonjs/store/store.js.map +1 -1
  58. package/lib/commonjs/types/internal/bottomSheet.types.js +1 -0
  59. package/lib/commonjs/types/internal/bottomSheet.types.js.map +1 -1
  60. package/lib/commonjs/types/internal/webComponent.types.js +1 -0
  61. package/lib/commonjs/types/internal/webComponent.types.js.map +1 -1
  62. package/lib/commonjs/types/shared/payment/checkPayment.types.js +6 -0
  63. package/lib/commonjs/types/shared/payment/checkPayment.types.js.map +1 -0
  64. package/lib/commonjs/types/shared/payment/index.js +11 -0
  65. package/lib/commonjs/types/shared/payment/index.js.map +1 -1
  66. package/lib/commonjs/types/shared/payment/payments.types.js +1 -0
  67. package/lib/commonjs/types/shared/payment/payments.types.js.map +1 -1
  68. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdk.constants.js +2 -2
  69. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdkManager.js +1 -1
  70. package/lib/commonjs/utils/eventBus/EventBus.js +107 -0
  71. package/lib/commonjs/utils/eventBus/EventBus.js.map +1 -0
  72. package/lib/commonjs/utils/eventBus/EventBus.types.js +6 -0
  73. package/lib/commonjs/utils/eventBus/EventBus.types.js.map +1 -0
  74. package/lib/commonjs/utils/eventBus/index.js +13 -0
  75. package/lib/commonjs/utils/eventBus/index.js.map +1 -0
  76. package/lib/commonjs/webComponent/WebComponent.js +22 -17
  77. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  78. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +23 -19
  79. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  80. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +23 -19
  81. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  82. package/lib/module/components/UNAccountComponent/UNAccountComponent.js +5 -10
  83. package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  84. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +7 -12
  85. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  86. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +1 -0
  87. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  88. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +27 -10
  89. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -1
  90. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +8 -5
  91. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  92. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +20 -0
  93. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  94. package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js +15 -7
  95. package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js.map +1 -1
  96. package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js +31 -55
  97. package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js.map +1 -1
  98. package/lib/module/components/UNCardComponent/UNCardComponent.js +7 -11
  99. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  100. package/lib/module/components/UNCheckPaymentComponent/UNCheckPaymentComponent.js +88 -0
  101. package/lib/module/components/UNCheckPaymentComponent/UNCheckPaymentComponent.js.map +1 -0
  102. package/lib/module/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.js +28 -0
  103. package/lib/module/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.js.map +1 -0
  104. package/lib/module/components/UNCheckPaymentComponent/index.js +2 -0
  105. package/lib/module/components/UNCheckPaymentComponent/index.js.map +1 -0
  106. package/lib/module/components/UNCreateCardComponent/UNCreateCardComponent.js +6 -7
  107. package/lib/module/components/UNCreateCardComponent/UNCreateCardComponent.js.map +1 -1
  108. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +6 -11
  109. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -1
  110. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +1 -1
  111. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -1
  112. package/lib/module/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js +11 -19
  113. package/lib/module/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js.map +1 -1
  114. package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js +5 -10
  115. package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js.map +1 -1
  116. package/lib/module/components/index.js +1 -0
  117. package/lib/module/components/index.js.map +1 -1
  118. package/lib/module/flows/card/UNCardFlows.js +2 -6
  119. package/lib/module/flows/card/UNCardFlows.js.map +1 -1
  120. package/lib/module/helpers/BottomSheet/BottomSheet.js +13 -3
  121. package/lib/module/helpers/BottomSheet/BottomSheet.js.map +1 -1
  122. package/lib/module/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.js +5 -3
  123. package/lib/module/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.js.map +1 -1
  124. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  125. package/lib/module/hooks/useEventListener.js +24 -0
  126. package/lib/module/hooks/useEventListener.js.map +1 -0
  127. package/lib/module/hooks/useSafeAreaDimensions.js +46 -0
  128. package/lib/module/hooks/useSafeAreaDimensions.js.map +1 -0
  129. package/lib/module/messages/webMessages/checkPaymentMessage.js +2 -0
  130. package/lib/module/messages/webMessages/checkPaymentMessage.js.map +1 -0
  131. package/lib/module/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.js +2 -7
  132. package/lib/module/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.js.map +1 -1
  133. package/lib/module/store/store.js +0 -2
  134. package/lib/module/store/store.js.map +1 -1
  135. package/lib/module/types/internal/bottomSheet.types.js +1 -0
  136. package/lib/module/types/internal/bottomSheet.types.js.map +1 -1
  137. package/lib/module/types/internal/webComponent.types.js +1 -0
  138. package/lib/module/types/internal/webComponent.types.js.map +1 -1
  139. package/lib/module/types/shared/payment/checkPayment.types.js +2 -0
  140. package/lib/module/types/shared/payment/checkPayment.types.js.map +1 -0
  141. package/lib/module/types/shared/payment/index.js +1 -0
  142. package/lib/module/types/shared/payment/index.js.map +1 -1
  143. package/lib/module/types/shared/payment/payments.types.js +1 -0
  144. package/lib/module/types/shared/payment/payments.types.js.map +1 -1
  145. package/lib/module/unitComponentsSdkManager/UnitComponentsSdk.constants.js +2 -2
  146. package/lib/module/unitComponentsSdkManager/UnitComponentsSdkManager.js +1 -1
  147. package/lib/module/utils/eventBus/EventBus.js +101 -0
  148. package/lib/module/utils/eventBus/EventBus.js.map +1 -0
  149. package/lib/module/utils/eventBus/EventBus.types.js +8 -0
  150. package/lib/module/utils/eventBus/EventBus.types.js.map +1 -0
  151. package/lib/module/utils/eventBus/index.js +2 -0
  152. package/lib/module/utils/eventBus/index.js.map +1 -0
  153. package/lib/module/webComponent/WebComponent.js +25 -20
  154. package/lib/module/webComponent/WebComponent.js.map +1 -1
  155. package/lib/typescript/src/components/UNACHCreditComponent/UNACHCreditComponent.d.ts.map +1 -1
  156. package/lib/typescript/src/components/UNACHDebitComponent/UNACHDebitComponent.d.ts.map +1 -1
  157. package/lib/typescript/src/components/UNAccountComponent/UNAccountComponent.d.ts.map +1 -1
  158. package/lib/typescript/src/components/UNActivityComponent/UNActivityComponent.d.ts +1 -0
  159. package/lib/typescript/src/components/UNActivityComponent/UNActivityComponent.d.ts.map +1 -1
  160. package/lib/typescript/src/components/UNActivityComponent/UNActivityComponent.utils.d.ts.map +1 -1
  161. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +0 -5
  162. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts.map +1 -1
  163. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +2 -2
  164. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts.map +1 -1
  165. package/lib/typescript/src/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.d.ts.map +1 -1
  166. package/lib/typescript/src/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.d.ts.map +1 -1
  167. package/lib/typescript/src/components/UNCardComponent/UNCardComponent.d.ts.map +1 -1
  168. package/lib/typescript/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.d.ts +17 -0
  169. package/lib/typescript/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.d.ts.map +1 -0
  170. package/lib/typescript/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.d.ts +4 -0
  171. package/lib/typescript/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.d.ts.map +1 -0
  172. package/lib/typescript/src/components/UNCheckPaymentComponent/index.d.ts +2 -0
  173. package/lib/typescript/src/components/UNCheckPaymentComponent/index.d.ts.map +1 -0
  174. package/lib/typescript/src/components/UNCreateCardComponent/UNCreateCardComponent.d.ts.map +1 -1
  175. package/lib/typescript/src/components/UNCreateCardComponent/UNCreateCardComponent.utils.d.ts +1 -1
  176. package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.d.ts.map +1 -1
  177. package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.d.ts +1 -1
  178. package/lib/typescript/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.d.ts.map +1 -1
  179. package/lib/typescript/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.d.ts.map +1 -1
  180. package/lib/typescript/src/components/index.d.ts +1 -0
  181. package/lib/typescript/src/components/index.d.ts.map +1 -1
  182. package/lib/typescript/src/flows/card/UNCardFlows.d.ts.map +1 -1
  183. package/lib/typescript/src/helpers/BottomSheet/BottomSheet.d.ts.map +1 -1
  184. package/lib/typescript/src/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.d.ts.map +1 -1
  185. package/lib/typescript/src/helpers/pushProvisioningService/hooks/useCardWallet.d.ts.map +1 -1
  186. package/lib/typescript/src/hooks/useEventListener.d.ts +12 -0
  187. package/lib/typescript/src/hooks/useEventListener.d.ts.map +1 -0
  188. package/lib/typescript/src/hooks/useSafeAreaDimensions.d.ts +9 -0
  189. package/lib/typescript/src/hooks/useSafeAreaDimensions.d.ts.map +1 -0
  190. package/lib/typescript/src/messages/webMessages/checkPaymentMessage.d.ts +6 -0
  191. package/lib/typescript/src/messages/webMessages/checkPaymentMessage.d.ts.map +1 -0
  192. package/lib/typescript/src/messages/webMessages/index.d.ts +2 -1
  193. package/lib/typescript/src/messages/webMessages/index.d.ts.map +1 -1
  194. package/lib/typescript/src/messages/webMessages/onLoadMessage.d.ts +1 -1
  195. package/lib/typescript/src/messages/webMessages/onLoadMessage.d.ts.map +1 -1
  196. package/lib/typescript/src/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.d.ts.map +1 -1
  197. package/lib/typescript/src/store/store.d.ts +0 -98
  198. package/lib/typescript/src/store/store.d.ts.map +1 -1
  199. package/lib/typescript/src/types/internal/bottomSheet.types.d.ts +7 -1
  200. package/lib/typescript/src/types/internal/bottomSheet.types.d.ts.map +1 -1
  201. package/lib/typescript/src/types/internal/webComponent.types.d.ts +2 -1
  202. package/lib/typescript/src/types/internal/webComponent.types.d.ts.map +1 -1
  203. package/lib/typescript/src/types/shared/activity.types.d.ts +1 -1
  204. package/lib/typescript/src/types/shared/activity.types.d.ts.map +1 -1
  205. package/lib/typescript/src/types/shared/payment/checkPayment.types.d.ts +38 -0
  206. package/lib/typescript/src/types/shared/payment/checkPayment.types.d.ts.map +1 -0
  207. package/lib/typescript/src/types/shared/payment/index.d.ts +1 -0
  208. package/lib/typescript/src/types/shared/payment/index.d.ts.map +1 -1
  209. package/lib/typescript/src/types/shared/payment/payments.types.d.ts +3 -1
  210. package/lib/typescript/src/types/shared/payment/payments.types.d.ts.map +1 -1
  211. package/lib/typescript/src/types/shared/transaction/UNNegativeBalanceCoverageTransaction.d.ts.map +1 -1
  212. package/lib/typescript/src/utils/eventBus/EventBus.d.ts +37 -0
  213. package/lib/typescript/src/utils/eventBus/EventBus.d.ts.map +1 -0
  214. package/lib/typescript/src/utils/eventBus/EventBus.types.d.ts +37 -0
  215. package/lib/typescript/src/utils/eventBus/EventBus.types.d.ts.map +1 -0
  216. package/lib/typescript/src/utils/eventBus/index.d.ts +4 -0
  217. package/lib/typescript/src/utils/eventBus/index.d.ts.map +1 -0
  218. package/lib/typescript/src/webComponent/WebComponent.d.ts.map +1 -1
  219. package/package.json +5 -3
  220. package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +26 -16
  221. package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +27 -17
  222. package/src/components/UNAccountComponent/UNAccountComponent.tsx +5 -7
  223. package/src/components/UNActivityComponent/UNActivityComponent.tsx +8 -9
  224. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +1 -0
  225. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.ts +26 -14
  226. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +6 -6
  227. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +24 -0
  228. package/src/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.tsx +17 -8
  229. package/src/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.tsx +54 -59
  230. package/src/components/UNCardComponent/UNCardComponent.tsx +7 -8
  231. package/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.tsx +110 -0
  232. package/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.tsx +31 -0
  233. package/src/components/UNCheckPaymentComponent/index.ts +1 -0
  234. package/src/components/UNCreateCardComponent/UNCreateCardComponent.tsx +9 -7
  235. package/src/components/UNCreateCardComponent/UNCreateCardComponent.utils.ts +1 -1
  236. package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.tsx +7 -9
  237. package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.ts +2 -2
  238. package/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.tsx +11 -15
  239. package/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.tsx +5 -8
  240. package/src/components/index.ts +1 -0
  241. package/src/flows/card/UNCardFlows.ts +2 -3
  242. package/src/helpers/BottomSheet/BottomSheet.tsx +8 -7
  243. package/src/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.tsx +7 -4
  244. package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +0 -1
  245. package/src/hooks/useEventListener.ts +30 -0
  246. package/src/hooks/useSafeAreaDimensions.ts +48 -0
  247. package/src/messages/webMessages/checkPaymentMessage.ts +8 -0
  248. package/src/messages/webMessages/index.ts +2 -0
  249. package/src/messages/webMessages/onLoadMessage.ts +1 -1
  250. package/src/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.tsx +5 -7
  251. package/src/store/store.ts +0 -2
  252. package/src/types/internal/bottomSheet.types.ts +8 -0
  253. package/src/types/internal/webComponent.types.ts +2 -1
  254. package/src/types/shared/activity.types.ts +1 -1
  255. package/src/types/shared/payment/checkPayment.types.ts +39 -0
  256. package/src/types/shared/payment/index.ts +1 -0
  257. package/src/types/shared/payment/payments.types.ts +3 -1
  258. package/src/types/shared/transaction/UNNegativeBalanceCoverageTransaction.ts +1 -1
  259. package/src/unitComponentsSdkManager/UnitComponentsSdk.constants.ts +2 -2
  260. package/src/unitComponentsSdkManager/UnitComponentsSdkManager.ts +1 -1
  261. package/src/utils/eventBus/EventBus.ts +106 -0
  262. package/src/utils/eventBus/EventBus.types.ts +37 -0
  263. package/src/utils/eventBus/index.ts +3 -0
  264. package/src/webComponent/WebComponent.tsx +30 -16
  265. package/lib/commonjs/hooks/useListenerToEvent.js +0 -26
  266. package/lib/commonjs/hooks/useListenerToEvent.js.map +0 -1
  267. package/lib/commonjs/slices/SharedEventsSlice.js +0 -29
  268. package/lib/commonjs/slices/SharedEventsSlice.js.map +0 -1
  269. package/lib/module/hooks/useListenerToEvent.js +0 -19
  270. package/lib/module/hooks/useListenerToEvent.js.map +0 -1
  271. package/lib/module/slices/SharedEventsSlice.js +0 -22
  272. package/lib/module/slices/SharedEventsSlice.js.map +0 -1
  273. package/lib/typescript/src/hooks/useListenerToEvent.d.ts +0 -10
  274. package/lib/typescript/src/hooks/useListenerToEvent.d.ts.map +0 -1
  275. package/lib/typescript/src/slices/SharedEventsSlice.d.ts +0 -81
  276. package/lib/typescript/src/slices/SharedEventsSlice.d.ts.map +0 -1
  277. package/src/hooks/useListenerToEvent.ts +0 -32
  278. package/src/slices/SharedEventsSlice.ts +0 -128
@@ -11,11 +11,7 @@ import {
11
11
  View,
12
12
  } from 'react-native';
13
13
  import { CloseIcon } from '../../assets/images';
14
- import {
15
- androidStatusBarHeight,
16
- fullScreenHeight, isAndroid10AndAbove,
17
- statusBarHeight,
18
- } from '../../components/UNBottomSheetComponent/UNBottomSheetComponent.constants';
14
+ import { useSafeAreaDimensions } from '../../hooks/useSafeAreaDimensions';
19
15
  import { getStylesObject } from './BottomSheet.styles';
20
16
  import { useIsBackFromLongBackground } from '../../hooks/useAppStateListener';
21
17
  import { BottomSheetNativePlaceType } from '../../types/internal/bottomSheet.types';
@@ -43,6 +39,9 @@ const BottomSheet = (props: BottomSheetProps) => {
43
39
  const styles = getStylesObject(fadeAnim);
44
40
  const [isPanelOpened, setIsPanelOpened] = useState(props.isOpen);
45
41
  const [contentHeight, setContentHeight] = useState<number | undefined>(undefined);
42
+ const { insets, fullScreenHeight, isAndroid10AndAbove, isEdgeToEdgeActive } = useSafeAreaDimensions();
43
+ // Android 15+ (API 35) enforces edge-to-edge, so marginTop calculation differs
44
+ const isAndroid15AndAbove = Platform.OS === 'android' && Platform.Version >= 35;
46
45
 
47
46
  const [currentHeight, setCurrentHeight] = useState<number>(props.sliderMaxHeight);
48
47
 
@@ -204,11 +203,13 @@ const BottomSheet = (props: BottomSheetProps) => {
204
203
  borderTopLeftRadius: isModal ? 0 : styles.container.borderTopLeftRadius,
205
204
  borderTopRightRadius: isModal ? 0 : styles.container.borderTopRightRadius,
206
205
  height: props.sliderMaxHeight,
207
- marginTop: fullScreenHeight - props.sliderMaxHeight - ((!isModal && isAndroid10AndAbove) ? androidStatusBarHeight : 0),
206
+ // Android 15+ (edge-to-edge): fullScreenHeight is already the full screen, no adjustment needed
207
+ // Android 10-14: fullScreenHeight includes status bar, but view starts below it, so subtract insets.top
208
+ marginTop: isModal ? 0 : fullScreenHeight - props.sliderMaxHeight - (isAndroid10AndAbove && !isAndroid15AndAbove ? insets.top : 0),
208
209
  transform: [
209
210
  { translateY: panelHeightValue },
210
211
  ],
211
- paddingTop: Platform.OS === 'ios' && isModal ? statusBarHeight : 0,
212
+ paddingTop: isModal && (Platform.OS === 'ios' || isEdgeToEdgeActive) ? insets.top : 0,
212
213
  }}
213
214
  >
214
215
  <View
@@ -1,6 +1,6 @@
1
- import { KeyboardAvoidingView, Platform, ViewStyle } from 'react-native';
1
+ import { KeyboardAvoidingView, Platform, StatusBar, ViewStyle } from 'react-native';
2
2
  import React from 'react';
3
- import { statusBarHeight } from '../../components/UNBottomSheetComponent/UNBottomSheetComponent.constants';
3
+ import { initialWindowMetrics } from 'react-native-safe-area-context';
4
4
 
5
5
  interface UNKeyboardAvoidingViewProps {
6
6
  children: React.ReactNode,
@@ -8,12 +8,15 @@ interface UNKeyboardAvoidingViewProps {
8
8
  keyboardVerticalOffset?: number,
9
9
  }
10
10
 
11
+ const topInset = initialWindowMetrics?.insets.top ?? 0;
12
+ const defaultOffset = topInset > 0 ? topInset : (StatusBar.currentHeight || 0);
13
+
11
14
  const UNKeyboardAvoidingView = ({ children, style, keyboardVerticalOffset }: UNKeyboardAvoidingViewProps) => {
12
15
  return (
13
16
  <KeyboardAvoidingView
14
17
  style={style ?? { height: '100%' }}
15
18
  behavior="padding"
16
- keyboardVerticalOffset={keyboardVerticalOffset ?? statusBarHeight}
19
+ keyboardVerticalOffset={keyboardVerticalOffset ?? defaultOffset}
17
20
  enabled={Platform.OS === 'android'}
18
21
  >
19
22
  {children}
@@ -21,4 +24,4 @@ const UNKeyboardAvoidingView = ({ children, style, keyboardVerticalOffset }: UNK
21
24
  );
22
25
  };
23
26
 
24
- export default UNKeyboardAvoidingView;
27
+ export default UNKeyboardAvoidingView;
@@ -24,7 +24,6 @@ export const useCardWallet = (cardId: string) => {
24
24
  const isRecoveringSignedNonceRef = useRef<boolean>(false);
25
25
  const customerToken = useSelector((state: RootState) => state.configuration.customerToken);
26
26
 
27
-
28
27
  const shouldRecoverVPSDKForError = (errorType: UNVPErrorType) => {
29
28
  const recoveringTypes = [UNVPErrorType.PayloadDecryptionFailed, UNVPErrorType.SessionExpired, UNVPErrorType.InvalidNonce];
30
29
  return recoveringTypes.includes(errorType);
@@ -0,0 +1,30 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { eventBus, type EventMap } from '../utils/eventBus';
3
+
4
+ type EventListener<K extends keyof EventMap> = {
5
+ busEventKey: K;
6
+ action: (data: EventMap[K]) => void;
7
+ };
8
+
9
+ /**
10
+ * Hook to listen to events from the EventBus
11
+ * Automatically subscribes on mount and unsubscribes on unmount
12
+ */
13
+ export const useEventListener = <K extends keyof EventMap>(listener: EventListener<K>) => {
14
+ const actionRef = useRef(listener.action);
15
+
16
+ // Keep action ref up to date
17
+ useEffect(() => {
18
+ actionRef.current = listener.action;
19
+ }, [listener.action]);
20
+
21
+ useEffect(() => {
22
+ // Subscribe to the event
23
+ const unsubscribe = eventBus.on(listener.busEventKey, (data) => {
24
+ actionRef.current(data);
25
+ });
26
+
27
+ // Cleanup: unsubscribe when component unmounts
28
+ return unsubscribe;
29
+ }, [listener.busEventKey]);
30
+ };
@@ -0,0 +1,48 @@
1
+ import { Dimensions, Platform } from 'react-native';
2
+ import { initialWindowMetrics } from 'react-native-safe-area-context';
3
+
4
+ const isAndroid = Platform.OS === 'android';
5
+ const isAndroid10To14 = isAndroid && Platform.Version >= 29 && Platform.Version < 35;
6
+ const isAndroid15AndAbove = isAndroid && Platform.Version >= 35;
7
+
8
+ const insets = initialWindowMetrics?.insets ?? { top: 0, bottom: 0, left: 0, right: 0 };
9
+ const windowHeight = Dimensions.get('window').height;
10
+ const screenHeight = Dimensions.get('screen').height;
11
+
12
+ // Detect edge-to-edge by comparing window to screen height
13
+ // Edge-to-edge ON: windowHeight ≈ screenHeight | OFF: windowHeight < screenHeight
14
+ const heightDifference = Math.abs(screenHeight - windowHeight);
15
+ const isEdgeToEdgeActive = isAndroid15AndAbove && heightDifference < 10;
16
+
17
+ const effectiveBottomInset = isEdgeToEdgeActive ? insets.bottom : 0;
18
+
19
+ const calculateFullScreenHeight = (): number => {
20
+ if (isAndroid15AndAbove) {
21
+ return isEdgeToEdgeActive ? screenHeight : windowHeight;
22
+ } else if (isAndroid10To14) {
23
+ return windowHeight + insets.top;
24
+ }
25
+ return windowHeight;
26
+ };
27
+
28
+ const fullScreenHeight = calculateFullScreenHeight();
29
+
30
+ const calculateContentHeight = (): number => {
31
+ if (isAndroid15AndAbove && !isEdgeToEdgeActive) {
32
+ return windowHeight;
33
+ }
34
+ return fullScreenHeight - insets.top;
35
+ };
36
+
37
+ const contentHeight = calculateContentHeight();
38
+
39
+ export const useSafeAreaDimensions = () => {
40
+ return {
41
+ insets,
42
+ fullScreenHeight,
43
+ contentHeight,
44
+ isAndroid10AndAbove: isAndroid && Platform.Version >= 29,
45
+ isEdgeToEdgeActive,
46
+ effectiveBottomInset,
47
+ };
48
+ };
@@ -0,0 +1,8 @@
1
+ import { UNPayment } from '../../types/shared';
2
+
3
+ export interface PaymentCreatedEvent {
4
+ data: UNPayment
5
+ }
6
+
7
+ export type CheckPaymentEvent =
8
+ | PaymentCreatedEvent
@@ -6,6 +6,7 @@ import type { PaymentMessage } from './paymentsMessage';
6
6
  import type { UnitEvent, UnitComponentsMessage, MultiFactorAuthenticationFinishedEvent } from './unitComponentsMessages';
7
7
  import type { AccountEvent, AccountMessage } from './accountMessage';
8
8
  import type { CheckEvent, CheckMessage } from './checkMessage';
9
+ import type { CheckPaymentEvent } from './checkPaymentMessage';
9
10
  import type { ActivityEvent, ActivityMessage } from './activityMessage';
10
11
  import type { MultipleCardsEvent, MultipleCardsMessage } from './multipleCardsMessage';
11
12
  import { PlaidEvent, PlaidMessage } from './plaidMessages';
@@ -36,6 +37,7 @@ type WebViewEvent =
36
37
  | ACHEvent
37
38
  | AccountEvent
38
39
  | CheckEvent
40
+ | CheckPaymentEvent
39
41
  | ActivityEvent
40
42
  | PlaidEvent
41
43
  | PayeeManagementEvent
@@ -45,7 +45,7 @@ export type ACHOnLoadResponse = {
45
45
 
46
46
  export type ActivityOnLoadResponse = {
47
47
  [RESPONSE_KEYS.authorizations]: UNComponentsOnLoadResponseData<[UNAuthorization]>,
48
- [RESPONSE_KEYS.transactions]: UNComponentsOnLoadResponseData<[UNTransaction]>
48
+ [RESPONSE_KEYS.transactions]?: UNComponentsOnLoadResponseData<[UNTransaction]>
49
49
  }
50
50
 
51
51
  export type PayeeManagementOnLoadResponse = {
@@ -6,7 +6,6 @@ import { PresentationMode, WebComponentType } from '../../../types/internal/webC
6
6
  import { UNCardAddToWalletStatus } from '../../../types/shared/wallet.types';
7
7
  import UnitAddToWalletButtonView from '../UnitAddToWalletButtonNativeComponent';
8
8
  import WebView from 'react-native-webview';
9
- import { useDispatch } from 'react-redux';
10
9
  import {
11
10
  getStylesObject,
12
11
  } from './UNAddToWalletBottomSheetItem.styles';
@@ -15,7 +14,7 @@ import { getAddToWalletParams, getAddToWalletWindowParams } from './UNAddToWalle
15
14
  import { WebViewMessage } from '../../../messages/webMessages';
16
15
  import { UnitComponentsMessage } from '../../../messages/webMessages/unitComponentsMessages';
17
16
  import { injectHtmlFullScreenHeight } from '../../../components/UNBottomSheetComponent/UNBottomSheetComponent.utils';
18
- import { setEvent } from '../../../slices/SharedEventsSlice';
17
+ import { eventBus } from '../../../utils/eventBus';
19
18
  import {
20
19
  overFullScreenHeight,
21
20
  } from '../../../components/UNBottomSheetComponent/UNBottomSheetComponent.constants';
@@ -33,7 +32,6 @@ export interface UNAddToWalletComponentProps {
33
32
  }
34
33
 
35
34
  const UNAddToWalletComponent = (props: UNAddToWalletComponentProps) => {
36
- const dispatch = useDispatch();
37
35
  const webRef = useRef<WebView>(null);
38
36
  const { currentUNWallet } = useCardWallet(props.cardId);
39
37
  const styles = getStylesObject();
@@ -55,10 +53,10 @@ const UNAddToWalletComponent = (props: UNAddToWalletComponentProps) => {
55
53
  injectHtmlFullScreenHeight(webRef.current, overFullScreenHeight);
56
54
  break;
57
55
  case UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW:
58
- dispatch(setEvent({
59
- key: UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW,
60
- data: {},
61
- }));
56
+ eventBus.emit(
57
+ UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW,
58
+ {}
59
+ );
62
60
  break;
63
61
  default:
64
62
  break;
@@ -1,14 +1,12 @@
1
1
  import { configureStore } from '@reduxjs/toolkit';
2
2
  import wallet from '../slices/pushProvisioningSlice';
3
3
  import configuration from '../slices/ConfigurationSlice';
4
- import sharedEvents from '../slices/SharedEventsSlice';
5
4
  import bottomSheet from '../slices/BottomSheetSlice';
6
5
 
7
6
  export const store = configureStore({
8
7
  reducer: {
9
8
  wallet,
10
9
  configuration,
11
- sharedEvents,
12
10
  bottomSheet,
13
11
  },
14
12
  });
@@ -9,6 +9,7 @@ import { UNCheckDepositComponentProps } from '../../components/UNCheckDepositCom
9
9
  import { UNBookPaymentComponentProps } from '../../components/UNBookPaymentComponent';
10
10
  import { UNWirePaymentComponentProps } from '../../components/UNWirePaymentComponent';
11
11
  import { UNCreateCardComponentProps } from '../../components/UNCreateCardComponent';
12
+ import { UNCheckPaymentComponentProps } from '../../components/UNCheckPaymentComponent';
12
13
 
13
14
  export enum BottomSheetNativePlaceType {
14
15
  overFullScreen = 'overFullScreen',
@@ -50,6 +51,7 @@ export enum BottomSheetNativeComponentType {
50
51
  ACHCreditComponent = 'UNACHCreditComponent',
51
52
  ACHDebitComponent = 'UNACHDebitComponent',
52
53
  CheckDepositComponent = 'UNCheckDepositComponent',
54
+ CheckPaymentComponent = 'UNCheckPaymentComponent',
53
55
  BookPaymentComponent = 'UNBookPaymentComponent',
54
56
  WirePaymentComponent = 'UNWirePaymentComponent',
55
57
  CreateCardComponent = 'UNCreateCardComponent'
@@ -75,6 +77,11 @@ export type BottomSheetNativeCheckDepositComponentType = {
75
77
  props: UNCheckDepositComponentProps
76
78
  }
77
79
 
80
+ export type BottomSheetNativeCheckPaymentComponentType = {
81
+ type: BottomSheetNativeComponentType.CheckPaymentComponent,
82
+ props: UNCheckPaymentComponentProps
83
+ }
84
+
78
85
  export type BottomSheetNativeBookPaymentComponentType = {
79
86
  type: BottomSheetNativeComponentType.BookPaymentComponent,
80
87
  props: UNBookPaymentComponentProps
@@ -94,6 +101,7 @@ export type BottomSheetNativeComponent = BottomSheetNativeAddToWalletComponentTy
94
101
  | BottomSheetNativeACHCreditComponentType
95
102
  | BottomSheetNativeACHDebitComponentType
96
103
  | BottomSheetNativeCheckDepositComponentType
104
+ | BottomSheetNativeCheckPaymentComponentType
97
105
  | BottomSheetNativeBookPaymentComponentType
98
106
  | BottomSheetNativeWirePaymentComponentType
99
107
  | BottomSheetNativeCreateCardComponentType
@@ -16,7 +16,8 @@ export enum WebComponentType {
16
16
  whiteLabelApp = 'unit-elements-white-label-app',
17
17
  multiFactorAuthentication = 'unit-elements-multi-factor-authentication',
18
18
  createCard = 'unit-elements-create-card',
19
- cardMenu = 'unit-elements-card-menu'
19
+ cardMenu = 'unit-elements-card-menu',
20
+ checkPayment = 'unit-elements-check-payment'
20
21
  }
21
22
 
22
23
  export enum PresentationMode {
@@ -9,7 +9,7 @@ export enum UNActivityComponentPaginationType {
9
9
 
10
10
  export type UNActivityOnLoadData = {
11
11
  [RESPONSE_KEYS.authorizations]: [UNAuthorization],
12
- [RESPONSE_KEYS.transactions]: [UNTransaction],
12
+ [RESPONSE_KEYS.transactions]?: [UNTransaction],
13
13
  }
14
14
 
15
15
  export enum UNActivityType {
@@ -0,0 +1,39 @@
1
+ import { UNPaymentType } from './payments.types';
2
+
3
+ export interface UNCheckPayment {
4
+ type: UNPaymentType.CheckPayment
5
+ id: string
6
+ attributes: {
7
+ counterparty: UNCheckPaymentCounterparty
8
+ amount: number
9
+ idempotencyKey: string
10
+ description: string
11
+ memo: string
12
+ }
13
+ relationships: {
14
+ account: {
15
+ data: {
16
+ type: string
17
+ id: string
18
+ }
19
+ }
20
+ customer: {
21
+ data: {
22
+ type: string
23
+ id: string
24
+ }
25
+ }
26
+ }
27
+ }
28
+
29
+ export interface UNCheckPaymentCounterparty {
30
+ name: string
31
+ address: {
32
+ street: string
33
+ street2?: string
34
+ city: string
35
+ state: string
36
+ postalCode: string
37
+ country: string
38
+ }
39
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './achPayment.types';
2
2
  export * from './billPayment.types';
3
3
  export * from './bookPayment.types';
4
+ export * from './checkPayment.types';
4
5
  export * from './wirePayment.types';
5
6
  export * from './payments.types';
@@ -3,14 +3,16 @@ import { UNACHPayment } from './achPayment.types';
3
3
  import { UNBillPayment } from './billPayment.types';
4
4
  import { UNBookPayment } from './bookPayment.types';
5
5
  import { UNWirePayment } from './wirePayment.types';
6
+ import { UNCheckPayment } from './checkPayment.types';
6
7
 
7
- export type UNPayment = UNACHPayment | UNBookPayment | UNWirePayment | UNBillPayment
8
+ export type UNPayment = UNACHPayment | UNBookPayment | UNWirePayment | UNBillPayment | UNCheckPayment
8
9
 
9
10
  export enum UNPaymentType {
10
11
  AchPayment = 'achPayment',
11
12
  BookPayment = 'bookPayment',
12
13
  WirePayment = 'wirePayment',
13
14
  BillPayment = 'billPayment',
15
+ CheckPayment = 'checkPayment',
14
16
  CardToCardPayment = 'cardToCardPayment',
15
17
  }
16
18
 
@@ -1,4 +1,4 @@
1
- import { UNCents } from '../payment/payments.types';
1
+ import { UNCents } from '../payment/payments.types';
2
2
  import { UNTransactionTypes } from './transactions.types';
3
3
  import { UNDirection } from '../types';
4
4
 
@@ -3,8 +3,8 @@ import { UNComponentsSecuritySettings, UNComponentsSnapshotProtectionStrategy }
3
3
 
4
4
  const WEB_SDK_RECOMMENDED_STRATEGY: UNComponentsWebVersioningStrategy = {
5
5
  type: UNVersioningStrategyType.upToNextMinor,
6
- major: 2,
7
- minor: 5,
6
+ major: 3,
7
+ minor: 3,
8
8
  };
9
9
 
10
10
  const DEFAULT_SECURITY_SETTINGS: UNComponentsSecuritySettings = {
@@ -25,7 +25,7 @@ export class UnitComponentsSDK {
25
25
  protected static fonts?: UNFonts;
26
26
  protected static signedNonce?: string;
27
27
  protected static pushProvisionModule?: typeof NativeModules;
28
- protected static sdkVersion = '2.2.0';
28
+ protected static sdkVersion = '3.0.0';
29
29
 
30
30
  public static init = async (
31
31
  env: UNComponentsEnvironment,
@@ -0,0 +1,106 @@
1
+ import type { EventMap, SharedEvent } from './EventBus.types';
2
+
3
+ // Type-safe callback that receives the correct data type for the event key
4
+ export type EventCallback<K extends keyof EventMap> = (data: EventMap[K]) => void;
5
+
6
+ class EventBus {
7
+ private debug = false;
8
+ private listeners = new Map<SharedEvent['key'], Set<(data: unknown) => void>>();
9
+ private eventQueue: SharedEvent[] = [];
10
+ private isProcessing = false;
11
+
12
+ /**
13
+ * Subscribe to an event
14
+ * @returns Unsubscribe function
15
+ */
16
+ on<K extends keyof EventMap>(eventKey: K, callback: EventCallback<K>): () => void {
17
+ if (!this.listeners.has(eventKey)) {
18
+ this.listeners.set(eventKey, new Set());
19
+ }
20
+
21
+ this.listeners.get(eventKey)!.add(callback as (data: unknown) => void);
22
+
23
+ if (this.debug) {
24
+ console.log(`[EventBus] Subscribed to: ${eventKey} (${this.listenerCount(eventKey)} listeners)`);
25
+ }
26
+
27
+ // Return unsubscribe function
28
+ return () => {
29
+ const callbacks = this.listeners.get(eventKey);
30
+ if (callbacks) {
31
+ callbacks.delete(callback as (data: unknown) => void);
32
+ if (callbacks.size === 0) {
33
+ this.listeners.delete(eventKey);
34
+ }
35
+ }
36
+ };
37
+ }
38
+
39
+ /**
40
+ * Emit an event - queues it for processing to ensure all events are delivered
41
+ */
42
+ emit<K extends keyof EventMap>(eventKey: K, data: EventMap[K]): void {
43
+ const event = { key: eventKey, data } as SharedEvent;
44
+
45
+ if (this.debug) {
46
+ console.log(`[EventBus] Emitting: ${eventKey} (${this.listenerCount(eventKey)} listeners)`);
47
+ }
48
+ this.eventQueue.push(event);
49
+ this.processQueue();
50
+ }
51
+
52
+ /**
53
+ * Process events from queue sequentially
54
+ * This ensures rapid successive events are all delivered
55
+ */
56
+ private processQueue(): void {
57
+ if (this.isProcessing || this.eventQueue.length === 0) {
58
+ return;
59
+ }
60
+
61
+ this.isProcessing = true;
62
+
63
+ // Process all queued events synchronously to ensure immediate delivery
64
+ while (this.eventQueue.length > 0) {
65
+ const event = this.eventQueue.shift()!;
66
+ const callbacks = this.listeners.get(event.key);
67
+
68
+ if (callbacks && callbacks.size > 0) {
69
+ // Process all listeners for this event
70
+ callbacks.forEach(callback => {
71
+ try {
72
+ callback(event.data);
73
+ } catch (error) {
74
+ console.error(`Error in event listener for ${event.key}:`, error);
75
+ }
76
+ });
77
+ }
78
+ }
79
+
80
+ this.isProcessing = false;
81
+ }
82
+
83
+ /**
84
+ * Remove all listeners for an event
85
+ */
86
+ off<K extends keyof EventMap>(eventKey: K): void {
87
+ this.listeners.delete(eventKey);
88
+ }
89
+
90
+ /**
91
+ * Get number of listeners for an event (useful for debugging)
92
+ */
93
+ listenerCount<K extends keyof EventMap>(eventKey: K): number {
94
+ return this.listeners.get(eventKey)?.size ?? 0;
95
+ }
96
+
97
+ /**
98
+ * Enable or disable debug logging
99
+ */
100
+ setDebug(enabled: boolean): void {
101
+ this.debug = enabled;
102
+ }
103
+ }
104
+
105
+ // Singleton instance
106
+ export const eventBus = new EventBus();
@@ -0,0 +1,37 @@
1
+ import type { UNAccount, UNCard } from '../../types/shared';
2
+ import type { ActivityFiltersChangedEvent } from '../../messages/webMessages/activityMessage';
3
+ import type { MultiFactorAuthenticationFinishedEvent, RequestRefreshEvent } from '../../messages/webMessages/unitComponentsMessages';
4
+ import type { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
5
+ import type { CardCreatedEvent, CardMessage } from '../../messages/webMessages/cardMessage';
6
+ import type { AccountMessage } from '../../messages/webMessages/accountMessage';
7
+ import type { ActivityMessage } from '../../messages/webMessages/activityMessage';
8
+ import type { UnitComponentsMessage } from '../../messages/webMessages/unitComponentsMessages';
9
+ import type { MultipleCardsFiltersChangedEvent, MultipleCardsMessage } from '../../messages/webMessages/multipleCardsMessage';
10
+ import { BottomSheetRenderingMessage } from '../../messages/nativeMessages/bottomSheetMessage';
11
+ import { PageMessage } from '../../messages/webMessages/pageMessage';
12
+ import { OpenPlaidEvent, PlaidMessage } from '../../messages/webMessages/plaidMessages';
13
+ import { PayeeManagementMessage } from '../../messages/webMessages/payeeManagementMessage';
14
+ import { UNCounterparty } from '../../types/shared/counterparty.types';
15
+
16
+ // Map of event keys to their data types
17
+ export type EventMap = {
18
+ [CardMessage.CARD_STATUS_CHANGED]: UNCard;
19
+ [CardMessage.CARD_ACTIVATED]: UNCard;
20
+ [CardMessage.CARD_CREATED]: CardCreatedEvent;
21
+ [AccountMessage.UNIT_ACCOUNT_CHANGED]: UNAccount;
22
+ [ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED]: ActivityFiltersChangedEvent;
23
+ [MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED]: UNCard;
24
+ [MultipleCardsMessage.UNIT_MULTIPLE_CARDS_FILTERS_CHANGED]: MultipleCardsFiltersChangedEvent;
25
+ [UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW]: Record<PropertyKey, never>;
26
+ [BottomSheetNativeMessage.REQUEST_RENDERING]: BottomSheetRenderingMessage;
27
+ [UnitComponentsMessage.UNIT_REQUEST_REFRESH]: RequestRefreshEvent;
28
+ [UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED]: MultiFactorAuthenticationFinishedEvent;
29
+ [PageMessage.PAGE_HEIGHT]: number;
30
+ [PlaidMessage.UNIT_OPEN_PLAID]: OpenPlaidEvent;
31
+ [PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED]: UNCounterparty;
32
+ };
33
+
34
+ // Generate SharedEvent as a union of { key, data } objects
35
+ export type SharedEvent = {
36
+ [K in keyof EventMap]: { key: K; data: EventMap[K] };
37
+ }[keyof EventMap];
@@ -0,0 +1,3 @@
1
+ export { eventBus } from './EventBus';
2
+ export type { EventCallback } from './EventBus';
3
+ export type { EventMap, SharedEvent } from './EventBus.types';
@@ -1,8 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
3
- import { Linking, Platform } from 'react-native';
4
- import { useDispatch, useSelector } from 'react-redux';
3
+ import { Linking, Platform, View } from 'react-native';
4
+ import { useSelector } from 'react-redux';
5
5
  import { WebView, WebViewMessageEvent } from 'react-native-webview';
6
+ import { useSafeAreaDimensions } from '../hooks/useSafeAreaDimensions';
6
7
  import html, { HTML_PLACEHOLDER } from './html';
7
8
  import {
8
9
  RequestRefreshEvent,
@@ -20,11 +21,11 @@ import { getInfoParams, handleRequestDownload, injectEventToContinue } from './W
20
21
  import { PresentationMode, WebComponentType } from '../types/internal/webComponent.types';
21
22
  import { getFontFacesString } from '../scripts/html/fontFaces';
22
23
  import type { RootState } from '../store';
23
- import { setEvent } from '../slices/SharedEventsSlice';
24
+ import { eventBus } from '../utils/eventBus';
24
25
  import AppInfo from '../utils/AppInfo';
25
26
  import UNStoreManagerHelper from '../nativeModulesHelpers/UNStoreModuleHelper/UNStoreModuleHelper';
26
27
  import { UserDataKeys } from '../types/internal/unitStore.types';
27
- import { useListenerToEvent } from '../hooks/useListenerToEvent';
28
+ import { useEventListener } from '../hooks/useEventListener';
28
29
  import { setItemInWindowUnitStore } from '../utils/windowUnitStore';
29
30
 
30
31
  export interface WebComponentProps {
@@ -42,7 +43,6 @@ export interface WebComponentProps {
42
43
  }
43
44
 
44
45
  export const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props, webOutRef) {
45
- const dispatch = useDispatch();
46
46
  const unitScript = useSelector((state: RootState) => state.configuration.unitScript);
47
47
  const globalTheme = useSelector((state: RootState) => state.configuration.theme);
48
48
  const globalLanguage = useSelector((state: RootState) => state.configuration.language);
@@ -131,17 +131,17 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
131
131
  });
132
132
  };
133
133
 
134
- useListenerToEvent({ busEventKey: UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED, action: handleMultiFactorAuthFinished });
134
+ useEventListener({ busEventKey: UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED, action: handleMultiFactorAuthFinished });
135
135
 
136
136
  const onMessage = (e: WebViewMessageEvent) => {
137
137
  const message = JSON.parse(e.nativeEvent.data) as WebViewMessage;
138
138
  switch (message.type) {
139
139
  case UnitComponentsMessage.UNIT_REQUEST_REFRESH:
140
140
  message.details &&
141
- dispatch(setEvent({
142
- key: UnitComponentsMessage.UNIT_REQUEST_REFRESH,
143
- data: message.details as RequestRefreshEvent,
144
- }));
141
+ eventBus.emit(
142
+ UnitComponentsMessage.UNIT_REQUEST_REFRESH,
143
+ message.details as RequestRefreshEvent
144
+ );
145
145
  break;
146
146
  case UnitComponentsMessage.UNIT_REQUEST_OPEN_LINK:
147
147
  // eslint-disable-next-line no-case-declarations
@@ -152,7 +152,7 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
152
152
  case UnitComponentsMessage.UNIT_REQUEST_DOWNLOAD:
153
153
  message.details &&
154
154
  handleRequestDownload(message.details as RequestDownloadEvent, () => {
155
- dispatch(setEvent({ key: UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW, data: {} }));
155
+ eventBus.emit(UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW, {});
156
156
  });
157
157
  break;
158
158
  case UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED:
@@ -160,10 +160,10 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
160
160
  const data = message.details as MultiFactorAuthenticationFinishedEvent;
161
161
  UNStoreManagerHelper.saveValue(UserDataKeys.unitVerifiedToken, data.unitVerifiedCustomerTokenString);
162
162
  // update existing components - namely, the other webComponents will update their window as well as this webComponent
163
- dispatch(setEvent({
164
- key: UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED,
165
- data,
166
- }));
163
+ eventBus.emit(
164
+ UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED,
165
+ data
166
+ );
167
167
  }
168
168
  props.onMessage && props.onMessage(message);
169
169
  break;
@@ -187,7 +187,11 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
187
187
  return null;
188
188
  }
189
189
 
190
- return (
190
+ const isInheritMode = props.presentationMode === PresentationMode.Inherit;
191
+ const { effectiveBottomInset } = useSafeAreaDimensions();
192
+ const needsBottomPadding = isInheritMode && effectiveBottomInset > 0;
193
+
194
+ const webView = (
191
195
  <WebView
192
196
  ref={webRef}
193
197
  originWhitelist={['*']}
@@ -207,4 +211,14 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
207
211
  mediaCapturePermissionGrantType='grant'
208
212
  />
209
213
  );
214
+
215
+ if (needsBottomPadding) {
216
+ return (
217
+ <View style={{ flex: 1, paddingBottom: effectiveBottomInset }}>
218
+ {webView}
219
+ </View>
220
+ );
221
+ }
222
+
223
+ return webView;
210
224
  });