# AI Commerce — Progress Tracker This file is the single source of truth for the project plan and status. Update it at the end of every work session. **Last updated:** 2026-11-30 **Current step:** Step 10: Stripe Connect built on branch `feature/stripe-connect` (not committed yet) and tested for real in Stripe test mode: Luna Skin is connected, and a card payment and an FPX payment both landed in its own account. EasyParcel courier booking is done on branch `feature/easyparcel` (not committed yet). Step 9 part 8 on hold **Next action:** Commit, then merge `feature/easyparcel` and `feature/stripe-connect` into `main` (run `php artisan migrate`). Later: live courier rate at checkout, tracking updates, a lawyer reads the legal pages, backup AI provider, hosting Status marks: `[ ]` not started · `[~]` in progress · `[x]` done --- ## 1. What we are building An AI store generator for ecommerce only, similar to amboras.com. A customer describes their brand, and the AI builds a complete online store. | Topic | Decision | | ---------------- | ------------------------------------------ | | Customers | First-time founders and existing merchants | | Market | Malaysia first | | Team | Solo, as a business | | Where we develop | Local machine first, no hosting yet | ## 2. Decisions ### Confirmed | Topic | Decision | | ----------------------------- | -------------------------------------------------------------- | | Backend | Laravel 13 on PHP 8.3 / 8.4 | | Frontend | React + TypeScript | | Payments | Stripe Malaysia | | AI for first store generation | Claude Sonnet 5.5 (`claude-sonnet-5-5`) | | Pricing rule | Each plan has a limited number of full regenerations per month | | Template reuse | Later improvement (see section 6) | ### Confirmed on 2026-11-14 (previously proposed) | Topic | Decision | | --------------------- | --------------------------------------------------------------------- | | Laravel + React link | Inertia.js (official Laravel React starter kit) | | Styling | Tailwind + shadcn/ui | | Database | MySQL (already installed), one database, `store_id` on every table | | Background jobs | Laravel queues (database driver first, Redis later) | | Commerce backend | Our own: products, cart, orders, checkout. Not built on Shopify | | How AI builds a store | AI picks and fills pre-built React sections. It never writes raw code | | Store data | Saved as a "store plan"; later edits change small parts of it | | AI for small edits | DeepSeek, called directly from Laravel (not through Hermes) | | AI design | One swappable AI layer, so each task can use a different model | | Shipping | EasyParcel | | Languages | Bahasa Malaysia and English | | WhatsApp | Order notifications and chat button | ### Rule: the AI model must be easy to change Changing from Claude to another AI model (or back) must be a settings change, not a code rewrite. - All AI calls go through one place in the code (the "AI layer"). No other code talks to an AI provider directly. - Each provider (Claude, DeepSeek, others later) is one small "driver" class behind the same interface. - Each task has its own setting in `.env.local`: which provider and which model. Example: - `AI_GENERATE_PROVIDER=claude`, `AI_GENERATE_MODEL=claude-sonnet-5-5` - `AI_EDIT_PROVIDER=deepseek`, `AI_EDIT_MODEL=deepseek-chat` - Prompts and the store plan format are ours and do not depend on any provider. - Every AI result is checked against the store plan format, so a weaker model cannot break a store. - To add a new provider: write one driver class, add its API key, change the setting. ### How the store plan works (added in Step 2) - A store plan is saved in the `plan` column of the `stores` table as JSON. Since Step 4 it is version 2: a theme (8 colours, heading font, body font, corner radius), one header and one footer shared by every page, and a list of pages. The first page is always `home`. - Each page has an `id`, a `title` and an ordered list of sections. Each section has an `id`, a `type`, a `variant` (layout) and `content` (the text). Section ids are unique in the whole plan. - Shop, product, cart and checkout pages are not in the plan. We build them ourselves, the same for every store, in the store's colours and fonts. Their addresses (`shop`, `products`, `cart`, `checkout` and a few more) cannot be used as page ids. - Links in a plan: `#section-id` scrolls on the home page, `/shop` opens the Shop page. The storefront turns these into real addresses. - A link to another page is `/` plus the page id, such as `/about`. `PlanValidator` rejects a link to a page that does not exist. - When a chat edit adds a page, the app adds a menu link to it if the AI forgot (header first, footer if the header is full). When a page is removed, links to it are removed too. - `PlanUpgrader` converts an old version 1 plan to version 2. - `PlanSchema.php` is the one place that says what is allowed. `PlanValidator` checks every plan before saving and removes anything unknown. Links can only point inside the page, inside the site, or to `https`, `mailto` and `tel` addresses. - Products: prices are saved in sen (whole numbers) to avoid rounding errors. Photos are saved on the `public` storage disk, which needs `php artisan storage:link` once per machine. - Cart: only product ids and quantities are saved in the session. Prices and stock are always read fresh, so the cart never shows an old price, and it corrects itself when stock runs low or a product is hidden. - Checkout: the shopper fills in contact details and a Malaysian address, we save an order as "Awaiting payment", then send them to Stripe's own payment page. Card details never touch our server. - An order keeps its own copy of product names and prices, so it never changes when a product is edited or deleted later. Order numbers count up per store from 1001. - An order becomes "Paid" only after we ask Stripe directly and the amount matches. Then stock goes down, the cart is emptied and the email is sent. This happens once, even if both the return page and the webhook report the payment. - Payments go through one interface (`PaymentGateway`), like the AI layer. Stripe is the only provider for now. - Stripe shows whichever payment methods are switched on in the Stripe dashboard for MYR (cards now; FPX and e-wallets can be switched on there, Step 7). - Until a store has real products, its home page shows the example products the AI wrote. - To add a new section type: add it to `PlanSchema.php` and `types.ts`, write one React component, add one line in `renderer.tsx`. - The storefront uses its own colours through `--sf-*` CSS variables, so it never mixes with the dashboard theme. ### How AI generation works (added in Step 3) - All AI calls go through `AiManager`. It reads `config/ai.php`, which reads `.env.local`. - Three providers exist: `claude`, `deepseek`, and `fake`. The `fake` one needs no key and costs nothing: it returns the built-in sample design. Use `fake` for free development work. - The DeepSeek driver speaks a common format that many providers share, so most new providers need only a few lines in `config/ai.php`. - A full design: the AI gets our rules (built from `PlanSchema.php`) and the brand description, and answers with a store plan. - A chat edit: the AI gets the current plan and the request, and answers with only what to change. We apply that to the plan. - Every answer goes through `PlanValidator`. If it fails, the AI gets one chance to correct it. If it fails again, the job fails and the store is not changed. - AI work runs in the background. Each job is one row in the `store_generations` table, which also drives the progress screen and counts usage. - Limits: the first design of a store is free. Later full designs count as regenerations. Failed jobs never count. Limits are in `config/plans.php`. - Until Step 6 (billing), every user is on the free trial. The plan name is stored in the `plan` column of the `users` table. - The AI is told not to invent facts (awards, halal or other certificates, contact details) that the merchant did not give. ### How publishing works (added in Step 5) - A published store opens at `.`. The domain is `localhost` on a development machine and is set with `STOREFRONT_DOMAIN` once the app is hosted. The port and http/https come from the address the app itself is opened at. - The `stores` table has `published_plan` (the copy shoppers see) and `published_at`. `plan` stays the working design. Publishing copies `plan` into `published_plan` after checking it once more. - Products, prices and stock are always live. Only the design waits for "Publish changes". - The same controllers and screens serve the live store and the owner's preview. `App\Storefront\Storefront` is the only place that knows the difference: which store, which design, and what the links are built on. - On a store's address only store pages exist. Everything else, including the dashboard and login, gives "not found". - Taking a store offline keeps the design, products and orders. - Some store names cannot be used as addresses (`www`, `admin`, `login` and so on). Such a store gets a number added, for example `login-2`. ### How billing works (added in Step 6) - Plans live in the `plans` table, not in code, so prices and limits can change without a release. `config/plans.php` holds only the trial length and the trial plan's key. - Every new account gets `trial_ends_at` 14 days ahead. While that date is in the future the account is on the free trial. - A paid plan is one row in `subscriptions`, a copy of what Stripe says. Stripe is the source of truth. The copy is refreshed when the merchant comes back from Stripe, every time the Billing page opens, and by the webhook. - An account's current plan is: an active paid plan, otherwise the free trial while it lasts, otherwise nothing. "Active" includes `past_due` (a card failed and Stripe is retrying). - With no plan: AI, new stores and publishing are refused, and live stores show "not found". Nothing is deleted, and everything returns once a plan is chosen. - The Stripe product and price for each plan are created the first time someone subscribes to it, and saved on the plan. - Switching plans changes the existing subscription; Stripe charges or credits the difference on the next bill. - Subscriptions go through one interface (`SubscriptionGateway`), like payments and AI. ### How merchants get paid (planned 2026-11-30, not built yet) - Today every shopper payment lands in **our** Stripe account. Before real merchants sell, this changes to **Stripe Connect**: each store connects the merchant's own Stripe account, and shopper payments go straight there. Stripe pays it into the merchant's bank. We never hold shop money (holding other businesses' money can need a Bank Negara licence, and would make refunds and tax our problem). - Payments are "direct charges": the Stripe payment page is made on the merchant's account, so the merchant is the seller on the shopper's bank statement and receipt. - The merchant gets their own full Stripe Dashboard. They pay Stripe's fees, and handle refunds and disputes (bank chargebacks), because they are the seller. - **No cut for us** (decided 2026-11-30): we earn from the monthly plan only. A cut per sale (Stripe's "application fee") can be added later without merchants connecting again. - Setup: in Settings, the merchant clicks "Connect Stripe". We create a Stripe account for the store and send them to Stripe's own sign-up page, where Stripe checks their identity, SSM number and bank account. They come back to Settings. This is what Stripe recommends now, instead of the older "Connect with Stripe" sign-in. - Stripe only accepts its newer accounts API for this ("Accounts v2": `$stripe->v2->core->accounts` and `accountLinks`; our `stripe/stripe-php` 23 has it). The older one was refused on 2026-11-30. The account is made with `dashboard: full`, country `my`, currency `myr`, the `merchant` configuration with card payments, and Stripe collecting fees and covering losses. FPX cannot be asked for when the account is made (Stripe first needs the business type), so it is asked for after the merchant finishes Stripe's sign-up. Found in the real test: the v2 update refuses Malaysian sole proprietors, so FPX is asked for with the older capability call; and an approved FPX still starts switched off in the merchant's payment method settings, so we switch it on there too (otherwise shoppers only see cards). - Stripe's test sign-up asks for a password and two-step sign-in (the merchant does these), then business, person, bank ("Use test account") and public details. Its page went blank once; our `resume` link opened a fresh one. - One Stripe account per store, like EasyParcel. Code: `app/Commerce/Payments/` (`StripeConnect`, `MerchantAccounts`, `StripeMerchantAccounts`), `StripeConnectController`, `StripeConnectWebhookController`. - Orders paid before Stripe Connect (into our own account) have no `payment_account` and are still checked in our own account. - A store cannot take orders until Stripe says it can accept payments. Shoppers see "This store is not taking orders yet" at checkout. The merchant sees a reminder in Settings and on the overview. - Each order saves which Stripe account it was paid into, so checks and refunds go to the right account even if the merchant reconnects later. - Discount coupons are made on the merchant's Stripe account, because the payment page lives there. - Stripe tells us about payments on merchants' accounts through a second webhook ("Connected accounts" events), and tells us when a merchant's setup is finished (`account.updated`). - FPX needs the merchant's SSM number (Stripe's rule). Merchants without a registered business may only be able to take cards. - Our own monthly plans (Billing) stay on our own Stripe account. Nothing changes there. - Plan B, if Stripe will not run Connect for a Malaysian platform: each merchant connects their own Malaysian payment gateway (such as CHIP or Billplz) instead, in the same "connect" way. The `PaymentGateway` interface already allows a second provider. ### How shipping and WhatsApp work (added in Step 7) - Shipping fees are stored on the store in sen (`shipping_west`, `shipping_east`, `free_shipping_over`). Sabah, Sarawak and Labuan use the east fee; every other state uses the west fee. - The fee goes through one interface (`ShippingProvider`). `FlatRateShipping` is the first provider; EasyParcel live rates can replace it in one place. - The order saves `shipping_total`, and Stripe must collect subtotal plus shipping before the order counts as paid. - `shipped_at`, `shipping_courier` and `tracking_number` on the order record the delivery. Only paid orders can be shipped. - **EasyParcel (decided 2026-11-26):** each merchant connects **their own** EasyParcel account (they sign up, top up credit, then click "Connect EasyParcel" and Allow). Parcels are paid from their credit, so we never hold shipping money. We cannot open EasyParcel accounts for merchants (EasyParcel checks identity and has no sign-up API), so Settings shows a 4-step guide instead. One account of ours for everyone (EasyParcel "Marketplace") was turned down: we would have to charge merchants back. - EasyParcel uses its new Open API (version 2026-09, `api.easyparcel.com`) with OAuth (PKCE). The app's client ID and secret come from developer.easyparcel.com and live in `.env.local`; the redirect address is `/easyparcel/callback`. Sandbox or live is decided by which EasyParcel account the merchant signs in with. Tokens are stored encrypted in `easyparcel_accounts` and renewed by themselves. Code: `app/Commerce/Shipping/EasyParcel/`. - First version (2026-11-26): **book a courier on a paid order**. The merchant types the parcel (weight and size, filled from "Your usual parcel" in Settings), sees every courier's price cheapest first, picks one and a collection day, and books. EasyParcel takes the price from their credit. The order saves the shipment number, price, courier, tracking number, label and tracking link. The order counts as shipped, and the shopper gets the "on its way" email, once the tracking number is known (some couriers give it a minute later: "Check for the label"). Services that deliver to a collection point are left out. Paid EasyParcel extras (SMS, WhatsApp tracking) stay off. - Checkout prices: shoppers still pay the flat fees. Later, the merchant will be able to choose "live rate" (the real courier price) instead. - What the real EasyParcel sends (found in the sandbox test): courier names are company names ("J&T Express (Malaysia) Sdn. Bhd."), so we show the service name without brackets ("J&T Express") and keep "Pickup needs at least N parcels" as a note; the delivery time is `{"type":"days","value":"3"}`, shown as "About 3 days"; errors are wrapped one level deeper than the docs show. A changed `.env.local` needs the app server restarted. - Pickup address on the store (`pickup_address`, all or nothing), usual parcel `parcel_weight` (grams) and `parcel_size` (cm). - WhatsApp numbers are saved as digits with country code (`60123456789`). Only Malaysian numbers are accepted. `MalaysianPhone` does the cleaning. - Messages the server shows to shoppers live in `App\Storefront\StorefrontText`; words drawn in the browser live in `resources/js/storefront/text.ts`. ### Shopper emails (restyled 2026-11-30) - The "order paid" and "order shipped" emails are in the store's own look, not ours: its name (from its header), colours, heading and body fonts (with a safe fallback of the same kind, since email apps rarely load web fonts) and corner rounding, from the design shoppers see. Our app's name is not shown. - Built with `App\Mail\StoreBrand` and the Blade components `x-mail.store` (frame) and `x-mail.store-button`, tables and inline styles only. Each email also has a plain-text version. - Buttons: "View your order" (the live store's order page, or the merchant's preview when the store is not live), "Ask on WhatsApp" when the store has a number (a text link in the shipped email), and "Track your parcel" when the courier gave a tracking link. Buttons stack on phones. - Links are built from `APP_URL`, because the paid email can be sent from the webhook, where there is no shopper visit. - Sender and replies (added 2026-11-30): the emails come from our address (so they are delivered) but under the store's name, such as "Luna Skin ". Replies go to the store's "Email for shoppers" (`stores.contact_email`), set in Settings under "How shoppers reach you" next to WhatsApp, with a one-click "Use ". It is also shown at the bottom of the emails. When empty, there is no reply address. The account email is never used unless the merchant saves it. ### How discount codes work (added in Step 8) - Codes live in the `discount_codes` table, per store, saved in capital letters. Shoppers may type them in any case. - A code takes money off the **products only**, never off shipping. Percentages are rounded down to the sen. A fixed amount never takes off more than the products cost. - Free shipping is judged on the product price **after** the discount. - The code in a cart is kept in the shopper's session. The cart checks it every time: a code that was switched off, expired or used up is taken out, and the shopper is told. A code that needs a bigger cart stays, with a "spend at least RM X" message, and is worth nothing until then. - If the code stopped working between the cart and paying, checkout stops with a message, so the total never surprises the shopper. - After the discount, the order total must still be at least RM 2.00 (Stripe's minimum). - The order saves `discount_code` and `discount_total`. Deleting or changing a code later never changes old orders. - A code counts as used only when its order is **paid**, once per order. Two shoppers paying at the same moment could both use the last remaining use; this is accepted. - Stripe gets a one-off coupon worth exactly the discount, so its page shows the code and the saving. - Days are Malaysian days: a code runs from the start of its first day to the end of its last day in Malaysian time. ### How product variants work (added in Step 8) - A product's `options` hold up to 2 options with their choices, such as `[{"name": "Size", "values": ["250g", "500g"]}]`. Null means a simple product. - `product_variants` has one row per combination (`option1`, `option2`), each with its own price, "price before discount" and stock, in sen. - For a product with options, the product's own price is the lowest variant price and its stock is all variants together. This keeps lists, cards and the featured section right; they show "From RM X" when variant prices differ. - In the cart each line is named after the product, or "product-variant" (for example `12-34`). A product with options must be bought as one of its variants. - Order lines keep the variant's name (`variant_name`) and include it in the line name, such as "Sambal (500g / Pedas)", so emails, Stripe and order pages all show the choice. Paying lowers the chosen variant's stock. - Editing a product keeps variants whose choices did not change, so carts holding them stay valid. Combinations that disappear are removed. - Limits: 2 options, 20 choices per option, 50 combinations. ### How bundles work (added in Step 8) - A bundle is a product with `is_bundle` on. `bundle_items` lists what is inside: a product (and, for a product with options, one variant) and how many. - A bundle has its own price (and optional "price before discount"), but no stock of its own. Its stock is how many times the items allow, for example 10 sambal ÷ 2 and 3 kerepek ÷ 1 gives 3. `BundleStock::refresh()` saves that number on the bundle whenever stock in the store changes (product saved or deleted, order paid), so lists, cards and the cart read it like any other product. - A bundle cannot hold itself, another bundle, or a product of another store. A product with options must name one of its variants. Up to 10 items, up to 20 of each. - Products inside a bundle are protected: they cannot be deleted, become a bundle, gain or lose options, or lose a choice the bundle holds. The merchant takes them out of the bundle first. - At checkout, a bundle and the same items bought on their own are checked together against the stock. - Each order line for a bundle keeps `bundle_contents` (what was inside at the time). Paying lowers the stock of those items. The merchant's order page shows "Each has: 1 × Cleanser, 1 × Moisturiser (50ml)" for packing. - The product form shows "Bought one by one: RM X" and how many bundles can be sold, to help set the price. The storefront product page shows "What's inside" with links to the items. ### How automatic discounts work (added in Step 8) - An automatic discount needs no code. It applies by itself when the cart qualifies: a name shown to shoppers ("Raya Sale"), percent or fixed amount off, an optional minimum number of items and/or minimum spend, all products or only chosen ones, optional dates, on or off. They are listed on the Discounts tab under the codes. - With chosen products, only those count towards the minimum and only those get cheaper. A fixed amount comes off once per order, never more than the eligible products cost. - **Only one discount applies per order.** The cart compares the code (if any) with every running automatic discount and uses whichever saves the most. If the code loses, the cart says "Raya Sale already saves you more, so this code is not used". A code only counts as used when it was the one applied. - The cart nudges shoppers who are close: "Add 1 more to get 10% off (Raya Sale)" or "Spend RM 10.00 more to get …". - Product pages show the running automatic discounts that cover that product. - The order keeps the name in `discount_name` (codes stay in `discount_code`). Stripe's page, the thank-you page, the email and the merchant's order page all show it. - Free shipping over an amount was already built in Step 7 (store Settings), so it is not an automatic discount type. - Chat: `create_automatic_discount` ("buy 2 sambal, get 15% off until end of January"), with the same confirm step as other chat commands. ### How chat commands work (added in Step 8) - The same "Ask the AI" box in the Design tab handles design changes and store changes. Each message counts as one AI edit. - **"Ask the AI" is a floating button (changed 2026-11-25):** a round button stays at the bottom right of the Design tab (`design-chat.tsx`). Clicking it opens a chat panel above it (400 wide; full width on phones) that does not cover the whole page, so the preview can be watched while the AI works. Newest message at the bottom, Enter sends, Shift + Enter for a new line, Escape closes. The button shows "AI is working…" while a request runs and a yellow dot when a change waits for the merchant's OK. Toasts move up on that page so they do not cover the button. - **Select to edit (added 2026-11-25):** a "Select to edit" button above the preview (also a link inside Ask the AI). The merchant clicks one thing (heading, text, photo, button) or drags a box over an area; a green outline with a tag ("Hero › Heading") shows what will be picked. The section is recognised from the page itself (`data-section` and `data-section-type` on each band; header and footer by tag), so it is instant, exact and free; no picture is sent to an AI. Ask the AI then opens with "Editing: Hero · Text …" and sends `target_section`, `target_label`, `target_detail`; the request saves them in `store_generations.target` and the chat history shows the tag. The AI is told what was selected and that "this" means it (`PlanPrompt::selectionNote`). Only that part can change: `PlanChanges::limitTo` keeps updates to the section, its removal (with menu link fixes) or a new section right after it, and drops theme, other sections, pages, header and footer. Store actions (prices, codes) still work. A whole-store wish ("make the colours black") is skipped and the reply says to ask without selecting. A section that no longer exists is refused. Counts as one AI edit as usual. Code: `components/stores/preview-picker.ts`. Tested with real DeepSeek: a mixed request changed only the heading; "shorten this" changed only the selected text. - Besides design changes, the AI may answer with `actions`: `create_product`, `update_product` (name, price, "was" price, stock, status, per variant for products with options), `create_discount`, `update_discount` (on/off, last day, number of uses) and `create_bundle`. At most 10 per message. - The AI gets the full product list (drafts, stock, choices), the discount codes and today's Malaysian date, so "until the end of the month" works. - `App\Commerce\ChatActions` checks each action with the same rules as the Products and Discounts forms (discount rules are shared through `DiscountCodeRules`). A wrong product, choice or code goes back to the AI once to fix, like a bad design answer. - Actions are saved on the chat message (`store_generations.actions`, `actions_status`) and shown as plain sentences, such as "Change "Moisturiser (100ml)": price RM 55.00 → RM 52.00". Nothing changes until the merchant clicks Confirm. Cancel changes nothing. - On Confirm everything is checked again (the store may have changed), and either all actions happen or none. If one fails, the merchant sees why and the card stays waiting. - Product descriptions (added 2026-11-17): "write descriptions for my products without one" or "rewrite the sunscreen description". The AI writes 2 to 4 sentences from the product name, its choices, what is inside a bundle and the store's category, in the store's language, and must not invent facts (ingredients, halal, awards, health claims, numbers). The confirm card shows the full text before anything is saved. The AI is told which products have no description and what each bundle contains. Up to 10 actions per message, so a small store fits in one message. - The AI cannot add photos, delete products or codes, or change options; it tells the merchant to use the Products or Discounts tab. ### How the featured product section works (fixed in Step 7) - A `featured_product` section may hold `productSlug`: the web-address name of one of the store's active products. Product web-address names never change, even when a product is renamed, so the link stays good. - Linked: the store shows the product's real name, price, "price before discount", photo and sold-out state, and the button opens the product page. The AI's description and bullet points stay. - Not linked and the store has products: the price is hidden, because the AI's price is only an example. - Not linked and the store has no products: the AI's example name and price show, so a new store never looks empty. - The merchant links it with the "Featured product" picker on the Design tab, or by chat. The AI is given the store's product list; a made-up product name is sent back to the AI to fix. - The link is part of the design, so on a live store it shows after "Publish changes". Price and stock changes show straight away. - A linked product that is sold out shows a "Sold out" label, and its button says "View product". ### How hero photos work (added in Step 9 part 1) - The hero section has 3 layouts: `image-full` (a photo across the whole width, words on top with a dark fade so they stay readable), `split` (words beside a tall photo) and `centered` (words only, as before). - The hero's `image` field names a photo: `upload:12` (a banner photo uploaded in the Design tab, saved in `store_images`) or `product:web-address-name` (that product's main photo). Null means automatic: the store's newest active product photo. With no photos at all, the hero shows a soft pattern in the store's colours. - The Design tab has a "Hero" box for each hero section: layout buttons, photo thumbnails (Automatic, uploads, product photos) and an upload button (JPG, PNG or WebP, up to 6 MB, at least 300 by 200 pixels; 600 by 400 until 2026-11-25). Uploading into a words-only hero switches it to "photo beside words" so the photo shows. Changes are part of the working design, so a live store shows them after "Publish changes". - The AI is told to prefer photo layouts and is given the list of photo names. A made-up photo name is sent back to it once to fix. A photo already in the design that was later deleted does not block chat edits; that hero just falls back to automatic. - **Banner photos are got ready in the background (added 2026-11-25):** after upload, the queued job `PrepareBannerPhoto` runs `App\StorePlan\BannerPhoto` (built-in GD, free): small photos are enlarged to 1600 pixels across with a light sharpen, photos with a side over 2400 are made smaller, phone photos are turned upright, and every photo is saved as WebP (quality 82), which also drops hidden details like GPS location. The design points to the photo by id, so it uses the new file by itself; the uploaded file is deleted. If the photo cannot be read, the upload stays in use. Chosen over an AI upscaler (sharper but paid, needs a new key and sends photos out); an AI upscaler can replace `resize()` later. Product photos are not processed yet. - Product cards show the product's second photo when the shopper points at the card. Placeholders show the first letter of the product in the store's heading font instead of plain shapes. ### How the announcement bar and trust row work (added in Step 9 part 2) - **Announcement bar:** a slim bar in the store's main colour above the header, on every store page. It shows the merchant's own lines (Settings tab, up to 3, one per line, 90 characters each) and then lines the store writes by itself: free shipping ("Free shipping on orders over RM 100.00" or "on every order") and every running automatic discount ("Glow Week: Buy 2 or more, get 10% off"). An ended discount is never announced. Several lines take turns every 4.5 seconds, with arrows; they stop while the shopper points at the bar and never move for visitors who ask their device for less motion. On by default; the merchant can switch it off. These are store settings, so they show on the live store straight away, without "Publish changes". - **Trust row:** a new section type, `trust_bar`, with layouts `row` (a band of icons) and `boxed` (small cards), 2 to 4 items. Items of kind `shipping`, `payment` and `whatsapp` are written by the store from its real settings, so they stay true when settings change (the WhatsApp item hides when there is no number). A `custom` item has a title, optional text and an icon from a fixed list, and the AI may only state what the merchant said. The AI adds a trust row after the hero in new designs, and can add one by chat. - "Secure checkout, pay safely through Stripe" is used instead of listing payment methods, because FPX and e-wallets depend on what the merchant switches on in Stripe. ### How the product page works (upgraded in Step 9 part 3) - **Folding sections:** each product can have up to 5 sections (`products.details`, title and text), edited under "More information" in the product form. A "Shipping" section is always added by the store from its real fees (Peninsular, Sabah/Sarawak/Labuan, free shipping), so it is never out of date. - **Chat:** `create_product`, `update_product` and `create_bundle` accept `details`. In `update_product` they merge by title (same title rewritten, new title added) and `remove_details` takes sections out, because the AI only sees section titles, not their text, and must not wipe them. The confirm card shows the full new text. The AI must not write ingredients or materials unless the merchant gives them. - **Trust points** under the button: shipping, secure checkout, and "Ask about this product on WhatsApp" (opens WhatsApp with the product name), all from real settings. - **Sticky add-to-cart bar on phones:** appears once the main button has scrolled up under the header; shows the name, choice and price. It is hidden for sold-out products. The WhatsApp button moves up while it shows. (A scroll check is used, because some embedded browsers ignore the "intersection" margin.) - **Pairs well with:** up to 4 products: those sold in a bundle with this one first, then the bundles containing it, then other in-stock products, newest first (`App\Storefront\RelatedProducts`). - **Phone menu:** below tablet width both header layouts show a menu button that opens all links and the header button; Escape or a link closes it. - On wide screens the photos stay in view while the shopper scrolls the details. ### How store styles work (added in Step 9 part 4) - `theme.style` in the store plan has six optional parts: `buttons` (solid, outline, shadow), `cards` (border, shadow, plain, hard), `spacing` (compact, normal, airy), `headings` (normal, uppercase, heavy), `backgrounds` (plain, alternate) and `motion` (none, gentle). A plan without it uses `PlanSchema::STYLE_DEFAULTS`, which look exactly like stores did before, so old designs need no change. - The storefront root carries `data-buttons`, `data-cards` and so on; `resources/css/app.css` turns them into looks. Components only carry five classes: `sf-btn-primary`, `sf-btn-outline`, `sf-card` (cards and photos), `sf-section` (section spacing) and `sf-band` (each section on a page). A new component gets every style by using those classes. - **Ready-made looks** (`PlanSchema::STYLE_PRESETS`): Minimal, Soft, Elegant, Bold, Playful and Classic. Each sets the style, corner roundness and fonts, never the colours. They are in the **Style** box of the Design tab, with a "Fine-tune" panel for single options. - **Fonts:** 20 in all. Archivo Black, Bebas Neue, Caveat and DM Serif Display are for headings only; the checker refuses them for body text. - **Alternate backgrounds** skip sections that bring their own background (hero, trust row, testimonials, newsletter). - **Gentle motion:** sections that start below the first screen fade up as they come into view. Anything on the first screen is never hidden, and nothing moves for visitors who ask their device for less motion. A scroll check is used instead of an intersection observer, for the same reason as the sticky cart bar. - **AI:** chooses a style that fits the brand when generating (with examples per kind of brand), and changes it by chat ("make it more premium", "bolder"). ### Section layouts (added in Step 9 part 5) | Section | Layouts (new ones in bold) | | -------------------------- | ----------------------------------------------------------------------------------------------------- | | Hero | centered, split, image-full | | Products | grid, minimal, **carousel** (one sideways row with arrows), **large** (2 big cards, up to 4 products) | | Featured product | image-left, image-right, **stacked** (wide photo on top, words centred) | | About | simple, with-stats, **statement** (the story as one large statement; a step smaller when it is long) | | Reviews | cards, single, **wall** (quotes packed in columns) | | FAQ | list, two-column, **cards** (every answer showing) | | Newsletter | banner, card, **split** (big heading beside the form) | | Footer | simple, centered, **columns** (store name and text, links, shop and help links) | | Header, contact, trust row | 2 each, unchanged | - The Design tab has a **Layouts** box (closed by default) listing every section with its layout in plain words; heroes stay in their own Hero box. `App\StorePlan\SectionLayouts` finds and changes them; only layouts of the section's own type are accepted. - The AI is told what each new layout looks like and when it suits, and can switch layouts by chat ("make the products slide sideways"). - **Show in the preview (added 2026-11-25):** in the Design tab, a section's name (Layouts, Hero, Featured product, Video and Bento boxes) is a button with a small target icon. Clicking it brings the preview into view, scrolls the preview to that section (below the store's sticky header) and outlines it in green with its name for about 2.5 seconds. A section on another page (such as About us) opens that page first. Each section's band in the store carries `data-section=""`; header and footer are found by their tags. Code: `resources/js/components/stores/preview-highlight.tsx`. ### How collections, bento and video work (added in Step 9 part 7) - **Collections** (`collections`, `collection_product`): groups of products such as "Sun care". Managed in a Collections box on the Products tab (name, short description, products) or by chat (`create_collection`, with the confirm step). The address `/collections/{slug}` is set when created and kept when renamed, so links keep working. Deleting a collection never deletes products. - Shoppers get a page per collection (`/collections/{slug}`, also in the preview) and links between collections on the shop page. Only collections with at least one active product are shown. `collections` is now a built-in address and cannot be a page id. - **Shop by** section (`shop_by`): the collections as round photos (`circles`) or photo tiles (`tiles`); the photo is the first active product's photo. It names collections in order, or shows all with an empty list, and shows nothing until a collection has products. The AI only adds it when given the list of collections; a made-up collection name goes back to it once. - **Bento** section (`bento`): 3 to 6 tiles, each with title, optional text, a link, and a photo name (like a hero's) or a colour (primary, accent, dark, surface). `mosaic` makes the first tile big; `even` makes them equal. Bento photos are resolved with hero photos (`HeroImages::refs`). - **Video** section (`video`): a YouTube or Vimeo address only (`PlanSchema::VIDEO_PATTERN`, which refuses look-alike addresses). Only a picture shows until the shopper presses play; then a privacy-friendly player loads (youtube-nocookie, Vimeo with do-not-track). The AI may only use a video address the merchant wrote in the chat or the brand description; any other is refused. The sample design has no video on purpose, so the AI never copies one. Uploading video files is not supported yet. - **Design tab boxes (added 2026-11-22):** a **Video** box (paste a YouTube or Vimeo link, heading, short text, layout, and where to put it; edit or remove later, with a preview picture) and a **Bento tiles** box ("Add tiles" puts in 3 starter tiles: the whole range with a product photo, the first collection or the products section, and the brand story; then edit each tile's title, text, link (with suggested links), photo and colour, add or remove tiles between 3 and 6, or remove the set). Both use `App\StorePlan\SectionEditor` and go through the plan checker, so a broken link or a photo from another store is refused. ### Our home page (added 2026-11-22) - The page at `/` sells AI Commerce to merchants (`resources/js/pages/home.tsx`, `HomeController`). Its content follows the outline of afilink.app (hero with a "name your store" box, the two sides, 3 steps, chat example, styles, features, pricing, questions, final call), but the look is our own: pandan green, turmeric yellow and a little hibiscus red on a mint-white, with Plus Jakarta Sans for headings and Instrument Sans for text (afilink uses Bricolage Grotesque, Nunito and lavender). - Prices come from the `plans` table, so the page always matches the Billing page. The store address preview uses `STOREFRONT_DOMAIN`. - "Start free" goes to sign-up (or the dashboard when signed in). The store name typed in the hero is kept in the browser and fills in the "Create a store" form (`?name=` or a saved name), and is forgotten once a store is created. - Every claim is true today: no FPX, own domains or real reviews are promised (the questions say own domains are not available yet). Update the page when those arrive. - The page has no dashboard frame (it replaces the starter "welcome" page) and keeps its own colours in light and dark mode. - The hero picture moves, in the way afilink's does (studied 2026-11-22): on wide screens (1024px and up) the hero stays pinned while the visitor scrolls, and scrolling puts the sample store together (the merchant's words, the store's banner and three products fly into place, then the frame and the feature tags appear). A hint says "Scroll to watch your store come together". On phones and tablets it plays once by itself after the page opens. The feature tags float gently up and down afterwards (CSS `h-bob`, 6 and 8 seconds, out of step). Visitors whose device asks for less motion see the finished picture with nothing moving. - The sample store and the "You write" bubble also float slowly up and down all the time, like afilink's phone (CSS `h-float`, 7 and 9 seconds, out of step). It moves `transform`, so it adds to the hover lift instead of fighting it. - More motion (2026-11-22), helpers in `resources/js/components/home/motion.ts`, styles `h-*` in `app.css`: 1. Sections fade up as they come into view (`data-reveal` on headings and cards, cards one after another). Things already on the first screen never hide. 2. The "You write" bubble types itself out first; on phones the store builds once the typing ends. The full words hold the bubble's size so nothing jumps. 3. The chat example plays like a real chat when it comes into view: message, typing dots, reply, the change waiting for an OK, then "Confirmed". A "Play again" button replays it. 4. The styles section has one big sample store that changes look every 3.2 seconds, with a timer bar under the look that is showing. Clicking a look shows it and stops the changing. 5. A line runs through the 3 steps (across on wide screens, down the left on phones) and fills in green as the visitor scrolls; each number lights up when the line reaches it. 6. A strip of Malaysian shop types (Sambal, Batik, Skincare, Kek lapis…) drifts sideways under the hero; hovering stops it. Everything shows its finished state, with nothing moving, when the device asks for less motion. - Hovering lifts things: the sample store or the "You write" bubble rises and moves in front of the other (the bubble also straightens), and each pricing card rises with a deeper shadow. Uses the separate CSS `translate` and `scale` properties so it does not fight the scroll animation; skipped when the device asks for less motion, and phones have no hover. - The tags are placed so they never cover the store's words or its button (the WhatsApp tag sits beside "Shop the jars" inside the banner), and the flying pieces stay on the right so the store-name form is never covered. ### Privacy policy and terms (added 2026-11-22) - `/privacy` and `/terms` (`LegalController`, `resources/js/pages/legal/`), with the home page's look (shared colours, fonts and logo in `resources/js/components/home/brand.tsx`). Linked from the home page footer and the sign-up page ("By creating an account, you agree to…"). - Written in plain English for Malaysian law: the Personal Data Protection Act 2010 (with the 2024 changes: breach notices, data portability), the Consumer Protection Act 1999 and its online-selling rules. A first draft, not checked by a lawyer yet. - The merchant is the seller; we hold shoppers' details for the merchant. - The pages name the AI companies the tasks use right now, read from `config/ai.php` and the company list in `config/legal.php`. Switching a model in `.env` keeps them truthful. A new AI provider must be added to `config/legal.php` too (a test fails otherwise). - They say what goes to the AI (brand description, AI messages, store design and words, product names, prices and photo names) and what never does (passwords, cards, shoppers' details and orders). Keep this true when the AI is given more. - Who runs the service, the SSM number, contact email and address come from `LEGAL_OPERATOR`, `LEGAL_REGISTRATION`, `LEGAL_EMAIL` (falls back to `MAIL_FROM_ADDRESS`) and `LEGAL_ADDRESS`. The "last changed" date is in `config/legal.php`; change it whenever the wording changes. - Promises made in the terms: 30 days' notice before a price change or closing the service, 14 days before important changes to the terms, no refunds for unused days, replies to data requests within 21 days. The terms do not yet say how merchants are paid; update them once Stripe Connect is decided. ### Overview dashboard and Store pulse (added 2026-11-22) - The dashboard page is now an Overview (`DashboardController`, `app/Dashboard/OverviewStats.php`, `resources/js/pages/dashboard.tsx`, `resources/js/components/overview/`), in the home page colours with its own dark version (`.overview` tokens in `app.css`). Chosen from three trend designs: an AI note on top of colourful number boxes. - Order, top to bottom: Store pulse (AI note), four numbers (sales, paid orders, average order, to ship now), sales chart beside "Needs attention", sales by store beside top products, recent orders. Filters: Today, 7 days, 30 days, This month, and a store picker. - Only paid orders count as sales, on the Malaysian day they were paid. Sales are what shoppers paid, shipping included. Each range is compared with the same length of time just before it; "This month" with the same days of last month. - "Needs attention": orders to ship per store, products with 5 or fewer left (active, not bundles), unpublished design changes, stores designed but not published (several make one line), trial ending in 7 days or plan ended. - Before the first sale the page shows "Get your first sale" (create, design, products, publish) and zero boxes instead of empty charts. No AI note then. - The stores list moved to the sidebar as a tree: Overview, "Your stores" (Create store first, then each store with Design, Products, Orders with a to-ship badge, Discounts, Settings; each store shows a coloured tile with its first letter, the same colour every time from its web address, with a green (live) or yellow (draft) dot on its corner, so stores can be told apart when the sidebar is folded), Account (Billing), and a plan box. Shared on every page as `sidebar` (`HandleInertiaRequests`). The starter kit's Repository and Documentation links are gone. Breadcrumbs say "Overview". - Store pulse (`app/Dashboard/StorePulse.php`, table `dashboard_pulses`): AI task `pulse` (DeepSeek by default, `AI_PULSE_PROVIDER`/`AI_PULSE_MODEL`, 400 tokens). Written once per Malaysian day per view (all stores, or one store) and saved, so refreshing costs nothing; it loads just after the page (deferred). Only numbers, store names and product names go to the AI, never shoppers' details (the privacy page says so). - "Write again" asks for a fresh note, 3 times a day in all (`AI_PULSE_DAILY_REWRITES`), shown under the button ("2 of 3 left today"). It does not count toward the plan's AI changes. A failed AI answer does not use a turn. - If the AI cannot answer, the note is written from the numbers instead. The buttons under the note (ship, restock, publish) are worked out by us from the numbers, not by the AI. - First real note: 442 tokens in, 63 out. - **Theme switch (added 2026-11-25):** Light and Dark sit in the sidebar footer, just above the user (`components/theme-switch.tsx`), one click each. With the sidebar folded it is one sun or moon button that flips between them. No System choice there: someone who never chose still follows their device, and the switch highlights how the page looks now. It uses the starter kit's `useAppearance` (browser storage and an `appearance` cookie); Settings → Appearance still offers System. ### Category guides for the AI (agreed 2026-11-17) - The category the merchant picks on the Create store page (Fashion, Beauty, Food, Home, Electronics, Health, Kids, Digital, Other) chooses a short design guide that is sent to the AI with the brand description. - A guide is a starting direction, not a template: for example Fashion = big photos, magazine feel, lookbook; Food = warm and appetising, "how it's made", reviews high up; Beauty = soft and clean, "shop by skin need". "Other" has no guide. - The brand description decides the details, so two stores in the same category still look different (bold streetwear versus elegant modest wear). - Guides live in our code and can be improved any time. They only suggest styles and layouts the store can really show, so they are written after the style options and extra layouts exist (Step 9 parts 4 and 5). - To avoid repeats, the AI is told not to copy the example design and, for a merchant's second store, what their first store looks like. - Built in Step 9 part 6: `App\StorePlan\Ai\CategoryGuides` holds the guides; each offers 2 or 3 directions (for example Fashion: editorial, street and youth, modest and graceful) and the AI picks or mixes by the brand description. Each guide also says which claims never to make for that category (halal, health, certifications, specifications and so on). - `PlanPrompt::looksToAvoid()` lists up to 5 of the merchant's other stores and, on a redesign, the store's current design, each as a one-line summary (colours, fonts, corners, style, home layouts). Other merchants' stores are never included. - A test checks every guide only names fonts and layouts that exist, so a guide cannot point the AI at something the store cannot show. - Real test with Claude Sonnet: a Kelantanese food store came out dark and warm (Fraunces and Nunito, alternating bands, full-photo hero, "Cooked in Kota Bharu" trust point from the description); a modest-wear store came out ivory and elegant (Cormorant Garamond and Jost, spaced capitals, outline buttons, large product cards), and both differed from the merchant's existing stores. ### AI edits must really change something (added 2026-11-16) - In a real test, the edit AI replied "Done" without including the change. The app no longer trusts the reply for this: it compares the design before and after each chat edit and saves the answer in `store_generations.changed`. - When nothing changed, the chat shows "No change was made to your design." under the AI's reply. ### Plan prices and limits (starting numbers, adjust after real usage) | Plan | Price / month | Stores | Full regenerations / month | AI edits / month | | -------------------- | ------------- | ------ | -------------------------- | ---------------- | | Free trial (14 days) | RM0 | 1 | 2 in total | 30 in total | | Starter | RM39 | 1 | 3 | 100 | | Growth | RM99 | 3 | 10 | 500 | | Pro | RM249 | 10 | 30 | 2,000 | --- ## 3. Plan, step by step ### Step 0 — Prepare the local machine - [x] Check installed tools (see section 4) - [x] Install PHP 8.4 (8.4.27, via Homebrew; default `php` is still 8.2) - [x] Create a MySQL database for the project (`ai_commerce`) - [x] Set up git in this folder - [x] Code is in the private repository `https://git.mirfalah.my/mirfalah-tech/ai_commerce.git`. `main` holds Steps 1 to 4 (merged 2026-11-15). Each new step is built on its own branch and merged into `main` when finished and tested ### Step 1 — Project foundation - [x] Create Laravel 13 project with the React + TypeScript starter kit (Laravel 13.42, Inertia 3, React 19) - [x] Confirm the app runs locally - [x] Register, login, logout (from the starter kit, with email verification and two-factor login; passkeys left out) - [x] "Create a store" flow (name, category, language, description) - [x] Dashboard that lists the user's stores - [x] Users only see their own stores (other people's stores give "not found") - [ ] Ongoing rule: every new store-related table gets `store_id` (applies from Step 2 on) ### Step 2 — Store sections and renderer - [x] Define the "store plan" format (colours, fonts, corner radius, sections, text) and a validator that every plan must pass - [x] Build 10 React sections, each with 2 layout variants: header, hero, product grid, featured product, about, testimonials, FAQ, newsletter, contact, footer - [x] Renderer that turns a store plan into a storefront page - [x] Preview a store inside the dashboard (desktop and mobile size, plus open as full page) - [x] One hand-written sample plan to prove the renderer works (the "Apply sample design" button was removed in Step 3; the sample plan is now used by the `fake` AI provider) - [ ] Known gaps, to do later: mobile menu for header links; real images (placeholders for now); newsletter form does not save ### Step 3 — AI generation - [x] Swappable AI layer: one interface, one driver per provider, provider and model chosen per task in the settings file - [x] Test: switch the generation model in settings and confirm it works with no code change (automated test) - [x] Claude Sonnet 5.5 for first store generation (built with Anthropic's official PHP package) - [x] DeepSeek for small edits - [x] Run generation as a background job with a progress screen - [x] Check the AI result is a valid store plan before saving (one automatic correction, then fail and leave the store unchanged) - [x] Edit by chat ("make the banner darker") - [x] Count and limit regenerations and edits per plan - [x] Real test with API keys (2026-11-14): two stores generated with Claude Sonnet 5.5 in 13 to 19 seconds each, about 4,000 tokens in and 2,000 to 2,600 out (roughly US$0.03 per store). Two edits with DeepSeek in 1 to 2 seconds each. All answers passed the checker first time. Prompt tuned once so layouts differ between brands ### Step 4 — Commerce - [x] Store plan format changed to support several pages (version 2): one shared header and footer, plus a list of pages. Existing stores were converted automatically - [x] Products: create, edit, delete, up to 5 photos, price, price before discount, stock, draft or active - [x] Shop page (all products) and product page, built by us, in the store's colours and fonts - [x] The home page product section shows real products once the merchant adds some, with a "View all" button - [x] Cart: add from the product page, change quantity, remove, subtotal, cart count in the header. Kept in the browser session, one cart per store, no account needed - [x] Checkout with Stripe Malaysia (test mode): shopper details and address, then Stripe's hosted payment page. Tested with a real Stripe test payment on 2026-11-15 - [x] Orders list and order page for the merchant ("Orders" tab) - [x] Order confirmation email, in the store's language, sent once when the order is paid - [ ] Known gaps, to do later: (shipping fee and "mark as shipped" were done in Step 7 part 1); unpaid orders stay in the list as "Awaiting payment"; the Stripe webhook needs a public address, so it only starts working after hosting (Step 10) - [x] Content pages by chat ("add an About page", "remove the About page"): the AI creates the page, and the app itself makes sure the menu links to it. Tested with real DeepSeek on 2026-11-15 ### Step 5 — Publishing - [x] Publish a store to its own address (local: `storename.localhost:8000`). Shoppers need no login - [x] "Publish store", "Publish changes" and "Take offline" buttons on the store page, with the live address shown - [x] Shoppers see a saved copy of the design, so design changes stay private until the merchant publishes again - [x] The whole shop works on the live address: home, extra pages, shop, product, cart, checkout, thank-you page - [x] The dashboard and login pages cannot be opened on a store's address - [ ] Custom domains (after hosting is chosen, Step 10) - [ ] Known gaps, to do before launch: pages are drawn in the shopper's browser, so search engines may read them poorly (fix: server-side rendering); no page description or sharing image for search and social media yet; the browser tab shows our app name for a moment while a page loads ### Step 6 — Our own subscription billing - [x] Plans table matching the price table above (`plans` table; prices in sen) - [x] Subscribe, upgrade, downgrade and cancel through Stripe (Billing page). Cancel keeps the plan until the end of the paid month and can be undone - [x] Free trial of 14 days for every new account (existing test accounts got a fresh 14 days) - [x] Enforce plan limits: stores, regenerations and AI edits. When the trial ends with no plan, AI, new stores and publishing are switched off and live stores go offline; nothing is deleted - [x] Tested with a real Stripe test subscription on 2026-11-16: subscribe to Growth, cancel, undo - [ ] Known gaps, to do later: a merchant who downgrades keeps stores above the new limit (they just cannot add more); no invoices page yet (Stripe sends receipts); no email before the trial ends; the subscription webhook needs hosting, like the order webhook ### Step 7 — Malaysia features Part 1 (done 2026-11-16, no new accounts needed): - [x] Store "Settings" tab: WhatsApp number and shipping fees - [x] Flat shipping fees: one for Peninsular Malaysia (default RM 8), one for Sabah, Sarawak and Labuan (default RM 15), optional free shipping above an amount. Shown at checkout as soon as a state is chosen, on Stripe's page as its own line, on the thank-you page and in the email - [x] "Mark as shipped" on the merchant's order page, with courier and tracking number. The shopper gets a "your order is on its way" email once; later corrections do not email again - [x] WhatsApp chat button on every page of the store, "Ask about this order on WhatsApp" on the thank-you page, and "WhatsApp customer" on the merchant's order page (all `wa.me` links, no account needed) - [x] Bahasa Malaysia and English store generation (already working since Step 3; checked again) - [x] Checkout and cart error messages in the store's language - [x] Checked which payment methods the Stripe account has: cards on; FPX and GrabPay supported by Stripe in Malaysia but not switched on yet (switch on in the Stripe dashboard, no code change). DuitNow QR, Touch 'n Go and Boost are not offered by Stripe - [x] Tested with a real Stripe test payment on 2026-11-16: Sabah order, RM 15 shipping, total RM 70; then marked as shipped - [x] Fix: the "featured product" section can now be linked to a real product (picker on the Design tab, or by chat: "feature the green sambal"). Its real name, price, photo and page are shown. Before, it showed the AI's made-up name and price Part 2 (needs outside accounts): - [ ] Switch on FPX and GrabPay in the Stripe dashboard (your action), then test an FPX payment - [~] EasyParcel (branch `feature/easyparcel`): - [x] Connect the merchant's own EasyParcel account with a guided setup in Settings, pickup address, usual parcel size - [x] Book a courier on a paid order: compare prices, book, print the label, tracking number and "on its way" email - [x] App "AI Commerce" made in the EasyParcel Developer Hub (redirect `http://localhost:8000/easyparcel/callback`), keys in `.env.local`, sandbox account made. Tested for real on 2026-11-26: Luna Skin connected to the sandbox account, real courier prices came back (22 services, Pos MELPlus RM 7.63 cheapest), booking with no credit showed "this parcel needs RM 7.03" - [x] Booked a sandbox parcel on 2026-11-26 (Luna Skin order #1001, Pos MELPlus pickup, EasyParcel ES-2611-TK58P, RM 7.03): tracking number and link saved, label opens as a PDF, "on its way" email sent. Found that EasyParcel's quoted total includes tracking extras we do not book (RM 0.60), so prices shown are now shipment + its tax, matching what is charged - [ ] Live courier rate at checkout, as a choice next to the flat fees (plugs in behind `ShippingProvider`) - [ ] Tracking updates by themselves (collected, in transit, delivered) - [ ] Product weights, for a more exact parcel weight - [ ] Automatic WhatsApp order notifications (needs a WhatsApp Business Platform account from Meta, with approved message templates) - [ ] DuitNow QR and Malaysian e-wallets: only through a second payment provider (for example Billplz, ToyyibPay, HitPay or Fiuu). Decide whether it is worth it ### Step 8 — Discounts and product options Agreed on 2026-11-15. Build in this order. It comes after Step 7 because automatic discounts such as free shipping need shipping to exist. - [x] Discount codes (done 2026-11-16): "Discounts" tab for the merchant (code, percent or fixed amount off, optional minimum spend, first and last day, number of uses, on or off); a "Discount code" box in the cart; the order records the code and the amount taken off; Stripe shows the code and the saving. Tested with a real Stripe test payment: RM 42.00 − 20% (RM 8.40) + RM 8.00 shipping = RM 41.60 - [x] Product variants (done 2026-11-16): up to 2 options per product (such as Size and Flavour), with a price, "price before discount" and stock for every combination. Shoppers pick with buttons on the product page; sold-out choices are crossed out. Each choice is its own cart line, order line and stock count. Tested with a real Stripe test payment - [x] Bundles with linked stock (done 2026-11-16): a product made of other products, with one bundle price. The product page shows what is included and the saving ("price before discount" crossed out). Selling a bundle lowers the stock of each item in it, and a bundle is sold out when any item is sold out. Tested with a real Stripe test payment - [x] Chat commands for products, discounts and bundles (done 2026-11-17): "create a bundle of the cleanser and moisturiser for RM 85", "make a 10% code RAYA10". The AI turns the sentence into actions, the chat shows them in plain words with Confirm and Cancel, and nothing changes until the merchant confirms. Tested with real DeepSeek - [x] Automatic discounts (done 2026-11-17): "buy 2, get 10% off" or "spend RM 100, get RM 15 off", on all or chosen products, with dates. Only one discount per order: the shopper gets whichever of the code and the automatic discounts saves more. "Free shipping over RM 100" already exists in store Settings. Tested with a real Stripe test payment and real DeepSeek Notes: - A sale price on one product already works today (the "price before discount" field). - Every feature gets a normal form first. Chat commands are a shortcut on top of the forms. - The confirm step is required for chat commands because these actions involve money. ### Step 9 — Modern store design Agreed on 2026-11-17 after comparing our stores with 2026 design trends (research page: https://claude.ai/artifact/EngaK7gb3yhe4Jt1JDkPce). Our stores look plain mainly because they show placeholder shapes instead of photos, and because every store has the same structure (centred text on a flat colour, then a grid). Build in this order, biggest visible change first: - [x] Part 1 — Photos first (done 2026-11-18): hero layouts with a big photo (full width, and split photo and text), a hero photo the merchant uploads in the Design tab or one of their product photos, second product photo on hover, nicer placeholders when there is no photo - [x] Part 2 — Announcement bar and trust row (done 2026-11-18): a slim bar above the header and a row of trust points, filled in by themselves from free shipping, automatic discounts, secure payment and WhatsApp - [x] Part 3 — Product page upgrade (done 2026-11-18): trust points under the button, folding sections (the product's own, such as "How to use", plus shipping from real fees), sticky add-to-cart bar on phones, "pairs well with", photos that stay in view on wide screens, and a phone menu for the header - [x] Part 4 — Style options and motion (done 2026-11-19): six style options (buttons, cards, spacing, headings, backgrounds, motion), six ready-made looks in a Style box in the Design tab, 12 more fonts (20 in all), gentle fade-in motion, and AI rules so each brand gets a fitting style - [x] Part 5 — More layouts per section (done 2026-11-19): 7 new layouts, so the main sections have 3 or 4 each, and a Layouts box in the Design tab - [x] Part 6 — Category guides for the AI (done 2026-11-21): one guide per category with 2 or 3 directions each, plus the merchant's other stores (and the current design on a redesign) as looks not to repeat - [x] Part 7 — Collections, "shop by" section, bento grid and video (done 2026-11-22): collections managed in the Products tab or by chat, collection pages and links, "shop by" section (round photos or tiles), bento section (3 to 6 tiles), video section (YouTube or Vimeo, loads on play), and Video and Bento boxes in the Design tab so no chat is needed - [ ] Part 8 — Real reviews from buyers after delivery: review email, review form, merchant approval, stars on products (split out of part 7 on 2026-11-21). On hold since 2026-11-22 (the merchant chose to skip it for now); when picked up, branch `redesign/part-8-reviews` from part 7 Branches (agreed 2026-11-18): - Each part has its own branch named `redesign/part-{number}-{short-title}`, such as `redesign/part-1-photo-hero` and `redesign/part-2-announcement-bar`. (Git does not allow spaces or ":" in branch names, so dashes are used.) - Each part branches from the part before it, not from `main`: part 2 from part 1, part 3 from part 2, and so on. - Nothing from Step 9 is merged into `main` until the merchant decides. - Decided 2026-11-21: keep `main` (the old design) and the redesign branches apart, so both can be shown to people to see which they prefer. Do not merge the redesign into `main` until the user says so. - Decided 2026-11-26: we use the new design. `feature/dashboard` (which holds parts 1–7, the home page, legal pages, dashboard and Select to edit) is merged into `main`. The old design is kept as the tag `old-design` (`git checkout old-design` to see it). New work branches from `main` again. Notes: - Old designs must keep working: every new option has a default that looks like today's stores. - The list of refused chat requests (saved for every AI edit) shows which styles merchants ask for most; build those first within each part. ### Step 10 — Before launch - [x] Our own home page at `/` (done 2026-11-22, branch `feature/homepage`, made from the part 7 branch) - [x] Overview dashboard with stats, store tree in the sidebar and daily AI note (done 2026-11-22, branch `feature/dashboard`) - [ ] Merchants get paid into their own Stripe account (Stripe Connect, planned 2026-11-30, see "How merchants get paid"): - [x] You: switch on Connect in the Stripe dashboard in **test mode** (done 2026-11-30). "Activate products" and "Create your Stripe profile" in Stripe's setup guide are for live mode only, so they wait until launch - [x] Checked 2026-11-30 with the test key: Stripe made a Malaysian merchant account, gave a Stripe sign-up link for it, and made a payment page on it. Plan B is not needed - [x] Branch `feature/stripe-connect` (made from `feature/easyparcel`, because EasyParcel is not merged into `main` yet): table `stripe_accounts` for each store's Stripe account (account id, can take payments, payouts on, form finished, FPX asked), and `payment_account` on each order - [x] Settings: a "Get paid" card at the top with what to have ready, "Connect Stripe", "Finish setup" if they stopped halfway, "Stripe is checking your details", and a connected view (payouts on or paused, link to their Stripe Dashboard) - [x] Checkout: the payment page is made on the store's Stripe account (coupons too). Checkout is closed until the store can take payments ("This store is not taking orders yet", in English and Malay) - [x] Return page checks the payment in the merchant's account; a second webhook `/stripe/connect-webhook` (secret `STRIPE_CONNECT_WEBHOOK_SECRET`) only marks an order paid when the payment is in that order's merchant account. `account.updated` was left out: the account is re-checked when the merchant comes back from Stripe, and at most once a minute from Settings or checkout - [x] Overview: "Connect Stripe to get paid" is a getting-started step, and a live store that cannot take payments shows in "Needs attention" - [x] Terms page says how merchants are paid (straight to their own Stripe account, Stripe's Connected Account Agreement, no cut); privacy page says shoppers' payments go to the merchant's Stripe account; "last changed" is now 2026-11-30 - [x] Tests with a pretend Stripe (`FakeMerchantAccounts`): 15 new tests, 341 in all pass - [x] Real test on 2026-11-30: Luna Skin signed up on Stripe's test form (sole proprietorship, Stripe's test values and test bank), came back "Connected", then order #1008 (Gentle Gel Cleanser RM 42 + RM 8 shipping) was paid with Stripe's test card. Stripe's page said "Pay Luna Skin Enterprise"; RM 50.00 landed in Luna Skin's own test account (RM 47.00 after Stripe's fee), nothing in ours, no cut. Order marked paid, email sent. Payouts turned on a minute later - [x] FPX test on 2026-11-30: order #1009 (Light Water-Gel Moisturiser 50ml RM 39 + RM 8 shipping) paid with FPX (Maybank2E, Stripe's test bank page). RM 47.00 landed in Luna Skin's own account (RM 44.59 after Stripe's fee), nothing in ours. Order marked paid on the return page - [ ] Before going live: switch on Connect in live mode, add our name, logo and colour for Stripe's sign-up page - [ ] Choose hosting and deploy - [x] Privacy policy and terms of service, naming the AI providers (done 2026-11-22, `/privacy` and `/terms`; a lawyer should read them before launch) - [ ] Backup AI provider in case one is down - [ ] Spending caps on every AI account --- ## 4. Local machine (checked 2026-11-14) | Tool | Status | | ---------- | ------------------------------------------------------------------------------------------------------------------- | | PHP | 8.4.27 at `/opt/homebrew/opt/php@8.4/bin/php` (used by this project). Default `php` is 8.2.30; 8.5.5 also installed | | Composer | 2.9.7 | | Node / npm | 24.14.1 / 11.11.0 | | MySQL | 9.6.0 | | PostgreSQL | Not installed (not needed, using MySQL) | | Redis | Not installed (not needed yet) | ## 4a. How to run the app locally This project needs PHP 8.4, which is not the default `php` on this machine. In each new terminal, run this first: ```bash export PATH="/opt/homebrew/opt/php@8.4/bin:$PATH" ``` Then, from the project folder: | Task | Command | | ----------------------------------- | ------------------------------------------ | | Start the app (server, queue, Vite) | `composer run dev` | | Open the app | http://localhost:8000 | | Run all tests | `php artisan test` | | Check PHP style and types | `composer lint` and `composer types:check` | | Check frontend | `npm run check` and `npm run types:check` | | Rebuild frontend for tests | `npm run build` | - Settings files: `.env` is uploaded to the repository and holds only basic, non-secret settings (secrets and all AI settings are blank). `.env.local` is never uploaded and holds everything needed to run, including keys. When `.env.local` exists the app reads it instead of `.env`, so it must be complete. This is set up in `bootstrap/app.php`. - Database: MySQL, database `ai_commerce`, settings in `.env.local`. - Local test login: created by `php artisan db:seed`. Email is in `database/seeders/DatabaseSeeder.php`, password in `database/factories/UserFactory.php`. - AI: `.env.local` now uses the real providers (`claude` and `deepseek`), so every generation and edit costs a little money. To work for free, set both providers to `fake`. For real AI, set `AI_GENERATE_PROVIDER=claude` and `AI_EDIT_PROVIDER=deepseek`, and fill in `ANTHROPIC_API_KEY` and `DEEPSEEK_API_KEY`. - AI jobs need the background worker. `composer run dev` starts it. Without it, a job waits and is marked failed after 10 minutes. - Emails (such as verification links) are written to `storage/logs/laravel.log`, not sent. - Code repository: `https://git.mirfalah.my/mirfalah-tech/ai_commerce.git` (remote name `origin`). The `.env.local` file is never uploaded. ## 4b. Where things are in the code | Thing | Location | | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Store model | `app/Models/Store.php` | | Store screens logic | `app/Http/Controllers/StoreController.php` | | Store categories, languages, statuses | `app/Enums/` | | Store form rules | `app/Http/Requests/Stores/CreateStoreRequest.php` | | Screens | `resources/js/pages/dashboard.tsx`, `resources/js/pages/stores/` | | Store tests | `tests/Feature/Stores/` | | Store plan format (the rules) | `app/StorePlan/PlanSchema.php` | | Store plan checker | `app/StorePlan/PlanValidator.php` | | Sample plan | `app/StorePlan/SamplePlan.php` | | Preview logic | `app/Http/Controllers/StoreDesignController.php` | | AI settings | `config/ai.php` (providers, models per task) | | AI layer and providers | `app/Ai/`, `app/Ai/Drivers/` | | AI prompts, generation and chat edits | `app/StorePlan/Ai/` | | Start an AI job (buttons) | `app/Http/Controllers/StoreGenerationController.php` | | Background AI job | `app/Jobs/RunStoreGeneration.php` | | Plan limits and usage counting | `config/plans.php`, `app/Billing/UsageLimits.php` | | Progress screen and chat box | `resources/js/components/stores/` | | Product model and photos | `app/Models/Product.php`, `app/Models/ProductImage.php` | | Product screens logic | `app/Http/Controllers/ProductController.php` | | Product screens | `resources/js/pages/stores/products/` | | Storefront Shop and product pages | `resources/js/storefront/pages/` | | Checkout and order logic | `app/Commerce/Checkout.php`, `app/Http/Controllers/CheckoutController.php` | | Payment providers | `app/Commerce/Payments/` (interface and Stripe) | | Stripe webhook | `app/Http/Controllers/StripeWebhookController.php` (address: `/stripe/webhook`) | | Orders for the merchant | `app/Http/Controllers/OrderController.php`, `resources/js/pages/stores/orders/` | | Order email | `app/Mail/OrderConfirmation.php`, `resources/views/mail/orders/` | | Live store or preview (the difference) | `app/Storefront/Storefront.php` | | Live store addresses | top of `routes/web.php`, `config/storefront.php` | | Publish and take offline | `app/Http/Controllers/StorePublishController.php` | | Plans, trial and limits | `app/Models/Plan.php`, `app/Models/User.php` (`currentPlan`), `app/Billing/UsageLimits.php` | | Subscriptions with Stripe | `app/Billing/` (`Billing`, `SubscriptionGateway`, `StripeSubscriptionGateway`) | | Billing page | `app/Http/Controllers/BillingController.php`, `resources/js/pages/billing/` | | Shipping fees | `app/Commerce/Shipping/`, store settings in `app/Http/Controllers/StoreSettingsController.php` | | Store settings page | `resources/js/pages/stores/settings.tsx` | | Mark as shipped and its email | `OrderController::ship`, `app/Mail/OrderShipped.php` | | WhatsApp links and phone cleaning | `app/Support/MalaysianPhone.php`, `resources/js/storefront/whatsapp.tsx` | | Shopper messages in English and Malay | `app/Storefront/StorefrontText.php`, `resources/js/storefront/text.ts` | | Discount codes | `app/Models/DiscountCode.php`, `app/Http/Controllers/DiscountCodeController.php`, `resources/js/pages/stores/discounts/` | | Discount in the cart and checkout | `Cart::applyCode` and `Cart::discount`, `Checkout::placeOrder` | | Product variants | `app/Models/ProductVariant.php`, `SaveProductRequest`, `ProductController::syncVariants`, `resources/js/components/stores/variant-editor.tsx` | | Cart logic | `app/Commerce/Cart.php`, `app/Http/Controllers/CartController.php` | | Bundles | `app/Models/BundleItem.php`, `app/Commerce/BundleStock.php`, `resources/js/components/stores/bundle-editor.tsx` | | Chat commands | `app/Commerce/ChatActions.php`, `StoreGenerationController::confirm`, `resources/js/components/stores/design-chat.tsx` | | Automatic discounts | `app/Models/AutomaticDiscount.php`, `app/Commerce/AutomaticDiscountRules.php`, `Cart::applied`, `AutomaticDiscountController` | | Hero photos | `app/StorePlan/HeroImages.php`, `HeroImageController`, `resources/js/storefront/sections/hero.tsx`, `components/stores/hero-picker.tsx` | | Announcement bar and trust row | `app/Storefront/Announcements.php`, `storefront/sections/announcement-bar.tsx`, `storefront/sections/trust-bar.tsx` | | Product page, phone menu | `storefront/pages/product.tsx`, `app/Storefront/RelatedProducts.php`, `components/stores/details-editor.tsx`, `storefront/sections/header.tsx` | | Store styles | `PlanSchema::STYLE_OPTIONS` and `STYLE_PRESETS`, `StoreStyleController`, `storefront/theme.ts`, `storefront/reveal.tsx`, `resources/css/app.css`, `components/stores/style-picker.tsx` | | Section layouts | `PlanSchema::SECTIONS`, `app/StorePlan/SectionLayouts.php`, `SectionLayoutController`, `storefront/sections/*.tsx`, `components/stores/layout-picker.tsx` | | Category guides | `app/StorePlan/Ai/CategoryGuides.php`, `PlanPrompt::categoryGuide()` and `looksToAvoid()` | | Collections, bento, video | `app/Models/Collection.php`, `CollectionController`, `storefront/sections/shop-by.tsx`, `bento.tsx`, `video.tsx`, `storefront/pages/shop.tsx` | | Video and Bento boxes | `app/StorePlan/SectionEditor.php`, `VideoSectionController`, `BentoSectionController`, `components/stores/video-box.tsx`, `bento-box.tsx` | | Home page | `resources/js/pages/home.tsx`, `app/Http/Controllers/HomeController.php` | | Privacy and terms | `resources/js/pages/legal/`, `app/Http/Controllers/LegalController.php`, `config/legal.php` | | Overview dashboard and Store pulse | `app/Dashboard/`, `DashboardController`, `resources/js/pages/dashboard.tsx`, `resources/js/components/overview/`, `nav-stores.tsx`, `nav-plan.tsx` | | Storefront words (English, Malay) | `resources/js/storefront/text.ts` | | Store plan format (frontend types) | `resources/js/storefront/types.ts` | | Storefront renderer and sections | `resources/js/storefront/renderer.tsx`, `resources/js/storefront/sections/` | ## 5. Open questions - **Who receives the money?** Decided 2026-11-30: Stripe Connect, each merchant's own Stripe account, no cut for us (see "How merchants get paid"). Still open: whether Stripe runs Connect for our Malaysian account (we find out once Connect is switched on). - **DuitNow QR and e-wallets:** Stripe does not offer them. Adding them means a second payment provider. Decide later, based on what merchants ask for. - Hosting provider (decide at Step 10) ## 6. Later improvements ### Improvement: more design styles (agreed 2026-11-16) Moved into **Step 9 — Modern store design** on 2026-11-17. ### Other ideas - **Template library:** save the design skeleton of good generated stores (colours, fonts, section order, style labels, never customer content). Match new customers to a skeleton and let the cheap model personalise it, so the expensive model is skipped. Start the library by generating 30–50 designs ourselves. - Show three matched designs for the customer to choose from. - Import products from Shopee, TikTok Shop, Shopify. - LHDN e-invoicing. - AI product photography, email flows, SEO tools. --- ## 7. Session log Add one line per work session: date, what was done, what is next. | Date | Done | Next | | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | | 2026-11-14 | Planning. Chose stack, market, payments, AI models, plan prices. Checked local tools. Created this file. All proposed decisions confirmed. Added the rule that the AI model must be easy to change. | Install PHP 8.4, create the Laravel project (Step 0 and Step 1) | | 2026-11-14 | Installed PHP 8.4. Created the Laravel 13 + React project, MySQL database and git repo. Built create-a-store flow and dashboard. 51 tests pass; login and store creation checked in the browser. Step 0 and Step 1 done. | Step 2: store plan format, sections, renderer | | 2026-11-14 | Step 2 done on branch `feature/store-sections-renderer`: store plan format and validator, 10 sections with 2 variants each, renderer, dashboard preview, sample design. 69 tests pass; storefront checked in the browser on desktop and mobile. | Step 3: swappable AI layer and store generation | | 2026-11-14 | First commit made and pushed to the private repository on git.mirfalah.my (branch `feature/store-sections-renderer`). | Step 3: swappable AI layer and store generation | | 2026-11-14 | Step 3 built on branch `feature/ai-generation`: swappable AI layer (Claude, DeepSeek, fake), full store generation, chat edits, background job with progress screen, plan limits. 92 tests pass; whole flow checked in the browser with the fake provider. Not yet run against real Claude or DeepSeek. | Add API keys, run the real test, then Step 4 | | 2026-11-14 | Split settings into `.env` (uploaded, no secrets, AI settings blank) and `.env.local` (private, complete). Removed `.env.example`. | Real AI test, then Step 4 | | 2026-11-14 | Real AI test passed: Claude Sonnet 5.5 generated two stores, DeepSeek made two chat edits. Tuned the prompt for more varied layouts. Step 3 done. | Merge into `main`, then Step 4: products | | 2026-11-14 | Step 4 part 1 on branch `feature/commerce`: store plan version 2 with pages, products with photos, Shop page, product page, real products on the home page. 108 tests pass; checked in the browser; real Claude and DeepSeek re-tested with the new format. | Step 4 part 2: cart, Stripe checkout, orders, email | | 2026-11-14 | Cart built on branch `feature/commerce`: add to cart, quantity, remove, subtotal, header count, stock limits. 118 tests pass; checked in the browser. | Stripe checkout (needs test keys), orders, email | | 2026-11-15 | Step 4 finished on branch `feature/commerce`: checkout with Stripe (test mode), orders for the merchant, order confirmation email. 133 tests pass. A real Stripe test payment worked end to end: order paid, stock lowered, email written to the log. | Merge into `main`, then Step 5: publishing | | 2026-11-15 | Merged Steps 3 and 4 into `main` and pushed. | Step 5: publishing | | 2026-11-15 | Content pages by chat on branch `feature/content-pages`: add, rename and remove pages, each page at its own address, menu links guaranteed by the app. 139 tests pass; tested with real DeepSeek and in the browser. Step 4 is now complete except the known gaps. | Step 5: publishing | | 2026-11-15 | Planning only. Added Step 8 (discount codes, product variants, bundles with linked stock, chat commands with a confirm step), placed after Malaysia features. "Before launch" is now Step 9. Cart items redesigned as cards. | Step 5: publishing | | 2026-11-15 | Step 5 on branch `feature/publishing`: publish and take offline, live stores on their own address, design changes private until published again, dashboard blocked on store addresses. 150 tests pass; Luna Skin published and checked in the browser at `luna-skin.localhost:8000`. | Step 6: subscription billing | | 2026-11-16 | Step 6 on branch `feature/billing`: plans table, 14-day trial, Stripe subscriptions (subscribe, switch, cancel, undo), Billing page, limits enforced, live stores offline when there is no plan. 164 tests pass; real Stripe test subscription to Growth, cancel and undo all worked. Switched the session model from Fable 5.2 to Opus 5.5. | Merge into `main`, then Step 7 | | 2026-11-16 | Step 7 part 1 on branch `feature/malaysia-shipping`: store settings, flat shipping fees (west, east, free over), mark as shipped with tracking and email, WhatsApp buttons, Malay checkout messages, Malaysian phone check. Fixed live-store menu links on pages other than home (bug from Step 5). 178 tests pass; real Stripe test payment with shipping to Sabah worked. | Merge, then Step 7 part 2 or Step 8 | | 2026-11-16 | Featured product fix on branch `feature/featured-product-link` (built on `feature/malaysia-shipping`): the section links to a real product (Design tab picker or chat), shows its real name, price, photo and page, and hides the made-up price otherwise. Added a check that marks chat edits that changed nothing. 191 tests pass; checked in the browser and with real DeepSeek. | Merge both branches, then Step 7 part 2 or Step 8 | | 2026-11-16 | Planning only. Added "more design styles" to later improvements: style options (effects, backgrounds, buttons, spacing, motion), more fonts, more layouts per section, more section types. | Merge branches, then Step 7 part 2 or Step 8 | | 2026-11-16 | Step 8 part 1 on branch `feature/discount-codes`: discount codes (merchant Discounts tab, cart code box, order record, Stripe coupon, use counted when paid). 207 tests pass; real Stripe test payment with a 20% code worked. | Merge, then product variants | | 2026-11-16 | Step 8 part 2 on branch `feature/product-variants` (built on `feature/discount-codes`): product options and variants, option buttons on the product page, variant cart lines, orders and stock. 217 tests pass; real Stripe test payment for a 100ml variant with a discount code worked. | Merge both branches, then bundles | | 2026-11-16 | Step 8 part 3 on branch `feature/bundles`: bundles with linked stock (bundle editor in the product form, "What's inside" on the product page, shared stock check at checkout, order shows what to pack). 223 tests pass; real Stripe test payment for "Glow Starter Set" (cleanser + 50ml moisturiser, RM 69 + RM 8 shipping) lowered both items' stock. | Merge, then chat commands | | 2026-11-17 | Step 8 part 4 on branch `feature/chat-commands`: chat commands for products, discount codes and bundles, with Confirm and Cancel in the chat. Shared discount rules. Fixed a test that failed by chance (random stock). 233 tests pass; with real DeepSeek, "GLOW15 until end of month + 100ml to RM 52" was proposed, confirmed and saved; a product + bundle request was proposed correctly and cancelled. | Merge; then automatic discounts, Step 7 part 2 or Step 9 | | 2026-11-17 | Step 8 part 5 on branch `feature/automatic-discounts`: automatic discounts (Discounts tab form, best-of-one rule with codes, cart nudge, product page note, order/Stripe/email name, chat command). Step 8 is done. 243 tests pass; real Stripe test payment with "Glow Week" (2 cleansers, −RM 8.40, total RM 83.60) worked, GLOW15 correctly won when typed; real DeepSeek proposed a sunscreen-only sale correctly (cancelled). | Merge; then Step 7 part 2 or Step 9 | | 2026-11-17 | Chat commands can write product descriptions from the product name (same branch, `feature/automatic-discounts`). Real DeepSeek test found the AI guessing bundle contents, so bundle contents are now listed for it; second try was accurate. 244 tests pass. | Merge; then Step 7 part 2 or Step 9 | | 2026-11-17 | Researched 2026 store design trends and published a comparison page. Added Step 9 — Modern store design (6 parts) and the category guides decision; "Before launch" is now Step 10. | Step 9 part 1: photos first | | 2026-11-18 | Step 9 part 1 on branch `redesign/part-1-photo-hero`: full-width and split photo heroes, hero photo upload and picker in the Design tab, automatic product photo, second photo on hover, letter placeholders, AI told about photos. 251 tests pass; checked in the browser at desktop and phone width with a test banner on Luna Skin. | Merge, then part 2 | | 2026-11-18 | Step 9 part 2 on branch `redesign/part-2-announcement-bar` (from part 1): announcement bar (automatic lines + merchant lines, Settings card) and trust row section with live facts. Plan checker now supports "required if" rules. 257 tests pass; real DeepSeek added a trust row to Luna Skin correctly; checked in the browser. | Commit; part 3 branches from part 2 | | 2026-11-18 | Step 9 part 3 on branch `redesign/part-3-product-page` (from part 2): folding sections (form, chat with merge by title), trust points, sticky phone add-to-cart bar, pairs well with, phone menu, sticky photos. Found and fixed the sticky bar hiding under the header. 261 tests pass; real DeepSeek wrote a sensible "How to use" for the sunscreen (confirmed); checked at phone width. | Commit; part 4 branches from part 3 | | 2026-11-19 | Step 9 part 4 on branch `redesign/part-4-style-options` (from part 3): style options, six ready-made looks with a Style box, 12 more fonts, gentle motion, AI style rules. Fixed fade-in hiding a section that was already partly on screen. "More layouts per section" moved to a new part 5; category guides are now part 6 and collections part 7. 266 tests pass; Bold look and a real DeepSeek "more premium and elegant" change both checked in the browser. | Commit; part 5 branches from part 4 | | 2026-11-19 | Step 9 part 5 on branch `redesign/part-5-section-layouts` (from part 4): 7 new section layouts (products carousel and large, featured stacked, about statement, reviews wall, FAQ cards, newsletter split, footer columns) and a Layouts box. 270 tests pass; every layout checked in the browser on Luna Skin; long About statements now shown a step smaller. | Commit; part 6 branches from part 5 | | 2026-11-21 | Step 9 part 6 on branch `redesign/part-6-category-guides` (from part 5): category design guides and "looks to avoid" for the AI. 275 tests pass; generated two real test stores with Claude Sonnet (Dapur Mak Teh, food; Seri Anggun, fashion) and they came out clearly different. | Commit; then part 7 or merge | | 2026-11-21 | Decided to keep `main` and the redesign apart for comparison. Split reviews out as part 8. Step 9 part 7 on branch `redesign/part-7-collections-bento-video` (from part 6): collections (Products tab, chat, pages, links), shop by, bento and video sections, with AI checks for collection names and video addresses. 282 tests pass; real DeepSeek created two collections for Luna Skin (confirmed) and added shop by and bento correctly; checked in the browser. | Commit; part 8 branches from part 7 | | 2026-11-22 | Added Video and Bento boxes to the Design tab (same branch, part 7), so both can be added and edited without chat. The merchant added a real YouTube video to Luna Skin by chat; it plays in the preview. 286 tests pass. | Commit part 7; then part 8 | | 2026-11-22 | Part 7 committed on `redesign/part-7-collections-bento-video`. Part 8 (real reviews) put on hold by the merchant. | Choose next step | | 2026-11-22 | Built our own home page on branch `feature/homepage`: content outline like afilink.app with our own look, real plan prices, store-name box that fills the Create store form. 288 tests pass; checked on desktop and phone. Then made the hero picture move like afilink's (pinned scroll on wide screens, plays once on phones, floating tags), fixed tags covering text, added hover lift on the hero pieces and pricing cards, made the store and bubble float, and added six more animations (fade-up, typing bubble, playing chat, changing styles, steps line, shop-types strip). | Commit; choose next step | | 2026-11-22 | Home page committed. Added the privacy policy (`/privacy`) and terms of service (`/terms`) for Malaysian law, naming the AI companies from the AI settings, linked from the home footer and sign-up. 293 tests pass; checked on desktop and phone. | Commit; lawyer check; choose next | | 2026-11-22 | Redesigned the dashboard on branch `feature/dashboard` (picked from three trend designs: AI note on top of colourful boxes). Stats with filters, needs attention, sales chart, store tree in the sidebar, daily Store pulse from DeepSeek saved per day with 3 "Write again" a day, first-sale steps for new merchants. 303 tests pass; checked on desktop, phone and dark mode. | Commit; choose next step | | 2026-11-25 | On `feature/dashboard` (not committed): store letter tiles in the sidebar; researched courier prices and APIs (J&T, Pos Laju, GDEX, DHL eCommerce): only GDEX has a public developer site, the others need a sales contract, so EasyParcel stays the plan; "Show in the preview": clicking a section name in the Design tab scrolls the preview to it and outlines it; banner photos now accepted from 300×200 and got ready in the background (enlarged, shrunk, upright, WebP); "Ask the AI" is now a floating button that opens a chat panel; Light/Dark switch above the user in the sidebar; Select to edit (click or drag in the preview, Ask the AI changes only that part). 310 tests pass; checked in the browser on desktop and phone preview. | Commit, then EasyParcel demo key | | 2026-11-26 | Decided to use the new design: merged `feature/dashboard` into `main`, old design kept as tag `old-design`. | EasyParcel demo key | | 2026-11-26 | EasyParcel on branch `feature/easyparcel` (later the same day: real sandbox test passed for connect, prices and the low-credit message; fixed courier names, delivery times and error messages from what the real API sends): merchants connect their own EasyParcel account (guided setup in Settings, OAuth with EasyParcel's new Open API), add a pickup address and usual parcel, and book a courier on a paid order (prices cheapest first, label, tracking number, shopper emailed). 324 tests pass with a pretend EasyParcel; checked Settings and the order page in the browser. | App keys in `.env.local`, then sandbox test | | 2026-11-26 | EasyParcel sandbox booking passed: Pos MELPlus parcel booked for Luna Skin #1001 (RM 7.03), label PDF, tracking and email all worked. Prices shown now leave out tracking extras we do not book. 326 tests pass. | Commit and merge | | 2026-11-30 | Planned how merchants get paid: Stripe Connect with each merchant's own Stripe account, direct charges, no cut for us. Connect switched on in Stripe test mode; a test made a Malaysian merchant account, its sign-up link and a payment page on it (newer Accounts v2 needed). Plan and tasks written in Step 10. | Commit EasyParcel; build `feature/stripe-connect` | | 2026-11-30 | Built Stripe Connect on branch `feature/stripe-connect`: "Get paid" card in Settings, merchant Stripe accounts (Accounts v2), payment pages and coupons in the merchant's account, checkout closed until Stripe approves, second webhook, overview step and warning, terms and privacy wording. 341 tests pass; Stripe's test sign-up page opened from Settings. | Test sign-up and test payment, then commit and merge | | 2026-11-30 | Stripe Connect tested for real (test mode): Luna Skin signed up and connected; order #1008 (RM 50) paid into Luna Skin's own Stripe account, none in ours. Fixed FPX: asked for with the older capability call and switched on in the merchant's payment settings, so FPX now shows to shoppers. 341 tests pass. | Commit and merge | | 2026-11-30 | FPX test passed: order #1009 (RM 47) paid with FPX (Maybank2E test bank) into Luna Skin's own Stripe account. | Commit and merge | | 2026-11-30 | Restyled the shopper emails (order paid, order shipped) in each store's own colours, fonts and corners, with View order, WhatsApp and Track parcel buttons and plain-text versions. Checked on desktop and phone width for Luna Skin, Sambal Nenek (Malay, serif) and Crunch & Co. 349 tests pass. | Commit and merge | | 2026-11-30 | Store contact email: "How shoppers reach you" card in Settings (WhatsApp + email for shoppers); order emails are sent under the store's name with replies to that email, shown in the footer. 352 tests pass; saved and checked for Luna Skin. | Commit and merge |