@applite/duticotac-react 0.0.1

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.
@@ -0,0 +1,102 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { TransactionModel, DuticotacSDK, PaymentProvider, CoreApp, PlatformType } from '@applite/duticotac';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ interface DuticotacPaymentModalProps {
7
+ open: boolean;
8
+ onClose: () => void;
9
+ onSuccess?: (transaction: TransactionModel) => void;
10
+ /** SDK instance or config to create one. */
11
+ sdk: DuticotacSDK;
12
+ /** Amount in the smallest currency unit. */
13
+ amount: number;
14
+ /** Available payment providers. */
15
+ providers?: PaymentProvider[];
16
+ /** Called to get a unique transaction ID before cashout. */
17
+ getTransactionId: () => Promise<string>;
18
+ /** Product reference for the cashout. */
19
+ productReference?: string;
20
+ /** Pre-fill phone number. */
21
+ initialPhone?: string;
22
+ /** Customer details. */
23
+ name?: string;
24
+ email?: string;
25
+ customerId?: string;
26
+ kolaboReference?: string;
27
+ app?: CoreApp;
28
+ platform?: PlatformType;
29
+ /** Custom success message. */
30
+ successMessage?: string;
31
+ /** Custom title. */
32
+ title?: string;
33
+ /** Polling timeout in ms (default: 90000). */
34
+ pollTimeout?: number;
35
+ /** Additional class names for the modal container. */
36
+ className?: string;
37
+ /**
38
+ * Render prop for the modal wrapper. Receives children and renders them
39
+ * inside your dialog/modal component. If not provided, a simple overlay is used.
40
+ */
41
+ renderModal?: (props: {
42
+ open: boolean;
43
+ onClose: () => void;
44
+ title: string;
45
+ children: React.ReactNode;
46
+ }) => React.ReactNode;
47
+ }
48
+ declare function DuticotacPaymentModal({ open, onClose, onSuccess, sdk, amount, providers, getTransactionId, productReference, initialPhone, name: customerName, email: customerEmail, customerId, kolaboReference, app, platform, successMessage, title, pollTimeout, className, renderModal, }: DuticotacPaymentModalProps): react_jsx_runtime.JSX.Element | null;
49
+
50
+ interface ProviderSelectorProps {
51
+ providers: PaymentProvider[];
52
+ value: PaymentProvider;
53
+ onChange: (provider: PaymentProvider) => void;
54
+ disabled?: boolean;
55
+ className?: string;
56
+ }
57
+ declare function ProviderSelector({ providers, value, onChange, disabled, className, }: ProviderSelectorProps): react_jsx_runtime.JSX.Element;
58
+
59
+ interface PhoneInputProps {
60
+ value: string;
61
+ onChange: (value: string) => void;
62
+ label?: string;
63
+ placeholder?: string;
64
+ error?: string | null;
65
+ disabled?: boolean;
66
+ className?: string;
67
+ autoFocus?: boolean;
68
+ }
69
+ declare function PhoneInput({ value, onChange, label, placeholder, error, disabled, className, autoFocus, }: PhoneInputProps): react_jsx_runtime.JSX.Element;
70
+
71
+ interface OtpInputProps {
72
+ value: string;
73
+ onChange: (value: string) => void;
74
+ length?: number;
75
+ disabled?: boolean;
76
+ className?: string;
77
+ }
78
+ declare function OtpInput({ value, onChange, length, disabled, className, }: OtpInputProps): react_jsx_runtime.JSX.Element;
79
+
80
+ interface TransactionStatusProps {
81
+ status: "polling" | "success" | "error";
82
+ elapsedSeconds?: number;
83
+ message?: string;
84
+ errorMessage?: string;
85
+ paymentUrl?: string | null;
86
+ onRetry?: () => void;
87
+ onClose?: () => void;
88
+ onOpenPaymentUrl?: () => void;
89
+ className?: string;
90
+ }
91
+ declare function TransactionStatus({ status, elapsedSeconds, message, errorMessage, paymentUrl, onRetry, onClose, onOpenPaymentUrl, className, }: TransactionStatusProps): react_jsx_runtime.JSX.Element;
92
+
93
+ declare function cn(...inputs: ClassValue[]): string;
94
+
95
+ declare function formatCFA(n: number): string;
96
+
97
+ declare function getPhoneRegex(provider: PaymentProvider): RegExp;
98
+ declare function validatePhone(phone: string, provider: PaymentProvider): string | null;
99
+ declare function normalizePhone(phone: string): string;
100
+ declare function needsOtp(provider: PaymentProvider): boolean;
101
+
102
+ export { DuticotacPaymentModal, type DuticotacPaymentModalProps, OtpInput, type OtpInputProps, PhoneInput, type PhoneInputProps, ProviderSelector, type ProviderSelectorProps, TransactionStatus, type TransactionStatusProps, cn, formatCFA, getPhoneRegex, needsOtp, normalizePhone, validatePhone };
@@ -0,0 +1,102 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { TransactionModel, DuticotacSDK, PaymentProvider, CoreApp, PlatformType } from '@applite/duticotac';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ interface DuticotacPaymentModalProps {
7
+ open: boolean;
8
+ onClose: () => void;
9
+ onSuccess?: (transaction: TransactionModel) => void;
10
+ /** SDK instance or config to create one. */
11
+ sdk: DuticotacSDK;
12
+ /** Amount in the smallest currency unit. */
13
+ amount: number;
14
+ /** Available payment providers. */
15
+ providers?: PaymentProvider[];
16
+ /** Called to get a unique transaction ID before cashout. */
17
+ getTransactionId: () => Promise<string>;
18
+ /** Product reference for the cashout. */
19
+ productReference?: string;
20
+ /** Pre-fill phone number. */
21
+ initialPhone?: string;
22
+ /** Customer details. */
23
+ name?: string;
24
+ email?: string;
25
+ customerId?: string;
26
+ kolaboReference?: string;
27
+ app?: CoreApp;
28
+ platform?: PlatformType;
29
+ /** Custom success message. */
30
+ successMessage?: string;
31
+ /** Custom title. */
32
+ title?: string;
33
+ /** Polling timeout in ms (default: 90000). */
34
+ pollTimeout?: number;
35
+ /** Additional class names for the modal container. */
36
+ className?: string;
37
+ /**
38
+ * Render prop for the modal wrapper. Receives children and renders them
39
+ * inside your dialog/modal component. If not provided, a simple overlay is used.
40
+ */
41
+ renderModal?: (props: {
42
+ open: boolean;
43
+ onClose: () => void;
44
+ title: string;
45
+ children: React.ReactNode;
46
+ }) => React.ReactNode;
47
+ }
48
+ declare function DuticotacPaymentModal({ open, onClose, onSuccess, sdk, amount, providers, getTransactionId, productReference, initialPhone, name: customerName, email: customerEmail, customerId, kolaboReference, app, platform, successMessage, title, pollTimeout, className, renderModal, }: DuticotacPaymentModalProps): react_jsx_runtime.JSX.Element | null;
49
+
50
+ interface ProviderSelectorProps {
51
+ providers: PaymentProvider[];
52
+ value: PaymentProvider;
53
+ onChange: (provider: PaymentProvider) => void;
54
+ disabled?: boolean;
55
+ className?: string;
56
+ }
57
+ declare function ProviderSelector({ providers, value, onChange, disabled, className, }: ProviderSelectorProps): react_jsx_runtime.JSX.Element;
58
+
59
+ interface PhoneInputProps {
60
+ value: string;
61
+ onChange: (value: string) => void;
62
+ label?: string;
63
+ placeholder?: string;
64
+ error?: string | null;
65
+ disabled?: boolean;
66
+ className?: string;
67
+ autoFocus?: boolean;
68
+ }
69
+ declare function PhoneInput({ value, onChange, label, placeholder, error, disabled, className, autoFocus, }: PhoneInputProps): react_jsx_runtime.JSX.Element;
70
+
71
+ interface OtpInputProps {
72
+ value: string;
73
+ onChange: (value: string) => void;
74
+ length?: number;
75
+ disabled?: boolean;
76
+ className?: string;
77
+ }
78
+ declare function OtpInput({ value, onChange, length, disabled, className, }: OtpInputProps): react_jsx_runtime.JSX.Element;
79
+
80
+ interface TransactionStatusProps {
81
+ status: "polling" | "success" | "error";
82
+ elapsedSeconds?: number;
83
+ message?: string;
84
+ errorMessage?: string;
85
+ paymentUrl?: string | null;
86
+ onRetry?: () => void;
87
+ onClose?: () => void;
88
+ onOpenPaymentUrl?: () => void;
89
+ className?: string;
90
+ }
91
+ declare function TransactionStatus({ status, elapsedSeconds, message, errorMessage, paymentUrl, onRetry, onClose, onOpenPaymentUrl, className, }: TransactionStatusProps): react_jsx_runtime.JSX.Element;
92
+
93
+ declare function cn(...inputs: ClassValue[]): string;
94
+
95
+ declare function formatCFA(n: number): string;
96
+
97
+ declare function getPhoneRegex(provider: PaymentProvider): RegExp;
98
+ declare function validatePhone(phone: string, provider: PaymentProvider): string | null;
99
+ declare function normalizePhone(phone: string): string;
100
+ declare function needsOtp(provider: PaymentProvider): boolean;
101
+
102
+ export { DuticotacPaymentModal, type DuticotacPaymentModalProps, OtpInput, type OtpInputProps, PhoneInput, type PhoneInputProps, ProviderSelector, type ProviderSelectorProps, TransactionStatus, type TransactionStatusProps, cn, formatCFA, getPhoneRegex, needsOtp, normalizePhone, validatePhone };