Squashed commit message
Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled

This commit is contained in:
2026-03-11 22:08:41 +03:00
commit 0e48b9d56d
590 changed files with 65799 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import {useSettingsStore} from "@/stores/SettingsStore.js";
/**
* Composable для безопасной работы с HapticFeedback
* Проверяет настройку haptic_enabled перед использованием
* @returns {object} Объект с методами haptic feedback, которые безопасно вызываются
*/
export function useHapticFeedback() {
const settings = useSettingsStore();
const haptic = window.Telegram?.WebApp?.HapticFeedback;
// Возвращаем обёртку с методами, которые проверяют настройку при каждом вызове
return {
impactOccurred: (style) => {
// Проверяем настройку при каждом вызове (реактивно)
const isHapticEnabled = settings.haptic_enabled !== false;
if (!haptic || !isHapticEnabled || !haptic.impactOccurred) {
return;
}
haptic.impactOccurred(style);
},
selectionChanged: () => {
// Проверяем настройку при каждом вызове (реактивно)
const isHapticEnabled = settings.haptic_enabled !== false;
if (!haptic || !isHapticEnabled || !haptic.selectionChanged) {
return;
}
haptic.selectionChanged();
},
notificationOccurred: (type) => {
// Проверяем настройку при каждом вызове (реактивно)
const isHapticEnabled = settings.haptic_enabled !== false;
if (!haptic || !isHapticEnabled || !haptic.notificationOccurred) {
return;
}
haptic.notificationOccurred(type);
},
};
}