@ecomiq/storefront 2.1.3 → 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 (317) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -123
  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 -81
  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/cloud-runtime-client.ts +0 -378
  238. package/src/codegen.mjs +0 -789
  239. package/src/components/account/customer-addresses-panel.tsx +0 -678
  240. package/src/components/account/customer-order-detail-panel.tsx +0 -285
  241. package/src/components/account/customer-orders-panel.tsx +0 -192
  242. package/src/components/account/customer-profile-panel.tsx +0 -379
  243. package/src/components/checkout/cart-sync.ts +0 -143
  244. package/src/components/checkout/checkout-contact-section.tsx +0 -76
  245. package/src/components/checkout/checkout-external-update-banner.tsx +0 -15
  246. package/src/components/checkout/checkout-form-controls.tsx +0 -139
  247. package/src/components/checkout/checkout-line-items.tsx +0 -43
  248. package/src/components/checkout/checkout-order-summary.tsx +0 -165
  249. package/src/components/checkout/checkout-payment-section.tsx +0 -212
  250. package/src/components/checkout/checkout-session-view.tsx +0 -564
  251. package/src/components/checkout/checkout-shipping-address-section.tsx +0 -400
  252. package/src/components/checkout/checkout-shipping-section.tsx +0 -98
  253. package/src/components/checkout/checkout-states.tsx +0 -73
  254. package/src/components/checkout/checkout-step-card.tsx +0 -101
  255. package/src/components/checkout/checkout-steps.ts +0 -111
  256. package/src/components/checkout/form-schema.ts +0 -281
  257. package/src/components/checkout/format.ts +0 -15
  258. package/src/components/checkout/index.ts +0 -5
  259. package/src/components/checkout/map-customer-to-checkout.ts +0 -188
  260. package/src/components/checkout/types.ts +0 -41
  261. package/src/components/checkout/use-checkout-customer-prefill.ts +0 -409
  262. package/src/components/checkout/use-checkout-geo.ts +0 -50
  263. package/src/components/checkout/use-checkout-session.ts +0 -640
  264. package/src/components/hero.tsx +0 -291
  265. package/src/config.d.ts +0 -94
  266. package/src/config.mjs +0 -146
  267. package/src/format-money.ts +0 -31
  268. package/src/health.ts +0 -90
  269. package/src/hooks/index.ts +0 -9
  270. package/src/hooks/recently-viewed.ts +0 -125
  271. package/src/index.ts +0 -354
  272. package/src/link.tsx +0 -2
  273. package/src/pages/account/account-page-skeleton.tsx +0 -69
  274. package/src/pages/account/account-page-view.tsx +0 -270
  275. package/src/pages/account/account-shell.tsx +0 -101
  276. package/src/pages/account/parse-account-route.ts +0 -36
  277. package/src/pages/account.tsx +0 -16
  278. package/src/pages/api.$.ts +0 -20
  279. package/src/pages/api.auth.$.ts +0 -16
  280. package/src/pages/checkout.$checkoutId.tsx +0 -60
  281. package/src/pages/checkout.tsx +0 -31
  282. package/src/pages/pages.$pageSlug.tsx +0 -111
  283. package/src/pages/thank-you.tsx +0 -53
  284. package/src/providers/auth.tsx +0 -96
  285. package/src/providers/cart.tsx +0 -275
  286. package/src/providers/ecomiq.ts +0 -137
  287. package/src/providers/index.ts +0 -26
  288. package/src/proxy-api.ts +0 -20
  289. package/src/public-config.ts +0 -24
  290. package/src/review-submission.ts +0 -89
  291. package/src/runtime/context.ts +0 -2
  292. package/src/runtime/default-layout.tsx +0 -64
  293. package/src/runtime/head.ts +0 -149
  294. package/src/runtime/page.tsx +0 -143
  295. package/src/runtime/postcss-browser-stub.mjs +0 -5
  296. package/src/server-config-store.ts +0 -35
  297. package/src/server.ts +0 -301
  298. package/src/storefront-definition/contract.ts +0 -1
  299. package/src/storefront-definition/data.ts +0 -188
  300. package/src/storefront-definition/index.ts +0 -2
  301. package/src/storefront-definition/renderer.tsx +0 -1481
  302. package/src/storefront-layout.ts +0 -59
  303. package/src/storefront-runtime.ts +0 -173
  304. package/src/styles.css +0 -97
  305. package/src/ui/badge.tsx +0 -32
  306. package/src/ui/button.tsx +0 -31
  307. package/src/ui/card.tsx +0 -31
  308. package/src/ui/carousel.tsx +0 -218
  309. package/src/ui/cn.ts +0 -6
  310. package/src/ui/index.ts +0 -8
  311. package/src/ui/separator.tsx +0 -6
  312. package/src/ui/skeleton.tsx +0 -6
  313. package/src/ui/storefront-error.tsx +0 -49
  314. package/src/utils.ts +0 -36
  315. package/src/vite-inline.mjs +0 -263
  316. package/templates/__root.tsx +0 -83
  317. package/templates/router.tsx +0 -19
@@ -0,0 +1,8 @@
1
+ import { SectionCatalog, SectionRoot } from "../settings.js";
2
+ import { ComplaintBookActionData, ComplaintBookData } from "../complaint-book.js";
3
+ import "../index.js";
4
+ export declare const catalog: SectionCatalog;
5
+ export declare function ComplaintBook({ loaderData, actionData, ...root }: {
6
+ loaderData: ComplaintBookData;
7
+ actionData?: ComplaintBookActionData;
8
+ } & SectionRoot): import("react").JSX.Element;
@@ -0,0 +1,538 @@
1
+ import { Captcha } from "../captcha-DAqaIx8m.js";
2
+ import { COMPLAINT_DOCUMENT_TYPES, identityDocumentRule } from "../documents-T1mzc_j8.js";
3
+ import { useStorefrontText } from "../storefront-language-DrMjVbmk.js";
4
+ import { complaintBookAttachmentError, complaintBookNumber } from "../complaint-book-BvwLvfx0.js";
5
+ import { CustomerCsrfField } from "../customer-csrf-C1oDX-Py.js";
6
+ import { money } from "../money-DtGOtDri.js";
7
+ import { Form, useNavigation } from "react-router";
8
+ import { COMPLAINT_BOOK_ATTACHMENT_TYPES, formatOrderDate } from "@ecomiq/core";
9
+ import { Fragment, useRef, useState } from "react";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
+ import { Button } from "@theme/ui/button";
12
+ import { Input } from "@theme/ui/input";
13
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@theme/ui/select";
14
+ import { Textarea } from "@theme/ui/textarea";
15
+ import { Checkbox } from "@theme/ui/checkbox";
16
+ import { Label } from "@theme/ui/label";
17
+ import { RadioGroup, RadioGroupItem } from "@theme/ui/radio-group";
18
+ // src/sections/complaint-book.tsx
19
+ const catalog = {
20
+ name: "Libro de Reclamaciones",
21
+ description: "Formulario de reclamos y quejas con la hoja para imprimir."
22
+ };
23
+ const TYPES = [{
24
+ value: "claim",
25
+ label: "Reclamo"
26
+ }, {
27
+ value: "complaint",
28
+ label: "Queja"
29
+ }];
30
+ const ITEMS = [{
31
+ value: "product",
32
+ label: "Producto"
33
+ }, {
34
+ value: "service",
35
+ label: "Servicio"
36
+ }];
37
+ const LEGEND = "mb-3 text-lg font-medium";
38
+ const ATTACHMENT_ACCEPT = [
39
+ ...COMPLAINT_BOOK_ATTACHMENT_TYPES,
40
+ ".jpg",
41
+ ".jpeg",
42
+ ".png",
43
+ ".webp",
44
+ ".pdf"
45
+ ].join(",");
46
+ function Rows({ title, rows }) {
47
+ return /* @__PURE__ */ jsxs("div", {
48
+ className: "flex flex-col gap-2",
49
+ children: [/* @__PURE__ */ jsx("h3", {
50
+ className: "font-medium",
51
+ children: title
52
+ }), /* @__PURE__ */ jsx("dl", {
53
+ className: "grid gap-x-6 gap-y-1.5 text-sm sm:grid-cols-[11rem_minmax(0,1fr)]",
54
+ children: rows.map(([label, value]) => value ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", {
55
+ className: "text-muted-foreground",
56
+ children: label
57
+ }), /* @__PURE__ */ jsx("dd", {
58
+ className: "break-words whitespace-pre-line",
59
+ children: value
60
+ })] }, label) : null)
61
+ })]
62
+ });
63
+ }
64
+ function providerRows(book) {
65
+ return [
66
+ ["Razón social", book.providerName],
67
+ ["RUC", book.providerTaxId],
68
+ ["Dirección", book.providerAddress]
69
+ ];
70
+ }
71
+ function Field({ label, name, className, ...props }) {
72
+ return /* @__PURE__ */ jsxs("div", {
73
+ className: `flex flex-col gap-2 ${className ?? ""}`,
74
+ children: [/* @__PURE__ */ jsx(Label, {
75
+ htmlFor: `complaint-${name}`,
76
+ children: label
77
+ }), /* @__PURE__ */ jsx(Input, {
78
+ id: `complaint-${name}`,
79
+ name,
80
+ ...props
81
+ })]
82
+ });
83
+ }
84
+ function Area({ label, name, maxLength }) {
85
+ return /* @__PURE__ */ jsxs("div", {
86
+ className: "flex flex-col gap-2",
87
+ children: [/* @__PURE__ */ jsx(Label, {
88
+ htmlFor: `complaint-${name}`,
89
+ children: label
90
+ }), /* @__PURE__ */ jsx(Textarea, {
91
+ id: `complaint-${name}`,
92
+ name,
93
+ rows: 4,
94
+ maxLength,
95
+ required: true
96
+ })]
97
+ });
98
+ }
99
+ function Choices({ name, options }) {
100
+ return /* @__PURE__ */ jsx(RadioGroup, {
101
+ name,
102
+ defaultValue: options[0]?.value,
103
+ required: true,
104
+ className: "flex flex-wrap gap-6",
105
+ children: options.map((option) => /* @__PURE__ */ jsxs("div", {
106
+ className: "flex items-center gap-2",
107
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
108
+ id: `complaint-${name}-${option.value}`,
109
+ value: option.value
110
+ }), /* @__PURE__ */ jsx(Label, {
111
+ htmlFor: `complaint-${name}-${option.value}`,
112
+ children: option.label
113
+ })]
114
+ }, option.value))
115
+ });
116
+ }
117
+ function Attachments() {
118
+ const storefrontTranslate = useStorefrontText();
119
+ const input = useRef(null);
120
+ const [files, setFiles] = useState([]);
121
+ const [error, setError] = useState(null);
122
+ function attach(next) {
123
+ const transfer = new DataTransfer();
124
+ for (const file of next) transfer.items.add(file);
125
+ if (input.current) input.current.files = transfer.files;
126
+ setFiles(next);
127
+ }
128
+ function pick(picked) {
129
+ const next = [...files, ...Array.from(picked ?? [])];
130
+ const invalid = complaintBookAttachmentError(next);
131
+ setError(invalid);
132
+ attach(invalid ? files : next);
133
+ }
134
+ function remove(index) {
135
+ setError(null);
136
+ attach(files.filter((_, position) => position !== index));
137
+ }
138
+ return /* @__PURE__ */ jsxs("div", {
139
+ className: "flex flex-col gap-2",
140
+ children: [
141
+ /* @__PURE__ */ jsx(Field, {
142
+ ref: input,
143
+ label: storefrontTranslate("Adjuntos (opcional)"),
144
+ name: "files",
145
+ type: "file",
146
+ multiple: true,
147
+ accept: ATTACHMENT_ACCEPT,
148
+ "aria-describedby": "complaint-files-help",
149
+ onChange: (event) => pick(event.currentTarget.files)
150
+ }),
151
+ /* @__PURE__ */ jsxs("p", {
152
+ id: "complaint-files-help",
153
+ className: "text-sm text-muted-foreground",
154
+ children: [storefrontTranslate("Hasta 3 fotos o PDF de 5 MB."), " "]
155
+ }),
156
+ error ? /* @__PURE__ */ jsx("p", {
157
+ role: "alert",
158
+ className: "text-sm text-destructive",
159
+ children: storefrontTranslate(error)
160
+ }) : null,
161
+ files.length > 0 ? /* @__PURE__ */ jsx("ul", {
162
+ className: "flex flex-col gap-1 text-sm",
163
+ children: files.map((file, index) => /* @__PURE__ */ jsxs("li", {
164
+ className: "flex items-center justify-between gap-3",
165
+ children: [/* @__PURE__ */ jsx("span", {
166
+ className: "min-w-0 truncate",
167
+ children: file.name
168
+ }), /* @__PURE__ */ jsx(Button, {
169
+ type: "button",
170
+ variant: "ghost",
171
+ size: "sm",
172
+ "aria-label": storefrontTranslate("Quitar {value0}", { value0: file.name }),
173
+ onClick: () => remove(index),
174
+ children: storefrontTranslate("Quitar")
175
+ })]
176
+ }, `${index}-${file.name}`))
177
+ }) : null
178
+ ]
179
+ });
180
+ }
181
+ function ComplaintForm({ book, error, countries }) {
182
+ const storefrontTranslate = useStorefrontText();
183
+ const busy = useNavigation().state !== "idle";
184
+ const [kind, setKind] = useState("nationalId");
185
+ const [countryCode, setCountryCode] = useState("");
186
+ const [minor, setMinor] = useState(false);
187
+ const rule = identityDocumentRule(COMPLAINT_DOCUMENT_TYPES[kind]);
188
+ return /* @__PURE__ */ jsxs(Form, {
189
+ method: "post",
190
+ encType: "multipart/form-data",
191
+ className: "flex flex-col gap-8",
192
+ children: [
193
+ /* @__PURE__ */ jsx(CustomerCsrfField, {}),
194
+ /* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsx("legend", {
195
+ className: LEGEND,
196
+ children: storefrontTranslate("Tipo")
197
+ }), /* @__PURE__ */ jsx(Choices, {
198
+ name: "type",
199
+ options: TYPES
200
+ })] }),
201
+ /* @__PURE__ */ jsxs("fieldset", {
202
+ className: "grid gap-4 sm:grid-cols-2",
203
+ children: [
204
+ /* @__PURE__ */ jsx("legend", {
205
+ className: LEGEND,
206
+ children: storefrontTranslate("Tus datos")
207
+ }),
208
+ /* @__PURE__ */ jsx(Field, {
209
+ label: storefrontTranslate("Nombre completo"),
210
+ name: "consumerName",
211
+ autoComplete: "name",
212
+ maxLength: 200,
213
+ required: true,
214
+ className: "sm:col-span-2"
215
+ }),
216
+ /* @__PURE__ */ jsxs("div", {
217
+ className: "flex flex-col gap-2",
218
+ children: [/* @__PURE__ */ jsx(Label, {
219
+ htmlFor: "complaint-documentType",
220
+ children: storefrontTranslate("Tipo de documento")
221
+ }), /* @__PURE__ */ jsxs(Select, {
222
+ name: "documentType",
223
+ value: kind,
224
+ onValueChange: (value) => setKind(value === "taxId" || value === "foreignId" || value === "passport" ? value : "nationalId"),
225
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
226
+ id: "complaint-documentType",
227
+ className: "w-full",
228
+ children: /* @__PURE__ */ jsx(SelectValue, {})
229
+ }), /* @__PURE__ */ jsx(SelectContent, { children: Object.entries(COMPLAINT_DOCUMENT_TYPES).map(([item, type]) => /* @__PURE__ */ jsx(SelectItem, {
230
+ value: item,
231
+ children: identityDocumentRule(type).label
232
+ }, item)) })]
233
+ })]
234
+ }),
235
+ /* @__PURE__ */ jsxs("label", {
236
+ className: "flex flex-col gap-2",
237
+ children: [
238
+ storefrontTranslate("País emisor del documento"),
239
+ " ",
240
+ /* @__PURE__ */ jsxs("select", {
241
+ name: "documentCountryCode",
242
+ required: true,
243
+ value: countryCode,
244
+ onChange: (event) => setCountryCode(event.currentTarget.value),
245
+ className: "h-10 rounded-md border bg-background px-3 text-base md:text-sm",
246
+ children: [/* @__PURE__ */ jsx("option", {
247
+ value: "",
248
+ children: storefrontTranslate("Elige…")
249
+ }), countries.map((country) => /* @__PURE__ */ jsx("option", {
250
+ value: country.code,
251
+ children: country.name
252
+ }, country.code))]
253
+ })
254
+ ]
255
+ }),
256
+ /* @__PURE__ */ jsx(Field, {
257
+ label: storefrontTranslate("Número de documento"),
258
+ name: "documentNumber",
259
+ inputMode: rule.inputMode,
260
+ maxLength: rule.maxLength,
261
+ pattern: rule.pattern,
262
+ title: storefrontTranslate(rule.error),
263
+ autoComplete: "off",
264
+ required: true
265
+ }),
266
+ /* @__PURE__ */ jsx(Field, {
267
+ label: storefrontTranslate("Dirección"),
268
+ name: "consumerAddress",
269
+ autoComplete: "street-address",
270
+ maxLength: 300,
271
+ required: true,
272
+ className: "sm:col-span-2"
273
+ }),
274
+ /* @__PURE__ */ jsx(Field, {
275
+ label: storefrontTranslate("Celular"),
276
+ name: "consumerPhone",
277
+ type: "tel",
278
+ autoComplete: "tel",
279
+ maxLength: 30,
280
+ required: true
281
+ }),
282
+ /* @__PURE__ */ jsx(Field, {
283
+ label: storefrontTranslate("Correo"),
284
+ name: "consumerEmail",
285
+ type: "email",
286
+ autoComplete: "email",
287
+ maxLength: 254,
288
+ required: true
289
+ }),
290
+ /* @__PURE__ */ jsxs("div", {
291
+ className: "flex items-center gap-2 sm:col-span-2",
292
+ children: [/* @__PURE__ */ jsx(Checkbox, {
293
+ id: "complaint-minor",
294
+ name: "minor",
295
+ checked: minor,
296
+ onCheckedChange: (checked) => setMinor(checked === true)
297
+ }), /* @__PURE__ */ jsx(Label, {
298
+ htmlFor: "complaint-minor",
299
+ children: storefrontTranslate("Soy menor de edad")
300
+ })]
301
+ })
302
+ ]
303
+ }),
304
+ minor ? /* @__PURE__ */ jsxs("fieldset", {
305
+ className: "grid gap-4 sm:grid-cols-2",
306
+ children: [
307
+ /* @__PURE__ */ jsx("legend", {
308
+ className: LEGEND,
309
+ children: storefrontTranslate("Padre, madre o apoderado")
310
+ }),
311
+ /* @__PURE__ */ jsx(Field, {
312
+ label: storefrontTranslate("Nombre completo"),
313
+ name: "guardianName",
314
+ maxLength: 200,
315
+ required: true,
316
+ className: "sm:col-span-2"
317
+ }),
318
+ /* @__PURE__ */ jsx(Field, {
319
+ label: storefrontTranslate("Dirección"),
320
+ name: "guardianAddress",
321
+ maxLength: 300,
322
+ required: true,
323
+ className: "sm:col-span-2"
324
+ }),
325
+ /* @__PURE__ */ jsx(Field, {
326
+ label: storefrontTranslate("Celular"),
327
+ name: "guardianPhone",
328
+ type: "tel",
329
+ maxLength: 30,
330
+ required: true
331
+ }),
332
+ /* @__PURE__ */ jsx(Field, {
333
+ label: storefrontTranslate("Correo"),
334
+ name: "guardianEmail",
335
+ type: "email",
336
+ maxLength: 254,
337
+ required: true
338
+ })
339
+ ]
340
+ }) : null,
341
+ /* @__PURE__ */ jsxs("fieldset", {
342
+ className: "grid gap-4 sm:grid-cols-2",
343
+ children: [
344
+ /* @__PURE__ */ jsx("legend", {
345
+ className: LEGEND,
346
+ children: storefrontTranslate("Producto o servicio")
347
+ }),
348
+ /* @__PURE__ */ jsx("div", {
349
+ className: "sm:col-span-2",
350
+ children: /* @__PURE__ */ jsx(Choices, {
351
+ name: "itemKind",
352
+ options: ITEMS
353
+ })
354
+ }),
355
+ /* @__PURE__ */ jsx(Field, {
356
+ label: storefrontTranslate("Descripción"),
357
+ name: "itemDescription",
358
+ maxLength: 500,
359
+ required: true,
360
+ className: "sm:col-span-2"
361
+ }),
362
+ /* @__PURE__ */ jsx(Field, {
363
+ label: storefrontTranslate("Monto reclamado en {value0} (opcional)", { value0: book.currency }),
364
+ name: "itemAmount",
365
+ type: "number",
366
+ inputMode: "decimal",
367
+ min: 0,
368
+ step: "0.01"
369
+ }),
370
+ /* @__PURE__ */ jsx(Field, {
371
+ label: storefrontTranslate("N.° de pedido (opcional)"),
372
+ name: "orderNumber",
373
+ maxLength: 50
374
+ })
375
+ ]
376
+ }),
377
+ /* @__PURE__ */ jsxs("fieldset", {
378
+ className: "flex flex-col gap-4",
379
+ children: [
380
+ /* @__PURE__ */ jsx("legend", {
381
+ className: LEGEND,
382
+ children: storefrontTranslate("Detalle")
383
+ }),
384
+ /* @__PURE__ */ jsx(Area, {
385
+ label: storefrontTranslate("Qué pasó"),
386
+ name: "detail",
387
+ maxLength: 4e3
388
+ }),
389
+ /* @__PURE__ */ jsx(Area, {
390
+ label: storefrontTranslate("Qué solicitas"),
391
+ name: "request",
392
+ maxLength: 2e3
393
+ }),
394
+ /* @__PURE__ */ jsx(Attachments, {})
395
+ ]
396
+ }),
397
+ /* @__PURE__ */ jsxs("div", {
398
+ className: "flex items-center gap-2",
399
+ children: [/* @__PURE__ */ jsx(Checkbox, {
400
+ id: "complaint-confirmed",
401
+ name: "confirmed",
402
+ required: true
403
+ }), /* @__PURE__ */ jsx(Label, {
404
+ htmlFor: "complaint-confirmed",
405
+ children: storefrontTranslate("Declaro que los datos son verdaderos.")
406
+ })]
407
+ }),
408
+ /* @__PURE__ */ jsx(Captcha, {
409
+ captcha: book.captcha,
410
+ action: "complaint_book",
411
+ errorClass: "text-sm text-destructive",
412
+ busy
413
+ }),
414
+ error ? /* @__PURE__ */ jsx("p", {
415
+ role: "alert",
416
+ className: "rounded-md bg-destructive/10 px-4 py-3 text-sm text-destructive",
417
+ children: storefrontTranslate(error)
418
+ }) : null,
419
+ /* @__PURE__ */ jsx(Button, {
420
+ type: "submit",
421
+ disabled: busy || !book.captcha.isConfigured,
422
+ className: "sm:w-fit",
423
+ children: busy ? "Enviando…" : "Enviar"
424
+ })
425
+ ]
426
+ });
427
+ }
428
+ function Sheet({ book, filed, language, timeZone }) {
429
+ const storefrontTranslate = useStorefrontText();
430
+ const { entry, sheet, attachments } = filed;
431
+ const { consumer, guardian, item } = sheet;
432
+ const type = TYPES.find((option) => option.value === sheet.type)?.label ?? "";
433
+ const date = (iso) => formatOrderDate(iso, language, timeZone);
434
+ return /* @__PURE__ */ jsxs("article", {
435
+ className: "flex flex-col gap-6 rounded-lg border bg-card p-6 text-card-foreground md:p-8",
436
+ children: [
437
+ /* @__PURE__ */ jsxs("div", {
438
+ className: "flex flex-wrap items-start justify-between gap-3",
439
+ children: [/* @__PURE__ */ jsxs("div", {
440
+ className: "flex flex-col gap-1",
441
+ children: [/* @__PURE__ */ jsxs("p", {
442
+ className: "text-sm text-muted-foreground",
443
+ children: [
444
+ storefrontTranslate("Hoja de reclamación ·"),
445
+ " ",
446
+ type
447
+ ]
448
+ }), /* @__PURE__ */ jsx("h2", {
449
+ className: "font-heading text-3xl",
450
+ children: complaintBookNumber(entry.number)
451
+ })]
452
+ }), /* @__PURE__ */ jsxs(Button, {
453
+ type: "button",
454
+ variant: "outline",
455
+ onClick: () => window.print(),
456
+ className: "print:hidden",
457
+ children: [storefrontTranslate("Imprimir"), " "]
458
+ })]
459
+ }),
460
+ /* @__PURE__ */ jsx(Rows, {
461
+ title: storefrontTranslate("Fechas"),
462
+ rows: [["Presentado", date(entry.filedOn)], ["Respuesta hasta", date(entry.responseDueOn)]]
463
+ }),
464
+ /* @__PURE__ */ jsx(Rows, {
465
+ title: storefrontTranslate("Proveedor"),
466
+ rows: providerRows(book)
467
+ }),
468
+ /* @__PURE__ */ jsx(Rows, {
469
+ title: storefrontTranslate("Consumidor"),
470
+ rows: [
471
+ [storefrontTranslate("Nombre"), consumer.name],
472
+ [identityDocumentRule(COMPLAINT_DOCUMENT_TYPES[consumer.documentType]).label, consumer.documentNumber],
473
+ [storefrontTranslate("Dirección"), consumer.address],
474
+ [storefrontTranslate("Celular"), consumer.phone],
475
+ [storefrontTranslate("Correo"), consumer.email]
476
+ ]
477
+ }),
478
+ guardian ? /* @__PURE__ */ jsx(Rows, {
479
+ title: storefrontTranslate("Padre, madre o apoderado"),
480
+ rows: [
481
+ [storefrontTranslate("Nombre"), guardian.name],
482
+ [storefrontTranslate("Dirección"), guardian.address],
483
+ [storefrontTranslate("Celular"), guardian.phone],
484
+ [storefrontTranslate("Correo"), guardian.email]
485
+ ]
486
+ }) : null,
487
+ /* @__PURE__ */ jsx(Rows, {
488
+ title: ITEMS.find((option) => option.value === item.kind)?.label ?? "",
489
+ rows: [
490
+ [storefrontTranslate("Descripción"), item.description],
491
+ ["Monto reclamado", item.amount === null ? null : money(item.amount, book.currency, language)],
492
+ ["N.° de pedido", sheet.orderNumber]
493
+ ]
494
+ }),
495
+ /* @__PURE__ */ jsx(Rows, {
496
+ title: type,
497
+ rows: [
498
+ [storefrontTranslate("Qué pasó"), sheet.detail],
499
+ [storefrontTranslate("Qué solicitas"), sheet.request],
500
+ ["Adjuntos", attachments.join("\n")]
501
+ ]
502
+ })
503
+ ]
504
+ });
505
+ }
506
+ function ComplaintBook({ loaderData, actionData, ...root }) {
507
+ const storefrontTranslate = useStorefrontText();
508
+ const { book, language, timeZone } = loaderData;
509
+ const filed = actionData && "entry" in actionData ? actionData : null;
510
+ const error = actionData && "error" in actionData ? actionData.error : null;
511
+ return /* @__PURE__ */ jsxs("section", {
512
+ ...root,
513
+ className: "mx-auto flex w-full max-w-3xl flex-col gap-8 px-4 py-12 md:py-20",
514
+ children: [/* @__PURE__ */ jsxs("div", {
515
+ className: "flex flex-col gap-3",
516
+ children: [/* @__PURE__ */ jsx("h1", {
517
+ className: "text-4xl leading-tight md:text-5xl",
518
+ children: storefrontTranslate("Libro de Reclamaciones")
519
+ }), /* @__PURE__ */ jsx("p", {
520
+ className: "text-muted-foreground",
521
+ children: storefrontTranslate("Reclamo: disconformidad con el producto o servicio. Queja: malestar con la atención.")
522
+ })]
523
+ }), filed ? /* @__PURE__ */ jsx(Sheet, {
524
+ book,
525
+ filed,
526
+ language: `${language}-${loaderData.countryCode}`,
527
+ timeZone
528
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Rows, {
529
+ title: storefrontTranslate("Proveedor"),
530
+ rows: providerRows(book)
531
+ }), /* @__PURE__ */ jsx(ComplaintForm, {
532
+ countries: loaderData.countries,
533
+ book,
534
+ error
535
+ })] })]
536
+ });
537
+ }
538
+ export { ComplaintBook, catalog };
@@ -0,0 +1 @@
1
+ export declare function DesignSystem(): import("react").JSX.Element;