AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SamplePlan.php 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <?php
  2. namespace App\StorePlan;
  3. use App\Models\Store;
  4. /**
  5. * A hand-written plan. Used as the format example in AI prompts, by the fake AI provider, and in tests.
  6. * It uses every section type once.
  7. */
  8. final class SamplePlan
  9. {
  10. /**
  11. * @return array<string, mixed>
  12. */
  13. public static function for(Store $store): array
  14. {
  15. return self::forName($store->name);
  16. }
  17. /**
  18. * @return array<string, mixed>
  19. */
  20. public static function forName(string $name): array
  21. {
  22. return PlanUpgrader::upgrade(self::flat($name));
  23. }
  24. /**
  25. * The sample written as one flat list, header first and footer last, which is the easiest form to read.
  26. * PlanUpgrader then moves the header and footer out and puts the rest on the home page.
  27. *
  28. * @return array<string, mixed>
  29. */
  30. private static function flat(string $name): array
  31. {
  32. return [
  33. 'version' => 1,
  34. 'theme' => [
  35. 'colors' => [
  36. 'background' => '#FBF7F0',
  37. 'surface' => '#F3EADB',
  38. 'foreground' => '#2A1A12',
  39. 'muted' => '#7A6557',
  40. 'primary' => '#B4411F',
  41. 'primaryForeground' => '#FFF8F0',
  42. 'accent' => '#E2A93B',
  43. 'border' => '#E3D5C0',
  44. ],
  45. 'fonts' => ['heading' => 'fraunces', 'body' => 'dm-sans'],
  46. 'radius' => 'medium',
  47. 'style' => [
  48. 'buttons' => 'solid',
  49. 'cards' => 'shadow',
  50. 'spacing' => 'normal',
  51. 'headings' => 'normal',
  52. 'backgrounds' => 'alternate',
  53. 'motion' => 'gentle',
  54. ],
  55. ],
  56. 'sections' => [
  57. [
  58. 'id' => 'header',
  59. 'type' => 'header',
  60. 'variant' => 'simple',
  61. 'content' => [
  62. 'logoText' => $name,
  63. 'links' => [
  64. ['label' => 'Shop', 'href' => '#products'],
  65. ['label' => 'Our story', 'href' => '#about'],
  66. ['label' => 'FAQ', 'href' => '#faq'],
  67. ['label' => 'Contact', 'href' => '#contact'],
  68. ],
  69. 'cta' => ['label' => 'Shop now', 'href' => '#products'],
  70. ],
  71. ],
  72. [
  73. 'id' => 'hero',
  74. 'type' => 'hero',
  75. 'variant' => 'split',
  76. 'content' => [
  77. 'eyebrow' => 'Small batch · Made in Malaysia',
  78. 'headline' => 'Sambal the way grandma made it',
  79. 'subheadline' => 'Slow-cooked for six hours with fresh chillies and no preservatives. One spoon turns plain rice into a meal.',
  80. 'primaryCta' => ['label' => 'Shop the range', 'href' => '#products'],
  81. 'secondaryCta' => ['label' => 'Our story', 'href' => '#about'],
  82. ],
  83. ],
  84. [
  85. 'id' => 'trust',
  86. 'type' => 'trust_bar',
  87. 'variant' => 'row',
  88. 'content' => [
  89. 'items' => [
  90. ['kind' => 'shipping'],
  91. ['kind' => 'payment'],
  92. ['kind' => 'custom', 'icon' => 'clock', 'title' => 'Slow-cooked for six hours', 'text' => 'No preservatives'],
  93. ],
  94. ],
  95. ],
  96. [
  97. 'id' => 'products',
  98. 'type' => 'product_grid',
  99. 'variant' => 'grid',
  100. 'content' => [
  101. 'heading' => 'Best sellers',
  102. 'subheading' => 'Cooked fresh every week and delivered across Malaysia.',
  103. 'items' => [
  104. ['name' => 'Sambal Ikan Bilis', 'price' => 18.90, 'badge' => 'Best seller'],
  105. ['name' => 'Sambal Hijau', 'price' => 16.90, 'badge' => null],
  106. ['name' => 'Sambal Petai', 'price' => 21.90, 'badge' => 'New'],
  107. ['name' => 'Sambal Belacan', 'price' => 15.90, 'badge' => null],
  108. ],
  109. ],
  110. ],
  111. [
  112. 'id' => 'highlights',
  113. 'type' => 'bento',
  114. 'variant' => 'mosaic',
  115. 'content' => [
  116. 'heading' => null,
  117. 'tiles' => [
  118. ['title' => 'The full range', 'text' => 'Every sambal, cooked fresh each week', 'href' => '/shop', 'image' => null, 'tone' => 'primary'],
  119. ['title' => 'New: Sambal Petai', 'text' => null, 'href' => '#products', 'image' => null, 'tone' => 'accent'],
  120. ['title' => 'Our story', 'text' => 'Grandma\'s recipe', 'href' => '#about', 'image' => null, 'tone' => 'dark'],
  121. ],
  122. ],
  123. ],
  124. [
  125. 'id' => 'shop-by',
  126. 'type' => 'shop_by',
  127. 'variant' => 'circles',
  128. 'content' => [
  129. 'heading' => 'Shop by taste',
  130. 'subheading' => null,
  131. 'collections' => [],
  132. ],
  133. ],
  134. [
  135. 'id' => 'featured',
  136. 'type' => 'featured_product',
  137. 'variant' => 'image-right',
  138. 'content' => [
  139. 'eyebrow' => 'Gift set',
  140. 'name' => 'The Family Trio',
  141. 'description' => 'Three of our most loved sambals in one box. A good first order, and an easy gift for anyone who misses home cooking.',
  142. 'price' => 49.90,
  143. 'bullets' => [
  144. 'Three 180g jars',
  145. 'Keeps for 3 months unopened',
  146. 'Free delivery in Peninsular Malaysia',
  147. ],
  148. 'cta' => ['label' => 'Add to cart', 'href' => '#products'],
  149. ],
  150. ],
  151. [
  152. 'id' => 'about',
  153. 'type' => 'about',
  154. 'variant' => 'with-stats',
  155. 'content' => [
  156. 'heading' => 'A family recipe, three generations old',
  157. 'body' => "$name began in a home kitchen, with a recipe passed from grandmother to mother to daughter. We still cook in small batches, taste every pot, and use chillies bought from the same farms each week.",
  158. 'stats' => [
  159. ['value' => '6 hrs', 'label' => 'Slow-cooked per batch'],
  160. ['value' => '0', 'label' => 'Preservatives'],
  161. ['value' => '12k+', 'label' => 'Jars delivered'],
  162. ],
  163. ],
  164. ],
  165. [
  166. 'id' => 'testimonials',
  167. 'type' => 'testimonials',
  168. 'variant' => 'cards',
  169. 'content' => [
  170. 'heading' => 'What customers say',
  171. 'items' => [
  172. ['quote' => 'Tastes exactly like my late mother\'s sambal. I order four jars every month.', 'name' => 'Aishah R.', 'role' => 'Shah Alam'],
  173. ['quote' => 'Spicy, but balanced. My kids now ask for it with every meal.', 'name' => 'Daniel L.', 'role' => 'Penang'],
  174. ['quote' => 'Arrived well packed and fresh. The petai one is dangerous.', 'name' => 'Farah N.', 'role' => 'Johor Bahru'],
  175. ],
  176. ],
  177. ],
  178. [
  179. 'id' => 'faq',
  180. 'type' => 'faq',
  181. 'variant' => 'list',
  182. 'content' => [
  183. 'heading' => 'Common questions',
  184. 'items' => [
  185. ['question' => 'How long does it keep?', 'answer' => 'Three months unopened. After opening, keep it in the fridge and finish within four weeks.'],
  186. ['question' => 'How spicy is it?', 'answer' => 'Most of our sambals are medium. Sambal Hijau is the mildest and Sambal Belacan is the hottest.'],
  187. ['question' => 'Do you deliver to East Malaysia?', 'answer' => 'Yes. Delivery to Sabah and Sarawak takes three to five working days.'],
  188. ],
  189. ],
  190. ],
  191. [
  192. 'id' => 'newsletter',
  193. 'type' => 'newsletter',
  194. 'variant' => 'banner',
  195. 'content' => [
  196. 'heading' => 'Get 10% off your first order',
  197. 'body' => 'Join our list for new flavours and recipes. No spam.',
  198. 'placeholder' => 'Your email address',
  199. 'buttonLabel' => 'Sign up',
  200. ],
  201. ],
  202. [
  203. 'id' => 'contact',
  204. 'type' => 'contact',
  205. 'variant' => 'simple',
  206. 'content' => [
  207. 'heading' => 'Talk to us',
  208. 'body' => 'Questions about an order, or want to stock our sambal? We reply within a day.',
  209. 'email' => 'hello@example.com',
  210. 'phone' => '+60 12-345 6789',
  211. 'whatsapp' => '60123456789',
  212. 'address' => 'Shah Alam, Selangor',
  213. ],
  214. ],
  215. [
  216. 'id' => 'footer',
  217. 'type' => 'footer',
  218. 'variant' => 'simple',
  219. 'content' => [
  220. 'text' => "© $name. All rights reserved.",
  221. 'links' => [
  222. ['label' => 'Shop', 'href' => '#products'],
  223. ['label' => 'FAQ', 'href' => '#faq'],
  224. ['label' => 'Contact', 'href' => '#contact'],
  225. ],
  226. ],
  227. ],
  228. ],
  229. ];
  230. }
  231. }