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