react-native-unit-components 2.2.0 → 3.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 (279) hide show
  1. package/android/src/main/java/com/unitreactnativecomponents/nativeModules/sharefile/UNShareFile.kt +1 -1
  2. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +22 -18
  3. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  4. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +22 -18
  5. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  6. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +5 -10
  7. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  8. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +7 -12
  9. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  10. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +1 -0
  11. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  12. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +27 -10
  13. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -1
  14. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +9 -6
  15. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  16. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +20 -0
  17. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  18. package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js +14 -6
  19. package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js.map +1 -1
  20. package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js +31 -55
  21. package/lib/commonjs/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js.map +1 -1
  22. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +6 -10
  23. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  24. package/lib/commonjs/components/UNCheckPaymentComponent/UNCheckPaymentComponent.js +96 -0
  25. package/lib/commonjs/components/UNCheckPaymentComponent/UNCheckPaymentComponent.js.map +1 -0
  26. package/lib/commonjs/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.js +36 -0
  27. package/lib/commonjs/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.js.map +1 -0
  28. package/lib/commonjs/components/UNCheckPaymentComponent/index.js +21 -0
  29. package/lib/commonjs/components/UNCheckPaymentComponent/index.js.map +1 -0
  30. package/lib/commonjs/components/UNCreateCardComponent/UNCreateCardComponent.js +6 -7
  31. package/lib/commonjs/components/UNCreateCardComponent/UNCreateCardComponent.js.map +1 -1
  32. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +6 -11
  33. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -1
  34. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +1 -1
  35. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -1
  36. package/lib/commonjs/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js +10 -18
  37. package/lib/commonjs/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js.map +1 -1
  38. package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js +5 -10
  39. package/lib/commonjs/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js.map +1 -1
  40. package/lib/commonjs/components/index.js +11 -0
  41. package/lib/commonjs/components/index.js.map +1 -1
  42. package/lib/commonjs/flows/card/UNCardFlows.js +2 -6
  43. package/lib/commonjs/flows/card/UNCardFlows.js.map +1 -1
  44. package/lib/commonjs/helpers/BottomSheet/BottomSheet.js +13 -3
  45. package/lib/commonjs/helpers/BottomSheet/BottomSheet.js.map +1 -1
  46. package/lib/commonjs/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.js +4 -2
  47. package/lib/commonjs/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.js.map +1 -1
  48. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  49. package/lib/commonjs/hooks/useEventListener.js +31 -0
  50. package/lib/commonjs/hooks/useEventListener.js.map +1 -0
  51. package/lib/commonjs/hooks/useSafeAreaDimensions.js +53 -0
  52. package/lib/commonjs/hooks/useSafeAreaDimensions.js.map +1 -0
  53. package/lib/commonjs/messages/webMessages/checkPaymentMessage.js +6 -0
  54. package/lib/commonjs/messages/webMessages/checkPaymentMessage.js.map +1 -0
  55. package/lib/commonjs/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.js +2 -7
  56. package/lib/commonjs/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.js.map +1 -1
  57. package/lib/commonjs/store/store.js +0 -2
  58. package/lib/commonjs/store/store.js.map +1 -1
  59. package/lib/commonjs/types/internal/bottomSheet.types.js +1 -0
  60. package/lib/commonjs/types/internal/bottomSheet.types.js.map +1 -1
  61. package/lib/commonjs/types/internal/webComponent.types.js +1 -0
  62. package/lib/commonjs/types/internal/webComponent.types.js.map +1 -1
  63. package/lib/commonjs/types/shared/payment/checkPayment.types.js +6 -0
  64. package/lib/commonjs/types/shared/payment/checkPayment.types.js.map +1 -0
  65. package/lib/commonjs/types/shared/payment/index.js +11 -0
  66. package/lib/commonjs/types/shared/payment/index.js.map +1 -1
  67. package/lib/commonjs/types/shared/payment/payments.types.js +1 -0
  68. package/lib/commonjs/types/shared/payment/payments.types.js.map +1 -1
  69. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdk.constants.js +2 -2
  70. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdkManager.js +1 -1
  71. package/lib/commonjs/utils/eventBus/EventBus.js +107 -0
  72. package/lib/commonjs/utils/eventBus/EventBus.js.map +1 -0
  73. package/lib/commonjs/utils/eventBus/EventBus.types.js +6 -0
  74. package/lib/commonjs/utils/eventBus/EventBus.types.js.map +1 -0
  75. package/lib/commonjs/utils/eventBus/index.js +13 -0
  76. package/lib/commonjs/utils/eventBus/index.js.map +1 -0
  77. package/lib/commonjs/webComponent/WebComponent.js +22 -17
  78. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  79. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +23 -19
  80. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  81. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +23 -19
  82. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  83. package/lib/module/components/UNAccountComponent/UNAccountComponent.js +5 -10
  84. package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  85. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +7 -12
  86. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  87. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +1 -0
  88. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  89. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +27 -10
  90. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -1
  91. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +8 -5
  92. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  93. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +20 -0
  94. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  95. package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js +15 -7
  96. package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.js.map +1 -1
  97. package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js +31 -55
  98. package/lib/module/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.js.map +1 -1
  99. package/lib/module/components/UNCardComponent/UNCardComponent.js +7 -11
  100. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  101. package/lib/module/components/UNCheckPaymentComponent/UNCheckPaymentComponent.js +88 -0
  102. package/lib/module/components/UNCheckPaymentComponent/UNCheckPaymentComponent.js.map +1 -0
  103. package/lib/module/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.js +28 -0
  104. package/lib/module/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.js.map +1 -0
  105. package/lib/module/components/UNCheckPaymentComponent/index.js +2 -0
  106. package/lib/module/components/UNCheckPaymentComponent/index.js.map +1 -0
  107. package/lib/module/components/UNCreateCardComponent/UNCreateCardComponent.js +6 -7
  108. package/lib/module/components/UNCreateCardComponent/UNCreateCardComponent.js.map +1 -1
  109. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +6 -11
  110. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -1
  111. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +1 -1
  112. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -1
  113. package/lib/module/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js +11 -19
  114. package/lib/module/components/UNPayeeManagementComponent/UNPayeeManagementComponent.js.map +1 -1
  115. package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js +5 -10
  116. package/lib/module/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.js.map +1 -1
  117. package/lib/module/components/index.js +1 -0
  118. package/lib/module/components/index.js.map +1 -1
  119. package/lib/module/flows/card/UNCardFlows.js +2 -6
  120. package/lib/module/flows/card/UNCardFlows.js.map +1 -1
  121. package/lib/module/helpers/BottomSheet/BottomSheet.js +13 -3
  122. package/lib/module/helpers/BottomSheet/BottomSheet.js.map +1 -1
  123. package/lib/module/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.js +5 -3
  124. package/lib/module/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.js.map +1 -1
  125. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  126. package/lib/module/hooks/useEventListener.js +24 -0
  127. package/lib/module/hooks/useEventListener.js.map +1 -0
  128. package/lib/module/hooks/useSafeAreaDimensions.js +46 -0
  129. package/lib/module/hooks/useSafeAreaDimensions.js.map +1 -0
  130. package/lib/module/messages/webMessages/checkPaymentMessage.js +2 -0
  131. package/lib/module/messages/webMessages/checkPaymentMessage.js.map +1 -0
  132. package/lib/module/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.js +2 -7
  133. package/lib/module/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.js.map +1 -1
  134. package/lib/module/store/store.js +0 -2
  135. package/lib/module/store/store.js.map +1 -1
  136. package/lib/module/types/internal/bottomSheet.types.js +1 -0
  137. package/lib/module/types/internal/bottomSheet.types.js.map +1 -1
  138. package/lib/module/types/internal/webComponent.types.js +1 -0
  139. package/lib/module/types/internal/webComponent.types.js.map +1 -1
  140. package/lib/module/types/shared/payment/checkPayment.types.js +2 -0
  141. package/lib/module/types/shared/payment/checkPayment.types.js.map +1 -0
  142. package/lib/module/types/shared/payment/index.js +1 -0
  143. package/lib/module/types/shared/payment/index.js.map +1 -1
  144. package/lib/module/types/shared/payment/payments.types.js +1 -0
  145. package/lib/module/types/shared/payment/payments.types.js.map +1 -1
  146. package/lib/module/unitComponentsSdkManager/UnitComponentsSdk.constants.js +2 -2
  147. package/lib/module/unitComponentsSdkManager/UnitComponentsSdkManager.js +1 -1
  148. package/lib/module/utils/eventBus/EventBus.js +101 -0
  149. package/lib/module/utils/eventBus/EventBus.js.map +1 -0
  150. package/lib/module/utils/eventBus/EventBus.types.js +8 -0
  151. package/lib/module/utils/eventBus/EventBus.types.js.map +1 -0
  152. package/lib/module/utils/eventBus/index.js +2 -0
  153. package/lib/module/utils/eventBus/index.js.map +1 -0
  154. package/lib/module/webComponent/WebComponent.js +25 -20
  155. package/lib/module/webComponent/WebComponent.js.map +1 -1
  156. package/lib/typescript/src/components/UNACHCreditComponent/UNACHCreditComponent.d.ts.map +1 -1
  157. package/lib/typescript/src/components/UNACHDebitComponent/UNACHDebitComponent.d.ts.map +1 -1
  158. package/lib/typescript/src/components/UNAccountComponent/UNAccountComponent.d.ts.map +1 -1
  159. package/lib/typescript/src/components/UNActivityComponent/UNActivityComponent.d.ts +1 -0
  160. package/lib/typescript/src/components/UNActivityComponent/UNActivityComponent.d.ts.map +1 -1
  161. package/lib/typescript/src/components/UNActivityComponent/UNActivityComponent.utils.d.ts.map +1 -1
  162. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +0 -5
  163. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts.map +1 -1
  164. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +2 -2
  165. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts.map +1 -1
  166. package/lib/typescript/src/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.d.ts.map +1 -1
  167. package/lib/typescript/src/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.d.ts.map +1 -1
  168. package/lib/typescript/src/components/UNCardComponent/UNCardComponent.d.ts.map +1 -1
  169. package/lib/typescript/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.d.ts +17 -0
  170. package/lib/typescript/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.d.ts.map +1 -0
  171. package/lib/typescript/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.d.ts +4 -0
  172. package/lib/typescript/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.d.ts.map +1 -0
  173. package/lib/typescript/src/components/UNCheckPaymentComponent/index.d.ts +2 -0
  174. package/lib/typescript/src/components/UNCheckPaymentComponent/index.d.ts.map +1 -0
  175. package/lib/typescript/src/components/UNCreateCardComponent/UNCreateCardComponent.d.ts.map +1 -1
  176. package/lib/typescript/src/components/UNCreateCardComponent/UNCreateCardComponent.utils.d.ts +1 -1
  177. package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.d.ts.map +1 -1
  178. package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.d.ts +1 -1
  179. package/lib/typescript/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.d.ts.map +1 -1
  180. package/lib/typescript/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.d.ts.map +1 -1
  181. package/lib/typescript/src/components/index.d.ts +1 -0
  182. package/lib/typescript/src/components/index.d.ts.map +1 -1
  183. package/lib/typescript/src/flows/card/UNCardFlows.d.ts.map +1 -1
  184. package/lib/typescript/src/helpers/BottomSheet/BottomSheet.d.ts.map +1 -1
  185. package/lib/typescript/src/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.d.ts.map +1 -1
  186. package/lib/typescript/src/helpers/pushProvisioningService/hooks/useCardWallet.d.ts.map +1 -1
  187. package/lib/typescript/src/hooks/useEventListener.d.ts +12 -0
  188. package/lib/typescript/src/hooks/useEventListener.d.ts.map +1 -0
  189. package/lib/typescript/src/hooks/useSafeAreaDimensions.d.ts +9 -0
  190. package/lib/typescript/src/hooks/useSafeAreaDimensions.d.ts.map +1 -0
  191. package/lib/typescript/src/messages/webMessages/checkPaymentMessage.d.ts +6 -0
  192. package/lib/typescript/src/messages/webMessages/checkPaymentMessage.d.ts.map +1 -0
  193. package/lib/typescript/src/messages/webMessages/index.d.ts +2 -1
  194. package/lib/typescript/src/messages/webMessages/index.d.ts.map +1 -1
  195. package/lib/typescript/src/messages/webMessages/onLoadMessage.d.ts +1 -1
  196. package/lib/typescript/src/messages/webMessages/onLoadMessage.d.ts.map +1 -1
  197. package/lib/typescript/src/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.d.ts.map +1 -1
  198. package/lib/typescript/src/store/store.d.ts +0 -98
  199. package/lib/typescript/src/store/store.d.ts.map +1 -1
  200. package/lib/typescript/src/types/internal/bottomSheet.types.d.ts +7 -1
  201. package/lib/typescript/src/types/internal/bottomSheet.types.d.ts.map +1 -1
  202. package/lib/typescript/src/types/internal/webComponent.types.d.ts +2 -1
  203. package/lib/typescript/src/types/internal/webComponent.types.d.ts.map +1 -1
  204. package/lib/typescript/src/types/shared/activity.types.d.ts +1 -1
  205. package/lib/typescript/src/types/shared/activity.types.d.ts.map +1 -1
  206. package/lib/typescript/src/types/shared/payment/checkPayment.types.d.ts +38 -0
  207. package/lib/typescript/src/types/shared/payment/checkPayment.types.d.ts.map +1 -0
  208. package/lib/typescript/src/types/shared/payment/index.d.ts +1 -0
  209. package/lib/typescript/src/types/shared/payment/index.d.ts.map +1 -1
  210. package/lib/typescript/src/types/shared/payment/payments.types.d.ts +3 -1
  211. package/lib/typescript/src/types/shared/payment/payments.types.d.ts.map +1 -1
  212. package/lib/typescript/src/types/shared/transaction/UNNegativeBalanceCoverageTransaction.d.ts.map +1 -1
  213. package/lib/typescript/src/utils/eventBus/EventBus.d.ts +37 -0
  214. package/lib/typescript/src/utils/eventBus/EventBus.d.ts.map +1 -0
  215. package/lib/typescript/src/utils/eventBus/EventBus.types.d.ts +37 -0
  216. package/lib/typescript/src/utils/eventBus/EventBus.types.d.ts.map +1 -0
  217. package/lib/typescript/src/utils/eventBus/index.d.ts +4 -0
  218. package/lib/typescript/src/utils/eventBus/index.d.ts.map +1 -0
  219. package/lib/typescript/src/webComponent/WebComponent.d.ts.map +1 -1
  220. package/package.json +5 -3
  221. package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +26 -16
  222. package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +27 -17
  223. package/src/components/UNAccountComponent/UNAccountComponent.tsx +5 -7
  224. package/src/components/UNActivityComponent/UNActivityComponent.tsx +8 -9
  225. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +1 -0
  226. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.ts +26 -14
  227. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +6 -6
  228. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +24 -0
  229. package/src/components/UNBottomSheetComponent/components/UNBottomSheetNativeComponent/UNBottomSheetNativeComponent.tsx +17 -8
  230. package/src/components/UNBottomSheetComponent/components/UNBottomSheetSlotComponent/UNBottomSheetSlotComponent.tsx +54 -59
  231. package/src/components/UNCardComponent/UNCardComponent.tsx +7 -8
  232. package/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.tsx +110 -0
  233. package/src/components/UNCheckPaymentComponent/UNCheckPaymentComponent.utils.tsx +31 -0
  234. package/src/components/UNCheckPaymentComponent/index.ts +1 -0
  235. package/src/components/UNCreateCardComponent/UNCreateCardComponent.tsx +9 -7
  236. package/src/components/UNCreateCardComponent/UNCreateCardComponent.utils.ts +1 -1
  237. package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.tsx +7 -9
  238. package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.ts +2 -2
  239. package/src/components/UNPayeeManagementComponent/UNPayeeManagementComponent.tsx +11 -15
  240. package/src/components/UNWhiteLabelAppComponent/UNWhiteLabelAppComponent.tsx +5 -8
  241. package/src/components/index.ts +1 -0
  242. package/src/flows/card/UNCardFlows.ts +2 -3
  243. package/src/helpers/BottomSheet/BottomSheet.tsx +8 -7
  244. package/src/helpers/UNKeyboardAvoidingView/UNKeyboardAvoidingView.tsx +7 -4
  245. package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +0 -1
  246. package/src/hooks/useEventListener.ts +30 -0
  247. package/src/hooks/useSafeAreaDimensions.ts +48 -0
  248. package/src/messages/webMessages/checkPaymentMessage.ts +8 -0
  249. package/src/messages/webMessages/index.ts +2 -0
  250. package/src/messages/webMessages/onLoadMessage.ts +1 -1
  251. package/src/nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent.tsx +5 -7
  252. package/src/store/store.ts +0 -2
  253. package/src/types/internal/bottomSheet.types.ts +8 -0
  254. package/src/types/internal/webComponent.types.ts +2 -1
  255. package/src/types/shared/activity.types.ts +1 -1
  256. package/src/types/shared/payment/checkPayment.types.ts +39 -0
  257. package/src/types/shared/payment/index.ts +1 -0
  258. package/src/types/shared/payment/payments.types.ts +3 -1
  259. package/src/types/shared/transaction/UNNegativeBalanceCoverageTransaction.ts +1 -1
  260. package/src/unitComponentsSdkManager/UnitComponentsSdk.constants.ts +2 -2
  261. package/src/unitComponentsSdkManager/UnitComponentsSdkManager.ts +1 -1
  262. package/src/utils/eventBus/EventBus.ts +106 -0
  263. package/src/utils/eventBus/EventBus.types.ts +37 -0
  264. package/src/utils/eventBus/index.ts +3 -0
  265. package/src/webComponent/WebComponent.tsx +30 -16
  266. package/lib/commonjs/hooks/useListenerToEvent.js +0 -26
  267. package/lib/commonjs/hooks/useListenerToEvent.js.map +0 -1
  268. package/lib/commonjs/slices/SharedEventsSlice.js +0 -29
  269. package/lib/commonjs/slices/SharedEventsSlice.js.map +0 -1
  270. package/lib/module/hooks/useListenerToEvent.js +0 -19
  271. package/lib/module/hooks/useListenerToEvent.js.map +0 -1
  272. package/lib/module/slices/SharedEventsSlice.js +0 -22
  273. package/lib/module/slices/SharedEventsSlice.js.map +0 -1
  274. package/lib/typescript/src/hooks/useListenerToEvent.d.ts +0 -10
  275. package/lib/typescript/src/hooks/useListenerToEvent.d.ts.map +0 -1
  276. package/lib/typescript/src/slices/SharedEventsSlice.d.ts +0 -81
  277. package/lib/typescript/src/slices/SharedEventsSlice.d.ts.map +0 -1
  278. package/src/hooks/useListenerToEvent.ts +0 -32
  279. package/src/slices/SharedEventsSlice.ts +0 -128
@@ -18,7 +18,7 @@ import {
18
18
  ScrollState, SlotRendering,
19
19
  } from '../../../../types/internal/bottomSheet.types';
20
20
  import { CardActivatedEvent, CardMessage, CardStatusChangedEvent } from '../../../../messages/webMessages/cardMessage';
21
- import { setEvent } from '../../../../slices/SharedEventsSlice';
21
+ import { eventBus } from '../../../../utils/eventBus';
22
22
  import { AccountChangedEvent, AccountMessage } from '../../../../messages/webMessages/accountMessage';
23
23
  import { ActivityFiltersChangedEvent, ActivityMessage } from '../../../../messages/webMessages/activityMessage';
24
24
  import { useDispatch, useSelector } from 'react-redux';
@@ -30,7 +30,8 @@ import {
30
30
  } from '../../../../slices/BottomSheetSlice';
31
31
  import { getAccountActionType } from '../../../UNAccountComponent/UNAccountComponent.utils';
32
32
  import { UNAccountAction } from '../../../UNAccountComponent/UNAccountComponent';
33
- import { BOTTOM_PADDING, fullScreenHeight, LEFT_PADDING, overFullScreenHeight, RIGHT_PADDING, statusBarHeight, TOP_PADDING, VERTICAL_PADDING } from '../../UNBottomSheetComponent.constants';
33
+ import { BOTTOM_PADDING, LEFT_PADDING, overFullScreenHeight, RIGHT_PADDING, TOP_PADDING, VERTICAL_PADDING } from '../../UNBottomSheetComponent.constants';
34
+ import { useSafeAreaDimensions } from '../../../../hooks/useSafeAreaDimensions';
34
35
  import { BottomSheetNativeMessage } from '../../../../messages/nativeMessages/bottomSheetMessage';
35
36
  import { OpenPlaidEvent, PlaidMessage } from '../../../../messages/webMessages/plaidMessages';
36
37
  import { PayeeCounterpartyEvent, PayeeManagementMessage } from '../../../../messages/webMessages/payeeManagementMessage';
@@ -49,6 +50,7 @@ const UNBottomSheetSlotComponent = (props: UNBottomSheetSlotComponentProps) => {
49
50
  const webRef = useRef<WebView>(null);
50
51
  const scrollState = useSelector((state: RootState) => state.bottomSheet.scrollState);
51
52
  const nativePlace = props.requestRenderingEvent?.data?.nativePlace;
53
+ const { fullScreenHeight, contentHeight, effectiveBottomInset } = useSafeAreaDimensions();
52
54
 
53
55
  useEffect(() => {
54
56
  const scrollStateForSlot = () => {
@@ -103,36 +105,29 @@ const UNBottomSheetSlotComponent = (props: UNBottomSheetSlotComponentProps) => {
103
105
  const height = (message.details as HeightEvent).height;
104
106
  switch (nativePlace) {
105
107
  case BottomSheetNativePlaceType.overFullScreen: {
106
- if (!props.requestRenderingEvent.data.isPaddingIncluded) {
107
- injectHtmlFullScreenHeight(webRef.current, overFullScreenHeight - VERTICAL_PADDING);
108
- } else {
109
- injectHtmlFullScreenHeight(webRef.current, overFullScreenHeight);
110
- }
108
+ const injectedHeight = !props.requestRenderingEvent.data.isPaddingIncluded
109
+ ? overFullScreenHeight - VERTICAL_PADDING - effectiveBottomInset
110
+ : overFullScreenHeight - effectiveBottomInset;
111
+ injectHtmlFullScreenHeight(webRef.current, injectedHeight);
111
112
  break;
112
113
  }
113
- case BottomSheetNativePlaceType.modal: {
114
- if (!props.requestRenderingEvent.data.isPaddingIncluded) {
115
- injectHtmlFullScreenHeight(webRef.current, fullScreenHeight - statusBarHeight - VERTICAL_PADDING);
116
- } else {
117
- injectHtmlFullScreenHeight(webRef.current, fullScreenHeight - statusBarHeight);
118
- }
114
+ case BottomSheetNativePlaceType.modal: {
115
+ const injectedHeight = !props.requestRenderingEvent.data.isPaddingIncluded
116
+ ? contentHeight - VERTICAL_PADDING - effectiveBottomInset
117
+ : contentHeight - effectiveBottomInset;
118
+ injectHtmlFullScreenHeight(webRef.current, injectedHeight);
119
119
  break;
120
120
  }
121
- case BottomSheetNativePlaceType.menu: case BottomSheetNativePlaceType.contentHeight:
122
- if (height < overFullScreenHeight) {
123
- dispatch(setComponentHeight(
124
- props.requestRenderingEvent.data.isPaddingIncluded ?
125
- height :
126
- height + VERTICAL_PADDING
127
- ));
128
- } else {
129
- dispatch(setComponentHeight(
130
- props.requestRenderingEvent.data.isPaddingIncluded ?
131
- overFullScreenHeight :
132
- overFullScreenHeight + VERTICAL_PADDING
133
- ));
134
- }
121
+ case BottomSheetNativePlaceType.menu: case BottomSheetNativePlaceType.contentHeight: {
122
+ const adjustedHeight = props.requestRenderingEvent.data.isPaddingIncluded
123
+ ? height + effectiveBottomInset
124
+ : height + VERTICAL_PADDING + effectiveBottomInset;
125
+ const maxHeight = props.requestRenderingEvent.data.isPaddingIncluded
126
+ ? overFullScreenHeight + effectiveBottomInset
127
+ : overFullScreenHeight + VERTICAL_PADDING + effectiveBottomInset;
128
+ dispatch(setComponentHeight(Math.min(adjustedHeight, maxHeight)));
135
129
  break;
130
+ }
136
131
  }
137
132
  dispatch(setIsComponentLoading(false));
138
133
  break;
@@ -143,55 +138,55 @@ const UNBottomSheetSlotComponent = (props: UNBottomSheetSlotComponentProps) => {
143
138
  type: BottomSheetRenderingType.Slot,
144
139
  data: { requestRenderingEvent: requestRendering, componentResourceId: props.componentResourceId },
145
140
  } as SlotRendering;
146
- dispatch(setEvent({ key: BottomSheetNativeMessage.REQUEST_RENDERING, data: requestRenderingSlotData }));
141
+ eventBus.emit(BottomSheetNativeMessage.REQUEST_RENDERING, requestRenderingSlotData);
147
142
  break;
148
143
  }
149
144
  case UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW:
150
- dispatch(setEvent({ key: UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW, data: {} }));
145
+ eventBus.emit(UnitComponentsMessage.UNIT_REQUEST_CLOSE_FLOW, {});
151
146
  break;
152
147
  case CardMessage.CARD_ACTIVATED:
153
- dispatch(setEvent({
154
- key: CardMessage.CARD_ACTIVATED,
155
- data: (message.details as CardActivatedEvent).card,
156
- }));
148
+ eventBus.emit(
149
+ CardMessage.CARD_ACTIVATED,
150
+ (message.details as CardActivatedEvent).card
151
+ );
157
152
  break;
158
153
 
159
154
  case PlaidMessage.UNIT_OPEN_PLAID:
160
- dispatch(setEvent({
161
- key: PlaidMessage.UNIT_OPEN_PLAID,
162
- data: message.details as OpenPlaidEvent
163
- }));
155
+ eventBus.emit(
156
+ PlaidMessage.UNIT_OPEN_PLAID,
157
+ message.details as OpenPlaidEvent
158
+ );
164
159
  break;
165
160
 
166
161
  case CardMessage.CARD_STATUS_CHANGED:
167
- dispatch(setEvent({
168
- key: CardMessage.CARD_STATUS_CHANGED,
169
- data: (message.details as CardStatusChangedEvent).card,
170
- }));
162
+ eventBus.emit(
163
+ CardMessage.CARD_STATUS_CHANGED,
164
+ (message.details as CardStatusChangedEvent).card
165
+ );
171
166
  break;
172
167
  case AccountMessage.UNIT_ACCOUNT_CHANGED:
173
- dispatch(setEvent({
174
- key: AccountMessage.UNIT_ACCOUNT_CHANGED,
175
- data: (message.details as AccountChangedEvent).account,
176
- }));
168
+ eventBus.emit(
169
+ AccountMessage.UNIT_ACCOUNT_CHANGED,
170
+ (message.details as AccountChangedEvent).account
171
+ );
177
172
  break;
178
173
  case ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED:
179
- dispatch(setEvent({
180
- key: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED,
181
- data: (message.details as ActivityFiltersChangedEvent),
182
- }));
174
+ eventBus.emit(
175
+ ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED,
176
+ (message.details as ActivityFiltersChangedEvent)
177
+ );
183
178
  break;
184
179
  case MultipleCardsMessage.UNIT_MULTIPLE_CARDS_FILTERS_CHANGED:
185
- dispatch(setEvent({
186
- key: MultipleCardsMessage.UNIT_MULTIPLE_CARDS_FILTERS_CHANGED,
187
- data: (message.details as MultipleCardsFiltersChangedEvent),
188
- }));
180
+ eventBus.emit(
181
+ MultipleCardsMessage.UNIT_MULTIPLE_CARDS_FILTERS_CHANGED,
182
+ (message.details as MultipleCardsFiltersChangedEvent)
183
+ );
189
184
  break;
190
185
  case PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED: {
191
- dispatch(setEvent({
192
- key: PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED,
193
- data: (message.details as PayeeCounterpartyEvent).counterparty,
194
- }));
186
+ eventBus.emit(
187
+ PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED,
188
+ (message.details as PayeeCounterpartyEvent).counterparty
189
+ );
195
190
  break;
196
191
  }
197
192
  }
@@ -217,13 +212,13 @@ const UNBottomSheetSlotComponent = (props: UNBottomSheetSlotComponentProps) => {
217
212
  // If isPaddingIncluded is true, we don't need to add padding to the web component
218
213
  const paddingStyle = !props.requestRenderingEvent.data.isPaddingIncluded ? {
219
214
  paddingTop: TOP_PADDING,
220
- paddingBottom: BOTTOM_PADDING,
215
+ paddingBottom: BOTTOM_PADDING + effectiveBottomInset,
221
216
  paddingLeft: LEFT_PADDING,
222
217
  paddingRight: RIGHT_PADDING,
223
218
  } : {};
224
219
 
225
220
  return (
226
- <View style={paddingStyle}>
221
+ <View style={{...paddingStyle, flex: 1}}>
227
222
  <UNKeyboardAvoidingView keyboardVerticalOffset={fullScreenHeight - overFullScreenHeight}>
228
223
  <WebComponent
229
224
  ref={webRef}
@@ -26,10 +26,10 @@ import { UnitComponentsSDK } from '../../unitComponentsSdkManager/UnitComponents
26
26
  import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
27
27
  import { useLaunchInitialize } from '../../helpers/pushProvisioningService/hooks/useLaunchInitialize';
28
28
  import { selectWallet } from '../../slices/pushProvisioningSlice';
29
- import { useDispatch, useSelector } from 'react-redux';
29
+ import { useSelector } from 'react-redux';
30
30
  import { withReduxStoreAndRefForwarding } from '../../helpers/store/helpers';
31
- import { useListenerToEvent } from '../../hooks/useListenerToEvent';
32
- import { setEvent } from '../../slices/SharedEventsSlice';
31
+ import { useEventListener } from '../../hooks/useEventListener';
32
+ import { eventBus } from '../../utils/eventBus';
33
33
  import { UNBaseView } from '../../nativeComponents/UNBaseView';
34
34
 
35
35
  export interface UNCardComponentProps {
@@ -65,7 +65,6 @@ export interface CardRef {
65
65
  }
66
66
 
67
67
  const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function UNCardComponent(props, cardRef) {
68
- const dispatch = useDispatch();
69
68
 
70
69
  const [height, setHeight] = useState(0);
71
70
 
@@ -124,9 +123,9 @@ const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function
124
123
  return;
125
124
  };
126
125
 
127
- useListenerToEvent({ busEventKey: UnitComponentsMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
128
- useListenerToEvent({ busEventKey: CardMessage.CARD_STATUS_CHANGED, action: cardStatusChanged });
129
- useListenerToEvent({ busEventKey: CardMessage.CARD_ACTIVATED, action: cardActivated });
126
+ useEventListener({ busEventKey: UnitComponentsMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
127
+ useEventListener({ busEventKey: CardMessage.CARD_STATUS_CHANGED, action: cardStatusChanged });
128
+ useEventListener({ busEventKey: CardMessage.CARD_ACTIVATED, action: cardActivated });
130
129
 
131
130
  const handleMessage = (message: WebViewMessage) => {
132
131
  if (!message || !message.details) return;
@@ -144,7 +143,7 @@ const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function
144
143
  data: slotData,
145
144
  } as SlotRendering;
146
145
 
147
- dispatch(setEvent({ key: BottomSheetNativeMessage.REQUEST_RENDERING, data }));
146
+ eventBus.emit(BottomSheetNativeMessage.REQUEST_RENDERING, data);
148
147
 
149
148
  sendActionCallbackIfNeeded(slotData.requestRenderingEvent);
150
149
  break;
@@ -0,0 +1,110 @@
1
+ import React, { useState } from 'react';
2
+ import { UNAccount, UNComponentsError, UNComponentsOnLoadResponse, UNComponentsOnLoadResponseData } from '../../types/shared';
3
+ import { UNCheckPayment } from '../../types/shared/payment';
4
+ import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
5
+ import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
6
+ import { ensureArray } from '../../utils/onLoadMessages.utils';
7
+ import type { WebViewMessage } from '../../messages/webMessages';
8
+ import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';
9
+ import { CheckPaymentEvent } from '../../messages/webMessages/checkPaymentMessage';
10
+ import { UnitComponentsMessage } from '../../messages/webMessages/unitComponentsMessages';
11
+ import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
12
+ import { UNBaseView } from '../../nativeComponents/UNBaseView';
13
+ import { WebComponent } from '../../webComponent/WebComponent';
14
+ import { withReduxStore } from '../../helpers/store/helpers';
15
+ import { getCheckPaymentParams, getCheckPaymentScript } from './UNCheckPaymentComponent.utils';
16
+
17
+ export interface UNCheckPaymentComponentProps {
18
+ //inputs
19
+ accountId?: string;
20
+
21
+ // ui
22
+ theme?: string;
23
+ language?: string;
24
+ initialStageBackButton?: boolean;
25
+ finalStageDoneButton?: boolean;
26
+
27
+ // events
28
+ onLoad?: (response: UNComponentsOnLoadResponse<[UNAccount]>) => void;
29
+ onPaymentCreated?: (data: UNCheckPayment) => void;
30
+ onInitialStageBackButtonClicked?: () => void;
31
+ onFinalStageDoneButtonClicked?: () => void;
32
+ }
33
+
34
+ const UNCheckPaymentComponent = (props: UNCheckPaymentComponentProps) => {
35
+ const [height, setHeight] = useState<number>(0);
36
+ const [presentationMode, setPresentationMode] = useState<PresentationMode>(PresentationMode.Inherit);
37
+
38
+ const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
39
+ if (!props.onLoad) {
40
+ return;
41
+ }
42
+
43
+ if (RESPONSE_KEYS.errors in response) {
44
+ props.onLoad(response as UNComponentsError);
45
+ return;
46
+ }
47
+
48
+ if (RESPONSE_KEYS.account in response) {
49
+ const account = response[RESPONSE_KEYS.account].data;
50
+ const paymentOnload: UNComponentsOnLoadResponseData<[UNAccount]> = {
51
+ data: ensureArray(account),
52
+ };
53
+ props.onLoad(paymentOnload);
54
+ return;
55
+ }
56
+
57
+ console.error('On Load Error: unexpected response type');
58
+ return;
59
+ };
60
+
61
+ const handleWebViewMessage = (message: WebViewMessage) => {
62
+ if (!message || !message.details) return;
63
+
64
+ switch (message.type) {
65
+ case PaymentMessage.INITIAL_STAGE_BACK_BUTTON_CLICKED: {
66
+ props.onInitialStageBackButtonClicked && props.onInitialStageBackButtonClicked();
67
+ break;
68
+ }
69
+ case PaymentMessage.FINAL_STAGE_DONE_BUTTON_CLICKED: {
70
+ props.onFinalStageDoneButtonClicked && props.onFinalStageDoneButtonClicked();
71
+ break;
72
+ }
73
+ case PaymentMessage.PAYMENT_CREATED: {
74
+ const checkPaymentEvent = message.details as CheckPaymentEvent;
75
+ props.onPaymentCreated && props.onPaymentCreated(checkPaymentEvent.data as UNCheckPayment);
76
+ break;
77
+ }
78
+ case UnitComponentsMessage.UNIT_ON_LOAD:
79
+ handleUnitOnLoad(message.details as UnitOnLoadResponseEvent);
80
+ break;
81
+ case PageMessage.PAGE_HEIGHT: {
82
+ const currentHeight = (message.details as HeightEvent).height;
83
+ setHeight(currentHeight);
84
+ if (presentationMode === PresentationMode.Inherit && currentHeight === 0) {
85
+ setPresentationMode(PresentationMode.Default);
86
+ }
87
+ break;
88
+ }
89
+ }
90
+ };
91
+
92
+ const style = presentationMode === PresentationMode.Inherit ? { flex: 1 } : { height: height };
93
+
94
+ return (
95
+ <UNBaseView style={style} onLoadError={ handleUnitOnLoad } fallback={<></>}>
96
+ <WebComponent
97
+ type={WebComponentType.checkPayment}
98
+ presentationMode={presentationMode}
99
+ params={getCheckPaymentParams(props)}
100
+ script={getCheckPaymentScript()}
101
+ onMessage={(message: WebViewMessage) => handleWebViewMessage(message)}
102
+ isScrollable={true}
103
+ theme={props.theme}
104
+ language={props.language}
105
+ />
106
+ </UNBaseView>
107
+ );
108
+ };
109
+
110
+ export default withReduxStore<UNCheckPaymentComponentProps>(UNCheckPaymentComponent);
@@ -0,0 +1,31 @@
1
+ import { LISTENERS } from '../../scripts/html/bodyScript';
2
+ import type { UNCheckPaymentComponentProps } from './UNCheckPaymentComponent';
3
+
4
+ import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';
5
+
6
+ export const getCheckPaymentParams = (props: UNCheckPaymentComponentProps) => {
7
+ const accountIdParam = props.accountId ? `account-id="${props.accountId}"` : '';
8
+ return `
9
+ ${accountIdParam}
10
+ initial-stage-back-button="${props.initialStageBackButton ?? false}"
11
+ final-stage-done-button="${props.finalStageDoneButton ?? false}"
12
+ style="height: 100%"
13
+ `;
14
+ };
15
+
16
+ export const getCheckPaymentScript = () => {
17
+ return `
18
+ window.addEventListener("${PaymentMessage.PAYMENT_CREATED}", (e) => {
19
+ const response = e.detail
20
+ response.then((data) => {
21
+ postMessageToSDK({ type: "${PaymentMessage.PAYMENT_CREATED}", details: { data: JSON.stringify(data.data) }})
22
+ }).catch((e) => {
23
+ console.log(e)
24
+ })
25
+ });
26
+
27
+ ${LISTENERS.requestRefresh}
28
+ ${LISTENERS.unitPaymentInitialStageBackButtonClicked}
29
+ ${LISTENERS.unitPaymentFinalStageDoneButtonClicked}
30
+ `;
31
+ };
@@ -0,0 +1 @@
1
+ export { default as UNCheckPaymentComponent, UNCheckPaymentComponentProps } from './UNCheckPaymentComponent';
@@ -11,8 +11,7 @@ import { UNCard, UNComponentsError, UNComponentsOnLoadResponse, UNComponentsOnLo
11
11
  import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
12
12
  import { UNCreateCardComponentResources, UNCreateCardType } from '../../types/shared/createCard.types';
13
13
  import { CardCreatedEvent, CardMessage } from '../../messages/webMessages/cardMessage';
14
- import { useDispatch } from 'react-redux';
15
- import { setEvent } from '../../slices/SharedEventsSlice';
14
+ import { eventBus } from '../../utils/eventBus';
16
15
 
17
16
  export interface UNCreateCardComponentProps {
18
17
  // inputs
@@ -31,7 +30,6 @@ export interface UNCreateCardComponentProps {
31
30
  }
32
31
 
33
32
  const UNCreateCardComponent = (props: UNCreateCardComponentProps) => {
34
- const dispatch = useDispatch();
35
33
  const [height, setHeight] = useState<number>(0);
36
34
  const [presentationMode, setPresentationMode] = useState<PresentationMode>(PresentationMode.Inherit);
37
35
 
@@ -49,6 +47,10 @@ const UNCreateCardComponent = (props: UNCreateCardComponentProps) => {
49
47
  props.onLoad(createCardResponse);
50
48
  return;
51
49
  }
50
+ // Ignore cardResult - card creation handled by onCardCreated
51
+ if (RESPONSE_KEYS.card in response) {
52
+ return;
53
+ }
52
54
  console.error('On Load Error: unexpected response type.');
53
55
  return;
54
56
  };
@@ -69,10 +71,10 @@ const UNCreateCardComponent = (props: UNCreateCardComponentProps) => {
69
71
  break;
70
72
  }
71
73
  case CardMessage.CARD_CREATED:
72
- dispatch(setEvent({
73
- key: CardMessage.CARD_CREATED,
74
- data: (message.details as CardCreatedEvent),
75
- }));
74
+ eventBus.emit(
75
+ CardMessage.CARD_CREATED,
76
+ (message.details as CardCreatedEvent)
77
+ );
76
78
  props.onCardCreated && props.onCardCreated(message.details as UNCard);
77
79
  break;
78
80
  }
@@ -1,4 +1,4 @@
1
- import { UNCreateCardComponentProps } from "./UNCreateCardComponent";
1
+ import { UNCreateCardComponentProps } from './UNCreateCardComponent';
2
2
 
3
3
  export const getCreateCardParams = (props: UNCreateCardComponentProps) => {
4
4
  const cardTypesParam = props.cardTypes ? `card-types="${props.cardTypes.join()}"` : '';
@@ -22,11 +22,10 @@ import type {
22
22
  } from '../../types/shared';
23
23
  import { MultipleCardsCardClickedEvent, MultipleCardsMessage } from '../../messages/webMessages/multipleCardsMessage';
24
24
  import { UNBaseView } from '../../nativeComponents/UNBaseView';
25
- import { useListenerToEvent } from '../../hooks/useListenerToEvent';
25
+ import { useEventListener } from '../../hooks/useEventListener';
26
26
  import { CardMessage } from '../../messages/webMessages/cardMessage';
27
27
  import { BottomSheetRenderingType, BottomSheetSlotData, SlotRendering } from '../../types/internal/bottomSheet.types';
28
- import { useDispatch } from 'react-redux';
29
- import { setEvent } from '../../slices/SharedEventsSlice';
28
+ import { eventBus } from '../../utils/eventBus';
30
29
  import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
31
30
 
32
31
  const DEFAULT_HEIGHT = Dimensions.get('window').height * 0.5;
@@ -50,7 +49,6 @@ export interface UNMultipleCardsComponentProps {
50
49
  }
51
50
 
52
51
  const UNMultipleCardsComponent = (props: UNMultipleCardsComponentProps) => {
53
- const dispatch = useDispatch();
54
52
  const webRef = useRef<WebView>(null);
55
53
  const [defaultHeight, setDefaultHeight] = useState<number>();
56
54
 
@@ -62,19 +60,19 @@ const UNMultipleCardsComponent = (props: UNMultipleCardsComponentProps) => {
62
60
  injectMultipleCardsFiltersChanged(webRef.current, query);
63
61
  };
64
62
 
65
- const dispatchCardCreated = (card: string) => {
63
+ const dispatchCardCreated = (card: UNCard) => {
66
64
  injectCardCreated(webRef.current, card);
67
65
  };
68
66
 
69
- useListenerToEvent({
67
+ useEventListener({
70
68
  busEventKey: CardMessage.CARD_STATUS_CHANGED,
71
69
  action: dispatchCardStatusChanged
72
70
  });
73
- useListenerToEvent({
71
+ useEventListener({
74
72
  busEventKey: MultipleCardsMessage.UNIT_MULTIPLE_CARDS_FILTERS_CHANGED,
75
73
  action: dispatchMultipleCardsFiltersChanged,
76
74
  });
77
- useListenerToEvent({
75
+ useEventListener({
78
76
  busEventKey: CardMessage.CARD_CREATED,
79
77
  action: dispatchCardCreated,
80
78
  });
@@ -130,7 +128,7 @@ const UNMultipleCardsComponent = (props: UNMultipleCardsComponentProps) => {
130
128
  type: BottomSheetRenderingType.Slot,
131
129
  data: slotData,
132
130
  } as SlotRendering;
133
- dispatch(setEvent({ key: BottomSheetNativeMessage.REQUEST_RENDERING, data }));
131
+ eventBus.emit(BottomSheetNativeMessage.REQUEST_RENDERING, data);
134
132
  break;
135
133
  }
136
134
  }
@@ -43,8 +43,8 @@ export const injectMultipleCardsFiltersChanged = (currentWeb: WebView | null, qu
43
43
  currentWeb?.injectJavaScript(`dispatchMultipleCardsFilterChangedEvent('${query}')`);
44
44
  };
45
45
 
46
- export const injectCardCreated = (currentWeb: WebView | null, card: string) => {
47
- currentWeb?.injectJavaScript(`dispatchCardCreatedEvent('${card}')`);
46
+ export const injectCardCreated = (currentWeb: WebView | null, card: UNCard) => {
47
+ currentWeb?.injectJavaScript(`dispatchCardCreatedEvent(${JSON.stringify(card)})`);
48
48
  };
49
49
 
50
50
  export const injectCardStatusChangedEvent = (currentWeb: WebView | null, card: UNCard | null) => {
@@ -20,11 +20,10 @@ import {
20
20
  import { getPayeeParams, getPayeeManagementScript, injectRefreshEventIfNeeded, injectUnitPlaidResponse, injectUnitOpenPlaid, injectUnitPlaidExit } from './UNPayeeManagementComponent.utils';
21
21
  import { BottomSheetRenderingType, BottomSheetSlotData, SlotRendering } from '../../types/internal/bottomSheet.types';
22
22
  import { RequestRenderingEvent } from '../../messages/webMessages/unitComponentsMessages';
23
- import { useDispatch } from 'react-redux';
24
- import { setEvent } from '../../slices/SharedEventsSlice';
23
+ import { eventBus } from '../../utils/eventBus';
25
24
  import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
26
- import { useListenerToEvent } from '../../hooks/useListenerToEvent';
27
- import { LinkSuccess, openLink } from 'react-native-plaid-link-sdk';
25
+ import { useEventListener } from '../../hooks/useEventListener';
26
+ import { LinkExit, LinkSuccess, open as openPlaidLink, create as createPlaidLink } from 'react-native-plaid-link-sdk';
28
27
  import { OpenPlaidEvent, PlaidMessage } from '../../messages/webMessages/plaidMessages';
29
28
  import { PayeeConnectedAccountEvent, PayeeCounterpartyEvent, PayeeManagementMessage, PayeeMicroDepositeConnectionEvent } from '../../messages/webMessages/payeeManagementMessage';
30
29
  import { UNBaseView } from '../../nativeComponents/UNBaseView';
@@ -64,7 +63,6 @@ export interface UNPayeeManagementComponentProps {
64
63
  }
65
64
 
66
65
  const UNPayeeManagementComponent = (props: UNPayeeManagementComponentProps) => {
67
- const dispatch = useDispatch();
68
66
  const webRef = useRef<WebView>(null);
69
67
 
70
68
  const requestRefresh = (data: RequestRefreshEvent) => {
@@ -75,17 +73,15 @@ const UNPayeeManagementComponent = (props: UNPayeeManagementComponentProps) => {
75
73
  injectUnitOpenPlaid(webRef.current, openPlaidData);
76
74
 
77
75
  const linkToken = openPlaidData.plaidLinkToken.attributes.linkToken;
76
+ createPlaidLink({ token: linkToken });
78
77
 
79
- linkToken && openLink({
80
- tokenConfig: { noLoadingState: false, token: linkToken },
78
+ openPlaidLink({
81
79
  onSuccess: (success: LinkSuccess) => {
82
80
  injectUnitPlaidResponse(webRef.current, success);
83
81
  },
84
- onExit: exit => {
82
+ onExit: (exit: LinkExit) => {
85
83
  injectUnitPlaidExit(webRef.current, exit.error);
86
- },
87
- }).catch(e => {
88
- console.error(e);
84
+ }
89
85
  });
90
86
  };
91
87
 
@@ -93,9 +89,9 @@ const UNPayeeManagementComponent = (props: UNPayeeManagementComponentProps) => {
93
89
  props.onCounterpartyDeleted && props.onCounterpartyDeleted(counterparty);
94
90
  };
95
91
 
96
- useListenerToEvent({ busEventKey: UnitComponentsMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
97
- useListenerToEvent({ busEventKey: PlaidMessage.UNIT_OPEN_PLAID, action: openPlaid });
98
- useListenerToEvent({ busEventKey: PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED, action: reportCounterpartyDeleted });
92
+ useEventListener({ busEventKey: UnitComponentsMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
93
+ useEventListener({ busEventKey: PlaidMessage.UNIT_OPEN_PLAID, action: openPlaid });
94
+ useEventListener({ busEventKey: PayeeManagementMessage.UNIT_COUNTERPARTY_DELETED, action: reportCounterpartyDeleted });
99
95
 
100
96
  const handleRequestRendering = (requestRenderingEvent : RequestRenderingEvent) => {
101
97
  switch (requestRenderingEvent.data.nativeComponentName) {
@@ -108,7 +104,7 @@ const UNPayeeManagementComponent = (props: UNPayeeManagementComponentProps) => {
108
104
  type: BottomSheetRenderingType.Slot,
109
105
  data: slotData,
110
106
  } as SlotRendering;
111
- dispatch(setEvent({ key: BottomSheetNativeMessage.REQUEST_RENDERING, data }));
107
+ eventBus.emit(BottomSheetNativeMessage.REQUEST_RENDERING, data);
112
108
  }
113
109
  }
114
110
  };
@@ -9,10 +9,9 @@ import {
9
9
  SlotRendering,
10
10
  } from '../../types/internal/bottomSheet.types';
11
11
  import type { BottomSheetSlotData } from '../../types/internal/bottomSheet.types';
12
- import { setEvent } from '../../slices/SharedEventsSlice';
12
+ import { eventBus } from '../../utils/eventBus';
13
13
  import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
14
- import { useDispatch } from 'react-redux';
15
- import { useListenerToEvent } from '../../hooks/useListenerToEvent';
14
+ import { useEventListener } from '../../hooks/useEventListener';
16
15
  import WebView from 'react-native-webview';
17
16
  import {
18
17
  getWhiteLabelAppParams,
@@ -40,8 +39,6 @@ export interface UNWhiteLabelAppComponentProps {
40
39
  const UNWhiteLabelAppComponent = (props: UNWhiteLabelAppComponentProps) => {
41
40
  const webRef = useRef<WebView>(null);
42
41
 
43
- const dispatch = useDispatch();
44
-
45
42
  const handleWebViewMessage = (message: WebViewMessage) => {
46
43
  switch (message.type) {
47
44
  case UnitComponentsMessage.UNIT_REQUEST_RENDERING: {
@@ -56,7 +53,7 @@ const UNWhiteLabelAppComponent = (props: UNWhiteLabelAppComponentProps) => {
56
53
  data: slotData,
57
54
  } as SlotRendering;
58
55
 
59
- dispatch(setEvent({ key: BottomSheetNativeMessage.REQUEST_RENDERING, data }));
56
+ eventBus.emit(BottomSheetNativeMessage.REQUEST_RENDERING, data);
60
57
  break;
61
58
  }
62
59
  case UnitComponentsMessage.UNIT_WHITE_LABEL_APP_ON_LOAD: {
@@ -97,8 +94,8 @@ const UNWhiteLabelAppComponent = (props: UNWhiteLabelAppComponentProps) => {
97
94
  webRef.current?.injectJavaScript(`dispatchActivityFilterChangedEvent('${query}')`);
98
95
  };
99
96
 
100
- useListenerToEvent({ busEventKey: UnitComponentsMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
101
- useListenerToEvent({
97
+ useEventListener({ busEventKey: UnitComponentsMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
98
+ useEventListener({
102
99
  busEventKey: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED,
103
100
  action: dispatchActivityFiltersChanged,
104
101
  });
@@ -5,6 +5,7 @@ export * from './UNBookPaymentComponent';
5
5
  export * from './UNActivityComponent';
6
6
  export * from './UNAccountComponent';
7
7
  export * from './UNCheckDepositComponent';
8
+ export * from './UNCheckPaymentComponent';
8
9
  export * from './UNACHDebitComponent';
9
10
  export * from './UNACHCreditComponent';
10
11
  export * from './UNProgramDetailsComponent';
@@ -3,8 +3,7 @@ import {
3
3
  BottomSheetRenderingType, NativeComponentRendering,
4
4
  } from '../../types/internal/bottomSheet.types';
5
5
  import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
6
- import { setEvent } from '../../slices/SharedEventsSlice';
7
- import { store } from '../../store/store';
6
+ import { eventBus } from '../../utils/eventBus';
8
7
  import {
9
8
  UNAddToWalletComponentProps,
10
9
  } from '../../nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent';
@@ -22,7 +21,7 @@ export class UNCardFlows {
22
21
  },
23
22
  },
24
23
  };
25
- store.dispatch(setEvent({ key: BottomSheetNativeMessage.REQUEST_RENDERING, data }));
24
+ eventBus.emit(BottomSheetNativeMessage.REQUEST_RENDERING, data);
26
25
  } catch (error) {
27
26
  console.error(error);
28
27
  }