storenest-commerce
Version:
Complete e-commerce SDK for Storenest platform with React components, multi-language support, secure checkout, and enterprise-grade security
137 lines (136 loc) • 5.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CheckoutBoxClient = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
// Localization strings
const translations = {
hr: {
loading: 'Učitavanje sigurnog naplatnog sustava...',
secureCheckout: 'Sigurni naplatni sustav',
shipping: 'Dostava',
payment: 'Plaćanje',
review: 'Pregled',
shippingInformation: 'Informacije o dostavi',
firstName: 'Ime *',
lastName: 'Prezime *',
emailAddress: 'Email adresa *',
address: 'Adresa *',
city: 'Grad *',
zipCode: 'Poštanski broj *',
country: 'Država *',
croatia: 'Hrvatska',
shippingMethod: 'Način dostave',
paymentMethod: 'Način plaćanja',
orderReview: 'Pregled narudžbe',
orderSummary: 'Sažetak narudžbe',
subtotal: 'Međuzbroj',
shippingCost: 'Dostava',
tax: 'Porez',
total: 'Ukupno',
previous: '← Prethodno',
continue: 'Nastavi →',
placeOrder: 'Naruči',
processing: 'Obrađujem...',
secureCheckoutPoweredBy: 'Sigurni naplatni sustav pokretan od Storenest',
paymentInfoEncrypted: 'Vaši podaci o plaćanju su šifrirani i sigurni',
loadingPaymentMethods: 'Učitavanje načina plaćanja...',
notSelected: 'Nije odabrano',
shippingInfo: 'Informacije o dostavi',
paymentInfo: 'Informacije o plaćanju'
},
en: {
loading: 'Loading secure checkout...',
secureCheckout: 'Secure Checkout',
shipping: 'Shipping',
payment: 'Payment',
review: 'Review',
shippingInformation: 'Shipping Information',
firstName: 'First Name *',
lastName: 'Last Name *',
emailAddress: 'Email Address *',
address: 'Address *',
city: 'City *',
zipCode: 'Zip Code *',
country: 'Country *',
croatia: 'Croatia',
shippingMethod: 'Shipping Method',
paymentMethod: 'Payment Method',
orderReview: 'Order Review',
orderSummary: 'Order Summary',
subtotal: 'Subtotal',
shippingCost: 'Shipping',
tax: 'Tax',
total: 'Total',
previous: '← Previous',
continue: 'Continue →',
placeOrder: 'Place Order',
processing: 'Processing...',
secureCheckoutPoweredBy: 'Secure checkout powered by Storenest',
paymentInfoEncrypted: 'Your payment information is encrypted and secure',
loadingPaymentMethods: 'Loading payment methods...',
notSelected: 'Not selected',
shippingInfo: 'Shipping Information',
paymentInfo: 'Payment Method'
},
de: {
loading: 'Sichere Kasse wird geladen...',
secureCheckout: 'Sichere Kasse',
shipping: 'Versand',
payment: 'Zahlung',
review: 'Überprüfung',
shippingInformation: 'Versandinformationen',
firstName: 'Vorname *',
lastName: 'Nachname *',
emailAddress: 'E-Mail-Adresse *',
address: 'Adresse *',
city: 'Stadt *',
zipCode: 'PLZ *',
country: 'Land *',
croatia: 'Kroatien',
shippingMethod: 'Versandart',
paymentMethod: 'Zahlungsart',
orderReview: 'Bestellübersicht',
orderSummary: 'Bestellübersicht',
subtotal: 'Zwischensumme',
shippingCost: 'Versand',
tax: 'Steuer',
total: 'Gesamt',
previous: '← Zurück',
continue: 'Weiter →',
placeOrder: 'Bestellung aufgeben',
processing: 'Wird verarbeitet...',
secureCheckoutPoweredBy: 'Sichere Kasse von Storenest',
paymentInfoEncrypted: 'Ihre Zahlungsinformationen sind verschlüsselt und sicher',
loadingPaymentMethods: 'Zahlungsarten werden geladen...',
notSelected: 'Nicht ausgewählt',
shippingInfo: 'Versandinformationen',
paymentInfo: 'Zahlungsart'
}
};
// Simple loading component for SSR
const LoadingComponent = ({ locale = 'en' }) => {
const t = translations[locale] || translations.en;
return ((0, jsx_runtime_1.jsx)("div", { style: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
minHeight: '400px',
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
borderRadius: '16px',
color: 'white'
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { textAlign: 'center' }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: '32px', marginBottom: '16px' }, children: "\uD83D\uDED2" }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: '18px', fontWeight: '500' }, children: "Storenest" }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: '14px', opacity: 0.8, marginTop: '8px' }, children: t.loading })] }) }));
};
// Simple component that returns loading during SSR
const CheckoutBoxClient = (props) => {
// Check if we're on the client side
const isClient = typeof window !== 'undefined';
// If we're on server side, return loading component immediately
if (!isClient) {
return (0, jsx_runtime_1.jsx)(LoadingComponent, { locale: props.config?.locale });
}
// For client side, we'll return loading and let the parent handle the dynamic import
// This ensures no React hooks are called during SSR
return (0, jsx_runtime_1.jsx)(LoadingComponent, { locale: props.config?.locale });
};
exports.CheckoutBoxClient = CheckoutBoxClient;
exports.default = exports.CheckoutBoxClient;