create-abcart-theme 0.10.1 → 1.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.
Files changed (251) hide show
  1. package/CHANGELOG.md +133 -127
  2. package/LICENSE +202 -202
  3. package/NOTICE +2 -2
  4. package/README.md +65 -65
  5. package/bin/create-abcart-theme.mjs +4 -4
  6. package/package.json +49 -49
  7. package/src/args.mjs +113 -113
  8. package/src/banner.mjs +21 -21
  9. package/src/cli.mjs +119 -119
  10. package/src/create.mjs +85 -82
  11. package/src/package-manager.mjs +32 -32
  12. package/src/style.mjs +17 -17
  13. package/templates/default/.agents/skills/{wocart-docs → abcart-docs}/SKILL.md +146 -146
  14. package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/SKILL.md +58 -58
  15. package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/inputs-and-rights.md +47 -47
  16. package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/layout-rtl-and-phone.md +36 -36
  17. package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/measure-the-design.md +60 -60
  18. package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/tokens-sections-content.md +103 -103
  19. package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/verify-and-report.md +102 -102
  20. package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/scripts/compare-design.cjs +230 -230
  21. package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/scripts/qa-pages.cjs +219 -219
  22. package/templates/default/.agents/skills/shopify-theme-asset-collector/SKILL.md +125 -125
  23. package/templates/default/.agents/skills/shopify-theme-asset-collector/scripts/collect_public_assets.py +370 -370
  24. package/templates/default/.dev.vars.example +12 -12
  25. package/templates/default/AGENTS.md +240 -240
  26. package/templates/default/README.md +184 -184
  27. package/templates/default/_gitignore +11 -11
  28. package/templates/default/astro.config.mjs +85 -85
  29. package/templates/default/package.json +36 -36
  30. package/templates/default/public/fonts/OFL.txt +96 -96
  31. package/templates/default/src/actions/index.ts +22 -22
  32. package/templates/default/src/components/cart/AddToCartButton.astro +45 -45
  33. package/templates/default/src/components/cart/CartDrawer.astro +47 -47
  34. package/templates/default/src/components/cart/CartSummary.astro +11 -11
  35. package/templates/default/src/components/cart/FreeShipping.astro +7 -7
  36. package/templates/default/src/components/checkout/CheckoutMain.astro +29 -29
  37. package/templates/default/src/components/checkout/OrderForm.astro +280 -280
  38. package/templates/default/src/components/checkout/ThankYouMain.astro +68 -68
  39. package/templates/default/src/components/landing/LandingImages.astro +51 -51
  40. package/templates/default/src/components/landing/LandingOrder.astro +46 -46
  41. package/templates/default/src/components/landing/LandingProduct.astro +41 -41
  42. package/templates/default/src/components/listing/ListingMain.astro +93 -93
  43. package/templates/default/src/components/listing/PageMain.astro +52 -52
  44. package/templates/default/src/components/listing/Pagination.astro +31 -31
  45. package/templates/default/src/components/listing/SortControl.astro +35 -35
  46. package/templates/default/src/components/product/BuyBox.astro +96 -96
  47. package/templates/default/src/components/product/Description.astro +24 -24
  48. package/templates/default/src/components/product/Gallery.astro +66 -66
  49. package/templates/default/src/components/product/MobileBuyBar.astro +29 -29
  50. package/templates/default/src/components/product/OfferChoice.astro +66 -66
  51. package/templates/default/src/components/product/ProductMain.astro +40 -40
  52. package/templates/default/src/components/product/ProductReviews.astro +72 -72
  53. package/templates/default/src/components/product/RelatedProducts.astro +30 -30
  54. package/templates/default/src/components/product/blocks/BenefitsBlock.astro +13 -13
  55. package/templates/default/src/components/product/blocks/CollapsibleBlock.astro +20 -20
  56. package/templates/default/src/components/product/blocks/DescriptionBlock.astro +19 -19
  57. package/templates/default/src/components/product/blocks/DetailsBlock.astro +33 -33
  58. package/templates/default/src/components/product/blocks/GalleryBlock.astro +12 -12
  59. package/templates/default/src/components/product/blocks/OrderBlock.astro +30 -30
  60. package/templates/default/src/components/product/blocks/PriceBlock.astro +23 -23
  61. package/templates/default/src/components/product/blocks/RatingBlock.astro +16 -16
  62. package/templates/default/src/components/product/blocks/StockBlock.astro +22 -22
  63. package/templates/default/src/components/product/blocks/TextBlock.astro +11 -11
  64. package/templates/default/src/components/product/blocks/TitleBlock.astro +20 -20
  65. package/templates/default/src/components/reviews/ReviewCard.astro +46 -46
  66. package/templates/default/src/components/reviews/ReviewForm.astro +113 -113
  67. package/templates/default/src/components/reviews/VoiceNote.astro +60 -60
  68. package/templates/default/src/components/sections/CollectionCards.astro +65 -65
  69. package/templates/default/src/components/sections/Countdown.astro +57 -57
  70. package/templates/default/src/components/sections/Faq.astro +44 -44
  71. package/templates/default/src/components/sections/FeaturedProduct.astro +71 -71
  72. package/templates/default/src/components/sections/Hero.astro +99 -99
  73. package/templates/default/src/components/sections/ImageBanner.astro +46 -46
  74. package/templates/default/src/components/sections/ProductGrid.astro +47 -47
  75. package/templates/default/src/components/sections/RichText.astro +35 -35
  76. package/templates/default/src/components/sections/Steps.astro +46 -46
  77. package/templates/default/src/components/sections/Testimonials.astro +57 -57
  78. package/templates/default/src/components/shell/Footer.astro +80 -80
  79. package/templates/default/src/components/shell/Header.astro +89 -89
  80. package/templates/default/src/components/shell/LanguageMenu.astro +33 -33
  81. package/templates/default/src/components/shell/MobileMenu.astro +65 -65
  82. package/templates/default/src/components/shell/SearchDialog.astro +19 -19
  83. package/templates/default/src/components/shell/TopBar.astro +54 -54
  84. package/templates/default/src/components/shell/WhatsAppWidget.astro +111 -111
  85. package/templates/default/src/components/store/ContactMain.astro +79 -79
  86. package/templates/default/src/components/store/SearchMain.astro +56 -56
  87. package/templates/default/src/components/store/TrackOrderMain.astro +161 -161
  88. package/templates/default/src/components/surface/Area.astro +20 -20
  89. package/templates/default/src/components/surface/PreviewBridge.astro +24 -24
  90. package/templates/default/src/components/surface/Sections.astro +35 -35
  91. package/templates/default/src/components/ui/Breadcrumbs.astro +36 -36
  92. package/templates/default/src/components/ui/Button.astro +45 -45
  93. package/templates/default/src/components/ui/EditorPlaceholder.astro +24 -24
  94. package/templates/default/src/components/ui/Icon.astro +93 -93
  95. package/templates/default/src/components/ui/Logo.astro +36 -36
  96. package/templates/default/src/components/ui/Photo.astro +46 -46
  97. package/templates/default/src/components/ui/Price.astro +24 -24
  98. package/templates/default/src/components/ui/ProductCard.astro +41 -41
  99. package/templates/default/src/components/ui/Rating.astro +22 -22
  100. package/templates/default/src/components/ui/Section.astro +34 -34
  101. package/templates/default/src/components/ui/SectionHeading.astro +19 -19
  102. package/templates/default/src/env.d.ts +23 -23
  103. package/templates/default/src/layouts/StoreLayout.astro +145 -145
  104. package/templates/default/src/lib/browser-copy.ts +37 -37
  105. package/templates/default/src/lib/context.ts +89 -89
  106. package/templates/default/src/lib/coupon-notice.ts +47 -47
  107. package/templates/default/src/lib/i18n.ts +32 -32
  108. package/templates/default/src/lib/images.ts +38 -38
  109. package/templates/default/src/lib/listing-query.ts +41 -41
  110. package/templates/default/src/lib/money.ts +16 -16
  111. package/templates/default/src/lib/motion.ts +16 -16
  112. package/templates/default/src/lib/nav.ts +26 -26
  113. package/templates/default/src/lib/offer-tiles.ts +105 -105
  114. package/templates/default/src/lib/order-outcome.ts +66 -66
  115. package/templates/default/src/lib/otp-message.ts +21 -21
  116. package/templates/default/src/lib/products.ts +38 -38
  117. package/templates/default/src/lib/review-refusals.ts +31 -31
  118. package/templates/default/src/lib/store.ts +31 -31
  119. package/templates/default/src/lib/whatsapp.ts +29 -29
  120. package/templates/default/src/middleware.ts +23 -23
  121. package/templates/default/src/pages/404.astro +22 -22
  122. package/templates/default/src/pages/{wocart-preview.astro → abcart-preview.astro} +43 -43
  123. package/templates/default/src/pages/{wocart-revalidate.ts → abcart-revalidate.ts} +10 -10
  124. package/templates/default/src/pages/{wocart-styles.css.ts → abcart-styles.css.ts} +5 -5
  125. package/templates/default/src/pages/{wocart-theme.json.ts → abcart-theme.json.ts} +5 -5
  126. package/templates/default/src/pages/api/abandoned/convert.ts +4 -4
  127. package/templates/default/src/pages/api/abandoned/upsert.ts +4 -4
  128. package/templates/default/src/pages/api/cart/validate.ts +4 -4
  129. package/templates/default/src/pages/api/communes/[wilayaId].ts +4 -4
  130. package/templates/default/src/pages/api/otp/send.ts +4 -4
  131. package/templates/default/src/pages/api/otp/verify.ts +4 -4
  132. package/templates/default/src/pages/api/reviews/[productId].ts +3 -3
  133. package/templates/default/src/pages/api/reviews/eligibility.ts +3 -3
  134. package/templates/default/src/pages/api/reviews/submit.ts +3 -3
  135. package/templates/default/src/pages/api/reviews/upload.ts +3 -3
  136. package/templates/default/src/pages/category/[slug].astro +20 -20
  137. package/templates/default/src/pages/checkout.astro +25 -25
  138. package/templates/default/src/pages/collections/[handle].astro +20 -20
  139. package/templates/default/src/pages/contact.astro +17 -17
  140. package/templates/default/src/pages/index.astro +9 -9
  141. package/templates/default/src/pages/lp/[slug].astro +47 -47
  142. package/templates/default/src/pages/pages/[slug].astro +16 -16
  143. package/templates/default/src/pages/products/[handle].astro +37 -37
  144. package/templates/default/src/pages/products/index.astro +15 -15
  145. package/templates/default/src/pages/robots.txt.ts +9 -9
  146. package/templates/default/src/pages/search.astro +19 -19
  147. package/templates/default/src/pages/sitemap.xml.ts +12 -12
  148. package/templates/default/src/pages/thank-you.astro +33 -33
  149. package/templates/default/src/pages/track-order.astro +17 -17
  150. package/templates/default/src/scripts/cart.ts +371 -371
  151. package/templates/default/src/scripts/checkout/coupon.ts +96 -96
  152. package/templates/default/src/scripts/checkout/delivery.ts +86 -86
  153. package/templates/default/src/scripts/checkout/form.ts +54 -54
  154. package/templates/default/src/scripts/checkout/otp.ts +106 -106
  155. package/templates/default/src/scripts/checkout/picker.ts +169 -169
  156. package/templates/default/src/scripts/checkout/quote.ts +169 -169
  157. package/templates/default/src/scripts/checkout/submit.ts +113 -113
  158. package/templates/default/src/scripts/checkout/tracking.ts +74 -74
  159. package/templates/default/src/scripts/countdown.ts +29 -29
  160. package/templates/default/src/scripts/events.ts +4 -4
  161. package/templates/default/src/scripts/hero.ts +49 -49
  162. package/templates/default/src/scripts/listing.ts +13 -13
  163. package/templates/default/src/scripts/order-form.ts +100 -100
  164. package/templates/default/src/scripts/product.ts +306 -306
  165. package/templates/default/src/scripts/public-config.ts +79 -79
  166. package/templates/default/src/scripts/reviews.ts +358 -358
  167. package/templates/default/src/scripts/site.ts +131 -131
  168. package/templates/default/src/scripts/thank-you.ts +11 -11
  169. package/templates/default/src/scripts/voice-note.ts +94 -94
  170. package/templates/default/src/styles/base.css +1030 -1030
  171. package/templates/default/src/styles/checkout.css +1111 -1111
  172. package/templates/default/src/styles/global.css +12 -12
  173. package/templates/default/src/styles/product.css +871 -871
  174. package/templates/default/src/styles/reviews.css +533 -533
  175. package/templates/default/src/styles/sections.css +931 -931
  176. package/templates/default/src/styles/shell.css +970 -970
  177. package/templates/default/src/styles/tokens.css +583 -583
  178. package/templates/default/src/theme/api-routes.ts +10 -10
  179. package/templates/default/src/theme/content/catalog.ts +117 -117
  180. package/templates/default/src/theme/content/checkout.ts +168 -168
  181. package/templates/default/src/theme/content/editor.ts +21 -21
  182. package/templates/default/src/theme/content/index.ts +45 -45
  183. package/templates/default/src/theme/content/reviews.ts +76 -76
  184. package/templates/default/src/theme/content/shell.ts +59 -59
  185. package/templates/default/src/theme/content/types.ts +12 -12
  186. package/templates/default/src/theme/documents/catalog.json +11 -11
  187. package/templates/default/src/theme/documents/category.json +11 -11
  188. package/templates/default/src/theme/documents/checkout.json +11 -11
  189. package/templates/default/src/theme/documents/collection.json +11 -11
  190. package/templates/default/src/theme/documents/contact.json +11 -11
  191. package/templates/default/src/theme/documents/footer.area.json +11 -11
  192. package/templates/default/src/theme/documents/header.area.json +16 -16
  193. package/templates/default/src/theme/documents/home.json +313 -313
  194. package/templates/default/src/theme/documents/landing.json +8 -8
  195. package/templates/default/src/theme/documents/page.json +11 -11
  196. package/templates/default/src/theme/documents/product.json +125 -125
  197. package/templates/default/src/theme/documents/search.json +11 -11
  198. package/templates/default/src/theme/documents/thank-you.json +11 -11
  199. package/templates/default/src/theme/documents/track-order.json +11 -11
  200. package/templates/default/src/theme/fields.ts +61 -61
  201. package/templates/default/src/theme/key.ts +11 -11
  202. package/templates/default/src/theme/labels.ts +231 -231
  203. package/templates/default/src/theme/locales.ts +11 -11
  204. package/templates/default/src/theme/palette.ts +14 -14
  205. package/templates/default/src/theme/sections/collection-cards.ts +65 -65
  206. package/templates/default/src/theme/sections/faq.ts +74 -74
  207. package/templates/default/src/theme/sections/featured-product.ts +42 -42
  208. package/templates/default/src/theme/sections/hero.ts +47 -47
  209. package/templates/default/src/theme/sections/image-banner.ts +25 -25
  210. package/templates/default/src/theme/sections/index.ts +40 -40
  211. package/templates/default/src/theme/sections/landing.ts +150 -150
  212. package/templates/default/src/theme/sections/listing.ts +84 -84
  213. package/templates/default/src/theme/sections/product-grid.ts +42 -42
  214. package/templates/default/src/theme/sections/product.ts +297 -297
  215. package/templates/default/src/theme/sections/rich-text.ts +39 -39
  216. package/templates/default/src/theme/sections/shared.ts +54 -54
  217. package/templates/default/src/theme/sections/shell.ts +85 -85
  218. package/templates/default/src/theme/sections/store-pages.ts +101 -101
  219. package/templates/default/src/theme/sections/testimonials.ts +61 -61
  220. package/templates/default/src/theme/sections/thank-you.ts +35 -35
  221. package/templates/default/src/theme/settings.ts +124 -124
  222. package/templates/default/src/theme/theme.ts +65 -65
  223. package/templates/default/tests/fixtures/canvas-tote.json +62 -62
  224. package/templates/default/tests/fixtures/linen-shirt.json +128 -128
  225. package/templates/default/tests/unit/checkout.test.ts +241 -241
  226. package/templates/default/tests/unit/contract.test.ts +170 -169
  227. package/templates/default/tests/unit/contrast.test.ts +68 -68
  228. package/templates/default/tests/unit/copy.test.ts +101 -101
  229. package/templates/default/tests/unit/design-values.test.ts +95 -95
  230. package/templates/default/tests/unit/editability.test.ts +180 -180
  231. package/templates/default/tests/unit/fixtures.ts +91 -91
  232. package/templates/default/tests/unit/footer.test.ts +54 -54
  233. package/templates/default/tests/unit/guards.test.ts +340 -340
  234. package/templates/default/tests/unit/images.test.ts +26 -26
  235. package/templates/default/tests/unit/landing.test.ts +151 -151
  236. package/templates/default/tests/unit/languages.test.ts +42 -42
  237. package/templates/default/tests/unit/middleware.test.ts +53 -53
  238. package/templates/default/tests/unit/offer-tiles.test.ts +75 -75
  239. package/templates/default/tests/unit/render.ts +38 -38
  240. package/templates/default/tests/unit/reviews.test.ts +25 -25
  241. package/templates/default/tests/unit/rules.test.ts +59 -59
  242. package/templates/default/tests/unit/source.ts +75 -75
  243. package/templates/default/tests/unit/store-pages.test.ts +147 -147
  244. package/templates/default/tests/unit/studio.test.ts +202 -202
  245. package/templates/default/tests/unit/testimonials.test.ts +52 -52
  246. package/templates/default/tests/unit/thank-you.test.ts +52 -52
  247. package/templates/default/tests/unit/tracking.test.ts +29 -29
  248. package/templates/default/tests/unit/voice-note.test.ts +42 -42
  249. package/templates/default/tsconfig.json +13 -13
  250. package/templates/default/vitest.config.ts +15 -15
  251. package/templates/default/wrangler.jsonc +16 -16
@@ -1,61 +1,61 @@
1
- /** The store's own best reviews, newest first: never invented quotes. */
2
- import { defineComponent } from "@abcart/theme";
3
- import { localeRouting, localizeHref, storefrontPath, type Review } from "@abcart/storefront";
4
- import Testimonials from "@/components/sections/Testimonials.astro";
5
- import { alignField, headingFields, schemeField, styleField } from "../fields";
6
- import { FIELD, GROUP, SECTION, HELP } from "../labels";
7
- import { WITH_LANDING } from "./shared";
8
-
9
- /** A shopper's review on a page, with the product it is about. */
10
- export interface TestimonialReview {
11
- review: Review;
12
- product: { name: string; href: string };
13
- }
14
-
15
- export const testimonials = defineComponent({
16
- type: "testimonials",
17
- component: Testimonials,
18
- label: SECTION.testimonials,
19
- group: GROUP.content,
20
- placement: "section",
21
- capabilities: WITH_LANDING,
22
- fields: [
23
- ...headingFields("home.testimonials"),
24
- alignField,
25
- { key: "limit", kind: "number", label: FIELD.reviewsShown, description: HELP.reviewsShown, default: 6, min: 3, max: 9, step: 1, display: "slider" },
26
- { key: "minRating", kind: "number", label: FIELD.minRating, description: HELP.minRating, default: 4, min: 1, max: 5, step: 1, display: "slider" },
27
- schemeField(),
28
- styleField(),
29
- ],
30
- presets: [
31
- {
32
- key: "top-rated",
33
- label: { ar: "الأعلى تقييماً", fr: "Les mieux notés", en: "Top rated" },
34
- props: {
35
- title: { ar: "الأعلى", fr: "Les mieux", en: "Top" },
36
- accent: { ar: "تقييماً", fr: "notés", en: "rated" },
37
- minRating: 5,
38
- limit: 3,
39
- },
40
- },
41
- ],
42
- load: async ({ storefront, context, props, reads }): Promise<{ reviews: TestimonialReview[] }> => {
43
- if (!context.store.reviewsEnabled) return { reviews: [] };
44
- const limit = props.limit ?? 6;
45
- const minRating = props.minRating ?? 4;
46
- const products = await reads.get("products:all", () => storefront.products.list());
47
- const reviewed = products
48
- .filter((product) => (product.reviewStats?.reviewCount ?? 0) > 0)
49
- .sort((a, b) => (b.reviewStats?.reviewCount ?? 0) - (a.reviewStats?.reviewCount ?? 0))
50
- .slice(0, limit);
51
- const pages = await Promise.all(reviewed.map((product) => reads.get(`reviews:${product.id}:3`, () => storefront.products.reviews.list(product.id, { limit: 3 }))));
52
- const routing = localeRouting(context.store);
53
- const reviews = pages
54
- .flatMap((page, index) => page.rows.map((review) => ({ review, product: reviewed[index]! })))
55
- .filter(({ review }) => review.rating >= minRating && review.body.trim().length > 0)
56
- .sort((a, b) => b.review.createdAt.localeCompare(a.review.createdAt))
57
- .slice(0, limit)
58
- .map(({ review, product }) => ({ review, product: { name: product.name, href: localizeHref(storefrontPath("product", { handle: product.handle }), context.locale, routing) } }));
59
- return { reviews };
60
- },
61
- });
1
+ /** The store's own best reviews, newest first: never invented quotes. */
2
+ import { defineComponent } from "@abcart/theme";
3
+ import { localeRouting, localizeHref, storefrontPath, type Review } from "@abcart/storefront";
4
+ import Testimonials from "@/components/sections/Testimonials.astro";
5
+ import { alignField, headingFields, schemeField, styleField } from "../fields";
6
+ import { FIELD, GROUP, SECTION, HELP } from "../labels";
7
+ import { WITH_LANDING } from "./shared";
8
+
9
+ /** A shopper's review on a page, with the product it is about. */
10
+ export interface TestimonialReview {
11
+ review: Review;
12
+ product: { name: string; href: string };
13
+ }
14
+
15
+ export const testimonials = defineComponent({
16
+ type: "testimonials",
17
+ component: Testimonials,
18
+ label: SECTION.testimonials,
19
+ group: GROUP.content,
20
+ placement: "section",
21
+ capabilities: WITH_LANDING,
22
+ fields: [
23
+ ...headingFields("home.testimonials"),
24
+ alignField,
25
+ { key: "limit", kind: "number", label: FIELD.reviewsShown, description: HELP.reviewsShown, default: 6, min: 3, max: 9, step: 1, display: "slider" },
26
+ { key: "minRating", kind: "number", label: FIELD.minRating, description: HELP.minRating, default: 4, min: 1, max: 5, step: 1, display: "slider" },
27
+ schemeField(),
28
+ styleField(),
29
+ ],
30
+ presets: [
31
+ {
32
+ key: "top-rated",
33
+ label: { ar: "الأعلى تقييماً", fr: "Les mieux notés", en: "Top rated" },
34
+ props: {
35
+ title: { ar: "الأعلى", fr: "Les mieux", en: "Top" },
36
+ accent: { ar: "تقييماً", fr: "notés", en: "rated" },
37
+ minRating: 5,
38
+ limit: 3,
39
+ },
40
+ },
41
+ ],
42
+ load: async ({ storefront, context, props, reads }): Promise<{ reviews: TestimonialReview[] }> => {
43
+ if (!context.store.reviewsEnabled) return { reviews: [] };
44
+ const limit = props.limit ?? 6;
45
+ const minRating = props.minRating ?? 4;
46
+ const products = await reads.get("products:all", () => storefront.products.list());
47
+ const reviewed = products
48
+ .filter((product) => (product.reviewStats?.reviewCount ?? 0) > 0)
49
+ .sort((a, b) => (b.reviewStats?.reviewCount ?? 0) - (a.reviewStats?.reviewCount ?? 0))
50
+ .slice(0, limit);
51
+ const pages = await Promise.all(reviewed.map((product) => reads.get(`reviews:${product.id}:3`, () => storefront.products.reviews.list(product.id, { limit: 3 }))));
52
+ const routing = localeRouting(context.store);
53
+ const reviews = pages
54
+ .flatMap((page, index) => page.rows.map((review) => ({ review, product: reviewed[index]! })))
55
+ .filter(({ review }) => review.rating >= minRating && review.body.trim().length > 0)
56
+ .sort((a, b) => b.review.createdAt.localeCompare(a.review.createdAt))
57
+ .slice(0, limit)
58
+ .map(({ review, product }) => ({ review, product: { name: product.name, href: localizeHref(storefrontPath("product", { handle: product.handle }), context.locale, routing) } }));
59
+ return { reviews };
60
+ },
61
+ });
@@ -1,35 +1,35 @@
1
- /**
2
- * The thank-you page: the order's confirmation, the page's one required
3
- * section, which content sections can follow. The route hands it the order's
4
- * number and total from its link; the editor's preview, with no order, an
5
- * example number.
6
- */
7
- import { defineComponent } from "@abcart/theme";
8
- import { schemeField, sectionStyle, styleField } from "../fields";
9
- import { FIELD, GROUP, SECTION } from "../labels";
10
- import { ORDER_EXAMPLE } from "@/lib/order-outcome";
11
- import ThankYouMain from "@/components/checkout/ThankYouMain.astro";
12
-
13
- export const thankYouMain = defineComponent({
14
- type: "thank-you-main",
15
- component: ThankYouMain,
16
- label: SECTION.thankYouMain,
17
- group: GROUP.page,
18
- placement: "section",
19
- capabilities: { surfaces: ["thank-you"], insertable: false },
20
- fields: [
21
- { key: "title", kind: "text", label: FIELD.title, contentKey: "thankYou.title" },
22
- { key: "subtitle", kind: "textarea", label: FIELD.subtitle, contentKey: "thankYou.subtitle" },
23
- { key: "note", kind: "textarea", label: FIELD.whatNext, contentKey: "thankYou.next" },
24
- { key: "showContact", kind: "boolean", label: FIELD.showContact, default: true },
25
- { key: "showTrack", kind: "boolean", label: FIELD.showTrack, default: true },
26
- { key: "showContinue", kind: "boolean", label: FIELD.showContinue, default: true },
27
- schemeField(),
28
- styleField(sectionStyle("normal", "narrow")),
29
- ],
30
- load: async ({ context }): Promise<{ order: { number: string; total: number | null } }> => {
31
- const params = context.params ?? {};
32
- const total = params.total ? Number(params.total) : NaN;
33
- return { order: { number: params.orderNumber || ORDER_EXAMPLE, total: Number.isFinite(total) ? total : null } };
34
- },
35
- });
1
+ /**
2
+ * The thank-you page: the order's confirmation, the page's one required
3
+ * section, which content sections can follow. The route hands it the order's
4
+ * number and total from its link; the editor's preview, with no order, an
5
+ * example number.
6
+ */
7
+ import { defineComponent } from "@abcart/theme";
8
+ import { schemeField, sectionStyle, styleField } from "../fields";
9
+ import { FIELD, GROUP, SECTION } from "../labels";
10
+ import { ORDER_EXAMPLE } from "@/lib/order-outcome";
11
+ import ThankYouMain from "@/components/checkout/ThankYouMain.astro";
12
+
13
+ export const thankYouMain = defineComponent({
14
+ type: "thank-you-main",
15
+ component: ThankYouMain,
16
+ label: SECTION.thankYouMain,
17
+ group: GROUP.page,
18
+ placement: "section",
19
+ capabilities: { surfaces: ["thank-you"], insertable: false },
20
+ fields: [
21
+ { key: "title", kind: "text", label: FIELD.title, contentKey: "thankYou.title" },
22
+ { key: "subtitle", kind: "textarea", label: FIELD.subtitle, contentKey: "thankYou.subtitle" },
23
+ { key: "note", kind: "textarea", label: FIELD.whatNext, contentKey: "thankYou.next" },
24
+ { key: "showContact", kind: "boolean", label: FIELD.showContact, default: true },
25
+ { key: "showTrack", kind: "boolean", label: FIELD.showTrack, default: true },
26
+ { key: "showContinue", kind: "boolean", label: FIELD.showContinue, default: true },
27
+ schemeField(),
28
+ styleField(sectionStyle("normal", "narrow")),
29
+ ],
30
+ load: async ({ context }): Promise<{ order: { number: string; total: number | null } }> => {
31
+ const params = context.params ?? {};
32
+ const total = params.total ? Number(params.total) : NaN;
33
+ return { order: { number: params.orderNumber || ORDER_EXAMPLE, total: Number.isFinite(total) ? total : null } };
34
+ },
35
+ });
@@ -1,124 +1,124 @@
1
- /**
2
- * The store-wide choices a merchant makes in the editor: colors, corners,
3
- * product cards, and the store's promises and social links. The defaults are
4
- * the starter's neutral look; a theme's brand lives in `src/styles/tokens.css`
5
- * and in the color schemes below.
6
- */
7
- import { defineTheme, type SettingsGroup } from "@abcart/theme";
8
- import { THEME_KEY, THEME_VERSION } from "./key";
9
- import { LOCALES } from "./locales";
10
- import { FIELD, OPTION, SETTINGS, HELP } from "./labels";
11
- import { ACCENT_SCHEME, DARK_SCHEME, MUTED_SCHEME, PAGE_SCHEME, iconField } from "./fields";
12
- import { BLACK, CHARCOAL, LINE, MIST, SILVER, STEEL, WHITE } from "./palette";
13
-
14
- const l = (ar: string, fr: string, en: string) => ({ ar, fr, en });
15
-
16
- export const THEME_SETTINGS = [
17
- {
18
- key: "appearance",
19
- label: SETTINGS.appearance,
20
- fields: [
21
- {
22
- key: "colorSchemes",
23
- kind: "colorSchemes",
24
- label: FIELD.colors,
25
- default: [
26
- {
27
- id: PAGE_SCHEME,
28
- name: l("فاتح", "Clair", "Light"),
29
- colors: { background: WHITE, text: CHARCOAL, heading: BLACK, accent: BLACK, button: BLACK, buttonText: WHITE, border: LINE },
30
- },
31
- {
32
- id: MUTED_SCHEME,
33
- name: l("هادئ", "Doux", "Muted"),
34
- colors: { background: MIST, text: CHARCOAL, heading: BLACK, accent: BLACK, button: BLACK, buttonText: WHITE, border: LINE },
35
- },
36
- {
37
- id: ACCENT_SCHEME,
38
- name: l("بارز", "Accent", "Accent"),
39
- colors: { background: CHARCOAL, text: SILVER, heading: WHITE, accent: WHITE, button: WHITE, buttonText: BLACK, border: STEEL },
40
- },
41
- {
42
- id: DARK_SCHEME,
43
- name: l("داكن", "Sombre", "Dark"),
44
- colors: { background: BLACK, text: SILVER, heading: WHITE, accent: WHITE, button: WHITE, buttonText: BLACK, border: STEEL },
45
- },
46
- ],
47
- },
48
- { key: "pageScheme", kind: "colorScheme", label: FIELD.pageScheme, description: HELP.pageScheme, default: PAGE_SCHEME },
49
- {
50
- key: "corners",
51
- kind: "select",
52
- label: FIELD.corners,
53
- description: HELP.corners,
54
- options: ["square", "soft", "round"],
55
- optionLabels: { square: OPTION.square, soft: OPTION.soft, round: OPTION.round },
56
- default: "soft",
57
- display: "segmented",
58
- },
59
- {
60
- key: "cardRatio",
61
- kind: "select",
62
- label: FIELD.cardImage,
63
- description: HELP.cardRatio,
64
- options: ["square", "portrait"],
65
- optionLabels: { square: OPTION.squareImage, portrait: OPTION.portrait },
66
- default: "square",
67
- display: "segmented",
68
- },
69
- { key: "cardButton", kind: "boolean", label: FIELD.cardButton, description: HELP.cardButton, default: true },
70
- ],
71
- },
72
- {
73
- key: "store",
74
- label: SETTINGS.store,
75
- fields: [
76
- {
77
- key: "benefits",
78
- kind: "list",
79
- label: FIELD.benefits,
80
- itemLabel: "text",
81
- max: 6,
82
- fields: [{ key: "text", kind: "text", label: FIELD.text }, iconField("check")],
83
- default: [
84
- { id: "ben-1", props: { text: l("الدفع عند الاستلام", "Paiement à la livraison", "Cash on delivery"), icon: "cash" } },
85
- { id: "ben-2", props: { text: l("سعر التوصيل يظهر قبل التأكيد", "Frais de livraison affichés avant de confirmer", "Delivery fee shown before you confirm"), icon: "truck" } },
86
- { id: "ben-3", props: { text: l("تتبّع طلبك برقمه", "Suivez votre commande avec son numéro", "Track your order with its number"), icon: "package" } },
87
- ],
88
- },
89
- {
90
- key: "socialLinks",
91
- kind: "list",
92
- label: FIELD.socialLinks,
93
- itemLabel: "label",
94
- max: 5,
95
- fields: [
96
- {
97
- key: "network",
98
- kind: "select",
99
- label: FIELD.network,
100
- options: ["instagram", "facebook", "tiktok", "youtube"],
101
- optionLabels: { instagram: OPTION.instagram, facebook: OPTION.facebook, tiktok: OPTION.tiktok, youtube: OPTION.youtube },
102
- default: "instagram",
103
- },
104
- { key: "href", kind: "url", label: FIELD.link },
105
- { key: "label", kind: "text", label: FIELD.label },
106
- ],
107
- default: [],
108
- },
109
- ],
110
- },
111
- ] as const satisfies readonly SettingsGroup[];
112
-
113
- /**
114
- * The settings alone, as a definition: what the middleware and the layout
115
- * resolve a store's settings against, so a request never loads every section
116
- * just to read the store's colors.
117
- */
118
- export const settingsDefinition = defineTheme({
119
- key: THEME_KEY,
120
- version: THEME_VERSION,
121
- locales: LOCALES,
122
- settings: THEME_SETTINGS,
123
- components: {},
124
- });
1
+ /**
2
+ * The store-wide choices a merchant makes in the editor: colors, corners,
3
+ * product cards, and the store's promises and social links. The defaults are
4
+ * the starter's neutral look; a theme's brand lives in `src/styles/tokens.css`
5
+ * and in the color schemes below.
6
+ */
7
+ import { defineTheme, type SettingsGroup } from "@abcart/theme";
8
+ import { THEME_KEY, THEME_VERSION } from "./key";
9
+ import { LOCALES } from "./locales";
10
+ import { FIELD, OPTION, SETTINGS, HELP } from "./labels";
11
+ import { ACCENT_SCHEME, DARK_SCHEME, MUTED_SCHEME, PAGE_SCHEME, iconField } from "./fields";
12
+ import { BLACK, CHARCOAL, LINE, MIST, SILVER, STEEL, WHITE } from "./palette";
13
+
14
+ const l = (ar: string, fr: string, en: string) => ({ ar, fr, en });
15
+
16
+ export const THEME_SETTINGS = [
17
+ {
18
+ key: "appearance",
19
+ label: SETTINGS.appearance,
20
+ fields: [
21
+ {
22
+ key: "colorSchemes",
23
+ kind: "colorSchemes",
24
+ label: FIELD.colors,
25
+ default: [
26
+ {
27
+ id: PAGE_SCHEME,
28
+ name: l("فاتح", "Clair", "Light"),
29
+ colors: { background: WHITE, text: CHARCOAL, heading: BLACK, accent: BLACK, button: BLACK, buttonText: WHITE, border: LINE },
30
+ },
31
+ {
32
+ id: MUTED_SCHEME,
33
+ name: l("هادئ", "Doux", "Muted"),
34
+ colors: { background: MIST, text: CHARCOAL, heading: BLACK, accent: BLACK, button: BLACK, buttonText: WHITE, border: LINE },
35
+ },
36
+ {
37
+ id: ACCENT_SCHEME,
38
+ name: l("بارز", "Accent", "Accent"),
39
+ colors: { background: CHARCOAL, text: SILVER, heading: WHITE, accent: WHITE, button: WHITE, buttonText: BLACK, border: STEEL },
40
+ },
41
+ {
42
+ id: DARK_SCHEME,
43
+ name: l("داكن", "Sombre", "Dark"),
44
+ colors: { background: BLACK, text: SILVER, heading: WHITE, accent: WHITE, button: WHITE, buttonText: BLACK, border: STEEL },
45
+ },
46
+ ],
47
+ },
48
+ { key: "pageScheme", kind: "colorScheme", label: FIELD.pageScheme, description: HELP.pageScheme, default: PAGE_SCHEME },
49
+ {
50
+ key: "corners",
51
+ kind: "select",
52
+ label: FIELD.corners,
53
+ description: HELP.corners,
54
+ options: ["square", "soft", "round"],
55
+ optionLabels: { square: OPTION.square, soft: OPTION.soft, round: OPTION.round },
56
+ default: "soft",
57
+ display: "segmented",
58
+ },
59
+ {
60
+ key: "cardRatio",
61
+ kind: "select",
62
+ label: FIELD.cardImage,
63
+ description: HELP.cardRatio,
64
+ options: ["square", "portrait"],
65
+ optionLabels: { square: OPTION.squareImage, portrait: OPTION.portrait },
66
+ default: "square",
67
+ display: "segmented",
68
+ },
69
+ { key: "cardButton", kind: "boolean", label: FIELD.cardButton, description: HELP.cardButton, default: true },
70
+ ],
71
+ },
72
+ {
73
+ key: "store",
74
+ label: SETTINGS.store,
75
+ fields: [
76
+ {
77
+ key: "benefits",
78
+ kind: "list",
79
+ label: FIELD.benefits,
80
+ itemLabel: "text",
81
+ max: 6,
82
+ fields: [{ key: "text", kind: "text", label: FIELD.text }, iconField("check")],
83
+ default: [
84
+ { id: "ben-1", props: { text: l("الدفع عند الاستلام", "Paiement à la livraison", "Cash on delivery"), icon: "cash" } },
85
+ { id: "ben-2", props: { text: l("سعر التوصيل يظهر قبل التأكيد", "Frais de livraison affichés avant de confirmer", "Delivery fee shown before you confirm"), icon: "truck" } },
86
+ { id: "ben-3", props: { text: l("تتبّع طلبك برقمه", "Suivez votre commande avec son numéro", "Track your order with its number"), icon: "package" } },
87
+ ],
88
+ },
89
+ {
90
+ key: "socialLinks",
91
+ kind: "list",
92
+ label: FIELD.socialLinks,
93
+ itemLabel: "label",
94
+ max: 5,
95
+ fields: [
96
+ {
97
+ key: "network",
98
+ kind: "select",
99
+ label: FIELD.network,
100
+ options: ["instagram", "facebook", "tiktok", "youtube"],
101
+ optionLabels: { instagram: OPTION.instagram, facebook: OPTION.facebook, tiktok: OPTION.tiktok, youtube: OPTION.youtube },
102
+ default: "instagram",
103
+ },
104
+ { key: "href", kind: "url", label: FIELD.link },
105
+ { key: "label", kind: "text", label: FIELD.label },
106
+ ],
107
+ default: [],
108
+ },
109
+ ],
110
+ },
111
+ ] as const satisfies readonly SettingsGroup[];
112
+
113
+ /**
114
+ * The settings alone, as a definition: what the middleware and the layout
115
+ * resolve a store's settings against, so a request never loads every section
116
+ * just to read the store's colors.
117
+ */
118
+ export const settingsDefinition = defineTheme({
119
+ key: THEME_KEY,
120
+ version: THEME_VERSION,
121
+ locales: LOCALES,
122
+ settings: THEME_SETTINGS,
123
+ components: {},
124
+ });
@@ -1,65 +1,65 @@
1
- /**
2
- * The theme, as the platform and the editor see it: its pages (surfaces), the
3
- * header and footer (areas), its sections, settings, words and spacing scale.
4
- * Definitions are code; each page's default layout is a JSON document in
5
- * `documents/`. The build turns this into `/wocart-theme.json`, the manifest
6
- * the editor reads.
7
- */
8
- import { defineTheme, type PageData, type RequiredBlock } from "@abcart/theme";
9
- import { THEME_KEY, THEME_VERSION } from "./key";
10
- import { LOCALES } from "./locales";
11
- import { content } from "./content";
12
- import { SURFACE } from "./labels";
13
- import { THEME_SETTINGS } from "./settings";
14
- import { components } from "./sections";
15
- import homeDocument from "./documents/home.json";
16
- import productDocument from "./documents/product.json";
17
- import collectionDocument from "./documents/collection.json";
18
- import categoryDocument from "./documents/category.json";
19
- import catalogDocument from "./documents/catalog.json";
20
- import pageDocument from "./documents/page.json";
21
- import thankYouDocument from "./documents/thank-you.json";
22
- import landingDocument from "./documents/landing.json";
23
- import searchDocument from "./documents/search.json";
24
- import trackOrderDocument from "./documents/track-order.json";
25
- import checkoutDocument from "./documents/checkout.json";
26
- import contactDocument from "./documents/contact.json";
27
- import headerDocument from "./documents/header.area.json";
28
- import footerDocument from "./documents/footer.area.json";
29
-
30
- const doc = (value: unknown) => value as PageData;
31
- /** The one section a page cannot lose: the editor keeps it, and a saved page missing it gets it back. */
32
- const main = (type: string): RequiredBlock[] => [{ type, min: 1, max: 1 }];
33
-
34
- export const theme = defineTheme({
35
- key: THEME_KEY,
36
- version: THEME_VERSION,
37
- preview: true,
38
- locales: LOCALES,
39
- content,
40
- /** The steps a section's spacing and width are picked from (pixels). */
41
- style: {
42
- spacing: { s0: 0, s1: 4, s2: 8, s3: 12, s4: 16, s5: 24, s6: 32, s7: 40, s8: 56, s9: 72, s10: 88, s11: 104, s12: 128 },
43
- widths: { wide: 1280, content: 960, narrow: 680 },
44
- },
45
- settings: THEME_SETTINGS,
46
- areas: [
47
- { key: "header", label: SURFACE.header, document: doc(headerDocument), required: main("header"), max: 4 },
48
- { key: "footer", label: SURFACE.footer, document: doc(footerDocument), required: main("footer"), max: 4 },
49
- ],
50
- surfaces: [
51
- { key: "home", label: SURFACE.home, pageType: "home", document: doc(homeDocument), max: 20 },
52
- { key: "product", label: SURFACE.product, pageType: "product", document: doc(productDocument), required: main("product-main"), max: 12 },
53
- { key: "collection", label: SURFACE.collection, pageType: "collection", document: doc(collectionDocument), required: main("listing-main"), max: 12 },
54
- { key: "category", label: SURFACE.category, pageType: "category", document: doc(categoryDocument), required: main("listing-main"), max: 12 },
55
- { key: "catalog", label: SURFACE.catalog, pageType: "catalog", document: doc(catalogDocument), required: main("listing-main"), max: 12 },
56
- { key: "page", label: SURFACE.page, pageType: "page", document: doc(pageDocument), required: main("page-main"), max: 8 },
57
- { key: "thank-you", label: SURFACE.thankYou, pageType: "thankYou", document: doc(thankYouDocument), required: main("thank-you-main"), max: 6 },
58
- { key: "landing", label: SURFACE.landing, pageType: "landing", document: doc(landingDocument), required: main("landing-order"), max: 16, hideableAreas: ["header", "footer"] },
59
- { key: "search", label: SURFACE.search, pageType: "search", document: doc(searchDocument), required: main("search-main"), max: 6 },
60
- { key: "track-order", label: SURFACE.trackOrder, pageType: "trackOrder", document: doc(trackOrderDocument), required: main("track-order-main"), max: 6 },
61
- { key: "checkout", label: SURFACE.checkout, pageType: "checkout", document: doc(checkoutDocument), required: main("checkout-main"), max: 4 },
62
- { key: "contact", label: SURFACE.contact, pageType: "contact", document: doc(contactDocument), required: main("contact-main"), max: 8 },
63
- ],
64
- components,
65
- });
1
+ /**
2
+ * The theme, as the platform and the editor see it: its pages (surfaces), the
3
+ * header and footer (areas), its sections, settings, words and spacing scale.
4
+ * Definitions are code; each page's default layout is a JSON document in
5
+ * `documents/`. The build turns this into `/abcart-theme.json`, the manifest
6
+ * the editor reads.
7
+ */
8
+ import { defineTheme, type PageData, type RequiredBlock } from "@abcart/theme";
9
+ import { THEME_KEY, THEME_VERSION } from "./key";
10
+ import { LOCALES } from "./locales";
11
+ import { content } from "./content";
12
+ import { SURFACE } from "./labels";
13
+ import { THEME_SETTINGS } from "./settings";
14
+ import { components } from "./sections";
15
+ import homeDocument from "./documents/home.json";
16
+ import productDocument from "./documents/product.json";
17
+ import collectionDocument from "./documents/collection.json";
18
+ import categoryDocument from "./documents/category.json";
19
+ import catalogDocument from "./documents/catalog.json";
20
+ import pageDocument from "./documents/page.json";
21
+ import thankYouDocument from "./documents/thank-you.json";
22
+ import landingDocument from "./documents/landing.json";
23
+ import searchDocument from "./documents/search.json";
24
+ import trackOrderDocument from "./documents/track-order.json";
25
+ import checkoutDocument from "./documents/checkout.json";
26
+ import contactDocument from "./documents/contact.json";
27
+ import headerDocument from "./documents/header.area.json";
28
+ import footerDocument from "./documents/footer.area.json";
29
+
30
+ const doc = (value: unknown) => value as PageData;
31
+ /** The one section a page cannot lose: the editor keeps it, and a saved page missing it gets it back. */
32
+ const main = (type: string): RequiredBlock[] => [{ type, min: 1, max: 1 }];
33
+
34
+ export const theme = defineTheme({
35
+ key: THEME_KEY,
36
+ version: THEME_VERSION,
37
+ preview: true,
38
+ locales: LOCALES,
39
+ content,
40
+ /** The steps a section's spacing and width are picked from (pixels). */
41
+ style: {
42
+ spacing: { s0: 0, s1: 4, s2: 8, s3: 12, s4: 16, s5: 24, s6: 32, s7: 40, s8: 56, s9: 72, s10: 88, s11: 104, s12: 128 },
43
+ widths: { wide: 1280, content: 960, narrow: 680 },
44
+ },
45
+ settings: THEME_SETTINGS,
46
+ areas: [
47
+ { key: "header", label: SURFACE.header, document: doc(headerDocument), required: main("header"), max: 4 },
48
+ { key: "footer", label: SURFACE.footer, document: doc(footerDocument), required: main("footer"), max: 4 },
49
+ ],
50
+ surfaces: [
51
+ { key: "home", label: SURFACE.home, pageType: "home", document: doc(homeDocument), max: 20 },
52
+ { key: "product", label: SURFACE.product, pageType: "product", document: doc(productDocument), required: main("product-main"), max: 12 },
53
+ { key: "collection", label: SURFACE.collection, pageType: "collection", document: doc(collectionDocument), required: main("listing-main"), max: 12 },
54
+ { key: "category", label: SURFACE.category, pageType: "category", document: doc(categoryDocument), required: main("listing-main"), max: 12 },
55
+ { key: "catalog", label: SURFACE.catalog, pageType: "catalog", document: doc(catalogDocument), required: main("listing-main"), max: 12 },
56
+ { key: "page", label: SURFACE.page, pageType: "page", document: doc(pageDocument), required: main("page-main"), max: 8 },
57
+ { key: "thank-you", label: SURFACE.thankYou, pageType: "thankYou", document: doc(thankYouDocument), required: main("thank-you-main"), max: 6 },
58
+ { key: "landing", label: SURFACE.landing, pageType: "landing", document: doc(landingDocument), required: main("landing-order"), max: 16, hideableAreas: ["header", "footer"] },
59
+ { key: "search", label: SURFACE.search, pageType: "search", document: doc(searchDocument), required: main("search-main"), max: 6 },
60
+ { key: "track-order", label: SURFACE.trackOrder, pageType: "trackOrder", document: doc(trackOrderDocument), required: main("track-order-main"), max: 6 },
61
+ { key: "checkout", label: SURFACE.checkout, pageType: "checkout", document: doc(checkoutDocument), required: main("checkout-main"), max: 4 },
62
+ { key: "contact", label: SURFACE.contact, pageType: "contact", document: doc(contactDocument), required: main("contact-main"), max: 8 },
63
+ ],
64
+ components,
65
+ });