@ecomiq/storefront 2.1.4 → 3.0.1
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 +377 -76
- 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 -76
- 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/codegen.mjs +0 -801
- 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 -349
- 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 -74
- 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 -286
- package/src/styles.css +0 -76
- 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,125 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from 'react'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
import { useSettings } from '../providers/ecomiq'
|
|
4
|
-
|
|
5
|
-
const RecentlyViewedItemSchema = z.object({
|
|
6
|
-
id: z.string().min(1),
|
|
7
|
-
name: z.string().min(1),
|
|
8
|
-
slug: z.string().min(1),
|
|
9
|
-
imageUrl: z.string(),
|
|
10
|
-
price: z.number().nonnegative(),
|
|
11
|
-
compareAtPrice: z.number().nonnegative().nullable(),
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const RecentlyViewedSessionSchema = z.object({
|
|
15
|
-
version: z.literal(1),
|
|
16
|
-
storeId: z.string().min(1),
|
|
17
|
-
items: z.array(RecentlyViewedItemSchema).max(12),
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
export type RecentlyViewedItem = z.infer<typeof RecentlyViewedItemSchema>
|
|
21
|
-
|
|
22
|
-
const MAX_ITEMS = 8
|
|
23
|
-
|
|
24
|
-
function storageKey(storeId: string) {
|
|
25
|
-
return `ecomiq:recently-viewed:v1:${storeId}`
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function readSession(storeId: string) {
|
|
29
|
-
if (typeof localStorage === 'undefined') return undefined
|
|
30
|
-
try {
|
|
31
|
-
const raw = localStorage.getItem(storageKey(storeId))
|
|
32
|
-
if (!raw) return undefined
|
|
33
|
-
const parsed = RecentlyViewedSessionSchema.safeParse(JSON.parse(raw))
|
|
34
|
-
return parsed.success && parsed.data.storeId === storeId ? parsed.data : undefined
|
|
35
|
-
} catch {
|
|
36
|
-
return undefined
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Lectura síncrona (tests / casos sin React). */
|
|
41
|
-
export function listRecentlyViewed(storeId: string): RecentlyViewedItem[] {
|
|
42
|
-
return readSession(storeId)?.items ?? []
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Persistencia síncrona: el item queda al frente y se deduplica por id. */
|
|
46
|
-
export function trackRecentlyViewed(
|
|
47
|
-
storeId: string,
|
|
48
|
-
item: RecentlyViewedItem,
|
|
49
|
-
): RecentlyViewedItem[] {
|
|
50
|
-
const current = listRecentlyViewed(storeId).filter((entry) => entry.id !== item.id)
|
|
51
|
-
const items = [item, ...current].slice(0, MAX_ITEMS)
|
|
52
|
-
localStorage.setItem(
|
|
53
|
-
storageKey(storeId),
|
|
54
|
-
JSON.stringify({
|
|
55
|
-
version: 1,
|
|
56
|
-
storeId,
|
|
57
|
-
items,
|
|
58
|
-
} satisfies z.infer<typeof RecentlyViewedSessionSchema>),
|
|
59
|
-
)
|
|
60
|
-
return items
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type TrackableProduct = {
|
|
64
|
-
id: string
|
|
65
|
-
name: string
|
|
66
|
-
slug: string
|
|
67
|
-
imageUrl?: string | null
|
|
68
|
-
images?: Array<{ url: string }>
|
|
69
|
-
price: number
|
|
70
|
-
compareAtPrice: number | null
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function toRecentlyViewedItem(product: TrackableProduct): RecentlyViewedItem {
|
|
74
|
-
return {
|
|
75
|
-
id: product.id,
|
|
76
|
-
name: product.name,
|
|
77
|
-
slug: product.slug,
|
|
78
|
-
imageUrl: product.imageUrl || product.images?.[0]?.url || '',
|
|
79
|
-
price: product.price,
|
|
80
|
-
compareAtPrice: product.compareAtPrice,
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Lista reactiva de productos vistos recientemente de la tienda actual.
|
|
86
|
-
*
|
|
87
|
-
* ```tsx
|
|
88
|
-
* const { items, track } = useRecentlyViewed()
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
export function useRecentlyViewed() {
|
|
92
|
-
const { store } = useSettings()
|
|
93
|
-
const [items, setItems] = useState<RecentlyViewedItem[]>([])
|
|
94
|
-
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
setItems(listRecentlyViewed(store.id))
|
|
97
|
-
}, [store.id])
|
|
98
|
-
|
|
99
|
-
const track = useCallback(
|
|
100
|
-
(item: RecentlyViewedItem) => {
|
|
101
|
-
const next = trackRecentlyViewed(store.id, item)
|
|
102
|
-
setItems(next)
|
|
103
|
-
return next
|
|
104
|
-
},
|
|
105
|
-
[store.id],
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
return { items, track, storeId: store.id }
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Registra un producto en “visto recientemente” al montar / cambiar de PDP.
|
|
113
|
-
*
|
|
114
|
-
* ```tsx
|
|
115
|
-
* useTrackRecentlyViewed(product)
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
export function useTrackRecentlyViewed(product: TrackableProduct) {
|
|
119
|
-
const { store } = useSettings()
|
|
120
|
-
const item = toRecentlyViewedItem(product)
|
|
121
|
-
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
trackRecentlyViewed(store.id, item)
|
|
124
|
-
}, [store.id, item.id, item.name, item.slug, item.imageUrl, item.price, item.compareAtPrice])
|
|
125
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API pública de @ecomiq/storefront.
|
|
3
|
-
* Todo lo que el usuario importa sale de aquí o de '@ecomiq/storefront/ui'.
|
|
4
|
-
* Las herramientas internas (router, bundler, SSR) no se exponen.
|
|
5
|
-
*/
|
|
6
|
-
import type { ReactNode } from 'react'
|
|
7
|
-
import type { StorefrontSettings } from '@ecomiq/core'
|
|
8
|
-
import type { PublicEcomiqConfig } from './public-config'
|
|
9
|
-
|
|
10
|
-
export type {
|
|
11
|
-
EcomiqConfig,
|
|
12
|
-
EcomiqThemeConfig,
|
|
13
|
-
PublicEcomiqConfig,
|
|
14
|
-
} from './public-config'
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
createApi,
|
|
18
|
-
createStorefrontClient,
|
|
19
|
-
ApiError,
|
|
20
|
-
DEFAULT_API_BASE_URL,
|
|
21
|
-
DEFAULT_API_VERSION,
|
|
22
|
-
} from '@ecomiq/core'
|
|
23
|
-
export type { Api, CreateApiOptions, StorefrontClient } from '@ecomiq/core'
|
|
24
|
-
export type { CreateApiOptions as CreateClientOptions } from '@ecomiq/core'
|
|
25
|
-
export {
|
|
26
|
-
CollectionSchema,
|
|
27
|
-
CollectionsSchema,
|
|
28
|
-
CountrySchema,
|
|
29
|
-
CountriesSchema,
|
|
30
|
-
DepartmentSchema,
|
|
31
|
-
DepartmentsSchema,
|
|
32
|
-
DistrictSchema,
|
|
33
|
-
DistrictsSchema,
|
|
34
|
-
CartTokenSchema,
|
|
35
|
-
EntityIdSchema,
|
|
36
|
-
NullableEntityIdSchema,
|
|
37
|
-
OptionalEntityIdSchema,
|
|
38
|
-
GeoDivisionSchema,
|
|
39
|
-
GeoDivisionTypeSchema,
|
|
40
|
-
GetDepartmentsParamsSchema,
|
|
41
|
-
GetDistrictsParamsSchema,
|
|
42
|
-
GetProvincesParamsSchema,
|
|
43
|
-
ProvinceSchema,
|
|
44
|
-
ProvincesSchema,
|
|
45
|
-
StorefrontSettingsSchema,
|
|
46
|
-
StorefrontMenuSchema,
|
|
47
|
-
StorefrontMenuItemSchema,
|
|
48
|
-
getMenuItems,
|
|
49
|
-
} from '@ecomiq/core'
|
|
50
|
-
export type { CartToken, EntityId } from '@ecomiq/core'
|
|
51
|
-
export { getCountries, getDepartments, getDistricts, getProvinces } from '@ecomiq/core'
|
|
52
|
-
export {
|
|
53
|
-
AddCartItemParamsSchema,
|
|
54
|
-
CreateCartParamsSchema,
|
|
55
|
-
CreateProductReviewParamsSchema,
|
|
56
|
-
GetCartParamsSchema,
|
|
57
|
-
ListProductReviewsParamsSchema,
|
|
58
|
-
ProductDetailParamsSchema,
|
|
59
|
-
ProductDetailSchema,
|
|
60
|
-
ProductAutocompleteParamsSchema,
|
|
61
|
-
ProductSuggestionSchema,
|
|
62
|
-
ProductSuggestionsSchema,
|
|
63
|
-
ProductSummarySchema,
|
|
64
|
-
ProductsParamsSchema,
|
|
65
|
-
ProductsResponseSchema,
|
|
66
|
-
RelatedProductsParamsSchema,
|
|
67
|
-
RemoveCartItemParamsSchema,
|
|
68
|
-
StorefrontCartSchema,
|
|
69
|
-
StorefrontReviewSchema,
|
|
70
|
-
StorefrontReviewsSchema,
|
|
71
|
-
CartCheckoutReadParamsSchema,
|
|
72
|
-
CartCheckoutParamsSchema,
|
|
73
|
-
GetShippingOptionsParamsSchema,
|
|
74
|
-
PutShippingMethodParamsSchema,
|
|
75
|
-
CartBuyerParamsSchema,
|
|
76
|
-
CartAddressesParamsSchema,
|
|
77
|
-
CartPromotionCodeParamsSchema,
|
|
78
|
-
UpdateCartItemQuantityParamsSchema,
|
|
79
|
-
sanitizeHtml,
|
|
80
|
-
stripHtml,
|
|
81
|
-
} from '@ecomiq/core'
|
|
82
|
-
export type {
|
|
83
|
-
Collection,
|
|
84
|
-
Collections,
|
|
85
|
-
Countries,
|
|
86
|
-
Country,
|
|
87
|
-
Department,
|
|
88
|
-
Departments,
|
|
89
|
-
District,
|
|
90
|
-
Districts,
|
|
91
|
-
GeoDivision,
|
|
92
|
-
GeoDivisionType,
|
|
93
|
-
GetDepartmentsParams,
|
|
94
|
-
GetDistrictsParams,
|
|
95
|
-
GetProvincesParams,
|
|
96
|
-
Province,
|
|
97
|
-
Provinces,
|
|
98
|
-
StorefrontSettings,
|
|
99
|
-
StorefrontMenu,
|
|
100
|
-
StorefrontMenuItem,
|
|
101
|
-
AddCartItemParams,
|
|
102
|
-
BundleItem,
|
|
103
|
-
CreateCartParams,
|
|
104
|
-
CreateProductReviewParams,
|
|
105
|
-
GetCartParams,
|
|
106
|
-
ListProductReviewsParams,
|
|
107
|
-
ProductDetail,
|
|
108
|
-
ProductDetailParams,
|
|
109
|
-
Product,
|
|
110
|
-
ProductAutocompleteParams,
|
|
111
|
-
ProductImage,
|
|
112
|
-
ProductPriceTier,
|
|
113
|
-
ProductSuggestion,
|
|
114
|
-
ProductSummary,
|
|
115
|
-
ProductsParams,
|
|
116
|
-
ProductsParamsInput,
|
|
117
|
-
ProductsResponse,
|
|
118
|
-
RelatedProductsParams,
|
|
119
|
-
RemoveCartItemParams,
|
|
120
|
-
SearchFilter,
|
|
121
|
-
SizeGuide,
|
|
122
|
-
SpecItem,
|
|
123
|
-
StorefrontCart,
|
|
124
|
-
StorefrontCartItem,
|
|
125
|
-
CartCheckoutReadParams,
|
|
126
|
-
CartCheckoutParams,
|
|
127
|
-
CartCheckoutResponse,
|
|
128
|
-
CartPaymentMethod,
|
|
129
|
-
GetShippingOptionsParams,
|
|
130
|
-
PutShippingMethodParams,
|
|
131
|
-
CartBuyerParams,
|
|
132
|
-
CartAddressesParams,
|
|
133
|
-
CartPromotionCodeParams,
|
|
134
|
-
ShippingRate,
|
|
135
|
-
ShippingOptionGroup,
|
|
136
|
-
ShippingOptionsResponse,
|
|
137
|
-
StorefrontOrderBump,
|
|
138
|
-
StorefrontReview,
|
|
139
|
-
StorefrontReviews,
|
|
140
|
-
UpdateCartItemQuantityParams,
|
|
141
|
-
VariantItem,
|
|
142
|
-
CustomerAddress,
|
|
143
|
-
CustomerAddresses,
|
|
144
|
-
CustomerAddressUpsertInput,
|
|
145
|
-
CustomerSavedAddress,
|
|
146
|
-
CustomerMe,
|
|
147
|
-
CustomerProfile,
|
|
148
|
-
CustomerProfilePatch,
|
|
149
|
-
CustomerOrderDetail,
|
|
150
|
-
CustomerOrderListItem,
|
|
151
|
-
} from '@ecomiq/core'
|
|
152
|
-
export {
|
|
153
|
-
CustomerAddressSchema,
|
|
154
|
-
CustomerAddressesSchema,
|
|
155
|
-
CustomerAddressUpsertInputSchema,
|
|
156
|
-
toCustomerSavedAddresses,
|
|
157
|
-
getCustomerAddresses,
|
|
158
|
-
createCustomerAddress,
|
|
159
|
-
updateCustomerAddress,
|
|
160
|
-
deleteCustomerAddress,
|
|
161
|
-
CustomerMeSchema,
|
|
162
|
-
CustomerProfileSchema,
|
|
163
|
-
CustomerProfilePatchSchema,
|
|
164
|
-
CustomerRegisterRequestSchema,
|
|
165
|
-
customerMeToProfile,
|
|
166
|
-
customerMeToProfilePatch,
|
|
167
|
-
customerProfileToPatch,
|
|
168
|
-
getCustomerMe,
|
|
169
|
-
patchCustomer,
|
|
170
|
-
registerCustomer,
|
|
171
|
-
CustomerOrderListItemSchema,
|
|
172
|
-
CustomerOrderDetailSchema,
|
|
173
|
-
CustomerOrderListSchema,
|
|
174
|
-
formatCustomerOrderStatus,
|
|
175
|
-
customerOrderStatusTone,
|
|
176
|
-
formatOrderDate,
|
|
177
|
-
formatOrderDateTime,
|
|
178
|
-
getCustomerOrders,
|
|
179
|
-
getCustomerOrder,
|
|
180
|
-
} from '@ecomiq/core'
|
|
181
|
-
export { createClient, getStorefrontClient } from './client'
|
|
182
|
-
export type {
|
|
183
|
-
AddProductToCartInput,
|
|
184
|
-
AddProductToCartResult,
|
|
185
|
-
ProductCartMutationResult,
|
|
186
|
-
} from './cart-session'
|
|
187
|
-
export type {
|
|
188
|
-
ProductReviewSubmissionError,
|
|
189
|
-
ProductReviewSubmissionResult,
|
|
190
|
-
} from './review-submission'
|
|
191
|
-
export { serverApi } from './server'
|
|
192
|
-
export { proxyStorefrontRequest } from './api-proxy'
|
|
193
|
-
export { createStorefrontProxyApi } from './proxy-api'
|
|
194
|
-
export {
|
|
195
|
-
AppEcomiqProvider,
|
|
196
|
-
useApiQuery,
|
|
197
|
-
useAppConfig,
|
|
198
|
-
useSettings,
|
|
199
|
-
useMenu,
|
|
200
|
-
useSearchNavigate,
|
|
201
|
-
CartProvider,
|
|
202
|
-
useCart,
|
|
203
|
-
AuthProvider,
|
|
204
|
-
createStorefrontAuthClient,
|
|
205
|
-
useAuth,
|
|
206
|
-
type CartContextValue,
|
|
207
|
-
type CartLoadStatus,
|
|
208
|
-
type CartMutation,
|
|
209
|
-
type StorefrontAuthClientInstance,
|
|
210
|
-
type StorefrontSession,
|
|
211
|
-
} from './providers'
|
|
212
|
-
export {
|
|
213
|
-
listRecentlyViewed,
|
|
214
|
-
trackRecentlyViewed,
|
|
215
|
-
toRecentlyViewedItem,
|
|
216
|
-
useRecentlyViewed,
|
|
217
|
-
useTrackRecentlyViewed,
|
|
218
|
-
type RecentlyViewedItem,
|
|
219
|
-
type TrackableProduct,
|
|
220
|
-
} from './hooks'
|
|
221
|
-
export { createStorefrontAuth } from './auth/create-storefront-auth'
|
|
222
|
-
export type { CreateStorefrontAuthOptions } from './auth/create-storefront-auth'
|
|
223
|
-
export {
|
|
224
|
-
BETTER_AUTH_TRUSTED_HOSTS_ENV,
|
|
225
|
-
DEFAULT_STOREFRONT_AUTH_ALLOWED_HOSTS,
|
|
226
|
-
defaultAllowedHostsFromEnv,
|
|
227
|
-
hostsFromStoreSettings,
|
|
228
|
-
mergeSettingsHostsIntoBaseURL,
|
|
229
|
-
resolveStorefrontAuthBaseURL,
|
|
230
|
-
} from './auth/storefront-auth-base-url'
|
|
231
|
-
export type {
|
|
232
|
-
StorefrontDynamicBaseURLConfig,
|
|
233
|
-
StoreSettingsHostsSource,
|
|
234
|
-
} from './auth/storefront-auth-base-url'
|
|
235
|
-
export { ecomiqOAuthPassword } from './auth/ecomiq-oauth-password-plugin'
|
|
236
|
-
export { ecomiqOAuthPasswordClient } from './auth/ecomiq-oauth-password-client'
|
|
237
|
-
export { signInWithEcomiqCredentials } from './auth/ecomiq-storefront-sign-in'
|
|
238
|
-
export type { EcomiqSignInCredentials } from './auth/ecomiq-storefront-sign-in'
|
|
239
|
-
export * from './utils'
|
|
240
|
-
export { formatMoney, type MoneyLocale } from './format-money'
|
|
241
|
-
export { Link } from './link'
|
|
242
|
-
export { Await } from '@tanstack/react-router'
|
|
243
|
-
export {
|
|
244
|
-
Hero,
|
|
245
|
-
findHeroSection,
|
|
246
|
-
type HeroProps,
|
|
247
|
-
type HeroSlide,
|
|
248
|
-
} from './components/hero'
|
|
249
|
-
export { z } from 'zod'
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Contexto del loader. Por defecto el loader es isomorfo (SSR + cliente).
|
|
253
|
-
* Preferí `serverApi` para que el fetch a storefront solo corra en el servidor.
|
|
254
|
-
*/
|
|
255
|
-
export interface LoaderContext<
|
|
256
|
-
TParams = Record<string, string>,
|
|
257
|
-
TSearch extends Record<string, unknown> = Record<string, unknown>,
|
|
258
|
-
> {
|
|
259
|
-
params: TParams
|
|
260
|
-
search: TSearch
|
|
261
|
-
config: PublicEcomiqConfig
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/** Props que recibe el componente de una página. */
|
|
265
|
-
export interface PageProps<
|
|
266
|
-
TData = unknown,
|
|
267
|
-
TParams = Record<string, string>,
|
|
268
|
-
TSearch extends Record<string, unknown> = Record<string, unknown>,
|
|
269
|
-
> {
|
|
270
|
-
data: TData
|
|
271
|
-
params: TParams
|
|
272
|
-
search: TSearch
|
|
273
|
-
/** Settings storefront (CMS, store, menus). Cargado en el root; sin request extra. */
|
|
274
|
-
settings: StorefrontSettings
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export interface PageMeta {
|
|
278
|
-
title?: string
|
|
279
|
-
description?: string
|
|
280
|
-
/** Imagen OG específica de esta página (sobreescribe branding.socialImageUrl). */
|
|
281
|
-
ogImage?: string
|
|
282
|
-
/** Marca la página como noindex,nofollow. */
|
|
283
|
-
noIndex?: boolean
|
|
284
|
-
/** Metas extra solo para esta página. */
|
|
285
|
-
meta?: Array<{ name?: string; property?: string; content: string }>
|
|
286
|
-
/** Datos estructurados (schema.org); se serializa como JSON-LD. */
|
|
287
|
-
jsonLd?: Record<string, unknown>
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/** Props que recibe un layout personalizado (layout.tsx en la raíz del proyecto). */
|
|
291
|
-
export interface LayoutProps {
|
|
292
|
-
children: ReactNode
|
|
293
|
-
config: PublicEcomiqConfig
|
|
294
|
-
/** Settings storefront (CMS, store, menus). Cargado en el root para todas las páginas. */
|
|
295
|
-
settings: StorefrontSettings
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Define el layout global de la tienda (opcional).
|
|
300
|
-
* Crea `layout.tsx` en la raíz del proyecto y el framework lo usa en lugar
|
|
301
|
-
* del layout por defecto. Recibe `children` (la página) y `config`.
|
|
302
|
-
*/
|
|
303
|
-
export function defineLayout(layout: (props: LayoutProps) => ReactNode) {
|
|
304
|
-
return layout
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export interface EcomiqPage<
|
|
308
|
-
TData = unknown,
|
|
309
|
-
TParams = Record<string, string>,
|
|
310
|
-
TSearch extends Record<string, unknown> = Record<string, unknown>,
|
|
311
|
-
> {
|
|
312
|
-
preload?: boolean
|
|
313
|
-
reloadOnSearch?: boolean
|
|
314
|
-
validateSearch?: (raw: Record<string, unknown>) => TSearch
|
|
315
|
-
/**
|
|
316
|
-
* Carga de datos. Corre en SSR y en navegaciones cliente.
|
|
317
|
-
* Usa `serverApi` (no `createClient`) para que el HTTP a storefront
|
|
318
|
-
* solo ocurra en el servidor.
|
|
319
|
-
*/
|
|
320
|
-
loader?: (ctx: LoaderContext<TParams, TSearch>) => Promise<TData> | TData
|
|
321
|
-
/** Metadatos del documento; recibe los datos ya cargados. */
|
|
322
|
-
meta?: (ctx: {
|
|
323
|
-
data: TData
|
|
324
|
-
params: TParams
|
|
325
|
-
search: TSearch
|
|
326
|
-
config: PublicEcomiqConfig
|
|
327
|
-
/**
|
|
328
|
-
* Settings storefront cargados en el root. Opcional: puede faltar si el
|
|
329
|
-
* `<head>` se calcula antes de que el match raíz tenga sus datos.
|
|
330
|
-
*/
|
|
331
|
-
settings?: StorefrontSettings
|
|
332
|
-
}) => PageMeta
|
|
333
|
-
/** UI de la página. */
|
|
334
|
-
component: (props: PageProps<TData, TParams, TSearch>) => ReactNode
|
|
335
|
-
/** UI mientras el loader está en curso (navegación cliente). */
|
|
336
|
-
loading?: () => ReactNode
|
|
337
|
-
/** UI cuando el loader falla. */
|
|
338
|
-
error?: (props: { error: Error; reset: () => void }) => ReactNode
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
export function definePage<
|
|
342
|
-
TData = unknown,
|
|
343
|
-
TParams = Record<string, string>,
|
|
344
|
-
TSearch extends Record<string, unknown> = Record<string, unknown>,
|
|
345
|
-
>(
|
|
346
|
-
page: EcomiqPage<TData, TParams, TSearch>,
|
|
347
|
-
): EcomiqPage<TData, TParams, TSearch> {
|
|
348
|
-
return page
|
|
349
|
-
}
|
package/src/link.tsx
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Skeleton } from '../../ui/skeleton'
|
|
2
|
-
import { cn } from '../../ui/cn'
|
|
3
|
-
|
|
4
|
-
function NavRowSkeleton() {
|
|
5
|
-
return (
|
|
6
|
-
<div className="flex items-center justify-between border-b border-border px-4 py-4">
|
|
7
|
-
<span className="flex items-center gap-3">
|
|
8
|
-
<Skeleton className="size-4 shrink-0 rounded" />
|
|
9
|
-
<Skeleton className="h-4 w-28" />
|
|
10
|
-
</span>
|
|
11
|
-
<Skeleton className="size-4 shrink-0 rounded" />
|
|
12
|
-
</div>
|
|
13
|
-
)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function AccountSectionSkeleton() {
|
|
17
|
-
return (
|
|
18
|
-
<div className="space-y-6 px-6" aria-busy="true" aria-label="Cargando sección">
|
|
19
|
-
<div className="space-y-2">
|
|
20
|
-
<Skeleton className="h-6 w-40" />
|
|
21
|
-
<Skeleton className="h-4 w-full max-w-md" />
|
|
22
|
-
</div>
|
|
23
|
-
<div className="overflow-hidden rounded-xl border border-border bg-background">
|
|
24
|
-
{Array.from({ length: 4 }).map((_, index) => (
|
|
25
|
-
<div
|
|
26
|
-
key={index}
|
|
27
|
-
className={cn(
|
|
28
|
-
'flex items-center justify-between gap-4 px-5 py-4',
|
|
29
|
-
index < 3 && 'border-b border-border',
|
|
30
|
-
)}
|
|
31
|
-
>
|
|
32
|
-
<div className="min-w-0 flex-1 space-y-2">
|
|
33
|
-
<Skeleton className="h-3 w-24" />
|
|
34
|
-
<Skeleton className="h-4 w-full max-w-xs" />
|
|
35
|
-
</div>
|
|
36
|
-
<Skeleton className="size-8 shrink-0 rounded-md" />
|
|
37
|
-
</div>
|
|
38
|
-
))}
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function AccountPageSkeleton() {
|
|
45
|
-
return (
|
|
46
|
-
<div
|
|
47
|
-
className="container mx-auto px-4 py-8"
|
|
48
|
-
aria-busy="true"
|
|
49
|
-
aria-label="Cargando cuenta"
|
|
50
|
-
>
|
|
51
|
-
<Skeleton className="h-4 w-24" />
|
|
52
|
-
<Skeleton className="mt-2 h-9 w-40" />
|
|
53
|
-
|
|
54
|
-
<div className="mt-8 grid grid-cols-1 gap-6 lg:grid-cols-[320px_1fr]">
|
|
55
|
-
<aside className="overflow-hidden rounded-xl border border-border bg-background lg:sticky lg:top-15 lg:self-start">
|
|
56
|
-
<nav>
|
|
57
|
-
{Array.from({ length: 5 }).map((_, index) => (
|
|
58
|
-
<NavRowSkeleton key={index} />
|
|
59
|
-
))}
|
|
60
|
-
</nav>
|
|
61
|
-
</aside>
|
|
62
|
-
|
|
63
|
-
<section className="min-w-0">
|
|
64
|
-
<AccountSectionSkeleton />
|
|
65
|
-
</section>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
}
|