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