@tanqory/partner-cli 0.1.0-alpha.0 → 0.1.0-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanqory/partner-cli",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Build, check and upload Tanqory partner themes: a starter that passes every partner check, the platform's own partner source checks run locally, packaging, upload through the Partner API with your partner sign-in, and an MCP server with the same operations.",
5
5
  "license": "MIT",
6
6
  "author": "Tanqory",
package/starter/README.md CHANGED
@@ -22,12 +22,18 @@ tanqory-partner theme push --org <organization id> --theme <handle>
22
22
  | `src/components/`, `src/styles/` | Your markup and all of the theme's CSS (the kit ships none) |
23
23
  | `src/settings.ts`, `src/templates.ts` | Theme settings (the editor's Theme panel) and the page types |
24
24
  | `templates/*.json`, `regions/*.json`, `config/settings.json` | Starter content a merchant sees first |
25
- | `locales/en.json`, `locales/th.json` | Every visible string |
25
+ | `locales/en.json`, `locales/th.json` | Interface words in English and Thai (buttons, form labels, the cart). Shop words are section settings |
26
+ | `locales/en.schema.json`, `locales/th.schema.json` | The editor's words for your section, block and setting names (`t:` labels) |
26
27
  | `scripts/build.mjs`, `vite.*.config.ts`, `src/entry.*`, `src/bundle.ts` | The build into `dist/abi` (the platform runs this same build in its sandbox) |
27
28
  | `LICENSE` | Your theme's licence. Put your name in it. The licences check needs it. |
28
29
 
29
30
  ## Rules the checks hold you to
30
31
 
32
+ - Editable (`EDITABILITY.md` of `@tanqory/theme-standard`): every word, image and link a shopper sees in a section is
33
+ a setting whose default is the real words, every list is blocks, every addable section has a preset with sample
34
+ settings and blocks, colours are theme settings, labels are `t:` keys with words in `locales/en.schema.json` and
35
+ `locales/th.schema.json`, and images are store files (never a guessed address). The starter's sections show each pattern.
36
+
31
37
  - `package.json` pins `@tanqory/theme-kit` and `@tanqory/theme-abi` exactly to versions the platform's builder
32
38
  carries. Other runtime dependencies are not installed by the builder; bundle what you need into `src/`.
33
39
  - No `pnpm.overrides`, `resolutions`, workspaces, patches, `.npmrc`, `.env` files, shell scripts or native addons.
@@ -1,3 +1,5 @@
1
1
  {
2
- "scheme": "light"
2
+ "colorBackground": "#ffffff",
3
+ "colorText": "#1f2328",
4
+ "colorAccent": "#1f2328"
3
5
  }
@@ -0,0 +1,69 @@
1
+ {
2
+ "descriptions": {
3
+ "a_city_or_what_they_bought": "A city, or what they bought.",
4
+ "a_heading_a_short_line_an": "A heading, a short line, an optional image and one link.",
5
+ "a_heading_and_a_paragraph_set": "A heading and a paragraph, set narrow.",
6
+ "a_heading_and_a_row_of": "A heading and a row of short points, each with an optional image and link. Add, remove and reorder them.",
7
+ "a_message_form_that_reaches_the": "A message form that reaches the store.",
8
+ "a_row_of_products_from_one": "A row of products from one collection.",
9
+ "an_email_sign_up_for_the": "An email sign-up for the store’s newsletter.",
10
+ "products_shoppers_buy_with_this_one": "Products shoppers buy with this one.",
11
+ "the_collections_products_with_sort_filters": "The collection’s products with sort, filters and paging.",
12
+ "the_product_image_title_price_options": "The product: image, title, price, options and add to cart.",
13
+ "the_shop_name_menu_columns_and": "The shop name, menu columns and the legal line.",
14
+ "the_shop_name_the_main_menu": "The shop name, the main menu, search, region and the cart.",
15
+ "what_customers_say_a_heading_and": "What customers say: a heading and quotations. Add, remove and reorder them.",
16
+ "what_the_picture_shows_for_people": "What the picture shows, for people who cannot see it."
17
+ },
18
+ "labels": {
19
+ "account": "Account",
20
+ "article": "Article",
21
+ "background": "Background",
22
+ "blog": "Blog",
23
+ "brand": "Brand",
24
+ "button_label": "Button label",
25
+ "button_link": "Button link",
26
+ "buttons_and_links": "Buttons and links",
27
+ "cart": "Cart",
28
+ "collection": "Collection",
29
+ "colours": "Colours",
30
+ "columns": "Columns",
31
+ "contact_form": "Contact form",
32
+ "detail": "Detail",
33
+ "feature": "Feature",
34
+ "features": "Features",
35
+ "footer": "Footer",
36
+ "four": "Four",
37
+ "header": "Header",
38
+ "heading": "Heading",
39
+ "hero": "Hero",
40
+ "image": "Image",
41
+ "image_description": "Image description",
42
+ "kicker": "Kicker",
43
+ "link": "Link",
44
+ "link_label": "Link label",
45
+ "menu": "Menu",
46
+ "menu_column": "Menu column",
47
+ "name": "Name",
48
+ "newsletter": "Newsletter",
49
+ "not_found": "Not found",
50
+ "page": "Page",
51
+ "product": "Product",
52
+ "product_grid": "Product grid",
53
+ "products_to_show": "Products to show",
54
+ "quotation": "Quotation",
55
+ "recommendations": "Recommendations",
56
+ "rich_text": "Rich text",
57
+ "search_results": "Search results",
58
+ "show_country_and_language": "Show country and language",
59
+ "show_the_brand": "Show the brand",
60
+ "show_the_description": "Show the description",
61
+ "tagline": "Tagline",
62
+ "testimonial": "Testimonial",
63
+ "testimonials": "Testimonials",
64
+ "text": "Text",
65
+ "text_above_the_form": "Text above the form",
66
+ "three": "Three",
67
+ "two": "Two"
68
+ }
69
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "descriptions": {
3
+ "a_city_or_what_they_bought": "เมือง หรือสิ่งที่ลูกค้าซื้อ",
4
+ "a_heading_a_short_line_an": "หัวข้อ ข้อความสั้น รูป (ไม่บังคับ) และลิงก์หนึ่งลิงก์",
5
+ "a_heading_and_a_paragraph_set": "หัวข้อและย่อหน้า จัดในคอลัมน์แคบ",
6
+ "a_heading_and_a_row_of": "หัวข้อและแถวของจุดเด่นสั้น ๆ แต่ละจุดมีรูปและลิงก์ได้ เพิ่ม ลบ และเรียงลำดับได้",
7
+ "a_message_form_that_reaches_the": "ฟอร์มส่งข้อความถึงร้าน",
8
+ "a_row_of_products_from_one": "แถวสินค้าจากคอลเลกชันเดียว",
9
+ "an_email_sign_up_for_the": "ช่องสมัครรับจดหมายข่าวของร้านทางอีเมล",
10
+ "products_shoppers_buy_with_this_one": "สินค้าที่ลูกค้ามักซื้อคู่กับชิ้นนี้",
11
+ "the_collections_products_with_sort_filters": "สินค้าในคอลเลกชัน พร้อมการเรียง ตัวกรอง และการแบ่งหน้า",
12
+ "the_product_image_title_price_options": "สินค้า: รูป ชื่อ ราคา ตัวเลือก และปุ่มหยิบใส่ตะกร้า",
13
+ "the_shop_name_menu_columns_and": "ชื่อร้าน คอลัมน์เมนู และข้อความทางกฎหมาย",
14
+ "the_shop_name_the_main_menu": "ชื่อร้าน เมนูหลัก ช่องค้นหา ภูมิภาค และตะกร้า",
15
+ "what_customers_say_a_heading_and": "ลูกค้าพูดถึงเรา: หัวข้อและคำรีวิว เพิ่ม ลบ และเรียงลำดับได้",
16
+ "what_the_picture_shows_for_people": "รูปนี้แสดงอะไร สำหรับผู้ที่มองไม่เห็นรูป"
17
+ },
18
+ "labels": {
19
+ "account": "บัญชี",
20
+ "article": "บทความ",
21
+ "background": "พื้นหลัง",
22
+ "blog": "บล็อก",
23
+ "brand": "แบรนด์",
24
+ "button_label": "ข้อความบนปุ่ม",
25
+ "button_link": "ลิงก์ของปุ่ม",
26
+ "buttons_and_links": "ปุ่มและลิงก์",
27
+ "cart": "ตะกร้า",
28
+ "collection": "คอลเลกชัน",
29
+ "colours": "สี",
30
+ "columns": "จำนวนคอลัมน์",
31
+ "contact_form": "ฟอร์มติดต่อ",
32
+ "detail": "รายละเอียด",
33
+ "feature": "จุดเด่น",
34
+ "features": "จุดเด่น",
35
+ "footer": "ส่วนท้าย",
36
+ "four": "สี่",
37
+ "header": "ส่วนหัว",
38
+ "heading": "หัวข้อ",
39
+ "hero": "แบนเนอร์หลัก",
40
+ "image": "รูปภาพ",
41
+ "image_description": "คำอธิบายรูป",
42
+ "kicker": "ข้อความนำ",
43
+ "link": "ลิงก์",
44
+ "link_label": "ข้อความลิงก์",
45
+ "menu": "เมนู",
46
+ "menu_column": "คอลัมน์เมนู",
47
+ "name": "ชื่อ",
48
+ "newsletter": "จดหมายข่าว",
49
+ "not_found": "ไม่พบหน้า",
50
+ "page": "หน้า",
51
+ "product": "สินค้า",
52
+ "product_grid": "ตารางสินค้า",
53
+ "products_to_show": "จำนวนสินค้าที่แสดง",
54
+ "quotation": "คำพูด",
55
+ "recommendations": "สินค้าแนะนำ",
56
+ "rich_text": "ข้อความจัดรูปแบบ",
57
+ "search_results": "ผลการค้นหา",
58
+ "show_country_and_language": "แสดงประเทศและภาษา",
59
+ "show_the_brand": "แสดงแบรนด์",
60
+ "show_the_description": "แสดงคำอธิบาย",
61
+ "tagline": "สโลแกน",
62
+ "testimonial": "คำรีวิว",
63
+ "testimonials": "คำรีวิว",
64
+ "text": "ข้อความ",
65
+ "text_above_the_form": "ข้อความเหนือฟอร์ม",
66
+ "three": "สาม",
67
+ "two": "สอง"
68
+ }
69
+ }
@@ -103,13 +103,29 @@ for (const [k, v] of Object.entries(values)) {
103
103
  if (!r.ok) problems.push(`config/settings.json.${k}: ${r.errors.map((e) => e.message).join('; ')}`)
104
104
  }
105
105
  }
106
+ // The editor's words for the theme's own section, block and setting names: labels written `t:<key>` are read from
107
+ // locales/<lang>.schema.json (the reference's schema translations), carried in the manifest's vendor key so the editor
108
+ // shows them in its language (packages/theme-standard EDITABILITY.md E9). The runtime never reads them.
109
+ {
110
+ const schemaLocales = {}
111
+ const flat = (o, p, out) => {
112
+ for (const [k, v] of Object.entries(o ?? {})) {
113
+ const key = p ? `${p}.${k}` : k
114
+ if (v && typeof v === 'object' && !Array.isArray(v)) flat(v, key, out)
115
+ else if (typeof v === 'string') out[key] = v
116
+ }
117
+ return out
118
+ }
119
+ for (const f of readdirSync(join(theme, 'locales')).filter((n) => n.endsWith('.schema.json'))) schemaLocales[f.replace(/\.schema\.json$/, '')] = flat(readJson(join(theme, 'locales', f)), '', {})
120
+ if (Object.keys(schemaLocales).length) manifest['x-tanqory-schema-locales'] = schemaLocales
121
+ }
106
122
  const valid = validateManifest(manifest)
107
123
  if (!valid.ok) for (const e of valid.errors) problems.push(`manifest${e.path}: ${e.message} (${e.code ?? e.keyword})`)
108
124
  if (problems.length) fail(`${problems.length} contract problem(s)`, problems)
109
125
 
110
126
  // 3. strings: the theme's over the kit's, for the bundle and for the artifact
111
127
  const locales = {}
112
- for (const f of readdirSync(join(theme, 'locales')).filter((n) => n.endsWith('.json'))) locales[f.replace(/\.json$/, '')] = readJson(join(theme, 'locales', f))
128
+ for (const f of readdirSync(join(theme, 'locales')).filter((n) => n.endsWith('.json') && !n.endsWith('.schema.json'))) locales[f.replace(/\.json$/, '')] = readJson(join(theme, 'locales', f))
113
129
  const merged = withKitStrings(locales)
114
130
  const gen = join(theme, 'src', 'generated')
115
131
  rmSync(gen, { recursive: true, force: true })
@@ -53,15 +53,15 @@ function Masthead({ settings }: { settings: { menu: string; tagline: string } })
53
53
 
54
54
  export const header = defineSection({
55
55
  type: 'header',
56
- title: 'Header',
57
- description: 'The shop name, the main menu, search, region and the cart.',
56
+ title: 't:labels.header',
57
+ description: 't:descriptions.the_shop_name_the_main_menu',
58
58
  category: 'chrome',
59
59
  zone: 'header',
60
60
  settings: {
61
- menu: field.resource('menu', 'main-menu', { label: 'Menu' }),
62
- tagline: field.text('', { label: 'Tagline' }),
61
+ menu: field.resource('menu', 'main-menu', { label: 't:labels.menu' }),
62
+ tagline: field.text('', { label: 't:labels.tagline' }),
63
63
  // The data plan's convention: the masthead shows the market selector.
64
- showLocale: field.boolean(true, { label: 'Show country and language' }),
64
+ showLocale: field.boolean(true, { label: 't:labels.show_country_and_language' }),
65
65
  },
66
66
  ai: ai.headerMenu('menu'),
67
67
  component: Masthead,
@@ -69,13 +69,13 @@ export const header = defineSection({
69
69
 
70
70
  const footerMenu = defineBlock({
71
71
  type: 'footer-menu',
72
- title: 'Menu column',
73
- settings: { heading: field.text('', { label: 'Heading' }), menu: field.resource('menu', 'footer', { label: 'Menu' }) },
72
+ title: 't:labels.menu_column',
73
+ settings: { heading: field.text('Explore', { label: 't:labels.heading' }), menu: field.resource('menu', 'footer', { label: 't:labels.menu' }) },
74
74
  })
75
75
  const footerBrand = defineBlock({
76
76
  type: 'footer-brand',
77
- title: 'Brand',
78
- settings: { tagline: field.textarea('', { label: 'Tagline' }) },
77
+ title: 't:labels.brand',
78
+ settings: { tagline: field.textarea('Thank you for shopping with us.', { label: 't:labels.tagline' }) },
79
79
  })
80
80
 
81
81
  function MenuColumn({ block }: { block: BlockInstance }): JSX.Element | null {
@@ -121,8 +121,8 @@ function Colophon({ blocks }: { blocks: BlockInstance[] }): JSX.Element {
121
121
 
122
122
  export const footer = defineSection({
123
123
  type: 'footer',
124
- title: 'Footer',
125
- description: 'The shop name, menu columns and the legal line.',
124
+ title: 't:labels.footer',
125
+ description: 't:descriptions.the_shop_name_menu_columns_and',
126
126
  category: 'chrome',
127
127
  zone: 'footer',
128
128
  settings: {},
@@ -71,23 +71,23 @@ function ProductDetail({ settings }: { settings: { showVendor: boolean } }): JSX
71
71
 
72
72
  export const product = defineSection({
73
73
  type: 'product',
74
- title: 'Product',
75
- description: 'The product: image, title, price, options and add to cart.',
74
+ title: 't:labels.product',
75
+ description: 't:descriptions.the_product_image_title_price_options',
76
76
  category: 'products',
77
77
  requires: ['product'],
78
- settings: { showVendor: field.boolean(true, { label: 'Show the brand' }) },
78
+ settings: { showVendor: field.boolean(true, { label: 't:labels.show_the_brand' }) },
79
79
  component: ProductDetail,
80
80
  })
81
81
 
82
82
  export const recommendations = defineSection({
83
83
  // The data plan's convention: this type loads the product's recommendations in the server render.
84
84
  type: 'product-recommendations',
85
- title: 'Recommendations',
86
- description: 'Products shoppers buy with this one.',
85
+ title: 't:labels.recommendations',
86
+ description: 't:descriptions.products_shoppers_buy_with_this_one',
87
87
  category: 'products',
88
88
  requires: ['product'],
89
- settings: { heading: field.text('You may also like', { label: 'Heading' }) },
90
- presets: [{ name: 'Recommendations' }],
89
+ settings: { heading: field.text('You may also like', { label: 't:labels.heading' }) },
90
+ presets: [{ name: 't:labels.recommendations' }],
91
91
  component: function Recommended({ settings }) {
92
92
  const { products } = useRecommendations()
93
93
  if (!products.length) return <section className="st-shelf st-shelf--empty" aria-hidden="true" />
@@ -104,11 +104,11 @@ export const recommendations = defineSection({
104
104
 
105
105
  export const collection = defineSection({
106
106
  type: 'collection',
107
- title: 'Collection',
108
- description: 'The collection’s products with sort, filters and paging.',
107
+ title: 't:labels.collection',
108
+ description: 't:descriptions.the_collections_products_with_sort_filters',
109
109
  category: 'products',
110
110
  requires: ['collection'],
111
- settings: { showDescription: field.boolean(true, { label: 'Show the description' }) },
111
+ settings: { showDescription: field.boolean(true, { label: 't:labels.show_the_description' }) },
112
112
  component: function CollectionPage({ settings }) {
113
113
  const t = useTranslate()
114
114
  return (
@@ -141,7 +141,7 @@ export const collection = defineSection({
141
141
 
142
142
  export const search = defineSection({
143
143
  type: 'search',
144
- title: 'Search results',
144
+ title: 't:labels.search_results',
145
145
  category: 'products',
146
146
  requires: ['search'],
147
147
  settings: {},
@@ -161,7 +161,7 @@ export const search = defineSection({
161
161
 
162
162
  export const cart = defineSection({
163
163
  type: 'cart',
164
- title: 'Cart',
164
+ title: 't:labels.cart',
165
165
  category: 'cart',
166
166
  requires: ['cart'],
167
167
  settings: {},
@@ -226,7 +226,7 @@ export const cart = defineSection({
226
226
 
227
227
  export const account = defineSection({
228
228
  type: 'account',
229
- title: 'Account',
229
+ title: 't:labels.account',
230
230
  category: 'account',
231
231
  requires: ['customer'],
232
232
  settings: {},
@@ -3,7 +3,7 @@ import { ContactForm, defineSection, field, useArticle, useBlog, usePageContent,
3
3
 
4
4
  export const page = defineSection({
5
5
  type: 'page',
6
- title: 'Page',
6
+ title: 't:labels.page',
7
7
  category: 'content',
8
8
  requires: ['page'],
9
9
  settings: {},
@@ -21,14 +21,18 @@ export const page = defineSection({
21
21
 
22
22
  export const contact = defineSection({
23
23
  type: 'contact-form',
24
- title: 'Contact form',
25
- description: 'A message form that reaches the store.',
24
+ title: 't:labels.contact_form',
25
+ description: 't:descriptions.a_message_form_that_reaches_the',
26
26
  category: 'forms',
27
- settings: { heading: field.text('Contact us', { label: 'Heading' }) },
28
- presets: [{ name: 'Contact form' }],
27
+ settings: {
28
+ heading: field.text('Contact us', { label: 't:labels.heading' }),
29
+ intro: field.textarea('Write to us and we will answer within one working day.', { label: 't:labels.text_above_the_form' }),
30
+ },
31
+ presets: [{ name: 't:labels.contact_form', settings: { heading: 'Contact us', intro: 'Write to us and we will answer within one working day.' } }],
29
32
  component: ({ settings }) => (
30
33
  <section className="st-contact">
31
- <h2 className="st-contact__title">{settings.heading}</h2>
34
+ {settings.heading ? <h2 className="st-contact__title">{settings.heading}</h2> : null}
35
+ {settings.intro ? <p className="st-muted">{settings.intro}</p> : null}
32
36
  <ContactForm className="st-form" inputClassName="st-input" labelClassName="st-label" buttonClassName="st-btn st-btn--solid" messageClassName="st-form__msg" />
33
37
  </section>
34
38
  ),
@@ -36,7 +40,7 @@ export const contact = defineSection({
36
40
 
37
41
  export const blog = defineSection({
38
42
  type: 'blog',
39
- title: 'Blog',
43
+ title: 't:labels.blog',
40
44
  category: 'content',
41
45
  requires: ['blog'],
42
46
  settings: {},
@@ -65,7 +69,7 @@ export const blog = defineSection({
65
69
 
66
70
  export const article = defineSection({
67
71
  type: 'article',
68
- title: 'Article',
72
+ title: 't:labels.article',
69
73
  category: 'content',
70
74
  requires: ['article'],
71
75
  settings: {},
@@ -92,7 +96,7 @@ export const article = defineSection({
92
96
  export const notFound = defineSection({
93
97
  // The runtime renders this type as the body of every 404 page (an unknown product, collection, page, blog).
94
98
  type: 'not-found',
95
- title: 'Not found',
99
+ title: 't:labels.not_found',
96
100
  category: 'content',
97
101
  settings: {},
98
102
  component: function Lost() {
@@ -1,25 +1,33 @@
1
- /** Home page sections: hero, product grid, rich text, newsletter. */
2
- import { Image, NewsletterForm, ai, defineSection, field, useCollection, useTranslate } from '@tanqory/theme-kit/headless'
1
+ /**
2
+ * Home page sections: hero, product grid, features, testimonials, rich text, newsletter.
3
+ *
4
+ * Editability (packages/theme-standard/EDITABILITY.md): every word, image and link a shopper sees here is a setting or
5
+ * a block, with real sample words as its default, so the merchant changes all of it in the theme editor. A list (the
6
+ * features, the testimonials) is blocks the merchant adds, removes and reorders. Every section has a preset, so it can
7
+ * be added from "Add section". Interface words (View all) go through t() and the locale files.
8
+ */
9
+ import { Image, NewsletterForm, ai, defineBlock, defineSection, field, useCollection, useTranslate, type BlockInstance } from '@tanqory/theme-kit/headless'
3
10
  import { Grid, cx } from '../components/parts'
4
11
 
5
12
  export const hero = defineSection({
6
13
  type: 'hero',
7
- title: 'Hero',
8
- description: 'A heading, a short line, an optional image and one link.',
14
+ title: 't:labels.hero',
15
+ description: 't:descriptions.a_heading_a_short_line_an',
9
16
  category: 'editorial',
10
17
  settings: {
11
- kicker: field.text('Welcome', { label: 'Kicker' }),
12
- heading: field.text('Our shop', { label: 'Heading' }),
13
- body: field.richtext('', { label: 'Text' }),
14
- image: field.resource('image', '', { label: 'Image' }),
15
- buttonLabel: field.text('Shop all', { label: 'Button label' }),
16
- buttonLink: field.url('/collections/all', { label: 'Button link' }),
18
+ kicker: field.text('New season', { label: 't:labels.kicker' }),
19
+ heading: field.text('Made to be used every day', { label: 't:labels.heading' }),
20
+ body: field.richtext('<p>Simple things, made well and made to last.</p>', { label: 't:labels.text' }),
21
+ image: field.resource('image', '', { label: 't:labels.image' }),
22
+ imageAlt: field.text('', { label: 't:labels.image_description', info: 't:descriptions.what_the_picture_shows_for_people' }),
23
+ buttonLabel: field.text('Shop all', { label: 't:labels.button_label' }),
24
+ buttonLink: field.url('/collections/all', { label: 't:labels.button_link' }),
17
25
  },
18
- presets: [{ name: 'Hero', settings: { kicker: 'Welcome', heading: 'Our shop' } }],
26
+ presets: [{ name: 't:labels.hero', settings: { kicker: 'New season', heading: 'Made to be used every day', buttonLabel: 'Shop all', buttonLink: '/collections/all' } }],
19
27
  ai: ai.hero({ heading: 'heading', subheading: 'kicker', image: 'image', button: 'buttonLabel', link: 'buttonLink' }),
20
28
  component: ({ settings }) => (
21
29
  <section className={cx('st-hero', settings.image && 'st-hero--image')}>
22
- {settings.image ? <Image image={settings.image} alt="" className="st-hero__img" loading="eager" /> : null}
30
+ {settings.image ? <Image image={settings.image} alt={settings.imageAlt} className="st-hero__img" loading="eager" /> : null}
23
31
  <div className="st-hero__copy">
24
32
  {settings.kicker ? <p className="st-hero__kicker">{settings.kicker}</p> : null}
25
33
  <h1 className="st-hero__title">{settings.heading}</h1>
@@ -55,29 +63,146 @@ function Shelf({ settings }: { settings: { heading: string; collection: string;
55
63
 
56
64
  export const featuredCollection = defineSection({
57
65
  type: 'featured-collection',
58
- title: 'Product grid',
59
- description: 'A row of products from one collection.',
66
+ title: 't:labels.product_grid',
67
+ description: 't:descriptions.a_row_of_products_from_one',
60
68
  category: 'products',
61
69
  settings: {
62
- heading: field.text('Products', { label: 'Heading' }),
63
- collection: field.resource('collection', 'all', { label: 'Collection' }),
64
- count: field.range(8, 4, 16, 4, { label: 'Products to show' }),
70
+ heading: field.text('Featured products', { label: 't:labels.heading' }),
71
+ collection: field.resource('collection', 'all', { label: 't:labels.collection' }),
72
+ count: field.range(8, 4, 16, 4, { label: 't:labels.products_to_show' }),
65
73
  },
66
- presets: [{ name: 'Product grid', settings: { heading: 'Products', collection: 'all' } }],
74
+ presets: [{ name: 't:labels.product_grid', settings: { heading: 'Featured products', collection: 'all' } }],
67
75
  ai: ai.productGrid('collection', { heading: 'heading' }),
68
76
  component: Shelf,
69
77
  })
70
78
 
79
+ // ── a list: each feature is a block ─────────────────────────────────────────────────────────────────────────────────
80
+ const feature = defineBlock({
81
+ type: 'feature',
82
+ title: 't:labels.feature',
83
+ settings: {
84
+ image: field.resource('image', '', { label: 't:labels.image' }),
85
+ imageAlt: field.text('', { label: 't:labels.image_description' }),
86
+ heading: field.text('Free delivery', { label: 't:labels.heading' }),
87
+ text: field.textarea('On every order over 1,000 baht.', { label: 't:labels.text' }),
88
+ linkLabel: field.text('', { label: 't:labels.link_label' }),
89
+ link: field.url('', { label: 't:labels.link' }),
90
+ },
91
+ })
92
+
93
+ function Feature({ block }: { block: BlockInstance }): JSX.Element {
94
+ const s = block.settings as { image?: string; imageAlt?: string; heading?: string; text?: string; linkLabel?: string; link?: string }
95
+ return (
96
+ <li className="st-features__item">
97
+ {s.image ? <Image image={s.image} alt={s.imageAlt ?? ''} className="st-features__img" /> : null}
98
+ {s.heading ? <h3 className="st-features__name">{s.heading}</h3> : null}
99
+ {s.text ? <p className="st-features__text">{s.text}</p> : null}
100
+ {s.linkLabel && s.link ? (
101
+ <a className="st-features__link" href={s.link}>
102
+ {s.linkLabel}
103
+ </a>
104
+ ) : null}
105
+ </li>
106
+ )
107
+ }
108
+
109
+ export const features = defineSection({
110
+ type: 'features',
111
+ title: 't:labels.features',
112
+ description: 't:descriptions.a_heading_and_a_row_of',
113
+ category: 'editorial',
114
+ settings: {
115
+ heading: field.text('Why shop with us', { label: 't:labels.heading' }),
116
+ columns: field.select(['2', '3', '4'], '3', { label: 't:labels.columns', optionLabels: { '2': 't:labels.two', '3': 't:labels.three', '4': 't:labels.four' } }),
117
+ },
118
+ blocks: [feature],
119
+ presets: [
120
+ {
121
+ name: 't:labels.features',
122
+ settings: { heading: 'Why shop with us' },
123
+ blocks: [
124
+ { type: 'feature', settings: { heading: 'Free delivery', text: 'On every order over 1,000 baht.' } },
125
+ { type: 'feature', settings: { heading: 'Easy returns', text: 'Send it back within 30 days, no questions asked.' } },
126
+ { type: 'feature', settings: { heading: 'Made to last', text: 'Good materials, checked by hand before they ship.' } },
127
+ ],
128
+ },
129
+ ],
130
+ component: ({ settings, blocks }) => (
131
+ <section className="st-features">
132
+ {settings.heading ? <h2 className="st-features__title">{settings.heading}</h2> : null}
133
+ <ul className={cx('st-features__list', `st-features__list--${settings.columns}`)}>
134
+ {blocks.map((b, i) => (
135
+ <Feature key={i} block={b} />
136
+ ))}
137
+ </ul>
138
+ </section>
139
+ ),
140
+ })
141
+
142
+ // ── testimonials: each quote is a block ─────────────────────────────────────────────────────────────────────────────
143
+ const quote = defineBlock({
144
+ type: 'testimonial',
145
+ title: 't:labels.testimonial',
146
+ settings: {
147
+ quote: field.textarea('The best thing I bought this year.', { label: 't:labels.quotation' }),
148
+ name: field.text('Somchai P.', { label: 't:labels.name' }),
149
+ detail: field.text('Bangkok', { label: 't:labels.detail', info: 't:descriptions.a_city_or_what_they_bought' }),
150
+ },
151
+ })
152
+
153
+ export const testimonials = defineSection({
154
+ type: 'testimonials',
155
+ title: 't:labels.testimonials',
156
+ description: 't:descriptions.what_customers_say_a_heading_and',
157
+ category: 'editorial',
158
+ settings: {
159
+ heading: field.text('What customers say', { label: 't:labels.heading' }),
160
+ },
161
+ blocks: [quote],
162
+ presets: [
163
+ {
164
+ name: 't:labels.testimonials',
165
+ settings: { heading: 'What customers say' },
166
+ blocks: [
167
+ { type: 'testimonial', settings: { quote: 'The best thing I bought this year.', name: 'Somchai P.', detail: 'Bangkok' } },
168
+ { type: 'testimonial', settings: { quote: 'Arrived in two days, packed with care.', name: 'Anna K.', detail: 'Chiang Mai' } },
169
+ { type: 'testimonial', settings: { quote: 'I ordered a second one for my sister.', name: 'Nok S.', detail: 'Phuket' } },
170
+ ],
171
+ },
172
+ ],
173
+ component: ({ settings, blocks }) => (
174
+ <section className="st-quotes">
175
+ {settings.heading ? <h2 className="st-quotes__title">{settings.heading}</h2> : null}
176
+ <ul className="st-quotes__list">
177
+ {blocks.map((b, i) => {
178
+ const s = b.settings as { quote?: string; name?: string; detail?: string }
179
+ return (
180
+ <li key={i} className="st-quotes__item">
181
+ <figure className="st-quotes__figure">
182
+ <blockquote className="st-quotes__text">{s.quote}</blockquote>
183
+ <figcaption className="st-quotes__who">
184
+ {s.name}
185
+ {s.detail ? <span className="st-muted"> · {s.detail}</span> : null}
186
+ </figcaption>
187
+ </figure>
188
+ </li>
189
+ )
190
+ })}
191
+ </ul>
192
+ </section>
193
+ ),
194
+ })
195
+
71
196
  export const note = defineSection({
72
197
  type: 'rich-text',
73
- title: 'Rich text',
74
- description: 'A heading and a paragraph, set narrow.',
198
+ title: 't:labels.rich_text',
199
+ description: 't:descriptions.a_heading_and_a_paragraph_set',
75
200
  category: 'editorial',
76
201
  settings: {
77
- heading: field.text('About us', { label: 'Heading' }),
78
- body: field.richtext('<p>Tell shoppers who you are and what you make.</p>', { label: 'Text' }),
202
+ heading: field.text('About us', { label: 't:labels.heading' }),
203
+ body: field.richtext('<p>Tell shoppers who you are and what you make.</p>', { label: 't:labels.text' }),
79
204
  },
80
- presets: [{ name: 'Rich text' }],
205
+ presets: [{ name: 't:labels.rich_text', settings: { heading: 'About us', body: '<p>Tell shoppers who you are and what you make.</p>' } }],
81
206
  ai: ai.richText({ heading: 'heading', body: 'body' }),
82
207
  component: ({ settings }) => (
83
208
  <section className="st-note">
@@ -89,17 +214,17 @@ export const note = defineSection({
89
214
 
90
215
  export const letters = defineSection({
91
216
  type: 'newsletter',
92
- title: 'Newsletter',
93
- description: 'An email sign-up for the store’s newsletter.',
217
+ title: 't:labels.newsletter',
218
+ description: 't:descriptions.an_email_sign_up_for_the',
94
219
  category: 'forms',
95
220
  settings: {
96
- heading: field.text('Stay in touch', { label: 'Heading' }),
97
- body: field.textarea('News and offers, now and then.', { label: 'Text' }),
221
+ heading: field.text('Stay in touch', { label: 't:labels.heading' }),
222
+ body: field.textarea('News and offers, now and then.', { label: 't:labels.text' }),
98
223
  },
99
- presets: [{ name: 'Newsletter' }],
224
+ presets: [{ name: 't:labels.newsletter', settings: { heading: 'Stay in touch', body: 'News and offers, now and then.' } }],
100
225
  component: ({ settings }) => (
101
226
  <section className="st-letters">
102
- <h2 className="st-letters__title">{settings.heading}</h2>
227
+ {settings.heading ? <h2 className="st-letters__title">{settings.heading}</h2> : null}
103
228
  {settings.body ? <p className="st-letters__body">{settings.body}</p> : null}
104
229
  <NewsletterForm className="st-letters__form" inputClassName="st-input" buttonClassName="st-btn st-btn--solid" messageClassName="st-letters__msg" />
105
230
  </section>