@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
package/src/storefront-layout.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { useRouterState } from '@tanstack/react-router'
|
|
2
|
-
import {
|
|
3
|
-
StorefrontDefinitionSchema,
|
|
4
|
-
resolveStorefrontRoute,
|
|
5
|
-
type StorefrontDefinition,
|
|
6
|
-
type StorefrontPage,
|
|
7
|
-
} from '@ecomiq/storefront-definition'
|
|
8
|
-
|
|
9
|
-
export type StorefrontDefinitionRoute = {
|
|
10
|
-
definition: StorefrontDefinition
|
|
11
|
-
page: StorefrontPage
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function definitionRouteFor(
|
|
15
|
-
pathname: string,
|
|
16
|
-
loaderData: unknown,
|
|
17
|
-
): StorefrontDefinitionRoute | null {
|
|
18
|
-
if (loaderData === null || typeof loaderData !== 'object') {
|
|
19
|
-
return null
|
|
20
|
-
}
|
|
21
|
-
if (!('kind' in loaderData) || loaderData.kind !== 'definition') {
|
|
22
|
-
return null
|
|
23
|
-
}
|
|
24
|
-
if (!('definition' in loaderData)) {
|
|
25
|
-
return null
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const parsed = StorefrontDefinitionSchema.safeParse(loaderData.definition)
|
|
29
|
-
if (!parsed.success) return null
|
|
30
|
-
|
|
31
|
-
const resolution = resolveStorefrontRoute(pathname, parsed.data.pages)
|
|
32
|
-
if (resolution.kind !== 'page') return null
|
|
33
|
-
const page = parsed.data.pages.find(
|
|
34
|
-
(candidate) => candidate.id === resolution.pageId,
|
|
35
|
-
)
|
|
36
|
-
if (!page) return null
|
|
37
|
-
return { definition: parsed.data, page }
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function definitionForRoute(
|
|
41
|
-
pathname: string,
|
|
42
|
-
loaderData: unknown,
|
|
43
|
-
): StorefrontDefinition | null {
|
|
44
|
-
return definitionRouteFor(pathname, loaderData)?.definition ?? null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function useDefinitionRoute(): StorefrontDefinitionRoute | null {
|
|
48
|
-
return useRouterState({
|
|
49
|
-
select: (state) =>
|
|
50
|
-
definitionRouteFor(
|
|
51
|
-
state.location.pathname,
|
|
52
|
-
state.matches.at(-1)?.loaderData,
|
|
53
|
-
),
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function useDefinition(): StorefrontDefinition | null {
|
|
58
|
-
return useDefinitionRoute()?.definition ?? null
|
|
59
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CloudRuntimeStoreSlugSchema,
|
|
3
|
-
getCloudRuntimeClient,
|
|
4
|
-
type ActiveStorefrontRuntime,
|
|
5
|
-
} from './cloud-runtime-client'
|
|
6
|
-
import { getStorefrontClient } from './client'
|
|
7
|
-
import {
|
|
8
|
-
getServerConfig,
|
|
9
|
-
type ServerEcomiqConfig,
|
|
10
|
-
} from './server-config-store'
|
|
11
|
-
import {
|
|
12
|
-
resolveStorefrontRoute,
|
|
13
|
-
type StorefrontDefinition,
|
|
14
|
-
type StorefrontPage,
|
|
15
|
-
} from '@ecomiq/storefront-definition'
|
|
16
|
-
import { storefrontPageFor } from './storefront-definition/renderer'
|
|
17
|
-
import {
|
|
18
|
-
emptyRendererData,
|
|
19
|
-
resolveStorefrontDefinitionData,
|
|
20
|
-
type ResolvedStorefrontDefinitionData,
|
|
21
|
-
type StorefrontRuntimeCatalogClient,
|
|
22
|
-
} from './storefront-definition/data'
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
resolveStorefrontDefinitionData,
|
|
26
|
-
type ResolvedStorefrontDefinitionData,
|
|
27
|
-
type StorefrontRuntimeCatalogClient,
|
|
28
|
-
} from './storefront-definition/data'
|
|
29
|
-
|
|
30
|
-
export interface StorefrontRuntimeCloudClient {
|
|
31
|
-
resolveActiveStorefront(
|
|
32
|
-
storeSlug: string,
|
|
33
|
-
): Promise<ActiveStorefrontRuntime | null>
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type ActiveStorefrontHome =
|
|
37
|
-
| {
|
|
38
|
-
kind: 'legacy'
|
|
39
|
-
}
|
|
40
|
-
| {
|
|
41
|
-
kind: 'definition'
|
|
42
|
-
definition: StorefrontDefinition
|
|
43
|
-
page: StorefrontPage
|
|
44
|
-
publication: ActiveStorefrontRuntime['publication']
|
|
45
|
-
data: ResolvedStorefrontDefinitionData
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type ActiveStorefrontPage =
|
|
49
|
-
| {
|
|
50
|
-
kind: 'unpublished'
|
|
51
|
-
}
|
|
52
|
-
| {
|
|
53
|
-
kind: 'not-found'
|
|
54
|
-
}
|
|
55
|
-
| {
|
|
56
|
-
kind: 'definition'
|
|
57
|
-
definition: StorefrontDefinition
|
|
58
|
-
page: StorefrontPage
|
|
59
|
-
publication: ActiveStorefrontRuntime['publication']
|
|
60
|
-
data: ResolvedStorefrontDefinitionData
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function deriveCloudStoreSlug(domain: string): string | null {
|
|
64
|
-
const normalized = domain.trim().toLowerCase()
|
|
65
|
-
if (!normalized) return null
|
|
66
|
-
|
|
67
|
-
let hostname: string
|
|
68
|
-
try {
|
|
69
|
-
hostname = new URL(
|
|
70
|
-
normalized.includes('://') ? normalized : `https://${normalized}`,
|
|
71
|
-
).hostname
|
|
72
|
-
} catch {
|
|
73
|
-
return null
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const candidate = hostname.split('.')[0] ?? ''
|
|
77
|
-
const parsed = CloudRuntimeStoreSlugSchema.safeParse(candidate)
|
|
78
|
-
return parsed.success ? parsed.data : null
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface LoadActiveStorefrontHomeDependencies {
|
|
82
|
-
config?: ServerEcomiqConfig
|
|
83
|
-
cloudClient?: StorefrontRuntimeCloudClient
|
|
84
|
-
catalogClient?: StorefrontRuntimeCatalogClient
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async function resolveActiveRuntime(
|
|
88
|
-
dependencies: LoadActiveStorefrontHomeDependencies,
|
|
89
|
-
): Promise<ActiveStorefrontRuntime | null> {
|
|
90
|
-
const config = dependencies.config ?? getServerConfig()
|
|
91
|
-
const cloudConfig = config.cloud
|
|
92
|
-
if (!cloudConfig?.baseUrl) return null
|
|
93
|
-
|
|
94
|
-
const storeSlug =
|
|
95
|
-
cloudConfig.storeSlug ?? deriveCloudStoreSlug(config.domain)
|
|
96
|
-
if (!storeSlug) return null
|
|
97
|
-
|
|
98
|
-
const cloudClient =
|
|
99
|
-
dependencies.cloudClient ??
|
|
100
|
-
getCloudRuntimeClient({
|
|
101
|
-
baseUrl: cloudConfig.baseUrl,
|
|
102
|
-
artifactBaseUrl: cloudConfig.artifactBaseUrl,
|
|
103
|
-
timeoutMs: cloudConfig.timeoutMs,
|
|
104
|
-
cacheTtlMs: cloudConfig.cacheTtlMs,
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
return await cloudClient.resolveActiveStorefront(storeSlug)
|
|
109
|
-
} catch {
|
|
110
|
-
return null
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export async function loadActiveStorefrontHome(
|
|
115
|
-
dependencies: LoadActiveStorefrontHomeDependencies = {},
|
|
116
|
-
): Promise<ActiveStorefrontHome> {
|
|
117
|
-
const runtime = await resolveActiveRuntime(dependencies)
|
|
118
|
-
if (!runtime) return { kind: 'legacy' }
|
|
119
|
-
|
|
120
|
-
const page = storefrontPageFor(runtime.definition)
|
|
121
|
-
if (!page) return { kind: 'legacy' }
|
|
122
|
-
|
|
123
|
-
const catalogClient =
|
|
124
|
-
dependencies.catalogClient ?? getStorefrontClient()
|
|
125
|
-
const data = await resolveStorefrontDefinitionData(
|
|
126
|
-
runtime.definition,
|
|
127
|
-
catalogClient,
|
|
128
|
-
page.id,
|
|
129
|
-
).catch(emptyRendererData)
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
kind: 'definition',
|
|
133
|
-
definition: runtime.definition,
|
|
134
|
-
page,
|
|
135
|
-
publication: runtime.publication,
|
|
136
|
-
data,
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export async function loadActiveStorefrontPage(
|
|
141
|
-
pathname: string,
|
|
142
|
-
dependencies: LoadActiveStorefrontHomeDependencies = {},
|
|
143
|
-
): Promise<ActiveStorefrontPage> {
|
|
144
|
-
const runtime = await resolveActiveRuntime(dependencies)
|
|
145
|
-
if (!runtime) return { kind: 'unpublished' }
|
|
146
|
-
|
|
147
|
-
const resolution = resolveStorefrontRoute(
|
|
148
|
-
pathname,
|
|
149
|
-
runtime.definition.pages,
|
|
150
|
-
)
|
|
151
|
-
if (resolution.kind !== 'page') return { kind: 'not-found' }
|
|
152
|
-
|
|
153
|
-
const page = runtime.definition.pages.find(
|
|
154
|
-
(candidate) => candidate.id === resolution.pageId,
|
|
155
|
-
)
|
|
156
|
-
if (!page) return { kind: 'not-found' }
|
|
157
|
-
|
|
158
|
-
const catalogClient =
|
|
159
|
-
dependencies.catalogClient ?? getStorefrontClient()
|
|
160
|
-
const data = await resolveStorefrontDefinitionData(
|
|
161
|
-
runtime.definition,
|
|
162
|
-
catalogClient,
|
|
163
|
-
page.id,
|
|
164
|
-
).catch(emptyRendererData)
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
kind: 'definition',
|
|
168
|
-
definition: runtime.definition,
|
|
169
|
-
page,
|
|
170
|
-
publication: runtime.publication,
|
|
171
|
-
data,
|
|
172
|
-
}
|
|
173
|
-
}
|
package/src/styles.css
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/* Design system de Ecomiq — Tailwind v4 + tokens estilo shadcn.
|
|
2
|
-
* `source(...)` fija el scan para que client y SSR generen el mismo CSS/hash. */
|
|
3
|
-
@import 'tailwindcss' source('./');
|
|
4
|
-
|
|
5
|
-
/* Escanear los componentes UI del propio framework */
|
|
6
|
-
@source './ui';
|
|
7
|
-
@source './components';
|
|
8
|
-
@source './storefront-definition';
|
|
9
|
-
@source './runtime';
|
|
10
|
-
@source './pages';
|
|
11
|
-
@source '../templates';
|
|
12
|
-
|
|
13
|
-
@theme inline {
|
|
14
|
-
--color-background: var(--background);
|
|
15
|
-
--color-foreground: var(--foreground);
|
|
16
|
-
--color-card: var(--card);
|
|
17
|
-
--color-card-foreground: var(--card-foreground);
|
|
18
|
-
--color-primary: var(--primary);
|
|
19
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
20
|
-
--color-secondary: var(--secondary);
|
|
21
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
22
|
-
--color-muted: var(--muted);
|
|
23
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
24
|
-
--color-accent: var(--accent);
|
|
25
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
26
|
-
--color-destructive: var(--destructive);
|
|
27
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
28
|
-
--color-border: var(--border);
|
|
29
|
-
--color-input: var(--input);
|
|
30
|
-
--color-ring: var(--ring);
|
|
31
|
-
--radius-lg: var(--radius);
|
|
32
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
33
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
:root {
|
|
37
|
-
--background: oklch(0.99 0.003 90);
|
|
38
|
-
--foreground: oklch(0.2 0.02 260);
|
|
39
|
-
--card: oklch(1 0 0);
|
|
40
|
-
--card-foreground: oklch(0.2 0.02 260);
|
|
41
|
-
--primary: oklch(0.45 0.15 165);
|
|
42
|
-
--primary-foreground: oklch(0.98 0.01 165);
|
|
43
|
-
--secondary: oklch(0.96 0.01 165);
|
|
44
|
-
--secondary-foreground: oklch(0.3 0.05 165);
|
|
45
|
-
--muted: oklch(0.96 0.005 90);
|
|
46
|
-
--muted-foreground: oklch(0.5 0.02 260);
|
|
47
|
-
--accent: oklch(0.94 0.03 165);
|
|
48
|
-
--accent-foreground: oklch(0.3 0.05 165);
|
|
49
|
-
--destructive: oklch(0.55 0.2 25);
|
|
50
|
-
--destructive-foreground: oklch(0.98 0.01 25);
|
|
51
|
-
--border: oklch(0.91 0.005 90);
|
|
52
|
-
--input: oklch(0.91 0.005 90);
|
|
53
|
-
--ring: oklch(0.45 0.15 165);
|
|
54
|
-
--radius: 0.625rem;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
* {
|
|
58
|
-
border-color: var(--border);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
::selection {
|
|
62
|
-
background: var(--accent);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
:focus-visible {
|
|
66
|
-
outline: 2px solid var(--ring);
|
|
67
|
-
outline-offset: 2px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@media (prefers-reduced-motion: reduce) {
|
|
71
|
-
*,
|
|
72
|
-
*::before,
|
|
73
|
-
*::after {
|
|
74
|
-
animation-duration: 0.01ms !important;
|
|
75
|
-
transition-duration: 0.01ms !important;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.storefront-definition {
|
|
80
|
-
font-family: var(--storefront-font-body);
|
|
81
|
-
--storefront-content-width: 72rem;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.storefront-definition :where(h1, h2, h3, h4, h5, h6) {
|
|
85
|
-
font-family: var(--storefront-font-heading);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.storefront-definition-section {
|
|
89
|
-
padding-block: var(
|
|
90
|
-
--storefront-section-padding-top,
|
|
91
|
-
var(--storefront-section-padding)
|
|
92
|
-
)
|
|
93
|
-
var(
|
|
94
|
-
--storefront-section-padding-bottom,
|
|
95
|
-
var(--storefront-section-padding)
|
|
96
|
-
);
|
|
97
|
-
}
|
package/src/ui/badge.tsx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps, ReactNode } from 'react'
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
-
import { cn } from './cn'
|
|
4
|
-
|
|
5
|
-
const badgeVariants = cva(
|
|
6
|
-
'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors',
|
|
7
|
-
{
|
|
8
|
-
variants: {
|
|
9
|
-
variant: {
|
|
10
|
-
default: 'border-transparent bg-primary text-primary-foreground',
|
|
11
|
-
secondary: 'border-transparent bg-secondary text-secondary-foreground',
|
|
12
|
-
outline: 'text-foreground',
|
|
13
|
-
destructive: 'border-transparent bg-destructive text-destructive-foreground',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: { variant: 'default' },
|
|
17
|
-
},
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
export interface BadgeProps
|
|
21
|
-
extends Omit<ComponentProps<'span'>, 'children'>,
|
|
22
|
-
VariantProps<typeof badgeVariants> {
|
|
23
|
-
children?: ReactNode
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function Badge({ className, variant, children, ...props }: BadgeProps) {
|
|
27
|
-
return (
|
|
28
|
-
<span className={cn(badgeVariants({ variant }), className)} {...props}>
|
|
29
|
-
{children}
|
|
30
|
-
</span>
|
|
31
|
-
)
|
|
32
|
-
}
|
package/src/ui/button.tsx
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react'
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
-
import { cn } from './cn'
|
|
4
|
-
|
|
5
|
-
export const buttonVariants = cva(
|
|
6
|
-
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0',
|
|
7
|
-
{
|
|
8
|
-
variants: {
|
|
9
|
-
variant: {
|
|
10
|
-
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
11
|
-
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
12
|
-
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
13
|
-
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
14
|
-
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
|
15
|
-
},
|
|
16
|
-
size: {
|
|
17
|
-
default: 'h-9 px-4 py-2',
|
|
18
|
-
sm: 'h-8 rounded-md px-3 text-xs',
|
|
19
|
-
lg: 'h-10 rounded-md px-8',
|
|
20
|
-
icon: 'h-9 w-9',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
defaultVariants: { variant: 'default', size: 'default' },
|
|
24
|
-
},
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {}
|
|
28
|
-
|
|
29
|
-
export function Button({ className, variant, size, type = 'button', ...props }: ButtonProps) {
|
|
30
|
-
return <button type={type} className={cn(buttonVariants({ variant, size }), className)} {...props} />
|
|
31
|
-
}
|
package/src/ui/card.tsx
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react'
|
|
2
|
-
import { cn } from './cn'
|
|
3
|
-
|
|
4
|
-
export function Card({ className, ...props }: ComponentProps<'div'>) {
|
|
5
|
-
return (
|
|
6
|
-
<div
|
|
7
|
-
className={cn('rounded-lg border bg-card text-card-foreground shadow-sm', className)}
|
|
8
|
-
{...props}
|
|
9
|
-
/>
|
|
10
|
-
)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function CardHeader({ className, ...props }: ComponentProps<'div'>) {
|
|
14
|
-
return <div className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function CardTitle({ className, ...props }: ComponentProps<'h3'>) {
|
|
18
|
-
return <h3 className={cn('font-semibold leading-none tracking-tight', className)} {...props} />
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function CardDescription({ className, ...props }: ComponentProps<'p'>) {
|
|
22
|
-
return <p className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function CardContent({ className, ...props }: ComponentProps<'div'>) {
|
|
26
|
-
return <div className={cn('p-6 pt-0', className)} {...props} />
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function CardFooter({ className, ...props }: ComponentProps<'div'>) {
|
|
30
|
-
return <div className={cn('flex items-center p-6 pt-0', className)} {...props} />
|
|
31
|
-
}
|
package/src/ui/carousel.tsx
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Children,
|
|
3
|
-
createContext,
|
|
4
|
-
useCallback,
|
|
5
|
-
useContext,
|
|
6
|
-
useEffect,
|
|
7
|
-
useMemo,
|
|
8
|
-
useState,
|
|
9
|
-
type HTMLAttributes,
|
|
10
|
-
type ReactNode,
|
|
11
|
-
} from 'react'
|
|
12
|
-
import useEmblaCarousel, {
|
|
13
|
-
type UseEmblaCarouselType,
|
|
14
|
-
} from 'embla-carousel-react'
|
|
15
|
-
import Autoplay from 'embla-carousel-autoplay'
|
|
16
|
-
import Fade from 'embla-carousel-fade'
|
|
17
|
-
import { ChevronLeft, ChevronRight } from 'lucide-react'
|
|
18
|
-
import { cn } from './cn'
|
|
19
|
-
import { Button } from './button'
|
|
20
|
-
|
|
21
|
-
type EmblaCarouselApi = UseEmblaCarouselType[1]
|
|
22
|
-
|
|
23
|
-
type CarouselContextValue = {
|
|
24
|
-
api: EmblaCarouselApi | undefined
|
|
25
|
-
selectedIndex: number
|
|
26
|
-
scrollPrev: () => void
|
|
27
|
-
scrollNext: () => void
|
|
28
|
-
scrollTo: (index: number) => void
|
|
29
|
-
slideCount: number
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const CarouselContext = createContext<CarouselContextValue | null>(null)
|
|
33
|
-
|
|
34
|
-
function useCarousel() {
|
|
35
|
-
const ctx = useContext(CarouselContext)
|
|
36
|
-
if (!ctx) throw new Error('Carousel components must be used within <Carousel>')
|
|
37
|
-
return ctx
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type CarouselProps = {
|
|
41
|
-
children: ReactNode
|
|
42
|
-
className?: string
|
|
43
|
-
/** Loop infinito. Default: true si hay más de un slide. */
|
|
44
|
-
loop?: boolean
|
|
45
|
-
/** Transición fade (Embla Fade). Default: false. */
|
|
46
|
-
fade?: boolean
|
|
47
|
-
/** Autoplay: delay en ms, o false para desactivar. Default: false. */
|
|
48
|
-
autoplay?: number | false
|
|
49
|
-
/** Flechas prev/next. Default: true si hay más de un slide. */
|
|
50
|
-
showArrows?: boolean
|
|
51
|
-
/** Dots de navegación. Default: true si hay más de un slide. */
|
|
52
|
-
showDots?: boolean
|
|
53
|
-
/** Etiqueta accesible del region. */
|
|
54
|
-
'aria-label'?: string
|
|
55
|
-
} & Omit<HTMLAttributes<HTMLElement>, 'children'>
|
|
56
|
-
|
|
57
|
-
export function Carousel({
|
|
58
|
-
children,
|
|
59
|
-
className,
|
|
60
|
-
loop,
|
|
61
|
-
fade = false,
|
|
62
|
-
autoplay = false,
|
|
63
|
-
showArrows,
|
|
64
|
-
showDots,
|
|
65
|
-
'aria-label': ariaLabel = 'Carrusel',
|
|
66
|
-
...rest
|
|
67
|
-
}: CarouselProps) {
|
|
68
|
-
const slides = Children.toArray(children).filter(Boolean)
|
|
69
|
-
const slideCount = slides.length
|
|
70
|
-
const multi = slideCount > 1
|
|
71
|
-
const shouldLoop = loop ?? multi
|
|
72
|
-
const arrows = showArrows ?? multi
|
|
73
|
-
const dots = showDots ?? multi
|
|
74
|
-
|
|
75
|
-
const plugins = useMemo(() => {
|
|
76
|
-
if (!multi) return []
|
|
77
|
-
const list = []
|
|
78
|
-
if (fade) list.push(Fade())
|
|
79
|
-
if (autoplay !== false) {
|
|
80
|
-
list.push(
|
|
81
|
-
Autoplay({
|
|
82
|
-
delay: typeof autoplay === 'number' ? autoplay : 6000,
|
|
83
|
-
stopOnInteraction: false,
|
|
84
|
-
stopOnMouseEnter: true,
|
|
85
|
-
}),
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
return list
|
|
89
|
-
}, [multi, fade, autoplay])
|
|
90
|
-
|
|
91
|
-
const [emblaRef, emblaApi] = useEmblaCarousel(
|
|
92
|
-
{ loop: shouldLoop, align: 'start', duration: 35 },
|
|
93
|
-
plugins,
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
const [selectedIndex, setSelectedIndex] = useState(0)
|
|
97
|
-
|
|
98
|
-
const resetAutoplay = useCallback(() => {
|
|
99
|
-
const plugin = emblaApi?.plugins()?.autoplay
|
|
100
|
-
if (plugin && 'reset' in plugin) plugin.reset()
|
|
101
|
-
}, [emblaApi])
|
|
102
|
-
|
|
103
|
-
const scrollPrev = useCallback(() => {
|
|
104
|
-
emblaApi?.scrollPrev()
|
|
105
|
-
resetAutoplay()
|
|
106
|
-
}, [emblaApi, resetAutoplay])
|
|
107
|
-
|
|
108
|
-
const scrollNext = useCallback(() => {
|
|
109
|
-
emblaApi?.scrollNext()
|
|
110
|
-
resetAutoplay()
|
|
111
|
-
}, [emblaApi, resetAutoplay])
|
|
112
|
-
|
|
113
|
-
const scrollTo = useCallback(
|
|
114
|
-
(index: number) => {
|
|
115
|
-
emblaApi?.scrollTo(index)
|
|
116
|
-
resetAutoplay()
|
|
117
|
-
},
|
|
118
|
-
[emblaApi, resetAutoplay],
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (!emblaApi) return
|
|
123
|
-
const onSelect = () => setSelectedIndex(emblaApi.selectedScrollSnap())
|
|
124
|
-
onSelect()
|
|
125
|
-
emblaApi.on('select', onSelect)
|
|
126
|
-
emblaApi.on('reInit', onSelect)
|
|
127
|
-
return () => {
|
|
128
|
-
emblaApi.off('select', onSelect)
|
|
129
|
-
emblaApi.off('reInit', onSelect)
|
|
130
|
-
}
|
|
131
|
-
}, [emblaApi])
|
|
132
|
-
|
|
133
|
-
const value = useMemo(
|
|
134
|
-
() => ({
|
|
135
|
-
api: emblaApi,
|
|
136
|
-
selectedIndex,
|
|
137
|
-
scrollPrev,
|
|
138
|
-
scrollNext,
|
|
139
|
-
scrollTo,
|
|
140
|
-
slideCount,
|
|
141
|
-
}),
|
|
142
|
-
[emblaApi, selectedIndex, scrollPrev, scrollNext, scrollTo, slideCount],
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
if (slideCount === 0) return null
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<CarouselContext.Provider value={value}>
|
|
149
|
-
<section
|
|
150
|
-
className={cn('group relative overflow-hidden', className)}
|
|
151
|
-
aria-label={ariaLabel}
|
|
152
|
-
role="region"
|
|
153
|
-
aria-roledescription="carrusel"
|
|
154
|
-
{...rest}
|
|
155
|
-
>
|
|
156
|
-
<div className="overflow-hidden" ref={emblaRef}>
|
|
157
|
-
<div className="flex touch-pan-y">
|
|
158
|
-
{slides.map((slide, index) => (
|
|
159
|
-
<div key={index} className="relative min-w-0 flex-[0_0_100%]">
|
|
160
|
-
{slide}
|
|
161
|
-
</div>
|
|
162
|
-
))}
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
{arrows ? (
|
|
167
|
-
<div className="pointer-events-none absolute inset-x-0 top-1/2 z-20 flex -translate-y-1/2 justify-between px-4 md:px-8">
|
|
168
|
-
<Button
|
|
169
|
-
type="button"
|
|
170
|
-
variant="outline"
|
|
171
|
-
size="icon"
|
|
172
|
-
onClick={scrollPrev}
|
|
173
|
-
className="pointer-events-auto rounded-full border-white/20 bg-black/40 text-white shadow-sm backdrop-blur-sm hover:bg-black/60 hover:text-white"
|
|
174
|
-
aria-label="Slide anterior"
|
|
175
|
-
>
|
|
176
|
-
<ChevronLeft />
|
|
177
|
-
</Button>
|
|
178
|
-
<Button
|
|
179
|
-
type="button"
|
|
180
|
-
variant="outline"
|
|
181
|
-
size="icon"
|
|
182
|
-
onClick={scrollNext}
|
|
183
|
-
className="pointer-events-auto rounded-full border-white/20 bg-black/40 text-white shadow-sm backdrop-blur-sm hover:bg-black/60 hover:text-white"
|
|
184
|
-
aria-label="Slide siguiente"
|
|
185
|
-
>
|
|
186
|
-
<ChevronRight />
|
|
187
|
-
</Button>
|
|
188
|
-
</div>
|
|
189
|
-
) : null}
|
|
190
|
-
|
|
191
|
-
{dots ? (
|
|
192
|
-
<div
|
|
193
|
-
className="absolute bottom-6 left-1/2 z-20 flex -translate-x-1/2 gap-2 md:bottom-8"
|
|
194
|
-
role="tablist"
|
|
195
|
-
aria-label="Slides"
|
|
196
|
-
>
|
|
197
|
-
{slides.map((_, i) => (
|
|
198
|
-
<button
|
|
199
|
-
key={i}
|
|
200
|
-
type="button"
|
|
201
|
-
role="tab"
|
|
202
|
-
aria-selected={i === selectedIndex}
|
|
203
|
-
aria-label={`Slide ${i + 1}`}
|
|
204
|
-
onClick={() => scrollTo(i)}
|
|
205
|
-
className={cn(
|
|
206
|
-
'h-2 w-2 rounded-full border border-white/30 transition md:h-2.5 md:w-2.5',
|
|
207
|
-
i === selectedIndex ? 'scale-110 bg-white' : 'bg-white/45 hover:bg-white/70',
|
|
208
|
-
)}
|
|
209
|
-
/>
|
|
210
|
-
))}
|
|
211
|
-
</div>
|
|
212
|
-
) : null}
|
|
213
|
-
</section>
|
|
214
|
-
</CarouselContext.Provider>
|
|
215
|
-
)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export { useCarousel }
|
package/src/ui/cn.ts
DELETED
package/src/ui/index.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { Button, buttonVariants, type ButtonProps } from './button'
|
|
2
|
-
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './card'
|
|
3
|
-
export { Badge, type BadgeProps } from './badge'
|
|
4
|
-
export { Skeleton } from './skeleton'
|
|
5
|
-
export { Separator } from './separator'
|
|
6
|
-
export { Carousel, useCarousel, type CarouselProps } from './carousel'
|
|
7
|
-
export { StorefrontError, type StorefrontErrorProps } from './storefront-error'
|
|
8
|
-
export { cn } from './cn'
|
package/src/ui/separator.tsx
DELETED
package/src/ui/skeleton.tsx
DELETED