@astropay/payments-lib 0.1.4 → 0.1.5
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/astropay-payments-lib.es.js +6 -5
- package/dist/astropay-payments-lib.umd.js +327 -209
- package/dist/{main-6waZa7Q3.js → main--VBDistj.js} +15131 -12676
- package/dist/main.d.ts +2 -1
- package/dist/{profiler-xDfSQSgI.js → profiler-DGwCu-BH.js} +1 -1
- package/dist/public/AstroPayCardPayment/index.d.ts +60 -0
- package/dist/public/AstroPayFullCheckout/index.d.ts +1 -0
- package/dist/public/AstroPayPayment/index.d.ts +1 -0
- package/dist/{startRecording-DynnLqeo.js → startRecording-Bvdu2DrJ.js} +1 -1
- package/dist/types/index.d.ts +51 -1
- package/package.json +5 -4
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { AstroPayCardPayment } from './public/AstroPayCardPayment';
|
|
1
2
|
import { AstroPayCore } from './public/AstroPayCore';
|
|
2
3
|
import { AstroPayFullCheckout } from './public/AstroPayFullCheckout';
|
|
3
4
|
import { AstroPayPayment } from './public/AstroPayPayment';
|
|
4
|
-
export { AstroPayCore, AstroPayCore as Core, AstroPayFullCheckout, AstroPayPayment };
|
|
5
|
+
export { AstroPayCardPayment, AstroPayCore, AstroPayCore as Core, AstroPayFullCheckout, AstroPayPayment, };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Component } from '../../components/templates/Component';
|
|
2
|
+
import { APCardPayment } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* AstroPayCardPayment provides a secure card payment form for credit/debit transactions.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const payment = new AstroPayCardPayment({
|
|
9
|
+
* amount: 100,
|
|
10
|
+
* currency: 'USD',
|
|
11
|
+
* country: 'BR'
|
|
12
|
+
* config: {
|
|
13
|
+
* userId: 'user-id-789';
|
|
14
|
+
* },
|
|
15
|
+
* // Optional props
|
|
16
|
+
* showPaymentSummary: true,
|
|
17
|
+
* expirationDateFormat: 'MM/YY'
|
|
18
|
+
* onSuccess: () => console.log('Payment successful'),
|
|
19
|
+
* onError: () => console.error('Payment failed')
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @see {@link APCardPayment} for all available configuration options
|
|
24
|
+
*/
|
|
25
|
+
export declare class AstroPayCardPayment extends Component<HTMLDivElement> {
|
|
26
|
+
private loadingWrapper;
|
|
27
|
+
private readonly componentProps;
|
|
28
|
+
private readonly methodCode;
|
|
29
|
+
constructor(params: APCardPayment);
|
|
30
|
+
private createPayment;
|
|
31
|
+
private renderAstroPayCardMethod;
|
|
32
|
+
private showErrorMessage;
|
|
33
|
+
/**
|
|
34
|
+
* Renders the payment component into the specified DOM container.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const paymentComponent = new AstroPayCardPayment(paymentSettings);
|
|
39
|
+
* paymentComponent.render(document.getElementById('payment-container'));
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param {HTMLElement} container - The DOM element to render the payment component into.
|
|
43
|
+
*/
|
|
44
|
+
render(container: HTMLElement): void;
|
|
45
|
+
/**
|
|
46
|
+
* Destroys the payment component instance, cleaning up all DOM elements
|
|
47
|
+
* and unregistering from the AstroPay Payments Library.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* // Initialize and render component
|
|
52
|
+
* const paymentComponent = new AstroPayCardPayment(paymentSettings);
|
|
53
|
+
* paymentComponent.render(container);
|
|
54
|
+
*
|
|
55
|
+
* // Later cleanup
|
|
56
|
+
* paymentComponent.destroy();
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
destroy(): void;
|
|
60
|
+
}
|
|
@@ -22,6 +22,7 @@ import { APFullCheckout } from '../../types';
|
|
|
22
22
|
export declare class AstroPayFullCheckout extends Component<HTMLDivElement> {
|
|
23
23
|
private loadingWrapper;
|
|
24
24
|
private readonly componentProps;
|
|
25
|
+
private accPaymentMethods?;
|
|
25
26
|
constructor(params: APFullCheckout);
|
|
26
27
|
private createPayment;
|
|
27
28
|
private renderPaymentMethods;
|
|
@@ -21,6 +21,7 @@ import { APPayment } from '../../types';
|
|
|
21
21
|
export declare class AstroPayPayment extends Component<HTMLDivElement> {
|
|
22
22
|
private loadingWrapper;
|
|
23
23
|
private readonly componentProps;
|
|
24
|
+
private readonly methodCode;
|
|
24
25
|
constructor(params: APPayment);
|
|
25
26
|
private createPayment;
|
|
26
27
|
private renderAstroPayMethod;
|
|
@@ -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
|
|
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--VBDistj.js";
|
|
2
2
|
const P = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
function T(t) {
|
|
4
4
|
return P.has(t);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ type APEnvironment = (typeof CONFIG_ENVIRONMENT_VALUES)[number];
|
|
|
9
9
|
type APAvailableTheme = (typeof CONFIG_THEME_VALUES)[number];
|
|
10
10
|
type APAvailableLanguages = (typeof CONFIG_LANGUAGE_VALUES)[number];
|
|
11
11
|
type APAvailableCurrencyMode = (typeof CONFIG_CURRENCY_MODE_VALUES)[number];
|
|
12
|
+
type APCardConfig = {
|
|
13
|
+
userId: string;
|
|
14
|
+
};
|
|
12
15
|
type APComponentStyles = {
|
|
13
16
|
backgroundColor: string;
|
|
14
17
|
fontFamily: string;
|
|
@@ -106,8 +109,13 @@ type APFullCheckout = {
|
|
|
106
109
|
amount: number;
|
|
107
110
|
currency: string;
|
|
108
111
|
country: string;
|
|
112
|
+
paymentExternalId?: string;
|
|
109
113
|
showTitle?: boolean;
|
|
110
114
|
showDescription?: boolean;
|
|
115
|
+
cardConfig?: (APCardConfig & {
|
|
116
|
+
showPaymentSummary?: boolean;
|
|
117
|
+
expirationDateFormat?: 'MM/YYYY' | 'MM/YY';
|
|
118
|
+
}) | undefined;
|
|
111
119
|
user?: {
|
|
112
120
|
phoneNumber?: string;
|
|
113
121
|
email?: string;
|
|
@@ -196,4 +204,46 @@ type APPayment = {
|
|
|
196
204
|
onSuccess?: () => void;
|
|
197
205
|
onError?: () => void;
|
|
198
206
|
};
|
|
199
|
-
|
|
207
|
+
type APCardPayment = {
|
|
208
|
+
amount: number;
|
|
209
|
+
currency: string;
|
|
210
|
+
country: string;
|
|
211
|
+
config: APCardConfig;
|
|
212
|
+
showPaymentSummary?: boolean | undefined;
|
|
213
|
+
expirationDateFormat?: 'MM/YYYY' | 'MM/YY' | undefined;
|
|
214
|
+
order?: {
|
|
215
|
+
id?: string;
|
|
216
|
+
items?: Array<{
|
|
217
|
+
name: string;
|
|
218
|
+
description?: string;
|
|
219
|
+
units: number;
|
|
220
|
+
amount: {
|
|
221
|
+
currency: string;
|
|
222
|
+
value: number;
|
|
223
|
+
};
|
|
224
|
+
}>;
|
|
225
|
+
summary?: {
|
|
226
|
+
totalAmount: {
|
|
227
|
+
currency: string;
|
|
228
|
+
value: number;
|
|
229
|
+
};
|
|
230
|
+
shipping?: {
|
|
231
|
+
label: string;
|
|
232
|
+
amount: {
|
|
233
|
+
currency: string;
|
|
234
|
+
value: number;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
fees?: {
|
|
238
|
+
label: string;
|
|
239
|
+
amount: {
|
|
240
|
+
currency: string;
|
|
241
|
+
value: number;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
} | undefined;
|
|
246
|
+
onSuccess?: () => void;
|
|
247
|
+
onError?: () => void;
|
|
248
|
+
};
|
|
249
|
+
export type { APCardConfig, APEnvironment, APAvailableTheme, APAvailableLanguages, APAvailableCurrencyMode, APComponentStyles, APCore, APFullCheckout, APPayment, APCardPayment, };
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.5",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"name": "@astropay/payments-lib",
|
|
5
5
|
"description": "Official AstroPay payments library for web and mobile.",
|
|
@@ -65,12 +65,13 @@
|
|
|
65
65
|
"release:dry": "standard-version --release-as $RELEASE_TYPE --dry-run"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
+
"@astropay/tokenizer-sdk": "1.1.3",
|
|
69
|
+
"@datadog/browser-rum": "6.6.3",
|
|
68
70
|
"@emotion/css": "^11.13.5",
|
|
69
71
|
"axios": "^1.7.9",
|
|
70
72
|
"bowser": "^2.11.0",
|
|
71
73
|
"i18next": "^24.2.2",
|
|
72
|
-
"qrcode": "^1.5.4"
|
|
73
|
-
"@datadog/browser-rum": "6.6.3"
|
|
74
|
+
"qrcode": "^1.5.4"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
77
|
"@commitlint/cli": "^19.7.1",
|
|
@@ -98,8 +99,8 @@
|
|
|
98
99
|
"prettier": "^3.4.2",
|
|
99
100
|
"qrcode": "^1.5.4",
|
|
100
101
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
101
|
-
"ts-jest": "^29.3.1",
|
|
102
102
|
"standard-version": "^9.5.0",
|
|
103
|
+
"ts-jest": "^29.3.1",
|
|
103
104
|
"typescript": "^5.8.3",
|
|
104
105
|
"typescript-eslint": "^8.31.1",
|
|
105
106
|
"vite": "^6.1.0",
|