@astropay/payments-lib 2.0.7 → 2.0.9

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.
@@ -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-CBfut1j-.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-OhXOviRS.js";
2
2
  function q(e) {
3
3
  let t = 0;
4
4
  for (const o of e)
@@ -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-CBfut1j-.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-OhXOviRS.js";
2
2
  const P = /* @__PURE__ */ new WeakMap();
3
3
  function T(t) {
4
4
  return P.has(t);
@@ -197,144 +197,81 @@ type APCore = {
197
197
  styles?: TDeepPartial<APComponentStyles>;
198
198
  tracking?: boolean;
199
199
  };
200
- type APFullCheckout = {
201
- amount: number;
202
- currency: string;
203
- country: string;
204
- paymentExternalId?: string;
205
- showTitle?: boolean;
206
- showDescription?: boolean;
207
- cardConfig?: {
208
- showPaymentSummary?: boolean;
209
- expirationDateFormat?: 'MM/YYYY' | 'MM/YY';
210
- } | undefined;
211
- user?: {
212
- phoneNumber?: string;
213
- email?: string;
214
- firstName?: string;
215
- lastName?: string;
216
- documentNumber?: string;
217
- } | undefined;
218
- order?: {
219
- id?: string;
220
- items?: Array<{
221
- name: string;
222
- description?: string;
223
- units: number;
200
+ type TOrderProps = {
201
+ id?: string;
202
+ items?: Array<{
203
+ name: string;
204
+ description?: string;
205
+ units: number;
206
+ amount: {
207
+ currency: string;
208
+ value: number;
209
+ };
210
+ }>;
211
+ summary?: {
212
+ totalAmount: {
213
+ currency: string;
214
+ value: number;
215
+ };
216
+ shipping?: {
217
+ label: string;
224
218
  amount: {
225
219
  currency: string;
226
220
  value: number;
227
221
  };
228
- }>;
229
- summary?: {
230
- totalAmount: {
222
+ };
223
+ fees?: {
224
+ label: string;
225
+ amount: {
231
226
  currency: string;
232
227
  value: number;
233
228
  };
234
- shipping?: {
235
- label: string;
236
- amount: {
237
- currency: string;
238
- value: number;
239
- };
240
- };
241
- fees?: {
242
- label: string;
243
- amount: {
244
- currency: string;
245
- value: number;
246
- };
247
- };
248
229
  };
249
- } | undefined;
250
- onSuccess?: () => void;
251
- onError?: () => void;
230
+ };
231
+ };
232
+ type TUserProps = {
233
+ phoneNumber?: string;
234
+ email?: string;
235
+ firstName?: string;
236
+ lastName?: string;
237
+ documentNumber?: string;
252
238
  };
253
- type APPayment = {
239
+ type TNewPayment = {
254
240
  amount: number;
255
241
  currency: string;
256
242
  country: string;
257
- user?: {
258
- phoneNumber?: string;
259
- email?: string;
260
- firstName?: string;
261
- lastName?: string;
262
- documentNumber?: string;
263
- } | undefined;
264
- order?: {
265
- id?: string;
266
- items?: Array<{
267
- name: string;
268
- description?: string;
269
- units: number;
270
- amount: {
271
- currency: string;
272
- value: number;
273
- };
274
- }>;
275
- summary?: {
276
- totalAmount: {
277
- currency: string;
278
- value: number;
279
- };
280
- shipping?: {
281
- label: string;
282
- amount: {
283
- currency: string;
284
- value: number;
285
- };
286
- };
287
- fees?: {
288
- label: string;
289
- amount: {
290
- currency: string;
291
- value: number;
292
- };
293
- };
294
- };
243
+ paymentExternalId?: never;
244
+ };
245
+ type TExistingPayment = {
246
+ paymentExternalId: string;
247
+ amount?: never;
248
+ currency?: never;
249
+ country?: never;
250
+ };
251
+ type TPaymentIdentity = TNewPayment | TExistingPayment;
252
+ type APFullCheckout = TPaymentIdentity & {
253
+ showTitle?: boolean;
254
+ showDescription?: boolean;
255
+ cardConfig?: {
256
+ showPaymentSummary?: boolean | undefined;
257
+ expirationDateFormat?: 'MM/YYYY' | 'MM/YY' | undefined;
295
258
  } | undefined;
259
+ user?: TUserProps | undefined;
260
+ order?: TOrderProps | undefined;
296
261
  onSuccess?: () => void;
297
262
  onError?: () => void;
298
263
  };
299
- type APCardPayment = {
300
- amount: number;
301
- currency: string;
302
- country: string;
264
+ type APPayment = TPaymentIdentity & {
265
+ user?: TUserProps | undefined;
266
+ order?: TOrderProps | undefined;
267
+ onSuccess?: () => void;
268
+ onError?: () => void;
269
+ };
270
+ type APCardPayment = TPaymentIdentity & {
303
271
  showPaymentSummary?: boolean | undefined;
304
272
  expirationDateFormat?: 'MM/YYYY' | 'MM/YY' | undefined;
305
- order?: {
306
- id?: string;
307
- items?: Array<{
308
- name: string;
309
- description?: string;
310
- units: number;
311
- amount: {
312
- currency: string;
313
- value: number;
314
- };
315
- }>;
316
- summary?: {
317
- totalAmount: {
318
- currency: string;
319
- value: number;
320
- };
321
- shipping?: {
322
- label: string;
323
- amount: {
324
- currency: string;
325
- value: number;
326
- };
327
- };
328
- fees?: {
329
- label: string;
330
- amount: {
331
- currency: string;
332
- value: number;
333
- };
334
- };
335
- };
336
- } | undefined;
273
+ order?: TOrderProps | undefined;
337
274
  onSuccess?: () => void;
338
275
  onError?: () => void;
339
276
  };
340
- export type { APEnvironment, APAvailableTheme, APAvailableLanguages, APAvailableCurrencyMode, APAvailableFontScale, APComponentStyles, APCore, APFullCheckout, APPayment, APCardPayment, };
277
+ export type { APEnvironment, APAvailableTheme, APAvailableLanguages, APAvailableCurrencyMode, APAvailableFontScale, APComponentStyles, APCore, APFullCheckout, APPayment, APCardPayment, TNewPayment, };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.7",
2
+ "version": "2.0.9",
3
3
  "type": "module",
4
4
  "name": "@astropay/payments-lib",
5
5
  "description": "Official AstroPay payments library for web and mobile.",