feat(customers): track order meta and OC sync

- add telecart_order_meta table and orders_count column for customers
- introduce OcCustomerService and OrderMetaService for syncing OC data
- rework OrderCreateService transaction flow, metadata handling and tests
- increment telegram customer orders_count and expose it via handlers/UI
- update stats dashboard with rub formatting, tooltips and customers count
- sync SPA theme colors with Telegram WebApp and fix dark variant behavior
- add helpers for RUB formatting and bool casting; simplify logs handler
This commit is contained in:
2025-11-24 14:08:56 +03:00
committed by Nikita Kiselev
parent b39a344a7d
commit 952d8e58da
18 changed files with 489 additions and 172 deletions

View File

@@ -38,6 +38,12 @@ const blocks = useBlocksStore();
const appLoading = createApp(AppLoading);
appLoading.mount('#app');
function setTelegramUIColors() {
const daisyUIBgColor = getCssVarOklchRgb('--color-base-100');
window.Telegram.WebApp.setHeaderColor(daisyUIBgColor);
window.Telegram.WebApp.setBackgroundColor(daisyUIBgColor);
}
settings.load()
.then(() => window.Telegram.WebApp.lockOrientation())
.then(() => {
@@ -87,18 +93,22 @@ settings.load()
if (settings.night_auto) {
window.Telegram.WebApp.onEvent('themeChanged', function () {
document.documentElement.setAttribute('data-theme', settings.theme[this.colorScheme]);
setTelegramUIColors();
});
}
const tgColorScheme = getComputedStyle(document.documentElement)
.getPropertyValue('--tg-color-scheme')
.trim();
if (tgColorScheme) {
document.documentElement.classList.add(tgColorScheme);
}
for (const key in settings.theme.variables) {
document.documentElement.style.setProperty(key, settings.theme.variables[key]);
}
const daisyUIBgColor = getCssVarOklchRgb('--color-base-100');
window.Telegram.WebApp.setHeaderColor(daisyUIBgColor);
window.Telegram.WebApp.setBackgroundColor(daisyUIBgColor);
setTelegramUIColors();
}
)
.then(() => new AppMetaInitializer(settings).init())

View File

@@ -1,5 +1,5 @@
@import "tailwindcss";
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
@custom-variant dark (&:where(.dark, .dark *));
@plugin "daisyui" {
themes: all;