@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,319 @@
1
+ import type { SectionRenderContext } from '@caartzee/theme-sdk';
2
+
3
+ function escapeHtml(str: string): string {
4
+ return String(str || '')
5
+ .replace(/&/g, '&')
6
+ .replace(/</g, '&lt;')
7
+ .replace(/>/g, '&gt;')
8
+ .replace(/"/g, '&quot;')
9
+ .replace(/'/g, '&#039;');
10
+ }
11
+
12
+ function formatTwoToneTitle(title: string, accentText?: string, accentClass: string = 'italic text-[#7e192b] font-normal'): string {
13
+ const cleanTitle = title || '';
14
+ const explicitAccent = typeof accentText === 'string' && accentText.trim() ? accentText.trim() : '';
15
+
16
+ if (explicitAccent && cleanTitle.includes(explicitAccent)) {
17
+ const idx = cleanTitle.indexOf(explicitAccent);
18
+ const before = escapeHtml(cleanTitle.slice(0, idx)).replace(/\\n|\n/g, '<br />');
19
+ const mid = `<em class="${accentClass}">${escapeHtml(explicitAccent)}</em>`;
20
+ const after = escapeHtml(cleanTitle.slice(idx + explicitAccent.length)).replace(/\\n|\n/g, '<br />');
21
+ return `${before}${mid}${after}`;
22
+ }
23
+
24
+ return escapeHtml(cleanTitle).replace(/\\n|\n/g, '<br />');
25
+ }
26
+
27
+ function renderVipClubBanner(ctx: SectionRenderContext): string {
28
+ const settings = ctx.section.settings || {};
29
+ const blocks = ctx.section.blocks || [];
30
+ const primaryBlock = blocks[0]?.settings || {};
31
+ const sectionId = escapeHtml(ctx.section.id || 'starter-vip-club');
32
+ const rawStoreName = typeof ctx.globalSettings?.storeName === 'string' && ctx.globalSettings.storeName.trim()
33
+ ? ctx.globalSettings.storeName.trim()
34
+ : 'My Store';
35
+
36
+ const title = typeof primaryBlock.title === 'string'
37
+ ? primaryBlock.title
38
+ : (typeof settings.title === 'string' ? settings.title : `Join the ${rawStoreName} Club`);
39
+ const accentText = typeof primaryBlock.accentText === 'string'
40
+ ? primaryBlock.accentText
41
+ : (typeof settings.accentText === 'string' ? settings.accentText : rawStoreName);
42
+ const subtitle = typeof primaryBlock.subtitle === 'string'
43
+ ? primaryBlock.subtitle
44
+ : (typeof settings.subtitle === 'string'
45
+ ? settings.subtitle
46
+ : 'Get exclusive offers, early access to new arrivals and special deals just for members!');
47
+ const buttonText = typeof primaryBlock.buttonText === 'string'
48
+ ? primaryBlock.buttonText
49
+ : (typeof settings.buttonText === 'string' ? settings.buttonText : 'Sign Up Now');
50
+ const linkUrl = typeof primaryBlock.linkUrl === 'string'
51
+ ? primaryBlock.linkUrl
52
+ : (typeof settings.linkUrl === 'string' ? settings.linkUrl : '/signup');
53
+ const imageUrl = typeof primaryBlock.imageUrl === 'string' && primaryBlock.imageUrl
54
+ ? primaryBlock.imageUrl
55
+ : (typeof settings.imageUrl === 'string' && settings.imageUrl ? settings.imageUrl : '');
56
+
57
+ const rawPerks = primaryBlock.perks || settings.perks;
58
+ const perks: string[] = Array.isArray(rawPerks)
59
+ ? rawPerks.map((p: unknown) => String(p)).filter(Boolean)
60
+ : typeof rawPerks === 'string' && rawPerks.trim()
61
+ ? rawPerks.split('|').map((p) => p.trim()).filter(Boolean)
62
+ : ['Member-Only Deals', 'Early Access to Launches', 'Special Birthday Offers'];
63
+
64
+ const formattedTitle = formatTwoToneTitle(title, accentText, 'italic text-[#f3cf76] font-semibold');
65
+
66
+ return `
67
+ <section class="sf-section sf-starter-banners py-8 sm:py-10 bg-[#fbf7f2] select-none" id="${sectionId}" data-section-id="${sectionId}" data-section-type="${escapeHtml(ctx.section.type)}" data-region="body">
68
+ <div class="max-w-[1360px] mx-auto px-4 sm:px-6 lg:px-8">
69
+ <div class="sf-vip-club-bg relative overflow-hidden rounded-2xl shadow-xl border border-white/10">
70
+ <!-- Diagonal Plum Light Sweep & Corner Satin Gold Ribbons -->
71
+ <svg class="pointer-events-none absolute inset-0 w-full h-full" viewBox="0 0 1280 240" preserveAspectRatio="none" aria-hidden="true">
72
+ <defs>
73
+ <linearGradient id="vip-rib-${sectionId}" x1="0%" y1="0%" x2="100%" y2="100%">
74
+ <stop offset="0%" stop-color="#fff0b8" />
75
+ <stop offset="35%" stop-color="#f2c464" />
76
+ <stop offset="70%" stop-color="#c98727" />
77
+ <stop offset="100%" stop-color="#8c540e" />
78
+ </linearGradient>
79
+ </defs>
80
+ <path d="M770,-20 C845,75 880,150 960,260 L1280,260 L1280,-20 Z" fill="#ffffff" opacity="0.04" />
81
+ <path d="M815,-20 C885,78 930,158 1015,260" fill="none" stroke="#ffffff" stroke-opacity="0.11" stroke-width="1.5" />
82
+ <path d="M-20,175 C45,172 105,205 185,248 L120,248 C65,215 15,200 -20,204 Z" fill="url(#vip-rib-${sectionId})" />
83
+ <path d="M-20,175 C45,172 105,205 185,248" fill="none" stroke="#fff3c4" stroke-opacity="0.55" stroke-width="1.5" />
84
+ <path d="M1085,248 C1155,212 1218,172 1295,120 L1295,155 C1225,198 1170,228 1125,248 Z" fill="url(#vip-rib-${sectionId})" />
85
+ </svg>
86
+
87
+ <div class="relative z-10 grid grid-cols-1 lg:grid-cols-12 items-center gap-6 lg:gap-8 px-6 sm:px-10 py-7 sm:py-8">
88
+ <!-- Left 3D Luxury Velvet & Satin Gold Gift Visual -->
89
+ <div class="lg:col-span-3 flex items-center justify-center">
90
+ ${imageUrl ? `
91
+ <img src="${escapeHtml(imageUrl)}" alt="${escapeHtml(title)}" class="w-40 h-32 sm:w-44 sm:h-36 object-contain drop-shadow-2xl rounded-xl" loading="lazy" />
92
+ ` : `
93
+ <div class="relative w-44 h-36 flex items-center justify-center">
94
+ <svg class="w-44 h-36 drop-shadow-2xl" viewBox="0 0 185 168" fill="none" aria-hidden="true">
95
+ <defs>
96
+ <linearGradient id="vip-box-rib-a-${sectionId}" x1="0%" y1="0%" x2="100%" y2="100%">
97
+ <stop offset="0%" stop-color="#fff0b8" />
98
+ <stop offset="35%" stop-color="#f2c464" />
99
+ <stop offset="70%" stop-color="#c98727" />
100
+ <stop offset="100%" stop-color="#8c540e" />
101
+ </linearGradient>
102
+ <linearGradient id="vip-box-rib-b-${sectionId}" x1="0%" y1="0%" x2="0%" y2="100%">
103
+ <stop offset="0%" stop-color="#ffe79e" />
104
+ <stop offset="50%" stop-color="#e3a642" />
105
+ <stop offset="100%" stop-color="#a16818" />
106
+ </linearGradient>
107
+ <linearGradient id="vip-box-fl-${sectionId}" x1="0%" y1="0%" x2="100%" y2="100%">
108
+ <stop offset="0%" stop-color="#8b1b42" />
109
+ <stop offset="100%" stop-color="#4e0a22" />
110
+ </linearGradient>
111
+ <linearGradient id="vip-box-sr-${sectionId}" x1="0%" y1="0%" x2="100%" y2="100%">
112
+ <stop offset="0%" stop-color="#5a0c28" />
113
+ <stop offset="100%" stop-color="#2d0413" />
114
+ </linearGradient>
115
+ <linearGradient id="vip-box-lt-${sectionId}" x1="0%" y1="0%" x2="100%" y2="100%">
116
+ <stop offset="0%" stop-color="#9c234d" />
117
+ <stop offset="100%" stop-color="#60102c" />
118
+ </linearGradient>
119
+ </defs>
120
+ <g transform="translate(2, 10)">
121
+ <polygon points="18,62 94,90 94,162 18,132" fill="url(#vip-box-fl-${sectionId})" />
122
+ <polygon points="94,90 164,62 164,132 94,162" fill="url(#vip-box-sr-${sectionId})" />
123
+ <polygon points="18,62 94,90 164,62 164,74 94,102 18,74" fill="#18020a" opacity="0.55" />
124
+ <polygon points="48,73 64,79 64,150 48,144" fill="url(#vip-box-rib-b-${sectionId})" />
125
+ <polygon points="122,79 138,73 138,143 122,150" fill="url(#vip-box-rib-a-${sectionId})" />
126
+ <polygon points="10,44 92,74 92,92 10,62" fill="url(#vip-box-fl-${sectionId})" />
127
+ <polygon points="92,74 172,44 172,62 92,92" fill="url(#vip-box-sr-${sectionId})" />
128
+ <polygon points="10,44 90,16 172,44 92,74" fill="url(#vip-box-lt-${sectionId})" />
129
+ <polygon points="44,32 60,27 138,56 122,62" fill="url(#vip-box-rib-b-${sectionId})" />
130
+ <polygon points="122,27 138,32 60,62 44,56" fill="url(#vip-box-rib-a-${sectionId})" />
131
+ <polygon points="44,56 60,62 60,80 44,74" fill="url(#vip-box-rib-b-${sectionId})" />
132
+ <polygon points="122,62 138,56 138,74 122,80" fill="url(#vip-box-rib-a-${sectionId})" />
133
+ <path d="M90,42 C68,26 42,10 52,-2 C64,-15 86,8 90,34 Z" fill="url(#vip-box-rib-a-${sectionId})" stroke="#9a6113" stroke-width="0.8" />
134
+ <path d="M90,42 C112,26 138,10 128,-2 C116,-15 94,8 90,34 Z" fill="url(#vip-box-rib-b-${sectionId})" stroke="#9a6113" stroke-width="0.8" />
135
+ <path d="M90,40 C74,26 60,18 68,6 C76,-2 88,16 90,36 Z" fill="#fff2c2" opacity="0.6" />
136
+ <path d="M90,40 C106,26 120,18 112,6 C104,-2 92,16 90,36 Z" fill="#e09e38" opacity="0.65" />
137
+ <path d="M84,42 C72,56 54,68 40,74 L52,78 C66,70 80,58 90,45 Z" fill="url(#vip-box-rib-a-${sectionId})" />
138
+ <path d="M96,42 C108,56 126,68 140,74 L128,78 C114,70 100,58 90,45 Z" fill="url(#vip-box-rib-b-${sectionId})" />
139
+ <ellipse cx="90" cy="39" rx="9" ry="7" fill="url(#vip-box-rib-a-${sectionId})" />
140
+ <path d="M77,11 L81,0 L86,6 L90,-2 L94,6 L99,0 L103,11 Z" fill="#ffe694" stroke="#b8781b" stroke-width="0.8" />
141
+ </g>
142
+ </svg>
143
+ </div>
144
+ `}
145
+ </div>
146
+
147
+ <!-- Center Invitation Copy & Gold Pill CTA -->
148
+ <div class="lg:col-span-5 text-center lg:text-left">
149
+ <h2 class="text-2xl sm:text-3xl lg:text-[34px] font-semibold text-white tracking-tight leading-tight mb-2.5">
150
+ ${formattedTitle}
151
+ </h2>
152
+ <p class="text-xs sm:text-sm text-white/85 leading-relaxed mb-5 max-w-[400px] mx-auto lg:mx-0">
153
+ ${escapeHtml(subtitle)}
154
+ </p>
155
+ <a
156
+ href="${escapeHtml(linkUrl)}"
157
+ class="inline-flex items-center gap-2 px-6 py-2.5 rounded-full bg-gradient-to-b from-[#f5d888] via-[#e2aa43] to-[#c48a28] hover:brightness-105 text-[#17110d] font-bold text-xs sm:text-sm border border-[#ffeaa8]/45 shadow-[0_6px_18px_rgba(0,0,0,0.3)] transition-all active:scale-95"
158
+ >
159
+ <span>${escapeHtml(buttonText)}</span>
160
+ <span>&rarr;</span>
161
+ </a>
162
+ </div>
163
+
164
+ <!-- Right Crown & Perks Checklist -->
165
+ <div class="lg:col-span-4 flex flex-col items-center lg:items-center">
166
+ <div class="flex flex-col items-center">
167
+ <div class="mb-2.5 text-[#f3cf76]" aria-hidden="true">
168
+ <svg class="w-6 h-6" viewBox="0 0 24 24" fill="currentColor">
169
+ <path d="M3 18h18v2H3v-2zm0-2l2-9 5 4 2-6 2 6 5-4 2 9H3z" />
170
+ </svg>
171
+ </div>
172
+ <ul class="space-y-2 text-xs sm:text-sm text-white/95 font-medium text-left">
173
+ ${perks.map((perk) => `
174
+ <li class="flex items-center gap-2.5">
175
+ <span class="w-4 h-4 rounded-full border border-[#f3cf76]/85 text-[#f3cf76] flex items-center justify-center shrink-0">
176
+ <svg class="w-2.5 h-2.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12" /></svg>
177
+ </span>
178
+ <span>${escapeHtml(perk)}</span>
179
+ </li>
180
+ `).join('')}
181
+ </ul>
182
+ </div>
183
+ </div>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ </section>
188
+ `;
189
+ }
190
+
191
+ export function renderStarterBannerGrid(ctx: SectionRenderContext): string {
192
+ const blocks = ctx.section.blocks || [];
193
+ const settings = ctx.section.settings || {};
194
+ const variant = typeof settings.variant === 'string' ? settings.variant : '';
195
+
196
+ if (variant === 'vip-club') {
197
+ return renderVipClubBanner(ctx);
198
+ }
199
+
200
+ const columns = typeof settings.columns === 'number' ? settings.columns : 2;
201
+
202
+ const defaultDualBanners = [
203
+ {
204
+ title: 'Plush &\nSoft Toys',
205
+ accentText: 'Soft Toys',
206
+ subtitle: 'Cuddly friends for all ages!',
207
+ buttonText: 'Shop Now',
208
+ linkUrl: '/categories/plush-soft-toys',
209
+ imageUrl: 'https://images.unsplash.com/photo-1559454403-b8fb88521f11?w=800&auto=format&fit=crop&q=85',
210
+ themeVariant: 'warm-blush',
211
+ },
212
+ {
213
+ title: 'Remote Control &\nVehicle Toys',
214
+ accentText: 'Vehicle Toys',
215
+ subtitle: 'High-speed fun for little explorers!',
216
+ buttonText: 'Shop Now',
217
+ linkUrl: '/categories/remote-control-toys',
218
+ imageUrl: 'https://images.unsplash.com/photo-1594787318286-3d835c1d207f?w=800&auto=format&fit=crop&q=85',
219
+ themeVariant: 'cool-mist',
220
+ },
221
+ ];
222
+
223
+ const effectiveBlocks = blocks.length > 0
224
+ ? blocks.map((b, idx) => ({
225
+ title: typeof b.settings?.title === 'string' ? b.settings.title : defaultDualBanners[idx % 2]!.title,
226
+ accentText: typeof b.settings?.accentText === 'string' ? b.settings.accentText : '',
227
+ subtitle: typeof b.settings?.subtitle === 'string' ? b.settings.subtitle : '',
228
+ buttonText: typeof b.settings?.buttonText === 'string' ? b.settings.buttonText : 'Shop Now',
229
+ linkUrl: typeof b.settings?.linkUrl === 'string' ? b.settings.linkUrl : (typeof b.settings?.link === 'string' ? b.settings.link : '/products'),
230
+ imageUrl: typeof b.settings?.imageUrl === 'string' && b.settings.imageUrl ? b.settings.imageUrl : defaultDualBanners[idx % 2]!.imageUrl,
231
+ themeVariant: typeof b.settings?.themeVariant === 'string' ? b.settings.themeVariant : (idx % 2 === 0 ? 'warm-blush' : 'cool-mist'),
232
+ }))
233
+ : defaultDualBanners;
234
+
235
+ if (columns === 1) {
236
+ const b = effectiveBlocks[0]!;
237
+ return `
238
+ <section class="sf-section sf-starter-banners py-8 sm:py-10 bg-[#fbf7f2] select-none" id="${escapeHtml(ctx.section.id)}" data-section-id="${escapeHtml(ctx.section.id)}" data-section-type="${escapeHtml(ctx.section.type)}" data-region="body">
239
+ <div class="max-w-[1360px] mx-auto px-4 sm:px-6 lg:px-8">
240
+ <div class="relative overflow-hidden rounded-2xl bg-gradient-to-r from-[#f6ece6] via-[#f2e5dc] to-[#ead9cc] border border-[#e6d7ca] shadow-sm">
241
+ <div class="flex flex-col lg:flex-row items-center justify-between p-8 sm:p-12 gap-8">
242
+ <div class="w-full lg:w-1/2 flex flex-col justify-center z-10 text-left">
243
+ <h2 class="text-3xl sm:text-4xl lg:text-5xl text-[#1c1613] font-bold font-heading tracking-tight leading-tight mb-3">
244
+ ${formatTwoToneTitle(b.title, b.accentText)}
245
+ </h2>
246
+ ${b.subtitle ? `<p class="text-sm sm:text-base text-[#5c4f46] leading-relaxed mb-6 max-w-md">${escapeHtml(b.subtitle)}</p>` : ''}
247
+ <div>
248
+ <a href="${escapeHtml(b.linkUrl)}" class="inline-flex items-center gap-2 px-6 py-3 rounded-full bg-[#7e192b] hover:bg-[#621220] text-white font-semibold text-xs sm:text-sm transition-all shadow-md active:scale-95">
249
+ ${escapeHtml(b.buttonText)} <span>&rarr;</span>
250
+ </a>
251
+ </div>
252
+ </div>
253
+ <div class="w-full lg:w-1/2 flex items-center justify-center lg:justify-end">
254
+ <div class="relative w-full max-w-[480px] aspect-[16/10] overflow-hidden rounded-xl shadow-sm">
255
+ <img src="${escapeHtml(b.imageUrl)}" alt="${escapeHtml(b.title)}" class="w-full h-full object-cover object-center transition-transform duration-700 hover:scale-105" loading="lazy" />
256
+ </div>
257
+ </div>
258
+ </div>
259
+ </div>
260
+ </div>
261
+ </section>
262
+ `;
263
+ }
264
+
265
+ const gridColsClass = columns >= 3 ? 'grid-cols-1 md:grid-cols-3' : 'grid-cols-1 md:grid-cols-2';
266
+
267
+ return `
268
+ <section class="sf-section sf-starter-banners py-6 sm:py-8 bg-[#fbf7f2] select-none" id="${escapeHtml(ctx.section.id)}" data-section-id="${escapeHtml(ctx.section.id)}" data-section-type="${escapeHtml(ctx.section.type)}" data-region="body">
269
+ <div class="max-w-[1360px] mx-auto px-4 sm:px-6 lg:px-8">
270
+ <div class="grid ${gridColsClass} gap-5 sm:gap-6">
271
+ ${effectiveBlocks.map((card, idx) => {
272
+ const isCool = card.themeVariant === 'cool-mist' || (card.themeVariant !== 'warm-blush' && idx % 2 === 1);
273
+ const cardSurface = isCool
274
+ ? 'bg-gradient-to-r from-[#eef2f5] via-[#e6ecf1] to-[#dce4ec] border-[#d6dfe7]'
275
+ : 'bg-gradient-to-r from-[#f8f0ea] via-[#f5e9e1] to-[#efdfd5] border-[#ead9cd]';
276
+ const btnClass = isCool
277
+ ? 'bg-gradient-to-r from-[#f0d182] via-[#dda842] to-[#c48d2b] text-[#17110d] hover:brightness-105'
278
+ : 'bg-[#7e192b] hover:bg-[#621220] text-white';
279
+
280
+ const fadeEdge = isCool
281
+ ? 'bg-gradient-to-r from-[#e9eef3] via-[#e9eef3]/35 to-transparent'
282
+ : 'bg-gradient-to-r from-[#f6ece5] via-[#f6ece5]/35 to-transparent';
283
+
284
+ return `
285
+ <div class="group relative overflow-hidden rounded-2xl border ${cardSurface} shadow-sm hover:shadow-md transition-all duration-300 grid grid-cols-1 sm:grid-cols-12 items-center min-h-[220px] sm:min-h-[240px]">
286
+ <div class="sm:col-span-6 p-6 sm:p-8 flex flex-col justify-center items-start relative z-10">
287
+ <h3 class="text-2xl sm:text-[28px] font-bold font-heading text-[#1c1613] leading-[1.15] mb-2">
288
+ ${formatTwoToneTitle(card.title, card.accentText)}
289
+ </h3>
290
+ ${card.subtitle ? `
291
+ <p class="text-xs sm:text-sm text-[#5c4f46] mb-5 leading-relaxed max-w-[22ch]">
292
+ ${escapeHtml(card.subtitle)}
293
+ </p>
294
+ ` : ''}
295
+ <a
296
+ href="${escapeHtml(card.linkUrl)}"
297
+ class="inline-flex items-center gap-2 px-5 py-2.5 rounded-full ${btnClass} font-semibold text-xs transition-all shadow-sm active:scale-95"
298
+ >
299
+ <span>${escapeHtml(card.buttonText)}</span>
300
+ <span class="transition-transform duration-200 group-hover:translate-x-0.5">&rarr;</span>
301
+ </a>
302
+ </div>
303
+ <div class="sm:col-span-6 h-48 sm:h-full w-full overflow-hidden relative">
304
+ <img
305
+ src="${escapeHtml(card.imageUrl)}"
306
+ alt="${escapeHtml(card.title)}"
307
+ class="w-full h-full object-cover object-center transition-transform duration-700 group-hover:scale-105"
308
+ loading="lazy"
309
+ />
310
+ <div class="hidden sm:block pointer-events-none absolute inset-y-0 left-0 w-16 ${fadeEdge}"></div>
311
+ </div>
312
+ </div>
313
+ `;
314
+ }).join('')}
315
+ </div>
316
+ </div>
317
+ </section>
318
+ `;
319
+ }
@@ -0,0 +1,158 @@
1
+ import type { SectionRenderContext, StorefrontCampaign } from '@caartzee/theme-sdk';
2
+
3
+ function escapeHtml(str: string | null | undefined): string {
4
+ if (!str) return '';
5
+ return String(str)
6
+ .replace(/&/g, '&amp;')
7
+ .replace(/</g, '&lt;')
8
+ .replace(/>/g, '&gt;')
9
+ .replace(/"/g, '&quot;')
10
+ .replace(/'/g, '&#039;');
11
+ }
12
+
13
+ /**
14
+ * Promotional Campaign Banners Section
15
+ *
16
+ * Displays active marketing campaigns with their promotional imagery, offer details,
17
+ * and clear calls-to-action linking directly to their respective /campaign/:slug landing pages.
18
+ *
19
+ * Architectural rule: Operates independently from the homepage Mobile Slider hero.
20
+ */
21
+ export function renderCampaignBanners(ctx: SectionRenderContext): string {
22
+ const pageCtx = ctx.pageContext as any;
23
+ const rawCampaigns: StorefrontCampaign[] =
24
+ (Array.isArray(pageCtx?.campaigns) && pageCtx.campaigns.length > 0)
25
+ ? pageCtx.campaigns
26
+ : (pageCtx?.campaign ? [pageCtx.campaign] : []);
27
+
28
+ return renderCampaignBannersSection(rawCampaigns, ctx);
29
+ }
30
+
31
+ export function renderCampaignBannersSection(
32
+ campaigns: StorefrontCampaign[] | undefined,
33
+ ctx?: Partial<SectionRenderContext>,
34
+ ): string {
35
+ if (!Array.isArray(campaigns) || campaigns.length === 0) {
36
+ return '';
37
+ }
38
+
39
+ // Filter for strictly active and non-expired campaigns
40
+ const now = Date.now();
41
+ const validStatuses = new Set(['active', 'publish', 'published', '1']);
42
+
43
+ const activeCampaigns = campaigns.filter((c) => {
44
+ if (!c) return false;
45
+ const status = String(c.status ?? '').toLowerCase().trim();
46
+ if (!validStatuses.has(status)) return false;
47
+
48
+ if (c.startDate) {
49
+ const start = new Date(c.startDate).getTime();
50
+ if (!isNaN(start) && start > now) return false;
51
+ }
52
+
53
+ if (c.endDate) {
54
+ const end = new Date(c.endDate).getTime();
55
+ if (!isNaN(end) && end < now) return false;
56
+ }
57
+
58
+ return true;
59
+ });
60
+
61
+ if (activeCampaigns.length === 0) {
62
+ return '';
63
+ }
64
+
65
+ const sectionId = ctx?.section?.id || 'sf-campaign-banners-section';
66
+ const isMulti = activeCampaigns.length > 1;
67
+
68
+ return `
69
+ <section
70
+ class="sf-section sf-campaign-banners py-8 sm:py-12 bg-white dark:bg-neutral-950"
71
+ id="${escapeHtml(sectionId)}"
72
+ data-section-type="campaign-banners"
73
+ data-campaign-count="${activeCampaigns.length}"
74
+ >
75
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
76
+ <div class="flex flex-col gap-2 mb-6">
77
+ <span class="text-xs font-bold uppercase tracking-widest text-indigo-600 dark:text-indigo-400">
78
+ Special Promotions
79
+ </span>
80
+ <h2 class="text-2xl sm:text-3xl font-extrabold text-neutral-900 dark:text-white font-heading tracking-tight">
81
+ Featured Campaigns & Exclusive Offers
82
+ </h2>
83
+ </div>
84
+
85
+ <div class="${isMulti ? 'grid grid-cols-1 md:grid-cols-2 gap-6' : 'w-full'}">
86
+ ${activeCampaigns.map((c) => {
87
+ const slug = c.slug || String(c.id);
88
+ const campaignUrl = `/campaign/${encodeURIComponent(slug)}`;
89
+ const imageUrl =
90
+ c.imageUrl ||
91
+ c.image ||
92
+ 'https://images.unsplash.com/photo-1441986300917-64674bd600d8?w=1400&auto=format&fit=crop&q=80';
93
+ const badge = c.badge || (c.freeShipping ? 'Free Shipping' : 'Limited Time Offer');
94
+ const showFreeShippingBadge = c.freeShipping && badge !== 'Free Shipping';
95
+
96
+ return `
97
+ <div
98
+ class="sf-campaign-banner-card group relative overflow-hidden rounded-3xl bg-neutral-900 border border-neutral-200/80 dark:border-neutral-800 shadow-sm hover:shadow-xl transition-all duration-300"
99
+ data-campaign-id="${escapeHtml(String(c.id))}"
100
+ data-campaign-slug="${escapeHtml(slug)}"
101
+ >
102
+ <!-- Campaign Banner Background Image -->
103
+ <div class="absolute inset-0 z-0 overflow-hidden">
104
+ <img
105
+ src="${escapeHtml(imageUrl)}"
106
+ alt="${escapeHtml(c.title)}"
107
+ class="w-full h-full object-cover object-center group-hover:scale-105 transition-transform duration-700 ease-out"
108
+ loading="lazy"
109
+ />
110
+ <!-- High-contrast readability overlay -->
111
+ <div class="absolute inset-0 bg-gradient-to-t from-black/90 via-black/50 to-black/20"></div>
112
+ </div>
113
+
114
+ <!-- Campaign Banner Content -->
115
+ <div class="relative z-10 p-6 sm:p-10 lg:p-12 min-h-[260px] sm:min-h-[320px] flex flex-col justify-end text-left">
116
+ <div class="flex items-center gap-2 mb-3 flex-wrap">
117
+ ${badge ? `
118
+ <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider bg-white/90 text-neutral-950 backdrop-blur-md shadow-sm">
119
+ ${escapeHtml(badge)}
120
+ </span>
121
+ ` : ''}
122
+ ${showFreeShippingBadge ? `
123
+ <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider bg-emerald-500/90 text-white backdrop-blur-md shadow-sm">
124
+ Free Shipping
125
+ </span>
126
+ ` : ''}
127
+ </div>
128
+
129
+ <h3 class="text-2xl sm:text-3xl lg:text-4xl font-extrabold text-white font-heading tracking-tight leading-tight mb-2">
130
+ ${escapeHtml(c.title)}
131
+ </h3>
132
+
133
+ ${c.subtitle ? `
134
+ <p class="text-sm sm:text-base text-neutral-200 line-clamp-2 max-w-xl mb-6">
135
+ ${escapeHtml(c.subtitle)}
136
+ </p>
137
+ ` : '<div class="mb-4"></div>'}
138
+
139
+ <div class="pt-2">
140
+ <a
141
+ href="${escapeHtml(campaignUrl)}"
142
+ class="inline-flex items-center gap-2 px-6 py-3 rounded-full text-xs sm:text-sm font-bold bg-white text-neutral-950 hover:bg-neutral-100 hover:shadow-lg active:scale-95 transition-all duration-200 group-hover:translate-x-1"
143
+ >
144
+ <span>Explore Campaign</span>
145
+ <svg class="w-4 h-4 transition-transform group-hover:translate-x-1" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24">
146
+ <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3" />
147
+ </svg>
148
+ </a>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ `;
153
+ }).join('\n')}
154
+ </div>
155
+ </div>
156
+ </section>
157
+ `;
158
+ }
@@ -0,0 +1,144 @@
1
+ import type { SectionRenderContext, StorefrontCategory } from '@caartzee/theme-sdk';
2
+ import { resolveSelectedCategories } from '@caartzee/theme-sdk';
3
+
4
+ function escapeHtml(str: string): string {
5
+ return str
6
+ .replace(/&/g, '&amp;')
7
+ .replace(/</g, '&lt;')
8
+ .replace(/>/g, '&gt;')
9
+ .replace(/"/g, '&quot;')
10
+ .replace(/'/g, '&#039;');
11
+ }
12
+
13
+ const PASTEL_CARD_PALETTE = [
14
+ 'bg-[#fdecef] border-[#f8d7de]',
15
+ 'bg-[#edf4fc] border-[#d6e6fa]',
16
+ 'bg-[#fdf6e7] border-[#f7e7c4]',
17
+ 'bg-[#fbeffb] border-[#f4daf4]',
18
+ 'bg-[#fbf7e8] border-[#f3e9c8]',
19
+ 'bg-[#f2effc] border-[#e2dcf8]',
20
+ ];
21
+
22
+ export function renderStarterCategorySlider(ctx: SectionRenderContext): string {
23
+ const settings = ctx.section.settings || {};
24
+ const eyebrow = typeof settings.eyebrow === 'string' ? settings.eyebrow : 'SHOP BY CATEGORY';
25
+ const title = typeof settings.title === 'string' ? settings.title : 'Explore Our Collections';
26
+ const viewAllText = typeof settings.viewAllText === 'string' ? settings.viewAllText : '';
27
+ const viewAllUrl = typeof settings.viewAllUrl === 'string' ? settings.viewAllUrl : '/categories';
28
+
29
+ const defaultJoybeeCategories: StorefrontCategory[] = [
30
+ {
31
+ id: '1',
32
+ name: 'Plush & Soft Toys',
33
+ slug: 'plush-soft-toys',
34
+ imageUrl: 'https://images.unsplash.com/photo-1559454403-b8fb88521f11?w=500&auto=format&fit=crop&q=85',
35
+ productCount: 0,
36
+ },
37
+ {
38
+ id: '2',
39
+ name: 'Remote Control Toys',
40
+ slug: 'remote-control-toys',
41
+ imageUrl: 'https://images.unsplash.com/photo-1594787318286-3d835c1d207f?w=500&auto=format&fit=crop&q=85',
42
+ productCount: 0,
43
+ },
44
+ {
45
+ id: '3',
46
+ name: 'Apparel (T-Shirts)',
47
+ slug: 'apparel-t-shirts',
48
+ imageUrl: 'https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?w=500&auto=format&fit=crop&q=85',
49
+ productCount: 0,
50
+ },
51
+ {
52
+ id: '4',
53
+ name: 'Play Sets & Pretend Play',
54
+ slug: 'play-sets-pretend-play',
55
+ imageUrl: 'https://images.unsplash.com/photo-1566576912321-d58ddd7a6088?w=500&auto=format&fit=crop&q=85',
56
+ productCount: 0,
57
+ },
58
+ {
59
+ id: '5',
60
+ name: 'Educational Toys',
61
+ slug: 'educational-toys',
62
+ imageUrl: 'https://images.unsplash.com/photo-1596461404969-9ae70f2830c1?w=500&auto=format&fit=crop&q=85',
63
+ productCount: 0,
64
+ },
65
+ {
66
+ id: '6',
67
+ name: 'Vehicle Toys',
68
+ slug: 'vehicle-toys',
69
+ imageUrl: 'https://images.unsplash.com/photo-1581235720704-06d3acfcb36f?w=500&auto=format&fit=crop&q=85',
70
+ productCount: 0,
71
+ },
72
+ ];
73
+
74
+ const rawCategories = ctx.catalog?.categories && ctx.catalog.categories.length > 0
75
+ ? ctx.catalog.categories
76
+ : defaultJoybeeCategories;
77
+
78
+ const selectedCategories = settings.categoryIds || settings.categories || settings.category_ids || settings.selected_categories || settings.category_list;
79
+ const filteredCategories = resolveSelectedCategories(rawCategories, selectedCategories);
80
+ const categories = filteredCategories.slice(0, Number(settings.limit) || 6);
81
+
82
+ return `
83
+ <section class="sf-section sf-starter-categories py-12 sm:py-14 bg-[#fbf7f2] select-none" id="${escapeHtml(ctx.section.id)}" data-section-id="${escapeHtml(ctx.section.id)}" data-section-type="${escapeHtml(ctx.section.type)}" data-region="body" data-element="category-slider">
84
+ <div class="max-w-[1360px] mx-auto px-4 sm:px-6 lg:px-8">
85
+
86
+ <!-- Centered Editorial Header with Hairline Dividers -->
87
+ <div class="text-center mb-8 sm:mb-10">
88
+ ${eyebrow ? `
89
+ <p class="text-[11px] font-semibold uppercase tracking-[0.24em] text-[#8d7660] mb-2">
90
+ <span class="mx-1.5 text-[#c99335]">&bull;</span>${escapeHtml(eyebrow)}<span class="mx-1.5 text-[#c99335]">&bull;</span>
91
+ </p>
92
+ ` : ''}
93
+ <div class="flex items-center justify-center gap-4 sm:gap-6">
94
+ <span class="hidden sm:block h-px bg-[#e2d5c6] flex-1 max-w-[160px]" aria-hidden="true"></span>
95
+ <h2 class="text-2xl sm:text-4xl font-bold tracking-tight text-[#1c1613] font-heading">
96
+ ${escapeHtml(title)}
97
+ </h2>
98
+ <span class="hidden sm:block h-px bg-[#e2d5c6] flex-1 max-w-[160px]" aria-hidden="true"></span>
99
+ </div>
100
+ ${viewAllText ? `
101
+ <div class="mt-3">
102
+ <a href="${escapeHtml(viewAllUrl)}" class="group/link inline-flex items-center gap-1.5 text-xs font-semibold text-[#7e192b] hover:text-[#1c1613] transition-colors">
103
+ ${escapeHtml(viewAllText)}
104
+ <span class="inline-block transition-transform duration-200 group-hover/link:translate-x-1">&rarr;</span>
105
+ </a>
106
+ </div>
107
+ ` : ''}
108
+ </div>
109
+
110
+ <!-- 6-Column Pastel Category Cards Grid -->
111
+ <div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-4 sm:gap-5 items-stretch" data-element="category-grid">
112
+ ${categories.length > 0 ? categories.map((c, idx) => {
113
+ const catName = c.name || 'Category';
114
+ const catSlug = c.slug || catName.toLowerCase().replace(/\s+/g, '-');
115
+ const catId = c.id !== undefined && c.id !== null ? String(c.id) : '';
116
+ const catImage = c.imageUrl || (c as any).image || 'https://images.unsplash.com/photo-1596461404969-9ae70f2830c1?w=500&auto=format&fit=crop&q=85';
117
+ const paletteClass = PASTEL_CARD_PALETTE[idx % PASTEL_CARD_PALETTE.length];
118
+
119
+ return `
120
+ <a href="/categories/${encodeURIComponent(catSlug)}" class="group flex flex-col items-center justify-between text-center rounded-2xl border ${paletteClass} p-4 sm:p-5 shadow-sm hover:shadow-md hover:-translate-y-1 transition-all duration-300 text-decoration-none" data-element="category-item" data-category-id="${escapeHtml(catId)}" data-category-slug="${escapeHtml(catSlug)}">
121
+ <div class="sf-category-media w-full aspect-[4/3] rounded-xl overflow-hidden flex items-center justify-center mb-3 p-1">
122
+ <img
123
+ src="${escapeHtml(catImage)}"
124
+ alt="${escapeHtml(catName)}"
125
+ class="w-full h-full object-contain object-center mix-blend-multiply transition-transform duration-500 group-hover:scale-105 rounded-lg"
126
+ loading="lazy"
127
+ />
128
+ </div>
129
+ <h3 class="font-bold text-xs sm:text-[13px] text-[#1c1613] leading-snug group-hover:text-[#7e192b] transition-colors">
130
+ ${escapeHtml(catName)}
131
+ </h3>
132
+ </a>
133
+ `;
134
+ }).join('') : `
135
+ <div class="col-span-full py-8 text-center text-sm text-[#73655b] sf-categories-empty-msg">
136
+ No categories selected.
137
+ </div>
138
+ `}
139
+ </div>
140
+
141
+ </div>
142
+ </section>
143
+ `;
144
+ }