@cimplify/sdk 0.44.11 → 0.44.12
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/package.json +1 -1
- package/templates/storefront-bakery/app/layout.tsx +2 -0
- package/templates/storefront-bakery/components/cart-drawer.tsx +14 -0
- package/templates/storefront-bakery/components/cart-pill.tsx +11 -7
- package/templates/storefront-bakery/components/providers.tsx +6 -2
- package/templates/storefront-grocery/app/layout.tsx +2 -0
- package/templates/storefront-grocery/components/cart-drawer.tsx +14 -0
- package/templates/storefront-grocery/components/cart-pill.tsx +11 -7
- package/templates/storefront-grocery/components/providers.tsx +6 -2
- package/templates/storefront-restaurant/app/layout.tsx +2 -0
- package/templates/storefront-restaurant/components/cart-drawer.tsx +14 -0
- package/templates/storefront-restaurant/components/cart-pill.tsx +11 -7
- package/templates/storefront-restaurant/components/providers.tsx +6 -2
- package/templates/storefront-retail/app/layout.tsx +2 -0
- package/templates/storefront-retail/components/cart-drawer.tsx +14 -0
- package/templates/storefront-retail/components/cart-pill.tsx +11 -7
- package/templates/storefront-retail/components/providers.tsx +6 -2
- package/templates/storefront-services/app/layout.tsx +2 -0
- package/templates/storefront-services/components/cart-drawer.tsx +14 -0
- package/templates/storefront-services/components/cart-pill.tsx +11 -7
- package/templates/storefront-services/components/providers.tsx +6 -2
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { Providers } from "@/components/providers";
|
|
|
5
5
|
import { Header } from "@/components/header";
|
|
6
6
|
import { Footer } from "@/components/footer";
|
|
7
7
|
import { ProductModal } from "@/components/product-modal";
|
|
8
|
+
import { CartDrawer } from "@/components/cart-drawer";
|
|
8
9
|
import { Suspense } from "react";
|
|
9
10
|
import { brand } from "@/lib/brand";
|
|
10
11
|
|
|
@@ -73,6 +74,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
73
74
|
<Suspense fallback={null}>
|
|
74
75
|
<ProductModal />
|
|
75
76
|
</Suspense>
|
|
77
|
+
<CartDrawer />
|
|
76
78
|
</Providers>
|
|
77
79
|
</body>
|
|
78
80
|
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { CartDrawer as SdkCartDrawer } from "@cimplify/sdk/react";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Side-drawer cart. Auto-opens when an item is added (via
|
|
8
|
+
* `<CartDrawerProvider>` in `providers.tsx`). The header's cart pill
|
|
9
|
+
* also calls `useCartDrawer().open()` to reveal it on click.
|
|
10
|
+
*/
|
|
11
|
+
export function CartDrawer() {
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
return <SdkCartDrawer onCheckout={() => router.push("/checkout")} />;
|
|
14
|
+
}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { useCartDrawer } from "@cimplify/sdk/react";
|
|
4
4
|
import { useCartCount } from "@/lib/cart";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Cart pill — dynamic island. Reads the live cart count via the SDK and
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* opens the side cart drawer on click (instead of navigating to /cart).
|
|
9
|
+
* Wrap in `<Suspense fallback={<CartPillSkeleton/>}>` so the cached
|
|
10
|
+
* header chrome streams without blocking on the cart fetch.
|
|
10
11
|
*/
|
|
11
12
|
export function CartPill() {
|
|
12
13
|
const { count } = useCartCount();
|
|
14
|
+
const { open } = useCartDrawer();
|
|
13
15
|
return (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
onClick={open}
|
|
19
|
+
aria-label={`Open cart, ${count} ${count === 1 ? "item" : "items"}`}
|
|
20
|
+
className="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-full bg-foreground text-background text-xs font-semibold tracking-wide transition-transform hover:scale-105 cursor-pointer"
|
|
17
21
|
>
|
|
18
22
|
Cart · {count}
|
|
19
|
-
</
|
|
23
|
+
</button>
|
|
20
24
|
);
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo, type ReactNode } from "react";
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
|
-
import { CimplifyProvider } from "@cimplify/sdk/react";
|
|
5
|
+
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Boots the Cimplify SDK client once on the client-side and exposes it via
|
|
@@ -27,5 +27,9 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
27
27
|
});
|
|
28
28
|
}, []);
|
|
29
29
|
|
|
30
|
-
return
|
|
30
|
+
return (
|
|
31
|
+
<CimplifyProvider client={client}>
|
|
32
|
+
<CartDrawerProvider>{children}</CartDrawerProvider>
|
|
33
|
+
</CimplifyProvider>
|
|
34
|
+
);
|
|
31
35
|
}
|
|
@@ -5,6 +5,7 @@ import { Providers } from "@/components/providers";
|
|
|
5
5
|
import { Header } from "@/components/header";
|
|
6
6
|
import { Footer } from "@/components/footer";
|
|
7
7
|
import { ProductModal } from "@/components/product-modal";
|
|
8
|
+
import { CartDrawer } from "@/components/cart-drawer";
|
|
8
9
|
import { Suspense } from "react";
|
|
9
10
|
import { brand } from "@/lib/brand";
|
|
10
11
|
|
|
@@ -68,6 +69,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
68
69
|
<Suspense fallback={null}>
|
|
69
70
|
<ProductModal />
|
|
70
71
|
</Suspense>
|
|
72
|
+
<CartDrawer />
|
|
71
73
|
</Providers>
|
|
72
74
|
</body>
|
|
73
75
|
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { CartDrawer as SdkCartDrawer } from "@cimplify/sdk/react";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Side-drawer cart. Auto-opens when an item is added (via
|
|
8
|
+
* `<CartDrawerProvider>` in `providers.tsx`). The header's cart pill
|
|
9
|
+
* also calls `useCartDrawer().open()` to reveal it on click.
|
|
10
|
+
*/
|
|
11
|
+
export function CartDrawer() {
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
return <SdkCartDrawer onCheckout={() => router.push("/checkout")} />;
|
|
14
|
+
}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { useCartDrawer } from "@cimplify/sdk/react";
|
|
4
4
|
import { useCartCount } from "@/lib/cart";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Cart pill — dynamic island. Reads the live cart count via the SDK and
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* opens the side cart drawer on click (instead of navigating to /cart).
|
|
9
|
+
* Wrap in `<Suspense fallback={<CartPillSkeleton/>}>` so the cached
|
|
10
|
+
* header chrome streams without blocking on the cart fetch.
|
|
10
11
|
*/
|
|
11
12
|
export function CartPill() {
|
|
12
13
|
const { count } = useCartCount();
|
|
14
|
+
const { open } = useCartDrawer();
|
|
13
15
|
return (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
onClick={open}
|
|
19
|
+
aria-label={`Open cart, ${count} ${count === 1 ? "item" : "items"}`}
|
|
20
|
+
className="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-full bg-foreground text-background text-xs font-semibold tracking-wide transition-transform hover:scale-105 cursor-pointer"
|
|
17
21
|
>
|
|
18
22
|
Cart · {count}
|
|
19
|
-
</
|
|
23
|
+
</button>
|
|
20
24
|
);
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo, type ReactNode } from "react";
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
|
-
import { CimplifyProvider } from "@cimplify/sdk/react";
|
|
5
|
+
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Boots the Cimplify SDK client once on the client-side and exposes it via
|
|
@@ -27,5 +27,9 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
27
27
|
});
|
|
28
28
|
}, []);
|
|
29
29
|
|
|
30
|
-
return
|
|
30
|
+
return (
|
|
31
|
+
<CimplifyProvider client={client}>
|
|
32
|
+
<CartDrawerProvider>{children}</CartDrawerProvider>
|
|
33
|
+
</CimplifyProvider>
|
|
34
|
+
);
|
|
31
35
|
}
|
|
@@ -5,6 +5,7 @@ import { Providers } from "@/components/providers";
|
|
|
5
5
|
import { Header } from "@/components/header";
|
|
6
6
|
import { Footer } from "@/components/footer";
|
|
7
7
|
import { ProductModal } from "@/components/product-modal";
|
|
8
|
+
import { CartDrawer } from "@/components/cart-drawer";
|
|
8
9
|
import { Suspense } from "react";
|
|
9
10
|
import { brand } from "@/lib/brand";
|
|
10
11
|
|
|
@@ -73,6 +74,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
73
74
|
<Suspense fallback={null}>
|
|
74
75
|
<ProductModal />
|
|
75
76
|
</Suspense>
|
|
77
|
+
<CartDrawer />
|
|
76
78
|
</Providers>
|
|
77
79
|
</body>
|
|
78
80
|
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { CartDrawer as SdkCartDrawer } from "@cimplify/sdk/react";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Side-drawer cart. Auto-opens when an item is added (via
|
|
8
|
+
* `<CartDrawerProvider>` in `providers.tsx`). The header's cart pill
|
|
9
|
+
* also calls `useCartDrawer().open()` to reveal it on click.
|
|
10
|
+
*/
|
|
11
|
+
export function CartDrawer() {
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
return <SdkCartDrawer onCheckout={() => router.push("/checkout")} />;
|
|
14
|
+
}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { useCartDrawer } from "@cimplify/sdk/react";
|
|
4
4
|
import { useCartCount } from "@/lib/cart";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Cart pill — dynamic island. Reads the live cart count via the SDK and
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* opens the side cart drawer on click (instead of navigating to /cart).
|
|
9
|
+
* Wrap in `<Suspense fallback={<CartPillSkeleton/>}>` so the cached
|
|
10
|
+
* header chrome streams without blocking on the cart fetch.
|
|
10
11
|
*/
|
|
11
12
|
export function CartPill() {
|
|
12
13
|
const { count } = useCartCount();
|
|
14
|
+
const { open } = useCartDrawer();
|
|
13
15
|
return (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
onClick={open}
|
|
19
|
+
aria-label={`Open cart, ${count} ${count === 1 ? "item" : "items"}`}
|
|
20
|
+
className="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-full bg-foreground text-background text-xs font-semibold tracking-wide transition-transform hover:scale-105 cursor-pointer"
|
|
17
21
|
>
|
|
18
22
|
Cart · {count}
|
|
19
|
-
</
|
|
23
|
+
</button>
|
|
20
24
|
);
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo, type ReactNode } from "react";
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
|
-
import { CimplifyProvider } from "@cimplify/sdk/react";
|
|
5
|
+
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Boots the Cimplify SDK client once on the client-side and exposes it via
|
|
@@ -27,5 +27,9 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
27
27
|
});
|
|
28
28
|
}, []);
|
|
29
29
|
|
|
30
|
-
return
|
|
30
|
+
return (
|
|
31
|
+
<CimplifyProvider client={client}>
|
|
32
|
+
<CartDrawerProvider>{children}</CartDrawerProvider>
|
|
33
|
+
</CimplifyProvider>
|
|
34
|
+
);
|
|
31
35
|
}
|
|
@@ -4,6 +4,7 @@ import "./globals.css";
|
|
|
4
4
|
import { Providers } from "@/components/providers";
|
|
5
5
|
import { Header } from "@/components/header";
|
|
6
6
|
import { Footer } from "@/components/footer";
|
|
7
|
+
import { CartDrawer } from "@/components/cart-drawer";
|
|
7
8
|
import { brand } from "@/lib/brand";
|
|
8
9
|
|
|
9
10
|
const inter = Inter({
|
|
@@ -68,6 +69,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
68
69
|
<Header />
|
|
69
70
|
<main className="flex-1 pb-12 w-full">{children}</main>
|
|
70
71
|
<Footer />
|
|
72
|
+
<CartDrawer />
|
|
71
73
|
</Providers>
|
|
72
74
|
</body>
|
|
73
75
|
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { CartDrawer as SdkCartDrawer } from "@cimplify/sdk/react";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Side-drawer cart. Auto-opens when an item is added (via
|
|
8
|
+
* `<CartDrawerProvider>` in `providers.tsx`). The header's cart pill
|
|
9
|
+
* also calls `useCartDrawer().open()` to reveal it on click.
|
|
10
|
+
*/
|
|
11
|
+
export function CartDrawer() {
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
return <SdkCartDrawer onCheckout={() => router.push("/checkout")} />;
|
|
14
|
+
}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { useCartDrawer } from "@cimplify/sdk/react";
|
|
4
4
|
import { useCartCount } from "@/lib/cart";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Cart pill — dynamic island. Reads the live cart count via the SDK and
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* opens the side cart drawer on click (instead of navigating to /cart).
|
|
9
|
+
* Wrap in `<Suspense fallback={<CartPillSkeleton/>}>` so the cached
|
|
10
|
+
* header chrome streams without blocking on the cart fetch.
|
|
10
11
|
*/
|
|
11
12
|
export function CartPill() {
|
|
12
13
|
const { count } = useCartCount();
|
|
14
|
+
const { open } = useCartDrawer();
|
|
13
15
|
return (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
onClick={open}
|
|
19
|
+
aria-label={`Open cart, ${count} ${count === 1 ? "item" : "items"}`}
|
|
20
|
+
className="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-full bg-foreground text-background text-xs font-semibold tracking-wide transition-transform hover:scale-105 cursor-pointer"
|
|
17
21
|
>
|
|
18
22
|
Cart · {count}
|
|
19
|
-
</
|
|
23
|
+
</button>
|
|
20
24
|
);
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo, type ReactNode } from "react";
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
|
-
import { CimplifyProvider } from "@cimplify/sdk/react";
|
|
5
|
+
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Boots the Cimplify SDK client once on the client-side and exposes it via
|
|
@@ -27,5 +27,9 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
27
27
|
});
|
|
28
28
|
}, []);
|
|
29
29
|
|
|
30
|
-
return
|
|
30
|
+
return (
|
|
31
|
+
<CimplifyProvider client={client}>
|
|
32
|
+
<CartDrawerProvider>{children}</CartDrawerProvider>
|
|
33
|
+
</CimplifyProvider>
|
|
34
|
+
);
|
|
31
35
|
}
|
|
@@ -5,6 +5,7 @@ import { Providers } from "@/components/providers";
|
|
|
5
5
|
import { Header } from "@/components/header";
|
|
6
6
|
import { Footer } from "@/components/footer";
|
|
7
7
|
import { ProductModal } from "@/components/product-modal";
|
|
8
|
+
import { CartDrawer } from "@/components/cart-drawer";
|
|
8
9
|
import { Suspense } from "react";
|
|
9
10
|
import { brand } from "@/lib/brand";
|
|
10
11
|
|
|
@@ -73,6 +74,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
73
74
|
<Suspense fallback={null}>
|
|
74
75
|
<ProductModal />
|
|
75
76
|
</Suspense>
|
|
77
|
+
<CartDrawer />
|
|
76
78
|
</Providers>
|
|
77
79
|
</body>
|
|
78
80
|
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { CartDrawer as SdkCartDrawer } from "@cimplify/sdk/react";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Side-drawer cart. Auto-opens when an item is added (via
|
|
8
|
+
* `<CartDrawerProvider>` in `providers.tsx`). The header's cart pill
|
|
9
|
+
* also calls `useCartDrawer().open()` to reveal it on click.
|
|
10
|
+
*/
|
|
11
|
+
export function CartDrawer() {
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
return <SdkCartDrawer onCheckout={() => router.push("/checkout")} />;
|
|
14
|
+
}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { useCartDrawer } from "@cimplify/sdk/react";
|
|
4
4
|
import { useCartCount } from "@/lib/cart";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Cart pill — dynamic island. Reads the live cart count via the SDK and
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* opens the side cart drawer on click (instead of navigating to /cart).
|
|
9
|
+
* Wrap in `<Suspense fallback={<CartPillSkeleton/>}>` so the cached
|
|
10
|
+
* header chrome streams without blocking on the cart fetch.
|
|
10
11
|
*/
|
|
11
12
|
export function CartPill() {
|
|
12
13
|
const { count } = useCartCount();
|
|
14
|
+
const { open } = useCartDrawer();
|
|
13
15
|
return (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
onClick={open}
|
|
19
|
+
aria-label={`Open cart, ${count} ${count === 1 ? "item" : "items"}`}
|
|
20
|
+
className="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-full bg-foreground text-background text-xs font-semibold tracking-wide transition-transform hover:scale-105 cursor-pointer"
|
|
17
21
|
>
|
|
18
22
|
Cart · {count}
|
|
19
|
-
</
|
|
23
|
+
</button>
|
|
20
24
|
);
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo, type ReactNode } from "react";
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
|
-
import { CimplifyProvider } from "@cimplify/sdk/react";
|
|
5
|
+
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Boots the Cimplify SDK client once on the client-side and exposes it via
|
|
@@ -27,5 +27,9 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
27
27
|
});
|
|
28
28
|
}, []);
|
|
29
29
|
|
|
30
|
-
return
|
|
30
|
+
return (
|
|
31
|
+
<CimplifyProvider client={client}>
|
|
32
|
+
<CartDrawerProvider>{children}</CartDrawerProvider>
|
|
33
|
+
</CimplifyProvider>
|
|
34
|
+
);
|
|
31
35
|
}
|