@monei-js/components 1.7.9 → 2.0.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 +72 -9
  2. package/dist/chunk.js +13 -0
  3. package/dist/index.cjs +1623 -0
  4. package/dist/index.d.cts +510 -0
  5. package/dist/index.d.ts +508 -14
  6. package/dist/index.js +1596 -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 +41 -65
  10. package/src/bridge/types.ts +102 -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 -18927
  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 -18909
  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,508 @@
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/bridge/types.d.ts
206
+ type Cancelable = {
207
+ cancel: () => void;
208
+ };
209
+ type EventEmitterType = {
210
+ on: (eventName: string, handler: (...args: any[]) => void) => Cancelable;
211
+ once: (eventName: string, handler: (...args: any[]) => void) => Cancelable;
212
+ trigger: (eventName: string, ...args: any[]) => void;
213
+ off: (eventName: string, handler: (...args: any[]) => void) => void;
214
+ destroy: () => void;
215
+ };
216
+ interface BridgeComponent<P> {
217
+ render: (container?: string | HTMLElement) => Promise<void>;
218
+ updateProps: (props: Partial<P>) => Promise<void>;
219
+ close: () => Promise<void>;
220
+ destroy: () => Promise<void>;
221
+ state: Record<string, any>;
222
+ event: EventEmitterType;
223
+ props: P;
224
+ driver: (name: string, deps?: Record<string, any>) => any;
225
+ }
226
+ interface BridgeComponentConstructor<P> {
227
+ new (props: P): BridgeComponent<P>;
228
+ driver: (name: string, deps?: Record<string, any>) => any;
229
+ }
230
+ //#endregion
231
+ //#region src/payment-modal/types.d.ts
232
+ type Style = {
233
+ width: string;
234
+ height: string;
235
+ };
236
+ interface ConfirmPaymentParams {
237
+ paymentId: string;
238
+ paymentToken?: string;
239
+ generatePaymentToken?: boolean;
240
+ fullscreen?: boolean;
241
+ language?: string;
242
+ paymentMethod?: PaymentMethod;
243
+ allowedPaymentMethods?: string[];
244
+ customDomain?: string;
245
+ customer?: Customer;
246
+ style?: Style;
247
+ billingDetails?: BillingDetails;
248
+ shippingDetails?: BillingDetails;
249
+ }
250
+ interface PaymentModalProps extends ConfirmPaymentParams {
251
+ isOpen: boolean;
252
+ onError?: (error: any) => void;
253
+ onProps?: (cb: (props: PaymentModalProps) => void) => Promise<void>;
254
+ onResult: (result: PaymentResult) => void;
255
+ onLoad?: () => void;
256
+ onOpen?: () => void;
257
+ }
258
+ //#endregion
259
+ //#region src/payment-modal/index.d.ts
260
+ declare const PaymentModal: BridgeComponentConstructor<PaymentModalProps>;
261
+ declare const confirmPayment: (params: ConfirmPaymentParams) => Promise<PaymentResult>;
262
+ declare namespace api_d_exports {
263
+ export { confirmPayment$1 as confirmPayment, createApplePaySession, createPayment, createToken$1 as createToken, getPayment, getPaymentMethods, sendPaymentReceipt, validateBizumPhone };
264
+ }
265
+ declare const getPaymentMethods: ({
266
+ accountId,
267
+ paymentId
268
+ }: GetPaymentMethodsRequest) => Promise<GetPaymentMethodsResponse>;
269
+ declare const createToken$1: ({
270
+ paymentMethod,
271
+ paymentId,
272
+ sessionId,
273
+ amount,
274
+ currency,
275
+ accountId,
276
+ transactionType
277
+ }: CreateTokenRequest) => Promise<CreateTokenResponse>;
278
+ declare const getPayment: (paymentId: string) => Promise<PaymentResult>;
279
+ declare const confirmPayment$1: ({
280
+ paymentId,
281
+ ...body
282
+ }: ConfirmPaymentParams) => Promise<PaymentResult>;
283
+ declare const createPayment: ({
284
+ signature,
285
+ ...body
286
+ }: CreatePaymentRequest) => Promise<PaymentResult>;
287
+ declare const sendPaymentReceipt: ({
288
+ paymentId,
289
+ customerEmail,
290
+ signature,
291
+ language
292
+ }: SendPaymentReceiptRequest) => Promise<PaymentResult>;
293
+ declare const createApplePaySession: (body: CreateApplePaySessionRequest) => Promise<any>;
294
+ declare const validateBizumPhone: (req: ValidateBizumPhoneRequest) => Promise<{
295
+ isValid: boolean;
296
+ }>;
297
+ //#endregion
298
+ //#region src/card-input/types.d.ts
299
+ type CardInputStyle = {
300
+ base?: CSSObject;
301
+ invalid?: CSSObject;
302
+ input?: CSSObject;
303
+ cardNumber?: CSSObject;
304
+ expiryDate?: CSSObject;
305
+ cvc?: CSSObject;
306
+ icon?: CSSObject;
307
+ loading?: CSSObject;
308
+ };
309
+ type CardInputOnChangeEvent = {
310
+ isTouched: boolean;
311
+ isSubmitted: boolean;
312
+ error?: string;
313
+ cardType?: string;
314
+ };
315
+ type CardInputProps = {
316
+ ref?: any;
317
+ accountId?: string;
318
+ orderId?: string;
319
+ sessionId?: string;
320
+ paymentId?: string;
321
+ onError?: (error: any) => void;
322
+ onProps?: (cb: (props: CardInputProps) => void) => void;
323
+ onBlur?: () => void;
324
+ onChange?: (event: CardInputOnChangeEvent) => void;
325
+ onEnter?: () => void;
326
+ onFocus?: () => void;
327
+ onLoad?: () => void;
328
+ language?: string;
329
+ placeholders?: {
330
+ cardNumber?: string;
331
+ expiryDate?: string;
332
+ cvc?: string;
333
+ };
334
+ errorMessages?: {
335
+ emptyCardNumber?: string;
336
+ invalidCardNumber?: string;
337
+ emptyExpiryDate?: string;
338
+ monthOutOfRange?: string;
339
+ yearOutOfRange?: string;
340
+ dateOutOfRange?: string;
341
+ invalidExpiryDate?: string;
342
+ invalidCardType?: string;
343
+ emptyCVC?: string;
344
+ invalidCVC?: string;
345
+ };
346
+ style?: CardInputStyle;
347
+ innerStyle?: CardInputStyle;
348
+ };
349
+ //#endregion
350
+ //#region src/card-input/index.d.ts
351
+ declare const createToken: (component?: any, options?: any) => Promise<{
352
+ token?: string;
353
+ error?: string;
354
+ }>;
355
+ declare const CardInput: BridgeComponentConstructor<CardInputProps>;
356
+ //#endregion
357
+ //#region src/paypal/types.d.ts
358
+ interface PayPalProps {
359
+ accountId?: string;
360
+ sessionId?: string;
361
+ paymentId?: string;
362
+ amount?: number;
363
+ currency?: string;
364
+ language?: string;
365
+ transactionType?: TransactionType;
366
+ cspNonce?: string;
367
+ onError?: (error: any) => void;
368
+ onProps?: (cb: (props: PayPalProps) => void) => void;
369
+ onSubmit: (data: {
370
+ token?: string;
371
+ error?: string;
372
+ }) => void;
373
+ onBeforeOpen?: () => boolean;
374
+ onLoad?: (isSupported: boolean) => void;
375
+ borderRadius?: number | string;
376
+ style?: {
377
+ height?: number | string;
378
+ color?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
379
+ layout?: 'horizontal' | 'vertical';
380
+ size?: 'small' | 'medium' | 'large' | 'responsive';
381
+ shape?: 'pill' | 'rect';
382
+ label?: 'checkout' | 'credit' | 'pay' | 'buynow' | 'paypal' | 'installment';
383
+ borderRadius?: number | string;
384
+ };
385
+ }
386
+ //#endregion
387
+ //#region src/paypal/index.d.ts
388
+ declare const PayPal: BridgeComponentConstructor<PayPalProps>;
389
+ //#endregion
390
+ //#region src/bizum/types.d.ts
391
+ interface BizumProps {
392
+ accountId?: string;
393
+ sessionId?: string;
394
+ paymentId?: string;
395
+ phoneNumber?: string;
396
+ amount?: number;
397
+ currency?: string;
398
+ transactionType?: TransactionType;
399
+ fullscreen?: boolean;
400
+ language?: string;
401
+ onError?: (error: any) => void;
402
+ onProps?: (cb: (props: BizumProps) => void) => Promise<void>;
403
+ onSubmit: (data: {
404
+ token?: string;
405
+ error?: string;
406
+ }) => void;
407
+ onLoad?: (isSupported: boolean) => void;
408
+ onBeforeOpen?: () => boolean;
409
+ onOpen?: () => void;
410
+ style?: {
411
+ height?: string | number;
412
+ type?: 'pay' | 'plain';
413
+ borderRadius?: number | string;
414
+ fontFamily?: string;
415
+ };
416
+ }
417
+ interface BizumModalProps extends BizumProps {
418
+ isOpen?: boolean;
419
+ isHidden?: boolean;
420
+ onError?: (error: any) => void;
421
+ onBeforeClose?: () => void;
422
+ }
423
+ //#endregion
424
+ //#region src/bizum/modal.d.ts
425
+ declare const BizumModal: BridgeComponentConstructor<BizumModalProps>;
426
+ //#endregion
427
+ //#region src/bizum/index.d.ts
428
+ declare const Bizum: BridgeComponentConstructor<BizumProps>;
429
+ //#endregion
430
+ //#region src/google-pay/types.d.ts
431
+ interface GooglePayProps {
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: GooglePayProps) => void) => void;
440
+ onSubmit: (data: {
441
+ token?: string;
442
+ error?: string;
443
+ }) => void;
444
+ onBeforeSubmit: () => void;
445
+ onLoad?: (isSupported: boolean) => void;
446
+ style?: {
447
+ height?: number;
448
+ color?: 'default' | 'black' | 'white';
449
+ type?: 'buy' | 'plain' | 'donate';
450
+ };
451
+ }
452
+ //#endregion
453
+ //#region src/google-pay/index.d.ts
454
+ declare const GooglePay: BridgeComponentConstructor<GooglePayProps>;
455
+ //#endregion
456
+ //#region src/payment-request/types.d.ts
457
+ interface PaymentRequestProps {
458
+ accountId?: string;
459
+ sessionId?: string;
460
+ paymentId?: string;
461
+ amount?: number;
462
+ currency?: string;
463
+ language?: string;
464
+ onError?: (error: any) => void;
465
+ onProps?: (cb: (props: PaymentRequestProps) => void) => void;
466
+ onBeforeOpen?: () => boolean;
467
+ onSubmit: (data: {
468
+ token?: string;
469
+ error?: string;
470
+ }) => void;
471
+ onBeforeSubmit?: () => void;
472
+ onLoad?: (isSupported: boolean) => void;
473
+ style?: {
474
+ height?: string | number;
475
+ color?: 'default' | 'black' | 'white';
476
+ type?: 'buy' | 'plain' | 'donate';
477
+ borderRadius?: number | string;
478
+ fontFamily?: string;
479
+ };
480
+ }
481
+ //#endregion
482
+ //#region src/payment-request/index.d.ts
483
+ declare const PaymentRequest: BridgeComponentConstructor<PaymentRequestProps>;
484
+ //#endregion
485
+ //#region src/config.d.ts
486
+ type Config = {
487
+ version: string;
488
+ domain: string;
489
+ stage: string;
490
+ rootDomain: string;
491
+ isProduction: boolean;
492
+ paymentPageUrl: string;
493
+ cardInputUrl: string;
494
+ paymentModalUrl: string;
495
+ bizumUrl: string;
496
+ bizumButtonUrl: string;
497
+ paypalUrl: string;
498
+ apiUrl: string;
499
+ paymentRequestUrl: string;
500
+ secureDomain: string;
501
+ };
502
+ declare const config: Config;
503
+ //#endregion
504
+ //#region src/index.d.ts
505
+ declare const api: typeof api_d_exports;
506
+ declare const utils: typeof utils_d_exports;
507
+ //#endregion
508
+ export { Address, BillingDetails, Bizum, BizumModal, BizumModalProps, BizumProps, CardBrand, CardInput, CardInputOnChangeEvent, CardInputProps, CardInputStyle, ConfirmPaymentParams, CreateApplePaySessionRequest, CreatePaymentRequest, CreateTokenRequest, CreateTokenResponse, Customer, GetPaymentMethodsRequest, GetPaymentMethodsResponse, GooglePay, GooglePayProps, NextActionType, PayPal, PayPalProps, PaymentMethod, PaymentModal, PaymentModalProps, PaymentRequest, PaymentRequestProps, PaymentResult, SendPaymentReceiptRequest, TransactionType, ValidateBizumPhoneRequest, api, config, confirmPayment, createToken, utils };