feat(subscriptions): migrate subscription management to merchant level and seed tiers

Move subscription create/edit from store detail (broken endpoint) to merchant
detail page with proper modal UI. Seed 4 subscription tiers (Essential,
Professional, Business, Enterprise) in init_production.py. Also includes
cross-module dependency declarations, store domain platform_id migration,
platform context middleware, CMS route fixes, and migration backups.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 21:04:04 +01:00
parent 7feacd5af8
commit 68493dc6cb
97 changed files with 13286 additions and 77 deletions

View File

@@ -19,7 +19,6 @@ function adminStoreDetail() {
loading: false,
error: null,
storeCode: null,
showSubscriptionModal: false,
// Initialize
async init() {
@@ -150,39 +149,6 @@ function adminStoreDetail() {
return 'bg-green-500';
},
// Create a new subscription for this store
async createSubscription() {
if (!this.store?.id) {
Utils.showToast(I18n.t('tenancy.messages.no_store_loaded'), 'error');
return;
}
detailLog.info('Creating subscription for store:', this.store.id);
try {
// Create a trial subscription with default tier
const url = `/admin/subscriptions/${this.store.id}`;
const data = {
tier: 'essential',
status: 'trial',
trial_days: 14,
is_annual: false
};
window.LogConfig.logApiCall('POST', url, data, 'request');
const response = await apiClient.post(url, data);
window.LogConfig.logApiCall('POST', url, response, 'response');
this.subscription = response;
Utils.showToast(I18n.t('tenancy.messages.subscription_created_successfully'), 'success');
detailLog.info('Subscription created:', this.subscription);
} catch (error) {
window.LogConfig.logError(error, 'Create Subscription');
Utils.showToast(error.message || 'Failed to create subscription', 'error');
}
},
// Delete store
async deleteStore() {
detailLog.info('Delete store requested:', this.storeCode);