@monei-js/components 1.7.10 → 2.1.0

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.
Files changed (56) hide show
  1. package/README.md +100 -9
  2. package/dist/chunk.js +13 -0
  3. package/dist/index.cjs +1643 -0
  4. package/dist/index.d.cts +528 -0
  5. package/dist/index.d.ts +526 -14
  6. package/dist/index.js +1616 -7
  7. package/dist/monei.umd.production.min.js +64 -0
  8. package/dist/monei.umd.production.min.js.map +1 -0
  9. package/package.json +42 -65
  10. package/src/bridge/types.ts +106 -0
  11. package/dist/api.d.ts +0 -13
  12. package/dist/bizum/container.d.ts +0 -4
  13. package/dist/bizum/index.d.ts +0 -5
  14. package/dist/bizum/modal.d.ts +0 -3
  15. package/dist/bizum/types.d.ts +0 -30
  16. package/dist/cardInput/index.d.ts +0 -8
  17. package/dist/cardInput/types.d.ts +0 -51
  18. package/dist/click2pay/container.d.ts +0 -4
  19. package/dist/click2pay/index.d.ts +0 -5
  20. package/dist/click2pay/modal.d.ts +0 -3
  21. package/dist/click2pay/types.d.ts +0 -23
  22. package/dist/cofidis/container.d.ts +0 -4
  23. package/dist/cofidis/index.d.ts +0 -6
  24. package/dist/cofidis/modal.d.ts +0 -3
  25. package/dist/cofidis/types.d.ts +0 -45
  26. package/dist/cofidis/widget.d.ts +0 -3
  27. package/dist/cofidisLoan/container.d.ts +0 -4
  28. package/dist/cofidisLoan/index.d.ts +0 -7
  29. package/dist/cofidisLoan/modal.d.ts +0 -4
  30. package/dist/cofidisLoan/types.d.ts +0 -45
  31. package/dist/cofidisLoan/widget.d.ts +0 -4
  32. package/dist/components.cjs.development.js +0 -18997
  33. package/dist/components.cjs.development.js.map +0 -1
  34. package/dist/components.cjs.production.min.js +0 -2
  35. package/dist/components.cjs.production.min.js.map +0 -1
  36. package/dist/components.esm.js +0 -18979
  37. package/dist/components.esm.js.map +0 -1
  38. package/dist/config.d.ts +0 -28
  39. package/dist/container.d.ts +0 -1
  40. package/dist/enums.d.ts +0 -4
  41. package/dist/googlePay/index.d.ts +0 -4
  42. package/dist/googlePay/types.d.ts +0 -21
  43. package/dist/paymentModal/container.d.ts +0 -4
  44. package/dist/paymentModal/index.d.ts +0 -6
  45. package/dist/paymentModal/types.d.ts +0 -28
  46. package/dist/paymentRequest/index.d.ts +0 -4
  47. package/dist/paymentRequest/types.d.ts +0 -22
  48. package/dist/paypal/index.d.ts +0 -4
  49. package/dist/paypal/types.d.ts +0 -27
  50. package/dist/types.d.ts +0 -194
  51. package/dist/utils.d.ts +0 -11
  52. package/types/belter.d.ts +0 -1
  53. package/types/component.d.ts +0 -196
  54. package/types/css.d.ts +0 -9
  55. package/types/global.d.ts +0 -3
  56. package/types/post-robot.d.ts +0 -1
package/dist/index.d.ts CHANGED
@@ -1,14 +1,526 @@
1
- import * as _utils from './utils';
2
- import * as _api from './api';
3
- export * from './cardInput';
4
- export * from './paymentModal';
5
- export * from './paypal';
6
- export * from './bizum';
7
- export * from './cofidis';
8
- export * from './cofidisLoan';
9
- export * from './googlePay';
10
- export * from './paymentRequest';
11
- export * from './config';
12
- export * from './types';
13
- export declare const api: typeof _api;
14
- export declare const utils: typeof _utils;
1
+ import * as CSS from "csstype";
2
+
3
+ //#region src/types/css.d.ts
4
+ type CSSProperties = CSS.Properties<string | number>;
5
+ type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject };
6
+ interface CSSObject extends CSSProperties, CSSPseudos {
7
+ [key: string]: CSSObject | string | number | undefined;
8
+ }
9
+ //#endregion
10
+ //#region src/types.d.ts
11
+ declare enum NextActionType {
12
+ CONFIRM = "CONFIRM",
13
+ FRICTIONLESS_CHALLENGE = "FRICTIONLESS_CHALLENGE",
14
+ BIZUM_CHALLENGE = "BIZUM_CHALLENGE",
15
+ CHALLENGE = "CHALLENGE",
16
+ COMPLETE = "COMPLETE"
17
+ }
18
+ declare enum CardBrand {
19
+ Visa = "visa",
20
+ Mastercard = "mastercard",
21
+ Amex = "amex",
22
+ Discover = "discover",
23
+ Diners = "diners",
24
+ JCB = "jcb",
25
+ Maestro = "maestro",
26
+ UnionPay = "unionpay",
27
+ Elo = "elo",
28
+ Hipercard = "hipercard"
29
+ }
30
+ declare enum TransactionType {
31
+ AUTH = "AUTH",
32
+ SALE = "SALE",
33
+ PAYOUT = "PAYOUT",
34
+ VERIF = "VERIF"
35
+ }
36
+ interface PaymentResult {
37
+ id: string;
38
+ status: string;
39
+ orderId?: string;
40
+ amount?: number;
41
+ currency?: string;
42
+ accountId?: string;
43
+ statusCode?: string;
44
+ statusMessage?: string;
45
+ nextAction?: {
46
+ type: NextActionType;
47
+ mustRedirect: boolean;
48
+ redirectUrl: string;
49
+ };
50
+ }
51
+ interface Customer {
52
+ email?: string;
53
+ name?: string;
54
+ phone?: string;
55
+ }
56
+ interface Address {
57
+ country?: string;
58
+ city?: string;
59
+ line1?: string;
60
+ line2?: string;
61
+ zip?: string;
62
+ state?: string;
63
+ }
64
+ interface BillingDetails {
65
+ name?: string;
66
+ email?: string;
67
+ phone?: string;
68
+ company?: string;
69
+ address?: Address;
70
+ }
71
+ interface PaymentMethod {
72
+ card?: {
73
+ cardholderName?: string;
74
+ cardholderEmail?: string;
75
+ };
76
+ }
77
+ type GetPaymentMethodsRequest = {
78
+ accountId?: string;
79
+ paymentId?: string;
80
+ t?: number;
81
+ };
82
+ type GetPaymentMethodsResponse = {
83
+ paymentMethods: string[];
84
+ livemode: boolean;
85
+ accountId: string;
86
+ amount?: number;
87
+ currency?: string;
88
+ merchantName?: string;
89
+ merchantUrl?: string;
90
+ countryCode?: string;
91
+ metadata: {
92
+ card: {
93
+ brands: CardBrand[];
94
+ };
95
+ paypal?: {
96
+ clientId: string;
97
+ merchantId: string;
98
+ };
99
+ googlePay?: {
100
+ merchantId: string;
101
+ cvcRequired?: boolean;
102
+ };
103
+ applePay?: {
104
+ merchantId: string;
105
+ };
106
+ clickToPay?: {
107
+ tokenSupport: boolean;
108
+ preselected: boolean;
109
+ visa: {
110
+ srciDpaId: string;
111
+ srcInitiatorId: string;
112
+ };
113
+ mastercard: {
114
+ srciDpaId: string;
115
+ srcInitiatorId: string;
116
+ };
117
+ discover: {
118
+ srciDpaId: string;
119
+ srcInitiatorId: string;
120
+ };
121
+ };
122
+ };
123
+ };
124
+ type CreateTokenRequest = {
125
+ accountId?: string;
126
+ paymentId?: string;
127
+ sessionId?: string;
128
+ amount?: number;
129
+ currency?: string;
130
+ transactionType?: TransactionType;
131
+ paymentMethod: {
132
+ card?: {
133
+ number: string;
134
+ expMonth: string;
135
+ expYear: string;
136
+ cvc: string;
137
+ };
138
+ paypal?: {};
139
+ googlePay?: {
140
+ token: string;
141
+ };
142
+ applePay?: {
143
+ token: string;
144
+ };
145
+ bizum?: {
146
+ phoneNumber: string;
147
+ remember?: boolean;
148
+ };
149
+ clickToPay?: {
150
+ token: string;
151
+ cardBrand: string;
152
+ };
153
+ };
154
+ };
155
+ type CreateTokenResponse = {
156
+ token?: string; /** @deprecated Use `token` instead */
157
+ paymentToken?: string;
158
+ error?: string;
159
+ paypal?: {
160
+ orderId: string;
161
+ };
162
+ };
163
+ type CreatePaymentRequest = {
164
+ accountId: string;
165
+ pointOfSaleId: string;
166
+ amount: number;
167
+ currency: string;
168
+ signature: string;
169
+ };
170
+ type SendPaymentReceiptRequest = {
171
+ paymentId: string;
172
+ signature: string;
173
+ customerEmail?: string;
174
+ language?: string;
175
+ };
176
+ type CreateApplePaySessionRequest = {
177
+ accountId: string;
178
+ validationUrl: string;
179
+ domainName: string;
180
+ displayName: string;
181
+ };
182
+ type ValidateBizumPhoneRequest = {
183
+ accountId?: string;
184
+ paymentId?: string;
185
+ amount?: number;
186
+ phoneNumber: string;
187
+ };
188
+ declare namespace utils_d_exports {
189
+ export { fixLocalstorage, getClientEnv, getClientFingerprint, isMethodSupported, loadScript, parsePx, stringify, toCssPx, transformStyle, validateComponentProps, withError };
190
+ }
191
+ declare const transformStyle: (style: CSSObject) => any;
192
+ declare const loadScript: (src: string, nonce?: string, dataset?: Record<string, string | undefined>, forceReload?: boolean) => Promise<HTMLScriptElement>;
193
+ declare const stringify: (obj: Record<string, any>) => string;
194
+ declare const fixLocalstorage: () => Storage;
195
+ declare const getClientEnv: () => string;
196
+ declare const getClientFingerprint: () => Promise<string>;
197
+ declare const withError: <T>(p: Promise<T>) => Promise<[Error | undefined, T | undefined]>;
198
+ declare const isMethodSupported: (config: GetPaymentMethodsResponse, paymentMethod: string) => boolean;
199
+ declare const validateComponentProps: ({
200
+ props
201
+ }: {
202
+ props: any;
203
+ }) => void;
204
+ //#endregion
205
+ //#region src/payment-modal/types.d.ts
206
+ type Style = {
207
+ width: string;
208
+ height: string;
209
+ };
210
+ interface ConfirmPaymentParams {
211
+ paymentId: string;
212
+ paymentToken?: string;
213
+ generatePaymentToken?: boolean;
214
+ fullscreen?: boolean;
215
+ language?: string;
216
+ paymentMethod?: PaymentMethod;
217
+ allowedPaymentMethods?: string[];
218
+ customDomain?: string;
219
+ customer?: Customer;
220
+ style?: Style;
221
+ billingDetails?: BillingDetails;
222
+ shippingDetails?: BillingDetails;
223
+ }
224
+ interface PaymentModalProps extends ConfirmPaymentParams {
225
+ isOpen: boolean;
226
+ onError?: (error: any) => void;
227
+ onProps?: (cb: (props: PaymentModalProps) => void) => Promise<void>;
228
+ onResult: (result: PaymentResult) => void;
229
+ onLoad?: () => void;
230
+ onOpen?: () => void;
231
+ }
232
+ //#endregion
233
+ //#region src/payment-modal/index.d.ts
234
+ declare const PaymentModal: BridgeComponentConstructor<PaymentModalProps>;
235
+ declare const confirmPayment: (params: ConfirmPaymentParams) => Promise<PaymentResult>;
236
+ declare namespace api_d_exports {
237
+ export { confirmPayment$1 as confirmPayment, createApplePaySession, createPayment, createToken$1 as createToken, getPayment, getPaymentMethods, sendPaymentReceipt, validateBizumPhone };
238
+ }
239
+ declare const getPaymentMethods: ({
240
+ accountId,
241
+ paymentId
242
+ }: GetPaymentMethodsRequest) => Promise<GetPaymentMethodsResponse>;
243
+ declare const createToken$1: ({
244
+ paymentMethod,
245
+ paymentId,
246
+ sessionId,
247
+ amount,
248
+ currency,
249
+ accountId,
250
+ transactionType
251
+ }: CreateTokenRequest) => Promise<CreateTokenResponse>;
252
+ declare const getPayment: (paymentId: string) => Promise<PaymentResult>;
253
+ declare const confirmPayment$1: ({
254
+ paymentId,
255
+ ...body
256
+ }: ConfirmPaymentParams) => Promise<PaymentResult>;
257
+ declare const createPayment: ({
258
+ signature,
259
+ ...body
260
+ }: CreatePaymentRequest) => Promise<PaymentResult>;
261
+ declare const sendPaymentReceipt: ({
262
+ paymentId,
263
+ customerEmail,
264
+ signature,
265
+ language
266
+ }: SendPaymentReceiptRequest) => Promise<PaymentResult>;
267
+ declare const createApplePaySession: (body: CreateApplePaySessionRequest) => Promise<any>;
268
+ declare const validateBizumPhone: (req: ValidateBizumPhoneRequest) => Promise<{
269
+ isValid: boolean;
270
+ }>;
271
+ //#endregion
272
+ //#region src/card-input/types.d.ts
273
+ type CardInputStyle = {
274
+ base?: CSSObject;
275
+ invalid?: CSSObject;
276
+ input?: CSSObject;
277
+ cardNumber?: CSSObject;
278
+ expiryDate?: CSSObject;
279
+ cvc?: CSSObject;
280
+ icon?: CSSObject;
281
+ loading?: CSSObject;
282
+ };
283
+ type CardInputOnChangeEvent = {
284
+ isTouched: boolean;
285
+ isSubmitted: boolean;
286
+ error?: string;
287
+ cardType?: string;
288
+ };
289
+ type CardInputProps = {
290
+ ref?: any;
291
+ accountId?: string;
292
+ orderId?: string;
293
+ sessionId?: string;
294
+ paymentId?: string;
295
+ onError?: (error: any) => void;
296
+ onProps?: (cb: (props: CardInputProps) => void) => void;
297
+ onBlur?: () => void;
298
+ onChange?: (event: CardInputOnChangeEvent) => void;
299
+ onEnter?: () => void;
300
+ onFocus?: () => void;
301
+ onLoad?: () => void;
302
+ language?: string;
303
+ placeholders?: {
304
+ cardNumber?: string;
305
+ expiryDate?: string;
306
+ cvc?: string;
307
+ };
308
+ errorMessages?: {
309
+ emptyCardNumber?: string;
310
+ invalidCardNumber?: string;
311
+ emptyExpiryDate?: string;
312
+ monthOutOfRange?: string;
313
+ yearOutOfRange?: string;
314
+ dateOutOfRange?: string;
315
+ invalidExpiryDate?: string;
316
+ invalidCardType?: string;
317
+ emptyCVC?: string;
318
+ invalidCVC?: string;
319
+ };
320
+ style?: CardInputStyle;
321
+ innerStyle?: CardInputStyle;
322
+ };
323
+ //#endregion
324
+ //#region src/card-input/index.d.ts
325
+ declare const createToken: (component?: any, options?: any) => Promise<{
326
+ token?: string;
327
+ error?: string;
328
+ }>;
329
+ declare const CardInput: BridgeComponentConstructor<CardInputProps>;
330
+ //#endregion
331
+ //#region src/paypal/types.d.ts
332
+ interface PayPalProps {
333
+ accountId?: string;
334
+ sessionId?: string;
335
+ paymentId?: string;
336
+ amount?: number;
337
+ currency?: string;
338
+ language?: string;
339
+ transactionType?: TransactionType;
340
+ cspNonce?: string;
341
+ onError?: (error: any) => void;
342
+ onProps?: (cb: (props: PayPalProps) => void) => void;
343
+ onSubmit: (data: {
344
+ token?: string;
345
+ error?: string;
346
+ }) => void;
347
+ onBeforeOpen?: () => boolean;
348
+ onLoad?: (isSupported: boolean) => void;
349
+ borderRadius?: number | string;
350
+ style?: {
351
+ height?: number | string;
352
+ color?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
353
+ layout?: 'horizontal' | 'vertical';
354
+ size?: 'small' | 'medium' | 'large' | 'responsive';
355
+ shape?: 'pill' | 'rect';
356
+ label?: 'checkout' | 'credit' | 'pay' | 'buynow' | 'paypal' | 'installment';
357
+ borderRadius?: number | string;
358
+ };
359
+ }
360
+ //#endregion
361
+ //#region src/paypal/index.d.ts
362
+ declare const PayPal: BridgeComponentConstructor<PayPalProps>;
363
+ //#endregion
364
+ //#region src/bizum/types.d.ts
365
+ interface BizumProps {
366
+ accountId?: string;
367
+ sessionId?: string;
368
+ paymentId?: string;
369
+ phoneNumber?: string;
370
+ amount?: number;
371
+ currency?: string;
372
+ transactionType?: TransactionType;
373
+ fullscreen?: boolean;
374
+ language?: string;
375
+ onError?: (error: any) => void;
376
+ onProps?: (cb: (props: BizumProps) => void) => Promise<void>;
377
+ onSubmit: (data: {
378
+ token?: string;
379
+ error?: string;
380
+ }) => void;
381
+ onLoad?: (isSupported: boolean) => void;
382
+ onBeforeOpen?: () => boolean;
383
+ onOpen?: () => void;
384
+ style?: {
385
+ height?: string | number;
386
+ type?: 'pay' | 'plain';
387
+ borderRadius?: number | string;
388
+ fontFamily?: string;
389
+ };
390
+ }
391
+ interface BizumModalProps extends BizumProps {
392
+ isOpen?: boolean;
393
+ isHidden?: boolean;
394
+ onError?: (error: any) => void;
395
+ onBeforeClose?: () => void;
396
+ }
397
+ //#endregion
398
+ //#region src/bizum/modal.d.ts
399
+ declare const BizumModal: BridgeComponentConstructor<BizumModalProps>;
400
+ //#endregion
401
+ //#region src/bizum/index.d.ts
402
+ declare const Bizum: BridgeComponentConstructor<BizumProps>;
403
+ //#endregion
404
+ //#region src/google-pay/types.d.ts
405
+ interface GooglePayProps {
406
+ accountId?: string;
407
+ sessionId?: string;
408
+ paymentId?: string;
409
+ amount?: number;
410
+ currency?: string;
411
+ language?: string;
412
+ onError?: (error: any) => void;
413
+ onProps?: (cb: (props: GooglePayProps) => void) => void;
414
+ onSubmit: (data: {
415
+ token?: string;
416
+ error?: string;
417
+ }) => void;
418
+ onBeforeSubmit: () => void;
419
+ onLoad?: (isSupported: boolean) => void;
420
+ style?: {
421
+ height?: number;
422
+ color?: 'default' | 'black' | 'white';
423
+ type?: 'buy' | 'plain' | 'donate';
424
+ };
425
+ }
426
+ //#endregion
427
+ //#region src/google-pay/index.d.ts
428
+ declare const GooglePay: BridgeComponentConstructor<GooglePayProps>;
429
+ //#endregion
430
+ //#region src/payment-request/types.d.ts
431
+ interface PaymentRequestProps {
432
+ accountId?: string;
433
+ sessionId?: string;
434
+ paymentId?: string;
435
+ amount?: number;
436
+ currency?: string;
437
+ language?: string;
438
+ onError?: (error: any) => void;
439
+ onProps?: (cb: (props: PaymentRequestProps) => void) => void;
440
+ onBeforeOpen?: () => boolean;
441
+ onSubmit: (data: {
442
+ token?: string;
443
+ error?: string;
444
+ }) => void;
445
+ onBeforeSubmit?: () => void;
446
+ onLoad?: (isSupported: boolean) => void;
447
+ style?: {
448
+ height?: string | number;
449
+ color?: 'default' | 'black' | 'white';
450
+ type?: 'buy' | 'plain' | 'donate';
451
+ borderRadius?: number | string;
452
+ fontFamily?: string;
453
+ };
454
+ }
455
+ //#endregion
456
+ //#region src/payment-request/index.d.ts
457
+ declare const PaymentRequest: BridgeComponentConstructor<PaymentRequestProps>;
458
+ //#endregion
459
+ //#region src/config.d.ts
460
+ type Config = {
461
+ version: string;
462
+ domain: string;
463
+ stage: string;
464
+ rootDomain: string;
465
+ isProduction: boolean;
466
+ paymentPageUrl: string;
467
+ cardInputUrl: string;
468
+ paymentModalUrl: string;
469
+ bizumUrl: string;
470
+ bizumButtonUrl: string;
471
+ paypalUrl: string;
472
+ apiUrl: string;
473
+ paymentRequestUrl: string;
474
+ secureDomain: string;
475
+ };
476
+ declare const config: Config;
477
+ //#endregion
478
+ //#region src/bridge/types.d.ts
479
+ type Cancelable = {
480
+ cancel: () => void;
481
+ };
482
+ type EventEmitterType = {
483
+ on: (eventName: string, handler: (...args: any[]) => void) => Cancelable;
484
+ once: (eventName: string, handler: (...args: any[]) => void) => Cancelable;
485
+ trigger: (eventName: string, ...args: any[]) => void;
486
+ off: (eventName: string, handler: (...args: any[]) => void) => void;
487
+ destroy: () => void;
488
+ };
489
+ interface BridgeComponent<P> {
490
+ render: (container?: string | HTMLElement) => Promise<void>;
491
+ updateProps: (props: Partial<P>) => Promise<void>;
492
+ close: () => Promise<void>;
493
+ destroy: () => Promise<void>;
494
+ submit?: (options?: any) => Promise<any>;
495
+ state: Record<string, any>;
496
+ event: EventEmitterType;
497
+ props: P;
498
+ driver: (name: string, deps?: Record<string, any>) => any;
499
+ }
500
+ interface BridgeComponentConstructor<P> {
501
+ new (props: P): BridgeComponent<P>;
502
+ driver: (name: string, deps?: Record<string, any>) => any;
503
+ }
504
+ //#endregion
505
+ //#region src/framework-types.d.ts
506
+ /** Public CardInput props — excludes internal bridge props */
507
+ type CardInputComponentProps = Omit<CardInputProps, 'ref' | 'onProps' | 'innerStyle' | 'orderId'>;
508
+ /** Public Bizum props — excludes internal bridge props */
509
+ type BizumComponentProps = Omit<BizumProps, 'onProps'>;
510
+ /** Public PayPal props — excludes internal bridge props */
511
+ type PayPalComponentProps = Omit<PayPalProps, 'onProps'>;
512
+ /** Public PaymentRequest props — excludes internal bridge props */
513
+ type PaymentRequestComponentProps = Omit<PaymentRequestProps, 'onProps'>;
514
+ /** Imperative handle for CardInput ref (framework packages) */
515
+ type CardInputHandle = {
516
+ submit(options?: any): Promise<{
517
+ token?: string;
518
+ error?: string;
519
+ }>;
520
+ };
521
+ //#endregion
522
+ //#region src/index.d.ts
523
+ declare const api: typeof api_d_exports;
524
+ declare const utils: typeof utils_d_exports;
525
+ //#endregion
526
+ export { Address, BillingDetails, Bizum, BizumComponentProps, BizumModal, BizumModalProps, BizumProps, type BridgeComponent, type BridgeComponentConstructor, CardBrand, CardInput, CardInputComponentProps, CardInputHandle, CardInputOnChangeEvent, CardInputProps, CardInputStyle, ConfirmPaymentParams, CreateApplePaySessionRequest, CreatePaymentRequest, CreateTokenRequest, CreateTokenResponse, Customer, GetPaymentMethodsRequest, GetPaymentMethodsResponse, GooglePay, GooglePayProps, NextActionType, PayPal, PayPalComponentProps, PayPalProps, PaymentMethod, PaymentModal, PaymentModalProps, PaymentRequest, PaymentRequestComponentProps, PaymentRequestProps, PaymentResult, SendPaymentReceiptRequest, TransactionType, ValidateBizumPhoneRequest, api, config, confirmPayment, createToken, utils };