@cedros/pay-react 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.
- package/LICENSE +21 -0
- package/README.md +1731 -0
- package/dist/CedrosContext-B3iCqN6e.js +11 -0
- package/dist/CedrosContext-vX9uqZKp.mjs +1796 -0
- package/dist/ar-LVoQZTFI.js +1 -0
- package/dist/ar-w27mU-4x.mjs +19 -0
- package/dist/bn-BR5Cv1T4.js +1 -0
- package/dist/bn-Ba_k3Kex.mjs +19 -0
- package/dist/components/CedrosPay.d.ts +54 -0
- package/dist/components/CedrosPay.d.ts.map +1 -0
- package/dist/components/CryptoButton.d.ts +26 -0
- package/dist/components/CryptoButton.d.ts.map +1 -0
- package/dist/components/PaymentModal.d.ts +28 -0
- package/dist/components/PaymentModal.d.ts.map +1 -0
- package/dist/components/ProductPrice.d.ts +56 -0
- package/dist/components/ProductPrice.d.ts.map +1 -0
- package/dist/components/PurchaseButton.d.ts +52 -0
- package/dist/components/PurchaseButton.d.ts.map +1 -0
- package/dist/components/StripeButton.d.ts +27 -0
- package/dist/components/StripeButton.d.ts.map +1 -0
- package/dist/context/CedrosContext.d.ts +46 -0
- package/dist/context/CedrosContext.d.ts.map +1 -0
- package/dist/context/ThemeContext.d.ts +30 -0
- package/dist/context/ThemeContext.d.ts.map +1 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/crypto-only.d.ts +33 -0
- package/dist/crypto-only.d.ts.map +1 -0
- package/dist/crypto-only.js +1 -0
- package/dist/crypto-only.mjs +35 -0
- package/dist/de-CoZiPFN7.mjs +19 -0
- package/dist/de-pQxy-oD1.js +1 -0
- package/dist/en-CSsJl3nf.mjs +19 -0
- package/dist/en-D-uY3ltT.js +1 -0
- package/dist/es-BWGIBp2f.mjs +19 -0
- package/dist/es-D24cg8dD.js +1 -0
- package/dist/fil-BOBft9G-.js +1 -0
- package/dist/fil-Czo27xmj.mjs +19 -0
- package/dist/fr-Ct9ub8Fa.js +1 -0
- package/dist/fr-DQ-2ThBv.mjs +19 -0
- package/dist/he-DpV1WnBQ.mjs +19 -0
- package/dist/he-DtQqRKRq.js +1 -0
- package/dist/hooks/usePaymentMode.d.ts +39 -0
- package/dist/hooks/usePaymentMode.d.ts.map +1 -0
- package/dist/hooks/useRefundVerification.d.ts +30 -0
- package/dist/hooks/useRefundVerification.d.ts.map +1 -0
- package/dist/hooks/useStripeCheckout.d.ts +20 -0
- package/dist/hooks/useStripeCheckout.d.ts.map +1 -0
- package/dist/hooks/useX402Payment.d.ts +24 -0
- package/dist/hooks/useX402Payment.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +107 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/useTranslation.d.ts +55 -0
- package/dist/i18n/useTranslation.d.ts.map +1 -0
- package/dist/id-BJMqsu19.mjs +19 -0
- package/dist/id-CiM2mL7C.js +1 -0
- package/dist/in-BxgxKLQH.mjs +19 -0
- package/dist/in-Bzcjmxcc.js +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +626 -0
- package/dist/it-Blb_pIJl.js +1 -0
- package/dist/it-DZFFPALf.mjs +19 -0
- package/dist/jp-9NHyIuwY.js +1 -0
- package/dist/jp-ZExTrlHK.mjs +19 -0
- package/dist/kr-DHX3i4Ht.mjs +19 -0
- package/dist/kr-DvzJ-0yX.js +1 -0
- package/dist/managers/ManagerCache.d.ts +49 -0
- package/dist/managers/ManagerCache.d.ts.map +1 -0
- package/dist/managers/RouteDiscoveryManager.d.ts +72 -0
- package/dist/managers/RouteDiscoveryManager.d.ts.map +1 -0
- package/dist/managers/StripeManager.d.ts +110 -0
- package/dist/managers/StripeManager.d.ts.map +1 -0
- package/dist/managers/WalletManager.d.ts +150 -0
- package/dist/managers/WalletManager.d.ts.map +1 -0
- package/dist/managers/X402Manager.d.ts +176 -0
- package/dist/managers/X402Manager.d.ts.map +1 -0
- package/dist/ms-BOAu5pUB.js +1 -0
- package/dist/ms-Cv1fdIi2.mjs +19 -0
- package/dist/nl-BmGonsKb.mjs +19 -0
- package/dist/nl-WHh_DfO8.js +1 -0
- package/dist/pa-B7kIhZCF.js +1 -0
- package/dist/pa-BfwcJIar.mjs +19 -0
- package/dist/pay-react.css +1 -0
- package/dist/pl-DE5IB9xv.mjs +19 -0
- package/dist/pl-H0hBKdvF.js +1 -0
- package/dist/pt-CLzkqDzf.mjs +19 -0
- package/dist/pt-DwGrViQ3.js +1 -0
- package/dist/ru-CB2m0UDT.js +1 -0
- package/dist/ru-DM6-oUR0.mjs +19 -0
- package/dist/stripe-only.d.ts +31 -0
- package/dist/stripe-only.d.ts.map +1 -0
- package/dist/stripe-only.js +1 -0
- package/dist/stripe-only.mjs +33 -0
- package/dist/styles-D3XGpsqb.js +1 -0
- package/dist/styles-zgmHs6Hs.mjs +1601 -0
- package/dist/ta-A5HnrGb5.mjs +19 -0
- package/dist/ta-CAS197uN.js +1 -0
- package/dist/telemetry.d.ts +27 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +1 -0
- package/dist/telemetry.mjs +127 -0
- package/dist/testing/__tests__/providers.test.d.ts +10 -0
- package/dist/testing/__tests__/providers.test.d.ts.map +1 -0
- package/dist/testing/helpers.d.ts +242 -0
- package/dist/testing/helpers.d.ts.map +1 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +1 -0
- package/dist/testing/index.mjs +374 -0
- package/dist/testing/mocks.d.ts +225 -0
- package/dist/testing/mocks.d.ts.map +1 -0
- package/dist/testing/providers.d.ts +89 -0
- package/dist/testing/providers.d.ts.map +1 -0
- package/dist/th-3fbB3Ytp.mjs +19 -0
- package/dist/th-Cpz2cFcg.js +1 -0
- package/dist/tr-BrgfFFdq.mjs +19 -0
- package/dist/tr-hQrEFk86.js +1 -0
- package/dist/types/componentOptions.d.ts +138 -0
- package/dist/types/componentOptions.d.ts.map +1 -0
- package/dist/types/errors.d.ts +213 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +248 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/uk-0hFun_g_.mjs +19 -0
- package/dist/uk-DrK2Sv8C.js +1 -0
- package/dist/ur-CaOjJXai.mjs +19 -0
- package/dist/ur-D5-7mN9a.js +1 -0
- package/dist/utils/__tests__/cspHelper.test.d.ts +9 -0
- package/dist/utils/__tests__/cspHelper.test.d.ts.map +1 -0
- package/dist/utils/__tests__/fetchWithTimeout.test.d.ts +11 -0
- package/dist/utils/__tests__/fetchWithTimeout.test.d.ts.map +1 -0
- package/dist/utils/cartHelpers.d.ts +105 -0
- package/dist/utils/cartHelpers.d.ts.map +1 -0
- package/dist/utils/circuitBreaker.d.ts +112 -0
- package/dist/utils/circuitBreaker.d.ts.map +1 -0
- package/dist/utils/couponHelpers.d.ts +50 -0
- package/dist/utils/couponHelpers.d.ts.map +1 -0
- package/dist/utils/cspHelper.d.ts +162 -0
- package/dist/utils/cspHelper.d.ts.map +1 -0
- package/dist/utils/deprecation.d.ts +128 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/errorHandling.d.ts +30 -0
- package/dist/utils/errorHandling.d.ts.map +1 -0
- package/dist/utils/errorMessages.d.ts +47 -0
- package/dist/utils/errorMessages.d.ts.map +1 -0
- package/dist/utils/errorParser.d.ts +37 -0
- package/dist/utils/errorParser.d.ts.map +1 -0
- package/dist/utils/eventEmitter.d.ts +119 -0
- package/dist/utils/eventEmitter.d.ts.map +1 -0
- package/dist/utils/exponentialBackoff.d.ts +104 -0
- package/dist/utils/exponentialBackoff.d.ts.map +1 -0
- package/dist/utils/fetchWithTimeout.d.ts +13 -0
- package/dist/utils/fetchWithTimeout.d.ts.map +1 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +76 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/modalStyles.d.ts +13 -0
- package/dist/utils/modalStyles.d.ts.map +1 -0
- package/dist/utils/rateLimiter.d.ts +88 -0
- package/dist/utils/rateLimiter.d.ts.map +1 -0
- package/dist/utils/requestDeduplication.d.ts +124 -0
- package/dist/utils/requestDeduplication.d.ts.map +1 -0
- package/dist/utils/securityValidation.d.ts +75 -0
- package/dist/utils/securityValidation.d.ts.map +1 -0
- package/dist/utils/solanaCheck.d.ts +10 -0
- package/dist/utils/solanaCheck.d.ts.map +1 -0
- package/dist/utils/telemetry.d.ts +277 -0
- package/dist/utils/telemetry.d.ts.map +1 -0
- package/dist/utils/tokenMintValidator.d.ts +77 -0
- package/dist/utils/tokenMintValidator.d.ts.map +1 -0
- package/dist/utils/uuid.d.ts +13 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/utils/validateConfig.d.ts +13 -0
- package/dist/utils/validateConfig.d.ts.map +1 -0
- package/dist/utils/walletDetection.d.ts +6 -0
- package/dist/utils/walletDetection.d.ts.map +1 -0
- package/dist/utils/walletPool.d.ts +57 -0
- package/dist/utils/walletPool.d.ts.map +1 -0
- package/dist/uuid-C0iMjdcc.js +1 -0
- package/dist/uuid-UlzrVY8Y.mjs +17 -0
- package/dist/vn-0nlIZFLP.mjs +19 -0
- package/dist/vn-B_iut9YL.js +1 -0
- package/dist/walletDetection-JZR3UCOa.mjs +27 -0
- package/dist/walletDetection-bNmV5ItZ.js +1 -0
- package/dist/zh-B4Endr1F.mjs +19 -0
- package/dist/zh-PR82dCHr.js +1 -0
- package/package.json +139 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const e = "CEDROS PAY - Исходный файл для перевода (русский)", a = "1.0.0", i = "ru", n = { pay_with_card: "Оплатить картой", pay_with_crypto: "Оплатить USDC", pay_with_usdc: "Оплатить USDC", purchase: "Покупка", card: "Карта", usdc_solana: "USDC (Solana)", crypto: "Криптовалюта", connect_wallet: "Подключить кошелёк", connecting: "Подключение...", processing: "Обработка...", loading: "Загрузка...", close: "Закрыть", cancel: "Отмена", confirm: "Подтвердить", retry: "Повторить", go_back: "Назад", contact_support: "Связаться со службой поддержки" }, o = { invalid_payment_proof: { message: "Не удалось подтвердить оплату", action: "Повторите оплату. Если проблема сохраняется, обратитесь в поддержку." }, invalid_signature: { message: "Подпись транзакции недействительна", action: "Одобрите транзакцию в вашем кошельке и повторите попытку." }, invalid_transaction: { message: "Неверный формат транзакции", action: "Повторите оплату. Если проблема сохраняется, попробуйте обновить приложение кошелька." }, transaction_not_found: { message: "Транзакция не найдена в блокчейне", action: "Ваша транзакция может ещё обрабатываться. Подождите немного и проверьте кошелёк, либо попробуйте снова." }, transaction_not_confirmed: { message: "Транзакция ещё обрабатывается", action: "Подождите подтверждения в блокчейне, затем попробуйте ещё раз." }, transaction_failed: { message: "Сбой транзакции в блокчейне", action: "Проверьте детали в кошельке. Возможно, нужно изменить параметры транзакции или добавить SOL для оплаты комиссий." }, transaction_expired: { message: "Время обработки транзакции истекло", action: "Повторите оплату. При наличии такой возможности увеличьте приоритет транзакции в кошельке." }, invalid_recipient: { message: "Платёж отправлен на неверный адрес", action: "Попробуйте снова и убедитесь, что вы одобряете верную транзакцию в кошельке." }, invalid_sender: { message: "Кошелёк отправителя недействителен", action: "Подключите кошелёк заново и повторите попытку." }, unauthorized_refund_issuer: { message: "У вас нет прав на оформление возвратов", action: "Возвраты могут обрабатывать только авторизованные аккаунты. Обратитесь в поддержку, если считаете это ошибкой." }, amount_below_minimum: { message: "Сумма платежа слишком мала", action: "Проверьте требуемую сумму и попробуйте снова." }, amount_mismatch: { message: "Сумма платежа не совпадает с указанной", action: "Цена могла измениться. Обновите страницу и повторите оплату." }, insufficient_funds_sol: { message: "Недостаточно SOL для оплаты комиссий", action: "Добавьте на кошелёк не менее 0.001 SOL для оплаты сетевых комиссий и повторите попытку." }, insufficient_funds_token: { message: "Недостаточный баланс в кошельке", action: "Пополните кошелёк и попробуйте снова." }, invalid_token_mint: { message: "Неверный токен оплаты", action: "Оплатите корректным токеном, указанным в деталях платежа." }, not_spl_transfer: { message: "Транзакция не является корректным переводом токенов", action: "Убедитесь, что вы отправляете токен нужного типа из вашего кошелька." }, missing_token_account: { message: "Токен-аккаунт не найден", action: "Вашему кошельку может потребоваться сначала создать токен-аккаунт. Попробуйте снова или используйте другой кошелёк." }, invalid_token_program: { message: "Недействительная программа токена", action: "Повторите оплату. Если проблема сохраняется, попробуйте другой кошелёк." }, missing_memo: { message: "Требуется примечание (memo) к платежу, но оно отсутствует", action: "Повторите оплату и убедитесь, что в кошельке одобрены все детали транзакции." }, invalid_memo: { message: "Неверный формат memo платежа", action: "Повторите оплату." }, payment_already_used: { message: "Этот платёж уже был обработан", action: "Проверьте историю транзакций. Если требуется новый платёж, создайте новую транзакцию." }, signature_reused: { message: "Подпись транзакции уже использовалась", action: "Создайте новую платёжную транзакцию." }, quote_expired: { message: "Срок действия котировки платежа истёк", action: "Цены часто обновляются. Обновите страницу и повторите оплату." }, missing_field: { message: "Отсутствует обязательная информация", action: "Проверьте все обязательные поля и попробуйте снова." }, invalid_field: { message: "Некоторые данные указаны неверно", action: "Проверьте введённые данные и повторите попытку." }, invalid_amount: { message: "Недействительная сумма платежа", action: "Проверьте сумму и попробуйте снова." }, invalid_wallet: { message: "Недействительный адрес кошелька", action: "Подключите кошелёк заново и повторите попытку." }, invalid_resource: { message: "Неверный выбор товара", action: "Обновите страницу и попробуйте снова." }, invalid_coupon: { message: "Недействительный промокод", action: "Проверьте промокод и попробуйте снова." }, invalid_cart_item: { message: "Один или несколько товаров в корзине некорректны", action: "Проверьте корзину и попробуйте снова." }, empty_cart: { message: "Ваша корзина пуста", action: "Добавьте товары в корзину перед оплатой." }, resource_not_found: { message: "Товар не найден", action: "Возможно, товар больше недоступен. Обновите страницу и попробуйте снова." }, cart_not_found: { message: "Корзина не найдена", action: "Срок действия корзины мог истечь. Начните новый заказ." }, refund_not_found: { message: "Возврат не найден", action: "Проверьте номер возврата или обратитесь в поддержку." }, product_not_found: { message: "Товар недоступен", action: "Возможно, товар больше недоступен. Просмотрите текущий ассортимент." }, coupon_not_found: { message: "Промокод не найден", action: "Проверьте код или удалите его, чтобы продолжить." }, session_not_found: { message: "Сеанс оплаты истёк", action: "Начните новый платёж." }, cart_already_paid: { message: "Этот заказ уже оплачен", action: "Проверьте историю заказов. Если нужна новая покупка, начните новый заказ." }, refund_already_processed: { message: "Этот возврат уже обработан", action: "Проверьте историю транзакций или свяжитесь с поддержкой для подробностей." }, coupon_expired: { message: "Срок действия промокода истёк", action: "Удалите промокод или используйте другой." }, coupon_usage_limit_reached: { message: "Достигнут лимит использования промокода", action: "Этот промокод исчерпан. Попробуйте другой код." }, coupon_not_applicable: { message: "Промокод не применяется к этой покупке", action: "Проверьте условия промокода или удалите его, чтобы продолжить." }, coupon_wrong_payment_method: { message: "Промокод недействителен для этого способа оплаты", action: "Выберите другой способ оплаты или удалите промокод." }, stripe_error: { message: "Сервис оплаты картой временно недоступен", action: "Попробуйте позже или воспользуйтесь оплатой криптовалютой." }, rpc_error: { message: "Сеть блокчейна временно недоступна", action: "Попробуйте позже или оплатите картой." }, network_error: { message: "Проблема с подключением к сети", action: "Проверьте подключение к интернету и попробуйте снова." }, internal_error: { message: "На нашей стороне что-то пошло не так", action: "Повторите попытку. Если проблема сохраняется, обратитесь в поддержку." }, database_error: { message: "Сервис временно недоступен", action: "Попробуйте позже." }, config_error: { message: "Ошибка конфигурации сервиса", action: "Обратитесь в поддержку за помощью." }, unknown_error: { message: "Произошла непредвиденная ошибка", action: "Повторите попытку или обратитесь в поддержку, если проблема сохраняется." } }, s = { unknown_token_mint: "Предупреждение: Неизвестный адрес mint токена. Тщательно проверьте, что это правильный токен, чтобы избежать потери средств.", token_typo_warning: "Адрес токена не совпадает с известными стейблкоинами (USDC, USDT, PYUSD, CASH). Проверьте внимательно, чтобы предотвратить безвозвратную потерю средств." }, t = { no_wallet_detected: "Кошелёк Solana не обнаружен", install_wallet: "Установите кошелёк Solana, например Phantom, Solflare или Backpack.", wallet_not_connected: "Кошелёк не подключён", connect_your_wallet: "Подключите кошелёк, чтобы продолжить.", wallet_connection_failed: "Не удалось подключить кошелёк", try_again: "Попробуйте подключиться ещё раз.", transaction_rejected: "Транзакция отклонена", approve_in_wallet: "Одобрите транзакцию в кошельке, чтобы продолжить." }, c = {
|
|
2
|
+
comment: e,
|
|
3
|
+
version: a,
|
|
4
|
+
locale: "ru",
|
|
5
|
+
ui: n,
|
|
6
|
+
errors: o,
|
|
7
|
+
validation: s,
|
|
8
|
+
wallet: t
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
e as comment,
|
|
12
|
+
c as default,
|
|
13
|
+
o as errors,
|
|
14
|
+
i as locale,
|
|
15
|
+
n as ui,
|
|
16
|
+
s as validation,
|
|
17
|
+
a as version,
|
|
18
|
+
t as wallet
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @cedros/pay-react/stripe-only
|
|
3
|
+
*
|
|
4
|
+
* Stripe-only build (no Solana dependencies)
|
|
5
|
+
* Bundle size: ~75KB (vs ~950KB for full build)
|
|
6
|
+
*
|
|
7
|
+
* Use this entry point if you only need Stripe payments.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // In your package.json or import statement
|
|
12
|
+
* import { CedrosProvider, StripeButton } from '@cedros/pay-react/stripe-only';
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export { CedrosProvider, useCedrosContext, useCedrosTheme, type CedrosContextValue } from './context';
|
|
16
|
+
export { StripeButton } from './components/StripeButton';
|
|
17
|
+
export { PaymentModal } from './components/PaymentModal';
|
|
18
|
+
export type { PaymentModalProps } from './components/PaymentModal';
|
|
19
|
+
export { ProductPrice, PaymentMethodBadge } from './components/ProductPrice';
|
|
20
|
+
export type { PaymentMethod } from './components/ProductPrice';
|
|
21
|
+
export { useStripeCheckout } from './hooks/useStripeCheckout';
|
|
22
|
+
export { usePaymentMode } from './hooks/usePaymentMode';
|
|
23
|
+
export type { CedrosConfig, PaymentStatus, Currency, StripeSessionRequest, StripeSessionResponse, PaymentResult, PaymentMetadata, PaymentState, CedrosThemeMode, CedrosThemeTokens, Product, CartItem, PaymentErrorCode, PaymentError, ErrorResponse, } from './types';
|
|
24
|
+
export { ERROR_CATEGORIES } from './types/errors';
|
|
25
|
+
export type { IStripeManager } from './managers/StripeManager';
|
|
26
|
+
export type { IRouteDiscoveryManager } from './managers/RouteDiscoveryManager';
|
|
27
|
+
export { validateConfig, parseCouponCodes, formatCouponCodes, calculateDiscountPercentage, createRateLimiter, RATE_LIMITER_PRESETS, type RateLimiter, type RateLimiterConfig, } from './utils';
|
|
28
|
+
export { LogLevel, Logger, getLogger, createLogger, type LoggerConfig, } from './utils/logger';
|
|
29
|
+
export { CEDROS_EVENTS, emitPaymentStart, emitPaymentProcessing, emitPaymentSuccess, emitPaymentError, type PaymentStartDetail, type PaymentProcessingDetail, type PaymentSuccessDetail, type PaymentErrorDetail, } from './utils';
|
|
30
|
+
export { parseStructuredErrorResponse, isRetryableError, getUserErrorMessage, } from './utils';
|
|
31
|
+
//# sourceMappingURL=stripe-only.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe-only.d.ts","sourceRoot":"","sources":["../src/stripe-only.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGtG,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,YAAY,EACV,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAG/E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,YAAY,EACZ,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./CedrosContext-B3iCqN6e.js"),e=require("./styles-D3XGpsqb.js");require("@solana/wallet-adapter-wallets");exports.CedrosProvider=r.CedrosProvider;exports.LogLevel=r.LogLevel;exports.Logger=r.Logger;exports.RATE_LIMITER_PRESETS=r.RATE_LIMITER_PRESETS;exports.createLogger=r.createLogger;exports.createRateLimiter=r.createRateLimiter;exports.getLogger=r.getLogger;exports.useCedrosContext=r.useCedrosContext;exports.useCedrosTheme=r.useCedrosTheme;exports.validateConfig=r.validateConfig;exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.ERROR_CATEGORIES=e.ERROR_CATEGORIES;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.StripeButton=e.StripeButton;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.formatCouponCodes=e.formatCouponCodes;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.parseCouponCodes=e.parseCouponCodes;exports.parseStructuredErrorResponse=e.parseErrorResponse;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { C as r, L as t, b as o, R as i, d as m, c as g, g as n, u, a as c, v as d } from "./CedrosContext-vX9uqZKp.mjs";
|
|
2
|
+
import { C, E as P, b as R, P as p, a as S, S as y, d as L, i as l, g as T, e as f, h as M, f as h, l as v, k as _, p as b, j as x, c as I, u as O } from "./styles-zgmHs6Hs.mjs";
|
|
3
|
+
import "@solana/wallet-adapter-wallets";
|
|
4
|
+
export {
|
|
5
|
+
C as CEDROS_EVENTS,
|
|
6
|
+
r as CedrosProvider,
|
|
7
|
+
P as ERROR_CATEGORIES,
|
|
8
|
+
t as LogLevel,
|
|
9
|
+
o as Logger,
|
|
10
|
+
R as PaymentMethodBadge,
|
|
11
|
+
p as PaymentModal,
|
|
12
|
+
S as ProductPrice,
|
|
13
|
+
i as RATE_LIMITER_PRESETS,
|
|
14
|
+
y as StripeButton,
|
|
15
|
+
L as calculateDiscountPercentage,
|
|
16
|
+
m as createLogger,
|
|
17
|
+
g as createRateLimiter,
|
|
18
|
+
l as emitPaymentError,
|
|
19
|
+
T as emitPaymentProcessing,
|
|
20
|
+
f as emitPaymentStart,
|
|
21
|
+
M as emitPaymentSuccess,
|
|
22
|
+
h as formatCouponCodes,
|
|
23
|
+
n as getLogger,
|
|
24
|
+
v as getUserErrorMessage,
|
|
25
|
+
_ as isRetryableError,
|
|
26
|
+
b as parseCouponCodes,
|
|
27
|
+
x as parseStructuredErrorResponse,
|
|
28
|
+
u as useCedrosContext,
|
|
29
|
+
c as useCedrosTheme,
|
|
30
|
+
I as usePaymentMode,
|
|
31
|
+
O as useStripeCheckout,
|
|
32
|
+
d as validateConfig
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=require("react/jsx-runtime"),i=require("react"),l=require("./CedrosContext-B3iCqN6e.js"),Te=require("@solana/wallet-adapter-react"),Re=require("@solana/wallet-adapter-base"),Ge=require("@solana/wallet-adapter-react-ui");require("@solana/wallet-adapter-wallets");function Ve(e){return!e||!e.coupon_codes?[]:e.coupon_codes.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function Xe(e,t=", "){return e.join(t)}function Ke(e,t){return e<=0?0:(e-t)/e*100}function ke(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return 1;const n=Math.floor(t);return n>0?n:1}function Se(e){return e.map(t=>({resource:t.resource,quantity:ke(t.quantity),metadata:t.metadata}))}function Y(e){return e.reduce((t,n)=>t+ke(n.quantity),0)}function Qe(e){return!!(e&&e.length>0&&(e.length>1||e.length===1&&(e[0].quantity??1)>1))}const Ze={invalid_payment_proof:{message:"Payment verification failed",action:"Please try your payment again. If this continues, contact support.",technicalHint:"Invalid payment proof format"},invalid_signature:{message:"Transaction signature is invalid",action:"Please approve the transaction in your wallet and try again.",technicalHint:"Transaction signature verification failed"},invalid_transaction:{message:"Transaction format is invalid",action:"Please try your payment again. If this continues, try updating your wallet app.",technicalHint:"Malformed transaction structure"},transaction_not_found:{message:"Transaction not found on the blockchain",action:"Your transaction may still be processing. Please wait a moment and check your wallet, or try again.",technicalHint:"Transaction signature not found on-chain"},transaction_not_confirmed:{message:"Transaction is still processing",action:"Please wait a moment for the blockchain to confirm your transaction, then try again.",technicalHint:"Transaction not yet confirmed"},transaction_failed:{message:"Transaction failed on the blockchain",action:"Check your wallet for details. You may need to adjust your transaction settings or add more SOL for fees.",technicalHint:"On-chain transaction failure"},transaction_expired:{message:"Transaction took too long to process",action:"Please try your payment again. Consider increasing transaction priority if your wallet supports it.",technicalHint:"Transaction blockhash expired"},invalid_recipient:{message:"Payment was sent to the wrong address",action:"Please try again and ensure you approve the correct transaction in your wallet.",technicalHint:"Recipient address mismatch"},invalid_sender:{message:"Payment sender wallet is invalid",action:"Please reconnect your wallet and try again.",technicalHint:"Sender address validation failed"},unauthorized_refund_issuer:{message:"You are not authorized to issue refunds",action:"Only authorized accounts can process refunds. Please contact support if you believe this is an error.",technicalHint:"Refund issuer not in authorized list"},amount_below_minimum:{message:"Payment amount is too low",action:"Please check the required amount and try again.",technicalHint:"Amount below minimum threshold"},amount_mismatch:{message:"Payment amount does not match the quote",action:"The price may have changed. Please refresh and try your payment again.",technicalHint:"Amount does not match quote"},insufficient_funds_sol:{message:"Not enough SOL for transaction fees",action:"Add at least 0.001 SOL to your wallet to cover network fees, then try again.",technicalHint:"Insufficient SOL balance for fees"},insufficient_funds_token:{message:"Insufficient balance in your wallet",action:"Add more funds to your wallet and try again.",technicalHint:"Insufficient token balance"},invalid_token_mint:{message:"Incorrect payment token",action:"Please pay with the correct token as shown in the payment details.",technicalHint:"Token mint address mismatch"},not_spl_transfer:{message:"Transaction is not a valid token transfer",action:"Please ensure you are sending the correct token type from your wallet.",technicalHint:"Transaction is not an SPL token transfer"},missing_token_account:{message:"Token account not found",action:"Your wallet may need to create a token account first. Try again or use a different wallet.",technicalHint:"Associated token account does not exist"},invalid_token_program:{message:"Invalid token program",action:"Please try your payment again. If this continues, try using a different wallet.",technicalHint:"Token program ID mismatch"},missing_memo:{message:"Payment memo is required but was not included",action:"Please try your payment again and ensure transaction details are approved in your wallet.",technicalHint:"Required memo instruction missing"},invalid_memo:{message:"Payment memo format is invalid",action:"Please try your payment again.",technicalHint:"Memo does not match expected format"},payment_already_used:{message:"This payment has already been processed",action:"Check your transaction history. If you need to make another payment, please start a new transaction.",technicalHint:"Payment signature already recorded"},signature_reused:{message:"Transaction signature has already been used",action:"Please create a new payment transaction.",technicalHint:"Duplicate signature detected"},quote_expired:{message:"Payment quote has expired",action:"Prices are updated frequently. Please refresh and try your payment again.",technicalHint:"Quote timestamp expired"},missing_field:{message:"Required information is missing",action:"Please check all required fields and try again.",technicalHint:"Required field not provided"},invalid_field:{message:"Some information is invalid",action:"Please check your input and try again.",technicalHint:"Field validation failed"},invalid_amount:{message:"Payment amount is invalid",action:"Please check the amount and try again.",technicalHint:"Amount validation failed"},invalid_wallet:{message:"Wallet address is invalid",action:"Please reconnect your wallet and try again.",technicalHint:"Wallet address validation failed"},invalid_resource:{message:"Invalid item selection",action:"Please refresh the page and try again.",technicalHint:"Resource ID validation failed"},invalid_coupon:{message:"Invalid coupon code",action:"Please check the coupon code and try again.",technicalHint:"Coupon code format invalid"},invalid_cart_item:{message:"One or more cart items are invalid",action:"Please review your cart and try again.",technicalHint:"Cart item validation failed"},empty_cart:{message:"Your cart is empty",action:"Please add items to your cart before checking out.",technicalHint:"Cart contains no items"},resource_not_found:{message:"Item not found",action:"This item may no longer be available. Please refresh and try again.",technicalHint:"Resource not found in database"},cart_not_found:{message:"Shopping cart not found",action:"Your cart may have expired. Please start a new order.",technicalHint:"Cart ID not found"},refund_not_found:{message:"Refund not found",action:"Please check your refund reference number or contact support.",technicalHint:"Refund ID not found"},product_not_found:{message:"Product not available",action:"This product may no longer be available. Please browse our current selection.",technicalHint:"Product ID not found"},coupon_not_found:{message:"Coupon code not found",action:"Please check the coupon code or remove it to continue.",technicalHint:"Coupon code not in database"},session_not_found:{message:"Payment session expired",action:"Please start a new payment.",technicalHint:"Session ID not found or expired"},cart_already_paid:{message:"This order has already been paid",action:"Check your order history. If you need to make another purchase, please start a new order.",technicalHint:"Cart marked as paid"},refund_already_processed:{message:"This refund has already been processed",action:"Check your transaction history or contact support for details.",technicalHint:"Refund already completed"},coupon_expired:{message:"Coupon has expired",action:"Please remove the coupon code or use a different code.",technicalHint:"Coupon expiration date passed"},coupon_usage_limit_reached:{message:"Coupon usage limit reached",action:"This coupon has been fully redeemed. Please try a different code.",technicalHint:"Coupon max uses exceeded"},coupon_not_applicable:{message:"Coupon cannot be applied to this purchase",action:"Please check the coupon terms or remove it to continue.",technicalHint:"Coupon conditions not met"},coupon_wrong_payment_method:{message:"Coupon not valid for this payment method",action:"Try a different payment method or remove the coupon code.",technicalHint:"Coupon restricted to specific payment methods"},stripe_error:{message:"Card payment service temporarily unavailable",action:"Please try again in a moment, or use cryptocurrency payment instead.",technicalHint:"Stripe API error"},rpc_error:{message:"Blockchain network temporarily unavailable",action:"Please try again in a moment, or use card payment instead.",technicalHint:"Solana RPC error"},network_error:{message:"Network connection issue",action:"Please check your internet connection and try again.",technicalHint:"Network request failed"},internal_error:{message:"Something went wrong on our end",action:"Please try again. If this continues, contact support.",technicalHint:"Internal server error"},database_error:{message:"Service temporarily unavailable",action:"Please try again in a moment.",technicalHint:"Database operation failed"},config_error:{message:"Service configuration error",action:"Please contact support for assistance.",technicalHint:"Server misconfiguration"}};function ee(e){return Ze[e]||{message:"An unexpected error occurred",action:"Please try again or contact support if this continues.",technicalHint:`Unknown error code: ${e}`}}const Ne=new Map,se=new Map,ie=new Map,xe=200,ue=2e3;function Je(e){const t=ie.get(e);return t?Date.now()<t?!0:(ie.delete(e),!1):!1}function et(e,t=xe){const n=Date.now()+t;ie.set(e,n)}function tt(e,t=ue){const n=Ne.get(e);if(!n)return!1;const o=Date.now()-n;return o<t?(l.getLogger().debug(`[Deduplication] Duplicate request blocked: ${e} (${o}ms ago)`),!0):!1}function nt(e){Ne.set(e,Date.now())}function rt(e){return se.get(e)||null}function ot(e,t){se.set(e,t);const n=()=>{se.delete(e),nt(e)};return t.then(n,n),t}async function at(e,t,n={}){const{windowMs:r=ue,throwOnDuplicate:o=!0}=n,a=rt(e);if(a)return l.getLogger().debug(`[Deduplication] Reusing in-flight request: ${e}`),a;if(tt(e,r)){if(o)throw new Error(`Duplicate request blocked: ${e}`);return l.getLogger().warn(`[Deduplication] Duplicate request blocked but not throwing: ${e}`),Promise.reject(new Error("Duplicate request"))}const m=t();return ot(e,m)}function de(e,t,n={}){const{cooldownMs:r=xe,deduplicationWindowMs:o=ue}=n;return async()=>{if(Je(e)){l.getLogger().debug(`[Deduplication] Button in cooldown: ${e}`);return}et(e,r);try{await at(e,async()=>{const a=t();a instanceof Promise&&await a},{windowMs:o,throwOnDuplicate:!1})}catch(a){if(a instanceof Error&&a.message.includes("Duplicate request"))return;throw a}}}function Ee(e){return{background:"none",border:"none",fontSize:"1.5rem",cursor:"pointer",color:e,opacity:.6,padding:"0.25rem",lineHeight:1}}const H={PAYMENT_START:"cedros:payment:start",WALLET_CONNECT:"cedros:wallet:connect",WALLET_CONNECTED:"cedros:wallet:connected",WALLET_ERROR:"cedros:wallet:error",PAYMENT_PROCESSING:"cedros:payment:processing",PAYMENT_SUCCESS:"cedros:payment:success",PAYMENT_ERROR:"cedros:payment:error"};function W(e,t){if(typeof window>"u")return;const n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!1});window.dispatchEvent(n)}function me(e,t,n){W(H.PAYMENT_START,{timestamp:Date.now(),method:e,resource:t,itemCount:n})}function ce(e){W(H.WALLET_CONNECT,{timestamp:Date.now(),wallet:e})}function De(e,t){W(H.WALLET_CONNECTED,{timestamp:Date.now(),wallet:e,publicKey:t})}function J(e,t){W(H.WALLET_ERROR,{timestamp:Date.now(),wallet:t,error:e})}function te(e,t,n){W(H.PAYMENT_PROCESSING,{timestamp:Date.now(),method:e,resource:t,itemCount:n})}function fe(e,t,n,r){W(H.PAYMENT_SUCCESS,{timestamp:Date.now(),method:e,transactionId:t,resource:n,itemCount:r})}function G(e,t,n,r){W(H.PAYMENT_ERROR,{timestamp:Date.now(),method:e,error:t,resource:n,itemCount:r})}var le=(e=>(e.INVALID_PAYMENT_PROOF="invalid_payment_proof",e.INVALID_SIGNATURE="invalid_signature",e.INVALID_TRANSACTION="invalid_transaction",e.TRANSACTION_NOT_FOUND="transaction_not_found",e.TRANSACTION_NOT_CONFIRMED="transaction_not_confirmed",e.TRANSACTION_FAILED="transaction_failed",e.TRANSACTION_EXPIRED="transaction_expired",e.INVALID_RECIPIENT="invalid_recipient",e.INVALID_SENDER="invalid_sender",e.UNAUTHORIZED_REFUND_ISSUER="unauthorized_refund_issuer",e.AMOUNT_BELOW_MINIMUM="amount_below_minimum",e.AMOUNT_MISMATCH="amount_mismatch",e.INSUFFICIENT_FUNDS_SOL="insufficient_funds_sol",e.INSUFFICIENT_FUNDS_TOKEN="insufficient_funds_token",e.INVALID_TOKEN_MINT="invalid_token_mint",e.NOT_SPL_TRANSFER="not_spl_transfer",e.MISSING_TOKEN_ACCOUNT="missing_token_account",e.INVALID_TOKEN_PROGRAM="invalid_token_program",e.MISSING_MEMO="missing_memo",e.INVALID_MEMO="invalid_memo",e.PAYMENT_ALREADY_USED="payment_already_used",e.SIGNATURE_REUSED="signature_reused",e.QUOTE_EXPIRED="quote_expired",e.MISSING_FIELD="missing_field",e.INVALID_FIELD="invalid_field",e.INVALID_AMOUNT="invalid_amount",e.INVALID_WALLET="invalid_wallet",e.INVALID_RESOURCE="invalid_resource",e.INVALID_COUPON="invalid_coupon",e.INVALID_CART_ITEM="invalid_cart_item",e.EMPTY_CART="empty_cart",e.RESOURCE_NOT_FOUND="resource_not_found",e.CART_NOT_FOUND="cart_not_found",e.REFUND_NOT_FOUND="refund_not_found",e.PRODUCT_NOT_FOUND="product_not_found",e.COUPON_NOT_FOUND="coupon_not_found",e.SESSION_NOT_FOUND="session_not_found",e.CART_ALREADY_PAID="cart_already_paid",e.REFUND_ALREADY_PROCESSED="refund_already_processed",e.COUPON_EXPIRED="coupon_expired",e.COUPON_USAGE_LIMIT_REACHED="coupon_usage_limit_reached",e.COUPON_NOT_APPLICABLE="coupon_not_applicable",e.COUPON_WRONG_PAYMENT_METHOD="coupon_wrong_payment_method",e.STRIPE_ERROR="stripe_error",e.RPC_ERROR="rpc_error",e.NETWORK_ERROR="network_error",e.INTERNAL_ERROR="internal_error",e.DATABASE_ERROR="database_error",e.CONFIG_ERROR="config_error",e))(le||{});class A extends Error{code;retryable;details;httpStatus;constructor(t,n,r=!1,o,a){super(n),this.name="PaymentError",this.code=t,this.retryable=r,this.details=o,this.httpStatus=a,Object.setPrototypeOf(this,A.prototype)}canRetry(){return this.retryable}is(t){return this.code===t}isInCategory(t){return t.includes(this.code)}getUserMessage(){const t=this.getErrorInfo();return t.action?`${t.message} ${t.action}`:t.message}getShortMessage(){return this.getErrorInfo().message}getAction(){return this.getErrorInfo().action}getErrorInfo(){return ee(this.code)}static fromErrorResponse(t,n){return new A(t.error.code,t.error.message,t.error.retryable,t.error.details,n)}static fromUnknown(t){return t instanceof A?t:t instanceof Error?new A("internal_error",t.message,!1):new A("internal_error",String(t),!1)}}const st={INSUFFICIENT_FUNDS:["insufficient_funds_sol","insufficient_funds_token"],TRANSACTION_PENDING:["transaction_not_confirmed","transaction_not_found"],VALIDATION:["missing_field","invalid_field","invalid_amount","invalid_wallet","invalid_resource","invalid_cart_item","empty_cart"],COUPON:["invalid_coupon","coupon_not_found","coupon_expired","coupon_usage_limit_reached","coupon_not_applicable","coupon_wrong_payment_method"],RETRYABLE:["transaction_not_confirmed","rpc_error","network_error","stripe_error"],NOT_FOUND:["resource_not_found","cart_not_found","refund_not_found","product_not_found","coupon_not_found","session_not_found"]};async function it(e){const t=e.status;try{const n=await e.json();if(n.error&&typeof n.error.code=="string"){const r=n;return A.fromErrorResponse(r,t)}return new A(le.INTERNAL_ERROR,n.error||n.message||"An unknown error occurred",!1,void 0,t)}catch{return new A(le.INTERNAL_ERROR,e.statusText||"Request failed",!1,void 0,t)}}function ct(e){return e instanceof A&&e.canRetry()}function lt(e){return e instanceof A?e.getUserMessage():e instanceof Error?e.message:String(e)}function Le(){const{stripeManager:e}=l.useCedrosContext(),[t,n]=i.useState({status:"idle",error:null,transactionId:null}),r=i.useCallback(async(m,p,N,y,v,b)=>{n({status:"loading",error:null,transactionId:null});const _={resource:m,successUrl:p,cancelUrl:N,metadata:y,customerEmail:v,couponCode:b},P=await e.processPayment(_);return n({status:P.success?"success":"error",error:P.success?null:P.error||"Payment failed",transactionId:P.success&&P.transactionId||null}),P},[e]),o=i.useCallback(async(m,p,N,y,v,b)=>{n({status:"loading",error:null,transactionId:null});const _=Se(m),P=await e.processCartCheckout({items:_,successUrl:p,cancelUrl:N,metadata:y,customerEmail:v,couponCode:b});return n({status:P.success?"success":"error",error:P.success?null:P.error||"Cart checkout failed",transactionId:P.success&&P.transactionId||null}),P},[e]),a=i.useCallback(()=>{n({status:"idle",error:null,transactionId:null})},[]);return{...t,processPayment:r,processCartCheckout:o,reset:a}}function ge(e,t){const n=Qe(t),r=e||(t?.length===1?t[0].resource:"");return{isCartMode:n,effectiveResource:r}}const ut=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((o,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},ae=new Map;let Z=null;async function Ie(e){if(ae.has(e))return ae.get(e);try{const t=await ut(Object.assign({"./translations/ar.json":()=>Promise.resolve().then(()=>require("./ar-LVoQZTFI.js")),"./translations/bn.json":()=>Promise.resolve().then(()=>require("./bn-BR5Cv1T4.js")),"./translations/de.json":()=>Promise.resolve().then(()=>require("./de-pQxy-oD1.js")),"./translations/en.json":()=>Promise.resolve().then(()=>require("./en-D-uY3ltT.js")),"./translations/es.json":()=>Promise.resolve().then(()=>require("./es-D24cg8dD.js")),"./translations/fil.json":()=>Promise.resolve().then(()=>require("./fil-BOBft9G-.js")),"./translations/fr.json":()=>Promise.resolve().then(()=>require("./fr-Ct9ub8Fa.js")),"./translations/he.json":()=>Promise.resolve().then(()=>require("./he-DtQqRKRq.js")),"./translations/id.json":()=>Promise.resolve().then(()=>require("./id-CiM2mL7C.js")),"./translations/in.json":()=>Promise.resolve().then(()=>require("./in-Bzcjmxcc.js")),"./translations/it.json":()=>Promise.resolve().then(()=>require("./it-Blb_pIJl.js")),"./translations/jp.json":()=>Promise.resolve().then(()=>require("./jp-9NHyIuwY.js")),"./translations/kr.json":()=>Promise.resolve().then(()=>require("./kr-DvzJ-0yX.js")),"./translations/ms.json":()=>Promise.resolve().then(()=>require("./ms-BOAu5pUB.js")),"./translations/nl.json":()=>Promise.resolve().then(()=>require("./nl-WHh_DfO8.js")),"./translations/pa.json":()=>Promise.resolve().then(()=>require("./pa-B7kIhZCF.js")),"./translations/pl.json":()=>Promise.resolve().then(()=>require("./pl-H0hBKdvF.js")),"./translations/pt.json":()=>Promise.resolve().then(()=>require("./pt-DwGrViQ3.js")),"./translations/ru.json":()=>Promise.resolve().then(()=>require("./ru-CB2m0UDT.js")),"./translations/ta.json":()=>Promise.resolve().then(()=>require("./ta-CAS197uN.js")),"./translations/th.json":()=>Promise.resolve().then(()=>require("./th-Cpz2cFcg.js")),"./translations/tr.json":()=>Promise.resolve().then(()=>require("./tr-hQrEFk86.js")),"./translations/uk.json":()=>Promise.resolve().then(()=>require("./uk-DrK2Sv8C.js")),"./translations/ur.json":()=>Promise.resolve().then(()=>require("./ur-D5-7mN9a.js")),"./translations/vn.json":()=>Promise.resolve().then(()=>require("./vn-B_iut9YL.js")),"./translations/zh.json":()=>Promise.resolve().then(()=>require("./zh-PR82dCHr.js"))}),`./translations/${e}.json`,3),n=t.default||t;return ae.set(e,n),n}catch{return null}}async function dt(){if(Z)return Z;const e=Object.assign({"./translations/ar.json":()=>Promise.resolve().then(()=>require("./ar-LVoQZTFI.js")),"./translations/bn.json":()=>Promise.resolve().then(()=>require("./bn-BR5Cv1T4.js")),"./translations/de.json":()=>Promise.resolve().then(()=>require("./de-pQxy-oD1.js")),"./translations/en.json":()=>Promise.resolve().then(()=>require("./en-D-uY3ltT.js")),"./translations/es.json":()=>Promise.resolve().then(()=>require("./es-D24cg8dD.js")),"./translations/fil.json":()=>Promise.resolve().then(()=>require("./fil-BOBft9G-.js")),"./translations/fr.json":()=>Promise.resolve().then(()=>require("./fr-Ct9ub8Fa.js")),"./translations/he.json":()=>Promise.resolve().then(()=>require("./he-DtQqRKRq.js")),"./translations/id.json":()=>Promise.resolve().then(()=>require("./id-CiM2mL7C.js")),"./translations/in.json":()=>Promise.resolve().then(()=>require("./in-Bzcjmxcc.js")),"./translations/it.json":()=>Promise.resolve().then(()=>require("./it-Blb_pIJl.js")),"./translations/jp.json":()=>Promise.resolve().then(()=>require("./jp-9NHyIuwY.js")),"./translations/kr.json":()=>Promise.resolve().then(()=>require("./kr-DvzJ-0yX.js")),"./translations/ms.json":()=>Promise.resolve().then(()=>require("./ms-BOAu5pUB.js")),"./translations/nl.json":()=>Promise.resolve().then(()=>require("./nl-WHh_DfO8.js")),"./translations/pa.json":()=>Promise.resolve().then(()=>require("./pa-B7kIhZCF.js")),"./translations/pl.json":()=>Promise.resolve().then(()=>require("./pl-H0hBKdvF.js")),"./translations/pt.json":()=>Promise.resolve().then(()=>require("./pt-DwGrViQ3.js")),"./translations/ru.json":()=>Promise.resolve().then(()=>require("./ru-CB2m0UDT.js")),"./translations/ta.json":()=>Promise.resolve().then(()=>require("./ta-CAS197uN.js")),"./translations/th.json":()=>Promise.resolve().then(()=>require("./th-Cpz2cFcg.js")),"./translations/tr.json":()=>Promise.resolve().then(()=>require("./tr-hQrEFk86.js")),"./translations/uk.json":()=>Promise.resolve().then(()=>require("./uk-DrK2Sv8C.js")),"./translations/ur.json":()=>Promise.resolve().then(()=>require("./ur-D5-7mN9a.js")),"./translations/vn.json":()=>Promise.resolve().then(()=>require("./vn-B_iut9YL.js")),"./translations/zh.json":()=>Promise.resolve().then(()=>require("./zh-PR82dCHr.js"))}),t=[];for(const n in e){const r=n.match(/\.\/translations\/([a-z]{2,3}(?:-[A-Z]{2})?)\.json$/);r&&t.push(r[1])}return Z=t.length>0?t:["en"],Z}function Oe(){return typeof navigator>"u"?"en":(navigator.language||navigator.userLanguage||"en").split("-")[0].toLowerCase()}async function je(e){let t=await Ie(e);if(t||(t=await Ie("en"),t))return t;throw new Error("Critical: No translation files found, not even en.json")}function Ae(e){return(t,n)=>{const r=t.split(".");let o=e;for(const a of r)if(o&&typeof o=="object"&&a in o)o=o[a];else return t;return typeof o!="string"?t:n?Object.entries(n).reduce((a,[m,p])=>a.replace(new RegExp(`\\{${m}\\}`,"g"),p),o):o}}function mt(e,t,n=!0){const r=t.errors[e];if(!r){const o=ee(e);return n&&o.action?`${o.message} ${o.action}`:o.message}return n&&r.action?`${r.message} ${r.action}`:r.message}function ne(e){const[t,n]=i.useState(null),[r,o]=i.useState(!0),a=i.useMemo(()=>e||Oe(),[e]);return i.useEffect(()=>{let p=!1;return(async()=>{o(!0);try{const y=await je(a);p||(n(y),o(!1))}catch(y){console.error("[CedrosPay] Failed to load translations:",y),p||o(!1)}})(),()=>{p=!0}},[a]),{t:i.useMemo(()=>t?Ae(t):p=>p,[t]),locale:a,isLoading:r,translations:t}}function ft(e,t=!0){const{translations:n}=ne();if(!n){const o=ee(e);return t&&o.action?`${o.message} ${o.action}`:o.message}const r=n.errors[e];if(!r){const o=ee(e);return t&&o.action?`${o.message} ${o.action}`:o.message}return t&&r.action?`${r.message} ${r.action}`:r.message}function qe({resource:e,items:t,successUrl:n,cancelUrl:r,metadata:o,customerEmail:a,couponCode:m,label:p,disabled:N=!1,onAttempt:y,onSuccess:v,onError:b,className:_=""}){const{status:P,error:E,transactionId:q,processPayment:h,processCartCheckout:w}=Le(),c=l.useCedrosTheme(),{isCartMode:C,effectiveResource:d}=ge(e,t),{t:f,translations:k}=ne(),R=p||f("ui.pay_with_card"),S=c.unstyled?_:`${c.className} cedros-theme__stripe-button ${_}`.trim(),g=E&&typeof E!="string"?E?.code??null:null,D=E?typeof E=="string"?E:(O=>{if(!O||!k)return"";const T=k.errors[O];return T?T.action?`${T.message} ${T.action}`:T.message:""})(g):null,x=i.useCallback(async()=>{l.getLogger().debug("[StripeButton] executePayment with couponCode:",m);const O=C&&t?Y(t):void 0;if(me("stripe",d,O),y&&y("stripe"),!C&&!d){const F="Invalid payment configuration: missing resource or items";l.getLogger().error("[StripeButton]",F),G("stripe",F,d,O),b&&b(F);return}let T;te("stripe",d,O),C&&t?(l.getLogger().debug("[StripeButton] Processing cart checkout with coupon:",m),T=await w(t,n,r,o,a,m)):d&&(l.getLogger().debug("[StripeButton] Processing single payment with coupon:",m),T=await h(d,n,r,o,a,m)),T&&T.success&&T.transactionId?(fe("stripe",T.transactionId,d,O),v&&v(T.transactionId)):T&&!T.success&&T.error&&(G("stripe",T.error,d,O),b&&b(T.error))},[m,C,d,t,n,r,o,a,w,h,y,v,b]),M=i.useMemo(()=>C&&t?`stripe-cart-${t.map(O=>O.resource).join("-")}`:`stripe-${d||"unknown"}`,[C,t,d]),V=i.useMemo(()=>de(M,x),[M,x]),X=P==="loading",re=N||X;return u.jsxs("div",{className:S,style:c.unstyled?{}:c.style,children:[u.jsx("button",{onClick:V,disabled:re,className:c.unstyled?_:"cedros-theme__button cedros-theme__stripe",type:"button",children:X?f("ui.processing"):R}),D&&u.jsx("div",{className:c.unstyled?"":"cedros-theme__error",children:D}),q&&u.jsx("div",{className:c.unstyled?"":"cedros-theme__success",children:f("ui.payment_successful")})]})}function Me(){const{x402Manager:e,walletManager:t}=l.useCedrosContext(),{publicKey:n,signTransaction:r}=Te.useWallet(),[o,a]=i.useState({status:"idle",error:null,transactionId:null}),[m,p]=i.useState(null),[N,y]=i.useState(null),v=i.useCallback(()=>{if(!n){const h="Wallet not connected";return a({status:"error",error:h,transactionId:null}),{valid:!1,error:h}}if(!r){const h="Wallet does not support signing";return a({status:"error",error:h,transactionId:null}),{valid:!1,error:h}}return{valid:!0}},[n,r]),b=i.useCallback(async h=>{try{a(c=>({...c,status:"loading"}));const w=await e.requestQuote({resource:h});if(!e.validateRequirement(w))throw new Error("Invalid requirement received from server");return p(w),a(c=>({...c,status:"idle"})),w}catch(w){const c=l.formatError(w,"Failed to fetch requirement");throw a({status:"error",error:c,transactionId:null}),w}},[e]),_=i.useCallback(async(h,w,c,C,d="regular")=>{if(!!h.extra?.feePayer){console.log("⚡ [useX402Payment] GASLESS FLOW - Backend pays fees"),console.log("🔨 [useX402Payment] Requesting backend to build gasless transaction");const{transaction:k,blockhash:R}=await e.buildGaslessTransaction({resourceId:w,userWallet:n.toString(),feePayer:h.extra.feePayer,couponCode:c});console.log("📦 [useX402Payment] Deserializing transaction from backend");const S=t.deserializeTransaction(k);console.log("✍️ [useX402Payment] Requesting wallet to partially sign (transfer authority only)");const g=await t.partiallySignTransaction({transaction:S,signTransaction:r,blockhash:R});console.log("📤 [useX402Payment] Submitting partially-signed transaction to backend");const L=await e.submitGaslessTransaction({resource:w,partialTx:g,couponCode:c,metadata:C,resourceType:d,requirement:h});return L.success&&L.settlement&&y(L.settlement),L}else{const k=await t.buildTransaction({requirement:h,payerPublicKey:n}),R=await t.signTransaction({transaction:k,signTransaction:r}),S=t.buildPaymentPayload({requirement:h,signedTx:R,payerPublicKey:n}),g=await e.submitPayment({resource:w,payload:S,couponCode:c,metadata:C,resourceType:d});return g.success&&g.settlement&&y(g.settlement),g}},[n,r,e,t]),P=i.useCallback(async(h,w,c)=>{const C=v();if(!C.valid)return{success:!1,error:C.error};a({status:"loading",error:null,transactionId:null});try{console.log("🔍 [useX402Payment] Fetching fresh quote for resource:",h);const d=await e.requestQuote({resource:h,couponCode:w});console.log("✅ [useX402Payment] Got quote:",{payTo:d.payTo,amount:d.maxAmountRequired}),p(d),console.log("⚙️ [useX402Payment] Executing payment flow with fresh requirement");const f=await _(d,h,w,c,"regular");return f.success?a({status:"success",error:null,transactionId:f.transactionId||"payment-success"}):a({status:"error",error:f.error||"Payment failed",transactionId:null}),f}catch(d){const f=l.formatError(d,"Payment failed");return a({status:"error",error:f,transactionId:null}),{success:!1,error:f}}},[v,e,_]),E=i.useCallback(async(h,w,c)=>{const C=v();if(!C.valid)return{success:!1,error:C.error};a({status:"loading",error:null,transactionId:null});try{const d=Se(h),f=await e.requestCartQuote({items:d,metadata:w,couponCode:c}),k=f.cartId,R=f.quote;if(!e.validateRequirement(R))throw new Error("Invalid cart quote received from server");p(R);const S=await _(R,k,c,w,"cart");return S.success?a({status:"success",error:null,transactionId:S.transactionId||"cart-payment-success"}):a({status:"error",error:S.error||"Cart payment failed",transactionId:null}),S}catch(d){const f=l.formatError(d,"Cart payment failed");return a({status:"error",error:f,transactionId:null}),{success:!1,error:f}}},[v,e,_]),q=i.useCallback(()=>{a({status:"idle",error:null,transactionId:null}),p(null),y(null)},[]);return{...o,requirement:m,settlement:N,fetchQuote:b,processPayment:P,processCartPayment:E,reset:q}}function He({resource:e,items:t,label:n,disabled:r=!1,onAttempt:o,onSuccess:a,onError:m,className:p="",testPageUrl:N,hideMessages:y=!1,metadata:v,couponCode:b}){const{connected:_,connecting:P,connect:E,disconnect:q,select:h,wallets:w,wallet:c,publicKey:C}=Te.useWallet(),{status:d,error:f,transactionId:k,processPayment:R,processCartPayment:S}=Me(),g=l.useCedrosTheme(),{solanaError:L}=l.useCedrosContext(),{isCartMode:D,effectiveResource:x}=ge(e,t),{t:M,translations:V}=ne(),X=n||M("ui.pay_with_crypto"),re=f&&typeof f!="string"?f?.code??null:null,O=L&&typeof L!="string"?L?.code??null:null,T=s=>{if(!s||!V)return"";const I=V.errors[s];return I?I.action?`${I.message} ${I.action}`:I.message:""},F=f?typeof f=="string"?f:T(re):null,pe=L?typeof L=="string"?L:T(O):null,he=i.useRef(R),ye=i.useRef(S);i.useEffect(()=>{he.current=R,ye.current=S},[R,S]);const Be=i.useMemo(()=>w.map(s=>`${s.adapter.name}-${s.readyState}`).join(","),[w]),K=i.useMemo(()=>w.filter(({readyState:s})=>s===Re.WalletReadyState.Installed||s===Re.WalletReadyState.Loadable),[Be]);i.useEffect(()=>{if(d==="success"&&k){const s=D&&t?Y(t):void 0;fe("crypto",k,x,s),a&&a(k)}},[d,k,a,D,t,x]),i.useEffect(()=>{if(d==="error"&&f){const s=D&&t?Y(t):void 0;G("crypto",f,x,s),m&&m(f)}},[d,f,m,D,t,x]);const _e=typeof window<"u"&&window.top!==window.self,[we,U]=i.useState(!1),[ve,oe]=i.useState(!1),[$,B]=i.useState(null),z=L;i.useEffect(()=>{let s=!1;return s||(async()=>{if(ve&&c&&!_&&!P){l.getLogger().debug("[CryptoButton] Wallet detected, attempting auto-connect:",c.adapter.name),oe(!1),ce(c.adapter.name);try{await E(),s||l.getLogger().debug("[CryptoButton] Auto-connect successful")}catch(j){if(!s){l.getLogger().error("[CryptoButton] Auto-connect failed:",j);const Q=j instanceof Error?j.message:"Failed to connect wallet";J(Q,c.adapter.name),B(null)}}}})(),()=>{s=!0}},[c,ve,_,P,E]),i.useEffect(()=>{if(l.getLogger().debug("[CryptoButton] Payment useEffect triggered",{connected:_,hasPendingPayment:!!$,hasPublicKey:!!C,pendingPaymentType:$?.type}),_&&$&&C&&c){De(c.adapter.name,C.toString()),l.getLogger().debug("[CryptoButton] All conditions met! Processing pending payment:",$);const s=$;B(null),U(!1);const I=s.type==="cart"&&s.items?Y(s.items):void 0;te("crypto",s.resource,I),s.type==="cart"&&s.items?(l.getLogger().debug("[CryptoButton] Auto-processing cart payment"),ye.current(s.items,s.metadata,s.couponCode)):s.type==="single"&&s.resource&&(l.getLogger().debug("[CryptoButton] Auto-processing single payment"),he.current(s.resource,s.couponCode,s.metadata))}},[_,$,C,c]);const be=i.useCallback(async()=>{l.getLogger().debug("[CryptoButton] executePaymentFlow called",{connected:_,wallet:c?.adapter.name,couponCode:b,isCartMode:D,hasItems:!!t,effectiveResource:x});const s=D&&t?Y(t):void 0;if(me("crypto",x,s),o&&o("crypto"),z){l.getLogger().error("[CryptoButton] Solana dependencies missing:",z),G("crypto",z,x,s),m&&m(z);return}if(_e){const I=N||window.location.href;window.open(I,"_blank","noopener,noreferrer");return}if(_)te("crypto",x,s),D&&t?(l.getLogger().debug("[CryptoButton] Processing cart payment with coupon:",b),await S(t,v,b)):x&&(l.getLogger().debug("[CryptoButton] Processing single payment with coupon:",b),await R(x,b,v));else{let I=!1;if(D&&t?(l.getLogger().debug("[CryptoButton] Setting pending cart payment with coupon:",b),B({type:"cart",items:t,metadata:v,couponCode:b}),I=!0):x&&(l.getLogger().debug("[CryptoButton] Setting pending single payment with coupon:",b),B({type:"single",resource:x,metadata:v,couponCode:b}),I=!0),!I){l.getLogger().error("[CryptoButton] No valid payment to process");return}try{if(c)l.getLogger().debug("[CryptoButton] Wallet already selected, connecting:",c.adapter.name),ce(c.adapter.name),await E();else{if(l.getLogger().debug("[CryptoButton] No wallet selected, showing selector. Available wallets:",K.map(j=>j.adapter.name)),K.length===0){B(null);const j="No wallets available";throw J(j),new Error(j)}U(!0)}}catch(j){B(null);const Q=j instanceof Error?j.message:"Failed to connect wallet";l.getLogger().error("[CryptoButton] Connection error:",Q),J(Q,c?.adapter.name)}}},[_,c,b,D,t,x,_e,N,K,E,v,S,R,z,o,m]),Pe=i.useMemo(()=>D&&t?`crypto-cart-${t.map(s=>s.resource).join("-")}`:`crypto-${x||"unknown"}`,[D,t,x]),We=i.useMemo(()=>de(Pe,be,{cooldownMs:200,deduplicationWindowMs:0}),[Pe,be]),Ce=d==="loading",Fe=r||Ce||P||!!z,Ue=Ce?M("ui.processing"):X,$e=i.useCallback(async()=>{try{oe(!1),_&&await q(),h(null),U(!0)}catch(s){l.getLogger().error("Failed to change wallet:",s)}},[_,q,h]),ze=i.useCallback(s=>{l.getLogger().debug("[CryptoButton] Wallet clicked:",s),U(!1),h(s),oe(!0),l.getLogger().debug("[CryptoButton] Wallet selected, useEffect will auto-connect")},[h]),Ye=i.useCallback(async()=>{try{await q(),B(null),typeof window<"u"&&window.localStorage&&window.localStorage.removeItem("walletName")}catch(s){l.getLogger().error("Failed to disconnect wallet:",s)}},[q]);return u.jsxs("div",{className:g.unstyled?p:`${g.className} cedros-theme__crypto-button ${p||""}`,style:g.unstyled?{}:g.style,children:[u.jsx("button",{onClick:We,disabled:Fe,className:g.unstyled?p:"cedros-theme__button cedros-theme__crypto",type:"button",children:Ue}),we&&!y&&u.jsx("div",{className:"cedros-modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:g.tokens.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem"},onClick:()=>U(!1),children:u.jsxs("div",{className:"cedros-modal-content",style:{backgroundColor:g.tokens.modalBackground,borderRadius:"12px",padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",border:`1px solid ${g.tokens.modalBorder}`},onClick:s=>s.stopPropagation(),children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[u.jsx("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:600,color:g.tokens.surfaceText},children:M("wallet.select_wallet")}),u.jsx("button",{onClick:()=>U(!1),style:Ee(g.tokens.surfaceText),"aria-label":"Close modal",type:"button",children:"×"})]}),u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:K.map(s=>u.jsxs("button",{onClick:()=>ze(s.adapter.name),style:{width:"100%",padding:"1rem",backgroundColor:g.tokens.surfaceBackground,border:`1px solid ${g.tokens.surfaceBorder}`,borderRadius:"0.5rem",cursor:"pointer",fontSize:"1rem",textAlign:"left",color:g.tokens.surfaceText,display:"flex",alignItems:"center",gap:"1rem",transition:"all 0.2s ease"},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=g.tokens.modalBackground,I.currentTarget.style.borderColor=g.tokens.surfaceText,I.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:I=>{I.currentTarget.style.backgroundColor=g.tokens.surfaceBackground,I.currentTarget.style.borderColor=g.tokens.surfaceBorder,I.currentTarget.style.transform="translateY(0)"},type:"button",children:[u.jsx(Ge.WalletIcon,{wallet:s,style:{width:"24px",height:"24px"}}),u.jsx("span",{style:{fontWeight:500},children:s.adapter.name})]},s.adapter.name))})]})}),_&&!y&&!we&&u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem",fontSize:"0.75rem",color:g.tokens.surfaceText,opacity:.7},children:[u.jsx("button",{onClick:$e,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:"Change Wallet"}),u.jsx("button",{onClick:Ye,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:M("ui.disconnect")})]}),!y&&pe&&u.jsx("div",{className:g.unstyled?"":"cedros-theme__error",children:pe}),!y&&F&&u.jsx("div",{className:g.unstyled?"":"cedros-theme__error",children:F}),!y&&k&&u.jsx("div",{className:g.unstyled?"":"cedros-theme__success",children:M("ui.payment_successful")})]})}const gt=({isOpen:e,onClose:t,resource:n,items:r,cardLabel:o="Card",cryptoLabel:a="USDC (Solana)",showCard:m=!0,showCrypto:p=!0,onPaymentAttempt:N,onPaymentSuccess:y,onPaymentError:v,onStripeSuccess:b,onCryptoSuccess:_,onStripeError:P,onCryptoError:E,customerEmail:q,successUrl:h,cancelUrl:w,metadata:c,couponCode:C,testPageUrl:d,hideMessages:f=!1})=>{const{tokens:k}=l.useCedrosTheme();return i.useEffect(()=>{const R=S=>{S.key==="Escape"&&e&&t()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[e,t]),i.useEffect(()=>{if(e){const R=window.scrollY;return document.body.style.position="fixed",document.body.style.top=`-${R}px`,document.body.style.width="100%",document.body.style.overflowY="scroll",()=>{const S=document.body.style.top?Math.abs(parseInt(document.body.style.top.replace("px",""),10)):0;document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflowY="",window.scrollTo(0,S)}}},[e]),e?u.jsx("div",{className:"cedros-modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:k.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem"},onClick:t,children:u.jsxs("div",{className:"cedros-modal-content",style:{backgroundColor:k.modalBackground,borderRadius:"12px",padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",border:`1px solid ${k.modalBorder}`},onClick:R=>R.stopPropagation(),children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[u.jsx("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:600,color:k.surfaceText},children:"Choose Payment Method"}),u.jsx("button",{onClick:t,style:Ee(k.surfaceText),"aria-label":"Close modal",children:"×"})]}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[m&&u.jsx(qe,{resource:n,items:r,label:o,onAttempt:N,onSuccess:b||y,onError:P||v,customerEmail:q,successUrl:h,cancelUrl:w,metadata:c,couponCode:C}),p&&u.jsx(He,{resource:n,items:r,label:a,onAttempt:N,onSuccess:_||y,onError:E||v,testPageUrl:d,hideMessages:f,metadata:c,couponCode:C})]})]})}):null};function pt({product:e,paymentMethod:t,showOriginalPrice:n=!1,className:r="",style:o={}}){const a=t==="stripe",m=a?e.fiatAmount:e.cryptoAmount,p=a?e.effectiveFiatAmount:e.effectiveCryptoAmount,N=a?e.fiatCurrency.toUpperCase():e.cryptoToken,y=a?e.hasStripeCoupon:e.hasCryptoCoupon,v=a?e.stripeDiscountPercent:e.cryptoDiscountPercent;return u.jsxs("div",{className:r,style:o,children:[n&&y&&u.jsxs("span",{style:{textDecoration:"line-through",opacity:.6,marginRight:"0.5rem",fontSize:"0.875em"},children:[m.toFixed(2)," ",N]}),u.jsxs("span",{style:{fontWeight:600},children:[p.toFixed(2)," ",N]}),y&&v>0&&u.jsxs("span",{style:{marginLeft:"0.5rem",padding:"0.125rem 0.375rem",backgroundColor:"#10b981",color:"white",borderRadius:"0.25rem",fontSize:"0.75em",fontWeight:600},children:[v,"% OFF"]})]})}function ht({product:e,paymentMethod:t,className:n="",style:r={}}){const o=t==="stripe",a=o?e.hasStripeCoupon:e.hasCryptoCoupon,m=o?e.stripeDiscountPercent:e.cryptoDiscountPercent,p=o?e.stripeCouponCode:e.cryptoCouponCode;if(!a||m===0)return null;const N=o?`${m}% off with card!`:`${m}% off with crypto!`;return u.jsxs("div",{className:n,style:{display:"inline-flex",alignItems:"center",padding:"0.5rem 0.75rem",backgroundColor:o?"#6366f1":"#10b981",color:"white",borderRadius:"0.375rem",fontSize:"0.875rem",fontWeight:600,...r},children:[N,p&&u.jsxs("span",{style:{marginLeft:"0.5rem",opacity:.8,fontSize:"0.75em",fontWeight:400},children:["(",p,")"]})]})}exports.CEDROS_EVENTS=H;exports.CryptoButton=He;exports.ERROR_CATEGORIES=st;exports.PaymentMethodBadge=ht;exports.PaymentModal=gt;exports.ProductPrice=pt;exports.StripeButton=qe;exports.calculateDiscountPercentage=Ke;exports.createDedupedClickHandler=de;exports.createTranslator=Ae;exports.detectLocale=Oe;exports.emitPaymentError=G;exports.emitPaymentProcessing=te;exports.emitPaymentStart=me;exports.emitPaymentSuccess=fe;exports.emitWalletConnect=ce;exports.emitWalletConnected=De;exports.emitWalletError=J;exports.formatCouponCodes=Xe;exports.getAvailableLocales=dt;exports.getCartItemCount=Y;exports.getLocalizedError=mt;exports.getUserErrorMessage=lt;exports.isRetryableError=ct;exports.loadLocale=je;exports.parseCouponCodes=Ve;exports.parseErrorResponse=it;exports.useLocalizedError=ft;exports.usePaymentMode=ge;exports.useStripeCheckout=Le;exports.useTranslation=ne;exports.useX402Payment=Me;
|