@caartzee/theme-sdk 0.0.0-stage → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -2
- package/dist/bin/caartzee-theme.js +9223 -0
- package/dist/lib/index.js +11614 -0
- package/dist/types/src/auth/credentials-store.d.ts +18 -0
- package/dist/types/src/auth/index.d.ts +2 -0
- package/dist/types/src/auth/oauth-client.d.ts +39 -0
- package/dist/types/src/blocks/block-contract.d.ts +242 -0
- package/dist/types/src/candy/compatibility-matrix.d.ts +10 -0
- package/dist/types/src/candy/context-builder.d.ts +31 -0
- package/dist/types/src/candy/engine.d.ts +69 -0
- package/dist/types/src/candy/filters.d.ts +32 -0
- package/dist/types/src/candy/ide-support.d.ts +20 -0
- package/dist/types/src/candy/index.d.ts +9 -0
- package/dist/types/src/candy/schema-parser.d.ts +13 -0
- package/dist/types/src/candy/security.d.ts +54 -0
- package/dist/types/src/candy/tags.d.ts +11 -0
- package/dist/types/src/candy/types.d.ts +185 -0
- package/dist/types/src/cli/caartzee-cli.d.ts +9 -0
- package/dist/types/src/cli/candy-mcp.d.ts +2 -0
- package/dist/types/src/cli/candy-tool-server.d.ts +39 -0
- package/dist/types/src/cli/index.d.ts +1 -0
- package/dist/types/src/cli/mcp/component-tools.d.ts +2 -0
- package/dist/types/src/cli/mcp/docs-tools.d.ts +89 -0
- package/dist/types/src/cli/mcp/editor-tools.d.ts +22 -0
- package/dist/types/src/cli/mcp/resources-and-prompts.d.ts +2 -0
- package/dist/types/src/cli/mcp/testing-tools.d.ts +54 -0
- package/dist/types/src/cli/sdk-client.d.ts +12 -0
- package/dist/types/src/contracts/category-selection.d.ts +15 -0
- package/dist/types/src/contracts/commerce.d.ts +282 -0
- package/dist/types/src/contracts/footer-builder.d.ts +125 -0
- package/dist/types/src/contracts/hooks.d.ts +37 -0
- package/dist/types/src/contracts/manifest.d.ts +3127 -0
- package/dist/types/src/contracts/navigation.d.ts +39 -0
- package/dist/types/src/contracts/order-tracking.d.ts +40 -0
- package/dist/types/src/contracts/page.d.ts +262 -0
- package/dist/types/src/contracts/storefront-content.d.ts +60 -0
- package/dist/types/src/contracts/style-document.d.ts +2 -0
- package/dist/types/src/contracts/styles.d.ts +2002 -0
- package/dist/types/src/contracts/theme.d.ts +35 -0
- package/dist/types/src/dev-server/catalog-preview.d.ts +25 -0
- package/dist/types/src/dev-server/dev-server.d.ts +25 -0
- package/dist/types/src/dev-server/index.d.ts +1 -0
- package/dist/types/src/dev-server/local-commerce-runtime.d.ts +76 -0
- package/dist/types/src/dev-server/local-editor-server.d.ts +22 -0
- package/dist/types/src/dev-server/theme-preview.d.ts +8 -0
- package/dist/types/src/index.d.ts +27 -0
- package/dist/types/src/mock/index.d.ts +10 -0
- package/dist/types/src/mock/mock-categories.d.ts +2 -0
- package/dist/types/src/mock/mock-commerce.d.ts +55 -0
- package/dist/types/src/mock/mock-customer.d.ts +47 -0
- package/dist/types/src/mock/mock-hooks.d.ts +2 -0
- package/dist/types/src/mock/mock-products.d.ts +3 -0
- package/dist/types/src/rendering/commerce-pages.d.ts +16 -0
- package/dist/types/src/rendering/raw-html.d.ts +12 -0
- package/dist/types/src/rendering/section-wrapper.d.ts +30 -0
- package/dist/types/src/scaffold/candy-starter-assets.d.ts +2 -0
- package/dist/types/src/scaffold/commerce-generator.d.ts +3 -0
- package/dist/types/src/scaffold/index.d.ts +2 -0
- package/dist/types/src/scaffold/template-generator.d.ts +21 -0
- package/dist/types/src/sections/section-contract.d.ts +350 -0
- package/dist/types/src/settings/global-settings.d.ts +25 -0
- package/dist/types/src/templates/json-template.d.ts +991 -0
- package/dist/types/src/validation/package-validator.d.ts +53 -0
- package/dist/types/src/validation/rich-text.d.ts +24 -0
- package/package.json +29 -3
- package/templates/commerce/README.md +165 -0
- package/templates/commerce/assets/theme.css +1 -0
- package/templates/commerce/manifest.json +1 -0
- package/templates/commerce/src/blocks/index.ts +184 -0
- package/templates/commerce/src/config/settings-defaults.ts +25 -0
- package/templates/commerce/src/config/settings-schema.ts +102 -0
- package/templates/commerce/src/index.ts +90 -0
- package/templates/commerce/src/layouts/default.ts +275 -0
- package/templates/commerce/src/manifest.ts +976 -0
- package/templates/commerce/src/pages/account/components.ts +369 -0
- package/templates/commerce/src/pages/account/tabs.ts +792 -0
- package/templates/commerce/src/pages/account.ts +55 -0
- package/templates/commerce/src/pages/campaign.ts +423 -0
- package/templates/commerce/src/pages/cart.ts +261 -0
- package/templates/commerce/src/pages/category-detail.ts +124 -0
- package/templates/commerce/src/pages/category-list.ts +87 -0
- package/templates/commerce/src/pages/checkout.ts +712 -0
- package/templates/commerce/src/pages/commerce.ts +45 -0
- package/templates/commerce/src/pages/home.ts +160 -0
- package/templates/commerce/src/pages/index.ts +99 -0
- package/templates/commerce/src/pages/login.ts +204 -0
- package/templates/commerce/src/pages/order-success.ts +80 -0
- package/templates/commerce/src/pages/product-detail.ts +489 -0
- package/templates/commerce/src/pages/product-list.ts +125 -0
- package/templates/commerce/src/pages/search.ts +88 -0
- package/templates/commerce/src/pages/signup.ts +253 -0
- package/templates/commerce/src/pages/status.ts +7 -0
- package/templates/commerce/src/pages/theme-layout.ts +491 -0
- package/templates/commerce/src/pages/track-order.ts +196 -0
- package/templates/commerce/src/pages/wishlist.ts +83 -0
- package/templates/commerce/src/sections/about-story.ts +117 -0
- package/templates/commerce/src/sections/announcement-bar.ts +101 -0
- package/templates/commerce/src/sections/banner-grid.ts +319 -0
- package/templates/commerce/src/sections/campaign-banners.ts +158 -0
- package/templates/commerce/src/sections/category-slider.ts +144 -0
- package/templates/commerce/src/sections/content-builder.ts +123 -0
- package/templates/commerce/src/sections/content-controls.ts +45 -0
- package/templates/commerce/src/sections/custom-form.ts +59 -0
- package/templates/commerce/src/sections/faq-accordion.ts +123 -0
- package/templates/commerce/src/sections/footer.ts +728 -0
- package/templates/commerce/src/sections/header.ts +439 -0
- package/templates/commerce/src/sections/hero-slider.ts +492 -0
- package/templates/commerce/src/sections/hero.ts +137 -0
- package/templates/commerce/src/sections/index.ts +102 -0
- package/templates/commerce/src/sections/mobile-slider.ts +102 -0
- package/templates/commerce/src/sections/newsletter.ts +43 -0
- package/templates/commerce/src/sections/product-grid.ts +191 -0
- package/templates/commerce/src/sections/raw-html.ts +1 -0
- package/templates/commerce/src/sections/rich-text.ts +26 -0
- package/templates/commerce/src/sections/services-features.ts +211 -0
- package/templates/commerce/src/sections/testimonials.ts +194 -0
- package/templates/commerce/src/snippets/product-card.ts +178 -0
- package/templates/commerce/src/snippets/product-price.ts +46 -0
- package/templates/commerce/src/snippets/responsive-image.ts +29 -0
- package/templates/commerce/src/styles.ts +477 -0
- package/templates/commerce/src/templates/404.json +26 -0
- package/templates/commerce/src/templates/account.json +17 -0
- package/templates/commerce/src/templates/cart.json +17 -0
- package/templates/commerce/src/templates/category.json +16 -0
- package/templates/commerce/src/templates/checkout.json +15 -0
- package/templates/commerce/src/templates/collection.json +16 -0
- package/templates/commerce/src/templates/index.json +180 -0
- package/templates/commerce/src/templates/login.json +17 -0
- package/templates/commerce/src/templates/order-success.json +17 -0
- package/templates/commerce/src/templates/page.json +17 -0
- package/templates/commerce/src/templates/product.json +17 -0
- package/templates/commerce/src/templates/search.json +18 -0
- package/templates/commerce/src/templates/signup.json +17 -0
- package/templates/commerce/src/templates/track-order.json +17 -0
- package/templates/commerce/src/templates/wishlist.json +17 -0
- package/templates/commerce/src/templates.ts +510 -0
- package/templates/commerce/src/tokens.ts +22 -0
- package/templates/theme-candy-boilerplate/.editorconfig +14 -0
- package/templates/theme-candy-boilerplate/.gitattributes +1 -0
- package/templates/theme-candy-boilerplate/.vscode/extensions.json +7 -0
- package/templates/theme-candy-boilerplate/.vscode/settings.json +17 -0
- package/templates/theme-candy-boilerplate/assets/theme.css +78 -0
- package/templates/theme-candy-boilerplate/assets/theme.js +7 -0
- package/templates/theme-candy-boilerplate/candy.config.json +40 -0
- package/templates/theme-candy-boilerplate/index.ts +39 -0
- package/templates/theme-candy-boilerplate/layout/theme.candy +25 -0
- package/templates/theme-candy-boilerplate/locales/en.default.json +37 -0
- package/templates/theme-candy-boilerplate/manifest.json +123 -0
- package/templates/theme-candy-boilerplate/package.json +16 -0
- package/templates/theme-candy-boilerplate/schemas/settings_schema.json +36 -0
- package/templates/theme-candy-boilerplate/sections/featured-products.candy +89 -0
- package/templates/theme-candy-boilerplate/sections/footer.candy +50 -0
- package/templates/theme-candy-boilerplate/sections/header.candy +116 -0
- package/templates/theme-candy-boilerplate/sections/hero-banner.candy +135 -0
- package/templates/theme-candy-boilerplate/sections/image-with-text.candy +85 -0
- package/templates/theme-candy-boilerplate/snippets/price.candy +19 -0
- package/templates/theme-candy-boilerplate/snippets/product-card.candy +43 -0
- package/templates/theme-candy-boilerplate/templates/404.candy +12 -0
- package/templates/theme-candy-boilerplate/templates/cart.candy +51 -0
- package/templates/theme-candy-boilerplate/templates/collection.candy +51 -0
- package/templates/theme-candy-boilerplate/templates/index.candy +7 -0
- package/templates/theme-candy-boilerplate/templates/page.candy +10 -0
- package/templates/theme-candy-boilerplate/templates/product.candy +59 -0
- package/templates/theme-candy-boilerplate/templates/search.candy +40 -0
- package/templates/vscode-candy/LICENSE +21 -0
- package/templates/vscode-candy/README.md +22 -0
- package/templates/vscode-candy/extension.js +689 -0
- package/templates/vscode-candy/icons/candy-dark.svg +23 -0
- package/templates/vscode-candy/icons/candy-light.svg +23 -0
- package/templates/vscode-candy/icons/candy-logo.png +0 -0
- package/templates/vscode-candy/icons/candy-sweet-dark.svg +23 -0
- package/templates/vscode-candy/icons/candy-sweet-light.svg +23 -0
- package/templates/vscode-candy/language-configuration.json +47 -0
- package/templates/vscode-candy/package.json +118 -0
- package/templates/vscode-candy/schemas/candy-config.schema.json +56 -0
- package/templates/vscode-candy/schemas/candy-settings.schema.json +70 -0
- package/templates/vscode-candy/snippets/candy.code-snippets +270 -0
- package/templates/vscode-candy/syntaxes/candy.tmLanguage.json +296 -0
- package/templates/vscode-candy/vim/ftdetect/candy.vim +5 -0
package/README.md
CHANGED
|
@@ -1,3 +1,223 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @caartzee/theme-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official Theme SDK & CLI for building, previewing, validating, and publishing **Candy (`.candy`)** storefront themes on **Caartzee**.
|
|
4
|
+
|
|
5
|
+
- **npm:** `https://www.npmjs.com/package/@caartzee/theme-sdk`
|
|
6
|
+
- **CLI binary:** `caartzee-theme` (alias: `caartzee`)
|
|
7
|
+
- **IDE Extension (`.candy` syntax, IntelliSense, formatter & diagnostics):**
|
|
8
|
+
- **VS Code Marketplace:** https://marketplace.visualstudio.com/items?itemName=AkhilJinu.candy-language-support
|
|
9
|
+
- **Open VSX (Antigravity, Cursor, Windsurf, VSCodium):** https://open-vsx.org/extension/AkhilJinu/candy-language-support
|
|
10
|
+
- Install via CLI: `code --install-extension AkhilJinu.candy-language-support`
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# 1. Scaffold a new Candy theme
|
|
18
|
+
npx --package=@caartzee/theme-sdk caartzee-theme init my-theme --engine candy
|
|
19
|
+
cd my-theme
|
|
20
|
+
bun install # or npm install
|
|
21
|
+
|
|
22
|
+
# 2. Preview locally with mock catalog, cart, wishlist & auth
|
|
23
|
+
npx caartzee-theme dev --port 3333
|
|
24
|
+
|
|
25
|
+
# 3. Preview with a merchant-approved live catalog
|
|
26
|
+
npx caartzee-theme connect --clipboard # Windows (or --stdin on macOS/Linux)
|
|
27
|
+
npx caartzee-theme dev --port 3333 --store your-store.caartzee.com
|
|
28
|
+
|
|
29
|
+
# 4. Run full health & storefront readiness audit
|
|
30
|
+
npx caartzee-theme doctor .
|
|
31
|
+
|
|
32
|
+
# 5. Sync manifest, validate security, build & publish
|
|
33
|
+
npx caartzee-theme sync-manifest .
|
|
34
|
+
npx caartzee-theme validate .
|
|
35
|
+
npx caartzee-theme build .
|
|
36
|
+
npx caartzee-theme push .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## CLI Commands
|
|
42
|
+
|
|
43
|
+
| Command | Description |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `caartzee-theme init [name] --engine candy` | Scaffold a new Candy storefront theme |
|
|
46
|
+
| `caartzee-theme dev [--port 3333] [--store DOMAIN]` | Start local preview server (offline mock data or live merchant catalog) |
|
|
47
|
+
| `caartzee-theme doctor [path]` | Audit storefront shell, cart/variant hooks, auth forms, currency, menus & sliders |
|
|
48
|
+
| `caartzee-theme version <patch\|minor\|major\|x.y.z> [path]` | Bump theme version across `candy.config.json` and `manifest.json` |
|
|
49
|
+
| `caartzee-theme sync-manifest [path]` | Regenerate `manifest.json` from `candy.config.json` & section `{% schema %}` blocks |
|
|
50
|
+
| `caartzee-theme validate [path]` | Run security & schema validation (forbids `eval`, `process.env`, `fs`, `child_process`) |
|
|
51
|
+
| `caartzee-theme build [path]` | Compile `.candy` templates & assets into `dist/candy-theme-bundle.json` |
|
|
52
|
+
| `caartzee-theme connect --clipboard \| --stdin` | Connect to your Caartzee Developer Portal theme app |
|
|
53
|
+
| `caartzee-theme login --api URL --token-stdin` | Authenticate using an app SDK token |
|
|
54
|
+
| `caartzee-theme whoami` / `logout` | Check or clear saved developer credentials |
|
|
55
|
+
| `caartzee-theme ide-setup [path]` | Install `.candy` syntax highlighting for VS Code / Cursor / Antigravity |
|
|
56
|
+
| `caartzee-theme push [path]` | Validate and submit a new theme version to the Caartzee Partner Portal |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Theme Directory Structure
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
my-theme/
|
|
64
|
+
├── candy.config.json # Theme slug, version, engine: "candy", design tokens
|
|
65
|
+
├── manifest.json # Generated via `caartzee-theme sync-manifest .`
|
|
66
|
+
├── layout/
|
|
67
|
+
│ └── theme.candy # Used by local SDK dev preview
|
|
68
|
+
├── templates/ # Page body fragments (NO {% layout %} in storefront-shell mode!)
|
|
69
|
+
│ ├── index.candy # Home page
|
|
70
|
+
│ ├── collection.candy # /products & /collections/:slug
|
|
71
|
+
│ ├── list-collections.candy # /collections
|
|
72
|
+
│ ├── product.candy # /products/:slug
|
|
73
|
+
│ ├── search.candy # /search
|
|
74
|
+
│ ├── wishlist.candy # /wishlist
|
|
75
|
+
│ ├── cart.candy # /cart
|
|
76
|
+
│ ├── login.candy # /login
|
|
77
|
+
│ ├── register.candy # /signup & /register
|
|
78
|
+
│ ├── page.candy # /pages/:slug
|
|
79
|
+
│ └── 404.candy # Not found
|
|
80
|
+
├── sections/ # Editable Theme Editor sections (each has a {% schema %} block)
|
|
81
|
+
│ ├── header.candy
|
|
82
|
+
│ ├── footer.candy
|
|
83
|
+
│ ├── hero-banner.candy
|
|
84
|
+
│ ├── featured-products.candy
|
|
85
|
+
│ ├── collection-showcase.candy
|
|
86
|
+
│ ├── image-with-text.candy
|
|
87
|
+
│ └── value-props.candy
|
|
88
|
+
├── snippets/ # Reusable partials (product-card.candy, price.candy, etc.)
|
|
89
|
+
├── assets/
|
|
90
|
+
│ ├── theme.css # Auto-injected into Storefront Shell <head>
|
|
91
|
+
│ └── theme.js # Auto-injected into Storefront Shell before </body>
|
|
92
|
+
├── locales/
|
|
93
|
+
│ └── en.default.json # Translations accessed via {{ 'key' | t }}
|
|
94
|
+
└── schemas/
|
|
95
|
+
└── settings_schema.json # Global theme settings shown in Theme Editor
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Storefront Shell & Capabilities (Critical!)
|
|
101
|
+
|
|
102
|
+
On live Caartzee storefronts, Candy themes run inside the **Storefront Shell**, which provides live cart/wishlist sessions, checkout, customer authentication, payment gateways, and Theme Editor live preview.
|
|
103
|
+
|
|
104
|
+
Enable both capabilities in `manifest.json`:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
"capabilities": {
|
|
108
|
+
"storefront-shell": true,
|
|
109
|
+
"commerce_pages": true
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Mandatory Rules for Storefront Shell Themes
|
|
114
|
+
1. **Keep `templates/*.candy` as body fragments:** Do **NOT** include `{% layout 'theme' %}` inside `templates/*.candy`. The shell renders header, body, footer, `assets/theme.css`, and `assets/theme.js` once.
|
|
115
|
+
2. **Load fonts inside `assets/theme.css`:** Because `layout/theme.candy` is bypassed in shell mode, include `@import url('https://fonts.googleapis.com/...');` at the top of `assets/theme.css` and style `body` directly (not only a custom body class).
|
|
116
|
+
3. **Use delegated event listeners in `assets/theme.js`:** Always bind interactive controls (mobile menu drawer, search bar toggle, slider dots) via `document.addEventListener('click', ...)` so they continue working after Theme Editor live section re-renders.
|
|
117
|
+
4. **Avoid `backdrop-filter` / `transform` on sticky `<header>`:** If your mobile drawer (`position: fixed; inset: 0;`) is rendered inside `<header>`, putting `backdrop-filter` or `transform` on `<header>` creates a CSS containing block that clips the drawer to the header height. Use a solid background on `<header>` instead.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## E-Commerce Storefront Contracts
|
|
122
|
+
|
|
123
|
+
### 1. Currency & Pricing (Never Hardcode `$`)
|
|
124
|
+
Always format prices with `{{ amount | money }}` (or `money_with_currency`).
|
|
125
|
+
**Important:** Liquid `{% render %}` isolates variable scope! Always pass `shop` and `currency_info` explicitly into snippets that render prices:
|
|
126
|
+
|
|
127
|
+
```liquid
|
|
128
|
+
{% render 'product-card', product: item, shop: shop, currency_info: currency_info %}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Inside `snippets/price.candy`, `{{ price | money }}` will automatically render the merchant's live currency symbol (e.g., `₹22.00`, `$22.00`, `€22.00`).
|
|
132
|
+
|
|
133
|
+
### 2. Add to Cart & Variants (`/_api/cart`)
|
|
134
|
+
Caartzee's storefront runtime binds to `.js-add-to-cart` buttons and reads `data-*` attributes:
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<button
|
|
138
|
+
type="button"
|
|
139
|
+
class="js-add-to-cart"
|
|
140
|
+
data-product-id="{{ product.id }}"
|
|
141
|
+
{% if product.has_inventory_variants and product.selected_or_first_available_variant.id %}
|
|
142
|
+
data-variant-id="{{ product.selected_or_first_available_variant.id }}"
|
|
143
|
+
{% endif %}
|
|
144
|
+
data-quantity="1"
|
|
145
|
+
data-product-title="{{ product.title | escape }}"
|
|
146
|
+
data-product-price="{{ product.price }}"
|
|
147
|
+
data-product-image="{{ product.featured_image | image_url | escape }}"
|
|
148
|
+
>
|
|
149
|
+
Add to Bag
|
|
150
|
+
</button>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
> **CRITICAL (`422 Unprocessable Entity` prevention):**
|
|
154
|
+
> Never emit synthetic string IDs like `data-variant-id="1-default"` for products without real inventory variants! The `/_api/cart` endpoint expects a numeric `variant_id` (or omitted/`0` when no inventory variants exist). Always guard `data-variant-id` with `{% if product.has_inventory_variants %}`.
|
|
155
|
+
|
|
156
|
+
#### Header Cart Count Badge
|
|
157
|
+
Include both `js-cart-count` and `data-cart-count` on your header cart counter so live Add to Cart updates it without a page reload:
|
|
158
|
+
|
|
159
|
+
```html
|
|
160
|
+
<span class="js-cart-count" data-cart-count>{{ cart.item_count | default: 0 }}</span>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Product Detail Page (PDP) Hooks
|
|
164
|
+
Preserve these attributes in `templates/product.candy`:
|
|
165
|
+
- Wrapper: `data-product-detail`
|
|
166
|
+
- Gallery: `data-product-main-image`, `data-product-thumbnail="<url>"`
|
|
167
|
+
- Variant selector: `data-product-variant`, `data-variant-option`, `data-variant-value`, `data-variant-label`, `data-stock`, `data-price`, `data-formatted-price`
|
|
168
|
+
- Quantity & feedback: `data-product-quantity`, `data-quantity-step="-1"|"1"`, `data-product-stock`, `data-product-feedback`
|
|
169
|
+
- Wishlist button: `.js-wishlist-toggle` with `data-product-id="{{ product.id }}"`
|
|
170
|
+
|
|
171
|
+
#### Shopping Bag (`/cart`) Hooks
|
|
172
|
+
In `templates/cart.candy`:
|
|
173
|
+
- Quantity buttons: `.js-cart-qty-btn` with `data-product-id`, `data-variant-id`, `data-delta="-1"|"1"`
|
|
174
|
+
- Remove button: `.js-remove-cart-item` with `data-product-id`, `data-variant-id`
|
|
175
|
+
- Checkout CTA: `<a href="{{ routes.checkout_url | default: '/checkout' }}">Proceed to Checkout</a>` (checkout and payment gateways are handled by Caartzee's secure checkout runtime).
|
|
176
|
+
|
|
177
|
+
### 3. Customer Login, Signup & Account (`/login`, `/signup`, `/account`)
|
|
178
|
+
- **Login template:** `templates/login.candy` (mapped automatically to `pageType: 'login'` at `/login`)
|
|
179
|
+
- **Signup template:** `templates/register.candy` (mapped automatically to `pageType: 'signup'` at `/signup` and `/register`)
|
|
180
|
+
- **Account & Checkout:** Delegated to Caartzee's built-in authenticated account portal (`/account`, `/account/orders`, `/account/addresses`, `/account/profile`) and checkout (`/checkout`).
|
|
181
|
+
|
|
182
|
+
#### Login Form Contract (`templates/login.candy`)
|
|
183
|
+
```html
|
|
184
|
+
<form action="/_api/auth/login" method="POST" class="js-auth-form" data-redirect="{{ redirect_url | default: '/account' | escape }}">
|
|
185
|
+
<input type="hidden" name="redirect" value="{{ redirect_url | default: '/account' | escape }}" />
|
|
186
|
+
<input id="login-email" type="email" name="email" required autocomplete="email" />
|
|
187
|
+
<input id="login-password" type="password" name="password" required autocomplete="current-password" />
|
|
188
|
+
<button type="submit" class="js-submit-btn">Sign In</button>
|
|
189
|
+
</form>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### Signup Form Contract (`templates/register.candy`)
|
|
193
|
+
```html
|
|
194
|
+
<form action="/_api/auth/register" method="POST" class="js-auth-form" data-redirect="{{ redirect_url | default: '/account' | escape }}">
|
|
195
|
+
<input type="hidden" name="redirect" value="{{ redirect_url | default: '/account' | escape }}" />
|
|
196
|
+
<input id="reg-first-name" type="text" name="firstName" required />
|
|
197
|
+
<input id="reg-last-name" type="text" name="lastName" required />
|
|
198
|
+
<input id="reg-email" type="email" name="email" required autocomplete="email" />
|
|
199
|
+
<input id="reg-phone" type="tel" name="mobile" required pattern="[0-9]{10}" maxlength="10" inputmode="numeric" />
|
|
200
|
+
<input id="reg-password" type="password" name="password" required minlength="8" autocomplete="new-password" />
|
|
201
|
+
<button type="submit" class="js-submit-btn">Create Account</button>
|
|
202
|
+
</form>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 4. Header Menus & Hero Mobile Sliders (Theme Editor)
|
|
206
|
+
- **Header Navigation (`sections/header.candy`):**
|
|
207
|
+
- Include `{ "id": "menuId", "type": "select", "label": "Navigation Menu", "default": null, "options": [] }` in `{% schema %}` so merchants can pick any menu from **Menu Manage**.
|
|
208
|
+
- Render `linklists['main-menu'].links` first, falling back to `section.blocks`.
|
|
209
|
+
- **Hero Banner (`sections/hero-banner.candy`):**
|
|
210
|
+
- Include a `slide` block definition in `{% schema %}` so Theme Editor draft/publish validation always succeeds.
|
|
211
|
+
- Check `{% if mobile_sliders and mobile_sliders.size > 0 %}` and render each slide (`slide.title`, `slide.description`, `slide.image`, `slide.button_text`, `slide.button_url`) with pagination dots so changes in the merchant's **Mobile Slider** manager reflect immediately.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Publishing & Live Deployment
|
|
216
|
+
|
|
217
|
+
1. Bump the version: `npx caartzee-theme version patch .`
|
|
218
|
+
2. Sync manifest: `npx caartzee-theme sync-manifest .`
|
|
219
|
+
3. Audit & validate: `npx caartzee-theme doctor . && npx caartzee-theme validate .`
|
|
220
|
+
4. Build bundle: `npx caartzee-theme build .`
|
|
221
|
+
5. Submit to Caartzee Partner Portal: `npx caartzee-theme push .`
|
|
222
|
+
|
|
223
|
+
Once approved, Caartzee's `theme-rendering-engine` dynamically fetches and caches the approved theme package from `theme_packages` by `(slug, version)` — **no backend code changes or redeploys are required**. Merchants simply click **Activate** or **Update** in **Theme Manage**.
|