@brainerce/mcp-server 3.9.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/http.js +290 -4
- package/dist/bin/stdio.js +290 -4
- package/dist/index.d.mts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +290 -4
- package/dist/index.mjs +290 -4
- package/package.json +1 -1
package/dist/bin/stdio.js
CHANGED
|
@@ -709,7 +709,7 @@ const growProvider = providers.find(p => p.provider === 'grow');
|
|
|
709
709
|
const paypalProvider = providers.find(p => p.provider === 'paypal');
|
|
710
710
|
\`\`\`
|
|
711
711
|
|
|
712
|
-
Each provider has: \`id\`, \`provider\` (flexible string \u2014 \`'stripe'\`, \`'grow'\`, \`'paypal'\`, \`'cardcom'\`, \`'sandbox'\`, and future providers), \`name\`, \`publicKey\`, \`stripeAccountId\` (Stripe only), \`supportedMethods\`, \`testMode\`, \`isDefault\`.
|
|
712
|
+
Each provider has: \`id\`, \`provider\` (flexible string \u2014 \`'stripe'\`, \`'grow'\`, \`'paypal'\`, \`'cardcom'\`, \`'morning'\`, \`'takbull'\`, \`'sandbox'\`, and future providers), \`name\`, \`publicKey\`, \`stripeAccountId\` (Stripe only), \`supportedMethods\`, \`testMode\`, \`isDefault\`.
|
|
713
713
|
|
|
714
714
|
The payment intent returned from \`createPaymentIntent()\` includes a \`clientSdk\` object whose \`renderType\` tells you exactly how to render \u2014 **branch on THAT, not on the provider name**:
|
|
715
715
|
|
|
@@ -2368,6 +2368,67 @@ Read \`storeInfo.i18n.supportedLocales\` and render a switcher in the header
|
|
|
2368
2368
|
that navigates to \`/{otherLocale}/{currentPathWithoutLocale}\`. The middleware
|
|
2369
2369
|
handles the canonical redirect when the user picks the default locale.`;
|
|
2370
2370
|
}
|
|
2371
|
+
function getMultilingualSeoSection() {
|
|
2372
|
+
return `## Multilingual SEO
|
|
2373
|
+
|
|
2374
|
+
### Slugs per locale (IMPORTANT)
|
|
2375
|
+
|
|
2376
|
+
Brainerce stores per-locale slugs in \`Product.translations[locale].slug\`.
|
|
2377
|
+
The API exposes them as \`product.localeSlugs\` \u2014 a flat \`Record<string, string>\`.
|
|
2378
|
+
|
|
2379
|
+
\`\`\`typescript
|
|
2380
|
+
// product.localeSlugs = { he: '\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4', en: 'yoga-mattress', ar: '\u062D\u0635\u064A\u0631\u0629-\u064A\u0648\u063A\u0627' }
|
|
2381
|
+
const locSlug = product.localeSlugs?.[locale] ?? product.slug;
|
|
2382
|
+
\`\`\`
|
|
2383
|
+
|
|
2384
|
+
Use AI translation (\`translateEntities\` / the AI Translate button in the admin) to populate
|
|
2385
|
+
locale-specific slugs automatically. Until translated, all locales fall back to the base slug
|
|
2386
|
+
(which Google still accepts \u2014 it resolves to the correct locale content via Accept-Language).
|
|
2387
|
+
|
|
2388
|
+
### hreflang tags
|
|
2389
|
+
|
|
2390
|
+
Every product page in a multi-locale store MUST emit bidirectional hreflang tags or Google
|
|
2391
|
+
ignores them entirely. The scaffolded template generates them automatically when
|
|
2392
|
+
\`NEXT_PUBLIC_BRAINERCE_LOCALES=he,en\` is set.
|
|
2393
|
+
|
|
2394
|
+
\`\`\`html
|
|
2395
|
+
<!-- Example output for /en/products/yoga-mattress -->
|
|
2396
|
+
<link rel="alternate" hreflang="he" href="https://store.com/products/\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4" />
|
|
2397
|
+
<link rel="alternate" hreflang="en" href="https://store.com/en/products/yoga-mattress" />
|
|
2398
|
+
<link rel="alternate" hreflang="x-default" href="https://store.com/products/\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4" />
|
|
2399
|
+
\`\`\`
|
|
2400
|
+
|
|
2401
|
+
If building a custom storefront, add to \`generateMetadata()\`:
|
|
2402
|
+
\`\`\`typescript
|
|
2403
|
+
alternates: {
|
|
2404
|
+
canonical: locale === defaultLoc ? \`/products/\${slug}\` : \`/\${locale}/products/\${slug}\`,
|
|
2405
|
+
languages: {
|
|
2406
|
+
he: \`\${baseUrl}/products/\${localeSlugs.he ?? baseSlug}\`,
|
|
2407
|
+
en: \`\${baseUrl}/en/products/\${localeSlugs.en ?? baseSlug}\`,
|
|
2408
|
+
'x-default': \`\${baseUrl}/products/\${localeSlugs[defaultLoc] ?? baseSlug}\`,
|
|
2409
|
+
},
|
|
2410
|
+
},
|
|
2411
|
+
\`\`\`
|
|
2412
|
+
|
|
2413
|
+
### URL structure
|
|
2414
|
+
|
|
2415
|
+
Google-recommended for headless storefronts:
|
|
2416
|
+
- Default locale: \`/products/\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4\` (no prefix)
|
|
2417
|
+
- Other locales: \`/en/products/yoga-mattress\` (prefixed)
|
|
2418
|
+
- \u274C Never: \`?locale=he\` query params (Google rates these as "Not recommended")
|
|
2419
|
+
|
|
2420
|
+
### Sitemap
|
|
2421
|
+
|
|
2422
|
+
The scaffolded \`sitemap.ts\` generates per-locale entries automatically:
|
|
2423
|
+
\`\`\`
|
|
2424
|
+
/products/\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4 (he \u2014 default, no prefix)
|
|
2425
|
+
/en/products/yoga-mattress (en)
|
|
2426
|
+
/ar/products/\u062D\u0635\u064A\u0631\u0629-\u064A\u0648\u063A\u0627 (ar)
|
|
2427
|
+
\`\`\`
|
|
2428
|
+
|
|
2429
|
+
Hebrew, Arabic, and other non-Latin slugs are fully supported \u2014 Google recommends
|
|
2430
|
+
using the audience's language in URLs and indexes non-ASCII characters correctly.`;
|
|
2431
|
+
}
|
|
2371
2432
|
function getAdminApiSection() {
|
|
2372
2433
|
return `## Admin API (v0.19.0+)
|
|
2373
2434
|
|
|
@@ -2451,6 +2512,20 @@ await admin.mergeTaxClasses(food.id, standardClassId);
|
|
|
2451
2512
|
Storefront (public, no apiKey \u2014 \`storeId\` mode): \`getStoreTaxClasses()\` lists
|
|
2452
2513
|
the store's classes (storefront-safe fields only) for a transparency badge.
|
|
2453
2514
|
|
|
2515
|
+
For a buyer-facing tax preview on PDP / PLP / cart, \`estimateTax({ country,
|
|
2516
|
+
subtotal })\` returns the tax portion at the Standard rate for the buyer's
|
|
2517
|
+
country. **Non-binding** \u2014 the authoritative tax still runs at checkout with
|
|
2518
|
+
the full shipping address (state / postal / per-class). Always render with an
|
|
2519
|
+
"Estimate" affordance.
|
|
2520
|
+
|
|
2521
|
+
\`\`\`typescript
|
|
2522
|
+
const { estimatedTax, rate, currency, note } = await store.estimateTax({
|
|
2523
|
+
country: 'IT', subtotal: 100,
|
|
2524
|
+
});
|
|
2525
|
+
// \u2192 { appliesTax: true, rate: 22, estimatedTax: 22, currency: 'EUR',
|
|
2526
|
+
// note: 'Estimate \u2014 final tax calculated at checkout\u2026' }
|
|
2527
|
+
\`\`\`
|
|
2528
|
+
|
|
2454
2529
|
### Regions (multi-currency / per-region providers)
|
|
2455
2530
|
|
|
2456
2531
|
A region binds countries \u2192 currency + tax-display mode + enabled payment
|
|
@@ -2481,6 +2556,19 @@ const { data: regions } = await store.getStoreRegions();
|
|
|
2481
2556
|
const region = await store.getStoreRegion(regions[0].id);
|
|
2482
2557
|
\`\`\`
|
|
2483
2558
|
|
|
2559
|
+
For a single round trip, \`getAutoRegion(country)\` resolves a buyer's country
|
|
2560
|
+
to a region server-side. Brainerce does NOT derive the country from the request
|
|
2561
|
+
IP (the storefront server is what reaches the backend, not the end-customer) \u2014
|
|
2562
|
+
your storefront extracts the country from its edge runtime (Cloudflare
|
|
2563
|
+
\`CF-IPCountry\`, Vercel \`request.geo?.country\`, Fastly \`client-geo-country\`,
|
|
2564
|
+
etc.) and forwards it. Returns \`matched=true\` on explicit country hit, \`false\`
|
|
2565
|
+
when falling back to the default region.
|
|
2566
|
+
|
|
2567
|
+
\`\`\`typescript
|
|
2568
|
+
const country = headers.get('cf-ipcountry') ?? 'US';
|
|
2569
|
+
const { region, matched } = await store.getAutoRegion(country);
|
|
2570
|
+
\`\`\`
|
|
2571
|
+
|
|
2484
2572
|
A shipping zone can be limited to regions via \`regionIds\` \u2014 the zone is then
|
|
2485
2573
|
only offered to checkouts that resolved to one of those regions. Empty/omitted =
|
|
2486
2574
|
available for any region (default); each id must belong to the same store.
|
|
@@ -2944,6 +3032,146 @@ entries \u2014 pick a descriptive slug (\`'shipping'\`, \`'returns'\`, \`'about'
|
|
|
2944
3032
|
- \`get-type-definitions\` with \`domain: 'content'\` for the TypeScript
|
|
2945
3033
|
interfaces.`;
|
|
2946
3034
|
}
|
|
3035
|
+
function getBlogSection() {
|
|
3036
|
+
return `## Blog
|
|
3037
|
+
|
|
3038
|
+
Merchants write and schedule blog posts in **Content \u2192 Blog** in the dashboard.
|
|
3039
|
+
Storefronts choose their own URL scheme \u2014 render posts at \`/blog/[slug]\`,
|
|
3040
|
+
\`/articles/[slug]\`, or whatever fits the brand.
|
|
3041
|
+
|
|
3042
|
+
Public reads carry \`Cache-Control: public, max-age=300, stale-while-revalidate=60\`.
|
|
3043
|
+
|
|
3044
|
+
**Scheduling:** A post is visible once \`status === 'PUBLISHED'\` and
|
|
3045
|
+
\`publishedAt <= now()\`. Set a future \`publishedAt\` while publishing to
|
|
3046
|
+
schedule \u2014 no cron needed; visibility is computed at query time.
|
|
3047
|
+
|
|
3048
|
+
### Reading posts (any SDK mode)
|
|
3049
|
+
|
|
3050
|
+
\`\`\`typescript
|
|
3051
|
+
// List published posts
|
|
3052
|
+
const { data: posts, meta } = await client.blog.getPosts({ page: 1, limit: 10 });
|
|
3053
|
+
|
|
3054
|
+
// Filter by category or tag
|
|
3055
|
+
const { data: news } = await client.blog.getPosts({ category: 'news' });
|
|
3056
|
+
const { data: tips } = await client.blog.getPosts({ tag: 'tutorial' });
|
|
3057
|
+
|
|
3058
|
+
// Fetch one by slug (returns null on 404)
|
|
3059
|
+
const post = await client.blog.getPost('my-first-post');
|
|
3060
|
+
if (post) {
|
|
3061
|
+
console.log(post.title); // string
|
|
3062
|
+
console.log(post.content); // HTML string from rich-text editor
|
|
3063
|
+
console.log(post.excerpt); // optional short summary
|
|
3064
|
+
console.log(post.tags); // string[]
|
|
3065
|
+
console.log(post.coverImageUrl, post.coverImageAlt);
|
|
3066
|
+
console.log(post.publishedAt); // ISO 8601 or undefined
|
|
3067
|
+
}
|
|
3068
|
+
\`\`\`
|
|
3069
|
+
|
|
3070
|
+
### BlogPost fields
|
|
3071
|
+
|
|
3072
|
+
| Field | Type | Notes |
|
|
3073
|
+
| ----------------- | ----------- | ------------------------------------- |
|
|
3074
|
+
| \`id\` | string | |
|
|
3075
|
+
| \`title\` | string | |
|
|
3076
|
+
| \`slug\` | string | Unique per store, URL-safe |
|
|
3077
|
+
| \`category\` | string? | Free-form (e.g. \`'news'\`) |
|
|
3078
|
+
| \`content\` | string | HTML from rich-text editor |
|
|
3079
|
+
| \`excerpt\` | string? | Short summary for listing cards |
|
|
3080
|
+
| \`coverImageUrl\` | string? | |
|
|
3081
|
+
| \`coverImageAlt\` | string? | |
|
|
3082
|
+
| \`author\` | string? | |
|
|
3083
|
+
| \`tags\` | string[] | |
|
|
3084
|
+
| \`publishedAt\` | string? | ISO 8601; null = publish immediately |
|
|
3085
|
+
| \`seoTitle\` | string? | |
|
|
3086
|
+
| \`seoDescription\`| string? | |
|
|
3087
|
+
| \`ogImageUrl\` | string? | |
|
|
3088
|
+
|
|
3089
|
+
### Rendering blog content
|
|
3090
|
+
|
|
3091
|
+
\`\`\`tsx
|
|
3092
|
+
// app/blog/[slug]/page.tsx
|
|
3093
|
+
import DOMPurify from 'isomorphic-dompurify';
|
|
3094
|
+
|
|
3095
|
+
const post = await brainerce.blog.getPost(params.slug);
|
|
3096
|
+
if (!post) notFound();
|
|
3097
|
+
|
|
3098
|
+
// Always sanitize before rendering HTML \u2014 treat external-origin content as untrusted
|
|
3099
|
+
const safeHtml = DOMPurify.sanitize(post.content);
|
|
3100
|
+
return <div dangerouslySetInnerHTML={{ __html: safeHtml }} className="prose" />;
|
|
3101
|
+
\`\`\`
|
|
3102
|
+
|
|
3103
|
+
The \`content\` field is HTML produced by the Lexical rich-text editor.
|
|
3104
|
+
**Always sanitize with DOMPurify (or equivalent) before rendering via
|
|
3105
|
+
\`dangerouslySetInnerHTML\`** \u2014 even though the content originates from your
|
|
3106
|
+
own editor, defense-in-depth prevents any stored-XSS path if content is ever
|
|
3107
|
+
migrated or imported from an external source.
|
|
3108
|
+
Apply a \`prose\` class (Tailwind Typography) for automatic styling.
|
|
3109
|
+
|
|
3110
|
+
### REST endpoints
|
|
3111
|
+
|
|
3112
|
+
| Method | Path | Returns |
|
|
3113
|
+
|--------|------|---------|
|
|
3114
|
+
| GET | \`/api/stores/:storeId/blog/posts\` | \`BlogPostListResponse\` |
|
|
3115
|
+
| GET | \`/api/stores/:storeId/blog/posts/:slug\` | \`BlogPost\` or 404 |
|
|
3116
|
+
| GET | \`/api/vc/:connectionId/blog/posts\` | Same, channel-scoped |
|
|
3117
|
+
| GET | \`/api/vc/:connectionId/blog/posts/:slug\` | \`BlogPost\` or 404 |
|
|
3118
|
+
`;
|
|
3119
|
+
}
|
|
3120
|
+
function getStorefrontBotSection(connectionId) {
|
|
3121
|
+
return `## Storefront Bot (AI chat widget)
|
|
3122
|
+
|
|
3123
|
+
The store's AI shopping assistant. ALL configuration (name, avatar, colors,
|
|
3124
|
+
greeting, starter questions, capabilities, guardrails) lives in the merchant
|
|
3125
|
+
dashboard \u2014 the embed never decides behavior, and the widget renders nothing
|
|
3126
|
+
until the merchant switches the bot Live.
|
|
3127
|
+
|
|
3128
|
+
### Zero-code embed (any site)
|
|
3129
|
+
|
|
3130
|
+
\`\`\`html
|
|
3131
|
+
<script src="https://cdn.brainerce.com/bot.js" data-connection-id="${connectionId}" defer></script>
|
|
3132
|
+
\`\`\`
|
|
3133
|
+
|
|
3134
|
+
Keep the tag exactly this bare \u2014 do NOT add \`integrity\` or \`crossorigin\`
|
|
3135
|
+
(the bootstrap is intentionally mutable; it is origin-pinned by CSP instead).
|
|
3136
|
+
|
|
3137
|
+
### SDK mount (React / Next.js / any bundler)
|
|
3138
|
+
|
|
3139
|
+
\`\`\`ts
|
|
3140
|
+
import { BrainerceBot } from 'brainerce/bot';
|
|
3141
|
+
|
|
3142
|
+
// client-side only (e.g. in a useEffect) \u2014 mounts a floating chat bubble
|
|
3143
|
+
const bot = await BrainerceBot.mount({ connectionId: '${connectionId}' });
|
|
3144
|
+
bot?.destroy(); // optional teardown
|
|
3145
|
+
\`\`\`
|
|
3146
|
+
|
|
3147
|
+
\`mount\` resolves to \`null\` when the bot is disabled (FREE plan, switched
|
|
3148
|
+
off, or unconfigured) \u2014 safe to call unconditionally. Options: \`connectionId\`
|
|
3149
|
+
(required), \`baseUrl\` (API origin override), \`target\` (mount element),
|
|
3150
|
+
\`onAddToCart\` (\`({ productId, variantId, quantity }) => boolean | Promise<boolean>\`
|
|
3151
|
+
\u2014 route the widget's cart adds through the site's own cart; \`variantId\` is
|
|
3152
|
+
null for simple products; return false to fall back to the product page).
|
|
3153
|
+
|
|
3154
|
+
Behavior: persists an anonymous session in localStorage, restores the
|
|
3155
|
+
conversation on revisit, streams answers, and shows product recommendation
|
|
3156
|
+
cards (image, price, add-to-cart / view). Multi-variant products get an
|
|
3157
|
+
in-card variant picker; shoppers can also ask the assistant to add an item
|
|
3158
|
+
and it goes through the same cart chain. Zero-result searches feed the
|
|
3159
|
+
merchant's "unmet demand" analytics. Aside from shopper-initiated cart adds,
|
|
3160
|
+
the bot is read-only.
|
|
3161
|
+
|
|
3162
|
+
Add-to-cart resolution chain: \`onAddToCart\` option \u2192 cancelable
|
|
3163
|
+
\`brainerce:bot:add-to-cart\` CustomEvent on window
|
|
3164
|
+
(\`detail: { productId, variantId, quantity, connectionId }\`; call
|
|
3165
|
+
preventDefault() after handling) \u2192 navigate to the product page.
|
|
3166
|
+
|
|
3167
|
+
Rules:
|
|
3168
|
+
- Mount once per page; do not pass any visual config \u2014 the dashboard owns it.
|
|
3169
|
+
- Do not wrap or restyle the widget; it renders in its own Shadow DOM.
|
|
3170
|
+
- Product card links expect the conventional \`/products/<slug>\` route.
|
|
3171
|
+
- Wire \`onAddToCart\` to the site's cart (see the cart section) so the header
|
|
3172
|
+
count updates when the bot adds items.
|
|
3173
|
+
`;
|
|
3174
|
+
}
|
|
2947
3175
|
function getSectionByTopic(topic, connectionId, currency) {
|
|
2948
3176
|
const cid = connectionId || "vc_YOUR_CONNECTION_ID";
|
|
2949
3177
|
const cur = currency || "USD";
|
|
@@ -2982,6 +3210,10 @@ function getSectionByTopic(topic, connectionId, currency) {
|
|
|
2982
3210
|
return getTaxDisplaySection(cur);
|
|
2983
3211
|
case "i18n":
|
|
2984
3212
|
return getI18nSection();
|
|
3213
|
+
case "multilingual-seo":
|
|
3214
|
+
case "hreflang":
|
|
3215
|
+
case "seo-i18n":
|
|
3216
|
+
return getMultilingualSeoSection();
|
|
2985
3217
|
case "critical-rules":
|
|
2986
3218
|
return getCriticalRulesSection() + "\n\n" + getTypeQuickReference();
|
|
2987
3219
|
case "type-reference":
|
|
@@ -2992,6 +3224,10 @@ function getSectionByTopic(topic, connectionId, currency) {
|
|
|
2992
3224
|
return getContactInquiriesSection();
|
|
2993
3225
|
case "content":
|
|
2994
3226
|
return getContentSection();
|
|
3227
|
+
case "blog":
|
|
3228
|
+
return getBlogSection();
|
|
3229
|
+
case "storefront-bot":
|
|
3230
|
+
return getStorefrontBotSection(cid);
|
|
2995
3231
|
case "all":
|
|
2996
3232
|
return [
|
|
2997
3233
|
"# Brainerce SDK \u2014 full topic dump",
|
|
@@ -3076,6 +3312,10 @@ function getSectionByTopic(topic, connectionId, currency) {
|
|
|
3076
3312
|
"",
|
|
3077
3313
|
"---",
|
|
3078
3314
|
"",
|
|
3315
|
+
getMultilingualSeoSection(),
|
|
3316
|
+
"",
|
|
3317
|
+
"---",
|
|
3318
|
+
"",
|
|
3079
3319
|
getAdminApiSection(),
|
|
3080
3320
|
"",
|
|
3081
3321
|
"---",
|
|
@@ -3084,10 +3324,18 @@ function getSectionByTopic(topic, connectionId, currency) {
|
|
|
3084
3324
|
"",
|
|
3085
3325
|
"---",
|
|
3086
3326
|
"",
|
|
3087
|
-
getContentSection()
|
|
3327
|
+
getContentSection(),
|
|
3328
|
+
"",
|
|
3329
|
+
"---",
|
|
3330
|
+
"",
|
|
3331
|
+
getBlogSection(),
|
|
3332
|
+
"",
|
|
3333
|
+
"---",
|
|
3334
|
+
"",
|
|
3335
|
+
getStorefrontBotSection(cid)
|
|
3088
3336
|
].join("\n");
|
|
3089
3337
|
default:
|
|
3090
|
-
return `Unknown topic: "${topic}". Available topics: setup, products, cart, checkout, checkout-custom-fields, payment, auth, order-confirmation, inventory, discounts, recommendations, product-customization-fields, tax, i18n, critical-rules, type-reference, admin, inquiries, content, all`;
|
|
3338
|
+
return `Unknown topic: "${topic}". Available topics: setup, products, cart, checkout, checkout-custom-fields, payment, auth, order-confirmation, inventory, discounts, recommendations, product-customization-fields, tax, i18n, critical-rules, type-reference, admin, inquiries, content, blog, all`;
|
|
3091
3339
|
}
|
|
3092
3340
|
}
|
|
3093
3341
|
|
|
@@ -3116,6 +3364,7 @@ var GET_SDK_DOCS_SCHEMA = {
|
|
|
3116
3364
|
"admin",
|
|
3117
3365
|
"inquiries",
|
|
3118
3366
|
"content",
|
|
3367
|
+
"storefront-bot",
|
|
3119
3368
|
"all"
|
|
3120
3369
|
]).describe("The SDK documentation topic to retrieve"),
|
|
3121
3370
|
salesChannelId: import_zod.z.string().optional().describe("Sales channel ID (starts with vc_). Used to personalize setup code."),
|
|
@@ -3153,6 +3402,12 @@ interface Product {
|
|
|
3153
3402
|
priceMin?: string | null; // Lowest variant price (VARIABLE products) \u2014 same as basePrice for VARIABLE, kept for back-compat and JSON-LD range display.
|
|
3154
3403
|
priceMax?: string | null; // Highest variant price (VARIABLE products). Use with priceMin for "\u20AA49 \u2013 \u20AA199" range.
|
|
3155
3404
|
priceVaries?: boolean; // true when variant prices differ \u2014 show "\u20AA49 \u2013 \u20AA199" range.
|
|
3405
|
+
// FX DISPLAY overlay (PRD \xA723). Set only when getProducts({ regionId }) was called AND region.currency !== store.currency. basePrice/salePrice above stay in store currency \u2014 these are additive, display-only. The buyer is still charged in store currency at checkout; payment provider handles customer-side FX.
|
|
3406
|
+
displayPrice?: string; // basePrice \xD7 daily FX rate, in displayCurrency.
|
|
3407
|
+
displaySalePrice?: string; // salePrice \xD7 rate (if salePrice present).
|
|
3408
|
+
displayPriceMin?: string; // priceMin \xD7 rate (VARIABLE products).
|
|
3409
|
+
displayPriceMax?: string; // priceMax \xD7 rate (VARIABLE products).
|
|
3410
|
+
displayCurrency?: string; // ISO 4217 of the region \u2014 e.g. "EUR".
|
|
3156
3411
|
status: string;
|
|
3157
3412
|
type: 'SIMPLE' | 'VARIABLE';
|
|
3158
3413
|
isDownloadable?: boolean;
|
|
@@ -3196,6 +3451,10 @@ interface ProductVariant {
|
|
|
3196
3451
|
name?: string | null;
|
|
3197
3452
|
price?: string | null;
|
|
3198
3453
|
salePrice?: string | null;
|
|
3454
|
+
// FX DISPLAY overlay (PRD \xA723) \u2014 same semantics as on the parent Product.
|
|
3455
|
+
displayPrice?: string;
|
|
3456
|
+
displaySalePrice?: string;
|
|
3457
|
+
displayCurrency?: string;
|
|
3199
3458
|
attributes?: Record<string, string> | null;
|
|
3200
3459
|
options?: Array<{ name: string; value: string }>;
|
|
3201
3460
|
inventory?: InventoryInfo | null;
|
|
@@ -4325,6 +4584,15 @@ interface PublicRegionDetail extends PublicRegion {
|
|
|
4325
4584
|
}
|
|
4326
4585
|
// getStoreRegions(): { data: PublicRegion[] } \u2014 active regions, default first.
|
|
4327
4586
|
// getStoreRegion(regionId): PublicRegionDetail \u2014 one region + its providers.
|
|
4587
|
+
interface AutoRegionResponse {
|
|
4588
|
+
region: PublicRegion | null;
|
|
4589
|
+
matched: boolean; // true=country was in a region's list; false=fell back to default
|
|
4590
|
+
country: string; // upper-cased ISO-3166-1 alpha-2; '' when caller omitted it
|
|
4591
|
+
}
|
|
4592
|
+
// getAutoRegion(country): AutoRegionResponse \u2014 server-side resolution in one
|
|
4593
|
+
// round trip. Pair with the country your edge runtime extracts
|
|
4594
|
+
// (CF-IPCountry / request.geo.country / etc.) \u2014 Brainerce does NOT derive the
|
|
4595
|
+
// country from the request IP server-side (storefront != end-customer).
|
|
4328
4596
|
|
|
4329
4597
|
// ---- Tax Classes ---- (scopes: tax-classes:read / tax-classes:write)
|
|
4330
4598
|
// Charge differential rates by product type. A TaxRate may target a class via
|
|
@@ -4356,7 +4624,25 @@ interface AssignTaxClassDto { productIds?: string[]; variantIds?: string[]; cate
|
|
|
4356
4624
|
// getRegionCompatibleProviders(id), detectRegion(country, regions)
|
|
4357
4625
|
// Tax classes: getTaxClasses(), getTaxClass(id), createTaxClass(dto), updateTaxClass(id, dto),
|
|
4358
4626
|
// deleteTaxClass(id), setDefaultTaxClass(id), assignTaxClass(id, dto),
|
|
4359
|
-
// mergeTaxClasses(id, targetId)
|
|
4627
|
+
// mergeTaxClasses(id, targetId)
|
|
4628
|
+
//
|
|
4629
|
+
// SDK methods (storefront, public \u2014 storeId mode, no apiKey):
|
|
4630
|
+
// getStoreRegions(), getStoreRegion(id), getAutoRegion(country)
|
|
4631
|
+
// getStoreTaxClasses(), estimateTax({ country?, subtotal })
|
|
4632
|
+
//
|
|
4633
|
+
// estimateTax returns:
|
|
4634
|
+
interface TaxEstimateResponse {
|
|
4635
|
+
appliesTax: boolean;
|
|
4636
|
+
rate: number | null; // percent (18 = 18%) \u2014 null when no matching rule
|
|
4637
|
+
rateName: string | null;
|
|
4638
|
+
estimatedTax: number; // tax portion of subtotal in store currency
|
|
4639
|
+
pricesIncludeTax: boolean;
|
|
4640
|
+
currency: string; // store currency (cart/order currency)
|
|
4641
|
+
note: string; // disclaimer \u2014 preview is non-binding
|
|
4642
|
+
}
|
|
4643
|
+
// Non-binding by design: the authoritative tax runs at checkout against the
|
|
4644
|
+
// full shipping address. The country comes from your edge runtime
|
|
4645
|
+
// (CF-IPCountry / request.geo.country / etc.), NOT the request IP.`;
|
|
4360
4646
|
var TYPES_BY_DOMAIN = {
|
|
4361
4647
|
products: PRODUCTS_TYPES,
|
|
4362
4648
|
cart: CART_TYPES,
|
package/dist/index.d.mts
CHANGED
|
@@ -5,9 +5,6 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
5
5
|
*/
|
|
6
6
|
declare function createServer(): McpServer;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Topic-to-section mapping for the get-sdk-docs tool.
|
|
10
|
-
*/
|
|
11
8
|
declare function getSectionByTopic(topic: string, connectionId?: string, currency?: string): string;
|
|
12
9
|
|
|
13
10
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,6 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
5
5
|
*/
|
|
6
6
|
declare function createServer(): McpServer;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Topic-to-section mapping for the get-sdk-docs tool.
|
|
10
|
-
*/
|
|
11
8
|
declare function getSectionByTopic(topic: string, connectionId?: string, currency?: string): string;
|
|
12
9
|
|
|
13
10
|
/**
|