react-native-unit-components 1.6.1 → 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 (294) hide show
  1. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +6 -6
  2. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  3. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +6 -6
  4. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  5. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +12 -6
  6. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  7. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js +3 -3
  8. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
  9. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +12 -6
  10. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  11. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +2 -2
  12. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  13. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +6 -6
  14. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  15. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +159 -74
  16. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  17. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +28 -8
  18. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  19. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js +49 -37
  20. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +1 -1
  21. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +20 -50
  22. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  23. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +4 -53
  24. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  25. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js +6 -6
  26. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -1
  27. package/lib/commonjs/flows/UNFlows.js +19 -0
  28. package/lib/commonjs/flows/UNFlows.js.map +1 -0
  29. package/lib/commonjs/flows/card/UNCardFlows.js +33 -0
  30. package/lib/commonjs/flows/card/UNCardFlows.js.map +1 -0
  31. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js +70 -0
  32. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -0
  33. package/lib/commonjs/helpers/pushProvisioningService/startProvisioning.js +22 -0
  34. package/lib/commonjs/helpers/pushProvisioningService/startProvisioning.js.map +1 -0
  35. package/lib/commonjs/index.js +4 -4
  36. package/lib/commonjs/index.js.map +1 -1
  37. package/lib/commonjs/messages/nativeMessages/bottomSheetMessage.js +17 -0
  38. package/lib/commonjs/messages/nativeMessages/bottomSheetMessage.js.map +1 -0
  39. package/lib/commonjs/messages/nativeMessages/cardMessage.js +2 -8
  40. package/lib/commonjs/messages/nativeMessages/cardMessage.js.map +1 -1
  41. package/lib/commonjs/messages/nativeMessages/index.js.map +1 -1
  42. package/lib/commonjs/messages/webMessages/accountMessage.js.map +1 -1
  43. package/lib/commonjs/messages/webMessages/achCreditMessage.js.map +1 -1
  44. package/lib/commonjs/messages/webMessages/bookPaymentMessage.js.map +1 -1
  45. package/lib/commonjs/messages/webMessages/cardMessage.js.map +1 -1
  46. package/lib/commonjs/messages/webMessages/checkMessage.js.map +1 -1
  47. package/lib/commonjs/messages/webMessages/onLoadMessage.js.map +1 -1
  48. package/lib/commonjs/messages/webMessages/unitMessages.js +1 -0
  49. package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -1
  50. package/lib/commonjs/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.js +1 -1
  51. package/lib/commonjs/networking/common/UNNetworkConstants.js.map +1 -0
  52. package/lib/commonjs/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.js +3 -1
  53. package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js.map +1 -0
  54. package/lib/commonjs/scripts/html/bodyHtml.js +4 -10
  55. package/lib/commonjs/scripts/html/bodyHtml.js.map +1 -1
  56. package/lib/commonjs/types/internal/bottomSheet.types.js +14 -0
  57. package/lib/commonjs/types/internal/bottomSheet.types.js.map +1 -0
  58. package/lib/commonjs/types/internal/webComponent.types.js +27 -0
  59. package/lib/commonjs/types/internal/webComponent.types.js.map +1 -0
  60. package/lib/commonjs/types/shared/achCredit.types.js.map +1 -0
  61. package/lib/commonjs/types/shared/activity.types.js.map +1 -0
  62. package/lib/commonjs/unitSdkManager/UnitSdkManager.js +20 -2
  63. package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
  64. package/lib/commonjs/unitSdkManager/unitUiManager/unitUiManager.js +21 -0
  65. package/lib/commonjs/unitSdkManager/unitUiManager/unitUiManager.js.map +1 -0
  66. package/lib/commonjs/webComponent/WebComponent.js +5 -16
  67. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  68. package/lib/commonjs/webComponent/html.js +3 -1
  69. package/lib/commonjs/webComponent/html.js.map +1 -1
  70. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +2 -2
  71. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  72. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +2 -2
  73. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  74. package/lib/module/components/UNAccountComponent/UNAccountComponent.js +10 -4
  75. package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  76. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js +1 -1
  77. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
  78. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +10 -4
  79. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  80. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +1 -1
  81. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  82. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +2 -2
  83. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  84. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +159 -74
  85. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  86. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +23 -6
  87. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  88. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js +51 -39
  89. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +1 -1
  90. package/lib/module/components/UNCardComponent/UNCardComponent.js +20 -51
  91. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  92. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +1 -48
  93. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  94. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js +2 -2
  95. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -1
  96. package/lib/module/flows/UNFlows.js +12 -0
  97. package/lib/module/flows/UNFlows.js.map +1 -0
  98. package/lib/module/flows/card/UNCardFlows.js +25 -0
  99. package/lib/module/flows/card/UNCardFlows.js.map +1 -0
  100. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js +63 -0
  101. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -0
  102. package/lib/module/helpers/pushProvisioningService/startProvisioning.js +15 -0
  103. package/lib/module/helpers/pushProvisioningService/startProvisioning.js.map +1 -0
  104. package/lib/module/index.js +1 -1
  105. package/lib/module/index.js.map +1 -1
  106. package/lib/module/messages/nativeMessages/bottomSheetMessage.js +9 -0
  107. package/lib/module/messages/nativeMessages/bottomSheetMessage.js.map +1 -0
  108. package/lib/module/messages/nativeMessages/cardMessage.js +1 -6
  109. package/lib/module/messages/nativeMessages/cardMessage.js.map +1 -1
  110. package/lib/module/messages/nativeMessages/index.js.map +1 -1
  111. package/lib/module/messages/webMessages/accountMessage.js.map +1 -1
  112. package/lib/module/messages/webMessages/achCreditMessage.js.map +1 -1
  113. package/lib/module/messages/webMessages/bookPaymentMessage.js.map +1 -1
  114. package/lib/module/messages/webMessages/cardMessage.js.map +1 -1
  115. package/lib/module/messages/webMessages/checkMessage.js.map +1 -1
  116. package/lib/module/messages/webMessages/onLoadMessage.js.map +1 -1
  117. package/lib/module/messages/webMessages/unitMessages.js +1 -0
  118. package/lib/module/messages/webMessages/unitMessages.js.map +1 -1
  119. package/lib/module/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.js +1 -1
  120. package/lib/module/networking/common/UNNetworkConstants.js.map +1 -0
  121. package/lib/module/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.js +4 -1
  122. package/lib/module/networking/requests/UNWalletPayloadRequest.js.map +1 -0
  123. package/lib/module/scripts/html/bodyHtml.js +1 -6
  124. package/lib/module/scripts/html/bodyHtml.js.map +1 -1
  125. package/lib/module/types/internal/bottomSheet.types.js +7 -0
  126. package/lib/module/types/internal/bottomSheet.types.js.map +1 -0
  127. package/lib/module/types/internal/webComponent.types.js +19 -0
  128. package/lib/module/types/internal/webComponent.types.js.map +1 -0
  129. package/lib/module/types/shared/achCredit.types.js.map +1 -0
  130. package/lib/module/types/shared/activity.types.js.map +1 -0
  131. package/lib/module/unitSdkManager/UnitSdkManager.js +20 -2
  132. package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
  133. package/lib/module/unitSdkManager/unitUiManager/unitUiManager.js +14 -0
  134. package/lib/module/unitSdkManager/unitUiManager/unitUiManager.js.map +1 -0
  135. package/lib/module/webComponent/WebComponent.js +4 -14
  136. package/lib/module/webComponent/WebComponent.js.map +1 -1
  137. package/lib/module/webComponent/html.js +3 -1
  138. package/lib/module/webComponent/html.js.map +1 -1
  139. package/lib/typescript/components/UNACHCreditComponent/UNACHCreditComponent.d.ts +1 -1
  140. package/lib/typescript/components/UNACHDebitComponent/UNACHDebitComponent.d.ts +1 -1
  141. package/lib/typescript/components/UNAccountComponent/UNAccountComponent.d.ts +3 -3
  142. package/lib/typescript/components/UNAccountComponent/UNAccountComponent.utils.d.ts +1 -1
  143. package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +2 -2
  144. package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +1 -1
  145. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +0 -7
  146. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +5 -1
  147. package/lib/typescript/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.d.ts +6 -2
  148. package/lib/typescript/components/UNCardComponent/UNCardComponent.d.ts +1 -1
  149. package/lib/typescript/components/UNCardComponent/UNCardComponent.utils.d.ts +1 -9
  150. package/lib/typescript/components/UNCheckDepositComponent/UNCheckDepositComponent.d.ts +2 -2
  151. package/lib/typescript/flows/UNFlows.d.ts +4 -0
  152. package/lib/typescript/flows/card/UNCardFlows.d.ts +3 -0
  153. package/lib/typescript/helpers/pushProvisioningService/hooks/useCardWallet.d.ts +7 -0
  154. package/lib/typescript/helpers/pushProvisioningService/startProvisioning.d.ts +2 -0
  155. package/lib/typescript/index.d.ts +1 -1
  156. package/lib/typescript/messages/nativeMessages/bottomSheetMessage.d.ts +9 -0
  157. package/lib/typescript/messages/nativeMessages/cardMessage.d.ts +0 -16
  158. package/lib/typescript/messages/nativeMessages/index.d.ts +3 -3
  159. package/lib/typescript/messages/webMessages/accountMessage.d.ts +1 -1
  160. package/lib/typescript/messages/webMessages/achCreditMessage.d.ts +1 -1
  161. package/lib/typescript/messages/webMessages/bookPaymentMessage.d.ts +1 -1
  162. package/lib/typescript/messages/webMessages/cardMessage.d.ts +1 -1
  163. package/lib/typescript/messages/webMessages/checkMessage.d.ts +1 -1
  164. package/lib/typescript/messages/webMessages/onLoadMessage.d.ts +3 -3
  165. package/lib/typescript/messages/webMessages/unitMessages.d.ts +2 -1
  166. package/lib/typescript/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.d.ts +1 -1
  167. package/lib/typescript/scripts/html/bodyHtml.d.ts +1 -5
  168. package/lib/typescript/types/internal/bottomSheet.types.d.ts +35 -0
  169. package/lib/typescript/types/internal/webComponent.types.d.ts +16 -0
  170. package/lib/typescript/{sharedTypes → types/shared}/achCredit.types.d.ts +1 -1
  171. package/lib/typescript/{sharedTypes → types/shared}/activity.types.d.ts +1 -1
  172. package/lib/typescript/unitSdkManager/UnitSdkManager.d.ts +9 -0
  173. package/lib/typescript/unitSdkManager/unitUiManager/unitUiManager.d.ts +6 -0
  174. package/lib/typescript/webComponent/WebComponent.d.ts +2 -11
  175. package/lib/typescript/webComponent/html.d.ts +1 -0
  176. package/package.json +1 -1
  177. package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +3 -3
  178. package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +3 -3
  179. package/src/components/UNAccountComponent/UNAccountComponent.tsx +15 -8
  180. package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +2 -2
  181. package/src/components/UNActivityComponent/UNActivityComponent.tsx +14 -7
  182. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +1 -1
  183. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +3 -3
  184. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +151 -76
  185. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +24 -6
  186. package/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.tsx +72 -41
  187. package/src/components/UNCardComponent/UNCardComponent.tsx +24 -54
  188. package/src/components/UNCardComponent/UNCardComponent.utils.ts +2 -49
  189. package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.tsx +4 -4
  190. package/src/flows/UNFlows.ts +13 -0
  191. package/src/flows/card/UNCardFlows.ts +25 -0
  192. package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +67 -0
  193. package/src/helpers/pushProvisioningService/startProvisioning.ts +20 -0
  194. package/src/index.tsx +1 -1
  195. package/src/messages/nativeMessages/bottomSheetMessage.ts +15 -0
  196. package/src/messages/nativeMessages/cardMessage.ts +1 -24
  197. package/src/messages/nativeMessages/index.ts +3 -3
  198. package/src/messages/webMessages/accountMessage.ts +1 -1
  199. package/src/messages/webMessages/achCreditMessage.ts +1 -1
  200. package/src/messages/webMessages/bookPaymentMessage.ts +1 -1
  201. package/src/messages/webMessages/cardMessage.ts +1 -1
  202. package/src/messages/webMessages/checkMessage.ts +1 -1
  203. package/src/messages/webMessages/onLoadMessage.ts +3 -3
  204. package/src/messages/webMessages/unitMessages.ts +3 -2
  205. package/src/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.ts +1 -1
  206. package/src/{components/UNCardComponent/networking → networking}/requests/UNWalletPayloadRequest.ts +3 -1
  207. package/src/scripts/html/bodyHtml.ts +2 -14
  208. package/src/types/internal/bottomSheet.types.ts +43 -0
  209. package/src/types/internal/webComponent.types.ts +26 -0
  210. package/src/{sharedTypes → types/shared}/achCredit.types.ts +1 -1
  211. package/src/{sharedTypes → types/shared}/activity.types.ts +1 -1
  212. package/src/unitSdkManager/UnitSdkManager.ts +28 -2
  213. package/src/unitSdkManager/unitUiManager/unitUiManager.ts +13 -0
  214. package/src/webComponent/WebComponent.tsx +7 -15
  215. package/src/webComponent/html.ts +3 -1
  216. package/lib/commonjs/components/UNCardComponent/networking/common/UNNetworkConstants.js.map +0 -1
  217. package/lib/commonjs/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js.map +0 -1
  218. package/lib/commonjs/sharedTypes/achCredit.types.js.map +0 -1
  219. package/lib/commonjs/sharedTypes/activity.types.js.map +0 -1
  220. package/lib/module/components/UNCardComponent/networking/common/UNNetworkConstants.js.map +0 -1
  221. package/lib/module/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js.map +0 -1
  222. package/lib/module/sharedTypes/achCredit.types.js.map +0 -1
  223. package/lib/module/sharedTypes/activity.types.js.map +0 -1
  224. /package/lib/commonjs/{sharedTypes → types/shared}/account.types.js +0 -0
  225. /package/lib/commonjs/{sharedTypes → types/shared}/account.types.js.map +0 -0
  226. /package/lib/commonjs/{sharedTypes → types/shared}/achCredit.types.js +0 -0
  227. /package/lib/commonjs/{sharedTypes → types/shared}/activity.types.js +0 -0
  228. /package/lib/commonjs/{sharedTypes → types/shared}/authorization.types.js +0 -0
  229. /package/lib/commonjs/{sharedTypes → types/shared}/authorization.types.js.map +0 -0
  230. /package/lib/commonjs/{sharedTypes → types/shared}/bookPayment.types.js +0 -0
  231. /package/lib/commonjs/{sharedTypes → types/shared}/bookPayment.types.js.map +0 -0
  232. /package/lib/commonjs/{sharedTypes → types/shared}/card.types.js +0 -0
  233. /package/lib/commonjs/{sharedTypes → types/shared}/card.types.js.map +0 -0
  234. /package/lib/commonjs/{sharedTypes → types/shared}/checkDeposit.types.js +0 -0
  235. /package/lib/commonjs/{sharedTypes → types/shared}/checkDeposit.types.js.map +0 -0
  236. /package/lib/commonjs/{sharedTypes → types/shared}/index.js +0 -0
  237. /package/lib/commonjs/{sharedTypes → types/shared}/index.js.map +0 -0
  238. /package/lib/commonjs/{sharedTypes → types/shared}/onLoadResponse.types.js +0 -0
  239. /package/lib/commonjs/{sharedTypes → types/shared}/onLoadResponse.types.js.map +0 -0
  240. /package/lib/commonjs/{sharedTypes → types/shared}/payments.types.js +0 -0
  241. /package/lib/commonjs/{sharedTypes → types/shared}/payments.types.js.map +0 -0
  242. /package/lib/commonjs/{sharedTypes → types/shared}/transactions.types.js +0 -0
  243. /package/lib/commonjs/{sharedTypes → types/shared}/transactions.types.js.map +0 -0
  244. /package/lib/commonjs/{sharedTypes → types/shared}/types.js +0 -0
  245. /package/lib/commonjs/{sharedTypes → types/shared}/types.js.map +0 -0
  246. /package/lib/commonjs/{sharedTypes → types/shared}/wallet.types.js +0 -0
  247. /package/lib/commonjs/{sharedTypes → types/shared}/wallet.types.js.map +0 -0
  248. /package/lib/module/{sharedTypes → types/shared}/account.types.js +0 -0
  249. /package/lib/module/{sharedTypes → types/shared}/account.types.js.map +0 -0
  250. /package/lib/module/{sharedTypes → types/shared}/achCredit.types.js +0 -0
  251. /package/lib/module/{sharedTypes → types/shared}/activity.types.js +0 -0
  252. /package/lib/module/{sharedTypes → types/shared}/authorization.types.js +0 -0
  253. /package/lib/module/{sharedTypes → types/shared}/authorization.types.js.map +0 -0
  254. /package/lib/module/{sharedTypes → types/shared}/bookPayment.types.js +0 -0
  255. /package/lib/module/{sharedTypes → types/shared}/bookPayment.types.js.map +0 -0
  256. /package/lib/module/{sharedTypes → types/shared}/card.types.js +0 -0
  257. /package/lib/module/{sharedTypes → types/shared}/card.types.js.map +0 -0
  258. /package/lib/module/{sharedTypes → types/shared}/checkDeposit.types.js +0 -0
  259. /package/lib/module/{sharedTypes → types/shared}/checkDeposit.types.js.map +0 -0
  260. /package/lib/module/{sharedTypes → types/shared}/index.js +0 -0
  261. /package/lib/module/{sharedTypes → types/shared}/index.js.map +0 -0
  262. /package/lib/module/{sharedTypes → types/shared}/onLoadResponse.types.js +0 -0
  263. /package/lib/module/{sharedTypes → types/shared}/onLoadResponse.types.js.map +0 -0
  264. /package/lib/module/{sharedTypes → types/shared}/payments.types.js +0 -0
  265. /package/lib/module/{sharedTypes → types/shared}/payments.types.js.map +0 -0
  266. /package/lib/module/{sharedTypes → types/shared}/transactions.types.js +0 -0
  267. /package/lib/module/{sharedTypes → types/shared}/transactions.types.js.map +0 -0
  268. /package/lib/module/{sharedTypes → types/shared}/types.js +0 -0
  269. /package/lib/module/{sharedTypes → types/shared}/types.js.map +0 -0
  270. /package/lib/module/{sharedTypes → types/shared}/wallet.types.js +0 -0
  271. /package/lib/module/{sharedTypes → types/shared}/wallet.types.js.map +0 -0
  272. /package/lib/typescript/{components/UNCardComponent/networking → networking}/common/UNNetworkConstants.d.ts +0 -0
  273. /package/lib/typescript/{sharedTypes → types/shared}/account.types.d.ts +0 -0
  274. /package/lib/typescript/{sharedTypes → types/shared}/authorization.types.d.ts +0 -0
  275. /package/lib/typescript/{sharedTypes → types/shared}/bookPayment.types.d.ts +0 -0
  276. /package/lib/typescript/{sharedTypes → types/shared}/card.types.d.ts +0 -0
  277. /package/lib/typescript/{sharedTypes → types/shared}/checkDeposit.types.d.ts +0 -0
  278. /package/lib/typescript/{sharedTypes → types/shared}/index.d.ts +0 -0
  279. /package/lib/typescript/{sharedTypes → types/shared}/onLoadResponse.types.d.ts +0 -0
  280. /package/lib/typescript/{sharedTypes → types/shared}/payments.types.d.ts +0 -0
  281. /package/lib/typescript/{sharedTypes → types/shared}/transactions.types.d.ts +0 -0
  282. /package/lib/typescript/{sharedTypes → types/shared}/types.d.ts +0 -0
  283. /package/lib/typescript/{sharedTypes → types/shared}/wallet.types.d.ts +0 -0
  284. /package/src/{sharedTypes → types/shared}/account.types.ts +0 -0
  285. /package/src/{sharedTypes → types/shared}/authorization.types.ts +0 -0
  286. /package/src/{sharedTypes → types/shared}/bookPayment.types.ts +0 -0
  287. /package/src/{sharedTypes → types/shared}/card.types.ts +0 -0
  288. /package/src/{sharedTypes → types/shared}/checkDeposit.types.ts +0 -0
  289. /package/src/{sharedTypes → types/shared}/index.ts +0 -0
  290. /package/src/{sharedTypes → types/shared}/onLoadResponse.types.ts +0 -0
  291. /package/src/{sharedTypes → types/shared}/payments.types.ts +0 -0
  292. /package/src/{sharedTypes → types/shared}/transactions.types.ts +0 -0
  293. /package/src/{sharedTypes → types/shared}/types.ts +0 -0
  294. /package/src/{sharedTypes → types/shared}/wallet.types.ts +0 -0
@@ -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 `
@@ -38,46 +34,3 @@ export const injectRefreshEventIfNeeded = (currentWeb: WebView | null, requestRe
38
34
  currentWeb?.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);
39
35
  }
40
36
  };
41
-
42
- export const launchGetWallets = async (customerToken: string, cardId: string, pushProvisioningModule: typeof NativeModules) => {
43
- try {
44
- const env = UnitSDK.getEnv();
45
- if (!env) return null;
46
-
47
- const encryptedPayload = await getMobileWalletPayload(customerToken, cardId, env);
48
- if (!encryptedPayload) return null;
49
-
50
- const walletsResponse = await pushProvisioningModule.launchGetWallets(JSON.stringify({ encPayload: encryptedPayload }));
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;
62
- return ({ name: UNWalletName.Google, code: UNWalletCode.Google, status: googleWallet[0].status });
63
- }
64
- } catch (error) {
65
- return Promise.reject(error);
66
- }
67
-
68
- };
69
-
70
- export const launchStartCardProvisioning = async (pushProvisioningModule: typeof NativeModules, wallet: UNWallet | null) => {
71
- try {
72
- const response = await pushProvisioningModule.launchStartCardProvisioning(
73
- JSON.stringify({
74
- walletCode: wallet?.code,
75
- walletName: wallet?.name
76
- }));
77
- return response;
78
- }
79
-
80
- catch (error) {
81
- return Promise.reject(error);
82
- }
83
- };
@@ -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,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
  }
@@ -1,4 +1,4 @@
1
- import { UNEnvironment } from '../../../../unitSdkManager/UnitSdkManager';
1
+ import { UNEnvironment } from '../../unitSdkManager/UnitSdkManager';
2
2
 
3
3
  export const APIHeaders = {
4
4
  AUTHORIZATION: 'Authorization',
@@ -1,6 +1,8 @@
1
1
  import axios from 'axios';
2
2
  import { APIHeaders, UNIT_SECURE_URL } from '../common/UNNetworkConstants';
3
- import { UnitSDK, UNEnvironment } from '../../../../unitSdkManager/UnitSdkManager';
3
+ import { UnitSDK, UNEnvironment } from '../../unitSdkManager/UnitSdkManager';
4
+
5
+ // TODO: use apiClient class for handling requests.
4
6
 
5
7
  export const getMobileWalletPayload = async (customerToken: string, cardId: string, env: UNEnvironment) => {
6
8
  const headers = {
@@ -1,18 +1,6 @@
1
- export const webViewId = 'webViewContainer';
2
-
3
- export enum PresentationMode {
4
- /*
5
- CoverInjectedHeight - give id (<webViewId> param) to enable style injection to the root. Then cover the injected height.
6
-
7
- Inherit - inherit the parent size by style of 100 view height
1
+ import { PresentationMode } from '../../types/internal/webComponent.types';
8
2
 
9
- Default - return the unit component script
10
- */
11
-
12
- CoverInjectedHeight = 'coverInjectedHeight',
13
- Inherit = 'inherit',
14
- Default = 'deafult'
15
- }
3
+ export const webViewId = 'webViewContainer';
16
4
 
17
5
  export const getHtmlBody = (unitComponent: string, unitComponentProps?: string, presentationMode?: PresentationMode) => {
18
6
  const currentComponent = `<${unitComponent} ${unitComponentProps || ''} }> </${unitComponent}>`;
@@ -0,0 +1,43 @@
1
+ import type { RequestRenderingEvent } from '../../messages/webMessages/unitMessages';
2
+ import type { PresentationMode, WebComponentType } from './webComponent.types';
3
+
4
+ export enum BottomSheetRenderingType {
5
+ Slot,
6
+ WebComponent,
7
+ NativeComponent
8
+ }
9
+
10
+ export type BottomSheetSlotData = {
11
+ // The data that rendered by the web view
12
+ componentName?: WebComponentType,
13
+ componentResourceId?: string,
14
+ requestRenderingEvent: RequestRenderingEvent
15
+ }
16
+
17
+ export type WebComponentData = {
18
+ type: WebComponentType;
19
+ presentationMode?: PresentationMode,
20
+ params?: string;
21
+ theme?: string;
22
+ language?: string;
23
+ windowParams?: string;
24
+ }
25
+
26
+ export type NativeComponentData = {
27
+ component: React.ReactNode,
28
+ }
29
+
30
+ export interface SlotRendering {
31
+ type: BottomSheetRenderingType.Slot,
32
+ data: BottomSheetSlotData
33
+ }
34
+
35
+ export interface WebComponentRendering {
36
+ type: BottomSheetRenderingType.WebComponent,
37
+ data: WebComponentData
38
+ }
39
+
40
+ export interface NativeComponentRendering {
41
+ type: BottomSheetRenderingType.NativeComponent,
42
+ data: NativeComponentData
43
+ }
@@ -0,0 +1,26 @@
1
+ export enum WebComponentType {
2
+ card = 'unit-elements-card',
3
+ bookPayment = 'unit-elements-book-payment',
4
+ activity = 'unit-elements-activity',
5
+ slot = 'unit-elements-sdk-slot',
6
+ account = 'unit-elements-account',
7
+ checkDeposit = 'unit-elements-check-deposit',
8
+ achDebitPayment = 'unit-elements-ach-debit-payment',
9
+ achCreditPayment = 'unit-elements-ach-credit-payment',
10
+
11
+ cardAction = 'unit-elements-card-action',
12
+ }
13
+
14
+ export enum PresentationMode {
15
+ /*
16
+ CoverInjectedHeight - give id (<webViewId> param) to enable style injection to the root. Then cover the injected height.
17
+
18
+ Inherit - inherit the parent size by style of 100 view height
19
+
20
+ Default - return the unit component script
21
+ */
22
+
23
+ CoverInjectedHeight = 'coverInjectedHeight',
24
+ Inherit = 'inherit',
25
+ Default = 'deafult'
26
+ }
@@ -1,4 +1,4 @@
1
- import type { RESPONSE_KEYS } from '../messages/webMessages/onLoadMessage';
1
+ import type { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';
2
2
  import type { UNAccountData, UNCounterpartyAccountData } from './account.types';
3
3
  import type { UNAchCounterparty, UNCounterpartyVerificationMethod, UNPaymentStatus } from './payments.types';
4
4
  import type { UNTags, UNRelationship } from './types';
@@ -1,4 +1,4 @@
1
- import type { RESPONSE_KEYS } from '../messages/webMessages/onLoadMessage';
1
+ import type { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';
2
2
  import type { UNAuthorizationData } from './authorization.types';
3
3
  import type { UNTransactionData } from './transactions.types';
4
4
 
@@ -1,27 +1,37 @@
1
+ import type { NativeModules } from 'react-native';
1
2
  import EventBus from '../helpers/EventBus';
2
3
  import { SDKMessage } from '../messages/nativeMessages/sdkMessage';
3
4
  import { fetchUnitScript } from './UnitSdk.api';
5
+ import { UnitUiManager } from './unitUiManager/unitUiManager';
4
6
 
5
7
  export enum UNEnvironment {
6
8
  sandbox = 'sandbox',
7
9
  production = 'production'
8
10
  }
9
11
 
12
+ const UNIT_WEB_VERSION = '1';
13
+
10
14
  export const UNIT_SCRIPT_URL = {
11
- [UNEnvironment.sandbox]: 'https://ui.s.unit.sh/components.js',
12
- [UNEnvironment.production]: 'https://ui.unit.co/components.js'
15
+ [UNEnvironment.sandbox]: `https://ui.s.unit.sh/release/${UNIT_WEB_VERSION}/components.js`,
16
+ [UNEnvironment.production]: `https://ui.unit.co/release/${UNIT_WEB_VERSION}/components.js`
13
17
  };
14
18
  export class UnitSDK {
15
19
  protected static env?: UNEnvironment;
20
+ protected static customerToken?: string;
16
21
  protected static theme?: string;
17
22
  protected static language?: string;
23
+
18
24
  protected static signedNonce?: string;
25
+ protected static pushProvisionModule?: typeof NativeModules;
26
+
27
+ public static ui: UnitUiManager;
19
28
 
20
29
  public static init = async (env: UNEnvironment, theme?: string, language?: string) => {
21
30
  try {
22
31
  this.env = env;
23
32
  this.theme = theme;
24
33
  this.language = language;
34
+ this.ui = new UnitUiManager();
25
35
  await fetchUnitScript();
26
36
  EventBus.Instance.event(SDKMessage.IS_SDK_INITIALIZED, {});
27
37
  } catch (e) {
@@ -29,6 +39,14 @@ export class UnitSDK {
29
39
  }
30
40
  };
31
41
 
42
+ public static setPushProvisioningModule = (pushProvisionModule: typeof NativeModules) => {
43
+ this.pushProvisionModule = pushProvisionModule;
44
+ };
45
+
46
+ public static getPushProvisionModule = () => {
47
+ return this.pushProvisionModule;
48
+ };
49
+
32
50
  public static setSignedNonce = (signedNonce: string) => {
33
51
  this.signedNonce = signedNonce;
34
52
  };
@@ -48,4 +66,12 @@ export class UnitSDK {
48
66
  public static getSignedNonce = () => {
49
67
  return this.signedNonce;
50
68
  };
69
+
70
+ public static setCustomerToken = (customerToken: string) => {
71
+ this.customerToken = customerToken;
72
+ };
73
+
74
+ public static getCustomerToken = () => {
75
+ return this.customerToken;
76
+ };
51
77
  }
@@ -0,0 +1,13 @@
1
+ import { UNFlows } from '../../flows/UNFlows';
2
+
3
+ export class UnitUiManager {
4
+ public flows: UNFlows = new UNFlows();
5
+
6
+ constructor() {
7
+ this.init();
8
+ }
9
+
10
+ private init = () => {
11
+ this.flows = new UNFlows();
12
+ };
13
+ }
@@ -6,12 +6,13 @@ import EventBus from '../helpers/EventBus';
6
6
  import html, { HTML_PLACEHOLDER } from './html';
7
7
  import { RequestRefreshEvent, UnitMessage, RequestDownloadEvent } from '../messages/webMessages/unitMessages';
8
8
  import { useListenerToBus } from '../hooks/listenerToBus';
9
- import { getHtmlBody, PresentationMode } from '../scripts/html/bodyHtml';
9
+ import { getHtmlBody } from '../scripts/html/bodyHtml';
10
10
  import { fetchUnitScript, globalUnitScript } from '../unitSdkManager/UnitSdk.api';
11
11
  import { UnitSDK } from '../unitSdkManager/UnitSdkManager';
12
12
  import type { WebViewMessage } from '../messages/webMessages';
13
13
  import { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';
14
14
  import { handleRequestDownload } from './WebComponent.utils';
15
+ import type { PresentationMode, WebComponentType } from '../types/internal/webComponent.types';
15
16
 
16
17
  const { UNAppInfo } = NativeModules;
17
18
 
@@ -27,17 +28,7 @@ export interface WebComponentProps {
27
28
  nestedScrollEnabled?: boolean,
28
29
  handleScroll?: (event: any) => void,
29
30
  width?: number;
30
- }
31
-
32
- export enum WebComponentType {
33
- card = 'unit-elements-card',
34
- bookPayment = 'unit-elements-book-payment',
35
- activity = 'unit-elements-activity',
36
- slot = 'unit-elements-sdk-slot',
37
- account = 'unit-elements-account',
38
- checkDeposit = 'unit-elements-check-deposit',
39
- achDebitPayment = 'unit-elements-ach-debit-payment',
40
- achCreditPayment = 'unit-elements-ach-credit-payment'
31
+ windowParams?: string;
41
32
  }
42
33
 
43
34
  export const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props, webRef) {
@@ -92,8 +83,9 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
92
83
  const componentParams = (props.params || '') + themeParam + languageParam;
93
84
  let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));
94
85
  newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');
86
+ newHtml = newHtml.replace(HTML_PLACEHOLDER.WINDOW_PARAMS, props.windowParams || '');
95
87
  setSourceHtml(newHtml);
96
- }, [props.params, unitScript, props.presentationMode, componentCurrentTheme, componentCurrentLanguage, props.script]);
88
+ }, [props.params, unitScript, props.presentationMode, componentCurrentTheme, componentCurrentLanguage, props.script, props.windowParams]);
97
89
 
98
90
  const onMessage = (e: WebViewMessageEvent) => {
99
91
  const message = JSON.parse(e.nativeEvent.data) as WebViewMessage;
@@ -105,7 +97,7 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
105
97
  case UnitMessage.UNIT_REQUEST_DOWNLOAD:
106
98
  message.details &&
107
99
  handleRequestDownload(message.details as RequestDownloadEvent, () => {
108
- EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW);
100
+ EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW, {});
109
101
  });
110
102
  break;
111
103
  default:
@@ -139,7 +131,7 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
139
131
  onScroll={_onScroll}
140
132
  overScrollMode="never"
141
133
  injectedJavaScript={unitScript}
142
- style={{ width: width, flex: 1, opacity: 0.99, backgroundColor: "transparent" }}
134
+ style={{ width: width, flex: 1, opacity: 0.99, backgroundColor: 'transparent' }}
143
135
  source={{ html: sourceHtml, baseUrl: `https://${baseName}` }}
144
136
  onMessage={onMessage}
145
137
  androidHardwareAccelerationDisabled
@@ -4,7 +4,8 @@ import { DISPATCH_RENDERING_EVENT, LISTENERS, POST_MESSAGE_TO_SDK, POST_PAGE_HEI
4
4
  export const HTML_PLACEHOLDER = {
5
5
  SCRIPT_UNIT: '<SCRIPT_UNIT>',
6
6
  BODY: '<BODY_HTML_CODE>',
7
- SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>'
7
+ SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>',
8
+ WINDOW_PARAMS: '<WINDOW_PARAMS>'
8
9
  };
9
10
 
10
11
  const htmlText = `
@@ -19,6 +20,7 @@ const htmlText = `
19
20
  os: "${Platform.OS}",
20
21
  walletName: "${Platform.OS === 'ios' ? 'Apple' : 'Google'}",
21
22
  }
23
+ ${HTML_PLACEHOLDER.WINDOW_PARAMS}
22
24
  </script>
23
25
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
24
26
  </head>
@@ -1 +0,0 @@
1
- {"version":3,"names":["_UnitSdkManager","require","APIHeaders","AUTHORIZATION","CONTENT_TYPE","exports","UNIT_SECURE_URL","UNEnvironment","sandbox","production"],"sources":["UNNetworkConstants.ts"],"sourcesContent":["import { UNEnvironment } from '../../../../unitSdkManager/UnitSdkManager';\n\nexport const APIHeaders = {\n AUTHORIZATION: 'Authorization',\n CONTENT_TYPE: 'application/vnd.api+json',\n};\n\nexport const UNIT_SECURE_URL = {\n [UNEnvironment.sandbox]: 'https://secure.api.s.unit.sh',\n [UNEnvironment.production]: 'https://secure.api.unit.co'\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEO,MAAMC,UAAU,GAAG;EACxBC,aAAa,EAAE,eAAe;EAC9BC,YAAY,EAAE;AAChB,CAAC;AAACC,OAAA,CAAAH,UAAA,GAAAA,UAAA;AAEK,MAAMI,eAAe,GAAG;EAC7B,CAACC,6BAAa,CAACC,OAAO,GAAG,8BAA8B;EACvD,CAACD,6BAAa,CAACE,UAAU,GAAG;AAC9B,CAAC;AAACJ,OAAA,CAAAC,eAAA,GAAAA,eAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_axios","_interopRequireDefault","require","_UNNetworkConstants","_UnitSdkManager","obj","__esModule","default","getMobileWalletPayload","customerToken","cardId","env","headers","APIHeaders","CONTENT_TYPE","data","attributes","signedNonce","UnitSDK","getSignedNonce","baseURL","UNIT_SECURE_URL","response","axios","post","encryptedPayload","payload","error","Promise","reject","exports"],"sources":["UNWalletPayloadRequest.ts"],"sourcesContent":["import axios from 'axios';\nimport { APIHeaders, UNIT_SECURE_URL } from '../common/UNNetworkConstants';\nimport { UnitSDK, UNEnvironment } from '../../../../unitSdkManager/UnitSdkManager';\n\nexport const getMobileWalletPayload = async (customerToken: string, cardId: string, env: UNEnvironment) => {\n const headers = {\n 'Content-Type': APIHeaders.CONTENT_TYPE,\n 'Authorization': `Bearer ${customerToken}`,\n };\n\n const data = {\n data: {\n attributes: {\n signedNonce: UnitSDK.getSignedNonce(),\n },\n },\n };\n\n const baseURL = `${UNIT_SECURE_URL[env as keyof typeof UNEnvironment]}/cards/${cardId}/mobile-wallet-payload`;\n try {\n const response = await axios.post(\n baseURL,\n data,\n {\n headers: headers,\n });\n const encryptedPayload = response.data.data.attributes.payload;\n return encryptedPayload;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAAmF,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE5E,MAAMG,sBAAsB,GAAG,MAAAA,CAAOC,aAAqB,EAAEC,MAAc,EAAEC,GAAkB,KAAK;EACzG,MAAMC,OAAO,GAAG;IACd,cAAc,EAAEC,8BAAU,CAACC,YAAY;IACvC,eAAe,EAAG,UAASL,aAAc;EAC3C,CAAC;EAED,MAAMM,IAAI,GAAG;IACXA,IAAI,EAAE;MACJC,UAAU,EAAE;QACVC,WAAW,EAAEC,uBAAO,CAACC,cAAc;MACrC;IACF;EACF,CAAC;EAED,MAAMC,OAAO,GAAI,GAAEC,mCAAe,CAACV,GAAG,CAAgC,UAASD,MAAO,wBAAuB;EAC7G,IAAI;IACF,MAAMY,QAAQ,GAAG,MAAMC,cAAK,CAACC,IAAI,CAC/BJ,OAAO,EACPL,IAAI,EACJ;MACEH,OAAO,EAAEA;IACX,CAAC,CAAC;IACJ,MAAMa,gBAAgB,GAAGH,QAAQ,CAACP,IAAI,CAACA,IAAI,CAACC,UAAU,CAACU,OAAO;IAC9D,OAAOD,gBAAgB;EACzB,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAOC,OAAO,CAACC,MAAM,CAACF,KAAK,CAAC;EAC9B;AACF,CAAC;AAACG,OAAA,CAAAtB,sBAAA,GAAAA,sBAAA"}