Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | /** * PWA Library * * Centralized exports for Progressive Web App functionality. */ // Offline Storage export { getDB, closeDB, saveCartOffline, getCartOffline, addToCartOffline, updateCartItemOffline, removeFromCartOffline, clearCartOffline, cacheProducts, getCachedProducts, getCachedProduct, clearOldCachedProducts, queueAction, getPendingActions, removePendingAction, incrementRetryCount, clearFailedActions, trackViewedProduct, getRecentlyViewed, isIndexedDBAvailable, getStorageEstimate, type PendingActionType, type OfflineCartItem, type CachedProduct, type PendingAction, } from './offline-storage'; // Background Sync export { syncPendingActions, registerBackgroundSync, initBackgroundSync, getPendingActionCount, hasPendingActions, queueAndSync, } from './background-sync'; // Push Notifications export { isPushSupported, getNotificationPermission, requestNotificationPermission, getExistingSubscription, subscribeToPush, unsubscribeFromPush, showLocalNotification, isNotificationsEnabled, getPushSubscriptionInfo, } from './push-notifications'; // Utility to check if running in standalone PWA mode export function isStandalone(): boolean { if (typeof window === 'undefined') return false; return ( window.matchMedia('(display-mode: standalone)').matches || // @ts-expect-error - navigator.standalone is iOS-specific window.navigator.standalone === true || document.referrer.includes('android-app://') ); } // Utility to check if device is mobile export function isMobileDevice(): boolean { if (typeof window === 'undefined') return false; return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ); } // Utility to check if iOS export function isIOS(): boolean { if (typeof window === 'undefined') return false; return ( /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) ); } // Utility to check if can be installed (not iOS, not already installed) export function canBeInstalled(): boolean { return !isStandalone() && !isIOS(); } |