Plugin Directory

Changeset 3305818


Ignore:
Timestamp:
06/03/2025 01:41:40 PM (10 months ago)
Author:
jumptech
Message:

refactor consent solution API

Location:
avacy/trunk
Files:
1 added
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • avacy/trunk/avacy.php

    r3299219 r3305818  
    3737}
    3838
     39global $api_base_url;
     40$api_base_url = 'https://api.avacy.eu';
     41
    3942class Init
    4043{
  • avacy/trunk/package.json

    r3286297 r3305818  
    88  },
    99  "author": "Jump Group",
    10   "license": "GPL-2.0-or-later"
     10  "license": "GPL-2.0-or-later",
     11  "dependencies": {
     12    "@wp-now/wp-now": "^0.1.74"
     13  }
    1114}
  • avacy/trunk/src/AddAdminInterface.php

    r3239361 r3305818  
    4141
    4242    if (empty($checkSaasAccount) || ( !empty($checkSaasAccount) && $checkSaasAccount['status'] === 200) ) {
     43      // if tenant and webspace key are not empty, concat them with a pipe
     44      if (strpos($webspaceKey, '|') === false) {
     45        $webspaceKey = $tenant . '|' . $webspaceKey;
     46        update_option('avacy_webspace_key', $webspaceKey);
     47      }
     48
    4349      if(empty($apiToken)){
    4450        return;
     
    9096      die( 'Security check' );
    9197    }
     98
     99    $isKeyInOldFormat = strpos($_POST['avacy_webspace_key'], '|') === false;
     100    if( $isKeyInOldFormat) {
     101      $webspaceKey = $_POST['avacy_webspace_key'];
     102      $saveAccountToken = $_POST['avacy_webspace_key'];
     103    } else {
     104      $accountToken = explode('|', $_POST['avacy_webspace_key']);
     105      $webspaceKey = $accountToken[1];
     106      $saveAccountToken = $_POST['avacy_webspace_key'];
     107    }
     108   
     109    if( $isKeyInOldFormat ) {
     110      $tenant = $_POST['avacy_tenant'];
     111    } else {
     112      $accountToken = explode('|', $_POST['avacy_webspace_key']);
     113      $tenant = $accountToken[0];
     114    }
     115   
    92116    $redirect_to = isset($_POST['redirectToUrl']) ? esc_url(sanitize_text_field($_POST['redirectToUrl'])) : '';
    93     $tenant = isset($_POST['avacy_tenant']) ? sanitize_text_field($_POST['avacy_tenant']) : '';
    94     $webspaceKey = isset($_POST['avacy_webspace_key']) ? sanitize_text_field($_POST['avacy_webspace_key']) : '';
    95117    $apiToken = isset($_POST['avacy_api_token']) ? sanitize_text_field($_POST['avacy_api_token']) : '';
    96118    $showBanner = isset($_POST['avacy_show_banner']) ? sanitize_text_field($_POST['avacy_show_banner']) : '';
     
    107129    $can_update = true;
    108130
    109     $checkSaasAccount = self::checkSaasAccount($tenant, $webspaceKey);
     131    $checkSaasAccount = self::checkSaasAccount($tenant, $_POST['avacy_webspace_key']);
    110132    if (!empty($checkSaasAccount)) {
    111133      $notices[] = $checkSaasAccount['notice'];
     
    121143    }
    122144
    123     if (!empty($can_update) && isset($_POST['avacy_active_tab']) && empty($checkSaasAccount)) {
     145    $avacyActiveTab = $_POST['avacy_active_tab'] ?? 'cookie-banner';
     146    if (!empty($can_update) && isset($avacyActiveTab) && empty($checkSaasAccount)) {
     147      update_option('avacy_webspace_key', esc_attr($saveAccountToken));
    124148      update_option('avacy_show_banner', esc_attr($showBanner));
    125149      update_option('avacy_enable_preemptive_block', esc_attr($enablePreemptiveBlock));
     
    151175
    152176  private static function checkSaasAccount($tenant, $webspaceKey) {
    153     $option_tenant = get_option('avacy_tenant');
    154     $option_webspace_key = get_option('avacy_webspace_key');
    155    
    156     $endpoint = 'https://api.avacy.eu/wp/validate/' . $tenant . '/' . $webspaceKey;
    157 
     177    global $api_base_url;
     178
     179    $option_account_token = get_option('avacy_webspace_key');
     180   
     181    if( empty($option_account_token) ) {   
     182      $option_account_token = $webspaceKey;
     183    }
     184
     185    if (strpos($option_account_token, '|') === false) {
     186      $option_tenant = get_option('avacy_tenant');
     187      $option_webspace_key = $option_account_token;
     188      $save_account_token = $option_webspace_key;
     189    } else {
     190      $option_tenant = explode('|', $option_account_token)[0] ?? '';
     191      $option_webspace_key = explode('|', $option_account_token)[1] ?? '';
     192      $save_account_token = $option_account_token;
     193    }
     194   
     195    $endpoint = $api_base_url . '/wp/validate/' . $option_tenant . '/' . $option_webspace_key;   
    158196    $response = wp_remote_get($endpoint);
    159197    $status_code = wp_remote_retrieve_response_code($response);
    160198    $body = wp_remote_retrieve_body($response);
    161199    $data = json_decode($body, true);
    162 
    163200
    164201    $setting = '';
     
    185222      }
    186223    } else {
    187       if ($tenant === $option_tenant && $webspaceKey === $option_webspace_key) {
     224      if ( ($tenant === $option_tenant && $webspaceKey === $option_webspace_key) || (isset($_POST['avacy_webspace_key']) && $option_account_token === $_POST['avacy_webspace_key'])) {
    188225        return [];
    189226      }
     
    194231      }
    195232      if (!empty($webspaceKey)) {
    196         update_option('avacy_webspace_key', esc_attr($webspaceKey));
     233        update_option('avacy_webspace_key', esc_attr($save_account_token));
    197234      }
    198235      if (!empty($webspaceId)) {
     
    219256
    220257  public static function checkConsentSolutionToken($apiToken) {
     258    global $api_base_url;
    221259    $option_api_token = get_option('avacy_api_token');
    222260
     
    230268      $option_webspace_key = get_option('avacy_webspace_key');
    231269
    232       $endpoint = 'https://api.avacy.eu/wp/validate/' . $option_tenant . '/' . $option_webspace_key . '/' . $apiToken;
     270      if( strpos($option_webspace_key, '|') === false ) {
     271        $option_webspace_key = $option_webspace_key;
     272      } else {
     273        $option_tenant = explode('|', $option_webspace_key)[0] ?? '';
     274        $option_webspace_key = explode('|', $option_webspace_key)[1] ?? '';
     275      }
     276
     277      $endpoint = $api_base_url . '/wp/validate/' . $option_tenant . '/' . $option_webspace_key . '/' . $apiToken;
     278      // $endpoint = $api_base_url . '/wp/validate/' . $apiToken;
    233279
    234280      $response = wp_remote_get($endpoint);
  • avacy/trunk/src/EnqueueBanner.php

    r3123908 r3305818  
    1414    public static function enqueueScripts() {
    1515        $avacy_team = esc_attr(get_option('avacy_tenant'));
    16         $avacy_uuid = esc_attr(get_option('avacy_webspace_key'));
     16
     17        $avacy_account_token = esc_attr(get_option('avacy_webspace_key'));
     18        if(strpos($avacy_account_token, '|')) {
     19            $avacy_account_token = explode('|', $avacy_account_token);
     20            $avacy_uuid = $avacy_account_token[1];
     21        } else {
     22            $avacy_uuid = esc_attr(get_option('avacy_webspace_key'));
     23        }
    1724
    1825        if (!empty($avacy_team) && !empty($avacy_uuid)) {
  • avacy/trunk/src/FormSubmission.php

    r3123908 r3305818  
    88class FormSubmission
    99{
    10     private array $fields;
    11     private string $identifier;
    12     private string $ipAddress;
    13     private string $proofs;
    14     private array $legalNotices;
    15     private array $preferences;
     10    private $ipAddress;
     11    private $consentType;
     12    private $optin;
     13    private $consentData;
     14    private $identifier;
     15    private $source;
     16    private $consentFeatures;
     17    private $proof;
    1618
    1719    public function __construct(
    18         $fields,
     20        $ipAddress,
     21        $consentType,
     22        $optin,
     23        $consentData,
    1924        $identifier,
    20         $ipAddress,
    21         $proofs,
    22         $legalNotices,
    23         $preferences
     25        $source,
     26        $consentFeatures,
     27        $proof
    2428    ) {
    25         $this->fields = $this->sanitizeFields($fields);
    26         $this->identifier = sanitize_text_field($identifier);
    27         $this->ipAddress = sanitize_text_field($ipAddress);
    28         $this->proofs = sanitize_text_field($proofs);
    29         $this->legalNotices = $this->sanitizeLegalNotices($legalNotices);
    30         $this->preferences = $this->sanitizePreferences($preferences);
     29        $this->ipAddress = $ipAddress ?: '0.0.0.0';
     30        $this->consentType = $consentType;
     31        $this->optin = $optin;
     32        $this->consentData = $consentData;
     33        $this->identifier = $identifier;
     34        $this->source = $source;
     35        $this->consentFeatures = $consentFeatures;
     36        $this->proof = $proof;
    3137    }
    3238
     
    3440    {
    3541        return [
    36             'subject' => $this->fields,
     42            'ip_address' => $this->ipAddress,
     43            'consent_type' => $this->consentType,
     44            'optin' => $this->optin,
     45            'consent_data' => json_decode($this->consentData, true),
    3746            'identifier' => $this->identifier,
    38             'ip_address' => $this->ipAddress,
    39             'proofs' => $this->proofs,
    40             'legal_notices' => $this->legalNotices,
    41             'preferences' => $this->preferences
     47            'source' => $this->source,
     48            'consent_features' => $this->consentFeatures,
     49            'html_form' => $this->proof,
    4250        ];
    4351    }
  • avacy/trunk/src/Integrations/ContactForm7.php

    r3239981 r3305818  
    88use Jumpgroup\Avacy\Form;
    99use WPCF7_Submission;
    10 use Jumpgroup\Avacy\Interfaces\Integration;
     10use Jumpgroup\Avacy\Interfaces\Form as FormInterface;
    1111use Jumpgroup\Avacy\SendFormsToConsentSolution;
    1212use Jumpgroup\Avacy\FormSubmission;
     
    1414use WPCF7_ContactForm;
    1515
    16 class ContactForm7 implements Integration
     16class ContactForm7 implements FormInterface
    1717{
    1818
     
    3131        $selectedFields = [];
    3232        foreach($fields as $field) {
    33             $selectedFields[$field] = sanitize_text_field($posted_data[$field]);
     33            if(!empty($field)) {
     34                $selectedFields[] = [
     35                    'label' => $field,
     36                    'value' => sanitize_text_field($posted_data[$field])
     37                ];
     38            }
    3439        }
    3540
    36         $identifier = get_option('avacy_contact_form_7_'. $id .'_form_user_identifier'); // TODO: get identifier from settings
     41        $identifierKey = get_option('avacy_contact_form_7_'. $id .'_form_user_identifier'); // TODO: get identifier from settings
    3742        $remoteAddr = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
    3843        $ipAddress = $remoteAddr ?: '0.0.0.0';
    39         $proofs = wp_json_encode($contact_form->form);
    40 
    41         // TODO: get legal notices from settings
    42         $legalNotices = [
    43             ["name" => "privacy_policy"],
    44             ["name" => "cookie_policy"]
    45         ];
    46 
    47         // TODO: get preferences from settings
    48         $preferences = [
    49             [
    50                 "name" => "newsletter",
    51                 "accepted" => true
    52             ],
    53             [
    54                 "name" => "updates",
    55                 "accepted" => true
    56             ]
     44        $proof = self::getHTMLForm($id);
     45        $consentData = wp_json_encode($selectedFields);
     46        $identifier = $posted_data[$identifierKey] ?? null;
     47        $consentFeatures = [
     48            'privacy_policy',
     49            'cookie_policy'
    5750        ];
    5851
    5952        $sub = new FormSubmission(
    60             $selectedFields,
     53            $ipAddress,
     54            'form',
     55            'accepted',
     56            $consentData,
    6157            $identifier,
    62             $ipAddress,
    63             $proofs,
    64             $legalNotices,
    65             $preferences
     58            'plugin',
     59            $consentFeatures,
     60            $proof
    6661        );
    6762
     
    124119        }, $fieldNames);
    125120    }
     121
     122    /**
     123     * This function retrieves the HTML form for the Contact Form 7 from the id
     124     */
     125    public static function getHTMLForm($id): string {
     126        $shortcode = '[contact-form-7 id="' . $id . '"]';
     127        return self::renderShortcode($shortcode);
     128    }
     129
     130    protected static function renderShortcode(string $shortcode): string {
     131        ob_start();
     132        echo do_shortcode($shortcode);
     133        return ob_get_clean();
     134    }
    126135}
  • avacy/trunk/src/Integrations/ElementorForms.php

    r3239361 r3305818  
    77
    88use Jumpgroup\Avacy\Form;
    9 use Jumpgroup\Avacy\Interfaces\Integration;
     9use Jumpgroup\Avacy\Interfaces\Form as FormInterface;
    1010use Jumpgroup\Avacy\SendFormsToConsentSolution;
    1111use Jumpgroup\Avacy\FormSubmission;
    1212use WP_Query;
    1313
    14 class ElementorForms implements Integration {
     14class ElementorForms implements FormInterface {
    1515   
    1616    public static function listen() : void {
     
    176176        }
    177177    }
     178
     179    public static function getHTMLForm($id) : string
     180    {
     181        return '';
     182    }
    178183}
  • avacy/trunk/src/Integrations/HtmlForms.php

    r3290429 r3305818  
    99use Jumpgroup\Avacy\Form;
    1010use Jumpgroup\Avacy\FormSubmission;
    11 use Jumpgroup\Avacy\Interfaces\Integration;
     11use Jumpgroup\Avacy\Interfaces\Form as FormInterface;
    1212use Jumpgroup\Avacy\SendFormsToConsentSolution;
    1313use WP_Query;
    1414
    15 class HtmlForms implements Integration {
     15class HtmlForms implements FormInterface {
    1616    public static function listen() : void {
    1717        add_action('hf_form_success', [__CLASS__, 'formSubmitted'], 10, 2);
     
    1919
    2020    public static function convertToFormSubmission($contact_form) : FormSubmission {
    21         $identifier = get_option('avacy_html_forms_'. $contact_form['id'] . '_form_user_identifier');
     21        $identifierKey = get_option('avacy_html_forms_'. $contact_form['id'] . '_form_user_identifier');
     22        $identifier = $contact_form['submission'][$identifierKey];
    2223        $remoteAddr = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
    2324        $ipAddress = $remoteAddr ?: '0.0.0.0';
    2425
    25         $proofs = wp_json_encode($contact_form['source']);
     26        $proof = self::getHTMLForm($contact_form['slug']);
    2627        $fields = self::getFields($contact_form['id']);
    2728
    2829        $selectedFields = [];
    2930        foreach($fields as $field) {
    30             $selectedFields[$field] = sanitize_text_field($contact_form['submission'][$field]);
     31            if(!empty($field)) {
     32                $selectedFields[] = [
     33                    'label' => $field,
     34                    'value' => sanitize_text_field($contact_form['submission'][$field])
     35                ];
     36            }
    3137        }
    3238
    33         // TODO: get legal notices from settings
    34         $legalNotices = [
    35             ["name" => "privacy_policy"],
    36             ["name" => "cookie_policy"]
     39        $consentData = wp_json_encode($selectedFields);
     40
     41        $consentFeatures = [
     42            'privacy_policy',
     43            'cookie_policy'
    3744        ];
    3845
    39         // TODO: get preferences from settings
    40         $preferences = [
    41             [
    42                 "name" => "newsletter",
    43                 "accepted" => true
    44             ],
    45             [
    46                 "name" => "updates",
    47                 "accepted" => true
    48             ]
    49         ];
     46        $sub = new FormSubmission(
     47            $ipAddress,
     48            'form',
     49            'accepted',
     50            $consentData,
     51            $identifier,
     52            'plugin',
     53            $consentFeatures,
     54            $proof
     55        );
    5056
    51         return new FormSubmission(
    52             $selectedFields,
    53             $identifier,
    54             $ipAddress,
    55             $proofs,
    56             $legalNotices,
    57             $preferences
    58         );
     57        return $sub;
    5958    }
    6059
    6160    public static function formSubmitted($submission, $form) : void {
     61
    6262        // eventually we want to do something with the form...
    6363        $submissionInput = [];
     
    7070        $formData['id'] = $submission->form_id;
    7171        $formData['source'] = htmlentities($form->markup);
     72        $formData['slug'] = htmlentities($form->slug);
    7273
    7374        self::sendFormData($formData);
     
    163164    }
    164165
     166    public static function getHTMLForm($id) : string
     167    {
     168        $shortcode = '[hf_form slug="' . $id . '"]';
     169        $form = self::renderShortcode($shortcode);
     170        return $form;
     171    }
     172
     173    public static function renderShortcode($shortcode) : string
     174    {
     175        ob_start();
     176        echo do_shortcode($shortcode);
     177        return ob_get_clean();
     178    }
     179
    165180}
  • avacy/trunk/src/Integrations/WooCommerceCheckoutForm.php

    r3239361 r3305818  
    77
    88use Jumpgroup\Avacy\Form;
    9 use Jumpgroup\Avacy\Interfaces\Integration;
     9use Jumpgroup\Avacy\Interfaces\Form as FormInterface;
    1010use Jumpgroup\Avacy\SendFormsToConsentSolution;
    1111use Jumpgroup\Avacy\FormSubmission;
    1212use WP_Query;
    1313
    14 class WooCommerceCheckoutForm implements Integration
     14class WooCommerceCheckoutForm implements FormInterface
    1515{
    1616
     
    6161    public static function convertToFormSubmission($order_id) : FormSubmission
    6262    {
    63         $checkoutForm = self::getWcCheckoutTemplate();
    6463
    65         $identifier = get_option('avacy_WooCommerce_Checkout_Form_' . $id . '_form_user_identifier'); // TODO: get identifier from settings
     64        $identifierKey = get_option('avacy_WooCommerce_Checkout_Form_' . $id . '_form_user_identifier'); // TODO: get identifier from settings
     65        $identifier = '';
     66
    6667        $remoteAddr = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
    6768        $ipAddress = $remoteAddr ?: '0.0.0.0';
    68         $proofs = wp_json_encode($checkoutForm);
    6969        $posted_data = wc_get_order($order_id)->get_data()['billing'];
     70        $proofs = self::getHTMLForm(1);
    7071       
    7172        $fields = self::getFields();
     
    7475        foreach($fields as $field) {
    7576            if(isset($posted_data[$field]))
    76                 $selectedFields[$field] = sanitize_text_field($posted_data[$field]);
     77                $selectedFields[$field] = [
     78                    'label' => $field,
     79                    'value' => sanitize_text_field($posted_data[$field])
     80                ];
    7781        }
    7882
    79         // TODO: get legal notices from settings
    80         $legalNotices = [
    81             ["name" => "privacy_policy"],
    82             ["name" => "cookie_policy"]
     83        $selectedFields[] =
     84        $identifier = $posted_data[$identifier] ?? null;
     85        $consentFeatures = [
     86            'privacy_policy',
     87            'cookie_policy'
    8388        ];
    8489
    85         // TODO: get preferences from settings
    86         $preferences = [
    87             [
    88                 "name" => "newsletter",
    89                 "accepted" => true
    90             ],
    91             [
    92                 "name" => "updates",
    93                 "accepted" => true
    94             ]
    95         ];
     90        $consentData = wp_json_encode($selectedFields);
    9691
    97         return new FormSubmission(
    98             $selectedFields,
     92        $sub = new FormSubmission(
     93            $ipAddress,
     94            'form',
     95            'accepted',
     96            $consentData,
    9997            $identifier,
    100             $ipAddress,
    101             $proofs,
    102             $legalNotices,
    103             $preferences
     98            'plugin',
     99            $consentFeatures,
     100            $proofs
    104101        );
     102
     103        return $sub;
    105104    }
    106105
     
    132131    }
    133132
    134     private static function getWcCheckoutTemplate() {
     133    public static function getHTMLForm($id) : string {
    135134        ob_start();
    136135
     
    145144        ob_end_clean();
    146145
    147         return $checkoutForm;
     146        return json_encode($checkoutForm);
    148147    }
    149148
  • avacy/trunk/src/Integrations/WpForms.php

    r3239361 r3305818  
    77
    88use Jumpgroup\Avacy\Form;
    9 use Jumpgroup\Avacy\Interfaces\Integration;
     9use Jumpgroup\Avacy\Interfaces\Form as FormInterface;
    1010use Jumpgroup\Avacy\SendFormsToConsentSolution;
    1111use Jumpgroup\Avacy\FormSubmission;
    1212
    13 class WpForms implements Integration {
     13class WpForms implements FormInterface {
    1414   
    1515    public static function listen() : void {
     
    1919    public static function convertToFormSubmission($contact_form) : FormSubmission {
    2020        $id = absint($contact_form['id']);
    21         $identifier = get_option('avacy_wp_forms_' . $id . '_form_user_identifier');
     21        $identifierKey = get_option('avacy_wp_forms_' . $id . '_form_user_identifier');
     22        $identifier = '';
    2223        $remoteAddr = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
    2324        $ipAddress = $remoteAddr ?: '0.0.0.0';
     
    2526        $fields = self::getFields($id);
    2627        $selectedFields = [];
    27 
    28         $formContent = wpforms()->form->get( $id, array( 'content_only' => true ) );
    2928
    3029        $submittedFields = $contact_form['fields'];
     
    3433                $slug = strtolower(str_replace(' ', '_', $inputValue['name']));
    3534                if($field === $slug) {
    36                     $selectedFields[$field] = sanitize_text_field($inputValue['value']);
     35                    $selectedFields[] = [
     36                        'label' => $field,
     37                        'value' => sanitize_text_field($inputValue['value'])
     38                    ];
     39                }
     40
     41                if($identifierKey === $slug) {
     42                    $identifier = $inputValue['value'];
    3743                }
    3844            }
    3945        }
    4046
    41         $proofs = wp_json_encode($formContent);
    42 
    43         // TODO: get legal notices from settings
    44         $legalNotices = [
    45             ["name" => "privacy_policy"],
    46             ["name" => "cookie_policy"]
     47        $consentData = wp_json_encode($selectedFields);
     48        $consentFeatures = [
     49            'privacy_policy',
     50            'cookie_policy'
    4751        ];
    4852
    49         // TODO: get preferences from settings
    50         $preferences = [
    51             [
    52                 "name" => "newsletter",
    53                 "accepted" => true
    54             ],
    55             [
    56                 "name" => "updates",
    57                 "accepted" => true
    58             ]
    59         ];
     53        $proofs = self::getHTMLForm($id);
     54        $sub = new FormSubmission(
     55            $ipAddress,
     56            'form',
     57            'accepted',
     58            $consentData,
     59            $identifier,
     60            'plugin',
     61            $consentFeatures,
     62            $proofs
     63        );
    6064
    61         return new FormSubmission(
    62             $selectedFields,
    63             $identifier,
    64             $ipAddress,
    65             $proofs,
    66             $legalNotices,
    67             $preferences
    68         );
     65        return $sub;
    6966    }
    7067
     
    132129        }, $fieldNames);
    133130    }
     131
     132    public static function getHTMLForm($id) : string
     133    {
     134        $shortcode = '[wpforms id="' . $id . '"]';
     135        $form = self::renderShortcode($shortcode);
     136        return $form;
     137    }
     138
     139    public static function renderShortcode($shortcode) : string
     140    {
     141        ob_start();
     142        echo do_shortcode($shortcode);
     143        return ob_get_clean();
     144    }
    134145}
  • avacy/trunk/src/SendFormsToConsentSolution.php

    r3123908 r3305818  
    3030  public static function send(FormSubmission $form)
    3131  {
     32    global $api_base_url;
     33
    3234    $payload = $form->getPayload();
    3335    $apiToken = get_option('avacy_api_token');
    3436    $tenant = get_option('avacy_tenant');
     37    if( empty($tenant) && strpos(get_option('avacy_webspace_key'), '|') !== false ) {
     38      $tenant = explode('|', get_option('avacy_webspace_key'))[0];
     39    }
     40
    3541    $webspaceId = get_option('avacy_webspace_id');
    3642
     
    5258
    5359    // API endpoint URL
    54     $url = 'https://api.avacy.eu/' . $tenant . '/v2/webspaces/' . $webspaceId . '/consents';
     60    $url = $api_base_url . '/' . $tenant . '/v4/webspaces/' . $webspaceId . '/consents';
    5561
    5662    // Set the arguments for the POST request
  • avacy/trunk/src/views/avacy-dashboard.php

    r3239363 r3305818  
    44    }
    55    use Jumpgroup\Avacy\AddAdminInterface;
     6
     7    global $api_base_url;
    68    // esacape the base api url
    7     $base_api_url = esc_attr('https://api.avacy.eu/wp');
     9    $base_api_url = esc_attr($api_base_url . '/wp');
    810    $registration_url = esc_attr('https://avacy.eu/registration');
    911    $documention_url = esc_attr('https://docs.avacysolution.com');
     
    6870        <section class="AvacySection AvacySection--Account">
    6971            <div class="EditAccountPanel <?php echo !empty(get_option('avacy_webspace_id')) ? 'hidden' : ''?>">
    70                 <sl-input name="avacy_tenant" placeholder="<?php echo esc_html__('Enter the name of your team', 'avacy')?>" size="small" value="<?php echo esc_attr(get_option('avacy_tenant')); ?>" required>
     72                <!-- <sl-input name="avacy_tenant" placeholder="<?php echo esc_html__('Enter the name of your team', 'avacy')?>" size="small" value="<?php echo esc_attr(get_option('avacy_tenant')); ?>" required>
    7173                    <label for="avacy_tenant" slot="label">
    7274                        <span><?php echo esc_html__('Avacy Team Name', 'avacy')?></span>
     
    7577                        <sl-icon name="info-circle"></sl-icon>
    7678                    </sl-tooltip>
    77                 </sl-input>
     79                </sl-input> -->
    7880                <sl-input name="avacy_webspace_key" placeholder="<?php echo esc_html__('Enter the specific key of your webspace', 'avacy')?>" size="small" value="<?php echo esc_attr(get_option('avacy_webspace_key')); ?>" required>
    7981                    <label for="avacy_webspace_key" slot="label">
     
    8890            </div>
    8991            <div class="RenderAccountPanel <?php echo empty(get_option('avacy_webspace_id')) ? 'hidden' : ''?>">
    90                 <div class="AccountDetail"><span class="AccountDetail__Key"><?php echo esc_html__('Avacy Team Name', 'avacy')?>:</span><span class="AccountDetail__Value"><?php echo esc_attr(get_option('avacy_tenant')); ?></span></div>
     92                <!-- <div class="AccountDetail"><span class="AccountDetail__Key"><?php echo esc_html__('Avacy Team Name', 'avacy')?>:</span><span class="AccountDetail__Value"><?php echo esc_attr(get_option('avacy_tenant')); ?></span></div> -->
    9193                <div class="AccountDetail"><span class="AccountDetail__Key"><?php echo esc_html__('Webspace Key', 'avacy')?>:</span><span class="AccountDetail__Value"><?php echo esc_attr(get_option('avacy_webspace_key')); ?></span></div>
    9294                <sl-button class="Edit" variant="text">
  • avacy/trunk/vendor/autoload.php

    r3299219 r3305818  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • avacy/trunk/vendor/composer/InstalledVersions.php

    r3299219 r3305818  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • avacy/trunk/vendor/composer/autoload_classmap.php

    r3299219 r3305818  
    1818    'Jumpgroup\\Avacy\\Integrations\\WooCommerceCheckoutForm' => $baseDir . '/src/Integrations/WooCommerceCheckoutForm.php',
    1919    'Jumpgroup\\Avacy\\Integrations\\WpForms' => $baseDir . '/src/Integrations/WpForms.php',
    20     'Jumpgroup\\Avacy\\Interfaces\\Integration' => $baseDir . '/src/Interfaces/Integration.php',
     20    'Jumpgroup\\Avacy\\Interfaces\\Form' => $baseDir . '/src/Interfaces/Form.php',
    2121    'Jumpgroup\\Avacy\\PreemptiveBlock' => $baseDir . '/src/PreemptiveBlock.php',
    2222    'Jumpgroup\\Avacy\\SendFormsToConsentSolution' => $baseDir . '/src/SendFormsToConsentSolution.php',
  • avacy/trunk/vendor/composer/autoload_static.php

    r3299219 r3305818  
    3333        'Jumpgroup\\Avacy\\Integrations\\WooCommerceCheckoutForm' => __DIR__ . '/../..' . '/src/Integrations/WooCommerceCheckoutForm.php',
    3434        'Jumpgroup\\Avacy\\Integrations\\WpForms' => __DIR__ . '/../..' . '/src/Integrations/WpForms.php',
    35         'Jumpgroup\\Avacy\\Interfaces\\Integration' => __DIR__ . '/../..' . '/src/Interfaces/Integration.php',
     35        'Jumpgroup\\Avacy\\Interfaces\\Form' => __DIR__ . '/../..' . '/src/Interfaces/Form.php',
    3636        'Jumpgroup\\Avacy\\PreemptiveBlock' => __DIR__ . '/../..' . '/src/PreemptiveBlock.php',
    3737        'Jumpgroup\\Avacy\\SendFormsToConsentSolution' => __DIR__ . '/../..' . '/src/SendFormsToConsentSolution.php',
  • avacy/trunk/vendor/composer/installed.php

    r3299219 r3305818  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '4079e2eb96de082dd880b4a4dbaab5c3dae52f2e',
     6        'reference' => '23989fdd4f75d9b7a42cd5f4cbc43ed4a9f6fc7d',
    77        'type' => 'wordpress-muplugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '4079e2eb96de082dd880b4a4dbaab5c3dae52f2e',
     16            'reference' => '23989fdd4f75d9b7a42cd5f4cbc43ed4a9f6fc7d',
    1717            'type' => 'wordpress-muplugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.