AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

SamplePlan.php 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. ],
  48. 'sections' => [
  49. [
  50. 'id' => 'header',
  51. 'type' => 'header',
  52. 'variant' => 'simple',
  53. 'content' => [
  54. 'logoText' => $name,
  55. 'links' => [
  56. ['label' => 'Shop', 'href' => '#products'],
  57. ['label' => 'Our story', 'href' => '#about'],
  58. ['label' => 'FAQ', 'href' => '#faq'],
  59. ['label' => 'Contact', 'href' => '#contact'],
  60. ],
  61. 'cta' => ['label' => 'Shop now', 'href' => '#products'],
  62. ],
  63. ],
  64. [
  65. 'id' => 'hero',
  66. 'type' => 'hero',
  67. 'variant' => 'split',
  68. 'content' => [
  69. 'eyebrow' => 'Small batch · Made in Malaysia',
  70. 'headline' => 'Sambal the way grandma made it',
  71. 'subheadline' => 'Slow-cooked for six hours with fresh chillies and no preservatives. One spoon turns plain rice into a meal.',
  72. 'primaryCta' => ['label' => 'Shop the range', 'href' => '#products'],
  73. 'secondaryCta' => ['label' => 'Our story', 'href' => '#about'],
  74. ],
  75. ],
  76. [
  77. 'id' => 'trust',
  78. 'type' => 'trust_bar',
  79. 'variant' => 'row',
  80. 'content' => [
  81. 'items' => [
  82. ['kind' => 'shipping'],
  83. ['kind' => 'payment'],
  84. ['kind' => 'custom', 'icon' => 'clock', 'title' => 'Slow-cooked for six hours', 'text' => 'No preservatives'],
  85. ],
  86. ],
  87. ],
  88. [
  89. 'id' => 'products',
  90. 'type' => 'product_grid',
  91. 'variant' => 'grid',
  92. 'content' => [
  93. 'heading' => 'Best sellers',
  94. 'subheading' => 'Cooked fresh every week and delivered across Malaysia.',
  95. 'items' => [
  96. ['name' => 'Sambal Ikan Bilis', 'price' => 18.90, 'badge' => 'Best seller'],
  97. ['name' => 'Sambal Hijau', 'price' => 16.90, 'badge' => null],
  98. ['name' => 'Sambal Petai', 'price' => 21.90, 'badge' => 'New'],
  99. ['name' => 'Sambal Belacan', 'price' => 15.90, 'badge' => null],
  100. ],
  101. ],
  102. ],
  103. [
  104. 'id' => 'featured',
  105. 'type' => 'featured_product',
  106. 'variant' => 'image-right',
  107. 'content' => [
  108. 'eyebrow' => 'Gift set',
  109. 'name' => 'The Family Trio',
  110. 'description' => 'Three of our most loved sambals in one box. A good first order, and an easy gift for anyone who misses home cooking.',
  111. 'price' => 49.90,
  112. 'bullets' => [
  113. 'Three 180g jars',
  114. 'Keeps for 3 months unopened',
  115. 'Free delivery in Peninsular Malaysia',
  116. ],
  117. 'cta' => ['label' => 'Add to cart', 'href' => '#products'],
  118. ],
  119. ],
  120. [
  121. 'id' => 'about',
  122. 'type' => 'about',
  123. 'variant' => 'with-stats',
  124. 'content' => [
  125. 'heading' => 'A family recipe, three generations old',
  126. '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.",
  127. 'stats' => [
  128. ['value' => '6 hrs', 'label' => 'Slow-cooked per batch'],
  129. ['value' => '0', 'label' => 'Preservatives'],
  130. ['value' => '12k+', 'label' => 'Jars delivered'],
  131. ],
  132. ],
  133. ],
  134. [
  135. 'id' => 'testimonials',
  136. 'type' => 'testimonials',
  137. 'variant' => 'cards',
  138. 'content' => [
  139. 'heading' => 'What customers say',
  140. 'items' => [
  141. ['quote' => 'Tastes exactly like my late mother\'s sambal. I order four jars every month.', 'name' => 'Aishah R.', 'role' => 'Shah Alam'],
  142. ['quote' => 'Spicy, but balanced. My kids now ask for it with every meal.', 'name' => 'Daniel L.', 'role' => 'Penang'],
  143. ['quote' => 'Arrived well packed and fresh. The petai one is dangerous.', 'name' => 'Farah N.', 'role' => 'Johor Bahru'],
  144. ],
  145. ],
  146. ],
  147. [
  148. 'id' => 'faq',
  149. 'type' => 'faq',
  150. 'variant' => 'list',
  151. 'content' => [
  152. 'heading' => 'Common questions',
  153. 'items' => [
  154. ['question' => 'How long does it keep?', 'answer' => 'Three months unopened. After opening, keep it in the fridge and finish within four weeks.'],
  155. ['question' => 'How spicy is it?', 'answer' => 'Most of our sambals are medium. Sambal Hijau is the mildest and Sambal Belacan is the hottest.'],
  156. ['question' => 'Do you deliver to East Malaysia?', 'answer' => 'Yes. Delivery to Sabah and Sarawak takes three to five working days.'],
  157. ],
  158. ],
  159. ],
  160. [
  161. 'id' => 'newsletter',
  162. 'type' => 'newsletter',
  163. 'variant' => 'banner',
  164. 'content' => [
  165. 'heading' => 'Get 10% off your first order',
  166. 'body' => 'Join our list for new flavours and recipes. No spam.',
  167. 'placeholder' => 'Your email address',
  168. 'buttonLabel' => 'Sign up',
  169. ],
  170. ],
  171. [
  172. 'id' => 'contact',
  173. 'type' => 'contact',
  174. 'variant' => 'simple',
  175. 'content' => [
  176. 'heading' => 'Talk to us',
  177. 'body' => 'Questions about an order, or want to stock our sambal? We reply within a day.',
  178. 'email' => 'hello@example.com',
  179. 'phone' => '+60 12-345 6789',
  180. 'whatsapp' => '60123456789',
  181. 'address' => 'Shah Alam, Selangor',
  182. ],
  183. ],
  184. [
  185. 'id' => 'footer',
  186. 'type' => 'footer',
  187. 'variant' => 'simple',
  188. 'content' => [
  189. 'text' => "© $name. All rights reserved.",
  190. 'links' => [
  191. ['label' => 'Shop', 'href' => '#products'],
  192. ['label' => 'FAQ', 'href' => '#faq'],
  193. ['label' => 'Contact', 'href' => '#contact'],
  194. ],
  195. ],
  196. ],
  197. ],
  198. ];
  199. }
  200. }