general
1 month ago
integrations
1 month ago
shared
1 month ago
PerformancePage.js
1 month ago
config.js
1 month ago
entities.js
1 month ago
config.js
204 lines
| 1 | /** |
| 2 | * Single source of truth for the Settings area. Every consumer — sidebar, |
| 3 | * router, redirect rules, option-key callers — derives from the exports here. |
| 4 | * |
| 5 | * Adding a new leaf = one entry in SETTINGS_PAGES + (if new option) one entry |
| 6 | * in OPTION_KEYS. The sidebar, routing, and Save wiring follow automatically. |
| 7 | */ |
| 8 | import { __ } from '@wordpress/i18n'; |
| 9 | import { |
| 10 | Palette, |
| 11 | FolderOpen, |
| 12 | BarChart3, |
| 13 | SlidersHorizontal, |
| 14 | Code2, |
| 15 | Trash2, |
| 16 | HeartHandshake, |
| 17 | LineChart, |
| 18 | Youtube, |
| 19 | Mail, |
| 20 | Cloud, |
| 21 | Webhook, |
| 22 | Gauge, |
| 23 | KeyRound, |
| 24 | } from 'lucide-react'; |
| 25 | |
| 26 | import BrandingPage from './general/BrandingPage'; |
| 27 | import MediaHubPage from './general/MediaHubPage'; |
| 28 | import ViewingAnalyticsPage from './general/ViewingAnalyticsPage'; |
| 29 | import PresetsPage from './general/PresetsPage'; |
| 30 | import CustomCssPage from './general/CustomCssPage'; |
| 31 | import UninstallPage from './general/UninstallPage'; |
| 32 | import ContributePage from './general/ContributePage'; |
| 33 | |
| 34 | import GoogleAnalyticsPage from './integrations/GoogleAnalyticsPage'; |
| 35 | import YouTubePage from './integrations/YouTubePage'; |
| 36 | import EmailCapturePage from './integrations/EmailCapturePage'; |
| 37 | import BunnyNetPage from './integrations/BunnyNetPage'; |
| 38 | import WebhooksPage from './integrations/WebhooksPage'; |
| 39 | |
| 40 | import PerformancePage from './PerformancePage'; |
| 41 | import LicensePage from './general/LicensePage'; |
| 42 | |
| 43 | export const SETTINGS_PAGES = [ |
| 44 | { |
| 45 | slug: 'branding', |
| 46 | label: __( 'Branding', 'presto-player' ), |
| 47 | icon: Palette, |
| 48 | group: 'general', |
| 49 | component: BrandingPage, |
| 50 | pro: false, |
| 51 | }, |
| 52 | { |
| 53 | slug: 'media-hub', |
| 54 | label: __( 'Media Hub', 'presto-player' ), |
| 55 | icon: FolderOpen, |
| 56 | group: 'general', |
| 57 | component: MediaHubPage, |
| 58 | pro: false, |
| 59 | }, |
| 60 | { |
| 61 | slug: 'viewing-analytics', |
| 62 | label: __( 'Video Analytics', 'presto-player' ), |
| 63 | icon: BarChart3, |
| 64 | group: 'general', |
| 65 | component: ViewingAnalyticsPage, |
| 66 | pro: true, |
| 67 | }, |
| 68 | { |
| 69 | slug: 'presets', |
| 70 | label: __( 'Presets', 'presto-player' ), |
| 71 | icon: SlidersHorizontal, |
| 72 | group: 'general', |
| 73 | component: PresetsPage, |
| 74 | pro: true, |
| 75 | }, |
| 76 | { |
| 77 | slug: 'custom-css', |
| 78 | label: __( 'Custom CSS', 'presto-player' ), |
| 79 | icon: Code2, |
| 80 | group: 'general', |
| 81 | component: CustomCssPage, |
| 82 | pro: true, |
| 83 | }, |
| 84 | { |
| 85 | slug: 'uninstall', |
| 86 | label: __( 'Uninstall Options', 'presto-player' ), |
| 87 | icon: Trash2, |
| 88 | group: 'general', |
| 89 | component: UninstallPage, |
| 90 | pro: false, |
| 91 | }, |
| 92 | { |
| 93 | slug: 'contribute', |
| 94 | label: __( 'Contribute', 'presto-player' ), |
| 95 | icon: HeartHandshake, |
| 96 | group: 'general', |
| 97 | component: ContributePage, |
| 98 | pro: false, |
| 99 | }, |
| 100 | { |
| 101 | slug: 'license', |
| 102 | label: __( 'License', 'presto-player' ), |
| 103 | icon: KeyRound, |
| 104 | group: 'general', |
| 105 | component: LicensePage, |
| 106 | pro: true, |
| 107 | requiresProPlugin: true, |
| 108 | }, |
| 109 | |
| 110 | { |
| 111 | slug: 'google-analytics', |
| 112 | label: __( 'Google Analytics', 'presto-player' ), |
| 113 | icon: LineChart, |
| 114 | group: 'integrations', |
| 115 | component: GoogleAnalyticsPage, |
| 116 | pro: true, |
| 117 | }, |
| 118 | { |
| 119 | slug: 'youtube', |
| 120 | label: __( 'YouTube', 'presto-player' ), |
| 121 | icon: Youtube, |
| 122 | group: 'integrations', |
| 123 | component: YouTubePage, |
| 124 | pro: false, |
| 125 | }, |
| 126 | { |
| 127 | slug: 'email-capture', |
| 128 | label: __( 'Email Capture', 'presto-player' ), |
| 129 | icon: Mail, |
| 130 | group: 'integrations', |
| 131 | component: EmailCapturePage, |
| 132 | pro: true, |
| 133 | skeletonCards: 2, |
| 134 | }, |
| 135 | { |
| 136 | slug: 'bunny-net', |
| 137 | label: __( 'Bunny.net', 'presto-player' ), |
| 138 | icon: Cloud, |
| 139 | group: 'integrations', |
| 140 | component: BunnyNetPage, |
| 141 | pro: true, |
| 142 | }, |
| 143 | { |
| 144 | slug: 'webhooks', |
| 145 | label: __( 'Webhooks', 'presto-player' ), |
| 146 | icon: Webhook, |
| 147 | group: 'integrations', |
| 148 | component: WebhooksPage, |
| 149 | pro: true, |
| 150 | requiresProPlugin: true, |
| 151 | }, |
| 152 | |
| 153 | { |
| 154 | slug: 'performance', |
| 155 | label: __( 'Performance', 'presto-player' ), |
| 156 | icon: Gauge, |
| 157 | group: 'performance', |
| 158 | component: PerformancePage, |
| 159 | pro: false, |
| 160 | }, |
| 161 | ]; |
| 162 | |
| 163 | export const GROUPS = [ |
| 164 | { key: 'general', label: __( 'General', 'presto-player' ) }, |
| 165 | { key: 'integrations', label: __( 'Integrations', 'presto-player' ) }, |
| 166 | { key: 'performance', label: __( 'Performance', 'presto-player' ) }, |
| 167 | ]; |
| 168 | |
| 169 | export const DEFAULT_SLUG = 'branding'; |
| 170 | |
| 171 | export const OPTION_KEYS = { |
| 172 | branding: 'presto_player_branding', |
| 173 | mediaHubWidth: 'presto_player_instant_video_width', |
| 174 | mediaHubSync: 'presto_player_media_hub_sync_default', |
| 175 | analytics: 'presto_player_analytics', |
| 176 | presets: 'presto_player_presets', |
| 177 | audioPresets: 'presto_player_audio_presets', |
| 178 | uninstall: 'presto_player_uninstall', |
| 179 | usageOptin: 'presto-player_usage_optin', |
| 180 | googleAnalytics: 'presto_player_google_analytics', |
| 181 | youtube: 'presto_player_youtube', |
| 182 | mailchimp: 'presto_player_mailchimp', |
| 183 | mailerlite: 'presto_player_mailerlite', |
| 184 | activecampaign: 'presto_player_activecampaign', |
| 185 | fluentcrm: 'presto_player_fluentcrm', |
| 186 | bunnyStream: 'presto_player_bunny_stream', |
| 187 | bunnyStreamPublic: 'presto_player_bunny_stream_public', |
| 188 | bunnyStreamPrivate: 'presto_player_bunny_stream_private', |
| 189 | bunnyPullZones: 'presto_player_bunny_pull_zones', |
| 190 | performance: 'presto_player_performance', |
| 191 | }; |
| 192 | |
| 193 | export const BUNNY_STREAM_KEYS = [ |
| 194 | OPTION_KEYS.bunnyStream, |
| 195 | OPTION_KEYS.bunnyStreamPublic, |
| 196 | OPTION_KEYS.bunnyStreamPrivate, |
| 197 | OPTION_KEYS.bunnyPullZones, |
| 198 | ]; |
| 199 | |
| 200 | export const WEBHOOK_ENTITY = [ 'presto-player', 'webhook' ]; |
| 201 | |
| 202 | export const findPage = ( slug ) => |
| 203 | SETTINGS_PAGES.find( ( page ) => page.slug === slug ) || null; |
| 204 |