Skip to content

Commit 8636385

Browse files
committed
Small refactor, remove readmes
1 parent 8cdd4dc commit 8636385

File tree

4 files changed

+47
-183
lines changed

4 files changed

+47
-183
lines changed

assets/src/js/README.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

assets/src/js/experiments/index.ts

Lines changed: 46 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,50 @@
55
* @since 6.4.3
66
*/
77

8-
// Define interfaces for our data structures
98
interface ExperimentsData {
10-
[key: string]: boolean; // Just store enabled status
11-
}
12-
13-
// Define the experiments object structure
14-
interface ExperimentsObject {
15-
[key: string]: boolean | ((name: string) => boolean);
16-
isEnabled: (name: string) => boolean;
17-
}
18-
19-
// Define a more complete ACF interface
20-
interface ACF {
21-
experiments?: ExperimentsObject;
22-
[key: string]: any;
23-
}
24-
25-
// Declare global types
26-
declare global {
27-
interface Window {
28-
acf: ACF; // Ensure acf is available on window
29-
acfExperiments?: ExperimentsData; // Variable created by wp_localize_script
30-
}
31-
var acf: ACF;
32-
var acfExperiments: ExperimentsData | undefined; // Variable created by wp_localize_script
33-
}
34-
35-
// Create a module to avoid global scope augmentation issues
36-
export {};
37-
38-
(function() {
39-
// End the function if acf doesn't exist
40-
if (typeof acf !== 'object' || acf === null) {
41-
return;
42-
}
43-
44-
// Add experiments to acf object
45-
acf.experiments = {
46-
isEnabled: function(name: string): boolean {
47-
return this.hasOwnProperty(name) && this[name] === true;
48-
}
49-
};
50-
51-
// Initialize when document is ready
52-
document.addEventListener('DOMContentLoaded', function() {
53-
if (!acf.experiments) return;
54-
55-
// Check if acfExperiments exists (created by wp_localize_script)
56-
if (typeof acfExperiments === 'undefined') {
57-
return;
58-
}
59-
60-
// Use the experiments data from wp_localize_script
61-
if (acfExperiments && acfExperiments.data) {
62-
// Copy all experiment flags directly to the experiments object
63-
Object.assign(acf.experiments, acfExperiments.data);
64-
}
65-
});
66-
67-
})();
68-
9+
[ key: string ]: boolean;
10+
}
11+
12+
interface ExperimentsObject {
13+
[ key: string ]: boolean | ( ( name: string ) => boolean );
14+
isEnabled: ( name: string ) => boolean;
15+
}
16+
17+
interface ACF {
18+
experiments?: ExperimentsObject;
19+
[ key: string ]: any;
20+
}
21+
22+
declare global {
23+
interface Window {
24+
acf: ACF;
25+
acfExperiments?: ExperimentsData; // Variable created by wp_localize_script in admin-experiments.php L150.
26+
}
27+
var acf: ACF;
28+
var acfExperiments: ExperimentsData | undefined;
29+
}
30+
31+
// Create a module to avoid global scope augmentation issues.
32+
export {};
33+
34+
( function () {
35+
if ( typeof acf !== 'object' || acf === null ) {
36+
return;
37+
}
38+
39+
acf.experiments = {
40+
isEnabled: function ( name: string ): boolean {
41+
return this.hasOwnProperty( name ) && this[ name ] === true;
42+
},
43+
};
44+
45+
document.addEventListener( 'DOMContentLoaded', function () {
46+
if ( ! acf.experiments || typeof acfExperiments === 'undefined' ) {
47+
return;
48+
}
49+
50+
if ( acfExperiments && acfExperiments.data ) {
51+
Object.assign( acf.experiments, acfExperiments.data );
52+
}
53+
} );
54+
} )();

includes/admin/experiments/README.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

includes/admin/views/global/navigation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
176176
if ( 'acf-tools' === $plugin_page ) {
177177
$acf_page_title = __( 'Tools', 'secure-custom-fields' );
178178
} elseif ( 'scf-experiments' === $plugin_page ) {
179-
$acf_page_title = __( 'Experiments', 'secure-custom-fields' );
179+
$acf_page_title = __( 'Beta Features', 'secure-custom-fields' );
180180
}
181181
acf_get_view( 'global/header' );
182182
}

0 commit comments

Comments
 (0)