-
Notifications
You must be signed in to change notification settings - Fork 34
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
[APP-721] Render widget and global settings #124
Conversation
modules/widget/module.php
Outdated
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' ) | ||
] | ||
); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated @pkniazevych
There was a problem hiding this 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.
classes/services/client.php
Outdated
* @return string | ||
*/ | ||
private static function webhook_endpoint(): string { | ||
$blog_id = get_current_blog_id(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$blog_id = get_current_blog_id(); | |
$blog_id = get_current_blog_id(); |
classes/services/client.php
Outdated
/** | ||
* 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 ); | ||
} |
There was a problem hiding this comment.
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
public function __construct() { | ||
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_accessibility_widget' ] ); | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some comments
modules/widget/module.php
Outdated
return; | ||
} | ||
|
||
if ( empty ( Settings::PLAN_DATA ) && ! isset( $plan_data->public_api_key ) ) { |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
…nirbhayel/one-click-accessibility into feature/APP-721-pass-settings-to-widget
No description provided.