This commit is contained in:
greeneclipse committed 2026-10-16 00:34:06 +02:00
1 parent 6586722652
commit 1e7c7bbfbb
65 files changed
+1345 -640

No files matched your search

+3 -3
View File
@@ -99,7 +99,7 @@ describe("buildSubscriptionEcommerce", () => {
const { ecommerce, extra } = buildSubscriptionEcommerce("starter", "monthly");
assert.equal(extra.plan, "starter");
assert.equal(extra.billing_term, "monthly");
assert.equal(ecommerce.currency, "USD");
assert.equal(ecommerce.currency, "EUR");
assert.equal(ecommerce.value, 49);
assert.deepEqual(ecommerce.items[0], {
item_id: "starter",
@@ -124,7 +124,7 @@ describe("buildCreditPackEcommerce", () => {
it("includes value/currency/items from CREDIT_PACKS list prices", () => {
const { ecommerce, extra } = buildCreditPackEcommerce("tiny");
assert.equal(extra.pack_id, "tiny");
assert.equal(ecommerce.currency, "USD");
assert.equal(ecommerce.currency, "EUR");
assert.equal(ecommerce.value, 29);
assert.deepEqual(ecommerce.items[0], {
item_id: "tiny",
@@ -143,7 +143,7 @@ describe("toEcommerceObject + purchase resolve", () => {
});
assert.deepEqual(toEcommerceObject(ecommerce), {
items: ecommerce.items,
currency: "USD",
currency: "EUR",
value: 49,
transaction_id: "cs_test_abc"
});
+8 -8
View File
@@ -46,7 +46,7 @@ export function normalizeBillingTerm(raw: string | null | undefined): BillingTer
return t === "yearly" || t === "annual" || t === "year" ? "yearly" : "monthly";
}
/** Marketing list price for a subscription term (USD). */
/** Marketing list price for a subscription term (EUR). */
export function subscriptionListValue(
monthlyPrice: number,
term: BillingTerm
@@ -81,7 +81,7 @@ export function buildSubscriptionEcommerce(
};
const ecommerce: Ga4EcommerceFields = {
items: [item],
...(price !== undefined ? { currency: "USD", value: price } : {}),
...(price !== undefined ? { currency: "EUR", value: price } : {}),
...(opts?.transactionId ? { transaction_id: opts.transactionId } : {})
};
return {
@@ -92,15 +92,15 @@ export function buildSubscriptionEcommerce(
export function buildCreditPackEcommerce(
packId: string,
opts?: { transactionId?: string; priceUsd?: number; itemName?: string }
opts?: { transactionId?: string; priceEur?: number; itemName?: string }
): { ecommerce: Ga4EcommerceFields; extra: Record<string, unknown> } {
const key = packId.trim().toLowerCase();
const marketing = CREDIT_PACKS.find((p) => p.id === key);
const price =
typeof opts?.priceUsd === "number" && opts.priceUsd > 0
? opts.priceUsd
: typeof marketing?.priceUSD === "number" && marketing.priceUSD > 0
? marketing.priceUSD
typeof opts?.priceEur === "number" && opts.priceEur > 0
? opts.priceEur
: typeof marketing?.priceEUR === "number" && marketing.priceEUR > 0
? marketing.priceEUR
: undefined;
const itemName = (opts?.itemName ?? marketing?.name ?? key).trim() || key;
const item: Ga4EcommerceItem = {
@@ -112,7 +112,7 @@ export function buildCreditPackEcommerce(
};
const ecommerce: Ga4EcommerceFields = {
items: [item],
...(price !== undefined ? { currency: "USD", value: price } : {}),
...(price !== undefined ? { currency: "EUR", value: price } : {}),
...(opts?.transactionId ? { transaction_id: opts.transactionId } : {})
};
return {
@@ -29,7 +29,7 @@
);
function formatMoney(n: number): string {
return `$${n.toLocaleString()}`;
return `€${n.toLocaleString()}`;
}
</script>
@@ -127,9 +127,9 @@
{#if rec.plan.customPrice}
{i18n.t("pricing.card.custom")}
{:else if rec.plan.pricePerMonth === 0}
$0 / {i18n.t("pricing.card.perMonth")}
€0 / {i18n.t("pricing.card.perMonth")}
{:else}
{formatMoney(rec.monthlyListUSD)} / {i18n.t("pricing.card.perMonth")}
{formatMoney(rec.monthlyListEUR)} / {i18n.t("pricing.card.perMonth")}
{/if}
</p>
<ul class="mt-3 mb-4 space-y-1 text-sm text-text-muted">
@@ -145,7 +145,7 @@
{i18n.t("pricing.calc.aiNeedsPacks", {
pack: rec.packs.pack.name,
count: rec.packs.count,
usd: formatMoney(rec.packs.totalUSD)
usd: formatMoney(rec.packs.totalEUR)
})}
</li>
{/if}
@@ -165,11 +165,11 @@
</p>
<p class="mt-1 text-2xl font-bold text-text">{budget.plan.name}</p>
<p class="mt-2 text-sm text-text-muted">
{formatMoney(budget.monthlyListUSD)} / {i18n.t("pricing.card.perMonth")}
{#if budget.yearlyMonthlyUSD > 0 && budget.yearlyMonthlyUSD < budget.monthlyListUSD}
{formatMoney(budget.monthlyListEUR)} / {i18n.t("pricing.card.perMonth")}
{#if budget.yearlyMonthlyEUR > 0 && budget.yearlyMonthlyEUR < budget.monthlyListEUR}
<span class="ml-1">
({i18n.t("pricing.calc.orYearly", {
amount: formatMoney(budget.yearlyMonthlyUSD)
amount: formatMoney(budget.yearlyMonthlyEUR)
})})
</span>
{/if}
@@ -182,7 +182,7 @@
{i18n.t("pricing.calc.aiNeedsPacks", {
pack: budget.packs.pack.name,
count: budget.packs.count,
usd: formatMoney(budget.packs.totalUSD)
usd: formatMoney(budget.packs.totalEUR)
})}
</li>
{/if}
@@ -133,10 +133,10 @@
{#if plan.customPrice}
<span class="text-4xl font-bold tracking-tight">{i18n.t("pricing.card.custom")}</span>
{:else if isFree}
<span class="text-4xl font-bold tracking-tight">$0</span>
<span class="text-4xl font-bold tracking-tight">€0</span>
<span class="ml-2 text-lg text-text-muted">{i18n.t("pricing.card.forever")}</span>
{:else}
<span class="text-4xl font-bold tracking-tight">${displayPrice}</span>
<span class="text-4xl font-bold tracking-tight">€{displayPrice}</span>
<span class="ml-2 text-lg text-text-muted">/{displayPeriod}</span>
{/if}
</div>
@@ -10,7 +10,7 @@ export type MarketingCreditPack = {
description: string;
descriptionKey: string;
credits: number;
priceUSD: number;
priceEUR: number;
aiProducts: number;
};
@@ -22,7 +22,7 @@ export const CREDIT_PACKS: MarketingCreditPack[] = [
description: "Smoke tests / tiny fixes (25 credits ≈ 12 AI products)",
descriptionKey: "pricing.pack.tiny.desc",
credits: 25,
priceUSD: 29,
priceEUR: 29,
aiProducts: 12
},
{
@@ -32,7 +32,7 @@ export const CREDIT_PACKS: MarketingCreditPack[] = [
description: "Small top-up (65 credits ≈ 32 AI products)",
descriptionKey: "pricing.pack.small.desc",
credits: 65,
priceUSD: 59,
priceEUR: 59,
aiProducts: 32
},
{
@@ -42,7 +42,7 @@ export const CREDIT_PACKS: MarketingCreditPack[] = [
description: "Burst top-up (200 credits ≈ 100 AI products)",
descriptionKey: "pricing.pack.medium.desc",
credits: 200,
priceUSD: 149,
priceEUR: 149,
aiProducts: 100
},
{
@@ -52,7 +52,7 @@ export const CREDIT_PACKS: MarketingCreditPack[] = [
description: "Mid buffer (500 credits ≈ 250 AI products)",
descriptionKey: "pricing.pack.large.desc",
credits: 500,
priceUSD: 299,
priceEUR: 299,
aiProducts: 250
},
{
@@ -62,7 +62,7 @@ export const CREDIT_PACKS: MarketingCreditPack[] = [
description: "Catalog / re-run buffer (1,200 credits ≈ 600 AI products)",
descriptionKey: "pricing.pack.xl.desc",
credits: 1200,
priceUSD: 599,
priceEUR: 599,
aiProducts: 600
},
{
@@ -72,7 +72,7 @@ export const CREDIT_PACKS: MarketingCreditPack[] = [
description: "Large multi-language buffer (3,000 credits ≈ 1,500 AI products)",
descriptionKey: "pricing.pack.xxl.desc",
credits: 3000,
priceUSD: 1299,
priceEUR: 1299,
aiProducts: 1500
},
{
@@ -82,7 +82,7 @@ export const CREDIT_PACKS: MarketingCreditPack[] = [
description: "Distributor / agency burst (8,000 credits ≈ 4,000 AI products)",
descriptionKey: "pricing.pack.mega.desc",
credits: 8000,
priceUSD: 2999,
priceEUR: 2999,
aiProducts: 4000
}
];
@@ -19,7 +19,7 @@ export type PackEstimate = {
pack: MarketingCreditPack;
count: number;
totalCredits: number;
totalUSD: number;
totalEUR: number;
};
export type PlanRecommendation = {
@@ -29,8 +29,8 @@ export type PlanRecommendation = {
creditsNeeded: number;
creditsShortfall: number;
packs: PackEstimate | null;
monthlyListUSD: number;
yearlyMonthlyUSD: number;
monthlyListEUR: number;
yearlyMonthlyEUR: number;
};
export type PlanCalculatorResult = {
@@ -61,13 +61,13 @@ export function estimatePacksForShortfall(shortfall: number): PackEstimate | nul
const count = Math.ceil(shortfall / pack.credits);
if (count <= 0) continue;
const totalCredits = count * pack.credits;
const totalUSD = count * pack.priceUSD;
const totalEUR = count * pack.priceEUR;
if (
!best ||
totalUSD < best.totalUSD ||
(totalUSD === best.totalUSD && count < best.count)
totalEUR < best.totalEUR ||
(totalEUR === best.totalEUR && count < best.count)
) {
best = { pack, count, totalCredits, totalUSD };
best = { pack, count, totalCredits, totalEUR };
}
}
return best;
@@ -86,8 +86,8 @@ function recommendationFor(
creditsNeeded,
creditsShortfall: shortfall,
packs,
monthlyListUSD: plan.pricePerMonth,
yearlyMonthlyUSD: plan.pricePerMonth > 0 ? Math.round(yearly / 12) : 0
monthlyListEUR: plan.pricePerMonth,
yearlyMonthlyEUR: plan.pricePerMonth > 0 ? Math.round(yearly / 12) : 0
};
}
@@ -134,7 +134,7 @@ export function recommendPlans(
// Only offer budget when packs can close AI gap without exceeding ~2 months of
// the price delta vs upgrading (keeps Starter+packs from undercutting A1 badly).
const lowerRec = recommendationFor(lower, creditsNeeded);
const packCost = lowerRec.packs?.totalUSD ?? 0;
const packCost = lowerRec.packs?.totalEUR ?? 0;
const upgradeDelta = fullPlan.pricePerMonth - lower.pricePerMonth;
const packOk = packCost === 0 || packCost <= Math.max(upgradeDelta * 2, 149);
if (packOk || lowerRec.aiComfortable) {
@@ -108,7 +108,7 @@ export interface PricingFaqItem {
* Never include client deals (A1, Merkur trial, …) — those stay admin-only.
*
* Limits are product/SKU- and credit-based (no storage meters on public plans).
* List prices are marketing placeholders; self-serve Checkout uses Stripe Price IDs from env/admin.
* List prices are in EUR; Stripe Checkout requires matching EUR Price IDs from settings/env.
*/
export const PRICING_PLANS: PricingPlan[] = [
{
@@ -689,7 +689,10 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
{/if}
</div>
<div class="hidden w-[130px] shrink-0 items-center px-3 py-2 xl:flex">
{#if product.feed_name}
{#if product.processing_origin === "api" && kind === "processed"}
<span class="mr-1 inline-flex rounded bg-primary/10 px-1.5 py-0.5 text-[11px] font-medium text-primary" title="Processed through the API">API</span>
{/if}
{#if product.feed_name}
<div
class="truncate text-sm"
title={productFeedSyncLabel(product)}
@@ -84,6 +84,7 @@ export type ProductRow = {
/** Category the feed supplied, before categorize assigned one. */
feed_category?: string | null;
status?: string | null;
processing_origin?: "api" | "dashboard" | string | null;
processing_status?: string | null;
raw_product_id?: string | null;
feed_id?: string | number | null;
@@ -90,10 +90,10 @@
{#if plan.customPrice}
<span class="text-4xl font-bold">{i18n.t("pricing.card.custom")}</span>
{:else if isFree}
<span class="text-4xl font-bold">$0</span>
<span class="text-4xl font-bold">€0</span>
<span class="ml-2 text-lg text-text-muted">{i18n.t("pricing.card.forever")}</span>
{:else}
<span class="text-4xl font-bold">${displayPrice}</span>
<span class="text-4xl font-bold">€{displayPrice}</span>
<span class="ml-2 text-lg text-text-muted">/{displayPeriod}</span>
{/if}
</div>
+3 -3
View File
@@ -626,7 +626,7 @@ export const de: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -5266,7 +5266,7 @@ export const de: MessageDict = {
"pricing.faq.credits.q": "Was sind KI-Credits?",
"pricing.faq.credits.a": "KI-Credits zahlen Schritte wie Titel- und Beschreibungsgenerierung. Free enthält 0 KI-Credits — Feeds mappen und Daten bereinigen geht trotzdem. Bezahlte Monatspakete: Starter 150, Plus 500, Growth 1.200, Business 4.000, Scale 8.000. Enterprise enthält ein großes verwaltetes Paket (und eigenen Schlüssel). Ab Growth optional eigener Schlüssel statt verwalteter Credits.",
"pricing.faq.packs.q": "Can I buy extra AI credits?",
"pricing.faq.packs.a": "Yes. One-time packs: Starter $19 / 500 credits, Growth $59 / 2,000, Catalog $199 / 10,000, Scale $599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.packs.a": "Yes. One-time packs: Starter €19 / 500 credits, Growth €59 / 2,000, Catalog €199 / 10,000, Scale €599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.limits.q": "Was passiert bei Produkt- oder Credit-Limit?",
"pricing.faq.limits.a": "Wir warnen rechtzeitig. Am Produktlimit oder ohne KI-Credits pausieren Jobs, die Kapazität brauchen, bis Platz frei wird, der nächste Zyklus kommt oder Sie upgraden.",
"pricing.faq.change.q": "Kann ich up- oder downgraden?",
@@ -5303,7 +5303,7 @@ export const de: MessageDict = {
"pricing.card.forever": "für immer",
"pricing.card.perMonth": "Monat",
"pricing.card.perYear": "Jahr",
"pricing.card.savePerMonth": "${amount}/Monat sparen",
"pricing.card.savePerMonth": "€{amount}/Monat sparen",
"pricing.card.discountBadge": "-20 %",
"pricing.card.unlimitedSkus": "Unbegrenzte SKUs",
"pricing.card.oneMSkus": "1M+ SKUs",
+7 -7
View File
@@ -812,7 +812,7 @@ export const en: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -1130,11 +1130,11 @@ export const en: MessageDict = {
"Stripe mode for this sync: {mode}. Switch the secret key (sk_test_ vs sk_live_) to sync the other environment.",
"admin.settings.syncCreditPacksFailed":
"Could not sync credit packs to Stripe.",
"admin.settings.pricePackSmall": "Starter pack (65 credits / $59) price ID",
"admin.settings.pricePackMedium": "Plus pack (200 credits / $149) price ID",
"admin.settings.pricePackSmall": "Starter pack (65 credits / €59) price ID",
"admin.settings.pricePackMedium": "Plus pack (200 credits / €149) price ID",
"admin.settings.pricePackLarge":
"Catalog pack (1,200 credits / $599) price ID",
"admin.settings.pricePackXL": "Scale pack (8,000 credits / $2,999) price ID",
"Catalog pack (1,200 credits / €599) price ID",
"admin.settings.pricePackXL": "Scale pack (8,000 credits / €2,999) price ID",
"admin.settings.feedAllowlist": "Feed private URL allowlist",
"admin.settings.allowlist": "Allowlist",
"admin.settings.platformAdmins": "Platform administrators",
@@ -5739,7 +5739,7 @@ export const en: MessageDict = {
"Connect CSV or XML supplier feeds, map them to your categories and attributes, generate titles and descriptions that match your rules, then export or sync to WooCommerce.",
"seo.pricing.title": "Pricing from Free to Enterprise | Descrybe",
"seo.pricing.description":
"Start free with 50 products and feed mapping. Paid plans start at $49 per month and include AI content, larger SKU limits, export feeds, and store sync.",
"Start free with 50 products and feed mapping. Paid plans start at €49 per month and include AI content, larger SKU limits, export feeds, and store sync.",
"seo.privacy.title": "Privacy Policy | Descrybe",
"seo.privacy.description":
"How Descrybe collects, uses, and protects account data, product catalogs, and supplier feeds when you use our product data platform.",
@@ -6492,7 +6492,7 @@ export const en: MessageDict = {
"pricing.card.forever": "forever",
"pricing.card.perMonth": "month",
"pricing.card.perYear": "year",
"pricing.card.savePerMonth": "Save ${amount}/month",
"pricing.card.savePerMonth": "Save €{amount}/month",
"pricing.card.discountBadge": "-20%",
"pricing.card.unlimitedSkus": "Unlimited SKUs",
"pricing.card.oneMSkus": "1M+ SKUs",
+3 -3
View File
@@ -626,7 +626,7 @@ export const es: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -5275,7 +5275,7 @@ export const es: MessageDict = {
"pricing.faq.credits.q": "¿Qué son los créditos de IA?",
"pricing.faq.credits.a": "Los créditos de IA pagan pasos como generar títulos y descripciones. Free incluye 0 créditos de IA — aún puedes mapear feeds y limpiar datos. Paquetes mensuales de pago: Starter 150, Plus 500, Growth 1.200, Business 4.000, Scale 8.000. Enterprise incluye un paquete gestionado grande (y tu propia clave). Desde Growth puedes usar opcionalmente tu propia clave en lugar de créditos gestionados.",
"pricing.faq.packs.q": "Can I buy extra AI credits?",
"pricing.faq.packs.a": "Yes. One-time packs: Starter $19 / 500 credits, Growth $59 / 2,000, Catalog $199 / 10,000, Scale $599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.packs.a": "Yes. One-time packs: Starter €19 / 500 credits, Growth €59 / 2,000, Catalog €199 / 10,000, Scale €599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.limits.q": "¿Qué pasa si alcanzo el límite de productos o créditos?",
"pricing.faq.limits.a": "Te avisamos al acercarte. Cuando llegues al tope de productos o te quedes sin créditos de IA, los trabajos que necesiten esa capacidad se pausan hasta liberar espacio, esperar el siguiente ciclo o mejorar de plan.",
"pricing.faq.change.q": "¿Puedo subir o bajar de plan?",
@@ -5312,7 +5312,7 @@ export const es: MessageDict = {
"pricing.card.forever": "para siempre",
"pricing.card.perMonth": "mes",
"pricing.card.perYear": "año",
"pricing.card.savePerMonth": "Ahorra ${amount}/mes",
"pricing.card.savePerMonth": "Ahorra €{amount}/mes",
"pricing.card.discountBadge": "-20%",
"pricing.card.unlimitedSkus": "SKU ilimitados",
"pricing.card.oneMSkus": "Más de 1M de SKU",
+3 -3
View File
@@ -626,7 +626,7 @@ export const fr: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -5275,7 +5275,7 @@ export const fr: MessageDict = {
"pricing.faq.credits.q": "Que sont les crédits IA ?",
"pricing.faq.credits.a": "Les crédits IA paient des étapes comme la génération de titres et descriptions. Free inclut 0 crédit IA — vous pouvez quand même mapper des flux et nettoyer les données. Packs mensuels payants : Starter 150, Plus 500, Growth 1 200, Business 4 000, Scale 8 000. Enterprise inclut un large pack géré (et votre propre clé). À partir de Growth, vous pouvez optionnellement utiliser votre propre clé.",
"pricing.faq.packs.q": "Can I buy extra AI credits?",
"pricing.faq.packs.a": "Yes. One-time packs: Starter $19 / 500 credits, Growth $59 / 2,000, Catalog $199 / 10,000, Scale $599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.packs.a": "Yes. One-time packs: Starter €19 / 500 credits, Growth €59 / 2,000, Catalog €199 / 10,000, Scale €599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.limits.q": "Que se passe-t-il si j’atteins la limite produits ou crédits ?",
"pricing.faq.limits.a": "Nous vous prévenons à l’approche. Au plafond produits ou sans crédits IA, les jobs qui en ont besoin se mettent en pause jusqu’à libérer de la capacité, attendre le prochain cycle ou changer d’offre.",
"pricing.faq.change.q": "Puis-je monter ou descendre d’offre ?",
@@ -5312,7 +5312,7 @@ export const fr: MessageDict = {
"pricing.card.forever": "pour toujours",
"pricing.card.perMonth": "mois",
"pricing.card.perYear": "an",
"pricing.card.savePerMonth": "Économisez ${amount}/mois",
"pricing.card.savePerMonth": "Économisez €{amount}/mois",
"pricing.card.discountBadge": "-20 %",
"pricing.card.unlimitedSkus": "SKU illimités",
"pricing.card.oneMSkus": "1 M+ SKU",
+3 -3
View File
@@ -626,7 +626,7 @@ export const it: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -5275,7 +5275,7 @@ export const it: MessageDict = {
"pricing.faq.credits.q": "Cosa sono i crediti AI?",
"pricing.faq.credits.a": "I crediti AI pagano passaggi come la generazione di titoli e descrizioni. Free include 0 crediti AI — puoi comunque mappare i feed e pulire i dati. Pacchetti mensili a pagamento: Starter 150, Plus 500, Growth 1.200, Business 4.000, Scale 8.000. Enterprise include un grande pacchetto gestito (e la tua chiave AI). Da Growth in su puoi opzionalmente usare la tua chiave al posto dei crediti gestiti.",
"pricing.faq.packs.q": "Can I buy extra AI credits?",
"pricing.faq.packs.a": "Yes. One-time packs: Starter $19 / 500 credits, Growth $59 / 2,000, Catalog $199 / 10,000, Scale $599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.packs.a": "Yes. One-time packs: Starter €19 / 500 credits, Growth €59 / 2,000, Catalog €199 / 10,000, Scale €599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.limits.q": "Cosa succede se raggiungo il limite di prodotti o crediti?",
"pricing.faq.limits.a": "Ti avvisiamo quando ti avvicini. Quando raggiungi il tetto prodotti o finisci i crediti AI, i job che richiedono quella capacità si mettono in pausa finché non liberi spazio, aspetti il ciclo successivo o fai upgrade.",
"pricing.faq.change.q": "Posso fare upgrade o downgrade?",
@@ -5312,7 +5312,7 @@ export const it: MessageDict = {
"pricing.card.forever": "per sempre",
"pricing.card.perMonth": "mese",
"pricing.card.perYear": "anno",
"pricing.card.savePerMonth": "Risparmia ${amount}/mese",
"pricing.card.savePerMonth": "Risparmia €{amount}/mese",
"pricing.card.discountBadge": "-20%",
"pricing.card.unlimitedSkus": "SKU illimitati",
"pricing.card.oneMSkus": "Oltre 1M di SKU",
+3 -3
View File
@@ -626,7 +626,7 @@ export const ja: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -5275,7 +5275,7 @@ export const ja: MessageDict = {
"pricing.faq.credits.q": "AIクレジットとは何ですか?",
"pricing.faq.credits.a": "AIクレジットは、タイトルや説明文の生成などのステップに使われます。FreeにはAIクレジットが0含まれます — フィードのマッピングと商品データのクリーンアップは可能です。有料の月次パック:Starter 150、Plus 500、Growth 1,200、Business 4,000、Scale 8,000。Enterpriseには大規模なマネージドパック(および独自のAIキー)が含まれます。Growth以上では、マネージドクレジットの代わりに独自キーでAIを実行することもできますÃLine truncated
"pricing.faq.packs.q": "Can I buy extra AI credits?",
"pricing.faq.packs.a": "Yes. One-time packs: Starter $19 / 500 credits, Growth $59 / 2,000, Catalog $199 / 10,000, Scale $599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.packs.a": "Yes. One-time packs: Starter €19 / 500 credits, Growth €59 / 2,000, Catalog €199 / 10,000, Scale €599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.limits.q": "商品またはクレジット上限に達するとどうなりますか?",
"pricing.faq.limits.a": "近づくと警告します。商品上限に達する、またはAIクレジットが尽きると、その容量が必要なジョブは、空きを確保する、次の請求サイクルを待つ、またはアップグレードするまで一時停止します。",
"pricing.faq.change.q": "アップグレードやダウングレードはできますか?",
@@ -5312,7 +5312,7 @@ export const ja: MessageDict = {
"pricing.card.forever": "ずっと",
"pricing.card.perMonth": "月",
"pricing.card.perYear": "å¹´",
"pricing.card.savePerMonth": "${amount}/月 お得",
"pricing.card.savePerMonth": "€{amount}/月 お得",
"pricing.card.discountBadge": "-20%",
"pricing.card.unlimitedSkus": "SKU無制限",
"pricing.card.oneMSkus": "100万以上のSKU",
+3 -3
View File
@@ -626,7 +626,7 @@ export const nl: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -5275,7 +5275,7 @@ export const nl: MessageDict = {
"pricing.faq.credits.q": "Wat zijn AI-credits?",
"pricing.faq.credits.a": "AI-credits betalen stappen zoals het genereren van titels en beschrijvingen. Free bevat 0 AI-credits — je kunt nog steeds feeds mappen en productdata opschonen. Betaalde maandpakketten: Starter 150, Plus 500, Growth 1.200, Business 4.000, Scale 8.000. Enterprise bevat een groot beheerd pakket (en je eigen AI-sleutel). Vanaf Growth kun je optioneel AI op je eigen sleutel draaien in plaats van beheerde credits.",
"pricing.faq.packs.q": "Can I buy extra AI credits?",
"pricing.faq.packs.a": "Yes. One-time packs: Starter $19 / 500 credits, Growth $59 / 2,000, Catalog $199 / 10,000, Scale $599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.packs.a": "Yes. One-time packs: Starter €19 / 500 credits, Growth €59 / 2,000, Catalog €199 / 10,000, Scale €599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.limits.q": "Wat gebeurt er als ik mijn product- of creditlimiet bereik?",
"pricing.faq.limits.a": "We waarschuwen je wanneer je dichtbij komt. Als je je productplafond bereikt of AI-credits opraken, pauzeren jobs die die capaciteit nodig hebben tot je ruimte vrijmaakt, wacht op de volgende factureringscyclus of upgrade.",
"pricing.faq.change.q": "Kan ik upgraden of downgraden?",
@@ -5312,7 +5312,7 @@ export const nl: MessageDict = {
"pricing.card.forever": "voor altijd",
"pricing.card.perMonth": "maand",
"pricing.card.perYear": "jaar",
"pricing.card.savePerMonth": "Bespaar ${amount}/maand",
"pricing.card.savePerMonth": "Bespaar €{amount}/maand",
"pricing.card.discountBadge": "-20%",
"pricing.card.unlimitedSkus": "Onbeperkte SKU's",
"pricing.card.oneMSkus": "1M+ SKU's",
+3 -3
View File
@@ -626,7 +626,7 @@ export const pl: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -5275,7 +5275,7 @@ export const pl: MessageDict = {
"pricing.faq.credits.q": "Czym sÄ… kredyty AI?",
"pricing.faq.credits.a": "Kredyty AI opłacają kroki takie jak generowanie tytułów i opisów. Free obejmuje 0 kredytów AI — nadal możesz mapować feedy i czyścić dane produktów. Płatne pakiety miesięczne: Starter 150, Plus 500, Growth 1 200, Business 4 000, Scale 8 000. Enterprise obejmuje duży zarządzany pakiet (oraz własny klucz AI). Od Growth w górę możesz opcjonalnie uruchamiać AI na własnym kluczu zamiast zarządzanych kredytów.",
"pricing.faq.packs.q": "Can I buy extra AI credits?",
"pricing.faq.packs.a": "Yes. One-time packs: Starter $19 / 500 credits, Growth $59 / 2,000, Catalog $199 / 10,000, Scale $599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.packs.a": "Yes. One-time packs: Starter €19 / 500 credits, Growth €59 / 2,000, Catalog €199 / 10,000, Scale €599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.limits.q": "Co się stanie, gdy osiągnę limit produktów lub kredytów?",
"pricing.faq.limits.a": "Ostrzegamy, gdy się zbliżasz. Po osiągnięciu limitu produktów lub wyczerpaniu kredytów AI zadania wymagające tej pojemności wstrzymują się, aż zwolnisz miejsce, poczekasz na kolejny cykl rozliczeniowy lub przejdziesz wyżej.",
"pricing.faq.change.q": "Czy mogę przejść wyżej lub niżej?",
@@ -5312,7 +5312,7 @@ export const pl: MessageDict = {
"pricing.card.forever": "na zawsze",
"pricing.card.perMonth": "miesiÄ…c",
"pricing.card.perYear": "rok",
"pricing.card.savePerMonth": "Oszczędź ${amount}/mies.",
"pricing.card.savePerMonth": "OszczÄ™dź €{amount}/mies.",
"pricing.card.discountBadge": "-20%",
"pricing.card.unlimitedSkus": "Bez limitu SKU",
"pricing.card.oneMSkus": "1 mln+ SKU",
+3 -3
View File
@@ -626,7 +626,7 @@ export const pt: MessageDict = {
"admin.sales.monthlyCredits": "Monthly AI credits",
"admin.sales.maxProducts": "Max SKUs",
"admin.sales.unlimitedHint": "Leave blank for unlimited",
"admin.sales.totalUsd": "Total price (USD)",
"admin.sales.totalUsd": "Total price (EUR)",
"admin.sales.termMonths": "Term (months)",
"admin.sales.installmentCount": "Installments",
"admin.sales.installmentInterval": "Interval",
@@ -5275,7 +5275,7 @@ export const pt: MessageDict = {
"pricing.faq.credits.q": "O que são créditos de IA?",
"pricing.faq.credits.a": "Os créditos de IA pagam passos como gerar títulos e descrições. O Free inclui 0 créditos de IA — ainda pode mapear feeds e limpar dados. Pacotes mensais pagos: Starter 150, Plus 500, Growth 1.200, Business 4.000, Scale 8.000. O Enterprise inclui um grande pacote gerido (e a sua própria chave). A partir do Growth, pode opcionalmente usar a sua chave em vez dos créditos geridos.",
"pricing.faq.packs.q": "Can I buy extra AI credits?",
"pricing.faq.packs.a": "Yes. One-time packs: Starter $19 / 500 credits, Growth $59 / 2,000, Catalog $199 / 10,000, Scale $599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.packs.a": "Yes. One-time packs: Starter €19 / 500 credits, Growth €59 / 2,000, Catalog €199 / 10,000, Scale €599 / 40,000. Buy from Billing after you have a paid plan (or Free with leftover trial credits). Packs do not change your SKU or feed limits.",
"pricing.faq.limits.q": "O que acontece se atingir o limite de produtos ou créditos?",
"pricing.faq.limits.a": "Avisamos quando se aproximar. Quando atingir o teto de produtos ou ficar sem créditos de IA, os trabalhos que precisam dessa capacidade pausam até libertar espaço, esperar o ciclo seguinte ou fazer upgrade.",
"pricing.faq.change.q": "Posso fazer upgrade ou downgrade?",
@@ -5312,7 +5312,7 @@ export const pt: MessageDict = {
"pricing.card.forever": "para sempre",
"pricing.card.perMonth": "mês",
"pricing.card.perYear": "ano",
"pricing.card.savePerMonth": "Poupe ${amount}/mês",
"pricing.card.savePerMonth": "Poupe €{amount}/mês",
"pricing.card.discountBadge": "-20%",
"pricing.card.unlimitedSkus": "SKUs ilimitados",
"pricing.card.oneMSkus": "Mais de 1M de SKUs",
+18
View File
@@ -0,0 +1,18 @@
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { PRICING_PLANS } from './components/pricing/pricing-data.ts';
import { CREDIT_PACKS } from './components/pricing/credit-packs.ts';
import { buildCreditPackEcommerce, buildSubscriptionEcommerce } from './analytics/ecommerce.ts';
describe('EUR pricing', () => {
it('uses the approved numeric ladder as EUR list prices', () => {
assert.deepEqual(PRICING_PLANS.filter(p => !p.customPrice).map(p => [p.name, p.pricePerMonth]), [
['Free', 0], ['Starter', 49], ['Plus', 199], ['Growth', 299], ['Business', 499], ['Scale', 999]
]);
});
it('tracks subscriptions and top-ups in EUR', () => {
assert.equal(buildSubscriptionEcommerce('business').ecommerce.currency, 'EUR');
assert.equal(buildCreditPackEcommerce('tiny').ecommerce.currency, 'EUR');
assert.equal(CREDIT_PACKS[0]?.priceEUR, 29);
});
});
+1 -1
View File
@@ -28,7 +28,7 @@ export const HOME_SEO: PageSeo = {
export const PRICING_SEO: PageSeo = {
title: "Pricing: Free, Starter, Growth, Business | Descrybe",
description:
"Start free with 100 products and feed mapping. Paid plans add AI titles and descriptions, more SKUs, export feeds, and WooCommerce sync from $49/month. Enterprise supports unlimited catalogs.",
"Start free with 100 products and feed mapping. Paid plans add AI titles and descriptions, more SKUs, export feeds, and WooCommerce sync from €49/month. Enterprise supports unlimited catalogs.",
path: "/pricing",
image: DEFAULT_OG_IMAGE,
imageAlt: DEFAULT_OG_IMAGE_ALT
+2 -2
View File
@@ -76,7 +76,7 @@ export type CreditPack = {
name: string;
description: string;
credits: number;
price_usd: number;
price_eur: number;
ai_products: number;
};
@@ -98,7 +98,7 @@ export async function startCreditPackCheckout(packId: string): Promise<CheckoutR
}
const marketing = CREDIT_PACKS.find((p) => p.id === pack);
const { ecommerce, extra } = buildCreditPackEcommerce(pack, {
priceUsd: marketing?.priceUSD,
priceEur: marketing?.priceEUR,
itemName: marketing?.name
});
trackEcommerceEvent("begin_checkout", ecommerce, extra);
@@ -145,6 +145,69 @@
let accessDenied = $state(false);
let error = $state("");
let days = $state(30);
type AICostRow = {
id?: string;
label?: string;
calls?: number;
prompt_tokens?: number;
cached_prompt_tokens?: number;
completion_tokens?: number;
total_tokens?: number;
cost_micros?: number;
};
type AICostReport = {
totals?: AICostRow;
by_company?: AICostRow[];
};
type CreditCostRule = {
scope: string;
id: string;
feature: string;
cost_per_unit: number;
};
let aiCost = $state<AICostReport | null>(null);
let fxRate = $state("");
let costRules = $state<CreditCostRule[]>([]);
let priceScope = $state("company");
let priceOwner = $state("");
let priceFeature = $state("product_processing");
let priceCredits = $state("2");
let pricingMessage = $state("");
let pricingSaving = $state(false);
function usd(micros?: number): string {
return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(Number(micros ?? 0) / 1000000);
}
function euroEstimate(micros?: number): string {
const rate = Number(fxRate);
if (!fxRate || !Number.isFinite(rate) || rate <= 0 || rate > 2) return "Set a USD→EUR rate";
return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(Number(micros ?? 0) / 1000000 * rate);
}
async function refreshCostRules() {
try {
const result = await api<{ rules: CreditCostRule[] }>("/api/admin/processing-costs");
costRules = result.rules ?? [];
} catch { costRules = []; }
}
async function saveProcessingCost() {
pricingMessage = "";
const creditCost = Number(priceCredits);
if (!priceOwner.trim() || !Number.isInteger(creditCost) || creditCost < 1 || creditCost > 1000000) {
pricingMessage = "Select a plan/company and enter a positive integer credit amount.";
return;
}
pricingSaving = true;
try {
await api("/api/admin/processing-costs", {
method: "PUT",
body: { scope: priceScope, id: priceOwner, feature: priceFeature, cost_per_unit: creditCost }
});
pricingMessage = "Saved. This rate applies to future processing, not past credits.";
await refreshCostRules();
} catch (err) { pricingMessage = failureMessage(err, "Could not save credit rate"); }
finally { pricingSaving = false; }
}
let data = $state<AnalyticsResponse | null>(null);
const tokenPoints = $derived(
@@ -224,7 +287,7 @@
loading = false;
return;
}
await load(days);
await Promise.all([load(days), refreshCostRules()]);
});
async function load(nextDays: number) {
@@ -232,7 +295,12 @@
error = "";
days = nextDays;
try {
data = await api<AnalyticsResponse>(`/api/admin/analytics?days=${nextDays}`);
const [analytics, costs] = await Promise.all([
api<AnalyticsResponse>(`/api/admin/analytics?days=${nextDays}`),
api<AICostReport>(`/api/admin/ai-costs?days=${nextDays}`).catch(() => null)
]);
data = analytics;
aiCost = costs;
} catch (err) {
error = failureMessage(err, i18n.t("flash.admin.analyticsLoadFailed"));
data = null;
@@ -286,7 +354,65 @@
{:else if error && !data}
<Alert message={error} />
{:else if data}
<div class="space-y-8">
<div class="space-y-8">
<section class="space-y-3 rounded-lg border border-border bg-card p-4">
<div class="flex flex-wrap justify-between items-center gap-3">
<div>
<h2 class="font-semibold">AI provider costs and credit usage</h2>
<p class="text-xs text-muted-foreground">Actual logged model calls; this is operating cost, not the customer's invoice amount.</p>
</div>
<a href={`/api/admin/ai-costs/export?days=${days}`} class="rounded-md border px-3 py-2 text-sm">Export AI costs CSV</a>
</div>
<div class="grid grid-cols-2 gap-4 md:grid-cols-4 text-sm">
<div><p class="text-muted-foreground">Input tokens</p><strong>{formatCredits(aiCost?.totals?.prompt_tokens ?? 0)}</strong></div>
<div><p class="text-muted-foreground">Output tokens</p><strong>{formatCredits(aiCost?.totals?.completion_tokens ?? 0)}</strong></div>
<div><p class="text-muted-foreground">Model calls</p><strong>{formatCredits(aiCost?.totals?.calls ?? 0)}</strong></div>
<div><p class="text-muted-foreground">Provider operating cost</p><strong>{usd(aiCost?.totals?.cost_micros)}</strong></div>
</div>
<div class="flex flex-wrap items-center gap-3 text-sm">
<label for="analytics-fx">USD → EUR exchange rate (for estimates)</label>
<input id="analytics-fx" type="text" inputmode="decimal" placeholder="Enter verified rate" bind:value={fxRate} class="w-44 rounded border bg-background p-2" />
<strong>{euroEstimate(aiCost?.totals?.cost_micros)}</strong>
</div>
<p class="text-xs text-muted-foreground">Credits used (all-time wallet): {formatCredits(data.summary.credits_used)}. Subscription charges are separate and are sourced from Stripe invoices. USD costs are historical ledger snapshots; EUR is an estimate using the rate entered above.</p>
{#if aiCost?.by_company?.length}
<div class="overflow-x-auto">
<table class="w-full text-left text-sm">
<thead><tr class="border-b"><th class="p-2">Company</th><th class="p-2 text-right">Input</th><th class="p-2 text-right">Output</th><th class="p-2 text-right">USD cost</th><th class="p-2 text-right">EUR estimate</th></tr></thead>
<tbody>
{#each aiCost?.by_company ?? [] as company (company.id)}
<tr class="border-b"><td class="p-2">{company.label || company.id}</td><td class="p-2 text-right">{formatCredits(company.prompt_tokens ?? 0)}</td><td class="p-2 text-right">{formatCredits(company.completion_tokens ?? 0)}</td><td class="p-2 text-right">{usd(company.cost_micros)}</td><td class="p-2 text-right">{euroEstimate(company.cost_micros)}</td></tr>
{/each}
</tbody>
</table>
</div>
{/if}
</section>
<section class="space-y-3 rounded-lg border border-border bg-card p-4">
<h2 class="font-semibold">Processing credit rules</h2>
<p class="text-xs text-muted-foreground">Company overrides take priority over plan overrides and platform defaults. Values are credits, not euros. For A1, select company and its UUID.</p>
<div class="flex flex-wrap gap-2 items-center">
<select aria-label="Pricing scope" bind:value={priceScope} class="rounded-md border bg-background p-2 text-sm"><option value="company">Company</option><option value="plan">Plan</option></select>
{#if priceScope === "company"}
<input aria-label="Company UUID" list="billing-company-ids" placeholder="Company UUID" bind:value={priceOwner} class="w-72 rounded-md border bg-background p-2 text-sm" />
<datalist id="billing-company-ids">{#each data.companies as c (c.id)}<option value={c.id}>{c.name}</option>{/each}</datalist>
{:else}
<input aria-label="Plan numeric ID" type="text" inputmode="numeric" placeholder="Plan ID" bind:value={priceOwner} class="w-28 rounded border bg-background p-2 text-sm" />
{/if}
<select aria-label="Feature" bind:value={priceFeature} class="rounded border bg-background p-2 text-sm"><option value="product_processing">Product base</option><option value="openai_token_k">Per 1K model tokens</option><option value="seo_meta_ai">SEO meta</option><option value="campaign_copy">Campaign</option></select>
<input aria-label="Credit cost" type="text" inputmode="numeric" bind:value={priceCredits} class="w-24 rounded border bg-background p-2 text-sm" />
<Button onclick={() => saveProcessingCost()} disabled={pricingSaving}>Save rate</Button>
{#if priceScope === "company" && priceOwner.trim()}
<a href={`/api/admin/billing/invoices/export?company_id=${encodeURIComponent(priceOwner)}`} class="rounded border px-3 py-2 text-sm">Export Stripe invoices</a>
{/if}
</div>
{#if pricingMessage}<p class="text-xs">{pricingMessage}</p>{/if}
<div class="flex flex-wrap gap-2 text-xs text-muted-foreground">
{#each costRules as rule (`${rule.scope}:${rule.id}:${rule.feature}`)}
<span class="rounded border p-1">{rule.scope} {rule.id || 'default'} · {rule.feature}: {rule.cost_per_unit} credits</span>
{/each}
</div>
</section>
{#if error}
<Alert message={error} />
{/if}
@@ -118,7 +118,7 @@
plan_name: planName.trim() || "Custom Deal",
monthly_credits: credits,
max_products: maxP != null && Number.isFinite(maxP) ? maxP : null,
currency: "usd",
currency: "eur",
total_amount_cents: totalCents,
installment_count: count,
installment_interval: installmentInterval,
@@ -162,7 +162,7 @@
function money(cents: number, currency: string): string {
return new Intl.NumberFormat(undefined, {
style: "currency",
currency: (currency || "usd").toUpperCase()
currency: (currency || "eur").toUpperCase()
}).format(cents / 100);
}
@@ -1287,7 +1287,7 @@
{#each CREDIT_PACKS as pack (pack.id)}
<div class="space-y-2">
<Label for={"price_pack_" + pack.id}>
{pack.name} ({pack.credits} credits ≈ {pack.aiProducts} AI / ${pack.priceUSD})
{pack.name} ({pack.credits} credits ≈ {pack.aiProducts} AI / €{pack.priceEUR})
</Label>
<Input
id={"price_pack_" + pack.id}
+67 -1
View File
@@ -79,6 +79,10 @@
products_processed?: number;
products_total?: number;
tokens?: number;
input_tokens?: number;
cached_input_tokens?: number;
output_tokens?: number;
ai_calls?: number;
feeds_input?: number;
feeds_export?: number;
jobs_total?: number;
@@ -88,6 +92,19 @@
notes?: string[];
};
type StripeInvoice = {
id: string;
number: string;
status: string;
currency: string;
created: number;
amount_due: number;
amount_paid: number;
hosted_invoice_url?: string;
invoice_pdf?: string;
};
let invoices = $state<StripeInvoice[]>([]);
let credits = $state<CreditBalance | null>(null);
let usage = $state<UsageSummary | null>(null);
let stripe = $state<StripeStatus | null>(null);
@@ -122,6 +139,10 @@
credits = creditsRes;
usage = usageRes;
stripe = stripeRes;
if (canManageBilling) {
const result = await api<{ invoices: StripeInvoice[] }>("/api/billing/invoices").catch(() => ({ invoices: [] }));
invoices = result.invoices ?? [];
}
const checkout = page.url.searchParams.get("checkout");
const portal = page.url.searchParams.get("portal");
@@ -304,6 +325,12 @@
Boolean(stripe && (stripe.has_customer || stripe.has_subscription || stripe.mock))
);
function invoiceAmount(amount: number, currency: string): string {
const code = String(currency || "eur").toUpperCase();
const major = ["JPY", "KRW"].includes(code) ? amount : amount / 100;
return new Intl.NumberFormat(undefined, { style: "currency", currency: code }).format(major);
}
function formatContractDate(value: string | Date | null | undefined): string {
if (!value) return i18n.t("billing.na");
const d = value instanceof Date ? value : new Date(value);
@@ -638,7 +665,7 @@
<p class="text-sm font-medium text-foreground">{i18n.t(pack.nameKey)}</p>
<p class="text-xs text-muted-foreground">{i18n.t(pack.descriptionKey)}</p>
</div>
<p class="shrink-0 text-sm font-semibold tabular-nums">${pack.priceUSD}</p>
<p class="shrink-0 text-sm font-semibold tabular-nums">€{pack.priceEUR}</p>
</div>
<p class="text-xs text-muted-foreground">
{i18n.t("billing.packCredits", { credits: pack.credits.toLocaleString() })}
@@ -660,6 +687,45 @@
</section>
{/if}
<section class="rounded-lg border border-border bg-card p-4 space-y-3">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<h2 class="font-semibold">AI usage and billing documents</h2>
<p class="text-xs text-muted-foreground">Actual recorded provider usage; wallet credits are all-time, not limited by this date range.</p>
</div>
<a href={`/api/billing/usage/export?range=${dateRangeOption}`} class={buttonClasses("outline", "sm", "")}>Export usage CSV</a>
</div>
<div class="grid grid-cols-2 gap-3 text-sm md:grid-cols-4">
<div><p class="text-muted-foreground">Model calls</p><b>{formatCredits(usage?.ai_calls ?? 0)}</b></div>
<div><p class="text-muted-foreground">Input tokens</p><b>{formatCredits(usage?.input_tokens ?? 0)}</b></div>
<div><p class="text-muted-foreground">Output tokens</p><b>{formatCredits(usage?.output_tokens ?? 0)}</b></div>
<div><p class="text-muted-foreground">Cached input</p><b>{formatCredits(usage?.cached_input_tokens ?? 0)}</b></div>
</div>
{#if canManageBilling}
<div class="border-t pt-3 space-y-2">
<div class="flex flex-wrap items-center justify-between gap-2">
<b class="text-sm">Invoices from Stripe</b>
{#if showPortal}
<Button variant="outline" loading={portalBusy} onclick={() => void manageSubscription()}>Open billing portal</Button>
{/if}
</div>
{#if invoices.length > 0}
{#each invoices as invoice (invoice.id)}
<div class="flex flex-wrap items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm">
<div><b>{invoice.number || invoice.id}</b> · {invoice.status} · Due: {invoiceAmount(invoice.amount_due, invoice.currency)} · Paid: {invoiceAmount(invoice.amount_paid, invoice.currency)}</div>
<div class="flex gap-3">
{#if invoice.hosted_invoice_url}<a class="underline" target="_blank" rel="noopener noreferrer" href={invoice.hosted_invoice_url}>View invoice</a>{/if}
{#if invoice.invoice_pdf}<a class="underline" target="_blank" rel="noopener noreferrer" href={invoice.invoice_pdf}>PDF</a>{/if}
</div>
</div>
{/each}
{:else}
<p class="text-xs text-muted-foreground">No Stripe invoices found. Manual contracts and mock checkouts do not create a Stripe invoice.</p>
{/if}
</div>
{/if}
</section>
<section class="space-y-3">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
+2 -2
View File
@@ -317,10 +317,10 @@
{#if row.customPrice}
<span class="text-4xl font-bold">{i18n.t("plans.price.custom")}</span>
{:else if row.price === 0}
<span class="text-4xl font-bold">$0</span>
<span class="text-4xl font-bold">€0</span>
<span class="ml-2 text-muted-foreground">{i18n.t("plans.price.forever")}</span>
{:else if row.price != null}
<span class="text-4xl font-bold">${row.price}</span>
<span class="text-4xl font-bold">€{row.price}</span>
<span class="ml-2 text-muted-foreground">{i18n.t("plans.price.perMonth")}</span>
{:else}
<span class="text-2xl font-bold text-muted-foreground"
+1 -9
View File
@@ -39,7 +39,6 @@
import UpgradeBanner from "$lib/components/UpgradeBanner.svelte";
import { Button, Card, CardHeader } from "$lib/components/ui";
import ProductTabs from "$lib/components/products/ProductTabs.svelte";
import RemoteCatalogImport from "$lib/components/feeds/RemoteCatalogImport.svelte";
import ProductSearchFilters from "$lib/components/products/ProductSearchFilters.svelte";
import ProductTable from "$lib/components/products/ProductTable.svelte";
import ProductEmptyState from "$lib/components/products/ProductEmptyState.svelte";
@@ -1299,14 +1298,7 @@
/>
{/if}
{#if canAdmin}
<details class="mb-4 rounded-md border border-border bg-card p-3">
<summary class="cursor-pointer text-sm font-medium">Import products from a JSON URL</summary>
<div class="mt-3">
<RemoteCatalogImport kind="products" onComplete={async () => { await loadProducts(); }} />
</div>
</details>
{/if}
<Card
class={`min-w-0 overflow-x-auto border-border shadow-sm transition-all duration-300 ${fetching ? "bg-background/20 backdrop-blur-sm" : ""}`}
>