@ecomiq/storefront 3.1.1 → 3.3.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/README.md +17 -0
- package/dist/{account-CZZ-ku6L.js → account-DMM0ZZYb.js} +25 -8
- package/dist/account.d.ts +1 -0
- package/dist/{address-defaults-BqjRhS82.js → address-defaults-Bj8j8noq.js} +2 -1
- package/dist/address-defaults.d.ts +1 -0
- package/dist/analytics/{config-DN5B1GOG.js → config-rY3DYQyP.js} +1 -1
- package/dist/{bank-accounts-MpKIxHaX.js → bank-accounts-CktJ_34-.js} +1 -1
- package/dist/buyer-rules-DBhUoaZX.js +20 -0
- package/dist/buyer-rules.d.ts +13 -0
- package/dist/{captcha-CZkpghTO.js → captcha-BgiQrAfa.js} +1 -1
- package/dist/{cart-actions-IKRYGqfj.js → cart-actions-C2Csh1k0.js} +1 -1
- package/dist/{catalog-hooks-DjmpXROv.js → catalog-hooks-Dk_58L_I.js} +1 -1
- package/dist/{checkout-DsI1MY14.js → checkout-DnfQ8WhP.js} +29 -14
- package/dist/{complaint-book-aAQfGBvo.js → complaint-book-DvxhgbsM.js} +11 -6
- package/dist/{culqi-authentication-DHxjPJRE.js → culqi-authentication-CThvkZYc.js} +1 -1
- package/dist/{customer-document-fields-BzLdztjM.js → customer-document-fields-CkydNlq2.js} +2 -2
- package/dist/{customer-login-form-k_q7_7FX.js → customer-login-form-CnXH_JcT.js} +2 -2
- package/dist/{customer-registration-form-PrBqUuI9.js → customer-registration-form-CwwytTsq.js} +10 -2
- package/dist/{documents-T1mzc_j8.js → documents-Ka-EL9m0.js} +29 -1
- package/dist/entries/account.js +5 -5
- package/dist/entries/analytics.js +1 -1
- package/dist/entries/cart.js +2 -2
- package/dist/entries/checkout.d.ts +4 -1
- package/dist/entries/checkout.js +11 -8
- package/dist/entries/order.js +7 -7
- package/dist/index.d.ts +3 -2
- package/dist/index.js +32 -31
- package/dist/{invoice-fields-BzDfV1nR.js → invoice-fields-BPRnSo_s.js} +3 -3
- package/dist/{mercadopago-dialog-CpGlgKBl.js → mercadopago-dialog-C8pRoGAB.js} +2 -2
- package/dist/{order-display-CUXVESaF.js → order-display-CK-5wCsa.js} +1 -1
- package/dist/{order-draft-D8sqUUNp.js → order-draft-XI7gDVeO.js} +1 -1
- package/dist/{order-payment-continuation-CS6omD7E.js → order-payment-continuation-DEGeYVyv.js} +3 -3
- package/dist/{order-payment-in-review-D5Y8bjGA.js → order-payment-in-review-D81gcAOe.js} +1 -1
- package/dist/{order-status-QsmEO-89.js → order-status-C61ywW-E.js} +2 -2
- package/dist/{page-seo-BKG-Ta6t.js → page-seo-BdyKwykI.js} +3 -3
- package/dist/{pages-DyItxkdE.js → pages-ClOPuk55.js} +3 -3
- package/dist/{payment-dialog-frame-xtidt_eM.js → payment-dialog-frame-C2n--N7s.js} +1 -1
- package/dist/{personalization-fields-CwBR8oGr.js → personalization-fields-BtNqpVpB.js} +1 -1
- package/dist/phone-B350moyr.js +13 -0
- package/dist/phone-field-D4io3zeV.js +141 -0
- package/dist/phone-field.d.ts +44 -0
- package/dist/phone.d.ts +2 -0
- package/dist/{preview-JWdMO6kX.js → preview-GypCcfup.js} +2 -2
- package/dist/{preview-address-bvieGEKb.js → preview-address-BobkvMlP.js} +1 -1
- package/dist/{preview-cart-COIP3Vfh.js → preview-cart-CRSPTs6g.js} +1 -1
- package/dist/{public-pages-Byh01h-6.js → public-pages-BZXH5gt9.js} +2 -2
- package/dist/{registration-h_00PAhj.js → registration-BmWt3-eT.js} +9 -4
- package/dist/registration.d.ts +1 -0
- package/dist/{route-text-B6pWdevi.js → route-text-CkupKB1b.js} +1 -1
- package/dist/{section-preview-BiYfeE-d.js → section-preview-C7QbWAzE.js} +2 -2
- package/dist/sections/account-addresses.js +20 -9
- package/dist/sections/account-order.js +4 -4
- package/dist/sections/account-orders.js +3 -3
- package/dist/sections/account-profile.d.ts +1 -0
- package/dist/sections/account-profile.js +21 -11
- package/dist/sections/checkout.js +63 -26
- package/dist/sections/complaint-book.js +39 -18
- package/dist/sections/design-system.js +1 -1
- package/dist/sections/draft-invoice.js +3 -3
- package/dist/sections/order-tracking.js +1 -1
- package/dist/{sections-CgpjubkB.js → sections-BkjGSM28.js} +1 -1
- package/dist/{seo-D9UdUMg9.js → seo-Cz1O5oxh.js} +2 -2
- package/dist/{session-DR_9-bcf.js → session-CsuzPSJs.js} +6 -6
- package/dist/{settings-B0NO2A6Y.js → settings-CiW3OroM.js} +20 -14
- package/dist/settings.d.ts +2 -1
- package/dist/{store-uU2gWdMY.js → store-BGDvRGNS.js} +14 -6
- package/dist/store.d.ts +8 -4
- package/dist/{storefront-language-Bnt-TU2F.js → storefront-language-20hJejSi.js} +5 -2
- package/dist/{storefront-text-Co7iUnLM.js → storefront-text-ClFfYMVk.js} +2 -2
- package/dist/{storefront-text-en-DzYmdOuY.js → storefront-text-en-DTTFnk6W.js} +8 -0
- package/dist/{storefront-text-pt-CizClH0I.js → storefront-text-pt-DuXQ0rti.js} +8 -0
- package/dist/{stripe-dialog-D88qfkUS.js → stripe-dialog-vlflY1WI.js} +2 -2
- package/dist/{telemetry-HuZXWBPi.js → telemetry-k9sM5iBG.js} +3 -0
- package/dist/{templates-AgGupnPA.js → templates-BM3WvMlA.js} +2 -2
- package/dist/{urls-D4uinJVd.js → urls-BR4wv2K2.js} +1 -1
- package/dist/{use-checkout-Jdk8P12A.js → use-checkout-BmVOLp_x.js} +1 -1
- package/dist/{use-checkout-payment-BGX-BE6D.js → use-checkout-payment-C2t511ck.js} +1 -1
- package/dist/{voucher-payment-B3o9ybg6.js → voucher-payment-Cbq4DRiL.js} +1 -1
- package/dist/{worker-cbXmLvfR.js → worker-BxlCSjSF.js} +3 -3
- package/package.json +4 -2
- package/src/sections/account-addresses.tsx +11 -7
- package/src/sections/account-profile.tsx +12 -7
- package/src/sections/checkout.tsx +45 -9
- package/src/sections/complaint-book.tsx +15 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { checkoutAddressDefaults, checkoutProgress, checkoutStep, defaultPaymentMethod, needsShipping } from "./checkout-
|
|
1
|
+
import { checkoutAddressDefaults, checkoutProgress, checkoutStep, defaultPaymentMethod, needsShipping } from "./checkout-DnfQ8WhP.js";
|
|
2
2
|
import { useCustomerCsrfToken } from "./customer-csrf-C1oDX-Py.js";
|
|
3
3
|
import { useFetcher, useNavigation, useSearchParams } from "react-router";
|
|
4
4
|
// src/use-checkout.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { findStripeWallet } from "./stripe-dialog-
|
|
1
|
+
import { findStripeWallet } from "./stripe-dialog-vlflY1WI.js";
|
|
2
2
|
import { usePaymentToken } from "./use-payment-token-CErx-tN-.js";
|
|
3
3
|
import { gathered } from "./checkout-form-CbOIdENC.js";
|
|
4
4
|
import { useRef, useState } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useStorefrontLocale, useStorefrontText } from "./storefront-language-
|
|
1
|
+
import { useStorefrontLocale, useStorefrontText } from "./storefront-language-20hJejSi.js";
|
|
2
2
|
import { money } from "./money-DtGOtDri.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
// src/voucher-payment.tsx
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cartCookie } from "./cart-D7DxZ2lD.js";
|
|
2
|
-
import "./preview-cart-
|
|
2
|
+
import "./preview-cart-CRSPTs6g.js";
|
|
3
3
|
import { productPreviewFrom, productPreviewResponse } from "./product-preview-BspMAecJ.js";
|
|
4
|
-
import { StorefrontSdkTiming, durationMetric } from "./telemetry-
|
|
4
|
+
import { StorefrontSdkTiming, durationMetric } from "./telemetry-k9sM5iBG.js";
|
|
5
5
|
import { privateCustomerResponse, rejectCrossOriginAction, rejectCustomerCsrf } from "./request-security-CRsRMgwj.js";
|
|
6
|
-
import { seoResponse } from "./seo-
|
|
6
|
+
import { seoResponse } from "./seo-Cz1O5oxh.js";
|
|
7
7
|
import { confirmingPaymentUrl } from "./payment-return-5cjypwIw.js";
|
|
8
8
|
import { RouterContextProvider, createContext, createRequestHandler } from "react-router";
|
|
9
9
|
import { STOREFRONT_CACHE_REVISION_HEADER, StorefrontCacheTokenSchema } from "@ecomiq/core/storefront-cache-revision";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecomiq/storefront",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Ecomiq para React Router: tienda, carrito, sesión de cliente y catálogo en un Worker",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -91,10 +91,12 @@
|
|
|
91
91
|
"@babel/parser": "^7.29.7",
|
|
92
92
|
"@babel/types": "^7.29.7",
|
|
93
93
|
"@stripe/stripe-js": "^9.17.0",
|
|
94
|
+
"libphonenumber-js": "^1.13.15",
|
|
94
95
|
"qrcode-generator": "^2.0.4",
|
|
96
|
+
"react-phone-number-input": "^3.4.17",
|
|
95
97
|
"sharp": "^0.35.5",
|
|
96
98
|
"zod": "^4.6.6",
|
|
97
|
-
"@ecomiq/core": "^1.
|
|
99
|
+
"@ecomiq/core": "^1.2.0"
|
|
98
100
|
},
|
|
99
101
|
"peerDependencies": {
|
|
100
102
|
"react": "^19.2.0",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { CustomerAddress } from "@ecomiq/core";
|
|
2
|
-
import { useState, type ReactNode } from "react";
|
|
2
|
+
import { useState, type ComponentProps, type ReactNode } from "react";
|
|
3
3
|
import { useNavigation } from "react-router";
|
|
4
4
|
import { Badge } from "@theme/ui/badge";
|
|
5
5
|
import { Button } from "@theme/ui/button";
|
|
6
6
|
import { Input } from "@theme/ui/input";
|
|
7
7
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@theme/ui/select";
|
|
8
|
-
import { useStorefrontText, type SectionCatalog } from "../index";
|
|
8
|
+
import { PhoneField, useStorefrontText, type SectionCatalog } from "../index";
|
|
9
9
|
import { AddressForm, addressDefaults, placeValue, useGeoCascade, type AddressActionData, type AddressDefaults } from "../entries/account";
|
|
10
10
|
|
|
11
11
|
export const catalog: SectionCatalog = {
|
|
@@ -59,6 +59,10 @@ function PlaceSelect({ name, label, items, value, disabled, onChange }: { name:
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
function PhoneInputBox(props: ComponentProps<"input">) {
|
|
63
|
+
return <Input {...props} className="min-w-0 flex-1 rounded-s-none" />;
|
|
64
|
+
}
|
|
65
|
+
|
|
62
66
|
function AddressFields({ countries, defaults, label }: { countries: Country[]; defaults: AddressDefaults; label: string }) {
|
|
63
67
|
const storefrontTranslate = useStorefrontText();
|
|
64
68
|
const geo = useGeoCascade({ ...defaults, country: defaults.country ?? countries[0]?.code });
|
|
@@ -83,21 +87,21 @@ function AddressFields({ countries, defaults, label }: { countries: Country[]; d
|
|
|
83
87
|
) : (
|
|
84
88
|
<>
|
|
85
89
|
<Labeled label={storefrontTranslate("Región")}>
|
|
86
|
-
<Input name="department" defaultValue={defaults.department ?? ""} required />
|
|
90
|
+
<Input name="department" defaultValue={defaults.department ?? ""} maxLength={100} required />
|
|
87
91
|
</Labeled>
|
|
88
92
|
<Labeled label={storefrontTranslate("Ciudad")}>
|
|
89
|
-
<Input name="district" defaultValue={defaults.district ?? ""} required />
|
|
93
|
+
<Input name="district" defaultValue={defaults.district ?? ""} maxLength={100} required />
|
|
90
94
|
</Labeled>
|
|
91
95
|
</>
|
|
92
96
|
)}
|
|
93
97
|
<Labeled label={storefrontTranslate("Dirección")} className="sm:col-span-2">
|
|
94
|
-
<Input name="line" autoComplete="street-address" defaultValue={defaults.line ?? ""} required />
|
|
98
|
+
<Input name="line" autoComplete="street-address" defaultValue={defaults.line ?? ""} maxLength={200} required />
|
|
95
99
|
</Labeled>
|
|
96
100
|
<Labeled label={storefrontTranslate("Referencia (opcional)")}>
|
|
97
|
-
<Input name="reference" defaultValue={defaults.reference ?? ""} />
|
|
101
|
+
<Input name="reference" defaultValue={defaults.reference ?? ""} maxLength={500} />
|
|
98
102
|
</Labeled>
|
|
99
103
|
<Labeled label={storefrontTranslate("Celular")}>
|
|
100
|
-
<
|
|
104
|
+
<PhoneField countryCode={geo.country} initial={defaults.phone ?? ""} required inputComponent={PhoneInputBox} />
|
|
101
105
|
</Labeled>
|
|
102
106
|
</div>
|
|
103
107
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CustomerMe } from "@ecomiq/core";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
2
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
3
3
|
import { useNavigation } from "react-router";
|
|
4
4
|
import { Button } from "@theme/ui/button";
|
|
5
5
|
import { Input } from "@theme/ui/input";
|
|
6
|
-
import { useStorefrontText, type SectionCatalog } from "../index";
|
|
6
|
+
import { PhoneField, useStorefrontText, type SectionCatalog } from "../index";
|
|
7
7
|
import { CustomerDocumentFields, ProfileForm, type ProfileActionData } from "../entries/account";
|
|
8
8
|
|
|
9
9
|
export const catalog: SectionCatalog = {
|
|
@@ -21,9 +21,13 @@ function Labeled({ label, hint, className = "", children }: { label: string; hin
|
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
function PhoneInputBox(props: ComponentProps<"input">) {
|
|
25
|
+
return <Input {...props} className="min-w-0 flex-1 rounded-s-none" />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function AccountProfile({ loaderData, actionData }: { loaderData: { countryCode: string; me: CustomerMe; countries: { code: string; name: string }[] }; actionData?: ProfileActionData }) {
|
|
25
29
|
const storefrontTranslate = useStorefrontText();
|
|
26
|
-
const { me, countries } = loaderData;
|
|
30
|
+
const { me, countries, countryCode } = loaderData;
|
|
27
31
|
const busy = useNavigation().state !== "idle";
|
|
28
32
|
return (
|
|
29
33
|
<div className="flex flex-col gap-6">
|
|
@@ -48,9 +52,10 @@ export function AccountProfile({ loaderData, actionData }: { loaderData: { me: C
|
|
|
48
52
|
<Labeled label={storefrontTranslate("Apellido")}>
|
|
49
53
|
<Input name="lastName" autoComplete="family-name" defaultValue={me.lastName ?? ""} maxLength={100} />
|
|
50
54
|
</Labeled>
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
|
|
55
|
+
<div className="flex flex-col gap-1.5 text-sm">
|
|
56
|
+
<label htmlFor="phone" className="font-medium">{storefrontTranslate("Celular")}</label>
|
|
57
|
+
<PhoneField countryCode={countryCode} initial={me.phone ?? ""} inputComponent={PhoneInputBox} />
|
|
58
|
+
</div>
|
|
54
59
|
<div className="flex flex-col gap-1.5 text-sm">
|
|
55
60
|
<span className="font-medium">{storefrontTranslate("Correo")}</span>
|
|
56
61
|
<p className="flex h-10 items-center text-muted-foreground">{me.email ?? "—"}</p>
|
|
@@ -5,12 +5,22 @@ import { Button } from "@theme/ui/button";
|
|
|
5
5
|
import { BankAccountList, useStorefrontText, PaymentLogo, money, section, setting, type SectionCatalog, type SectionProps, type SectionRoot } from "../index";
|
|
6
6
|
import { placeValue, useGeoCascade } from "../entries/account";
|
|
7
7
|
import {
|
|
8
|
+
ADDRESS_LINE_MAX_LENGTH,
|
|
9
|
+
ADDRESS_LINE_MIN_LENGTH,
|
|
10
|
+
ADDRESS_REFERENCE_MAX_LENGTH,
|
|
8
11
|
CheckoutForm,
|
|
9
12
|
CulqiAuthentication,
|
|
13
|
+
EMAIL_ERROR,
|
|
14
|
+
EMAIL_MAX_LENGTH,
|
|
15
|
+
EMAIL_PATTERN,
|
|
10
16
|
InvoiceFields,
|
|
11
17
|
MercadoPagoDialog,
|
|
12
18
|
OrderBumpForm,
|
|
13
19
|
PaymentMethods,
|
|
20
|
+
PERSON_NAME_MAX_LENGTH,
|
|
21
|
+
PhoneField,
|
|
22
|
+
PLACE_NAME_MAX_LENGTH,
|
|
23
|
+
POSTAL_CODE_MAX_LENGTH,
|
|
14
24
|
PromoCodeForm,
|
|
15
25
|
StripeAuthentication,
|
|
16
26
|
StripeDialog,
|
|
@@ -96,6 +106,31 @@ function Field({ label, className, ...props }: ComponentProps<"input"> & { label
|
|
|
96
106
|
);
|
|
97
107
|
}
|
|
98
108
|
|
|
109
|
+
function PhoneInputBox({ className, ...props }: ComponentProps<"input">) {
|
|
110
|
+
const storefrontTranslate = useStorefrontText();
|
|
111
|
+
const label = storefrontTranslate("Celular");
|
|
112
|
+
return (
|
|
113
|
+
<label className={`relative block flex-1 ${className ?? ""}`}>
|
|
114
|
+
<input placeholder={label} className={`${FIELD} rounded-s-none`} {...props} />
|
|
115
|
+
<span className={FLOAT}>{label}</span>
|
|
116
|
+
</label>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function CheckoutPhoneField({ countryCode, initial, className }: { countryCode: string; initial: string; className?: string }) {
|
|
121
|
+
return (
|
|
122
|
+
<PhoneField
|
|
123
|
+
countryCode={countryCode}
|
|
124
|
+
initial={initial}
|
|
125
|
+
required
|
|
126
|
+
className={className}
|
|
127
|
+
inputComponent={PhoneInputBox}
|
|
128
|
+
selectClassName="rounded-s-md border border-e-0 border-input bg-background px-3 text-foreground focus-within:border-ring focus-within:ring-1 focus-within:ring-ring group-data-[fields=filled]/checkout:border-transparent group-data-[fields=filled]/checkout:bg-muted"
|
|
129
|
+
errorClassName="text-sm text-destructive sm:col-span-2"
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
99
134
|
function Choice({ label, className, children, ...props }: SelectHTMLAttributes<HTMLSelectElement> & { label: string; name: string }) {
|
|
100
135
|
return (
|
|
101
136
|
<label className={`relative block ${className ?? ""}`}>
|
|
@@ -160,13 +195,14 @@ function Address({ countries, defaults }: { countries: { code: string; name: str
|
|
|
160
195
|
</>
|
|
161
196
|
) : (
|
|
162
197
|
<>
|
|
163
|
-
<Field label={storefrontTranslate("Región")} name="department" defaultValue={defaults.department ?? ""} required />
|
|
164
|
-
<Field label={storefrontTranslate("Ciudad")} name="district" defaultValue={defaults.district ?? ""} required />
|
|
198
|
+
<Field label={storefrontTranslate("Región")} name="department" defaultValue={defaults.department ?? ""} maxLength={PLACE_NAME_MAX_LENGTH} required />
|
|
199
|
+
<Field label={storefrontTranslate("Ciudad")} name="district" defaultValue={defaults.district ?? ""} maxLength={PLACE_NAME_MAX_LENGTH} required />
|
|
165
200
|
</>
|
|
166
201
|
)}
|
|
167
|
-
<Field label={storefrontTranslate("Dirección")} name="line" autoComplete="street-address" defaultValue={defaults.line ?? ""} required className="sm:col-span-2" />
|
|
168
|
-
<Field label={storefrontTranslate("Referencia (opcional)")} name="reference" defaultValue={defaults.reference ?? ""} />
|
|
169
|
-
<Field label={storefrontTranslate("
|
|
202
|
+
<Field label={storefrontTranslate("Dirección")} name="line" autoComplete="street-address" defaultValue={defaults.line ?? ""} minLength={ADDRESS_LINE_MIN_LENGTH} maxLength={ADDRESS_LINE_MAX_LENGTH} required className="sm:col-span-2" />
|
|
203
|
+
<Field label={storefrontTranslate("Referencia (opcional)")} name="reference" defaultValue={defaults.reference ?? ""} maxLength={ADDRESS_REFERENCE_MAX_LENGTH} />
|
|
204
|
+
{geo.structured ? null : <Field label={storefrontTranslate("Código postal (opcional)")} name="postalCode" autoComplete="postal-code" defaultValue={defaults.postalCode ?? ""} maxLength={POSTAL_CODE_MAX_LENGTH} />}
|
|
205
|
+
<CheckoutPhoneField countryCode={country} initial={defaults.phone ?? ""} className={geo.structured ? "" : "sm:col-span-2"} />
|
|
170
206
|
</div>
|
|
171
207
|
);
|
|
172
208
|
}
|
|
@@ -367,10 +403,10 @@ export function Checkout({ data, result, ...root }: { data: CheckoutData; result
|
|
|
367
403
|
>
|
|
368
404
|
{storefrontTranslate("Contacto")}</Heading>
|
|
369
405
|
<CheckoutForm single={single} intent="contact" className="grid gap-3 sm:grid-cols-2">
|
|
370
|
-
<Field label={storefrontTranslate("Correo")} name="email" type="email" autoComplete="email" defaultValue={cart.email ?? me?.email ?? ""} required className="sm:col-span-2" />
|
|
371
|
-
<Field label={storefrontTranslate("Nombre")} name="firstName" autoComplete="given-name" defaultValue={cart.firstName ?? me?.firstName ?? ""} required />
|
|
372
|
-
<Field label={storefrontTranslate("Apellidos")} name="lastName" autoComplete="family-name" defaultValue={cart.lastName ?? me?.lastName ?? ""} required />
|
|
373
|
-
<
|
|
406
|
+
<Field label={storefrontTranslate("Correo")} name="email" type="email" autoComplete="email" defaultValue={cart.email ?? me?.email ?? ""} pattern={EMAIL_PATTERN} title={storefrontTranslate(EMAIL_ERROR)} maxLength={EMAIL_MAX_LENGTH} required className="sm:col-span-2" />
|
|
407
|
+
<Field label={storefrontTranslate("Nombre")} name="firstName" autoComplete="given-name" defaultValue={cart.firstName ?? me?.firstName ?? ""} maxLength={PERSON_NAME_MAX_LENGTH} required />
|
|
408
|
+
<Field label={storefrontTranslate("Apellidos")} name="lastName" autoComplete="family-name" defaultValue={cart.lastName ?? me?.lastName ?? ""} maxLength={PERSON_NAME_MAX_LENGTH} required />
|
|
409
|
+
<CheckoutPhoneField countryCode={data.countryCode} initial={cart.phone ?? me?.phone ?? ""} className="sm:col-span-2" />
|
|
374
410
|
<InvoiceFields cart={cart}>
|
|
375
411
|
{(invoice) => (
|
|
376
412
|
<div className="flex flex-col gap-3 sm:col-span-2">
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
complaintBookNumber,
|
|
18
18
|
CustomerCsrfField,
|
|
19
19
|
money,
|
|
20
|
+
PhoneField,
|
|
20
21
|
type ComplaintBookActionData,
|
|
21
22
|
type ComplaintBookData,
|
|
22
23
|
type SectionCatalog,
|
|
@@ -68,6 +69,10 @@ function providerRows(book: ComplaintBookConfiguration): Row[] {
|
|
|
68
69
|
];
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
function PhoneInputBox(props: ComponentProps<"input">) {
|
|
73
|
+
return <Input {...props} className="min-w-0 flex-1 rounded-s-none" />;
|
|
74
|
+
}
|
|
75
|
+
|
|
71
76
|
function Field({ label, name, className, ...props }: ComponentProps<"input"> & { label: string; name: string }) {
|
|
72
77
|
return (
|
|
73
78
|
<div className={`flex flex-col gap-2 ${className ?? ""}`}>
|
|
@@ -149,7 +154,7 @@ function Attachments() {
|
|
|
149
154
|
);
|
|
150
155
|
}
|
|
151
156
|
|
|
152
|
-
function ComplaintForm({ book, error, countries }: { book: ComplaintBookConfiguration; error: string | null; countries: ComplaintBookData["countries"] }) {
|
|
157
|
+
function ComplaintForm({ book, error, countries, storeCountry }: { storeCountry: string; book: ComplaintBookConfiguration; error: string | null; countries: ComplaintBookData["countries"] }) {
|
|
153
158
|
const storefrontTranslate = useStorefrontText();
|
|
154
159
|
const busy = useNavigation().state !== "idle";
|
|
155
160
|
const [kind, setKind] = useState<keyof typeof COMPLAINT_DOCUMENT_TYPES>("nationalId");
|
|
@@ -188,7 +193,10 @@ function ComplaintForm({ book, error, countries }: { book: ComplaintBookConfigur
|
|
|
188
193
|
</label>
|
|
189
194
|
<Field label={storefrontTranslate("Número de documento")} name="documentNumber" inputMode={rule.inputMode} maxLength={rule.maxLength} pattern={rule.pattern} title={storefrontTranslate(rule.error)} autoComplete="off" required />
|
|
190
195
|
<Field label={storefrontTranslate("Dirección")} name="consumerAddress" autoComplete="street-address" maxLength={300} required className="sm:col-span-2" />
|
|
191
|
-
<
|
|
196
|
+
<div className="flex flex-col gap-2">
|
|
197
|
+
<Label htmlFor="complaint-consumerPhone">{storefrontTranslate("Celular")}</Label>
|
|
198
|
+
<PhoneField countryCode={storeCountry} initial="" name="consumerPhone" id="complaint-consumerPhone" required inputComponent={PhoneInputBox} />
|
|
199
|
+
</div>
|
|
192
200
|
<Field label={storefrontTranslate("Correo")} name="consumerEmail" type="email" autoComplete="email" maxLength={254} required />
|
|
193
201
|
<div className="flex items-center gap-2 sm:col-span-2">
|
|
194
202
|
<Checkbox id="complaint-minor" name="minor" checked={minor} onCheckedChange={(checked) => setMinor(checked === true)} />
|
|
@@ -200,7 +208,10 @@ function ComplaintForm({ book, error, countries }: { book: ComplaintBookConfigur
|
|
|
200
208
|
<legend className={LEGEND}>{storefrontTranslate("Padre, madre o apoderado")}</legend>
|
|
201
209
|
<Field label={storefrontTranslate("Nombre completo")} name="guardianName" maxLength={200} required className="sm:col-span-2" />
|
|
202
210
|
<Field label={storefrontTranslate("Dirección")} name="guardianAddress" maxLength={300} required className="sm:col-span-2" />
|
|
203
|
-
<
|
|
211
|
+
<div className="flex flex-col gap-2">
|
|
212
|
+
<Label htmlFor="complaint-guardianPhone">{storefrontTranslate("Celular")}</Label>
|
|
213
|
+
<PhoneField countryCode={storeCountry} initial="" name="guardianPhone" id="complaint-guardianPhone" required inputComponent={PhoneInputBox} />
|
|
214
|
+
</div>
|
|
204
215
|
<Field label={storefrontTranslate("Correo")} name="guardianEmail" type="email" maxLength={254} required />
|
|
205
216
|
</fieldset>
|
|
206
217
|
) : null}
|
|
@@ -317,7 +328,7 @@ export function ComplaintBook({ loaderData, actionData, ...root }: { loaderData:
|
|
|
317
328
|
) : (
|
|
318
329
|
<>
|
|
319
330
|
<Rows title={storefrontTranslate("Proveedor")} rows={providerRows(book)} />
|
|
320
|
-
<ComplaintForm countries={loaderData.countries} book={book} error={error} />
|
|
331
|
+
<ComplaintForm storeCountry={loaderData.countryCode} countries={loaderData.countries} book={book} error={error} />
|
|
321
332
|
</>
|
|
322
333
|
)}
|
|
323
334
|
</section>
|