@astropay/payments-lib 2.0.21 → 2.0.23

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/main.d.ts CHANGED
@@ -2,4 +2,5 @@ import { AstroPayCardPayment } from './public/AstroPayCardPayment';
2
2
  import { AstroPayCore } from './public/AstroPayCore';
3
3
  import { AstroPayFullCheckout } from './public/AstroPayFullCheckout';
4
4
  import { AstroPayPayment } from './public/AstroPayPayment';
5
- export { AstroPayCardPayment, AstroPayCore, AstroPayCore as Core, AstroPayFullCheckout, AstroPayPayment, };
5
+ import { AstroPaySinglePaymentMethod } from './public/AstroPaySinglePaymentMethod';
6
+ export { AstroPayCardPayment, AstroPayCore, AstroPayCore as Core, AstroPayFullCheckout, AstroPayPayment, AstroPaySinglePaymentMethod, };
@@ -1,4 +1,4 @@
1
- import { p as x, V as z, W as H, w as O, X as W, Y as v, Z as X, O as Y, M as Z } from "./main-CawYSJ0e.js";
1
+ import { p as x, V as z, W as H, w as O, X as W, Y as v, Z as X, O as Y, M as Z } from "./main-D6KiGA5-.js";
2
2
  function q(e) {
3
3
  let t = 0;
4
4
  for (const o of e)
@@ -0,0 +1,61 @@
1
+ import { Component } from '../../components/templates/Component';
2
+ import { APSinglePaymentMethod } from '../../types';
3
+ /**
4
+ * AstroPaySinglePaymentMethod renders exactly one generic payment method selected by
5
+ * `paymentMethodCode` (e.g. QR Code `QA`). Card methods and the AstroPay wallet
6
+ * are not supported here — use `AstroPayCardPayment` / `AstroPayPayment` instead.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const payment = new AstroPaySinglePaymentMethod({
11
+ * amount: 100,
12
+ * currency: 'USD',
13
+ * country: 'AR',
14
+ * paymentMethodCode: 'QA',
15
+ * // Optional props
16
+ * showTitle: true,
17
+ * onSuccess: () => console.log('Payment successful'),
18
+ * onError: () => console.error('Payment failed')
19
+ * });
20
+ * ```
21
+ *
22
+ * @see {@link APSinglePaymentMethod} for all available configuration options
23
+ */
24
+ export declare class AstroPaySinglePaymentMethod extends Component<HTMLDivElement> {
25
+ private readonly componentProps;
26
+ private loadingWrapper;
27
+ private paymentMethod;
28
+ private isDestroyed;
29
+ constructor(params: APSinglePaymentMethod);
30
+ private createPayment;
31
+ private renderPaymentMethod;
32
+ private showErrorMessage;
33
+ private showResultScreen;
34
+ /**
35
+ * Renders the payment component into the specified DOM container.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const paymentComponent = new AstroPaySinglePaymentMethod(paymentSettings);
40
+ * paymentComponent.render(document.getElementById('payment-container'));
41
+ * ```
42
+ *
43
+ * @param {HTMLElement} container - The DOM element to render the payment component into.
44
+ */
45
+ render(container: HTMLElement): void;
46
+ /**
47
+ * Destroys the payment component instance, cleaning up all DOM elements
48
+ * and unregistering from the AstroPay Payments Library.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * // Initialize and render component
53
+ * const paymentComponent = new AstroPaySinglePaymentMethod(paymentSettings);
54
+ * paymentComponent.render(container);
55
+ *
56
+ * // Later cleanup
57
+ * paymentComponent.destroy();
58
+ * ```
59
+ */
60
+ destroy(): void;
61
+ }
@@ -1,4 +1,4 @@
1
- import { s as A, C, b as ft, i as Y, g as V, N as h, P as X, S as pt, a as B, c as ht, d as mt, e as St, f as q, r as gt, h as Et, j as yt, k as Tt, l as j, m as J, t as _, n as x, o as M, p as K, q as N, u as Q, v as Z, w as Nt, x as vt, y as b, z as D, A as R, B as wt, D as Mt, E as It, F as Rt, G as Ct, H as bt, I as _t, J as Lt, K as Dt, L as xt, M as Ot, O as At, Q as Vt, R as Pt, T as kt, U as zt } from "./main-CawYSJ0e.js";
1
+ import { s as A, C, b as ft, i as Y, g as V, N as h, P as X, S as pt, a as B, c as ht, d as mt, e as St, f as q, r as gt, h as Et, j as yt, k as Tt, l as j, m as J, t as _, n as x, o as M, p as K, q as N, u as Q, v as Z, w as Nt, x as vt, y as b, z as D, A as R, B as wt, D as Mt, E as It, F as Rt, G as Ct, H as bt, I as _t, J as Lt, K as Dt, L as xt, M as Ot, O as At, Q as Vt, R as Pt, T as kt, U as zt } from "./main-D6KiGA5-.js";
2
2
  const P = /* @__PURE__ */ new WeakMap();
3
3
  function T(t) {
4
4
  return P.has(t);
@@ -331,4 +331,11 @@ type APCardPayment = TPaymentIdentity & {
331
331
  onSuccess?: () => void;
332
332
  onError?: () => void;
333
333
  };
334
- export type { APEnvironment, APAvailableTheme, APAvailableLanguages, APAvailableCurrencyMode, APAvailableFontScale, APComponentStyles, APCore, APFullCheckout, APPayment, APCardPayment, TNewPayment, };
334
+ type APSinglePaymentMethod = TPaymentIdentity & {
335
+ paymentMethodCode: string;
336
+ showTitle?: boolean;
337
+ order?: TOrderProps | undefined;
338
+ onSuccess?: () => void;
339
+ onError?: () => void;
340
+ };
341
+ export type { APEnvironment, APAvailableTheme, APAvailableLanguages, APAvailableCurrencyMode, APAvailableFontScale, APComponentStyles, APCore, APFullCheckout, APPayment, APCardPayment, APSinglePaymentMethod, TNewPayment, };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.21",
2
+ "version": "2.0.23",
3
3
  "type": "module",
4
4
  "name": "@astropay/payments-lib",
5
5
  "description": "Official AstroPay payments library for web and mobile.",