| 2 |
| 3 | const fromQuery = new URLSearchParams(location.search).get('policy'); |
| 4 | const fromEnv = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.VITE_TW_POLICY; |
| 5 |
| 6 | export const WIDGET_POLICY: SandboxPolicy = (fromQuery ?? fromEnv) === 'compat' ? 'compat' : 'strict'; |
| 7 |
| 8 | /** Opt-in sandbox features for every widget the dev app creates: `?features=webAnimations` or VITE_TW_FEATURES (comma-separated). */ |
| 9 | const featuresQuery = new URLSearchParams(location.search).get('features'); |
| 10 | const featuresEnv = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.VITE_TW_FEATURES; |
| 11 | export const WIDGET_FEATURES: string[] = (featuresQuery ?? featuresEnv ?? '').split(',').map((f) => f.trim()).filter(Boolean); |
| 12 |