@ecomiq/storefront 2.1.4 → 3.0.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.
Files changed (310) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -103
  3. package/dist/account-Dx4e3syi.js +258 -0
  4. package/dist/account-forms-AVk71ko7.js +39 -0
  5. package/dist/account-forms.d.ts +13 -0
  6. package/dist/account.d.ts +240 -0
  7. package/dist/address-defaults-BqjRhS82.js +14 -0
  8. package/dist/address-defaults.d.ts +11 -0
  9. package/dist/analytics/analytics-CG1Qagwl.js +148 -0
  10. package/dist/analytics/analytics.d.ts +1 -0
  11. package/dist/analytics/config-DJr-GRhs.js +62 -0
  12. package/dist/analytics/config.d.ts +22 -0
  13. package/dist/analytics/consent-B13rBpBs.js +57 -0
  14. package/dist/analytics/consent-banner-9QvRRy8v.js +239 -0
  15. package/dist/analytics/consent-banner.d.ts +20 -0
  16. package/dist/analytics/cookies-pLozllyB.js +100 -0
  17. package/dist/analytics/cookies.d.ts +6 -0
  18. package/dist/analytics/destinations-iECrlLIr.js +144 -0
  19. package/dist/analytics/events-Dt81tIp1.js +102 -0
  20. package/dist/analytics/events.d.ts +51 -0
  21. package/dist/analytics/tracker-p4yaoOyk.js +51 -0
  22. package/dist/api-cache-DsuIn5hX.js +159 -0
  23. package/dist/bank-accounts-DlEczQQ5.js +81 -0
  24. package/dist/bank-accounts.d.ts +4 -0
  25. package/dist/captcha-DAqaIx8m.js +117 -0
  26. package/dist/captcha.d.ts +34 -0
  27. package/dist/cart-D7DxZ2lD.js +30 -0
  28. package/dist/cart-actions-Bsub_FFG.js +116 -0
  29. package/dist/cart-actions.d.ts +15 -0
  30. package/dist/cart-drawer-B7PPsR69.js +22 -0
  31. package/dist/cart-drawer.d.ts +9 -0
  32. package/dist/cart-form-y9P1r_EX.js +81 -0
  33. package/dist/cart-form.d.ts +24 -0
  34. package/dist/cart-summary-ur2VWKr-.js +89 -0
  35. package/dist/cart-summary.d.ts +31 -0
  36. package/dist/cart.d.ts +4 -0
  37. package/dist/catalog-7gJ-l5hW.js +67 -0
  38. package/dist/catalog-hooks-B7ZP4wYY.js +312 -0
  39. package/dist/catalog-hooks.d.ts +111 -0
  40. package/dist/catalog.d.ts +5 -0
  41. package/dist/checkout-DVWSXANi.js +474 -0
  42. package/dist/checkout-form-CbOIdENC.js +131 -0
  43. package/dist/checkout-form.d.ts +20 -0
  44. package/dist/checkout.d.ts +86 -0
  45. package/dist/complaint-book-BvwLvfx0.js +117 -0
  46. package/dist/complaint-book.d.ts +62 -0
  47. package/dist/culqi-authentication-BGr20vAJ.js +204 -0
  48. package/dist/culqi-authentication.d.ts +15 -0
  49. package/dist/culqi-checkout-CTXpKgp_.js +55 -0
  50. package/dist/culqi-three-ds-HP3mfrvV.js +33 -0
  51. package/dist/culqi-three-ds.d.ts +29 -0
  52. package/dist/customer-avatar-CJXSDroK.js +12 -0
  53. package/dist/customer-avatar.d.ts +5 -0
  54. package/dist/customer-cookies-DHOgFAMV.js +45 -0
  55. package/dist/customer-csrf-C1oDX-Py.js +17 -0
  56. package/dist/customer-csrf.d.ts +3 -0
  57. package/dist/customer-document-fields-C1K-_DAD.js +70 -0
  58. package/dist/customer-document-fields.d.ts +9 -0
  59. package/dist/customer-login-form-C7AC6vXd.js +144 -0
  60. package/dist/customer-login-form.d.ts +17 -0
  61. package/dist/customer-registration-form-BEm_NEfP.js +93 -0
  62. package/dist/customer-registration-form.d.ts +8 -0
  63. package/dist/document-url-CGsAl5Tf.js +9 -0
  64. package/dist/documents-T1mzc_j8.js +38 -0
  65. package/dist/documents.d.ts +16 -0
  66. package/dist/entries/account.d.ts +11 -0
  67. package/dist/entries/account.js +10 -0
  68. package/dist/entries/analytics.d.ts +6 -0
  69. package/dist/entries/analytics.js +5 -0
  70. package/dist/entries/cart.d.ts +8 -0
  71. package/dist/entries/cart.js +7 -0
  72. package/dist/entries/checkout.d.ts +12 -0
  73. package/dist/entries/checkout.js +11 -0
  74. package/dist/entries/order.d.ts +11 -0
  75. package/dist/entries/order.js +11 -0
  76. package/dist/favicon-YpyhVJ9H.js +28 -0
  77. package/dist/favicon.d.ts +4 -0
  78. package/dist/form-BtQcbXlJ.js +18 -0
  79. package/dist/form-contracts-BNpHaTGJ.js +166 -0
  80. package/dist/form-contracts.d.ts +42 -0
  81. package/dist/form.d.ts +3 -0
  82. package/dist/hidden-CCWtOWKR.js +3 -0
  83. package/dist/hidden.d.ts +4 -0
  84. package/dist/index.d.ts +50 -0
  85. package/dist/index.js +50 -0
  86. package/dist/invoice-fields-BG0HjL6T.js +103 -0
  87. package/dist/invoice-fields.d.ts +39 -0
  88. package/dist/links-kFxBZfdb.js +96 -0
  89. package/dist/links.d.ts +21 -0
  90. package/dist/mercadopago-checkout-DC7RXa8k.js +27 -0
  91. package/dist/mercadopago-dialog-UTQev0MG.js +180 -0
  92. package/dist/mercadopago-dialog.d.ts +21 -0
  93. package/dist/money-DtGOtDri.js +32 -0
  94. package/dist/money.d.ts +1 -0
  95. package/dist/optimistic-cart-BveVOHuh.js +53 -0
  96. package/dist/optimistic-cart.d.ts +16 -0
  97. package/dist/order-display-DTt5WBbc.js +112 -0
  98. package/dist/order-display.d.ts +20 -0
  99. package/dist/order-draft-DxV1Uhm3.js +38 -0
  100. package/dist/order-draft.d.ts +16 -0
  101. package/dist/order-pages-Dm6l5m0m.js +38 -0
  102. package/dist/order-pages.d.ts +12 -0
  103. package/dist/order-payment-continuation-D_d5PGA4.js +212 -0
  104. package/dist/order-payment-continuation.d.ts +10 -0
  105. package/dist/order-payment-in-review-x4gdLFHZ.js +65 -0
  106. package/dist/order-payment-in-review.d.ts +5 -0
  107. package/dist/order-status-BJXLJwxq.js +162 -0
  108. package/dist/order-status.d.ts +89 -0
  109. package/dist/order-view-9IlBg5AF.js +62 -0
  110. package/dist/order-view.d.ts +12 -0
  111. package/dist/page-action-Ctkf4xC6.js +7 -0
  112. package/dist/page-seo-a5FJl8x5.js +262 -0
  113. package/dist/page-seo.d.ts +34 -0
  114. package/dist/pages-Ca_Gt6mq.js +150 -0
  115. package/dist/pages.d.ts +45 -0
  116. package/dist/payment-dialog-frame-B-Q_xQ94.js +57 -0
  117. package/dist/payment-logo-BoPaGJc_.js +46 -0
  118. package/dist/payment-logo-svgs-By9lDTLK.js +20 -0
  119. package/dist/payment-logo.d.ts +11 -0
  120. package/dist/payment-logos-BYvdwYyJ.js +23 -0
  121. package/dist/payment-methods-B8ocTgFZ.js +73 -0
  122. package/dist/payment-methods.d.ts +58 -0
  123. package/dist/payment-return-5cjypwIw.js +7 -0
  124. package/dist/place-CmW4hBWY.js +13 -0
  125. package/dist/place.d.ts +4 -0
  126. package/dist/preview-BiIBif3C.js +427 -0
  127. package/dist/preview-address-Cf0sJ-9p.js +21 -0
  128. package/dist/preview-cart-Dg2CVktS.js +376 -0
  129. package/dist/product-preview-BspMAecJ.js +51 -0
  130. package/dist/product-preview.d.ts +5 -0
  131. package/dist/product-variants-BNDHvs1y.js +46 -0
  132. package/dist/product-variants.d.ts +12 -0
  133. package/dist/public-pages-XtwlaLwt.js +194 -0
  134. package/dist/public-pages.d.ts +67 -0
  135. package/dist/registration-CpDcv8ql.js +91 -0
  136. package/dist/registration.d.ts +12 -0
  137. package/dist/request-security-CRsRMgwj.js +76 -0
  138. package/dist/rich-text-M-Ju8RL4.js +9 -0
  139. package/dist/rich-text.d.ts +5 -0
  140. package/dist/route-text-DcJw2SsK.js +9 -0
  141. package/dist/route-text.d.ts +4 -0
  142. package/dist/section-preview-CmsMl3yu.js +83 -0
  143. package/dist/section-preview.d.ts +12 -0
  144. package/dist/sections/account-addresses.d.ts +18 -0
  145. package/dist/sections/account-addresses.js +375 -0
  146. package/dist/sections/account-order.d.ts +12 -0
  147. package/dist/sections/account-order.js +592 -0
  148. package/dist/sections/account-orders.d.ts +8 -0
  149. package/dist/sections/account-orders.js +359 -0
  150. package/dist/sections/account-profile.d.ts +16 -0
  151. package/dist/sections/account-profile.js +123 -0
  152. package/dist/sections/checkout.d.ts +24 -0
  153. package/dist/sections/checkout.js +963 -0
  154. package/dist/sections/complaint-book.d.ts +8 -0
  155. package/dist/sections/complaint-book.js +538 -0
  156. package/dist/sections/design-system.d.ts +1 -0
  157. package/dist/sections/design-system.js +310 -0
  158. package/dist/sections/draft-invoice.d.ts +20 -0
  159. package/dist/sections/draft-invoice.js +158 -0
  160. package/dist/sections/order-tracking.d.ts +19 -0
  161. package/dist/sections/order-tracking.js +141 -0
  162. package/dist/sections-CNUMWTF_.js +77 -0
  163. package/dist/sections.d.ts +19 -0
  164. package/dist/seo-GpDRhAAA.js +78 -0
  165. package/dist/session-CKvmFJyg.js +379 -0
  166. package/dist/session.d.ts +24 -0
  167. package/dist/settings-B0NO2A6Y.js +78 -0
  168. package/dist/settings.d.ts +51 -0
  169. package/dist/source-marker-DhqSkW7n.js +4 -0
  170. package/dist/sources-B-3JFJfb.js +46 -0
  171. package/dist/sources.d.ts +7 -0
  172. package/dist/store-8Q-_LFrQ.js +152 -0
  173. package/dist/store-contact--hY6CoFb.js +19 -0
  174. package/dist/store-contact.d.ts +6 -0
  175. package/dist/store.d.ts +17 -0
  176. package/dist/storefront-language-DrMjVbmk.js +29 -0
  177. package/dist/storefront-language.d.ts +14 -0
  178. package/dist/storefront-text-D25ae1qf.js +11 -0
  179. package/dist/storefront-text-en-ljjjSS4q.js +1030 -0
  180. package/dist/storefront-text-pt-BtHaJLcp.js +1030 -0
  181. package/dist/storefront-text.d.ts +4 -0
  182. package/dist/stripe-dialog-Ev9s3Z62.js +396 -0
  183. package/dist/stripe-dialog.d.ts +30 -0
  184. package/dist/telemetry-HuZXWBPi.js +114 -0
  185. package/dist/telemetry.d.ts +10 -0
  186. package/dist/templates-CAqoNyTW.js +40 -0
  187. package/dist/templates.d.ts +15 -0
  188. package/dist/urls-CpGQPxvf.js +71 -0
  189. package/dist/urls.d.ts +18 -0
  190. package/dist/use-checkout-CZcxXJXi.js +42 -0
  191. package/dist/use-checkout-payment-9R-zacrJ.js +80 -0
  192. package/dist/use-checkout-payment.d.ts +18 -0
  193. package/dist/use-checkout.d.ts +36 -0
  194. package/dist/use-culqi-checkout-CrjLAipU.js +109 -0
  195. package/dist/use-order-payment-BKIz_IO0.js +45 -0
  196. package/dist/use-order-payment.d.ts +18 -0
  197. package/dist/use-payment-token-CErx-tN-.js +105 -0
  198. package/dist/vite-payment-logos-kziu7wKb.js +27 -0
  199. package/dist/vite-payment-logos.d.ts +24 -0
  200. package/dist/vite-public-assets-DW2fgtVb.js +209 -0
  201. package/dist/vite-public-assets.d.ts +29 -0
  202. package/dist/vite-sections-DTBr0-Kg.js +464 -0
  203. package/dist/vite-sections.d.ts +21 -0
  204. package/dist/vite-theme-ui-BMO-CDi3.js +41 -0
  205. package/dist/vite-theme-ui.d.ts +10 -0
  206. package/dist/vite.d.ts +36 -0
  207. package/dist/vite.js +127 -0
  208. package/dist/voucher-payment-CVFDZ1L8.js +66 -0
  209. package/dist/worker-CNi-gzCu.js +86 -0
  210. package/dist/worker.d.ts +27 -0
  211. package/package.json +100 -76
  212. package/src/sections/account-addresses.tsx +215 -0
  213. package/src/sections/account-order.tsx +424 -0
  214. package/src/sections/account-orders.tsx +259 -0
  215. package/src/sections/account-profile.tsx +70 -0
  216. package/src/sections/checkout.tsx +586 -0
  217. package/src/sections/complaint-book.tsx +325 -0
  218. package/src/sections/design-system.tsx +146 -0
  219. package/src/sections/draft-invoice.tsx +105 -0
  220. package/src/sections/order-tracking.tsx +81 -0
  221. package/src/vite-client.d.ts +4 -0
  222. package/bin/ecomiq.mjs +0 -179
  223. package/public/design-bridge.js +0 -318
  224. package/src/api-proxy.ts +0 -194
  225. package/src/auth/create-storefront-auth.ts +0 -94
  226. package/src/auth/ecomiq-oauth-password-client.ts +0 -26
  227. package/src/auth/ecomiq-oauth-password-constants.ts +0 -24
  228. package/src/auth/ecomiq-oauth-password-plugin.ts +0 -294
  229. package/src/auth/ecomiq-oauth-password-types.ts +0 -24
  230. package/src/auth/ecomiq-storefront-sign-in.ts +0 -44
  231. package/src/auth/env.ts +0 -7
  232. package/src/auth/secure-cookies.ts +0 -23
  233. package/src/auth/storefront-auth-base-url.ts +0 -117
  234. package/src/auth/storefront-auth.ts +0 -7
  235. package/src/cart-session.ts +0 -239
  236. package/src/client.ts +0 -48
  237. package/src/codegen.mjs +0 -801
  238. package/src/components/account/customer-addresses-panel.tsx +0 -678
  239. package/src/components/account/customer-order-detail-panel.tsx +0 -285
  240. package/src/components/account/customer-orders-panel.tsx +0 -192
  241. package/src/components/account/customer-profile-panel.tsx +0 -379
  242. package/src/components/checkout/cart-sync.ts +0 -143
  243. package/src/components/checkout/checkout-contact-section.tsx +0 -76
  244. package/src/components/checkout/checkout-external-update-banner.tsx +0 -15
  245. package/src/components/checkout/checkout-form-controls.tsx +0 -139
  246. package/src/components/checkout/checkout-line-items.tsx +0 -43
  247. package/src/components/checkout/checkout-order-summary.tsx +0 -165
  248. package/src/components/checkout/checkout-payment-section.tsx +0 -212
  249. package/src/components/checkout/checkout-session-view.tsx +0 -564
  250. package/src/components/checkout/checkout-shipping-address-section.tsx +0 -400
  251. package/src/components/checkout/checkout-shipping-section.tsx +0 -98
  252. package/src/components/checkout/checkout-states.tsx +0 -73
  253. package/src/components/checkout/checkout-step-card.tsx +0 -101
  254. package/src/components/checkout/checkout-steps.ts +0 -111
  255. package/src/components/checkout/form-schema.ts +0 -281
  256. package/src/components/checkout/format.ts +0 -15
  257. package/src/components/checkout/index.ts +0 -5
  258. package/src/components/checkout/map-customer-to-checkout.ts +0 -188
  259. package/src/components/checkout/types.ts +0 -41
  260. package/src/components/checkout/use-checkout-customer-prefill.ts +0 -409
  261. package/src/components/checkout/use-checkout-geo.ts +0 -50
  262. package/src/components/checkout/use-checkout-session.ts +0 -640
  263. package/src/components/hero.tsx +0 -291
  264. package/src/config.d.ts +0 -94
  265. package/src/config.mjs +0 -146
  266. package/src/format-money.ts +0 -31
  267. package/src/health.ts +0 -90
  268. package/src/hooks/index.ts +0 -9
  269. package/src/hooks/recently-viewed.ts +0 -125
  270. package/src/index.ts +0 -349
  271. package/src/link.tsx +0 -2
  272. package/src/pages/account/account-page-skeleton.tsx +0 -69
  273. package/src/pages/account/account-page-view.tsx +0 -270
  274. package/src/pages/account/account-shell.tsx +0 -101
  275. package/src/pages/account/parse-account-route.ts +0 -36
  276. package/src/pages/account.tsx +0 -16
  277. package/src/pages/api.$.ts +0 -20
  278. package/src/pages/api.auth.$.ts +0 -16
  279. package/src/pages/checkout.$checkoutId.tsx +0 -60
  280. package/src/pages/checkout.tsx +0 -31
  281. package/src/pages/pages.$pageSlug.tsx +0 -74
  282. package/src/pages/thank-you.tsx +0 -53
  283. package/src/providers/auth.tsx +0 -96
  284. package/src/providers/cart.tsx +0 -275
  285. package/src/providers/ecomiq.ts +0 -137
  286. package/src/providers/index.ts +0 -26
  287. package/src/proxy-api.ts +0 -20
  288. package/src/public-config.ts +0 -24
  289. package/src/review-submission.ts +0 -89
  290. package/src/runtime/context.ts +0 -2
  291. package/src/runtime/default-layout.tsx +0 -64
  292. package/src/runtime/head.ts +0 -149
  293. package/src/runtime/page.tsx +0 -143
  294. package/src/runtime/postcss-browser-stub.mjs +0 -5
  295. package/src/server-config-store.ts +0 -35
  296. package/src/server.ts +0 -286
  297. package/src/styles.css +0 -76
  298. package/src/ui/badge.tsx +0 -32
  299. package/src/ui/button.tsx +0 -31
  300. package/src/ui/card.tsx +0 -31
  301. package/src/ui/carousel.tsx +0 -218
  302. package/src/ui/cn.ts +0 -6
  303. package/src/ui/index.ts +0 -8
  304. package/src/ui/separator.tsx +0 -6
  305. package/src/ui/skeleton.tsx +0 -6
  306. package/src/ui/storefront-error.tsx +0 -49
  307. package/src/utils.ts +0 -36
  308. package/src/vite-inline.mjs +0 -263
  309. package/templates/__root.tsx +0 -83
  310. package/templates/router.tsx +0 -19
@@ -0,0 +1,963 @@
1
+ import { BankAccountList } from "../bank-accounts-DlEczQQ5.js";
2
+ import { useStorefrontText } from "../storefront-language-DrMjVbmk.js";
3
+ import { PaymentLogo } from "../payment-logo-BoPaGJc_.js";
4
+ import { money } from "../money-DtGOtDri.js";
5
+ import { section, setting } from "../settings-B0NO2A6Y.js";
6
+ import { placeValue, useGeoCascade } from "../catalog-hooks-B7ZP4wYY.js";
7
+ import { CheckoutForm, OrderBumpForm, PromoCodeForm } from "../checkout-form-CbOIdENC.js";
8
+ import { CulqiAuthentication } from "../culqi-authentication-BGr20vAJ.js";
9
+ import { InvoiceFields } from "../invoice-fields-BG0HjL6T.js";
10
+ import { MercadoPagoDialog } from "../mercadopago-dialog-UTQev0MG.js";
11
+ import { PaymentMethods } from "../payment-methods-B8ocTgFZ.js";
12
+ import { StripeAuthentication, StripeDialog, findStripeWallet, useAvailableStripeWallets } from "../stripe-dialog-Ev9s3Z62.js";
13
+ import { summaryLines } from "../cart-summary-ur2VWKr-.js";
14
+ import { useCheckout } from "../use-checkout-CZcxXJXi.js";
15
+ import { useCheckoutPayment } from "../use-checkout-payment-9R-zacrJ.js";
16
+ import { Link, useRouteLoaderData } from "react-router";
17
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
18
+ import { Button } from "@theme/ui/button";
19
+ // src/sections/checkout.tsx
20
+ const catalog = {
21
+ name: "Finalizar compra",
22
+ description: "Checkout de la tienda: contacto, entrega, envío y pago, con el resumen del pedido."
23
+ };
24
+ const settings = { checkout: {
25
+ layout: setting.select("steps", "Tipo de checkout", {
26
+ steps: "Por pasos",
27
+ single: "Una página"
28
+ }),
29
+ summary: setting.select("right", "Resumen del pedido", {
30
+ right: "A la derecha",
31
+ left: "A la izquierda"
32
+ }),
33
+ main: setting.scheme("claro", "Esquema del formulario"),
34
+ aside: setting.scheme("claro", "Esquema del resumen"),
35
+ logo: setting.select("left", "Logo", {
36
+ left: "A la izquierda",
37
+ center: "Centrado"
38
+ }),
39
+ secure: setting.toggle(true, "«Compra segura» en la cabecera"),
40
+ marks: setting.toggle(true, "Logos de medios de pago"),
41
+ encrypted: setting.toggle(true, "Aviso de datos cifrados"),
42
+ fields: setting.select("outline", "Campos", {
43
+ outline: "Con borde",
44
+ filled: "Con fondo"
45
+ }),
46
+ corners: setting.select("soft", "Esquinas", {
47
+ square: "Rectas",
48
+ soft: "Suaves",
49
+ round: "Redondeadas"
50
+ }),
51
+ button: setting.select("full", "Botón de pagar", {
52
+ full: "A todo el ancho",
53
+ fit: "Al contenido"
54
+ })
55
+ } };
56
+ const RADIUS = {
57
+ square: "0px",
58
+ soft: "0.5rem",
59
+ round: "1rem"
60
+ };
61
+ const FIELD = "peer w-full rounded-md border border-input bg-background px-3.5 pt-5 pb-1.5 text-base text-foreground md:text-sm outline-none transition-colors placeholder:text-transparent focus:border-ring focus:ring-1 focus:ring-ring disabled:opacity-60 group-data-[fields=filled]/checkout:border-transparent group-data-[fields=filled]/checkout:bg-muted";
62
+ const FLOAT = "pointer-events-none absolute top-1/2 left-3.5 -translate-y-1/2 text-sm text-muted-foreground transition-all peer-focus:top-3 peer-focus:text-[11px] peer-[:not(:placeholder-shown)]:top-3 peer-[:not(:placeholder-shown)]:text-[11px]";
63
+ const GROUP = "overflow-hidden rounded-md border border-input bg-background";
64
+ const ROW = "flex cursor-pointer items-center gap-3 px-4 py-3.5 text-sm has-[:checked]:bg-muted/60";
65
+ const STEPS = [
66
+ {
67
+ step: "contact",
68
+ label: "Contacto"
69
+ },
70
+ {
71
+ step: "delivery",
72
+ label: "Entrega"
73
+ },
74
+ {
75
+ step: "shipping",
76
+ label: "Envío"
77
+ },
78
+ {
79
+ step: "payment",
80
+ label: "Pago"
81
+ }
82
+ ];
83
+ function shopOf(data) {
84
+ const shop = typeof data === "object" && data !== null ? data.shop : void 0;
85
+ return {
86
+ name: shop?.name ?? "",
87
+ logo: shop?.logo ?? null,
88
+ language: shop?.language ?? "es"
89
+ };
90
+ }
91
+ function Lock() {
92
+ return /* @__PURE__ */ jsxs("svg", {
93
+ "aria-hidden": "true",
94
+ viewBox: "0 0 24 24",
95
+ className: "size-4",
96
+ fill: "none",
97
+ stroke: "currentColor",
98
+ strokeWidth: 1.8,
99
+ children: [/* @__PURE__ */ jsx("rect", {
100
+ x: "5",
101
+ y: "11",
102
+ width: "14",
103
+ height: "9",
104
+ rx: "2"
105
+ }), /* @__PURE__ */ jsx("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })]
106
+ });
107
+ }
108
+ function Bag() {
109
+ return /* @__PURE__ */ jsxs("svg", {
110
+ "aria-hidden": "true",
111
+ viewBox: "0 0 24 24",
112
+ className: "size-5",
113
+ fill: "none",
114
+ stroke: "currentColor",
115
+ strokeWidth: 1.6,
116
+ children: [/* @__PURE__ */ jsx("path", { d: "M6 8h12l-1 12H7L6 8Z" }), /* @__PURE__ */ jsx("path", { d: "M9 8a3 3 0 0 1 6 0" })]
117
+ });
118
+ }
119
+ function Field({ label, className, ...props }) {
120
+ return /* @__PURE__ */ jsxs("label", {
121
+ className: `relative block ${className ?? ""}`,
122
+ children: [/* @__PURE__ */ jsx("input", {
123
+ id: props.id ?? props.name,
124
+ placeholder: label,
125
+ className: FIELD,
126
+ ...props
127
+ }), /* @__PURE__ */ jsx("span", {
128
+ className: FLOAT,
129
+ children: label
130
+ })]
131
+ });
132
+ }
133
+ function Choice({ label, className, children, ...props }) {
134
+ return /* @__PURE__ */ jsxs("label", {
135
+ className: `relative block ${className ?? ""}`,
136
+ children: [
137
+ /* @__PURE__ */ jsx("select", {
138
+ id: props.id ?? props.name,
139
+ className: `${FIELD} appearance-none pr-9`,
140
+ ...props,
141
+ children
142
+ }),
143
+ /* @__PURE__ */ jsx("span", {
144
+ className: "pointer-events-none absolute top-3 left-3.5 -translate-y-1/2 text-[11px] text-muted-foreground",
145
+ children: label
146
+ }),
147
+ /* @__PURE__ */ jsx("svg", {
148
+ "aria-hidden": "true",
149
+ viewBox: "0 0 24 24",
150
+ className: "pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 text-muted-foreground",
151
+ fill: "none",
152
+ stroke: "currentColor",
153
+ strokeWidth: 2,
154
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
155
+ })
156
+ ]
157
+ });
158
+ }
159
+ function Address({ countries, defaults }) {
160
+ const storefrontTranslate = useStorefrontText();
161
+ const geo = useGeoCascade({
162
+ ...defaults,
163
+ country: countries[0]?.code
164
+ });
165
+ const { country, department, province, district } = geo;
166
+ return /* @__PURE__ */ jsxs("div", {
167
+ className: "grid gap-3 sm:grid-cols-2",
168
+ children: [
169
+ /* @__PURE__ */ jsx(Choice, {
170
+ label: storefrontTranslate("País"),
171
+ name: "country",
172
+ value: country,
173
+ onChange: (event) => geo.setCountry(event.target.value),
174
+ className: "sm:col-span-2",
175
+ children: countries.map((item) => /* @__PURE__ */ jsx("option", {
176
+ value: item.code,
177
+ children: item.name
178
+ }, item.code))
179
+ }),
180
+ geo.structured ? /* @__PURE__ */ jsxs(Fragment, { children: [
181
+ /* @__PURE__ */ jsxs(Choice, {
182
+ label: storefrontTranslate("Departamento"),
183
+ name: "department",
184
+ required: true,
185
+ value: placeValue(department),
186
+ onChange: (event) => geo.setDepartmentValue(event.target.value),
187
+ children: [/* @__PURE__ */ jsx("option", {
188
+ value: "",
189
+ children: storefrontTranslate("Elige…")
190
+ }), geo.places.departments.map((item) => /* @__PURE__ */ jsx("option", {
191
+ value: placeValue(item),
192
+ children: item.name
193
+ }, item.code))]
194
+ }),
195
+ /* @__PURE__ */ jsxs(Choice, {
196
+ label: storefrontTranslate("Provincia"),
197
+ name: "province",
198
+ required: true,
199
+ disabled: department === null,
200
+ value: placeValue(province),
201
+ onChange: (event) => geo.setProvinceValue(event.target.value),
202
+ children: [/* @__PURE__ */ jsx("option", {
203
+ value: "",
204
+ children: storefrontTranslate("Elige…")
205
+ }), geo.places.provinces.map((item) => /* @__PURE__ */ jsx("option", {
206
+ value: placeValue(item),
207
+ children: item.name
208
+ }, item.code))]
209
+ }),
210
+ /* @__PURE__ */ jsxs(Choice, {
211
+ label: storefrontTranslate("Distrito"),
212
+ name: "district",
213
+ required: true,
214
+ disabled: province === null,
215
+ value: placeValue(district),
216
+ onChange: (event) => geo.setDistrictValue(event.target.value),
217
+ className: "sm:col-span-2",
218
+ children: [/* @__PURE__ */ jsx("option", {
219
+ value: "",
220
+ children: storefrontTranslate("Elige…")
221
+ }), geo.places.districts.map((item) => /* @__PURE__ */ jsx("option", {
222
+ value: placeValue(item),
223
+ children: item.name
224
+ }, item.code))]
225
+ })
226
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Field, {
227
+ label: storefrontTranslate("Región"),
228
+ name: "department",
229
+ defaultValue: defaults.department ?? "",
230
+ required: true
231
+ }), /* @__PURE__ */ jsx(Field, {
232
+ label: storefrontTranslate("Ciudad"),
233
+ name: "district",
234
+ defaultValue: defaults.district ?? "",
235
+ required: true
236
+ })] }),
237
+ /* @__PURE__ */ jsx(Field, {
238
+ label: storefrontTranslate("Dirección"),
239
+ name: "line",
240
+ autoComplete: "street-address",
241
+ defaultValue: defaults.line ?? "",
242
+ required: true,
243
+ className: "sm:col-span-2"
244
+ }),
245
+ /* @__PURE__ */ jsx(Field, {
246
+ label: storefrontTranslate("Referencia (opcional)"),
247
+ name: "reference",
248
+ defaultValue: defaults.reference ?? ""
249
+ }),
250
+ /* @__PURE__ */ jsx(Field, {
251
+ label: storefrontTranslate("Celular"),
252
+ name: "phone",
253
+ type: "tel",
254
+ autoComplete: "tel",
255
+ defaultValue: defaults.phone ?? "",
256
+ required: true
257
+ })
258
+ ]
259
+ });
260
+ }
261
+ function Heading({ children, aside }) {
262
+ return /* @__PURE__ */ jsxs("div", {
263
+ className: "mb-3 flex items-baseline justify-between gap-3",
264
+ children: [/* @__PURE__ */ jsx("h2", {
265
+ className: "text-lg font-semibold",
266
+ children
267
+ }), aside]
268
+ });
269
+ }
270
+ function Review({ rows }) {
271
+ const storefrontTranslate = useStorefrontText();
272
+ if (rows.length === 0) return null;
273
+ return /* @__PURE__ */ jsx("dl", {
274
+ className: `${GROUP} divide-y divide-input text-sm`,
275
+ children: rows.map((row) => /* @__PURE__ */ jsxs("div", {
276
+ className: "flex items-start gap-4 px-4 py-3",
277
+ children: [
278
+ /* @__PURE__ */ jsx("dt", {
279
+ className: "w-24 shrink-0 text-muted-foreground",
280
+ children: storefrontTranslate(row.label)
281
+ }),
282
+ /* @__PURE__ */ jsx("dd", {
283
+ className: "min-w-0 flex-1 truncate",
284
+ children: row.value
285
+ }),
286
+ /* @__PURE__ */ jsx(Link, {
287
+ to: `?edit=${row.step}`,
288
+ className: "shrink-0 text-xs underline underline-offset-4",
289
+ children: storefrontTranslate("Cambiar")
290
+ })
291
+ ]
292
+ }, row.step))
293
+ });
294
+ }
295
+ const MOBILE_LOGOS = 3;
296
+ function Checkout({ data, result, ...root }) {
297
+ const storefrontTranslate = useStorefrontText();
298
+ const checkout = section(settings.checkout, root);
299
+ const shop = shopOf(useRouteLoaderData("root"));
300
+ const { cart, methods, bumps, me, signedIn, countries, shipping, step, done, needsDelivery, defaults, paymentMethod, choosePaymentMethod, error, promoError, busy, single } = useCheckout(data, result, checkout.layout);
301
+ const payment = useCheckoutPayment(methods, cart, shop.name);
302
+ const wallets = useAvailableStripeWallets(methods, cart.totals.total, cart.currencyCode);
303
+ const offeredMethods = methods.filter((method) => {
304
+ const wallet = findStripeWallet(method);
305
+ return wallet === null || wallets.has(wallet);
306
+ });
307
+ if (result && "authentication" in result) {
308
+ if (result.authentication.payment.providerId === "stripe") return /* @__PURE__ */ jsx(StripeAuthentication, { ...result.authentication });
309
+ return /* @__PURE__ */ jsx(CulqiAuthentication, {
310
+ ...result.authentication,
311
+ email: cart.email,
312
+ source: payment.source.current
313
+ });
314
+ }
315
+ const alert = payment.error ?? error;
316
+ const paying = busy || payment.loading;
317
+ const format = (value) => money(value, cart.currencyCode, `${data.language}-${data.countryCode}`);
318
+ const attributes = Object.fromEntries(Object.entries(root).filter(([key]) => key.startsWith("data-")));
319
+ const style = { "--radius": RADIUS[checkout.corners] };
320
+ const total = summaryLines(cart).find((line) => line.key === "total")?.amount ?? cart.totals.total;
321
+ const open = (current) => single || step === current;
322
+ const saved = cart.shippingAddress;
323
+ const current = STEPS.findIndex((item) => item.step === step);
324
+ const rows = [];
325
+ if (!single && current > 0 && done.contact) rows.push({
326
+ step: "contact",
327
+ label: storefrontTranslate("Contacto"),
328
+ value: `${cart.email ?? ""} · ${cart.phone ?? ""}`
329
+ });
330
+ if (!single && current > 1 && saved) rows.push({
331
+ step: "delivery",
332
+ label: storefrontTranslate("Enviar a"),
333
+ value: [
334
+ saved.address1,
335
+ saved.district,
336
+ saved.province
337
+ ].filter(Boolean).join(", ")
338
+ });
339
+ if (!single && current > 2 && done.shipping) rows.push({
340
+ step: "shipping",
341
+ label: storefrontTranslate("Envío"),
342
+ value: cart.shippingMethods.map((method) => `${method.name} · ${method.total === 0 ? storefrontTranslate("Gratis") : format(method.total)}`).join(" · ")
343
+ });
344
+ const lines = /* @__PURE__ */ jsx("ul", {
345
+ className: "flex flex-col gap-4",
346
+ children: cart.items.map((item) => /* @__PURE__ */ jsxs("li", {
347
+ className: "flex items-center gap-4 text-sm",
348
+ children: [
349
+ /* @__PURE__ */ jsxs("span", {
350
+ className: "relative size-16 shrink-0 rounded-md border border-input bg-background",
351
+ children: [/* @__PURE__ */ jsx("span", {
352
+ className: "block size-full overflow-hidden rounded-md",
353
+ children: item.thumbnail ? /* @__PURE__ */ jsx("img", {
354
+ src: item.thumbnail,
355
+ alt: "",
356
+ width: 64,
357
+ height: 64,
358
+ loading: "lazy",
359
+ decoding: "async",
360
+ className: "size-full object-cover"
361
+ }) : null
362
+ }), /* @__PURE__ */ jsx("span", {
363
+ className: "absolute -top-2 -right-2 flex size-5 items-center justify-center rounded-full bg-muted-foreground text-[11px] font-medium text-background",
364
+ children: item.quantity
365
+ })]
366
+ }),
367
+ /* @__PURE__ */ jsxs("span", {
368
+ className: "flex min-w-0 flex-1 flex-col",
369
+ children: [
370
+ /* @__PURE__ */ jsx("span", {
371
+ className: "font-medium",
372
+ children: item.title
373
+ }),
374
+ item.variantLabel && item.variantLabel !== item.title ? /* @__PURE__ */ jsx("span", {
375
+ className: "text-xs text-muted-foreground",
376
+ children: item.variantLabel
377
+ }) : null,
378
+ item.sellerName ? /* @__PURE__ */ jsxs("span", {
379
+ className: "text-xs text-muted-foreground",
380
+ children: [
381
+ storefrontTranslate("Vendido por"),
382
+ " ",
383
+ item.sellerName
384
+ ]
385
+ }) : null
386
+ ]
387
+ }),
388
+ /* @__PURE__ */ jsx("span", {
389
+ className: "tabular-nums",
390
+ children: format(item.unitPrice * item.quantity)
391
+ })
392
+ ]
393
+ }, item.id))
394
+ });
395
+ const totals = /* @__PURE__ */ jsxs(Fragment, { children: [
396
+ /* @__PURE__ */ jsxs(PromoCodeForm, {
397
+ className: "flex gap-2",
398
+ children: [/* @__PURE__ */ jsx(Field, {
399
+ label: storefrontTranslate("Código de descuento"),
400
+ name: "code",
401
+ className: "flex-1"
402
+ }), /* @__PURE__ */ jsx(Button, {
403
+ type: "submit",
404
+ disabled: busy,
405
+ children: storefrontTranslate("Aplicar")
406
+ })]
407
+ }),
408
+ promoError ? /* @__PURE__ */ jsx("p", {
409
+ className: "-mt-3 text-sm text-destructive",
410
+ children: storefrontTranslate(promoError)
411
+ }) : null,
412
+ cart.promotionCodes.map((code) => /* @__PURE__ */ jsxs(PromoCodeForm, {
413
+ remove: code,
414
+ className: "flex items-center justify-between text-sm",
415
+ children: [/* @__PURE__ */ jsx("span", {
416
+ className: "rounded-md bg-muted px-2 py-1 font-medium",
417
+ children: code
418
+ }), /* @__PURE__ */ jsx("button", {
419
+ type: "submit",
420
+ className: "text-xs underline underline-offset-4",
421
+ children: storefrontTranslate("Quitar")
422
+ })]
423
+ }, code)),
424
+ /* @__PURE__ */ jsx("dl", {
425
+ className: "flex flex-col gap-2 text-sm",
426
+ children: summaryLines(cart).map((line) => {
427
+ if (line.key === "total") return /* @__PURE__ */ jsxs("div", {
428
+ className: "flex items-baseline justify-between pt-2",
429
+ children: [/* @__PURE__ */ jsx("dt", {
430
+ className: "text-base font-semibold",
431
+ children: storefrontTranslate(line.label)
432
+ }), /* @__PURE__ */ jsxs("dd", {
433
+ className: "flex items-baseline gap-2",
434
+ children: [/* @__PURE__ */ jsx("span", {
435
+ className: "text-xs text-muted-foreground",
436
+ children: cart.currencyCode
437
+ }), /* @__PURE__ */ jsx("span", {
438
+ className: "text-xl font-semibold tabular-nums",
439
+ children: format(line.amount ?? 0)
440
+ })]
441
+ })]
442
+ }, line.key);
443
+ return /* @__PURE__ */ jsxs("div", {
444
+ className: "flex justify-between",
445
+ children: [/* @__PURE__ */ jsx("dt", {
446
+ className: "text-muted-foreground",
447
+ children: storefrontTranslate(line.label)
448
+ }), /* @__PURE__ */ jsx("dd", {
449
+ className: "tabular-nums",
450
+ children: line.amount === null ? storefrontTranslate(line.text ?? "") : format(line.amount)
451
+ })]
452
+ }, line.key);
453
+ })
454
+ })
455
+ ] });
456
+ return /* @__PURE__ */ jsxs("div", {
457
+ ...attributes,
458
+ "data-layout": checkout.layout,
459
+ "data-fields": checkout.fields,
460
+ "data-summary": checkout.summary,
461
+ style,
462
+ className: "group/checkout flex min-h-screen flex-col bg-background text-foreground",
463
+ children: [
464
+ /* @__PURE__ */ jsx("header", {
465
+ className: "border-b border-input",
466
+ "data-scheme": checkout.main,
467
+ children: /* @__PURE__ */ jsxs("div", {
468
+ className: `mx-auto flex h-16 w-full max-w-6xl items-center gap-4 px-4 lg:px-8 ${checkout.logo === "center" ? "justify-center" : "justify-between"}`,
469
+ children: [/* @__PURE__ */ jsx(Link, {
470
+ to: "/",
471
+ className: "flex items-center",
472
+ children: shop.logo ? /* @__PURE__ */ jsx("img", {
473
+ src: shop.logo,
474
+ alt: shop.name,
475
+ width: 144,
476
+ height: 36,
477
+ decoding: "async",
478
+ className: "h-9 w-auto max-w-40 object-contain"
479
+ }) : /* @__PURE__ */ jsx("span", {
480
+ className: "font-heading text-xl",
481
+ children: shop.name
482
+ })
483
+ }), checkout.logo === "center" ? null : /* @__PURE__ */ jsxs("div", {
484
+ className: "flex items-center gap-4 text-sm",
485
+ children: [checkout.secure ? /* @__PURE__ */ jsxs("span", {
486
+ className: "flex items-center gap-1.5 text-muted-foreground",
487
+ children: [/* @__PURE__ */ jsx(Lock, {}), storefrontTranslate("Compra segura")]
488
+ }) : null, /* @__PURE__ */ jsx(Link, {
489
+ to: "/cart",
490
+ "aria-label": storefrontTranslate("Volver al carrito"),
491
+ className: "text-foreground",
492
+ children: /* @__PURE__ */ jsx(Bag, {})
493
+ })]
494
+ })]
495
+ })
496
+ }),
497
+ /* @__PURE__ */ jsxs("details", {
498
+ className: "group/summary border-b border-input bg-muted/50 lg:hidden",
499
+ "data-scheme": checkout.aside,
500
+ children: [/* @__PURE__ */ jsxs("summary", {
501
+ className: "flex cursor-pointer list-none items-center justify-between px-4 py-4 text-sm",
502
+ children: [/* @__PURE__ */ jsxs("span", {
503
+ className: "flex items-center gap-1.5 font-medium",
504
+ children: [
505
+ /* @__PURE__ */ jsx("span", {
506
+ className: "group-open/summary:hidden",
507
+ children: storefrontTranslate("Mostrar resumen del pedido")
508
+ }),
509
+ /* @__PURE__ */ jsx("span", {
510
+ className: "hidden group-open/summary:inline",
511
+ children: storefrontTranslate("Ocultar resumen del pedido")
512
+ }),
513
+ /* @__PURE__ */ jsx("svg", {
514
+ "aria-hidden": "true",
515
+ viewBox: "0 0 24 24",
516
+ className: "size-4 transition-transform group-open/summary:rotate-180",
517
+ fill: "none",
518
+ stroke: "currentColor",
519
+ strokeWidth: 2,
520
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
521
+ })
522
+ ]
523
+ }), /* @__PURE__ */ jsx("span", {
524
+ className: "text-base font-semibold tabular-nums",
525
+ children: format(total)
526
+ })]
527
+ }), /* @__PURE__ */ jsxs("div", {
528
+ className: "flex flex-col gap-5 px-4 pb-6",
529
+ children: [lines, totals]
530
+ })]
531
+ }),
532
+ /* @__PURE__ */ jsxs("div", {
533
+ className: "mx-auto grid w-full max-w-6xl flex-1 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_minmax(0,26rem)] group-data-[summary=left]/checkout:lg:grid-cols-[minmax(0,26rem)_minmax(0,1fr)]",
534
+ children: [/* @__PURE__ */ jsxs("main", {
535
+ className: "flex flex-col gap-8 px-4 py-8 lg:px-10 lg:py-10 group-data-[summary=left]/checkout:lg:order-2",
536
+ "data-scheme": checkout.main,
537
+ children: [
538
+ single ? null : /* @__PURE__ */ jsxs("nav", {
539
+ "aria-label": storefrontTranslate("Pasos"),
540
+ className: "flex flex-wrap items-center gap-2 text-xs",
541
+ children: [/* @__PURE__ */ jsx(Link, {
542
+ to: "/cart",
543
+ className: "underline-offset-4 hover:underline",
544
+ children: storefrontTranslate("Carrito")
545
+ }), STEPS.filter((item) => needsDelivery || item.step !== "delivery" && item.step !== "shipping").map((item) => /* @__PURE__ */ jsxs("span", {
546
+ className: "flex items-center gap-2",
547
+ children: [/* @__PURE__ */ jsx("span", {
548
+ "aria-hidden": "true",
549
+ className: "text-muted-foreground",
550
+ children: "›"
551
+ }), /* @__PURE__ */ jsx("span", {
552
+ className: item.step === step ? "font-semibold" : "text-muted-foreground",
553
+ "aria-current": item.step === step ? "step" : void 0,
554
+ children: storefrontTranslate(item.label)
555
+ })]
556
+ }, item.step))]
557
+ }),
558
+ alert ? /* @__PURE__ */ jsx("p", {
559
+ role: "alert",
560
+ className: "rounded-md bg-destructive/10 px-4 py-3 text-sm text-destructive",
561
+ children: storefrontTranslate(alert)
562
+ }) : null,
563
+ /* @__PURE__ */ jsx(Review, { rows }),
564
+ open("contact") ? /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx(Heading, {
565
+ aside: signedIn ? null : /* @__PURE__ */ jsx(Link, {
566
+ to: "/account/login?next=/checkout",
567
+ className: "text-sm underline underline-offset-4",
568
+ children: storefrontTranslate("Iniciar sesión")
569
+ }),
570
+ children: storefrontTranslate("Contacto")
571
+ }), /* @__PURE__ */ jsxs(CheckoutForm, {
572
+ single,
573
+ intent: "contact",
574
+ className: "grid gap-3 sm:grid-cols-2",
575
+ children: [
576
+ /* @__PURE__ */ jsx(Field, {
577
+ label: storefrontTranslate("Correo"),
578
+ name: "email",
579
+ type: "email",
580
+ autoComplete: "email",
581
+ defaultValue: cart.email ?? me?.email ?? "",
582
+ required: true,
583
+ className: "sm:col-span-2"
584
+ }),
585
+ /* @__PURE__ */ jsx(Field, {
586
+ label: storefrontTranslate("Nombre"),
587
+ name: "firstName",
588
+ autoComplete: "given-name",
589
+ defaultValue: cart.firstName ?? me?.firstName ?? "",
590
+ required: true
591
+ }),
592
+ /* @__PURE__ */ jsx(Field, {
593
+ label: storefrontTranslate("Apellidos"),
594
+ name: "lastName",
595
+ autoComplete: "family-name",
596
+ defaultValue: cart.lastName ?? me?.lastName ?? "",
597
+ required: true
598
+ }),
599
+ /* @__PURE__ */ jsx(Field, {
600
+ label: storefrontTranslate("Celular"),
601
+ name: "phone",
602
+ type: "tel",
603
+ autoComplete: "tel",
604
+ defaultValue: cart.phone ?? me?.phone ?? "",
605
+ required: true,
606
+ className: "sm:col-span-2"
607
+ }),
608
+ /* @__PURE__ */ jsx(InvoiceFields, {
609
+ cart,
610
+ children: (invoice) => /* @__PURE__ */ jsxs("div", {
611
+ className: "flex flex-col gap-3 sm:col-span-2",
612
+ children: [
613
+ /* @__PURE__ */ jsx("div", {
614
+ role: "radiogroup",
615
+ "aria-label": storefrontTranslate("Comprobante"),
616
+ className: `${GROUP} grid grid-cols-2 divide-x divide-input`,
617
+ children: invoice.options.map((option) => /* @__PURE__ */ jsxs("label", {
618
+ className: ROW,
619
+ children: [/* @__PURE__ */ jsx("input", {
620
+ type: "radio",
621
+ name: "invoiceType",
622
+ value: option.value,
623
+ checked: invoice.type === option.value,
624
+ onChange: () => invoice.setType(option.value),
625
+ className: "accent-primary"
626
+ }), storefrontTranslate(option.label)]
627
+ }, option.value))
628
+ }),
629
+ /* @__PURE__ */ jsxs(Choice, {
630
+ label: storefrontTranslate("País emisor del documento"),
631
+ ...invoice.documentCountry,
632
+ children: [/* @__PURE__ */ jsx("option", {
633
+ value: "",
634
+ children: storefrontTranslate("Elige…")
635
+ }), data.documentCountries.map((country) => /* @__PURE__ */ jsx("option", {
636
+ value: country.code,
637
+ children: country.name
638
+ }, country.code))]
639
+ }),
640
+ invoice.type === "invoice" ? /* @__PURE__ */ jsxs("div", {
641
+ className: "grid gap-3 sm:grid-cols-2",
642
+ children: [
643
+ /* @__PURE__ */ jsx(Field, {
644
+ label: storefrontTranslate("Identificación fiscal"),
645
+ ...invoice.taxId
646
+ }),
647
+ /* @__PURE__ */ jsx(Field, {
648
+ label: storefrontTranslate("Razón social"),
649
+ ...invoice.entityName
650
+ }),
651
+ invoice.taxIdError ? /* @__PURE__ */ jsx("p", {
652
+ className: "text-sm text-destructive sm:col-span-2",
653
+ children: storefrontTranslate(invoice.taxIdError)
654
+ }) : null
655
+ ]
656
+ }) : /* @__PURE__ */ jsxs("div", {
657
+ className: "grid gap-3 sm:grid-cols-2",
658
+ children: [
659
+ /* @__PURE__ */ jsx(Choice, {
660
+ label: storefrontTranslate("Tipo de documento"),
661
+ ...invoice.documentType,
662
+ children: invoice.documentTypes.map((option) => /* @__PURE__ */ jsx("option", {
663
+ value: option.value,
664
+ children: storefrontTranslate(option.label)
665
+ }, option.value))
666
+ }),
667
+ /* @__PURE__ */ jsx(Field, {
668
+ label: storefrontTranslate(invoice.documentLabel),
669
+ ...invoice.document
670
+ }),
671
+ invoice.documentError ? /* @__PURE__ */ jsx("p", {
672
+ className: "text-sm text-destructive sm:col-span-2",
673
+ children: storefrontTranslate(invoice.documentError)
674
+ }) : null
675
+ ]
676
+ })
677
+ ]
678
+ })
679
+ }),
680
+ single ? null : /* @__PURE__ */ jsx(Button, {
681
+ type: "submit",
682
+ size: "lg",
683
+ disabled: busy,
684
+ className: "mt-2 sm:col-span-2 sm:w-fit",
685
+ children: needsDelivery ? storefrontTranslate("Continuar con la entrega") : storefrontTranslate("Continuar con el pago")
686
+ })
687
+ ]
688
+ })] }) : null,
689
+ needsDelivery && open("delivery") ? /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx(Heading, { children: storefrontTranslate("Entrega") }), /* @__PURE__ */ jsxs(CheckoutForm, {
690
+ single,
691
+ intent: "delivery",
692
+ className: "flex flex-col gap-3",
693
+ children: [/* @__PURE__ */ jsx(Address, {
694
+ countries,
695
+ defaults
696
+ }), single ? null : /* @__PURE__ */ jsx(Button, {
697
+ type: "submit",
698
+ size: "lg",
699
+ disabled: busy,
700
+ className: "mt-2 sm:w-fit",
701
+ children: storefrontTranslate("Continuar con el envío")
702
+ })]
703
+ })] }) : null,
704
+ needsDelivery && open("shipping") ? /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx(Heading, { children: storefrontTranslate("Método de envío") }), shipping.length === 0 ? /* @__PURE__ */ jsx("p", {
705
+ className: "rounded-md bg-muted/60 px-4 py-3 text-sm text-muted-foreground",
706
+ children: done.delivery ? storefrontTranslate("No hay métodos de envío para esta dirección. Prueba con otra dirección.") : storefrontTranslate("Completa la dirección para ver las opciones de envío.")
707
+ }) : /* @__PURE__ */ jsxs(CheckoutForm, {
708
+ single,
709
+ intent: "shipping",
710
+ className: "flex flex-col gap-4",
711
+ children: [shipping.map((group, index) => /* @__PURE__ */ jsxs("fieldset", {
712
+ className: "flex flex-col gap-2",
713
+ children: [shipping.length > 1 ? /* @__PURE__ */ jsx("legend", {
714
+ className: "mb-2 text-sm font-medium",
715
+ children: group.sellerName ? `${storefrontTranslate("Paquete de")} ${group.sellerName}` : `${storefrontTranslate("Paquete")} ${index + 1}`
716
+ }) : null, /* @__PURE__ */ jsx("div", {
717
+ className: `${GROUP} divide-y divide-input`,
718
+ children: group.rates.map((rate, position) => /* @__PURE__ */ jsxs("label", {
719
+ className: ROW,
720
+ children: [
721
+ /* @__PURE__ */ jsx("input", {
722
+ type: "radio",
723
+ name: group.field,
724
+ value: rate.value,
725
+ defaultChecked: position === 0,
726
+ required: true,
727
+ className: "accent-primary"
728
+ }),
729
+ /* @__PURE__ */ jsxs("span", {
730
+ className: "flex flex-1 flex-col",
731
+ children: [
732
+ /* @__PURE__ */ jsx("span", { children: rate.displayName }),
733
+ rate.estimatedDeliveryDays != null ? /* @__PURE__ */ jsxs("span", {
734
+ className: "text-xs text-muted-foreground",
735
+ children: [
736
+ storefrontTranslate("Llega en"),
737
+ " ",
738
+ rate.estimatedDeliveryDays,
739
+ " ",
740
+ rate.estimatedDeliveryDays === 1 ? storefrontTranslate("día") : storefrontTranslate("días")
741
+ ]
742
+ }) : null,
743
+ rate.estimatedDeliveryDays == null && rate.description ? /* @__PURE__ */ jsx("span", {
744
+ className: "text-xs text-muted-foreground",
745
+ children: rate.description
746
+ }) : null
747
+ ]
748
+ }),
749
+ /* @__PURE__ */ jsx("span", {
750
+ className: "font-medium tabular-nums",
751
+ children: rate.price === 0 ? storefrontTranslate("Gratis") : format(rate.price)
752
+ })
753
+ ]
754
+ }, rate.value))
755
+ })]
756
+ }, `${group.sellerId ?? "store"}-${index}`)), single ? null : /* @__PURE__ */ jsx(Button, {
757
+ type: "submit",
758
+ size: "lg",
759
+ disabled: busy,
760
+ className: "mt-2 sm:w-fit",
761
+ children: storefrontTranslate("Continuar con el pago")
762
+ })]
763
+ })] }) : null,
764
+ open("payment") ? /* @__PURE__ */ jsxs("section", { children: [
765
+ /* @__PURE__ */ jsx(Heading, { children: storefrontTranslate("Pago") }),
766
+ checkout.encrypted ? /* @__PURE__ */ jsx("p", {
767
+ className: "-mt-2 mb-3 text-sm text-muted-foreground",
768
+ children: storefrontTranslate("Todas las transacciones son seguras y están cifradas.")
769
+ }) : null,
770
+ bumps.length > 0 ? /* @__PURE__ */ jsx("div", {
771
+ className: "mb-4 flex flex-col gap-2",
772
+ children: bumps.map((bump) => /* @__PURE__ */ jsxs(OrderBumpForm, {
773
+ bump,
774
+ className: `${GROUP} flex items-center gap-3 p-3`,
775
+ children: [
776
+ /* @__PURE__ */ jsx("span", {
777
+ className: "size-12 shrink-0 overflow-hidden rounded-md bg-muted",
778
+ children: bump.imageUrl ? /* @__PURE__ */ jsx("img", {
779
+ src: bump.imageUrl,
780
+ alt: "",
781
+ width: 48,
782
+ height: 48,
783
+ loading: "lazy",
784
+ decoding: "async",
785
+ className: "size-full object-cover"
786
+ }) : null
787
+ }),
788
+ /* @__PURE__ */ jsxs("span", {
789
+ className: "flex flex-1 flex-col text-sm",
790
+ children: [/* @__PURE__ */ jsx("span", {
791
+ className: "font-medium",
792
+ children: bump.productName
793
+ }), /* @__PURE__ */ jsx("span", {
794
+ className: "text-xs text-muted-foreground",
795
+ children: format(bump.offerPrice)
796
+ })]
797
+ }),
798
+ /* @__PURE__ */ jsx(Button, {
799
+ type: "submit",
800
+ size: "sm",
801
+ disabled: busy,
802
+ children: bump.callToAction || storefrontTranslate("Agregar")
803
+ })
804
+ ]
805
+ }, bump.id))
806
+ }) : null,
807
+ methods.length === 0 ? /* @__PURE__ */ jsx("p", {
808
+ className: "rounded-md bg-muted/60 px-4 py-3 text-sm text-muted-foreground",
809
+ children: storefrontTranslate("La tienda todavía no tiene medios de pago activos.")
810
+ }) : /* @__PURE__ */ jsxs(CheckoutForm, {
811
+ single,
812
+ intent: "pay",
813
+ onSubmit: payment.onSubmit,
814
+ className: "flex flex-col gap-5",
815
+ children: [
816
+ /* @__PURE__ */ jsx("input", {
817
+ ref: payment.token,
818
+ type: "hidden",
819
+ name: "token",
820
+ defaultValue: ""
821
+ }),
822
+ /* @__PURE__ */ jsx("input", {
823
+ ref: payment.deviceSessionId,
824
+ type: "hidden",
825
+ name: "deviceSessionId",
826
+ defaultValue: ""
827
+ }),
828
+ /* @__PURE__ */ jsx("input", {
829
+ ref: payment.providerPaymentMethodId,
830
+ type: "hidden",
831
+ name: "providerPaymentMethodId",
832
+ defaultValue: ""
833
+ }),
834
+ /* @__PURE__ */ jsx("div", {
835
+ role: "radiogroup",
836
+ "aria-label": storefrontTranslate("Medio de pago"),
837
+ className: `${GROUP} divide-y divide-input`,
838
+ children: /* @__PURE__ */ jsx(PaymentMethods, {
839
+ methods: offeredMethods,
840
+ cart,
841
+ language: `${data.language}-${data.countryCode}`,
842
+ children: ({ method, logos, saving, identification, manual, receipt, charge }) => /* @__PURE__ */ jsxs("div", {
843
+ className: "group/method",
844
+ children: [/* @__PURE__ */ jsxs("label", {
845
+ className: ROW,
846
+ children: [
847
+ /* @__PURE__ */ jsx("input", {
848
+ type: "radio",
849
+ name: "method",
850
+ value: method.code,
851
+ defaultChecked: method.code === paymentMethod,
852
+ onChange: () => choosePaymentMethod(method.code),
853
+ required: true,
854
+ className: "accent-primary"
855
+ }),
856
+ /* @__PURE__ */ jsxs("span", {
857
+ className: "flex min-w-0 flex-1 flex-col",
858
+ children: [
859
+ /* @__PURE__ */ jsx("span", { children: method.name }),
860
+ method.description ? /* @__PURE__ */ jsx("span", {
861
+ className: "hidden text-xs text-muted-foreground group-has-[:checked]/method:block",
862
+ children: method.description
863
+ }) : null,
864
+ saving ? /* @__PURE__ */ jsx("span", {
865
+ className: "text-xs text-muted-foreground",
866
+ children: saving.label
867
+ }) : null,
868
+ charge ? /* @__PURE__ */ jsx("span", {
869
+ className: "hidden text-xs text-muted-foreground group-has-[:checked]/method:block",
870
+ children: storefrontTranslate("Se te cobrará {value0} con un tipo de cambio de {value1} por {value2}.", {
871
+ value0: charge.amount,
872
+ value1: charge.rate,
873
+ value2: charge.unit
874
+ })
875
+ }) : null
876
+ ]
877
+ }),
878
+ checkout.marks ? /* @__PURE__ */ jsxs("span", {
879
+ className: "flex flex-wrap justify-end gap-1 max-sm:[&>img:nth-of-type(n+4)]:hidden",
880
+ children: [logos.map((code) => /* @__PURE__ */ jsx(PaymentLogo, {
881
+ code,
882
+ className: "h-5 w-auto"
883
+ }, code)), logos.length > MOBILE_LOGOS ? /* @__PURE__ */ jsxs("span", {
884
+ className: "rounded border border-input px-1 text-xs leading-[1.125rem] text-muted-foreground sm:hidden",
885
+ children: ["+", logos.length - MOBILE_LOGOS]
886
+ }) : null]
887
+ }) : null
888
+ ]
889
+ }), identification || manual || receipt ? /* @__PURE__ */ jsxs("div", {
890
+ className: "hidden flex-col gap-3 bg-muted/40 px-4 py-3 text-sm group-has-[:checked]/method:flex",
891
+ children: [
892
+ identification ? /* @__PURE__ */ jsx(Field, {
893
+ label: "DNI",
894
+ ...identification
895
+ }) : null,
896
+ manual?.qrImageUrl ? /* @__PURE__ */ jsx("img", {
897
+ src: manual.qrImageUrl,
898
+ alt: storefrontTranslate("QR de {value0}", { value0: method.name }),
899
+ width: 160,
900
+ height: 160,
901
+ loading: "lazy",
902
+ decoding: "async",
903
+ className: "size-40 rounded-md border border-input bg-background object-contain"
904
+ }) : null,
905
+ manual?.phoneNumber ? /* @__PURE__ */ jsxs("span", { children: [
906
+ storefrontTranslate("Número:"),
907
+ " ",
908
+ /* @__PURE__ */ jsx("span", {
909
+ className: "font-medium",
910
+ children: manual.phoneNumber
911
+ })
912
+ ] }) : null,
913
+ manual?.accountHolder ? /* @__PURE__ */ jsxs("span", { children: [
914
+ storefrontTranslate("Titular:"),
915
+ " ",
916
+ /* @__PURE__ */ jsx("span", {
917
+ className: "font-medium",
918
+ children: manual.accountHolder
919
+ })
920
+ ] }) : null,
921
+ manual ? /* @__PURE__ */ jsx(BankAccountList, { accounts: manual.bankAccounts }) : null,
922
+ receipt ? /* @__PURE__ */ jsxs("span", {
923
+ className: "flex flex-col gap-2",
924
+ children: [/* @__PURE__ */ jsx("span", {
925
+ className: "text-xs text-muted-foreground",
926
+ children: storefrontTranslate("Sube la captura de tu pago (opcional).")
927
+ }), /* @__PURE__ */ jsx("input", {
928
+ ...receipt,
929
+ "aria-label": storefrontTranslate("Captura del pago"),
930
+ className: "text-xs file:mr-3 file:rounded-md file:border-0 file:bg-muted file:px-3 file:py-1.5 file:text-xs file:font-medium"
931
+ })]
932
+ }) : null
933
+ ]
934
+ }) : null]
935
+ })
936
+ })
937
+ }),
938
+ /* @__PURE__ */ jsx(Button, {
939
+ type: "submit",
940
+ size: "lg",
941
+ disabled: paying,
942
+ className: checkout.button === "fit" ? "h-12 w-fit text-base" : "h-12 w-full text-base",
943
+ children: paying ? storefrontTranslate("Procesando…") : `${storefrontTranslate("Pagar ahora")} · ${format(cart.totals.total)}`
944
+ })
945
+ ]
946
+ })
947
+ ] }) : null,
948
+ /* @__PURE__ */ jsx(MercadoPagoDialog, { dialog: payment.dialog }),
949
+ /* @__PURE__ */ jsx(StripeDialog, { dialog: payment.stripeDialog })
950
+ ]
951
+ }), /* @__PURE__ */ jsx("aside", {
952
+ className: "hidden border-input bg-muted/50 px-10 py-10 lg:block lg:border-l group-data-[summary=left]/checkout:lg:order-1 group-data-[summary=left]/checkout:lg:border-r group-data-[summary=left]/checkout:lg:border-l-0",
953
+ "data-scheme": checkout.aside,
954
+ children: /* @__PURE__ */ jsxs("div", {
955
+ className: "sticky top-8 flex flex-col gap-6",
956
+ children: [lines, totals]
957
+ })
958
+ })]
959
+ })
960
+ ]
961
+ });
962
+ }
963
+ export { Checkout, catalog, settings };