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

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanqory/partner-cli",
3
- "version": "0.1.0-alpha.3",
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.",
3
+ "version": "0.1.0-alpha.6",
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, an app's theme app embeds and app blocks declared in tanqory.extensions.json and pushed through the Partner API, and an MCP server with the same operations.",
5
5
  "license": "MIT",
6
6
  "author": "Tanqory",
7
7
  "keywords": [
@@ -38,16 +38,13 @@
38
38
  "node": ">=20.11.0"
39
39
  },
40
40
  "dependencies": {
41
- "@tanqory/theme-abi": "2.0.0-alpha.14",
42
41
  "acorn": "^8.15.0",
42
+ "ajv": "^8.17.1",
43
43
  "acorn-walk": "^8.3.4",
44
44
  "tar": "^7.5.2",
45
45
  "yaml": "^2.9.1",
46
46
  "zod": "^3.25.76"
47
47
  },
48
- "devDependencies": {
49
- "esbuild": "0.28.2"
50
- },
51
48
  "scripts": {
52
49
  "prepare:vendor": "node scripts/prepare.mjs",
53
50
  "check:vendor": "node scripts/prepare.mjs --check",
@@ -14,12 +14,12 @@
14
14
  "typecheck": "tsc --noEmit"
15
15
  },
16
16
  "dependencies": {
17
- "@tanqory/theme-kit": "2.0.0-alpha.17",
17
+ "@tanqory/theme-kit": "2.0.0-alpha.19",
18
18
  "react": "18.3.1",
19
19
  "react-dom": "18.3.1"
20
20
  },
21
21
  "devDependencies": {
22
- "@tanqory/theme-abi": "2.0.0-alpha.14",
22
+ "@tanqory/theme-abi": "2.0.0-alpha.15",
23
23
  "@types/react": "^18.3.12",
24
24
  "@types/react-dom": "^18.3.1",
25
25
  "@vitejs/plugin-react": "^4.3.4",
@@ -30,7 +30,7 @@ const vite = join(dirname(vitePkg), JSON.parse(readFileSync(vitePkg, 'utf8')).bi
30
30
  const load = (spec) => import(pathToFileURL(require.resolve(spec)).href)
31
31
 
32
32
  const { buildManifest, checkContent, withKitStrings, canonicalize } = await load('@tanqory/theme-kit/build')
33
- const { validateManifest, validateFieldValue, PLATFORM_ROUTES } = await load('@tanqory/theme-abi')
33
+ const { validateManifest, validateFieldValue, PLATFORM_ROUTES, appBlockPlaces } = await load('@tanqory/theme-abi')
34
34
  const { LIMITS } = await load('@tanqory/theme-abi/limits')
35
35
 
36
36
  const fail = (msg, list = []) => {
@@ -52,13 +52,17 @@ if (PLATFORM_ROUTES.data !== '/_tq/data/' || PLATFORM_ROUTES.actions !== '/_tq/a
52
52
  const ASSET = /^asset:client\/assets\/([A-Za-z0-9._-]+)$/
53
53
  const assetDir = join(theme, 'assets')
54
54
  const shipped = new Set(existsSync(assetDir) ? readdirSync(assetDir) : [])
55
+ // The field-type registry values are checked against: "4" while the manifest is built (registries only add, B.3/B.4;
56
+ // a model setting exists only there), then the one the manifest declares for the templates and regions below (lane TS,
57
+ // MCP item 3: a model value in a template was checked against registry 1 and refused).
58
+ let fieldRegistry = '4'
55
59
  const checkValue = (type, value, spec) => {
56
60
  if (type === 'text_alignment' && (value === 'start' || value === 'end')) return { ok: true }
57
61
  if ((type === 'image' || type === 'video') && typeof value === 'string' && value.startsWith('asset:')) {
58
62
  const m = ASSET.exec(value)
59
63
  return m && shipped.has(m[1]) ? { ok: true } : { ok: false, errors: [{ message: `${value} is not a file under assets/`, code: 'asset_ref_missing' }] }
60
64
  }
61
- return validateFieldValue(type, value, spec)
65
+ return validateFieldValue(type, value, spec, { registry: fieldRegistry })
62
66
  }
63
67
 
64
68
  // 1. the theme's declarations, loaded in Node
@@ -77,6 +81,7 @@ const { manifest, problems } = buildManifest({
77
81
  capabilities: { server: ['data:inventory'], browser: ['data:inventory'] },
78
82
  checkValue,
79
83
  })
84
+ fieldRegistry = manifest.engines?.['tanqory-field-types'] ?? '2'
80
85
  const templates = {}
81
86
  for (const f of readdirSync(join(theme, 'templates')).filter((n) => n.endsWith('.json')).sort()) {
82
87
  const name = f.replace(/\.json$/, '')
@@ -119,6 +124,12 @@ for (const [k, v] of Object.entries(values)) {
119
124
  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
125
  if (Object.keys(schemaLocales).length) manifest['x-tanqory-schema-locales'] = schemaLocales
121
126
  }
127
+ // theme-abi §7.2 AppBlocks-1: the product page and a section for any page show the store's installed apps (conformance
128
+ // suite 2 checks the same; an older theme-abi without appBlockPlaces leaves it to conformance)
129
+ if (typeof appBlockPlaces === 'function') {
130
+ const places = appBlockPlaces(manifest, templates[manifest.routes?.product], regions)
131
+ for (const p of places.problems) problems.push(`app blocks: ${p}`)
132
+ }
122
133
  const valid = validateManifest(manifest)
123
134
  if (!valid.ok) for (const e of valid.errors) problems.push(`manifest${e.path}: ${e.message} (${e.code ?? e.keyword})`)
124
135
  if (problems.length) fail(`${problems.length} contract problem(s)`, problems)
@@ -1,7 +1,9 @@
1
1
  /** Starter's commerce sections: product, recommendations, collection, search, cart and the account page. */
2
2
  import {
3
+ APP_BLOCKS,
3
4
  AccountSlot,
4
5
  AddToCart,
6
+ AppBlock,
5
7
  CartLine,
6
8
  CartLineDecrement,
7
9
  CartLineIncrement,
@@ -21,10 +23,12 @@ import {
21
23
  defineSection,
22
24
  field,
23
25
  formatMoney,
26
+ isAppBlock,
24
27
  useCart,
25
28
  useRecommendations,
26
29
  useSearch,
27
30
  useTranslate,
31
+ type BlockInstance,
28
32
  type ProductFormState,
29
33
  } from '@tanqory/theme-kit/headless'
30
34
  import { Grid } from '../components/parts'
@@ -36,7 +40,7 @@ function stockLine(p: ProductFormState, t: ReturnType<typeof useTranslate>): str
36
40
  return t('product.inStock')
37
41
  }
38
42
 
39
- function ProductDetail({ settings }: { settings: { showVendor: boolean } }): JSX.Element {
43
+ function ProductDetail({ settings, blocks }: { settings: { showVendor: boolean }; blocks: BlockInstance[] }): JSX.Element {
40
44
  const t = useTranslate()
41
45
  return (
42
46
  <ProductForm className="st-pdp">
@@ -59,6 +63,10 @@ function ProductDetail({ settings }: { settings: { showVendor: boolean } }): JSX
59
63
  <AddToCart className="st-btn st-btn--solid st-pdp__add" />
60
64
  </div>
61
65
  {p.product.descriptionHtml ? <div className="st-pdp__desc" dangerouslySetInnerHTML={{ __html: p.product.descriptionHtml }} /> : null}
66
+ {/* Blocks of the store's installed apps (reviews, size charts), below the buy box (theme-abi §7.2). */}
67
+ {blocks.filter(isAppBlock).map((b, i) => (
68
+ <AppBlock key={b.id ?? i} block={b} className="st-pdp__app" />
69
+ ))}
62
70
  </div>
63
71
  </>
64
72
  ) : (
@@ -76,6 +84,8 @@ export const product = defineSection({
76
84
  category: 'products',
77
85
  requires: ['product'],
78
86
  settings: { showVendor: field.boolean(true, { label: 't:labels.show_the_brand' }) },
87
+ // '@app': every theme lets the product page show the store's installed apps (theme-abi §7.2 AppBlocks-1)
88
+ blocks: [APP_BLOCKS],
79
89
  component: ProductDetail,
80
90
  })
81
91
 
@@ -193,7 +203,7 @@ export const cart = defineSection({
193
203
  </a>
194
204
  {line.variant.title && line.variant.title !== 'Default Title' ? <p className="st-muted">{line.variant.title}</p> : null}
195
205
  <p className="st-muted">{formatMoney(line.variant.price)}</p>
196
- {l.refusal ? <p role="alert">{t('cart.limitReached', { max: l.refusal.maxQuantity ?? line.quantity })}</p> : l.failed ? <p role="alert">{t('cart.lineFailed')}</p> : null}
206
+ {l.refusal ? <p role="alert">{t('cart.limitReached', { max: ('maxQuantity' in l.refusal ? l.refusal.maxQuantity : undefined) ?? line.quantity })}</p> : l.failed ? <p role="alert">{t('cart.lineFailed')}</p> : null}
197
207
  </div>
198
208
  <div className="st-line__qty">
199
209
  <CartLineDecrement className="st-step" />
@@ -6,7 +6,7 @@
6
6
  * features, the testimonials) is blocks the merchant adds, removes and reorders. Every section has a preset, so it can
7
7
  * be added from "Add section". Interface words (View all) go through t() and the locale files.
8
8
  */
9
- import { Image, NewsletterForm, ai, defineBlock, defineSection, field, useCollection, useTranslate, type BlockInstance } from '@tanqory/theme-kit/headless'
9
+ import { APP_BLOCKS, AppBlock, Image, NewsletterForm, ai, defineBlock, defineSection, field, isAppBlock, useCollection, useTranslate, type BlockInstance } from '@tanqory/theme-kit/headless'
10
10
  import { Grid, cx } from '../components/parts'
11
11
 
12
12
  export const hero = defineSection({
@@ -204,10 +204,15 @@ export const note = defineSection({
204
204
  },
205
205
  presets: [{ name: 't:labels.rich_text', settings: { heading: 'About us', body: '<p>Tell shoppers who you are and what you make.</p>' } }],
206
206
  ai: ai.richText({ heading: 'heading', body: 'body' }),
207
- component: ({ settings }) => (
207
+ // '@app': a section that can go on any page and shows the store's installed apps (theme-abi §7.2 AppBlocks-1)
208
+ blocks: [APP_BLOCKS],
209
+ component: ({ settings, blocks }) => (
208
210
  <section className="st-note">
209
211
  {settings.heading ? <h2 className="st-note__title">{settings.heading}</h2> : null}
210
212
  {settings.body ? <div className="st-note__body" dangerouslySetInnerHTML={{ __html: settings.body }} /> : null}
213
+ {blocks.filter(isAppBlock).map((b, i) => (
214
+ <AppBlock key={b.id ?? i} block={b} className="st-note__app" />
215
+ ))}
211
216
  </section>
212
217
  ),
213
218
  })
@@ -20,8 +20,10 @@ body { color: var(--st-ink); font-family: var(--st-font); line-height: 1.6; -web
20
20
  .st :focus-visible { outline: 2px solid var(--st-accent); outline-offset: 3px; }
21
21
  .st h1, .st h2, .st h3 { font-weight: 600; line-height: 1.2; margin: 0; }
22
22
  .st-muted { color: var(--st-muted); }
23
- .st-skip { position: absolute; left: -9999px; top: 8px; z-index: 50; padding: 12px 16px; background: var(--st-ink); color: var(--st-bg) !important; }
24
- .st-skip:focus { left: 8px; }
23
+ /* Off-screen until focused, without a large negative physical offset: that becomes a sideways scroll area as wide as the
24
+ offset in a right-to-left language (and the page's pictures show only that blank area). */
25
+ .st-skip { position: absolute; inset-inline-start: 8px; top: 8px; z-index: 50; padding: 12px 16px; background: var(--st-ink); color: var(--st-bg) !important; transform: translateY(-200%); }
26
+ .st-skip:focus { transform: none; }
25
27
  main#main:focus { outline: none; }
26
28
 
27
29
  /* ── buttons, inputs ─────────────────────────────────────────────────────── */
@@ -130,6 +132,8 @@ main#main:focus { outline: none; }
130
132
  .st-pdp__buy { display: flex; gap: 12px; }
131
133
  .st-pdp__add { flex: 1; }
132
134
  .st-pdp__desc { color: var(--st-muted); border-top: 1px solid var(--st-line); padding-top: 20px; }
135
+ /* a block of an installed app (theme-abi §7.2): the app fills it; the theme only spaces it */
136
+ .st-pdp__app, .st-note__app { margin-top: 20px; }
133
137
 
134
138
  /* ── collection ──────────────────────────────────────────────────────────── */
135
139
  .st-plp { padding: 56px var(--st-gutter); }