409 lines
12 KiB
TypeScript
409 lines
12 KiB
TypeScript
/**
|
|
* Admin commercial registry surface map — API path bindings only.
|
|
* Not a product/plan/bundle catalog: rows always load from Core Commercial APIs.
|
|
*/
|
|
|
|
export type CommercialAdminResourceKey =
|
|
| "products"
|
|
| "bundles"
|
|
| "pricing"
|
|
| "plans"
|
|
| "trial-rules"
|
|
| "subscription-templates"
|
|
| "capabilities"
|
|
| "policies"
|
|
| "extensions"
|
|
| "assets"
|
|
| "automation-packs"
|
|
| "metadata"
|
|
| "business-types"
|
|
| "recommendation-rules"
|
|
| "announcements"
|
|
| "promotions"
|
|
| "coupons"
|
|
| "discount-campaigns"
|
|
| "regional-pricing"
|
|
| "taxes"
|
|
| "currencies"
|
|
| "languages"
|
|
| "marketplace-visibility"
|
|
| "release-channels"
|
|
| "support-levels"
|
|
| "subscriptions"
|
|
| "licenses"
|
|
| "entitlements"
|
|
| "activation-logs"
|
|
| "invoices"
|
|
| "transactions";
|
|
|
|
export interface CommercialAdminResourceDef {
|
|
key: CommercialAdminResourceKey;
|
|
label: string;
|
|
description: string;
|
|
/** Core Commercial API collection path */
|
|
listPath: string;
|
|
createPath: string;
|
|
/** Item code/id field for display + PATCH/DELETE */
|
|
codeField: string;
|
|
nameField: string;
|
|
/** Envelope keys for list extraction */
|
|
envelopeKeys: string[];
|
|
group:
|
|
| "catalog"
|
|
| "commerce"
|
|
| "governance"
|
|
| "ops"
|
|
| "localization"
|
|
| "tenant";
|
|
}
|
|
|
|
export const COMMERCIAL_ADMIN_RESOURCES: CommercialAdminResourceDef[] = [
|
|
{
|
|
key: "products",
|
|
label: "محصولات",
|
|
description: "Product registry — visibility, default_route, launch_strategy",
|
|
listPath: "/api/v1/commercial/products",
|
|
createPath: "/api/v1/commercial/products",
|
|
codeField: "product_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "products"],
|
|
group: "catalog",
|
|
},
|
|
{
|
|
key: "bundles",
|
|
label: "باندلها",
|
|
description: "Business bundles — pricing_refs only",
|
|
listPath: "/api/v1/commercial/bundles",
|
|
createPath: "/api/v1/commercial/bundles",
|
|
codeField: "bundle_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "bundles"],
|
|
group: "catalog",
|
|
},
|
|
{
|
|
key: "pricing",
|
|
label: "قیمتگذاری",
|
|
description: "Pricing catalog items",
|
|
listPath: "/api/v1/commercial/pricing",
|
|
createPath: "/api/v1/commercial/pricing",
|
|
codeField: "pricing_item_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "pricing"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "plans",
|
|
label: "پلنها",
|
|
description: "Subscription plans (commercial registry)",
|
|
listPath: "/api/v1/commercial/plans",
|
|
createPath: "/api/v1/commercial/plans",
|
|
codeField: "plan_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "plans"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "trial-rules",
|
|
label: "قوانین Trial",
|
|
description: "Trial duration, limits, grace, auto-disable",
|
|
listPath: "/api/v1/commercial/trial-rules",
|
|
createPath: "/api/v1/commercial/trial-rules",
|
|
codeField: "trial_rule_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "trial_rules"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "subscription-templates",
|
|
label: "قالب اشتراک",
|
|
description: "Subscription templates / renewals",
|
|
listPath: "/api/v1/commercial/subscription-templates",
|
|
createPath: "/api/v1/commercial/subscription-templates",
|
|
codeField: "template_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "templates", "subscription_templates"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "capabilities",
|
|
label: "قابلیتها",
|
|
description: "Capability registry",
|
|
listPath: "/api/v1/commercial/capabilities",
|
|
createPath: "/api/v1/commercial/capabilities",
|
|
codeField: "capability_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "capabilities"],
|
|
group: "catalog",
|
|
},
|
|
{
|
|
key: "policies",
|
|
label: "سیاستها",
|
|
description: "Domain and commercial policies",
|
|
listPath: "/api/v1/commercial/policies",
|
|
createPath: "/api/v1/commercial/policies",
|
|
codeField: "policy_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "policies"],
|
|
group: "governance",
|
|
},
|
|
{
|
|
key: "extensions",
|
|
label: "افزونهها",
|
|
description: "Extension registry",
|
|
listPath: "/api/v1/commercial/extensions",
|
|
createPath: "/api/v1/commercial/extensions",
|
|
codeField: "extension_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "extensions"],
|
|
group: "catalog",
|
|
},
|
|
{
|
|
key: "assets",
|
|
label: "داراییها",
|
|
description: "Asset registry",
|
|
listPath: "/api/v1/commercial/assets",
|
|
createPath: "/api/v1/commercial/assets",
|
|
codeField: "asset_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "assets"],
|
|
group: "catalog",
|
|
},
|
|
{
|
|
key: "automation-packs",
|
|
label: "اتوماسیون",
|
|
description: "Automation packs catalog",
|
|
listPath: "/api/v1/commercial/automation-packs",
|
|
createPath: "/api/v1/commercial/automation-packs",
|
|
codeField: "automation_pack_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "automation_packs", "packs"],
|
|
group: "catalog",
|
|
},
|
|
{
|
|
key: "metadata",
|
|
label: "Metadata",
|
|
description: "Unlimited metadata bags",
|
|
listPath: "/api/v1/commercial/metadata",
|
|
createPath: "/api/v1/commercial/metadata",
|
|
codeField: "registry_object_id",
|
|
nameField: "target_kind",
|
|
envelopeKeys: ["items", "bags", "metadata"],
|
|
group: "governance",
|
|
},
|
|
{
|
|
key: "business-types",
|
|
label: "انواع کسبوکار",
|
|
description: "Business type catalog",
|
|
listPath: "/api/v1/commercial/business-types",
|
|
createPath: "/api/v1/commercial/business-types",
|
|
codeField: "business_type_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "business_types"],
|
|
group: "catalog",
|
|
},
|
|
{
|
|
key: "recommendation-rules",
|
|
label: "قوانین پیشنهاد",
|
|
description: "Recommendation rules + simulator target",
|
|
listPath: "/api/v1/commercial/recommendation-rules",
|
|
createPath: "/api/v1/commercial/recommendation-rules",
|
|
codeField: "rule_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "rules"],
|
|
group: "governance",
|
|
},
|
|
{
|
|
key: "announcements",
|
|
label: "اعلانهای تجاری",
|
|
description: "Commercial announcements",
|
|
listPath: "/api/v1/commercial/announcements",
|
|
createPath: "/api/v1/commercial/announcements",
|
|
codeField: "announcement_code",
|
|
nameField: "title",
|
|
envelopeKeys: ["items", "announcements"],
|
|
group: "ops",
|
|
},
|
|
{
|
|
key: "promotions",
|
|
label: "پروموشن",
|
|
description: "Promotions",
|
|
listPath: "/api/v1/commercial/promotions",
|
|
createPath: "/api/v1/commercial/promotions",
|
|
codeField: "promotion_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "promotions"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "coupons",
|
|
label: "کوپن",
|
|
description: "Coupons",
|
|
listPath: "/api/v1/commercial/coupons",
|
|
createPath: "/api/v1/commercial/coupons",
|
|
codeField: "coupon_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "coupons"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "discount-campaigns",
|
|
label: "کمپین تخفیف",
|
|
description: "Discount campaigns",
|
|
listPath: "/api/v1/commercial/discount-campaigns",
|
|
createPath: "/api/v1/commercial/discount-campaigns",
|
|
codeField: "campaign_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "campaigns", "discount_campaigns"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "regional-pricing",
|
|
label: "قیمت منطقهای",
|
|
description: "Regional pricing overlays",
|
|
listPath: "/api/v1/commercial/regional-pricing",
|
|
createPath: "/api/v1/commercial/regional-pricing",
|
|
codeField: "regional_pricing_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "regional_pricing"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "taxes",
|
|
label: "مالیات",
|
|
description: "Tax classes",
|
|
listPath: "/api/v1/commercial/taxes",
|
|
createPath: "/api/v1/commercial/taxes",
|
|
codeField: "tax_class_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "taxes"],
|
|
group: "commerce",
|
|
},
|
|
{
|
|
key: "currencies",
|
|
label: "ارزها",
|
|
description: "Currency registry",
|
|
listPath: "/api/v1/commercial/currencies",
|
|
createPath: "/api/v1/commercial/currencies",
|
|
codeField: "currency_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "currencies"],
|
|
group: "localization",
|
|
},
|
|
{
|
|
key: "languages",
|
|
label: "زبانها",
|
|
description: "Language registry",
|
|
listPath: "/api/v1/commercial/languages",
|
|
createPath: "/api/v1/commercial/languages",
|
|
codeField: "language_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "languages"],
|
|
group: "localization",
|
|
},
|
|
{
|
|
key: "marketplace-visibility",
|
|
label: "بازار / Visibility",
|
|
description: "Marketplace visibility flags",
|
|
listPath: "/api/v1/commercial/marketplace-visibility",
|
|
createPath: "/api/v1/commercial/marketplace-visibility",
|
|
codeField: "visibility_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "visibility"],
|
|
group: "ops",
|
|
},
|
|
{
|
|
key: "release-channels",
|
|
label: "کانال انتشار",
|
|
description: "Release channels",
|
|
listPath: "/api/v1/commercial/release-channels",
|
|
createPath: "/api/v1/commercial/release-channels",
|
|
codeField: "channel_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "channels"],
|
|
group: "ops",
|
|
},
|
|
{
|
|
key: "support-levels",
|
|
label: "سطح پشتیبانی",
|
|
description: "Support levels",
|
|
listPath: "/api/v1/commercial/support-levels",
|
|
createPath: "/api/v1/commercial/support-levels",
|
|
codeField: "support_level_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "support_levels"],
|
|
group: "ops",
|
|
},
|
|
{
|
|
key: "subscriptions",
|
|
label: "اشتراکها",
|
|
description: "Tenant subscriptions",
|
|
listPath: "/api/v1/commercial/subscriptions",
|
|
createPath: "/api/v1/commercial/subscriptions",
|
|
codeField: "id",
|
|
nameField: "tenant_id",
|
|
envelopeKeys: ["items", "subscriptions"],
|
|
group: "tenant",
|
|
},
|
|
{
|
|
key: "licenses",
|
|
label: "لایسنسها",
|
|
description: "Licenses",
|
|
listPath: "/api/v1/commercial/licenses",
|
|
createPath: "/api/v1/commercial/licenses",
|
|
codeField: "license_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "licenses"],
|
|
group: "tenant",
|
|
},
|
|
{
|
|
key: "entitlements",
|
|
label: "Entitlements",
|
|
description: "Entitlement projections",
|
|
listPath: "/api/v1/commercial/entitlements",
|
|
createPath: "/api/v1/commercial/entitlements",
|
|
codeField: "entitlement_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "entitlements"],
|
|
group: "tenant",
|
|
},
|
|
{
|
|
key: "activation-logs",
|
|
label: "لاگ فعالسازی",
|
|
description: "Activation pipelines",
|
|
listPath: "/api/v1/commercial/activation-logs",
|
|
createPath: "/api/v1/commercial/activation-logs",
|
|
codeField: "correlation_id",
|
|
nameField: "tenant_id",
|
|
envelopeKeys: ["items", "pipelines", "activation_logs"],
|
|
group: "tenant",
|
|
},
|
|
{
|
|
key: "invoices",
|
|
label: "فاکتورها",
|
|
description: "Commercial invoices (published read models)",
|
|
listPath: "/api/v1/commercial/invoices",
|
|
createPath: "/api/v1/commercial/invoices",
|
|
codeField: "invoice_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "invoices"],
|
|
group: "tenant",
|
|
},
|
|
{
|
|
key: "transactions",
|
|
label: "تراکنشها",
|
|
description: "Payment history read models (no Payment edits)",
|
|
listPath: "/api/v1/commercial/transactions",
|
|
createPath: "/api/v1/commercial/transactions",
|
|
codeField: "transaction_code",
|
|
nameField: "display_name",
|
|
envelopeKeys: ["items", "transactions"],
|
|
group: "tenant",
|
|
},
|
|
];
|
|
|
|
export function getCommercialAdminResource(
|
|
key: string
|
|
): CommercialAdminResourceDef | undefined {
|
|
return COMMERCIAL_ADMIN_RESOURCES.find((r) => r.key === key);
|
|
}
|