@miden-npm/react 2.0.3 → 2.0.5

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 CHANGED
@@ -144,6 +144,10 @@ function buildDeviceInformation(partial) {
144
144
  ...partial
145
145
  };
146
146
  }
147
+ var toastConfig = {
148
+ position: "top-right",
149
+ style: { fontSize: "12px" }
150
+ };
147
151
 
148
152
  // src/utils/api.util.ts
149
153
  var getBaseUrl = (mode, caller) => {
@@ -168,7 +172,7 @@ var currencySign = (currency) => {
168
172
  var formatAmount = (value, currency) => {
169
173
  const num = typeof value === "string" ? parseFloat(value) : value;
170
174
  if (isNaN(num)) return "0";
171
- return `${currency ? currencySign(currency) : ""} ${num?.toLocaleString(
175
+ return `${currency ? currencySign(currency) : ""}${num?.toLocaleString(
172
176
  "en-US"
173
177
  )}`;
174
178
  };
@@ -201,6 +205,254 @@ var restrictToNumericKeys = (event) => {
201
205
  event.preventDefault();
202
206
  }
203
207
  };
208
+ var COUNTRIES = [
209
+ { name: "Afghanistan", code: "AF", phoneCode: "+93", flag: "\u{1F1E6}\u{1F1EB}" },
210
+ { name: "Albania", code: "AL", phoneCode: "+355", flag: "\u{1F1E6}\u{1F1F1}" },
211
+ { name: "Algeria", code: "DZ", phoneCode: "+213", flag: "\u{1F1E9}\u{1F1FF}" },
212
+ { name: "American Samoa", code: "AS", phoneCode: "+1", flag: "\u{1F1E6}\u{1F1F8}" },
213
+ { name: "Andorra", code: "AD", phoneCode: "+376", flag: "\u{1F1E6}\u{1F1E9}" },
214
+ { name: "Angola", code: "AO", phoneCode: "+244", flag: "\u{1F1E6}\u{1F1F4}" },
215
+ { name: "Anguilla", code: "AI", phoneCode: "+1", flag: "\u{1F1E6}\u{1F1EE}" },
216
+ { name: "Antarctica", code: "AQ", phoneCode: "+672", flag: "\u{1F1E6}\u{1F1F6}" },
217
+ { name: "Antigua and Barbuda", code: "AG", phoneCode: "+1", flag: "\u{1F1E6}\u{1F1EC}" },
218
+ { name: "Argentina", code: "AR", phoneCode: "+54", flag: "\u{1F1E6}\u{1F1F7}" },
219
+ { name: "Armenia", code: "AM", phoneCode: "+374", flag: "\u{1F1E6}\u{1F1F2}" },
220
+ { name: "Aruba", code: "AW", phoneCode: "+297", flag: "\u{1F1E6}\u{1F1FC}" },
221
+ { name: "Australia", code: "AU", phoneCode: "+61", flag: "\u{1F1E6}\u{1F1FA}" },
222
+ { name: "Austria", code: "AT", phoneCode: "+43", flag: "\u{1F1E6}\u{1F1F9}" },
223
+ { name: "Azerbaijan", code: "AZ", phoneCode: "+994", flag: "\u{1F1E6}\u{1F1FF}" },
224
+ { name: "Bahamas", code: "BS", phoneCode: "+1", flag: "\u{1F1E7}\u{1F1F8}" },
225
+ { name: "Bahrain", code: "BH", phoneCode: "+973", flag: "\u{1F1E7}\u{1F1ED}" },
226
+ { name: "Bangladesh", code: "BD", phoneCode: "+880", flag: "\u{1F1E7}\u{1F1E9}" },
227
+ { name: "Barbados", code: "BB", phoneCode: "+1", flag: "\u{1F1E7}\u{1F1E7}" },
228
+ { name: "Belarus", code: "BY", phoneCode: "+375", flag: "\u{1F1E7}\u{1F1FE}" },
229
+ { name: "Belgium", code: "BE", phoneCode: "+32", flag: "\u{1F1E7}\u{1F1EA}" },
230
+ { name: "Belize", code: "BZ", phoneCode: "+501", flag: "\u{1F1E7}\u{1F1FF}" },
231
+ { name: "Benin", code: "BJ", phoneCode: "+229", flag: "\u{1F1E7}\u{1F1EF}" },
232
+ { name: "Bermuda", code: "BM", phoneCode: "+1", flag: "\u{1F1E7}\u{1F1F2}" },
233
+ { name: "Bhutan", code: "BT", phoneCode: "+975", flag: "\u{1F1E7}\u{1F1F9}" },
234
+ { name: "Bolivia", code: "BO", phoneCode: "+591", flag: "\u{1F1E7}\u{1F1F4}" },
235
+ { name: "Bosnia and Herzegovina", code: "BA", phoneCode: "+387", flag: "\u{1F1E7}\u{1F1E6}" },
236
+ { name: "Botswana", code: "BW", phoneCode: "+267", flag: "\u{1F1E7}\u{1F1FC}" },
237
+ { name: "Bouvet Island", code: "BV", phoneCode: "+47", flag: "\u{1F1E7}\u{1F1FB}" },
238
+ { name: "Brazil", code: "BR", phoneCode: "+55", flag: "\u{1F1E7}\u{1F1F7}" },
239
+ { name: "British Indian Ocean Territory", code: "IO", phoneCode: "+246", flag: "\u{1F1EE}\u{1F1F4}" },
240
+ { name: "Brunei Darussalam", code: "BN", phoneCode: "+673", flag: "\u{1F1E7}\u{1F1F3}" },
241
+ { name: "Bulgaria", code: "BG", phoneCode: "+359", flag: "\u{1F1E7}\u{1F1EC}" },
242
+ { name: "Burkina Faso", code: "BF", phoneCode: "+226", flag: "\u{1F1E7}\u{1F1EB}" },
243
+ { name: "Burundi", code: "BI", phoneCode: "+257", flag: "\u{1F1E7}\u{1F1EE}" },
244
+ { name: "Cambodia", code: "KH", phoneCode: "+855", flag: "\u{1F1F0}\u{1F1ED}" },
245
+ { name: "Cameroon", code: "CM", phoneCode: "+237", flag: "\u{1F1E8}\u{1F1F2}" },
246
+ { name: "Canada", code: "CA", phoneCode: "+1", flag: "\u{1F1E8}\u{1F1E6}" },
247
+ { name: "Cape Verde", code: "CV", phoneCode: "+238", flag: "\u{1F1E8}\u{1F1FB}" },
248
+ { name: "Cayman Islands", code: "KY", phoneCode: "+1", flag: "\u{1F1F0}\u{1F1FE}" },
249
+ { name: "Central African Republic", code: "CF", phoneCode: "+236", flag: "\u{1F1E8}\u{1F1EB}" },
250
+ { name: "Chad", code: "TD", phoneCode: "+235", flag: "\u{1F1F9}\u{1F1E9}" },
251
+ { name: "Chile", code: "CL", phoneCode: "+56", flag: "\u{1F1E8}\u{1F1F1}" },
252
+ { name: "China", code: "CN", phoneCode: "+86", flag: "\u{1F1E8}\u{1F1F3}" },
253
+ { name: "Christmas Island", code: "CX", phoneCode: "+61", flag: "\u{1F1E8}\u{1F1FD}" },
254
+ { name: "Cocos (Keeling) Islands", code: "CC", phoneCode: "+61", flag: "\u{1F1E8}\u{1F1E8}" },
255
+ { name: "Colombia", code: "CO", phoneCode: "+57", flag: "\u{1F1E8}\u{1F1F4}" },
256
+ { name: "Comoros", code: "KM", phoneCode: "+269", flag: "\u{1F1F0}\u{1F1F2}" },
257
+ { name: "Congo", code: "CG", phoneCode: "+242", flag: "\u{1F1E8}\u{1F1EC}" },
258
+ { name: "Congo, Democratic Republic of the", code: "CD", phoneCode: "+243", flag: "\u{1F1E8}\u{1F1E9}" },
259
+ { name: "Cook Islands", code: "CK", phoneCode: "+682", flag: "\u{1F1E8}\u{1F1F0}" },
260
+ { name: "Costa Rica", code: "CR", phoneCode: "+506", flag: "\u{1F1E8}\u{1F1F7}" },
261
+ { name: "C\xF4te d'Ivoire", code: "CI", phoneCode: "+225", flag: "\u{1F1E8}\u{1F1EE}" },
262
+ { name: "Croatia", code: "HR", phoneCode: "+385", flag: "\u{1F1ED}\u{1F1F7}" },
263
+ { name: "Cuba", code: "CU", phoneCode: "+53", flag: "\u{1F1E8}\u{1F1FA}" },
264
+ { name: "Cyprus", code: "CY", phoneCode: "+357", flag: "\u{1F1E8}\u{1F1FE}" },
265
+ { name: "Czech Republic", code: "CZ", phoneCode: "+420", flag: "\u{1F1E8}\u{1F1FF}" },
266
+ { name: "Denmark", code: "DK", phoneCode: "+45", flag: "\u{1F1E9}\u{1F1F0}" },
267
+ { name: "Djibouti", code: "DJ", phoneCode: "+253", flag: "\u{1F1E9}\u{1F1EF}" },
268
+ { name: "Dominica", code: "DM", phoneCode: "+1", flag: "\u{1F1E9}\u{1F1F2}" },
269
+ { name: "Dominican Republic", code: "DO", phoneCode: "+1", flag: "\u{1F1E9}\u{1F1F4}" },
270
+ { name: "Ecuador", code: "EC", phoneCode: "+593", flag: "\u{1F1EA}\u{1F1E8}" },
271
+ { name: "Egypt", code: "EG", phoneCode: "+20", flag: "\u{1F1EA}\u{1F1EC}" },
272
+ { name: "El Salvador", code: "SV", phoneCode: "+503", flag: "\u{1F1F8}\u{1F1FB}" },
273
+ { name: "Equatorial Guinea", code: "GQ", phoneCode: "+240", flag: "\u{1F1EC}\u{1F1F6}" },
274
+ { name: "Eritrea", code: "ER", phoneCode: "+291", flag: "\u{1F1EA}\u{1F1F7}" },
275
+ { name: "Estonia", code: "EE", phoneCode: "+372", flag: "\u{1F1EA}\u{1F1EA}" },
276
+ { name: "Ethiopia", code: "ET", phoneCode: "+251", flag: "\u{1F1EA}\u{1F1F9}" },
277
+ { name: "Falkland Islands (Malvinas)", code: "FK", phoneCode: "+500", flag: "\u{1F1EB}\u{1F1F0}" },
278
+ { name: "Faroe Islands", code: "FO", phoneCode: "+298", flag: "\u{1F1EB}\u{1F1F4}" },
279
+ { name: "Fiji", code: "FJ", phoneCode: "+679", flag: "\u{1F1EB}\u{1F1EF}" },
280
+ { name: "Finland", code: "FI", phoneCode: "+358", flag: "\u{1F1EB}\u{1F1EE}" },
281
+ { name: "France", code: "FR", phoneCode: "+33", flag: "\u{1F1EB}\u{1F1F7}" },
282
+ { name: "French Guiana", code: "GF", phoneCode: "+594", flag: "\u{1F1EC}\u{1F1EB}" },
283
+ { name: "French Polynesia", code: "PF", phoneCode: "+689", flag: "\u{1F1F5}\u{1F1EB}" },
284
+ { name: "French Southern Territories", code: "TF", phoneCode: "+262", flag: "\u{1F1F9}\u{1F1EB}" },
285
+ { name: "Gabon", code: "GA", phoneCode: "+240", flag: "\u{1F1EC}\u{1F1E6}" },
286
+ { name: "Gambia", code: "GM", phoneCode: "+220", flag: "\u{1F1EC}\u{1F1F2}" },
287
+ { name: "Georgia", code: "GE", phoneCode: "+995", flag: "\u{1F1EC}\u{1F1EA}" },
288
+ { name: "Germany", code: "DE", phoneCode: "+49", flag: "\u{1F1E9}\u{1F1EA}" },
289
+ { name: "Ghana", code: "GH", phoneCode: "+233", flag: "\u{1F1EC}\u{1F1ED}" },
290
+ { name: "Gibraltar", code: "GI", phoneCode: "+350", flag: "\u{1F1EC}\u{1F1EE}" },
291
+ { name: "Greece", code: "GR", phoneCode: "+30", flag: "\u{1F1EC}\u{1F1F7}" },
292
+ { name: "Greenland", code: "GL", phoneCode: "+299", flag: "\u{1F1EC}\u{1F1F1}" },
293
+ { name: "Grenada", code: "GD", phoneCode: "+1", flag: "\u{1F1EC}\u{1F1E9}" },
294
+ { name: "Guadeloupe", code: "GP", phoneCode: "+590", flag: "\u{1F1EC}\u{1F1F5}" },
295
+ { name: "Guam", code: "GU", phoneCode: "+1", flag: "\u{1F1EC}\u{1F1FA}" },
296
+ { name: "Guatemala", code: "GT", phoneCode: "+502", flag: "\u{1F1EC}\u{1F1F9}" },
297
+ { name: "Guernsey", code: "GG", phoneCode: "+44", flag: "\u{1F1EC}\u{1F1EC}" },
298
+ { name: "Guinea", code: "GN", phoneCode: "+224", flag: "\u{1F1EC}\u{1F1F3}" },
299
+ { name: "Guinea-Bissau", code: "GW", phoneCode: "+245", flag: "\u{1F1EC}\u{1F1FC}" },
300
+ { name: "Guyana", code: "GY", phoneCode: "+592", flag: "\u{1F1EC}\u{1F1FE}" },
301
+ { name: "Haiti", code: "HT", phoneCode: "+509", flag: "\u{1F1ED}\u{1F1F9}" },
302
+ { name: "Heard Island and McDonald Islands", code: "HM", phoneCode: "+672", flag: "\u{1F1ED}\u{1F1F2}" },
303
+ { name: "Holy See (Vatican City State)", code: "VA", phoneCode: "+39", flag: "\u{1F1FB}\u{1F1E6}" },
304
+ { name: "Honduras", code: "HN", phoneCode: "+504", flag: "\u{1F1ED}\u{1F1F3}" },
305
+ { name: "Hong Kong", code: "HK", phoneCode: "+852", flag: "\u{1F1ED}\u{1F1F0}" },
306
+ { name: "Hungary", code: "HU", phoneCode: "+36", flag: "\u{1F1ED}\u{1F1FA}" },
307
+ { name: "Iceland", code: "IS", phoneCode: "+354", flag: "\u{1F1EE}\u{1F1F8}" },
308
+ { name: "India", code: "IN", phoneCode: "+91", flag: "\u{1F1EE}\u{1F1F3}" },
309
+ { name: "Indonesia", code: "ID", phoneCode: "+62", flag: "\u{1F1EE}\u{1F1E9}" },
310
+ { name: "Iran, Islamic Republic of", code: "IR", phoneCode: "+98", flag: "\u{1F1EE}\u{1F1F7}" },
311
+ { name: "Iraq", code: "IQ", phoneCode: "+964", flag: "\u{1F1EE}\u{1F1F6}" },
312
+ { name: "Ireland", code: "IE", phoneCode: "+353", flag: "\u{1F1EE}\u{1F1EA}" },
313
+ { name: "Isle of Man", code: "IM", phoneCode: "+44", flag: "\u{1F1EE}\u{1F1F2}" },
314
+ { name: "Israel", code: "IL", phoneCode: "+972", flag: "\u{1F1EE}\u{1F1F1}" },
315
+ { name: "Italy", code: "IT", phoneCode: "+39", flag: "\u{1F1EE}\u{1F1F9}" },
316
+ { name: "Jamaica", code: "JM", phoneCode: "+1", flag: "\u{1F1EF}\u{1F1F2}" },
317
+ { name: "Japan", code: "JP", phoneCode: "+81", flag: "\u{1F1EF}\u{1F1F5}" },
318
+ { name: "Jersey", code: "JE", phoneCode: "+44", flag: "\u{1F1EF}\u{1F1EA}" },
319
+ { name: "Jordan", code: "JO", phoneCode: "+962", flag: "\u{1F1EF}\u{1F1F4}" },
320
+ { name: "Kazakhstan", code: "KZ", phoneCode: "+7", flag: "\u{1F1F0}\u{1F1FF}" },
321
+ { name: "Kenya", code: "KE", phoneCode: "+254", flag: "\u{1F1F0}\u{1F1EA}" },
322
+ { name: "Kiribati", code: "KI", phoneCode: "+686", flag: "\u{1F1F0}\u{1F1EE}" },
323
+ { name: "Korea, Democratic People's Republic of", code: "KP", phoneCode: "+850", flag: "\u{1F1F0}\u{1F1F5}" },
324
+ { name: "Korea, Republic of", code: "KR", phoneCode: "+82", flag: "\u{1F1F0}\u{1F1F7}" },
325
+ { name: "Kuwait", code: "KW", phoneCode: "+965", flag: "\u{1F1F0}\u{1F1FC}" },
326
+ { name: "Kyrgyzstan", code: "KG", phoneCode: "+996", flag: "\u{1F1F0}\u{1F1EC}" },
327
+ { name: "Lao People's Democratic Republic", code: "LA", phoneCode: "+856", flag: "\u{1F1F1}\u{1F1E6}" },
328
+ { name: "Latvia", code: "LV", phoneCode: "+371", flag: "\u{1F1F1}\u{1F1FB}" },
329
+ { name: "Lebanon", code: "LB", phoneCode: "+961", flag: "\u{1F1F1}\u{1F1E7}" },
330
+ { name: "Lesotho", code: "LS", phoneCode: "+266", flag: "\u{1F1F1}\u{1F1F8}" },
331
+ { name: "Liberia", code: "LR", phoneCode: "+231", flag: "\u{1F1F1}\u{1F1F7}" },
332
+ { name: "Libya", code: "LY", phoneCode: "+218", flag: "\u{1F1F1}\u{1F1FE}" },
333
+ { name: "Liechtenstein", code: "LI", phoneCode: "+423", flag: "\u{1F1F1}\u{1F1EE}" },
334
+ { name: "Lithuania", code: "LT", phoneCode: "+370", flag: "\u{1F1F1}\u{1F1F9}" },
335
+ { name: "Luxembourg", code: "LU", phoneCode: "+352", flag: "\u{1F1F1}\u{1F1FA}" },
336
+ { name: "Macao", code: "MO", phoneCode: "+853", flag: "\u{1F1F2}\u{1F1F4}" },
337
+ { name: "Macedonia, the former Yugoslav Republic of", code: "MK", phoneCode: "+389", flag: "\u{1F1F2}\u{1F1F0}" },
338
+ { name: "Madagascar", code: "MG", phoneCode: "+261", flag: "\u{1F1F2}\u{1F1EC}" },
339
+ { name: "Malawi", code: "MW", phoneCode: "+265", flag: "\u{1F1F2}\u{1F1FC}" },
340
+ { name: "Malaysia", code: "MY", phoneCode: "+60", flag: "\u{1F1F2}\u{1F1FE}" },
341
+ { name: "Maldives", code: "MV", phoneCode: "+960", flag: "\u{1F1F2}\u{1F1FB}" },
342
+ { name: "Mali", code: "ML", phoneCode: "+223", flag: "\u{1F1F2}\u{1F1F1}" },
343
+ { name: "Malta", code: "MT", phoneCode: "+356", flag: "\u{1F1F2}\u{1F1F9}" },
344
+ { name: "Marshall Islands", code: "MH", phoneCode: "+692", flag: "\u{1F1F2}\u{1F1ED}" },
345
+ { name: "Martinique", code: "MQ", phoneCode: "+596", flag: "\u{1F1F2}\u{1F1F6}" },
346
+ { name: "Mauritania", code: "MR", phoneCode: "+222", flag: "\u{1F1F2}\u{1F1F7}" },
347
+ { name: "Mauritius", code: "MU", phoneCode: "+230", flag: "\u{1F1F2}\u{1F1FA}" },
348
+ { name: "Mayotte", code: "YT", phoneCode: "+262", flag: "\u{1F1FE}\u{1F1F9}" },
349
+ { name: "Mexico", code: "MX", phoneCode: "+52", flag: "\u{1F1F2}\u{1F1FD}" },
350
+ { name: "Micronesia, Federated States of", code: "FM", phoneCode: "+691", flag: "\u{1F1EB}\u{1F1F2}" },
351
+ { name: "Moldova, Republic of", code: "MD", phoneCode: "+373", flag: "\u{1F1F2}\u{1F1E9}" },
352
+ { name: "Monaco", code: "MC", phoneCode: "+377", flag: "\u{1F1F2}\u{1F1E8}" },
353
+ { name: "Mongolia", code: "MN", phoneCode: "+976", flag: "\u{1F1F2}\u{1F1F3}" },
354
+ { name: "Montenegro", code: "ME", phoneCode: "+382", flag: "\u{1F1F2}\u{1F1EA}" },
355
+ { name: "Montserrat", code: "MS", phoneCode: "+1", flag: "\u{1F1F2}\u{1F1F8}" },
356
+ { name: "Morocco", code: "MA", phoneCode: "+212", flag: "\u{1F1F2}\u{1F1E6}" },
357
+ { name: "Mozambique", code: "MZ", phoneCode: "+258", flag: "\u{1F1F2}\u{1F1FF}" },
358
+ { name: "Myanmar", code: "MM", phoneCode: "+95", flag: "\u{1F1F2}\u{1F1F2}" },
359
+ { name: "Namibia", code: "NA", phoneCode: "+264", flag: "\u{1F1F3}\u{1F1E6}" },
360
+ { name: "Nauru", code: "NR", phoneCode: "+674", flag: "\u{1F1F3}\u{1F1F7}" },
361
+ { name: "Nepal", code: "NP", phoneCode: "+977", flag: "\u{1F1F3}\u{1F1F5}" },
362
+ { name: "Netherlands", code: "NL", phoneCode: "+31", flag: "\u{1F1F3}\u{1F1F1}" },
363
+ { name: "New Caledonia", code: "NC", phoneCode: "+687", flag: "\u{1F1F3}\u{1F1E8}" },
364
+ { name: "New Zealand", code: "NZ", phoneCode: "+64", flag: "\u{1F1F3}\u{1F1FF}" },
365
+ { name: "Nicaragua", code: "NI", phoneCode: "+505", flag: "\u{1F1F3}\u{1F1EE}" },
366
+ { name: "Niger", code: "NE", phoneCode: "+227", flag: "\u{1F1F3}\u{1F1EA}" },
367
+ { name: "Nigeria", code: "NG", phoneCode: "+234", flag: "\u{1F1F3}\u{1F1EC}" },
368
+ { name: "Niue", code: "NU", phoneCode: "+683", flag: "\u{1F1F3}\u{1F1FA}" },
369
+ { name: "Norfolk Island", code: "NF", phoneCode: "+672", flag: "\u{1F1F3}\u{1F1EB}" },
370
+ { name: "Northern Mariana Islands", code: "MP", phoneCode: "+1", flag: "\u{1F1F2}\u{1F1F5}" },
371
+ { name: "Norway", code: "NO", phoneCode: "+47", flag: "\u{1F1F3}\u{1F1F4}" },
372
+ { name: "Oman", code: "OM", phoneCode: "+968", flag: "\u{1F1F4}\u{1F1F2}" },
373
+ { name: "Pakistan", code: "PK", phoneCode: "+92", flag: "\u{1F1F5}\u{1F1F0}" },
374
+ { name: "Palau", code: "PW", phoneCode: "+680", flag: "\u{1F1F5}\u{1F1FC}" },
375
+ { name: "Palestinian Territory, Occupied", code: "PS", phoneCode: "+970", flag: "\u{1F1F5}\u{1F1F8}" },
376
+ { name: "Panama", code: "PA", phoneCode: "+507", flag: "\u{1F1F5}\u{1F1E6}" },
377
+ { name: "Papua New Guinea", code: "PG", phoneCode: "+675", flag: "\u{1F1F5}\u{1F1EC}" },
378
+ { name: "Paraguay", code: "PY", phoneCode: "+595", flag: "\u{1F1F5}\u{1F1FE}" },
379
+ { name: "Peru", code: "PE", phoneCode: "+51", flag: "\u{1F1F5}\u{1F1EA}" },
380
+ { name: "Philippines", code: "PH", phoneCode: "+63", flag: "\u{1F1F5}\u{1F1ED}" },
381
+ { name: "Pitcairn", code: "PN", phoneCode: "+64", flag: "\u{1F1F5}\u{1F1F3}" },
382
+ { name: "Poland", code: "PL", phoneCode: "+48", flag: "\u{1F1F5}\u{1F1F1}" },
383
+ { name: "Portugal", code: "PT", phoneCode: "+351", flag: "\u{1F1F5}\u{1F1F9}" },
384
+ { name: "Puerto Rico", code: "PR", phoneCode: "+1", flag: "\u{1F1F5}\u{1F1F7}" },
385
+ { name: "Qatar", code: "QA", phoneCode: "+974", flag: "\u{1F1F6}\u{1F1E6}" },
386
+ { name: "R\xE9union", code: "RE", phoneCode: "+262", flag: "\u{1F1F7}\u{1F1EA}" },
387
+ { name: "Romania", code: "RO", phoneCode: "+40", flag: "\u{1F1F7}\u{1F1F4}" },
388
+ { name: "Russian Federation", code: "RU", phoneCode: "+7", flag: "\u{1F1F7}\u{1F1FA}" },
389
+ { name: "Rwanda", code: "RW", phoneCode: "+250", flag: "\u{1F1F7}\u{1F1FC}" },
390
+ { name: "Saint Barth\xE9lemy", code: "BL", phoneCode: "+590", flag: "\u{1F1E7}\u{1F1F1}" },
391
+ { name: "Saint Helena, Ascension and Tristan da Cunha", code: "SH", phoneCode: "+290", flag: "\u{1F1F8}\u{1F1ED}" },
392
+ { name: "Saint Kitts and Nevis", code: "KN", phoneCode: "+1", flag: "\u{1F1F0}\u{1F1F3}" },
393
+ { name: "Saint Lucia", code: "LC", phoneCode: "+1", flag: "\u{1F1F1}\u{1F1E8}" },
394
+ { name: "Saint Martin (French part)", code: "MF", phoneCode: "+590", flag: "\u{1F1F2}\u{1F1EB}" },
395
+ { name: "Saint Pierre and Miquelon", code: "PM", phoneCode: "+508", flag: "\u{1F1F5}\u{1F1F2}" },
396
+ { name: "Saint Vincent and the Grenadines", code: "VC", phoneCode: "+1", flag: "\u{1F1FB}\u{1F1E8}" },
397
+ { name: "Samoa", code: "WS", phoneCode: "+685", flag: "\u{1F1FC}\u{1F1F8}" },
398
+ { name: "San Marino", code: "SM", phoneCode: "+378", flag: "\u{1F1F8}\u{1F1F2}" },
399
+ { name: "Sao Tome and Principe", code: "ST", phoneCode: "+239", flag: "\u{1F1F8}\u{1F1F9}" },
400
+ { name: "Saudi Arabia", code: "SA", phoneCode: "+966", flag: "\u{1F1F8}\u{1F1E6}" },
401
+ { name: "Senegal", code: "SN", phoneCode: "+221", flag: "\u{1F1F8}\u{1F1F3}" },
402
+ { name: "Serbia", code: "RS", phoneCode: "+381", flag: "\u{1F1F7}\u{1F1F8}" },
403
+ { name: "Seychelles", code: "SC", phoneCode: "+248", flag: "\u{1F1F8}\u{1F1E8}" },
404
+ { name: "Sierra Leone", code: "SL", phoneCode: "+232", flag: "\u{1F1F8}\u{1F1F1}" },
405
+ { name: "Singapore", code: "SG", phoneCode: "+65", flag: "\u{1F1F8}\u{1F1EC}" },
406
+ { name: "Sint Maarten (Dutch part)", code: "SX", phoneCode: "+1", flag: "\u{1F1F8}\u{1F1FD}" },
407
+ { name: "Slovakia", code: "SK", phoneCode: "+421", flag: "\u{1F1F8}\u{1F1F0}" },
408
+ { name: "Slovenia", code: "SI", phoneCode: "+386", flag: "\u{1F1F8}\u{1F1EE}" },
409
+ { name: "Solomon Islands", code: "SB", phoneCode: "+677", flag: "\u{1F1F8}\u{1F1E7}" },
410
+ { name: "Somalia", code: "SO", phoneCode: "+252", flag: "\u{1F1F8}\u{1F1F4}" },
411
+ { name: "South Africa", code: "ZA", phoneCode: "+27", flag: "\u{1F1FF}\u{1F1E6}" },
412
+ { name: "South Georgia and the South Sandwich Islands", code: "GS", phoneCode: "+500", flag: "\u{1F1EC}\u{1F1F8}" },
413
+ { name: "South Sudan", code: "SS", phoneCode: "+211", flag: "\u{1F1F8}\u{1F1F8}" },
414
+ { name: "Spain", code: "ES", phoneCode: "+34", flag: "\u{1F1EA}\u{1F1F8}" },
415
+ { name: "Sri Lanka", code: "LK", phoneCode: "+94", flag: "\u{1F1F1}\u{1F1F0}" },
416
+ { name: "Sudan", code: "SD", phoneCode: "+249", flag: "\u{1F1F8}\u{1F1E9}" },
417
+ { name: "Suriname", code: "SR", phoneCode: "+597", flag: "\u{1F1F8}\u{1F1F7}" },
418
+ { name: "Svalbard and Jan Mayen", code: "SJ", phoneCode: "+47", flag: "\u{1F1F8}\u{1F1EF}" },
419
+ { name: "Swaziland", code: "SZ", phoneCode: "+268", flag: "\u{1F1F8}\u{1F1FF}" },
420
+ { name: "Sweden", code: "SE", phoneCode: "+46", flag: "\u{1F1F8}\u{1F1EA}" },
421
+ { name: "Switzerland", code: "CH", phoneCode: "+41", flag: "\u{1F1E8}\u{1F1ED}" },
422
+ { name: "Syrian Arab Republic", code: "SY", phoneCode: "+963", flag: "\u{1F1F8}\u{1F1FE}" },
423
+ { name: "Taiwan, Province of China", code: "TW", phoneCode: "+886", flag: "\u{1F1F9}\u{1F1FC}" },
424
+ { name: "Tajikistan", code: "TJ", phoneCode: "+992", flag: "\u{1F1F9}\u{1F1EF}" },
425
+ { name: "Tanzania, United Republic of", code: "TZ", phoneCode: "+255", flag: "\u{1F1F9}\u{1F1FF}" },
426
+ { name: "Thailand", code: "TH", phoneCode: "+66", flag: "\u{1F1F9}\u{1F1ED}" },
427
+ { name: "Timor-Leste", code: "TL", phoneCode: "+670", flag: "\u{1F1F9}\u{1F1F1}" },
428
+ { name: "Togo", code: "TG", phoneCode: "+228", flag: "\u{1F1F9}\u{1F1EC}" },
429
+ { name: "Tokelau", code: "TK", phoneCode: "+690", flag: "\u{1F1F9}\u{1F1F0}" },
430
+ { name: "Tonga", code: "TO", phoneCode: "+676", flag: "\u{1F1F9}\u{1F1F4}" },
431
+ { name: "Trinidad and Tobago", code: "TT", phoneCode: "+1", flag: "\u{1F1F9}\u{1F1F9}" },
432
+ { name: "Tunisia", code: "TN", phoneCode: "+216", flag: "\u{1F1F9}\u{1F1F3}" },
433
+ { name: "Turkey", code: "TR", phoneCode: "+90", flag: "\u{1F1F9}\u{1F1F7}" },
434
+ { name: "Turkmenistan", code: "TM", phoneCode: "+993", flag: "\u{1F1F9}\u{1F1F2}" },
435
+ { name: "Turks and Caicos Islands", code: "TC", phoneCode: "+1", flag: "\u{1F1F9}\u{1F1E8}" },
436
+ { name: "Tuvalu", code: "TV", phoneCode: "+688", flag: "\u{1F1F9}\u{1F1FB}" },
437
+ { name: "Uganda", code: "UG", phoneCode: "+256", flag: "\u{1F1FA}\u{1F1EC}" },
438
+ { name: "Ukraine", code: "UA", phoneCode: "+380", flag: "\u{1F1FA}\u{1F1E6}" },
439
+ { name: "United Arab Emirates", code: "AE", phoneCode: "+971", flag: "\u{1F1E6}\u{1F1EA}" },
440
+ { name: "United Kingdom", code: "GB", phoneCode: "+44", flag: "\u{1F1EC}\u{1F1E7}" },
441
+ { name: "United States", code: "US", phoneCode: "+1", flag: "\u{1F1FA}\u{1F1F8}" },
442
+ { name: "United States Minor Outlying Islands", code: "UM", phoneCode: "+1", flag: "\u{1F1FA}\u{1F1F2}" },
443
+ { name: "Uruguay", code: "UY", phoneCode: "+598", flag: "\u{1F1FA}\u{1F1FE}" },
444
+ { name: "Uzbekistan", code: "UZ", phoneCode: "+998", flag: "\u{1F1FA}\u{1F1FF}" },
445
+ { name: "Vanuatu", code: "VU", phoneCode: "+678", flag: "\u{1F1FB}\u{1F1FA}" },
446
+ { name: "Venezuela, Bolivarian Republic of", code: "VE", phoneCode: "+58", flag: "\u{1F1FB}\u{1F1EA}" },
447
+ { name: "Viet Nam", code: "VN", phoneCode: "+84", flag: "\u{1F1FB}\u{1F1F3}" },
448
+ { name: "Virgin Islands, British", code: "VG", phoneCode: "+1", flag: "\u{1F1FB}\u{1F1EC}" },
449
+ { name: "Virgin Islands, U.S.", code: "VI", phoneCode: "+1", flag: "\u{1F1FB}\u{1F1EE}" },
450
+ { name: "Wallis and Futuna", code: "WF", phoneCode: "+681", flag: "\u{1F1FC}\u{1F1EB}" },
451
+ { name: "Western Sahara", code: "EH", phoneCode: "+212", flag: "\u{1F1EA}\u{1F1ED}" },
452
+ { name: "Yemen", code: "YE", phoneCode: "+967", flag: "\u{1F1FE}\u{1F1EA}" },
453
+ { name: "Zambia", code: "ZM", phoneCode: "+260", flag: "\u{1F1FF}\u{1F1F2}" },
454
+ { name: "Zimbabwe", code: "ZW", phoneCode: "+263", flag: "\u{1F1FF}\u{1F1FC}" }
455
+ ];
204
456
 
205
457
  // src/utils/error.util.ts
206
458
  var validateRegex = (value, regex) => regex.test(value);
@@ -1777,6 +2029,7 @@ var BaseSelect = ({
1777
2029
  disabled = false,
1778
2030
  loading = false,
1779
2031
  validationError = "",
2032
+ showBottomText = true,
1780
2033
  label = "",
1781
2034
  hint = "",
1782
2035
  required = false,
@@ -2030,8 +2283,8 @@ var BaseSelect = ({
2030
2283
  ]
2031
2284
  }
2032
2285
  ),
2033
- hint && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BaseHint, { hint }),
2034
- validationError && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BaseInputError, { errorMessage: validationError })
2286
+ hint && showBottomText && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BaseHint, { hint }),
2287
+ validationError && showBottomText && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BaseInputError, { errorMessage: validationError })
2035
2288
  ] });
2036
2289
  };
2037
2290
 
@@ -2080,6 +2333,7 @@ var BaseInput = ({
2080
2333
  mask,
2081
2334
  placeholder,
2082
2335
  validationError = "",
2336
+ showBottomText = true,
2083
2337
  hint = "",
2084
2338
  rules = [],
2085
2339
  isAmountInput = false,
@@ -2183,8 +2437,8 @@ var BaseInput = ({
2183
2437
  ]
2184
2438
  }
2185
2439
  ),
2186
- (hint || localHint) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-body-3xs text-light-copy", children: localHint || hint }),
2187
- (validationError || localError) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-body-3xs text-red-500", children: localError || validationError })
2440
+ (hint || localHint) && showBottomText && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-body-3xs text-light-copy", children: localHint || hint }),
2441
+ (validationError || localError) && showBottomText && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-body-3xs text-red-500", children: localError || validationError })
2188
2442
  ] });
2189
2443
  };
2190
2444
 
@@ -2458,11 +2712,97 @@ function BzpCheckoutButton({
2458
2712
  }
2459
2713
 
2460
2714
  // src/buzapay-checkout/checkout-card.tsx
2461
- var import_react12 = require("react");
2715
+ var import_react13 = require("react");
2462
2716
 
2463
2717
  // src/components/pay-by-card.tsx
2464
- var import_react9 = require("react");
2718
+ var import_react10 = require("react");
2719
+
2720
+ // src/components/base/phone-number-input.tsx
2721
+ var import_react9 = __toESM(require("react"), 1);
2465
2722
  var import_jsx_runtime35 = require("react/jsx-runtime");
2723
+ var BasePhoneNumberInput = ({
2724
+ phoneCodeOptions,
2725
+ value,
2726
+ onChange,
2727
+ onCodeChange,
2728
+ label = "",
2729
+ required = false,
2730
+ disabled = false,
2731
+ loading = false,
2732
+ validationError = "",
2733
+ hint = "",
2734
+ defaultCountryCode,
2735
+ preventPaste = false,
2736
+ showCopyIcon = false,
2737
+ containerClassName = "",
2738
+ inputClassName = "",
2739
+ placeholder
2740
+ }) => {
2741
+ const safeDefaultCode = phoneCodeOptions?.[0]?.value ?? "+1";
2742
+ const [selectedCode, setSelectedCode] = import_react9.default.useState(safeDefaultCode);
2743
+ const selectedMeta = import_react9.default.useMemo(() => {
2744
+ return phoneCodeOptions.find((o) => o.value === selectedCode);
2745
+ }, [phoneCodeOptions, selectedCode]);
2746
+ const getFormattedCode = (codeValue) => codeValue.split("-")[0];
2747
+ const handleCountryChange = (nextValue) => {
2748
+ setSelectedCode(nextValue);
2749
+ onCodeChange?.(getFormattedCode(nextValue));
2750
+ };
2751
+ const handleChange = (e) => {
2752
+ const incoming = e;
2753
+ onChange?.(incoming);
2754
+ };
2755
+ const computedPlaceholder = placeholder ?? selectedMeta?.placeholder ?? (label ? `Enter ${label.toLowerCase()}` : "Enter phone number");
2756
+ (0, import_react9.useEffect)(() => {
2757
+ const nextValue = defaultCountryCode ?? safeDefaultCode;
2758
+ setSelectedCode(nextValue);
2759
+ onCodeChange?.(getFormattedCode(nextValue));
2760
+ }, [defaultCountryCode]);
2761
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `flex flex-col gap-2`, children: [
2762
+ label ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mb-0 text-body-2xs font-normal text-heading-text", children: [
2763
+ label,
2764
+ required && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-orange-required", children: " *" })
2765
+ ] }) : null,
2766
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `flex items-center gap-2 ${containerClassName}`, children: [
2767
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-1/3", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2768
+ BaseSelect,
2769
+ {
2770
+ required: true,
2771
+ options: phoneCodeOptions,
2772
+ value: selectedCode,
2773
+ showBottomText: false,
2774
+ itemImageType: "country",
2775
+ onChange: handleCountryChange,
2776
+ validationError,
2777
+ placeholder: "+234"
2778
+ }
2779
+ ) }),
2780
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2/3", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2781
+ BaseInput,
2782
+ {
2783
+ className: inputClassName,
2784
+ required,
2785
+ disabled,
2786
+ loading,
2787
+ validationError,
2788
+ showBottomText: false,
2789
+ hint,
2790
+ value,
2791
+ onChange: handleChange,
2792
+ rules: ["numeric"],
2793
+ preventPaste,
2794
+ showCopyIcon,
2795
+ placeholder: computedPlaceholder
2796
+ }
2797
+ ) })
2798
+ ] }),
2799
+ hint && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-body-3xs text-light-copy", children: hint }),
2800
+ validationError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-body-3xs text-red-500", children: validationError })
2801
+ ] });
2802
+ };
2803
+
2804
+ // src/components/pay-by-card.tsx
2805
+ var import_jsx_runtime36 = require("react/jsx-runtime");
2466
2806
  function PayByCard({
2467
2807
  secretKey,
2468
2808
  paymentObject,
@@ -2471,18 +2811,22 @@ function PayByCard({
2471
2811
  onError,
2472
2812
  caller = "buzapay"
2473
2813
  }) {
2474
- const [formIndex, setFormIndex] = (0, import_react9.useState)(0);
2475
- const [message, setMessage] = (0, import_react9.useState)("");
2476
- const [isMakingPayment, setIsMakingPayment] = (0, import_react9.useState)(false);
2477
- const [loading, setLoading] = (0, import_react9.useState)(false);
2478
- const [cardType, setCardType] = (0, import_react9.useState)("");
2479
- const [transactionReference, setTransactionReference] = (0, import_react9.useState)("");
2480
- const [loadingCountries, setLoadingCountries] = (0, import_react9.useState)(false);
2481
- const [loadingStates, setLoadingStates] = (0, import_react9.useState)(false);
2482
- const [rawCountries, setRawCountries] = (0, import_react9.useState)([]);
2483
- const [countries, setCountries] = (0, import_react9.useState)([]);
2484
- const [countryStates, setCountryStates] = (0, import_react9.useState)([]);
2485
- const [billingForm, setBillingForm] = (0, import_react9.useState)({
2814
+ const [formIndex, setFormIndex] = (0, import_react10.useState)(0);
2815
+ const [message, setMessage] = (0, import_react10.useState)("");
2816
+ const [isMakingPayment, setIsMakingPayment] = (0, import_react10.useState)(false);
2817
+ const [loading, setLoading] = (0, import_react10.useState)(false);
2818
+ const [defaultCountryCode, setDefaultCountryCode] = (0, import_react10.useState)("");
2819
+ const [cardType, setCardType] = (0, import_react10.useState)("");
2820
+ const [transactionReference, setTransactionReference] = (0, import_react10.useState)("");
2821
+ const [loadingCountries, setLoadingCountries] = (0, import_react10.useState)(false);
2822
+ const [loadingStates, setLoadingStates] = (0, import_react10.useState)(false);
2823
+ const [rawCountries, setRawCountries] = (0, import_react10.useState)([]);
2824
+ const [countries, setCountries] = (0, import_react10.useState)([]);
2825
+ const [countryStates, setCountryStates] = (0, import_react10.useState)([]);
2826
+ const [phoneCodeOptions, setPhoneCodeOptions] = (0, import_react10.useState)(
2827
+ []
2828
+ );
2829
+ const [billingForm, setBillingForm] = (0, import_react10.useState)({
2486
2830
  address1: "",
2487
2831
  address2: "",
2488
2832
  postalCode: "",
@@ -2490,9 +2834,10 @@ function PayByCard({
2490
2834
  city: "",
2491
2835
  country: "",
2492
2836
  emailAddress: "",
2493
- phoneNumber: ""
2837
+ phoneNumber: "",
2838
+ phoneNumberExt: ""
2494
2839
  });
2495
- const [payForm, setPayForm] = (0, import_react9.useState)({
2840
+ const [payForm, setPayForm] = (0, import_react10.useState)({
2496
2841
  customerName: "",
2497
2842
  cardNo: "",
2498
2843
  expireDate: "",
@@ -2500,10 +2845,10 @@ function PayByCard({
2500
2845
  cardPin: ""
2501
2846
  // Only required for Verve cards
2502
2847
  });
2503
- const [billingErrors, setBillingErrors] = (0, import_react9.useState)(
2848
+ const [billingErrors, setBillingErrors] = (0, import_react10.useState)(
2504
2849
  {}
2505
2850
  );
2506
- const [payErrors, setPayErrors] = (0, import_react9.useState)({});
2851
+ const [payErrors, setPayErrors] = (0, import_react10.useState)({});
2507
2852
  const billingRules = {
2508
2853
  address1: "required",
2509
2854
  address2: "",
@@ -2578,7 +2923,7 @@ function PayByCard({
2578
2923
  city: billingForm.city ?? "",
2579
2924
  country: billingForm.country ?? "",
2580
2925
  emailAddress: billingForm.emailAddress ?? "",
2581
- phoneNumber: billingForm.phoneNumber ?? ""
2926
+ phoneNumber: billingForm.phoneNumber ? `${billingForm.phoneNumberExt}${billingForm.phoneNumber}` : ""
2582
2927
  };
2583
2928
  const encryptedCardDetails = encryptPayload(secretKey, cardDetails);
2584
2929
  let payload = null;
@@ -2677,13 +3022,12 @@ function PayByCard({
2677
3022
  setIsMakingPayment(false);
2678
3023
  return;
2679
3024
  }
2680
- setMessage(response?.responseMessage || "Payment failed");
2681
- onPaymentAuthorized?.({
2682
- paymentId: response?.transactionReference,
2683
- paymentDate: response?.data?.updatedAt,
2684
- paymentStatus: "payment failed",
2685
- message
2686
- });
3025
+ if (response && response.message) {
3026
+ setMessage(response.message);
3027
+ onError?.({
3028
+ errorMessage: response.message
3029
+ });
3030
+ }
2687
3031
  setIsMakingPayment(false);
2688
3032
  } catch (err) {
2689
3033
  let friendly = "Payment failed";
@@ -2767,6 +3111,9 @@ function PayByCard({
2767
3111
  setLoadingCountries(false);
2768
3112
  }
2769
3113
  };
3114
+ const goBack = () => {
3115
+ setFormIndex(formIndex > 0 ? formIndex - 1 : 0);
3116
+ };
2770
3117
  const getStates = async (countryIso2) => {
2771
3118
  const country = rawCountries.find((c) => c.iso2 === countryIso2);
2772
3119
  if (!country) return;
@@ -2799,15 +3146,25 @@ function PayByCard({
2799
3146
  setCardType(cardTypeHandler(event));
2800
3147
  payRules.cardPin = cardType === "Verve" ? "required|numeric" : "";
2801
3148
  };
2802
- (0, import_react9.useEffect)(() => {
3149
+ (0, import_react10.useEffect)(() => {
2803
3150
  (async () => {
2804
3151
  await generatePaymentLinkHandler();
2805
3152
  await getAllCountries();
3153
+ const codeOptions = COUNTRIES.map((country) => {
3154
+ return {
3155
+ value: `${country.phoneCode}-${country.code}`,
3156
+ label: `${country.phoneCode}`,
3157
+ flag: country.flag,
3158
+ phoneCode: country.phoneCode,
3159
+ countryCode: country.code
3160
+ };
3161
+ }).sort((a, b) => a.label.localeCompare(b.label));
3162
+ setPhoneCodeOptions(codeOptions);
2806
3163
  })();
2807
3164
  }, []);
2808
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-6", children: [
2809
- formIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "grid grid-cols-2 gap-6 overflow-y-auto", children: [
2810
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3165
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-6", children: [
3166
+ formIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-2 gap-6 overflow-y-auto", children: [
3167
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2811
3168
  BaseInput,
2812
3169
  {
2813
3170
  label: "Address Line 1",
@@ -2822,7 +3179,7 @@ function PayByCard({
2822
3179
  validationError: billingErrors.address1 ?? ""
2823
3180
  }
2824
3181
  ) }),
2825
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3182
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2826
3183
  BaseInput,
2827
3184
  {
2828
3185
  label: "Address Line 2",
@@ -2831,7 +3188,7 @@ function PayByCard({
2831
3188
  validationError: billingErrors.address2 ?? ""
2832
3189
  }
2833
3190
  ) }),
2834
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3191
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2835
3192
  BaseSelect,
2836
3193
  {
2837
3194
  label: "Select Country",
@@ -2842,6 +3199,14 @@ function PayByCard({
2842
3199
  onChange: (e) => {
2843
3200
  setBillingForm({ ...billingForm, country: e, state: "" });
2844
3201
  getStates(e);
3202
+ const selectedCountry = COUNTRIES.filter(
3203
+ (c) => c.code.toLowerCase() === e.toLowerCase()
3204
+ )[0];
3205
+ if (selectedCountry) {
3206
+ setDefaultCountryCode(
3207
+ `${selectedCountry.phoneCode}-${selectedCountry.code}`
3208
+ );
3209
+ }
2845
3210
  if (billingErrors.country) {
2846
3211
  setBillingErrors((er) => ({ ...er, country: "" }));
2847
3212
  }
@@ -2849,7 +3214,7 @@ function PayByCard({
2849
3214
  validationError: billingErrors.country ?? ""
2850
3215
  }
2851
3216
  ),
2852
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3217
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2853
3218
  BaseSelect,
2854
3219
  {
2855
3220
  label: "Select State",
@@ -2866,7 +3231,7 @@ function PayByCard({
2866
3231
  validationError: billingErrors.state ?? ""
2867
3232
  }
2868
3233
  ),
2869
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3234
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2870
3235
  BaseInput,
2871
3236
  {
2872
3237
  label: "City",
@@ -2881,7 +3246,7 @@ function PayByCard({
2881
3246
  validationError: billingErrors.city ?? ""
2882
3247
  }
2883
3248
  ),
2884
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3249
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2885
3250
  BaseInput,
2886
3251
  {
2887
3252
  label: "Postal Code",
@@ -2896,7 +3261,7 @@ function PayByCard({
2896
3261
  validationError: billingErrors.postalCode ?? ""
2897
3262
  }
2898
3263
  ),
2899
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3264
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2900
3265
  BaseInput,
2901
3266
  {
2902
3267
  label: "Email",
@@ -2910,30 +3275,39 @@ function PayByCard({
2910
3275
  },
2911
3276
  validationError: billingErrors.emailAddress ?? ""
2912
3277
  }
2913
- ),
2914
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2915
- BaseInput,
3278
+ ) }),
3279
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3280
+ BasePhoneNumberInput,
2916
3281
  {
2917
3282
  label: "Phone Number",
2918
3283
  required: true,
3284
+ preventPaste: true,
2919
3285
  value: billingForm.phoneNumber,
3286
+ phoneCodeOptions,
3287
+ defaultCountryCode,
2920
3288
  onChange: (e) => {
2921
3289
  setBillingForm({ ...billingForm, phoneNumber: e });
2922
3290
  if (billingErrors.phoneNumber) {
2923
3291
  setBillingErrors((er) => ({ ...er, phoneNumber: "" }));
2924
3292
  }
2925
3293
  },
3294
+ onCodeChange: (e) => {
3295
+ setBillingForm({ ...billingForm, phoneNumberExt: e });
3296
+ if (billingErrors.phoneNumberExt) {
3297
+ setBillingErrors((er) => ({ ...er, phoneNumberExt: "" }));
3298
+ }
3299
+ },
2926
3300
  validationError: billingErrors.phoneNumber ?? ""
2927
3301
  }
2928
- )
3302
+ ) })
2929
3303
  ] }),
2930
- formIndex === 1 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3304
+ formIndex === 1 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
2931
3305
  "div",
2932
3306
  {
2933
3307
  className: "grid grid-cols-2 gap-6 overflow-y-auto",
2934
3308
  style: { maxHeight: 320 },
2935
3309
  children: [
2936
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3310
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2937
3311
  BaseInput,
2938
3312
  {
2939
3313
  label: "Card Name",
@@ -2948,7 +3322,7 @@ function PayByCard({
2948
3322
  validationError: payErrors.customerName ?? ""
2949
3323
  }
2950
3324
  ) }),
2951
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3325
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2952
3326
  BaseInput,
2953
3327
  {
2954
3328
  label: "Card Number",
@@ -2967,7 +3341,7 @@ function PayByCard({
2967
3341
  validationError: payErrors.cardNo ?? ""
2968
3342
  }
2969
3343
  ) }),
2970
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3344
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2971
3345
  BaseInput,
2972
3346
  {
2973
3347
  label: "Expiry Date",
@@ -2983,7 +3357,7 @@ function PayByCard({
2983
3357
  validationError: payErrors.expireDate ?? ""
2984
3358
  }
2985
3359
  ),
2986
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3360
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2987
3361
  BaseInput,
2988
3362
  {
2989
3363
  label: "CVV",
@@ -2999,7 +3373,7 @@ function PayByCard({
2999
3373
  validationError: payErrors.cvv ?? ""
3000
3374
  }
3001
3375
  ),
3002
- cardType === "Verve" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3376
+ cardType === "Verve" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3003
3377
  BaseInput,
3004
3378
  {
3005
3379
  label: "Card Pin",
@@ -3019,24 +3393,36 @@ function PayByCard({
3019
3393
  ]
3020
3394
  }
3021
3395
  ),
3022
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3023
- BaseButton,
3024
- {
3025
- label: formIndex === 0 ? "Proceed" : `Pay ${formatAmountHandler}`,
3026
- type: "primary",
3027
- customClass: "w-full mt-6",
3028
- caller,
3029
- loading: isMakingPayment,
3030
- onClick: proceedHandler,
3031
- disabled: isMakingPayment
3032
- }
3033
- )
3396
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between gap-4 mt-6", children: [
3397
+ formIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3398
+ BaseButton,
3399
+ {
3400
+ label: "Previous",
3401
+ type: "secondary",
3402
+ customClass: "w-1/2",
3403
+ caller,
3404
+ onClick: goBack
3405
+ }
3406
+ ),
3407
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3408
+ BaseButton,
3409
+ {
3410
+ label: formIndex === 0 ? "Proceed" : `Pay ${formatAmountHandler}`,
3411
+ type: "primary",
3412
+ customClass: `${formIndex > 0 ? "w-1/2" : "w-full"}`,
3413
+ caller,
3414
+ loading: isMakingPayment,
3415
+ onClick: proceedHandler,
3416
+ disabled: isMakingPayment
3417
+ }
3418
+ )
3419
+ ] })
3034
3420
  ] });
3035
3421
  }
3036
3422
 
3037
3423
  // src/components/pay-by-transfer.tsx
3038
- var import_react10 = require("react");
3039
- var import_jsx_runtime36 = require("react/jsx-runtime");
3424
+ var import_react11 = require("react");
3425
+ var import_jsx_runtime37 = require("react/jsx-runtime");
3040
3426
  var PayByTransfer = ({
3041
3427
  secretKey,
3042
3428
  paymentObject,
@@ -3046,25 +3432,25 @@ var PayByTransfer = ({
3046
3432
  onError,
3047
3433
  caller = "buzapay"
3048
3434
  }) => {
3049
- const [formIndex, setFormIndex] = (0, import_react10.useState)(0);
3050
- const [isMakingPayment, setIsMakingPayment] = (0, import_react10.useState)(false);
3051
- const [isConfirmCall, setIsConfirmCall] = (0, import_react10.useState)(false);
3052
- const [isPaymentConfirmed, setIsPaymentConfirmed] = (0, import_react10.useState)(false);
3053
- const [transactionReference, setTransactionReference] = (0, import_react10.useState)("");
3054
- const [paymentReferenceStatus, setPaymentReferenceStatus] = (0, import_react10.useState)("");
3055
- const [isFetchingPaymentDetails, setIsFetchingPaymentDetails] = (0, import_react10.useState)(false);
3056
- const [paymentReferenceDetails, setPaymentReferenceDetails] = (0, import_react10.useState)(null);
3057
- const [paymentAccountDetails, setPaymentAccountDetails] = (0, import_react10.useState)(null);
3058
- const [paymentMade, setPaymentMade] = (0, import_react10.useState)(false);
3059
- const [loading, setLoading] = (0, import_react10.useState)(false);
3060
- const [message, setMessage] = (0, import_react10.useState)("");
3061
- const [remainingSeconds, setRemainingSeconds] = (0, import_react10.useState)(30 * 60);
3062
- const [countDownTime, setCountDownTime] = (0, import_react10.useState)("00:00");
3063
- const intervalRef = (0, import_react10.useRef)(null);
3064
- const [transferForm, setTransferForm] = (0, import_react10.useState)({
3435
+ const [formIndex, setFormIndex] = (0, import_react11.useState)(0);
3436
+ const [isMakingPayment, setIsMakingPayment] = (0, import_react11.useState)(false);
3437
+ const [isConfirmCall, setIsConfirmCall] = (0, import_react11.useState)(false);
3438
+ const [isPaymentConfirmed, setIsPaymentConfirmed] = (0, import_react11.useState)(false);
3439
+ const [transactionReference, setTransactionReference] = (0, import_react11.useState)("");
3440
+ const [paymentReferenceStatus, setPaymentReferenceStatus] = (0, import_react11.useState)("");
3441
+ const [isFetchingPaymentDetails, setIsFetchingPaymentDetails] = (0, import_react11.useState)(false);
3442
+ const [paymentReferenceDetails, setPaymentReferenceDetails] = (0, import_react11.useState)(null);
3443
+ const [paymentAccountDetails, setPaymentAccountDetails] = (0, import_react11.useState)(null);
3444
+ const [paymentMade, setPaymentMade] = (0, import_react11.useState)(false);
3445
+ const [loading, setLoading] = (0, import_react11.useState)(false);
3446
+ const [message, setMessage] = (0, import_react11.useState)("");
3447
+ const [remainingSeconds, setRemainingSeconds] = (0, import_react11.useState)(30 * 60);
3448
+ const [countDownTime, setCountDownTime] = (0, import_react11.useState)("00:00");
3449
+ const intervalRef = (0, import_react11.useRef)(null);
3450
+ const [transferForm, setTransferForm] = (0, import_react11.useState)({
3065
3451
  customerName: ""
3066
3452
  });
3067
- const [transferErrors, setTransferErrors] = (0, import_react10.useState)(
3453
+ const [transferErrors, setTransferErrors] = (0, import_react11.useState)(
3068
3454
  {}
3069
3455
  );
3070
3456
  const transferRules = {
@@ -3214,12 +3600,12 @@ var PayByTransfer = ({
3214
3600
  setLoading(false);
3215
3601
  }
3216
3602
  };
3217
- const updateDisplay = (0, import_react10.useCallback)((secs) => {
3603
+ const updateDisplay = (0, import_react11.useCallback)((secs) => {
3218
3604
  const minutes = String(Math.floor(secs / 60)).padStart(2, "0");
3219
3605
  const seconds = String(secs % 60).padStart(2, "0");
3220
3606
  setCountDownTime(`${minutes}:${seconds}`);
3221
3607
  }, []);
3222
- const startTimer = (0, import_react10.useCallback)(() => {
3608
+ const startTimer = (0, import_react11.useCallback)(() => {
3223
3609
  if (intervalRef.current) {
3224
3610
  clearInterval(intervalRef.current);
3225
3611
  intervalRef.current = null;
@@ -3247,19 +3633,19 @@ var PayByTransfer = ({
3247
3633
  intervalRef.current = null;
3248
3634
  }
3249
3635
  };
3250
- (0, import_react10.useEffect)(() => {
3636
+ (0, import_react11.useEffect)(() => {
3251
3637
  (async () => {
3252
3638
  await generatePaymentLinkHandler();
3253
3639
  })();
3254
3640
  }, []);
3255
- (0, import_react10.useEffect)(() => {
3641
+ (0, import_react11.useEffect)(() => {
3256
3642
  if (remainingSeconds < 0 && intervalRef.current) {
3257
3643
  stopTimer();
3258
3644
  }
3259
3645
  }, [remainingSeconds]);
3260
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-10", children: [
3261
- formIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-10", children: [
3262
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3646
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-10", children: [
3647
+ formIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-10", children: [
3648
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3263
3649
  BaseInput,
3264
3650
  {
3265
3651
  label: "Customer Name",
@@ -3274,7 +3660,7 @@ var PayByTransfer = ({
3274
3660
  validationError: transferErrors.customerName ?? ""
3275
3661
  }
3276
3662
  ),
3277
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3663
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3278
3664
  BaseButton,
3279
3665
  {
3280
3666
  label: `Pay ${formatAmountHandler}`,
@@ -3286,8 +3672,8 @@ var PayByTransfer = ({
3286
3672
  }
3287
3673
  )
3288
3674
  ] }),
3289
- formIndex === 1 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-10", children: [
3290
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
3675
+ formIndex === 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-10", children: [
3676
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
3291
3677
  "div",
3292
3678
  {
3293
3679
  className: [
@@ -3295,22 +3681,22 @@ var PayByTransfer = ({
3295
3681
  caller === "miden" ? "bg-[#FAFDFF] border border-[#F0FAFF]" : "bg-[#EFF7FF]"
3296
3682
  ].join(" "),
3297
3683
  children: [
3298
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3684
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3299
3685
  BaseLabelInfo,
3300
3686
  {
3301
3687
  label: "Bank Name",
3302
3688
  value: `${paymentAccountDetails?.bank} ${paymentAccountDetails?.accountName}`
3303
3689
  }
3304
3690
  ),
3305
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
3306
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3691
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
3692
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3307
3693
  BaseLabelInfo,
3308
3694
  {
3309
3695
  label: "Account Number",
3310
3696
  value: paymentAccountDetails?.accountNumber
3311
3697
  }
3312
3698
  ),
3313
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3699
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3314
3700
  BaseCopy,
3315
3701
  {
3316
3702
  color: "#9DBFDE",
@@ -3318,20 +3704,20 @@ var PayByTransfer = ({
3318
3704
  }
3319
3705
  )
3320
3706
  ] }),
3321
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
3322
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(BaseLabelInfo, { label: "Amount", value: formatAmountHandler }),
3323
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(BaseCopy, { color: "#9DBFDE", copyText: formatAmountHandler })
3707
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
3708
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BaseLabelInfo, { label: "Amount", value: formatAmountHandler }),
3709
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BaseCopy, { color: "#9DBFDE", copyText: formatAmountHandler })
3324
3710
  ] })
3325
3711
  ]
3326
3712
  }
3327
3713
  ),
3328
- caller === "buzapay" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: "w-2/3 mx-auto text-center text-body-2xs font-medium text-sub-copy", children: [
3714
+ caller === "buzapay" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "w-2/3 mx-auto text-center text-body-2xs font-medium text-sub-copy", children: [
3329
3715
  "This account is for this transaction only and expires in",
3330
3716
  " ",
3331
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-orange-500", children: remainingSeconds >= 0 ? countDownTime : "00:00" })
3717
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-orange-500", children: remainingSeconds >= 0 ? countDownTime : "00:00" })
3332
3718
  ] }),
3333
- caller === "miden" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "p-4 rounded-lg bg-[#FAFDFF] flex items-center gap-3", children: [
3334
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3719
+ caller === "miden" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "p-4 rounded-lg bg-[#FAFDFF] flex items-center gap-3", children: [
3720
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3335
3721
  BaseCircularCountdown,
3336
3722
  {
3337
3723
  value: remainingSeconds,
@@ -3342,16 +3728,16 @@ var PayByTransfer = ({
3342
3728
  color: "#3b82f6"
3343
3729
  }
3344
3730
  ),
3345
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: "text-body-3xs font-medium text-light-copy", children: [
3731
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "text-body-3xs font-medium text-light-copy", children: [
3346
3732
  "This account is for this transaction only and expires in",
3347
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "text-[#1383E8] ml-2", children: [
3733
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "text-[#1383E8] ml-2", children: [
3348
3734
  countDownTime,
3349
3735
  "..."
3350
3736
  ] })
3351
3737
  ] })
3352
3738
  ] }),
3353
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4", children: [
3354
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3739
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-4", children: [
3740
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3355
3741
  BaseButton,
3356
3742
  {
3357
3743
  label: "I have paid the money",
@@ -3362,7 +3748,7 @@ var PayByTransfer = ({
3362
3748
  onClick: getReferenceDetails
3363
3749
  }
3364
3750
  ),
3365
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3751
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3366
3752
  "button",
3367
3753
  {
3368
3754
  type: "button",
@@ -3377,8 +3763,8 @@ var PayByTransfer = ({
3377
3763
  };
3378
3764
 
3379
3765
  // src/components/pay-by-stable-coin.tsx
3380
- var import_react11 = require("react");
3381
- var import_jsx_runtime37 = require("react/jsx-runtime");
3766
+ var import_react12 = require("react");
3767
+ var import_jsx_runtime38 = require("react/jsx-runtime");
3382
3768
  var PayByStableCoin = ({
3383
3769
  secretKey,
3384
3770
  paymentObject,
@@ -3387,25 +3773,25 @@ var PayByStableCoin = ({
3387
3773
  onError,
3388
3774
  caller = "buzapay"
3389
3775
  }) => {
3390
- const [formIndex, setFormIndex] = (0, import_react11.useState)(0);
3391
- const [message, setMessage] = (0, import_react11.useState)("");
3392
- const [loading, setLoading] = (0, import_react11.useState)(false);
3393
- const [generatingAddress, setGeneratingAddress] = (0, import_react11.useState)(false);
3394
- const [loadingStableCoins, setLoadingStableCoins] = (0, import_react11.useState)(false);
3395
- const [loadingStableCoinNetworks, setLoadingStableCoinNetworks] = (0, import_react11.useState)(false);
3396
- const [transactionReference, setTransactionReference] = (0, import_react11.useState)("");
3397
- const [stableCoins, setStableCoins] = (0, import_react11.useState)([]);
3398
- const [networkList, setNetworkList] = (0, import_react11.useState)([]);
3399
- const [addressDetails, setAddressDetails] = (0, import_react11.useState)(null);
3400
- const [generateAddressPayload, setGenerateAddressPayload] = (0, import_react11.useState)(null);
3401
- const [isConfirmingPayment, setIsConfirmingPayment] = (0, import_react11.useState)(false);
3402
- const [paymentReferenceDetails, setPaymentReferenceDetails] = (0, import_react11.useState)(null);
3403
- const [paymentReferenceStatus, setPaymentReferenceStatus] = (0, import_react11.useState)("");
3404
- const [stableCoinForm, setStableCoinForm] = (0, import_react11.useState)({
3776
+ const [formIndex, setFormIndex] = (0, import_react12.useState)(0);
3777
+ const [message, setMessage] = (0, import_react12.useState)("");
3778
+ const [loading, setLoading] = (0, import_react12.useState)(false);
3779
+ const [generatingAddress, setGeneratingAddress] = (0, import_react12.useState)(false);
3780
+ const [loadingStableCoins, setLoadingStableCoins] = (0, import_react12.useState)(false);
3781
+ const [loadingStableCoinNetworks, setLoadingStableCoinNetworks] = (0, import_react12.useState)(false);
3782
+ const [transactionReference, setTransactionReference] = (0, import_react12.useState)("");
3783
+ const [stableCoins, setStableCoins] = (0, import_react12.useState)([]);
3784
+ const [networkList, setNetworkList] = (0, import_react12.useState)([]);
3785
+ const [addressDetails, setAddressDetails] = (0, import_react12.useState)(null);
3786
+ const [generateAddressPayload, setGenerateAddressPayload] = (0, import_react12.useState)(null);
3787
+ const [isConfirmingPayment, setIsConfirmingPayment] = (0, import_react12.useState)(false);
3788
+ const [paymentReferenceDetails, setPaymentReferenceDetails] = (0, import_react12.useState)(null);
3789
+ const [paymentReferenceStatus, setPaymentReferenceStatus] = (0, import_react12.useState)("");
3790
+ const [stableCoinForm, setStableCoinForm] = (0, import_react12.useState)({
3405
3791
  stableCoin: "",
3406
3792
  network: ""
3407
3793
  });
3408
- const [stableCoinErrors, setStableCoinErrors] = (0, import_react11.useState)({});
3794
+ const [stableCoinErrors, setStableCoinErrors] = (0, import_react12.useState)({});
3409
3795
  const stableCoinRules = {
3410
3796
  stableCoin: "required",
3411
3797
  network: "required"
@@ -3597,16 +3983,16 @@ var PayByStableCoin = ({
3597
3983
  }
3598
3984
  };
3599
3985
  const amountPlusNetworkFee = addressDetails ? Number(addressDetails.transactionAmount) + addressDetails.networkFee : 0;
3600
- (0, import_react11.useEffect)(() => {
3986
+ (0, import_react12.useEffect)(() => {
3601
3987
  (async () => {
3602
3988
  await generatePaymentLinkHandler();
3603
3989
  await getAllStableCoins();
3604
3990
  })();
3605
3991
  }, []);
3606
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-6", children: [
3607
- formIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
3608
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "grid grid-cols-1 gap-6", children: [
3609
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3992
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-6", children: [
3993
+ formIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
3994
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "grid grid-cols-1 gap-6", children: [
3995
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3610
3996
  BaseSelect,
3611
3997
  {
3612
3998
  label: "Select Crypto",
@@ -3624,7 +4010,7 @@ var PayByStableCoin = ({
3624
4010
  validationError: stableCoinErrors.stableCoin ?? ""
3625
4011
  }
3626
4012
  ),
3627
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4013
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3628
4014
  BaseSelect,
3629
4015
  {
3630
4016
  label: "Select Network",
@@ -3642,7 +4028,7 @@ var PayByStableCoin = ({
3642
4028
  }
3643
4029
  )
3644
4030
  ] }),
3645
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4031
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3646
4032
  BaseButton,
3647
4033
  {
3648
4034
  label: `Pay ${formatAmountHandler}`,
@@ -3654,22 +4040,22 @@ var PayByStableCoin = ({
3654
4040
  }
3655
4041
  )
3656
4042
  ] }),
3657
- formIndex === 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
3658
- caller === "buzapay" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-6", children: [
3659
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mx-auto", children: [
3660
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(IconQrCode, {}),
3661
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-4xs text-light-copy font-normal text-center", children: generateAddressPayload?.currency })
4043
+ formIndex === 1 && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
4044
+ caller === "buzapay" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-6", children: [
4045
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mx-auto", children: [
4046
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(IconQrCode, {}),
4047
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-4xs text-light-copy font-normal text-center", children: generateAddressPayload?.currency })
3662
4048
  ] }),
3663
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-6 border-c border-grey-100 p-4 rounded-2xl bg-light-white-50", children: [
3664
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "border-b border-grey-border pb-4 flex flex-col gap-2", children: [
3665
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "Network" }),
3666
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between", children: [
3667
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-1", children: [
3668
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-2xs font-medium text-sub-copy", children: addressDetails?.chain }),
3669
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2", children: [
3670
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "*Est. arrival = 3 mins" }),
3671
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "|" }),
3672
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4049
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-6 border-c border-grey-100 p-4 rounded-2xl bg-light-white-50", children: [
4050
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "border-b border-grey-border pb-4 flex flex-col gap-2", children: [
4051
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "Network" }),
4052
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between", children: [
4053
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-1", children: [
4054
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-2xs font-medium text-sub-copy", children: addressDetails?.chain }),
4055
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2", children: [
4056
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "*Est. arrival = 3 mins" }),
4057
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "|" }),
4058
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3673
4059
  BaseCurrencyAmount,
3674
4060
  {
3675
4061
  currency: generateAddressPayload?.currency ?? "",
@@ -3682,21 +4068,21 @@ var PayByStableCoin = ({
3682
4068
  )
3683
4069
  ] })
3684
4070
  ] }),
3685
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(IconArrowSwap, {})
4071
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(IconArrowSwap, {})
3686
4072
  ] })
3687
4073
  ] }),
3688
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "pb-4 flex flex-col gap-2", children: [
3689
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "Deposit Address >" }),
3690
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between", children: [
3691
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-2xs font-medium text-sub-copy w-2/3 break-words", children: addressDetails?.walletAddress }),
3692
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BaseCopy, { copyText: addressDetails?.walletAddress ?? "" })
4074
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "pb-4 flex flex-col gap-2", children: [
4075
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-3xs text-light-copy font-normal", children: "Deposit Address >" }),
4076
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between", children: [
4077
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-2xs font-medium text-sub-copy w-2/3 break-words", children: addressDetails?.walletAddress }),
4078
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BaseCopy, { copyText: addressDetails?.walletAddress ?? "" })
3693
4079
  ] })
3694
4080
  ] })
3695
4081
  ] }),
3696
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-2", children: [
3697
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between border-b border-grey-border py-3", children: [
3698
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-2xs font-medium text-primary-black", children: "Network fee" }),
3699
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4082
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-2", children: [
4083
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between border-b border-grey-border py-3", children: [
4084
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-2xs font-medium text-primary-black", children: "Network fee" }),
4085
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3700
4086
  BaseCurrencyAmount,
3701
4087
  {
3702
4088
  currency: generateAddressPayload?.currency ?? "",
@@ -3706,9 +4092,9 @@ var PayByStableCoin = ({
3706
4092
  }
3707
4093
  )
3708
4094
  ] }),
3709
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between py-4", children: [
3710
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-0 text-body-lg font-semibold text-primary-black", children: "Pay" }),
3711
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4095
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between py-4", children: [
4096
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-0 text-body-lg font-semibold text-primary-black", children: "Pay" }),
4097
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3712
4098
  BaseCurrencyAmount,
3713
4099
  {
3714
4100
  currency: generateAddressPayload?.currency ?? "",
@@ -3721,7 +4107,7 @@ var PayByStableCoin = ({
3721
4107
  )
3722
4108
  ] })
3723
4109
  ] }),
3724
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4110
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3725
4111
  BaseButton,
3726
4112
  {
3727
4113
  label: "Confirm Payment",
@@ -3733,17 +4119,17 @@ var PayByStableCoin = ({
3733
4119
  }
3734
4120
  ) })
3735
4121
  ] }),
3736
- caller === "miden" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-6", children: [
3737
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "p-4 rounded-lg flex flex-col gap-6 bg-[#FAFDFF] border border-[#F0FAFF]", children: [
3738
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
3739
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4122
+ caller === "miden" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-6", children: [
4123
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "p-4 rounded-lg flex flex-col gap-6 bg-[#FAFDFF] border border-[#F0FAFF]", children: [
4124
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
4125
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3740
4126
  BaseLabelInfo,
3741
4127
  {
3742
4128
  label: "Chain",
3743
4129
  value: addressDetails?.chain ?? ""
3744
4130
  }
3745
4131
  ),
3746
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4132
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3747
4133
  BaseCopy,
3748
4134
  {
3749
4135
  color: "#9DBFDE",
@@ -3751,15 +4137,15 @@ var PayByStableCoin = ({
3751
4137
  }
3752
4138
  )
3753
4139
  ] }),
3754
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
3755
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4140
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
4141
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3756
4142
  BaseLabelInfo,
3757
4143
  {
3758
4144
  label: "Wallet Address",
3759
4145
  value: addressDetails?.walletAddress ?? ""
3760
4146
  }
3761
4147
  ),
3762
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4148
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3763
4149
  BaseCopy,
3764
4150
  {
3765
4151
  color: "#9DBFDE",
@@ -3767,9 +4153,9 @@ var PayByStableCoin = ({
3767
4153
  }
3768
4154
  )
3769
4155
  ] }),
3770
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col", children: [
3771
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-1 text-body-4xs font-medium text-light-copy uppercase", children: "Amount" }),
3772
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4156
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col", children: [
4157
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-1 text-body-4xs font-medium text-light-copy uppercase", children: "Amount" }),
4158
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3773
4159
  BaseCurrencyAmount,
3774
4160
  {
3775
4161
  currency: generateAddressPayload?.currency ?? "",
@@ -3781,17 +4167,17 @@ var PayByStableCoin = ({
3781
4167
  }
3782
4168
  )
3783
4169
  ] }),
3784
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-4 items-center justify-center", children: [
3785
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-24 border border-[#E1EBF5]" }),
3786
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-2 text-body-2xs text-[#5F738C] font-normal", children: "Or" }),
3787
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-24 border border-[#E1EBF5]" })
4170
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex gap-4 items-center justify-center", children: [
4171
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "w-24 border border-[#E1EBF5]" }),
4172
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-2 text-body-2xs text-[#5F738C] font-normal", children: "Or" }),
4173
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "w-24 border border-[#E1EBF5]" })
3788
4174
  ] }),
3789
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mx-auto", children: [
3790
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mb-2 text-body-xs text-primary font-semibold text-center", children: "Scan to Pay" }),
3791
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(IconQrCode, {})
4175
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mx-auto", children: [
4176
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mb-2 text-body-xs text-primary font-semibold text-center", children: "Scan to Pay" }),
4177
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(IconQrCode, {})
3792
4178
  ] })
3793
4179
  ] }),
3794
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4180
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3795
4181
  BaseButton,
3796
4182
  {
3797
4183
  label: "I have made this payment",
@@ -3808,7 +4194,8 @@ var PayByStableCoin = ({
3808
4194
  };
3809
4195
 
3810
4196
  // src/buzapay-checkout/checkout-card.tsx
3811
- var import_jsx_runtime38 = require("react/jsx-runtime");
4197
+ var import_react_hot_toast = __toESM(require("react-hot-toast"), 1);
4198
+ var import_jsx_runtime39 = require("react/jsx-runtime");
3812
4199
  function BzpCheckoutCard({
3813
4200
  secretKey,
3814
4201
  environment = "sandbox",
@@ -3823,15 +4210,15 @@ function BzpCheckoutCard({
3823
4210
  onPaymentAuthorized,
3824
4211
  onError
3825
4212
  }) {
3826
- const [checkoutState, setCheckoutState] = (0, import_react12.useState)("PENDING");
4213
+ const [checkoutState, setCheckoutState] = (0, import_react13.useState)("PENDING");
3827
4214
  const paymentTypeOptions = [
3828
4215
  { label: "Card", value: "CARD" },
3829
4216
  { label: "Bank Transfer", value: "BANK_TRANSFER" },
3830
4217
  { label: "Stable Coin", value: "STABLE_COIN" }
3831
4218
  ];
3832
- const [filteredPaymentTypeOptions, setFilteredPaymentTypeOptions] = (0, import_react12.useState)([]);
3833
- const [paymentType, setPaymentType] = (0, import_react12.useState)("");
3834
- const [successObject, setSuccessObject] = (0, import_react12.useState)({
4219
+ const [filteredPaymentTypeOptions, setFilteredPaymentTypeOptions] = (0, import_react13.useState)([]);
4220
+ const [paymentType, setPaymentType] = (0, import_react13.useState)("");
4221
+ const [successObject, setSuccessObject] = (0, import_react13.useState)({
3835
4222
  paymentDate: "",
3836
4223
  paymentId: "",
3837
4224
  paymentStatus: ""
@@ -3843,16 +4230,26 @@ function BzpCheckoutCard({
3843
4230
  setSuccessObject({ ...event });
3844
4231
  if (event.paymentStatus === "authorized") {
3845
4232
  setCheckoutState("SUCCESS");
4233
+ import_react_hot_toast.default.success("Payment authorization successful.", toastConfig);
4234
+ } else if (event.paymentStatus === "confirmed") {
4235
+ setCheckoutState("SUCCESS");
4236
+ import_react_hot_toast.default.success("Payment confirmed.", toastConfig);
3846
4237
  } else if (event.paymentStatus === "payment failed") {
3847
4238
  setCheckoutState("PENDING");
4239
+ import_react_hot_toast.default.error("Payment pending.", toastConfig);
3848
4240
  } else if (event.paymentStatus === "used") {
3849
4241
  setCheckoutState("USED");
3850
4242
  } else {
3851
4243
  setCheckoutState("PENDING");
4244
+ import_react_hot_toast.default.error("Payment pending.", toastConfig);
3852
4245
  }
3853
4246
  onPaymentAuthorized?.(event);
3854
4247
  };
3855
- (0, import_react12.useEffect)(() => {
4248
+ const onErrorHandler = (error) => {
4249
+ import_react_hot_toast.default.error(error.errorMessage ?? "Payment failed.", toastConfig);
4250
+ onError?.(error);
4251
+ };
4252
+ (0, import_react13.useEffect)(() => {
3856
4253
  let options = [];
3857
4254
  if (paymentObject.currency === "USD") {
3858
4255
  if (paymentObject.amount < 50) {
@@ -3871,103 +4268,106 @@ function BzpCheckoutCard({
3871
4268
  }
3872
4269
  setFilteredPaymentTypeOptions(options);
3873
4270
  }, [paymentObject.currency, paymentObject.amount]);
3874
- (0, import_react12.useEffect)(() => {
4271
+ (0, import_react13.useEffect)(() => {
3875
4272
  if (filteredPaymentTypeOptions.length) {
3876
4273
  setPaymentType(filteredPaymentTypeOptions[0].value);
3877
4274
  }
3878
4275
  }, [filteredPaymentTypeOptions]);
3879
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BaseCard, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "grid grid-cols-3", children: [
3880
- checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "bg-[#EFF7FF] px-6 py-8 flex flex-col gap-5 col-span-1 rounded-l-xl", children: [
3881
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-heading-text text-body-xs font-semibold", children: "Pay with" }),
3882
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3883
- BaseRadioGroup,
4276
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(BaseCard, { children: [
4277
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_hot_toast.Toaster, {}),
4278
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "grid grid-cols-3", children: [
4279
+ checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "bg-[#EFF7FF] px-6 py-8 flex flex-col gap-5 col-span-1 rounded-l-xl", children: [
4280
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-heading-text text-body-xs font-semibold", children: "Pay with" }),
4281
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4282
+ BaseRadioGroup,
4283
+ {
4284
+ options: filteredPaymentTypeOptions,
4285
+ selectedChange: (e) => paymentTypeHandler(e)
4286
+ }
4287
+ )
4288
+ ] }),
4289
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4290
+ "div",
3884
4291
  {
3885
- options: filteredPaymentTypeOptions,
3886
- selectedChange: (e) => paymentTypeHandler(e)
3887
- }
3888
- )
3889
- ] }),
3890
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
3891
- "div",
3892
- {
3893
- className: checkoutState === "SUCCESS" ? "col-span-3" : "col-span-2",
3894
- children: [
3895
- checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between px-12 py-8", children: [
3896
- paymentObject.logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3897
- BaseImage,
4292
+ className: checkoutState === "SUCCESS" || checkoutState === "USED" && paymentType === "BANK_TRANSFER" ? "col-span-3" : "col-span-2",
4293
+ children: [
4294
+ checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between px-12 py-8", children: [
4295
+ paymentObject.logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4296
+ BaseImage,
4297
+ {
4298
+ src: paymentObject.logoUrl ?? "",
4299
+ alt: "Merchant Logo",
4300
+ width: 52,
4301
+ height: 52,
4302
+ customClass: "rounded-lg object-fit"
4303
+ }
4304
+ ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4305
+ "div",
4306
+ {
4307
+ className: "bg-heading-text rounded flex flex-col justify-center",
4308
+ style: { width: "52px", height: "52px" },
4309
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-white text-center text-body-2xs font-medium", children: "Logo" })
4310
+ }
4311
+ ),
4312
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-col gap-1", children: [
4313
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-body-2xs font-regular text-sub-copy text-right", children: paymentObject.merchantName }),
4314
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { className: "text-body-2xs font-regular text-sub-copy text-right", children: [
4315
+ "Pay:",
4316
+ " ",
4317
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-orange-500 font-extrabold", children: formatAmount(paymentObject.amount, paymentObject.currency) })
4318
+ ] })
4319
+ ] })
4320
+ ] }),
4321
+ checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "max-h-[32rem] overflow-y-scroll px-10 pb-10 pt-2", children: paymentType === "CARD" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4322
+ PayByCard,
3898
4323
  {
3899
- src: paymentObject.logoUrl ?? "",
3900
- alt: "Merchant Logo",
3901
- width: 52,
3902
- height: 52,
3903
- customClass: "rounded-lg object-fit"
4324
+ secretKey,
4325
+ environment,
4326
+ paymentObject,
4327
+ onPaymentAuthorized: setSuccess,
4328
+ onError: onErrorHandler
3904
4329
  }
3905
- ) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3906
- "div",
4330
+ ) : paymentType === "BANK_TRANSFER" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4331
+ PayByTransfer,
3907
4332
  {
3908
- className: "bg-heading-text rounded flex flex-col justify-center",
3909
- style: { width: "52px", height: "52px" },
3910
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-white text-center text-body-2xs font-medium", children: "Logo" })
4333
+ secretKey,
4334
+ environment,
4335
+ paymentObject,
4336
+ onPaymentAuthorized: setSuccess,
4337
+ onError: onErrorHandler
3911
4338
  }
3912
- ),
3913
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-1", children: [
3914
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-body-2xs font-regular text-sub-copy text-right", children: paymentObject.merchantName }),
3915
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("p", { className: "text-body-2xs font-regular text-sub-copy text-right", children: [
3916
- "Pay:",
3917
- " ",
3918
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-orange-500 font-extrabold", children: formatAmount(paymentObject.amount, paymentObject.currency) })
3919
- ] })
3920
- ] })
3921
- ] }),
3922
- checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "max-h-[32rem] overflow-y-scroll px-10 pb-10 pt-2", children: paymentType === "CARD" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3923
- PayByCard,
3924
- {
3925
- secretKey,
3926
- environment,
3927
- paymentObject,
3928
- onPaymentAuthorized: setSuccess,
3929
- onError
3930
- }
3931
- ) : paymentType === "BANK_TRANSFER" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3932
- PayByTransfer,
3933
- {
3934
- secretKey,
3935
- environment,
3936
- paymentObject,
3937
- onPaymentAuthorized: setSuccess,
3938
- onError
3939
- }
3940
- ) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3941
- PayByStableCoin,
3942
- {
3943
- secretKey,
3944
- environment,
3945
- paymentObject,
3946
- onPaymentAuthorized: setSuccess,
3947
- onError
3948
- }
3949
- ) }),
3950
- checkoutState === "SUCCESS" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
3951
- BaseSuccess,
3952
- {
3953
- amount: paymentObject.amount,
3954
- currency: paymentObject.currency,
3955
- redirectUrl: paymentObject.redirectUrl ?? "",
3956
- successObject
3957
- }
3958
- )
3959
- ]
3960
- }
3961
- )
3962
- ] }) });
4339
+ ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4340
+ PayByStableCoin,
4341
+ {
4342
+ secretKey,
4343
+ environment,
4344
+ paymentObject,
4345
+ onPaymentAuthorized: setSuccess,
4346
+ onError: onErrorHandler
4347
+ }
4348
+ ) }),
4349
+ checkoutState === "SUCCESS" || checkoutState === "USED" && paymentType === "BANK_TRANSFER" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4350
+ BaseSuccess,
4351
+ {
4352
+ amount: paymentObject.amount,
4353
+ currency: paymentObject.currency,
4354
+ redirectUrl: paymentObject.redirectUrl ?? "",
4355
+ successObject
4356
+ }
4357
+ )
4358
+ ]
4359
+ }
4360
+ )
4361
+ ] })
4362
+ ] });
3963
4363
  }
3964
4364
 
3965
4365
  // src/miden-checkout/checkout-button.tsx
3966
- var import_react14 = require("react");
4366
+ var import_react15 = require("react");
3967
4367
 
3968
4368
  // src/miden-checkout/checkout-iframe.tsx
3969
- var import_react13 = require("react");
3970
- var import_jsx_runtime39 = require("react/jsx-runtime");
4369
+ var import_react14 = require("react");
4370
+ var import_jsx_runtime40 = require("react/jsx-runtime");
3971
4371
  function MidenCheckoutIframe({
3972
4372
  style = {
3973
4373
  width: "100%",
@@ -3990,12 +4390,12 @@ function MidenCheckoutIframe({
3990
4390
  },
3991
4391
  onError
3992
4392
  }) {
3993
- const containerRef = (0, import_react13.useRef)(null);
3994
- const iframeRef = (0, import_react13.useRef)(null);
3995
- const [message, setMessage] = (0, import_react13.useState)("");
3996
- const [launchUrl, setLaunchUrl] = (0, import_react13.useState)("");
3997
- const [loading, setLoading] = (0, import_react13.useState)(false);
3998
- const launchIframe = (0, import_react13.useCallback)(
4393
+ const containerRef = (0, import_react14.useRef)(null);
4394
+ const iframeRef = (0, import_react14.useRef)(null);
4395
+ const [message, setMessage] = (0, import_react14.useState)("");
4396
+ const [launchUrl, setLaunchUrl] = (0, import_react14.useState)("");
4397
+ const [loading, setLoading] = (0, import_react14.useState)(false);
4398
+ const launchIframe = (0, import_react14.useCallback)(
3999
4399
  (url2) => {
4000
4400
  if (iframeRef.current && iframeRef.current.parentNode) {
4001
4401
  iframeRef.current.parentNode.removeChild(iframeRef.current);
@@ -4051,18 +4451,18 @@ function MidenCheckoutIframe({
4051
4451
  setLoading(false);
4052
4452
  }
4053
4453
  };
4054
- (0, import_react13.useEffect)(() => {
4454
+ (0, import_react14.useEffect)(() => {
4055
4455
  if (!containerRef.current) return;
4056
4456
  generatePaymentLinkHandler();
4057
4457
  }, []);
4058
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "relative", style, children: [
4059
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ref: containerRef, className: "w-full h-full" }),
4060
- loading && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "absolute inset-0 grid place-items-center bg-white/60", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(IconLoader, {}) })
4458
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "relative", style, children: [
4459
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref: containerRef, className: "w-full h-full" }),
4460
+ loading && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "absolute inset-0 grid place-items-center bg-white/60", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(IconLoader, {}) })
4061
4461
  ] });
4062
4462
  }
4063
4463
 
4064
4464
  // src/miden-checkout/checkout-button.tsx
4065
- var import_jsx_runtime40 = require("react/jsx-runtime");
4465
+ var import_jsx_runtime41 = require("react/jsx-runtime");
4066
4466
  function MidenCheckoutButton({
4067
4467
  secretKey,
4068
4468
  environment = "sandbox",
@@ -4078,10 +4478,10 @@ function MidenCheckoutButton({
4078
4478
  mode = "redirect",
4079
4479
  onError
4080
4480
  }) {
4081
- const [message, setMessage] = (0, import_react14.useState)("");
4082
- const [launchUrl, setLaunchUrl] = (0, import_react14.useState)("");
4083
- const [urlLaunchUrl, setUrlLaunchUrl] = (0, import_react14.useState)("");
4084
- const [loading, setLoading] = (0, import_react14.useState)(false);
4481
+ const [message, setMessage] = (0, import_react15.useState)("");
4482
+ const [launchUrl, setLaunchUrl] = (0, import_react15.useState)("");
4483
+ const [urlLaunchUrl, setUrlLaunchUrl] = (0, import_react15.useState)("");
4484
+ const [loading, setLoading] = (0, import_react15.useState)(false);
4085
4485
  const generatePaymentLinkHandler = async () => {
4086
4486
  if (!secretKey) {
4087
4487
  setMessage("Secret key is required.");
@@ -4119,15 +4519,15 @@ function MidenCheckoutButton({
4119
4519
  setLoading(false);
4120
4520
  }
4121
4521
  };
4122
- return urlLaunchUrl && mode === "iframe" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4522
+ return urlLaunchUrl && mode === "iframe" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4123
4523
  MidenCheckoutIframe,
4124
4524
  {
4125
4525
  url: urlLaunchUrl,
4126
4526
  secretKey,
4127
4527
  environment
4128
4528
  }
4129
- ) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
4130
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4529
+ ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
4530
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4131
4531
  BaseButton,
4132
4532
  {
4133
4533
  label: "Pay",
@@ -4138,13 +4538,14 @@ function MidenCheckoutButton({
4138
4538
  onClick: generatePaymentLinkHandler
4139
4539
  }
4140
4540
  ),
4141
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BaseInputError, { errorMessage: message })
4541
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BaseInputError, { errorMessage: message })
4142
4542
  ] });
4143
4543
  }
4144
4544
 
4145
4545
  // src/miden-checkout/checkout-card.tsx
4146
- var import_react15 = require("react");
4147
- var import_jsx_runtime41 = require("react/jsx-runtime");
4546
+ var import_react16 = require("react");
4547
+ var import_react_hot_toast2 = __toESM(require("react-hot-toast"), 1);
4548
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4148
4549
  function MidenCheckoutCard({
4149
4550
  secretKey,
4150
4551
  options,
@@ -4160,15 +4561,15 @@ function MidenCheckoutCard({
4160
4561
  onPaymentAuthorized,
4161
4562
  onError
4162
4563
  }) {
4163
- const [checkoutState, setCheckoutState] = (0, import_react15.useState)("PENDING");
4564
+ const [checkoutState, setCheckoutState] = (0, import_react16.useState)("PENDING");
4164
4565
  const paymentTypeOptions = [
4165
4566
  { label: "Card", value: "CARD" },
4166
4567
  { label: "Bank Transfer", value: "BANK_TRANSFER" },
4167
4568
  { label: "Stable Coin", value: "STABLE_COIN" }
4168
4569
  ];
4169
- const [filteredPaymentTypeOptions, setFilteredPaymentTypeOptions] = (0, import_react15.useState)([]);
4170
- const [paymentType, setPaymentType] = (0, import_react15.useState)("");
4171
- const [successObject, setSuccessObject] = (0, import_react15.useState)({
4570
+ const [filteredPaymentTypeOptions, setFilteredPaymentTypeOptions] = (0, import_react16.useState)([]);
4571
+ const [paymentType, setPaymentType] = (0, import_react16.useState)("");
4572
+ const [successObject, setSuccessObject] = (0, import_react16.useState)({
4172
4573
  paymentDate: "",
4173
4574
  paymentId: "",
4174
4575
  paymentStatus: ""
@@ -4180,22 +4581,32 @@ function MidenCheckoutCard({
4180
4581
  setSuccessObject({ ...event });
4181
4582
  if (event.paymentStatus === "authorized") {
4182
4583
  setCheckoutState("SUCCESS");
4584
+ import_react_hot_toast2.default.success("Payment authorization successful.", toastConfig);
4585
+ } else if (event.paymentStatus === "confirmed") {
4586
+ setCheckoutState("SUCCESS");
4587
+ import_react_hot_toast2.default.success("Payment confirmed.", toastConfig);
4183
4588
  } else if (event.paymentStatus === "payment failed") {
4184
4589
  setCheckoutState("PENDING");
4590
+ import_react_hot_toast2.default.error("Payment pending.", toastConfig);
4185
4591
  } else if (event.paymentStatus === "used") {
4186
4592
  setCheckoutState("USED");
4187
4593
  } else {
4188
4594
  setCheckoutState("PENDING");
4595
+ import_react_hot_toast2.default.error("Payment pending.", toastConfig);
4189
4596
  }
4190
4597
  onPaymentAuthorized?.(event);
4191
4598
  };
4599
+ const onErrorHandler = (error) => {
4600
+ import_react_hot_toast2.default.error(error.errorMessage ?? "Payment failed.", toastConfig);
4601
+ onError?.(error);
4602
+ };
4192
4603
  const formatAmountHandler = () => {
4193
4604
  return formatAmount(paymentObject.amount, paymentObject.currency);
4194
4605
  };
4195
4606
  const formatChargeHandler = () => {
4196
4607
  return formatAmount(0, paymentObject.currency);
4197
4608
  };
4198
- (0, import_react15.useEffect)(() => {
4609
+ (0, import_react16.useEffect)(() => {
4199
4610
  let options2 = [];
4200
4611
  if (paymentObject.currency === "USD") {
4201
4612
  if (paymentObject.amount < 50) {
@@ -4214,89 +4625,92 @@ function MidenCheckoutCard({
4214
4625
  }
4215
4626
  setFilteredPaymentTypeOptions(options2);
4216
4627
  }, [paymentObject.currency, paymentObject.amount]);
4217
- (0, import_react15.useEffect)(() => {
4628
+ (0, import_react16.useEffect)(() => {
4218
4629
  if (filteredPaymentTypeOptions.length) {
4219
4630
  setPaymentType(filteredPaymentTypeOptions[0].value);
4220
4631
  }
4221
4632
  }, [filteredPaymentTypeOptions]);
4222
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BaseCard, { caller: "miden", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "grid grid-cols-3", children: [
4223
- checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "bg-[#0A0032] py-6 flex flex-col gap-5 col-span-1 rounded-l-xl", children: [
4224
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-white text-body-xs font-semibold px-6", children: "Pay with" }),
4225
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4226
- BaseRadioGroup,
4633
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(BaseCard, { caller: "miden", children: [
4634
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_hot_toast2.Toaster, {}),
4635
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "grid grid-cols-3", children: [
4636
+ checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "bg-[#0A0032] py-6 flex flex-col gap-5 col-span-1 rounded-l-xl", children: [
4637
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-white text-body-xs font-semibold px-6", children: "Pay with" }),
4638
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4639
+ BaseRadioGroup,
4640
+ {
4641
+ caller: "miden",
4642
+ options: filteredPaymentTypeOptions,
4643
+ selectedChange: (e) => paymentTypeHandler(e)
4644
+ }
4645
+ )
4646
+ ] }),
4647
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4648
+ "div",
4227
4649
  {
4228
- caller: "miden",
4229
- options: filteredPaymentTypeOptions,
4230
- selectedChange: (e) => paymentTypeHandler(e)
4231
- }
4232
- )
4233
- ] }),
4234
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
4235
- "div",
4236
- {
4237
- className: checkoutState === "SUCCESS" ? "col-span-3" : "col-span-2",
4238
- children: [
4239
- checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between p-6", children: [
4240
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(IconMidenLogo, {}),
4241
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(IconClose, { color: "black", className: "cursor-pointer" })
4242
- ] }),
4243
- checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "px-14 pt-4 pb-8 flex flex-col gap-6 max-h-[32rem] overflow-y-scroll", children: [
4244
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between py-3 px-4 bg-[#F8FDFF] border border-[#DAE4E8] rounded-lg", children: [
4245
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4246
- BaseLabelInfo,
4650
+ className: checkoutState === "SUCCESS" ? "col-span-3" : "col-span-2",
4651
+ children: [
4652
+ checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center justify-between p-6", children: [
4653
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(IconMidenLogo, {}),
4654
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(IconClose, { color: "black", className: "cursor-pointer" })
4655
+ ] }),
4656
+ checkoutState === "PENDING" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "px-14 pt-4 pb-8 flex flex-col gap-6 max-h-[32rem] overflow-y-scroll", children: [
4657
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center justify-between py-3 px-4 bg-[#F8FDFF] border border-[#DAE4E8] rounded-lg", children: [
4658
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4659
+ BaseLabelInfo,
4660
+ {
4661
+ label: "Amount Due",
4662
+ value: formatAmountHandler()
4663
+ }
4664
+ ),
4665
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BaseLabelInfo, { label: "Charges", value: formatChargeHandler() })
4666
+ ] }),
4667
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: paymentType === "CARD" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4668
+ PayByCard,
4247
4669
  {
4248
- label: "Amount Due",
4249
- value: formatAmountHandler()
4670
+ secretKey,
4671
+ environment,
4672
+ caller: "miden",
4673
+ paymentObject,
4674
+ onPaymentAuthorized: setSuccess,
4675
+ onError: onErrorHandler
4250
4676
  }
4251
- ),
4252
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BaseLabelInfo, { label: "Charges", value: formatChargeHandler() })
4677
+ ) : paymentType === "BANK_TRANSFER" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4678
+ PayByTransfer,
4679
+ {
4680
+ secretKey,
4681
+ environment,
4682
+ caller: "miden",
4683
+ paymentObject,
4684
+ onPaymentAuthorized: setSuccess,
4685
+ onError: onErrorHandler
4686
+ }
4687
+ ) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4688
+ PayByStableCoin,
4689
+ {
4690
+ secretKey,
4691
+ environment,
4692
+ caller: "miden",
4693
+ paymentObject,
4694
+ onPaymentAuthorized: setSuccess,
4695
+ onError: onErrorHandler
4696
+ }
4697
+ ) })
4253
4698
  ] }),
4254
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: paymentType === "CARD" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4255
- PayByCard,
4256
- {
4257
- secretKey,
4258
- environment,
4259
- caller: "miden",
4260
- paymentObject,
4261
- onPaymentAuthorized: setSuccess,
4262
- onError
4263
- }
4264
- ) : paymentType === "BANK_TRANSFER" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4265
- PayByTransfer,
4266
- {
4267
- secretKey,
4268
- environment,
4269
- caller: "miden",
4270
- paymentObject,
4271
- onPaymentAuthorized: setSuccess,
4272
- onError
4273
- }
4274
- ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4275
- PayByStableCoin,
4699
+ checkoutState === "SUCCESS" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4700
+ BaseSuccess,
4276
4701
  {
4277
- secretKey,
4278
- environment,
4702
+ amount: paymentObject.amount,
4703
+ currency: paymentObject.currency,
4279
4704
  caller: "miden",
4280
- paymentObject,
4281
- onPaymentAuthorized: setSuccess,
4282
- onError
4705
+ redirectUrl: paymentObject.redirectUrl ?? "",
4706
+ successObject
4283
4707
  }
4284
- ) })
4285
- ] }),
4286
- checkoutState === "SUCCESS" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4287
- BaseSuccess,
4288
- {
4289
- amount: paymentObject.amount,
4290
- currency: paymentObject.currency,
4291
- caller: "miden",
4292
- redirectUrl: paymentObject.redirectUrl ?? "",
4293
- successObject
4294
- }
4295
- )
4296
- ]
4297
- }
4298
- )
4299
- ] }) });
4708
+ )
4709
+ ]
4710
+ }
4711
+ )
4712
+ ] })
4713
+ ] });
4300
4714
  }
4301
4715
  // Annotate the CommonJS export names for ESM import in node:
4302
4716
  0 && (module.exports = {