Fixes AXO settings fields display and AXO sandbox mode

This commit is contained in:
Pedro Silva 2024-04-15 18:08:53 +01:00
parent 2e6f403ed1
commit 11b87155f3
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
3 changed files with 10 additions and 13 deletions

View file

@ -84,15 +84,13 @@ return array(
->rule()
->condition_element( 'axo_enabled', '1' )
->action_visible( 'axo_gateway_title' )
->action_visible( 'axo_email_widget' )
->action_visible( 'axo_address_widget' )
->action_visible( 'axo_payment_widget' )
->action_visible( 'axo_privacy' )
->action_visible( 'axo_style_heading' )
->action_class( 'axo_enabled', 'active' )
->to_array(),
$display_manager
->rule()
->condition_element( 'axo_enabled', '1' )
->condition_js_variable( 'ppcpAxoShowStyles', true )
->action_visible( 'axo_style_root_heading' )
->action_visible( 'axo_style_root_bg_color' )

View file

@ -435,7 +435,9 @@ class AxoManager {
}
async connect() {
window.localStorage.setItem('axoEnv', 'sandbox'); // TODO: check sandbox
if (this.axoConfig.environment.is_sandbox) {
window.localStorage.setItem('axoEnv', 'sandbox');
}
await this.fastlane.connect({
locale: this.locale,

View file

@ -150,17 +150,14 @@ class AxoManager {
* @return array
*/
private function script_data() {
$email_widget = $this->settings->has( 'axo_email_widget' ) ? $this->settings->get( 'axo_email_widget' ) : null;
$address_widget = $this->settings->has( 'axo_address_widget' ) ? $this->settings->get( 'axo_address_widget' ) : null;
$payment_widget = $this->settings->has( 'axo_payment_widget' ) ? $this->settings->get( 'axo_payment_widget' ) : null;
return array(
'widgets' => array(
'email' => $email_widget ?: 'render',
'address' => $address_widget ?: 'render',
'payment' => $payment_widget ?: 'render',
'environment' => array(
'is_sandbox' => $this->environment->current_environment() === 'sandbox',
),
'insights' => array(
'widgets' => array(
'email' => 'render',
),
'insights' => array(
'enabled' => true,
'client_id' => ( $this->settings->has( 'client_id' ) ? $this->settings->get( 'client_id' ) : null ),
'session_id' =>