@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.
- package/LICENSE +21 -0
- package/README.md +150 -123
- package/dist/account-Dx4e3syi.js +258 -0
- package/dist/account-forms-AVk71ko7.js +39 -0
- package/dist/account-forms.d.ts +13 -0
- package/dist/account.d.ts +240 -0
- package/dist/address-defaults-BqjRhS82.js +14 -0
- package/dist/address-defaults.d.ts +11 -0
- package/dist/analytics/analytics-CG1Qagwl.js +148 -0
- package/dist/analytics/analytics.d.ts +1 -0
- package/dist/analytics/config-DJr-GRhs.js +62 -0
- package/dist/analytics/config.d.ts +22 -0
- package/dist/analytics/consent-B13rBpBs.js +57 -0
- package/dist/analytics/consent-banner-9QvRRy8v.js +239 -0
- package/dist/analytics/consent-banner.d.ts +20 -0
- package/dist/analytics/cookies-pLozllyB.js +100 -0
- package/dist/analytics/cookies.d.ts +6 -0
- package/dist/analytics/destinations-iECrlLIr.js +144 -0
- package/dist/analytics/events-Dt81tIp1.js +102 -0
- package/dist/analytics/events.d.ts +51 -0
- package/dist/analytics/tracker-p4yaoOyk.js +51 -0
- package/dist/api-cache-DsuIn5hX.js +159 -0
- package/dist/bank-accounts-DlEczQQ5.js +81 -0
- package/dist/bank-accounts.d.ts +4 -0
- package/dist/captcha-DAqaIx8m.js +117 -0
- package/dist/captcha.d.ts +34 -0
- package/dist/cart-D7DxZ2lD.js +30 -0
- package/dist/cart-actions-Bsub_FFG.js +116 -0
- package/dist/cart-actions.d.ts +15 -0
- package/dist/cart-drawer-B7PPsR69.js +22 -0
- package/dist/cart-drawer.d.ts +9 -0
- package/dist/cart-form-y9P1r_EX.js +81 -0
- package/dist/cart-form.d.ts +24 -0
- package/dist/cart-summary-ur2VWKr-.js +89 -0
- package/dist/cart-summary.d.ts +31 -0
- package/dist/cart.d.ts +4 -0
- package/dist/catalog-7gJ-l5hW.js +67 -0
- package/dist/catalog-hooks-B7ZP4wYY.js +312 -0
- package/dist/catalog-hooks.d.ts +111 -0
- package/dist/catalog.d.ts +5 -0
- package/dist/checkout-DVWSXANi.js +474 -0
- package/dist/checkout-form-CbOIdENC.js +131 -0
- package/dist/checkout-form.d.ts +20 -0
- package/dist/checkout.d.ts +86 -0
- package/dist/complaint-book-BvwLvfx0.js +117 -0
- package/dist/complaint-book.d.ts +62 -0
- package/dist/culqi-authentication-BGr20vAJ.js +204 -0
- package/dist/culqi-authentication.d.ts +15 -0
- package/dist/culqi-checkout-CTXpKgp_.js +55 -0
- package/dist/culqi-three-ds-HP3mfrvV.js +33 -0
- package/dist/culqi-three-ds.d.ts +29 -0
- package/dist/customer-avatar-CJXSDroK.js +12 -0
- package/dist/customer-avatar.d.ts +5 -0
- package/dist/customer-cookies-DHOgFAMV.js +45 -0
- package/dist/customer-csrf-C1oDX-Py.js +17 -0
- package/dist/customer-csrf.d.ts +3 -0
- package/dist/customer-document-fields-C1K-_DAD.js +70 -0
- package/dist/customer-document-fields.d.ts +9 -0
- package/dist/customer-login-form-C7AC6vXd.js +144 -0
- package/dist/customer-login-form.d.ts +17 -0
- package/dist/customer-registration-form-BEm_NEfP.js +93 -0
- package/dist/customer-registration-form.d.ts +8 -0
- package/dist/document-url-CGsAl5Tf.js +9 -0
- package/dist/documents-T1mzc_j8.js +38 -0
- package/dist/documents.d.ts +16 -0
- package/dist/entries/account.d.ts +11 -0
- package/dist/entries/account.js +10 -0
- package/dist/entries/analytics.d.ts +6 -0
- package/dist/entries/analytics.js +5 -0
- package/dist/entries/cart.d.ts +8 -0
- package/dist/entries/cart.js +7 -0
- package/dist/entries/checkout.d.ts +12 -0
- package/dist/entries/checkout.js +11 -0
- package/dist/entries/order.d.ts +11 -0
- package/dist/entries/order.js +11 -0
- package/dist/favicon-YpyhVJ9H.js +28 -0
- package/dist/favicon.d.ts +4 -0
- package/dist/form-BtQcbXlJ.js +18 -0
- package/dist/form-contracts-BNpHaTGJ.js +166 -0
- package/dist/form-contracts.d.ts +42 -0
- package/dist/form.d.ts +3 -0
- package/dist/hidden-CCWtOWKR.js +3 -0
- package/dist/hidden.d.ts +4 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +50 -0
- package/dist/invoice-fields-BG0HjL6T.js +103 -0
- package/dist/invoice-fields.d.ts +39 -0
- package/dist/links-kFxBZfdb.js +96 -0
- package/dist/links.d.ts +21 -0
- package/dist/mercadopago-checkout-DC7RXa8k.js +27 -0
- package/dist/mercadopago-dialog-UTQev0MG.js +180 -0
- package/dist/mercadopago-dialog.d.ts +21 -0
- package/dist/money-DtGOtDri.js +32 -0
- package/dist/money.d.ts +1 -0
- package/dist/optimistic-cart-BveVOHuh.js +53 -0
- package/dist/optimistic-cart.d.ts +16 -0
- package/dist/order-display-DTt5WBbc.js +112 -0
- package/dist/order-display.d.ts +20 -0
- package/dist/order-draft-DxV1Uhm3.js +38 -0
- package/dist/order-draft.d.ts +16 -0
- package/dist/order-pages-Dm6l5m0m.js +38 -0
- package/dist/order-pages.d.ts +12 -0
- package/dist/order-payment-continuation-D_d5PGA4.js +212 -0
- package/dist/order-payment-continuation.d.ts +10 -0
- package/dist/order-payment-in-review-x4gdLFHZ.js +65 -0
- package/dist/order-payment-in-review.d.ts +5 -0
- package/dist/order-status-BJXLJwxq.js +162 -0
- package/dist/order-status.d.ts +89 -0
- package/dist/order-view-9IlBg5AF.js +62 -0
- package/dist/order-view.d.ts +12 -0
- package/dist/page-action-Ctkf4xC6.js +7 -0
- package/dist/page-seo-a5FJl8x5.js +262 -0
- package/dist/page-seo.d.ts +34 -0
- package/dist/pages-Ca_Gt6mq.js +150 -0
- package/dist/pages.d.ts +45 -0
- package/dist/payment-dialog-frame-B-Q_xQ94.js +57 -0
- package/dist/payment-logo-BoPaGJc_.js +46 -0
- package/dist/payment-logo-svgs-By9lDTLK.js +20 -0
- package/dist/payment-logo.d.ts +11 -0
- package/dist/payment-logos-BYvdwYyJ.js +23 -0
- package/dist/payment-methods-B8ocTgFZ.js +73 -0
- package/dist/payment-methods.d.ts +58 -0
- package/dist/payment-return-5cjypwIw.js +7 -0
- package/dist/place-CmW4hBWY.js +13 -0
- package/dist/place.d.ts +4 -0
- package/dist/preview-BiIBif3C.js +427 -0
- package/dist/preview-address-Cf0sJ-9p.js +21 -0
- package/dist/preview-cart-Dg2CVktS.js +376 -0
- package/dist/product-preview-BspMAecJ.js +51 -0
- package/dist/product-preview.d.ts +5 -0
- package/dist/product-variants-BNDHvs1y.js +46 -0
- package/dist/product-variants.d.ts +12 -0
- package/dist/public-pages-XtwlaLwt.js +194 -0
- package/dist/public-pages.d.ts +67 -0
- package/dist/registration-CpDcv8ql.js +91 -0
- package/dist/registration.d.ts +12 -0
- package/dist/request-security-CRsRMgwj.js +76 -0
- package/dist/rich-text-M-Ju8RL4.js +9 -0
- package/dist/rich-text.d.ts +5 -0
- package/dist/route-text-DcJw2SsK.js +9 -0
- package/dist/route-text.d.ts +4 -0
- package/dist/section-preview-CmsMl3yu.js +83 -0
- package/dist/section-preview.d.ts +12 -0
- package/dist/sections/account-addresses.d.ts +18 -0
- package/dist/sections/account-addresses.js +375 -0
- package/dist/sections/account-order.d.ts +12 -0
- package/dist/sections/account-order.js +592 -0
- package/dist/sections/account-orders.d.ts +8 -0
- package/dist/sections/account-orders.js +359 -0
- package/dist/sections/account-profile.d.ts +16 -0
- package/dist/sections/account-profile.js +123 -0
- package/dist/sections/checkout.d.ts +24 -0
- package/dist/sections/checkout.js +963 -0
- package/dist/sections/complaint-book.d.ts +8 -0
- package/dist/sections/complaint-book.js +538 -0
- package/dist/sections/design-system.d.ts +1 -0
- package/dist/sections/design-system.js +310 -0
- package/dist/sections/draft-invoice.d.ts +20 -0
- package/dist/sections/draft-invoice.js +158 -0
- package/dist/sections/order-tracking.d.ts +19 -0
- package/dist/sections/order-tracking.js +141 -0
- package/dist/sections-CNUMWTF_.js +77 -0
- package/dist/sections.d.ts +19 -0
- package/dist/seo-GpDRhAAA.js +78 -0
- package/dist/session-CKvmFJyg.js +379 -0
- package/dist/session.d.ts +24 -0
- package/dist/settings-B0NO2A6Y.js +78 -0
- package/dist/settings.d.ts +51 -0
- package/dist/source-marker-DhqSkW7n.js +4 -0
- package/dist/sources-B-3JFJfb.js +46 -0
- package/dist/sources.d.ts +7 -0
- package/dist/store-8Q-_LFrQ.js +152 -0
- package/dist/store-contact--hY6CoFb.js +19 -0
- package/dist/store-contact.d.ts +6 -0
- package/dist/store.d.ts +17 -0
- package/dist/storefront-language-DrMjVbmk.js +29 -0
- package/dist/storefront-language.d.ts +14 -0
- package/dist/storefront-text-D25ae1qf.js +11 -0
- package/dist/storefront-text-en-ljjjSS4q.js +1030 -0
- package/dist/storefront-text-pt-BtHaJLcp.js +1030 -0
- package/dist/storefront-text.d.ts +4 -0
- package/dist/stripe-dialog-Ev9s3Z62.js +396 -0
- package/dist/stripe-dialog.d.ts +30 -0
- package/dist/telemetry-HuZXWBPi.js +114 -0
- package/dist/telemetry.d.ts +10 -0
- package/dist/templates-CAqoNyTW.js +40 -0
- package/dist/templates.d.ts +15 -0
- package/dist/urls-CpGQPxvf.js +71 -0
- package/dist/urls.d.ts +18 -0
- package/dist/use-checkout-CZcxXJXi.js +42 -0
- package/dist/use-checkout-payment-9R-zacrJ.js +80 -0
- package/dist/use-checkout-payment.d.ts +18 -0
- package/dist/use-checkout.d.ts +36 -0
- package/dist/use-culqi-checkout-CrjLAipU.js +109 -0
- package/dist/use-order-payment-BKIz_IO0.js +45 -0
- package/dist/use-order-payment.d.ts +18 -0
- package/dist/use-payment-token-CErx-tN-.js +105 -0
- package/dist/vite-payment-logos-kziu7wKb.js +27 -0
- package/dist/vite-payment-logos.d.ts +24 -0
- package/dist/vite-public-assets-DW2fgtVb.js +209 -0
- package/dist/vite-public-assets.d.ts +29 -0
- package/dist/vite-sections-DTBr0-Kg.js +464 -0
- package/dist/vite-sections.d.ts +21 -0
- package/dist/vite-theme-ui-BMO-CDi3.js +41 -0
- package/dist/vite-theme-ui.d.ts +10 -0
- package/dist/vite.d.ts +36 -0
- package/dist/vite.js +127 -0
- package/dist/voucher-payment-CVFDZ1L8.js +66 -0
- package/dist/worker-CNi-gzCu.js +86 -0
- package/dist/worker.d.ts +27 -0
- package/package.json +100 -81
- package/src/sections/account-addresses.tsx +215 -0
- package/src/sections/account-order.tsx +424 -0
- package/src/sections/account-orders.tsx +259 -0
- package/src/sections/account-profile.tsx +70 -0
- package/src/sections/checkout.tsx +586 -0
- package/src/sections/complaint-book.tsx +325 -0
- package/src/sections/design-system.tsx +146 -0
- package/src/sections/draft-invoice.tsx +105 -0
- package/src/sections/order-tracking.tsx +81 -0
- package/src/vite-client.d.ts +4 -0
- package/bin/ecomiq.mjs +0 -179
- package/public/design-bridge.js +0 -318
- package/src/api-proxy.ts +0 -194
- package/src/auth/create-storefront-auth.ts +0 -94
- package/src/auth/ecomiq-oauth-password-client.ts +0 -26
- package/src/auth/ecomiq-oauth-password-constants.ts +0 -24
- package/src/auth/ecomiq-oauth-password-plugin.ts +0 -294
- package/src/auth/ecomiq-oauth-password-types.ts +0 -24
- package/src/auth/ecomiq-storefront-sign-in.ts +0 -44
- package/src/auth/env.ts +0 -7
- package/src/auth/secure-cookies.ts +0 -23
- package/src/auth/storefront-auth-base-url.ts +0 -117
- package/src/auth/storefront-auth.ts +0 -7
- package/src/cart-session.ts +0 -239
- package/src/client.ts +0 -48
- package/src/cloud-runtime-client.ts +0 -378
- package/src/codegen.mjs +0 -789
- package/src/components/account/customer-addresses-panel.tsx +0 -678
- package/src/components/account/customer-order-detail-panel.tsx +0 -285
- package/src/components/account/customer-orders-panel.tsx +0 -192
- package/src/components/account/customer-profile-panel.tsx +0 -379
- package/src/components/checkout/cart-sync.ts +0 -143
- package/src/components/checkout/checkout-contact-section.tsx +0 -76
- package/src/components/checkout/checkout-external-update-banner.tsx +0 -15
- package/src/components/checkout/checkout-form-controls.tsx +0 -139
- package/src/components/checkout/checkout-line-items.tsx +0 -43
- package/src/components/checkout/checkout-order-summary.tsx +0 -165
- package/src/components/checkout/checkout-payment-section.tsx +0 -212
- package/src/components/checkout/checkout-session-view.tsx +0 -564
- package/src/components/checkout/checkout-shipping-address-section.tsx +0 -400
- package/src/components/checkout/checkout-shipping-section.tsx +0 -98
- package/src/components/checkout/checkout-states.tsx +0 -73
- package/src/components/checkout/checkout-step-card.tsx +0 -101
- package/src/components/checkout/checkout-steps.ts +0 -111
- package/src/components/checkout/form-schema.ts +0 -281
- package/src/components/checkout/format.ts +0 -15
- package/src/components/checkout/index.ts +0 -5
- package/src/components/checkout/map-customer-to-checkout.ts +0 -188
- package/src/components/checkout/types.ts +0 -41
- package/src/components/checkout/use-checkout-customer-prefill.ts +0 -409
- package/src/components/checkout/use-checkout-geo.ts +0 -50
- package/src/components/checkout/use-checkout-session.ts +0 -640
- package/src/components/hero.tsx +0 -291
- package/src/config.d.ts +0 -94
- package/src/config.mjs +0 -146
- package/src/format-money.ts +0 -31
- package/src/health.ts +0 -90
- package/src/hooks/index.ts +0 -9
- package/src/hooks/recently-viewed.ts +0 -125
- package/src/index.ts +0 -354
- package/src/link.tsx +0 -2
- package/src/pages/account/account-page-skeleton.tsx +0 -69
- package/src/pages/account/account-page-view.tsx +0 -270
- package/src/pages/account/account-shell.tsx +0 -101
- package/src/pages/account/parse-account-route.ts +0 -36
- package/src/pages/account.tsx +0 -16
- package/src/pages/api.$.ts +0 -20
- package/src/pages/api.auth.$.ts +0 -16
- package/src/pages/checkout.$checkoutId.tsx +0 -60
- package/src/pages/checkout.tsx +0 -31
- package/src/pages/pages.$pageSlug.tsx +0 -111
- package/src/pages/thank-you.tsx +0 -53
- package/src/providers/auth.tsx +0 -96
- package/src/providers/cart.tsx +0 -275
- package/src/providers/ecomiq.ts +0 -137
- package/src/providers/index.ts +0 -26
- package/src/proxy-api.ts +0 -20
- package/src/public-config.ts +0 -24
- package/src/review-submission.ts +0 -89
- package/src/runtime/context.ts +0 -2
- package/src/runtime/default-layout.tsx +0 -64
- package/src/runtime/head.ts +0 -149
- package/src/runtime/page.tsx +0 -143
- package/src/runtime/postcss-browser-stub.mjs +0 -5
- package/src/server-config-store.ts +0 -35
- package/src/server.ts +0 -301
- package/src/storefront-definition/contract.ts +0 -1
- package/src/storefront-definition/data.ts +0 -188
- package/src/storefront-definition/index.ts +0 -2
- package/src/storefront-definition/renderer.tsx +0 -1481
- package/src/storefront-layout.ts +0 -59
- package/src/storefront-runtime.ts +0 -173
- package/src/styles.css +0 -97
- package/src/ui/badge.tsx +0 -32
- package/src/ui/button.tsx +0 -31
- package/src/ui/card.tsx +0 -31
- package/src/ui/carousel.tsx +0 -218
- package/src/ui/cn.ts +0 -6
- package/src/ui/index.ts +0 -8
- package/src/ui/separator.tsx +0 -6
- package/src/ui/skeleton.tsx +0 -6
- package/src/ui/storefront-error.tsx +0 -49
- package/src/utils.ts +0 -36
- package/src/vite-inline.mjs +0 -263
- package/templates/__root.tsx +0 -83
- package/templates/router.tsx +0 -19
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
import { CustomerCsrfField } from "../customer-csrf-C1oDX-Py.js";
|
|
2
|
+
import { money } from "../money-DtGOtDri.js";
|
|
3
|
+
import { orderProgress } from "../order-status-BJXLJwxq.js";
|
|
4
|
+
import { useStorefrontLocale, useStorefrontText } from "../storefront-language-DrMjVbmk.js";
|
|
5
|
+
import { PayButton, PaymentPreview, ReorderButton, useOrderStepDetail } from "../order-display-DTt5WBbc.js";
|
|
6
|
+
import { orderStepLabel, orderStepOf, paymentStatusLabel } from "../order-view-9IlBg5AF.js";
|
|
7
|
+
import { orderSummaryLines } from "../cart-summary-ur2VWKr-.js";
|
|
8
|
+
import { Form, Link, useNavigation } from "react-router";
|
|
9
|
+
import { formatOrderDate } from "@ecomiq/core";
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Button } from "@theme/ui/button";
|
|
13
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@theme/ui/select";
|
|
14
|
+
import { Textarea } from "@theme/ui/textarea";
|
|
15
|
+
// src/sections/account-order.tsx
|
|
16
|
+
const catalog = {
|
|
17
|
+
name: "Detalle del pedido",
|
|
18
|
+
description: "Estado de cada producto, seguimiento, pago y totales de un pedido del cliente."
|
|
19
|
+
};
|
|
20
|
+
const STEP_ORDER = {
|
|
21
|
+
outForDelivery: 0,
|
|
22
|
+
shipped: 1,
|
|
23
|
+
confirmed: 2,
|
|
24
|
+
pending: 3,
|
|
25
|
+
delivered: 4,
|
|
26
|
+
cancelled: 5
|
|
27
|
+
};
|
|
28
|
+
function shipments(items) {
|
|
29
|
+
const groups = /* @__PURE__ */ new Map();
|
|
30
|
+
for (const item of items) {
|
|
31
|
+
const step = orderStepOf(item);
|
|
32
|
+
const key = `${step}|${item.trackingNumber ?? ""}|${item.trackingLink ?? ""}`;
|
|
33
|
+
const group = groups.get(key);
|
|
34
|
+
if (group) {
|
|
35
|
+
group.items.push(item);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
groups.set(key, {
|
|
39
|
+
key,
|
|
40
|
+
step,
|
|
41
|
+
carrierName: item.carrierName ?? null,
|
|
42
|
+
trackingNumber: item.trackingNumber ?? null,
|
|
43
|
+
trackingLink: item.trackingLink ?? null,
|
|
44
|
+
items: [item]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return [...groups.values()].sort((a, b) => STEP_ORDER[a.step] - STEP_ORDER[b.step]);
|
|
48
|
+
}
|
|
49
|
+
function Progress({ step }) {
|
|
50
|
+
const storefrontTranslate = useStorefrontText();
|
|
51
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
52
|
+
className: "grid grid-cols-4 gap-1.5",
|
|
53
|
+
children: orderProgress(step).map((item) => /* @__PURE__ */ jsxs("li", {
|
|
54
|
+
className: "flex flex-col gap-1.5",
|
|
55
|
+
children: [/* @__PURE__ */ jsx("span", { className: `h-1 rounded-full ${item.done ? "bg-primary" : "bg-muted"}` }), /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: `text-xs ${item.current ? "font-medium text-foreground" : "text-muted-foreground"}`,
|
|
57
|
+
children: storefrontTranslate(item.label)
|
|
58
|
+
})]
|
|
59
|
+
}, item.key))
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function ShipmentCard({ shipment, currency }) {
|
|
63
|
+
const storefrontTranslate = useStorefrontText();
|
|
64
|
+
const { locale } = useStorefrontLocale();
|
|
65
|
+
const stepDetail = useOrderStepDetail();
|
|
66
|
+
const tracking = [shipment.carrierName, shipment.trackingNumber].filter(Boolean).join(" · ");
|
|
67
|
+
const cancelled = shipment.step === "cancelled";
|
|
68
|
+
const detail = stepDetail(shipment.step, shipment.items);
|
|
69
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
70
|
+
className: "flex flex-col gap-5 rounded-lg border bg-card p-5 text-card-foreground md:p-6",
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "flex flex-col gap-1",
|
|
74
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
75
|
+
className: `font-heading text-2xl ${cancelled ? "text-muted-foreground" : ""}`,
|
|
76
|
+
children: storefrontTranslate(orderStepLabel(shipment.step))
|
|
77
|
+
}), detail === null ? null : /* @__PURE__ */ jsx("p", {
|
|
78
|
+
className: "text-sm text-muted-foreground",
|
|
79
|
+
children: detail
|
|
80
|
+
})]
|
|
81
|
+
}),
|
|
82
|
+
cancelled ? null : /* @__PURE__ */ jsx(Progress, { step: shipment.step }),
|
|
83
|
+
tracking !== "" || shipment.trackingLink ? /* @__PURE__ */ jsxs("div", {
|
|
84
|
+
className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2 rounded-md bg-muted/60 px-4 py-3 text-sm",
|
|
85
|
+
children: [/* @__PURE__ */ jsxs("span", { children: [
|
|
86
|
+
/* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: "text-muted-foreground",
|
|
88
|
+
children: storefrontTranslate("Seguimiento")
|
|
89
|
+
}),
|
|
90
|
+
" ",
|
|
91
|
+
tracking
|
|
92
|
+
] }), shipment.trackingLink ? /* @__PURE__ */ jsx("a", {
|
|
93
|
+
href: shipment.trackingLink,
|
|
94
|
+
target: "_blank",
|
|
95
|
+
rel: "noopener noreferrer",
|
|
96
|
+
className: "font-medium underline underline-offset-4",
|
|
97
|
+
children: storefrontTranslate("Seguir envío")
|
|
98
|
+
}) : null]
|
|
99
|
+
}) : null,
|
|
100
|
+
/* @__PURE__ */ jsx("ul", {
|
|
101
|
+
className: "flex flex-col divide-y",
|
|
102
|
+
children: shipment.items.map((item) => /* @__PURE__ */ jsxs("li", {
|
|
103
|
+
className: `flex gap-4 py-4 first:pt-0 last:pb-0 ${cancelled ? "opacity-60" : ""}`,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: "w-16 shrink-0 overflow-hidden rounded-sm bg-muted",
|
|
107
|
+
children: item.thumbnail ? /* @__PURE__ */ jsx("img", {
|
|
108
|
+
src: item.thumbnail,
|
|
109
|
+
alt: "",
|
|
110
|
+
width: 64,
|
|
111
|
+
height: 80,
|
|
112
|
+
loading: "lazy",
|
|
113
|
+
decoding: "async",
|
|
114
|
+
className: "aspect-[4/5] size-full object-cover"
|
|
115
|
+
}) : /* @__PURE__ */ jsx("span", { className: "block aspect-[4/5]" })
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ jsxs("div", {
|
|
118
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
119
|
+
children: [
|
|
120
|
+
item.productUrl ? /* @__PURE__ */ jsx(Link, {
|
|
121
|
+
to: item.productUrl,
|
|
122
|
+
className: "font-medium hover:underline",
|
|
123
|
+
children: item.title
|
|
124
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
125
|
+
className: "font-medium",
|
|
126
|
+
children: item.title
|
|
127
|
+
}),
|
|
128
|
+
item.variantTitle ? /* @__PURE__ */ jsx("p", {
|
|
129
|
+
className: "text-sm text-muted-foreground",
|
|
130
|
+
children: item.variantTitle
|
|
131
|
+
}) : null,
|
|
132
|
+
/* @__PURE__ */ jsxs("p", {
|
|
133
|
+
className: "text-sm text-muted-foreground",
|
|
134
|
+
children: [
|
|
135
|
+
money(item.unitPrice, currency, locale),
|
|
136
|
+
" × ",
|
|
137
|
+
item.quantity
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ jsx("p", {
|
|
143
|
+
className: "text-sm font-medium",
|
|
144
|
+
children: money(item.total, currency, locale)
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
}, item.id))
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function Payments({ order }) {
|
|
153
|
+
const storefrontTranslate = useStorefrontText();
|
|
154
|
+
const { locale, timeZone } = useStorefrontLocale();
|
|
155
|
+
const format = (value) => money(value, order.currencyCode, locale);
|
|
156
|
+
const lines = orderSummaryLines(order, {
|
|
157
|
+
subtotal: storefrontTranslate("Subtotal"),
|
|
158
|
+
discount: storefrontTranslate("Descuentos"),
|
|
159
|
+
shipping: storefrontTranslate("Envío"),
|
|
160
|
+
tax: storefrontTranslate("Impuestos"),
|
|
161
|
+
total: storefrontTranslate("Total"),
|
|
162
|
+
free: storefrontTranslate("Gratis"),
|
|
163
|
+
pending: storefrontTranslate("Por calcular")
|
|
164
|
+
});
|
|
165
|
+
const due = Math.max(0, order.total - order.totalPaid);
|
|
166
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
167
|
+
className: "flex flex-col gap-4 rounded-lg border bg-card p-5 text-card-foreground",
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ jsx("h3", {
|
|
170
|
+
className: "font-heading text-lg",
|
|
171
|
+
children: storefrontTranslate("Pago")
|
|
172
|
+
}),
|
|
173
|
+
order.payments.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
174
|
+
className: "text-sm text-muted-foreground",
|
|
175
|
+
children: storefrontTranslate("Sin pagos registrados")
|
|
176
|
+
}) : null,
|
|
177
|
+
order.payments.map((payment) => {
|
|
178
|
+
const status = paymentStatusLabel(payment);
|
|
179
|
+
const installments = payment.installments ?? 0;
|
|
180
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
181
|
+
className: "flex flex-col gap-1",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsxs("div", {
|
|
184
|
+
className: "flex items-start justify-between gap-3 text-sm",
|
|
185
|
+
children: [/* @__PURE__ */ jsx(PaymentPreview, {
|
|
186
|
+
payment,
|
|
187
|
+
className: "font-medium"
|
|
188
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
189
|
+
className: "font-medium",
|
|
190
|
+
children: format(payment.amount)
|
|
191
|
+
})]
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ jsx("p", {
|
|
194
|
+
className: "text-xs text-muted-foreground",
|
|
195
|
+
children: [
|
|
196
|
+
formatOrderDate(payment.createdOn, locale, timeZone),
|
|
197
|
+
installments > 1 ? storefrontTranslate("{value0} cuotas", { value0: installments }) : null,
|
|
198
|
+
status ? storefrontTranslate(status) : null
|
|
199
|
+
].filter(Boolean).join(" · ")
|
|
200
|
+
}),
|
|
201
|
+
payment.receiptUrl ? /* @__PURE__ */ jsx("a", {
|
|
202
|
+
href: payment.receiptUrl,
|
|
203
|
+
target: "_blank",
|
|
204
|
+
rel: "noopener noreferrer",
|
|
205
|
+
className: "w-fit text-xs font-medium underline underline-offset-4",
|
|
206
|
+
children: storefrontTranslate("Ver comprobante")
|
|
207
|
+
}) : null
|
|
208
|
+
]
|
|
209
|
+
}, payment.id);
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ jsxs("dl", {
|
|
212
|
+
className: "flex flex-col gap-2 border-t pt-4 text-sm",
|
|
213
|
+
children: [
|
|
214
|
+
lines.map((line) => /* @__PURE__ */ jsxs("div", {
|
|
215
|
+
className: `flex justify-between gap-4 ${line.key === "total" ? "font-semibold" : "text-muted-foreground"}`,
|
|
216
|
+
children: [/* @__PURE__ */ jsx("dt", { children: line.label }), /* @__PURE__ */ jsx("dd", { children: line.amount === null ? line.text : format(line.amount) })]
|
|
217
|
+
}, line.key)),
|
|
218
|
+
/* @__PURE__ */ jsxs("div", {
|
|
219
|
+
className: "flex justify-between gap-4 text-muted-foreground",
|
|
220
|
+
children: [/* @__PURE__ */ jsx("dt", { children: storefrontTranslate("Pagado") }), /* @__PURE__ */ jsx("dd", { children: format(order.totalPaid) })]
|
|
221
|
+
}),
|
|
222
|
+
due > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
223
|
+
className: "flex justify-between gap-4 font-medium text-destructive",
|
|
224
|
+
children: [/* @__PURE__ */ jsx("dt", { children: storefrontTranslate("Por pagar") }), /* @__PURE__ */ jsx("dd", { children: format(due) })]
|
|
225
|
+
}) : null
|
|
226
|
+
]
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
function History({ order }) {
|
|
232
|
+
const storefrontTranslate = useStorefrontText();
|
|
233
|
+
const { locale, timeZone } = useStorefrontLocale();
|
|
234
|
+
const events = [...order.statusTimeline].reverse();
|
|
235
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
236
|
+
className: "flex flex-col gap-4 rounded-lg border bg-card p-5 text-card-foreground",
|
|
237
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
238
|
+
className: "font-heading text-lg",
|
|
239
|
+
children: storefrontTranslate("Historial")
|
|
240
|
+
}), /* @__PURE__ */ jsx("ol", {
|
|
241
|
+
className: "flex flex-col",
|
|
242
|
+
children: events.map((event, index) => /* @__PURE__ */ jsxs("li", {
|
|
243
|
+
className: "relative flex gap-3 pb-4 text-sm last:pb-0",
|
|
244
|
+
children: [
|
|
245
|
+
index < events.length - 1 ? /* @__PURE__ */ jsx("span", {
|
|
246
|
+
"aria-hidden": "true",
|
|
247
|
+
className: "absolute left-[3px] top-3 h-full w-px bg-border"
|
|
248
|
+
}) : null,
|
|
249
|
+
/* @__PURE__ */ jsx("span", {
|
|
250
|
+
"aria-hidden": "true",
|
|
251
|
+
className: `relative mt-1.5 size-[7px] shrink-0 rounded-full ${index === 0 ? "bg-foreground" : "bg-foreground/25"}`
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ jsxs("div", {
|
|
254
|
+
className: "flex flex-1 flex-wrap justify-between gap-x-4 gap-y-0.5",
|
|
255
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
256
|
+
className: index === 0 ? "font-medium" : "",
|
|
257
|
+
children: [storefrontTranslate(event.label), event.description ? /* @__PURE__ */ jsx("span", {
|
|
258
|
+
className: "block text-xs font-normal text-muted-foreground",
|
|
259
|
+
children: event.description
|
|
260
|
+
}) : null]
|
|
261
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
262
|
+
className: "text-muted-foreground",
|
|
263
|
+
children: formatOrderDate(event.occurredAt, locale, timeZone)
|
|
264
|
+
})]
|
|
265
|
+
})
|
|
266
|
+
]
|
|
267
|
+
}, `${event.key}-${event.occurredAt}`))
|
|
268
|
+
})]
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const RETURN_REASONS = [
|
|
272
|
+
"La talla o medida no me quedó",
|
|
273
|
+
"Llegó dañado o con fallas",
|
|
274
|
+
"No es lo que pedí",
|
|
275
|
+
"No es como en las fotos",
|
|
276
|
+
"Ya no lo quiero",
|
|
277
|
+
"Otro motivo"
|
|
278
|
+
];
|
|
279
|
+
const CANCEL_REASONS = [
|
|
280
|
+
"Me equivoqué al hacer el pedido",
|
|
281
|
+
"Encontré un mejor precio",
|
|
282
|
+
"Demora mucho en llegar",
|
|
283
|
+
"Ya no lo necesito",
|
|
284
|
+
"Otro motivo"
|
|
285
|
+
];
|
|
286
|
+
const RETURN_STATES = {
|
|
287
|
+
requested: {
|
|
288
|
+
title: "Devolución solicitada",
|
|
289
|
+
detail: "La tienda está revisando tu solicitud. Te escribiremos por correo."
|
|
290
|
+
},
|
|
291
|
+
inProgress: {
|
|
292
|
+
title: "Devolución aprobada",
|
|
293
|
+
detail: "Te enviamos por correo los pasos para devolver los productos."
|
|
294
|
+
},
|
|
295
|
+
inspected: {
|
|
296
|
+
title: "Devolución en revisión",
|
|
297
|
+
detail: "La tienda recibió los productos y los está revisando."
|
|
298
|
+
},
|
|
299
|
+
returned: {
|
|
300
|
+
title: "Devolución completada",
|
|
301
|
+
detail: "La tienda recibió los productos."
|
|
302
|
+
},
|
|
303
|
+
rejected: {
|
|
304
|
+
title: "Devolución no aprobada",
|
|
305
|
+
detail: "Te escribimos por correo con el motivo."
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
function RequestStatus({ order }) {
|
|
309
|
+
const storefrontTranslate = useStorefrontText();
|
|
310
|
+
const state = order.cancellationRequestedAt ? {
|
|
311
|
+
title: "Cancelación solicitada",
|
|
312
|
+
detail: "La tienda está revisando tu solicitud. Te escribiremos por correo."
|
|
313
|
+
} : RETURN_STATES[order.returnStatus ?? ""];
|
|
314
|
+
if (!state) return null;
|
|
315
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
316
|
+
role: "status",
|
|
317
|
+
className: "flex flex-col gap-1 rounded-lg border bg-card p-5 text-card-foreground",
|
|
318
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
319
|
+
className: "font-heading text-lg",
|
|
320
|
+
children: storefrontTranslate(state.title)
|
|
321
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
322
|
+
className: "text-sm text-muted-foreground",
|
|
323
|
+
children: storefrontTranslate(state.detail)
|
|
324
|
+
})]
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function ReasonField({ reasons }) {
|
|
328
|
+
const storefrontTranslate = useStorefrontText();
|
|
329
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
330
|
+
className: "flex flex-col gap-1.5 text-sm",
|
|
331
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
332
|
+
className: "font-medium",
|
|
333
|
+
children: storefrontTranslate("Motivo")
|
|
334
|
+
}), /* @__PURE__ */ jsxs(Select, {
|
|
335
|
+
name: "reason",
|
|
336
|
+
required: true,
|
|
337
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
338
|
+
"aria-label": storefrontTranslate("Motivo"),
|
|
339
|
+
className: "h-11 w-full data-[size=default]:h-11",
|
|
340
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: storefrontTranslate("Elige un motivo") })
|
|
341
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: reasons.map((reason) => /* @__PURE__ */ jsx(SelectItem, {
|
|
342
|
+
value: reason,
|
|
343
|
+
children: storefrontTranslate(reason)
|
|
344
|
+
}, reason)) })]
|
|
345
|
+
})]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
function RequestForm({ request, order, error, onClose }) {
|
|
349
|
+
const storefrontTranslate = useStorefrontText();
|
|
350
|
+
const { locale, timeZone } = useStorefrontLocale();
|
|
351
|
+
const busy = useNavigation().state === "submitting";
|
|
352
|
+
const returnable = order.items.filter((item) => item.returnableQuantity > 0);
|
|
353
|
+
const [quantities, setQuantities] = useState(() => Object.fromEntries(returnable.map((item) => [item.id, returnable.length === 1 ? String(item.returnableQuantity) : "0"])));
|
|
354
|
+
return /* @__PURE__ */ jsxs(Form, {
|
|
355
|
+
method: "post",
|
|
356
|
+
encType: "multipart/form-data",
|
|
357
|
+
className: "flex flex-col gap-5 rounded-lg border bg-card p-5 text-card-foreground md:p-6",
|
|
358
|
+
children: [
|
|
359
|
+
/* @__PURE__ */ jsx(CustomerCsrfField, {}),
|
|
360
|
+
/* @__PURE__ */ jsx("input", {
|
|
361
|
+
type: "hidden",
|
|
362
|
+
name: "intent",
|
|
363
|
+
value: request
|
|
364
|
+
}),
|
|
365
|
+
/* @__PURE__ */ jsxs("div", {
|
|
366
|
+
className: "flex flex-col gap-1",
|
|
367
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
368
|
+
className: "font-heading text-2xl",
|
|
369
|
+
children: storefrontTranslate(request === "return" ? "Solicitar devolución" : "Solicitar cancelación")
|
|
370
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
371
|
+
className: "text-sm text-muted-foreground",
|
|
372
|
+
children: request === "return" && order.returnDeadline ? storefrontTranslate("Puedes pedirla hasta el {value0}. La tienda la revisa y te escribe por correo.", { value0: formatOrderDate(order.returnDeadline, locale, timeZone) }) : storefrontTranslate("La tienda la revisa antes de enviar tu pedido y te escribe por correo.")
|
|
373
|
+
})]
|
|
374
|
+
}),
|
|
375
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
376
|
+
role: "alert",
|
|
377
|
+
className: "rounded-md bg-destructive/10 px-4 py-3 text-sm text-destructive",
|
|
378
|
+
children: storefrontTranslate(error)
|
|
379
|
+
}) : null,
|
|
380
|
+
request === "return" ? /* @__PURE__ */ jsxs("ul", {
|
|
381
|
+
className: "flex flex-col divide-y",
|
|
382
|
+
children: [/* @__PURE__ */ jsx("li", {
|
|
383
|
+
className: "flex justify-end pb-2 text-xs text-muted-foreground",
|
|
384
|
+
children: storefrontTranslate("Cantidad")
|
|
385
|
+
}), returnable.map((item) => /* @__PURE__ */ jsxs("li", {
|
|
386
|
+
className: "flex items-center gap-4 py-3 first:pt-0",
|
|
387
|
+
children: [
|
|
388
|
+
/* @__PURE__ */ jsx("span", {
|
|
389
|
+
className: "w-12 shrink-0 overflow-hidden rounded-sm bg-muted",
|
|
390
|
+
children: item.thumbnail ? /* @__PURE__ */ jsx("img", {
|
|
391
|
+
src: item.thumbnail,
|
|
392
|
+
alt: "",
|
|
393
|
+
width: 48,
|
|
394
|
+
height: 60,
|
|
395
|
+
loading: "lazy",
|
|
396
|
+
decoding: "async",
|
|
397
|
+
className: "aspect-[4/5] size-full object-cover"
|
|
398
|
+
}) : /* @__PURE__ */ jsx("span", { className: "block aspect-[4/5]" })
|
|
399
|
+
}),
|
|
400
|
+
/* @__PURE__ */ jsxs("div", {
|
|
401
|
+
className: "flex min-w-0 flex-1 flex-col text-sm",
|
|
402
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
403
|
+
className: "font-medium",
|
|
404
|
+
children: item.title
|
|
405
|
+
}), item.variantTitle ? /* @__PURE__ */ jsx("span", {
|
|
406
|
+
className: "text-muted-foreground",
|
|
407
|
+
children: item.variantTitle
|
|
408
|
+
}) : null]
|
|
409
|
+
}),
|
|
410
|
+
/* @__PURE__ */ jsx("input", {
|
|
411
|
+
type: "hidden",
|
|
412
|
+
name: "itemId",
|
|
413
|
+
value: item.id
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ jsxs(Select, {
|
|
416
|
+
name: "quantity",
|
|
417
|
+
value: quantities[item.id] ?? "0",
|
|
418
|
+
onValueChange: (value) => setQuantities((current) => ({
|
|
419
|
+
...current,
|
|
420
|
+
[item.id]: value
|
|
421
|
+
})),
|
|
422
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
423
|
+
"aria-label": storefrontTranslate("Cantidad a devolver de {value0}", { value0: item.title }),
|
|
424
|
+
className: "w-20 shrink-0",
|
|
425
|
+
children: /* @__PURE__ */ jsx(SelectValue, { children: quantities[item.id] ?? "0" })
|
|
426
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: Array.from({ length: item.returnableQuantity + 1 }, (_, quantity) => /* @__PURE__ */ jsx(SelectItem, {
|
|
427
|
+
value: String(quantity),
|
|
428
|
+
children: quantity
|
|
429
|
+
}, quantity)) })]
|
|
430
|
+
})
|
|
431
|
+
]
|
|
432
|
+
}, item.id))]
|
|
433
|
+
}) : null,
|
|
434
|
+
/* @__PURE__ */ jsx(ReasonField, { reasons: request === "return" ? RETURN_REASONS : CANCEL_REASONS }),
|
|
435
|
+
/* @__PURE__ */ jsxs("label", {
|
|
436
|
+
className: "flex flex-col gap-1.5 text-sm",
|
|
437
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
438
|
+
className: "font-medium",
|
|
439
|
+
children: storefrontTranslate("Comentario (opcional)")
|
|
440
|
+
}), /* @__PURE__ */ jsx(Textarea, {
|
|
441
|
+
name: "comment",
|
|
442
|
+
rows: 3,
|
|
443
|
+
maxLength: 1e3
|
|
444
|
+
})]
|
|
445
|
+
}),
|
|
446
|
+
request === "return" ? /* @__PURE__ */ jsxs("label", {
|
|
447
|
+
className: "flex flex-col gap-1.5 text-sm",
|
|
448
|
+
children: [
|
|
449
|
+
/* @__PURE__ */ jsx("span", {
|
|
450
|
+
className: "font-medium",
|
|
451
|
+
children: storefrontTranslate("Fotos (opcional)")
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ jsx("input", {
|
|
454
|
+
type: "file",
|
|
455
|
+
name: "photos",
|
|
456
|
+
accept: "image/jpeg,image/png,image/webp",
|
|
457
|
+
multiple: true,
|
|
458
|
+
className: "text-sm file:mr-3 file:rounded-md file:border file:bg-background file:px-3 file:py-1.5 file:text-sm"
|
|
459
|
+
}),
|
|
460
|
+
/* @__PURE__ */ jsx("span", {
|
|
461
|
+
className: "text-xs text-muted-foreground",
|
|
462
|
+
children: storefrontTranslate("Hasta 3 fotos JPG, PNG o WebP de hasta 5 MB.")
|
|
463
|
+
})
|
|
464
|
+
]
|
|
465
|
+
}) : null,
|
|
466
|
+
/* @__PURE__ */ jsxs("div", {
|
|
467
|
+
className: "flex flex-wrap gap-2",
|
|
468
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
469
|
+
type: "submit",
|
|
470
|
+
disabled: busy,
|
|
471
|
+
children: busy ? storefrontTranslate("Enviando…") : storefrontTranslate("Enviar solicitud")
|
|
472
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
473
|
+
type: "button",
|
|
474
|
+
variant: "ghost",
|
|
475
|
+
onClick: onClose,
|
|
476
|
+
children: storefrontTranslate("Cancelar")
|
|
477
|
+
})]
|
|
478
|
+
})
|
|
479
|
+
]
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
function AccountOrder({ loaderData, actionData }) {
|
|
483
|
+
const storefrontTranslate = useStorefrontText();
|
|
484
|
+
const { locale, timeZone } = useStorefrontLocale();
|
|
485
|
+
const { order } = loaderData;
|
|
486
|
+
const [request, setRequest] = useState(null);
|
|
487
|
+
const sent = actionData?.sent ?? null;
|
|
488
|
+
useEffect(() => {
|
|
489
|
+
if (sent) setRequest(null);
|
|
490
|
+
}, [sent]);
|
|
491
|
+
const units = order.items.reduce((sum, item) => sum + item.quantity, 0);
|
|
492
|
+
const address = order.shippingAddress;
|
|
493
|
+
const contact = [order.email, order.phone].filter(Boolean);
|
|
494
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
495
|
+
className: "flex flex-col gap-8",
|
|
496
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
497
|
+
className: "flex flex-col gap-4",
|
|
498
|
+
children: [/* @__PURE__ */ jsxs(Link, {
|
|
499
|
+
to: "/account",
|
|
500
|
+
className: "w-fit text-sm text-muted-foreground hover:text-foreground",
|
|
501
|
+
children: ["← ", storefrontTranslate("Mis pedidos")]
|
|
502
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
503
|
+
className: "flex flex-wrap items-end justify-between gap-4",
|
|
504
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
505
|
+
className: "flex flex-col gap-1",
|
|
506
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
507
|
+
className: "text-3xl md:text-4xl",
|
|
508
|
+
children: storefrontTranslate("Pedido {value0}", { value0: order.orderNumber })
|
|
509
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
510
|
+
className: "text-sm text-muted-foreground",
|
|
511
|
+
children: [
|
|
512
|
+
storefrontTranslate("Realizado el {value0}", { value0: formatOrderDate(order.orderDate, locale, timeZone) }),
|
|
513
|
+
" ·",
|
|
514
|
+
" ",
|
|
515
|
+
units === 1 ? storefrontTranslate("1 producto") : storefrontTranslate("{value0} productos", { value0: units })
|
|
516
|
+
]
|
|
517
|
+
})]
|
|
518
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
519
|
+
className: "flex flex-wrap gap-2",
|
|
520
|
+
children: [
|
|
521
|
+
order.paymentPath ? /* @__PURE__ */ jsx(PayButton, {
|
|
522
|
+
path: order.paymentPath,
|
|
523
|
+
label: storefrontTranslate("Pagar {value0}", { value0: money(order.total - order.totalPaid, order.currencyCode, locale) })
|
|
524
|
+
}) : null,
|
|
525
|
+
/* @__PURE__ */ jsx(ReorderButton, {
|
|
526
|
+
items: order.items,
|
|
527
|
+
variant: order.paymentPath ? "outline" : "default"
|
|
528
|
+
}),
|
|
529
|
+
order.canRequestReturn && request !== "return" ? /* @__PURE__ */ jsx(Button, {
|
|
530
|
+
type: "button",
|
|
531
|
+
variant: "outline",
|
|
532
|
+
onClick: () => setRequest("return"),
|
|
533
|
+
children: storefrontTranslate("Solicitar devolución")
|
|
534
|
+
}) : null,
|
|
535
|
+
order.canRequestCancellation && request !== "cancel" ? /* @__PURE__ */ jsx(Button, {
|
|
536
|
+
type: "button",
|
|
537
|
+
variant: "outline",
|
|
538
|
+
onClick: () => setRequest("cancel"),
|
|
539
|
+
children: storefrontTranslate("Solicitar cancelación")
|
|
540
|
+
}) : null
|
|
541
|
+
]
|
|
542
|
+
})]
|
|
543
|
+
})]
|
|
544
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
545
|
+
className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_20rem]",
|
|
546
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
547
|
+
className: "flex flex-col gap-4",
|
|
548
|
+
children: [
|
|
549
|
+
/* @__PURE__ */ jsx(RequestStatus, { order }),
|
|
550
|
+
request ? /* @__PURE__ */ jsx(RequestForm, {
|
|
551
|
+
request,
|
|
552
|
+
order,
|
|
553
|
+
error: actionData?.error ?? null,
|
|
554
|
+
onClose: () => setRequest(null)
|
|
555
|
+
}) : null,
|
|
556
|
+
shipments(order.items).map((shipment) => /* @__PURE__ */ jsx(ShipmentCard, {
|
|
557
|
+
shipment,
|
|
558
|
+
currency: order.currencyCode
|
|
559
|
+
}, shipment.key)),
|
|
560
|
+
order.statusTimeline.length > 0 ? /* @__PURE__ */ jsx(History, { order }) : null
|
|
561
|
+
]
|
|
562
|
+
}), /* @__PURE__ */ jsxs("aside", {
|
|
563
|
+
className: "flex flex-col gap-4",
|
|
564
|
+
children: [/* @__PURE__ */ jsx(Payments, { order }), /* @__PURE__ */ jsxs("section", {
|
|
565
|
+
className: "flex flex-col gap-3 rounded-lg border bg-card p-5 text-sm text-card-foreground",
|
|
566
|
+
children: [
|
|
567
|
+
/* @__PURE__ */ jsx("h3", {
|
|
568
|
+
className: "font-heading text-lg",
|
|
569
|
+
children: storefrontTranslate("Entrega")
|
|
570
|
+
}),
|
|
571
|
+
address.name ? /* @__PURE__ */ jsx("p", {
|
|
572
|
+
className: "font-medium",
|
|
573
|
+
children: address.name
|
|
574
|
+
}) : null,
|
|
575
|
+
/* @__PURE__ */ jsx("p", {
|
|
576
|
+
className: "text-muted-foreground",
|
|
577
|
+
children: order.shippingAddressSummary ?? address.address1
|
|
578
|
+
}),
|
|
579
|
+
contact.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("h3", {
|
|
580
|
+
className: "pt-2 font-heading text-lg",
|
|
581
|
+
children: storefrontTranslate("Contacto")
|
|
582
|
+
}), contact.map((value) => /* @__PURE__ */ jsx("p", {
|
|
583
|
+
className: "text-muted-foreground",
|
|
584
|
+
children: value
|
|
585
|
+
}, value))] }) : null
|
|
586
|
+
]
|
|
587
|
+
})]
|
|
588
|
+
})]
|
|
589
|
+
})]
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
export { AccountOrder, catalog };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OrdersData } from "../account.js";
|
|
2
|
+
import "../index.js";
|
|
3
|
+
import { SectionCatalog } from "../settings.js";
|
|
4
|
+
import "../entries/account.js";
|
|
5
|
+
export declare const catalog: SectionCatalog;
|
|
6
|
+
export declare function AccountOrders({ loaderData }: {
|
|
7
|
+
loaderData: OrdersData;
|
|
8
|
+
}): import("react").JSX.Element;
|