@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.
Files changed (179) hide show
  1. package/README.md +222 -2
  2. package/dist/bin/caartzee-theme.js +9223 -0
  3. package/dist/lib/index.js +11614 -0
  4. package/dist/types/src/auth/credentials-store.d.ts +18 -0
  5. package/dist/types/src/auth/index.d.ts +2 -0
  6. package/dist/types/src/auth/oauth-client.d.ts +39 -0
  7. package/dist/types/src/blocks/block-contract.d.ts +242 -0
  8. package/dist/types/src/candy/compatibility-matrix.d.ts +10 -0
  9. package/dist/types/src/candy/context-builder.d.ts +31 -0
  10. package/dist/types/src/candy/engine.d.ts +69 -0
  11. package/dist/types/src/candy/filters.d.ts +32 -0
  12. package/dist/types/src/candy/ide-support.d.ts +20 -0
  13. package/dist/types/src/candy/index.d.ts +9 -0
  14. package/dist/types/src/candy/schema-parser.d.ts +13 -0
  15. package/dist/types/src/candy/security.d.ts +54 -0
  16. package/dist/types/src/candy/tags.d.ts +11 -0
  17. package/dist/types/src/candy/types.d.ts +185 -0
  18. package/dist/types/src/cli/caartzee-cli.d.ts +9 -0
  19. package/dist/types/src/cli/candy-mcp.d.ts +2 -0
  20. package/dist/types/src/cli/candy-tool-server.d.ts +39 -0
  21. package/dist/types/src/cli/index.d.ts +1 -0
  22. package/dist/types/src/cli/mcp/component-tools.d.ts +2 -0
  23. package/dist/types/src/cli/mcp/docs-tools.d.ts +89 -0
  24. package/dist/types/src/cli/mcp/editor-tools.d.ts +22 -0
  25. package/dist/types/src/cli/mcp/resources-and-prompts.d.ts +2 -0
  26. package/dist/types/src/cli/mcp/testing-tools.d.ts +54 -0
  27. package/dist/types/src/cli/sdk-client.d.ts +12 -0
  28. package/dist/types/src/contracts/category-selection.d.ts +15 -0
  29. package/dist/types/src/contracts/commerce.d.ts +282 -0
  30. package/dist/types/src/contracts/footer-builder.d.ts +125 -0
  31. package/dist/types/src/contracts/hooks.d.ts +37 -0
  32. package/dist/types/src/contracts/manifest.d.ts +3127 -0
  33. package/dist/types/src/contracts/navigation.d.ts +39 -0
  34. package/dist/types/src/contracts/order-tracking.d.ts +40 -0
  35. package/dist/types/src/contracts/page.d.ts +262 -0
  36. package/dist/types/src/contracts/storefront-content.d.ts +60 -0
  37. package/dist/types/src/contracts/style-document.d.ts +2 -0
  38. package/dist/types/src/contracts/styles.d.ts +2002 -0
  39. package/dist/types/src/contracts/theme.d.ts +35 -0
  40. package/dist/types/src/dev-server/catalog-preview.d.ts +25 -0
  41. package/dist/types/src/dev-server/dev-server.d.ts +25 -0
  42. package/dist/types/src/dev-server/index.d.ts +1 -0
  43. package/dist/types/src/dev-server/local-commerce-runtime.d.ts +76 -0
  44. package/dist/types/src/dev-server/local-editor-server.d.ts +22 -0
  45. package/dist/types/src/dev-server/theme-preview.d.ts +8 -0
  46. package/dist/types/src/index.d.ts +27 -0
  47. package/dist/types/src/mock/index.d.ts +10 -0
  48. package/dist/types/src/mock/mock-categories.d.ts +2 -0
  49. package/dist/types/src/mock/mock-commerce.d.ts +55 -0
  50. package/dist/types/src/mock/mock-customer.d.ts +47 -0
  51. package/dist/types/src/mock/mock-hooks.d.ts +2 -0
  52. package/dist/types/src/mock/mock-products.d.ts +3 -0
  53. package/dist/types/src/rendering/commerce-pages.d.ts +16 -0
  54. package/dist/types/src/rendering/raw-html.d.ts +12 -0
  55. package/dist/types/src/rendering/section-wrapper.d.ts +30 -0
  56. package/dist/types/src/scaffold/candy-starter-assets.d.ts +2 -0
  57. package/dist/types/src/scaffold/commerce-generator.d.ts +3 -0
  58. package/dist/types/src/scaffold/index.d.ts +2 -0
  59. package/dist/types/src/scaffold/template-generator.d.ts +21 -0
  60. package/dist/types/src/sections/section-contract.d.ts +350 -0
  61. package/dist/types/src/settings/global-settings.d.ts +25 -0
  62. package/dist/types/src/templates/json-template.d.ts +991 -0
  63. package/dist/types/src/validation/package-validator.d.ts +53 -0
  64. package/dist/types/src/validation/rich-text.d.ts +24 -0
  65. package/package.json +29 -3
  66. package/templates/commerce/README.md +165 -0
  67. package/templates/commerce/assets/theme.css +1 -0
  68. package/templates/commerce/manifest.json +1 -0
  69. package/templates/commerce/src/blocks/index.ts +184 -0
  70. package/templates/commerce/src/config/settings-defaults.ts +25 -0
  71. package/templates/commerce/src/config/settings-schema.ts +102 -0
  72. package/templates/commerce/src/index.ts +90 -0
  73. package/templates/commerce/src/layouts/default.ts +275 -0
  74. package/templates/commerce/src/manifest.ts +976 -0
  75. package/templates/commerce/src/pages/account/components.ts +369 -0
  76. package/templates/commerce/src/pages/account/tabs.ts +792 -0
  77. package/templates/commerce/src/pages/account.ts +55 -0
  78. package/templates/commerce/src/pages/campaign.ts +423 -0
  79. package/templates/commerce/src/pages/cart.ts +261 -0
  80. package/templates/commerce/src/pages/category-detail.ts +124 -0
  81. package/templates/commerce/src/pages/category-list.ts +87 -0
  82. package/templates/commerce/src/pages/checkout.ts +712 -0
  83. package/templates/commerce/src/pages/commerce.ts +45 -0
  84. package/templates/commerce/src/pages/home.ts +160 -0
  85. package/templates/commerce/src/pages/index.ts +99 -0
  86. package/templates/commerce/src/pages/login.ts +204 -0
  87. package/templates/commerce/src/pages/order-success.ts +80 -0
  88. package/templates/commerce/src/pages/product-detail.ts +489 -0
  89. package/templates/commerce/src/pages/product-list.ts +125 -0
  90. package/templates/commerce/src/pages/search.ts +88 -0
  91. package/templates/commerce/src/pages/signup.ts +253 -0
  92. package/templates/commerce/src/pages/status.ts +7 -0
  93. package/templates/commerce/src/pages/theme-layout.ts +491 -0
  94. package/templates/commerce/src/pages/track-order.ts +196 -0
  95. package/templates/commerce/src/pages/wishlist.ts +83 -0
  96. package/templates/commerce/src/sections/about-story.ts +117 -0
  97. package/templates/commerce/src/sections/announcement-bar.ts +101 -0
  98. package/templates/commerce/src/sections/banner-grid.ts +319 -0
  99. package/templates/commerce/src/sections/campaign-banners.ts +158 -0
  100. package/templates/commerce/src/sections/category-slider.ts +144 -0
  101. package/templates/commerce/src/sections/content-builder.ts +123 -0
  102. package/templates/commerce/src/sections/content-controls.ts +45 -0
  103. package/templates/commerce/src/sections/custom-form.ts +59 -0
  104. package/templates/commerce/src/sections/faq-accordion.ts +123 -0
  105. package/templates/commerce/src/sections/footer.ts +728 -0
  106. package/templates/commerce/src/sections/header.ts +439 -0
  107. package/templates/commerce/src/sections/hero-slider.ts +492 -0
  108. package/templates/commerce/src/sections/hero.ts +137 -0
  109. package/templates/commerce/src/sections/index.ts +102 -0
  110. package/templates/commerce/src/sections/mobile-slider.ts +102 -0
  111. package/templates/commerce/src/sections/newsletter.ts +43 -0
  112. package/templates/commerce/src/sections/product-grid.ts +191 -0
  113. package/templates/commerce/src/sections/raw-html.ts +1 -0
  114. package/templates/commerce/src/sections/rich-text.ts +26 -0
  115. package/templates/commerce/src/sections/services-features.ts +211 -0
  116. package/templates/commerce/src/sections/testimonials.ts +194 -0
  117. package/templates/commerce/src/snippets/product-card.ts +178 -0
  118. package/templates/commerce/src/snippets/product-price.ts +46 -0
  119. package/templates/commerce/src/snippets/responsive-image.ts +29 -0
  120. package/templates/commerce/src/styles.ts +477 -0
  121. package/templates/commerce/src/templates/404.json +26 -0
  122. package/templates/commerce/src/templates/account.json +17 -0
  123. package/templates/commerce/src/templates/cart.json +17 -0
  124. package/templates/commerce/src/templates/category.json +16 -0
  125. package/templates/commerce/src/templates/checkout.json +15 -0
  126. package/templates/commerce/src/templates/collection.json +16 -0
  127. package/templates/commerce/src/templates/index.json +180 -0
  128. package/templates/commerce/src/templates/login.json +17 -0
  129. package/templates/commerce/src/templates/order-success.json +17 -0
  130. package/templates/commerce/src/templates/page.json +17 -0
  131. package/templates/commerce/src/templates/product.json +17 -0
  132. package/templates/commerce/src/templates/search.json +18 -0
  133. package/templates/commerce/src/templates/signup.json +17 -0
  134. package/templates/commerce/src/templates/track-order.json +17 -0
  135. package/templates/commerce/src/templates/wishlist.json +17 -0
  136. package/templates/commerce/src/templates.ts +510 -0
  137. package/templates/commerce/src/tokens.ts +22 -0
  138. package/templates/theme-candy-boilerplate/.editorconfig +14 -0
  139. package/templates/theme-candy-boilerplate/.gitattributes +1 -0
  140. package/templates/theme-candy-boilerplate/.vscode/extensions.json +7 -0
  141. package/templates/theme-candy-boilerplate/.vscode/settings.json +17 -0
  142. package/templates/theme-candy-boilerplate/assets/theme.css +78 -0
  143. package/templates/theme-candy-boilerplate/assets/theme.js +7 -0
  144. package/templates/theme-candy-boilerplate/candy.config.json +40 -0
  145. package/templates/theme-candy-boilerplate/index.ts +39 -0
  146. package/templates/theme-candy-boilerplate/layout/theme.candy +25 -0
  147. package/templates/theme-candy-boilerplate/locales/en.default.json +37 -0
  148. package/templates/theme-candy-boilerplate/manifest.json +123 -0
  149. package/templates/theme-candy-boilerplate/package.json +16 -0
  150. package/templates/theme-candy-boilerplate/schemas/settings_schema.json +36 -0
  151. package/templates/theme-candy-boilerplate/sections/featured-products.candy +89 -0
  152. package/templates/theme-candy-boilerplate/sections/footer.candy +50 -0
  153. package/templates/theme-candy-boilerplate/sections/header.candy +116 -0
  154. package/templates/theme-candy-boilerplate/sections/hero-banner.candy +135 -0
  155. package/templates/theme-candy-boilerplate/sections/image-with-text.candy +85 -0
  156. package/templates/theme-candy-boilerplate/snippets/price.candy +19 -0
  157. package/templates/theme-candy-boilerplate/snippets/product-card.candy +43 -0
  158. package/templates/theme-candy-boilerplate/templates/404.candy +12 -0
  159. package/templates/theme-candy-boilerplate/templates/cart.candy +51 -0
  160. package/templates/theme-candy-boilerplate/templates/collection.candy +51 -0
  161. package/templates/theme-candy-boilerplate/templates/index.candy +7 -0
  162. package/templates/theme-candy-boilerplate/templates/page.candy +10 -0
  163. package/templates/theme-candy-boilerplate/templates/product.candy +59 -0
  164. package/templates/theme-candy-boilerplate/templates/search.candy +40 -0
  165. package/templates/vscode-candy/LICENSE +21 -0
  166. package/templates/vscode-candy/README.md +22 -0
  167. package/templates/vscode-candy/extension.js +689 -0
  168. package/templates/vscode-candy/icons/candy-dark.svg +23 -0
  169. package/templates/vscode-candy/icons/candy-light.svg +23 -0
  170. package/templates/vscode-candy/icons/candy-logo.png +0 -0
  171. package/templates/vscode-candy/icons/candy-sweet-dark.svg +23 -0
  172. package/templates/vscode-candy/icons/candy-sweet-light.svg +23 -0
  173. package/templates/vscode-candy/language-configuration.json +47 -0
  174. package/templates/vscode-candy/package.json +118 -0
  175. package/templates/vscode-candy/schemas/candy-config.schema.json +56 -0
  176. package/templates/vscode-candy/schemas/candy-settings.schema.json +70 -0
  177. package/templates/vscode-candy/snippets/candy.code-snippets +270 -0
  178. package/templates/vscode-candy/syntaxes/candy.tmLanguage.json +296 -0
  179. package/templates/vscode-candy/vim/ftdetect/candy.vim +5 -0
@@ -0,0 +1,492 @@
1
+ import type { SectionRenderContext } from '@caartzee/theme-sdk';
2
+
3
+ function escapeHtml(str: string | null | undefined): string {
4
+ if (!str) return '';
5
+ return String(str)
6
+ .replace(/&/g, '&')
7
+ .replace(/</g, '&lt;')
8
+ .replace(/>/g, '&gt;')
9
+ .replace(/"/g, '&quot;')
10
+ .replace(/'/g, '&#039;');
11
+ }
12
+
13
+ function normalizeHeroImageUrl(url?: string | null, tenantId?: string): string {
14
+ if (!url || typeof url !== 'string' || !url.trim()) {
15
+ return 'https://images.unsplash.com/photo-1558060370-d644479cb6f7?w=1200&auto=format&fit=crop&q=85';
16
+ }
17
+ const trimmed = url.trim();
18
+ if (trimmed.startsWith('http://') || trimmed.startsWith('https://')) {
19
+ return trimmed;
20
+ }
21
+ const cleanKey = trimmed.startsWith('/') ? trimmed.slice(1) : trimmed;
22
+ const tid = tenantId || 'toybee';
23
+ if (cleanKey.startsWith('zeedonecartlynew/')) {
24
+ return `https://d2smzhz8bsiykz.cloudfront.net/${cleanKey}`;
25
+ }
26
+ if (cleanKey.startsWith(`${tid}/`)) {
27
+ return `https://d2smzhz8bsiykz.cloudfront.net/zeedonecartlynew/${cleanKey}`;
28
+ }
29
+ return `https://d2smzhz8bsiykz.cloudfront.net/zeedonecartlynew/${tid}/${cleanKey}`;
30
+ }
31
+
32
+ interface SlideData {
33
+ badge?: string;
34
+ heading?: string;
35
+ highlightText?: string;
36
+ subheading?: string;
37
+ buttonText?: string;
38
+ buttonLink?: string;
39
+ secondaryButtonText?: string;
40
+ secondaryButtonLink?: string;
41
+ imageUrl?: string;
42
+ overlayOpacity?: number;
43
+ textAlignment?: 'left' | 'center' | 'right';
44
+ }
45
+
46
+ function formatEditorialHeading(heading: string, highlightText?: string): string {
47
+ const cleanHeading = heading || 'Autumn\nCollection 2026';
48
+ const normalizedHeading = !cleanHeading.includes('\n') && !cleanHeading.includes('\\n')
49
+ ? cleanHeading.replace(/^([A-Za-z]+)\s+([A-Za-z]+\s+(?:19|20)\d{2}.*)$/, '$1\n$2')
50
+ : cleanHeading;
51
+ const explicitHighlight = typeof highlightText === 'string' && highlightText.trim() ? highlightText.trim() : '';
52
+
53
+ if (explicitHighlight && normalizedHeading.includes(explicitHighlight)) {
54
+ const idx = normalizedHeading.indexOf(explicitHighlight);
55
+ const before = escapeHtml(normalizedHeading.slice(0, idx)).replace(/\\n|\n/g, '<br />');
56
+ const mid = `<em class="italic font-normal text-[#e5b95c]">${escapeHtml(explicitHighlight)}</em>`;
57
+ const after = escapeHtml(normalizedHeading.slice(idx + explicitHighlight.length)).replace(/\\n|\n/g, '<br />');
58
+ return `${before}${mid}${after}`;
59
+ }
60
+
61
+ // Automatically italicize standalone 4-digit year (e.g., "Autumn\nCollection 2026" or "... 2026 sp2")
62
+ const yearMatch = normalizedHeading.match(/^(.*?\b)((?:19|20)\d{2})(\b.*)$/s);
63
+ if (yearMatch && yearMatch[2]) {
64
+ const before = escapeHtml(yearMatch[1] || '').replace(/\\n|\n/g, '<br />');
65
+ const yearPart = `<em class="italic font-normal text-[#e5b95c]">${escapeHtml(yearMatch[2])}</em>`;
66
+ const after = escapeHtml(yearMatch[3] || '').replace(/\\n|\n/g, '<br />');
67
+ return `${before}${yearPart}${after}`;
68
+ }
69
+
70
+ return escapeHtml(normalizedHeading).replace(/\\n|\n/g, '<br />');
71
+ }
72
+
73
+ /**
74
+ * Luxury Editorial Hero Banner Carousel & Slider Section
75
+ *
76
+ * Features:
77
+ * - Deep burgundy-mahogany radial lighting with golden spotlight halo
78
+ * - Editorial serif display headline with italic gold accent
79
+ * - Metallic champagne-gold pill CTA button
80
+ * - Interactive navigation arrows, gold pill pagination dots & touch swipe island
81
+ */
82
+ export function renderStarterHeroSlider(ctx: SectionRenderContext): string {
83
+ const settings = ctx.section.settings || {};
84
+ const sectionId = escapeHtml(ctx.section.id || 'hero-slider-1');
85
+ const sectionType = escapeHtml(ctx.section.type || 'hero-slider');
86
+ const rawNonce = (ctx.pageContext as any)?.nonce;
87
+ const nonceAttr = typeof rawNonce === 'string' && rawNonce.trim() ? ` nonce="${escapeHtml(rawNonce)}"` : '';
88
+
89
+ // Height preset class (supports both manifest 'height' and legacy 'heightPreset')
90
+ const heightPreset = settings.height || settings.heightPreset || 'standard';
91
+ const heightClass =
92
+ heightPreset === 'compact'
93
+ ? 'min-h-[440px] lg:min-h-[500px]'
94
+ : heightPreset === 'fullscreen'
95
+ ? 'min-h-[75vh] lg:min-h-[85vh]'
96
+ : 'min-h-[540px] lg:min-h-[640px]';
97
+
98
+ const autoplay = settings.autoplay !== false;
99
+ const intervalSeconds = Number(settings.intervalSeconds || 5);
100
+ const showArrows = settings.showArrows !== false;
101
+ const showDots = settings.showDots !== false;
102
+ const mobileSliders = (ctx.pageContext as any)?.mobileSliders;
103
+ const hasMobileSliders = Array.isArray(mobileSliders) && mobileSliders.length > 0;
104
+
105
+ const defaultSlides: SlideData[] = [
106
+ {
107
+ badge: 'NEW SEASON LAUNCH',
108
+ heading: 'Autumn\nCollection 2026',
109
+ highlightText: '2026',
110
+ subheading: 'Discover the latest seasonal trends in toys, fashion and more for every age.',
111
+ buttonText: 'Shop Collection',
112
+ buttonLink: '/products',
113
+ imageUrl: 'https://images.unsplash.com/photo-1584917865442-de89df76afd3?w=1200&auto=format&fit=crop&q=85',
114
+ textAlignment: 'left',
115
+ },
116
+ {
117
+ badge: 'LIMITED DROP',
118
+ heading: 'Playful\nWonders 2026',
119
+ highlightText: '2026',
120
+ subheading: 'Thoughtfully crafted toys, apparel, and seasonal favorites built for everyday joy.',
121
+ buttonText: 'Explore Collection',
122
+ buttonLink: '/products',
123
+ imageUrl: 'https://images.unsplash.com/photo-1548036328-c9fa89d128fa?w=1200&auto=format&fit=crop&q=85',
124
+ textAlignment: 'left',
125
+ },
126
+ ];
127
+
128
+ // Authoritative Content Resolution:
129
+ // Mobile Slider in Tenant Admin is the single source of truth for storefront hero slide content.
130
+ // When configured by the tenant, consume these slides across all viewports (mobile and desktop).
131
+ // When not configured, fall back gracefully to Theme Editor section blocks or default starter slides.
132
+ const blocks = ctx.section.blocks || [];
133
+ let slides: (SlideData & { id?: string; blockId?: string })[];
134
+
135
+ if (hasMobileSliders) {
136
+ const validMobileSlides = mobileSliders.filter((s: any) => s && (s.image || s.imageUrl));
137
+ if (validMobileSlides.length > 0) {
138
+ slides = validMobileSlides.map((s: any, idx: number) => ({
139
+ id: `slide_${s.id ?? idx + 1}`,
140
+ blockId: `slide_${s.id ?? idx + 1}`,
141
+ badge: s.campaign ? String(s.campaign) : (s.category || ''),
142
+ heading: s.title || '',
143
+ subheading: s.description || '',
144
+ buttonText: s.button_text || s.buttonText || 'Shop Now',
145
+ buttonLink: s.button_url || s.buttonUrl || '/shop',
146
+ imageUrl: normalizeHeroImageUrl(s.image || s.imageUrl),
147
+ overlayOpacity: 0.1,
148
+ textAlignment: (settings.textAlignment as 'left' | 'center' | 'right') || 'left',
149
+ }));
150
+ } else if (blocks.length > 0) {
151
+ slides = blocks.map((b, idx) => ({
152
+ id: b.id || `slide_${idx + 1}`,
153
+ blockId: b.id || `slide_${idx + 1}`,
154
+ badge: b.settings?.badge as string,
155
+ heading: (b.settings?.heading as string) || (b.settings?.title as string),
156
+ subheading: (b.settings?.subheading as string) || (b.settings?.subtitle as string),
157
+ buttonText: b.settings?.buttonText as string,
158
+ buttonLink: (b.settings?.buttonLink as string) || (b.settings?.buttonUrl as string),
159
+ secondaryButtonText: b.settings?.secondaryButtonText as string,
160
+ secondaryButtonLink: b.settings?.secondaryButtonLink as string,
161
+ imageUrl: (b.settings?.imageUrl as string) || (b.settings?.image as string),
162
+ overlayOpacity: Number(b.settings?.overlayOpacity ?? 0),
163
+ textAlignment: (b.settings?.textAlignment as 'left' | 'center' | 'right') || (settings.textAlignment as 'left' | 'center' | 'right') || 'left',
164
+ }));
165
+ } else {
166
+ slides = defaultSlides.map((s, idx) => ({
167
+ ...s,
168
+ id: `slide_${idx + 1}`,
169
+ blockId: `slide_${idx + 1}`,
170
+ }));
171
+ }
172
+ } else if (blocks.length > 0) {
173
+ slides = blocks.map((b, idx) => ({
174
+ id: b.id || `slide_${idx + 1}`,
175
+ blockId: b.id || `slide_${idx + 1}`,
176
+ badge: b.settings?.badge as string,
177
+ heading: (b.settings?.heading as string) || (b.settings?.title as string),
178
+ subheading: (b.settings?.subheading as string) || (b.settings?.subtitle as string),
179
+ buttonText: b.settings?.buttonText as string,
180
+ buttonLink: (b.settings?.buttonLink as string) || (b.settings?.buttonUrl as string),
181
+ secondaryButtonText: b.settings?.secondaryButtonText as string,
182
+ secondaryButtonLink: b.settings?.secondaryButtonLink as string,
183
+ imageUrl: (b.settings?.imageUrl as string) || (b.settings?.image as string),
184
+ overlayOpacity: Number(b.settings?.overlayOpacity ?? 0),
185
+ textAlignment: (b.settings?.textAlignment as 'left' | 'center' | 'right') || 'left',
186
+ }));
187
+ } else {
188
+ slides = defaultSlides.map((s, idx) => ({
189
+ ...s,
190
+ id: `slide_${idx + 1}`,
191
+ blockId: `slide_${idx + 1}`,
192
+ }));
193
+ }
194
+
195
+ return `
196
+ <section
197
+ class="sf-hero-slider relative w-full overflow-hidden select-none group"
198
+ style="background: #140b0e !important; background-image: radial-gradient(ellipse at 70% 50%, rgba(238, 186, 86, 0.25) 0%, rgba(148, 24, 44, 0.42) 36%, rgba(20, 11, 14, 0.95) 70%, #140b0e 100%) !important; color: #ffffff !important;"
199
+ id="${sectionId}"
200
+ data-section-id="${sectionId}"
201
+ data-section-type="${sectionType}"
202
+ data-autoplay="${autoplay}"
203
+ data-interval="${intervalSeconds * 1000}"
204
+ data-region="body"
205
+ data-content-source="${hasMobileSliders ? 'mobile-slider' : 'theme-editor'}"
206
+ >
207
+ <style${nonceAttr}>
208
+ #${sectionId}.sf-hero-slider,
209
+ #${sectionId} .sf-slider-track,
210
+ #${sectionId} .sf-slide {
211
+ background: #140b0e !important;
212
+ background-image: radial-gradient(ellipse at 70% 50%, rgba(238, 186, 86, 0.25) 0%, rgba(148, 24, 44, 0.42) 36%, rgba(20, 11, 14, 0.95) 70%, #140b0e 100%) !important;
213
+ color: #ffffff !important;
214
+ }
215
+ #${sectionId} .sf-hero-title,
216
+ #${sectionId} .sf-hero-title * {
217
+ color: #ffffff !important;
218
+ text-shadow: 0 2px 16px rgba(0,0,0,0.7) !important;
219
+ }
220
+ #${sectionId} .sf-hero-copy p {
221
+ color: #e2dcd5 !important;
222
+ text-shadow: 0 1px 4px rgba(0,0,0,0.6) !important;
223
+ }
224
+ #${sectionId} .sf-hero-composition {
225
+ display: flex !important;
226
+ flex-direction: column !important;
227
+ }
228
+ @media (min-width: 1024px) {
229
+ #${sectionId} .sf-hero-composition {
230
+ flex-direction: row !important;
231
+ justify-content: space-between !important;
232
+ align-items: center !important;
233
+ }
234
+ #${sectionId} .sf-hero-copy,
235
+ #${sectionId} .sf-hero-visual {
236
+ width: 50% !important;
237
+ max-width: 50% !important;
238
+ }
239
+ }
240
+ #${sectionId} .sf-hero-btn-primary {
241
+ display: inline-flex !important;
242
+ visibility: visible !important;
243
+ opacity: 1 !important;
244
+ }
245
+ </style>
246
+
247
+ <!-- Slides Track Container -->
248
+ <div class="sf-slider-track relative w-full ${heightClass} flex overflow-hidden" style="background: transparent !important;">
249
+ ${slides
250
+ .map((slide, idx) => {
251
+ const isActive = idx === 0;
252
+ const bgImage = normalizeHeroImageUrl(
253
+ slide.imageUrl,
254
+ );
255
+
256
+ const headingHtml = formatEditorialHeading(
257
+ slide.heading || 'Autumn\nCollection 2026',
258
+ slide.highlightText,
259
+ );
260
+
261
+ const slideAlign = slide.textAlignment || 'left';
262
+ const slideAlignClass = slideAlign === 'center' ? 'items-center text-center mx-auto' : slideAlign === 'right' ? 'items-end text-right ml-auto' : 'items-start text-left';
263
+ const btnText = slide.buttonText || 'Shop Now';
264
+ const btnLink = slide.buttonLink || '/shop';
265
+
266
+ return `
267
+ <div
268
+ class="sf-slide js-slide absolute inset-0 w-full h-full flex items-center transition-opacity duration-700 ease-in-out ${isActive ? 'opacity-100 z-10' : 'opacity-0 z-0 pointer-events-none'}"
269
+ style="background: transparent !important; color: #ffffff !important;"
270
+ id="${escapeHtml(slide.id || `${sectionId}-slide-${idx}`)}"
271
+ data-block-id="${escapeHtml(slide.blockId || slide.id || `slide_${idx + 1}`)}"
272
+ data-slide-index="${idx}"
273
+ >
274
+ <!-- Ambient studio radial lighting (keeps crimson burgundy + golden warmth intact) -->
275
+ <div class="absolute inset-0 pointer-events-none bg-[radial-gradient(ellipse_at_70%_50%,rgba(238,186,86,0.25)_0%,rgba(148,24,44,0.38)_36%,transparent_70%)]" aria-hidden="true"></div>
276
+
277
+ <div class="sf-hero-composition relative w-full h-full max-w-[1360px] mx-auto px-6 sm:px-10 lg:px-14 py-8 lg:py-0 flex flex-col lg:flex-row items-center justify-between gap-8 lg:gap-12">
278
+
279
+ <!-- Left Text Column -->
280
+ <div class="sf-hero-copy w-full lg:w-1/2 flex flex-col justify-center z-20 py-4 lg:py-8 ${slideAlignClass}">
281
+ ${slide.badge ? `
282
+ <span class="inline-block text-[11px] sm:text-xs font-bold uppercase tracking-[0.22em] mb-3" style="color: #f5d888 !important; text-shadow: 0 1px 4px rgba(0,0,0,0.6) !important;">
283
+ ${escapeHtml(slide.badge)}
284
+ </span>
285
+ ` : ''}
286
+
287
+ <h1 class="sf-hero-title text-4xl sm:text-5xl lg:text-[58px] font-bold tracking-tight font-heading leading-[1.08] mb-4 max-w-[540px]" style="color: #ffffff !important; text-shadow: 0 2px 16px rgba(0,0,0,0.7) !important;">
288
+ ${headingHtml}
289
+ </h1>
290
+
291
+ ${slide.subheading ? `
292
+ <p class="text-sm sm:text-base font-normal leading-relaxed mb-6 max-w-lg" style="color: #e2dcd5 !important; text-shadow: 0 1px 4px rgba(0,0,0,0.5) !important;">
293
+ ${escapeHtml(slide.subheading)}
294
+ </p>
295
+ ` : ''}
296
+
297
+ <div class="flex flex-wrap items-center gap-4 mt-2">
298
+ <a
299
+ href="${escapeHtml(btnLink)}"
300
+ class="sf-hero-btn-primary inline-flex items-center gap-2.5 px-8 py-3.5 rounded-full font-bold text-sm tracking-wide transition-all duration-200 hover:scale-105 active:scale-95 shadow-lg group/btn"
301
+ style="background: linear-gradient(180deg, #f5d888 0%, #dfb04a 50%, #c38c2b 100%) !important; color: #17110d !important; border: 1px solid rgba(255, 234, 168, 0.7) !important; box-shadow: 0 8px 24px rgba(223, 176, 74, 0.45) !important;"
302
+ >
303
+ <span style="color: #17110d !important; font-weight: 700 !important;">${escapeHtml(btnText)}</span>
304
+ <span class="inline-block transition-transform duration-200 group-hover/btn:translate-x-1" style="color: #17110d !important;">&rarr;</span>
305
+ </a>
306
+
307
+ ${slide.secondaryButtonText ? `
308
+ <a
309
+ href="${escapeHtml(slide.secondaryButtonLink || '/categories')}"
310
+ class="inline-flex items-center gap-2 px-6 py-3.5 rounded-full font-medium text-sm transition-all active:scale-95"
311
+ style="background: rgba(255, 255, 255, 0.12) !important; color: #ffffff !important; border: 1px solid rgba(255, 255, 255, 0.3) !important;"
312
+ >
313
+ ${escapeHtml(slide.secondaryButtonText)}
314
+ </a>
315
+ ` : ''}
316
+ </div>
317
+ </div>
318
+
319
+ <!-- Right Visual Showcase Column -->
320
+ <div class="sf-hero-visual w-full lg:w-1/2 h-[340px] sm:h-[420px] lg:h-[480px] flex items-center justify-center lg:justify-end relative z-10">
321
+ <div class="relative w-full max-w-[540px] h-full flex items-center justify-center p-2 sm:p-4">
322
+ <img
323
+ src="${escapeHtml(bgImage)}"
324
+ alt="${escapeHtml(slide.heading || 'Hero Banner')}"
325
+ class="max-h-[90%] w-auto max-w-full object-contain rounded-2xl drop-shadow-[0_12px_28px_rgba(0,0,0,0.5)] transition-transform duration-700 hover:scale-[1.03]"
326
+ loading="${idx === 0 ? 'eager' : 'lazy'}"
327
+ ${idx === 0 ? 'fetchpriority="high"' : ''}
328
+ onerror="this.onerror=null; this.src='https://images.unsplash.com/photo-1558060370-d644479cb6f7?w=1200&auto=format&fit=crop&q=85';"
329
+ />
330
+ </div>
331
+ </div>
332
+
333
+ </div>
334
+ </div>
335
+ `;
336
+ })
337
+ .join('')}
338
+ </div>
339
+
340
+ <!-- Navigation Arrows -->
341
+ ${showArrows && slides.length > 1
342
+ ? `
343
+ <button
344
+ type="button"
345
+ class="js-slider-prev absolute left-3 sm:left-5 top-1/2 -translate-y-1/2 z-30 w-10 h-10 rounded-full bg-white/10 hover:bg-white/25 text-white shadow-md flex items-center justify-center transition-all duration-200 hover:scale-105 active:scale-95 border border-white/15 backdrop-blur-sm"
346
+ aria-label="Previous Slide"
347
+ >
348
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2.2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" /></svg>
349
+ </button>
350
+ <button
351
+ type="button"
352
+ class="js-slider-next absolute right-3 sm:right-5 top-1/2 -translate-y-1/2 z-30 w-10 h-10 rounded-full bg-white/10 hover:bg-white/25 text-white shadow-md flex items-center justify-center transition-all duration-200 hover:scale-105 active:scale-95 border border-white/15 backdrop-blur-sm"
353
+ aria-label="Next Slide"
354
+ >
355
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2.2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M9 5l7 7-7 7" /></svg>
356
+ </button>
357
+ `
358
+ : ''
359
+ }
360
+
361
+ <!-- Pagination Indicators (Dots) -->
362
+ ${showDots && slides.length > 1
363
+ ? `
364
+ <div class="absolute bottom-4 left-1/2 -translate-x-1/2 z-30 flex items-center gap-2">
365
+ ${slides
366
+ .map(
367
+ (_, idx) => `
368
+ <button
369
+ type="button"
370
+ class="js-slider-dot h-2 rounded-full transition-all duration-300 ${idx === 0 ? 'w-6 bg-[#e5b95c]' : 'w-2 bg-white/40 hover:bg-white/70'}"
371
+ data-dot-index="${idx}"
372
+ aria-label="Go to slide ${idx + 1}"
373
+ ></button>
374
+ `,
375
+ )
376
+ .join('')}
377
+ </div>
378
+ `
379
+ : ''
380
+ }
381
+
382
+ <!-- Self-Contained Lightweight Island Script -->
383
+ <script${nonceAttr}>
384
+ (function() {
385
+ var container = document.getElementById('${sectionId}');
386
+ if (!container || container.__sliderInitialized) return;
387
+ container.__sliderInitialized = true;
388
+
389
+ var slides = container.querySelectorAll('.js-slide');
390
+ var dots = container.querySelectorAll('.js-slider-dot');
391
+ var prevBtn = container.querySelector('.js-slider-prev');
392
+ var nextBtn = container.querySelector('.js-slider-next');
393
+ var count = slides.length;
394
+ if (count <= 1) return;
395
+
396
+ var currentIndex = 0;
397
+ var intervalMs = parseInt(container.getAttribute('data-interval') || '5000', 10);
398
+ var isAutoplay = container.getAttribute('data-autoplay') === 'true';
399
+ var timer = null;
400
+
401
+ function goTo(index) {
402
+ currentIndex = (index + count) % count;
403
+
404
+ slides.forEach(function(slide, idx) {
405
+ if (idx === currentIndex) {
406
+ slide.classList.remove('opacity-0', 'z-0', 'pointer-events-none');
407
+ slide.classList.add('opacity-100', 'z-10');
408
+ } else {
409
+ slide.classList.remove('opacity-100', 'z-10');
410
+ slide.classList.add('opacity-0', 'z-0', 'pointer-events-none');
411
+ }
412
+ });
413
+
414
+ dots.forEach(function(dot, idx) {
415
+ if (idx === currentIndex) {
416
+ dot.classList.remove('w-2', 'bg-white/40');
417
+ dot.classList.add('w-6', 'bg-[#e5b95c]');
418
+ } else {
419
+ dot.classList.remove('w-6', 'bg-[#e5b95c]');
420
+ dot.classList.add('w-2', 'bg-white/40');
421
+ }
422
+ });
423
+ }
424
+
425
+ function next() { goTo(currentIndex + 1); }
426
+ function prev() { goTo(currentIndex - 1); }
427
+
428
+ function startAutoplay() {
429
+ if (!isAutoplay || timer) return;
430
+ timer = setInterval(next, intervalMs);
431
+ }
432
+
433
+ function stopAutoplay() {
434
+ if (timer) {
435
+ clearInterval(timer);
436
+ timer = null;
437
+ }
438
+ }
439
+
440
+ if (nextBtn) nextBtn.addEventListener('click', function() { next(); stopAutoplay(); startAutoplay(); });
441
+ if (prevBtn) prevBtn.addEventListener('click', function() { prev(); stopAutoplay(); startAutoplay(); });
442
+
443
+ dots.forEach(function(dot) {
444
+ dot.addEventListener('click', function() {
445
+ var idx = parseInt(dot.getAttribute('data-dot-index') || '0', 10);
446
+ goTo(idx);
447
+ stopAutoplay();
448
+ startAutoplay();
449
+ });
450
+ });
451
+
452
+ container.addEventListener('mouseenter', stopAutoplay);
453
+ container.addEventListener('mouseleave', startAutoplay);
454
+
455
+ var touchStartX = 0;
456
+ container.addEventListener('touchstart', function(e) {
457
+ touchStartX = e.changedTouches[0].screenX;
458
+ }, { passive: true });
459
+
460
+ container.addEventListener('touchend', function(e) {
461
+ var diff = e.changedTouches[0].screenX - touchStartX;
462
+ if (Math.abs(diff) > 40) {
463
+ if (diff > 0) prev();
464
+ else next();
465
+ stopAutoplay();
466
+ startAutoplay();
467
+ }
468
+ }, { passive: true });
469
+
470
+ container.__goToSlide = goTo;
471
+ container.__stopAutoplay = stopAutoplay;
472
+
473
+ window.addEventListener('message', function(evt) {
474
+ if (!evt.data) return;
475
+ if (evt.data.type === 'SELECT_SLIDE' || evt.data.type === 'CAARTZEE_SELECT_SLIDE') {
476
+ var targetSec = evt.data.sectionId;
477
+ if (!targetSec || targetSec === '${sectionId}' || targetSec === 'hero-slider' || String(targetSec).indexOf('hero') !== -1) {
478
+ var sIdx = typeof evt.data.slideIndex === 'number' ? evt.data.slideIndex : evt.data.index;
479
+ if (typeof sIdx === 'number' && sIdx >= 0) {
480
+ stopAutoplay();
481
+ goTo(sIdx);
482
+ }
483
+ }
484
+ }
485
+ });
486
+
487
+ startAutoplay();
488
+ })();
489
+ </script>
490
+ </section>
491
+ `;
492
+ }
@@ -0,0 +1,137 @@
1
+ import type { SectionRenderContext } from '@caartzee/theme-sdk';
2
+
3
+ function escapeHtml(str: string): string {
4
+ return str
5
+ .replace(/&/g, '&amp;')
6
+ .replace(/</g, '&lt;')
7
+ .replace(/>/g, '&gt;')
8
+ .replace(/"/g, '&quot;')
9
+ .replace(/'/g, '&#039;');
10
+ }
11
+
12
+ /**
13
+ * Starter Hero Banner Section - Beautiful Tailwind CSS Edition
14
+ *
15
+ * Features:
16
+ * - Fluid radial glow gradient background
17
+ * - Modern pill badge with sparkles icon
18
+ * - Expressive typography and responsive headline
19
+ * - Primary and secondary CTA action buttons
20
+ * - Value props trust bar
21
+ */
22
+ export function renderStarterHero(ctx: SectionRenderContext): string {
23
+ const settings = ctx.section.settings || {};
24
+ const firstBlock = (ctx.section.blocks && ctx.section.blocks[0]?.settings) ? ctx.section.blocks[0].settings : {};
25
+ const mobileSliders = (ctx.pageContext as any)?.mobileSliders;
26
+ const firstMobileSlide = Array.isArray(mobileSliders) && mobileSliders.length > 0 ? mobileSliders[0] : null;
27
+
28
+ const heading = typeof settings.heading === 'string'
29
+ ? settings.heading
30
+ : (typeof firstBlock.heading === 'string'
31
+ ? firstBlock.heading
32
+ : (firstMobileSlide?.title || 'Good things, chosen well.'));
33
+
34
+ const subheading = typeof settings.subheading === 'string'
35
+ ? settings.subheading
36
+ : (typeof firstBlock.subheading === 'string'
37
+ ? firstBlock.subheading
38
+ : (firstMobileSlide?.description || 'Thoughtful finds. Everyday favourites. Explore the collection.'));
39
+
40
+ const buttonText = typeof settings.buttonText === 'string'
41
+ ? settings.buttonText
42
+ : (typeof firstBlock.buttonText === 'string'
43
+ ? firstBlock.buttonText
44
+ : (firstMobileSlide?.button_text || firstMobileSlide?.buttonText || 'Shop Now'));
45
+
46
+ const buttonLink = typeof settings.buttonLink === 'string'
47
+ ? settings.buttonLink
48
+ : (typeof firstBlock.buttonLink === 'string'
49
+ ? firstBlock.buttonLink
50
+ : (firstMobileSlide?.button_url || firstMobileSlide?.buttonUrl || '/products'));
51
+
52
+ const badge = typeof settings.badge === 'string'
53
+ ? settings.badge
54
+ : (firstMobileSlide?.campaign ? String(firstMobileSlide.campaign) : (firstMobileSlide?.category || ''));
55
+
56
+ const imageUrl = (typeof settings.imageUrl === 'string' && settings.imageUrl)
57
+ || (typeof firstBlock.imageUrl === 'string' && firstBlock.imageUrl)
58
+ || firstMobileSlide?.image
59
+ || firstMobileSlide?.imageUrl
60
+ || 'https://images.unsplash.com/photo-1584917865442-de89df76afd3?w=1400&auto=format&fit=crop&q=85';
61
+
62
+ const headingHtml = escapeHtml(heading)
63
+ .replace(/\\n/g, '<br />')
64
+ .replace(/\n/g, '<br />');
65
+
66
+ return `
67
+ <section class="sf-hero sf-starter-hero relative overflow-hidden bg-[#ece7e1] text-neutral-900 border-b border-black/5 py-12 lg:py-20 select-none" id="${escapeHtml(ctx.section.id)}" data-section-id="${escapeHtml(ctx.section.id)}" data-section-type="${escapeHtml(ctx.section.type)}" data-region="body">
68
+
69
+ <div class="max-w-7xl mx-auto px-6 sm:px-10 lg:px-12">
70
+ <div class="flex flex-col lg:flex-row items-center justify-between gap-10 lg:gap-14">
71
+
72
+ <!-- Left Text Column -->
73
+ <div class="w-full lg:w-1/2 flex flex-col justify-center z-10 text-left">
74
+ ${badge ? `
75
+ <span class="inline-flex items-center gap-2 text-xs font-bold uppercase tracking-widest text-neutral-500 mb-4">
76
+ ${escapeHtml(badge)}
77
+ </span>
78
+ ` : ''}
79
+
80
+ <h1 class="text-4xl sm:text-6xl lg:text-[72px] font-black tracking-tight text-neutral-950 font-heading leading-[1.05] mb-5 uppercase">
81
+ ${headingHtml}
82
+ </h1>
83
+
84
+ <p class="text-base sm:text-lg text-neutral-600 font-normal leading-relaxed mb-8 max-w-md">
85
+ ${escapeHtml(subheading)}
86
+ </p>
87
+
88
+ <div class="flex flex-wrap items-center gap-4">
89
+ <a href="${escapeHtml(buttonLink)}" class="inline-flex items-center gap-2.5 px-8 py-3.5 rounded-full bg-neutral-950 hover:bg-neutral-800 text-white font-medium text-sm transition-all duration-200 shadow-md group/btn active:scale-95">
90
+ ${escapeHtml(buttonText)}
91
+ <span class="inline-block transition-transform duration-200 group-hover/btn:translate-x-1">&rarr;</span>
92
+ </a>
93
+ <a href="/categories" class="inline-flex items-center gap-2 px-6 py-3.5 rounded-full bg-white/70 hover:bg-white text-neutral-900 border border-neutral-300 font-medium text-sm transition-all active:scale-95">
94
+ Explore Categories
95
+ </a>
96
+ </div>
97
+ </div>
98
+
99
+ <!-- Right Showcase Column -->
100
+ <div class="w-full lg:w-1/2 flex items-center justify-center lg:justify-end z-10">
101
+ <div class="relative w-full max-w-[560px] flex items-center justify-center">
102
+ <img
103
+ src="${escapeHtml(imageUrl)}"
104
+ alt="${escapeHtml(heading)}"
105
+ class="w-full h-auto object-contain rounded-2xl shadow-sm transition-transform duration-700 hover:scale-[1.02]"
106
+ loading="eager"
107
+ onerror="this.onerror=null; this.src='https://images.unsplash.com/photo-1558060370-d644479cb6f7?w=1200&auto=format&fit=crop&q=85';"
108
+ />
109
+ </div>
110
+ </div>
111
+
112
+ </div>
113
+
114
+ <!-- Trust Badges Strip -->
115
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-6 pt-12 mt-12 border-t border-black/5 text-neutral-600 text-xs font-medium">
116
+ <div class="flex items-center gap-2.5">
117
+ <span class="w-2 h-2 rounded-full bg-neutral-900"></span>
118
+ <span>Free Express Delivery over ₹999</span>
119
+ </div>
120
+ <div class="flex items-center gap-2.5">
121
+ <span class="w-2 h-2 rounded-full bg-neutral-900"></span>
122
+ <span>Verified 100% Authentic Products</span>
123
+ </div>
124
+ <div class="flex items-center gap-2.5">
125
+ <span class="w-2 h-2 rounded-full bg-neutral-900"></span>
126
+ <span>30-Day Hassle-Free Returns</span>
127
+ </div>
128
+ <div class="flex items-center gap-2.5">
129
+ <span class="w-2 h-2 rounded-full bg-neutral-900"></span>
130
+ <span>24/7 Premium Concierge Support</span>
131
+ </div>
132
+ </div>
133
+
134
+ </div>
135
+ </section>
136
+ `;
137
+ }