@fayz-ai/storefront 0.9.0-next.0 → 0.9.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/dist/component-contracts.d.ts +14 -0
- package/dist/component-contracts.d.ts.map +1 -1
- package/dist/components/CartDrawer.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/component-contracts.ts +15 -1
- package/src/components/CartDrawer.tsx +7 -1
- package/src/pages/CheckoutPage.tsx +1 -1
- package/src/pages/ProductDetailPage.tsx +1 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"fayz": {
|
|
4
4
|
"status": "beta"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.9.0
|
|
6
|
+
"version": "0.9.0",
|
|
7
7
|
"description": "Fayz SDK storefront kit — Shopify-style customer-facing ecommerce template components",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@fayz-ai/
|
|
41
|
-
"@fayz-ai/
|
|
42
|
-
"@fayz-ai/auth": "^0.9.0
|
|
43
|
-
"@fayz-ai/
|
|
44
|
-
"@fayz-ai/
|
|
45
|
-
"@fayz-ai/
|
|
40
|
+
"@fayz-ai/auth": "^0.9.0",
|
|
41
|
+
"@fayz-ai/core": "^0.9.0",
|
|
42
|
+
"@fayz-ai/plugin-auth": "^0.9.0",
|
|
43
|
+
"@fayz-ai/sdk": "^0.9.0",
|
|
44
|
+
"@fayz-ai/shop": "^0.9.0",
|
|
45
|
+
"@fayz-ai/ui": "^0.9.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": "^18.0.0 || ^19.0.0",
|
|
49
49
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
50
|
-
"zustand": "^4.5.0",
|
|
50
|
+
"zustand": "^4.5.0 || ^5.0.0",
|
|
51
51
|
"@supabase/supabase-js": "^2.45.0",
|
|
52
52
|
"lucide-react": ">=0.400.0 <1.0.0"
|
|
53
53
|
},
|
|
@@ -3,6 +3,7 @@ import type { Category, CreateProductEnquiryInput, Product, ProductEnquiry, Prod
|
|
|
3
3
|
import type { ProductOptionGroup, ProductOptionSelection } from './product-options'
|
|
4
4
|
import type { ResolvedStorefrontConfig, StorefrontCommerceMode } from './config'
|
|
5
5
|
import type { MediaCarouselItem } from './sections'
|
|
6
|
+
import type { CartState } from './stores/cart.store'
|
|
6
7
|
|
|
7
8
|
export interface StorefrontComponentBaseProps {
|
|
8
9
|
config: ResolvedStorefrontConfig
|
|
@@ -118,6 +119,19 @@ export interface StorefrontStateProps extends StorefrontComponentBaseProps {
|
|
|
118
119
|
children?: React.ReactNode
|
|
119
120
|
}
|
|
120
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Extra content rendered inside CartDrawer's footer, right after the
|
|
124
|
+
* "Finalizar compra" button — e.g. an alternative checkout path like
|
|
125
|
+
* "Finalizar via WhatsApp". Unlike every other entry in
|
|
126
|
+
* StorefrontComponents, this isn't a whole-component replacement:
|
|
127
|
+
* CartDrawer is always the SDK's own, this only adds optional content
|
|
128
|
+
* inside it. Only rendered when the cart has lines (same condition as the
|
|
129
|
+
* checkout button itself).
|
|
130
|
+
*/
|
|
131
|
+
export interface CartDrawerFooterExtraProps extends StorefrontComponentBaseProps {
|
|
132
|
+
cart: CartState
|
|
133
|
+
}
|
|
134
|
+
|
|
121
135
|
export interface StorefrontComponents {
|
|
122
136
|
ProductCard?: React.ComponentType<ProductCardProps>
|
|
123
137
|
ProductDetail?: React.ComponentType<ProductDetailProps>
|
|
@@ -136,5 +150,5 @@ export interface StorefrontComponents {
|
|
|
136
150
|
EmptyState?: React.ComponentType<StorefrontStateProps>
|
|
137
151
|
LoadingState?: React.ComponentType<StorefrontStateProps>
|
|
138
152
|
ErrorState?: React.ComponentType<StorefrontStateProps>
|
|
139
|
-
|
|
153
|
+
CartDrawerFooterExtra?: React.ComponentType<CartDrawerFooterExtraProps>
|
|
140
154
|
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '../stores/cart.store'
|
|
10
10
|
import { useDiscountValidator } from '../hooks/useDiscountValidator'
|
|
11
11
|
import { toast } from '../stores/toast.store'
|
|
12
|
-
import { useStorefrontConfig } from '../config'
|
|
12
|
+
import { getStorefrontComponents, useStorefrontConfig } from '../config'
|
|
13
13
|
import { navigateTo } from '../router'
|
|
14
14
|
import { formatMoney } from '../format'
|
|
15
15
|
import { QuantityInput } from './QuantityInput'
|
|
@@ -22,6 +22,8 @@ import { SmoothImage } from './SmoothImage'
|
|
|
22
22
|
export function CartDrawer() {
|
|
23
23
|
const config = useStorefrontConfig()
|
|
24
24
|
const cart = useCartStore()
|
|
25
|
+
const components = getStorefrontComponents(config)
|
|
26
|
+
const FooterExtra = components.CartDrawerFooterExtra
|
|
25
27
|
const validate = useDiscountValidator()
|
|
26
28
|
const [code, setCode] = useState('')
|
|
27
29
|
const [discountError, setDiscountError] = useState<string | null>(null)
|
|
@@ -264,6 +266,10 @@ export function CartDrawer() {
|
|
|
264
266
|
>
|
|
265
267
|
Finalizar compra
|
|
266
268
|
</button>
|
|
269
|
+
|
|
270
|
+
{FooterExtra && (
|
|
271
|
+
<FooterExtra cart={cart} config={config} commerceMode={config.commerceMode} />
|
|
272
|
+
)}
|
|
267
273
|
</div>
|
|
268
274
|
</>
|
|
269
275
|
)}
|
|
@@ -417,7 +417,7 @@ export function CheckoutPage() {
|
|
|
417
417
|
</div>
|
|
418
418
|
</header>
|
|
419
419
|
|
|
420
|
-
<div className="mx-auto grid max-w-6xl gap-8 px-4 py-8 sm:px-6 lg:grid-cols-5 lg:px-6">
|
|
420
|
+
<div className="mx-auto grid max-w-6xl grid-cols-1 gap-8 px-4 py-8 sm:px-6 lg:grid-cols-5 lg:px-6">
|
|
421
421
|
<section className="lg:col-span-3 lg:pr-10">
|
|
422
422
|
<nav className="mb-8 flex flex-wrap items-center gap-2 text-sm text-muted-foreground" aria-label="Checkout steps">
|
|
423
423
|
<span className="font-medium text-foreground">Informações</span>
|
|
@@ -109,7 +109,7 @@ export function ProductDetailPage({ slug }: { slug: string }) {
|
|
|
109
109
|
<ChevronLeft className="h-4 w-4" /> Continuar comprando
|
|
110
110
|
</Link>
|
|
111
111
|
|
|
112
|
-
<div className="grid animate-fade-up gap-10 md:grid-cols-2">
|
|
112
|
+
<div className="grid animate-fade-up grid-cols-1 gap-10 md:grid-cols-2">
|
|
113
113
|
<GalleryComponent
|
|
114
114
|
product={product}
|
|
115
115
|
images={product.images}
|