pay-sdk-web10 1.0.1

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.
@@ -0,0 +1,1395 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
3
+ typeof define === 'function' && define.amd ? define(['react'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.WalletPaymentForm = factory(global.React));
5
+ })(this, (function (React) { 'use strict';
6
+
7
+ const HasAccountSummary = ({
8
+ onClose
9
+ }) => {
10
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
11
+ className: "popup-content"
12
+ }, /*#__PURE__*/React.createElement("div", {
13
+ className: "popup-header"
14
+ }, /*#__PURE__*/React.createElement("div", {
15
+ className: "logo"
16
+ }, /*#__PURE__*/React.createElement("img", {
17
+ src: "https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg",
18
+ alt: "EvZone Logo",
19
+ className: "header-icon"
20
+ })), /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement("span", {
21
+ className: "evzone"
22
+ }, "EVzone"), /*#__PURE__*/React.createElement("span", {
23
+ className: "pay"
24
+ }, " Pay")), /*#__PURE__*/React.createElement("button", {
25
+ className: "close-btn",
26
+ onClick: onClose
27
+ }, /*#__PURE__*/React.createElement("span", null, "\xD7"))), /*#__PURE__*/React.createElement("div", {
28
+ className: "error-content"
29
+ }, /*#__PURE__*/React.createElement("div", {
30
+ className: "message-container"
31
+ }, /*#__PURE__*/React.createElement("div", {
32
+ className: "info-icon"
33
+ }, "i"), /*#__PURE__*/React.createElement("div", {
34
+ className: "message-text"
35
+ }, /*#__PURE__*/React.createElement("h3", null, "EVzone requires you to sign in to proceed with this transaction"))), /*#__PURE__*/React.createElement("button", {
36
+ onClick: onClose,
37
+ className: "submit-button"
38
+ }, "Sign in"))), /*#__PURE__*/React.createElement("style", null, `
39
+ .popup-content {
40
+ display: flex;
41
+ flex-direction: column;
42
+ align-items: center;
43
+ background: white;
44
+ border-radius: 10px;
45
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
46
+ max-width: 400px;
47
+ width: 90%;
48
+ text-align: center;
49
+ border: 1px solid #ddd;
50
+ font-family: Arial, sans-serif;
51
+ z-index: 1001;
52
+ position: relative;
53
+ pointer-events: auto;
54
+ }
55
+
56
+ .popup-header {
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: space-between;
60
+ margin-bottom: 15px;
61
+ width: 100%;
62
+ padding: 10px 15px;
63
+ border-bottom: 1px solid #ddd;
64
+ }
65
+
66
+ .logo {
67
+ width: 40px;
68
+ height: 40px;
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: center;
72
+ margin-right: 10px;
73
+ border-radius: 50%;
74
+ overflow: hidden;
75
+ }
76
+
77
+ .header-icon {
78
+ width: 100%;
79
+ height: auto;
80
+ }
81
+
82
+ .popup-header h2 {
83
+ font-size: 1.2em;
84
+ color: #080808;
85
+ margin: 0;
86
+ font-weight: bold;
87
+ text-align: left;
88
+ flex-grow: 1;
89
+ }
90
+
91
+ .popup-header .evzone {
92
+ color: #0a0a0a;
93
+ }
94
+
95
+ .popup-header .pay {
96
+ color: #0a0a0a;
97
+ }
98
+
99
+ .close-btn {
100
+ background: none;
101
+ border: none;
102
+ font-size: 1.5em;
103
+ color: #ff5a5f;
104
+ cursor: pointer;
105
+ }
106
+
107
+ .error-content {
108
+ display: flex;
109
+ flex-direction: column;
110
+ align-items: center;
111
+ padding: 20px;
112
+ background-color: #fff;
113
+ border-radius: 8px;
114
+ }
115
+
116
+ .message-container {
117
+ display: flex;
118
+ align-items: center;
119
+ width: 100%;
120
+ margin-bottom: 20px;
121
+ background-color: #e0f7fa;
122
+ border-radius: 10px;
123
+ padding: 10px 15px;
124
+ }
125
+
126
+ .info-icon {
127
+ display: flex;
128
+ justify-content: center;
129
+ align-items: center;
130
+ width: 40px;
131
+ height: 40px;
132
+ background-color: #b3e5fc;
133
+ color: #0288d1;
134
+ border-radius: 50%;
135
+ font-size: 24px;
136
+ font-weight: bold;
137
+ margin-right: 15px;
138
+ }
139
+
140
+ .message-text {
141
+ flex: 1;
142
+ }
143
+
144
+ .message-text h3 {
145
+ font-size: 1.2em;
146
+ margin: 0;
147
+ color: #333;
148
+ font-weight: 500;
149
+ }
150
+
151
+ .submit-button {
152
+ background-color: #0288d1;
153
+ color: #fff;
154
+ border: none;
155
+ border-radius: 5px;
156
+ padding: 10px 20px;
157
+ font-size: 1em;
158
+ font-weight: 500;
159
+ cursor: pointer;
160
+ transition: background-color 0.3s ease;
161
+ width: 100%;
162
+ max-width: 200px;
163
+ }
164
+
165
+ .submit-button:hover {
166
+ background-color: #0277bd;
167
+ }
168
+ `));
169
+ };
170
+
171
+ const TransactionSummary = ({
172
+ transactionDetails,
173
+ onConfirm
174
+ }) => {
175
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
176
+ className: "popup-content"
177
+ }, /*#__PURE__*/React.createElement("div", {
178
+ className: "popup-header"
179
+ }, /*#__PURE__*/React.createElement("div", {
180
+ className: "logo"
181
+ }, /*#__PURE__*/React.createElement("img", {
182
+ src: "https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg",
183
+ alt: "EvZone Logo",
184
+ className: "header-icon"
185
+ })), /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement("span", {
186
+ className: "evzone"
187
+ }, "EVzone"), /*#__PURE__*/React.createElement("span", {
188
+ className: "pay"
189
+ }, " Pay"))), /*#__PURE__*/React.createElement("div", {
190
+ className: "transaction-summary"
191
+ }, /*#__PURE__*/React.createElement("div", {
192
+ className: "merchant-info"
193
+ }, /*#__PURE__*/React.createElement("strong", null, "Airbnb")), /*#__PURE__*/React.createElement("div", {
194
+ className: "total-billing"
195
+ }, "UGX ", transactionDetails.totalBilling.toFixed(2)), /*#__PURE__*/React.createElement("div", {
196
+ className: "transaction-details"
197
+ }, /*#__PURE__*/React.createElement("h4", null, "Transaction Details"), /*#__PURE__*/React.createElement("div", {
198
+ className: "detail"
199
+ }, /*#__PURE__*/React.createElement("span", null, "Type"), /*#__PURE__*/React.createElement("strong", null, transactionDetails.type)), /*#__PURE__*/React.createElement("div", {
200
+ className: "detail"
201
+ }, /*#__PURE__*/React.createElement("span", null, "ID"), /*#__PURE__*/React.createElement("strong", null, transactionDetails.id)), /*#__PURE__*/React.createElement("div", {
202
+ className: "detail"
203
+ }, /*#__PURE__*/React.createElement("span", null, "Particulars"), /*#__PURE__*/React.createElement("strong", null, transactionDetails.particulars)), /*#__PURE__*/React.createElement("div", {
204
+ className: "detail"
205
+ }, /*#__PURE__*/React.createElement("span", null, "Billed Currency"), /*#__PURE__*/React.createElement("strong", null, transactionDetails.billedCurrency)), /*#__PURE__*/React.createElement("div", {
206
+ className: "detail"
207
+ }, /*#__PURE__*/React.createElement("span", null, "Billed Amount"), /*#__PURE__*/React.createElement("strong", null, "UGX ", transactionDetails.billedAmount.toFixed(2))), /*#__PURE__*/React.createElement("div", {
208
+ className: "detail total-billing-detail"
209
+ }, /*#__PURE__*/React.createElement("span", null, "Total Billing"), /*#__PURE__*/React.createElement("strong", null, "UGX ", transactionDetails.totalBilling.toFixed(2)))), /*#__PURE__*/React.createElement("button", {
210
+ onClick: onConfirm,
211
+ className: "confirm-button"
212
+ }, "Confirm"))), /*#__PURE__*/React.createElement("style", null, `
213
+ .popup-content {
214
+ display: flex;
215
+ flex-direction: column;
216
+ align-items: center;
217
+ background: white;
218
+ border-radius: 10px;
219
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
220
+ max-width: 400px;
221
+ width: 90%;
222
+ text-align: center;
223
+ border: 1px solid #ddd;
224
+ font-family: Arial, sans-serif;
225
+ z-index: 1001; /* Ensure popup is above overlay */
226
+ }
227
+
228
+ .popup-header {
229
+ display: flex;
230
+ align-items: center;
231
+ justify-content: center;
232
+ margin-bottom: 15px;
233
+ width: 100%;
234
+ padding: 10px 15px;
235
+ border-bottom: 1px solid #ddd;
236
+ }
237
+
238
+ .logo {
239
+ width: 40px;
240
+ height: 40px;
241
+ display: flex;
242
+ align-items: center;
243
+ justify-content: center;
244
+ margin-right: 10px;
245
+ border-radius: 50%;
246
+ overflow: hidden;
247
+ }
248
+
249
+ .header-icon {
250
+ width: 100%;
251
+ height: auto;
252
+ }
253
+
254
+ .popup-header h2 {
255
+ font-size: 1.2em;
256
+ color: #080808;
257
+ margin: 0;
258
+ font-weight: bold;
259
+ }
260
+
261
+ .popup-header .evzone {
262
+ color: #0a0a0a;
263
+ }
264
+
265
+ .popup-header .pay {
266
+ color: #0a0a0a;
267
+ }
268
+
269
+ .transaction-summary {
270
+ text-align: center;
271
+ width: 100%;
272
+ padding: 0 15px;
273
+ }
274
+
275
+ .merchant-info {
276
+ font-size: 1.2em;
277
+ font-weight: bold;
278
+ color: #333;
279
+ margin-bottom: 10px;
280
+ }
281
+
282
+ .total-billing {
283
+ font-size: 1.5em;
284
+ font-weight: bold;
285
+ color: #02CD8D;
286
+ text-align: center;
287
+ padding: 10px 0;
288
+ margin-bottom: 15px;
289
+ }
290
+
291
+ .transaction-details {
292
+ background: #f9f9f9;
293
+ padding: 15px;
294
+ border-radius: 8px;
295
+ margin-bottom: 20px;
296
+ display: flex;
297
+ flex-direction: column;
298
+ text-align: left;
299
+ }
300
+
301
+ .transaction-details h4 {
302
+ font-size: 1.1em;
303
+ font-weight: bold;
304
+ color: #333;
305
+ margin-bottom: 10px;
306
+ }
307
+
308
+ .transaction-details .detail {
309
+ display: flex;
310
+ justify-content: space-between;
311
+ align-items: center;
312
+ padding: 5px 0;
313
+ width: 100%;
314
+ }
315
+
316
+ .transaction-details span {
317
+ color: #666;
318
+ font-size: 0.9em;
319
+ flex-shrink: 0;
320
+ }
321
+
322
+ .transaction-details strong {
323
+ color: #000;
324
+ font-size: 0.9em;
325
+ text-align: right;
326
+ flex-shrink: 0;
327
+ }
328
+
329
+ .transaction-details .total-billing-detail {
330
+ margin-top: 10px;
331
+ padding-top: 10px;
332
+ border-top: 1px solid #ddd;
333
+ }
334
+
335
+ .confirm-button {
336
+ width: 100%;
337
+ background: #007bff;
338
+ color: #fff;
339
+ padding: 12px;
340
+ border-radius: 5px;
341
+ font-size: 1.1em;
342
+ cursor: pointer;
343
+ border: none;
344
+ transition: background-color 0.3s ease;
345
+ }
346
+
347
+ .confirm-button:hover {
348
+ background: #0056b3;
349
+ }
350
+ `));
351
+ };
352
+
353
+ var DefaultContext = {
354
+ color: undefined,
355
+ size: undefined,
356
+ className: undefined,
357
+ style: undefined,
358
+ attr: undefined
359
+ };
360
+ var IconContext = React.createContext && /*#__PURE__*/React.createContext(DefaultContext);
361
+
362
+ var _excluded = ["attr", "size", "title"];
363
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
364
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
365
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
366
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
367
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
368
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
369
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
370
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
371
+ function Tree2Element(tree) {
372
+ return tree && tree.map((node, i) => /*#__PURE__*/React.createElement(node.tag, _objectSpread({
373
+ key: i
374
+ }, node.attr), Tree2Element(node.child)));
375
+ }
376
+ function GenIcon(data) {
377
+ return props => /*#__PURE__*/React.createElement(IconBase, _extends({
378
+ attr: _objectSpread({}, data.attr)
379
+ }, props), Tree2Element(data.child));
380
+ }
381
+ function IconBase(props) {
382
+ var elem = conf => {
383
+ var {
384
+ attr,
385
+ size,
386
+ title
387
+ } = props,
388
+ svgProps = _objectWithoutProperties(props, _excluded);
389
+ var computedSize = size || conf.size || "1em";
390
+ var className;
391
+ if (conf.className) className = conf.className;
392
+ if (props.className) className = (className ? className + " " : "") + props.className;
393
+ return /*#__PURE__*/React.createElement("svg", _extends({
394
+ stroke: "currentColor",
395
+ fill: "currentColor",
396
+ strokeWidth: "0"
397
+ }, conf.attr, attr, svgProps, {
398
+ className: className,
399
+ style: _objectSpread(_objectSpread({
400
+ color: props.color || conf.color
401
+ }, conf.style), props.style),
402
+ height: computedSize,
403
+ width: computedSize,
404
+ xmlns: "http://www.w3.org/2000/svg"
405
+ }), title && /*#__PURE__*/React.createElement("title", null, title), props.children);
406
+ };
407
+ return IconContext !== undefined ? /*#__PURE__*/React.createElement(IconContext.Consumer, null, conf => elem(conf)) : elem(DefaultContext);
408
+ }
409
+
410
+ // THIS FILE IS AUTO GENERATED
411
+ function IoEyeOff (props) {
412
+ return GenIcon({"attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M432 448a15.92 15.92 0 0 1-11.31-4.69l-352-352a16 16 0 0 1 22.62-22.62l352 352A16 16 0 0 1 432 448zM248 315.85l-51.79-51.79a2 2 0 0 0-3.39 1.69 64.11 64.11 0 0 0 53.49 53.49 2 2 0 0 0 1.69-3.39zm16-119.7L315.87 248a2 2 0 0 0 3.4-1.69 64.13 64.13 0 0 0-53.55-53.55 2 2 0 0 0-1.72 3.39z"},"child":[]},{"tag":"path","attr":{"d":"M491 273.36a32.2 32.2 0 0 0-.1-34.76c-26.46-40.92-60.79-75.68-99.27-100.53C349 110.55 302 96 255.68 96a226.54 226.54 0 0 0-71.82 11.79 4 4 0 0 0-1.56 6.63l47.24 47.24a4 4 0 0 0 3.82 1.05 96 96 0 0 1 116 116 4 4 0 0 0 1.05 3.81l67.95 68a4 4 0 0 0 5.4.24 343.81 343.81 0 0 0 67.24-77.4zM256 352a96 96 0 0 1-93.3-118.63 4 4 0 0 0-1.05-3.81l-66.84-66.87a4 4 0 0 0-5.41-.23c-24.39 20.81-47 46.13-67.67 75.72a31.92 31.92 0 0 0-.64 35.54c26.41 41.33 60.39 76.14 98.28 100.65C162.06 402 207.92 416 255.68 416a238.22 238.22 0 0 0 72.64-11.55 4 4 0 0 0 1.61-6.64l-47.47-47.46a4 4 0 0 0-3.81-1.05A96 96 0 0 1 256 352z"},"child":[]}]})(props);
413
+ }function IoEye (props) {
414
+ return GenIcon({"attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"circle","attr":{"cx":"256","cy":"256","r":"64"},"child":[]},{"tag":"path","attr":{"d":"M490.84 238.6c-26.46-40.92-60.79-75.68-99.27-100.53C349 110.55 302 96 255.66 96c-42.52 0-84.33 12.15-124.27 36.11-40.73 24.43-77.63 60.12-109.68 106.07a31.92 31.92 0 0 0-.64 35.54c26.41 41.33 60.4 76.14 98.28 100.65C162 402 207.9 416 255.66 416c46.71 0 93.81-14.43 136.2-41.72 38.46-24.77 72.72-59.66 99.08-100.92a32.2 32.2 0 0 0-.1-34.76zM256 352a96 96 0 1 1 96-96 96.11 96.11 0 0 1-96 96z"},"child":[]}]})(props);
415
+ }
416
+
417
+ const EnterPasscode = ({
418
+ passcode,
419
+ setPasscode,
420
+ showPasscode,
421
+ setShowPasscode,
422
+ transactionDetails,
423
+ onSubmit,
424
+ onBack
425
+ }) => {
426
+ const renderHeader = () => /*#__PURE__*/React.createElement("div", {
427
+ className: "popup-header"
428
+ }, /*#__PURE__*/React.createElement("div", {
429
+ className: "logo"
430
+ }, /*#__PURE__*/React.createElement("img", {
431
+ src: "https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg",
432
+ alt: "EVzone Logo",
433
+ className: "header-icon"
434
+ })), /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement("span", {
435
+ className: "evzone"
436
+ }, "EVzone"), /*#__PURE__*/React.createElement("span", {
437
+ className: "pay"
438
+ }, " Pay")));
439
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
440
+ className: "passcode-popup"
441
+ }, renderHeader(), /*#__PURE__*/React.createElement("div", {
442
+ className: "merchant-header"
443
+ }, "Merchant Info :"), /*#__PURE__*/React.createElement("div", {
444
+ className: "merchant-details"
445
+ }, /*#__PURE__*/React.createElement("div", {
446
+ className: "merchant-left"
447
+ }, /*#__PURE__*/React.createElement("div", {
448
+ className: "merchant-info"
449
+ }, /*#__PURE__*/React.createElement("div", {
450
+ className: "merchant-name"
451
+ }, "Airbnb"), /*#__PURE__*/React.createElement("div", {
452
+ className: "merchant-id"
453
+ }, "W-123456789"))), /*#__PURE__*/React.createElement("div", {
454
+ className: "merchant-amount"
455
+ }, /*#__PURE__*/React.createElement("strong", null, "UGX ", transactionDetails.totalBilling.toFixed(2)))), /*#__PURE__*/React.createElement("div", {
456
+ className: "passcode-section"
457
+ }, /*#__PURE__*/React.createElement("label", {
458
+ htmlFor: "passcode"
459
+ }, "Enter Passcode"), /*#__PURE__*/React.createElement("div", {
460
+ className: "passcode-input"
461
+ }, /*#__PURE__*/React.createElement("input", {
462
+ type: showPasscode ? "text" : "password",
463
+ id: "passcode",
464
+ value: passcode,
465
+ onChange: e => setPasscode(e.target.value),
466
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022",
467
+ maxLength: "6"
468
+ }), /*#__PURE__*/React.createElement("span", {
469
+ className: "toggle-visibility",
470
+ onClick: () => setShowPasscode(!showPasscode)
471
+ }, showPasscode ? /*#__PURE__*/React.createElement(IoEye, null) : /*#__PURE__*/React.createElement(IoEyeOff, null)))), /*#__PURE__*/React.createElement("div", {
472
+ className: "transaction-details"
473
+ }, /*#__PURE__*/React.createElement("p", null, "You are making a payment to ", /*#__PURE__*/React.createElement("strong", null, "Acorn International School"), " and an amount of", /*#__PURE__*/React.createElement("strong", null, " UGX ", transactionDetails.totalBilling.toFixed(2)), " will be deducted off your wallet, including:", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "0.5% Tax:"), " UGX ", (transactionDetails.totalBilling * 0.005).toFixed(2), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "0.5% Wallet Fee:"), " UGX ", (transactionDetails.totalBilling * 0.005).toFixed(2))), /*#__PURE__*/React.createElement("div", {
474
+ className: "buttons-container"
475
+ }, /*#__PURE__*/React.createElement("button", {
476
+ onClick: onSubmit,
477
+ className: "confirm-button",
478
+ disabled: !passcode
479
+ }, "Confirm Payment"), /*#__PURE__*/React.createElement("button", {
480
+ onClick: onBack,
481
+ className: "back-button",
482
+ style: {
483
+ marginTop: '15px'
484
+ }
485
+ }, "Back"))), /*#__PURE__*/React.createElement("style", null, `
486
+ .passcode-popup {
487
+ display: flex;
488
+ flex-direction: column;
489
+ align-items: center;
490
+ background: white;
491
+ padding: 20px;
492
+ border-radius: 10px;
493
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
494
+ max-width: 400px;
495
+ width: 90%;
496
+ text-align: center;
497
+ border: 1px solid #ddd;
498
+ font-family: Arial, sans-serif;
499
+ z-index: 1001;
500
+ position: relative;
501
+ pointer-events: auto;
502
+ }
503
+
504
+ .popup-header {
505
+ display: flex;
506
+ align-items: center;
507
+ justify-content: center;
508
+ margin-bottom: 15px;
509
+ width: 100%;
510
+ padding: 10px 15px;
511
+ border-bottom: 1px solid #ddd;
512
+ }
513
+
514
+ .logo {
515
+ width: 40px;
516
+ height: 40px;
517
+ display: flex;
518
+ align-items: center;
519
+ justify-content: center;
520
+ margin-right: 10px;
521
+ border-radius: 50%;
522
+ overflow: hidden;
523
+ }
524
+
525
+ .header-icon {
526
+ width: 100%;
527
+ height: auto;
528
+ }
529
+
530
+ .popup-header h2 {
531
+ font-size: 1.2em;
532
+ color: #080808;
533
+ margin: 0;
534
+ font-weight: bold;
535
+ }
536
+
537
+ .popup-header .evzone {
538
+ color: #0a0a0a;
539
+ }
540
+
541
+ .popup-header .pay {
542
+ color: #0a0a0a;
543
+ }
544
+
545
+ .merchant-header {
546
+ font-size: 1.2em;
547
+ font-weight: bold;
548
+ color: #02CD8D;
549
+ text-align: left;
550
+ margin-bottom: 10px;
551
+ width: 100%;
552
+ }
553
+
554
+ .merchant-details {
555
+ display: flex;
556
+ justify-content: space-between;
557
+ align-items: center;
558
+ background: #f9f9f9;
559
+ padding: 12px;
560
+ border-radius: 8px;
561
+ margin-bottom: 15px;
562
+ width: 100%;
563
+ }
564
+
565
+ .merchant-left {
566
+ display: flex;
567
+ align-items: center;
568
+ }
569
+
570
+ .merchant-info {
571
+ display: flex;
572
+ flex-direction: column;
573
+ text-align: left;
574
+ }
575
+
576
+ .merchant-name {
577
+ font-size: 1em;
578
+ font-weight: bold;
579
+ }
580
+
581
+ .merchant-id {
582
+ font-size: 0.9em;
583
+ color: #666;
584
+ }
585
+
586
+ .merchant-amount {
587
+ text-align: right;
588
+ }
589
+
590
+ .merchant-amount strong {
591
+ font-size: 1.2em;
592
+ font-weight: bold;
593
+ color: #000;
594
+ }
595
+
596
+ .passcode-section {
597
+ text-align: left;
598
+ margin-bottom: 20px;
599
+ width: 100%;
600
+ }
601
+
602
+ .passcode-section label {
603
+ font-size: 1em;
604
+ font-weight: bold;
605
+ color: #000;
606
+ }
607
+
608
+ .passcode-input {
609
+ position: relative;
610
+ width: 100%;
611
+ border: 1px solid #ccc;
612
+ border-radius: 8px;
613
+ padding: 12px;
614
+ font-size: 1.1em;
615
+ text-align: center;
616
+ letter-spacing: 5px;
617
+ background: transparent;
618
+ display: flex;
619
+ align-items: center;
620
+ }
621
+
622
+ .passcode-input input {
623
+ flex: 1;
624
+ border: none;
625
+ outline: none;
626
+ text-align: center;
627
+ font-size: 1.4em;
628
+ letter-spacing: 5px;
629
+ background: transparent;
630
+ color: #000;
631
+ font-weight: bold;
632
+ }
633
+
634
+ .passcode-input .toggle-visibility {
635
+ position: absolute;
636
+ right: 12px;
637
+ top: 50%;
638
+ transform: translateY(-50%);
639
+ cursor: pointer;
640
+ font-size: 1.5em;
641
+ color: #000;
642
+ }
643
+
644
+ .transaction-details {
645
+ display: flex;
646
+ align-items: flex-start;
647
+ background: #e0f0ff;
648
+ padding: 12px;
649
+ border-radius: 8px;
650
+ text-align: left;
651
+ width: 100%;
652
+ margin-bottom: 20px;
653
+ }
654
+
655
+ .transaction-details p {
656
+ font-size: 1em;
657
+ color: #000;
658
+ line-height: 1.5;
659
+ margin: 0;
660
+ }
661
+
662
+ .buttons-container {
663
+ width: 100%;
664
+ }
665
+
666
+ .confirm-button {
667
+ width: 100%;
668
+ background: #007bff;
669
+ color: #fff;
670
+ padding: 12px;
671
+ border-radius: 5px;
672
+ font-size: 1.1em;
673
+ cursor: pointer;
674
+ border: none;
675
+ transition: background-color 0.3s ease;
676
+ }
677
+
678
+ .confirm-button:disabled {
679
+ background: #ddd;
680
+ cursor: not-allowed;
681
+ }
682
+
683
+ .confirm-button:hover:not(:disabled) {
684
+ background: #0056b3;
685
+ }
686
+
687
+ .back-button {
688
+ width: 100%;
689
+ background: white;
690
+ border: 2px solid red;
691
+ color: red;
692
+ padding: 10px 15px;
693
+ border-radius: 5px;
694
+ font-size: 1em;
695
+ cursor: pointer;
696
+ transition: all 0.3s ease;
697
+ }
698
+
699
+ .back-button:hover {
700
+ background: white;
701
+ color: red;
702
+ border-color: red;
703
+ }
704
+ `));
705
+ };
706
+
707
+ // THIS FILE IS AUTO GENERATED
708
+ function FaCheckCircle (props) {
709
+ return GenIcon({"attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"},"child":[]}]})(props);
710
+ }function FaExclamationCircle (props) {
711
+ return GenIcon({"attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},"child":[]}]})(props);
712
+ }function FaTimesCircle (props) {
713
+ return GenIcon({"attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"},"child":[]}]})(props);
714
+ }
715
+
716
+ const PaymentSuccess = ({
717
+ amount,
718
+ onClose
719
+ }) => {
720
+ const renderHeader = () => /*#__PURE__*/React.createElement("div", {
721
+ className: "popup-header"
722
+ }, /*#__PURE__*/React.createElement("div", {
723
+ className: "logo"
724
+ }, /*#__PURE__*/React.createElement("img", {
725
+ src: "https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg",
726
+ alt: "EVzone Logo",
727
+ className: "header-icon"
728
+ })), /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement("span", {
729
+ className: "evzone"
730
+ }, "EVzone"), /*#__PURE__*/React.createElement("span", {
731
+ className: "pay"
732
+ }, " Pay")));
733
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
734
+ className: "popup-content"
735
+ }, renderHeader(), /*#__PURE__*/React.createElement("div", {
736
+ className: "success-content"
737
+ }, /*#__PURE__*/React.createElement(FaCheckCircle, {
738
+ className: "icon"
739
+ }), /*#__PURE__*/React.createElement("h3", null, "Payment Successful"), /*#__PURE__*/React.createElement("p", null, "Your payment of UGX ", amount.toFixed(2), " was processed successfully!"), /*#__PURE__*/React.createElement("button", {
740
+ onClick: onClose,
741
+ className: "close-button"
742
+ }, "Close"))), /*#__PURE__*/React.createElement("style", null, `
743
+ .popup-content {
744
+ display: flex;
745
+ flex-direction: column;
746
+ align-items: center;
747
+ background: white;
748
+ border-radius: 10px;
749
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
750
+ max-width: 400px;
751
+ width: 90%;
752
+ text-align: center;
753
+ border: 1px solid #ddd;
754
+ font-family: Arial, sans-serif;
755
+ z-index: 1001;
756
+ position: relative;
757
+ pointer-events: auto;
758
+ }
759
+
760
+ .popup-header {
761
+ display: flex;
762
+ align-items: center;
763
+ justify-content: center;
764
+ margin-bottom: 15px;
765
+ width: 100%;
766
+ padding: 10px 15px;
767
+ border-bottom: 1px solid #ddd;
768
+ }
769
+
770
+ .logo {
771
+ width: 40px;
772
+ height: 40px;
773
+ display: flex;
774
+ align-items: center;
775
+ justify-content: center;
776
+ margin-right: 10px;
777
+ border-radius: 50%;
778
+ overflow: hidden;
779
+ }
780
+
781
+ .header-icon {
782
+ width: 100%;
783
+ height: auto;
784
+ }
785
+
786
+ .popup-header h2 {
787
+ font-size: 1.2em;
788
+ color: #080808;
789
+ margin: 0;
790
+ font-weight: bold;
791
+ }
792
+
793
+ .popup-header .evzone {
794
+ color: #0a0a0a;
795
+ }
796
+
797
+ .popup-header .pay {
798
+ color: #0a0a0a;
799
+ }
800
+
801
+ .success-content {
802
+ display: flex;
803
+ flex-direction: column;
804
+ align-items: center;
805
+ padding: 20px;
806
+ background-color: #fff;
807
+ border-radius: 8px;
808
+ }
809
+
810
+ .success-content .icon {
811
+ color: #02CD8D;
812
+ font-size: 40px;
813
+ margin-bottom: 10px;
814
+ }
815
+
816
+ .success-content h3 {
817
+ font-size: 1.2em;
818
+ margin: 0 0 15px;
819
+ color: #333;
820
+ font-weight: 500;
821
+ }
822
+
823
+ .success-content p {
824
+ font-size: 1em;
825
+ color: #666;
826
+ margin-bottom: 15px;
827
+ }
828
+
829
+ .close-button {
830
+ background-color: #0288d1;
831
+ color: #fff;
832
+ border: none;
833
+ border-radius: 5px;
834
+ padding: 10px 20px;
835
+ font-size: 1em;
836
+ font-weight: 500;
837
+ cursor: pointer;
838
+ transition: background-color 0.3s ease;
839
+ width: 100%;
840
+ max-width: 200px;
841
+ }
842
+
843
+ .close-button:hover {
844
+ background-color: #0277bd;
845
+ }
846
+ `));
847
+ };
848
+
849
+ const PaymentFailed = ({
850
+ onClose
851
+ }) => {
852
+ const renderHeader = () => /*#__PURE__*/React.createElement("div", {
853
+ className: "popup-header"
854
+ }, /*#__PURE__*/React.createElement("div", {
855
+ className: "logo"
856
+ }, /*#__PURE__*/React.createElement("img", {
857
+ src: "https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg",
858
+ alt: "EVzone Logo",
859
+ className: "header-icon"
860
+ })), /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement("span", {
861
+ className: "evzone"
862
+ }, "EVzone"), /*#__PURE__*/React.createElement("span", {
863
+ className: "pay"
864
+ }, " Pay")));
865
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
866
+ className: "popup-content"
867
+ }, renderHeader(), /*#__PURE__*/React.createElement("div", {
868
+ className: "error-content"
869
+ }, /*#__PURE__*/React.createElement(FaTimesCircle, {
870
+ className: "icon"
871
+ }), /*#__PURE__*/React.createElement("h3", null, "Payment Failed"), /*#__PURE__*/React.createElement("p", null, "Please check your wallet for details."), /*#__PURE__*/React.createElement("button", {
872
+ onClick: onClose,
873
+ className: "close-button"
874
+ }, "Details"))), /*#__PURE__*/React.createElement("style", null, `
875
+ .popup-content {
876
+ display: flex;
877
+ flex-direction: column;
878
+ align-items: center;
879
+ background: white;
880
+ border-radius: 10px;
881
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
882
+ max-width: 400px;
883
+ width: 90%;
884
+ text-align: center;
885
+ border: 1px solid #ddd;
886
+ font-family: Arial, sans-serif;
887
+ z-index: 1001;
888
+ position: relative;
889
+ pointer-events: auto;
890
+ }
891
+
892
+ .popup-header {
893
+ display: flex;
894
+ align-items: center;
895
+ justify-content: center;
896
+ margin-bottom: 15px;
897
+ width: 100%;
898
+ padding: 10px 15px;
899
+ border-bottom: 1px solid #ddd;
900
+ }
901
+
902
+ .logo {
903
+ width: 40px;
904
+ height: 40px;
905
+ display: flex;
906
+ align-items: center;
907
+ justify-content: center;
908
+ margin-right: 10px;
909
+ border-radius: 50%;
910
+ overflow: hidden;
911
+ }
912
+
913
+ .header-icon {
914
+ width: 100%;
915
+ height: auto;
916
+ }
917
+
918
+ .popup-header h2 {
919
+ font-size: 1.2em;
920
+ color: #080808;
921
+ margin: 0;
922
+ font-weight: bold;
923
+ }
924
+
925
+ .popup-header .evzone {
926
+ color: #0a0a0a;
927
+ }
928
+
929
+ .popup-header .pay {
930
+ color: #0a0a0a;
931
+ }
932
+
933
+ .error-content {
934
+ display: flex;
935
+ flex-direction: column;
936
+ align-items: center;
937
+ padding: 20px;
938
+ background-color: #fff;
939
+ border-radius: 8px;
940
+ }
941
+
942
+ .error-content .icon {
943
+ color: #ff5a5f;
944
+ font-size: 40px;
945
+ margin-bottom: 10px;
946
+ }
947
+
948
+ .error-content h3 {
949
+ font-size: 1.2em;
950
+ margin: 0 0 15px;
951
+ color: #333;
952
+ font-weight: 500;
953
+ }
954
+
955
+ .error-content p {
956
+ font-size: 1em;
957
+ color: #666;
958
+ margin-bottom: 15px;
959
+ }
960
+
961
+ .close-button {
962
+ background-color: #0288d1;
963
+ color: #fff;
964
+ border: none;
965
+ border-radius: 5px;
966
+ padding: 10px 20px;
967
+ font-size: 1em;
968
+ font-weight: 500;
969
+ cursor: pointer;
970
+ transition: background-color 0.3s ease;
971
+ width: 100%;
972
+ max-width: 200px;
973
+ }
974
+
975
+ .close-button:hover {
976
+ background-color: #0277bd;
977
+ }
978
+ `));
979
+ };
980
+
981
+ const InsufficientFunds = ({
982
+ onClose
983
+ }) => {
984
+ const renderHeader = () => /*#__PURE__*/React.createElement("div", {
985
+ className: "popup-header"
986
+ }, /*#__PURE__*/React.createElement("div", {
987
+ className: "logo"
988
+ }, /*#__PURE__*/React.createElement("img", {
989
+ src: "https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg",
990
+ alt: "EVzone Logo",
991
+ className: "header-icon"
992
+ })), /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement("span", {
993
+ className: "evzone"
994
+ }, "EVzone"), /*#__PURE__*/React.createElement("span", {
995
+ className: "pay"
996
+ }, " Pay")));
997
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
998
+ className: "popup-content"
999
+ }, renderHeader(), /*#__PURE__*/React.createElement("div", {
1000
+ className: "error-content"
1001
+ }, /*#__PURE__*/React.createElement(FaExclamationCircle, {
1002
+ className: "icon"
1003
+ }), /*#__PURE__*/React.createElement("h3", null, "Insufficient Funds"), /*#__PURE__*/React.createElement("p", null, "Please add funds to your wallet to proceed."), /*#__PURE__*/React.createElement("button", {
1004
+ onClick: onClose,
1005
+ className: "close-button"
1006
+ }, "Close"))), /*#__PURE__*/React.createElement("style", null, `
1007
+ .popup-content {
1008
+ display: flex;
1009
+ flex-direction: column;
1010
+ align-items: center;
1011
+ background: white;
1012
+ border-radius: 10px;
1013
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
1014
+ max-width: 400px;
1015
+ width: 90%;
1016
+ text-align: center;
1017
+ border: 1px solid #ddd;
1018
+ font-family: Arial, sans-serif;
1019
+ z-index: 1001;
1020
+ position: relative;
1021
+ pointer-events: auto;
1022
+ }
1023
+
1024
+ .popup-header {
1025
+ display: flex;
1026
+ align-items: center;
1027
+ justify-content: center;
1028
+ margin-bottom: 15px;
1029
+ width: 100%;
1030
+ padding: 10px 15px;
1031
+ border-bottom: 1px solid #ddd;
1032
+ }
1033
+
1034
+ .logo {
1035
+ width: 40px;
1036
+ height: 40px;
1037
+ display: flex;
1038
+ align-items: center;
1039
+ justify-content: center;
1040
+ margin-right: 10px;
1041
+ border-radius: 50%;
1042
+ overflow: hidden;
1043
+ }
1044
+
1045
+ .header-icon {
1046
+ width: 100%;
1047
+ height: auto;
1048
+ }
1049
+
1050
+ .popup-header h2 {
1051
+ font-size: 1.2em;
1052
+ color: #080808;
1053
+ margin: 0;
1054
+ font-weight: bold;
1055
+ }
1056
+
1057
+ .popup-header .evzone {
1058
+ color: #0a0a0a;
1059
+ }
1060
+
1061
+ .popup-header .pay {
1062
+ color: #0a0a0a;
1063
+ }
1064
+
1065
+ .error-content {
1066
+ display: flex;
1067
+ flex-direction: column;
1068
+ align-items: center;
1069
+ padding: 20px;
1070
+ background-color: #fff;
1071
+ border-radius: 8px;
1072
+ }
1073
+
1074
+ .error-content .icon {
1075
+ color: #ff9800;
1076
+ font-size: 40px;
1077
+ margin-bottom: 10px;
1078
+ }
1079
+
1080
+ .error-content h3 {
1081
+ font-size: 1.2em;
1082
+ margin: 0 0 15px;
1083
+ color: #333;
1084
+ font-weight: 500;
1085
+ }
1086
+
1087
+ .error-content p {
1088
+ font-size: 1em;
1089
+ color: #666;
1090
+ margin-bottom: 15px;
1091
+ }
1092
+
1093
+ .close-button {
1094
+ background-color: #0288d1;
1095
+ color: #fff;
1096
+ border: none;
1097
+ border-radius: 5px;
1098
+ padding: 10px 20px;
1099
+ font-size: 1em;
1100
+ font-weight: 500;
1101
+ cursor: pointer;
1102
+ transition: background-color 0.3s ease;
1103
+ width: 100%;
1104
+ max-width: 200px;
1105
+ }
1106
+
1107
+ .close-button:hover {
1108
+ background-color: #0277bd;
1109
+ }
1110
+ `));
1111
+ };
1112
+
1113
+ const LoadingOverlay = () => {
1114
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1115
+ className: "loading-overlay"
1116
+ }, /*#__PURE__*/React.createElement("div", {
1117
+ className: "loading-content"
1118
+ }, /*#__PURE__*/React.createElement("img", {
1119
+ src: "https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg",
1120
+ alt: "EvZone Logo",
1121
+ className: "loading-logo"
1122
+ }), /*#__PURE__*/React.createElement("p", {
1123
+ className: "loading-text"
1124
+ }, /*#__PURE__*/React.createElement("span", {
1125
+ className: "evzone"
1126
+ }, "EVzone"), ' ', /*#__PURE__*/React.createElement("span", {
1127
+ className: "pay"
1128
+ }, "Pay")))), /*#__PURE__*/React.createElement("style", null, `
1129
+ .loading-overlay {
1130
+ position: fixed;
1131
+ top: 0;
1132
+ left: 0;
1133
+ width: 100%;
1134
+ height: 100%;
1135
+ background: rgba(0, 0, 0, 0.5);
1136
+ display: flex;
1137
+ justify-content: center;
1138
+ align-items: center;
1139
+ z-index: 1001;
1140
+ pointer-events: auto;
1141
+ }
1142
+
1143
+ .loading-content {
1144
+ text-align: center;
1145
+ display: flex;
1146
+ flex-direction: column;
1147
+ justify-content: center;
1148
+ align-items: center;
1149
+ background: white;
1150
+ padding: 30px; /* Increased from 20px to 30px for more space */
1151
+ border-radius: 10px;
1152
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
1153
+ }
1154
+
1155
+ .loading-logo {
1156
+ width: 120px;
1157
+ height: 120px;
1158
+ margin-bottom: 30px; /* Increased from 20px to 30px for more space */
1159
+ border-radius: 50%;
1160
+ overflow: hidden;
1161
+ }
1162
+
1163
+ .loading-text {
1164
+ font-size: 40px; /* Increased from 36px to 40px */
1165
+ font-weight: bold;
1166
+ margin: 0;
1167
+ animation: blink 1.5s step-start infinite;
1168
+ }
1169
+
1170
+ .loading-text .evzone {
1171
+ color: rgb(76, 184, 123);
1172
+ }
1173
+
1174
+ .loading-text .pay {
1175
+ color: rgb(235, 182, 67);
1176
+ }
1177
+
1178
+ @keyframes blink {
1179
+ 0% {
1180
+ opacity: 1;
1181
+ }
1182
+ 50% {
1183
+ opacity: 0;
1184
+ }
1185
+ 100% {
1186
+ opacity: 1;
1187
+ }
1188
+ }
1189
+ `));
1190
+ };
1191
+
1192
+ const SAMPLE_CUSTOMERS = {
1193
+ "customer123": {
1194
+ name: "John Doe",
1195
+ balance: 1000,
1196
+ passcode: "123456"
1197
+ },
1198
+ "customer456": {
1199
+ name: "Jane Smith",
1200
+ balance: 500,
1201
+ passcode: "567856"
1202
+ },
1203
+ "customer789": {
1204
+ name: "Alice Brown",
1205
+ balance: 50,
1206
+ passcode: "901256"
1207
+ }
1208
+ };
1209
+ const generateTransactionDetails = (amount, transactionId) => ({
1210
+ type: "Booking",
1211
+ id: transactionId,
1212
+ particulars: "Hotel Booking",
1213
+ billedCurrency: "UGX",
1214
+ billedAmount: amount,
1215
+ totalBilling: amount
1216
+ });
1217
+ const checkAccountExists = customerId => Promise.resolve(!!SAMPLE_CUSTOMERS[customerId]);
1218
+ const validatePasscode = (customerId, passcode, amount) => {
1219
+ const customer = SAMPLE_CUSTOMERS[customerId];
1220
+ if (!customer) return {
1221
+ success: false,
1222
+ reason: 'no_account'
1223
+ };
1224
+ if (customer.passcode !== passcode) return {
1225
+ success: false,
1226
+ reason: 'invalid_passcode'
1227
+ };
1228
+ if (customer.balance < amount) return {
1229
+ success: false,
1230
+ reason: 'insufficient_funds'
1231
+ };
1232
+ SAMPLE_CUSTOMERS[customerId].balance -= amount;
1233
+ return {
1234
+ success: true
1235
+ };
1236
+ };
1237
+ const WalletPaymentForm = ({
1238
+ customerId,
1239
+ amount,
1240
+ onClose,
1241
+ onSuccess
1242
+ }) => {
1243
+ const [popup, setPopup] = React.useState('transactionSummary');
1244
+ const [passcode, setPasscode] = React.useState('');
1245
+ const [hasAccount, setHasAccount] = React.useState(null);
1246
+ const [paymentStatus, setPaymentStatus] = React.useState('idle');
1247
+ const [showPasscode, setShowPasscode] = React.useState(false);
1248
+ const [transactionId] = React.useState(`W-${Math.floor(Math.random() * 1000000000)}`);
1249
+ const [loading, setLoading] = React.useState(true);
1250
+ React.useEffect(() => {
1251
+ console.log('useEffect running, customerId:', customerId, 'amount:', amount);
1252
+ const timer = setTimeout(() => {
1253
+ console.log('Loading finished');
1254
+ setLoading(false);
1255
+ }, 5000);
1256
+ const checkConditions = async () => {
1257
+ if (!customerId) {
1258
+ console.log('No customerId provided, setting hasAccount to false');
1259
+ setHasAccount(false);
1260
+ return;
1261
+ }
1262
+ if (!SAMPLE_CUSTOMERS[customerId]) {
1263
+ console.log(`Invalid customerId: ${customerId}, setting hasAccount to false`);
1264
+ setHasAccount(false);
1265
+ return;
1266
+ }
1267
+ const accountExists = await checkAccountExists(customerId);
1268
+ console.log('Account exists:', accountExists);
1269
+ setHasAccount(accountExists);
1270
+ };
1271
+ checkConditions();
1272
+ return () => clearTimeout(timer);
1273
+ }, [customerId, amount]);
1274
+ const handleConfirm = () => {
1275
+ console.log('Confirm clicked, hasAccount:', hasAccount);
1276
+ if (hasAccount === null) {
1277
+ console.log('hasAccount is null, cannot proceed');
1278
+ return;
1279
+ }
1280
+ if (hasAccount) {
1281
+ setPopup('enterPasscode');
1282
+ } else {
1283
+ console.log('No account, showing HasAccountSummary');
1284
+ setPopup('transactionSummary');
1285
+ }
1286
+ };
1287
+ const handleSubmit = async e => {
1288
+ e.preventDefault();
1289
+ console.log('Submitting passcode:', passcode);
1290
+ setPaymentStatus('pending');
1291
+ const result = await validatePasscode(customerId, passcode, amount);
1292
+ console.log('Validation result:', result);
1293
+ setPaymentStatus(result.success ? 'success' : 'failed');
1294
+ if (result.success) {
1295
+ setPopup('paymentSuccess');
1296
+ if (onSuccess) onSuccess();
1297
+ } else {
1298
+ if (result.reason === 'insufficient_funds') {
1299
+ setPopup('insufficientFunds');
1300
+ } else {
1301
+ setPopup('paymentFailed');
1302
+ }
1303
+ setTimeout(() => {
1304
+ setPopup('transactionSummary');
1305
+ setPasscode('');
1306
+ setPaymentStatus('idle');
1307
+ onClose();
1308
+ }, 5000);
1309
+ }
1310
+ };
1311
+ const handleSuccessClose = () => {
1312
+ console.log('Success close clicked');
1313
+ setPopup('transactionSummary');
1314
+ setPasscode('');
1315
+ setPaymentStatus('idle');
1316
+ onClose();
1317
+ };
1318
+ const transactionDetails = generateTransactionDetails(amount, transactionId);
1319
+ const renderPopup = () => {
1320
+ console.log('Rendering popup, current popup:', popup, 'hasAccount:', hasAccount);
1321
+ switch (popup) {
1322
+ case 'transactionSummary':
1323
+ if (!hasAccount) {
1324
+ return /*#__PURE__*/React.createElement(HasAccountSummary, {
1325
+ onClose: onClose
1326
+ });
1327
+ }
1328
+ return /*#__PURE__*/React.createElement(TransactionSummary, {
1329
+ transactionDetails: transactionDetails,
1330
+ onConfirm: handleConfirm
1331
+ });
1332
+ case 'enterPasscode':
1333
+ return /*#__PURE__*/React.createElement(EnterPasscode, {
1334
+ passcode: passcode,
1335
+ setPasscode: setPasscode,
1336
+ showPasscode: showPasscode,
1337
+ setShowPasscode: setShowPasscode,
1338
+ transactionDetails: transactionDetails,
1339
+ onSubmit: handleSubmit,
1340
+ onBack: () => setPopup('transactionSummary')
1341
+ });
1342
+ case 'paymentSuccess':
1343
+ return /*#__PURE__*/React.createElement(PaymentSuccess, {
1344
+ amount: amount,
1345
+ onClose: handleSuccessClose
1346
+ });
1347
+ case 'paymentFailed':
1348
+ return /*#__PURE__*/React.createElement(PaymentFailed, {
1349
+ onClose: onClose
1350
+ });
1351
+ case 'insufficientFunds':
1352
+ return /*#__PURE__*/React.createElement(InsufficientFunds, {
1353
+ onClose: onClose
1354
+ });
1355
+ default:
1356
+ return null;
1357
+ }
1358
+ };
1359
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1360
+ className: "wallet-payment-form"
1361
+ }, loading ? /*#__PURE__*/React.createElement(LoadingOverlay, null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1362
+ className: "overlay",
1363
+ onClick: () => {
1364
+ console.log('Overlay clicked, closing');
1365
+ onClose();
1366
+ }
1367
+ }), renderPopup())), /*#__PURE__*/React.createElement("style", null, `
1368
+ .wallet-payment-form {
1369
+ position: fixed;
1370
+ top: 0;
1371
+ left: 0;
1372
+ width: 100%;
1373
+ height: 100%;
1374
+ display: flex;
1375
+ justify-content: center;
1376
+ align-items: center;
1377
+ z-index: 1000;
1378
+ }
1379
+
1380
+ .overlay {
1381
+ position: absolute;
1382
+ top: 0;
1383
+ left: 0;
1384
+ width: 100%;
1385
+ height: 100%;
1386
+ background: rgba(0, 0, 0, 0.5);
1387
+ z-index: 999;
1388
+ pointer-events: auto;
1389
+ }
1390
+ `));
1391
+ };
1392
+
1393
+ return WalletPaymentForm;
1394
+
1395
+ }));