PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.2
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.2
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / src / dashboard / Constants / index.js
everest-forms / src / dashboard / Constants Last commit date
Products.js 1 year ago index.js 3 months ago
index.js
227 lines
1 import { __ } from '@wordpress/i18n';
2
3 const { isPro, adminURL, showAnalyticsTab } =
4 typeof _EVF_DASHBOARD_ !== 'undefined' && _EVF_DASHBOARD_;
5
6 const normalizeAdminURL = (url) => {
7 if (!url) return '';
8
9 let cleanURL = url.endsWith('/') ? url.slice(0, -1) : url;
10
11 if (cleanURL.endsWith('/admin.php')) {
12 cleanURL = cleanURL.slice(0, -10);
13 }
14
15 return cleanURL;
16 };
17
18 const cleanAdminURL = normalizeAdminURL(adminURL);
19
20 let ROUTES = [
21 {
22 route: '/',
23 label: __('Site Assistant', 'everest-forms'),
24 external: false,
25 key: 'siteAssistant',
26 },
27 {
28 route: `${cleanAdminURL}/admin.php?page=evf-analytics`,
29 label: __('Analytics', 'everest-forms'),
30 external: true,
31 },
32 {
33 route: `${cleanAdminURL}/admin.php?page=evf-builder`,
34 label: __('All Forms', 'everest-forms'),
35 external: true,
36 key: 'forms',
37 },
38 {
39 route: `${cleanAdminURL}/admin.php?page=evf-entries`,
40 label: __('Entries', 'everest-forms'),
41 external: true,
42 key: 'entries',
43 },
44 {
45 route: `${cleanAdminURL}/admin.php?page=evf-settings`,
46 label: __('Settings', 'everest-forms'),
47 external: true,
48 key: 'settings',
49 },
50
51 {
52 route: '/features',
53 label: __('Addons', 'everest-forms'),
54 external: false,
55 key: 'features',
56 },
57 {
58 route: '/help',
59 label: __('Help', 'everest-forms'),
60 external: false,
61 key: 'help',
62 },
63 ];
64
65 if (!isPro) {
66 ROUTES = [
67 ...ROUTES.slice(0, 4),
68 {
69 route: 'https://everestforms.net/free-vs-pro/',
70 label: __('Free vs Pro', 'everest-forms'),
71 external: true,
72 },
73 ...ROUTES.slice(4),
74 ];
75 }
76
77 export default ROUTES;
78
79 export const CHANGELOG_TAG_COLORS = {
80 fix: {
81 color: 'primary.500',
82 bgColor: 'primary.100',
83 scheme: 'primary',
84 },
85 feature: {
86 color: 'green.500',
87 bgColor: 'green.50',
88 scheme: 'green',
89 },
90 enhance: {
91 color: 'teal.500',
92 bgColor: 'teal.50',
93 scheme: 'teal',
94 },
95 refactor: {
96 color: 'pink.500',
97 bgColor: 'pink.50',
98 scheme: 'pink',
99 },
100 dev: {
101 color: 'orange.500',
102 bgColor: 'orange.50',
103 scheme: 'orange',
104 },
105 tweak: {
106 color: 'purple.500',
107 bgColor: 'purple.50',
108 scheme: 'purple',
109 },
110 };
111
112 export const facebookUrl = 'https://www.facebook.com/groups/everestforms';
113 export const youtubeChannelUrl = 'https://www.youtube.com/@EverestForms';
114 export const twitterUrl = 'https://twitter.com/everestforms';
115 export const reviewUrl =
116 'https://wordpress.org/support/plugin/everest-forms/reviews/?rate=5#new-post';
117
118 /**
119 * Normalize admin URL - remove trailing slashes and admin.php if present
120 * @param {string} url - WordPress admin URL
121 * @returns {string} - Normalized URL
122 */
123 const normalizeURL = (url) => {
124 if (!url) return '';
125
126 let cleanURL = url.endsWith('/') ? url.slice(0, -1) : url;
127
128 if (cleanURL.endsWith('/admin.php')) {
129 cleanURL = cleanURL.slice(0, -10);
130 }
131
132 return cleanURL;
133 };
134
135 /**
136 * Convert internal routes to full admin URLs when needed
137 * @param {string} route - The route path
138 * @param {boolean} isNonDashboardPage - Whether we're on a non-dashboard page (settings, entries, etc.)
139 * @param {string} adminURL - WordPress admin URL
140 * @returns {string} - Converted route
141 */
142 export const convertRoute = (route, isNonDashboardPage, adminURL) => {
143 if (route.includes('admin.php') || route.includes('?page=')) {
144 return route;
145 }
146
147 if (isNonDashboardPage) {
148 const cleanURL = normalizeURL(adminURL);
149
150 if (route === '/') {
151 return `${cleanURL}/admin.php?page=evf-dashboard`;
152 }
153 return `${cleanURL}/admin.php?page=evf-dashboard#${route}`;
154 }
155
156 return route;
157 };
158
159 /**
160 * Check if route is external (WordPress admin link)
161 * @param {string} route - The route path
162 * @returns {boolean}
163 */
164 export const isExternalRoute = (route) => {
165 return route.includes('admin.php') || route.includes('?page=');
166 };
167
168 /**
169 * Check if route is active
170 * @param {string} route - The route path
171 * @param {string} currentPath - Current location path (from React Router)
172 * @param {string} pageType - Current page type (settings, entries, analytics, forms, etc.)
173 * @returns {boolean}
174 */
175 export const isRouteActive = (route, currentPath, pageType) => {
176 // Get current page from URL parameters
177 const urlParams = new URLSearchParams(window.location.search);
178 const currentPage = urlParams.get('page');
179
180 // Check for analytics page
181 if (currentPage === 'evf-analytics' && route.includes('evf-analytics')) {
182 return true;
183 }
184
185 if (currentPage === 'evf-entries' && route.includes('evf-entries')) {
186 return true;
187 }
188
189 if (currentPage === 'evf-builder' && route.includes('evf-builder')) {
190 return true;
191 }
192
193 if (currentPage === 'evf-settings' && route.includes('evf-settings')) {
194 return true;
195 }
196
197 // For dashboard internal routes (hash-based navigation)
198 if (currentPage === 'evf-dashboard' || !currentPage) {
199 // Check if it's a hash route
200 const hash = window.location.hash.replace('#', '');
201
202 if (!route.includes('admin.php') && !route.includes('?page=')) {
203 // This is an internal route
204 if (hash === '' && route === '/') {
205 return true;
206 }
207 if (hash && route === `/${hash}`) {
208 return true;
209 }
210 if (hash && route === hash) {
211 return true;
212 }
213 // Use React Router's currentPath as fallback
214 if (currentPath === route) {
215 return true;
216 }
217 }
218 }
219
220 // Check external routes like free-vs-pro
221 if (route.includes('everestforms.net/free-vs-pro')) {
222 return false; // External links are never "active"
223 }
224
225 return false;
226 };
227