@tap-payments/connect 2.5.14-test → 2.6.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 (37) hide show
  1. package/README.md +39 -24
  2. package/build/@types/config.d.ts +54 -0
  3. package/build/@types/config.js +1 -0
  4. package/build/@types/index.d.ts +16 -19
  5. package/build/api/index.js +14 -26
  6. package/build/constants/index.d.ts +5 -2
  7. package/build/constants/index.js +5 -2
  8. package/build/features/Connect/Connect.d.ts +1 -1
  9. package/build/features/Connect/Connect.js +23 -13
  10. package/build/features/Connect/ConnectAuth.d.ts +7 -0
  11. package/build/features/Connect/ConnectAuth.js +117 -0
  12. package/build/features/Connect/ConnectBank.d.ts +12 -0
  13. package/build/features/Connect/ConnectBank.js +118 -0
  14. package/build/features/Connect/ConnectBoard.d.ts +10 -0
  15. package/build/features/Connect/ConnectBoard.js +117 -0
  16. package/build/features/Connect/ConnectBrand.d.ts +12 -0
  17. package/build/features/Connect/ConnectBrand.js +118 -0
  18. package/build/features/Connect/ConnectEntity.d.ts +12 -0
  19. package/build/features/Connect/ConnectEntity.js +118 -0
  20. package/build/features/Connect/ConnectExpress.js +1 -13
  21. package/build/features/Connect/ConnectIndividual.d.ts +12 -0
  22. package/build/features/Connect/ConnectIndividual.js +118 -0
  23. package/build/features/Connect/ConnectPassword.d.ts +12 -0
  24. package/build/features/Connect/ConnectPassword.js +118 -0
  25. package/build/features/Connect/ConnectTax.d.ts +12 -0
  26. package/build/features/Connect/ConnectTax.js +118 -0
  27. package/build/features/Connect/index.d.ts +10 -2
  28. package/build/features/Connect/index.js +9 -1
  29. package/build/index.d.ts +3 -3
  30. package/build/index.js +10 -3
  31. package/build/utils/common.d.ts +2 -2
  32. package/build/utils/common.js +3 -3
  33. package/build/utils/config.d.ts +1 -1
  34. package/build/utils/config.js +5 -1
  35. package/build/utils/validation.d.ts +6 -0
  36. package/build/utils/validation.js +143 -5
  37. package/package.json +1 -1
@@ -1,21 +1,27 @@
1
1
  import { Language } from '../constants';
2
2
  export var validateConnectProps = function (props) {
3
- var publicKey = props.publicKey, mature = props.mature, country = props.country, language = props.language, scope = props.scope, open = props.open, domain = props.domain, board = props.board, lead = props.lead, onClose = props.onClose, onCreated = props.onCreated, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL;
3
+ var mode = props.mode, publicKey = props.publicKey, mature = props.mature, language = props.language, scope = props.scope, open = props.open, domain = props.domain, board = props.board, lead = props.lead, onClose = props.onClose, onCreated = props.onCreated, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, redirectUrl = props.redirectUrl;
4
+ if (!mode) {
5
+ throw new Error('mode is required');
6
+ }
7
+ if (!['page', 'popup'].includes(mode)) {
8
+ throw new Error('you can only use page or popup for mode');
9
+ }
4
10
  if (!publicKey) {
5
11
  throw new Error('publicKey is required');
6
12
  }
7
- if (!country) {
8
- throw new Error('country is required');
9
- }
10
13
  if (!language) {
11
14
  throw new Error('language is required');
12
15
  }
13
16
  if (![Language.AR, Language.EN].includes(language)) {
14
- throw new Error('You can only use AR or EN for language');
17
+ throw new Error('you can only use AR or EN for language');
15
18
  }
16
19
  if (!scope) {
17
20
  throw new Error('scope is required');
18
21
  }
22
+ if (scope === 'auth' && mode === 'page' && !redirectUrl) {
23
+ throw new Error('redirectUrl is required');
24
+ }
19
25
  if (!domain) {
20
26
  throw new Error('domain is required');
21
27
  }
@@ -50,3 +56,135 @@ export var validateConnectProps = function (props) {
50
56
  throw new Error('onSuccess must be a function');
51
57
  }
52
58
  };
59
+ export var validateConnectAuthProps = function (props) {
60
+ var publicKey = props.publicKey, country = props.country, language = props.language, open = props.open, domain = props.domain, lead = props.lead, onClose = props.onClose, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, data = props.data;
61
+ if (!data) {
62
+ throw new Error('data is required');
63
+ }
64
+ if (!Array.isArray(data)) {
65
+ throw new Error('data must be an array');
66
+ }
67
+ if (!publicKey) {
68
+ throw new Error('publicKey is required');
69
+ }
70
+ if (typeof country !== 'string') {
71
+ throw new Error('country should be from type string');
72
+ }
73
+ if (!language) {
74
+ throw new Error('language is required');
75
+ }
76
+ if (![Language.AR, Language.EN].includes(language)) {
77
+ throw new Error('you can only use AR or EN for language');
78
+ }
79
+ if (!domain) {
80
+ throw new Error('domain is required');
81
+ }
82
+ if (typeof open !== 'boolean') {
83
+ throw new Error('open is required, and must be a boolean');
84
+ }
85
+ if (typeof lead !== 'undefined' && typeof lead !== 'string') {
86
+ throw new Error('lead must be a string');
87
+ }
88
+ if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
89
+ throw new Error('postURL must be a string');
90
+ }
91
+ if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
92
+ throw new Error('onClose must be a function');
93
+ }
94
+ if (typeof onError !== 'undefined' && typeof onError !== 'function') {
95
+ throw new Error('onError must be a function');
96
+ }
97
+ if (typeof onReady !== 'undefined' && typeof onReady !== 'function') {
98
+ throw new Error('onReady must be a function');
99
+ }
100
+ if (typeof onSuccess !== 'undefined' && typeof onSuccess !== 'function') {
101
+ throw new Error('onSuccess must be a function');
102
+ }
103
+ };
104
+ export var validateBoardProps = function (props) {
105
+ var publicKey = props.publicKey, country = props.country, scope = props.scope, language = props.language, open = props.open, domain = props.domain, onClose = props.onClose, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, boardId = props.boardId;
106
+ if (!publicKey) {
107
+ throw new Error('publicKey is required');
108
+ }
109
+ if (typeof country !== 'string') {
110
+ throw new Error('country should be from type string');
111
+ }
112
+ if (!language) {
113
+ throw new Error('language is required');
114
+ }
115
+ if (!scope) {
116
+ throw new Error('scope is required');
117
+ }
118
+ if (![Language.AR, Language.EN].includes(language)) {
119
+ throw new Error('you can only use AR or EN for language');
120
+ }
121
+ if (!domain) {
122
+ throw new Error('domain is required');
123
+ }
124
+ if (!boardId) {
125
+ throw new Error('board id is required');
126
+ }
127
+ if (typeof open !== 'boolean') {
128
+ throw new Error('open is required, and must be a boolean');
129
+ }
130
+ if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
131
+ throw new Error('postURL must be a string');
132
+ }
133
+ if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
134
+ throw new Error('onClose must be a function');
135
+ }
136
+ if (typeof onError !== 'undefined' && typeof onError !== 'function') {
137
+ throw new Error('onError must be a function');
138
+ }
139
+ if (typeof onReady !== 'undefined' && typeof onReady !== 'function') {
140
+ throw new Error('onReady must be a function');
141
+ }
142
+ if (typeof onSuccess !== 'undefined' && typeof onSuccess !== 'function') {
143
+ throw new Error('onSuccess must be a function');
144
+ }
145
+ };
146
+ export var validateBoardOtherKitsProps = function (props) {
147
+ var publicKey = props.publicKey, country = props.country, scope = props.scope, language = props.language, open = props.open, domain = props.domain, onClose = props.onClose, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, verifyToken = props.verifyToken, onBoardButtonClick = props.onBoardButtonClick;
148
+ if (!publicKey) {
149
+ throw new Error('publicKey is required');
150
+ }
151
+ if (typeof country !== 'string') {
152
+ throw new Error('country should be from type string');
153
+ }
154
+ if (!language) {
155
+ throw new Error('language is required');
156
+ }
157
+ if (!scope) {
158
+ throw new Error('scope is required');
159
+ }
160
+ if (![Language.AR, Language.EN].includes(language)) {
161
+ throw new Error('you can only use AR or EN for language');
162
+ }
163
+ if (!domain) {
164
+ throw new Error('domain is required');
165
+ }
166
+ if (!verifyToken) {
167
+ throw new Error('token is required');
168
+ }
169
+ if (typeof open !== 'boolean') {
170
+ throw new Error('open is required, and must be a boolean');
171
+ }
172
+ if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
173
+ throw new Error('postURL must be a string');
174
+ }
175
+ if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
176
+ throw new Error('onClose must be a function');
177
+ }
178
+ if (typeof onError !== 'undefined' && typeof onError !== 'function') {
179
+ throw new Error('onError must be a function');
180
+ }
181
+ if (typeof onReady !== 'undefined' && typeof onReady !== 'function') {
182
+ throw new Error('onReady must be a function');
183
+ }
184
+ if (typeof onSuccess !== 'undefined' && typeof onSuccess !== 'function') {
185
+ throw new Error('onSuccess must be a function');
186
+ }
187
+ if (typeof onBoardButtonClick !== 'undefined' && typeof onBoardButtonClick !== 'function') {
188
+ throw new Error('onBoardButtonClick must be a function');
189
+ }
190
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/connect",
3
- "version": "2.5.14-test",
3
+ "version": "2.6.0",
4
4
  "description": "Tap Connect",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",