AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

SamplePlan.php 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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' => 'featured',
  113. 'type' => 'featured_product',
  114. 'variant' => 'image-right',
  115. 'content' => [
  116. 'eyebrow' => 'Gift set',
  117. 'name' => 'The Family Trio',
  118. 'description' => 'Three of our most loved sambals in one box. A good first order, and an easy gift for anyone who misses home cooking.',
  119. 'price' => 49.90,
  120. 'bullets' => [
  121. 'Three 180g jars',
  122. 'Keeps for 3 months unopened',
  123. 'Free delivery in Peninsular Malaysia',
  124. ],
  125. 'cta' => ['label' => 'Add to cart', 'href' => '#products'],
  126. ],
  127. ],
  128. [
  129. 'id' => 'about',
  130. 'type' => 'about',
  131. 'variant' => 'with-stats',
  132. 'content' => [
  133. 'heading' => 'A family recipe, three generations old',
  134. '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.",
  135. 'stats' => [
  136. ['value' => '6 hrs', 'label' => 'Slow-cooked per batch'],
  137. ['value' => '0', 'label' => 'Preservatives'],
  138. ['value' => '12k+', 'label' => 'Jars delivered'],
  139. ],
  140. ],
  141. ],
  142. [
  143. 'id' => 'testimonials',
  144. 'type' => 'testimonials',
  145. 'variant' => 'cards',
  146. 'content' => [
  147. 'heading' => 'What customers say',
  148. 'items' => [
  149. ['quote' => 'Tastes exactly like my late mother\'s sambal. I order four jars every month.', 'name' => 'Aishah R.', 'role' => 'Shah Alam'],
  150. ['quote' => 'Spicy, but balanced. My kids now ask for it with every meal.', 'name' => 'Daniel L.', 'role' => 'Penang'],
  151. ['quote' => 'Arrived well packed and fresh. The petai one is dangerous.', 'name' => 'Farah N.', 'role' => 'Johor Bahru'],
  152. ],
  153. ],
  154. ],
  155. [
  156. 'id' => 'faq',
  157. 'type' => 'faq',
  158. 'variant' => 'list',
  159. 'content' => [
  160. 'heading' => 'Common questions',
  161. 'items' => [
  162. ['question' => 'How long does it keep?', 'answer' => 'Three months unopened. After opening, keep it in the fridge and finish within four weeks.'],
  163. ['question' => 'How spicy is it?', 'answer' => 'Most of our sambals are medium. Sambal Hijau is the mildest and Sambal Belacan is the hottest.'],
  164. ['question' => 'Do you deliver to East Malaysia?', 'answer' => 'Yes. Delivery to Sabah and Sarawak takes three to five working days.'],
  165. ],
  166. ],
  167. ],
  168. [
  169. 'id' => 'newsletter',
  170. 'type' => 'newsletter',
  171. 'variant' => 'banner',
  172. 'content' => [
  173. 'heading' => 'Get 10% off your first order',
  174. 'body' => 'Join our list for new flavours and recipes. No spam.',
  175. 'placeholder' => 'Your email address',
  176. 'buttonLabel' => 'Sign up',
  177. ],
  178. ],
  179. [
  180. 'id' => 'contact',
  181. 'type' => 'contact',
  182. 'variant' => 'simple',
  183. 'content' => [
  184. 'heading' => 'Talk to us',
  185. 'body' => 'Questions about an order, or want to stock our sambal? We reply within a day.',
  186. 'email' => 'hello@example.com',
  187. 'phone' => '+60 12-345 6789',
  188. 'whatsapp' => '60123456789',
  189. 'address' => 'Shah Alam, Selangor',
  190. ],
  191. ],
  192. [
  193. 'id' => 'footer',
  194. 'type' => 'footer',
  195. 'variant' => 'simple',
  196. 'content' => [
  197. 'text' => "© $name. All rights reserved.",
  198. 'links' => [
  199. ['label' => 'Shop', 'href' => '#products'],
  200. ['label' => 'FAQ', 'href' => '#faq'],
  201. ['label' => 'Contact', 'href' => '#contact'],
  202. ],
  203. ],
  204. ],
  205. ],
  206. ];
  207. }
  208. }