@miden-npm/react 2.0.2 → 2.0.4
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.
- package/dist/index.cjs +754 -361
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +685 -292
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -99,6 +99,10 @@ function buildDeviceInformation(partial) {
|
|
|
99
99
|
...partial
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
+
var toastConfig = {
|
|
103
|
+
position: "top-right",
|
|
104
|
+
style: { fontSize: "12px" }
|
|
105
|
+
};
|
|
102
106
|
|
|
103
107
|
// src/utils/api.util.ts
|
|
104
108
|
var getBaseUrl = (mode, caller) => {
|
|
@@ -123,7 +127,7 @@ var currencySign = (currency) => {
|
|
|
123
127
|
var formatAmount = (value, currency) => {
|
|
124
128
|
const num = typeof value === "string" ? parseFloat(value) : value;
|
|
125
129
|
if (isNaN(num)) return "0";
|
|
126
|
-
return `${currency ? currencySign(currency) : ""}
|
|
130
|
+
return `${currency ? currencySign(currency) : ""}${num?.toLocaleString(
|
|
127
131
|
"en-US"
|
|
128
132
|
)}`;
|
|
129
133
|
};
|
|
@@ -156,6 +160,254 @@ var restrictToNumericKeys = (event) => {
|
|
|
156
160
|
event.preventDefault();
|
|
157
161
|
}
|
|
158
162
|
};
|
|
163
|
+
var COUNTRIES = [
|
|
164
|
+
{ name: "Afghanistan", code: "AF", phoneCode: "+93", flag: "\u{1F1E6}\u{1F1EB}" },
|
|
165
|
+
{ name: "Albania", code: "AL", phoneCode: "+355", flag: "\u{1F1E6}\u{1F1F1}" },
|
|
166
|
+
{ name: "Algeria", code: "DZ", phoneCode: "+213", flag: "\u{1F1E9}\u{1F1FF}" },
|
|
167
|
+
{ name: "American Samoa", code: "AS", phoneCode: "+1", flag: "\u{1F1E6}\u{1F1F8}" },
|
|
168
|
+
{ name: "Andorra", code: "AD", phoneCode: "+376", flag: "\u{1F1E6}\u{1F1E9}" },
|
|
169
|
+
{ name: "Angola", code: "AO", phoneCode: "+244", flag: "\u{1F1E6}\u{1F1F4}" },
|
|
170
|
+
{ name: "Anguilla", code: "AI", phoneCode: "+1", flag: "\u{1F1E6}\u{1F1EE}" },
|
|
171
|
+
{ name: "Antarctica", code: "AQ", phoneCode: "+672", flag: "\u{1F1E6}\u{1F1F6}" },
|
|
172
|
+
{ name: "Antigua and Barbuda", code: "AG", phoneCode: "+1", flag: "\u{1F1E6}\u{1F1EC}" },
|
|
173
|
+
{ name: "Argentina", code: "AR", phoneCode: "+54", flag: "\u{1F1E6}\u{1F1F7}" },
|
|
174
|
+
{ name: "Armenia", code: "AM", phoneCode: "+374", flag: "\u{1F1E6}\u{1F1F2}" },
|
|
175
|
+
{ name: "Aruba", code: "AW", phoneCode: "+297", flag: "\u{1F1E6}\u{1F1FC}" },
|
|
176
|
+
{ name: "Australia", code: "AU", phoneCode: "+61", flag: "\u{1F1E6}\u{1F1FA}" },
|
|
177
|
+
{ name: "Austria", code: "AT", phoneCode: "+43", flag: "\u{1F1E6}\u{1F1F9}" },
|
|
178
|
+
{ name: "Azerbaijan", code: "AZ", phoneCode: "+994", flag: "\u{1F1E6}\u{1F1FF}" },
|
|
179
|
+
{ name: "Bahamas", code: "BS", phoneCode: "+1", flag: "\u{1F1E7}\u{1F1F8}" },
|
|
180
|
+
{ name: "Bahrain", code: "BH", phoneCode: "+973", flag: "\u{1F1E7}\u{1F1ED}" },
|
|
181
|
+
{ name: "Bangladesh", code: "BD", phoneCode: "+880", flag: "\u{1F1E7}\u{1F1E9}" },
|
|
182
|
+
{ name: "Barbados", code: "BB", phoneCode: "+1", flag: "\u{1F1E7}\u{1F1E7}" },
|
|
183
|
+
{ name: "Belarus", code: "BY", phoneCode: "+375", flag: "\u{1F1E7}\u{1F1FE}" },
|
|
184
|
+
{ name: "Belgium", code: "BE", phoneCode: "+32", flag: "\u{1F1E7}\u{1F1EA}" },
|
|
185
|
+
{ name: "Belize", code: "BZ", phoneCode: "+501", flag: "\u{1F1E7}\u{1F1FF}" },
|
|
186
|
+
{ name: "Benin", code: "BJ", phoneCode: "+229", flag: "\u{1F1E7}\u{1F1EF}" },
|
|
187
|
+
{ name: "Bermuda", code: "BM", phoneCode: "+1", flag: "\u{1F1E7}\u{1F1F2}" },
|
|
188
|
+
{ name: "Bhutan", code: "BT", phoneCode: "+975", flag: "\u{1F1E7}\u{1F1F9}" },
|
|
189
|
+
{ name: "Bolivia", code: "BO", phoneCode: "+591", flag: "\u{1F1E7}\u{1F1F4}" },
|
|
190
|
+
{ name: "Bosnia and Herzegovina", code: "BA", phoneCode: "+387", flag: "\u{1F1E7}\u{1F1E6}" },
|
|
191
|
+
{ name: "Botswana", code: "BW", phoneCode: "+267", flag: "\u{1F1E7}\u{1F1FC}" },
|
|
192
|
+
{ name: "Bouvet Island", code: "BV", phoneCode: "+47", flag: "\u{1F1E7}\u{1F1FB}" },
|
|
193
|
+
{ name: "Brazil", code: "BR", phoneCode: "+55", flag: "\u{1F1E7}\u{1F1F7}" },
|
|
194
|
+
{ name: "British Indian Ocean Territory", code: "IO", phoneCode: "+246", flag: "\u{1F1EE}\u{1F1F4}" },
|
|
195
|
+
{ name: "Brunei Darussalam", code: "BN", phoneCode: "+673", flag: "\u{1F1E7}\u{1F1F3}" },
|
|
196
|
+
{ name: "Bulgaria", code: "BG", phoneCode: "+359", flag: "\u{1F1E7}\u{1F1EC}" },
|
|
197
|
+
{ name: "Burkina Faso", code: "BF", phoneCode: "+226", flag: "\u{1F1E7}\u{1F1EB}" },
|
|
198
|
+
{ name: "Burundi", code: "BI", phoneCode: "+257", flag: "\u{1F1E7}\u{1F1EE}" },
|
|
199
|
+
{ name: "Cambodia", code: "KH", phoneCode: "+855", flag: "\u{1F1F0}\u{1F1ED}" },
|
|
200
|
+
{ name: "Cameroon", code: "CM", phoneCode: "+237", flag: "\u{1F1E8}\u{1F1F2}" },
|
|
201
|
+
{ name: "Canada", code: "CA", phoneCode: "+1", flag: "\u{1F1E8}\u{1F1E6}" },
|
|
202
|
+
{ name: "Cape Verde", code: "CV", phoneCode: "+238", flag: "\u{1F1E8}\u{1F1FB}" },
|
|
203
|
+
{ name: "Cayman Islands", code: "KY", phoneCode: "+1", flag: "\u{1F1F0}\u{1F1FE}" },
|
|
204
|
+
{ name: "Central African Republic", code: "CF", phoneCode: "+236", flag: "\u{1F1E8}\u{1F1EB}" },
|
|
205
|
+
{ name: "Chad", code: "TD", phoneCode: "+235", flag: "\u{1F1F9}\u{1F1E9}" },
|
|
206
|
+
{ name: "Chile", code: "CL", phoneCode: "+56", flag: "\u{1F1E8}\u{1F1F1}" },
|
|
207
|
+
{ name: "China", code: "CN", phoneCode: "+86", flag: "\u{1F1E8}\u{1F1F3}" },
|
|
208
|
+
{ name: "Christmas Island", code: "CX", phoneCode: "+61", flag: "\u{1F1E8}\u{1F1FD}" },
|
|
209
|
+
{ name: "Cocos (Keeling) Islands", code: "CC", phoneCode: "+61", flag: "\u{1F1E8}\u{1F1E8}" },
|
|
210
|
+
{ name: "Colombia", code: "CO", phoneCode: "+57", flag: "\u{1F1E8}\u{1F1F4}" },
|
|
211
|
+
{ name: "Comoros", code: "KM", phoneCode: "+269", flag: "\u{1F1F0}\u{1F1F2}" },
|
|
212
|
+
{ name: "Congo", code: "CG", phoneCode: "+242", flag: "\u{1F1E8}\u{1F1EC}" },
|
|
213
|
+
{ name: "Congo, Democratic Republic of the", code: "CD", phoneCode: "+243", flag: "\u{1F1E8}\u{1F1E9}" },
|
|
214
|
+
{ name: "Cook Islands", code: "CK", phoneCode: "+682", flag: "\u{1F1E8}\u{1F1F0}" },
|
|
215
|
+
{ name: "Costa Rica", code: "CR", phoneCode: "+506", flag: "\u{1F1E8}\u{1F1F7}" },
|
|
216
|
+
{ name: "C\xF4te d'Ivoire", code: "CI", phoneCode: "+225", flag: "\u{1F1E8}\u{1F1EE}" },
|
|
217
|
+
{ name: "Croatia", code: "HR", phoneCode: "+385", flag: "\u{1F1ED}\u{1F1F7}" },
|
|
218
|
+
{ name: "Cuba", code: "CU", phoneCode: "+53", flag: "\u{1F1E8}\u{1F1FA}" },
|
|
219
|
+
{ name: "Cyprus", code: "CY", phoneCode: "+357", flag: "\u{1F1E8}\u{1F1FE}" },
|
|
220
|
+
{ name: "Czech Republic", code: "CZ", phoneCode: "+420", flag: "\u{1F1E8}\u{1F1FF}" },
|
|
221
|
+
{ name: "Denmark", code: "DK", phoneCode: "+45", flag: "\u{1F1E9}\u{1F1F0}" },
|
|
222
|
+
{ name: "Djibouti", code: "DJ", phoneCode: "+253", flag: "\u{1F1E9}\u{1F1EF}" },
|
|
223
|
+
{ name: "Dominica", code: "DM", phoneCode: "+1", flag: "\u{1F1E9}\u{1F1F2}" },
|
|
224
|
+
{ name: "Dominican Republic", code: "DO", phoneCode: "+1", flag: "\u{1F1E9}\u{1F1F4}" },
|
|
225
|
+
{ name: "Ecuador", code: "EC", phoneCode: "+593", flag: "\u{1F1EA}\u{1F1E8}" },
|
|
226
|
+
{ name: "Egypt", code: "EG", phoneCode: "+20", flag: "\u{1F1EA}\u{1F1EC}" },
|
|
227
|
+
{ name: "El Salvador", code: "SV", phoneCode: "+503", flag: "\u{1F1F8}\u{1F1FB}" },
|
|
228
|
+
{ name: "Equatorial Guinea", code: "GQ", phoneCode: "+240", flag: "\u{1F1EC}\u{1F1F6}" },
|
|
229
|
+
{ name: "Eritrea", code: "ER", phoneCode: "+291", flag: "\u{1F1EA}\u{1F1F7}" },
|
|
230
|
+
{ name: "Estonia", code: "EE", phoneCode: "+372", flag: "\u{1F1EA}\u{1F1EA}" },
|
|
231
|
+
{ name: "Ethiopia", code: "ET", phoneCode: "+251", flag: "\u{1F1EA}\u{1F1F9}" },
|
|
232
|
+
{ name: "Falkland Islands (Malvinas)", code: "FK", phoneCode: "+500", flag: "\u{1F1EB}\u{1F1F0}" },
|
|
233
|
+
{ name: "Faroe Islands", code: "FO", phoneCode: "+298", flag: "\u{1F1EB}\u{1F1F4}" },
|
|
234
|
+
{ name: "Fiji", code: "FJ", phoneCode: "+679", flag: "\u{1F1EB}\u{1F1EF}" },
|
|
235
|
+
{ name: "Finland", code: "FI", phoneCode: "+358", flag: "\u{1F1EB}\u{1F1EE}" },
|
|
236
|
+
{ name: "France", code: "FR", phoneCode: "+33", flag: "\u{1F1EB}\u{1F1F7}" },
|
|
237
|
+
{ name: "French Guiana", code: "GF", phoneCode: "+594", flag: "\u{1F1EC}\u{1F1EB}" },
|
|
238
|
+
{ name: "French Polynesia", code: "PF", phoneCode: "+689", flag: "\u{1F1F5}\u{1F1EB}" },
|
|
239
|
+
{ name: "French Southern Territories", code: "TF", phoneCode: "+262", flag: "\u{1F1F9}\u{1F1EB}" },
|
|
240
|
+
{ name: "Gabon", code: "GA", phoneCode: "+240", flag: "\u{1F1EC}\u{1F1E6}" },
|
|
241
|
+
{ name: "Gambia", code: "GM", phoneCode: "+220", flag: "\u{1F1EC}\u{1F1F2}" },
|
|
242
|
+
{ name: "Georgia", code: "GE", phoneCode: "+995", flag: "\u{1F1EC}\u{1F1EA}" },
|
|
243
|
+
{ name: "Germany", code: "DE", phoneCode: "+49", flag: "\u{1F1E9}\u{1F1EA}" },
|
|
244
|
+
{ name: "Ghana", code: "GH", phoneCode: "+233", flag: "\u{1F1EC}\u{1F1ED}" },
|
|
245
|
+
{ name: "Gibraltar", code: "GI", phoneCode: "+350", flag: "\u{1F1EC}\u{1F1EE}" },
|
|
246
|
+
{ name: "Greece", code: "GR", phoneCode: "+30", flag: "\u{1F1EC}\u{1F1F7}" },
|
|
247
|
+
{ name: "Greenland", code: "GL", phoneCode: "+299", flag: "\u{1F1EC}\u{1F1F1}" },
|
|
248
|
+
{ name: "Grenada", code: "GD", phoneCode: "+1", flag: "\u{1F1EC}\u{1F1E9}" },
|
|
249
|
+
{ name: "Guadeloupe", code: "GP", phoneCode: "+590", flag: "\u{1F1EC}\u{1F1F5}" },
|
|
250
|
+
{ name: "Guam", code: "GU", phoneCode: "+1", flag: "\u{1F1EC}\u{1F1FA}" },
|
|
251
|
+
{ name: "Guatemala", code: "GT", phoneCode: "+502", flag: "\u{1F1EC}\u{1F1F9}" },
|
|
252
|
+
{ name: "Guernsey", code: "GG", phoneCode: "+44", flag: "\u{1F1EC}\u{1F1EC}" },
|
|
253
|
+
{ name: "Guinea", code: "GN", phoneCode: "+224", flag: "\u{1F1EC}\u{1F1F3}" },
|
|
254
|
+
{ name: "Guinea-Bissau", code: "GW", phoneCode: "+245", flag: "\u{1F1EC}\u{1F1FC}" },
|
|
255
|
+
{ name: "Guyana", code: "GY", phoneCode: "+592", flag: "\u{1F1EC}\u{1F1FE}" },
|
|
256
|
+
{ name: "Haiti", code: "HT", phoneCode: "+509", flag: "\u{1F1ED}\u{1F1F9}" },
|
|
257
|
+
{ name: "Heard Island and McDonald Islands", code: "HM", phoneCode: "+672", flag: "\u{1F1ED}\u{1F1F2}" },
|
|
258
|
+
{ name: "Holy See (Vatican City State)", code: "VA", phoneCode: "+39", flag: "\u{1F1FB}\u{1F1E6}" },
|
|
259
|
+
{ name: "Honduras", code: "HN", phoneCode: "+504", flag: "\u{1F1ED}\u{1F1F3}" },
|
|
260
|
+
{ name: "Hong Kong", code: "HK", phoneCode: "+852", flag: "\u{1F1ED}\u{1F1F0}" },
|
|
261
|
+
{ name: "Hungary", code: "HU", phoneCode: "+36", flag: "\u{1F1ED}\u{1F1FA}" },
|
|
262
|
+
{ name: "Iceland", code: "IS", phoneCode: "+354", flag: "\u{1F1EE}\u{1F1F8}" },
|
|
263
|
+
{ name: "India", code: "IN", phoneCode: "+91", flag: "\u{1F1EE}\u{1F1F3}" },
|
|
264
|
+
{ name: "Indonesia", code: "ID", phoneCode: "+62", flag: "\u{1F1EE}\u{1F1E9}" },
|
|
265
|
+
{ name: "Iran, Islamic Republic of", code: "IR", phoneCode: "+98", flag: "\u{1F1EE}\u{1F1F7}" },
|
|
266
|
+
{ name: "Iraq", code: "IQ", phoneCode: "+964", flag: "\u{1F1EE}\u{1F1F6}" },
|
|
267
|
+
{ name: "Ireland", code: "IE", phoneCode: "+353", flag: "\u{1F1EE}\u{1F1EA}" },
|
|
268
|
+
{ name: "Isle of Man", code: "IM", phoneCode: "+44", flag: "\u{1F1EE}\u{1F1F2}" },
|
|
269
|
+
{ name: "Israel", code: "IL", phoneCode: "+972", flag: "\u{1F1EE}\u{1F1F1}" },
|
|
270
|
+
{ name: "Italy", code: "IT", phoneCode: "+39", flag: "\u{1F1EE}\u{1F1F9}" },
|
|
271
|
+
{ name: "Jamaica", code: "JM", phoneCode: "+1", flag: "\u{1F1EF}\u{1F1F2}" },
|
|
272
|
+
{ name: "Japan", code: "JP", phoneCode: "+81", flag: "\u{1F1EF}\u{1F1F5}" },
|
|
273
|
+
{ name: "Jersey", code: "JE", phoneCode: "+44", flag: "\u{1F1EF}\u{1F1EA}" },
|
|
274
|
+
{ name: "Jordan", code: "JO", phoneCode: "+962", flag: "\u{1F1EF}\u{1F1F4}" },
|
|
275
|
+
{ name: "Kazakhstan", code: "KZ", phoneCode: "+7", flag: "\u{1F1F0}\u{1F1FF}" },
|
|
276
|
+
{ name: "Kenya", code: "KE", phoneCode: "+254", flag: "\u{1F1F0}\u{1F1EA}" },
|
|
277
|
+
{ name: "Kiribati", code: "KI", phoneCode: "+686", flag: "\u{1F1F0}\u{1F1EE}" },
|
|
278
|
+
{ name: "Korea, Democratic People's Republic of", code: "KP", phoneCode: "+850", flag: "\u{1F1F0}\u{1F1F5}" },
|
|
279
|
+
{ name: "Korea, Republic of", code: "KR", phoneCode: "+82", flag: "\u{1F1F0}\u{1F1F7}" },
|
|
280
|
+
{ name: "Kuwait", code: "KW", phoneCode: "+965", flag: "\u{1F1F0}\u{1F1FC}" },
|
|
281
|
+
{ name: "Kyrgyzstan", code: "KG", phoneCode: "+996", flag: "\u{1F1F0}\u{1F1EC}" },
|
|
282
|
+
{ name: "Lao People's Democratic Republic", code: "LA", phoneCode: "+856", flag: "\u{1F1F1}\u{1F1E6}" },
|
|
283
|
+
{ name: "Latvia", code: "LV", phoneCode: "+371", flag: "\u{1F1F1}\u{1F1FB}" },
|
|
284
|
+
{ name: "Lebanon", code: "LB", phoneCode: "+961", flag: "\u{1F1F1}\u{1F1E7}" },
|
|
285
|
+
{ name: "Lesotho", code: "LS", phoneCode: "+266", flag: "\u{1F1F1}\u{1F1F8}" },
|
|
286
|
+
{ name: "Liberia", code: "LR", phoneCode: "+231", flag: "\u{1F1F1}\u{1F1F7}" },
|
|
287
|
+
{ name: "Libya", code: "LY", phoneCode: "+218", flag: "\u{1F1F1}\u{1F1FE}" },
|
|
288
|
+
{ name: "Liechtenstein", code: "LI", phoneCode: "+423", flag: "\u{1F1F1}\u{1F1EE}" },
|
|
289
|
+
{ name: "Lithuania", code: "LT", phoneCode: "+370", flag: "\u{1F1F1}\u{1F1F9}" },
|
|
290
|
+
{ name: "Luxembourg", code: "LU", phoneCode: "+352", flag: "\u{1F1F1}\u{1F1FA}" },
|
|
291
|
+
{ name: "Macao", code: "MO", phoneCode: "+853", flag: "\u{1F1F2}\u{1F1F4}" },
|
|
292
|
+
{ name: "Macedonia, the former Yugoslav Republic of", code: "MK", phoneCode: "+389", flag: "\u{1F1F2}\u{1F1F0}" },
|
|
293
|
+
{ name: "Madagascar", code: "MG", phoneCode: "+261", flag: "\u{1F1F2}\u{1F1EC}" },
|
|
294
|
+
{ name: "Malawi", code: "MW", phoneCode: "+265", flag: "\u{1F1F2}\u{1F1FC}" },
|
|
295
|
+
{ name: "Malaysia", code: "MY", phoneCode: "+60", flag: "\u{1F1F2}\u{1F1FE}" },
|
|
296
|
+
{ name: "Maldives", code: "MV", phoneCode: "+960", flag: "\u{1F1F2}\u{1F1FB}" },
|
|
297
|
+
{ name: "Mali", code: "ML", phoneCode: "+223", flag: "\u{1F1F2}\u{1F1F1}" },
|
|
298
|
+
{ name: "Malta", code: "MT", phoneCode: "+356", flag: "\u{1F1F2}\u{1F1F9}" },
|
|
299
|
+
{ name: "Marshall Islands", code: "MH", phoneCode: "+692", flag: "\u{1F1F2}\u{1F1ED}" },
|
|
300
|
+
{ name: "Martinique", code: "MQ", phoneCode: "+596", flag: "\u{1F1F2}\u{1F1F6}" },
|
|
301
|
+
{ name: "Mauritania", code: "MR", phoneCode: "+222", flag: "\u{1F1F2}\u{1F1F7}" },
|
|
302
|
+
{ name: "Mauritius", code: "MU", phoneCode: "+230", flag: "\u{1F1F2}\u{1F1FA}" },
|
|
303
|
+
{ name: "Mayotte", code: "YT", phoneCode: "+262", flag: "\u{1F1FE}\u{1F1F9}" },
|
|
304
|
+
{ name: "Mexico", code: "MX", phoneCode: "+52", flag: "\u{1F1F2}\u{1F1FD}" },
|
|
305
|
+
{ name: "Micronesia, Federated States of", code: "FM", phoneCode: "+691", flag: "\u{1F1EB}\u{1F1F2}" },
|
|
306
|
+
{ name: "Moldova, Republic of", code: "MD", phoneCode: "+373", flag: "\u{1F1F2}\u{1F1E9}" },
|
|
307
|
+
{ name: "Monaco", code: "MC", phoneCode: "+377", flag: "\u{1F1F2}\u{1F1E8}" },
|
|
308
|
+
{ name: "Mongolia", code: "MN", phoneCode: "+976", flag: "\u{1F1F2}\u{1F1F3}" },
|
|
309
|
+
{ name: "Montenegro", code: "ME", phoneCode: "+382", flag: "\u{1F1F2}\u{1F1EA}" },
|
|
310
|
+
{ name: "Montserrat", code: "MS", phoneCode: "+1", flag: "\u{1F1F2}\u{1F1F8}" },
|
|
311
|
+
{ name: "Morocco", code: "MA", phoneCode: "+212", flag: "\u{1F1F2}\u{1F1E6}" },
|
|
312
|
+
{ name: "Mozambique", code: "MZ", phoneCode: "+258", flag: "\u{1F1F2}\u{1F1FF}" },
|
|
313
|
+
{ name: "Myanmar", code: "MM", phoneCode: "+95", flag: "\u{1F1F2}\u{1F1F2}" },
|
|
314
|
+
{ name: "Namibia", code: "NA", phoneCode: "+264", flag: "\u{1F1F3}\u{1F1E6}" },
|
|
315
|
+
{ name: "Nauru", code: "NR", phoneCode: "+674", flag: "\u{1F1F3}\u{1F1F7}" },
|
|
316
|
+
{ name: "Nepal", code: "NP", phoneCode: "+977", flag: "\u{1F1F3}\u{1F1F5}" },
|
|
317
|
+
{ name: "Netherlands", code: "NL", phoneCode: "+31", flag: "\u{1F1F3}\u{1F1F1}" },
|
|
318
|
+
{ name: "New Caledonia", code: "NC", phoneCode: "+687", flag: "\u{1F1F3}\u{1F1E8}" },
|
|
319
|
+
{ name: "New Zealand", code: "NZ", phoneCode: "+64", flag: "\u{1F1F3}\u{1F1FF}" },
|
|
320
|
+
{ name: "Nicaragua", code: "NI", phoneCode: "+505", flag: "\u{1F1F3}\u{1F1EE}" },
|
|
321
|
+
{ name: "Niger", code: "NE", phoneCode: "+227", flag: "\u{1F1F3}\u{1F1EA}" },
|
|
322
|
+
{ name: "Nigeria", code: "NG", phoneCode: "+234", flag: "\u{1F1F3}\u{1F1EC}" },
|
|
323
|
+
{ name: "Niue", code: "NU", phoneCode: "+683", flag: "\u{1F1F3}\u{1F1FA}" },
|
|
324
|
+
{ name: "Norfolk Island", code: "NF", phoneCode: "+672", flag: "\u{1F1F3}\u{1F1EB}" },
|
|
325
|
+
{ name: "Northern Mariana Islands", code: "MP", phoneCode: "+1", flag: "\u{1F1F2}\u{1F1F5}" },
|
|
326
|
+
{ name: "Norway", code: "NO", phoneCode: "+47", flag: "\u{1F1F3}\u{1F1F4}" },
|
|
327
|
+
{ name: "Oman", code: "OM", phoneCode: "+968", flag: "\u{1F1F4}\u{1F1F2}" },
|
|
328
|
+
{ name: "Pakistan", code: "PK", phoneCode: "+92", flag: "\u{1F1F5}\u{1F1F0}" },
|
|
329
|
+
{ name: "Palau", code: "PW", phoneCode: "+680", flag: "\u{1F1F5}\u{1F1FC}" },
|
|
330
|
+
{ name: "Palestinian Territory, Occupied", code: "PS", phoneCode: "+970", flag: "\u{1F1F5}\u{1F1F8}" },
|
|
331
|
+
{ name: "Panama", code: "PA", phoneCode: "+507", flag: "\u{1F1F5}\u{1F1E6}" },
|
|
332
|
+
{ name: "Papua New Guinea", code: "PG", phoneCode: "+675", flag: "\u{1F1F5}\u{1F1EC}" },
|
|
333
|
+
{ name: "Paraguay", code: "PY", phoneCode: "+595", flag: "\u{1F1F5}\u{1F1FE}" },
|
|
334
|
+
{ name: "Peru", code: "PE", phoneCode: "+51", flag: "\u{1F1F5}\u{1F1EA}" },
|
|
335
|
+
{ name: "Philippines", code: "PH", phoneCode: "+63", flag: "\u{1F1F5}\u{1F1ED}" },
|
|
336
|
+
{ name: "Pitcairn", code: "PN", phoneCode: "+64", flag: "\u{1F1F5}\u{1F1F3}" },
|
|
337
|
+
{ name: "Poland", code: "PL", phoneCode: "+48", flag: "\u{1F1F5}\u{1F1F1}" },
|
|
338
|
+
{ name: "Portugal", code: "PT", phoneCode: "+351", flag: "\u{1F1F5}\u{1F1F9}" },
|
|
339
|
+
{ name: "Puerto Rico", code: "PR", phoneCode: "+1", flag: "\u{1F1F5}\u{1F1F7}" },
|
|
340
|
+
{ name: "Qatar", code: "QA", phoneCode: "+974", flag: "\u{1F1F6}\u{1F1E6}" },
|
|
341
|
+
{ name: "R\xE9union", code: "RE", phoneCode: "+262", flag: "\u{1F1F7}\u{1F1EA}" },
|
|
342
|
+
{ name: "Romania", code: "RO", phoneCode: "+40", flag: "\u{1F1F7}\u{1F1F4}" },
|
|
343
|
+
{ name: "Russian Federation", code: "RU", phoneCode: "+7", flag: "\u{1F1F7}\u{1F1FA}" },
|
|
344
|
+
{ name: "Rwanda", code: "RW", phoneCode: "+250", flag: "\u{1F1F7}\u{1F1FC}" },
|
|
345
|
+
{ name: "Saint Barth\xE9lemy", code: "BL", phoneCode: "+590", flag: "\u{1F1E7}\u{1F1F1}" },
|
|
346
|
+
{ name: "Saint Helena, Ascension and Tristan da Cunha", code: "SH", phoneCode: "+290", flag: "\u{1F1F8}\u{1F1ED}" },
|
|
347
|
+
{ name: "Saint Kitts and Nevis", code: "KN", phoneCode: "+1", flag: "\u{1F1F0}\u{1F1F3}" },
|
|
348
|
+
{ name: "Saint Lucia", code: "LC", phoneCode: "+1", flag: "\u{1F1F1}\u{1F1E8}" },
|
|
349
|
+
{ name: "Saint Martin (French part)", code: "MF", phoneCode: "+590", flag: "\u{1F1F2}\u{1F1EB}" },
|
|
350
|
+
{ name: "Saint Pierre and Miquelon", code: "PM", phoneCode: "+508", flag: "\u{1F1F5}\u{1F1F2}" },
|
|
351
|
+
{ name: "Saint Vincent and the Grenadines", code: "VC", phoneCode: "+1", flag: "\u{1F1FB}\u{1F1E8}" },
|
|
352
|
+
{ name: "Samoa", code: "WS", phoneCode: "+685", flag: "\u{1F1FC}\u{1F1F8}" },
|
|
353
|
+
{ name: "San Marino", code: "SM", phoneCode: "+378", flag: "\u{1F1F8}\u{1F1F2}" },
|
|
354
|
+
{ name: "Sao Tome and Principe", code: "ST", phoneCode: "+239", flag: "\u{1F1F8}\u{1F1F9}" },
|
|
355
|
+
{ name: "Saudi Arabia", code: "SA", phoneCode: "+966", flag: "\u{1F1F8}\u{1F1E6}" },
|
|
356
|
+
{ name: "Senegal", code: "SN", phoneCode: "+221", flag: "\u{1F1F8}\u{1F1F3}" },
|
|
357
|
+
{ name: "Serbia", code: "RS", phoneCode: "+381", flag: "\u{1F1F7}\u{1F1F8}" },
|
|
358
|
+
{ name: "Seychelles", code: "SC", phoneCode: "+248", flag: "\u{1F1F8}\u{1F1E8}" },
|
|
359
|
+
{ name: "Sierra Leone", code: "SL", phoneCode: "+232", flag: "\u{1F1F8}\u{1F1F1}" },
|
|
360
|
+
{ name: "Singapore", code: "SG", phoneCode: "+65", flag: "\u{1F1F8}\u{1F1EC}" },
|
|
361
|
+
{ name: "Sint Maarten (Dutch part)", code: "SX", phoneCode: "+1", flag: "\u{1F1F8}\u{1F1FD}" },
|
|
362
|
+
{ name: "Slovakia", code: "SK", phoneCode: "+421", flag: "\u{1F1F8}\u{1F1F0}" },
|
|
363
|
+
{ name: "Slovenia", code: "SI", phoneCode: "+386", flag: "\u{1F1F8}\u{1F1EE}" },
|
|
364
|
+
{ name: "Solomon Islands", code: "SB", phoneCode: "+677", flag: "\u{1F1F8}\u{1F1E7}" },
|
|
365
|
+
{ name: "Somalia", code: "SO", phoneCode: "+252", flag: "\u{1F1F8}\u{1F1F4}" },
|
|
366
|
+
{ name: "South Africa", code: "ZA", phoneCode: "+27", flag: "\u{1F1FF}\u{1F1E6}" },
|
|
367
|
+
{ name: "South Georgia and the South Sandwich Islands", code: "GS", phoneCode: "+500", flag: "\u{1F1EC}\u{1F1F8}" },
|
|
368
|
+
{ name: "South Sudan", code: "SS", phoneCode: "+211", flag: "\u{1F1F8}\u{1F1F8}" },
|
|
369
|
+
{ name: "Spain", code: "ES", phoneCode: "+34", flag: "\u{1F1EA}\u{1F1F8}" },
|
|
370
|
+
{ name: "Sri Lanka", code: "LK", phoneCode: "+94", flag: "\u{1F1F1}\u{1F1F0}" },
|
|
371
|
+
{ name: "Sudan", code: "SD", phoneCode: "+249", flag: "\u{1F1F8}\u{1F1E9}" },
|
|
372
|
+
{ name: "Suriname", code: "SR", phoneCode: "+597", flag: "\u{1F1F8}\u{1F1F7}" },
|
|
373
|
+
{ name: "Svalbard and Jan Mayen", code: "SJ", phoneCode: "+47", flag: "\u{1F1F8}\u{1F1EF}" },
|
|
374
|
+
{ name: "Swaziland", code: "SZ", phoneCode: "+268", flag: "\u{1F1F8}\u{1F1FF}" },
|
|
375
|
+
{ name: "Sweden", code: "SE", phoneCode: "+46", flag: "\u{1F1F8}\u{1F1EA}" },
|
|
376
|
+
{ name: "Switzerland", code: "CH", phoneCode: "+41", flag: "\u{1F1E8}\u{1F1ED}" },
|
|
377
|
+
{ name: "Syrian Arab Republic", code: "SY", phoneCode: "+963", flag: "\u{1F1F8}\u{1F1FE}" },
|
|
378
|
+
{ name: "Taiwan, Province of China", code: "TW", phoneCode: "+886", flag: "\u{1F1F9}\u{1F1FC}" },
|
|
379
|
+
{ name: "Tajikistan", code: "TJ", phoneCode: "+992", flag: "\u{1F1F9}\u{1F1EF}" },
|
|
380
|
+
{ name: "Tanzania, United Republic of", code: "TZ", phoneCode: "+255", flag: "\u{1F1F9}\u{1F1FF}" },
|
|
381
|
+
{ name: "Thailand", code: "TH", phoneCode: "+66", flag: "\u{1F1F9}\u{1F1ED}" },
|
|
382
|
+
{ name: "Timor-Leste", code: "TL", phoneCode: "+670", flag: "\u{1F1F9}\u{1F1F1}" },
|
|
383
|
+
{ name: "Togo", code: "TG", phoneCode: "+228", flag: "\u{1F1F9}\u{1F1EC}" },
|
|
384
|
+
{ name: "Tokelau", code: "TK", phoneCode: "+690", flag: "\u{1F1F9}\u{1F1F0}" },
|
|
385
|
+
{ name: "Tonga", code: "TO", phoneCode: "+676", flag: "\u{1F1F9}\u{1F1F4}" },
|
|
386
|
+
{ name: "Trinidad and Tobago", code: "TT", phoneCode: "+1", flag: "\u{1F1F9}\u{1F1F9}" },
|
|
387
|
+
{ name: "Tunisia", code: "TN", phoneCode: "+216", flag: "\u{1F1F9}\u{1F1F3}" },
|
|
388
|
+
{ name: "Turkey", code: "TR", phoneCode: "+90", flag: "\u{1F1F9}\u{1F1F7}" },
|
|
389
|
+
{ name: "Turkmenistan", code: "TM", phoneCode: "+993", flag: "\u{1F1F9}\u{1F1F2}" },
|
|
390
|
+
{ name: "Turks and Caicos Islands", code: "TC", phoneCode: "+1", flag: "\u{1F1F9}\u{1F1E8}" },
|
|
391
|
+
{ name: "Tuvalu", code: "TV", phoneCode: "+688", flag: "\u{1F1F9}\u{1F1FB}" },
|
|
392
|
+
{ name: "Uganda", code: "UG", phoneCode: "+256", flag: "\u{1F1FA}\u{1F1EC}" },
|
|
393
|
+
{ name: "Ukraine", code: "UA", phoneCode: "+380", flag: "\u{1F1FA}\u{1F1E6}" },
|
|
394
|
+
{ name: "United Arab Emirates", code: "AE", phoneCode: "+971", flag: "\u{1F1E6}\u{1F1EA}" },
|
|
395
|
+
{ name: "United Kingdom", code: "GB", phoneCode: "+44", flag: "\u{1F1EC}\u{1F1E7}" },
|
|
396
|
+
{ name: "United States", code: "US", phoneCode: "+1", flag: "\u{1F1FA}\u{1F1F8}" },
|
|
397
|
+
{ name: "United States Minor Outlying Islands", code: "UM", phoneCode: "+1", flag: "\u{1F1FA}\u{1F1F2}" },
|
|
398
|
+
{ name: "Uruguay", code: "UY", phoneCode: "+598", flag: "\u{1F1FA}\u{1F1FE}" },
|
|
399
|
+
{ name: "Uzbekistan", code: "UZ", phoneCode: "+998", flag: "\u{1F1FA}\u{1F1FF}" },
|
|
400
|
+
{ name: "Vanuatu", code: "VU", phoneCode: "+678", flag: "\u{1F1FB}\u{1F1FA}" },
|
|
401
|
+
{ name: "Venezuela, Bolivarian Republic of", code: "VE", phoneCode: "+58", flag: "\u{1F1FB}\u{1F1EA}" },
|
|
402
|
+
{ name: "Viet Nam", code: "VN", phoneCode: "+84", flag: "\u{1F1FB}\u{1F1F3}" },
|
|
403
|
+
{ name: "Virgin Islands, British", code: "VG", phoneCode: "+1", flag: "\u{1F1FB}\u{1F1EC}" },
|
|
404
|
+
{ name: "Virgin Islands, U.S.", code: "VI", phoneCode: "+1", flag: "\u{1F1FB}\u{1F1EE}" },
|
|
405
|
+
{ name: "Wallis and Futuna", code: "WF", phoneCode: "+681", flag: "\u{1F1FC}\u{1F1EB}" },
|
|
406
|
+
{ name: "Western Sahara", code: "EH", phoneCode: "+212", flag: "\u{1F1EA}\u{1F1ED}" },
|
|
407
|
+
{ name: "Yemen", code: "YE", phoneCode: "+967", flag: "\u{1F1FE}\u{1F1EA}" },
|
|
408
|
+
{ name: "Zambia", code: "ZM", phoneCode: "+260", flag: "\u{1F1FF}\u{1F1F2}" },
|
|
409
|
+
{ name: "Zimbabwe", code: "ZW", phoneCode: "+263", flag: "\u{1F1FF}\u{1F1FC}" }
|
|
410
|
+
];
|
|
159
411
|
|
|
160
412
|
// src/utils/error.util.ts
|
|
161
413
|
var validateRegex = (value, regex) => regex.test(value);
|
|
@@ -1732,6 +1984,7 @@ var BaseSelect = ({
|
|
|
1732
1984
|
disabled = false,
|
|
1733
1985
|
loading = false,
|
|
1734
1986
|
validationError = "",
|
|
1987
|
+
showBottomText = true,
|
|
1735
1988
|
label = "",
|
|
1736
1989
|
hint = "",
|
|
1737
1990
|
required = false,
|
|
@@ -1985,8 +2238,8 @@ var BaseSelect = ({
|
|
|
1985
2238
|
]
|
|
1986
2239
|
}
|
|
1987
2240
|
),
|
|
1988
|
-
hint && /* @__PURE__ */ jsx29(BaseHint, { hint }),
|
|
1989
|
-
validationError && /* @__PURE__ */ jsx29(BaseInputError, { errorMessage: validationError })
|
|
2241
|
+
hint && showBottomText && /* @__PURE__ */ jsx29(BaseHint, { hint }),
|
|
2242
|
+
validationError && showBottomText && /* @__PURE__ */ jsx29(BaseInputError, { errorMessage: validationError })
|
|
1990
2243
|
] });
|
|
1991
2244
|
};
|
|
1992
2245
|
|
|
@@ -2035,6 +2288,7 @@ var BaseInput = ({
|
|
|
2035
2288
|
mask,
|
|
2036
2289
|
placeholder,
|
|
2037
2290
|
validationError = "",
|
|
2291
|
+
showBottomText = true,
|
|
2038
2292
|
hint = "",
|
|
2039
2293
|
rules = [],
|
|
2040
2294
|
isAmountInput = false,
|
|
@@ -2138,8 +2392,8 @@ var BaseInput = ({
|
|
|
2138
2392
|
]
|
|
2139
2393
|
}
|
|
2140
2394
|
),
|
|
2141
|
-
(hint || localHint) && /* @__PURE__ */ jsx31("p", { className: "text-body-3xs text-light-copy", children: localHint || hint }),
|
|
2142
|
-
(validationError || localError) && /* @__PURE__ */ jsx31("p", { className: "text-body-3xs text-red-500", children: localError || validationError })
|
|
2395
|
+
(hint || localHint) && showBottomText && /* @__PURE__ */ jsx31("p", { className: "text-body-3xs text-light-copy", children: localHint || hint }),
|
|
2396
|
+
(validationError || localError) && showBottomText && /* @__PURE__ */ jsx31("p", { className: "text-body-3xs text-red-500", children: localError || validationError })
|
|
2143
2397
|
] });
|
|
2144
2398
|
};
|
|
2145
2399
|
|
|
@@ -2413,11 +2667,97 @@ function BzpCheckoutButton({
|
|
|
2413
2667
|
}
|
|
2414
2668
|
|
|
2415
2669
|
// src/buzapay-checkout/checkout-card.tsx
|
|
2416
|
-
import { useEffect as
|
|
2670
|
+
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
2417
2671
|
|
|
2418
2672
|
// src/components/pay-by-card.tsx
|
|
2419
|
-
import { useEffect as
|
|
2673
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
2674
|
+
|
|
2675
|
+
// src/components/base/phone-number-input.tsx
|
|
2676
|
+
import React5, { useEffect as useEffect3 } from "react";
|
|
2420
2677
|
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2678
|
+
var BasePhoneNumberInput = ({
|
|
2679
|
+
phoneCodeOptions,
|
|
2680
|
+
value,
|
|
2681
|
+
onChange,
|
|
2682
|
+
onCodeChange,
|
|
2683
|
+
label = "",
|
|
2684
|
+
required = false,
|
|
2685
|
+
disabled = false,
|
|
2686
|
+
loading = false,
|
|
2687
|
+
validationError = "",
|
|
2688
|
+
hint = "",
|
|
2689
|
+
defaultCountryCode,
|
|
2690
|
+
preventPaste = false,
|
|
2691
|
+
showCopyIcon = false,
|
|
2692
|
+
containerClassName = "",
|
|
2693
|
+
inputClassName = "",
|
|
2694
|
+
placeholder
|
|
2695
|
+
}) => {
|
|
2696
|
+
const safeDefaultCode = phoneCodeOptions?.[0]?.value ?? "+1";
|
|
2697
|
+
const [selectedCode, setSelectedCode] = React5.useState(safeDefaultCode);
|
|
2698
|
+
const selectedMeta = React5.useMemo(() => {
|
|
2699
|
+
return phoneCodeOptions.find((o) => o.value === selectedCode);
|
|
2700
|
+
}, [phoneCodeOptions, selectedCode]);
|
|
2701
|
+
const getFormattedCode = (codeValue) => codeValue.split("-")[0];
|
|
2702
|
+
const handleCountryChange = (nextValue) => {
|
|
2703
|
+
setSelectedCode(nextValue);
|
|
2704
|
+
onCodeChange?.(getFormattedCode(nextValue));
|
|
2705
|
+
};
|
|
2706
|
+
const handleChange = (e) => {
|
|
2707
|
+
const incoming = e;
|
|
2708
|
+
onChange?.(incoming);
|
|
2709
|
+
};
|
|
2710
|
+
const computedPlaceholder = placeholder ?? selectedMeta?.placeholder ?? (label ? `Enter ${label.toLowerCase()}` : "Enter phone number");
|
|
2711
|
+
useEffect3(() => {
|
|
2712
|
+
const nextValue = defaultCountryCode ?? safeDefaultCode;
|
|
2713
|
+
setSelectedCode(nextValue);
|
|
2714
|
+
onCodeChange?.(getFormattedCode(nextValue));
|
|
2715
|
+
}, [defaultCountryCode]);
|
|
2716
|
+
return /* @__PURE__ */ jsxs23("div", { className: `flex flex-col gap-2`, children: [
|
|
2717
|
+
label ? /* @__PURE__ */ jsxs23("p", { className: "mb-0 text-body-2xs font-normal text-heading-text", children: [
|
|
2718
|
+
label,
|
|
2719
|
+
required && /* @__PURE__ */ jsx35("span", { className: "text-orange-required", children: " *" })
|
|
2720
|
+
] }) : null,
|
|
2721
|
+
/* @__PURE__ */ jsxs23("div", { className: `flex items-center gap-2 ${containerClassName}`, children: [
|
|
2722
|
+
/* @__PURE__ */ jsx35("div", { className: "w-1/3", children: /* @__PURE__ */ jsx35(
|
|
2723
|
+
BaseSelect,
|
|
2724
|
+
{
|
|
2725
|
+
required: true,
|
|
2726
|
+
options: phoneCodeOptions,
|
|
2727
|
+
value: selectedCode,
|
|
2728
|
+
showBottomText: false,
|
|
2729
|
+
itemImageType: "country",
|
|
2730
|
+
onChange: handleCountryChange,
|
|
2731
|
+
validationError,
|
|
2732
|
+
placeholder: "+234"
|
|
2733
|
+
}
|
|
2734
|
+
) }),
|
|
2735
|
+
/* @__PURE__ */ jsx35("div", { className: "w-2/3", children: /* @__PURE__ */ jsx35(
|
|
2736
|
+
BaseInput,
|
|
2737
|
+
{
|
|
2738
|
+
className: inputClassName,
|
|
2739
|
+
required,
|
|
2740
|
+
disabled,
|
|
2741
|
+
loading,
|
|
2742
|
+
validationError,
|
|
2743
|
+
showBottomText: false,
|
|
2744
|
+
hint,
|
|
2745
|
+
value,
|
|
2746
|
+
onChange: handleChange,
|
|
2747
|
+
rules: ["numeric"],
|
|
2748
|
+
preventPaste,
|
|
2749
|
+
showCopyIcon,
|
|
2750
|
+
placeholder: computedPlaceholder
|
|
2751
|
+
}
|
|
2752
|
+
) })
|
|
2753
|
+
] }),
|
|
2754
|
+
hint && /* @__PURE__ */ jsx35("p", { className: "text-body-3xs text-light-copy", children: hint }),
|
|
2755
|
+
validationError && /* @__PURE__ */ jsx35("p", { className: "text-body-3xs text-red-500", children: validationError })
|
|
2756
|
+
] });
|
|
2757
|
+
};
|
|
2758
|
+
|
|
2759
|
+
// src/components/pay-by-card.tsx
|
|
2760
|
+
import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2421
2761
|
function PayByCard({
|
|
2422
2762
|
secretKey,
|
|
2423
2763
|
paymentObject,
|
|
@@ -2430,6 +2770,7 @@ function PayByCard({
|
|
|
2430
2770
|
const [message, setMessage] = useState4("");
|
|
2431
2771
|
const [isMakingPayment, setIsMakingPayment] = useState4(false);
|
|
2432
2772
|
const [loading, setLoading] = useState4(false);
|
|
2773
|
+
const [defaultCountryCode, setDefaultCountryCode] = useState4("");
|
|
2433
2774
|
const [cardType, setCardType] = useState4("");
|
|
2434
2775
|
const [transactionReference, setTransactionReference] = useState4("");
|
|
2435
2776
|
const [loadingCountries, setLoadingCountries] = useState4(false);
|
|
@@ -2437,6 +2778,9 @@ function PayByCard({
|
|
|
2437
2778
|
const [rawCountries, setRawCountries] = useState4([]);
|
|
2438
2779
|
const [countries, setCountries] = useState4([]);
|
|
2439
2780
|
const [countryStates, setCountryStates] = useState4([]);
|
|
2781
|
+
const [phoneCodeOptions, setPhoneCodeOptions] = useState4(
|
|
2782
|
+
[]
|
|
2783
|
+
);
|
|
2440
2784
|
const [billingForm, setBillingForm] = useState4({
|
|
2441
2785
|
address1: "",
|
|
2442
2786
|
address2: "",
|
|
@@ -2445,7 +2789,8 @@ function PayByCard({
|
|
|
2445
2789
|
city: "",
|
|
2446
2790
|
country: "",
|
|
2447
2791
|
emailAddress: "",
|
|
2448
|
-
phoneNumber: ""
|
|
2792
|
+
phoneNumber: "",
|
|
2793
|
+
phoneNumberExt: ""
|
|
2449
2794
|
});
|
|
2450
2795
|
const [payForm, setPayForm] = useState4({
|
|
2451
2796
|
customerName: "",
|
|
@@ -2518,7 +2863,7 @@ function PayByCard({
|
|
|
2518
2863
|
setIsMakingPayment(true);
|
|
2519
2864
|
setMessage("");
|
|
2520
2865
|
const cardDetails = {
|
|
2521
|
-
pan: payForm.cardNo
|
|
2866
|
+
pan: payForm.cardNo ? payForm.cardNo.replace(/ /g, "") : "",
|
|
2522
2867
|
expiryDate: payForm.expireDate ?? "",
|
|
2523
2868
|
cvv: payForm.cvv ?? "",
|
|
2524
2869
|
cardScheme: cardType,
|
|
@@ -2533,7 +2878,7 @@ function PayByCard({
|
|
|
2533
2878
|
city: billingForm.city ?? "",
|
|
2534
2879
|
country: billingForm.country ?? "",
|
|
2535
2880
|
emailAddress: billingForm.emailAddress ?? "",
|
|
2536
|
-
phoneNumber: billingForm.phoneNumber
|
|
2881
|
+
phoneNumber: billingForm.phoneNumber ? `${billingForm.phoneNumberExt}${billingForm.phoneNumber}` : ""
|
|
2537
2882
|
};
|
|
2538
2883
|
const encryptedCardDetails = encryptPayload(secretKey, cardDetails);
|
|
2539
2884
|
let payload = null;
|
|
@@ -2569,7 +2914,6 @@ function PayByCard({
|
|
|
2569
2914
|
}
|
|
2570
2915
|
const request = caller === "buzapay" ? { ...payload, merchantId: secretKey } : { ...payloadMiden, merchantId: secretKey };
|
|
2571
2916
|
let response = await authorizeCardPayment(environment, request, caller);
|
|
2572
|
-
debugger;
|
|
2573
2917
|
if (response?.responseParam) {
|
|
2574
2918
|
response = decryptPayload(environment, response.responseParam);
|
|
2575
2919
|
}
|
|
@@ -2755,15 +3099,25 @@ function PayByCard({
|
|
|
2755
3099
|
setCardType(cardTypeHandler(event));
|
|
2756
3100
|
payRules.cardPin = cardType === "Verve" ? "required|numeric" : "";
|
|
2757
3101
|
};
|
|
2758
|
-
|
|
3102
|
+
useEffect4(() => {
|
|
2759
3103
|
(async () => {
|
|
2760
3104
|
await generatePaymentLinkHandler();
|
|
2761
3105
|
await getAllCountries();
|
|
3106
|
+
const codeOptions = COUNTRIES.map((country) => {
|
|
3107
|
+
return {
|
|
3108
|
+
value: `${country.phoneCode}-${country.code}`,
|
|
3109
|
+
label: `${country.phoneCode}`,
|
|
3110
|
+
flag: country.flag,
|
|
3111
|
+
phoneCode: country.phoneCode,
|
|
3112
|
+
countryCode: country.code
|
|
3113
|
+
};
|
|
3114
|
+
}).sort((a, b) => a.label.localeCompare(b.label));
|
|
3115
|
+
setPhoneCodeOptions(codeOptions);
|
|
2762
3116
|
})();
|
|
2763
3117
|
}, []);
|
|
2764
|
-
return /* @__PURE__ */
|
|
2765
|
-
formIndex === 0 && /* @__PURE__ */
|
|
2766
|
-
/* @__PURE__ */
|
|
3118
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-6", children: [
|
|
3119
|
+
formIndex === 0 && /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-6 overflow-y-auto", children: [
|
|
3120
|
+
/* @__PURE__ */ jsx36("div", { className: "col-span-2", children: /* @__PURE__ */ jsx36(
|
|
2767
3121
|
BaseInput,
|
|
2768
3122
|
{
|
|
2769
3123
|
label: "Address Line 1",
|
|
@@ -2778,7 +3132,7 @@ function PayByCard({
|
|
|
2778
3132
|
validationError: billingErrors.address1 ?? ""
|
|
2779
3133
|
}
|
|
2780
3134
|
) }),
|
|
2781
|
-
/* @__PURE__ */
|
|
3135
|
+
/* @__PURE__ */ jsx36("div", { className: "col-span-2", children: /* @__PURE__ */ jsx36(
|
|
2782
3136
|
BaseInput,
|
|
2783
3137
|
{
|
|
2784
3138
|
label: "Address Line 2",
|
|
@@ -2787,7 +3141,7 @@ function PayByCard({
|
|
|
2787
3141
|
validationError: billingErrors.address2 ?? ""
|
|
2788
3142
|
}
|
|
2789
3143
|
) }),
|
|
2790
|
-
/* @__PURE__ */
|
|
3144
|
+
/* @__PURE__ */ jsx36(
|
|
2791
3145
|
BaseSelect,
|
|
2792
3146
|
{
|
|
2793
3147
|
label: "Select Country",
|
|
@@ -2798,6 +3152,12 @@ function PayByCard({
|
|
|
2798
3152
|
onChange: (e) => {
|
|
2799
3153
|
setBillingForm({ ...billingForm, country: e, state: "" });
|
|
2800
3154
|
getStates(e);
|
|
3155
|
+
const selectedCountry = COUNTRIES.filter(
|
|
3156
|
+
(c) => c.code.toLowerCase() === e.toLowerCase()
|
|
3157
|
+
)[0];
|
|
3158
|
+
if (selectedCountry) {
|
|
3159
|
+
setDefaultCountryCode(`${selectedCountry.phoneCode}-${selectedCountry.code}`);
|
|
3160
|
+
}
|
|
2801
3161
|
if (billingErrors.country) {
|
|
2802
3162
|
setBillingErrors((er) => ({ ...er, country: "" }));
|
|
2803
3163
|
}
|
|
@@ -2805,7 +3165,7 @@ function PayByCard({
|
|
|
2805
3165
|
validationError: billingErrors.country ?? ""
|
|
2806
3166
|
}
|
|
2807
3167
|
),
|
|
2808
|
-
/* @__PURE__ */
|
|
3168
|
+
/* @__PURE__ */ jsx36(
|
|
2809
3169
|
BaseSelect,
|
|
2810
3170
|
{
|
|
2811
3171
|
label: "Select State",
|
|
@@ -2822,7 +3182,7 @@ function PayByCard({
|
|
|
2822
3182
|
validationError: billingErrors.state ?? ""
|
|
2823
3183
|
}
|
|
2824
3184
|
),
|
|
2825
|
-
/* @__PURE__ */
|
|
3185
|
+
/* @__PURE__ */ jsx36(
|
|
2826
3186
|
BaseInput,
|
|
2827
3187
|
{
|
|
2828
3188
|
label: "City",
|
|
@@ -2837,7 +3197,7 @@ function PayByCard({
|
|
|
2837
3197
|
validationError: billingErrors.city ?? ""
|
|
2838
3198
|
}
|
|
2839
3199
|
),
|
|
2840
|
-
/* @__PURE__ */
|
|
3200
|
+
/* @__PURE__ */ jsx36(
|
|
2841
3201
|
BaseInput,
|
|
2842
3202
|
{
|
|
2843
3203
|
label: "Postal Code",
|
|
@@ -2852,7 +3212,7 @@ function PayByCard({
|
|
|
2852
3212
|
validationError: billingErrors.postalCode ?? ""
|
|
2853
3213
|
}
|
|
2854
3214
|
),
|
|
2855
|
-
/* @__PURE__ */
|
|
3215
|
+
/* @__PURE__ */ jsx36(
|
|
2856
3216
|
BaseInput,
|
|
2857
3217
|
{
|
|
2858
3218
|
label: "Email",
|
|
@@ -2867,29 +3227,37 @@ function PayByCard({
|
|
|
2867
3227
|
validationError: billingErrors.emailAddress ?? ""
|
|
2868
3228
|
}
|
|
2869
3229
|
),
|
|
2870
|
-
/* @__PURE__ */
|
|
2871
|
-
|
|
3230
|
+
/* @__PURE__ */ jsx36("div", { className: "col-span-2", children: /* @__PURE__ */ jsx36(
|
|
3231
|
+
BasePhoneNumberInput,
|
|
2872
3232
|
{
|
|
2873
3233
|
label: "Phone Number",
|
|
2874
3234
|
required: true,
|
|
2875
3235
|
value: billingForm.phoneNumber,
|
|
3236
|
+
phoneCodeOptions,
|
|
3237
|
+
defaultCountryCode,
|
|
2876
3238
|
onChange: (e) => {
|
|
2877
3239
|
setBillingForm({ ...billingForm, phoneNumber: e });
|
|
2878
3240
|
if (billingErrors.phoneNumber) {
|
|
2879
3241
|
setBillingErrors((er) => ({ ...er, phoneNumber: "" }));
|
|
2880
3242
|
}
|
|
2881
3243
|
},
|
|
3244
|
+
onCodeChange: (e) => {
|
|
3245
|
+
setBillingForm({ ...billingForm, phoneNumberExt: e });
|
|
3246
|
+
if (billingErrors.phoneNumberExt) {
|
|
3247
|
+
setBillingErrors((er) => ({ ...er, phoneNumberExt: "" }));
|
|
3248
|
+
}
|
|
3249
|
+
},
|
|
2882
3250
|
validationError: billingErrors.phoneNumber ?? ""
|
|
2883
3251
|
}
|
|
2884
|
-
)
|
|
3252
|
+
) })
|
|
2885
3253
|
] }),
|
|
2886
|
-
formIndex === 1 && /* @__PURE__ */
|
|
3254
|
+
formIndex === 1 && /* @__PURE__ */ jsxs24(
|
|
2887
3255
|
"div",
|
|
2888
3256
|
{
|
|
2889
3257
|
className: "grid grid-cols-2 gap-6 overflow-y-auto",
|
|
2890
3258
|
style: { maxHeight: 320 },
|
|
2891
3259
|
children: [
|
|
2892
|
-
/* @__PURE__ */
|
|
3260
|
+
/* @__PURE__ */ jsx36("div", { className: "col-span-2", children: /* @__PURE__ */ jsx36(
|
|
2893
3261
|
BaseInput,
|
|
2894
3262
|
{
|
|
2895
3263
|
label: "Card Name",
|
|
@@ -2904,7 +3272,7 @@ function PayByCard({
|
|
|
2904
3272
|
validationError: payErrors.customerName ?? ""
|
|
2905
3273
|
}
|
|
2906
3274
|
) }),
|
|
2907
|
-
/* @__PURE__ */
|
|
3275
|
+
/* @__PURE__ */ jsx36("div", { className: "col-span-2", children: /* @__PURE__ */ jsx36(
|
|
2908
3276
|
BaseInput,
|
|
2909
3277
|
{
|
|
2910
3278
|
label: "Card Number",
|
|
@@ -2923,7 +3291,7 @@ function PayByCard({
|
|
|
2923
3291
|
validationError: payErrors.cardNo ?? ""
|
|
2924
3292
|
}
|
|
2925
3293
|
) }),
|
|
2926
|
-
/* @__PURE__ */
|
|
3294
|
+
/* @__PURE__ */ jsx36(
|
|
2927
3295
|
BaseInput,
|
|
2928
3296
|
{
|
|
2929
3297
|
label: "Expiry Date",
|
|
@@ -2939,7 +3307,7 @@ function PayByCard({
|
|
|
2939
3307
|
validationError: payErrors.expireDate ?? ""
|
|
2940
3308
|
}
|
|
2941
3309
|
),
|
|
2942
|
-
/* @__PURE__ */
|
|
3310
|
+
/* @__PURE__ */ jsx36(
|
|
2943
3311
|
BaseInput,
|
|
2944
3312
|
{
|
|
2945
3313
|
label: "CVV",
|
|
@@ -2955,7 +3323,7 @@ function PayByCard({
|
|
|
2955
3323
|
validationError: payErrors.cvv ?? ""
|
|
2956
3324
|
}
|
|
2957
3325
|
),
|
|
2958
|
-
cardType === "Verve" && /* @__PURE__ */
|
|
3326
|
+
cardType === "Verve" && /* @__PURE__ */ jsx36(
|
|
2959
3327
|
BaseInput,
|
|
2960
3328
|
{
|
|
2961
3329
|
label: "Card Pin",
|
|
@@ -2975,7 +3343,7 @@ function PayByCard({
|
|
|
2975
3343
|
]
|
|
2976
3344
|
}
|
|
2977
3345
|
),
|
|
2978
|
-
/* @__PURE__ */
|
|
3346
|
+
/* @__PURE__ */ jsx36(
|
|
2979
3347
|
BaseButton,
|
|
2980
3348
|
{
|
|
2981
3349
|
label: formIndex === 0 ? "Proceed" : `Pay ${formatAmountHandler}`,
|
|
@@ -2993,11 +3361,11 @@ function PayByCard({
|
|
|
2993
3361
|
// src/components/pay-by-transfer.tsx
|
|
2994
3362
|
import {
|
|
2995
3363
|
useCallback as useCallback3,
|
|
2996
|
-
useEffect as
|
|
3364
|
+
useEffect as useEffect5,
|
|
2997
3365
|
useRef as useRef2,
|
|
2998
3366
|
useState as useState5
|
|
2999
3367
|
} from "react";
|
|
3000
|
-
import { jsx as
|
|
3368
|
+
import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3001
3369
|
var PayByTransfer = ({
|
|
3002
3370
|
secretKey,
|
|
3003
3371
|
paymentObject,
|
|
@@ -3208,19 +3576,19 @@ var PayByTransfer = ({
|
|
|
3208
3576
|
intervalRef.current = null;
|
|
3209
3577
|
}
|
|
3210
3578
|
};
|
|
3211
|
-
|
|
3579
|
+
useEffect5(() => {
|
|
3212
3580
|
(async () => {
|
|
3213
3581
|
await generatePaymentLinkHandler();
|
|
3214
3582
|
})();
|
|
3215
3583
|
}, []);
|
|
3216
|
-
|
|
3584
|
+
useEffect5(() => {
|
|
3217
3585
|
if (remainingSeconds < 0 && intervalRef.current) {
|
|
3218
3586
|
stopTimer();
|
|
3219
3587
|
}
|
|
3220
3588
|
}, [remainingSeconds]);
|
|
3221
|
-
return /* @__PURE__ */
|
|
3222
|
-
formIndex === 0 && /* @__PURE__ */
|
|
3223
|
-
/* @__PURE__ */
|
|
3589
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-10", children: [
|
|
3590
|
+
formIndex === 0 && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-10", children: [
|
|
3591
|
+
/* @__PURE__ */ jsx37(
|
|
3224
3592
|
BaseInput,
|
|
3225
3593
|
{
|
|
3226
3594
|
label: "Customer Name",
|
|
@@ -3235,7 +3603,7 @@ var PayByTransfer = ({
|
|
|
3235
3603
|
validationError: transferErrors.customerName ?? ""
|
|
3236
3604
|
}
|
|
3237
3605
|
),
|
|
3238
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ jsx37(
|
|
3239
3607
|
BaseButton,
|
|
3240
3608
|
{
|
|
3241
3609
|
label: `Pay ${formatAmountHandler}`,
|
|
@@ -3247,8 +3615,8 @@ var PayByTransfer = ({
|
|
|
3247
3615
|
}
|
|
3248
3616
|
)
|
|
3249
3617
|
] }),
|
|
3250
|
-
formIndex === 1 && /* @__PURE__ */
|
|
3251
|
-
/* @__PURE__ */
|
|
3618
|
+
formIndex === 1 && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-10", children: [
|
|
3619
|
+
/* @__PURE__ */ jsxs25(
|
|
3252
3620
|
"div",
|
|
3253
3621
|
{
|
|
3254
3622
|
className: [
|
|
@@ -3256,22 +3624,22 @@ var PayByTransfer = ({
|
|
|
3256
3624
|
caller === "miden" ? "bg-[#FAFDFF] border border-[#F0FAFF]" : "bg-[#EFF7FF]"
|
|
3257
3625
|
].join(" "),
|
|
3258
3626
|
children: [
|
|
3259
|
-
/* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ jsx37(
|
|
3260
3628
|
BaseLabelInfo,
|
|
3261
3629
|
{
|
|
3262
3630
|
label: "Bank Name",
|
|
3263
3631
|
value: `${paymentAccountDetails?.bank} ${paymentAccountDetails?.accountName}`
|
|
3264
3632
|
}
|
|
3265
3633
|
),
|
|
3266
|
-
/* @__PURE__ */
|
|
3267
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
|
|
3635
|
+
/* @__PURE__ */ jsx37(
|
|
3268
3636
|
BaseLabelInfo,
|
|
3269
3637
|
{
|
|
3270
3638
|
label: "Account Number",
|
|
3271
3639
|
value: paymentAccountDetails?.accountNumber
|
|
3272
3640
|
}
|
|
3273
3641
|
),
|
|
3274
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsx37(
|
|
3275
3643
|
BaseCopy,
|
|
3276
3644
|
{
|
|
3277
3645
|
color: "#9DBFDE",
|
|
@@ -3279,20 +3647,20 @@ var PayByTransfer = ({
|
|
|
3279
3647
|
}
|
|
3280
3648
|
)
|
|
3281
3649
|
] }),
|
|
3282
|
-
/* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
3284
|
-
/* @__PURE__ */
|
|
3650
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
|
|
3651
|
+
/* @__PURE__ */ jsx37(BaseLabelInfo, { label: "Amount", value: formatAmountHandler }),
|
|
3652
|
+
/* @__PURE__ */ jsx37(BaseCopy, { color: "#9DBFDE", copyText: formatAmountHandler })
|
|
3285
3653
|
] })
|
|
3286
3654
|
]
|
|
3287
3655
|
}
|
|
3288
3656
|
),
|
|
3289
|
-
caller === "buzapay" && /* @__PURE__ */
|
|
3657
|
+
caller === "buzapay" && /* @__PURE__ */ jsxs25("p", { className: "w-2/3 mx-auto text-center text-body-2xs font-medium text-sub-copy", children: [
|
|
3290
3658
|
"This account is for this transaction only and expires in",
|
|
3291
3659
|
" ",
|
|
3292
|
-
/* @__PURE__ */
|
|
3660
|
+
/* @__PURE__ */ jsx37("span", { className: "text-orange-500", children: remainingSeconds >= 0 ? countDownTime : "00:00" })
|
|
3293
3661
|
] }),
|
|
3294
|
-
caller === "miden" && /* @__PURE__ */
|
|
3295
|
-
/* @__PURE__ */
|
|
3662
|
+
caller === "miden" && /* @__PURE__ */ jsxs25("div", { className: "p-4 rounded-lg bg-[#FAFDFF] flex items-center gap-3", children: [
|
|
3663
|
+
/* @__PURE__ */ jsx37(
|
|
3296
3664
|
BaseCircularCountdown,
|
|
3297
3665
|
{
|
|
3298
3666
|
value: remainingSeconds,
|
|
@@ -3303,16 +3671,16 @@ var PayByTransfer = ({
|
|
|
3303
3671
|
color: "#3b82f6"
|
|
3304
3672
|
}
|
|
3305
3673
|
),
|
|
3306
|
-
/* @__PURE__ */
|
|
3674
|
+
/* @__PURE__ */ jsxs25("p", { className: "text-body-3xs font-medium text-light-copy", children: [
|
|
3307
3675
|
"This account is for this transaction only and expires in",
|
|
3308
|
-
/* @__PURE__ */
|
|
3676
|
+
/* @__PURE__ */ jsxs25("span", { className: "text-[#1383E8] ml-2", children: [
|
|
3309
3677
|
countDownTime,
|
|
3310
3678
|
"..."
|
|
3311
3679
|
] })
|
|
3312
3680
|
] })
|
|
3313
3681
|
] }),
|
|
3314
|
-
/* @__PURE__ */
|
|
3315
|
-
/* @__PURE__ */
|
|
3682
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4", children: [
|
|
3683
|
+
/* @__PURE__ */ jsx37(
|
|
3316
3684
|
BaseButton,
|
|
3317
3685
|
{
|
|
3318
3686
|
label: "I have paid the money",
|
|
@@ -3323,7 +3691,7 @@ var PayByTransfer = ({
|
|
|
3323
3691
|
onClick: getReferenceDetails
|
|
3324
3692
|
}
|
|
3325
3693
|
),
|
|
3326
|
-
/* @__PURE__ */
|
|
3694
|
+
/* @__PURE__ */ jsx37(
|
|
3327
3695
|
"button",
|
|
3328
3696
|
{
|
|
3329
3697
|
type: "button",
|
|
@@ -3338,8 +3706,8 @@ var PayByTransfer = ({
|
|
|
3338
3706
|
};
|
|
3339
3707
|
|
|
3340
3708
|
// src/components/pay-by-stable-coin.tsx
|
|
3341
|
-
import { useEffect as
|
|
3342
|
-
import { Fragment as Fragment3, jsx as
|
|
3709
|
+
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
3710
|
+
import { Fragment as Fragment3, jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3343
3711
|
var PayByStableCoin = ({
|
|
3344
3712
|
secretKey,
|
|
3345
3713
|
paymentObject,
|
|
@@ -3558,16 +3926,16 @@ var PayByStableCoin = ({
|
|
|
3558
3926
|
}
|
|
3559
3927
|
};
|
|
3560
3928
|
const amountPlusNetworkFee = addressDetails ? Number(addressDetails.transactionAmount) + addressDetails.networkFee : 0;
|
|
3561
|
-
|
|
3929
|
+
useEffect6(() => {
|
|
3562
3930
|
(async () => {
|
|
3563
3931
|
await generatePaymentLinkHandler();
|
|
3564
3932
|
await getAllStableCoins();
|
|
3565
3933
|
})();
|
|
3566
3934
|
}, []);
|
|
3567
|
-
return /* @__PURE__ */
|
|
3568
|
-
formIndex === 0 && /* @__PURE__ */
|
|
3569
|
-
/* @__PURE__ */
|
|
3570
|
-
/* @__PURE__ */
|
|
3935
|
+
return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-6", children: [
|
|
3936
|
+
formIndex === 0 && /* @__PURE__ */ jsxs26(Fragment3, { children: [
|
|
3937
|
+
/* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-1 gap-6", children: [
|
|
3938
|
+
/* @__PURE__ */ jsx38(
|
|
3571
3939
|
BaseSelect,
|
|
3572
3940
|
{
|
|
3573
3941
|
label: "Select Crypto",
|
|
@@ -3585,7 +3953,7 @@ var PayByStableCoin = ({
|
|
|
3585
3953
|
validationError: stableCoinErrors.stableCoin ?? ""
|
|
3586
3954
|
}
|
|
3587
3955
|
),
|
|
3588
|
-
/* @__PURE__ */
|
|
3956
|
+
/* @__PURE__ */ jsx38(
|
|
3589
3957
|
BaseSelect,
|
|
3590
3958
|
{
|
|
3591
3959
|
label: "Select Network",
|
|
@@ -3603,7 +3971,7 @@ var PayByStableCoin = ({
|
|
|
3603
3971
|
}
|
|
3604
3972
|
)
|
|
3605
3973
|
] }),
|
|
3606
|
-
/* @__PURE__ */
|
|
3974
|
+
/* @__PURE__ */ jsx38(
|
|
3607
3975
|
BaseButton,
|
|
3608
3976
|
{
|
|
3609
3977
|
label: `Pay ${formatAmountHandler}`,
|
|
@@ -3615,22 +3983,22 @@ var PayByStableCoin = ({
|
|
|
3615
3983
|
}
|
|
3616
3984
|
)
|
|
3617
3985
|
] }),
|
|
3618
|
-
formIndex === 1 && /* @__PURE__ */
|
|
3619
|
-
caller === "buzapay" && /* @__PURE__ */
|
|
3620
|
-
/* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3622
|
-
/* @__PURE__ */
|
|
3986
|
+
formIndex === 1 && /* @__PURE__ */ jsxs26("div", { children: [
|
|
3987
|
+
caller === "buzapay" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-6", children: [
|
|
3988
|
+
/* @__PURE__ */ jsxs26("div", { className: "mx-auto", children: [
|
|
3989
|
+
/* @__PURE__ */ jsx38(IconQrCode, {}),
|
|
3990
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-4xs text-light-copy font-normal text-center", children: generateAddressPayload?.currency })
|
|
3623
3991
|
] }),
|
|
3624
|
-
/* @__PURE__ */
|
|
3625
|
-
/* @__PURE__ */
|
|
3626
|
-
/* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
3628
|
-
/* @__PURE__ */
|
|
3629
|
-
/* @__PURE__ */
|
|
3630
|
-
/* @__PURE__ */
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
/* @__PURE__ */
|
|
3633
|
-
/* @__PURE__ */
|
|
3992
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-6 border-c border-grey-100 p-4 rounded-2xl bg-light-white-50", children: [
|
|
3993
|
+
/* @__PURE__ */ jsxs26("div", { className: "border-b border-grey-border pb-4 flex flex-col gap-2", children: [
|
|
3994
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "Network" }),
|
|
3995
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex justify-between", children: [
|
|
3996
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
|
|
3997
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-2xs font-medium text-sub-copy", children: addressDetails?.chain }),
|
|
3998
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2", children: [
|
|
3999
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "*Est. arrival = 3 mins" }),
|
|
4000
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "|" }),
|
|
4001
|
+
/* @__PURE__ */ jsx38(
|
|
3634
4002
|
BaseCurrencyAmount,
|
|
3635
4003
|
{
|
|
3636
4004
|
currency: generateAddressPayload?.currency ?? "",
|
|
@@ -3643,21 +4011,21 @@ var PayByStableCoin = ({
|
|
|
3643
4011
|
)
|
|
3644
4012
|
] })
|
|
3645
4013
|
] }),
|
|
3646
|
-
/* @__PURE__ */
|
|
4014
|
+
/* @__PURE__ */ jsx38(IconArrowSwap, {})
|
|
3647
4015
|
] })
|
|
3648
4016
|
] }),
|
|
3649
|
-
/* @__PURE__ */
|
|
3650
|
-
/* @__PURE__ */
|
|
3651
|
-
/* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
3653
|
-
/* @__PURE__ */
|
|
4017
|
+
/* @__PURE__ */ jsxs26("div", { className: "pb-4 flex flex-col gap-2", children: [
|
|
4018
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "Deposit Address >" }),
|
|
4019
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex justify-between", children: [
|
|
4020
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-2xs font-medium text-sub-copy w-2/3 break-words", children: addressDetails?.walletAddress }),
|
|
4021
|
+
/* @__PURE__ */ jsx38(BaseCopy, { copyText: addressDetails?.walletAddress ?? "" })
|
|
3654
4022
|
] })
|
|
3655
4023
|
] })
|
|
3656
4024
|
] }),
|
|
3657
|
-
/* @__PURE__ */
|
|
3658
|
-
/* @__PURE__ */
|
|
3659
|
-
/* @__PURE__ */
|
|
3660
|
-
/* @__PURE__ */
|
|
4025
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-2", children: [
|
|
4026
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between border-b border-grey-border py-3", children: [
|
|
4027
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-2xs font-medium text-primary-black", children: "Network fee" }),
|
|
4028
|
+
/* @__PURE__ */ jsx38(
|
|
3661
4029
|
BaseCurrencyAmount,
|
|
3662
4030
|
{
|
|
3663
4031
|
currency: generateAddressPayload?.currency ?? "",
|
|
@@ -3667,9 +4035,9 @@ var PayByStableCoin = ({
|
|
|
3667
4035
|
}
|
|
3668
4036
|
)
|
|
3669
4037
|
] }),
|
|
3670
|
-
/* @__PURE__ */
|
|
3671
|
-
/* @__PURE__ */
|
|
3672
|
-
/* @__PURE__ */
|
|
4038
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between py-4", children: [
|
|
4039
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-0 text-body-lg font-semibold text-primary-black", children: "Pay" }),
|
|
4040
|
+
/* @__PURE__ */ jsx38(
|
|
3673
4041
|
BaseCurrencyAmount,
|
|
3674
4042
|
{
|
|
3675
4043
|
currency: generateAddressPayload?.currency ?? "",
|
|
@@ -3682,7 +4050,7 @@ var PayByStableCoin = ({
|
|
|
3682
4050
|
)
|
|
3683
4051
|
] })
|
|
3684
4052
|
] }),
|
|
3685
|
-
/* @__PURE__ */
|
|
4053
|
+
/* @__PURE__ */ jsx38("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ jsx38(
|
|
3686
4054
|
BaseButton,
|
|
3687
4055
|
{
|
|
3688
4056
|
label: "Confirm Payment",
|
|
@@ -3694,17 +4062,17 @@ var PayByStableCoin = ({
|
|
|
3694
4062
|
}
|
|
3695
4063
|
) })
|
|
3696
4064
|
] }),
|
|
3697
|
-
caller === "miden" && /* @__PURE__ */
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3700
|
-
/* @__PURE__ */
|
|
4065
|
+
caller === "miden" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-6", children: [
|
|
4066
|
+
/* @__PURE__ */ jsxs26("div", { className: "p-4 rounded-lg flex flex-col gap-6 bg-[#FAFDFF] border border-[#F0FAFF]", children: [
|
|
4067
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
|
|
4068
|
+
/* @__PURE__ */ jsx38(
|
|
3701
4069
|
BaseLabelInfo,
|
|
3702
4070
|
{
|
|
3703
4071
|
label: "Chain",
|
|
3704
4072
|
value: addressDetails?.chain ?? ""
|
|
3705
4073
|
}
|
|
3706
4074
|
),
|
|
3707
|
-
/* @__PURE__ */
|
|
4075
|
+
/* @__PURE__ */ jsx38(
|
|
3708
4076
|
BaseCopy,
|
|
3709
4077
|
{
|
|
3710
4078
|
color: "#9DBFDE",
|
|
@@ -3712,15 +4080,15 @@ var PayByStableCoin = ({
|
|
|
3712
4080
|
}
|
|
3713
4081
|
)
|
|
3714
4082
|
] }),
|
|
3715
|
-
/* @__PURE__ */
|
|
3716
|
-
/* @__PURE__ */
|
|
4083
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
|
|
4084
|
+
/* @__PURE__ */ jsx38(
|
|
3717
4085
|
BaseLabelInfo,
|
|
3718
4086
|
{
|
|
3719
4087
|
label: "Wallet Address",
|
|
3720
4088
|
value: addressDetails?.walletAddress ?? ""
|
|
3721
4089
|
}
|
|
3722
4090
|
),
|
|
3723
|
-
/* @__PURE__ */
|
|
4091
|
+
/* @__PURE__ */ jsx38(
|
|
3724
4092
|
BaseCopy,
|
|
3725
4093
|
{
|
|
3726
4094
|
color: "#9DBFDE",
|
|
@@ -3728,9 +4096,9 @@ var PayByStableCoin = ({
|
|
|
3728
4096
|
}
|
|
3729
4097
|
)
|
|
3730
4098
|
] }),
|
|
3731
|
-
/* @__PURE__ */
|
|
3732
|
-
/* @__PURE__ */
|
|
3733
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col", children: [
|
|
4100
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-1 text-body-4xs font-medium text-light-copy uppercase", children: "Amount" }),
|
|
4101
|
+
/* @__PURE__ */ jsx38(
|
|
3734
4102
|
BaseCurrencyAmount,
|
|
3735
4103
|
{
|
|
3736
4104
|
currency: generateAddressPayload?.currency ?? "",
|
|
@@ -3742,17 +4110,17 @@ var PayByStableCoin = ({
|
|
|
3742
4110
|
}
|
|
3743
4111
|
)
|
|
3744
4112
|
] }),
|
|
3745
|
-
/* @__PURE__ */
|
|
3746
|
-
/* @__PURE__ */
|
|
3747
|
-
/* @__PURE__ */
|
|
3748
|
-
/* @__PURE__ */
|
|
4113
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex gap-4 items-center justify-center", children: [
|
|
4114
|
+
/* @__PURE__ */ jsx38("div", { className: "w-24 border border-[#E1EBF5]" }),
|
|
4115
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-2 text-body-2xs text-[#5F738C] font-normal", children: "Or" }),
|
|
4116
|
+
/* @__PURE__ */ jsx38("div", { className: "w-24 border border-[#E1EBF5]" })
|
|
3749
4117
|
] }),
|
|
3750
|
-
/* @__PURE__ */
|
|
3751
|
-
/* @__PURE__ */
|
|
3752
|
-
/* @__PURE__ */
|
|
4118
|
+
/* @__PURE__ */ jsxs26("div", { className: "mx-auto", children: [
|
|
4119
|
+
/* @__PURE__ */ jsx38("p", { className: "mb-2 text-body-xs text-primary font-semibold text-center", children: "Scan to Pay" }),
|
|
4120
|
+
/* @__PURE__ */ jsx38(IconQrCode, {})
|
|
3753
4121
|
] })
|
|
3754
4122
|
] }),
|
|
3755
|
-
/* @__PURE__ */
|
|
4123
|
+
/* @__PURE__ */ jsx38("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ jsx38(
|
|
3756
4124
|
BaseButton,
|
|
3757
4125
|
{
|
|
3758
4126
|
label: "I have made this payment",
|
|
@@ -3769,10 +4137,10 @@ var PayByStableCoin = ({
|
|
|
3769
4137
|
};
|
|
3770
4138
|
|
|
3771
4139
|
// src/buzapay-checkout/checkout-card.tsx
|
|
3772
|
-
import
|
|
4140
|
+
import toast, { Toaster } from "react-hot-toast";
|
|
4141
|
+
import { jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3773
4142
|
function BzpCheckoutCard({
|
|
3774
4143
|
secretKey,
|
|
3775
|
-
options,
|
|
3776
4144
|
environment = "sandbox",
|
|
3777
4145
|
paymentObject = {
|
|
3778
4146
|
merchantName: "",
|
|
@@ -3780,8 +4148,7 @@ function BzpCheckoutCard({
|
|
|
3780
4148
|
currency: "",
|
|
3781
4149
|
email: "",
|
|
3782
4150
|
phoneNumber: "",
|
|
3783
|
-
narration: ""
|
|
3784
|
-
redirectUrl: ""
|
|
4151
|
+
narration: ""
|
|
3785
4152
|
},
|
|
3786
4153
|
onPaymentAuthorized,
|
|
3787
4154
|
onError
|
|
@@ -3806,131 +4173,144 @@ function BzpCheckoutCard({
|
|
|
3806
4173
|
setSuccessObject({ ...event });
|
|
3807
4174
|
if (event.paymentStatus === "authorized") {
|
|
3808
4175
|
setCheckoutState("SUCCESS");
|
|
4176
|
+
toast.success("Payment authorization successful.", toastConfig);
|
|
4177
|
+
} else if (event.paymentStatus === "confirmed") {
|
|
4178
|
+
setCheckoutState("SUCCESS");
|
|
4179
|
+
toast.success("Payment confirmed.", toastConfig);
|
|
3809
4180
|
} else if (event.paymentStatus === "payment failed") {
|
|
3810
4181
|
setCheckoutState("PENDING");
|
|
4182
|
+
toast.error("Payment pending.", toastConfig);
|
|
3811
4183
|
} else if (event.paymentStatus === "used") {
|
|
3812
4184
|
setCheckoutState("USED");
|
|
3813
4185
|
} else {
|
|
3814
4186
|
setCheckoutState("PENDING");
|
|
4187
|
+
toast.error("Payment pending.", toastConfig);
|
|
3815
4188
|
}
|
|
3816
4189
|
onPaymentAuthorized?.(event);
|
|
3817
4190
|
};
|
|
3818
|
-
|
|
3819
|
-
|
|
4191
|
+
const onErrorHandler = (error) => {
|
|
4192
|
+
toast.error(error.errorMessage ?? "Payment failed.", toastConfig);
|
|
4193
|
+
onError?.(error);
|
|
4194
|
+
};
|
|
4195
|
+
useEffect7(() => {
|
|
4196
|
+
let options = [];
|
|
3820
4197
|
if (paymentObject.currency === "USD") {
|
|
3821
4198
|
if (paymentObject.amount < 50) {
|
|
3822
|
-
|
|
4199
|
+
options = paymentTypeOptions.filter(
|
|
3823
4200
|
(option) => option.value !== "BANK_TRANSFER" && option.value !== "STABLE_COIN"
|
|
3824
4201
|
);
|
|
3825
4202
|
} else {
|
|
3826
|
-
|
|
4203
|
+
options = paymentTypeOptions.filter(
|
|
3827
4204
|
(option) => option.value !== "BANK_TRANSFER"
|
|
3828
4205
|
);
|
|
3829
4206
|
}
|
|
3830
4207
|
} else {
|
|
3831
|
-
|
|
4208
|
+
options = paymentTypeOptions.filter(
|
|
3832
4209
|
(option) => option.value !== "STABLE_COIN"
|
|
3833
4210
|
);
|
|
3834
4211
|
}
|
|
3835
|
-
setFilteredPaymentTypeOptions(
|
|
4212
|
+
setFilteredPaymentTypeOptions(options);
|
|
3836
4213
|
}, [paymentObject.currency, paymentObject.amount]);
|
|
3837
|
-
|
|
4214
|
+
useEffect7(() => {
|
|
3838
4215
|
if (filteredPaymentTypeOptions.length) {
|
|
3839
4216
|
setPaymentType(filteredPaymentTypeOptions[0].value);
|
|
3840
4217
|
}
|
|
3841
4218
|
}, [filteredPaymentTypeOptions]);
|
|
3842
|
-
return /* @__PURE__ */
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
/* @__PURE__ */
|
|
3846
|
-
|
|
4219
|
+
return /* @__PURE__ */ jsxs27(BaseCard, { children: [
|
|
4220
|
+
/* @__PURE__ */ jsx39(Toaster, {}),
|
|
4221
|
+
/* @__PURE__ */ jsxs27("div", { className: "grid grid-cols-3", children: [
|
|
4222
|
+
checkoutState === "PENDING" && /* @__PURE__ */ jsxs27("div", { className: "bg-[#EFF7FF] px-6 py-8 flex flex-col gap-5 col-span-1 rounded-l-xl", children: [
|
|
4223
|
+
/* @__PURE__ */ jsx39("p", { className: "text-heading-text text-body-xs font-semibold", children: "Pay with" }),
|
|
4224
|
+
/* @__PURE__ */ jsx39(
|
|
4225
|
+
BaseRadioGroup,
|
|
4226
|
+
{
|
|
4227
|
+
options: filteredPaymentTypeOptions,
|
|
4228
|
+
selectedChange: (e) => paymentTypeHandler(e)
|
|
4229
|
+
}
|
|
4230
|
+
)
|
|
4231
|
+
] }),
|
|
4232
|
+
/* @__PURE__ */ jsxs27(
|
|
4233
|
+
"div",
|
|
3847
4234
|
{
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
4235
|
+
className: checkoutState === "SUCCESS" || checkoutState === "USED" && paymentType === "BANK_TRANSFER" ? "col-span-3" : "col-span-2",
|
|
4236
|
+
children: [
|
|
4237
|
+
checkoutState === "PENDING" && /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between px-12 py-8", children: [
|
|
4238
|
+
paymentObject.logoUrl ? /* @__PURE__ */ jsx39(
|
|
4239
|
+
BaseImage,
|
|
4240
|
+
{
|
|
4241
|
+
src: paymentObject.logoUrl ?? "",
|
|
4242
|
+
alt: "Merchant Logo",
|
|
4243
|
+
width: 52,
|
|
4244
|
+
height: 52,
|
|
4245
|
+
customClass: "rounded-lg object-fit"
|
|
4246
|
+
}
|
|
4247
|
+
) : /* @__PURE__ */ jsx39(
|
|
4248
|
+
"div",
|
|
4249
|
+
{
|
|
4250
|
+
className: "bg-heading-text rounded flex flex-col justify-center",
|
|
4251
|
+
style: { width: "52px", height: "52px" },
|
|
4252
|
+
children: /* @__PURE__ */ jsx39("p", { className: "text-white text-center text-body-2xs font-medium", children: "Logo" })
|
|
4253
|
+
}
|
|
4254
|
+
),
|
|
4255
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", children: [
|
|
4256
|
+
/* @__PURE__ */ jsx39("p", { className: "text-body-2xs font-regular text-sub-copy text-right", children: paymentObject.merchantName }),
|
|
4257
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-body-2xs font-regular text-sub-copy text-right", children: [
|
|
4258
|
+
"Pay:",
|
|
4259
|
+
" ",
|
|
4260
|
+
/* @__PURE__ */ jsx39("span", { className: "text-orange-500 font-extrabold", children: formatAmount(paymentObject.amount, paymentObject.currency) })
|
|
4261
|
+
] })
|
|
4262
|
+
] })
|
|
4263
|
+
] }),
|
|
4264
|
+
checkoutState === "PENDING" && /* @__PURE__ */ jsx39("div", { className: "max-h-[32rem] overflow-y-scroll px-10 pb-10 pt-2", children: paymentType === "CARD" ? /* @__PURE__ */ jsx39(
|
|
4265
|
+
PayByCard,
|
|
3861
4266
|
{
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
4267
|
+
secretKey,
|
|
4268
|
+
environment,
|
|
4269
|
+
paymentObject,
|
|
4270
|
+
onPaymentAuthorized: setSuccess,
|
|
4271
|
+
onError: onErrorHandler
|
|
3867
4272
|
}
|
|
3868
|
-
) : /* @__PURE__ */
|
|
3869
|
-
|
|
4273
|
+
) : paymentType === "BANK_TRANSFER" ? /* @__PURE__ */ jsx39(
|
|
4274
|
+
PayByTransfer,
|
|
3870
4275
|
{
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
4276
|
+
secretKey,
|
|
4277
|
+
environment,
|
|
4278
|
+
paymentObject,
|
|
4279
|
+
onPaymentAuthorized: setSuccess,
|
|
4280
|
+
onError: onErrorHandler
|
|
3874
4281
|
}
|
|
3875
|
-
)
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
paymentObject,
|
|
3900
|
-
onPaymentAuthorized: setSuccess,
|
|
3901
|
-
onError
|
|
3902
|
-
}
|
|
3903
|
-
) : /* @__PURE__ */ jsx38(
|
|
3904
|
-
PayByStableCoin,
|
|
3905
|
-
{
|
|
3906
|
-
secretKey,
|
|
3907
|
-
environment,
|
|
3908
|
-
paymentObject,
|
|
3909
|
-
onPaymentAuthorized: setSuccess,
|
|
3910
|
-
onError
|
|
3911
|
-
}
|
|
3912
|
-
) }),
|
|
3913
|
-
checkoutState === "SUCCESS" && /* @__PURE__ */ jsx38(
|
|
3914
|
-
BaseSuccess,
|
|
3915
|
-
{
|
|
3916
|
-
amount: paymentObject.amount,
|
|
3917
|
-
currency: paymentObject.currency,
|
|
3918
|
-
redirectUrl: paymentObject.redirectUrl ?? "",
|
|
3919
|
-
successObject
|
|
3920
|
-
}
|
|
3921
|
-
)
|
|
3922
|
-
]
|
|
3923
|
-
}
|
|
3924
|
-
)
|
|
3925
|
-
] }) });
|
|
4282
|
+
) : /* @__PURE__ */ jsx39(
|
|
4283
|
+
PayByStableCoin,
|
|
4284
|
+
{
|
|
4285
|
+
secretKey,
|
|
4286
|
+
environment,
|
|
4287
|
+
paymentObject,
|
|
4288
|
+
onPaymentAuthorized: setSuccess,
|
|
4289
|
+
onError: onErrorHandler
|
|
4290
|
+
}
|
|
4291
|
+
) }),
|
|
4292
|
+
checkoutState === "SUCCESS" || checkoutState === "USED" && paymentType === "BANK_TRANSFER" && /* @__PURE__ */ jsx39(
|
|
4293
|
+
BaseSuccess,
|
|
4294
|
+
{
|
|
4295
|
+
amount: paymentObject.amount,
|
|
4296
|
+
currency: paymentObject.currency,
|
|
4297
|
+
redirectUrl: paymentObject.redirectUrl ?? "",
|
|
4298
|
+
successObject
|
|
4299
|
+
}
|
|
4300
|
+
)
|
|
4301
|
+
]
|
|
4302
|
+
}
|
|
4303
|
+
)
|
|
4304
|
+
] })
|
|
4305
|
+
] });
|
|
3926
4306
|
}
|
|
3927
4307
|
|
|
3928
4308
|
// src/miden-checkout/checkout-button.tsx
|
|
3929
4309
|
import { useState as useState9 } from "react";
|
|
3930
4310
|
|
|
3931
4311
|
// src/miden-checkout/checkout-iframe.tsx
|
|
3932
|
-
import { useCallback as useCallback4, useEffect as
|
|
3933
|
-
import { jsx as
|
|
4312
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useRef as useRef3, useState as useState8 } from "react";
|
|
4313
|
+
import { jsx as jsx40, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3934
4314
|
function MidenCheckoutIframe({
|
|
3935
4315
|
style = {
|
|
3936
4316
|
width: "100%",
|
|
@@ -4014,18 +4394,18 @@ function MidenCheckoutIframe({
|
|
|
4014
4394
|
setLoading(false);
|
|
4015
4395
|
}
|
|
4016
4396
|
};
|
|
4017
|
-
|
|
4397
|
+
useEffect8(() => {
|
|
4018
4398
|
if (!containerRef.current) return;
|
|
4019
4399
|
generatePaymentLinkHandler();
|
|
4020
4400
|
}, []);
|
|
4021
|
-
return /* @__PURE__ */
|
|
4022
|
-
/* @__PURE__ */
|
|
4023
|
-
loading && /* @__PURE__ */
|
|
4401
|
+
return /* @__PURE__ */ jsxs28("div", { className: "relative", style, children: [
|
|
4402
|
+
/* @__PURE__ */ jsx40("div", { ref: containerRef, className: "w-full h-full" }),
|
|
4403
|
+
loading && /* @__PURE__ */ jsx40("div", { className: "absolute inset-0 grid place-items-center bg-white/60", children: /* @__PURE__ */ jsx40(IconLoader, {}) })
|
|
4024
4404
|
] });
|
|
4025
4405
|
}
|
|
4026
4406
|
|
|
4027
4407
|
// src/miden-checkout/checkout-button.tsx
|
|
4028
|
-
import { jsx as
|
|
4408
|
+
import { jsx as jsx41, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4029
4409
|
function MidenCheckoutButton({
|
|
4030
4410
|
secretKey,
|
|
4031
4411
|
environment = "sandbox",
|
|
@@ -4082,15 +4462,15 @@ function MidenCheckoutButton({
|
|
|
4082
4462
|
setLoading(false);
|
|
4083
4463
|
}
|
|
4084
4464
|
};
|
|
4085
|
-
return urlLaunchUrl && mode === "iframe" ? /* @__PURE__ */
|
|
4465
|
+
return urlLaunchUrl && mode === "iframe" ? /* @__PURE__ */ jsx41(
|
|
4086
4466
|
MidenCheckoutIframe,
|
|
4087
4467
|
{
|
|
4088
4468
|
url: urlLaunchUrl,
|
|
4089
4469
|
secretKey,
|
|
4090
4470
|
environment
|
|
4091
4471
|
}
|
|
4092
|
-
) : /* @__PURE__ */
|
|
4093
|
-
/* @__PURE__ */
|
|
4472
|
+
) : /* @__PURE__ */ jsxs29("div", { children: [
|
|
4473
|
+
/* @__PURE__ */ jsx41(
|
|
4094
4474
|
BaseButton,
|
|
4095
4475
|
{
|
|
4096
4476
|
label: "Pay",
|
|
@@ -4101,13 +4481,14 @@ function MidenCheckoutButton({
|
|
|
4101
4481
|
onClick: generatePaymentLinkHandler
|
|
4102
4482
|
}
|
|
4103
4483
|
),
|
|
4104
|
-
/* @__PURE__ */
|
|
4484
|
+
/* @__PURE__ */ jsx41(BaseInputError, { errorMessage: message })
|
|
4105
4485
|
] });
|
|
4106
4486
|
}
|
|
4107
4487
|
|
|
4108
4488
|
// src/miden-checkout/checkout-card.tsx
|
|
4109
|
-
import { useEffect as
|
|
4110
|
-
import {
|
|
4489
|
+
import { useEffect as useEffect9, useState as useState10 } from "react";
|
|
4490
|
+
import toast2, { Toaster as Toaster2 } from "react-hot-toast";
|
|
4491
|
+
import { jsx as jsx42, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4111
4492
|
function MidenCheckoutCard({
|
|
4112
4493
|
secretKey,
|
|
4113
4494
|
options,
|
|
@@ -4118,8 +4499,7 @@ function MidenCheckoutCard({
|
|
|
4118
4499
|
currency: "",
|
|
4119
4500
|
email: "",
|
|
4120
4501
|
phoneNumber: "",
|
|
4121
|
-
narration: ""
|
|
4122
|
-
redirectUrl: ""
|
|
4502
|
+
narration: ""
|
|
4123
4503
|
},
|
|
4124
4504
|
onPaymentAuthorized,
|
|
4125
4505
|
onError
|
|
@@ -4144,22 +4524,32 @@ function MidenCheckoutCard({
|
|
|
4144
4524
|
setSuccessObject({ ...event });
|
|
4145
4525
|
if (event.paymentStatus === "authorized") {
|
|
4146
4526
|
setCheckoutState("SUCCESS");
|
|
4527
|
+
toast2.success("Payment authorization successful.", toastConfig);
|
|
4528
|
+
} else if (event.paymentStatus === "confirmed") {
|
|
4529
|
+
setCheckoutState("SUCCESS");
|
|
4530
|
+
toast2.success("Payment confirmed.", toastConfig);
|
|
4147
4531
|
} else if (event.paymentStatus === "payment failed") {
|
|
4148
4532
|
setCheckoutState("PENDING");
|
|
4533
|
+
toast2.error("Payment pending.", toastConfig);
|
|
4149
4534
|
} else if (event.paymentStatus === "used") {
|
|
4150
4535
|
setCheckoutState("USED");
|
|
4151
4536
|
} else {
|
|
4152
4537
|
setCheckoutState("PENDING");
|
|
4538
|
+
toast2.error("Payment pending.", toastConfig);
|
|
4153
4539
|
}
|
|
4154
4540
|
onPaymentAuthorized?.(event);
|
|
4155
4541
|
};
|
|
4542
|
+
const onErrorHandler = (error) => {
|
|
4543
|
+
toast2.error(error.errorMessage ?? "Payment failed.", toastConfig);
|
|
4544
|
+
onError?.(error);
|
|
4545
|
+
};
|
|
4156
4546
|
const formatAmountHandler = () => {
|
|
4157
4547
|
return formatAmount(paymentObject.amount, paymentObject.currency);
|
|
4158
4548
|
};
|
|
4159
4549
|
const formatChargeHandler = () => {
|
|
4160
4550
|
return formatAmount(0, paymentObject.currency);
|
|
4161
4551
|
};
|
|
4162
|
-
|
|
4552
|
+
useEffect9(() => {
|
|
4163
4553
|
let options2 = [];
|
|
4164
4554
|
if (paymentObject.currency === "USD") {
|
|
4165
4555
|
if (paymentObject.amount < 50) {
|
|
@@ -4178,89 +4568,92 @@ function MidenCheckoutCard({
|
|
|
4178
4568
|
}
|
|
4179
4569
|
setFilteredPaymentTypeOptions(options2);
|
|
4180
4570
|
}, [paymentObject.currency, paymentObject.amount]);
|
|
4181
|
-
|
|
4571
|
+
useEffect9(() => {
|
|
4182
4572
|
if (filteredPaymentTypeOptions.length) {
|
|
4183
4573
|
setPaymentType(filteredPaymentTypeOptions[0].value);
|
|
4184
4574
|
}
|
|
4185
4575
|
}, [filteredPaymentTypeOptions]);
|
|
4186
|
-
return /* @__PURE__ */
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
/* @__PURE__ */
|
|
4190
|
-
|
|
4576
|
+
return /* @__PURE__ */ jsxs30(BaseCard, { caller: "miden", children: [
|
|
4577
|
+
/* @__PURE__ */ jsx42(Toaster2, {}),
|
|
4578
|
+
/* @__PURE__ */ jsxs30("div", { className: "grid grid-cols-3", children: [
|
|
4579
|
+
checkoutState === "PENDING" && /* @__PURE__ */ jsxs30("div", { className: "bg-[#0A0032] py-6 flex flex-col gap-5 col-span-1 rounded-l-xl", children: [
|
|
4580
|
+
/* @__PURE__ */ jsx42("p", { className: "text-white text-body-xs font-semibold px-6", children: "Pay with" }),
|
|
4581
|
+
/* @__PURE__ */ jsx42(
|
|
4582
|
+
BaseRadioGroup,
|
|
4583
|
+
{
|
|
4584
|
+
caller: "miden",
|
|
4585
|
+
options: filteredPaymentTypeOptions,
|
|
4586
|
+
selectedChange: (e) => paymentTypeHandler(e)
|
|
4587
|
+
}
|
|
4588
|
+
)
|
|
4589
|
+
] }),
|
|
4590
|
+
/* @__PURE__ */ jsxs30(
|
|
4591
|
+
"div",
|
|
4191
4592
|
{
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
/* @__PURE__ */
|
|
4210
|
-
|
|
4593
|
+
className: checkoutState === "SUCCESS" ? "col-span-3" : "col-span-2",
|
|
4594
|
+
children: [
|
|
4595
|
+
checkoutState === "PENDING" && /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-6", children: [
|
|
4596
|
+
/* @__PURE__ */ jsx42(IconMidenLogo, {}),
|
|
4597
|
+
/* @__PURE__ */ jsx42(IconClose, { color: "black", className: "cursor-pointer" })
|
|
4598
|
+
] }),
|
|
4599
|
+
checkoutState === "PENDING" && /* @__PURE__ */ jsxs30("div", { className: "px-14 pt-4 pb-8 flex flex-col gap-6 max-h-[32rem] overflow-y-scroll", children: [
|
|
4600
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between py-3 px-4 bg-[#F8FDFF] border border-[#DAE4E8] rounded-lg", children: [
|
|
4601
|
+
/* @__PURE__ */ jsx42(
|
|
4602
|
+
BaseLabelInfo,
|
|
4603
|
+
{
|
|
4604
|
+
label: "Amount Due",
|
|
4605
|
+
value: formatAmountHandler()
|
|
4606
|
+
}
|
|
4607
|
+
),
|
|
4608
|
+
/* @__PURE__ */ jsx42(BaseLabelInfo, { label: "Charges", value: formatChargeHandler() })
|
|
4609
|
+
] }),
|
|
4610
|
+
/* @__PURE__ */ jsx42("div", { children: paymentType === "CARD" ? /* @__PURE__ */ jsx42(
|
|
4611
|
+
PayByCard,
|
|
4211
4612
|
{
|
|
4212
|
-
|
|
4213
|
-
|
|
4613
|
+
secretKey,
|
|
4614
|
+
environment,
|
|
4615
|
+
caller: "miden",
|
|
4616
|
+
paymentObject,
|
|
4617
|
+
onPaymentAuthorized: setSuccess,
|
|
4618
|
+
onError: onErrorHandler
|
|
4214
4619
|
}
|
|
4215
|
-
)
|
|
4216
|
-
|
|
4620
|
+
) : paymentType === "BANK_TRANSFER" ? /* @__PURE__ */ jsx42(
|
|
4621
|
+
PayByTransfer,
|
|
4622
|
+
{
|
|
4623
|
+
secretKey,
|
|
4624
|
+
environment,
|
|
4625
|
+
caller: "miden",
|
|
4626
|
+
paymentObject,
|
|
4627
|
+
onPaymentAuthorized: setSuccess,
|
|
4628
|
+
onError: onErrorHandler
|
|
4629
|
+
}
|
|
4630
|
+
) : /* @__PURE__ */ jsx42(
|
|
4631
|
+
PayByStableCoin,
|
|
4632
|
+
{
|
|
4633
|
+
secretKey,
|
|
4634
|
+
environment,
|
|
4635
|
+
caller: "miden",
|
|
4636
|
+
paymentObject,
|
|
4637
|
+
onPaymentAuthorized: setSuccess,
|
|
4638
|
+
onError: onErrorHandler
|
|
4639
|
+
}
|
|
4640
|
+
) })
|
|
4217
4641
|
] }),
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
{
|
|
4221
|
-
secretKey,
|
|
4222
|
-
environment,
|
|
4223
|
-
caller: "miden",
|
|
4224
|
-
paymentObject,
|
|
4225
|
-
onPaymentAuthorized: setSuccess,
|
|
4226
|
-
onError
|
|
4227
|
-
}
|
|
4228
|
-
) : paymentType === "BANK_TRANSFER" ? /* @__PURE__ */ jsx41(
|
|
4229
|
-
PayByTransfer,
|
|
4642
|
+
checkoutState === "SUCCESS" && /* @__PURE__ */ jsx42(
|
|
4643
|
+
BaseSuccess,
|
|
4230
4644
|
{
|
|
4231
|
-
|
|
4232
|
-
|
|
4645
|
+
amount: paymentObject.amount,
|
|
4646
|
+
currency: paymentObject.currency,
|
|
4233
4647
|
caller: "miden",
|
|
4234
|
-
paymentObject,
|
|
4235
|
-
|
|
4236
|
-
onError
|
|
4237
|
-
}
|
|
4238
|
-
) : /* @__PURE__ */ jsx41(
|
|
4239
|
-
PayByStableCoin,
|
|
4240
|
-
{
|
|
4241
|
-
secretKey,
|
|
4242
|
-
environment,
|
|
4243
|
-
caller: "miden",
|
|
4244
|
-
paymentObject,
|
|
4245
|
-
onPaymentAuthorized: setSuccess,
|
|
4246
|
-
onError
|
|
4648
|
+
redirectUrl: paymentObject.redirectUrl ?? "",
|
|
4649
|
+
successObject
|
|
4247
4650
|
}
|
|
4248
|
-
)
|
|
4249
|
-
]
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
currency: paymentObject.currency,
|
|
4255
|
-
caller: "miden",
|
|
4256
|
-
redirectUrl: paymentObject.redirectUrl ?? "",
|
|
4257
|
-
successObject
|
|
4258
|
-
}
|
|
4259
|
-
)
|
|
4260
|
-
]
|
|
4261
|
-
}
|
|
4262
|
-
)
|
|
4263
|
-
] }) });
|
|
4651
|
+
)
|
|
4652
|
+
]
|
|
4653
|
+
}
|
|
4654
|
+
)
|
|
4655
|
+
] })
|
|
4656
|
+
] });
|
|
4264
4657
|
}
|
|
4265
4658
|
export {
|
|
4266
4659
|
BzpCheckoutButton,
|