Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/dev/js/hooks/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { useToastNotification } from '@ea11y-apps/global/hooks/use-notifications';
export { default as useStorage } from '@ea11y-apps/global/hooks/use-storage';
26 changes: 26 additions & 0 deletions assets/dev/js/hooks/use-storage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { store as coreDataStore } from '@wordpress/core-data';
import { dispatch, useSelect } from '@wordpress/data';

const useStorage = () => {
const save = async (data) => {
return await dispatch(coreDataStore).saveEntityRecord('root', 'site', data);
};

// Fetch site data with useSelect and check resolution status
const get = useSelect((select) => {
return {
data: select(coreDataStore).getEntityRecord('root', 'site'),
hasFinishedResolution: select(coreDataStore).hasFinishedResolution(
'getEntityRecord',
['root', 'site'],
),
};
}, []);

return {
save,
get,
};
};

export default useStorage;
13 changes: 13 additions & 0 deletions assets/dev/js/services/mixpanel/mixpanel-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,17 @@ export const mixpanelEvents = {
assistantDashboardScanCtaClicked: 'scan_cta_clicked',
assistantDashboardSearchTriggered: 'search_triggered',
scanLogActionsButtonClicked: 'scan_log_actions_button_clicked',

// Onboarding modal
scanHomePageButtonClicked: 'scan_triggered',
introductionBannerShowed: 'banner_showed',
introductionBannerClosed: 'banner_dismissed',

review: {
promptShown: 'review_prompt_shown',
dismissClicked: 'review_dismiss_clicked',
starSelected: 'review_star_selected',
feedbackSubmitted: 'review_feedback_submitted',
publicRedirectClicked: 'review_public_redirect_clicked',
},
};
2 changes: 1 addition & 1 deletion classes/database/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private function class_short_name(): string {
* Optional.
* Defaults to null. In this case, will raise only the defaults /changed/ event.
*/
private function trigger_change( $data, string $event = null ) : void {
private function trigger_change( $data, ?string $event = null ) : void {
if ( $event ) {
/**
* event specific
Expand Down
10 changes: 5 additions & 5 deletions classes/database/table.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private static function get_columns_for_insert( $data ) {
*
* @return string|null The query result or NULL on error.
*/
public static function select_var( $fields = '*', $where = '1', int $limit = null, int $offset = null, string $join = '' ): ?string {
public static function select_var( $fields = '*', $where = '1', ?int $limit = null, ?int $offset = null, string $join = '' ): ?string {
return static::db()->get_var( static::build_sql_string( $fields, $where, $limit, $offset, $join ) );
}

Expand Down Expand Up @@ -333,7 +333,7 @@ public static function select_var( $fields = '*', $where = '1', int $limit = nul
*
* @return string The SQL SELECT statement built according to the function parameters.
*/
private static function build_sql_string( $fields = '*', $where = '1', int $limit = null, int $offset = null, string $join = '', array $order_by = [], $group_by = '' ): string {
private static function build_sql_string( $fields = '*', $where = '1', ?int $limit = null, ?int $offset = null, string $join = '', array $order_by = [], $group_by = '' ): string {
if ( is_array( $fields ) ) {
$fields = implode( ', ', $fields );
}
Expand Down Expand Up @@ -414,7 +414,7 @@ public static function build_order_by_sql_string( array $order_by ): string {
*
* @return array|object|\stdClass[]|null On success, an array of objects. Null on error.
*/
public static function select( $fields = '*', $where = '1', int $limit = null, int $offset = null, $join = '', array $order_by = [], $group_by = '' ) {
public static function select( $fields = '*', $where = '1', ?int $limit = null, ?int $offset = null, $join = '', array $order_by = [], $group_by = '' ) {
// TODO: handle $wpdb->last_error
$query = static::build_sql_string( $fields, $where, $limit, $offset, $join, $order_by, $group_by );
return static::db()->get_results( $query );
Expand Down Expand Up @@ -447,7 +447,7 @@ public static function select( $fields = '*', $where = '1', int $limit = null, i
*
* @return string[] Array of the values of the column as strings, or an empty one on error.
*/
public static function get_col( string $column = '', $where = '1', int $limit = null, int $offset = null, string $join = '', array $order_by = [] ) : array {
public static function get_col( string $column = '', $where = '1', ?int $limit = null, ?int $offset = null, string $join = '', array $order_by = [] ) : array {
return static::db()->get_col( static::build_sql_string( $column, $where, $limit, $offset, $join, $order_by ) );
}

Expand Down Expand Up @@ -521,7 +521,7 @@ public static function insert( array $data = [] ) {
*
* @return false|int Number of rows affected or false on error
*/
public static function insert_many( array $data = [], string $columns = null ) {
public static function insert_many( array $data = [], ?string $columns = null ) {
if ( null === $columns ) {
$columns = static::get_columns_for_insert( $data );
if ( ! $columns ) {
Expand Down
12 changes: 12 additions & 0 deletions classes/services/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
class Client {
private const BASE_URL = 'https://my.elementor.com/apps/api/v1/a11y/';

private const BASE_URL_FEEDBACK = 'https://feedback-api.prod.apps.elementor.red/apps/api/v1/';

private bool $refreshed = false;

public static ?Client $instance = null;
Expand Down Expand Up @@ -71,6 +73,9 @@ private static function webhook_endpoint(): string {
return get_rest_url( $blog_id, 'a11y/v1/webhooks/common' );
}

/**
* @throws Service_Exception
*/
public function make_request( $method, $endpoint, $body = [], array $headers = [], $send_json = false, $file = false, $file_name = '' ) {
$headers = array_replace_recursive( [
'x-elementor-a11y' => EA11Y_VERSION,
Expand Down Expand Up @@ -114,7 +119,14 @@ public static function get_client_base_url() {
return apply_filters( 'ea11y_client_base_url', self::BASE_URL );
}

public static function get_feedback_base_url() {
return apply_filters( 'ea11y_feedback_base_url', self::BASE_URL_FEEDBACK );
}

private static function get_remote_url( $endpoint ): string {
if ( strpos( $endpoint, 'feedback/' ) !== false ) {
return self::get_feedback_base_url() . $endpoint;
}
return self::get_client_base_url() . $endpoint;
}

Expand Down
3 changes: 3 additions & 0 deletions classes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public static function is_elementor_installed() :bool {
$installed_plugins = get_plugins();
return isset( $installed_plugins[ $file_path ] );
}
public static function user_is_admin(): bool {
return current_user_can( 'manage_options' );
}

public static function sanitize_object( $input ) {
// Convert an object to array if needed
Expand Down
2 changes: 2 additions & 0 deletions includes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static function get_module_list(): array {
'whats-new',
'Remediation',
'Scanner',
'Deactivation',
'Reviews',
];
}

Expand Down
152 changes: 152 additions & 0 deletions modules/deactivation/assets/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
.ea11y-deactivation-modal {
display: none;
}

.ea11y-deactivation-content {
padding: 20px;
}

/* Thickbox auto-height adjustments */
#TB_window.ea11y-feedback-thickbox {
height: auto !important;
max-height: 90vh;
overflow: auto;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
margin: 0 !important;
width: 600px !important;
}

/* Custom styles for Ally feedback thickbox */
#TB_window.ea11y-feedback-thickbox {
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.ea11y-feedback-thickbox #TB_ajaxContent {
overflow: visible;
padding: 0;
}

.ea11y-feedback-thickbox #TB_title {
padding: 5px;
display: flex;
flex-direction: row;
}

.ea11y-feedback-thickbox #TB_closeWindowButton .tb-close-icon {
box-shadow: none !important;
}

.ea11y-feedback-thickbox #TB_ajaxWindowTitle {
font-size: 14px;
letter-spacing: 1px;
}

.ea11y-deactivation-content h3 {
margin-top: 0;
color: #23282d;
font-size: 18px;
font-weight: 600;
}

.ea11y-deactivation-content p {
color: #666;
margin-bottom: 20px;
}

.ea11y-feedback-options {
margin-bottom: 20px;
}

.ea11y-feedback-option {
margin-bottom: 15px;
}

.ea11y-feedback-option > label {
display: flex;
align-items: center;
cursor: pointer;
color: #23282d;
margin-bottom: 8px;
}

.ea11y-feedback-option input[type="radio"] {
margin-right: 8px;
}

.ea11y-feedback-text-field {
margin-left: 24px;
margin-top: 8px;
}

.ea11y-feedback-text-field label {
display: block;
font-size: 12px;
color: #666;
margin-bottom: 4px;
}

.ea11y-feedback-text-field input,
.ea11y-feedback-text-field textarea {
width: 100%;
padding: 6px 8px;
border: 1px solid #ddd;
border-radius: 3px;
font-size: 13px;
resize: vertical;
}

.ea11y-feedback-text-field input:focus,
.ea11y-feedback-text-field textarea:focus {
border-color: #0073aa;
box-shadow: 0 0 0 1px #0073aa;
outline: none;
}

.ea11y-deactivation-buttons {
display: flex;
flex-direction: row-reverse;
justify-content: space-between;
gap: 10px;
border-top: 1px solid #e1e1e1;
padding-top: 20px;
}

.ea11y-btn {
padding: 8px 16px;
border: none;
background: none;
text-decoration: none;
border-radius: 3px;
cursor: pointer;
font-size: 13px;
font-weight: 600;
color: #c0c0c0;
transition: all 0.3s ease;
}

.ea11y-btn:hover {
background: none;
color: #000;
}

.ea11y-btn-primary {
background: rgb(240, 171, 252);
border-color: rgb(240, 171, 252);
color: #000;
font-weight: 600;
transition: all 0.3s ease;
}

.ea11y-btn-primary:hover {
background: #e881fa;
border-color: #e881fa;
color: #000;
}

.ea11y-btn:focus {
box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);
outline: none;
}
Loading
Loading