react-native-unit-components 1.5.0 → 1.7.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 (324) hide show
  1. package/ios/UNAppInfo/UNAppInfo.swift +5 -1
  2. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +50 -8
  3. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  4. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.utils.js +18 -11
  5. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.utils.js.map +1 -1
  6. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +9 -11
  7. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  8. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.utils.js +2 -23
  9. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.utils.js.map +1 -1
  10. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +12 -6
  11. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  12. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js +5 -4
  13. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
  14. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +12 -6
  15. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  16. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +4 -3
  17. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  18. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +6 -6
  19. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  20. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +1 -0
  21. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -1
  22. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +159 -74
  23. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  24. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +28 -8
  25. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  26. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js +49 -37
  27. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +1 -1
  28. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +20 -50
  29. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  30. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +5 -53
  31. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  32. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js +6 -6
  33. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -1
  34. package/lib/commonjs/components/utils/nativeModulesInfo.js +20 -0
  35. package/lib/commonjs/components/utils/nativeModulesInfo.js.map +1 -0
  36. package/lib/commonjs/flows/UNFlows.js +19 -0
  37. package/lib/commonjs/flows/UNFlows.js.map +1 -0
  38. package/lib/commonjs/flows/card/UNCardFlows.js +33 -0
  39. package/lib/commonjs/flows/card/UNCardFlows.js.map +1 -0
  40. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js +70 -0
  41. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -0
  42. package/lib/commonjs/helpers/pushProvisioningService/startProvisioning.js +22 -0
  43. package/lib/commonjs/helpers/pushProvisioningService/startProvisioning.js.map +1 -0
  44. package/lib/commonjs/index.js +4 -4
  45. package/lib/commonjs/index.js.map +1 -1
  46. package/lib/commonjs/messages/nativeMessages/bottomSheetMessage.js +17 -0
  47. package/lib/commonjs/messages/nativeMessages/bottomSheetMessage.js.map +1 -0
  48. package/lib/commonjs/messages/nativeMessages/cardMessage.js +2 -8
  49. package/lib/commonjs/messages/nativeMessages/cardMessage.js.map +1 -1
  50. package/lib/commonjs/messages/nativeMessages/index.js.map +1 -1
  51. package/lib/commonjs/messages/webMessages/accountMessage.js.map +1 -1
  52. package/lib/commonjs/messages/webMessages/achCreditMessage.js.map +1 -1
  53. package/lib/commonjs/messages/webMessages/bookPaymentMessage.js.map +1 -1
  54. package/lib/commonjs/messages/webMessages/cardMessage.js.map +1 -1
  55. package/lib/commonjs/messages/webMessages/checkMessage.js.map +1 -1
  56. package/lib/commonjs/messages/webMessages/onLoadMessage.js.map +1 -1
  57. package/lib/commonjs/messages/webMessages/unitMessages.js +1 -0
  58. package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -1
  59. package/lib/commonjs/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.js +1 -1
  60. package/lib/commonjs/networking/common/UNNetworkConstants.js.map +1 -0
  61. package/lib/commonjs/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.js +3 -1
  62. package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js.map +1 -0
  63. package/lib/commonjs/scripts/html/bodyHtml.js +4 -10
  64. package/lib/commonjs/scripts/html/bodyHtml.js.map +1 -1
  65. package/lib/commonjs/scripts/html/bodyScript.js +13 -2
  66. package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
  67. package/lib/commonjs/types/internal/bottomSheet.types.js +14 -0
  68. package/lib/commonjs/types/internal/bottomSheet.types.js.map +1 -0
  69. package/lib/commonjs/types/internal/webComponent.types.js +27 -0
  70. package/lib/commonjs/types/internal/webComponent.types.js.map +1 -0
  71. package/lib/commonjs/types/shared/achCredit.types.js.map +1 -0
  72. package/lib/commonjs/types/shared/activity.types.js.map +1 -0
  73. package/lib/commonjs/unitSdkManager/UnitSdkManager.js +20 -2
  74. package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
  75. package/lib/commonjs/unitSdkManager/unitUiManager/unitUiManager.js +21 -0
  76. package/lib/commonjs/unitSdkManager/unitUiManager/unitUiManager.js.map +1 -0
  77. package/lib/commonjs/webComponent/WebComponent.js +6 -16
  78. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  79. package/lib/commonjs/webComponent/html.js +3 -1
  80. package/lib/commonjs/webComponent/html.js.map +1 -1
  81. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +49 -7
  82. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  83. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.utils.js +16 -10
  84. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.utils.js.map +1 -1
  85. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +5 -7
  86. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  87. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.utils.js +1 -21
  88. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.utils.js.map +1 -1
  89. package/lib/module/components/UNAccountComponent/UNAccountComponent.js +10 -4
  90. package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  91. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js +3 -2
  92. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
  93. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +10 -4
  94. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  95. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +3 -2
  96. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  97. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +2 -2
  98. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  99. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +1 -0
  100. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -1
  101. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +159 -74
  102. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  103. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +23 -6
  104. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  105. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js +51 -39
  106. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +1 -1
  107. package/lib/module/components/UNCardComponent/UNCardComponent.js +20 -51
  108. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  109. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +2 -48
  110. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  111. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js +2 -2
  112. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -1
  113. package/lib/module/components/utils/nativeModulesInfo.js +13 -0
  114. package/lib/module/components/utils/nativeModulesInfo.js.map +1 -0
  115. package/lib/module/flows/UNFlows.js +12 -0
  116. package/lib/module/flows/UNFlows.js.map +1 -0
  117. package/lib/module/flows/card/UNCardFlows.js +25 -0
  118. package/lib/module/flows/card/UNCardFlows.js.map +1 -0
  119. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js +63 -0
  120. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -0
  121. package/lib/module/helpers/pushProvisioningService/startProvisioning.js +15 -0
  122. package/lib/module/helpers/pushProvisioningService/startProvisioning.js.map +1 -0
  123. package/lib/module/index.js +1 -1
  124. package/lib/module/index.js.map +1 -1
  125. package/lib/module/messages/nativeMessages/bottomSheetMessage.js +9 -0
  126. package/lib/module/messages/nativeMessages/bottomSheetMessage.js.map +1 -0
  127. package/lib/module/messages/nativeMessages/cardMessage.js +1 -6
  128. package/lib/module/messages/nativeMessages/cardMessage.js.map +1 -1
  129. package/lib/module/messages/nativeMessages/index.js.map +1 -1
  130. package/lib/module/messages/webMessages/accountMessage.js.map +1 -1
  131. package/lib/module/messages/webMessages/achCreditMessage.js.map +1 -1
  132. package/lib/module/messages/webMessages/bookPaymentMessage.js.map +1 -1
  133. package/lib/module/messages/webMessages/cardMessage.js.map +1 -1
  134. package/lib/module/messages/webMessages/checkMessage.js.map +1 -1
  135. package/lib/module/messages/webMessages/onLoadMessage.js.map +1 -1
  136. package/lib/module/messages/webMessages/unitMessages.js +1 -0
  137. package/lib/module/messages/webMessages/unitMessages.js.map +1 -1
  138. package/lib/module/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.js +1 -1
  139. package/lib/module/networking/common/UNNetworkConstants.js.map +1 -0
  140. package/lib/module/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.js +4 -1
  141. package/lib/module/networking/requests/UNWalletPayloadRequest.js.map +1 -0
  142. package/lib/module/scripts/html/bodyHtml.js +1 -6
  143. package/lib/module/scripts/html/bodyHtml.js.map +1 -1
  144. package/lib/module/scripts/html/bodyScript.js +13 -2
  145. package/lib/module/scripts/html/bodyScript.js.map +1 -1
  146. package/lib/module/types/internal/bottomSheet.types.js +7 -0
  147. package/lib/module/types/internal/bottomSheet.types.js.map +1 -0
  148. package/lib/module/types/internal/webComponent.types.js +19 -0
  149. package/lib/module/types/internal/webComponent.types.js.map +1 -0
  150. package/lib/module/types/shared/achCredit.types.js.map +1 -0
  151. package/lib/module/types/shared/activity.types.js.map +1 -0
  152. package/lib/module/unitSdkManager/UnitSdkManager.js +20 -2
  153. package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
  154. package/lib/module/unitSdkManager/unitUiManager/unitUiManager.js +14 -0
  155. package/lib/module/unitSdkManager/unitUiManager/unitUiManager.js.map +1 -0
  156. package/lib/module/webComponent/WebComponent.js +5 -14
  157. package/lib/module/webComponent/WebComponent.js.map +1 -1
  158. package/lib/module/webComponent/html.js +3 -1
  159. package/lib/module/webComponent/html.js.map +1 -1
  160. package/lib/typescript/components/UNACHCreditComponent/UNACHCreditComponent.d.ts +2 -1
  161. package/lib/typescript/components/UNACHCreditComponent/UNACHCreditComponent.utils.d.ts +4 -1
  162. package/lib/typescript/components/UNACHDebitComponent/UNACHDebitComponent.d.ts +1 -1
  163. package/lib/typescript/components/UNACHDebitComponent/UNACHDebitComponent.utils.d.ts +0 -1
  164. package/lib/typescript/components/UNAccountComponent/UNAccountComponent.d.ts +3 -3
  165. package/lib/typescript/components/UNAccountComponent/UNAccountComponent.utils.d.ts +1 -1
  166. package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +3 -3
  167. package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +2 -1
  168. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +0 -7
  169. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +5 -1
  170. package/lib/typescript/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.d.ts +6 -2
  171. package/lib/typescript/components/UNCardComponent/UNCardComponent.d.ts +2 -1
  172. package/lib/typescript/components/UNCardComponent/UNCardComponent.utils.d.ts +1 -9
  173. package/lib/typescript/components/UNCheckDepositComponent/UNCheckDepositComponent.d.ts +2 -2
  174. package/lib/typescript/components/utils/nativeModulesInfo.d.ts +1 -0
  175. package/lib/typescript/flows/UNFlows.d.ts +4 -0
  176. package/lib/typescript/flows/card/UNCardFlows.d.ts +3 -0
  177. package/lib/typescript/helpers/pushProvisioningService/hooks/useCardWallet.d.ts +7 -0
  178. package/lib/typescript/helpers/pushProvisioningService/startProvisioning.d.ts +2 -0
  179. package/lib/typescript/index.d.ts +1 -1
  180. package/lib/typescript/messages/nativeMessages/bottomSheetMessage.d.ts +9 -0
  181. package/lib/typescript/messages/nativeMessages/cardMessage.d.ts +0 -16
  182. package/lib/typescript/messages/nativeMessages/index.d.ts +3 -3
  183. package/lib/typescript/messages/webMessages/accountMessage.d.ts +1 -1
  184. package/lib/typescript/messages/webMessages/achCreditMessage.d.ts +1 -1
  185. package/lib/typescript/messages/webMessages/bookPaymentMessage.d.ts +1 -1
  186. package/lib/typescript/messages/webMessages/cardMessage.d.ts +1 -1
  187. package/lib/typescript/messages/webMessages/checkMessage.d.ts +1 -1
  188. package/lib/typescript/messages/webMessages/onLoadMessage.d.ts +3 -3
  189. package/lib/typescript/messages/webMessages/unitMessages.d.ts +2 -1
  190. package/lib/typescript/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.d.ts +1 -1
  191. package/lib/typescript/scripts/html/bodyHtml.d.ts +1 -5
  192. package/lib/typescript/scripts/html/bodyScript.d.ts +1 -0
  193. package/lib/typescript/types/internal/bottomSheet.types.d.ts +35 -0
  194. package/lib/typescript/types/internal/webComponent.types.d.ts +16 -0
  195. package/lib/typescript/{sharedTypes → types/shared}/achCredit.types.d.ts +1 -1
  196. package/lib/typescript/{sharedTypes → types/shared}/activity.types.d.ts +1 -1
  197. package/lib/typescript/unitSdkManager/UnitSdkManager.d.ts +9 -0
  198. package/lib/typescript/unitSdkManager/unitUiManager/unitUiManager.d.ts +6 -0
  199. package/lib/typescript/webComponent/WebComponent.d.ts +2 -11
  200. package/lib/typescript/webComponent/html.d.ts +1 -0
  201. package/package.json +1 -1
  202. package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +47 -8
  203. package/src/components/UNACHCreditComponent/UNACHCreditComponent.utils.ts +14 -11
  204. package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +7 -11
  205. package/src/components/UNACHDebitComponent/UNACHDebitComponent.utils.ts +1 -20
  206. package/src/components/UNAccountComponent/UNAccountComponent.tsx +15 -8
  207. package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +4 -3
  208. package/src/components/UNActivityComponent/UNActivityComponent.tsx +15 -8
  209. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +4 -2
  210. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +9 -3
  211. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.ts +1 -0
  212. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +151 -76
  213. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +24 -6
  214. package/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.tsx +72 -41
  215. package/src/components/UNCardComponent/UNCardComponent.tsx +25 -54
  216. package/src/components/UNCardComponent/UNCardComponent.utils.ts +3 -49
  217. package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.tsx +4 -4
  218. package/src/components/utils/nativeModulesInfo.ts +11 -0
  219. package/src/flows/UNFlows.ts +13 -0
  220. package/src/flows/card/UNCardFlows.ts +25 -0
  221. package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +67 -0
  222. package/src/helpers/pushProvisioningService/startProvisioning.ts +20 -0
  223. package/src/index.tsx +1 -1
  224. package/src/messages/nativeMessages/bottomSheetMessage.ts +15 -0
  225. package/src/messages/nativeMessages/cardMessage.ts +1 -24
  226. package/src/messages/nativeMessages/index.ts +3 -3
  227. package/src/messages/webMessages/accountMessage.ts +1 -1
  228. package/src/messages/webMessages/achCreditMessage.ts +1 -1
  229. package/src/messages/webMessages/bookPaymentMessage.ts +1 -1
  230. package/src/messages/webMessages/cardMessage.ts +1 -1
  231. package/src/messages/webMessages/checkMessage.ts +1 -1
  232. package/src/messages/webMessages/onLoadMessage.ts +3 -3
  233. package/src/messages/webMessages/unitMessages.ts +3 -2
  234. package/src/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.ts +1 -1
  235. package/src/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.ts +3 -1
  236. package/src/scripts/html/bodyHtml.ts +2 -14
  237. package/src/scripts/html/bodyScript.ts +13 -3
  238. package/src/types/internal/bottomSheet.types.ts +43 -0
  239. package/src/types/internal/webComponent.types.ts +26 -0
  240. package/src/{sharedTypes → types/shared}/achCredit.types.ts +1 -1
  241. package/src/{sharedTypes → types/shared}/activity.types.ts +1 -1
  242. package/src/unitSdkManager/UnitSdkManager.ts +28 -2
  243. package/src/unitSdkManager/unitUiManager/unitUiManager.ts +13 -0
  244. package/src/webComponent/WebComponent.tsx +7 -15
  245. package/src/webComponent/html.ts +3 -1
  246. package/lib/commonjs/components/UNCardComponent/networking/common/UNNetworkConstants.js.map +0 -1
  247. package/lib/commonjs/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js.map +0 -1
  248. package/lib/commonjs/sharedTypes/achCredit.types.js.map +0 -1
  249. package/lib/commonjs/sharedTypes/activity.types.js.map +0 -1
  250. package/lib/module/components/UNCardComponent/networking/common/UNNetworkConstants.js.map +0 -1
  251. package/lib/module/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js.map +0 -1
  252. package/lib/module/sharedTypes/achCredit.types.js.map +0 -1
  253. package/lib/module/sharedTypes/activity.types.js.map +0 -1
  254. /package/lib/commonjs/{sharedTypes → types/shared}/account.types.js +0 -0
  255. /package/lib/commonjs/{sharedTypes → types/shared}/account.types.js.map +0 -0
  256. /package/lib/commonjs/{sharedTypes → types/shared}/achCredit.types.js +0 -0
  257. /package/lib/commonjs/{sharedTypes → types/shared}/activity.types.js +0 -0
  258. /package/lib/commonjs/{sharedTypes → types/shared}/authorization.types.js +0 -0
  259. /package/lib/commonjs/{sharedTypes → types/shared}/authorization.types.js.map +0 -0
  260. /package/lib/commonjs/{sharedTypes → types/shared}/bookPayment.types.js +0 -0
  261. /package/lib/commonjs/{sharedTypes → types/shared}/bookPayment.types.js.map +0 -0
  262. /package/lib/commonjs/{sharedTypes → types/shared}/card.types.js +0 -0
  263. /package/lib/commonjs/{sharedTypes → types/shared}/card.types.js.map +0 -0
  264. /package/lib/commonjs/{sharedTypes → types/shared}/checkDeposit.types.js +0 -0
  265. /package/lib/commonjs/{sharedTypes → types/shared}/checkDeposit.types.js.map +0 -0
  266. /package/lib/commonjs/{sharedTypes → types/shared}/index.js +0 -0
  267. /package/lib/commonjs/{sharedTypes → types/shared}/index.js.map +0 -0
  268. /package/lib/commonjs/{sharedTypes → types/shared}/onLoadResponse.types.js +0 -0
  269. /package/lib/commonjs/{sharedTypes → types/shared}/onLoadResponse.types.js.map +0 -0
  270. /package/lib/commonjs/{sharedTypes → types/shared}/payments.types.js +0 -0
  271. /package/lib/commonjs/{sharedTypes → types/shared}/payments.types.js.map +0 -0
  272. /package/lib/commonjs/{sharedTypes → types/shared}/transactions.types.js +0 -0
  273. /package/lib/commonjs/{sharedTypes → types/shared}/transactions.types.js.map +0 -0
  274. /package/lib/commonjs/{sharedTypes → types/shared}/types.js +0 -0
  275. /package/lib/commonjs/{sharedTypes → types/shared}/types.js.map +0 -0
  276. /package/lib/commonjs/{sharedTypes → types/shared}/wallet.types.js +0 -0
  277. /package/lib/commonjs/{sharedTypes → types/shared}/wallet.types.js.map +0 -0
  278. /package/lib/module/{sharedTypes → types/shared}/account.types.js +0 -0
  279. /package/lib/module/{sharedTypes → types/shared}/account.types.js.map +0 -0
  280. /package/lib/module/{sharedTypes → types/shared}/achCredit.types.js +0 -0
  281. /package/lib/module/{sharedTypes → types/shared}/activity.types.js +0 -0
  282. /package/lib/module/{sharedTypes → types/shared}/authorization.types.js +0 -0
  283. /package/lib/module/{sharedTypes → types/shared}/authorization.types.js.map +0 -0
  284. /package/lib/module/{sharedTypes → types/shared}/bookPayment.types.js +0 -0
  285. /package/lib/module/{sharedTypes → types/shared}/bookPayment.types.js.map +0 -0
  286. /package/lib/module/{sharedTypes → types/shared}/card.types.js +0 -0
  287. /package/lib/module/{sharedTypes → types/shared}/card.types.js.map +0 -0
  288. /package/lib/module/{sharedTypes → types/shared}/checkDeposit.types.js +0 -0
  289. /package/lib/module/{sharedTypes → types/shared}/checkDeposit.types.js.map +0 -0
  290. /package/lib/module/{sharedTypes → types/shared}/index.js +0 -0
  291. /package/lib/module/{sharedTypes → types/shared}/index.js.map +0 -0
  292. /package/lib/module/{sharedTypes → types/shared}/onLoadResponse.types.js +0 -0
  293. /package/lib/module/{sharedTypes → types/shared}/onLoadResponse.types.js.map +0 -0
  294. /package/lib/module/{sharedTypes → types/shared}/payments.types.js +0 -0
  295. /package/lib/module/{sharedTypes → types/shared}/payments.types.js.map +0 -0
  296. /package/lib/module/{sharedTypes → types/shared}/transactions.types.js +0 -0
  297. /package/lib/module/{sharedTypes → types/shared}/transactions.types.js.map +0 -0
  298. /package/lib/module/{sharedTypes → types/shared}/types.js +0 -0
  299. /package/lib/module/{sharedTypes → types/shared}/types.js.map +0 -0
  300. /package/lib/module/{sharedTypes → types/shared}/wallet.types.js +0 -0
  301. /package/lib/module/{sharedTypes → types/shared}/wallet.types.js.map +0 -0
  302. /package/lib/typescript/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.d.ts +0 -0
  303. /package/lib/typescript/{sharedTypes → types/shared}/account.types.d.ts +0 -0
  304. /package/lib/typescript/{sharedTypes → types/shared}/authorization.types.d.ts +0 -0
  305. /package/lib/typescript/{sharedTypes → types/shared}/bookPayment.types.d.ts +0 -0
  306. /package/lib/typescript/{sharedTypes → types/shared}/card.types.d.ts +0 -0
  307. /package/lib/typescript/{sharedTypes → types/shared}/checkDeposit.types.d.ts +0 -0
  308. /package/lib/typescript/{sharedTypes → types/shared}/index.d.ts +0 -0
  309. /package/lib/typescript/{sharedTypes → types/shared}/onLoadResponse.types.d.ts +0 -0
  310. /package/lib/typescript/{sharedTypes → types/shared}/payments.types.d.ts +0 -0
  311. /package/lib/typescript/{sharedTypes → types/shared}/transactions.types.d.ts +0 -0
  312. /package/lib/typescript/{sharedTypes → types/shared}/types.d.ts +0 -0
  313. /package/lib/typescript/{sharedTypes → types/shared}/wallet.types.d.ts +0 -0
  314. /package/src/{sharedTypes → types/shared}/account.types.ts +0 -0
  315. /package/src/{sharedTypes → types/shared}/authorization.types.ts +0 -0
  316. /package/src/{sharedTypes → types/shared}/bookPayment.types.ts +0 -0
  317. /package/src/{sharedTypes → types/shared}/card.types.ts +0 -0
  318. /package/src/{sharedTypes → types/shared}/checkDeposit.types.ts +0 -0
  319. /package/src/{sharedTypes → types/shared}/index.ts +0 -0
  320. /package/src/{sharedTypes → types/shared}/onLoadResponse.types.ts +0 -0
  321. /package/src/{sharedTypes → types/shared}/payments.types.ts +0 -0
  322. /package/src/{sharedTypes → types/shared}/transactions.types.ts +0 -0
  323. /package/src/{sharedTypes → types/shared}/types.ts +0 -0
  324. /package/src/{sharedTypes → types/shared}/wallet.types.ts +0 -0
@@ -1,20 +1,25 @@
1
- import React, { useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import type WebView from 'react-native-webview';
3
- import { UNCardAddToWalletStatusEvent, CardGetAddToWalletStatusEvent, CardNativeMessage, CardStartPushProvisioningEvent } from '../../../messages/nativeMessages/cardMessage';
4
- import EventBus from '../../../helpers/EventBus';
5
- import { PresentationMode } from '../../../scripts/html/bodyHtml';
6
- import { WebComponent, WebComponentType } from '../../../webComponent/WebComponent';
7
- import { renderingBottomSheetRequest } from '../UNBottomSheetComponent.utils';
3
+ import { WebComponent } from '../../../webComponent/WebComponent';
4
+ import { injectHtmlFullScreenHeight, renderingBottomSheetRequest } from '../UNBottomSheetComponent.utils';
8
5
  import { getStylesObject } from './UNAddToWalletBottomSheetItem.styles';
9
6
  import { ActivityIndicator } from 'react-native';
10
- import { useListenerToBus } from '../../../hooks/listenerToBus';
11
- import type { RequestRenderingEvent } from '../../../messages/webMessages/unitMessages';
7
+ import { UnitMessage, type RequestRenderingEvent } from '../../../messages/webMessages/unitMessages';
12
8
  import UnitAddToWalletButtonView from '../../../nativeComponent/UnitAddToWalletButton';
13
- import { UNCardAddToWalletStatus } from '../../../sharedTypes/wallet.types';
9
+ import { UNCardAddToWalletStatus } from '../../../types/shared/wallet.types';
10
+ import { BottomSheetRenderingType, WebComponentData } from '../../../types/internal/bottomSheet.types';
11
+ import { PresentationMode, WebComponentType } from '../../../types/internal/webComponent.types';
12
+ import { useCardWallet } from '../../../helpers/pushProvisioningService/hooks/useCardWallet';
13
+ import { launchStartCardProvisioning } from '../../../helpers/pushProvisioningService/startProvisioning';
14
+ import type { WebViewMessage } from '../../../messages/webMessages';
15
+ import EventBus from '../../../helpers/EventBus';
14
16
 
15
17
  export interface UNAddToWalletBottomSheetItemProps {
18
+ renderingType: BottomSheetRenderingType
16
19
  renderingRequest?: RequestRenderingEvent
17
- cardId?: string
20
+ webComponentData?: WebComponentData
21
+ cardId: string,
22
+ fullScreenHeight: number
18
23
  }
19
24
 
20
25
  export const UNAddToWalletBottomSheetItem = (props: UNAddToWalletBottomSheetItemProps) => {
@@ -22,52 +27,78 @@ export const UNAddToWalletBottomSheetItem = (props: UNAddToWalletBottomSheetItem
22
27
 
23
28
  const webRef = useRef<WebView>(null);
24
29
 
25
- const { renderingRequest, cardId } = props;
26
-
27
- const [addToWalletStatus, setAddToWalletStatus] = useState<UNCardAddToWalletStatus>(UNCardAddToWalletStatus.pending);
28
-
29
- useEffect(() => {
30
- if (!cardId) return;
31
- const event: CardGetAddToWalletStatusEvent = { cardId };
32
- EventBus.Instance.event(CardNativeMessage.CARD_GET_ADD_TO_WALLET_STATUS, event);
33
- }, [cardId]);
30
+ const { renderingType, renderingRequest, webComponentData, cardId } = props;
31
+ const { currentUNWallet } = useCardWallet(cardId);
34
32
 
35
33
  useEffect(() => {
36
34
  if (!webRef.current) return;
37
- if (addToWalletStatus === UNCardAddToWalletStatus.pending) return;
38
-
39
- const isCardInWallet = addToWalletStatus === UNCardAddToWalletStatus.addedToWallet;
40
- webRef.current.injectJavaScript(`window.UnitMobileSDKConfig["isCardInWallet"] = ${isCardInWallet}`);
35
+ const currentWalletStatus = currentUNWallet?.status ?? UNCardAddToWalletStatus.pending;
36
+ if (currentWalletStatus === UNCardAddToWalletStatus.pending) return;
41
37
 
42
- if (renderingRequest) {
38
+ if (renderingType === BottomSheetRenderingType.Slot && renderingRequest) {
39
+ const isCardInWallet = currentWalletStatus === UNCardAddToWalletStatus.addedToWallet;
40
+ webRef.current.injectJavaScript(`window.UnitMobileSDKConfig["isCardInWallet"] = ${isCardInWallet}`);
43
41
  renderingBottomSheetRequest(webRef.current, renderingRequest);
44
42
  }
45
- }, [webRef.current, renderingRequest, addToWalletStatus]);
46
43
 
47
- const gotCardWalletStatus = (data?: UNCardAddToWalletStatusEvent) => {
48
- if (data != null) {
49
- setAddToWalletStatus(data.status);
44
+ }, [webRef.current, renderingRequest, currentUNWallet]);
45
+
46
+ const handleAddToWalletClicked = () => {
47
+ if (!currentUNWallet) return;
48
+ launchStartCardProvisioning(currentUNWallet);
49
+ };
50
+
51
+ const handleWebComponentMessage = (message: WebViewMessage) => {
52
+ if (!message || !message.type) return;
53
+ switch (message.type) {
54
+ case UnitMessage.UNIT_ON_LOAD:
55
+ injectHtmlFullScreenHeight(webRef.current, props.fullScreenHeight);
56
+ break;
57
+ case UnitMessage.UNIT_REQUEST_CLOSE_FLOW:
58
+ EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW, {});
59
+ break;
60
+ default:
61
+ break;
50
62
  }
51
63
  };
52
64
 
53
- useListenerToBus({ busEventKey: CardNativeMessage.CARD_UPDATE_ADD_TO_WALLET_STATUS, action: gotCardWalletStatus });
65
+ const shouldShowWebComponent = () => {
66
+ // Show .Slot, since it need to be loaded when we inject the requestRendering
67
+ // Otherwise show web component only if the card is in wallet or ready to be provisioned.
54
68
 
55
- const handleAddToWalletClicked = () => {
56
- if (!cardId) return;
57
- const startPushProvisioningEvent: CardStartPushProvisioningEvent = { cardId };
58
- EventBus.Instance.event(CardNativeMessage.CARD_START_PUSH_PROVISIONING, startPushProvisioningEvent);
69
+ const isSlot = renderingType === BottomSheetRenderingType.Slot;
70
+
71
+ const gotWalletStatus = currentUNWallet &&
72
+ (currentUNWallet.status === UNCardAddToWalletStatus.readyToProvisioning ||
73
+ currentUNWallet.status === UNCardAddToWalletStatus.addedToWallet);
74
+
75
+ return isSlot || gotWalletStatus;
59
76
  };
60
77
 
61
78
  return (
62
79
  <>
63
- <WebComponent
64
- ref={webRef}
65
- type={WebComponentType.slot}
66
- presentationMode={PresentationMode.CoverInjectedHeight}
67
- isScrollable={false}
68
- />
69
- {addToWalletStatus === UNCardAddToWalletStatus.pending && <ActivityIndicator style={styles.loader} />}
70
- {addToWalletStatus === UNCardAddToWalletStatus.readyToProvisioning && <UnitAddToWalletButtonView style={styles.addToWalletButton} onAddToWalletClicked={handleAddToWalletClicked} />}
80
+ {
81
+ shouldShowWebComponent() &&
82
+ <WebComponent
83
+ ref={webRef}
84
+ type={renderingType === BottomSheetRenderingType.WebComponent ? WebComponentType.cardAction : WebComponentType.slot}
85
+ presentationMode={PresentationMode.CoverInjectedHeight}
86
+ params={webComponentData?.params}
87
+ isScrollable={false}
88
+ onMessage={handleWebComponentMessage}
89
+ windowParams={renderingType === BottomSheetRenderingType.WebComponent ? `window.UnitMobileSDKConfig["isCardInWallet"] = ${currentUNWallet?.status === UNCardAddToWalletStatus.addedToWallet}` : ''}
90
+ />
91
+ }
92
+
93
+ {
94
+ (currentUNWallet == undefined || currentUNWallet?.status === UNCardAddToWalletStatus.pending) &&
95
+ <ActivityIndicator style={styles.loader} />
96
+ }
97
+
98
+ {
99
+ currentUNWallet?.status === UNCardAddToWalletStatus.readyToProvisioning &&
100
+ <UnitAddToWalletButtonView style={styles.addToWalletButton} onAddToWalletClicked={handleAddToWalletClicked} />
101
+ }
71
102
  </>
72
103
  );
73
104
  };
@@ -1,26 +1,26 @@
1
- import React, { useImperativeHandle, useRef, useState } from 'react';
2
- import { Dimensions, NativeModule, View } from 'react-native';
1
+ import React, { useImperativeHandle, useRef, useState, useEffect } from 'react';
2
+ import { Dimensions, 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
6
  import EventBus from '../../helpers/EventBus';
7
- import { WebComponent, WebComponentType } from '../../webComponent/WebComponent';
7
+ import { WebComponent } from '../../webComponent/WebComponent';
8
8
  import { useListenerToBus } from '../../hooks/listenerToBus';
9
9
  import type { WebViewMessage } from '../../messages/webMessages';
10
- import { getCardParams, getCardScript, injectRefreshEventIfNeeded, launchStartCardProvisioning, injectOpenActionsMenuScript, injectRequestCardActionScript } from './UNCardComponent.utils';
11
- import { PresentationMode } from '../../scripts/html/bodyHtml';
12
- import type { UNOnLoadResponse, UNCardData, UNError, UNCardMenuAction } from '../../sharedTypes';
10
+ import { getCardParams, getCardScript, injectRefreshEventIfNeeded, injectOpenActionsMenuScript, injectRequestCardActionScript } from './UNCardComponent.utils';
11
+ import type { UNOnLoadResponse, UNCardData, UNError, UNCardMenuAction } from '../../types/shared';
13
12
  import { CardMessage } from '../../messages/webMessages/cardMessage';
14
- import { launchGetWallets } from './UNCardComponent.utils';
15
13
  import type { NativeModules } from 'react-native';
16
- import type { UNWallet } from 'src/sharedTypes/wallet.types';
17
- import { CardAddToWalletErrors, UNCardAddToWalletStatusEvent, CardGetAddToWalletStatusEvent, CardNativeMessage, CardStartPushProvisioningEvent } from '../../messages/nativeMessages/cardMessage';
18
- import type { BottomSheetSlotData } from '../UNBottomSheetComponent/UNBottomSheetComponent';
19
14
  import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
15
+ import { BottomSheetRenderingType, SlotRendering, type BottomSheetSlotData } from '../../types/internal/bottomSheet.types';
16
+ import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
17
+ import { UnitSDK } from '../../unitSdkManager/UnitSdkManager';
18
+ import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
20
19
  export interface UNCardComponentProps {
21
20
  // inputs
22
21
  cardId: string;
23
22
  customerToken: string;
23
+ learnMoreUrl?: string;
24
24
 
25
25
  // ui
26
26
  theme?: string;
@@ -44,10 +44,6 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
44
44
  const [height, setHeight] = useState(0);
45
45
  const windowWidth = Dimensions.get('window').width;
46
46
 
47
- const walletRef = useRef<UNWallet | null>(null);
48
- // walletRef can be changed to a state. (After the change of the listener hook)
49
- // TODO: walletState and checks it works. =)
50
-
51
47
  const webRef = useRef<WebView>(null);
52
48
 
53
49
  useImperativeHandle(cardRef, () => ({
@@ -75,16 +71,6 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
75
71
  injectRefreshEventIfNeeded(webRef.current, data, props.cardId);
76
72
  };
77
73
 
78
- const startPushProvisioning = async (data: CardStartPushProvisioningEvent) => {
79
- if (data.cardId !== props.cardId) return;
80
- onAddToWalletClicked();
81
- };
82
-
83
- const getAddToWalletStatus = (data: CardGetAddToWalletStatusEvent) => {
84
- if (data.cardId !== props.cardId) return;
85
- getWallets();
86
- };
87
-
88
74
  const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {
89
75
  if (!props.onLoad) {
90
76
  return;
@@ -108,20 +94,24 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
108
94
  useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });
109
95
  useListenerToBus({ busEventKey: CardMessage.CARD_STATUS_CHANGED, action: cardStatusChanged });
110
96
  useListenerToBus({ busEventKey: CardMessage.CARD_ACTIVATED, action: cardActivated });
111
- useListenerToBus({ busEventKey: CardNativeMessage.CARD_START_PUSH_PROVISIONING, action: startPushProvisioning });
112
- useListenerToBus({ busEventKey: CardNativeMessage.CARD_GET_ADD_TO_WALLET_STATUS, action: getAddToWalletStatus });
113
97
 
114
98
  const handleMessage = (message: WebViewMessage) => {
115
99
  if (!message || !message.details) return;
116
100
 
117
101
  switch (message.type) {
118
102
  case UnitMessage.UNIT_REQUEST_RENDERING: {
119
- const event: BottomSheetSlotData = {
103
+ const slotData: BottomSheetSlotData = {
120
104
  componentName: WebComponentType.card,
121
105
  componentResourceId: props.cardId,
122
106
  requestRenderingEvent: message.details as RequestRenderingEvent
123
107
  };
124
- EventBus.Instance.event(UnitMessage.UNIT_REQUEST_RENDERING, event);
108
+
109
+ const event = {
110
+ type: BottomSheetRenderingType.Slot,
111
+ data: slotData
112
+ } as SlotRendering;
113
+
114
+ EventBus.Instance.event(BottomSheetNativeMessage.START_FLOW, event);
125
115
  break;
126
116
  }
127
117
  case PageMessage.PAGE_HEIGHT:
@@ -133,34 +123,15 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
133
123
  }
134
124
  };
135
125
 
136
- const getWallets = async () => {
137
-
138
- try {
126
+ useEffect(() => {
127
+ UnitSDK.setCustomerToken(props.customerToken);
128
+ }, [props.customerToken]);
139
129
 
140
- const walletResponse = await launchGetWallets(props.customerToken, props.cardId, props.pushProvisioningModule as NativeModule);
141
-
142
- if (!walletResponse) return;
143
-
144
- walletRef.current = walletResponse;
145
-
146
- const walletStatus: UNCardAddToWalletStatusEvent = { status: walletResponse.status };
147
- EventBus.Instance.event(CardNativeMessage.CARD_UPDATE_ADD_TO_WALLET_STATUS, walletStatus);
148
- } catch (error) {
149
- console.error(error);
150
- }
151
- };
152
-
153
- const onAddToWalletClicked = async () => {
154
- try {
155
- await launchStartCardProvisioning(props.pushProvisioningModule as NativeModule, walletRef.current);
156
- } catch (error) {
157
- if (error instanceof Error) {
158
- const parsedError = JSON.parse(error.message);
159
- if (parsedError.code === CardAddToWalletErrors.closedNativeWalletScreen) return;
160
- }
161
- console.log(error);
130
+ useEffect(() => {
131
+ if (props.pushProvisioningModule) {
132
+ UnitSDK.setPushProvisioningModule(props.pushProvisioningModule);
162
133
  }
163
- };
134
+ }, [props.pushProvisioningModule]);
164
135
 
165
136
  return (
166
137
  <View style={{ height }}>
@@ -1,13 +1,9 @@
1
1
  import { DISPATCH_REQUEST_REFRESH } from './../../scripts/html/bodyScript';
2
2
  import type WebView from 'react-native-webview';
3
3
  import type { UNCardComponentProps } from './UNCardComponent';
4
- import { WebComponentType } from '../../webComponent/WebComponent';
5
- import type { NativeModules } from 'react-native';
6
- import { getMobileWalletPayload } from './networking/requests/UNWalletPayloadRequest';
7
- import { UNWallet, UNWalletCode, UNWalletName } from '../../../src/sharedTypes/wallet.types';
8
4
  import type { RequestRefreshEvent } from '../../messages/webMessages/unitMessages';
9
- import { UnitSDK } from '../../unitSdkManager/UnitSdkManager';
10
- import type { UNCardMenuAction } from '../../sharedTypes';
5
+ import type { UNCardMenuAction } from '../../types/shared';
6
+ import { WebComponentType } from '../../types/internal/webComponent.types';
11
7
 
12
8
  export const getCardParams = (props: UNCardComponentProps) => {
13
9
  return `
@@ -17,6 +13,7 @@ export const getCardParams = (props: UNCardComponentProps) => {
17
13
  hide-actions-menu-button="${props.hideActionsMenuButton || false}"
18
14
  hide-card-title="${props.hideCardTitle || false}"
19
15
  hide-sensitive-data-button="${props.hideSensitiveDataButton || false}"
16
+ learn-more-url="${props.learnMoreUrl || ''}"
20
17
  `;
21
18
  };
22
19
 
@@ -37,46 +34,3 @@ export const injectRefreshEventIfNeeded = (currentWeb: WebView | null, requestRe
37
34
  currentWeb?.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);
38
35
  }
39
36
  };
40
-
41
- export const launchGetWallets = async (customerToken: string, cardId: string, pushProvisioningModule: typeof NativeModules) => {
42
- try {
43
- const env = UnitSDK.getEnv();
44
- if (!env) return null;
45
-
46
- const encryptedPayload = await getMobileWalletPayload(customerToken, cardId, env);
47
- if (!encryptedPayload) return null;
48
-
49
- const walletsResponse = await pushProvisioningModule.launchGetWallets(JSON.stringify({ encPayload: encryptedPayload }));
50
- const parsedWalletsResponse = JSON.parse(walletsResponse);
51
- const wallets = parsedWalletsResponse.wallets;
52
-
53
- if (!wallets) return null;
54
- if (wallets[0].code === UNWalletCode.Apple) {
55
- return ({ name: UNWalletName.Apple, code: UNWalletCode.Apple, status: wallets[0].status });
56
- } else {
57
- const googleWallet = wallets.filter((wallet: { name: UNWalletName }) => {
58
- return wallet.name === UNWalletName.Google;
59
- });
60
- if (!googleWallet) return;
61
- return ({ name: UNWalletName.Google, code: UNWalletCode.Google, status: googleWallet[0].status });
62
- }
63
- } catch (error) {
64
- return Promise.reject(error);
65
- }
66
-
67
- };
68
-
69
- export const launchStartCardProvisioning = async (pushProvisioningModule: typeof NativeModules, wallet: UNWallet | null) => {
70
- try {
71
- const response = await pushProvisioningModule.launchStartCardProvisioning(
72
- JSON.stringify({
73
- walletCode: wallet?.code,
74
- walletName: wallet?.name
75
- }));
76
- return response;
77
- }
78
-
79
- catch (error) {
80
- return Promise.reject(error);
81
- }
82
- };
@@ -1,15 +1,15 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { View, NativeModules, Platform } from 'react-native';
3
- import { WebComponent, WebComponentType } from '../../webComponent/WebComponent';
4
- import { PresentationMode } from '../../scripts/html/bodyHtml';
3
+ import { WebComponent } from '../../webComponent/WebComponent';
5
4
  import type { WebViewMessage } from '../../messages/webMessages';
6
5
  import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
7
6
  import { UnitMessage } from '../../messages/webMessages/unitMessages';
8
7
  import { getCheckDepositParams, getCheckDepositScript } from './UNCheckDepositComponent.utils';
9
8
  import { CheckMessage } from '../../messages/webMessages/checkMessage';
10
- import type { UNCheckDepositData } from '../../sharedTypes/checkDeposit.types';
11
- import type { UNAccountData, UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../sharedTypes';
9
+ import type { UNCheckDepositData } from '../../types/shared/checkDeposit.types';
10
+ import type { UNAccountData, UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../types/shared';
12
11
  import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
12
+ import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
13
13
 
14
14
  const { Camera } = NativeModules;
15
15
 
@@ -0,0 +1,11 @@
1
+ import { NativeModules } from 'react-native';
2
+ const { RNAppInfoModule } = NativeModules;
3
+
4
+ export const getAndroidPackageName = async () => {
5
+ try {
6
+ const response = await RNAppInfoModule.getAppPackageName();
7
+ return response;
8
+ } catch (error) {
9
+ console.error(error);
10
+ }
11
+ };
@@ -0,0 +1,13 @@
1
+ import { UNCardFlows } from './card/UNCardFlows';
2
+ import { UnitSDK } from '../unitSdkManager/UnitSdkManager';
3
+
4
+ export class UNFlows {
5
+ constructor() {
6
+ console.log('new Flows instance created');
7
+ }
8
+
9
+ public async startPushProvisioning(cardId: string, customerToken: string) {
10
+ UnitSDK.setCustomerToken(customerToken);
11
+ UNCardFlows.startPushProvisioning(cardId, customerToken);
12
+ }
13
+ }
@@ -0,0 +1,25 @@
1
+ import EventBus from '../../helpers/EventBus';
2
+ import { PresentationMode, WebComponentType } from '../../types/internal/webComponent.types';
3
+ import { BottomSheetRenderingType, type WebComponentData, type WebComponentRendering } from '../../types/internal/bottomSheet.types';
4
+ import { BottomSheetNativeMessage } from '../../messages/nativeMessages/bottomSheetMessage';
5
+
6
+ export class UNCardFlows {
7
+ public static startPushProvisioning = async (cardId: string, customerToken: string) => {
8
+ try {
9
+ const addToWalletComponentData: WebComponentData = {
10
+ type: WebComponentType.cardAction,
11
+ presentationMode: PresentationMode.CoverInjectedHeight,
12
+ params: `card-id=${cardId} customer-token=${customerToken} action=AddToWallet`,
13
+ };
14
+
15
+ const event: WebComponentRendering = {
16
+ type: BottomSheetRenderingType.WebComponent,
17
+ data: addToWalletComponentData,
18
+ };
19
+
20
+ EventBus.Instance.event(BottomSheetNativeMessage.START_FLOW, event);
21
+ } catch (error) {
22
+ console.error(error);
23
+ }
24
+ };
25
+ }
@@ -0,0 +1,67 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { UNWalletCode, type UNWallet, UNWalletName } from '../../../types/shared/wallet.types';
3
+ import { UnitSDK } from '../../../unitSdkManager/UnitSdkManager';
4
+ import { getMobileWalletPayload } from '../../../networking/requests/UNWalletPayloadRequest';
5
+
6
+ export type CardToEncryptedPayload = {
7
+ [cardId: string]: string;
8
+ };
9
+
10
+ export const useCardWallet = (cardId: string) => {
11
+ const [currentUNWallet, setCurrentUNWallet] = useState<UNWallet>();
12
+
13
+ useEffect(() => {
14
+ const getEncryptedPayload = async () => {
15
+ const env = UnitSDK.getEnv();
16
+ const customerToken = UnitSDK.getCustomerToken();
17
+ if (!env || !customerToken) return;
18
+
19
+ const encryptedPayload = await getMobileWalletPayload(customerToken, cardId, env);
20
+ return encryptedPayload;
21
+ };
22
+
23
+ const getCardWalletData = async () => {
24
+ const currentProvisioningModule = UnitSDK.getPushProvisionModule();
25
+ if (!currentProvisioningModule) return;
26
+ try {
27
+ const encryptedPayload = await getEncryptedPayload();
28
+ const walletsResponse = await currentProvisioningModule.launchGetWallets(JSON.stringify({ encPayload: encryptedPayload }));
29
+
30
+ const unWallet: UNWallet | null = parseWalletsResponse(walletsResponse);
31
+ if (!unWallet) return;
32
+ setCurrentUNWallet(unWallet);
33
+ return;
34
+ } catch (error) {
35
+ return Promise.reject(error);
36
+ }
37
+ };
38
+
39
+ getCardWalletData();
40
+
41
+ }, [cardId]);
42
+
43
+ return {
44
+ currentUNWallet
45
+ };
46
+
47
+ };
48
+
49
+ const parseWalletsResponse = (walletsResponse: string): UNWallet | null => {
50
+ try {
51
+ const parsedWalletsResponse = JSON.parse(walletsResponse);
52
+ const wallets = parsedWalletsResponse.wallets;
53
+
54
+ if (!wallets) return null;
55
+ if (wallets[0].code === UNWalletCode.Apple) {
56
+ return ({ name: UNWalletName.Apple, code: UNWalletCode.Apple, status: wallets[0].status });
57
+ } else {
58
+ const googleWallet = wallets.filter((wallet: { name: UNWalletName }) => {
59
+ return wallet.name === UNWalletName.Google;
60
+ });
61
+ if (!googleWallet) return null;
62
+ return ({ name: UNWalletName.Google, code: UNWalletCode.Google, status: googleWallet[0].status });
63
+ }
64
+ } catch (error) {
65
+ throw new Error('Error parsing wallet response');
66
+ }
67
+ };
@@ -0,0 +1,20 @@
1
+ import type { UNWallet } from '../../types/shared/wallet.types';
2
+ import { UnitSDK } from '../../unitSdkManager/UnitSdkManager';
3
+
4
+ export const launchStartCardProvisioning = async (wallet: UNWallet | null) => {
5
+ const pushProvisioningModule = UnitSDK.getPushProvisionModule();
6
+ if (!pushProvisioningModule) return;
7
+
8
+ try {
9
+ const response = await pushProvisioningModule.launchStartCardProvisioning(
10
+ JSON.stringify({
11
+ walletCode: wallet?.code,
12
+ walletName: wallet?.name
13
+ }));
14
+ return response;
15
+ }
16
+
17
+ catch (error) {
18
+ return Promise.reject(error);
19
+ }
20
+ };
package/src/index.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './components';
2
2
 
3
- export * from './sharedTypes';
3
+ export * from './types/shared';
4
4
 
5
5
  export { UnitSDK, UNEnvironment } from './unitSdkManager/UnitSdkManager';
@@ -0,0 +1,15 @@
1
+ import type {NativeComponentRendering, WebComponentRendering, SlotRendering } from '../../types/internal/bottomSheet.types';
2
+
3
+ export enum BottomSheetNativeMessage {
4
+ START_FLOW = 'startBottomSheetFlow',
5
+ }
6
+
7
+ export enum CardAddToWalletErrors {
8
+ closedNativeWalletScreen = 'VP_ERROR_302'
9
+ }
10
+
11
+ export type StartBottomSheetFlowMessage = SlotRendering | WebComponentRendering | NativeComponentRendering
12
+
13
+ export type BottomSheetNativeEvent = |
14
+ StartBottomSheetFlowMessage
15
+ // BottomSheetChangeFlowMessage - probably, we want to add this message event in the future to alternate between flows
@@ -1,27 +1,4 @@
1
- import type { UNCardAddToWalletStatus } from '../../sharedTypes/wallet.types';
2
-
3
- export enum CardNativeMessage {
4
- CARD_GET_ADD_TO_WALLET_STATUS = 'cardGetAddToWalletStatus',
5
- CARD_UPDATE_ADD_TO_WALLET_STATUS = 'cardUpdateAddToWalletStatus',
6
- CARD_START_PUSH_PROVISIONING = 'cardStartPushProvisioning'
7
- }
8
-
1
+ // Should we remove it ?
9
2
  export enum CardAddToWalletErrors {
10
3
  closedNativeWalletScreen = 'VP_ERROR_302'
11
4
  }
12
- export interface UNCardAddToWalletStatusEvent {
13
- status: UNCardAddToWalletStatus
14
- }
15
-
16
- export interface CardGetAddToWalletStatusEvent {
17
- cardId: string
18
- }
19
-
20
- export interface CardStartPushProvisioningEvent {
21
- cardId: string
22
- }
23
-
24
- export type CardNativeEvent =
25
- | UNCardAddToWalletStatusEvent
26
- | CardGetAddToWalletStatusEvent
27
- | CardStartPushProvisioningEvent
@@ -1,13 +1,13 @@
1
- import type { CardNativeEvent, CardNativeMessage } from './cardMessage';
1
+ import type { BottomSheetNativeEvent, BottomSheetNativeMessage } from './bottomSheetMessage';
2
2
  import type { SDKEvent, SDKMessage } from './sdkMessage';
3
3
 
4
4
  export type NativeMessageType =
5
5
  | SDKMessage
6
- | CardNativeMessage
6
+ | BottomSheetNativeMessage
7
7
 
8
8
  export type NativeEvent =
9
- | CardNativeEvent
10
9
  | SDKEvent
10
+ | BottomSheetNativeEvent
11
11
 
12
12
  export interface NativeMessage {
13
13
  type: NativeMessageType,
@@ -1,4 +1,4 @@
1
- import type { UNAccountData } from '../../sharedTypes';
1
+ import type { UNAccountData } from '../../types/shared';
2
2
 
3
3
  export enum AccountMessage {
4
4
  UNIT_ACCOUNT_CHANGED = 'unitAccountChanged'
@@ -1,4 +1,4 @@
1
- import type { UNACHData } from '../../sharedTypes';
1
+ import type { UNACHData } from '../../types/shared';
2
2
 
3
3
  export interface PaymentCreatedEvent {
4
4
  data: UNACHData
@@ -1,4 +1,4 @@
1
- import type { UNBookPaymentData } from '../../sharedTypes';
1
+ import type { UNBookPaymentData } from '../../types/shared';
2
2
 
3
3
  export interface PaymentCreatedEvent {
4
4
  data: UNBookPaymentData
@@ -1,4 +1,4 @@
1
- import type { UNCardData } from '../../sharedTypes';
1
+ import type { UNCardData } from '../../types/shared';
2
2
 
3
3
  export enum CardMessage {
4
4
  CARD_ACTIVATED = 'unitCardActivated',
@@ -1,4 +1,4 @@
1
- import type { UNCheckDepositData } from '../../sharedTypes/checkDeposit.types';
1
+ import type { UNCheckDepositData } from '../../types/shared/checkDeposit.types';
2
2
 
3
3
  export enum CheckMessage {
4
4
  // check deposit
@@ -1,6 +1,6 @@
1
- import type {UNAccountData, UNCounterpartyAccountData, UNCardData, UNError, UNOnLoadResponseData } from '../../sharedTypes';
2
- import type { UNAuthorizationData } from '../../sharedTypes/authorization.types';
3
- import type { UNTransactionData } from '../../sharedTypes/transactions.types';
1
+ import type {UNAccountData, UNCounterpartyAccountData, UNCardData, UNError, UNOnLoadResponseData } from '../../types/shared';
2
+ import type { UNAuthorizationData } from '../../types/shared/authorization.types';
3
+ import type { UNTransactionData } from '../../types/shared/transactions.types';
4
4
 
5
5
  export enum RESPONSE_KEYS {
6
6
  errors = 'errors',
@@ -9,9 +9,10 @@ export enum UnitMessage {
9
9
  UNIT_REQUEST_DOWNLOAD = 'unitRequestDownload',
10
10
  UNIT_PLAID_TOKEN_CREATED = 'unitPlaidLinkTokenCreated',
11
11
  UNIT_REQUEST_EXTERNAL_SDK = 'unitRequestExternalSdk',
12
- UNIT_PLAID_RESPONSE = 'unitPlaidResponse'
13
-
12
+ UNIT_PLAID_RESPONSE = 'unitPlaidResponse',
13
+ PAGE_HEIGHT = 'PAGE_HEIGHT'
14
14
  }
15
+
15
16
  export interface RequestRenderingEvent {
16
17
  data: RequestRenderingEventData
17
18
  }