react-native-unit-components 1.2.1 → 1.4.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 (192) hide show
  1. package/README.md +0 -255
  2. package/ios/Camera/Camera.swift +22 -0
  3. package/ios/Camera/CameraExportModule.m +7 -0
  4. package/ios/UNAppInfo/UNAppInfo.swift +19 -0
  5. package/ios/UNAppInfo/UNAppInfoExportModule.m +7 -0
  6. package/ios/UnitReactNativeComponentsViewManager.swift +7 -7
  7. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js +24 -1
  8. package/lib/commonjs/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  9. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js +24 -1
  10. package/lib/commonjs/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  11. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +28 -3
  12. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  13. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js +11 -1
  14. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
  15. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +32 -1
  16. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  17. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +8 -1
  18. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  19. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +18 -1
  20. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  21. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +7 -0
  22. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  23. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +37 -3
  24. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  25. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +9 -1
  26. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  27. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js +97 -0
  28. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -0
  29. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js +45 -0
  30. package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js.map +1 -0
  31. package/lib/commonjs/components/index.js +11 -0
  32. package/lib/commonjs/components/index.js.map +1 -1
  33. package/lib/commonjs/hooks/listenerToBus.js +4 -1
  34. package/lib/commonjs/hooks/listenerToBus.js.map +1 -1
  35. package/lib/commonjs/messages/webMessages/activityMessage.js +12 -0
  36. package/lib/commonjs/messages/webMessages/activityMessage.js.map +1 -0
  37. package/lib/commonjs/messages/webMessages/cardMessage.js +1 -0
  38. package/lib/commonjs/messages/webMessages/cardMessage.js.map +1 -1
  39. package/lib/commonjs/messages/webMessages/checkMessage.js +13 -0
  40. package/lib/commonjs/messages/webMessages/checkMessage.js.map +1 -0
  41. package/lib/commonjs/messages/webMessages/index.js.map +1 -1
  42. package/lib/commonjs/messages/webMessages/onLoadMessage.js +17 -0
  43. package/lib/commonjs/messages/webMessages/onLoadMessage.js.map +1 -0
  44. package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -1
  45. package/lib/commonjs/scripts/html/bodyScript.js +42 -1
  46. package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
  47. package/lib/commonjs/sharedTypes/account.types.js +8 -1
  48. package/lib/commonjs/sharedTypes/account.types.js.map +1 -1
  49. package/lib/commonjs/sharedTypes/achCredit.types.js.map +1 -1
  50. package/lib/commonjs/sharedTypes/activity.types.js +6 -0
  51. package/lib/commonjs/sharedTypes/activity.types.js.map +1 -0
  52. package/lib/commonjs/sharedTypes/authorization.types.js +2 -0
  53. package/lib/commonjs/sharedTypes/authorization.types.js.map +1 -0
  54. package/lib/commonjs/sharedTypes/card.types.js +15 -0
  55. package/lib/commonjs/sharedTypes/card.types.js.map +1 -1
  56. package/lib/commonjs/sharedTypes/checkDeposit.types.js +22 -0
  57. package/lib/commonjs/sharedTypes/checkDeposit.types.js.map +1 -0
  58. package/lib/commonjs/sharedTypes/index.js +11 -0
  59. package/lib/commonjs/sharedTypes/index.js.map +1 -1
  60. package/lib/commonjs/sharedTypes/onLoadResponse.types.js +0 -4
  61. package/lib/commonjs/sharedTypes/onLoadResponse.types.js.map +1 -1
  62. package/lib/commonjs/sharedTypes/transactions.types.js +52 -0
  63. package/lib/commonjs/sharedTypes/transactions.types.js.map +1 -0
  64. package/lib/commonjs/webComponent/WebComponent.js +35 -2
  65. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  66. package/lib/commonjs/webComponent/html.js +14 -1
  67. package/lib/commonjs/webComponent/html.js.map +1 -1
  68. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js +24 -1
  69. package/lib/module/components/UNACHCreditComponent/UNACHCreditComponent.js.map +1 -1
  70. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js +24 -1
  71. package/lib/module/components/UNACHDebitComponent/UNACHDebitComponent.js.map +1 -1
  72. package/lib/module/components/UNAccountComponent/UNAccountComponent.js +30 -5
  73. package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
  74. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js +8 -0
  75. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
  76. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +33 -2
  77. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  78. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +6 -0
  79. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  80. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +18 -1
  81. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  82. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +7 -0
  83. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  84. package/lib/module/components/UNCardComponent/UNCardComponent.js +39 -5
  85. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  86. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +6 -0
  87. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  88. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js +88 -0
  89. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -0
  90. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js +37 -0
  91. package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js.map +1 -0
  92. package/lib/module/components/index.js +1 -0
  93. package/lib/module/components/index.js.map +1 -1
  94. package/lib/module/hooks/listenerToBus.js +4 -1
  95. package/lib/module/hooks/listenerToBus.js.map +1 -1
  96. package/lib/module/messages/webMessages/activityMessage.js +5 -0
  97. package/lib/module/messages/webMessages/activityMessage.js.map +1 -0
  98. package/lib/module/messages/webMessages/cardMessage.js +1 -0
  99. package/lib/module/messages/webMessages/cardMessage.js.map +1 -1
  100. package/lib/module/messages/webMessages/checkMessage.js +6 -0
  101. package/lib/module/messages/webMessages/checkMessage.js.map +1 -0
  102. package/lib/module/messages/webMessages/index.js.map +1 -1
  103. package/lib/module/messages/webMessages/onLoadMessage.js +10 -0
  104. package/lib/module/messages/webMessages/onLoadMessage.js.map +1 -0
  105. package/lib/module/messages/webMessages/unitMessages.js.map +1 -1
  106. package/lib/module/scripts/html/bodyScript.js +37 -0
  107. package/lib/module/scripts/html/bodyScript.js.map +1 -1
  108. package/lib/module/sharedTypes/account.types.js +6 -0
  109. package/lib/module/sharedTypes/account.types.js.map +1 -1
  110. package/lib/module/sharedTypes/achCredit.types.js.map +1 -1
  111. package/lib/module/sharedTypes/activity.types.js +2 -0
  112. package/lib/module/sharedTypes/activity.types.js.map +1 -0
  113. package/lib/module/sharedTypes/authorization.types.js +2 -0
  114. package/lib/module/sharedTypes/authorization.types.js.map +1 -0
  115. package/lib/module/sharedTypes/card.types.js +13 -1
  116. package/lib/module/sharedTypes/card.types.js.map +1 -1
  117. package/lib/module/sharedTypes/checkDeposit.types.js +15 -0
  118. package/lib/module/sharedTypes/checkDeposit.types.js.map +1 -0
  119. package/lib/module/sharedTypes/index.js +2 -1
  120. package/lib/module/sharedTypes/index.js.map +1 -1
  121. package/lib/module/sharedTypes/onLoadResponse.types.js +1 -1
  122. package/lib/module/sharedTypes/onLoadResponse.types.js.map +1 -1
  123. package/lib/module/sharedTypes/transactions.types.js +44 -0
  124. package/lib/module/sharedTypes/transactions.types.js.map +1 -0
  125. package/lib/module/webComponent/WebComponent.js +34 -2
  126. package/lib/module/webComponent/WebComponent.js.map +1 -1
  127. package/lib/module/webComponent/html.js +15 -2
  128. package/lib/module/webComponent/html.js.map +1 -1
  129. package/lib/typescript/components/UNACHCreditComponent/UNACHCreditComponent.d.ts +2 -2
  130. package/lib/typescript/components/UNACHDebitComponent/UNACHDebitComponent.d.ts +2 -2
  131. package/lib/typescript/components/UNAccountComponent/UNAccountComponent.d.ts +11 -3
  132. package/lib/typescript/components/UNAccountComponent/UNAccountComponent.utils.d.ts +3 -0
  133. package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +5 -2
  134. package/lib/typescript/components/UNActivityComponent/UNActivityComponent.utils.d.ts +1 -0
  135. package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +2 -2
  136. package/lib/typescript/components/UNCardComponent/UNCardComponent.d.ts +9 -3
  137. package/lib/typescript/components/UNCardComponent/UNCardComponent.utils.d.ts +3 -0
  138. package/lib/typescript/components/UNCheckDepositComponent/UNCheckDepositComponent.d.ts +12 -0
  139. package/lib/typescript/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.d.ts +3 -0
  140. package/lib/typescript/components/index.d.ts +1 -0
  141. package/lib/typescript/messages/webMessages/activityMessage.d.ts +5 -0
  142. package/lib/typescript/messages/webMessages/cardMessage.d.ts +5 -1
  143. package/lib/typescript/messages/webMessages/checkMessage.d.ts +8 -0
  144. package/lib/typescript/messages/webMessages/index.d.ts +4 -2
  145. package/lib/typescript/messages/webMessages/onLoadMessage.d.ts +30 -0
  146. package/lib/typescript/messages/webMessages/unitMessages.d.ts +2 -2
  147. package/lib/typescript/scripts/html/bodyScript.d.ts +6 -0
  148. package/lib/typescript/sharedTypes/account.types.d.ts +18 -4
  149. package/lib/typescript/sharedTypes/achCredit.types.d.ts +6 -0
  150. package/lib/typescript/sharedTypes/activity.types.d.ts +7 -0
  151. package/lib/typescript/sharedTypes/authorization.types.d.ts +20 -0
  152. package/lib/typescript/sharedTypes/card.types.d.ts +12 -0
  153. package/lib/typescript/sharedTypes/checkDeposit.types.d.ts +46 -0
  154. package/lib/typescript/sharedTypes/index.d.ts +2 -1
  155. package/lib/typescript/sharedTypes/onLoadResponse.types.d.ts +12 -16
  156. package/lib/typescript/sharedTypes/transactions.types.d.ts +80 -0
  157. package/lib/typescript/webComponent/WebComponent.d.ts +1 -0
  158. package/package.json +3 -3
  159. package/src/components/UNACHCreditComponent/UNACHCreditComponent.tsx +30 -3
  160. package/src/components/UNACHDebitComponent/UNACHDebitComponent.tsx +30 -3
  161. package/src/components/UNAccountComponent/UNAccountComponent.tsx +52 -9
  162. package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +11 -0
  163. package/src/components/UNActivityComponent/UNActivityComponent.tsx +45 -4
  164. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +7 -0
  165. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +24 -3
  166. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +8 -1
  167. package/src/components/UNCardComponent/UNCardComponent.tsx +51 -7
  168. package/src/components/UNCardComponent/UNCardComponent.utils.ts +9 -0
  169. package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.tsx +112 -0
  170. package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.ts +40 -0
  171. package/src/components/index.ts +1 -0
  172. package/src/hooks/listenerToBus.ts +4 -1
  173. package/src/messages/webMessages/activityMessage.ts +8 -0
  174. package/src/messages/webMessages/cardMessage.ts +6 -0
  175. package/src/messages/webMessages/checkMessage.ts +14 -0
  176. package/src/messages/webMessages/index.ts +6 -0
  177. package/src/messages/webMessages/onLoadMessage.ts +45 -0
  178. package/src/messages/webMessages/unitMessages.ts +2 -2
  179. package/src/scripts/html/bodyScript.ts +42 -1
  180. package/src/sharedTypes/account.types.ts +33 -19
  181. package/src/sharedTypes/achCredit.types.ts +7 -0
  182. package/src/sharedTypes/activity.types.ts +8 -0
  183. package/src/sharedTypes/authorization.types.ts +22 -0
  184. package/src/sharedTypes/card.types.ts +13 -0
  185. package/src/sharedTypes/checkDeposit.types.ts +50 -0
  186. package/src/sharedTypes/index.ts +2 -1
  187. package/src/sharedTypes/onLoadResponse.types.ts +15 -23
  188. package/src/sharedTypes/transactions.types.ts +84 -0
  189. package/src/webComponent/WebComponent.tsx +36 -2
  190. package/src/webComponent/html.ts +15 -2
  191. package/android/src/main/res/values/themes.xml +0 -16
  192. package/android/src/main/res/values-night/themes.xml +0 -16
@@ -3,6 +3,7 @@ import { CardMessage } from '../../messages/webMessages/cardMessage';
3
3
  import { PageMessage } from '../../messages/webMessages/pageMessage';
4
4
  import { UnitMessage } from '../../messages/webMessages/unitMessages';
5
5
  import { AccountMessage } from '../../messages/webMessages/accountMessage';
6
+ import { ActivityMessage } from '../../messages/webMessages/activityMessage';
6
7
 
7
8
  export const POST_MESSAGE_TO_SDK = `
8
9
  const postMessageToSDK = (message) => {
@@ -59,6 +60,16 @@ export const LISTENERS = {
59
60
  postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_DOWNLOAD}", details: e.detail })
60
61
  });
61
62
  `,
63
+ cardActivated: `
64
+ window.addEventListener("${CardMessage.CARD_ACTIVATED}", (e) => {
65
+ const response = e.detail
66
+ response.then((data) => {
67
+ postMessageToSDK({ type: "${CardMessage.CARD_ACTIVATED}", details: { card: data.data }})
68
+ }).catch((e) => {
69
+ console.log(e)
70
+ })
71
+ });
72
+ `,
62
73
  cardStatusChange: `
63
74
  window.addEventListener("${CardMessage.CARD_STATUS_CHANGED}", (e) => {
64
75
  const response = e.detail
@@ -74,7 +85,7 @@ export const LISTENERS = {
74
85
  postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}", details: e.detail })
75
86
  });
76
87
  `,
77
- unitPaymentCreated:`
88
+ unitPaymentCreated: `
78
89
  window.addEventListener("${PaymentMessage.PAYMENT_CREATED}", (e) => {
79
90
  const response = e.detail
80
91
  response.then((data) => {
@@ -94,6 +105,11 @@ export const LISTENERS = {
94
105
  })
95
106
  });
96
107
  `,
108
+ unitActivityFiltersChanged: `
109
+ window.addEventListener("${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}", (e) => {
110
+ postMessageToSDK({ type: "${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}", details: e.detail })
111
+ });
112
+ `
97
113
  };
98
114
 
99
115
  export const DISPATCH_RENDERING_EVENT = `
@@ -110,9 +126,34 @@ export const DISPATCH_REQUEST_REFRESH = `
110
126
  }
111
127
  `;
112
128
 
129
+ export const DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = `
130
+ const dispatchActivityFilterChangedEvent = (details) => {
131
+ const event = new CustomEvent("${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}",{ detail: details });
132
+ window.dispatchEvent(event);
133
+ }
134
+ `;
135
+
113
136
  export const DISPATCH_PLAID_RESPONSE = `
114
137
  const dispatchPlaidEvent = (details) => {
115
138
  const event = new CustomEvent("${UnitMessage.UNIT_PLAID_RESPONSE}",{ detail: details })
116
139
  window.dispatchEvent(event)
117
140
  }
118
141
  `;
142
+
143
+ export const DISPATCH_OPEN_ACTIONS_MENU = `
144
+ const dispatchOpenActionsMenu = (componentName) => {
145
+ document.querySelector(componentName).dispatchEvent(new CustomEvent("unitRequestOpenActionsMenu"))
146
+ }
147
+ `;
148
+
149
+ export const DISPATCH_REQUEST_CARD_ACTION = `
150
+ const dispatchRequestCardAction = (action) => {
151
+ document.querySelector("unit-elements-card").dispatchEvent(new CustomEvent("unitRequestCardAction", {detail: {action: action}}))
152
+ }
153
+ `;
154
+
155
+ export const DISPATCH_REQUEST_ACCOUNT_ACTION = `
156
+ const dispatchRequestAccountAction = (action) => {
157
+ document.querySelector("unit-elements-account").dispatchEvent(new CustomEvent("unitRequestAccountAction", {detail: {action: action}}))
158
+ }
159
+ `;
@@ -2,31 +2,39 @@ import type { UNRelationship, UNTags } from './types';
2
2
 
3
3
  export type UNAccountData = UNDepositAccount | UNBatchAccount | UNCreditAccount
4
4
 
5
+ export type UNCounterpartyAccountData = {
6
+ id: string
7
+ attributes: {
8
+ name: string
9
+ tags?: { [key: string]: string }
10
+ }
11
+ }
12
+
5
13
  enum UNAccountStatus {
6
- Open = "Open",
7
- Closed = "Closed",
8
- Frozen = "Frozen",
14
+ Open = 'Open',
15
+ Closed = 'Closed',
16
+ Frozen = 'Frozen',
9
17
  }
10
18
 
11
19
  export enum UNCloseReason {
12
- Fraud = "Fraud",
13
- ByCustomer = "ByCustomer",
20
+ Fraud = 'Fraud',
21
+ ByCustomer = 'ByCustomer',
14
22
  }
15
23
 
16
24
  export enum UNFraudReason {
17
- ACHActivity = "ACHActivity",
18
- CardActivity = "CardActivity",
19
- CheckActivity = "CheckActivity",
20
- ApplicationHistory = "ApplicationHistory",
21
- AccountActivity = "AccountActivity",
22
- ClientIdentified = "ClientIdentified",
23
- IdentityTheft = "IdentityTheft",
24
- LinkedToFraudulentCustomer = "LinkedToFraudulentCustomer",
25
+ ACHActivity = 'ACHActivity',
26
+ CardActivity = 'CardActivity',
27
+ CheckActivity = 'CheckActivity',
28
+ ApplicationHistory = 'ApplicationHistory',
29
+ AccountActivity = 'AccountActivity',
30
+ ClientIdentified = 'ClientIdentified',
31
+ IdentityTheft = 'IdentityTheft',
32
+ LinkedToFraudulentCustomer = 'LinkedToFraudulentCustomer',
25
33
  }
26
34
 
27
35
  export type UNDepositAccount = {
28
36
  id: string
29
- type: "depositAccount"
37
+ type: 'depositAccount'
30
38
  attributes: {
31
39
  createdAt: string
32
40
  updatedAt?: string
@@ -63,7 +71,7 @@ export type UNDepositAccount = {
63
71
 
64
72
  export type UNBatchAccount = {
65
73
  id: string
66
- type: "batchAccount"
74
+ type: 'batchAccount'
67
75
  attributes: {
68
76
  createdAt: Date
69
77
  updatedAt?: Date
@@ -77,12 +85,12 @@ export type UNBatchAccount = {
77
85
  reserve: number
78
86
  available: number
79
87
  currency: string
80
- status: "Open" | "Closed"
88
+ status: 'Open' | 'Closed'
81
89
  closeReason?: string
82
90
  fraudReason?: UNFraudReason
83
91
  closeReasonText?: string
84
92
  freezeReason?: string
85
- tags?: {[key: string]: string}
93
+ tags?: { [key: string]: string }
86
94
  }
87
95
  relationships: {
88
96
  org: UNRelationship
@@ -91,7 +99,7 @@ export type UNBatchAccount = {
91
99
 
92
100
  export type UNCreditAccount = {
93
101
  id: string
94
- type: "creditAccount"
102
+ type: 'creditAccount'
95
103
  attributes: {
96
104
  createdAt: Date
97
105
  updatedAt?: Date
@@ -103,7 +111,7 @@ export type UNCreditAccount = {
103
111
  available: number
104
112
  creditLimit: number
105
113
  currency: string
106
- tags: {[key: string]: string}
114
+ tags: { [key: string]: string }
107
115
  status: UNAccountStatus
108
116
  closeReason?: UNCloseReason
109
117
  fraudReason?: UNFraudReason
@@ -115,3 +123,9 @@ export type UNCreditAccount = {
115
123
  org: UNRelationship
116
124
  }
117
125
  }
126
+
127
+ export enum UNAccountMenuAction {
128
+ OpenAccountDetails = 'OpenAccountDetails',
129
+ OpenAccountStatements = 'OpenAccountStatements',
130
+ DownloadBankVerificationLetter = 'DownloadBankVerificationLetter',
131
+ }
@@ -1,6 +1,13 @@
1
+ import type { RESPONSE_KEYS } from '../messages/webMessages/onLoadMessage';
2
+ import type { UNAccountData, UNCounterpartyAccountData } from './account.types';
1
3
  import type { UNAchCounterparty, UNCounterpartyVerificationMethod, UNPaymentStatus } from './payments.types';
2
4
  import type { UNTags, UNRelationship } from './types';
3
5
 
6
+ export type UNACHOnLoadData = {
7
+ [RESPONSE_KEYS.account]: UNAccountData,
8
+ [RESPONSE_KEYS.counterpartyAccount]: [UNCounterpartyAccountData]
9
+ }
10
+
4
11
  export type UNACHData = {
5
12
  type: 'achPayment',
6
13
  id: string,
@@ -0,0 +1,8 @@
1
+ import type { RESPONSE_KEYS } from '../messages/webMessages/onLoadMessage';
2
+ import type { UNAuthorizationData } from './authorization.types';
3
+ import type { UNTransactionData } from './transactions.types';
4
+
5
+ export type UNActivityOnLoadData = {
6
+ [RESPONSE_KEYS.authorization]: UNAuthorizationData,
7
+ [RESPONSE_KEYS.transactions]: UNTransactionData,
8
+ }
@@ -0,0 +1,22 @@
1
+ export type UNAuthorizationData = {
2
+ type: string,
3
+ id: string,
4
+ attributes: UNAuthorizationDetails
5
+ }
6
+
7
+ export type UNAuthorizationDetails = {
8
+ cardNetwork: string,
9
+ createdAt: Date,
10
+ amount: string,
11
+ merchant?: UNAuthorizationMerchant,
12
+ cardLast4Digits: string,
13
+ recurring : boolean,
14
+ summary: string,
15
+ }
16
+
17
+ export type UNAuthorizationMerchant = {
18
+ name: string,
19
+ type: string,
20
+ category: string,
21
+ location?: string,
22
+ }
@@ -57,3 +57,16 @@ export type UNBusinessDebitCard = {
57
57
  customer: UNRelationship
58
58
  }
59
59
  }
60
+
61
+ export enum UNCardMenuAction {
62
+ Freeze = 'Freeze',
63
+ ManagePin = 'ManagePin',
64
+ Replace = 'Replace',
65
+ Report = 'Report',
66
+ Close = 'Close',
67
+ Activate = 'Activate',
68
+ Unfreeze = 'Unfreeze',
69
+ ChangePin = 'ChangePin',
70
+ SetPin = 'SetPin',
71
+ AddToWallet = 'AddToWallet'
72
+ }
@@ -0,0 +1,50 @@
1
+ import type { UNRelationship } from './types';
2
+
3
+ export type UNCheckDepositData = {
4
+ id: string
5
+ type: string
6
+ attributes: UNCheckDepositAttributes
7
+ relationships: UNCheckDepositRelationships
8
+ }
9
+
10
+ export type UNCheckDepositAttributes = {
11
+ createdAt: Date
12
+ status: keyof typeof UNCheckDepositStatus
13
+ reason?: string
14
+ description: string
15
+ amount: Cents
16
+ checkNumber?: string
17
+ counterparty: UNCheckCounterparty
18
+ settlementDate?: Date
19
+ tags?: {[key: string]: string}
20
+ }
21
+
22
+ export type UNCheckDepositRelationships = {
23
+ account: UNRelationship
24
+ customer?: UNRelationship
25
+ customers?: UNRelationship
26
+ org?: UNRelationship
27
+ transaction?: UNRelationship
28
+ }
29
+
30
+ export enum UNCheckDepositStatus {
31
+ AwaitingImages = 'AwaitingImages',
32
+ AwaitingFrontImage = 'AwaitingFrontImage',
33
+ AwaitingBackImage = 'AwaitingBackImage',
34
+ PendingReview = 'PendingReview',
35
+ AwaitingCustomerConfirmation = 'AwaitingCustomerConfirmation',
36
+ Pending = 'Pending',
37
+ Rejected = 'Rejected',
38
+ Clearing = 'Clearing',
39
+ Sent = 'Sent',
40
+ Canceled = 'Canceled',
41
+ Returned = 'Returned',
42
+ }
43
+
44
+ export type Cents = number
45
+
46
+ export type UNCheckCounterparty = {
47
+ name: string
48
+ accountNumber: string
49
+ routingNumber: string
50
+ }
@@ -3,4 +3,5 @@ export * from './card.types';
3
3
  export * from './onLoadResponse.types';
4
4
  export * from './achCredit.types';
5
5
  export * from './payments.types';
6
- export * from "./account.types";
6
+ export * from './account.types';
7
+ export * from './checkDeposit.types';
@@ -1,27 +1,19 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
- import type { UNCardData } from '../sharedTypes';
1
+ export type UNOnLoadResponseData<T> = {
2
+ data: T,
3
+ }
3
4
 
4
- export type UNSuccessResponseUnitOnLoad = {
5
- /*
6
- Object since the current response data types from 'Activities' and 'BookPayment' do not have documentation.
7
- When things are determined, we may update it
8
- */
9
- data: UNCardData | Object,
10
- included: [Object],
11
- errors: null
5
+ export type UNError = {
6
+ errors: UNErrorData[]
12
7
  }
13
8
 
14
- export type UNErrorResponseUnitOnLoad = {
15
- errors: [
16
- {
17
- status: string,
18
- title: string,
19
- detail?: string,
20
- details?: string,
21
- meta?: Record<string, string>
22
- }
23
- ]
9
+ export type UNErrorData = {
10
+ status: string,
11
+ title: string,
12
+ detail?: string,
13
+ details?: string,
14
+ meta?: Record<string, string>
24
15
  }
25
- export type UNResponseUnitOnLoadEvent =
26
- | UNSuccessResponseUnitOnLoad
27
- | UNErrorResponseUnitOnLoad
16
+
17
+ export type UNOnLoadResponse<T> =
18
+ | UNOnLoadResponseData<T>
19
+ | UNError
@@ -0,0 +1,84 @@
1
+ export type UNTransactionData = {
2
+ type: UNTransactionType,
3
+ id: string,
4
+ attributes: UNATransactionAttributes,
5
+ relationships: UNTransactionRelationships
6
+ }
7
+
8
+ export type UNATransactionAttributes = {
9
+ createdAt: Date,
10
+ amount: string,
11
+ direction?: UNDirection,
12
+ balance?: string,
13
+ summary?: string,
14
+ companyName?: string,
15
+ counterpartyName?: string,
16
+ counterpartyRoutingNumber?: string,
17
+ reason?: string,
18
+ }
19
+
20
+ export type UNTransactionRelationships = {
21
+ customer?: {
22
+ data: {
23
+ type: string
24
+ id: number
25
+ }
26
+ }
27
+ customers?: {
28
+ data: [
29
+ {
30
+ type: 'customer'
31
+ id: string
32
+ }
33
+ ]
34
+ }
35
+ org?: {
36
+ data: {
37
+ type: string
38
+ id: number
39
+ }
40
+ }
41
+ }
42
+
43
+ export enum UNDirection {
44
+ Debit = 'Debit',
45
+ Credit = 'Credit',
46
+ }
47
+
48
+ export enum UNTransactionType {
49
+ ATM = 'atmTransaction',
50
+ Adjustment = 'adjustmentTransaction',
51
+ BillPay = 'billPayTransaction',
52
+ Book = 'bookTransaction',
53
+ Card = 'cardTransaction',
54
+ CardReversal = 'cardReverTransactionTypessalTransaction',
55
+ Chargeback = 'chargebackTransaction',
56
+ CheckDeposit = 'checkDepositTransaction',
57
+ DishonoredACH = 'dishonoredAchTransaction',
58
+ Dispute = 'disputeTransaction',
59
+ DisputeSettlement = 'disputeSettlementTransaction',
60
+ Fee = 'feeTransaction',
61
+ InterchangeShare = 'interchangeShareTransaction',
62
+ Interest = 'interestTransaction',
63
+ InterestShare = 'interestShareTransaction',
64
+ NegativeBalanceCoverage = 'negativeBalanceCoverageTransaction',
65
+ OriginatedACH = 'originatedAchTransaction',
66
+ PaymentAdvance = 'paymentAdvanceTransaction',
67
+ PaymentCanceled = 'paymentCanceledTransaction',
68
+ Purchase = 'purchaseTransaction',
69
+ ReceivedACH = 'receivedAchTransaction',
70
+ Release = 'releaseTransaction',
71
+ RepaidPaymentAdvance = 'repaidPaymentAdvanceTransaction',
72
+ ReturnedACH = 'returnedAchTransaction',
73
+ ReturnedCheckDeposit = 'returnedCheckDepositTransaction',
74
+ ReturnedReceivedACH = 'returnedReceivedAchTransaction',
75
+ Reward = 'rewardTransaction',
76
+ Settlement = 'settlementTransaction',
77
+ SponsoredInterest = 'sponsoredInterestTransaction',
78
+ Wire = 'wireTransaction',
79
+ AccountLowBalanceClosure = 'accountLowBalanceClosureTransaction',
80
+ CashDeposit = 'cashDepositTransaction',
81
+ BankRepayment = 'bankRepaymentTransaction',
82
+ CustomerRepayment = 'CustomerRepaymentTransaction',
83
+ CustomerRepaymentReturned = 'CustomerRepaymentReturnedTransaction',
84
+ }
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import React, { useEffect, useState } from 'react';
3
+ import { NativeModules, Platform } from 'react-native';
3
4
  import { WebView, WebViewMessageEvent } from 'react-native-webview';
4
5
  import EventBus from '../helpers/EventBus';
5
6
  import html, { HTML_PLACEHOLDER } from './html';
@@ -12,6 +13,8 @@ import type { WebViewMessage } from '../messages/webMessages';
12
13
  import { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';
13
14
  import { handleRequestDownload } from './WebComponent.utils';
14
15
 
16
+ const { UNAppInfo } = NativeModules;
17
+
15
18
  export interface WebComponentProps {
16
19
  type: WebComponentType;
17
20
  presentationMode?: PresentationMode,
@@ -31,6 +34,7 @@ export enum WebComponentType {
31
34
  activity = 'unit-elements-activity',
32
35
  slot = 'unit-elements-sdk-slot',
33
36
  account = 'unit-elements-account',
37
+ checkDeposit = 'unit-elements-check-deposit',
34
38
  achDebitPayment = 'unit-elements-ach-debit-payment',
35
39
  achCreditPayment = 'unit-elements-ach-credit-payment'
36
40
  }
@@ -39,6 +43,7 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
39
43
  const [unitScript, setUnitScript] = useState<string | undefined>(globalUnitScript);
40
44
  const [sourceHtml, setSourceHtml] = useState<string | null>(null);
41
45
  const [componentCurrentTheme, setComponentCurrentTheme] = useState<string | undefined>(props.theme ?? UnitSDK.getTheme());
46
+ const [baseName, setBaseName] = useState<string>();
42
47
  const width = props.width ?? '100%';
43
48
 
44
49
  const updateUnitScript = (data: SdkScriptFetched) => {
@@ -52,6 +57,26 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
52
57
  useListenerToBus({ busEventKey: SDKMessage.IS_SCRIPT_FETCHED, action: updateUnitScript });
53
58
  useListenerToBus({ busEventKey: SDKMessage.IS_SDK_INITIALIZED, action: updateInitializedParams });
54
59
 
60
+ useEffect(() => {
61
+
62
+ const getAppName = async () => {
63
+ // For iOS, we extend the app name from the HTML to display a prettier access request message.
64
+ // On Android, there is no request message sent from HTML.
65
+ try {
66
+ if (Platform.OS == 'ios') {
67
+ const name = await UNAppInfo.getBundleName();
68
+ setBaseName(name.replace(/ /g, '-'));
69
+ } else { // android
70
+ setBaseName('unit');
71
+ }
72
+ } catch (error: any) {
73
+ console.error(error);
74
+ }
75
+ };
76
+
77
+ getAppName();
78
+ }, []);
79
+
55
80
  useEffect(() => {
56
81
  if (!unitScript) {
57
82
  fetchUnitScript();
@@ -92,9 +117,16 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
92
117
  return null;
93
118
  };
94
119
 
120
+ if (!baseName) {
121
+ return null;
122
+ }
123
+
95
124
  return (
96
125
  <WebView
97
126
  ref={webRef}
127
+ originWhitelist={['*']}
128
+ mediaPlaybackRequiresUserAction={false}
129
+ allowsInlineMediaPlayback={true}
98
130
  cacheEnabled={false}
99
131
  scrollEnabled={props.isScrollable}
100
132
  nestedScrollEnabled={props.nestedScrollEnabled}
@@ -102,7 +134,9 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
102
134
  overScrollMode="never"
103
135
  injectedJavaScript={unitScript}
104
136
  style={{ width: width, flex: 1, opacity: 0.99}}
105
- source={{ html: sourceHtml }}
106
- onMessage={onMessage} />
137
+ source={{ html: sourceHtml, baseUrl: `https://${baseName}` }}
138
+ onMessage={onMessage}
139
+ androidHardwareAccelerationDisabled
140
+ />
107
141
  );
108
142
  });
@@ -1,5 +1,5 @@
1
1
  import { Platform } from 'react-native';
2
- import { DISPATCH_RENDERING_EVENT, LISTENERS, POST_MESSAGE_TO_SDK, POST_PAGE_HEIGHT } from '../scripts/html/bodyScript';
2
+ import { DISPATCH_RENDERING_EVENT, LISTENERS, POST_MESSAGE_TO_SDK, POST_PAGE_HEIGHT, DISPATCH_REQUEST_CARD_ACTION, DISPATCH_OPEN_ACTIONS_MENU, DISPATCH_REQUEST_ACCOUNT_ACTION, DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT } from '../scripts/html/bodyScript';
3
3
 
4
4
  export const HTML_PLACEHOLDER = {
5
5
  SCRIPT_UNIT: '<SCRIPT_UNIT>',
@@ -21,7 +21,7 @@ const htmlText = `
21
21
  }
22
22
  </script>
23
23
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
24
- </html>
24
+ </head>
25
25
 
26
26
  <body style="margin: 0;">
27
27
  ${HTML_PLACEHOLDER.BODY}
@@ -43,17 +43,30 @@ const htmlText = `
43
43
 
44
44
  ${LISTENERS.requestCloseFlow}
45
45
 
46
+ ${LISTENERS.cardActivated}
47
+
46
48
  ${LISTENERS.cardStatusChange}
47
49
 
48
50
  ${LISTENERS.unitRequestExternalSdk}
49
51
 
50
52
  ${LISTENERS.unitAccountChanged}
51
53
 
54
+ ${LISTENERS.unitActivityFiltersChanged}
55
+
52
56
  ${DISPATCH_RENDERING_EVENT}
53
57
 
58
+ ${DISPATCH_OPEN_ACTIONS_MENU}
59
+
60
+ ${DISPATCH_REQUEST_CARD_ACTION}
61
+
62
+ ${DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT}
63
+
64
+ ${DISPATCH_REQUEST_ACCOUNT_ACTION}
65
+
54
66
  ${HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE}
55
67
  </script>
56
68
  </body>
69
+ </html>
57
70
  `;
58
71
 
59
72
  export default htmlText;
@@ -1,16 +0,0 @@
1
- <resources xmlns:tools="http://schemas.android.com/tools">
2
- <!-- Base application theme. -->
3
- <style name="Theme.UnitWalletDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
4
- <!-- Primary brand color. -->
5
- <item name="colorPrimary">@color/purple_500</item>
6
- <item name="colorPrimaryVariant">@color/purple_700</item>
7
- <item name="colorOnPrimary">@color/white</item>
8
- <!-- Secondary brand color. -->
9
- <item name="colorSecondary">@color/teal_200</item>
10
- <item name="colorSecondaryVariant">@color/teal_700</item>
11
- <item name="colorOnSecondary">@color/black</item>
12
- <!-- Status bar color. -->
13
- <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
14
- <!-- Customize your theme here. -->
15
- </style>
16
- </resources>
@@ -1,16 +0,0 @@
1
- <resources xmlns:tools="http://schemas.android.com/tools">
2
- <!-- Base application theme. -->
3
- <style name="Theme.UnitWalletDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
4
- <!-- Primary brand color. -->
5
- <item name="colorPrimary">@color/purple_200</item>
6
- <item name="colorPrimaryVariant">@color/purple_700</item>
7
- <item name="colorOnPrimary">@color/black</item>
8
- <!-- Secondary brand color. -->
9
- <item name="colorSecondary">@color/teal_200</item>
10
- <item name="colorSecondaryVariant">@color/teal_200</item>
11
- <item name="colorOnSecondary">@color/black</item>
12
- <!-- Status bar color. -->
13
- <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
14
- <!-- Customize your theme here. -->
15
- </style>
16
- </resources>