@reevit/core 0.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.
@@ -0,0 +1,332 @@
1
+ /**
2
+ * Reevit Core Types
3
+ * Shared type definitions for all Reevit SDKs
4
+ */
5
+ type PaymentMethod = 'card' | 'mobile_money' | 'bank_transfer';
6
+ type MobileMoneyNetwork = 'mtn' | 'vodafone' | 'airteltigo';
7
+ type PSPType = 'paystack' | 'hubtel' | 'flutterwave' | 'stripe' | 'monnify' | 'mpesa';
8
+ interface ReevitCheckoutConfig {
9
+ /** Your Reevit public key (pk_live_xxx or pk_test_xxx) */
10
+ publicKey: string;
11
+ /** Amount in the smallest currency unit (e.g., pesewas for GHS) */
12
+ amount: number;
13
+ /** Currency code (e.g., 'GHS', 'NGN', 'USD') */
14
+ currency: string;
15
+ /** Customer email address */
16
+ email?: string;
17
+ /** Customer phone number (required for mobile money) */
18
+ phone?: string;
19
+ /** Unique reference for this transaction */
20
+ reference?: string;
21
+ /** Additional metadata to attach to the payment */
22
+ metadata?: Record<string, unknown>;
23
+ /** Payment methods to display */
24
+ paymentMethods?: PaymentMethod[];
25
+ }
26
+ interface ReevitCheckoutCallbacks {
27
+ /** Called when payment is successful */
28
+ onSuccess?: (result: PaymentResult) => void;
29
+ /** Called when payment fails */
30
+ onError?: (error: PaymentError) => void;
31
+ /** Called when user closes the checkout */
32
+ onClose?: () => void;
33
+ /** Called when checkout state changes */
34
+ onStateChange?: (state: CheckoutState) => void;
35
+ }
36
+ type CheckoutState = 'idle' | 'loading' | 'ready' | 'method_selected' | 'processing' | 'success' | 'failed' | 'closed';
37
+ interface PaymentResult {
38
+ /** Unique payment ID from Reevit */
39
+ paymentId: string;
40
+ /** Reference provided or generated */
41
+ reference: string;
42
+ /** Amount paid in smallest currency unit */
43
+ amount: number;
44
+ /** Currency code */
45
+ currency: string;
46
+ /** Payment method used */
47
+ paymentMethod: PaymentMethod;
48
+ /** PSP that processed the payment */
49
+ psp: string;
50
+ /** PSP's transaction reference */
51
+ pspReference: string;
52
+ /** Payment status */
53
+ status: 'success' | 'pending';
54
+ /** Any additional data from the PSP */
55
+ metadata?: Record<string, unknown>;
56
+ }
57
+ interface PaymentError {
58
+ /** Error code */
59
+ code: string;
60
+ /** Human-readable error message */
61
+ message: string;
62
+ /** Whether the error is recoverable (user can retry) */
63
+ recoverable?: boolean;
64
+ /** Original error from PSP if available */
65
+ originalError?: unknown;
66
+ /** Additional error details */
67
+ details?: Record<string, unknown>;
68
+ }
69
+ interface ReevitTheme {
70
+ /** Primary brand color */
71
+ primaryColor?: string;
72
+ /** Background color */
73
+ backgroundColor?: string;
74
+ /** Text color */
75
+ textColor?: string;
76
+ /** Border radius for inputs and buttons */
77
+ borderRadius?: string;
78
+ /** Font family to use */
79
+ fontFamily?: string;
80
+ /** Whether to use dark mode */
81
+ darkMode?: boolean;
82
+ }
83
+ interface PSPConfig {
84
+ id: string;
85
+ name: string;
86
+ supportedMethods: PaymentMethod[];
87
+ supportedCurrencies: string[];
88
+ }
89
+ interface MobileMoneyFormData {
90
+ phone: string;
91
+ network: MobileMoneyNetwork;
92
+ }
93
+ interface CardFormData {
94
+ /** Token from PSP's hosted fields */
95
+ token: string;
96
+ /** Last 4 digits for display */
97
+ last4?: string;
98
+ /** Card brand (visa, mastercard, etc.) */
99
+ brand?: string;
100
+ }
101
+ interface PaymentIntent {
102
+ /** Unique payment intent ID */
103
+ id: string;
104
+ /** Client secret for authenticating client-side operations */
105
+ clientSecret: string;
106
+ /** Amount in smallest currency unit */
107
+ amount: number;
108
+ /** Currency code */
109
+ currency: string;
110
+ /** Payment status */
111
+ status: 'pending' | 'processing' | 'succeeded' | 'failed' | 'cancelled';
112
+ /** Recommended PSP based on routing rules */
113
+ recommendedPsp: PSPType;
114
+ /** Available payment methods for this intent */
115
+ availableMethods: PaymentMethod[];
116
+ /** Connection ID (from Reevit backend) */
117
+ connectionId?: string;
118
+ /** Provider name (from backend) */
119
+ provider?: string;
120
+ /** Fee amount charged by PSP */
121
+ feeAmount?: number;
122
+ /** Fee currency */
123
+ feeCurrency?: string;
124
+ /** Net amount after fees */
125
+ netAmount?: number;
126
+ /** Additional metadata */
127
+ metadata?: Record<string, unknown>;
128
+ }
129
+
130
+ /**
131
+ * Reevit API Client
132
+ *
133
+ * Handles communication with the Reevit backend for payment operations.
134
+ */
135
+
136
+ interface CreatePaymentIntentRequest {
137
+ amount: number;
138
+ currency: string;
139
+ method: string;
140
+ country: string;
141
+ customer_id?: string;
142
+ metadata?: Record<string, unknown>;
143
+ description?: string;
144
+ policy?: {
145
+ prefer?: string[];
146
+ max_amount?: number;
147
+ blocked_bins?: string[];
148
+ allowed_bins?: string[];
149
+ velocity_max_per_minute?: number;
150
+ };
151
+ }
152
+ interface PaymentIntentResponse {
153
+ id: string;
154
+ connection_id: string;
155
+ provider: string;
156
+ status: string;
157
+ client_secret: string;
158
+ amount: number;
159
+ currency: string;
160
+ fee_amount: number;
161
+ fee_currency: string;
162
+ net_amount: number;
163
+ }
164
+ interface ConfirmPaymentRequest {
165
+ provider_ref_id: string;
166
+ provider_data?: Record<string, unknown>;
167
+ }
168
+ interface PaymentDetailResponse {
169
+ id: string;
170
+ connection_id: string;
171
+ provider: string;
172
+ method: string;
173
+ status: string;
174
+ amount: number;
175
+ currency: string;
176
+ fee_amount: number;
177
+ fee_currency: string;
178
+ net_amount: number;
179
+ customer_id?: string;
180
+ client_secret: string;
181
+ provider_ref_id?: string;
182
+ metadata?: Record<string, unknown>;
183
+ created_at: string;
184
+ updated_at: string;
185
+ }
186
+ interface APIErrorResponse {
187
+ code: string;
188
+ message: string;
189
+ details?: Record<string, string>;
190
+ }
191
+ interface ReevitAPIClientConfig {
192
+ /** Your Reevit public key */
193
+ publicKey: string;
194
+ /** Base URL for the Reevit API (defaults to production) */
195
+ baseUrl?: string;
196
+ /** Request timeout in milliseconds */
197
+ timeout?: number;
198
+ }
199
+ /**
200
+ * Reevit API Client
201
+ */
202
+ declare class ReevitAPIClient {
203
+ private readonly publicKey;
204
+ private readonly baseUrl;
205
+ private readonly timeout;
206
+ constructor(config: ReevitAPIClientConfig);
207
+ /**
208
+ * Makes an authenticated API request
209
+ */
210
+ private request;
211
+ /**
212
+ * Creates a payment intent
213
+ */
214
+ createPaymentIntent(config: ReevitCheckoutConfig, method: PaymentMethod, country?: string): Promise<{
215
+ data?: PaymentIntentResponse;
216
+ error?: PaymentError;
217
+ }>;
218
+ /**
219
+ * Retrieves a payment intent by ID
220
+ */
221
+ getPaymentIntent(paymentId: string): Promise<{
222
+ data?: PaymentDetailResponse;
223
+ error?: PaymentError;
224
+ }>;
225
+ /**
226
+ * Confirms a payment after PSP callback
227
+ */
228
+ confirmPayment(paymentId: string): Promise<{
229
+ data?: PaymentDetailResponse;
230
+ error?: PaymentError;
231
+ }>;
232
+ /**
233
+ * Cancels a payment intent
234
+ */
235
+ cancelPaymentIntent(paymentId: string): Promise<{
236
+ data?: PaymentDetailResponse;
237
+ error?: PaymentError;
238
+ }>;
239
+ /**
240
+ * Maps SDK payment method to backend format
241
+ */
242
+ private mapPaymentMethod;
243
+ }
244
+ /**
245
+ * Creates a new Reevit API client instance
246
+ */
247
+ declare function createReevitClient(config: ReevitAPIClientConfig): ReevitAPIClient;
248
+
249
+ /**
250
+ * Utility Functions
251
+ * Shared utilities for Reevit SDKs
252
+ */
253
+
254
+ /**
255
+ * Formats an amount from smallest currency unit to display format
256
+ */
257
+ declare function formatAmount(amount: number, currency: string): string;
258
+ /**
259
+ * Generates a unique payment reference
260
+ */
261
+ declare function generateReference(prefix?: string): string;
262
+ /**
263
+ * Validates a phone number for mobile money
264
+ */
265
+ declare function validatePhone(phone: string, country?: string): boolean;
266
+ /**
267
+ * Formats a phone number for display
268
+ */
269
+ declare function formatPhone(phone: string, country?: string): string;
270
+ /**
271
+ * Detects mobile money network from phone number (Ghana)
272
+ */
273
+ declare function detectNetwork(phone: string): MobileMoneyNetwork | null;
274
+ /**
275
+ * Creates CSS custom property variables from theme
276
+ */
277
+ declare function createThemeVariables(theme: ReevitTheme): Record<string, string>;
278
+ /**
279
+ * Simple class name concatenation utility
280
+ */
281
+ declare function cn(...classes: (string | boolean | undefined | null)[]): string;
282
+ /**
283
+ * Detects country code from currency
284
+ */
285
+ declare function detectCountryFromCurrency(currency: string): string;
286
+
287
+ /**
288
+ * Reevit State Machine
289
+ * Shared state management logic for all SDKs
290
+ */
291
+
292
+ interface ReevitState {
293
+ status: CheckoutState;
294
+ paymentIntent: PaymentIntent | null;
295
+ selectedMethod: PaymentMethod | null;
296
+ error: PaymentError | null;
297
+ result: PaymentResult | null;
298
+ }
299
+ type ReevitAction = {
300
+ type: 'INIT_START';
301
+ } | {
302
+ type: 'INIT_SUCCESS';
303
+ payload: PaymentIntent;
304
+ } | {
305
+ type: 'INIT_ERROR';
306
+ payload: PaymentError;
307
+ } | {
308
+ type: 'SELECT_METHOD';
309
+ payload: PaymentMethod;
310
+ } | {
311
+ type: 'PROCESS_START';
312
+ } | {
313
+ type: 'PROCESS_SUCCESS';
314
+ payload: PaymentResult;
315
+ } | {
316
+ type: 'PROCESS_ERROR';
317
+ payload: PaymentError;
318
+ } | {
319
+ type: 'RESET';
320
+ } | {
321
+ type: 'CLOSE';
322
+ };
323
+ /**
324
+ * Creates the initial state for the checkout
325
+ */
326
+ declare function createInitialState(): ReevitState;
327
+ /**
328
+ * State reducer for checkout flow
329
+ */
330
+ declare function reevitReducer(state: ReevitState, action: ReevitAction): ReevitState;
331
+
332
+ export { type APIErrorResponse, type CardFormData, type CheckoutState, type ConfirmPaymentRequest, type CreatePaymentIntentRequest, type MobileMoneyFormData, type MobileMoneyNetwork, type PSPConfig, type PSPType, type PaymentDetailResponse, type PaymentError, type PaymentIntent, type PaymentIntentResponse, type PaymentMethod, type PaymentResult, ReevitAPIClient, type ReevitAPIClientConfig, type ReevitAction, type ReevitCheckoutCallbacks, type ReevitCheckoutConfig, type ReevitState, type ReevitTheme, cn, createInitialState, createReevitClient, createThemeVariables, detectCountryFromCurrency, detectNetwork, formatAmount, formatPhone, generateReference, reevitReducer, validatePhone };
package/dist/index.js ADDED
@@ -0,0 +1,327 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ReevitAPIClient: () => ReevitAPIClient,
24
+ cn: () => cn,
25
+ createInitialState: () => createInitialState,
26
+ createReevitClient: () => createReevitClient,
27
+ createThemeVariables: () => createThemeVariables,
28
+ detectCountryFromCurrency: () => detectCountryFromCurrency,
29
+ detectNetwork: () => detectNetwork,
30
+ formatAmount: () => formatAmount,
31
+ formatPhone: () => formatPhone,
32
+ generateReference: () => generateReference,
33
+ reevitReducer: () => reevitReducer,
34
+ validatePhone: () => validatePhone
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+
38
+ // src/api/client.ts
39
+ var API_BASE_URL_PRODUCTION = "https://api.reevit.io";
40
+ var API_BASE_URL_SANDBOX = "https://sandbox-api.reevit.io";
41
+ var DEFAULT_TIMEOUT = 3e4;
42
+ function isSandboxKey(publicKey) {
43
+ return publicKey.startsWith("pk_test_") || publicKey.startsWith("pk_sandbox_");
44
+ }
45
+ function createPaymentError(response, errorData) {
46
+ return {
47
+ code: errorData.code || "api_error",
48
+ message: errorData.message || "An unexpected error occurred",
49
+ details: {
50
+ httpStatus: response.status,
51
+ ...errorData.details
52
+ }
53
+ };
54
+ }
55
+ var ReevitAPIClient = class {
56
+ constructor(config) {
57
+ this.publicKey = config.publicKey;
58
+ this.baseUrl = config.baseUrl || (isSandboxKey(config.publicKey) ? API_BASE_URL_SANDBOX : API_BASE_URL_PRODUCTION);
59
+ this.timeout = config.timeout || DEFAULT_TIMEOUT;
60
+ }
61
+ /**
62
+ * Makes an authenticated API request
63
+ */
64
+ async request(method, path, body) {
65
+ const controller = new AbortController();
66
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
67
+ try {
68
+ const response = await fetch(`${this.baseUrl}${path}`, {
69
+ method,
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ "Authorization": `Bearer ${this.publicKey}`,
73
+ "X-Reevit-Client": "@reevit/core",
74
+ "X-Reevit-Client-Version": "0.1.0"
75
+ },
76
+ body: body ? JSON.stringify(body) : void 0,
77
+ signal: controller.signal
78
+ });
79
+ clearTimeout(timeoutId);
80
+ const responseData = await response.json().catch(() => ({}));
81
+ if (!response.ok) {
82
+ return {
83
+ error: createPaymentError(response, responseData)
84
+ };
85
+ }
86
+ return { data: responseData };
87
+ } catch (err) {
88
+ clearTimeout(timeoutId);
89
+ if (err instanceof Error) {
90
+ if (err.name === "AbortError") {
91
+ return {
92
+ error: {
93
+ code: "request_timeout",
94
+ message: "The request timed out. Please try again."
95
+ }
96
+ };
97
+ }
98
+ if (err.message.includes("Failed to fetch") || err.message.includes("NetworkError")) {
99
+ return {
100
+ error: {
101
+ code: "network_error",
102
+ message: "Unable to connect to Reevit. Please check your internet connection."
103
+ }
104
+ };
105
+ }
106
+ }
107
+ return {
108
+ error: {
109
+ code: "unknown_error",
110
+ message: "An unexpected error occurred. Please try again."
111
+ }
112
+ };
113
+ }
114
+ }
115
+ /**
116
+ * Creates a payment intent
117
+ */
118
+ async createPaymentIntent(config, method, country = "GH") {
119
+ const request = {
120
+ amount: config.amount,
121
+ currency: config.currency,
122
+ method: this.mapPaymentMethod(method),
123
+ country,
124
+ customer_id: config.metadata?.customerId,
125
+ metadata: config.metadata
126
+ };
127
+ return this.request("POST", "/v1/payments/intents", request);
128
+ }
129
+ /**
130
+ * Retrieves a payment intent by ID
131
+ */
132
+ async getPaymentIntent(paymentId) {
133
+ return this.request("GET", `/v1/payments/${paymentId}`);
134
+ }
135
+ /**
136
+ * Confirms a payment after PSP callback
137
+ */
138
+ async confirmPayment(paymentId) {
139
+ return this.request("POST", `/v1/payments/${paymentId}/confirm`);
140
+ }
141
+ /**
142
+ * Cancels a payment intent
143
+ */
144
+ async cancelPaymentIntent(paymentId) {
145
+ return this.request("POST", `/v1/payments/${paymentId}/cancel`);
146
+ }
147
+ /**
148
+ * Maps SDK payment method to backend format
149
+ */
150
+ mapPaymentMethod(method) {
151
+ switch (method) {
152
+ case "card":
153
+ return "card";
154
+ case "mobile_money":
155
+ return "mobile_money";
156
+ case "bank_transfer":
157
+ return "bank_transfer";
158
+ default:
159
+ return method;
160
+ }
161
+ }
162
+ };
163
+ function createReevitClient(config) {
164
+ return new ReevitAPIClient(config);
165
+ }
166
+
167
+ // src/utils.ts
168
+ function formatAmount(amount, currency) {
169
+ const majorUnit = amount / 100;
170
+ const currencyFormats = {
171
+ GHS: { locale: "en-GH", minimumFractionDigits: 2 },
172
+ NGN: { locale: "en-NG", minimumFractionDigits: 2 },
173
+ KES: { locale: "en-KE", minimumFractionDigits: 2 },
174
+ USD: { locale: "en-US", minimumFractionDigits: 2 },
175
+ EUR: { locale: "de-DE", minimumFractionDigits: 2 },
176
+ GBP: { locale: "en-GB", minimumFractionDigits: 2 }
177
+ };
178
+ const format = currencyFormats[currency.toUpperCase()] || { locale: "en-US", minimumFractionDigits: 2 };
179
+ try {
180
+ return new Intl.NumberFormat(format.locale, {
181
+ style: "currency",
182
+ currency: currency.toUpperCase(),
183
+ minimumFractionDigits: format.minimumFractionDigits
184
+ }).format(majorUnit);
185
+ } catch {
186
+ return `${currency} ${majorUnit.toFixed(2)}`;
187
+ }
188
+ }
189
+ function generateReference(prefix = "reevit") {
190
+ const timestamp = Date.now().toString(36);
191
+ const random = Math.random().toString(36).substring(2, 8);
192
+ return `${prefix}_${timestamp}_${random}`;
193
+ }
194
+ function validatePhone(phone, country = "GH") {
195
+ const digits = phone.replace(/\D/g, "");
196
+ const patterns = {
197
+ GH: /^(?:233|0)?[235][0-9]{8}$/,
198
+ // Ghana
199
+ NG: /^(?:234|0)?[789][01][0-9]{8}$/,
200
+ // Nigeria
201
+ KE: /^(?:254|0)?[17][0-9]{8}$/
202
+ // Kenya
203
+ };
204
+ const pattern = patterns[country.toUpperCase()];
205
+ if (!pattern) return digits.length >= 10;
206
+ return pattern.test(digits);
207
+ }
208
+ function formatPhone(phone, country = "GH") {
209
+ const digits = phone.replace(/\D/g, "");
210
+ if (country === "GH") {
211
+ if (digits.startsWith("233") && digits.length === 12) {
212
+ const local = "0" + digits.slice(3);
213
+ return `${local.slice(0, 3)} ${local.slice(3, 6)} ${local.slice(6)}`;
214
+ }
215
+ if (digits.length === 10 && digits.startsWith("0")) {
216
+ return `${digits.slice(0, 3)} ${digits.slice(3, 6)} ${digits.slice(6)}`;
217
+ }
218
+ }
219
+ return phone;
220
+ }
221
+ function detectNetwork(phone) {
222
+ const digits = phone.replace(/\D/g, "");
223
+ let prefix;
224
+ if (digits.startsWith("233")) {
225
+ prefix = digits.slice(3, 5);
226
+ } else if (digits.startsWith("0")) {
227
+ prefix = digits.slice(1, 3);
228
+ } else {
229
+ prefix = digits.slice(0, 2);
230
+ }
231
+ const mtnPrefixes = ["24", "25", "53", "54", "55", "59"];
232
+ const vodafonePrefixes = ["20", "50"];
233
+ const airteltigoPrefixes = ["26", "27", "56", "57"];
234
+ if (mtnPrefixes.includes(prefix)) return "mtn";
235
+ if (vodafonePrefixes.includes(prefix)) return "vodafone";
236
+ if (airteltigoPrefixes.includes(prefix)) return "airteltigo";
237
+ return null;
238
+ }
239
+ function createThemeVariables(theme) {
240
+ const variables = {};
241
+ if (theme.primaryColor) {
242
+ variables["--reevit-primary"] = theme.primaryColor;
243
+ }
244
+ if (theme.backgroundColor) {
245
+ variables["--reevit-bg"] = theme.backgroundColor;
246
+ }
247
+ if (theme.textColor) {
248
+ variables["--reevit-text"] = theme.textColor;
249
+ }
250
+ if (theme.borderRadius) {
251
+ variables["--reevit-radius"] = theme.borderRadius;
252
+ }
253
+ if (theme.fontFamily) {
254
+ variables["--reevit-font"] = theme.fontFamily;
255
+ }
256
+ return variables;
257
+ }
258
+ function cn(...classes) {
259
+ return classes.filter(Boolean).join(" ");
260
+ }
261
+ function detectCountryFromCurrency(currency) {
262
+ const currencyToCountry = {
263
+ GHS: "GH",
264
+ NGN: "NG",
265
+ KES: "KE",
266
+ UGX: "UG",
267
+ TZS: "TZ",
268
+ ZAR: "ZA",
269
+ XOF: "CI",
270
+ XAF: "CM",
271
+ USD: "US",
272
+ EUR: "DE",
273
+ GBP: "GB"
274
+ };
275
+ return currencyToCountry[currency.toUpperCase()] || "GH";
276
+ }
277
+
278
+ // src/state.ts
279
+ function createInitialState() {
280
+ return {
281
+ status: "idle",
282
+ paymentIntent: null,
283
+ selectedMethod: null,
284
+ error: null,
285
+ result: null
286
+ };
287
+ }
288
+ function reevitReducer(state, action) {
289
+ switch (action.type) {
290
+ case "INIT_START":
291
+ return { ...state, status: "loading", error: null };
292
+ case "INIT_SUCCESS":
293
+ return { ...state, status: "ready", paymentIntent: action.payload };
294
+ case "INIT_ERROR":
295
+ return { ...state, status: "failed", error: action.payload };
296
+ case "SELECT_METHOD":
297
+ return { ...state, status: "method_selected", selectedMethod: action.payload };
298
+ case "PROCESS_START":
299
+ return { ...state, status: "processing", error: null };
300
+ case "PROCESS_SUCCESS":
301
+ return { ...state, status: "success", result: action.payload };
302
+ case "PROCESS_ERROR":
303
+ return { ...state, status: "failed", error: action.payload };
304
+ case "RESET":
305
+ return { ...createInitialState(), status: "ready", paymentIntent: state.paymentIntent };
306
+ case "CLOSE":
307
+ return { ...state, status: "closed" };
308
+ default:
309
+ return state;
310
+ }
311
+ }
312
+ // Annotate the CommonJS export names for ESM import in node:
313
+ 0 && (module.exports = {
314
+ ReevitAPIClient,
315
+ cn,
316
+ createInitialState,
317
+ createReevitClient,
318
+ createThemeVariables,
319
+ detectCountryFromCurrency,
320
+ detectNetwork,
321
+ formatAmount,
322
+ formatPhone,
323
+ generateReference,
324
+ reevitReducer,
325
+ validatePhone
326
+ });
327
+ //# sourceMappingURL=index.js.map