@cimplify/cli 0.7.23 → 0.7.25
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/{add-LABPJFW7.mjs → add-DMA7USQR.mjs} +1 -1
- package/dist/{chunk-FIMXBNN3.mjs → chunk-5SVTTTD2.mjs} +1 -1
- package/dist/{chunk-5VJ5VV27.mjs → chunk-ML6JUUXS.mjs} +34 -34
- package/dist/{chunk-TKFUMOQQ.mjs → chunk-NUXKAEX5.mjs} +7 -7
- package/dist/dispatcher.mjs +9 -9
- package/dist/{doctor-ARURW6E5.mjs → doctor-IOEKC6LJ.mjs} +2 -2
- package/dist/{explain-Z4FKFZOA.mjs → explain-GBKONBB3.mjs} +1 -1
- package/dist/{introspect-XL6Y35PZ.mjs → introspect-PJ6SLINK.mjs} +2 -2
- package/dist/{list-EZTRRY4Z.mjs → list-ZTKE2YVE.mjs} +1 -1
- package/dist/{update-6NCPLWGV.mjs → update-BZ53TKVN.mjs} +1 -1
- package/package.json +7 -7
- package/templates/storefront-auto/app/products/[slug]/page.tsx +4 -9
- package/templates/storefront-auto/bun.lock +2 -2
- package/templates/storefront-auto/components/account-pill.tsx +1 -1
- package/templates/storefront-auto/lib/product-offer.ts +46 -0
- package/templates/storefront-auto/package.json +1 -1
- package/templates/storefront-bakery/bun.lock +2 -2
- package/templates/storefront-bakery/components/account-pill.tsx +1 -1
- package/templates/storefront-bakery/package.json +1 -1
- package/templates/storefront-fashion/app/products/[slug]/page.tsx +4 -9
- package/templates/storefront-fashion/bun.lock +2 -2
- package/templates/storefront-fashion/components/account-pill.tsx +1 -1
- package/templates/storefront-fashion/lib/product-offer.ts +46 -0
- package/templates/storefront-fashion/package.json +1 -1
- package/templates/storefront-grocery/bun.lock +2 -2
- package/templates/storefront-grocery/components/account-pill.tsx +1 -1
- package/templates/storefront-grocery/package.json +1 -1
- package/templates/storefront-pharmacy/app/products/[slug]/page.tsx +4 -9
- package/templates/storefront-pharmacy/bun.lock +2 -2
- package/templates/storefront-pharmacy/components/account-pill.tsx +1 -1
- package/templates/storefront-pharmacy/lib/product-offer.ts +46 -0
- package/templates/storefront-pharmacy/package.json +1 -1
- package/templates/storefront-restaurant/bun.lock +2 -2
- package/templates/storefront-restaurant/components/account-pill.tsx +1 -1
- package/templates/storefront-restaurant/package.json +1 -1
- package/templates/storefront-retail/app/products/[slug]/page.tsx +4 -9
- package/templates/storefront-retail/bun.lock +2 -2
- package/templates/storefront-retail/components/account-pill.tsx +1 -1
- package/templates/storefront-retail/lib/product-offer.ts +46 -0
- package/templates/storefront-retail/package.json +1 -1
- package/templates/storefront-services/bun.lock +2 -2
- package/templates/storefront-services/components/account-pill.tsx +1 -1
- package/templates/storefront-services/package.json +1 -1
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { ProductDetail } from "./product-detail";
|
|
12
12
|
import { brand } from "@/lib/brand";
|
|
13
13
|
import { getSiteUrl } from "@/lib/site-url";
|
|
14
|
+
import { buildProductOffer } from "@/lib/product-offer";
|
|
14
15
|
|
|
15
16
|
// Pre-enumerate every product slug at build time so Next can emit cacheable
|
|
16
17
|
// responses (s-maxage instead of no-store) for the route. Without this, every
|
|
@@ -29,7 +30,6 @@ export const revalidate = 3600;
|
|
|
29
30
|
|
|
30
31
|
function productLd(product: ProductWithDetails, SITE_URL: string) {
|
|
31
32
|
const image = product.image_url ?? product.images?.[0];
|
|
32
|
-
const inStock = product.inventory_status?.in_stock !== false;
|
|
33
33
|
return {
|
|
34
34
|
"@context": "https://schema.org",
|
|
35
35
|
"@type": "Product",
|
|
@@ -38,15 +38,10 @@ function productLd(product: ProductWithDetails, SITE_URL: string) {
|
|
|
38
38
|
image: image ? [image] : undefined,
|
|
39
39
|
sku: product.id,
|
|
40
40
|
brand: { "@type": "Brand", name: brand.name },
|
|
41
|
-
offers: {
|
|
42
|
-
"@type": "Offer",
|
|
43
|
-
price: product.default_price,
|
|
44
|
-
priceCurrency: brand.currency,
|
|
45
|
-
availability: inStock
|
|
46
|
-
? "https://schema.org/InStock"
|
|
47
|
-
: "https://schema.org/OutOfStock",
|
|
41
|
+
offers: buildProductOffer(product, {
|
|
48
42
|
url: `${SITE_URL}/products/${product.slug ?? product.id}`,
|
|
49
|
-
|
|
43
|
+
currency: brand.currency,
|
|
44
|
+
}),
|
|
50
45
|
};
|
|
51
46
|
}
|
|
52
47
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "__STOREFRONT_NAME__",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@cimplify/sdk": "^0.
|
|
8
|
+
"@cimplify/sdk": "^0.84.0",
|
|
9
9
|
"next": "^16.2.6",
|
|
10
10
|
"react": "^19.0.0",
|
|
11
11
|
"react-dom": "^19.0.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
"@base-ui/utils": ["@base-ui/utils@0.2.9", "", { "dependencies": { "@babel/runtime": "^7.29.2", "@floating-ui/utils": "^0.2.11", "reselect": "^5.1.1", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "@types/react": "^17 || ^18 || ^19", "react": "^17 || ^18 || ^19", "react-dom": "^17 || ^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-x/PDDCYzoqPpjrdyb3VcyylTI2IjUXEtYDGi5foh7KsnmNJIIaVwA2GLgDH1dps1GgXiJbA60hM+AyuTfQzIvw=="],
|
|
33
33
|
|
|
34
|
-
"@cimplify/sdk": ["@cimplify/sdk@0.
|
|
34
|
+
"@cimplify/sdk": ["@cimplify/sdk@0.84.0", "", { "dependencies": { "@base-ui/react": "^1.4.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", "jose": "^6.2.3", "libphonenumber-js": "1.12.41", "react-day-picker": "^9.14.0", "tailwind-merge": "^3.5.0", "xss": "^1.0.15", "zod": "^4.4.3" }, "peerDependencies": { "@paystack/inline-js": "^2.22.8", "msw": ">=2.0.0", "react": ">=17.0.0", "react-dom": ">=17.0.0", "vitest": ">=2.0.0" }, "optionalPeers": ["@paystack/inline-js", "msw", "react", "react-dom", "vitest"], "bin": { "cimplify-mock": "dist/mock/cli.mjs" } }, "sha512-0fhHjNgBrxLt3pjI51gVfAj8lrd81NCw0DzsTdLIiM59UqOwCWCt166NqPOZg6VxpMITeE+z+fDKJn1tJpV/0Q=="],
|
|
35
35
|
|
|
36
36
|
"@date-fns/tz": ["@date-fns/tz@1.4.1", "", {}, "sha512-P5LUNhtbj6YfI3iJjw5EL9eUAG6OitD0W3fWQcpQjDRc/QIsL0tRNuO1PcDvPccWL1fSTXXdE1ds+l95DV/OFA=="],
|
|
37
37
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { parsePrice, type ProductWithDetails } from "@cimplify/sdk";
|
|
2
|
+
|
|
3
|
+
const IN_STOCK = "https://schema.org/InStock";
|
|
4
|
+
const OUT_OF_STOCK = "https://schema.org/OutOfStock";
|
|
5
|
+
|
|
6
|
+
interface SaleOverlay {
|
|
7
|
+
price: string | number;
|
|
8
|
+
ends_at: string;
|
|
9
|
+
// Present only for capped, claims-driven sales, whose price moves per purchase.
|
|
10
|
+
cap?: { claimed: number; of: number } | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ProductOffer {
|
|
14
|
+
"@type": "Offer";
|
|
15
|
+
price: number;
|
|
16
|
+
priceCurrency: string;
|
|
17
|
+
priceValidUntil?: string;
|
|
18
|
+
availability: string;
|
|
19
|
+
url: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* schema.org Offer for a product page. Indexes the price a shopper actually
|
|
24
|
+
* sees: a scheduled/time sale carries the sale price plus a validity window; a
|
|
25
|
+
* capped (claims-driven) sale keeps the base price out of the index, since its
|
|
26
|
+
* number moves on every purchase and would mismatch the product feed.
|
|
27
|
+
*/
|
|
28
|
+
export function buildProductOffer(
|
|
29
|
+
product: ProductWithDetails & { sale?: SaleOverlay | null },
|
|
30
|
+
opts: { url: string; currency: string },
|
|
31
|
+
): ProductOffer {
|
|
32
|
+
const inStock = product.inventory_status?.in_stock !== false;
|
|
33
|
+
const sale = product.sale;
|
|
34
|
+
const indexableSale = sale && !sale.cap ? sale : null;
|
|
35
|
+
const offer: ProductOffer = {
|
|
36
|
+
"@type": "Offer",
|
|
37
|
+
price: parsePrice(indexableSale ? indexableSale.price : product.default_price),
|
|
38
|
+
priceCurrency: opts.currency,
|
|
39
|
+
availability: inStock ? IN_STOCK : OUT_OF_STOCK,
|
|
40
|
+
url: opts.url,
|
|
41
|
+
};
|
|
42
|
+
if (indexableSale) {
|
|
43
|
+
offer.priceValidUntil = indexableSale.ends_at;
|
|
44
|
+
}
|
|
45
|
+
return offer;
|
|
46
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "__STOREFRONT_NAME__",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@cimplify/sdk": "^0.
|
|
8
|
+
"@cimplify/sdk": "^0.84.0",
|
|
9
9
|
"next": "^16.2.6",
|
|
10
10
|
"react": "^19.0.0",
|
|
11
11
|
"react-dom": "^19.0.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
"@base-ui/utils": ["@base-ui/utils@0.2.9", "", { "dependencies": { "@babel/runtime": "^7.29.2", "@floating-ui/utils": "^0.2.11", "reselect": "^5.1.1", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "@types/react": "^17 || ^18 || ^19", "react": "^17 || ^18 || ^19", "react-dom": "^17 || ^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-x/PDDCYzoqPpjrdyb3VcyylTI2IjUXEtYDGi5foh7KsnmNJIIaVwA2GLgDH1dps1GgXiJbA60hM+AyuTfQzIvw=="],
|
|
33
33
|
|
|
34
|
-
"@cimplify/sdk": ["@cimplify/sdk@0.
|
|
34
|
+
"@cimplify/sdk": ["@cimplify/sdk@0.84.0", "", { "dependencies": { "@base-ui/react": "^1.4.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", "jose": "^6.2.3", "libphonenumber-js": "1.12.41", "react-day-picker": "^9.14.0", "tailwind-merge": "^3.5.0", "xss": "^1.0.15", "zod": "^4.4.3" }, "peerDependencies": { "@paystack/inline-js": "^2.22.8", "msw": ">=2.0.0", "react": ">=17.0.0", "react-dom": ">=17.0.0", "vitest": ">=2.0.0" }, "optionalPeers": ["@paystack/inline-js", "msw", "react", "react-dom", "vitest"], "bin": { "cimplify-mock": "dist/mock/cli.mjs" } }, "sha512-0fhHjNgBrxLt3pjI51gVfAj8lrd81NCw0DzsTdLIiM59UqOwCWCt166NqPOZg6VxpMITeE+z+fDKJn1tJpV/0Q=="],
|
|
35
35
|
|
|
36
36
|
"@date-fns/tz": ["@date-fns/tz@1.4.1", "", {}, "sha512-P5LUNhtbj6YfI3iJjw5EL9eUAG6OitD0W3fWQcpQjDRc/QIsL0tRNuO1PcDvPccWL1fSTXXdE1ds+l95DV/OFA=="],
|
|
37
37
|
|