Add store installments module with calculator and public API docs.

Business dashboard can manage credit methods and preview plans; cropper and module flags support the new flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-24 23:17:51 +03:30
co-authored by Cursor
parent ff419603bf
commit e2950fa20e
26 changed files with 2661 additions and 37 deletions
+15 -1
View File
@@ -280,7 +280,7 @@ Products accept optional `brandId` on create/update.
- `website.schema`: site-wide Schema.org settings (`enabled`, `type` Organization|LocalBusiness, optional name/description/priceRange/sameAs). Public `GET /tenants/:host/website/business-info` returns `schema.jsonLd` ready for `<script type="application/ld+json">`. When enabled, public product/blog **detail** responses also include `schema.jsonLd` (`Product` / `BlogPosting`).
- Per-entity optional SEO overrides (`seoMetaTitle`, `seoMetaDescription`) on products, blogs, portfolios, videos, instructions, workshops, user-products, and categories (stored in `metadata` JSON).
- **Torob:** store-module websites with Store settings → Torob on. Nginx on the shop apex proxies `POST /torob_api/v3/products` to `POST /api/v1/tenants/{domain}/torob_api/v3/products`. Otherwise 404. Do not implement this in Next.js.
- `modules.enabled`: optional modules — business: `products`, `store`, `portfolio`, `blog`, `warehouse`, `videos`, `finance`; customer: `customer_products`. Missing key → all business modules enabled (legacy); customer modules stay opt-in. Super-admin only for modules PATCH.
- `modules.enabled`: optional modules — business: `products`, `store`, `store_installments`, `portfolio`, `blog`, `warehouse`, `videos`, `instructions`, `workshops`, `finance`, `multilanguage_data`; customer: `customer_products`. Missing key → all business modules enabled except opt-in (`workshops`, `multilanguage_data`, `store_installments`); customer modules stay opt-in. Super-admin only for modules PATCH.
- `modules.charts`: two home chart slots (`none`, `orders_30d`, `customers_joined_1y`, `blog_views_30d`, `products_added_1y`, `product_views_30d`, `website_views_30d`, `portfolio_views_30d`); `none` hides that slot; defaults orders + customers. View charts read `website_page_views` (auto-counted on public list/detail GETs; ~6 month retention). `website_views_30d` aggregates **all** page kinds (`kind=all`); product chart counts `product_detail` + `user_product_detail`; portfolio/blog charts filter by detail kind. Home-only hits also increment on `GET .../website/sliders` and `GET .../website/static-images?pageKey=home`. Lifetime totals in `website_page_view_counters`.
- **Statistics** (`/statistics`, always-on sidebar): same two home chart slots, then visit KPI rows (today / this week Sat–Fri / this month / lifetime total) for all pages, home, products (+ store items + user products), blog, portfolio, videos — module-gated except total + home. API: `GET businesses/:id/analytics/views/summary`.
- Always-on (not in modules list): business — home, **statistics**, customers, website, profile, settings; customer — home, profile, addresses, orders, favorites
@@ -301,6 +301,20 @@ Products accept optional `brandId` on create/update.
- `GET/POST/PATCH/DELETE /businesses/:businessId/store-specials`
- `GET /tenants/:host/store-specials` — public API for websites
### Store loan methods (installments & facilities)
Requires modules `store` + `store_installments` (opt-in).
**Dashboard:**
- `GET/POST /businesses/:businessId/store-loan-methods`
- `GET/PATCH/DELETE /businesses/:businessId/store-loan-methods/:methodId`
**Public website:**
- `GET /tenants/:host/store-loan-methods` → `{ enabled, items[] }`
- `GET /tenants/:host/store-loan-methods/:methodId` → `{ method }`
- `POST /tenants/:host/store-loan-methods/calculate` — body `{ methodId, totalValue, creditAmount, months }` → `{ method, plan }`
When `items.length > 1`, ask the shopper which credit method first, then calculate. If one method, auto-select. `methodId` is always required on calculate.
### Website homepage widgets
- `GET/POST/PATCH/DELETE /businesses/:businessId/website/category-groups` — groups with `categoryIds[]`
- `GET/POST/PATCH/DELETE /businesses/:businessId/website/brand-groups` — groups with `brandIds[]`