@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,55 @@
|
|
|
1
|
+
// src/culqi-checkout.ts
|
|
2
|
+
const CULQI_TOKEN_METHODS = /* @__PURE__ */ new Map([["card", {
|
|
3
|
+
tarjeta: true,
|
|
4
|
+
yape: false,
|
|
5
|
+
billetera: false,
|
|
6
|
+
bancaMovil: false,
|
|
7
|
+
agente: false,
|
|
8
|
+
cuotealo: false
|
|
9
|
+
}], ["yape", {
|
|
10
|
+
tarjeta: false,
|
|
11
|
+
yape: true,
|
|
12
|
+
billetera: false,
|
|
13
|
+
bancaMovil: false,
|
|
14
|
+
agente: false,
|
|
15
|
+
cuotealo: false
|
|
16
|
+
}]]);
|
|
17
|
+
const CULQI_ORDER_METHODS = /* @__PURE__ */ new Map([["plin", {
|
|
18
|
+
tarjeta: false,
|
|
19
|
+
yape: false,
|
|
20
|
+
billetera: true,
|
|
21
|
+
bancaMovil: false,
|
|
22
|
+
agente: false,
|
|
23
|
+
cuotealo: false
|
|
24
|
+
}], ["pagoefectivo", {
|
|
25
|
+
tarjeta: false,
|
|
26
|
+
yape: false,
|
|
27
|
+
billetera: false,
|
|
28
|
+
bancaMovil: true,
|
|
29
|
+
agente: true,
|
|
30
|
+
cuotealo: false
|
|
31
|
+
}]]);
|
|
32
|
+
let loading;
|
|
33
|
+
function loadCulqiCheckout() {
|
|
34
|
+
if (window.CulqiCheckout) return Promise.resolve(window.CulqiCheckout);
|
|
35
|
+
if (loading) return loading;
|
|
36
|
+
loading = new Promise((resolve, reject) => {
|
|
37
|
+
const script = document.createElement("script");
|
|
38
|
+
script.src = "https://js.culqi.com/checkout-js";
|
|
39
|
+
script.async = true;
|
|
40
|
+
script.onload = () => {
|
|
41
|
+
if (window.CulqiCheckout) resolve(window.CulqiCheckout);
|
|
42
|
+
else reject(/* @__PURE__ */ new Error("No pudimos abrir el pago."));
|
|
43
|
+
};
|
|
44
|
+
script.onerror = () => {
|
|
45
|
+
script.remove();
|
|
46
|
+
reject(/* @__PURE__ */ new Error("No pudimos cargar el pago. Revisa tu conexión e intenta de nuevo."));
|
|
47
|
+
};
|
|
48
|
+
document.head.appendChild(script);
|
|
49
|
+
}).catch((error) => {
|
|
50
|
+
loading = void 0;
|
|
51
|
+
throw error;
|
|
52
|
+
});
|
|
53
|
+
return loading;
|
|
54
|
+
}
|
|
55
|
+
export { CULQI_ORDER_METHODS, CULQI_TOKEN_METHODS, loadCulqiCheckout };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// src/culqi-three-ds.ts
|
|
3
|
+
const CulqiPaymentSourceSchema = z.object({
|
|
4
|
+
token: z.string().min(1),
|
|
5
|
+
deviceSessionId: z.string().min(1)
|
|
6
|
+
});
|
|
7
|
+
let loading;
|
|
8
|
+
function loadCulqiThreeDS() {
|
|
9
|
+
if (window.Culqi3DS) return Promise.resolve(window.Culqi3DS);
|
|
10
|
+
if (loading) return loading;
|
|
11
|
+
loading = new Promise((resolve, reject) => {
|
|
12
|
+
const script = document.createElement("script");
|
|
13
|
+
script.src = "https://3ds.culqi.com";
|
|
14
|
+
script.async = true;
|
|
15
|
+
script.onload = () => {
|
|
16
|
+
if (window.Culqi3DS) resolve(window.Culqi3DS);
|
|
17
|
+
else reject(/* @__PURE__ */ new Error("No pudimos cargar la autenticación de tarjeta."));
|
|
18
|
+
};
|
|
19
|
+
script.onerror = () => {
|
|
20
|
+
script.remove();
|
|
21
|
+
reject(/* @__PURE__ */ new Error("No pudimos cargar la autenticación de tarjeta."));
|
|
22
|
+
};
|
|
23
|
+
document.head.appendChild(script);
|
|
24
|
+
}).catch((error) => {
|
|
25
|
+
loading = void 0;
|
|
26
|
+
throw error;
|
|
27
|
+
});
|
|
28
|
+
return loading;
|
|
29
|
+
}
|
|
30
|
+
function culqiSourceKey(transactionId) {
|
|
31
|
+
return `ecomiq:culqi:${transactionId}`;
|
|
32
|
+
}
|
|
33
|
+
export { CulqiPaymentSourceSchema, culqiSourceKey, loadCulqiThreeDS };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CulqiPaymentSourceSchema: z.ZodObject<{
|
|
3
|
+
token: z.ZodString;
|
|
4
|
+
deviceSessionId: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type CulqiPaymentSource = z.infer<typeof CulqiPaymentSourceSchema>;
|
|
7
|
+
type CulqiThreeDS = {
|
|
8
|
+
publicKey: string;
|
|
9
|
+
settings: {
|
|
10
|
+
charge: {
|
|
11
|
+
totalAmount: number;
|
|
12
|
+
currency: string;
|
|
13
|
+
returnUrl: string;
|
|
14
|
+
};
|
|
15
|
+
card: {
|
|
16
|
+
email: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
generateDevice: () => Promise<string | null>;
|
|
20
|
+
initAuthentication: (token: string) => void;
|
|
21
|
+
reset: () => void;
|
|
22
|
+
};
|
|
23
|
+
declare global {
|
|
24
|
+
interface Window {
|
|
25
|
+
Culqi3DS?: CulqiThreeDS;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export declare function culqiSourceKey(transactionId: string): string;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
// src/customer-avatar.tsx
|
|
3
|
+
/** The signed-in customer's initial, drawn in the header's text color. */
|
|
4
|
+
function CustomerAvatar({ name, className = "" }) {
|
|
5
|
+
const initial = name.trim().charAt(0).toLocaleUpperCase() || "?";
|
|
6
|
+
return /* @__PURE__ */ jsx("span", {
|
|
7
|
+
"aria-hidden": "true",
|
|
8
|
+
className: `inline-flex shrink-0 items-center justify-center rounded-full border-[1.5px] border-current font-semibold leading-none ${className}`,
|
|
9
|
+
children: initial
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { CustomerAvatar };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createCookie } from "react-router";
|
|
2
|
+
// src/customer-cookies.ts
|
|
3
|
+
const CUSTOMER_COOKIE = "__Host-ecomiq-customer";
|
|
4
|
+
const cookies = /* @__PURE__ */ new Map();
|
|
5
|
+
function customerCookies(env) {
|
|
6
|
+
const secret = env.SESSION_SECRET;
|
|
7
|
+
if (!secret) throw new Error("Falta SESSION_SECRET en el worker.");
|
|
8
|
+
let saved = cookies.get(secret);
|
|
9
|
+
if (!saved) {
|
|
10
|
+
const options = {
|
|
11
|
+
httpOnly: true,
|
|
12
|
+
sameSite: "lax",
|
|
13
|
+
secure: true,
|
|
14
|
+
path: "/",
|
|
15
|
+
secrets: [secret]
|
|
16
|
+
};
|
|
17
|
+
saved = {
|
|
18
|
+
session: createCookie(CUSTOMER_COOKIE, options),
|
|
19
|
+
transaction: createCookie("__Host-ecomiq-customer-login", {
|
|
20
|
+
...options,
|
|
21
|
+
maxAge: 600
|
|
22
|
+
})
|
|
23
|
+
};
|
|
24
|
+
cookies.set(secret, saved);
|
|
25
|
+
}
|
|
26
|
+
return saved;
|
|
27
|
+
}
|
|
28
|
+
async function customerSessionId(request, env) {
|
|
29
|
+
const value = await customerCookies(env).session.parse(request.headers.get("Cookie"));
|
|
30
|
+
return typeof value === "string" && value.length > 0 && value.length <= 256 ? value : null;
|
|
31
|
+
}
|
|
32
|
+
function base64Url(bytes) {
|
|
33
|
+
return btoa(String.fromCharCode(...bytes)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
34
|
+
}
|
|
35
|
+
function base64UrlBytes(value) {
|
|
36
|
+
const base64 = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
37
|
+
return Uint8Array.from(atob(base64 + "=".repeat((4 - base64.length % 4) % 4)), (character) => character.charCodeAt(0));
|
|
38
|
+
}
|
|
39
|
+
function equalSecret(left, right) {
|
|
40
|
+
if (left.length !== right.length) return false;
|
|
41
|
+
let difference = 0;
|
|
42
|
+
for (let index = 0; index < left.length; index += 1) difference |= left.charCodeAt(index) ^ right.charCodeAt(index);
|
|
43
|
+
return difference === 0;
|
|
44
|
+
}
|
|
45
|
+
export { CUSTOMER_COOKIE, base64Url, base64UrlBytes, customerCookies, customerSessionId, equalSecret };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useRouteLoaderData } from "react-router";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/customer-csrf.tsx
|
|
4
|
+
/** Reads the public antiforgery token supplied by the root loader. */
|
|
5
|
+
function useCustomerCsrfToken() {
|
|
6
|
+
return useRouteLoaderData("root")?.customerCsrfToken ?? "";
|
|
7
|
+
}
|
|
8
|
+
function CustomerCsrfField() {
|
|
9
|
+
const token = useCustomerCsrfToken();
|
|
10
|
+
if (!token) return null;
|
|
11
|
+
return /* @__PURE__ */ jsx("input", {
|
|
12
|
+
type: "hidden",
|
|
13
|
+
name: "__customer_csrf",
|
|
14
|
+
value: token
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { CustomerCsrfField, useCustomerCsrfToken };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { IDENTITY_DOCUMENT_TYPES, identityDocumentRule, isIdentityDocumentType } from "./documents-T1mzc_j8.js";
|
|
2
|
+
import { useStorefrontText } from "./storefront-language-DrMjVbmk.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/customer-document-fields.tsx
|
|
6
|
+
function CustomerDocumentFields({ customer, countries }) {
|
|
7
|
+
const t = useStorefrontText();
|
|
8
|
+
const [country, setCountry] = useState(customer.identificationCountryCode ?? "");
|
|
9
|
+
const initialType = customer.identificationType;
|
|
10
|
+
const [type, setType] = useState(isIdentityDocumentType(initialType) ? initialType : "NationalId");
|
|
11
|
+
const [number, setNumber] = useState(customer.identificationNumber ?? "");
|
|
12
|
+
const documentType = type;
|
|
13
|
+
const rule = identityDocumentRule(documentType);
|
|
14
|
+
const required = number !== "" || (customer.entityIdentificationNumber ?? "") !== "";
|
|
15
|
+
const inputClass = "h-11 w-full rounded-md border border-input bg-background px-3 text-base font-normal md:text-sm";
|
|
16
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
17
|
+
className: "grid gap-4 sm:grid-cols-2",
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx("legend", {
|
|
20
|
+
className: "mb-4 font-heading text-lg",
|
|
21
|
+
children: t("Documento de identidad")
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ jsxs("label", {
|
|
24
|
+
className: "grid gap-1.5 text-sm font-medium",
|
|
25
|
+
children: [t("País emisor del documento"), /* @__PURE__ */ jsxs("select", {
|
|
26
|
+
name: "identificationCountryCode",
|
|
27
|
+
value: country,
|
|
28
|
+
required,
|
|
29
|
+
className: inputClass,
|
|
30
|
+
onChange: (event) => setCountry(event.target.value),
|
|
31
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
32
|
+
value: "",
|
|
33
|
+
children: t("Selecciona un país")
|
|
34
|
+
}), countries.map((item) => /* @__PURE__ */ jsx("option", {
|
|
35
|
+
value: item.code,
|
|
36
|
+
children: item.name
|
|
37
|
+
}, item.code))]
|
|
38
|
+
})]
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ jsxs("label", {
|
|
41
|
+
className: "grid gap-1.5 text-sm font-medium",
|
|
42
|
+
children: [t("Tipo de documento"), /* @__PURE__ */ jsx("select", {
|
|
43
|
+
name: "identificationType",
|
|
44
|
+
value: documentType,
|
|
45
|
+
className: inputClass,
|
|
46
|
+
onChange: (event) => {
|
|
47
|
+
if (isIdentityDocumentType(event.target.value)) setType(event.target.value);
|
|
48
|
+
},
|
|
49
|
+
children: IDENTITY_DOCUMENT_TYPES.map((item) => /* @__PURE__ */ jsx("option", {
|
|
50
|
+
value: item,
|
|
51
|
+
children: t(identityDocumentRule(item).label)
|
|
52
|
+
}, item))
|
|
53
|
+
})]
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ jsxs("label", {
|
|
56
|
+
className: "grid gap-1.5 text-sm font-medium sm:col-span-2",
|
|
57
|
+
children: [t("Número de documento"), /* @__PURE__ */ jsx("input", {
|
|
58
|
+
name: "document",
|
|
59
|
+
value: number,
|
|
60
|
+
inputMode: rule.inputMode,
|
|
61
|
+
pattern: rule.pattern,
|
|
62
|
+
maxLength: rule.maxLength,
|
|
63
|
+
className: inputClass,
|
|
64
|
+
onChange: (event) => setNumber(event.target.value)
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export { CustomerDocumentFields };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CustomerMe } from "@ecomiq/core";
|
|
2
|
+
export type CustomerDocumentFieldsProps = {
|
|
3
|
+
customer: Pick<CustomerMe, "identificationType" | "identificationNumber" | "identificationCountryCode" | "entityIdentificationNumber">;
|
|
4
|
+
countries: {
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
export declare function CustomerDocumentFields({ customer, countries }: CustomerDocumentFieldsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { useStorefrontText } from "./storefront-language-DrMjVbmk.js";
|
|
2
|
+
import { Captcha } from "./captcha-DAqaIx8m.js";
|
|
3
|
+
import { Form, useNavigation } from "react-router";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/customer-login-form.tsx
|
|
7
|
+
/** The theme owns the surrounding page and styling; the SDK owns the shared form flow. */
|
|
8
|
+
function CustomerLoginForm({ data, classNames: styles }) {
|
|
9
|
+
const storefrontTranslate = useStorefrontText();
|
|
10
|
+
const busy = useNavigation().state !== "idle";
|
|
11
|
+
const [resending, setResending] = useState(false);
|
|
12
|
+
const [remaining, setRemaining] = useState(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setResending(false);
|
|
15
|
+
const updateRemaining = () => setRemaining(Math.max(0, Math.ceil((data.retryAt - Date.now()) / 1e3)));
|
|
16
|
+
updateRemaining();
|
|
17
|
+
if (data.retryAt <= Date.now()) return;
|
|
18
|
+
const timer = setInterval(updateRemaining, 1e3);
|
|
19
|
+
return () => clearInterval(timer);
|
|
20
|
+
}, [data.retryAt, data.step]);
|
|
21
|
+
const send = data.step === "email" || resending;
|
|
22
|
+
let button = storefrontTranslate("Enviar código");
|
|
23
|
+
if (!send) button = storefrontTranslate("Ingresar");
|
|
24
|
+
if (resending) button = storefrontTranslate("Reenviar código");
|
|
25
|
+
if (busy) button = storefrontTranslate("Espera un momento…");
|
|
26
|
+
let intent = "verify";
|
|
27
|
+
if (send) intent = "send";
|
|
28
|
+
if (resending) intent = "resend";
|
|
29
|
+
let resendLabel = storefrontTranslate("Solicitar otro código");
|
|
30
|
+
if (remaining !== null && remaining > 0) resendLabel = `${storefrontTranslate("Reenviar código en")} ${remaining}s`;
|
|
31
|
+
return /* @__PURE__ */ jsxs(Form, {
|
|
32
|
+
method: "post",
|
|
33
|
+
className: styles.form,
|
|
34
|
+
children: [
|
|
35
|
+
data.step !== "email" ? /* @__PURE__ */ jsxs("p", {
|
|
36
|
+
className: styles.hint,
|
|
37
|
+
children: [
|
|
38
|
+
storefrontTranslate("Enviamos un código a"),
|
|
39
|
+
" ",
|
|
40
|
+
/* @__PURE__ */ jsx("strong", { children: data.email }),
|
|
41
|
+
"."
|
|
42
|
+
]
|
|
43
|
+
}) : null,
|
|
44
|
+
data.step === "email" ? /* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: styles.field,
|
|
46
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
47
|
+
className: styles.label,
|
|
48
|
+
htmlFor: "customer-email",
|
|
49
|
+
children: storefrontTranslate("Correo electrónico")
|
|
50
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
51
|
+
className: styles.input,
|
|
52
|
+
id: "customer-email",
|
|
53
|
+
name: "email",
|
|
54
|
+
type: "email",
|
|
55
|
+
autoComplete: "email",
|
|
56
|
+
autoFocus: true,
|
|
57
|
+
required: true,
|
|
58
|
+
maxLength: 254,
|
|
59
|
+
defaultValue: data.email,
|
|
60
|
+
placeholder: storefrontTranslate("tu@correo.com")
|
|
61
|
+
})]
|
|
62
|
+
}) : null,
|
|
63
|
+
!send && data.step === "code" ? /* @__PURE__ */ jsxs("div", {
|
|
64
|
+
className: styles.field,
|
|
65
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
66
|
+
className: styles.label,
|
|
67
|
+
htmlFor: "customer-code",
|
|
68
|
+
children: storefrontTranslate("Código de verificación")
|
|
69
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
70
|
+
className: styles.input,
|
|
71
|
+
id: "customer-code",
|
|
72
|
+
name: "code",
|
|
73
|
+
type: "text",
|
|
74
|
+
inputMode: "numeric",
|
|
75
|
+
pattern: "[0-9]{6}",
|
|
76
|
+
autoComplete: "one-time-code",
|
|
77
|
+
autoFocus: true,
|
|
78
|
+
required: true,
|
|
79
|
+
minLength: 6,
|
|
80
|
+
maxLength: 6,
|
|
81
|
+
placeholder: "000000"
|
|
82
|
+
})]
|
|
83
|
+
}) : null,
|
|
84
|
+
!send && data.step === "secondFactor" ? /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
className: styles.field,
|
|
86
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
87
|
+
className: styles.label,
|
|
88
|
+
htmlFor: "customer-second-factor",
|
|
89
|
+
children: storefrontTranslate("Código de autenticación o recuperación")
|
|
90
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
91
|
+
className: styles.input,
|
|
92
|
+
id: "customer-second-factor",
|
|
93
|
+
name: "secondFactor",
|
|
94
|
+
type: "text",
|
|
95
|
+
autoComplete: "one-time-code",
|
|
96
|
+
autoFocus: true,
|
|
97
|
+
required: true,
|
|
98
|
+
placeholder: storefrontTranslate("Código de tu aplicación o recuperación")
|
|
99
|
+
})]
|
|
100
|
+
}) : null,
|
|
101
|
+
send ? /* @__PURE__ */ jsx(Captcha, {
|
|
102
|
+
captcha: data.captcha,
|
|
103
|
+
action: "customer_login_code",
|
|
104
|
+
errorClass: styles.error,
|
|
105
|
+
busy
|
|
106
|
+
}, data.retryAt) : null,
|
|
107
|
+
data.error ? /* @__PURE__ */ jsx("p", {
|
|
108
|
+
role: "alert",
|
|
109
|
+
className: styles.error,
|
|
110
|
+
children: storefrontTranslate(data.error)
|
|
111
|
+
}) : null,
|
|
112
|
+
/* @__PURE__ */ jsx("button", {
|
|
113
|
+
className: styles.button,
|
|
114
|
+
type: "submit",
|
|
115
|
+
name: "intent",
|
|
116
|
+
value: intent,
|
|
117
|
+
disabled: busy || send && !data.captcha.isConfigured,
|
|
118
|
+
children: button
|
|
119
|
+
}),
|
|
120
|
+
data.step !== "email" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [resending ? /* @__PURE__ */ jsx("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
className: styles.secondary,
|
|
123
|
+
disabled: busy,
|
|
124
|
+
onClick: () => setResending(false),
|
|
125
|
+
children: storefrontTranslate("Ya tengo un código")
|
|
126
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
className: styles.secondary,
|
|
129
|
+
disabled: busy || remaining === null || remaining > 0,
|
|
130
|
+
onClick: () => setResending(true),
|
|
131
|
+
children: resendLabel
|
|
132
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
133
|
+
className: styles.secondary,
|
|
134
|
+
type: "submit",
|
|
135
|
+
name: "intent",
|
|
136
|
+
value: "reset",
|
|
137
|
+
formNoValidate: true,
|
|
138
|
+
disabled: busy,
|
|
139
|
+
children: storefrontTranslate("Usar otro correo")
|
|
140
|
+
})] }) : null
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
export { CustomerLoginForm };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CustomerLoginData } from "./session.js";
|
|
2
|
+
export type CustomerLoginFormProps = {
|
|
3
|
+
data: CustomerLoginData;
|
|
4
|
+
/** Classes belong to the theme, so controls follow its own design tokens. */
|
|
5
|
+
classNames: {
|
|
6
|
+
form: string;
|
|
7
|
+
field: string;
|
|
8
|
+
label: string;
|
|
9
|
+
input: string;
|
|
10
|
+
button: string;
|
|
11
|
+
secondary: string;
|
|
12
|
+
error: string;
|
|
13
|
+
hint: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/** The theme owns the surrounding page and styling; the SDK owns the shared form flow. */
|
|
17
|
+
export declare function CustomerLoginForm({ data, classNames: styles }: CustomerLoginFormProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useStorefrontText } from "./storefront-language-DrMjVbmk.js";
|
|
2
|
+
import { CustomerCsrfField } from "./customer-csrf-C1oDX-Py.js";
|
|
3
|
+
import { Form, useNavigation } from "react-router";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/customer-registration-form.tsx
|
|
6
|
+
const FIELDS = [
|
|
7
|
+
{
|
|
8
|
+
name: "firstName",
|
|
9
|
+
label: "Nombre",
|
|
10
|
+
type: "text",
|
|
11
|
+
autoComplete: "given-name",
|
|
12
|
+
maxLength: 100
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "lastName",
|
|
16
|
+
label: "Apellido",
|
|
17
|
+
type: "text",
|
|
18
|
+
autoComplete: "family-name",
|
|
19
|
+
maxLength: 100
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "phone",
|
|
23
|
+
label: "Teléfono",
|
|
24
|
+
type: "tel",
|
|
25
|
+
autoComplete: "tel",
|
|
26
|
+
maxLength: 20
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "dateOfBirth",
|
|
30
|
+
label: "Fecha de nacimiento",
|
|
31
|
+
type: "date",
|
|
32
|
+
autoComplete: "bday"
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
function CustomerRegistrationForm({ data, classNames }) {
|
|
36
|
+
const storefrontTranslate = useStorefrontText();
|
|
37
|
+
const busy = useNavigation().state !== "idle";
|
|
38
|
+
const { registration } = data;
|
|
39
|
+
const canSkip = Object.values(registration.fields).every((mode) => mode !== "required");
|
|
40
|
+
return /* @__PURE__ */ jsxs(Form, {
|
|
41
|
+
method: "post",
|
|
42
|
+
action: `/account/register?next=${encodeURIComponent(data.next)}`,
|
|
43
|
+
className: classNames.form,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx(CustomerCsrfField, {}),
|
|
46
|
+
data.error ? /* @__PURE__ */ jsx("p", {
|
|
47
|
+
role: "alert",
|
|
48
|
+
className: classNames.error,
|
|
49
|
+
children: storefrontTranslate(data.error)
|
|
50
|
+
}) : null,
|
|
51
|
+
FIELDS.map((field) => {
|
|
52
|
+
const mode = registration.fields[field.name];
|
|
53
|
+
if (mode === "hidden") return null;
|
|
54
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: classNames.field,
|
|
56
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
57
|
+
htmlFor: `registration-${field.name}`,
|
|
58
|
+
className: storefrontTranslate(classNames.label),
|
|
59
|
+
children: [storefrontTranslate(field.label), mode === "optional" ? ` (${storefrontTranslate("opcional")})` : ""]
|
|
60
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
61
|
+
id: `registration-${field.name}`,
|
|
62
|
+
name: field.name,
|
|
63
|
+
type: field.type,
|
|
64
|
+
autoComplete: field.autoComplete,
|
|
65
|
+
defaultValue: registration[field.name] ?? "",
|
|
66
|
+
required: mode === "required",
|
|
67
|
+
maxLength: field.maxLength,
|
|
68
|
+
max: field.type === "date" ? data.today : void 0,
|
|
69
|
+
className: classNames.input
|
|
70
|
+
})]
|
|
71
|
+
}, field.name);
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsx("button", {
|
|
74
|
+
type: "submit",
|
|
75
|
+
name: "intent",
|
|
76
|
+
value: "complete",
|
|
77
|
+
disabled: busy,
|
|
78
|
+
className: classNames.button,
|
|
79
|
+
children: busy ? storefrontTranslate("Guardando…") : storefrontTranslate("Continuar")
|
|
80
|
+
}),
|
|
81
|
+
canSkip ? /* @__PURE__ */ jsx("button", {
|
|
82
|
+
type: "submit",
|
|
83
|
+
name: "intent",
|
|
84
|
+
value: "skip",
|
|
85
|
+
formNoValidate: true,
|
|
86
|
+
disabled: busy,
|
|
87
|
+
className: classNames.secondary,
|
|
88
|
+
children: storefrontTranslate("Omitir por ahora")
|
|
89
|
+
}) : null
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export { CustomerRegistrationForm };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomerLoginFormProps } from "./customer-login-form.js";
|
|
2
|
+
import { CustomerRegistrationData } from "./registration.js";
|
|
3
|
+
export type CustomerRegistrationFormProps = {
|
|
4
|
+
data: CustomerRegistrationData;
|
|
5
|
+
/** The theme owns layout, spacing, colors and controls through its classes. */
|
|
6
|
+
classNames: CustomerLoginFormProps["classNames"];
|
|
7
|
+
};
|
|
8
|
+
export declare function CustomerRegistrationForm({ data, classNames }: CustomerRegistrationFormProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/document-url.ts
|
|
2
|
+
function documentUrl(value) {
|
|
3
|
+
const url = new URL(value);
|
|
4
|
+
if (url.pathname.endsWith("/_.data")) url.pathname = url.pathname.replace(/_\.data$/, "");
|
|
5
|
+
else url.pathname = url.pathname.replace(/\.data$/, "");
|
|
6
|
+
if (url.searchParams.has("_routes")) url.searchParams.delete("_routes");
|
|
7
|
+
return url;
|
|
8
|
+
}
|
|
9
|
+
export { documentUrl };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/documents.ts
|
|
2
|
+
const IDENTITY_DOCUMENT_TYPES = [
|
|
3
|
+
"NationalId",
|
|
4
|
+
"TaxId",
|
|
5
|
+
"ForeignId",
|
|
6
|
+
"Passport"
|
|
7
|
+
];
|
|
8
|
+
function isIdentityDocumentType(value) {
|
|
9
|
+
return value === "NationalId" || value === "TaxId" || value === "ForeignId" || value === "Passport";
|
|
10
|
+
}
|
|
11
|
+
const IDENTITY_DOCUMENT_LABELS = {
|
|
12
|
+
NationalId: "Documento nacional",
|
|
13
|
+
TaxId: "Identificación fiscal",
|
|
14
|
+
ForeignId: "Documento de extranjería",
|
|
15
|
+
Passport: "Pasaporte"
|
|
16
|
+
};
|
|
17
|
+
function identityDocumentRule(type) {
|
|
18
|
+
return {
|
|
19
|
+
label: IDENTITY_DOCUMENT_LABELS[type],
|
|
20
|
+
pattern: "[^\\u0000-\\u001f\\u007f-\\u009f]{1,50}",
|
|
21
|
+
maxLength: 50,
|
|
22
|
+
inputMode: "text",
|
|
23
|
+
error: "Revisa el número de documento."
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function identityDocumentError(type, countryCode, value) {
|
|
27
|
+
if (value === "") return null;
|
|
28
|
+
if (!/^[A-Z]{2}$/.test(countryCode)) return "Elige el país emisor del documento.";
|
|
29
|
+
if (value.trim() === "" || value.length > 50 || /[\u0000-\u001f\u007f-\u009f]/.test(value)) return identityDocumentRule(type).error;
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const COMPLAINT_DOCUMENT_TYPES = {
|
|
33
|
+
nationalId: "NationalId",
|
|
34
|
+
taxId: "TaxId",
|
|
35
|
+
foreignId: "ForeignId",
|
|
36
|
+
passport: "Passport"
|
|
37
|
+
};
|
|
38
|
+
export { COMPLAINT_DOCUMENT_TYPES, IDENTITY_DOCUMENT_TYPES, identityDocumentError, identityDocumentRule, isIdentityDocumentType };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type DocumentRule = {
|
|
2
|
+
label: string;
|
|
3
|
+
pattern: string;
|
|
4
|
+
maxLength: number;
|
|
5
|
+
inputMode: "text";
|
|
6
|
+
error: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const IDENTITY_DOCUMENT_TYPES: readonly ["NationalId", "TaxId", "ForeignId", "Passport"];
|
|
9
|
+
export type IdentityDocumentType = (typeof IDENTITY_DOCUMENT_TYPES)[number];
|
|
10
|
+
export declare function identityDocumentRule(type: IdentityDocumentType): DocumentRule;
|
|
11
|
+
export declare const COMPLAINT_DOCUMENT_TYPES: {
|
|
12
|
+
readonly nationalId: "NationalId";
|
|
13
|
+
readonly taxId: "TaxId";
|
|
14
|
+
readonly foreignId: "ForeignId";
|
|
15
|
+
readonly passport: "Passport";
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AddressActionData, OrderFilters, OrderRequestActionData, OrdersData, ProfileActionData, addressAction, loadAccount, loadAddresses, loadOrder, loadOrders, loadProfile, orderFiltersQuery, orderRequestAction, profileAction, readOrderFilters } from "../account.js";
|
|
2
|
+
import { mainPayment, orderStepLabel, orderStepOf, paymentLabel, paymentStatusLabel } from "../order-view.js";
|
|
3
|
+
import { MoreOrders, useOrderPages } from "../order-pages.js";
|
|
4
|
+
import { PayButton, PaymentPreview, ReorderButton, useOrderHeadline, useOrderStepDetail } from "../order-display.js";
|
|
5
|
+
import { AddressForm, AddressFormProps, ProfileForm, ProfileFormProps } from "../account-forms.js";
|
|
6
|
+
import { AddressDefaults, addressDefaults } from "../address-defaults.js";
|
|
7
|
+
import { placeValue, useGeoCascade } from "../catalog-hooks.js";
|
|
8
|
+
import { SummaryLabels, SummaryLine, SummaryOrder, orderSummaryLines } from "../cart-summary.js";
|
|
9
|
+
import { AddressIntent } from "../form-contracts.js";
|
|
10
|
+
import { CustomerDocumentFields, CustomerDocumentFieldsProps } from "../customer-document-fields.js";
|
|
11
|
+
export { type AddressActionData, type AddressDefaults, AddressForm, type AddressFormProps, type AddressIntent, CustomerDocumentFields, type CustomerDocumentFieldsProps, type MoreOrders, type OrderFilters, type OrderRequestActionData, type OrdersData, PayButton, PaymentPreview, type ProfileActionData, ProfileForm, type ProfileFormProps, ReorderButton, type SummaryLabels, type SummaryLine, type SummaryOrder, addressAction, addressDefaults, loadAccount, loadAddresses, loadOrder, loadOrders, loadProfile, mainPayment, orderFiltersQuery, orderRequestAction, orderStepLabel, orderStepOf, orderSummaryLines, paymentLabel, paymentStatusLabel, placeValue, profileAction, readOrderFilters, useGeoCascade, useOrderHeadline, useOrderPages, useOrderStepDetail };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { addressAction, loadAccount, loadAddresses, loadOrder, loadOrders, loadProfile, orderFiltersQuery, orderRequestAction, profileAction, readOrderFilters } from "../account-Dx4e3syi.js";
|
|
2
|
+
import { mainPayment, orderStepLabel, orderStepOf, paymentLabel, paymentStatusLabel } from "../order-view-9IlBg5AF.js";
|
|
3
|
+
import { useOrderPages } from "../order-pages-Dm6l5m0m.js";
|
|
4
|
+
import { PayButton, PaymentPreview, ReorderButton, useOrderHeadline, useOrderStepDetail } from "../order-display-DTt5WBbc.js";
|
|
5
|
+
import { AddressForm, ProfileForm } from "../account-forms-AVk71ko7.js";
|
|
6
|
+
import { addressDefaults } from "../address-defaults-BqjRhS82.js";
|
|
7
|
+
import { placeValue, useGeoCascade } from "../catalog-hooks-B7ZP4wYY.js";
|
|
8
|
+
import { orderSummaryLines } from "../cart-summary-ur2VWKr-.js";
|
|
9
|
+
import { CustomerDocumentFields } from "../customer-document-fields-C1K-_DAD.js";
|
|
10
|
+
export { AddressForm, CustomerDocumentFields, PayButton, PaymentPreview, ProfileForm, ReorderButton, addressAction, addressDefaults, loadAccount, loadAddresses, loadOrder, loadOrders, loadProfile, mainPayment, orderFiltersQuery, orderRequestAction, orderStepLabel, orderStepOf, orderSummaryLines, paymentLabel, paymentStatusLabel, placeValue, profileAction, readOrderFilters, useGeoCascade, useOrderHeadline, useOrderPages, useOrderStepDetail };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Analytics } from "../analytics/analytics.js";
|
|
2
|
+
import { AnalyticsConfig, readAnalytics } from "../analytics/config.js";
|
|
3
|
+
import { ConsentBanner, ConsentBannerProps, ConsentLink, ConsentLinkProps } from "../analytics/consent-banner.js";
|
|
4
|
+
import { Consent } from "../analytics/cookies.js";
|
|
5
|
+
import { PageAnalytics, catalogAnalytics } from "../analytics/events.js";
|
|
6
|
+
export { Analytics, type AnalyticsConfig, type Consent, ConsentBanner, type ConsentBannerProps, ConsentLink, type ConsentLinkProps, type PageAnalytics, catalogAnalytics, readAnalytics };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Analytics } from "../analytics/analytics-CG1Qagwl.js";
|
|
2
|
+
import { readAnalytics } from "../analytics/config-DJr-GRhs.js";
|
|
3
|
+
import { ConsentBanner, ConsentLink } from "../analytics/consent-banner-9QvRRy8v.js";
|
|
4
|
+
import { catalogAnalytics } from "../analytics/events-Dt81tIp1.js";
|
|
5
|
+
export { Analytics, ConsentBanner, ConsentLink, catalogAnalytics, readAnalytics };
|