Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APP-721] Render widget and global settings #124

Merged

Conversation

nirbhayel
Copy link

No description provided.

Comment on lines 81 to 89
wp_localize_script(
'ea11y-widget',
'ea11yWidgetData',
[
'iconSettings' => wp_json_encode( get_option( 'ea11y_widget_icon_settings' ) ),
'menuSettings' => wp_json_encode( get_option( 'ea11y_widget_menu_settings' ) ),
'wpRestNonce' => wp_create_nonce( 'wp_rest' )
]
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's stick to the agreements we've had.
The widget expects an object named ea11yWidget with the field preview: true inside. It also doesn't need wpRestNonce, not sure if you keep it for some other piece of logic, but please move it elsewhere.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated @pkniazevych

Copy link

@pkniazevych pkniazevych left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, check the comment.

* @return string
*/
private static function webhook_endpoint(): string {
$blog_id = get_current_blog_id();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$blog_id = get_current_blog_id();
$blog_id = get_current_blog_id();

Comment on lines 166 to 173
/**
* product/widget endpoint returns javascript hence we
* escape decoding for the data received in body from
* this endpoint.
*/
if ( ! strpos( $endpoint, 'widget' ) ) {
$body = json_decode( $body );
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this? we will never call the widget from the service client directly

Comment on lines +57 to +59
public function __construct() {
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_accessibility_widget' ] );
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be enqueue only if connected

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bainternet Should there be a check for plan data as well? If the pan data is not available, then the widget should not load.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes also the pr is not fixed in both comments

Copy link
Contributor

@bainternet bainternet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments

@nirbhayel nirbhayel requested a review from bainternet December 30, 2024 09:49
return;
}

if ( empty ( Settings::PLAN_DATA ) && ! isset( $plan_data->public_api_key ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this must be wrong empty ( Settings::PLAN_DATA )

return;
}

$plan_data = Settings::get( Settings::PLAN_DATA );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this should probably be above it

Copy link
Contributor

@bainternet bainternet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

@nirbhayel nirbhayel requested a review from bainternet December 30, 2024 13:27
@nirbhayel nirbhayel merged commit 45a15d2 into elementor:develop Dec 30, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants