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