react-native-unit-components 1.9.1 → 1.10.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 (327) hide show
  1. package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsPackage.kt +9 -12
  2. package/android/src/main/java/com/unitreactnativecomponents/appInfo/UNAppInfoModule.kt +59 -0
  3. package/android/src/main/java/com/unitreactnativecomponents/extensions/ContextExtensions.kt +35 -0
  4. package/ios/Extensions/Bundle+Extensions.swift +23 -0
  5. package/ios/UNAppInfo/IOSAppInfo.swift +47 -0
  6. package/ios/UNAppInfo/UNAppInfoExportModule.m +5 -2
  7. package/ios/UnitReactNativeComponents.xcodeproj/project.pbxproj +34 -0
  8. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +2 -2
  9. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  10. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +2 -2
  11. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  12. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +11 -7
  13. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  14. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +13 -9
  15. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  16. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +4 -0
  17. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  18. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +22 -8
  19. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  20. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js +7 -2
  21. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js.map +1 -1
  22. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +11 -8
  23. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  24. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +86 -0
  25. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -0
  26. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +41 -0
  27. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -0
  28. package/lib/commonjs/components/UNMultipleCardsComponent/index.js +21 -0
  29. package/lib/commonjs/components/UNMultipleCardsComponent/index.js.map +1 -0
  30. package/lib/commonjs/components/index.js +11 -0
  31. package/lib/commonjs/components/index.js.map +1 -1
  32. package/lib/commonjs/flows/card/UNCardFlows.js +8 -4
  33. package/lib/commonjs/flows/card/UNCardFlows.js.map +1 -1
  34. package/lib/commonjs/helpers/pushProvisioningService/helpers.js +34 -0
  35. package/lib/commonjs/helpers/pushProvisioningService/helpers.js.map +1 -0
  36. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js +32 -2
  37. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  38. package/lib/commonjs/helpers/pushProvisioningService/types.js +41 -0
  39. package/lib/commonjs/helpers/pushProvisioningService/types.js.map +1 -0
  40. package/lib/commonjs/hooks/useListenerToEvent.js +26 -0
  41. package/lib/commonjs/hooks/useListenerToEvent.js.map +1 -0
  42. package/lib/commonjs/messages/webMessages/index.js.map +1 -1
  43. package/lib/commonjs/messages/webMessages/multipleCardsMessage.js +12 -0
  44. package/lib/commonjs/messages/webMessages/multipleCardsMessage.js.map +1 -0
  45. package/lib/commonjs/messages/webMessages/onLoadMessage.js +2 -1
  46. package/lib/commonjs/messages/webMessages/onLoadMessage.js.map +1 -1
  47. package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js +27 -3
  48. package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js.map +1 -1
  49. package/lib/commonjs/slices/ConfigurationSlice.js +36 -0
  50. package/lib/commonjs/slices/ConfigurationSlice.js.map +1 -0
  51. package/lib/commonjs/slices/SharedEventsSlice.js +28 -0
  52. package/lib/commonjs/slices/SharedEventsSlice.js.map +1 -0
  53. package/lib/commonjs/store/store.js +5 -1
  54. package/lib/commonjs/store/store.js.map +1 -1
  55. package/lib/commonjs/types/internal/errorHelpers.js +20 -0
  56. package/lib/commonjs/types/internal/errorHelpers.js.map +1 -0
  57. package/lib/commonjs/types/internal/webComponent.types.js +1 -0
  58. package/lib/commonjs/types/internal/webComponent.types.js.map +1 -1
  59. package/lib/commonjs/types/shared/activity.types.js +7 -0
  60. package/lib/commonjs/types/shared/activity.types.js.map +1 -1
  61. package/lib/commonjs/types/shared/error.types.js +29 -0
  62. package/lib/commonjs/types/shared/error.types.js.map +1 -0
  63. package/lib/commonjs/types/shared/index.js +22 -0
  64. package/lib/commonjs/types/shared/index.js.map +1 -1
  65. package/lib/commonjs/types/shared/multipleCards.types.js +13 -0
  66. package/lib/commonjs/types/shared/multipleCards.types.js.map +1 -0
  67. package/lib/commonjs/types/shared/onLoadResponse.types.js +4 -0
  68. package/lib/commonjs/types/shared/onLoadResponse.types.js.map +1 -1
  69. package/lib/commonjs/unitSdkManager/UnitSdk.api.js +6 -13
  70. package/lib/commonjs/unitSdkManager/UnitSdk.api.js.map +1 -1
  71. package/lib/commonjs/unitSdkManager/UnitSdk.constants.js +1 -1
  72. package/lib/commonjs/unitSdkManager/UnitSdk.constants.js.map +1 -1
  73. package/lib/commonjs/unitSdkManager/UnitSdkManager.js +8 -18
  74. package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
  75. package/lib/commonjs/utils/AppInfo.js +49 -0
  76. package/lib/commonjs/utils/AppInfo.js.map +1 -0
  77. package/lib/commonjs/utils/SDKInfo.js +13 -0
  78. package/lib/commonjs/utils/SDKInfo.js.map +1 -0
  79. package/lib/commonjs/webComponent/WebComponent.js +30 -32
  80. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  81. package/lib/commonjs/webComponent/WebComponent.utils.js +19 -1
  82. package/lib/commonjs/webComponent/WebComponent.utils.js.map +1 -1
  83. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +2 -2
  84. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  85. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +2 -2
  86. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  87. package/lib/module/components/UNAccountComponent/UNAccountComponent.js +11 -6
  88. package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  89. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +13 -8
  90. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  91. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +4 -0
  92. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  93. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +22 -8
  94. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  95. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js +7 -2
  96. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js.map +1 -1
  97. package/lib/module/components/UNCardComponent/UNCardComponent.js +12 -8
  98. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  99. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +77 -0
  100. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -0
  101. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +33 -0
  102. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -0
  103. package/lib/module/components/UNMultipleCardsComponent/index.js +2 -0
  104. package/lib/module/components/UNMultipleCardsComponent/index.js.map +1 -0
  105. package/lib/module/components/index.js +1 -0
  106. package/lib/module/components/index.js.map +1 -1
  107. package/lib/module/flows/card/UNCardFlows.js +8 -3
  108. package/lib/module/flows/card/UNCardFlows.js.map +1 -1
  109. package/lib/module/helpers/pushProvisioningService/helpers.js +24 -0
  110. package/lib/module/helpers/pushProvisioningService/helpers.js.map +1 -0
  111. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js +35 -5
  112. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  113. package/lib/module/helpers/pushProvisioningService/types.js +34 -0
  114. package/lib/module/helpers/pushProvisioningService/types.js.map +1 -0
  115. package/lib/module/hooks/useListenerToEvent.js +19 -0
  116. package/lib/module/hooks/useListenerToEvent.js.map +1 -0
  117. package/lib/module/messages/webMessages/index.js.map +1 -1
  118. package/lib/module/messages/webMessages/multipleCardsMessage.js +5 -0
  119. package/lib/module/messages/webMessages/multipleCardsMessage.js.map +1 -0
  120. package/lib/module/messages/webMessages/onLoadMessage.js +2 -1
  121. package/lib/module/messages/webMessages/onLoadMessage.js.map +1 -1
  122. package/lib/module/networking/requests/UNWalletPayloadRequest.js +27 -3
  123. package/lib/module/networking/requests/UNWalletPayloadRequest.js.map +1 -1
  124. package/lib/module/slices/ConfigurationSlice.js +25 -0
  125. package/lib/module/slices/ConfigurationSlice.js.map +1 -0
  126. package/lib/module/slices/SharedEventsSlice.js +19 -0
  127. package/lib/module/slices/SharedEventsSlice.js.map +1 -0
  128. package/lib/module/store/store.js +5 -1
  129. package/lib/module/store/store.js.map +1 -1
  130. package/lib/module/types/internal/errorHelpers.js +12 -0
  131. package/lib/module/types/internal/errorHelpers.js.map +1 -0
  132. package/lib/module/types/internal/webComponent.types.js +1 -0
  133. package/lib/module/types/internal/webComponent.types.js.map +1 -1
  134. package/lib/module/types/shared/activity.types.js +5 -1
  135. package/lib/module/types/shared/activity.types.js.map +1 -1
  136. package/lib/module/types/shared/error.types.js +22 -0
  137. package/lib/module/types/shared/error.types.js.map +1 -0
  138. package/lib/module/types/shared/index.js +2 -0
  139. package/lib/module/types/shared/index.js.map +1 -1
  140. package/lib/module/types/shared/multipleCards.types.js +6 -0
  141. package/lib/module/types/shared/multipleCards.types.js.map +1 -0
  142. package/lib/module/types/shared/onLoadResponse.types.js +1 -1
  143. package/lib/module/types/shared/onLoadResponse.types.js.map +1 -1
  144. package/lib/module/unitSdkManager/UnitSdk.api.js +5 -10
  145. package/lib/module/unitSdkManager/UnitSdk.api.js.map +1 -1
  146. package/lib/module/unitSdkManager/UnitSdk.constants.js +1 -1
  147. package/lib/module/unitSdkManager/UnitSdk.constants.js.map +1 -1
  148. package/lib/module/unitSdkManager/UnitSdkManager.js +8 -17
  149. package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
  150. package/lib/module/utils/AppInfo.js +39 -0
  151. package/lib/module/utils/AppInfo.js.map +1 -0
  152. package/lib/module/utils/SDKInfo.js +5 -0
  153. package/lib/module/utils/SDKInfo.js.map +1 -0
  154. package/lib/module/webComponent/WebComponent.js +33 -34
  155. package/lib/module/webComponent/WebComponent.js.map +1 -1
  156. package/lib/module/webComponent/WebComponent.utils.js +15 -0
  157. package/lib/module/webComponent/WebComponent.utils.js.map +1 -1
  158. package/lib/typescript/{components → src/components}/UNActivityComponent/UNActivityComponent.d.ts +3 -0
  159. package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.d.ts +15 -0
  160. package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.d.ts +3 -0
  161. package/lib/typescript/src/components/UNMultipleCardsComponent/index.d.ts +1 -0
  162. package/lib/typescript/{components → src/components}/index.d.ts +1 -0
  163. package/lib/typescript/src/helpers/pushProvisioningService/helpers.d.ts +4 -0
  164. package/lib/typescript/src/helpers/pushProvisioningService/types.d.ts +49 -0
  165. package/lib/typescript/src/hooks/useListenerToEvent.d.ts +9 -0
  166. package/lib/typescript/{messages → src/messages}/webMessages/index.d.ts +3 -2
  167. package/lib/typescript/src/messages/webMessages/multipleCardsMessage.d.ts +6 -0
  168. package/lib/typescript/{messages → src/messages}/webMessages/onLoadMessage.d.ts +7 -3
  169. package/lib/typescript/{networking → src/networking}/requests/UNWalletPayloadRequest.d.ts +1 -1
  170. package/lib/typescript/src/slices/ConfigurationSlice.d.ts +10 -0
  171. package/lib/typescript/src/slices/SharedEventsSlice.d.ts +56 -0
  172. package/lib/typescript/src/store/store.d.ts +76 -0
  173. package/lib/typescript/src/types/internal/errorHelpers.d.ts +4 -0
  174. package/lib/typescript/{types → src/types}/internal/webComponent.types.d.ts +1 -0
  175. package/lib/typescript/{types → src/types}/shared/activity.types.d.ts +5 -1
  176. package/lib/typescript/src/types/shared/error.types.d.ts +36 -0
  177. package/lib/typescript/{types → src/types}/shared/index.d.ts +2 -0
  178. package/lib/typescript/src/types/shared/multipleCards.types.d.ts +6 -0
  179. package/lib/typescript/src/types/shared/onLoadResponse.types.d.ts +5 -0
  180. package/lib/typescript/src/unitSdkManager/UnitSdk.api.d.ts +1 -0
  181. package/lib/typescript/{unitSdkManager → src/unitSdkManager}/UnitSdkManager.d.ts +4 -8
  182. package/lib/typescript/src/utils/AppInfo.d.ts +4 -0
  183. package/lib/typescript/src/utils/SDKInfo.d.ts +1 -0
  184. package/lib/typescript/{webComponent → src/webComponent}/WebComponent.utils.d.ts +3 -0
  185. package/package.json +3 -3
  186. package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +2 -2
  187. package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +2 -2
  188. package/src/components/UNAccountComponent/UNAccountComponent.tsx +25 -12
  189. package/src/components/UNActivityComponent/UNActivityComponent.tsx +33 -16
  190. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +4 -1
  191. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +42 -16
  192. package/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.tsx +7 -2
  193. package/src/components/UNCardComponent/UNCardComponent.tsx +11 -10
  194. package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.tsx +119 -0
  195. package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.ts +36 -0
  196. package/src/components/UNMultipleCardsComponent/index.ts +3 -0
  197. package/src/components/index.ts +1 -0
  198. package/src/flows/card/UNCardFlows.ts +10 -4
  199. package/src/helpers/pushProvisioningService/helpers.ts +31 -0
  200. package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +35 -6
  201. package/src/helpers/pushProvisioningService/types.ts +52 -0
  202. package/src/hooks/useListenerToEvent.ts +32 -0
  203. package/src/messages/webMessages/index.ts +3 -0
  204. package/src/messages/webMessages/multipleCardsMessage.ts +9 -0
  205. package/src/messages/webMessages/onLoadMessage.ts +14 -3
  206. package/src/networking/requests/UNWalletPayloadRequest.ts +25 -4
  207. package/src/slices/ConfigurationSlice.ts +31 -0
  208. package/src/slices/SharedEventsSlice.ts +93 -0
  209. package/src/store/store.ts +6 -2
  210. package/src/types/internal/errorHelpers.ts +22 -0
  211. package/src/types/internal/webComponent.types.ts +1 -1
  212. package/src/types/shared/activity.types.ts +6 -1
  213. package/src/types/shared/error.types.ts +38 -0
  214. package/src/types/shared/index.ts +2 -0
  215. package/src/types/shared/multipleCards.types.ts +8 -0
  216. package/src/types/shared/onLoadResponse.types.ts +2 -12
  217. package/src/unitSdkManager/UnitSdk.api.ts +5 -8
  218. package/src/unitSdkManager/UnitSdk.constants.ts +1 -1
  219. package/src/unitSdkManager/UnitSdkManager.ts +8 -20
  220. package/src/utils/AppInfo.ts +40 -0
  221. package/src/utils/SDKInfo.ts +5 -0
  222. package/src/webComponent/WebComponent.tsx +37 -34
  223. package/src/webComponent/WebComponent.utils.ts +17 -0
  224. package/android/src/main/java/com/unitreactnativecomponents/getapplicationid/UNAppInfoModule.kt +0 -35
  225. package/ios/UNAppInfo/UNAppInfo.swift +0 -23
  226. package/lib/commonjs/components/utils/nativeModulesInfo.js +0 -20
  227. package/lib/commonjs/components/utils/nativeModulesInfo.js.map +0 -1
  228. package/lib/commonjs/helpers/EventBus.js +0 -58
  229. package/lib/commonjs/helpers/EventBus.js.map +0 -1
  230. package/lib/commonjs/hooks/listenerToBus.js +0 -34
  231. package/lib/commonjs/hooks/listenerToBus.js.map +0 -1
  232. package/lib/module/components/utils/nativeModulesInfo.js +0 -13
  233. package/lib/module/components/utils/nativeModulesInfo.js.map +0 -1
  234. package/lib/module/helpers/EventBus.js +0 -51
  235. package/lib/module/helpers/EventBus.js.map +0 -1
  236. package/lib/module/hooks/listenerToBus.js +0 -25
  237. package/lib/module/hooks/listenerToBus.js.map +0 -1
  238. package/lib/typescript/components/utils/nativeModulesInfo.d.ts +0 -1
  239. package/lib/typescript/helpers/EventBus.d.ts +0 -13
  240. package/lib/typescript/hooks/listenerToBus.d.ts +0 -7
  241. package/lib/typescript/store/store.d.ts +0 -6
  242. package/lib/typescript/types/shared/onLoadResponse.types.d.ts +0 -14
  243. package/lib/typescript/unitSdkManager/UnitSdk.api.d.ts +0 -3
  244. package/src/components/utils/nativeModulesInfo.ts +0 -11
  245. package/src/helpers/EventBus.ts +0 -58
  246. package/src/hooks/listenerToBus.ts +0 -31
  247. /package/lib/typescript/{assets → src/assets}/images/index.d.ts +0 -0
  248. /package/lib/typescript/{components → src/components}/UNACHCreditComponent/UNACHCreditComponent.d.ts +0 -0
  249. /package/lib/typescript/{components → src/components}/UNACHCreditComponent/UNACHCreditComponent.utils.d.ts +0 -0
  250. /package/lib/typescript/{components → src/components}/UNACHCreditComponent/index.d.ts +0 -0
  251. /package/lib/typescript/{components → src/components}/UNACHDebitComponent/UNACHDebitComponent.d.ts +0 -0
  252. /package/lib/typescript/{components → src/components}/UNACHDebitComponent/UNACHDebitComponent.utils.d.ts +0 -0
  253. /package/lib/typescript/{components → src/components}/UNACHDebitComponent/index.d.ts +0 -0
  254. /package/lib/typescript/{components → src/components}/UNAccountComponent/UNAccountComponent.d.ts +0 -0
  255. /package/lib/typescript/{components → src/components}/UNAccountComponent/UNAccountComponent.utils.d.ts +0 -0
  256. /package/lib/typescript/{components → src/components}/UNAccountComponent/index.d.ts +0 -0
  257. /package/lib/typescript/{components → src/components}/UNActivityComponent/UNActivityComponent.utils.d.ts +0 -0
  258. /package/lib/typescript/{components → src/components}/UNActivityComponent/index.d.ts +0 -0
  259. /package/lib/typescript/{components → src/components}/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +0 -0
  260. /package/lib/typescript/{components → src/components}/UNBookPaymentComponent/UNBookPaymentComponent.utils.d.ts +0 -0
  261. /package/lib/typescript/{components → src/components}/UNBookPaymentComponent/index.d.ts +0 -0
  262. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +0 -0
  263. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +0 -0
  264. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.styles.d.ts +0 -0
  265. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +0 -0
  266. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.d.ts +0 -0
  267. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.styles.d.ts +0 -0
  268. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/index.d.ts +0 -0
  269. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/components/index.d.ts +0 -0
  270. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/index.d.ts +0 -0
  271. /package/lib/typescript/{components → src/components}/UNCardComponent/UNCardComponent.d.ts +0 -0
  272. /package/lib/typescript/{components → src/components}/UNCardComponent/UNCardComponent.utils.d.ts +0 -0
  273. /package/lib/typescript/{components → src/components}/UNCardComponent/index.d.ts +0 -0
  274. /package/lib/typescript/{components → src/components}/UNCheckDepositComponent/UNCheckDepositComponent.d.ts +0 -0
  275. /package/lib/typescript/{components → src/components}/UNCheckDepositComponent/UNCheckDepositComponent.utils.d.ts +0 -0
  276. /package/lib/typescript/{components → src/components}/UNCheckDepositComponent/index.d.ts +0 -0
  277. /package/lib/typescript/{flows → src/flows}/UNFlows.d.ts +0 -0
  278. /package/lib/typescript/{flows → src/flows}/card/UNCardFlows.d.ts +0 -0
  279. /package/lib/typescript/{helpers → src/helpers}/BottomSheet/BottomSheet.d.ts +0 -0
  280. /package/lib/typescript/{helpers → src/helpers}/BottomSheet/BottomSheet.styles.d.ts +0 -0
  281. /package/lib/typescript/{helpers → src/helpers}/pushProvisioningService/hooks/useCardWallet.d.ts +0 -0
  282. /package/lib/typescript/{helpers → src/helpers}/pushProvisioningService/hooks/useLaunchInitialize.d.ts +0 -0
  283. /package/lib/typescript/{helpers → src/helpers}/pushProvisioningService/startProvisioning.d.ts +0 -0
  284. /package/lib/typescript/{helpers → src/helpers}/store/helpers.d.ts +0 -0
  285. /package/lib/typescript/{hooks → src/hooks}/useAppStateListener.d.ts +0 -0
  286. /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
  287. /package/lib/typescript/{messages → src/messages}/nativeMessages/bottomSheetMessage.d.ts +0 -0
  288. /package/lib/typescript/{messages → src/messages}/nativeMessages/cardMessage.d.ts +0 -0
  289. /package/lib/typescript/{messages → src/messages}/nativeMessages/index.d.ts +0 -0
  290. /package/lib/typescript/{messages → src/messages}/nativeMessages/sdkMessage.d.ts +0 -0
  291. /package/lib/typescript/{messages → src/messages}/webMessages/accountMessage.d.ts +0 -0
  292. /package/lib/typescript/{messages → src/messages}/webMessages/achCreditMessage.d.ts +0 -0
  293. /package/lib/typescript/{messages → src/messages}/webMessages/activityMessage.d.ts +0 -0
  294. /package/lib/typescript/{messages → src/messages}/webMessages/bookPaymentMessage.d.ts +0 -0
  295. /package/lib/typescript/{messages → src/messages}/webMessages/cardMessage.d.ts +0 -0
  296. /package/lib/typescript/{messages → src/messages}/webMessages/checkMessage.d.ts +0 -0
  297. /package/lib/typescript/{messages → src/messages}/webMessages/pageMessage.d.ts +0 -0
  298. /package/lib/typescript/{messages → src/messages}/webMessages/paymentsMessage.d.ts +0 -0
  299. /package/lib/typescript/{messages → src/messages}/webMessages/unitMessages.d.ts +0 -0
  300. /package/lib/typescript/{nativeComponent → src/nativeComponent}/UnitAddToWalletButton.d.ts +0 -0
  301. /package/lib/typescript/{networking → src/networking}/common/UNNetworkConstants.d.ts +0 -0
  302. /package/lib/typescript/{scripts → src/scripts}/html/bodyHtml.d.ts +0 -0
  303. /package/lib/typescript/{scripts → src/scripts}/html/bodyScript.d.ts +0 -0
  304. /package/lib/typescript/{scripts → src/scripts}/html/fontFaces.d.ts +0 -0
  305. /package/lib/typescript/{slices → src/slices}/pushProvisioningSlice.d.ts +0 -0
  306. /package/lib/typescript/{store → src/store}/index.d.ts +0 -0
  307. /package/lib/typescript/{styles → src/styles}/fonts.d.ts +0 -0
  308. /package/lib/typescript/{styles → src/styles}/variables.d.ts +0 -0
  309. /package/lib/typescript/{types → src/types}/internal/bottomSheet.types.d.ts +0 -0
  310. /package/lib/typescript/{types → src/types}/shared/account.types.d.ts +0 -0
  311. /package/lib/typescript/{types → src/types}/shared/achCredit.types.d.ts +0 -0
  312. /package/lib/typescript/{types → src/types}/shared/authorization.types.d.ts +0 -0
  313. /package/lib/typescript/{types → src/types}/shared/bookPayment.types.d.ts +0 -0
  314. /package/lib/typescript/{types → src/types}/shared/card.types.d.ts +0 -0
  315. /package/lib/typescript/{types → src/types}/shared/checkDeposit.types.d.ts +0 -0
  316. /package/lib/typescript/{types → src/types}/shared/fonts.types.d.ts +0 -0
  317. /package/lib/typescript/{types → src/types}/shared/payments.types.d.ts +0 -0
  318. /package/lib/typescript/{types → src/types}/shared/transactions.types.d.ts +0 -0
  319. /package/lib/typescript/{types → src/types}/shared/types.d.ts +0 -0
  320. /package/lib/typescript/{types → src/types}/shared/versioning.types.d.ts +0 -0
  321. /package/lib/typescript/{types → src/types}/shared/wallet.types.d.ts +0 -0
  322. /package/lib/typescript/{unitSdkManager → src/unitSdkManager}/UnitSdk.constants.d.ts +0 -0
  323. /package/lib/typescript/{unitSdkManager → src/unitSdkManager}/UnitSdkManager.utils.internal.d.ts +0 -0
  324. /package/lib/typescript/{unitSdkManager → src/unitSdkManager}/unitUiManager/unitUiManager.d.ts +0 -0
  325. /package/lib/typescript/{utils → src/utils}/webVersioningStrategy.utils.d.ts +0 -0
  326. /package/lib/typescript/{webComponent → src/webComponent}/WebComponent.d.ts +0 -0
  327. /package/lib/typescript/{webComponent → src/webComponent}/html.d.ts +0 -0
@@ -1,39 +1,53 @@
1
1
  import React, { useRef, useState } from 'react';
2
2
  import { Dimensions, View } from 'react-native';
3
3
  import { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
4
- import { useListenerToBus } from '../../hooks/listenerToBus';
5
4
  import type { WebViewMessage } from '../../messages/webMessages';
6
5
  import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
7
6
  import type { UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../types/shared';
8
7
  import { WebComponent } from '../../webComponent/WebComponent';
9
- import { getActivityParams, getActivityScript, injectFiltersChanged, injectRefreshEventIfNeeded } from './UNActivityComponent.utils';
8
+ import {
9
+ getActivityParams,
10
+ getActivityScript,
11
+ injectFiltersChanged,
12
+ injectRefreshEventIfNeeded,
13
+ } from './UNActivityComponent.utils';
10
14
  import type WebView from 'react-native-webview';
11
- import EventBus from '../../helpers/EventBus';
12
15
  import type { UNActivityOnLoadData } from '../../types/shared/activity.types';
13
16
  import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
14
17
  import { ActivityMessage } from '../../messages/webMessages/activityMessage';
15
- import { BottomSheetRenderingType, type BottomSheetSlotData, type SlotRendering } from '../../types/internal/bottomSheet.types';
18
+ import {
19
+ BottomSheetRenderingType,
20
+ type BottomSheetSlotData,
21
+ type SlotRendering,
22
+ } from '../../types/internal/bottomSheet.types';
16
23
  import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
17
24
  import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
18
25
  import { withReduxStore } from '../../helpers/store/helpers';
26
+ import { setEvent } from '../../slices/SharedEventsSlice';
27
+ import { useDispatch } from 'react-redux';
28
+ import { useListenerToEvent } from '../../hooks/useListenerToEvent';
29
+ import type { UNActivityComponentPaginationType } from '../../types/shared';
19
30
 
20
31
  const DEFAULT_HEIGHT = Dimensions.get('window').height * 0.5;
32
+
21
33
  export interface UNActivityComponentProps {
22
34
  // inputs
23
35
  customerToken: string;
24
36
  accountId?: string;
25
- queryFilter?: string
37
+ queryFilter?: string;
26
38
 
27
39
  // ui
28
40
  theme?: string;
29
41
  language?: string;
30
42
  hideFilterButton?: boolean;
31
-
43
+ paginationType?: UNActivityComponentPaginationType;
44
+ transactionsPerPage?: number;
32
45
  // event
33
46
  onLoad?: (response: UNOnLoadResponse<UNActivityOnLoadData>) => void;
34
47
  }
35
48
 
36
49
  const UNActivityComponent = (props: UNActivityComponentProps) => {
50
+ const dispatch = useDispatch();
37
51
  const webRef = useRef<WebView>(null);
38
52
  const [defaultHeight, setDefaultHeight] = useState<number>();
39
53
 
@@ -45,8 +59,11 @@ const UNActivityComponent = (props: UNActivityComponentProps) => {
45
59
  injectFiltersChanged(webRef.current, query);
46
60
  };
47
61
 
48
- useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
49
- useListenerToBus({ busEventKey: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED, action: dispatchActivityFiltersChanged });
62
+ useListenerToEvent({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
63
+ useListenerToEvent({
64
+ busEventKey: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED,
65
+ action: dispatchActivityFiltersChanged,
66
+ });
50
67
 
51
68
  const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
52
69
  if (!props.onLoad) {
@@ -58,13 +75,13 @@ const UNActivityComponent = (props: UNActivityComponentProps) => {
58
75
  return;
59
76
  }
60
77
 
61
- if (RESPONSE_KEYS.authorization in response && RESPONSE_KEYS.transactions in response) {
78
+ if (RESPONSE_KEYS.authorizations in response && RESPONSE_KEYS.transactions in response) {
62
79
  // ActivityOnLoadResponse;
63
80
  const activityOnLoad: UNOnLoadResponseData<UNActivityOnLoadData> = {
64
81
  data: {
65
- [RESPONSE_KEYS.authorization]: response[RESPONSE_KEYS.authorization].data,
66
- [RESPONSE_KEYS.transactions]: response[RESPONSE_KEYS.transactions].data
67
- }
82
+ [RESPONSE_KEYS.authorizations]: response[RESPONSE_KEYS.authorizations].data,
83
+ [RESPONSE_KEYS.transactions]: response[RESPONSE_KEYS.transactions].data,
84
+ },
68
85
  };
69
86
  props.onLoad(activityOnLoad);
70
87
  return;
@@ -80,15 +97,15 @@ const UNActivityComponent = (props: UNActivityComponentProps) => {
80
97
  const slotData: BottomSheetSlotData = {
81
98
  componentName: WebComponentType.activity,
82
99
  componentResourceId: props.accountId,
83
- requestRenderingEvent: message.details as RequestRenderingEvent
100
+ requestRenderingEvent: message.details as RequestRenderingEvent,
84
101
  };
85
102
 
86
- const event = {
103
+ const data = {
87
104
  type: BottomSheetRenderingType.Slot,
88
- data: slotData
105
+ data: slotData,
89
106
  } as SlotRendering;
90
107
 
91
- EventBus.Instance.event(BottomSheetNativeMessage.START_FLOW, event);
108
+ dispatch(setEvent({ key: BottomSheetNativeMessage.START_FLOW, data }));
92
109
  break;
93
110
  }
94
111
  case UnitMessage.UNIT_ON_LOAD:
@@ -7,12 +7,15 @@ import { WebComponentType } from '../../types/internal/webComponent.types';
7
7
  export const getActivityParams = (props: UNActivityComponentProps) => {
8
8
  const accountIdParam = props.accountId ? `account-id="${props.accountId}"` : '';
9
9
  const queryFilterParam = props.queryFilter ? `query-filter="${props.queryFilter}"` : '';
10
-
10
+ const paginationTypeParam = props.paginationType ? `pagination-type="${props.paginationType}"` : '';
11
+ const transactionsPerPageParam = props.transactionsPerPage ? `transactions-per-page="${props.transactionsPerPage}"` : '';
11
12
  return `
12
13
  customer-token="${props.customerToken}"
13
14
  ${accountIdParam}
14
15
  hide-filter-button="${props.hideFilterButton || false}"
15
16
  ${queryFilterParam}
17
+ ${paginationTypeParam}
18
+ ${transactionsPerPageParam}
16
19
  style="height: 100%"
17
20
  `;
18
21
  };
@@ -4,11 +4,9 @@ import type WebView from 'react-native-webview';
4
4
  import { WebComponent } from '../../webComponent/WebComponent';
5
5
  import { Dimensions, Linking, View } from 'react-native';
6
6
  import BottomSheet from '../../helpers/BottomSheet/BottomSheet';
7
- import EventBus from '../../helpers/EventBus';
8
7
  import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
9
8
  import { RequestOpenLinkEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
10
9
  import { CardMessage, CardActivatedEvent, CardStatusChangedEvent } from '../../messages/webMessages/cardMessage';
11
- import { useListenerToBus } from '../../hooks/listenerToBus';
12
10
  import type { WebViewMessage } from '../../messages/webMessages';
13
11
  import {
14
12
  extractCardIdFromComponentParams,
@@ -28,10 +26,21 @@ import type { AccountChangedEvent } from '../../messages/webMessages/accountMess
28
26
  import { AccountMessage } from '../../messages/webMessages/accountMessage';
29
27
  import { ActivityFiltersChangedEvent, ActivityMessage } from '../../messages/webMessages/activityMessage';
30
28
  import { BOTTOM_SHEET_MAX_PERCENTAGE_SIZE } from './UNBottomSheetComponent.constants';
31
- import { BottomSheetRenderingType, BottomSheetSlotData, NativeComponentData, WebComponentData } from '../../types/internal/bottomSheet.types';
29
+ import {
30
+ BottomSheetRenderingType,
31
+ BottomSheetSlotData,
32
+ NativeComponentData,
33
+ WebComponentData,
34
+ } from '../../types/internal/bottomSheet.types';
32
35
  import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
33
- import { BottomSheetNativeMessage, type StartBottomSheetFlowMessage } from '../../messages/nativeMessages/bottomSheetMessage';
36
+ import {
37
+ BottomSheetNativeMessage,
38
+ type StartBottomSheetFlowMessage,
39
+ } from '../../messages/nativeMessages/bottomSheetMessage';
34
40
  import { withReduxStore } from '../../helpers/store/helpers';
41
+ import { useListenerToEvent } from '../../hooks/useListenerToEvent';
42
+ import { setEvent } from '../../slices/SharedEventsSlice';
43
+ import { useDispatch } from 'react-redux';
35
44
 
36
45
  export enum ScrollState {
37
46
  /*
@@ -57,6 +66,7 @@ export enum ScrollState {
57
66
  }
58
67
 
59
68
  const UNBottomSheetComponent = () => {
69
+ const dispatch = useDispatch();
60
70
  const [isBottomSheetActive, setIsBottomSheetActive] = useState(false);
61
71
  const [height, setHeight] = useState(0);
62
72
 
@@ -143,8 +153,8 @@ const UNBottomSheetComponent = () => {
143
153
  }
144
154
  }, [shouldShowComponent, newHeightMessage, isAddToWallet]);
145
155
 
146
- useListenerToBus({ busEventKey: BottomSheetNativeMessage.START_FLOW, action: startFlow });
147
- useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_CLOSE_FLOW, action: handleCloseFlow });
156
+ useListenerToEvent({ busEventKey: BottomSheetNativeMessage.START_FLOW, action: startFlow });
157
+ useListenerToEvent({ busEventKey: UnitMessage.UNIT_REQUEST_CLOSE_FLOW, action: handleCloseFlow });
148
158
 
149
159
  const defineScrollState = () => {
150
160
  const scrollStateForSlot = () => {
@@ -153,7 +163,7 @@ const UNBottomSheetComponent = () => {
153
163
  case WebComponentType.account: {
154
164
  const accountActionType = getAccountActionType(bottomSheetSlotData.requestRenderingEvent);
155
165
  setScrollState(
156
- accountActionType === UNAccountAction.List ? ScrollState.onTop : ScrollState.unScrollable
166
+ accountActionType === UNAccountAction.List ? ScrollState.onTop : ScrollState.unScrollable,
157
167
  );
158
168
  break;
159
169
  }
@@ -233,7 +243,7 @@ const UNBottomSheetComponent = () => {
233
243
  setBottomSheetSlotData({
234
244
  componentResourceId: bottomSheetSlotData?.componentResourceId,
235
245
  componentName: bottomSheetSlotData?.componentName,
236
- requestRenderingEvent: requestRendering
246
+ requestRenderingEvent: requestRendering,
237
247
  });
238
248
 
239
249
  // Open the bottom sheet
@@ -242,16 +252,28 @@ const UNBottomSheetComponent = () => {
242
252
  break;
243
253
  }
244
254
  case CardMessage.CARD_ACTIVATED:
245
- EventBus.Instance.event(CardMessage.CARD_ACTIVATED, (message.details as CardActivatedEvent).card);
255
+ dispatch(setEvent({
256
+ key: CardMessage.CARD_ACTIVATED,
257
+ data: (message.details as CardActivatedEvent).card,
258
+ }));
246
259
  break;
247
260
  case CardMessage.CARD_STATUS_CHANGED:
248
- EventBus.Instance.event(CardMessage.CARD_STATUS_CHANGED, (message.details as CardStatusChangedEvent).card);
261
+ dispatch(setEvent({
262
+ key: CardMessage.CARD_STATUS_CHANGED,
263
+ data: (message.details as CardStatusChangedEvent).card,
264
+ }));
249
265
  break;
250
266
  case AccountMessage.UNIT_ACCOUNT_CHANGED:
251
- EventBus.Instance.event(AccountMessage.UNIT_ACCOUNT_CHANGED, (message.details as AccountChangedEvent).account);
267
+ dispatch(setEvent({
268
+ key: AccountMessage.UNIT_ACCOUNT_CHANGED,
269
+ data: (message.details as AccountChangedEvent).account,
270
+ }));
252
271
  break;
253
272
  case ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED:
254
- EventBus.Instance.event(ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED, (message.details as ActivityFiltersChangedEvent));
273
+ dispatch(setEvent({
274
+ key: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED,
275
+ data: (message.details as ActivityFiltersChangedEvent),
276
+ }));
255
277
  break;
256
278
  case UnitMessage.UNIT_REQUEST_CLOSE_FLOW:
257
279
  handleCloseFlow();
@@ -287,7 +309,10 @@ const UNBottomSheetComponent = () => {
287
309
  switch (renderingType) {
288
310
  case BottomSheetRenderingType.Slot:
289
311
  if (bottomSheetSlotData?.requestRenderingEvent.data.nativeComponent?.includes('action=AddToWallet') && bottomSheetSlotData?.componentResourceId) {
290
- return <UNAddToWalletBottomSheetItem renderingType={renderingType} renderingRequest={bottomSheetSlotData.requestRenderingEvent} cardId={bottomSheetSlotData?.componentResourceId} fullScreenHeight={fullScreenHeight} />;
312
+ return <UNAddToWalletBottomSheetItem renderingType={renderingType}
313
+ renderingRequest={bottomSheetSlotData.requestRenderingEvent}
314
+ cardId={bottomSheetSlotData?.componentResourceId}
315
+ fullScreenHeight={fullScreenHeight} />;
291
316
  }
292
317
 
293
318
  return (
@@ -305,7 +330,8 @@ const UNBottomSheetComponent = () => {
305
330
  if (webComponentData?.params?.includes('action=AddToWallet')) {
306
331
  const cardId = extractCardIdFromComponentParams(webComponentData);
307
332
  if (!cardId) return null;
308
- return <UNAddToWalletBottomSheetItem renderingType={renderingType} webComponentData={webComponentData} cardId={cardId} fullScreenHeight={fullScreenHeight} />;
333
+ return <UNAddToWalletBottomSheetItem renderingType={renderingType} webComponentData={webComponentData}
334
+ cardId={cardId} fullScreenHeight={fullScreenHeight} />;
309
335
  }
310
336
  return null;
311
337
  case BottomSheetRenderingType.NativeComponent:
@@ -327,8 +353,8 @@ const UNBottomSheetComponent = () => {
327
353
  shouldEnableBottomSheetScroll={scrollState !== ScrollState.onlyWebView}
328
354
  >
329
355
  {isAppActive && renderBottomSheetItem()}
330
- </BottomSheet >
331
- </View >
356
+ </BottomSheet>
357
+ </View>
332
358
  );
333
359
  };
334
360
 
@@ -12,7 +12,8 @@ import { PresentationMode, WebComponentType } from '../../../../types/internal/w
12
12
  import { useCardWallet } from '../../../../helpers/pushProvisioningService/hooks/useCardWallet';
13
13
  import { launchStartCardProvisioning } from '../../../../helpers/pushProvisioningService/startProvisioning';
14
14
  import type { WebViewMessage } from '../../../../messages/webMessages';
15
- import EventBus from '../../../../helpers/EventBus';
15
+ import { useDispatch } from 'react-redux';
16
+ import { setEvent } from '../../../../slices/SharedEventsSlice';
16
17
 
17
18
  export interface UNAddToWalletBottomSheetItemProps {
18
19
  renderingType: BottomSheetRenderingType
@@ -23,6 +24,7 @@ export interface UNAddToWalletBottomSheetItemProps {
23
24
  }
24
25
 
25
26
  export const UNAddToWalletBottomSheetItem = (props: UNAddToWalletBottomSheetItemProps) => {
27
+ const dispatch = useDispatch();
26
28
  const styles = getStylesObject();
27
29
 
28
30
  const webRef = useRef<WebView>(null);
@@ -55,7 +57,10 @@ export const UNAddToWalletBottomSheetItem = (props: UNAddToWalletBottomSheetItem
55
57
  injectHtmlFullScreenHeight(webRef.current, props.fullScreenHeight);
56
58
  break;
57
59
  case UnitMessage.UNIT_REQUEST_CLOSE_FLOW:
58
- EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW, {});
60
+ dispatch(setEvent({
61
+ key: UnitMessage.UNIT_REQUEST_CLOSE_FLOW,
62
+ data: {},
63
+ }));
59
64
  break;
60
65
  default:
61
66
  break;
@@ -3,9 +3,7 @@ import { View } from 'react-native';
3
3
  import type WebView from 'react-native-webview';
4
4
  import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
5
5
  import { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
6
- import EventBus from '../../helpers/EventBus';
7
6
  import { WebComponent } from '../../webComponent/WebComponent';
8
- import { useListenerToBus } from '../../hooks/listenerToBus';
9
7
  import type { WebViewMessage } from '../../messages/webMessages';
10
8
  import {
11
9
  getCardParams,
@@ -29,9 +27,10 @@ import { UnitSDK } from '../../unitSdkManager/UnitSdkManager';
29
27
  import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
30
28
  import { useLaunchInitialize } from '../../helpers/pushProvisioningService/hooks/useLaunchInitialize';
31
29
  import { selectWallet } from '../../slices/pushProvisioningSlice';
32
- import { useSelector } from 'react-redux';
30
+ import { useDispatch, useSelector } from 'react-redux';
33
31
  import { withReduxStoreAndRefForwarding } from '../../helpers/store/helpers';
34
-
32
+ import { useListenerToEvent } from '../../hooks/useListenerToEvent';
33
+ import { setEvent } from '../../slices/SharedEventsSlice';
35
34
 
36
35
  export interface UNCardComponentProps {
37
36
  // inputs
@@ -61,6 +60,8 @@ export interface CardRef {
61
60
  }
62
61
 
63
62
  const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function UNCardComponent(props, cardRef) {
63
+ const dispatch = useDispatch();
64
+
64
65
  const [height, setHeight] = useState(0);
65
66
 
66
67
  const webRef = useRef<WebView>(null);
@@ -118,9 +119,9 @@ const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function
118
119
  return;
119
120
  };
120
121
 
121
- useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
122
- useListenerToBus({ busEventKey: CardMessage.CARD_STATUS_CHANGED, action: cardStatusChanged });
123
- useListenerToBus({ busEventKey: CardMessage.CARD_ACTIVATED, action: cardActivated });
122
+ useListenerToEvent({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
123
+ useListenerToEvent({ busEventKey: CardMessage.CARD_STATUS_CHANGED, action: cardStatusChanged });
124
+ useListenerToEvent({ busEventKey: CardMessage.CARD_ACTIVATED, action: cardActivated });
124
125
 
125
126
  const handleMessage = (message: WebViewMessage) => {
126
127
  if (!message || !message.details) return;
@@ -133,12 +134,12 @@ const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function
133
134
  requestRenderingEvent: message.details as RequestRenderingEvent,
134
135
  };
135
136
 
136
- const event = {
137
+ const data = {
137
138
  type: BottomSheetRenderingType.Slot,
138
139
  data: slotData,
139
140
  } as SlotRendering;
140
141
 
141
- EventBus.Instance.event(BottomSheetNativeMessage.START_FLOW, event);
142
+ dispatch(setEvent({ key: BottomSheetNativeMessage.START_FLOW, data }));
142
143
  break;
143
144
  }
144
145
  case PageMessage.PAGE_HEIGHT:
@@ -178,7 +179,7 @@ const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(function
178
179
  onMessage={message => handleMessage(message)}
179
180
  isScrollable={false}
180
181
  />
181
- </View >
182
+ </View>
182
183
  );
183
184
 
184
185
  });
@@ -0,0 +1,119 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import { Dimensions, View } from 'react-native';
3
+ import type { WebViewMessage } from '../../messages/webMessages';
4
+ import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
5
+ import { WebComponent } from '../../webComponent/WebComponent';
6
+
7
+ import type WebView from 'react-native-webview';
8
+
9
+ import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
10
+ import { withReduxStore } from '../../helpers/store/helpers';
11
+ import { getMultipleCardsParams, getMultipleCardsScript } from './UNMultipleCardsComponent.utils';
12
+ import { UnitMessage } from '../../messages/webMessages/unitMessages';
13
+ import type { UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
14
+ import { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';
15
+ import type {
16
+ UNCardData,
17
+ UNError,
18
+ UNMultipleCardsComponentPaginationType,
19
+ UNMultipleCardsOnLoadData,
20
+ UNOnLoadResponse,
21
+ UNOnLoadResponseData,
22
+ } from '../../types/shared';
23
+ import { MultipleCardsCardClickedEvent, MultipleCardsMessage } from '../../messages/webMessages/multipleCardsMessage';
24
+
25
+ const DEFAULT_HEIGHT = Dimensions.get('window').height * 0.5;
26
+
27
+ export interface UNMultipleCardsComponentProps {
28
+ // inputs
29
+ customerToken: string;
30
+
31
+ // ui
32
+ paginationType?: UNMultipleCardsComponentPaginationType;
33
+ cardsPerPage?: number;
34
+ disableCardClick?: boolean;
35
+ theme?: string;
36
+ language?: string;
37
+ queryFilter?: string;
38
+ hideTitle?: boolean;
39
+
40
+ // events
41
+ onLoad?: (response: UNOnLoadResponse<UNMultipleCardsOnLoadData>) => void;
42
+ onCardClicked?: (card: UNCardData) => void;
43
+ }
44
+
45
+ const UNMultipleCardsComponent = (props: UNMultipleCardsComponentProps) => {
46
+ const webRef = useRef<WebView>(null);
47
+ const [defaultHeight, setDefaultHeight] = useState<number>();
48
+
49
+ const cardClicked = (card: UNCardData) => {
50
+ if (props.onCardClicked) {
51
+ props.onCardClicked(card);
52
+ }
53
+ };
54
+
55
+ const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
56
+ if (!props.onLoad) {
57
+ return;
58
+ }
59
+
60
+ if (RESPONSE_KEYS.errors in response) {
61
+ props.onLoad(response as UNError);
62
+ return;
63
+ }
64
+
65
+ if (RESPONSE_KEYS.cards in response) {
66
+ // MultipleCardsOnLoadResponse;
67
+ props.onLoad(response[RESPONSE_KEYS.cards] as UNOnLoadResponseData<UNMultipleCardsOnLoadData>);
68
+ return;
69
+ }
70
+
71
+ console.error('On Load Error: unexpected response type');
72
+ return;
73
+ };
74
+
75
+ const handleWebViewMessage = (message: WebViewMessage) => {
76
+ if (!message || !message.details) return;
77
+ switch (message.type) {
78
+ case UnitMessage.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
+ currentHeight === 0 && setDefaultHeight(DEFAULT_HEIGHT);
84
+ break;
85
+ }
86
+ case MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED: {
87
+ cardClicked(message.details as MultipleCardsCardClickedEvent);
88
+ }
89
+ }
90
+ };
91
+
92
+ const renderMultipleCardsWebView = () => {
93
+ return (
94
+ <WebComponent
95
+ ref={webRef}
96
+ type={WebComponentType.multipleCards}
97
+ presentationMode={PresentationMode.Inherit}
98
+ params={getMultipleCardsParams(props)}
99
+ script={getMultipleCardsScript()}
100
+ onMessage={(message: WebViewMessage) => handleWebViewMessage(message)}
101
+ nestedScrollEnabled={true}
102
+ theme={props.theme}
103
+ language={props.language}
104
+ />
105
+ );
106
+ };
107
+
108
+ if (!defaultHeight) {
109
+ return renderMultipleCardsWebView();
110
+ }
111
+
112
+ return (
113
+ <View style={{ height: defaultHeight }}>
114
+ {renderMultipleCardsWebView()}
115
+ </View>
116
+ );
117
+ };
118
+
119
+ export default withReduxStore<UNMultipleCardsComponentProps>(UNMultipleCardsComponent);
@@ -0,0 +1,36 @@
1
+ import type { UNMultipleCardsComponentProps } from './UNMultipleCardsComponent';
2
+ import { MultipleCardsMessage } from '../../messages/webMessages/multipleCardsMessage';
3
+
4
+ export const getMultipleCardsParams = (props: UNMultipleCardsComponentProps) => {
5
+ const paginationType = props.paginationType ? `pagination-type="${props.paginationType}"` : '';
6
+ const cardsPerPage = props.cardsPerPage ? `cards-per-page="${props.cardsPerPage}"` : '';
7
+ const queryFilter = props.queryFilter ? `query-filter="${props.queryFilter}"` : '';
8
+ return `
9
+ customer-token="${props.customerToken}"
10
+ ${paginationType}
11
+ ${cardsPerPage}
12
+ disable-card-click="${props.disableCardClick || false}"
13
+ ${queryFilter}
14
+ hide-title="${props.hideTitle || false}"
15
+ style="height: 100%"
16
+ `;
17
+ };
18
+
19
+ const MULTIPLE_CARDS_LISTENERS = {
20
+ cardClicked: `
21
+ window.addEventListener("${MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED}", (e) => {
22
+ const response = e.detail
23
+ response.then((data) => {
24
+ postMessageToSDK({ type: "${MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED}", details: data.data })
25
+ }).catch((e) => {
26
+ console.log(e)
27
+ })
28
+ });
29
+ `,
30
+ };
31
+
32
+ export const getMultipleCardsScript = () => {
33
+ return `
34
+ ${MULTIPLE_CARDS_LISTENERS.cardClicked}
35
+ `;
36
+ };
@@ -0,0 +1,3 @@
1
+ export {
2
+ default as UNMultipleCardsComponent, UNMultipleCardsComponentProps,
3
+ } from './UNMultipleCardsComponent';
@@ -1,4 +1,5 @@
1
1
  export * from './UNCardComponent';
2
+ export * from './UNMultipleCardsComponent';
2
3
  export * from './UNBottomSheetComponent';
3
4
  export * from './UNBookPaymentComponent';
4
5
  export * from './UNActivityComponent';
@@ -1,10 +1,16 @@
1
- import EventBus from '../../helpers/EventBus';
2
1
  import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
3
- import { BottomSheetRenderingType, type WebComponentData, type WebComponentRendering } from '../../types/internal/bottomSheet.types';
2
+ import {
3
+ BottomSheetRenderingType,
4
+ type WebComponentData,
5
+ type WebComponentRendering,
6
+ } from '../../types/internal/bottomSheet.types';
4
7
  import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
8
+ import { useDispatch } from 'react-redux';
9
+ import { setEvent } from '../../slices/SharedEventsSlice';
5
10
 
6
11
  export class UNCardFlows {
7
12
  public static startPushProvisioning = async (cardId: string, customerToken: string) => {
13
+ const dispatch = useDispatch(); //todo: can we use hook here?
8
14
  try {
9
15
  const addToWalletComponentData: WebComponentData = {
10
16
  type: WebComponentType.cardAction,
@@ -12,12 +18,12 @@ export class UNCardFlows {
12
18
  params: `card-id=${cardId} customer-token=${customerToken} action=AddToWallet`,
13
19
  };
14
20
 
15
- const event: WebComponentRendering = {
21
+ const data: WebComponentRendering = {
16
22
  type: BottomSheetRenderingType.WebComponent,
17
23
  data: addToWalletComponentData,
18
24
  };
19
25
 
20
- EventBus.Instance.event(BottomSheetNativeMessage.START_FLOW, event);
26
+ dispatch(setEvent({ key: BottomSheetNativeMessage.START_FLOW, data }));
21
27
  } catch (error) {
22
28
  console.error(error);
23
29
  }
@@ -0,0 +1,31 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { UNNativePromiseReject, UNVPError, UNVPErrorType } from './types';
3
+
4
+ export const isUNVPError = (error: any): error is UNVPError => {
5
+ return 'code' in error &&
6
+ 'description' in error &&
7
+ 'type' in error &&
8
+ isUNVPErrorType(error.type) &&
9
+ 'correlationId' in error;
10
+ };
11
+
12
+ const isUNVPErrorType = (type: any): type is UNVPErrorType => {
13
+ return Object.values(UNVPErrorType).includes(type);
14
+ };
15
+
16
+ export const isUNNativePromiseReject = (error: any): error is UNNativePromiseReject => {
17
+ return 'code' in error && 'message' in error;
18
+ };
19
+
20
+ export const promiseRejectToUNVPErrorType = (error: any): UNVPErrorType | null => {
21
+ // validate the shape of a promise reject we get from iOS/Android native
22
+ if (!isUNNativePromiseReject(error)) {
23
+ return null;
24
+ }
25
+ const parsedError = JSON.parse(error.message);
26
+ // validate the shape of an error we get from VDE SDK
27
+ if (!isUNVPError(parsedError)) {
28
+ return null;
29
+ }
30
+ return parsedError.type;
31
+ };