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