Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,318 @@
|
||||
package billing
|
||||
|
||||
// Code generated from docs/plan-permissions/01-feature-keys.json — do not hand-edit keys.
|
||||
|
||||
// FeatureCatalogKeys is the admin-validated registry of dashboard feature keys.
|
||||
var FeatureCatalogKeys = []string{
|
||||
"shell.navigation",
|
||||
"shell.command_palette",
|
||||
"shell.company_switcher",
|
||||
"shell.support_notifications",
|
||||
"shell.tutorial",
|
||||
"shell.account_menu",
|
||||
"shell.billing_recovery_banner",
|
||||
"dashboard.overview",
|
||||
"dashboard.stats",
|
||||
"dashboard.quick_links",
|
||||
"dashboard.recent_jobs",
|
||||
"dashboard.news_feed",
|
||||
"dashboard.activation_checklist",
|
||||
"dashboard.migrated_checklist",
|
||||
"dashboard.etl_gaps",
|
||||
"dashboard.store_reconnect",
|
||||
"dashboard.upgrade_banners",
|
||||
"catalog.products",
|
||||
"catalog.products.tab_processed",
|
||||
"catalog.products.tab_needs_review",
|
||||
"catalog.products.tab_error",
|
||||
"catalog.products.tab_processing",
|
||||
"catalog.products.tab_unprocessed",
|
||||
"catalog.products.process_categories",
|
||||
"catalog.products.process_attributes",
|
||||
"catalog.products.process_ai_titles",
|
||||
"catalog.products.process_ai_descriptions",
|
||||
"catalog.products.enrichment_review",
|
||||
"catalog.products.export_selection",
|
||||
"catalog.products.upgrade_prompt",
|
||||
"catalog.categories",
|
||||
"catalog.categories.title_formula",
|
||||
"catalog.categories.description_formula",
|
||||
"catalog.attributes",
|
||||
"catalog.attributes.bulk_import",
|
||||
"catalog.standard_fields",
|
||||
"catalog.standard_fields.groups",
|
||||
"catalog.structured_descriptions",
|
||||
"catalog.vector_categories",
|
||||
"feeds.list",
|
||||
"feeds.add_url",
|
||||
"feeds.add_csv",
|
||||
"feeds.sync",
|
||||
"feeds.mapping",
|
||||
"feeds.mapping.select_item",
|
||||
"feeds.mapping.map_fields",
|
||||
"feeds.export_feeds",
|
||||
"feeds.export_feeds.create",
|
||||
"feeds.export_feeds.generate",
|
||||
"feeds.uploads",
|
||||
"stores.hub",
|
||||
"stores.woocommerce",
|
||||
"stores.woocommerce.connection",
|
||||
"stores.woocommerce.categories",
|
||||
"stores.woocommerce.attributes",
|
||||
"stores.woocommerce.orders",
|
||||
"stores.woocommerce.reviews",
|
||||
"stores.woocommerce.settings",
|
||||
"stores.shopify",
|
||||
"stores.shopify.connection",
|
||||
"stores.shopify.orders",
|
||||
"stores.shopify.settings",
|
||||
"processing.monitor",
|
||||
"marketing.campaigns",
|
||||
"marketing.campaigns.create",
|
||||
"marketing.campaigns.generate_ai",
|
||||
"marketing.campaigns.send",
|
||||
"marketing.content_calendar",
|
||||
"marketing.brand_kit",
|
||||
"marketing.brand_ai_apply",
|
||||
"marketing.seo",
|
||||
"marketing.seo.template_fill",
|
||||
"marketing.seo.ai_rewrite",
|
||||
"marketing.reviews",
|
||||
"integrations.ai",
|
||||
"integrations.ai.byok",
|
||||
"integrations.email",
|
||||
"integrations.email.test",
|
||||
"integrations.email.blast",
|
||||
"billing.overview",
|
||||
"billing.customer_portal",
|
||||
"billing.quick_upgrade",
|
||||
"billing.plans_compare",
|
||||
"billing.checkout",
|
||||
"settings.profile",
|
||||
"settings.company",
|
||||
"settings.alerts",
|
||||
"settings.api_keys",
|
||||
"settings.team",
|
||||
"settings.team_invite",
|
||||
"support.center",
|
||||
"support.ticket_create",
|
||||
"support.ticket_thread",
|
||||
"capability.sku_cap",
|
||||
"capability.ai_credits",
|
||||
"capability.ai_processing",
|
||||
"capability.eprel",
|
||||
"capability.normalize_specs_fill",
|
||||
"capability.campaign_ai",
|
||||
"capability.email_live_send",
|
||||
"capability.brand_ai_apply",
|
||||
"capability.seo_ai_rewrite",
|
||||
"capability.feed_source_limit",
|
||||
"capability.export_feed_limit",
|
||||
"capability.storage_limit",
|
||||
"capability.api_access",
|
||||
"capability.byok",
|
||||
}
|
||||
|
||||
// FeatureSections are global section master-switch keys.
|
||||
var FeatureSections = []string{
|
||||
"shell",
|
||||
"dashboard",
|
||||
"catalog",
|
||||
"feeds",
|
||||
"stores",
|
||||
"processing",
|
||||
"marketing",
|
||||
"integrations",
|
||||
"billing",
|
||||
"settings",
|
||||
"support",
|
||||
"capabilities",
|
||||
}
|
||||
|
||||
var featureKeySection = map[string]string{
|
||||
"shell.navigation": "shell",
|
||||
"shell.command_palette": "shell",
|
||||
"shell.company_switcher": "shell",
|
||||
"shell.support_notifications": "shell",
|
||||
"shell.tutorial": "shell",
|
||||
"shell.account_menu": "shell",
|
||||
"shell.billing_recovery_banner": "shell",
|
||||
"dashboard.overview": "dashboard",
|
||||
"dashboard.stats": "dashboard",
|
||||
"dashboard.quick_links": "dashboard",
|
||||
"dashboard.recent_jobs": "dashboard",
|
||||
"dashboard.news_feed": "dashboard",
|
||||
"dashboard.activation_checklist": "dashboard",
|
||||
"dashboard.migrated_checklist": "dashboard",
|
||||
"dashboard.etl_gaps": "dashboard",
|
||||
"dashboard.store_reconnect": "dashboard",
|
||||
"dashboard.upgrade_banners": "dashboard",
|
||||
"catalog.products": "catalog",
|
||||
"catalog.products.tab_processed": "catalog",
|
||||
"catalog.products.tab_needs_review": "catalog",
|
||||
"catalog.products.tab_error": "catalog",
|
||||
"catalog.products.tab_processing": "catalog",
|
||||
"catalog.products.tab_unprocessed": "catalog",
|
||||
"catalog.products.process_categories": "catalog",
|
||||
"catalog.products.process_attributes": "catalog",
|
||||
"catalog.products.process_ai_titles": "catalog",
|
||||
"catalog.products.process_ai_descriptions": "catalog",
|
||||
"catalog.products.enrichment_review": "catalog",
|
||||
"catalog.products.export_selection": "catalog",
|
||||
"catalog.products.upgrade_prompt": "catalog",
|
||||
"catalog.categories": "catalog",
|
||||
"catalog.categories.title_formula": "catalog",
|
||||
"catalog.categories.description_formula": "catalog",
|
||||
"catalog.attributes": "catalog",
|
||||
"catalog.attributes.bulk_import": "catalog",
|
||||
"catalog.standard_fields": "catalog",
|
||||
"catalog.standard_fields.groups": "catalog",
|
||||
"catalog.structured_descriptions": "catalog",
|
||||
"catalog.vector_categories": "catalog",
|
||||
"feeds.list": "feeds",
|
||||
"feeds.add_url": "feeds",
|
||||
"feeds.add_csv": "feeds",
|
||||
"feeds.sync": "feeds",
|
||||
"feeds.mapping": "feeds",
|
||||
"feeds.mapping.select_item": "feeds",
|
||||
"feeds.mapping.map_fields": "feeds",
|
||||
"feeds.export_feeds": "feeds",
|
||||
"feeds.export_feeds.create": "feeds",
|
||||
"feeds.export_feeds.generate": "feeds",
|
||||
"feeds.uploads": "feeds",
|
||||
"stores.hub": "stores",
|
||||
"stores.woocommerce": "stores",
|
||||
"stores.woocommerce.connection": "stores",
|
||||
"stores.woocommerce.categories": "stores",
|
||||
"stores.woocommerce.attributes": "stores",
|
||||
"stores.woocommerce.orders": "stores",
|
||||
"stores.woocommerce.reviews": "stores",
|
||||
"stores.woocommerce.settings": "stores",
|
||||
"stores.shopify": "stores",
|
||||
"stores.shopify.connection": "stores",
|
||||
"stores.shopify.orders": "stores",
|
||||
"stores.shopify.settings": "stores",
|
||||
"processing.monitor": "processing",
|
||||
"marketing.campaigns": "marketing",
|
||||
"marketing.campaigns.create": "marketing",
|
||||
"marketing.campaigns.generate_ai": "marketing",
|
||||
"marketing.campaigns.send": "marketing",
|
||||
"marketing.content_calendar": "marketing",
|
||||
"marketing.brand_kit": "marketing",
|
||||
"marketing.brand_ai_apply": "marketing",
|
||||
"marketing.seo": "marketing",
|
||||
"marketing.seo.template_fill": "marketing",
|
||||
"marketing.seo.ai_rewrite": "marketing",
|
||||
"marketing.reviews": "marketing",
|
||||
"integrations.ai": "integrations",
|
||||
"integrations.ai.byok": "integrations",
|
||||
"integrations.email": "integrations",
|
||||
"integrations.email.test": "integrations",
|
||||
"integrations.email.blast": "integrations",
|
||||
"billing.overview": "billing",
|
||||
"billing.customer_portal": "billing",
|
||||
"billing.quick_upgrade": "billing",
|
||||
"billing.plans_compare": "billing",
|
||||
"billing.checkout": "billing",
|
||||
"settings.profile": "settings",
|
||||
"settings.company": "settings",
|
||||
"settings.alerts": "settings",
|
||||
"settings.api_keys": "settings",
|
||||
"settings.team": "settings",
|
||||
"settings.team_invite": "settings",
|
||||
"support.center": "support",
|
||||
"support.ticket_create": "support",
|
||||
"support.ticket_thread": "support",
|
||||
"capability.sku_cap": "capabilities",
|
||||
"capability.ai_credits": "capabilities",
|
||||
"capability.ai_processing": "capabilities",
|
||||
"capability.eprel": "capabilities",
|
||||
"capability.normalize_specs_fill": "capabilities",
|
||||
"capability.campaign_ai": "capabilities",
|
||||
"capability.email_live_send": "capabilities",
|
||||
"capability.brand_ai_apply": "capabilities",
|
||||
"capability.seo_ai_rewrite": "capabilities",
|
||||
"capability.feed_source_limit": "capabilities",
|
||||
"capability.export_feed_limit": "capabilities",
|
||||
"capability.storage_limit": "capabilities",
|
||||
"capability.api_access": "capabilities",
|
||||
"capability.byok": "capabilities",
|
||||
}
|
||||
|
||||
var featureCatalogSet = map[string]struct{}{}
|
||||
|
||||
func init() {
|
||||
for _, k := range FeatureCatalogKeys {
|
||||
featureCatalogSet[k] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// SectionOfFeature returns the section for a registry feature key.
|
||||
func SectionOfFeature(key string) (string, bool) {
|
||||
s, ok := featureKeySection[key]
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// IsKnownFeatureKey reports whether key is in the dashboard feature registry.
|
||||
func IsKnownFeatureKey(key string) bool {
|
||||
_, ok := featureCatalogSet[key]
|
||||
return ok
|
||||
}
|
||||
|
||||
// IsKnownFeatureSection reports whether section is a valid master-switch section.
|
||||
func IsKnownFeatureSection(section string) bool {
|
||||
for _, s := range FeatureSections {
|
||||
if s == section {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func freePlanFeatureOff(key string) bool {
|
||||
switch key {
|
||||
case "capability.ai_processing":
|
||||
return true
|
||||
case "capability.api_access":
|
||||
return true
|
||||
case "capability.brand_ai_apply":
|
||||
return true
|
||||
case "capability.byok":
|
||||
return true
|
||||
case "capability.campaign_ai":
|
||||
return true
|
||||
case "capability.email_live_send":
|
||||
return true
|
||||
case "capability.seo_ai_rewrite":
|
||||
return true
|
||||
case "catalog.products.process_ai_descriptions":
|
||||
return true
|
||||
case "catalog.products.process_ai_titles":
|
||||
return true
|
||||
case "integrations.ai.byok":
|
||||
return true
|
||||
case "marketing.brand_ai_apply":
|
||||
return true
|
||||
case "marketing.campaigns.generate_ai":
|
||||
return true
|
||||
case "marketing.campaigns.send":
|
||||
return true
|
||||
case "marketing.seo.ai_rewrite":
|
||||
return true
|
||||
case "settings.api_keys":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func starterPlanFeatureOff(key string) bool {
|
||||
switch key {
|
||||
case "capability.byok":
|
||||
return true
|
||||
case "integrations.ai.byok":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user