react-native-unit-components 1.8.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) hide show
  1. package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsPackage.kt +9 -12
  2. package/android/src/main/java/com/unitreactnativecomponents/appInfo/UNAppInfoModule.kt +59 -0
  3. package/android/src/main/java/com/unitreactnativecomponents/extensions/ContextExtensions.kt +35 -0
  4. package/ios/Extensions/Bundle+Extensions.swift +23 -0
  5. package/ios/UNAppInfo/IOSAppInfo.swift +47 -0
  6. package/ios/UNAppInfo/UNAppInfoExportModule.m +5 -2
  7. package/ios/UnitReactNativeComponents.xcodeproj/project.pbxproj +34 -0
  8. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +6 -4
  9. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  10. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.utils.js +1 -0
  11. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.utils.js.map +1 -1
  12. package/lib/commonjs/components/UNACHCreditComponent/index.js +21 -0
  13. package/lib/commonjs/components/UNACHCreditComponent/index.js.map +1 -0
  14. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +6 -4
  15. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  16. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.utils.js +1 -0
  17. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.utils.js.map +1 -1
  18. package/lib/commonjs/components/UNACHDebitComponent/index.js +21 -0
  19. package/lib/commonjs/components/UNACHDebitComponent/index.js.map +1 -0
  20. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +21 -15
  21. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  22. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js +1 -1
  23. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
  24. package/lib/commonjs/components/UNAccountComponent/index.js +27 -0
  25. package/lib/commonjs/components/UNAccountComponent/index.js.map +1 -0
  26. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +17 -11
  27. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  28. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +4 -0
  29. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  30. package/lib/commonjs/components/UNActivityComponent/index.js +21 -0
  31. package/lib/commonjs/components/UNActivityComponent/index.js.map +1 -0
  32. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +4 -2
  33. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  34. package/lib/commonjs/components/UNBookPaymentComponent/index.js +21 -0
  35. package/lib/commonjs/components/UNBookPaymentComponent/index.js.map +1 -0
  36. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +29 -13
  37. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  38. package/lib/commonjs/components/UNBottomSheetComponent/components/{UNAddToWalletBottomSheetItem.js → UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js} +16 -11
  39. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js.map +1 -0
  40. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/index.js +17 -0
  41. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/index.js.map +1 -0
  42. package/lib/commonjs/components/UNBottomSheetComponent/components/index.js +17 -0
  43. package/lib/commonjs/components/UNBottomSheetComponent/components/index.js.map +1 -0
  44. package/lib/commonjs/components/UNBottomSheetComponent/index.js +14 -0
  45. package/lib/commonjs/components/UNBottomSheetComponent/index.js.map +1 -0
  46. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +34 -10
  47. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  48. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +9 -1
  49. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  50. package/lib/commonjs/components/UNCardComponent/index.js +27 -0
  51. package/lib/commonjs/components/UNCardComponent/index.js.map +1 -0
  52. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js +4 -2
  53. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -1
  54. package/lib/commonjs/components/UNCheckDepositComponent/index.js +21 -0
  55. package/lib/commonjs/components/UNCheckDepositComponent/index.js.map +1 -0
  56. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +86 -0
  57. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -0
  58. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +41 -0
  59. package/lib/commonjs/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -0
  60. package/lib/commonjs/components/UNMultipleCardsComponent/index.js +21 -0
  61. package/lib/commonjs/components/UNMultipleCardsComponent/index.js.map +1 -0
  62. package/lib/commonjs/components/index.js +19 -8
  63. package/lib/commonjs/components/index.js.map +1 -1
  64. package/lib/commonjs/flows/card/UNCardFlows.js +8 -4
  65. package/lib/commonjs/flows/card/UNCardFlows.js.map +1 -1
  66. package/lib/commonjs/helpers/pushProvisioningService/helpers.js +34 -0
  67. package/lib/commonjs/helpers/pushProvisioningService/helpers.js.map +1 -0
  68. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js +49 -3
  69. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  70. package/lib/commonjs/helpers/pushProvisioningService/hooks/useLaunchInitialize.js +33 -0
  71. package/lib/commonjs/helpers/pushProvisioningService/hooks/useLaunchInitialize.js.map +1 -0
  72. package/lib/commonjs/helpers/pushProvisioningService/types.js +41 -0
  73. package/lib/commonjs/helpers/pushProvisioningService/types.js.map +1 -0
  74. package/lib/commonjs/helpers/store/helpers.js +29 -0
  75. package/lib/commonjs/helpers/store/helpers.js.map +1 -0
  76. package/lib/commonjs/hooks/useListenerToEvent.js +26 -0
  77. package/lib/commonjs/hooks/useListenerToEvent.js.map +1 -0
  78. package/lib/commonjs/messages/webMessages/index.js.map +1 -1
  79. package/lib/commonjs/messages/webMessages/multipleCardsMessage.js +12 -0
  80. package/lib/commonjs/messages/webMessages/multipleCardsMessage.js.map +1 -0
  81. package/lib/commonjs/messages/webMessages/onLoadMessage.js +2 -1
  82. package/lib/commonjs/messages/webMessages/onLoadMessage.js.map +1 -1
  83. package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js +30 -6
  84. package/lib/commonjs/networking/requests/UNWalletPayloadRequest.js.map +1 -1
  85. package/lib/commonjs/scripts/html/bodyScript.js +13 -1
  86. package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
  87. package/lib/commonjs/slices/ConfigurationSlice.js +36 -0
  88. package/lib/commonjs/slices/ConfigurationSlice.js.map +1 -0
  89. package/lib/commonjs/slices/SharedEventsSlice.js +28 -0
  90. package/lib/commonjs/slices/SharedEventsSlice.js.map +1 -0
  91. package/lib/commonjs/slices/pushProvisioningSlice.js +28 -0
  92. package/lib/commonjs/slices/pushProvisioningSlice.js.map +1 -0
  93. package/lib/commonjs/store/index.js +17 -0
  94. package/lib/commonjs/store/index.js.map +1 -0
  95. package/lib/commonjs/store/store.js +20 -0
  96. package/lib/commonjs/store/store.js.map +1 -0
  97. package/lib/commonjs/types/internal/errorHelpers.js +20 -0
  98. package/lib/commonjs/types/internal/errorHelpers.js.map +1 -0
  99. package/lib/commonjs/types/internal/webComponent.types.js +1 -0
  100. package/lib/commonjs/types/internal/webComponent.types.js.map +1 -1
  101. package/lib/commonjs/types/shared/activity.types.js +7 -0
  102. package/lib/commonjs/types/shared/activity.types.js.map +1 -1
  103. package/lib/commonjs/types/shared/error.types.js +29 -0
  104. package/lib/commonjs/types/shared/error.types.js.map +1 -0
  105. package/lib/commonjs/types/shared/index.js +33 -0
  106. package/lib/commonjs/types/shared/index.js.map +1 -1
  107. package/lib/commonjs/types/shared/multipleCards.types.js +13 -0
  108. package/lib/commonjs/types/shared/multipleCards.types.js.map +1 -0
  109. package/lib/commonjs/types/shared/onLoadResponse.types.js +4 -0
  110. package/lib/commonjs/types/shared/onLoadResponse.types.js.map +1 -1
  111. package/lib/commonjs/types/shared/versioning.types.js +14 -0
  112. package/lib/commonjs/types/shared/versioning.types.js.map +1 -0
  113. package/lib/commonjs/unitSdkManager/UnitSdk.api.js +9 -14
  114. package/lib/commonjs/unitSdkManager/UnitSdk.api.js.map +1 -1
  115. package/lib/commonjs/unitSdkManager/UnitSdk.constants.js +17 -0
  116. package/lib/commonjs/unitSdkManager/UnitSdk.constants.js.map +1 -0
  117. package/lib/commonjs/unitSdkManager/UnitSdkManager.js +21 -22
  118. package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
  119. package/lib/commonjs/unitSdkManager/UnitSdkManager.utils.internal.js +19 -0
  120. package/lib/commonjs/unitSdkManager/UnitSdkManager.utils.internal.js.map +1 -0
  121. package/lib/commonjs/utils/AppInfo.js +49 -0
  122. package/lib/commonjs/utils/AppInfo.js.map +1 -0
  123. package/lib/commonjs/utils/SDKInfo.js +13 -0
  124. package/lib/commonjs/utils/SDKInfo.js.map +1 -0
  125. package/lib/commonjs/utils/webVersioningStrategy.utils.js +58 -0
  126. package/lib/commonjs/utils/webVersioningStrategy.utils.js.map +1 -0
  127. package/lib/commonjs/webComponent/WebComponent.js +30 -32
  128. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  129. package/lib/commonjs/webComponent/WebComponent.utils.js +19 -1
  130. package/lib/commonjs/webComponent/WebComponent.utils.js.map +1 -1
  131. package/lib/commonjs/webComponent/html.js +4 -0
  132. package/lib/commonjs/webComponent/html.js.map +1 -1
  133. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +5 -3
  134. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  135. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.utils.js +1 -0
  136. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.utils.js.map +1 -1
  137. package/lib/module/components/UNACHCreditComponent/index.js +2 -0
  138. package/lib/module/components/UNACHCreditComponent/index.js.map +1 -0
  139. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +5 -3
  140. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  141. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.utils.js +1 -0
  142. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.utils.js.map +1 -1
  143. package/lib/module/components/UNACHDebitComponent/index.js +2 -0
  144. package/lib/module/components/UNACHDebitComponent/index.js.map +1 -0
  145. package/lib/module/components/UNAccountComponent/UNAccountComponent.js +19 -12
  146. package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  147. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js +2 -2
  148. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
  149. package/lib/module/components/UNAccountComponent/index.js +2 -0
  150. package/lib/module/components/UNAccountComponent/index.js.map +1 -0
  151. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +16 -9
  152. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  153. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +4 -0
  154. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  155. package/lib/module/components/UNActivityComponent/index.js +2 -0
  156. package/lib/module/components/UNActivityComponent/index.js.map +1 -0
  157. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +3 -1
  158. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  159. package/lib/module/components/UNBookPaymentComponent/index.js +2 -0
  160. package/lib/module/components/UNBookPaymentComponent/index.js.map +1 -0
  161. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +29 -13
  162. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  163. package/lib/module/components/UNBottomSheetComponent/components/{UNAddToWalletBottomSheetItem.js → UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js} +16 -11
  164. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.js.map +1 -0
  165. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/index.js +2 -0
  166. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/index.js.map +1 -0
  167. package/lib/module/components/UNBottomSheetComponent/components/index.js +2 -0
  168. package/lib/module/components/UNBottomSheetComponent/components/index.js.map +1 -0
  169. package/lib/module/components/UNBottomSheetComponent/index.js +2 -0
  170. package/lib/module/components/UNBottomSheetComponent/index.js.map +1 -0
  171. package/lib/module/components/UNCardComponent/UNCardComponent.js +34 -9
  172. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  173. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +6 -0
  174. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  175. package/lib/module/components/UNCardComponent/index.js +2 -0
  176. package/lib/module/components/UNCardComponent/index.js.map +1 -0
  177. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js +3 -1
  178. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -1
  179. package/lib/module/components/UNCheckDepositComponent/index.js +2 -0
  180. package/lib/module/components/UNCheckDepositComponent/index.js.map +1 -0
  181. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js +77 -0
  182. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.js.map +1 -0
  183. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js +33 -0
  184. package/lib/module/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.js.map +1 -0
  185. package/lib/module/components/UNMultipleCardsComponent/index.js +2 -0
  186. package/lib/module/components/UNMultipleCardsComponent/index.js.map +1 -0
  187. package/lib/module/components/index.js +9 -8
  188. package/lib/module/components/index.js.map +1 -1
  189. package/lib/module/flows/card/UNCardFlows.js +8 -3
  190. package/lib/module/flows/card/UNCardFlows.js.map +1 -1
  191. package/lib/module/helpers/pushProvisioningService/helpers.js +24 -0
  192. package/lib/module/helpers/pushProvisioningService/helpers.js.map +1 -0
  193. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js +50 -4
  194. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  195. package/lib/module/helpers/pushProvisioningService/hooks/useLaunchInitialize.js +26 -0
  196. package/lib/module/helpers/pushProvisioningService/hooks/useLaunchInitialize.js.map +1 -0
  197. package/lib/module/helpers/pushProvisioningService/types.js +34 -0
  198. package/lib/module/helpers/pushProvisioningService/types.js.map +1 -0
  199. package/lib/module/helpers/store/helpers.js +20 -0
  200. package/lib/module/helpers/store/helpers.js.map +1 -0
  201. package/lib/module/hooks/useListenerToEvent.js +19 -0
  202. package/lib/module/hooks/useListenerToEvent.js.map +1 -0
  203. package/lib/module/messages/webMessages/index.js.map +1 -1
  204. package/lib/module/messages/webMessages/multipleCardsMessage.js +5 -0
  205. package/lib/module/messages/webMessages/multipleCardsMessage.js.map +1 -0
  206. package/lib/module/messages/webMessages/onLoadMessage.js +2 -1
  207. package/lib/module/messages/webMessages/onLoadMessage.js.map +1 -1
  208. package/lib/module/networking/requests/UNWalletPayloadRequest.js +29 -6
  209. package/lib/module/networking/requests/UNWalletPayloadRequest.js.map +1 -1
  210. package/lib/module/scripts/html/bodyScript.js +10 -0
  211. package/lib/module/scripts/html/bodyScript.js.map +1 -1
  212. package/lib/module/slices/ConfigurationSlice.js +25 -0
  213. package/lib/module/slices/ConfigurationSlice.js.map +1 -0
  214. package/lib/module/slices/SharedEventsSlice.js +19 -0
  215. package/lib/module/slices/SharedEventsSlice.js.map +1 -0
  216. package/lib/module/slices/pushProvisioningSlice.js +19 -0
  217. package/lib/module/slices/pushProvisioningSlice.js.map +1 -0
  218. package/lib/module/store/index.js +2 -0
  219. package/lib/module/store/index.js.map +1 -0
  220. package/lib/module/store/store.js +12 -0
  221. package/lib/module/store/store.js.map +1 -0
  222. package/lib/module/types/internal/errorHelpers.js +12 -0
  223. package/lib/module/types/internal/errorHelpers.js.map +1 -0
  224. package/lib/module/types/internal/webComponent.types.js +1 -0
  225. package/lib/module/types/internal/webComponent.types.js.map +1 -1
  226. package/lib/module/types/shared/activity.types.js +5 -1
  227. package/lib/module/types/shared/activity.types.js.map +1 -1
  228. package/lib/module/types/shared/error.types.js +22 -0
  229. package/lib/module/types/shared/error.types.js.map +1 -0
  230. package/lib/module/types/shared/index.js +3 -0
  231. package/lib/module/types/shared/index.js.map +1 -1
  232. package/lib/module/types/shared/multipleCards.types.js +6 -0
  233. package/lib/module/types/shared/multipleCards.types.js.map +1 -0
  234. package/lib/module/types/shared/onLoadResponse.types.js +1 -1
  235. package/lib/module/types/shared/onLoadResponse.types.js.map +1 -1
  236. package/lib/module/types/shared/versioning.types.js +7 -0
  237. package/lib/module/types/shared/versioning.types.js.map +1 -0
  238. package/lib/module/unitSdkManager/UnitSdk.api.js +9 -12
  239. package/lib/module/unitSdkManager/UnitSdk.api.js.map +1 -1
  240. package/lib/module/unitSdkManager/UnitSdk.constants.js +10 -0
  241. package/lib/module/unitSdkManager/UnitSdk.constants.js.map +1 -0
  242. package/lib/module/unitSdkManager/UnitSdkManager.js +20 -19
  243. package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
  244. package/lib/module/unitSdkManager/UnitSdkManager.utils.internal.js +12 -0
  245. package/lib/module/unitSdkManager/UnitSdkManager.utils.internal.js.map +1 -0
  246. package/lib/module/utils/AppInfo.js +39 -0
  247. package/lib/module/utils/AppInfo.js.map +1 -0
  248. package/lib/module/utils/SDKInfo.js +5 -0
  249. package/lib/module/utils/SDKInfo.js.map +1 -0
  250. package/lib/module/utils/webVersioningStrategy.utils.js +48 -0
  251. package/lib/module/utils/webVersioningStrategy.utils.js.map +1 -0
  252. package/lib/module/webComponent/WebComponent.js +33 -34
  253. package/lib/module/webComponent/WebComponent.js.map +1 -1
  254. package/lib/module/webComponent/WebComponent.utils.js +15 -0
  255. package/lib/module/webComponent/WebComponent.utils.js.map +1 -1
  256. package/lib/module/webComponent/html.js +5 -1
  257. package/lib/module/webComponent/html.js.map +1 -1
  258. package/lib/typescript/{components → src/components}/UNACHCreditComponent/UNACHCreditComponent.d.ts +3 -1
  259. package/lib/typescript/src/components/UNACHCreditComponent/index.d.ts +1 -0
  260. package/lib/typescript/{components → src/components}/UNACHDebitComponent/UNACHDebitComponent.d.ts +3 -1
  261. package/lib/typescript/src/components/UNACHDebitComponent/index.d.ts +1 -0
  262. package/lib/typescript/{components → src/components}/UNAccountComponent/UNAccountComponent.d.ts +3 -2
  263. package/lib/typescript/{components → src/components}/UNAccountComponent/UNAccountComponent.utils.d.ts +2 -2
  264. package/lib/typescript/src/components/UNAccountComponent/index.d.ts +1 -0
  265. package/lib/typescript/{components → src/components}/UNActivityComponent/UNActivityComponent.d.ts +5 -1
  266. package/lib/typescript/src/components/UNActivityComponent/index.d.ts +1 -0
  267. package/lib/typescript/{components → src/components}/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +2 -1
  268. package/lib/typescript/src/components/UNBookPaymentComponent/index.d.ts +1 -0
  269. package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +2 -1
  270. package/lib/typescript/{components/UNBottomSheetComponent/components → src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem}/UNAddToWalletBottomSheetItem.d.ts +2 -2
  271. package/lib/typescript/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/index.d.ts +1 -0
  272. package/lib/typescript/src/components/UNBottomSheetComponent/components/index.d.ts +1 -0
  273. package/lib/typescript/src/components/UNBottomSheetComponent/index.d.ts +1 -0
  274. package/lib/typescript/{components → src/components}/UNCardComponent/UNCardComponent.d.ts +4 -1
  275. package/lib/typescript/{components → src/components}/UNCardComponent/UNCardComponent.utils.d.ts +2 -0
  276. package/lib/typescript/src/components/UNCardComponent/index.d.ts +1 -0
  277. package/lib/typescript/{components → src/components}/UNCheckDepositComponent/UNCheckDepositComponent.d.ts +2 -1
  278. package/lib/typescript/src/components/UNCheckDepositComponent/index.d.ts +1 -0
  279. package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.d.ts +15 -0
  280. package/lib/typescript/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.d.ts +3 -0
  281. package/lib/typescript/src/components/UNMultipleCardsComponent/index.d.ts +1 -0
  282. package/lib/typescript/src/components/index.d.ts +9 -0
  283. package/lib/typescript/src/helpers/pushProvisioningService/helpers.d.ts +4 -0
  284. package/lib/typescript/src/helpers/pushProvisioningService/hooks/useLaunchInitialize.d.ts +3 -0
  285. package/lib/typescript/src/helpers/pushProvisioningService/types.d.ts +49 -0
  286. package/lib/typescript/src/helpers/store/helpers.d.ts +3 -0
  287. package/lib/typescript/src/hooks/useListenerToEvent.d.ts +9 -0
  288. package/lib/typescript/{messages → src/messages}/webMessages/index.d.ts +3 -2
  289. package/lib/typescript/src/messages/webMessages/multipleCardsMessage.d.ts +6 -0
  290. package/lib/typescript/{messages → src/messages}/webMessages/onLoadMessage.d.ts +7 -3
  291. package/lib/typescript/src/networking/requests/UNWalletPayloadRequest.d.ts +2 -0
  292. package/lib/typescript/{scripts → src/scripts}/html/bodyScript.d.ts +2 -0
  293. package/lib/typescript/src/slices/ConfigurationSlice.d.ts +10 -0
  294. package/lib/typescript/src/slices/SharedEventsSlice.d.ts +56 -0
  295. package/lib/typescript/src/slices/pushProvisioningSlice.d.ts +8 -0
  296. package/lib/typescript/src/store/index.d.ts +1 -0
  297. package/lib/typescript/src/store/store.d.ts +76 -0
  298. package/lib/typescript/src/types/internal/errorHelpers.d.ts +4 -0
  299. package/lib/typescript/{types → src/types}/internal/webComponent.types.d.ts +1 -0
  300. package/lib/typescript/{types → src/types}/shared/activity.types.d.ts +5 -1
  301. package/lib/typescript/src/types/shared/error.types.d.ts +36 -0
  302. package/lib/typescript/{types → src/types}/shared/index.d.ts +3 -0
  303. package/lib/typescript/src/types/shared/multipleCards.types.d.ts +6 -0
  304. package/lib/typescript/src/types/shared/onLoadResponse.types.d.ts +5 -0
  305. package/lib/typescript/src/types/shared/versioning.types.d.ts +22 -0
  306. package/lib/typescript/src/unitSdkManager/UnitSdk.api.d.ts +1 -0
  307. package/lib/typescript/src/unitSdkManager/UnitSdk.constants.d.ts +8 -0
  308. package/lib/typescript/{unitSdkManager → src/unitSdkManager}/UnitSdkManager.d.ts +11 -10
  309. package/lib/typescript/src/unitSdkManager/UnitSdkManager.utils.internal.d.ts +3 -0
  310. package/lib/typescript/src/utils/AppInfo.d.ts +4 -0
  311. package/lib/typescript/src/utils/SDKInfo.d.ts +1 -0
  312. package/lib/typescript/src/utils/webVersioningStrategy.utils.d.ts +5 -0
  313. package/lib/typescript/{webComponent → src/webComponent}/WebComponent.utils.d.ts +3 -0
  314. package/package.json +8 -6
  315. package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +7 -3
  316. package/src/components/UNACHCreditComponent/UNACHCreditComponent.utils.ts +1 -0
  317. package/src/components/UNACHCreditComponent/index.ts +1 -0
  318. package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +7 -3
  319. package/src/components/UNACHDebitComponent/UNACHDebitComponent.utils.ts +1 -0
  320. package/src/components/UNACHDebitComponent/index.ts +1 -0
  321. package/src/components/UNAccountComponent/UNAccountComponent.tsx +30 -14
  322. package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +2 -2
  323. package/src/components/UNAccountComponent/index.ts +1 -0
  324. package/src/components/UNActivityComponent/UNActivityComponent.tsx +37 -17
  325. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +4 -1
  326. package/src/components/UNActivityComponent/index.ts +1 -0
  327. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +4 -1
  328. package/src/components/UNBookPaymentComponent/index.ts +1 -0
  329. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +59 -32
  330. package/src/components/UNBottomSheetComponent/components/{UNAddToWalletBottomSheetItem.tsx → UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.tsx} +18 -13
  331. package/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem/index.ts +1 -0
  332. package/src/components/UNBottomSheetComponent/components/index.ts +1 -0
  333. package/src/components/UNBottomSheetComponent/index.ts +1 -0
  334. package/src/components/UNCardComponent/UNCardComponent.tsx +51 -14
  335. package/src/components/UNCardComponent/UNCardComponent.utils.ts +7 -0
  336. package/src/components/UNCardComponent/index.ts +1 -0
  337. package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.tsx +4 -1
  338. package/src/components/UNCheckDepositComponent/index.ts +1 -0
  339. package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.tsx +119 -0
  340. package/src/components/UNMultipleCardsComponent/UNMultipleCardsComponent.utils.ts +36 -0
  341. package/src/components/UNMultipleCardsComponent/index.ts +3 -0
  342. package/src/components/index.ts +9 -8
  343. package/src/flows/card/UNCardFlows.ts +10 -4
  344. package/src/helpers/pushProvisioningService/helpers.ts +31 -0
  345. package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +46 -7
  346. package/src/helpers/pushProvisioningService/hooks/useLaunchInitialize.ts +29 -0
  347. package/src/helpers/pushProvisioningService/types.ts +52 -0
  348. package/src/helpers/store/helpers.tsx +22 -0
  349. package/src/hooks/useListenerToEvent.ts +32 -0
  350. package/src/messages/webMessages/index.ts +3 -0
  351. package/src/messages/webMessages/multipleCardsMessage.ts +9 -0
  352. package/src/messages/webMessages/onLoadMessage.ts +14 -3
  353. package/src/networking/requests/UNWalletPayloadRequest.ts +30 -7
  354. package/src/scripts/html/bodyScript.ts +13 -1
  355. package/src/slices/ConfigurationSlice.ts +31 -0
  356. package/src/slices/SharedEventsSlice.ts +93 -0
  357. package/src/slices/pushProvisioningSlice.ts +24 -0
  358. package/src/store/index.ts +1 -0
  359. package/src/store/store.ts +14 -0
  360. package/src/types/internal/errorHelpers.ts +22 -0
  361. package/src/types/internal/webComponent.types.ts +1 -1
  362. package/src/types/shared/activity.types.ts +6 -1
  363. package/src/types/shared/error.types.ts +38 -0
  364. package/src/types/shared/index.ts +3 -0
  365. package/src/types/shared/multipleCards.types.ts +8 -0
  366. package/src/types/shared/onLoadResponse.types.ts +2 -12
  367. package/src/types/shared/versioning.types.ts +28 -0
  368. package/src/unitSdkManager/UnitSdk.api.ts +10 -10
  369. package/src/unitSdkManager/UnitSdk.constants.ts +11 -0
  370. package/src/unitSdkManager/UnitSdkManager.ts +21 -24
  371. package/src/unitSdkManager/UnitSdkManager.utils.internal.ts +13 -0
  372. package/src/utils/AppInfo.ts +40 -0
  373. package/src/utils/SDKInfo.ts +5 -0
  374. package/src/utils/webVersioningStrategy.utils.ts +52 -0
  375. package/src/webComponent/WebComponent.tsx +37 -34
  376. package/src/webComponent/WebComponent.utils.ts +17 -0
  377. package/src/webComponent/html.ts +16 -2
  378. package/android/src/main/java/com/unitreactnativecomponents/getapplicationid/UNAppInfoModule.kt +0 -35
  379. package/ios/UNAppInfo/UNAppInfo.swift +0 -23
  380. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +0 -1
  381. package/lib/commonjs/components/utils/nativeModulesInfo.js +0 -20
  382. package/lib/commonjs/components/utils/nativeModulesInfo.js.map +0 -1
  383. package/lib/commonjs/helpers/EventBus.js +0 -58
  384. package/lib/commonjs/helpers/EventBus.js.map +0 -1
  385. package/lib/commonjs/hooks/listenerToBus.js +0 -34
  386. package/lib/commonjs/hooks/listenerToBus.js.map +0 -1
  387. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +0 -1
  388. package/lib/module/components/utils/nativeModulesInfo.js +0 -13
  389. package/lib/module/components/utils/nativeModulesInfo.js.map +0 -1
  390. package/lib/module/helpers/EventBus.js +0 -51
  391. package/lib/module/helpers/EventBus.js.map +0 -1
  392. package/lib/module/hooks/listenerToBus.js +0 -25
  393. package/lib/module/hooks/listenerToBus.js.map +0 -1
  394. package/lib/typescript/components/index.d.ts +0 -8
  395. package/lib/typescript/components/utils/nativeModulesInfo.d.ts +0 -1
  396. package/lib/typescript/helpers/EventBus.d.ts +0 -13
  397. package/lib/typescript/hooks/listenerToBus.d.ts +0 -7
  398. package/lib/typescript/networking/requests/UNWalletPayloadRequest.d.ts +0 -2
  399. package/lib/typescript/types/shared/onLoadResponse.types.d.ts +0 -14
  400. package/lib/typescript/unitSdkManager/UnitSdk.api.d.ts +0 -3
  401. package/src/components/utils/nativeModulesInfo.ts +0 -11
  402. package/src/helpers/EventBus.ts +0 -58
  403. package/src/hooks/listenerToBus.ts +0 -31
  404. /package/lib/commonjs/components/UNBottomSheetComponent/components/{UNAddToWalletBottomSheetItem.styles.js → UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.styles.js} +0 -0
  405. /package/lib/commonjs/components/UNBottomSheetComponent/components/{UNAddToWalletBottomSheetItem.styles.js.map → UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.styles.js.map} +0 -0
  406. /package/lib/module/components/UNBottomSheetComponent/components/{UNAddToWalletBottomSheetItem.styles.js → UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.styles.js} +0 -0
  407. /package/lib/module/components/UNBottomSheetComponent/components/{UNAddToWalletBottomSheetItem.styles.js.map → UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.styles.js.map} +0 -0
  408. /package/lib/typescript/{assets → src/assets}/images/index.d.ts +0 -0
  409. /package/lib/typescript/{components → src/components}/UNACHCreditComponent/UNACHCreditComponent.utils.d.ts +0 -0
  410. /package/lib/typescript/{components → src/components}/UNACHDebitComponent/UNACHDebitComponent.utils.d.ts +0 -0
  411. /package/lib/typescript/{components → src/components}/UNActivityComponent/UNActivityComponent.utils.d.ts +0 -0
  412. /package/lib/typescript/{components → src/components}/UNBookPaymentComponent/UNBookPaymentComponent.utils.d.ts +0 -0
  413. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +0 -0
  414. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.styles.d.ts +0 -0
  415. /package/lib/typescript/{components → src/components}/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +0 -0
  416. /package/lib/typescript/{components/UNBottomSheetComponent/components → src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem}/UNAddToWalletBottomSheetItem.styles.d.ts +0 -0
  417. /package/lib/typescript/{components → src/components}/UNCheckDepositComponent/UNCheckDepositComponent.utils.d.ts +0 -0
  418. /package/lib/typescript/{flows → src/flows}/UNFlows.d.ts +0 -0
  419. /package/lib/typescript/{flows → src/flows}/card/UNCardFlows.d.ts +0 -0
  420. /package/lib/typescript/{helpers → src/helpers}/BottomSheet/BottomSheet.d.ts +0 -0
  421. /package/lib/typescript/{helpers → src/helpers}/BottomSheet/BottomSheet.styles.d.ts +0 -0
  422. /package/lib/typescript/{helpers → src/helpers}/pushProvisioningService/hooks/useCardWallet.d.ts +0 -0
  423. /package/lib/typescript/{helpers → src/helpers}/pushProvisioningService/startProvisioning.d.ts +0 -0
  424. /package/lib/typescript/{hooks → src/hooks}/useAppStateListener.d.ts +0 -0
  425. /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
  426. /package/lib/typescript/{messages → src/messages}/nativeMessages/bottomSheetMessage.d.ts +0 -0
  427. /package/lib/typescript/{messages → src/messages}/nativeMessages/cardMessage.d.ts +0 -0
  428. /package/lib/typescript/{messages → src/messages}/nativeMessages/index.d.ts +0 -0
  429. /package/lib/typescript/{messages → src/messages}/nativeMessages/sdkMessage.d.ts +0 -0
  430. /package/lib/typescript/{messages → src/messages}/webMessages/accountMessage.d.ts +0 -0
  431. /package/lib/typescript/{messages → src/messages}/webMessages/achCreditMessage.d.ts +0 -0
  432. /package/lib/typescript/{messages → src/messages}/webMessages/activityMessage.d.ts +0 -0
  433. /package/lib/typescript/{messages → src/messages}/webMessages/bookPaymentMessage.d.ts +0 -0
  434. /package/lib/typescript/{messages → src/messages}/webMessages/cardMessage.d.ts +0 -0
  435. /package/lib/typescript/{messages → src/messages}/webMessages/checkMessage.d.ts +0 -0
  436. /package/lib/typescript/{messages → src/messages}/webMessages/pageMessage.d.ts +0 -0
  437. /package/lib/typescript/{messages → src/messages}/webMessages/paymentsMessage.d.ts +0 -0
  438. /package/lib/typescript/{messages → src/messages}/webMessages/unitMessages.d.ts +0 -0
  439. /package/lib/typescript/{nativeComponent → src/nativeComponent}/UnitAddToWalletButton.d.ts +0 -0
  440. /package/lib/typescript/{networking → src/networking}/common/UNNetworkConstants.d.ts +0 -0
  441. /package/lib/typescript/{scripts → src/scripts}/html/bodyHtml.d.ts +0 -0
  442. /package/lib/typescript/{scripts → src/scripts}/html/fontFaces.d.ts +0 -0
  443. /package/lib/typescript/{styles → src/styles}/fonts.d.ts +0 -0
  444. /package/lib/typescript/{styles → src/styles}/variables.d.ts +0 -0
  445. /package/lib/typescript/{types → src/types}/internal/bottomSheet.types.d.ts +0 -0
  446. /package/lib/typescript/{types → src/types}/shared/account.types.d.ts +0 -0
  447. /package/lib/typescript/{types → src/types}/shared/achCredit.types.d.ts +0 -0
  448. /package/lib/typescript/{types → src/types}/shared/authorization.types.d.ts +0 -0
  449. /package/lib/typescript/{types → src/types}/shared/bookPayment.types.d.ts +0 -0
  450. /package/lib/typescript/{types → src/types}/shared/card.types.d.ts +0 -0
  451. /package/lib/typescript/{types → src/types}/shared/checkDeposit.types.d.ts +0 -0
  452. /package/lib/typescript/{types → src/types}/shared/fonts.types.d.ts +0 -0
  453. /package/lib/typescript/{types → src/types}/shared/payments.types.d.ts +0 -0
  454. /package/lib/typescript/{types → src/types}/shared/transactions.types.d.ts +0 -0
  455. /package/lib/typescript/{types → src/types}/shared/types.d.ts +0 -0
  456. /package/lib/typescript/{types → src/types}/shared/wallet.types.d.ts +0 -0
  457. /package/lib/typescript/{unitSdkManager → src/unitSdkManager}/unitUiManager/unitUiManager.d.ts +0 -0
  458. /package/lib/typescript/{webComponent → src/webComponent}/WebComponent.d.ts +0 -0
  459. /package/lib/typescript/{webComponent → src/webComponent}/html.d.ts +0 -0
  460. /package/src/components/UNBottomSheetComponent/components/{UNAddToWalletBottomSheetItem.styles.ts → UNAddToWalletBottomSheetItem/UNAddToWalletBottomSheetItem.styles.ts} +0 -0
@@ -8,10 +8,12 @@ import type { UnitEvent, UnitMessage } from './unitMessages';
8
8
  import type { AccountEvent, AccountMessage } from './accountMessage';
9
9
  import type { CheckEvent, CheckMessage } from './checkMessage';
10
10
  import type { ActivityEvent, ActivityMessage } from './activityMessage';
11
+ import type { MultipleCardsEvent, MultipleCardsMessage } from './multipleCardsMessage';
11
12
 
12
13
  export type WebViewMessageType =
13
14
  | PageMessage
14
15
  | CardMessage
16
+ | MultipleCardsMessage
15
17
  | UnitMessage
16
18
  | PaymentMessage
17
19
  | AccountMessage
@@ -22,6 +24,7 @@ type WebViewEvent =
22
24
  | PageEvent
23
25
  | UnitEvent
24
26
  | CardEvent
27
+ | MultipleCardsEvent
25
28
  | BookPaymentEvent
26
29
  | PaymentMessage
27
30
  | ACHEvent
@@ -0,0 +1,9 @@
1
+ import type { UNCardData } from '../../types/shared';
2
+
3
+ export enum MultipleCardsMessage {
4
+ UNIT_MULTIPLE_CARDS_CARD_CLICKED = 'unitMultipleCardsCardClicked',
5
+ }
6
+
7
+ export type MultipleCardsCardClickedEvent = UNCardData;
8
+
9
+ export type MultipleCardsEvent = MultipleCardsCardClickedEvent
@@ -1,16 +1,26 @@
1
- import type {UNAccountData, UNCounterpartyAccountData, UNCardData, UNError, UNOnLoadResponseData } from '../../types/shared';
1
+ import type {
2
+ UNAccountData,
3
+ UNCounterpartyAccountData,
4
+ UNCardData,
5
+ UNError,
6
+ UNOnLoadResponseData,
7
+ } from '../../types/shared';
2
8
  import type { UNAuthorizationData } from '../../types/shared/authorization.types';
3
9
  import type { UNTransactionData } from '../../types/shared/transactions.types';
4
10
 
5
11
  export enum RESPONSE_KEYS {
6
12
  errors = 'errors',
7
13
  card = 'cardResult',
14
+ cards = 'cardsResult',
8
15
  account = 'accountResult',
9
16
  counterpartyAccount = 'counterpartyResult',
10
17
  transactions = 'transactionsResult',
11
- authorization = 'authorizationResult'
18
+ authorizations = 'authorizationsResult'
12
19
  }
13
20
 
21
+ export type CardsOnLoadResponse = {
22
+ [RESPONSE_KEYS.cards]: UNOnLoadResponseData<[UNCardData]>
23
+ }
14
24
  export type CardOnLoadResponse = {
15
25
  [RESPONSE_KEYS.card]: UNOnLoadResponseData<UNCardData>
16
26
  }
@@ -29,12 +39,13 @@ export type ACHOnLoadResponse = {
29
39
  }
30
40
 
31
41
  export type ActivityOnLoadResponse = {
32
- [RESPONSE_KEYS.authorization]: UNOnLoadResponseData<UNAuthorizationData>,
42
+ [RESPONSE_KEYS.authorizations]: UNOnLoadResponseData<UNAuthorizationData>,
33
43
  [RESPONSE_KEYS.transactions]: UNOnLoadResponseData<UNTransactionData>
34
44
  }
35
45
 
36
46
  export type UnitOnLoadResponseSuccessData =
37
47
  | CardOnLoadResponse
48
+ | CardsOnLoadResponse
38
49
  | ACHOnLoadResponse
39
50
  | AccountsOnLoadResponse
40
51
  | AccountOnLoadResponse
@@ -1,10 +1,20 @@
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 type { UNEnvironment } from '../../unitSdkManager/UnitSdkManager';
4
+ import type { UNMobileWalletPayload } from '../../helpers/pushProvisioningService/types';
5
+ import type { UNError, UNErrorData } from '../../types/shared/error.types';
6
+
7
+ const isUNMobileWalletPayload = (object: any): object is UNMobileWalletPayload => {
8
+ return 'data' in object &&
9
+ 'attributes' in object.data &&
10
+ 'payload' in object.data.attributes;
11
+ };
4
12
 
5
13
  // TODO: use apiClient class for handling requests.
6
14
 
7
- export const getMobileWalletPayload = async (customerToken: string, cardId: string, env: UNEnvironment) => {
15
+ export const getMobileWalletPayload = async (customerToken: string, cardId: string, env: UNEnvironment, signedNonce: string) => {
16
+ if (!signedNonce) return;
17
+
8
18
  const headers = {
9
19
  'Content-Type': APIHeaders.CONTENT_TYPE,
10
20
  'Authorization': `Bearer ${customerToken}`,
@@ -13,7 +23,7 @@ export const getMobileWalletPayload = async (customerToken: string, cardId: stri
13
23
  const data = {
14
24
  data: {
15
25
  attributes: {
16
- signedNonce: UnitSDK.getSignedNonce(),
26
+ signedNonce: signedNonce,
17
27
  },
18
28
  },
19
29
  };
@@ -26,9 +36,22 @@ export const getMobileWalletPayload = async (customerToken: string, cardId: stri
26
36
  {
27
37
  headers: headers,
28
38
  });
29
- const encryptedPayload = response.data.data.attributes.payload;
30
- return encryptedPayload;
31
- } catch (error) {
32
- return Promise.reject(error);
39
+ if (!isUNMobileWalletPayload(response.data)) {
40
+ const error: UNErrorData = {title: `Couldn't get mobile wallet payload. Status:${response.status} Response data:${response.data}`};
41
+ throw error;
42
+ } else {
43
+ const encryptedPayload = response.data.data.attributes.payload;
44
+ return encryptedPayload;
45
+ }
46
+ } catch (error: unknown) {
47
+ // Converts the error into a UNError
48
+ if (axios.isAxiosError<UNError>(error) && error.response) {
49
+ const unErrors = error.response.data;
50
+ throw unErrors;
51
+ } else if (error instanceof Error) {
52
+ const unexpectedError: UNErrorData = {title: 'Unexpected error', error: error};
53
+ throw unexpectedError;
54
+ }
55
+ throw {title: `Unexpected error: ${error}`};
33
56
  }
34
57
  };
@@ -119,7 +119,7 @@ export const LISTENERS = {
119
119
  window.addEventListener("${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}", (e) => {
120
120
  postMessageToSDK({ type: "${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}", details: e.detail })
121
121
  });
122
- `
122
+ `,
123
123
  };
124
124
 
125
125
  export const DISPATCH_RENDERING_EVENT = `
@@ -162,6 +162,18 @@ export const DISPATCH_REQUEST_CARD_ACTION = `
162
162
  }
163
163
  `;
164
164
 
165
+ export const DISPATCH_REQUEST_HIDE_SENSITIVE_DATA = `
166
+ const dispatchRequestHideSensitiveData = (componentName) => {
167
+ document.querySelector(componentName).dispatchEvent(new CustomEvent("unitRequestHideSensitiveData"))
168
+ }
169
+ `;
170
+
171
+ export const DISPATCH_REQUEST_SHOW_SENSITIVE_DATA = `
172
+ const dispatchRequestShowSensitiveData = (componentName) => {
173
+ document.querySelector(componentName).dispatchEvent(new CustomEvent("unitRequestShowSensitiveData"))
174
+ }
175
+ `;
176
+
165
177
  export const DISPATCH_REQUEST_ACCOUNT_ACTION = `
166
178
  const dispatchRequestAccountAction = (action) => {
167
179
  document.querySelector("unit-elements-account").dispatchEvent(new CustomEvent("unitRequestAccountAction", {detail: {action: action}}))
@@ -0,0 +1,31 @@
1
+ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
+ import type { RootState } from '../store';
3
+
4
+ export interface ConfigurationState {
5
+ unitScript?: string;
6
+ theme?: string;
7
+ language?: string;
8
+ }
9
+
10
+ const initialState: ConfigurationState = {};
11
+
12
+ const ConfigurationSlice = createSlice({
13
+ name: 'Configuration',
14
+ initialState: initialState,
15
+ reducers: {
16
+ setUnitScript(state, action: PayloadAction<string | undefined>) {
17
+ state.unitScript = action.payload;
18
+ },
19
+ setTheme(state, action: PayloadAction<string | undefined>) {
20
+ state.theme = action.payload;
21
+ },
22
+ setLanguage(state, action: PayloadAction<string | undefined>) {
23
+ state.language = action.payload;
24
+ },
25
+ },
26
+
27
+ });
28
+
29
+ export const { setUnitScript, setLanguage, setTheme } = ConfigurationSlice.actions;
30
+ export const selectConfiguration = (state: RootState) => state.configuration;
31
+ export default ConfigurationSlice.reducer;
@@ -0,0 +1,93 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
3
+ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
4
+ import type { RootState } from '../store';
5
+ import type { SlotRendering, WebComponentRendering } from '../types/internal/bottomSheet.types';
6
+ import type { UNAccountData, UNCardData } from '../types/shared';
7
+ import type { ActivityFiltersChangedEvent } from '../messages/webMessages/activityMessage';
8
+ import type { RequestRefreshEvent } from '../messages/webMessages/unitMessages';
9
+ import type { BottomSheetNativeMessage } from '../messages/nativeMessages/bottomSheetMessage';
10
+ import type { CardMessage } from '../messages/webMessages/cardMessage';
11
+ import type { AccountMessage } from '../messages/webMessages/accountMessage';
12
+ import type { ActivityMessage } from '../messages/webMessages/activityMessage';
13
+ import type { UnitMessage } from '../messages/webMessages/unitMessages';
14
+ import type { MultipleCardsMessage } from '../messages/webMessages/multipleCardsMessage';
15
+
16
+ type EmptyObj = Record<PropertyKey, never>;
17
+
18
+ type SlotRenderingEventState = {
19
+ key: BottomSheetNativeMessage.START_FLOW,
20
+ data: SlotRendering
21
+ }
22
+ type MultipleCardsCardClickedEventState = {
23
+ key: MultipleCardsMessage.UNIT_MULTIPLE_CARDS_CARD_CLICKED,
24
+ data: UNCardData
25
+ }
26
+
27
+ type CardStatusChangedEventState = {
28
+ key: CardMessage.CARD_STATUS_CHANGED,
29
+ data: UNCardData
30
+ }
31
+
32
+ type CardActivatedEventState = {
33
+ key: CardMessage.CARD_ACTIVATED,
34
+ data: UNCardData
35
+ }
36
+
37
+ type AccountChangedEventState = {
38
+ key: AccountMessage.UNIT_ACCOUNT_CHANGED,
39
+ data: UNAccountData
40
+ }
41
+
42
+ type ActivityFiltersChangedEventState = {
43
+ key: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED
44
+ data: ActivityFiltersChangedEvent
45
+ }
46
+
47
+ type RequestCloseFlowEventState = {
48
+ key: UnitMessage.UNIT_REQUEST_CLOSE_FLOW,
49
+ data: EmptyObj
50
+ }
51
+
52
+ type WebComponentRenderingEventState = {
53
+ key: BottomSheetNativeMessage.START_FLOW,
54
+ data: WebComponentRendering
55
+ }
56
+
57
+ type RequestRefreshEventState = {
58
+ key: UnitMessage.UNIT_REQUEST_REFRESH,
59
+ data: RequestRefreshEvent
60
+ }
61
+
62
+ //currently left state suffixes to avoid the duplication of the event names
63
+ type SharedEvent =
64
+ SlotRenderingEventState
65
+ | CardStatusChangedEventState
66
+ | CardActivatedEventState
67
+ | MultipleCardsCardClickedEventState
68
+ | AccountChangedEventState
69
+ | ActivityFiltersChangedEventState
70
+ | RequestCloseFlowEventState
71
+ | WebComponentRenderingEventState
72
+ | RequestRefreshEventState
73
+
74
+ type SharedEventsState = {
75
+ event?: SharedEvent
76
+ }
77
+
78
+ const initialState: SharedEventsState = {};
79
+
80
+ const SharedEventsSlice = createSlice({
81
+ name: 'SharedEvents',
82
+ initialState: initialState,
83
+ reducers: {
84
+ setEvent(state, action: PayloadAction<SharedEvent>) {
85
+ state.event = action.payload;
86
+ },
87
+ },
88
+
89
+ });
90
+
91
+ export const { setEvent } = SharedEventsSlice.actions;
92
+ export const selectSharedEvents = (state: RootState) => state.sharedEvents;
93
+ export default SharedEventsSlice.reducer;
@@ -0,0 +1,24 @@
1
+ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
+ import type { RootState } from '../store';
3
+
4
+ export interface PushProvisioningState {
5
+ signedNonce: string | null
6
+ }
7
+
8
+ const initialState: PushProvisioningState = {
9
+ signedNonce: null
10
+ };
11
+
12
+ const pushProvisioningSlice = createSlice({
13
+ name: 'wallet',
14
+ initialState: initialState,
15
+ reducers: {
16
+ setSignedNonce(state, action: PayloadAction<string | null>) {
17
+ state.signedNonce = action.payload;
18
+ }
19
+ }
20
+ });
21
+
22
+ export const { setSignedNonce } = pushProvisioningSlice.actions;
23
+ export const selectWallet = (state: RootState) => state.wallet;
24
+ export default pushProvisioningSlice.reducer;
@@ -0,0 +1 @@
1
+ export * from './store';
@@ -0,0 +1,14 @@
1
+ import { configureStore } from '@reduxjs/toolkit';
2
+ import wallet from '../slices/pushProvisioningSlice';
3
+ import configuration from '../slices/ConfigurationSlice';
4
+ import sharedEvents from '../slices/SharedEventsSlice';
5
+
6
+ export const store = configureStore({
7
+ reducer: {
8
+ wallet,
9
+ configuration,
10
+ sharedEvents,
11
+ },
12
+ });
13
+
14
+ export type RootState = ReturnType<typeof store.getState>;
@@ -0,0 +1,22 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
3
+ import type { UNErrorData } from '../shared/error.types';
4
+ import type { UNError } from '../shared';
5
+
6
+ const isUNErrorData = (obj: any): obj is UNErrorData => {
7
+ return (
8
+ typeof obj === 'object' &&
9
+ 'title' in obj
10
+ );
11
+ };
12
+
13
+ export const isUNErrorDataArray = (arr: any): arr is UNErrorData[] => {
14
+ return (
15
+ Array.isArray(arr) &&
16
+ arr.every((item) => isUNErrorData(item))
17
+ );
18
+ };
19
+
20
+ export const isUNError = (error: any): error is UNError => {
21
+ return 'errors' in error && isUNErrorDataArray(error.errors);
22
+ };
@@ -1,5 +1,6 @@
1
1
  export enum WebComponentType {
2
2
  card = 'unit-elements-card',
3
+ multipleCards = 'unit-elements-multiple-cards',
3
4
  bookPayment = 'unit-elements-book-payment',
4
5
  activity = 'unit-elements-activity',
5
6
  slot = 'unit-elements-sdk-slot',
@@ -7,7 +8,6 @@ export enum WebComponentType {
7
8
  checkDeposit = 'unit-elements-check-deposit',
8
9
  achDebitPayment = 'unit-elements-ach-debit-payment',
9
10
  achCreditPayment = 'unit-elements-ach-credit-payment',
10
-
11
11
  cardAction = 'unit-elements-card-action',
12
12
  }
13
13
 
@@ -2,7 +2,12 @@ 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
 
5
+ export const enum UNActivityComponentPaginationType {
6
+ infiniteScroll = 'infiniteScroll',
7
+ pagination = 'pagination'
8
+ }
9
+
5
10
  export type UNActivityOnLoadData = {
6
- [RESPONSE_KEYS.authorization]: UNAuthorizationData,
11
+ [RESPONSE_KEYS.authorizations]: UNAuthorizationData,
7
12
  [RESPONSE_KEYS.transactions]: UNTransactionData,
8
13
  }
@@ -0,0 +1,38 @@
1
+ export type UNError = {
2
+ errors: UNErrorData[]
3
+ }
4
+
5
+ export type UNErrorData = {
6
+ status?: string,
7
+ title: string,
8
+ detail?: string,
9
+ details?: string,
10
+ meta?: UNErrorMeta
11
+ code?: UNErrorCodes,
12
+ error?: Error
13
+ }
14
+
15
+ interface UNErrorMeta {
16
+ meta: Record<string, string>,
17
+ }
18
+
19
+ export enum UNErrorCodes {
20
+ FEATURE_DISABLED = 'feature_disabled',
21
+ INVALID_VALUE = 'invalid_value',
22
+ LIMITS_EXCEEDED = 'limits_exceeded',
23
+ NOT_FOUND = 'not_found',
24
+ ACCOUNT_CUSTOMER_MISMATCH = 'account_customer_mismatch',
25
+ NOT_SUPPORTED_FOR_ACCOUNT_STATUS = 'not_supported_for_account_status',
26
+ NOT_SUPPORTED_FOR_ACCOUNT_TYPE = 'not_supported_for_account_type',
27
+ NOT_SUPPORTED_FOR_CARD = 'not_supported_for_card',
28
+ NOT_SUPPORTED_FOR_CARD_STATUS = 'not_supported_for_card_status',
29
+ NOT_SUPPORTED_FOR_CARD_TYPE = 'not_supported_for_card_type',
30
+ INVALID_NONCE = 'invalid_nonce',
31
+ NOT_SUPPORTED_FOR_PAYMENT_TYPE = 'not_supported_for_payment_type',
32
+ PAYMENT_INVALID = 'payment_invalid',
33
+ UNAUTHORIZED = 'unauthorized',
34
+ FORBIDDEN = 'forbidden',
35
+ ALREADY_EXISTS = 'already_exists',
36
+ CUSTOMER_NAME_UNDELIVERABLE = 'customer_name_undeliverable',
37
+ CUSTOMER_ADDRESS_UNDELIVERABLE = 'customer_address_undeliverable',
38
+ }
@@ -7,3 +7,6 @@ export * from './account.types';
7
7
  export * from './checkDeposit.types';
8
8
  export * from './activity.types';
9
9
  export * from './fonts.types';
10
+ export * from './error.types';
11
+ export * from './versioning.types';
12
+ export * from './multipleCards.types';
@@ -0,0 +1,8 @@
1
+ import type { UNCardData } from './card.types';
2
+
3
+ export const enum UNMultipleCardsComponentPaginationType {
4
+ infiniteScroll = 'infiniteScroll',
5
+ pagination = 'pagination'
6
+ }
7
+
8
+ export type UNMultipleCardsOnLoadData = UNCardData[];
@@ -1,19 +1,9 @@
1
+ import type { UNError } from './error.types';
2
+
1
3
  export type UNOnLoadResponseData<T> = {
2
4
  data: T,
3
5
  }
4
6
 
5
- export type UNError = {
6
- errors: UNErrorData[]
7
- }
8
-
9
- export type UNErrorData = {
10
- status: string,
11
- title: string,
12
- detail?: string,
13
- details?: string,
14
- meta?: Record<string, string>
15
- }
16
-
17
7
  export type UNOnLoadResponse<T> =
18
8
  | UNOnLoadResponseData<T>
19
9
  | UNError
@@ -0,0 +1,28 @@
1
+ export enum UNVersioningStrategyType {
2
+ exact = 'exact',
3
+ upToNextMinor = 'upToNextMinor',
4
+ upToNextMajor = 'upToNextMajor'
5
+ }
6
+
7
+ type UNExactWebVersioningStrategy = {
8
+ type: UNVersioningStrategyType.exact;
9
+ major: number;
10
+ minor: number;
11
+ patch: number;
12
+ }
13
+
14
+ type UNUpToNextMinorWebVersioningStrategy = {
15
+ type: UNVersioningStrategyType.upToNextMinor;
16
+ major: number;
17
+ minor: number;
18
+ }
19
+
20
+ type UNUpToNextMajorWebVersioningStrategy = {
21
+ type: UNVersioningStrategyType.upToNextMajor;
22
+ major: number;
23
+ }
24
+
25
+ export type UNWebVersioningStrategy =
26
+ UNExactWebVersioningStrategy
27
+ | UNUpToNextMinorWebVersioningStrategy
28
+ | UNUpToNextMajorWebVersioningStrategy;
@@ -1,26 +1,26 @@
1
- import EventBus from '../helpers/EventBus';
2
- import { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';
3
- import { UnitSDK, UNIT_SCRIPT_URL } from './UnitSdkManager';
1
+ import { UnitSDK } from './UnitSdkManager';
4
2
 
5
- let isLoadingScript = false;
3
+ import { getUnitScriptUrl } from './UnitSdkManager.utils.internal';
4
+ import { store } from '../store/store';
5
+ import { setUnitScript, selectConfiguration } from '../slices/ConfigurationSlice';
6
6
 
7
- /** globalUnitScript is exported ONLY to our project components **/
8
- export let globalUnitScript = '';
7
+ let isLoadingScript = false;
9
8
 
10
9
  export const fetchUnitScript = async () => {
10
+ const configurationState = selectConfiguration(store.getState());
11
+ const globalUnitScript = configurationState.unitScript;
11
12
  const env = UnitSDK.getEnv();
13
+ const webVersioningStrategy = UnitSDK.getWebVersioningStrategy();
12
14
  if (isLoadingScript || globalUnitScript || !env) {
13
15
  // init function is called and success OR in progress
14
16
  return null;
15
17
  }
16
18
  isLoadingScript = true;
17
19
  try {
18
- const unitScriptRes = await fetch(UNIT_SCRIPT_URL[env]);
20
+ const unitScriptRes = await fetch(getUnitScriptUrl(env, webVersioningStrategy));
19
21
  const unitScript = await unitScriptRes.text();
20
22
  if (unitScript) {
21
- const scriptFetchData: SdkScriptFetched = { unitScript };
22
- EventBus.Instance.event(SDKMessage.IS_SCRIPT_FETCHED, scriptFetchData);
23
- globalUnitScript = unitScript;
23
+ store.dispatch(setUnitScript(unitScript));
24
24
  }
25
25
  return null;
26
26
  } catch (e) {
@@ -0,0 +1,11 @@
1
+ import { UNVersioningStrategyType, UNWebVersioningStrategy } from '../types/shared';
2
+
3
+ const WEB_SDK_RECOMMENDED_STRATEGY: UNWebVersioningStrategy = {
4
+ type: UNVersioningStrategyType.upToNextMinor,
5
+ major: 1,
6
+ minor: 3,
7
+ };
8
+
9
+ export const UNSDKConstants = {
10
+ webSDKRecommendedStrategy: WEB_SDK_RECOMMENDED_STRATEGY,
11
+ };
@@ -1,43 +1,37 @@
1
1
  import type { NativeModules } from 'react-native';
2
- import EventBus from '../helpers/EventBus';
3
- import { SDKMessage } from '../messages/nativeMessages/sdkMessage';
4
2
  import { fetchUnitScript } from './UnitSdk.api';
5
3
  import { UnitUiManager } from './unitUiManager/unitUiManager';
6
4
  import type { UNFonts } from '../types/shared/fonts.types';
5
+ import { warnClientIfNeeded } from '../utils/webVersioningStrategy.utils';
6
+ import { UNSDKConstants } from './UnitSdk.constants';
7
+ import type { UNWebVersioningStrategy } from '../types/shared';
8
+ import { setTheme, setLanguage } from '../slices/ConfigurationSlice';
9
+ import { store } from '../store/store';
7
10
 
8
11
  export enum UNEnvironment {
9
12
  sandbox = 'sandbox',
10
13
  production = 'production'
11
14
  }
12
15
 
13
- const UNIT_WEB_VERSION = '1';
14
-
15
- export const UNIT_SCRIPT_URL = {
16
- [UNEnvironment.sandbox]: `https://ui.s.unit.sh/release/${UNIT_WEB_VERSION}/components.js`,
17
- [UNEnvironment.production]: `https://ui.unit.co/release/${UNIT_WEB_VERSION}/components.js`
18
- };
19
16
  export class UnitSDK {
17
+ public static ui: UnitUiManager;
20
18
  protected static env?: UNEnvironment;
19
+ protected static webVersioningStrategy: UNWebVersioningStrategy;
21
20
  protected static customerToken?: string;
22
- protected static theme?: string;
23
- protected static language?: string;
24
21
  protected static fonts?: UNFonts;
25
-
26
22
  protected static signedNonce?: string;
27
23
  protected static pushProvisionModule?: typeof NativeModules;
28
24
 
29
- public static ui: UnitUiManager;
30
-
31
- public static init = async (env: UNEnvironment, theme?: string, language?: string, fonts?: UNFonts) => {
25
+ public static init = async (env: UNEnvironment, theme?: string, language?: string, fonts?: UNFonts, webVersioningStrategy: UNWebVersioningStrategy = UNSDKConstants.webSDKRecommendedStrategy) => {
32
26
  try {
33
27
  this.env = env;
34
- this.theme = theme;
35
- this.language = language;
28
+ this.webVersioningStrategy = webVersioningStrategy;
36
29
  this.fonts = fonts;
37
-
30
+ store.dispatch(setTheme(theme));
31
+ store.dispatch(setLanguage(language));
38
32
  this.ui = new UnitUiManager();
33
+ warnClientIfNeeded(this.webVersioningStrategy);
39
34
  await fetchUnitScript();
40
- EventBus.Instance.event(SDKMessage.IS_SDK_INITIALIZED, {});
41
35
  } catch (e) {
42
36
  console.log(e);
43
37
  }
@@ -51,6 +45,9 @@ export class UnitSDK {
51
45
  return this.pushProvisionModule;
52
46
  };
53
47
 
48
+ /**
49
+ * @deprecated - Unit SDK is managing the signedNonce, no need to provide it
50
+ */
54
51
  public static setSignedNonce = (signedNonce: string) => {
55
52
  this.signedNonce = signedNonce;
56
53
  };
@@ -59,18 +56,17 @@ export class UnitSDK {
59
56
  return this.env;
60
57
  };
61
58
 
62
- public static getTheme = () => {
63
- return this.theme;
64
- };
65
-
66
- public static getLanguage = () => {
67
- return this.language;
59
+ public static getWebVersioningStrategy = () => {
60
+ return this.webVersioningStrategy;
68
61
  };
69
62
 
70
63
  public static getFonts = () => {
71
64
  return this.fonts;
72
65
  };
73
66
 
67
+ /**
68
+ * @deprecated - Unit SDK is managing the signedNonce, no need to provide it
69
+ */
74
70
  public static getSignedNonce = () => {
75
71
  return this.signedNonce;
76
72
  };
@@ -82,4 +78,5 @@ export class UnitSDK {
82
78
  public static getCustomerToken = () => {
83
79
  return this.customerToken;
84
80
  };
81
+
85
82
  }
@@ -0,0 +1,13 @@
1
+ import type { UNWebVersioningStrategy } from '../types/shared';
2
+ import { getWebSdkVersionString } from '../utils/webVersioningStrategy.utils';
3
+ import { UNEnvironment } from './UnitSdkManager';
4
+
5
+ export const getUnitScriptUrl = (env: UNEnvironment, webVersioningStrategy: UNWebVersioningStrategy) => {
6
+ const webSdkVersionString = getWebSdkVersionString(webVersioningStrategy);
7
+ switch (env) {
8
+ case UNEnvironment.sandbox:
9
+ return `https://ui.s.unit.sh/release/${webSdkVersionString}/components.js`;
10
+ case UNEnvironment.production:
11
+ return `https://ui.unit.co/release/${webSdkVersionString}/components.js`;
12
+ }
13
+ };