@test-glide/glide-payment 0.0.2 → 0.0.3

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.es.js CHANGED
@@ -1,21 +1,21 @@
1
- function p(n, e = {}) {
2
- const t = document.createElement(n), { className: l, id: r, innerHTML: h, textContent: o, attributes: c, styles: d, dataset: a, children: i, events: m } = e;
1
+ function u(n, e = {}) {
2
+ const t = document.createElement(n), { className: l, id: a, innerHTML: h, textContent: i, attributes: c, styles: p, dataset: s, children: r, events: m } = e;
3
3
  if (l) {
4
- const u = Array.isArray(l) ? l : l.split(" ");
5
- t.classList.add(...u.filter(Boolean));
4
+ const d = Array.isArray(l) ? l : l.split(" ");
5
+ t.classList.add(...d.filter(Boolean));
6
6
  }
7
- if (r && (t.id = r), h && (t.innerHTML = h), o && (t.textContent = o), c)
8
- for (const [u, s] of Object.entries(c))
9
- s && t.setAttribute(u, s);
10
- if (d)
11
- for (const [u, s] of Object.entries(d))
12
- t.style[u] = s;
13
- if (a)
14
- for (const [u, s] of Object.entries(a))
15
- t.dataset[u] = s;
16
- if (i && t.append(...i.filter(Boolean)), m)
17
- for (const [u, s] of Object.entries(m))
18
- t.addEventListener(u, s);
7
+ if (a && (t.id = a), h && (t.innerHTML = h), i && (t.textContent = i), c)
8
+ for (const [d, o] of Object.entries(c))
9
+ o && t.setAttribute(d, o);
10
+ if (p)
11
+ for (const [d, o] of Object.entries(p))
12
+ t.style[d] = o;
13
+ if (s)
14
+ for (const [d, o] of Object.entries(s))
15
+ t.dataset[d] = o;
16
+ if (r && t.append(...r.filter(Boolean)), m)
17
+ for (const [d, o] of Object.entries(m))
18
+ t.addEventListener(d, o);
19
19
  return t;
20
20
  }
21
21
  function x(n, e) {
@@ -25,25 +25,25 @@ function x(n, e) {
25
25
  return;
26
26
  }
27
27
  for (const l of t) {
28
- const { styles: r, attributes: h, dataset: o, innerHTML: c, textContent: d, className: a } = e;
29
- if (r)
30
- for (const [i, m] of Object.entries(r))
31
- l.style[i] = m;
28
+ const { styles: a, attributes: h, dataset: i, innerHTML: c, textContent: p, className: s } = e;
29
+ if (a)
30
+ for (const [r, m] of Object.entries(a))
31
+ l.style[r] = m;
32
32
  if (h)
33
- for (const [i, m] of Object.entries(h))
34
- l.setAttribute(i, m);
35
- if (o)
36
- for (const [i, m] of Object.entries(o))
37
- l.dataset[i] = m;
38
- if (c !== void 0 && (l.innerHTML = c), d !== void 0 && (l.textContent = d), a?.add) {
39
- const i = Array.isArray(a.add) ? a.add : [a.add];
40
- l.classList.add(...i);
33
+ for (const [r, m] of Object.entries(h))
34
+ l.setAttribute(r, m);
35
+ if (i)
36
+ for (const [r, m] of Object.entries(i))
37
+ l.dataset[r] = m;
38
+ if (c !== void 0 && (l.innerHTML = c), p !== void 0 && (l.textContent = p), s?.add) {
39
+ const r = Array.isArray(s.add) ? s.add : [s.add];
40
+ l.classList.add(...r);
41
41
  }
42
- if (a?.remove) {
43
- const i = Array.isArray(a.remove) ? a.remove : [a.remove];
44
- l.classList.remove(...i);
42
+ if (s?.remove) {
43
+ const r = Array.isArray(s.remove) ? s.remove : [s.remove];
44
+ l.classList.remove(...r);
45
45
  }
46
- a?.toggle && (Array.isArray(a.toggle) ? a.toggle : [a.toggle]).forEach((m) => l.classList.toggle(m));
46
+ s?.toggle && (Array.isArray(s.toggle) ? s.toggle : [s.toggle]).forEach((m) => l.classList.toggle(m));
47
47
  }
48
48
  }
49
49
  const Q = `
@@ -93,21 +93,21 @@ const Q = `
93
93
  ></path>
94
94
  </svg>`, k = `
95
95
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path></svg>
96
- `, te = ({ children: n, onClick: e, disabled: t = !1, size: l = "medium", type: r = "button", className: h = "", variant: o = "primary" }) => {
97
- const c = p("span", {
96
+ `, te = ({ children: n, onClick: e, disabled: t = !1, size: l = "medium", type: a = "button", className: h = "", variant: i = "primary" }) => {
97
+ const c = u("span", {
98
98
  className: "button-spinner",
99
99
  innerHTML: X,
100
100
  dataset: { show: "false" }
101
- }), d = p("span", {
101
+ }), p = u("span", {
102
102
  className: "button-label",
103
103
  children: [
104
104
  null
105
105
  ],
106
106
  textContent: n
107
- }), a = p("button", {
108
- className: `custom-button ${o} ${l} ${h}`,
107
+ }), s = u("button", {
108
+ className: `custom-button ${i} ${l} ${h}`,
109
109
  attributes: {
110
- type: r,
110
+ type: a,
111
111
  ...t ? { disabled: "true" } : {}
112
112
  },
113
113
  events: {
@@ -115,23 +115,23 @@ const Q = `
115
115
  },
116
116
  children: [
117
117
  c,
118
- d
118
+ p
119
119
  ]
120
- }), i = (u = !1) => {
120
+ }), r = (d = !1) => {
121
121
  x({ element: c }, {
122
- dataset: { show: String(u) }
123
- }), m(u);
124
- }, m = (u = !1) => {
125
- u ? a.setAttribute("disabled", "true") : a.removeAttribute("disabled");
122
+ dataset: { show: String(d) }
123
+ }), m(d);
124
+ }, m = (d = !1) => {
125
+ d ? s.setAttribute("disabled", "true") : s.removeAttribute("disabled");
126
126
  };
127
127
  return {
128
- element: a,
129
- setLoading: i,
128
+ element: s,
129
+ setLoading: r,
130
130
  setDisabled: m
131
131
  };
132
- }, ne = ({ content: n, position: e = "top", delay: t = 200, maxWidth: l = 250, className: r = "", id: h = "" }) => {
133
- var o = p("div", {
134
- className: `tooltip ${e} ${r}`,
132
+ }, ne = ({ content: n, position: e = "top", delay: t = 200, maxWidth: l = 250, className: a = "", id: h = "" }) => {
133
+ var i = u("div", {
134
+ className: `tooltip ${e} ${a}`,
135
135
  styles: {
136
136
  // top: `${tooltipPosition.top}px`,
137
137
  // left: `${tooltipPosition.left}px`,
@@ -147,71 +147,71 @@ const Q = `
147
147
  `
148
148
  });
149
149
  let c = null;
150
- var i = p("span", {
150
+ var r = u("span", {
151
151
  className: "tooltip-trigger",
152
152
  innerHTML: k,
153
153
  events: {
154
154
  mouseenter: () => {
155
155
  t > 0 ? c = window.setTimeout(() => {
156
- o.dataset.show = "true", m();
157
- }, t) : (o.dataset.show = "true", m());
156
+ i.dataset.show = "true", m();
157
+ }, t) : (i.dataset.show = "true", m());
158
158
  },
159
159
  mouseleave: () => {
160
- c && clearTimeout(c), o.dataset.show = "false";
160
+ c && clearTimeout(c), i.dataset.show = "false";
161
161
  }
162
162
  }
163
163
  });
164
164
  function m() {
165
- if (!i || !o) return;
166
- const s = i.getBoundingClientRect(), v = o.getBoundingClientRect(), y = 8;
165
+ if (!r || !i) return;
166
+ const o = r.getBoundingClientRect(), v = i.getBoundingClientRect(), y = 8;
167
167
  let w, g;
168
168
  switch (e) {
169
169
  case "top":
170
- w = s.top - v.height - y, g = s.left + s.width / 2 - v.width / 2;
170
+ w = o.top - v.height - y, g = o.left + o.width / 2 - v.width / 2;
171
171
  break;
172
172
  case "bottom":
173
- w = s.bottom + y, g = s.left + s.width / 2 - v.width / 2;
173
+ w = o.bottom + y, g = o.left + o.width / 2 - v.width / 2;
174
174
  break;
175
175
  case "left":
176
- w = s.top + s.height / 2 - v.height / 2, g = s.left - v.width - y;
176
+ w = o.top + o.height / 2 - v.height / 2, g = o.left - v.width - y;
177
177
  break;
178
178
  case "right":
179
- w = s.top + s.height / 2 - v.height / 2, g = s.right + y;
179
+ w = o.top + o.height / 2 - v.height / 2, g = o.right + y;
180
180
  break;
181
181
  default:
182
- w = s.top - v.height - y, g = s.left + s.width / 2 - v.width / 2;
182
+ w = o.top - v.height - y, g = o.left + o.width / 2 - v.width / 2;
183
183
  }
184
184
  const N = window.innerWidth, M = window.innerHeight;
185
- g < 0 && (g = y), g + v.width > N && (g = N - v.width - y), w < 0 && (w = y), w + v.height > M && (w = M - v.height - y), o.style.top = `${w}px`, o.style.left = `${g}px`;
185
+ g < 0 && (g = y), g + v.width > N && (g = N - v.width - y), w < 0 && (w = y), w + v.height > M && (w = M - v.height - y), i.style.top = `${w}px`, i.style.left = `${g}px`;
186
186
  }
187
- return p("div", {
187
+ return u("div", {
188
188
  className: "tooltip-wrapper",
189
189
  id: `tooltip-${h}`,
190
190
  children: [
191
- i,
192
- o
191
+ r,
192
+ i
193
193
  ]
194
194
  });
195
195
  }, se = (n) => {
196
196
  const e = {}, t = Object.values(n).every(
197
- (r) => !r || r.trim() === ""
197
+ (a) => !a || a.trim() === ""
198
198
  ), l = n.cardNumber?.replace(/\s/g, "");
199
199
  if (l ? /^\d{13,19}$/.test(l) || (e.cardNumber = "Card number must be 13-19 digits") : e.cardNumber = "Card number is required", !n.expiryDate)
200
200
  e.expiryDate = "Expiry date is required";
201
201
  else {
202
- const r = n.expiryDate.replace(/\D/g, "");
203
- if (r.length < 4)
202
+ const a = n.expiryDate.replace(/\D/g, "");
203
+ if (a.length < 4)
204
204
  e.expiryDate = "Enter complete expiry date (MM/YY)";
205
205
  else {
206
- const h = parseInt(r.substring(0, 2), 10), o = parseInt(r.substring(2, 4), 10);
206
+ const h = parseInt(a.substring(0, 2), 10), i = parseInt(a.substring(2, 4), 10);
207
207
  if (isNaN(h) || h < 1 || h > 12)
208
208
  e.expiryDate = "Invalid month (must be 01-12)";
209
- else if (isNaN(o) || o < 0 || o > 99)
209
+ else if (isNaN(i) || i < 0 || i > 99)
210
210
  e.expiryDate = "Invalid year";
211
211
  else {
212
- const c = /* @__PURE__ */ new Date(), d = c.getFullYear(), a = c.getMonth() + 1, i = Math.floor(d / 100) * 100, m = i + o, u = i + 100 + o;
213
- let s;
214
- m >= d && m <= d + 20 ? s = m : (u >= d && u <= d + 20, s = u), s < d || s === d && h < a ? e.expiryDate = "Card has expired" : s > d + 20 && (e.expiryDate = "Expiry year is too far in the future");
212
+ const c = /* @__PURE__ */ new Date(), p = c.getFullYear(), s = c.getMonth() + 1, r = Math.floor(p / 100) * 100, m = r + i, d = r + 100 + i;
213
+ let o;
214
+ m >= p && m <= p + 20 ? o = m : (d >= p && d <= p + 20, o = d), o < p || o === p && h < s ? e.expiryDate = "Card has expired" : o > p + 20 && (e.expiryDate = "Expiry year is too far in the future");
215
215
  }
216
216
  }
217
217
  }
@@ -225,8 +225,8 @@ function re(n) {
225
225
  const e = parseInt(n, 10);
226
226
  if (isNaN(e) || e < 0 || e > 99) return null;
227
227
  const t = (/* @__PURE__ */ new Date()).getFullYear(), l = Math.floor(t / 100) * 100;
228
- let r = l + e;
229
- return r >= t && r <= t + 20 || (r = l + 100 + e, r >= t && r <= t + 20) ? r : l + 100 + e;
228
+ let a = l + e;
229
+ return a >= t && a <= t + 20 || (a = l + 100 + e, a >= t && a <= t + 20) ? a : l + 100 + e;
230
230
  }
231
231
  function V(n = "") {
232
232
  return n.trim().replaceAll(/\s/g, "").replaceAll("-", "");
@@ -250,56 +250,56 @@ const oe = {
250
250
  function ae(n, e) {
251
251
  return e === "none" ? n : oe[e](n);
252
252
  }
253
- const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholder: h = "Enter value", tooltip: o = "", onChange: c }) => {
254
- const d = ["card", "expiry", "phone", "cvv", "zip"].includes(e) ? "numeric" : "", a = p("label", {
253
+ const $ = ({ label: n, maskType: e, id: t, name: l, type: a = "text", placeholder: h = "Enter value", tooltip: i = "", onChange: c }) => {
254
+ const p = ["card", "expiry", "phone", "cvv", "zip"].includes(e) ? "numeric" : "", s = u("label", {
255
255
  className: "input-label",
256
256
  innerHTML: n,
257
257
  attributes: {
258
258
  for: t
259
259
  }
260
260
  });
261
- let i = !1;
262
- const u = p("input", {
261
+ let r = !1;
262
+ const d = u("input", {
263
263
  id: t || "input-id",
264
264
  className: "styled-input",
265
265
  attributes: {
266
266
  placeholder: h,
267
- type: r,
268
- inputMode: d,
267
+ type: a,
268
+ inputMode: p,
269
269
  name: l
270
270
  },
271
271
  events: {
272
- input: s,
272
+ input: o,
273
273
  blur: v,
274
274
  keydown: (b) => {
275
- b.key === "Enter" && (i = !0);
275
+ b.key === "Enter" && (r = !0);
276
276
  }
277
277
  }
278
278
  });
279
- function s(b) {
279
+ function o(b) {
280
280
  const D = e !== "none" ? ae(b?.target?.value, e) : b?.target?.value;
281
- u.value = D, c?.(D);
281
+ d.value = D, c?.(D);
282
282
  }
283
283
  function v() {
284
- i = !0, c?.(u?.value || "");
284
+ r = !0, c?.(d?.value || "");
285
285
  }
286
- const y = p("div", {
286
+ const y = u("div", {
287
287
  className: "input-loader",
288
288
  innerHTML: '<div class="loader"></div>',
289
289
  dataset: { show: "false" }
290
- }), w = o ? p("div", {
290
+ }), w = i ? u("div", {
291
291
  className: "input-right-element",
292
292
  children: [
293
- ne({ content: o, id: t })
293
+ ne({ content: i, id: t })
294
294
  ]
295
- }) : null, g = p("div", {
295
+ }) : null, g = u("div", {
296
296
  className: "input-wrapper",
297
297
  children: [
298
- u,
298
+ d,
299
299
  y,
300
300
  w
301
301
  ]
302
- }), N = p("div", {
302
+ }), N = u("div", {
303
303
  className: "error-message",
304
304
  dataset: { show: "false" },
305
305
  innerHTML: `
@@ -308,10 +308,10 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
308
308
  `
309
309
  });
310
310
  return {
311
- element: p("div", {
311
+ element: u("div", {
312
312
  className: "custom-input-group",
313
313
  children: [
314
- a,
314
+ s,
315
315
  g,
316
316
  N
317
317
  ]
@@ -319,7 +319,7 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
319
319
  setLoading: (b) => {
320
320
  x({ element: g }, {
321
321
  dataset: { loading: b ? "true" : "false" }
322
- }), x({ element: u }, {
322
+ }), x({ element: d }, {
323
323
  attributes: { disabled: b ? "true" : "false" }
324
324
  }), x({ element: y }, {
325
325
  dataset: { show: b ? "true" : "false" }
@@ -327,9 +327,9 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
327
327
  },
328
328
  setError: (b = "") => {
329
329
  x({ element: g }, {
330
- className: b && i ? { add: "input-error" } : { remove: "input-error" }
330
+ className: b && r ? { add: "input-error" } : { remove: "input-error" }
331
331
  }), x({ element: N }, {
332
- dataset: { show: b && i ? "true" : "false" },
332
+ dataset: { show: b && r ? "true" : "false" },
333
333
  innerHTML: `
334
334
  ${k}
335
335
  <span>${b || ""}</span>
@@ -338,9 +338,9 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
338
338
  }
339
339
  };
340
340
  }, ie = async (n, e = {}) => {
341
- const { method: t = "GET", headers: l = {}, body: r = null, ...h } = e;
341
+ const { method: t = "GET", headers: l = {}, body: a = null, ...h } = e;
342
342
  try {
343
- const o = {
343
+ const i = {
344
344
  method: t,
345
345
  headers: {
346
346
  Accept: "*/*",
@@ -349,78 +349,78 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
349
349
  },
350
350
  ...h
351
351
  };
352
- r && ["POST", "PUT", "PATCH", "DELETE"].includes(t.toUpperCase()) && (o.body = typeof r == "string" ? r : JSON.stringify(r));
353
- const c = await fetch(n, o), d = c.headers.get("content-type");
354
- let a;
355
- if (d?.includes("application/json") ? a = await c.json() : a = await c.text(), !c.ok) {
356
- const i = a;
352
+ a && ["POST", "PUT", "PATCH", "DELETE"].includes(t.toUpperCase()) && (i.body = typeof a == "string" ? a : JSON.stringify(a));
353
+ const c = await fetch(n, i), p = c.headers.get("content-type");
354
+ let s;
355
+ if (p?.includes("application/json") ? s = await c.json() : s = await c.text(), !c.ok) {
356
+ const r = s;
357
357
  throw new Error(
358
- i?.message || `HTTP error! status: ${c.status}`
358
+ r?.message || `HTTP error! status: ${c.status}`
359
359
  );
360
360
  }
361
- return { data: a, error: null };
362
- } catch (o) {
363
- return { data: null, error: o instanceof Error ? o.message : "An error occurred" };
361
+ return { data: s, error: null };
362
+ } catch (i) {
363
+ return { data: null, error: i instanceof Error ? i.message : "An error occurred" };
364
364
  }
365
365
  }, le = ({
366
366
  title: n = "",
367
367
  children: e,
368
368
  onClose: t,
369
369
  showBackBtn: l = !1,
370
- showCloseBtn: r = !0
370
+ showCloseBtn: a = !0
371
371
  }) => {
372
- const h = p("button", {
372
+ const h = u("button", {
373
373
  className: "back-btn",
374
374
  innerHTML: ee,
375
375
  dataset: { show: String(l) },
376
376
  events: { click: () => m() }
377
- }), o = p("h3", {
377
+ }), i = u("h3", {
378
378
  textContent: n
379
- }), c = p("button", {
379
+ }), c = u("button", {
380
380
  className: "close-btn",
381
381
  innerHTML: "&times;",
382
- dataset: { show: String(r) },
382
+ dataset: { show: String(a) },
383
383
  attributes: { "aria-label": "Close modal" },
384
384
  events: { click: () => m() }
385
- }), d = p("div", {
385
+ }), p = u("div", {
386
386
  className: "modal-header",
387
- children: [h, o, c]
388
- }), a = p("div", {
387
+ children: [h, i, c]
388
+ }), s = u("div", {
389
389
  className: "modal-content",
390
390
  children: [e]
391
- }), i = p("dialog", {
391
+ }), r = u("dialog", {
392
392
  className: "custom-modal",
393
- children: [d, a],
393
+ children: [p, s],
394
394
  events: {
395
- cancel: (s) => {
396
- s.preventDefault(), m();
395
+ cancel: (o) => {
396
+ o.preventDefault(), m();
397
397
  }
398
398
  }
399
399
  }), m = () => {
400
- i.close(), t?.();
400
+ r.close(), t?.();
401
401
  };
402
402
  return {
403
- element: i,
404
- setModalVisibility: (s) => {
405
- s ? i.showModal() : i.close();
403
+ element: r,
404
+ setModalVisibility: (o) => {
405
+ o ? r.showModal() : r.close();
406
406
  }
407
407
  };
408
- }, ce = ({ token: n, endpoint: e, beneficiaryCard: t = !1, isModal: l = !1, onCallback: r = () => null }) => {
409
- const h = t ? "Enter Recipient Debit Card Details" : "Enter Your Debit Card Details", o = t ? "Enter the debit card details of the recipient you're sending funds to." : "Linking an external account allows you to send and receive money to your account.", c = t ? "Debit Card Number" : "Your Debit Card Number", d = t ? "Enter recipient's card number" : "Enter your card number", a = `add-card-form-wrapper${t ? " recipient-form" : ""}`, i = {
408
+ }, ce = ({ token: n, endpoint: e, beneficiaryCard: t = !1, isModal: l = !1, onCallback: a = () => null }) => {
409
+ const h = t ? "Enter Recipient Debit Card Details" : "Enter Your Debit Card Details", i = t ? "Enter the debit card details of the recipient you're sending funds to." : "Linking an external account allows you to send and receive money to your account.", c = t ? "Debit Card Number" : "Your Debit Card Number", p = t ? "Enter recipient's card number" : "Enter your card number", s = `add-card-form-wrapper${t ? " recipient-form" : ""}`, r = {
410
410
  cardNumber: "",
411
411
  expiryDate: "",
412
412
  cvv: "",
413
413
  zipCode: ""
414
- }, { element: m, setError: u } = $({
414
+ }, { element: m, setError: d } = $({
415
415
  label: c,
416
- placeholder: d,
416
+ placeholder: p,
417
417
  id: "card-number-input",
418
418
  name: "cardNumber",
419
419
  maskType: "card",
420
420
  onChange(f) {
421
- L("cardNumber", f, u);
421
+ L("cardNumber", f, d);
422
422
  }
423
- }), { element: s, setError: v } = $({
423
+ }), { element: o, setError: v } = $({
424
424
  label: "Expiration Date",
425
425
  placeholder: "MM/YY",
426
426
  id: "expiry-input",
@@ -449,10 +449,10 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
449
449
  onChange(f) {
450
450
  L("zipCode", f, N);
451
451
  }
452
- }), M = p("div", {
452
+ }), M = u("div", {
453
453
  className: t ? "input-sections" : "inputs",
454
- children: [m, s, y, g]
455
- }), A = p("p", {
454
+ children: [m, o, y, g]
455
+ }), A = u("p", {
456
456
  className: "submit-error",
457
457
  dataset: { show: "false" }
458
458
  // innerHTML: `//icon`
@@ -472,11 +472,11 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
472
472
  b(f), D(f);
473
473
  };
474
474
  function L(f, H, E) {
475
- i[f] = H;
476
- const { isValid: I, errors: T } = se(i);
475
+ r[f] = H;
476
+ const { isValid: I, errors: T } = se(r);
477
477
  T[f] ? E(T[f]) : E(""), b(!I);
478
478
  }
479
- const O = p("div", {
479
+ const O = u("div", {
480
480
  className: "submit-button-wrapper",
481
481
  children: [A, j]
482
482
  });
@@ -499,9 +499,9 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
499
499
  }
500
500
  }
501
501
  });
502
- C.error ? (console.error("Request failed:", C.error), B(!1), z(C.error), r?.({ success: !1, error: C.error })) : (console.log("Request success:", C.data), B(!1), r?.({ success: !0, data: C.data }));
502
+ C.error ? (console.error("Request failed:", C.error), B(!1), z(C.error), a?.({ success: !1, error: C.error })) : (console.log("Request success:", C.data), B(!1), a?.({ success: !0, data: C.data }));
503
503
  }
504
- const Z = () => p("form", {
504
+ const Z = () => u("form", {
505
505
  events: {
506
506
  submit: P
507
507
  },
@@ -509,10 +509,10 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
509
509
  M,
510
510
  O
511
511
  ]
512
- }), W = () => p("div", {
512
+ }), W = () => u("div", {
513
513
  className: "form-title",
514
514
  innerHTML: `
515
- <p>${o}</p>
515
+ <p>${i}</p>
516
516
 
517
517
  <div>
518
518
  ${Q}
@@ -520,13 +520,13 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
520
520
  <span>Secured with 256-bit encryption</span>
521
521
  </div>
522
522
  `
523
- }), Y = () => p("div", {
523
+ }), Y = () => u("div", {
524
524
  className: l ? "" : "non-modal-content",
525
525
  children: [W(), Z()]
526
- }), q = l ? null : p("div", {
527
- className: `${a} non-modal`,
526
+ }), q = l ? null : u("div", {
527
+ className: `${s} non-modal`,
528
528
  children: [
529
- p("div", {
529
+ u("div", {
530
530
  className: "non-modal-header",
531
531
  innerHTML: `
532
532
  <span></span>
@@ -540,8 +540,8 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
540
540
  } };
541
541
  function R() {
542
542
  F && (document.body.appendChild(
543
- p("div", {
544
- className: a,
543
+ u("div", {
544
+ className: s,
545
545
  children: [F]
546
546
  })
547
547
  ), S(!0));
@@ -552,24 +552,24 @@ const $ = ({ label: n, maskType: e, id: t, name: l, type: r = "text", placeholde
552
552
  closeModal: () => S(!1)
553
553
  };
554
554
  };
555
- function de({ token: n, endpoint: e, beneficiaryCard: t, isModal: l, onCallback: r }) {
556
- const { renderFormWithModal: h, nonModalForm: o, closeModal: c } = ce({
555
+ function de({ token: n, endpoint: e, beneficiaryCard: t, isModal: l, onCallback: a, onModalClose: h }) {
556
+ const { renderFormWithModal: i, nonModalForm: c, closeModal: p } = ce({
557
557
  token: n,
558
558
  endpoint: e,
559
559
  beneficiaryCard: t,
560
560
  isModal: l,
561
- onCallback: r
561
+ onCallback: a
562
562
  });
563
563
  return {
564
- mount(d) {
565
- const a = "className" in d ? document.querySelector(d.className) : "id" in d ? document.getElementById(d.id) : d.element;
566
- a && o && a.appendChild(o);
564
+ mount(s) {
565
+ const r = "className" in s ? document.querySelector(s.className) : "id" in s ? document.getElementById(s.id) : s.element;
566
+ r && c && r.appendChild(c);
567
567
  },
568
568
  open() {
569
- h();
569
+ i();
570
570
  },
571
571
  destroy() {
572
- c();
572
+ p(), h?.();
573
573
  }
574
574
  };
575
575
  }