@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
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { House, RefreshCw, TriangleAlert } from 'lucide-react'
|
|
2
|
-
import { Button, buttonVariants } from './button'
|
|
3
|
-
|
|
4
|
-
export interface StorefrontErrorProps {
|
|
5
|
-
title?: string
|
|
6
|
-
description?: string
|
|
7
|
-
onRetry?: () => void
|
|
8
|
-
returnTo?: string
|
|
9
|
-
returnLabel?: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function StorefrontError({
|
|
13
|
-
title = 'No pudimos cargar esta página',
|
|
14
|
-
description = 'La tienda no respondió como esperábamos. Inténtalo nuevamente en unos segundos.',
|
|
15
|
-
onRetry,
|
|
16
|
-
returnTo = '/',
|
|
17
|
-
returnLabel = 'Volver al inicio',
|
|
18
|
-
}: StorefrontErrorProps) {
|
|
19
|
-
return (
|
|
20
|
-
<section className="mx-auto flex min-h-[55vh] w-full max-w-6xl items-center px-4 py-16" role="alert">
|
|
21
|
-
<div className="w-full max-w-xl border-l-2 border-primary pl-5 sm:pl-7">
|
|
22
|
-
<div className="mb-5 flex size-11 items-center justify-center rounded-lg bg-muted text-muted-foreground">
|
|
23
|
-
<TriangleAlert className="size-5" aria-hidden="true" />
|
|
24
|
-
</div>
|
|
25
|
-
<p className="mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground">
|
|
26
|
-
Interrupción temporal
|
|
27
|
-
</p>
|
|
28
|
-
<h1 className="text-balance text-2xl font-semibold tracking-[-0.02em] sm:text-3xl">
|
|
29
|
-
{title}
|
|
30
|
-
</h1>
|
|
31
|
-
<p className="mt-3 max-w-md text-sm leading-6 text-muted-foreground">
|
|
32
|
-
{description}
|
|
33
|
-
</p>
|
|
34
|
-
<div className="mt-6 flex flex-wrap gap-2">
|
|
35
|
-
{onRetry ? (
|
|
36
|
-
<Button onClick={onRetry} className="min-h-10">
|
|
37
|
-
<RefreshCw aria-hidden="true" />
|
|
38
|
-
Intentar otra vez
|
|
39
|
-
</Button>
|
|
40
|
-
) : null}
|
|
41
|
-
<a href={returnTo} className={buttonVariants({ variant: 'outline' })}>
|
|
42
|
-
<House aria-hidden="true" />
|
|
43
|
-
{returnLabel}
|
|
44
|
-
</a>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</section>
|
|
48
|
-
)
|
|
49
|
-
}
|
package/src/utils.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { StorefrontSettings } from "@ecomiq/core";
|
|
2
|
-
|
|
3
|
-
type StorefrontCmsPage = StorefrontSettings['cms']['pages'][number]
|
|
4
|
-
|
|
5
|
-
function isRenderableCmsPage(p: StorefrontCmsPage): boolean {
|
|
6
|
-
return p.status === "published";
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function findStorefrontCmsPageBySlug(
|
|
10
|
-
settings: StorefrontSettings | null | undefined,
|
|
11
|
-
slug: string
|
|
12
|
-
) {
|
|
13
|
-
const pages = settings?.cms?.pages;
|
|
14
|
-
if (!pages?.length) return null;
|
|
15
|
-
const raw = pages.find(
|
|
16
|
-
(p) => p.slug === slug && isRenderableCmsPage(p)
|
|
17
|
-
);
|
|
18
|
-
if (!raw) return null;
|
|
19
|
-
return raw;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function cmsBranding(settings: StorefrontSettings | null | undefined) {
|
|
23
|
-
return settings?.cms?.settings?.branding;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function cmsSeo(settings: StorefrontSettings | null | undefined) {
|
|
27
|
-
return settings?.cms?.settings?.seo;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function storeDisplayName(settings: StorefrontSettings | null | undefined) {
|
|
31
|
-
return settings?.store?.name ?? cmsSeo(settings)?.siteName;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function storeSeoDescription(settings: StorefrontSettings | null | undefined) {
|
|
35
|
-
return cmsSeo(settings)?.metaDescription ?? settings?.store?.description;
|
|
36
|
-
}
|
package/src/vite-inline.mjs
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config interna de Vite, construida en memoria por la CLI.
|
|
3
|
-
* No existe vite.config.ts en el proyecto del usuario ni en .ecomiq:
|
|
4
|
-
* los plugins se importan aquí (contexto del framework) y se pasan como
|
|
5
|
-
* instancias, así la resolución de módulos nunca depende del proyecto.
|
|
6
|
-
*
|
|
7
|
-
* Alineado con el ejemplo oficial TanStack Start + Cloudflare:
|
|
8
|
-
* https://github.com/TanStack/router/tree/main/examples/react/start-basic-cloudflare
|
|
9
|
-
*/
|
|
10
|
-
import { readFileSync } from 'node:fs'
|
|
11
|
-
import { dirname, isAbsolute, resolve } from 'node:path'
|
|
12
|
-
import { fileURLToPath } from 'node:url'
|
|
13
|
-
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
|
|
14
|
-
import viteReact from '@vitejs/plugin-react'
|
|
15
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
16
|
-
import { cloudflare } from '@cloudflare/vite-plugin'
|
|
17
|
-
import basicSsl from '@vitejs/plugin-basic-ssl'
|
|
18
|
-
|
|
19
|
-
const postcssBrowserStub = fileURLToPath(
|
|
20
|
-
new URL('./runtime/postcss-browser-stub.mjs', import.meta.url),
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
const frameworkRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
24
|
-
const designBridgePath = resolve(frameworkRoot, 'public', 'design-bridge.js')
|
|
25
|
-
|
|
26
|
-
/** Sirve /design-bridge.js desde el package (no desde public/ del usuario). */
|
|
27
|
-
function designBridgePlugin() {
|
|
28
|
-
return {
|
|
29
|
-
name: 'ecomiq:design-bridge',
|
|
30
|
-
configureServer(server) {
|
|
31
|
-
server.middlewares.use((req, res, next) => {
|
|
32
|
-
const url = req.url?.split('?')[0]
|
|
33
|
-
if (url !== '/design-bridge.js') return next()
|
|
34
|
-
try {
|
|
35
|
-
const body = readFileSync(designBridgePath)
|
|
36
|
-
res.setHeader('Content-Type', 'application/javascript; charset=utf-8')
|
|
37
|
-
res.setHeader('Cache-Control', 'no-store')
|
|
38
|
-
res.end(body)
|
|
39
|
-
} catch (error) {
|
|
40
|
-
next(error)
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
},
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function resolveSanitizeHtmlPostcss(source, importer) {
|
|
47
|
-
if (source !== 'postcss') return null
|
|
48
|
-
if (!importer?.includes('/sanitize-html/')) return null
|
|
49
|
-
return postcssBrowserStub
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function sanitizeHtmlClientBoundary() {
|
|
53
|
-
return {
|
|
54
|
-
name: 'ecomiq:sanitize-html-client-boundary',
|
|
55
|
-
enforce: 'pre',
|
|
56
|
-
applyToEnvironment(environment) {
|
|
57
|
-
return environment.name === 'client'
|
|
58
|
-
},
|
|
59
|
-
configEnvironment(name, config) {
|
|
60
|
-
if (name !== 'client') return
|
|
61
|
-
const rolldownOptions = config.optimizeDeps?.rolldownOptions ?? {}
|
|
62
|
-
return {
|
|
63
|
-
optimizeDeps: {
|
|
64
|
-
rolldownOptions: {
|
|
65
|
-
...rolldownOptions,
|
|
66
|
-
plugins: [
|
|
67
|
-
...(rolldownOptions.plugins ?? []),
|
|
68
|
-
{
|
|
69
|
-
name: 'ecomiq:sanitize-html-optimizer-boundary',
|
|
70
|
-
resolveId: resolveSanitizeHtmlPostcss,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
resolveId: resolveSanitizeHtmlPostcss,
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* TanStack Start marca `@tanstack/react-router` como `resolve.external` fuera de
|
|
83
|
-
* su monorepo. Cloudflare Vite plugin no lo tolera y workerd acaba ejecutando
|
|
84
|
-
* CJS con `require` → "require is not defined".
|
|
85
|
-
*
|
|
86
|
-
* Solo aplica en runtime `workerd`. En `node`, React y otras deps CJS deben
|
|
87
|
-
* quedar external: `noExternal` las pasa por el module runner ESM de Vite y
|
|
88
|
-
* falla con "module is not defined".
|
|
89
|
-
* @see https://github.com/TanStack/router/issues/5291
|
|
90
|
-
*/
|
|
91
|
-
function bundleSsrDependenciesForWorkerd() {
|
|
92
|
-
return {
|
|
93
|
-
name: 'ecomiq:ssr-no-external',
|
|
94
|
-
configEnvironment(name) {
|
|
95
|
-
if (name !== 'ssr') return
|
|
96
|
-
return {
|
|
97
|
-
resolve: {
|
|
98
|
-
external: [],
|
|
99
|
-
noExternal: true,
|
|
100
|
-
},
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
configResolved(config) {
|
|
104
|
-
const ssr = config.environments?.ssr
|
|
105
|
-
if (ssr?.resolve) {
|
|
106
|
-
ssr.resolve.external = []
|
|
107
|
-
ssr.resolve.noExternal = true
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @param {{ appDir: string, config?: object, projectRoot?: string, runtime?: 'workerd' | 'node' }} opts
|
|
115
|
-
*/
|
|
116
|
-
export function resolveDevRuntime({ config, runtime } = {}) {
|
|
117
|
-
// Default: Node (compatible con npm/CodeSandbox). Opt-in a workerd con
|
|
118
|
-
// `dev.runtime: 'workerd'` (p. ej. monorepo local). build/deploy siempre
|
|
119
|
-
// fuerza workerd desde la CLI.
|
|
120
|
-
return runtime ?? config?.dev?.runtime ?? 'node'
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* HTTPS en `ecomiq dev` (localhost).
|
|
125
|
-
* - `dev.https: true` → certificado auto (plugin-basic-ssl)
|
|
126
|
-
* - `dev.https: { cert, key }` → PEM propios (paths relativos al project root)
|
|
127
|
-
*
|
|
128
|
-
* @param {{ config?: object, projectRoot?: string, appDir?: string }} opts
|
|
129
|
-
* @returns {{ enabled: boolean, plugin?: object, https?: import('node:https').ServerOptions }}
|
|
130
|
-
*/
|
|
131
|
-
export function resolveDevHttps({ config, projectRoot, appDir } = {}) {
|
|
132
|
-
const https = config?.dev?.https
|
|
133
|
-
if (!https) return { enabled: false }
|
|
134
|
-
|
|
135
|
-
if (https === true) {
|
|
136
|
-
return {
|
|
137
|
-
enabled: true,
|
|
138
|
-
plugin: basicSsl({
|
|
139
|
-
name: 'ecomiq',
|
|
140
|
-
domains: ['localhost', '127.0.0.1', '::1'],
|
|
141
|
-
}),
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (typeof https === 'object' && https !== null) {
|
|
146
|
-
const root = projectRoot ?? (appDir ? resolve(appDir, '..') : process.cwd())
|
|
147
|
-
const certPath = resolvePathFromRoot(root, https.cert)
|
|
148
|
-
const keyPath = resolvePathFromRoot(root, https.key)
|
|
149
|
-
return {
|
|
150
|
-
enabled: true,
|
|
151
|
-
https: {
|
|
152
|
-
cert: readFileSync(certPath),
|
|
153
|
-
key: readFileSync(keyPath),
|
|
154
|
-
},
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return { enabled: false }
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function resolvePathFromRoot(root, value) {
|
|
162
|
-
if (typeof value !== 'string' || !value.trim()) {
|
|
163
|
-
throw new Error('dev.https.cert y dev.https.key deben ser paths a archivos PEM')
|
|
164
|
-
}
|
|
165
|
-
return isAbsolute(value) ? value : resolve(root, value)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @param {{ appDir: string, config?: object, projectRoot?: string, runtime?: 'workerd' | 'node' }} opts
|
|
170
|
-
*/
|
|
171
|
-
export function createViteConfig({ appDir, config, projectRoot, runtime }) {
|
|
172
|
-
const root = projectRoot ?? resolve(appDir, '..')
|
|
173
|
-
const allow = [
|
|
174
|
-
'..',
|
|
175
|
-
root,
|
|
176
|
-
frameworkRoot,
|
|
177
|
-
resolve(appDir, 'node_modules'),
|
|
178
|
-
resolve(root, 'node_modules'),
|
|
179
|
-
]
|
|
180
|
-
|
|
181
|
-
const resolvedRuntime = resolveDevRuntime({ config, runtime })
|
|
182
|
-
const resolvedHttps = resolveDevHttps({ config, projectRoot: root, appDir })
|
|
183
|
-
|
|
184
|
-
const plugins = [tailwindcss(), designBridgePlugin()]
|
|
185
|
-
|
|
186
|
-
if (resolvedHttps.plugin) {
|
|
187
|
-
plugins.push(resolvedHttps.plugin)
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (resolvedRuntime === 'workerd') {
|
|
191
|
-
plugins.unshift(bundleSsrDependenciesForWorkerd())
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// workerd emula Cloudflare Workers (opt-in en `ecomiq dev`).
|
|
195
|
-
// Default es Node; build/deploy siempre usan workerd.
|
|
196
|
-
if (resolvedRuntime === 'workerd') {
|
|
197
|
-
plugins.push(
|
|
198
|
-
cloudflare({
|
|
199
|
-
configPath: resolve(appDir, 'wrangler.jsonc'),
|
|
200
|
-
viteEnvironment: { name: 'ssr' },
|
|
201
|
-
}),
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
plugins.push(
|
|
206
|
-
tanstackStart({
|
|
207
|
-
srcDirectory: 'src',
|
|
208
|
-
router: {
|
|
209
|
-
routesDirectory: 'routes',
|
|
210
|
-
generatedRouteTree: 'routeTree.gen.ts',
|
|
211
|
-
},
|
|
212
|
-
}),
|
|
213
|
-
sanitizeHtmlClientBoundary(),
|
|
214
|
-
viteReact(),
|
|
215
|
-
)
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
root: appDir,
|
|
219
|
-
configFile: false,
|
|
220
|
-
publicDir: resolve(appDir, '../public'),
|
|
221
|
-
resolve: {
|
|
222
|
-
// Evita dos copias de React/context: el template resuelve desde
|
|
223
|
-
// node_modules del proyecto y `.ecomiq` desde symlinks — sin dedupe,
|
|
224
|
-
// AppEcomiqProvider y useSettings no comparten el mismo createContext
|
|
225
|
-
// (falla al re-render post useSession de Better Auth).
|
|
226
|
-
// No aliasar `@ecomiq/storefront` → rompe subpaths (`/internal/*`).
|
|
227
|
-
dedupe: [
|
|
228
|
-
'react',
|
|
229
|
-
'react-dom',
|
|
230
|
-
'@ecomiq/storefront',
|
|
231
|
-
'@ecomiq/core',
|
|
232
|
-
'@tanstack/react-router',
|
|
233
|
-
'@tanstack/react-start',
|
|
234
|
-
'@tanstack/react-query',
|
|
235
|
-
'better-auth',
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
|
-
plugins,
|
|
239
|
-
build: {
|
|
240
|
-
cssCodeSplit: false,
|
|
241
|
-
commonjsOptions: {
|
|
242
|
-
transformMixedEsModules: true,
|
|
243
|
-
},
|
|
244
|
-
rollupOptions: {
|
|
245
|
-
output: {
|
|
246
|
-
assetFileNames: (assetInfo) => {
|
|
247
|
-
const name = assetInfo.names?.join('') ?? assetInfo.name ?? ''
|
|
248
|
-
if (name.endsWith('.css')) return 'assets/styles[extname]'
|
|
249
|
-
return 'assets/[name]-[hash][extname]'
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
server: {
|
|
255
|
-
// `true` → escucha en 0.0.0.0 y muestra Network URL (IP local), no solo localhost.
|
|
256
|
-
// Override: `dev.host: false | 'localhost' | string` en ecomiq.config.
|
|
257
|
-
host: config?.dev?.host ?? true,
|
|
258
|
-
allowedHosts: config?.dev?.host ?? true,
|
|
259
|
-
fs: { allow },
|
|
260
|
-
...(resolvedHttps.https ? { https: resolvedHttps.https } : {}),
|
|
261
|
-
},
|
|
262
|
-
}
|
|
263
|
-
}
|
package/templates/__root.tsx
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/* Generado por Ecomiq — no editar. */
|
|
2
|
-
import { useState, type ReactNode } from 'react'
|
|
3
|
-
import { createRootRoute, HeadContent, Scripts, Outlet, Link } from '@tanstack/react-router'
|
|
4
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
5
|
-
import { AppEcomiqProvider, AuthProvider } from '@ecomiq/storefront/internal/context'
|
|
6
|
-
import { buildRootHead } from '@ecomiq/storefront/internal/head'
|
|
7
|
-
import { serverApi } from '@ecomiq/storefront'
|
|
8
|
-
import { StorefrontError } from '@ecomiq/storefront/ui'
|
|
9
|
-
import Layout from '../user-layout'
|
|
10
|
-
import publicConfig from '../app-config'
|
|
11
|
-
// Side-effect: Start lo trata como asset del manifest (mismo URL en SSR y client).
|
|
12
|
-
// Evita el FOUC por hashes distintos con `?url` en head().
|
|
13
|
-
import '../styles.css'
|
|
14
|
-
|
|
15
|
-
export const Route = createRootRoute({
|
|
16
|
-
loader: () => serverApi.getSettings(),
|
|
17
|
-
head: ({ loaderData }) => buildRootHead(loaderData),
|
|
18
|
-
component: RootComponent,
|
|
19
|
-
errorComponent: RootError,
|
|
20
|
-
notFoundComponent: NotFound,
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
function RootComponent() {
|
|
24
|
-
const settings = Route.useLoaderData()
|
|
25
|
-
const [queryClient] = useState(
|
|
26
|
-
() =>
|
|
27
|
-
new QueryClient({
|
|
28
|
-
defaultOptions: { queries: { staleTime: 30_000, retry: 1 } },
|
|
29
|
-
}),
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<RootDocument language={settings.store.language}>
|
|
34
|
-
<QueryClientProvider client={queryClient}>
|
|
35
|
-
<AppEcomiqProvider config={publicConfig} settings={settings}>
|
|
36
|
-
<AuthProvider>
|
|
37
|
-
<Layout config={publicConfig} settings={settings}>
|
|
38
|
-
<Outlet />
|
|
39
|
-
</Layout>
|
|
40
|
-
</AuthProvider>
|
|
41
|
-
</AppEcomiqProvider>
|
|
42
|
-
</QueryClientProvider>
|
|
43
|
-
</RootDocument>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function RootDocument({ children, language }: { children: ReactNode; language: string }) {
|
|
48
|
-
return (
|
|
49
|
-
<html lang={language} suppressHydrationWarning>
|
|
50
|
-
<head>
|
|
51
|
-
<HeadContent />
|
|
52
|
-
</head>
|
|
53
|
-
<body className="bg-background text-foreground antialiased">
|
|
54
|
-
{children}
|
|
55
|
-
{/* Puente de design mode (solo dev): el parent (admin) pinta hover/select. */}
|
|
56
|
-
{import.meta.env.DEV ? (
|
|
57
|
-
<script src="/design-bridge.js?v=1.0.0" defer />
|
|
58
|
-
) : null}
|
|
59
|
-
<Scripts />
|
|
60
|
-
</body>
|
|
61
|
-
</html>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function RootError({ reset }: { reset: () => void }) {
|
|
66
|
-
return (
|
|
67
|
-
<RootDocument language="es">
|
|
68
|
-
<StorefrontError onRetry={reset} />
|
|
69
|
-
</RootDocument>
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function NotFound() {
|
|
74
|
-
return (
|
|
75
|
-
<div className="flex flex-col items-center gap-3 py-24 text-center">
|
|
76
|
-
<p className="text-6xl font-bold tracking-tight">404</p>
|
|
77
|
-
<p className="text-muted-foreground">Esta página no existe.</p>
|
|
78
|
-
<Link to="/" className="text-sm underline underline-offset-4">
|
|
79
|
-
Volver al inicio
|
|
80
|
-
</Link>
|
|
81
|
-
</div>
|
|
82
|
-
)
|
|
83
|
-
}
|
package/templates/router.tsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* Generado por Ecomiq — no editar. */
|
|
2
|
-
import { createRouter } from '@tanstack/react-router'
|
|
3
|
-
import { routeTree } from './routeTree.gen'
|
|
4
|
-
|
|
5
|
-
export function getRouter() {
|
|
6
|
-
return createRouter({
|
|
7
|
-
routeTree,
|
|
8
|
-
defaultPreload: 'intent',
|
|
9
|
-
defaultPreloadDelay: 200,
|
|
10
|
-
scrollRestoration: true,
|
|
11
|
-
defaultStaleTime: 30_000,
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare module '@tanstack/react-router' {
|
|
16
|
-
interface Register {
|
|
17
|
-
router: ReturnType<typeof getRouter>
|
|
18
|
-
}
|
|
19
|
-
}
|