@cardql/react-native
Version:
CardQL SDK for React Native applications with mobile-optimized features
1,085 lines (1,075 loc) • 29.3 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
// src/index.ts
export * from "@cardql/core";
// src/context.tsx
import React, {
createContext,
useContext,
useMemo,
useEffect
} from "react";
import { CardQL } from "@cardql/core";
// src/storage.ts
var MockStorage = class {
data = /* @__PURE__ */ new Map();
async getItem(key) {
return this.data.get(key) || null;
}
async setItem(key, value) {
this.data.set(key, value);
}
async removeItem(key) {
this.data.delete(key);
}
async clear() {
this.data.clear();
}
};
var storage = new MockStorage();
var createStorageKey = (prefix, key) => {
return `${prefix}:${key}`;
};
var isStorageAvailable = () => {
try {
return typeof storage !== "undefined";
} catch {
return false;
}
};
// src/context.tsx
import { jsx } from "react/jsx-runtime";
var CardQLContext = createContext(void 0);
function CardQLProvider({
config,
children,
enableOfflineMode = false,
enableSecureStorage = true,
apiKeyStorageKey = "cardql_api_key"
}) {
const [isOnline, setIsOnline] = React.useState(true);
const [finalConfig, setFinalConfig] = React.useState(config);
useEffect(() => {
const initializeConfig = async () => {
if (enableSecureStorage && !config.apiKey) {
try {
const storedApiKey = await storage.getItem(apiKeyStorageKey);
if (storedApiKey) {
setFinalConfig((prev) => ({ ...prev, apiKey: storedApiKey }));
}
} catch (error) {
console.warn("Failed to retrieve stored API key:", error);
}
}
};
initializeConfig();
}, [config.apiKey, enableSecureStorage, apiKeyStorageKey]);
const cardql = useMemo(() => new CardQL(finalConfig), [finalConfig]);
const updateApiKey = async (apiKey) => {
setFinalConfig((prev) => ({ ...prev, apiKey }));
cardql.setApiKey(apiKey);
if (enableSecureStorage) {
try {
await storage.setItem(apiKeyStorageKey, apiKey);
} catch (error) {
console.warn("Failed to store API key:", error);
}
}
};
const clearStoredData = async () => {
if (enableSecureStorage) {
try {
await storage.removeItem(apiKeyStorageKey);
} catch (error) {
console.warn("Failed to clear stored data:", error);
}
}
};
const value = useMemo(
() => ({
cardql,
config: finalConfig,
isOnline,
enableOfflineMode,
updateApiKey,
clearStoredData
}),
[
cardql,
finalConfig,
isOnline,
enableOfflineMode,
updateApiKey,
clearStoredData
]
);
return /* @__PURE__ */ jsx(CardQLContext.Provider, { value, children });
}
function useCardQL() {
const context = useContext(CardQLContext);
if (context === void 0) {
throw new Error("useCardQL must be used within a CardQLProvider");
}
return context;
}
function useCardQLClient() {
const { cardql } = useCardQL();
return cardql;
}
function useCardQLApi() {
const { cardql } = useCardQL();
return cardql.api;
}
// src/hooks/useNetworkStatus.ts
import { useState, useEffect as useEffect2 } from "react";
function useNetworkStatus() {
const [networkStatus, setNetworkStatus] = useState({
isConnected: true,
type: "wifi",
isWifiEnabled: true,
isInternetReachable: true
});
useEffect2(() => {
return () => {
};
}, []);
return networkStatus;
}
function useIsOnline() {
const { isConnected } = useNetworkStatus();
return isConnected;
}
function useIsOffline() {
const { isConnected } = useNetworkStatus();
return !isConnected;
}
function useNetworkType() {
const { type } = useNetworkStatus();
return type;
}
// src/hooks/useOfflineQueue.ts
import { useState as useState2, useEffect as useEffect3, useCallback } from "react";
var STORAGE_KEY = "cardql_offline_queue";
function useOfflineQueue(options = {}) {
const {
maxRetries = 3,
retryDelay = 1e3,
storageKey = STORAGE_KEY
} = options;
const cardql = useCardQLClient();
const isOnline = useIsOnline();
const [queue, setQueue] = useState2([]);
const [isProcessing, setIsProcessing] = useState2(false);
useEffect3(() => {
const loadQueue = async () => {
try {
const storedQueue = await storage.getItem(storageKey);
if (storedQueue) {
setQueue(JSON.parse(storedQueue));
}
} catch (error) {
console.warn("Failed to load offline queue:", error);
}
};
loadQueue();
}, [storageKey]);
useEffect3(() => {
const saveQueue = async () => {
try {
await storage.setItem(storageKey, JSON.stringify(queue));
} catch (error) {
console.warn("Failed to save offline queue:", error);
}
};
saveQueue();
}, [queue, storageKey]);
useEffect3(() => {
if (isOnline && queue.length > 0 && !isProcessing) {
processQueue();
}
}, [isOnline, queue.length, isProcessing]);
const addToQueue = useCallback(async (mutation, variables) => {
const operation = {
id: `${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
mutation,
variables,
timestamp: Date.now(),
retryCount: 0
};
setQueue((prev) => [...prev, operation]);
}, []);
const removeFromQueue = useCallback(async (id) => {
setQueue((prev) => prev.filter((op) => op.id !== id));
}, []);
const processQueue = useCallback(async () => {
if (!isOnline || isProcessing || queue.length === 0) {
return;
}
setIsProcessing(true);
const processedIds = [];
for (const operation of queue) {
try {
await cardql.client.request(operation.mutation, operation.variables);
processedIds.push(operation.id);
} catch (error) {
console.warn("Failed to process queued operation:", error);
setQueue(
(prev) => prev.map(
(op) => op.id === operation.id ? { ...op, retryCount: op.retryCount + 1 } : op
)
);
if (operation.retryCount >= maxRetries) {
processedIds.push(operation.id);
console.warn("Max retries exceeded for operation:", operation.id);
}
await new Promise((resolve) => setTimeout(resolve, retryDelay));
}
}
if (processedIds.length > 0) {
setQueue((prev) => prev.filter((op) => !processedIds.includes(op.id)));
}
setIsProcessing(false);
}, [isOnline, isProcessing, queue, cardql, maxRetries, retryDelay]);
const clearQueue = useCallback(async () => {
setQueue([]);
try {
await storage.removeItem(storageKey);
} catch (error) {
console.warn("Failed to clear queue storage:", error);
}
}, [storageKey]);
return {
queue,
addToQueue,
processQueue,
clearQueue,
removeFromQueue,
isProcessing
};
}
// src/components/PaymentSheet.tsx
import { useState as useState4 } from "react";
import {
Modal,
View,
Text,
TextInput,
TouchableOpacity,
StyleSheet,
Alert,
ActivityIndicator,
ScrollView
} from "react-native";
// ../react/dist/index.mjs
var dist_exports = {};
__export(dist_exports, {
CardQLProvider: () => CardQLProvider2,
PaymentForm: () => PaymentForm,
useAccount: () => useAccount,
useAccounts: () => useAccounts,
useApp: () => useApp,
useApps: () => useApps,
useCardQL: () => useCardQL2,
useCardQLApi: () => useCardQLApi2,
useCardQLClient: () => useCardQLClient2,
useCreateAccount: () => useCreateAccount,
useCreateApp: () => useCreateApp,
useCreateCustomer: () => useCreateCustomer,
useCreateLedger: () => useCreateLedger,
useCreateMerchant: () => useCreateMerchant,
useCreatePayment: () => useCreatePayment,
useCustomer: () => useCustomer,
useCustomers: () => useCustomers,
useDeleteAccount: () => useDeleteAccount,
useDeleteApp: () => useDeleteApp,
useDeleteCustomer: () => useDeleteCustomer,
useDeleteLedger: () => useDeleteLedger,
useDeleteMerchant: () => useDeleteMerchant,
useDeletePayment: () => useDeletePayment,
useLedger: () => useLedger,
useLedgers: () => useLedgers,
useMerchant: () => useMerchant,
useMerchants: () => useMerchants,
useMutation: () => useMutation,
usePayment: () => usePayment,
usePayments: () => usePayments,
useQuery: () => useQuery,
useUpdateAccount: () => useUpdateAccount,
useUpdateApp: () => useUpdateApp,
useUpdateCustomer: () => useUpdateCustomer,
useUpdateLedger: () => useUpdateLedger,
useUpdateMerchant: () => useUpdateMerchant,
useUpdatePayment: () => useUpdatePayment
});
__reExport(dist_exports, core_star);
import * as core_star from "@cardql/core";
import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
import { CardQL as CardQL2 } from "@cardql/core";
import { jsx as jsx2 } from "react/jsx-runtime";
import { useState as useState3, useEffect as useEffect4, useCallback as useCallback2, useRef } from "react";
import { useState as useState22, useCallback as useCallback22 } from "react";
import {
GET_ACCOUNTS,
GET_ACCOUNT,
CREATE_ACCOUNT,
UPDATE_ACCOUNT,
DELETE_ACCOUNT,
GET_APPS,
GET_APP,
CREATE_APP,
UPDATE_APP,
DELETE_APP,
GET_CUSTOMERS,
GET_CUSTOMER,
CREATE_CUSTOMER,
UPDATE_CUSTOMER,
DELETE_CUSTOMER,
GET_MERCHANTS,
GET_MERCHANT,
CREATE_MERCHANT,
UPDATE_MERCHANT,
DELETE_MERCHANT,
GET_PAYMENTS,
GET_PAYMENT,
CREATE_PAYMENT,
UPDATE_PAYMENT,
DELETE_PAYMENT,
GET_LEDGERS,
GET_LEDGER,
CREATE_LEDGER,
UPDATE_LEDGER,
DELETE_LEDGER
} from "@cardql/core";
import { useState as useState32 } from "react";
import { jsx as jsx22, jsxs } from "react/jsx-runtime";
var CardQLContext2 = createContext2(void 0);
function CardQLProvider2({ config, children }) {
const cardql = useMemo2(() => new CardQL2(config), [config]);
const value = useMemo2(
() => ({
cardql,
config
}),
[cardql, config]
);
return /* @__PURE__ */ jsx2(CardQLContext2.Provider, { value, children });
}
function useCardQL2() {
const context = useContext2(CardQLContext2);
if (context === void 0) {
throw new Error("useCardQL must be used within a CardQLProvider");
}
return context;
}
function useCardQLClient2() {
const { cardql } = useCardQL2();
return cardql;
}
function useCardQLApi2() {
const { cardql } = useCardQL2();
return cardql.api;
}
function useQuery(query, variables, options = {}) {
const cardql = useCardQLClient2();
const [data, setData] = useState3(void 0);
const [loading, setLoading] = useState3(true);
const [error, setError] = useState3(null);
const {
enabled = true,
refetchOnMount = true,
refetchInterval,
onSuccess,
onError
} = options;
const intervalRef = useRef();
const mountedRef = useRef(true);
const fetchData = useCallback2(async () => {
if (!enabled) return;
setLoading(true);
setError(null);
try {
const result = await cardql.client.requestWithRetry(query, variables);
if (mountedRef.current) {
setData(result);
setLoading(false);
onSuccess?.(result);
}
} catch (err) {
if (mountedRef.current) {
setError(err);
setLoading(false);
onError?.(err);
}
}
}, [cardql, query, variables, enabled, onSuccess, onError]);
const refetch = useCallback2(async () => {
await fetchData();
}, [fetchData]);
const refresh = useCallback2(async () => {
setData(void 0);
await fetchData();
}, [fetchData]);
useEffect4(() => {
if (enabled && refetchOnMount) {
fetchData();
}
}, [enabled, refetchOnMount, fetchData]);
useEffect4(() => {
if (refetchInterval && enabled) {
intervalRef.current = setInterval(fetchData, refetchInterval);
return () => {
if (intervalRef.current) {
clearInterval(intervalRef.current);
}
};
}
}, [refetchInterval, enabled, fetchData]);
useEffect4(() => {
return () => {
mountedRef.current = false;
if (intervalRef.current) {
clearInterval(intervalRef.current);
}
};
}, []);
return {
data,
loading,
error,
refetch,
refresh
};
}
function useMutation(mutation, options = {}) {
const cardql = useCardQLClient2();
const [data, setData] = useState22(void 0);
const [loading, setLoading] = useState22(false);
const [error, setError] = useState22(null);
const { onSuccess, onError, onSettled } = options;
const mutateAsync = useCallback22(
async (variables) => {
setLoading(true);
setError(null);
try {
const result = await cardql.client.requestWithRetry(
mutation,
variables
);
setData(result);
setLoading(false);
onSuccess?.(result, variables);
onSettled?.(result, null, variables);
return result;
} catch (err) {
setError(err);
setLoading(false);
onError?.(err, variables);
onSettled?.(void 0, err, variables);
throw err;
}
},
[cardql, mutation, onSuccess, onError, onSettled]
);
const mutate = useCallback22(
async (variables) => {
try {
return await mutateAsync(variables);
} catch (err) {
return Promise.reject(err);
}
},
[mutateAsync]
);
const reset = useCallback22(() => {
setData(void 0);
setError(null);
setLoading(false);
}, []);
return {
data,
loading,
error,
mutate,
mutateAsync,
reset
};
}
function useAccounts(options) {
return useQuery(GET_ACCOUNTS, void 0, options);
}
function useAccount(accountID, options) {
return useQuery(
GET_ACCOUNT,
{ accountID },
options
);
}
function useCreateAccount(options) {
return useMutation(
CREATE_ACCOUNT,
options
);
}
function useUpdateAccount(options) {
return useMutation(
UPDATE_ACCOUNT,
options
);
}
function useDeleteAccount(options) {
return useMutation(
DELETE_ACCOUNT,
options
);
}
function useApps(options) {
return useQuery(GET_APPS, void 0, options);
}
function useApp(id, options) {
return useQuery(GET_APP, { id }, options);
}
function useCreateApp(options) {
return useMutation(CREATE_APP, options);
}
function useUpdateApp(options) {
return useMutation(UPDATE_APP, options);
}
function useDeleteApp(options) {
return useMutation(
DELETE_APP,
options
);
}
function useCustomers(options) {
return useQuery(GET_CUSTOMERS, void 0, options);
}
function useCustomer(id, options) {
return useQuery(GET_CUSTOMER, { id }, options);
}
function useCreateCustomer(options) {
return useMutation(
CREATE_CUSTOMER,
options
);
}
function useUpdateCustomer(options) {
return useMutation(
UPDATE_CUSTOMER,
options
);
}
function useDeleteCustomer(options) {
return useMutation(
DELETE_CUSTOMER,
options
);
}
function useMerchants(options) {
return useQuery(GET_MERCHANTS, void 0, options);
}
function useMerchant(id, options) {
return useQuery(GET_MERCHANT, { id }, options);
}
function useCreateMerchant(options) {
return useMutation(
CREATE_MERCHANT,
options
);
}
function useUpdateMerchant(options) {
return useMutation(
UPDATE_MERCHANT,
options
);
}
function useDeleteMerchant(options) {
return useMutation(
DELETE_MERCHANT,
options
);
}
function usePayments(options) {
return useQuery(GET_PAYMENTS, void 0, options);
}
function usePayment(id, options) {
return useQuery(GET_PAYMENT, { id }, options);
}
function useCreatePayment(options) {
return useMutation(
CREATE_PAYMENT,
options
);
}
function useUpdatePayment(options) {
return useMutation(
UPDATE_PAYMENT,
options
);
}
function useDeletePayment(options) {
return useMutation(
DELETE_PAYMENT,
options
);
}
function useLedgers(options) {
return useQuery(GET_LEDGERS, void 0, options);
}
function useLedger(id, options) {
return useQuery(GET_LEDGER, { id }, options);
}
function useCreateLedger(options) {
return useMutation(
CREATE_LEDGER,
options
);
}
function useUpdateLedger(options) {
return useMutation(
UPDATE_LEDGER,
options
);
}
function useDeleteLedger(options) {
return useMutation(
DELETE_LEDGER,
options
);
}
function PaymentForm({
merchantID,
userID,
onSuccess,
onError,
className = "",
disabled = false
}) {
const [formData, setFormData] = useState32({
amount: "",
currency: "USD",
description: ""
});
const createPayment = useCreatePayment({
onSuccess: (data) => {
onSuccess?.(data.createPayment);
setFormData({
amount: "",
currency: "USD",
description: ""
});
},
onError: (error) => {
onError?.(error);
}
});
const handleSubmit = async (e) => {
e.preventDefault();
if (!formData.amount || !formData.currency) {
onError?.(new Error("Amount and currency are required"));
return;
}
const paymentInput = {
amount: formData.amount,
currency: formData.currency,
merchantID,
userID,
description: formData.description || void 0
};
try {
await createPayment.mutateAsync(paymentInput);
} catch (error) {
}
};
const handleInputChange = (field, value) => {
setFormData((prev) => ({
...prev,
[field]: value
}));
};
return /* @__PURE__ */ jsxs(
"form",
{
onSubmit: handleSubmit,
className: `cardql-payment-form ${className}`,
children: [
/* @__PURE__ */ jsxs("div", { className: "cardql-form-field", children: [
/* @__PURE__ */ jsx22("label", { htmlFor: "amount", children: "Amount" }),
/* @__PURE__ */ jsx22(
"input",
{
id: "amount",
type: "number",
step: "0.01",
min: "0",
value: formData.amount,
onChange: (e) => handleInputChange("amount", e.target.value),
placeholder: "0.00",
required: true,
disabled: disabled || createPayment.loading
}
)
] }),
/* @__PURE__ */ jsxs("div", { className: "cardql-form-field", children: [
/* @__PURE__ */ jsx22("label", { htmlFor: "currency", children: "Currency" }),
/* @__PURE__ */ jsxs(
"select",
{
id: "currency",
value: formData.currency,
onChange: (e) => handleInputChange("currency", e.target.value),
required: true,
disabled: disabled || createPayment.loading,
children: [
/* @__PURE__ */ jsx22("option", { value: "USD", children: "USD" }),
/* @__PURE__ */ jsx22("option", { value: "EUR", children: "EUR" }),
/* @__PURE__ */ jsx22("option", { value: "GBP", children: "GBP" }),
/* @__PURE__ */ jsx22("option", { value: "CAD", children: "CAD" }),
/* @__PURE__ */ jsx22("option", { value: "AUD", children: "AUD" }),
/* @__PURE__ */ jsx22("option", { value: "JPY", children: "JPY" })
]
}
)
] }),
/* @__PURE__ */ jsxs("div", { className: "cardql-form-field", children: [
/* @__PURE__ */ jsx22("label", { htmlFor: "description", children: "Description (Optional)" }),
/* @__PURE__ */ jsx22(
"input",
{
id: "description",
type: "text",
value: formData.description,
onChange: (e) => handleInputChange("description", e.target.value),
placeholder: "Payment description",
disabled: disabled || createPayment.loading
}
)
] }),
createPayment.error && /* @__PURE__ */ jsxs("div", { className: "cardql-error", children: [
"Error: ",
createPayment.error.message
] }),
/* @__PURE__ */ jsx22(
"button",
{
type: "submit",
disabled: disabled || createPayment.loading || !formData.amount || !formData.currency,
className: "cardql-submit-button",
children: createPayment.loading ? "Processing..." : "Create Payment"
}
)
]
}
);
}
// src/components/PaymentSheet.tsx
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
function PaymentSheet({
visible,
onClose,
merchantID,
userID,
onSuccess,
onError,
defaultAmount = "",
defaultCurrency = "USD",
defaultDescription = "",
style,
headerStyle,
inputStyle,
buttonStyle,
buttonTextStyle
}) {
const [formData, setFormData] = useState4({
amount: defaultAmount,
currency: defaultCurrency,
description: defaultDescription
});
const createPayment = useCreatePayment({
onSuccess: (data) => {
onSuccess?.(data.createPayment);
onClose();
setFormData({
amount: defaultAmount,
currency: defaultCurrency,
description: defaultDescription
});
},
onError: (error) => {
onError?.(error);
Alert.alert(
"Payment Failed",
error.message || "An error occurred while processing your payment. Please try again.",
[{ text: "OK" }]
);
}
});
const handleSubmit = async () => {
if (!formData.amount || !formData.currency) {
Alert.alert("Missing Information", "Amount and currency are required.");
return;
}
const paymentInput = {
amount: formData.amount,
currency: formData.currency,
merchantID,
userID,
description: formData.description || void 0
};
try {
await createPayment.mutateAsync(paymentInput);
} catch (error) {
}
};
const updateField = (field, value) => {
setFormData((prev) => ({ ...prev, [field]: value }));
};
const currencies = ["USD", "EUR", "GBP", "CAD", "AUD", "JPY"];
return /* @__PURE__ */ jsx3(
Modal,
{
visible,
animationType: "slide",
presentationStyle: "pageSheet",
onRequestClose: onClose,
children: /* @__PURE__ */ jsxs2(View, { style: [styles.container, style], children: [
/* @__PURE__ */ jsxs2(View, { style: [styles.header, headerStyle], children: [
/* @__PURE__ */ jsx3(Text, { style: styles.title, children: "Payment" }),
/* @__PURE__ */ jsx3(TouchableOpacity, { onPress: onClose, style: styles.closeButton, children: /* @__PURE__ */ jsx3(Text, { style: styles.closeButtonText, children: "\u2715" }) })
] }),
/* @__PURE__ */ jsx3(ScrollView, { style: styles.content, showsVerticalScrollIndicator: false, children: /* @__PURE__ */ jsxs2(View, { style: styles.form, children: [
/* @__PURE__ */ jsxs2(View, { style: styles.field, children: [
/* @__PURE__ */ jsx3(Text, { style: styles.label, children: "Amount" }),
/* @__PURE__ */ jsx3(
TextInput,
{
style: [styles.input, inputStyle],
value: formData.amount,
onChangeText: (value) => updateField("amount", value),
placeholder: "0.00",
keyboardType: "decimal-pad",
editable: !createPayment.loading
}
)
] }),
/* @__PURE__ */ jsxs2(View, { style: styles.field, children: [
/* @__PURE__ */ jsx3(Text, { style: styles.label, children: "Currency" }),
/* @__PURE__ */ jsx3(
ScrollView,
{
horizontal: true,
showsHorizontalScrollIndicator: false,
style: styles.currencyContainer,
children: currencies.map((currency) => /* @__PURE__ */ jsx3(
TouchableOpacity,
{
style: [
styles.currencyButton,
formData.currency === currency && styles.currencyButtonActive
],
onPress: () => updateField("currency", currency),
disabled: createPayment.loading,
children: /* @__PURE__ */ jsx3(
Text,
{
style: [
styles.currencyButtonText,
formData.currency === currency && styles.currencyButtonTextActive
],
children: currency
}
)
},
currency
))
}
)
] }),
/* @__PURE__ */ jsxs2(View, { style: styles.field, children: [
/* @__PURE__ */ jsx3(Text, { style: styles.label, children: "Description (Optional)" }),
/* @__PURE__ */ jsx3(
TextInput,
{
style: [styles.input, inputStyle],
value: formData.description,
onChangeText: (value) => updateField("description", value),
placeholder: "Payment description",
multiline: true,
numberOfLines: 2,
editable: !createPayment.loading
}
)
] })
] }) }),
/* @__PURE__ */ jsx3(View, { style: styles.footer, children: /* @__PURE__ */ jsx3(
TouchableOpacity,
{
style: [
styles.submitButton,
buttonStyle,
(!formData.amount || !formData.currency || createPayment.loading) && styles.submitButtonDisabled
],
onPress: handleSubmit,
disabled: !formData.amount || !formData.currency || createPayment.loading,
children: createPayment.loading ? /* @__PURE__ */ jsx3(ActivityIndicator, { color: "#fff" }) : /* @__PURE__ */ jsx3(Text, { style: [styles.submitButtonText, buttonTextStyle], children: "Create Payment" })
}
) })
] })
}
);
}
var styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff"
},
header: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
paddingHorizontal: 20,
paddingVertical: 16,
borderBottomWidth: 1,
borderBottomColor: "#e0e0e0"
},
title: {
fontSize: 18,
fontWeight: "600",
color: "#000"
},
closeButton: {
padding: 8
},
closeButtonText: {
fontSize: 18,
color: "#666"
},
content: {
flex: 1
},
form: {
padding: 20
},
field: {
marginBottom: 20
},
label: {
fontSize: 16,
fontWeight: "500",
color: "#333",
marginBottom: 8
},
input: {
borderWidth: 1,
borderColor: "#ddd",
borderRadius: 8,
paddingHorizontal: 16,
paddingVertical: 12,
fontSize: 16,
backgroundColor: "#fff"
},
currencyContainer: {
flexDirection: "row"
},
currencyButton: {
paddingHorizontal: 16,
paddingVertical: 8,
marginRight: 8,
borderWidth: 1,
borderColor: "#ddd",
borderRadius: 6,
backgroundColor: "#fff"
},
currencyButtonActive: {
backgroundColor: "#007bff",
borderColor: "#007bff"
},
currencyButtonText: {
fontSize: 14,
color: "#333",
fontWeight: "500"
},
currencyButtonTextActive: {
color: "#fff"
},
footer: {
padding: 20,
borderTopWidth: 1,
borderTopColor: "#e0e0e0"
},
submitButton: {
backgroundColor: "#007bff",
paddingVertical: 16,
borderRadius: 8,
alignItems: "center"
},
submitButtonDisabled: {
backgroundColor: "#ccc"
},
submitButtonText: {
color: "#fff",
fontSize: 16,
fontWeight: "600"
}
});
export {
CardQLProvider,
PaymentSheet,
createStorageKey,
isStorageAvailable,
storage,
useAccount,
useAccounts,
useApp,
useApps,
useCardQL,
useCardQLApi,
useCardQLClient,
useCreateAccount,
useCreateApp,
useCreateCustomer,
useCreateLedger,
useCreateMerchant,
useCreatePayment,
useCustomer,
useCustomers,
useDeleteAccount,
useDeleteApp,
useDeleteCustomer,
useDeleteLedger,
useDeleteMerchant,
useDeletePayment,
useIsOffline,
useIsOnline,
useLedger,
useLedgers,
useMerchant,
useMerchants,
useMutation,
useNetworkStatus,
useNetworkType,
useOfflineQueue,
usePayment,
usePayments,
useQuery,
useUpdateAccount,
useUpdateApp,
useUpdateCustomer,
useUpdateLedger,
useUpdateMerchant,
useUpdatePayment
};