Plugin Directory

Changeset 3298601


Ignore:
Timestamp:
05/22/2025 10:06:02 AM (9 months ago)
Author:
cookiebot
Message:

Releasing version 4.5.7

Location:
cookiebot/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • cookiebot/trunk/assets/js/backend/account.js

    r3289738 r3298601  
    2929        const data = await response.json();
    3030
    31         if (data.status === 'DONE') {
     31        if (data.status?.toLowerCase() === 'done') {
    3232            await fetch(cookiebot_account.ajax_url, {
    3333                method: 'POST',
     
    198198    const urlParams = new URLSearchParams(window.location.search);
    199199    const ucApiCode = urlParams.get('uc_api_code');
     200    const companyId = urlParams.get('company_id');
     201
    200202    // if (!cookiebot_account.has_cbid) {
    201203    //     window.trackAmplitudeEvent('Get Started Page Visited');
     
    206208    }
    207209
     210    if (cookiebot_account.cbid !== cookiebot_account.scan_id) {
     211        await fetch(cookiebot_account.ajax_url, {
     212            method: 'POST',
     213            body: createFormData('cookiebot_update_scan_id', {
     214                scan_id: cookiebot_account.cbid
     215            }),
     216            credentials: 'same-origin'
     217        });
     218        if (canReload()) {
     219            window.location.reload();
     220        }
     221    }
     222
    208223    // For previously onboarded users that disconnected the account, no new account registration workflow is needed
    209     if (!cookiebot_account.has_cbid && cookiebot_account.was_onboarded) {
    210         return;
    211     }
     224    // if (!cookiebot_account.has_cbid && cookiebot_account.was_onboarded) {
     225    //     return;
     226    // }
    212227
    213228    try {
     
    317332        }
    318333
    319         if (!cbid) {
     334        if (!cbid && companyId) {
    320335            try {
    321336                // Create new configuration
     
    334349                        data_controller: "",
    335350                        legal_framework_template: "gdpr",
    336                         domains: [formattedDomain]
     351                        domains: [formattedDomain],
     352                        company_id: companyId
    337353                    })
    338354                });
  • cookiebot/trunk/readme.txt

    r3291994 r3298601  
    200200## Changelog ##
    201201**Cookiebot CMP Plugin will soon no longer support PHP 5. If your website still runs on this version we recommend upgrading so you can continue enjoying the features Cookiebot CMP offers.**
     202
     203### 4.5.7 ###
     204Release date: May 22th 2025
     205
     206Cookiebot CMP version 4.5.7 is out! This release has some bugfixes
     207
     208####Bugfixes####
     209
     210* Fixed issues with user login sessions
     211* Resolved problems when disconnecting accounts or deactivating the plugin
     212* Prevented duplicate companies from being created
     213* Improved enforcement of user entitlements
    202214
    203215### 4.5.6 ###
  • cookiebot/trunk/src/lib/Account_Service.php

    r3284229 r3298601  
    5252        add_action( 'wp_ajax_cookiebot_delete_auth_token', array( $this, 'ajax_delete_auth_token' ) );
    5353        add_action( 'wp_ajax_cookiebot_store_onboarding_status', array( $this, 'ajax_store_onboarding_status' ) );
     54        add_action( 'wp_ajax_cookiebot_update_scan_id', array( $this, 'ajax_update_scan_id' ) );
    5455    }
    5556
     
    123124    }
    124125
     126    public function ajax_update_scan_id() {
     127        if ( ! check_ajax_referer( 'cookiebot-account', 'nonce', false ) || ! current_user_can( 'manage_options' ) ) {
     128            wp_send_json_error( 'Unauthorized', 401 );
     129        }
     130
     131        $scan_id = isset( $_POST['scan_id'] ) ? sanitize_text_field( $_POST['scan_id'] ) : '';
     132
     133        if ( empty( $scan_id ) ) {
     134            wp_send_json_error( 'Scan ID is required', 400 );
     135        }
     136
     137        update_option( 'cookiebot-scan-id', $scan_id );
     138        wp_send_json_success();
     139    }
     140
    125141    public function ajax_post_user_data() {
    126142        if ( ! check_ajax_referer( 'cookiebot-account', 'nonce', false ) || ! current_user_can( 'manage_options' ) ) {
  • cookiebot/trunk/src/settings/Menu_Settings.php

    r3284229 r3298601  
    4545        $user_data  = Cookiebot_WP::get_user_data();
    4646
    47         if ( $option_name === 'cookiebot-cbid' && empty( $option_value ) && ! empty( $auth_token ) && ! empty( $user_data ) ) {
     47        if ( $option_name === 'cookiebot-cbid' && empty( $option_value ) ) {
    4848            Cookiebot_WP::debug_log( 'Account Disconnected: clearing user_data' );
     49            // Clean up all user data
     50            delete_option( 'cookiebot-auth-token' );
    4951            delete_option( 'cookiebot-user-data' );
     52            delete_option( 'cookiebot-configuration' );
     53            delete_option( 'cookiebot-scan-id' );
     54            delete_option( 'cookiebot-scan-status' );
     55            delete_option( 'cookiebot-banner-enabled' );
     56            delete_option( 'cookiebot_banner_live_dismissed' );
     57            delete_option( 'cookiebot-cookie-blocking-mode' );
     58            delete_option( 'cookiebot-uc-auto-blocking-mode' );
     59            delete_option( 'cookiebot-uc-onboarded-via-signup' );
    5060        }
    5161    }
  • cookiebot/trunk/src/settings/pages/Dashboard_Page.php

    r3284229 r3298601  
    6565        $user_data          = Cookiebot_WP::get_user_data();
    6666        $scan_status        = Cookiebot_WP::get_scan_status();
     67        $scan_id            = get_option( 'cookiebot-scan-id' );
    6768        $banner_enabled     = Cookiebot_WP::get_banner_enabled();
    6869        $auto_blocking_mode = Cookiebot_WP::get_auto_blocking_mode();
     
    7172        $legal_framework    = Cookiebot_WP::get_legal_framwework();
    7273        $is_authenticated   = ! empty( Cookiebot_WP::get_auth_token() );
     74        $is_cb_user         = Cookiebot_Frame::is_cb_frame_type();
    7375
    7476        // Get user data and check if they were onboarded via signup
     
    8183            'user_data'             => $user_data,
    8284            'scan_status'           => $scan_status,
     85            'scan_id'               => $scan_id,
    8386            'cb_wp'                 => CYBOT_COOKIEBOT_PLUGIN_URL . 'assets/img/cb-wp.png',
    8487            'europe_icon'           => CYBOT_COOKIEBOT_PLUGIN_URL . 'assets/img/europe.png',
     
    140143                    'nonce'             => wp_create_nonce( 'cookiebot-account' ),
    141144                    'cbid'              => $cbid,
     145                    'scan_id'           => $scan_id,
    142146                    'has_user_data'     => ! empty( $user_data ),
    143147                    'has_cbid'          => ! empty( $cbid ),
     
    176180                    'nonce'         => wp_create_nonce( 'cookiebot-account' ),
    177181                    'cbid'          => $cbid,
     182                    'scan_id'       => $scan_id,
    178183                    'has_user_data' => ! empty( $user_data ),
    179184                    'has_cbid'      => ! empty( $cbid ),
     
    187192        }
    188193
    189         // Modified condition to check for onboarding status
    190         if ( ! empty( $cbid ) && ( empty( $user_data ) && ! $was_onboarded ) ) {
     194        // Redirect CB users to previous dashboard page
     195        if ( ( ! empty( $cbid ) && $is_cb_user ) || ( ! empty( $cbid ) && empty( $user_data ) ) ) {
    191196            wp_enqueue_style(
    192197                'cookiebot-dashboard-backup-css',
     
    211216                    'nonce'         => wp_create_nonce( 'cookiebot-account' ),
    212217                    'cbid'          => $cbid,
     218                    'scan_id'       => $scan_id,
    213219                    'has_user_data' => ! empty( $user_data ),
    214220                    'has_cbid'      => ! empty( $cbid ),
     
    261267                'nonce'            => wp_create_nonce( 'cookiebot-account' ),
    262268                'cbid'             => $cbid,
     269                'scan_id'          => $scan_id,
    263270                'has_user_data'    => ! empty( $user_data ),
    264271                'has_cbid'         => ! empty( $cbid ),
  • cookiebot/trunk/src/view/admin/common/dashboard-page.php

    r3289355 r3298601  
    6363        <?php endif; ?>
    6464
    65         <!-- Banner connected notice -->
    66         <?php if ( ! empty( $template_args['cbid'] ) && empty( $template_args['user_data'] ) ) : ?>
    67             <div class="header-top-banners connected-banner">
    68                 <div class="banner-content">
    69                     <img src="<?php echo \esc_url( CYBOT_COOKIEBOT_PLUGIN_URL . 'assets/img/icons/check-green.svg' ); ?>"
    70                         alt="Check Icon">
    71                     <div>
    72                         <h3><?php echo esc_html__( 'Your banner is connected!', 'cookiebot' ); ?></h3>
    73                         <p style="text-wrap: nowrap;">
    74                             <?php echo esc_html__( 'Everything works as before. Manage your banner in the', 'cookiebot' ); ?>
    75                             <a href="<?php echo esc_url( $template_args['cookiebot_admin_link'] ); ?>" target="_blank"><?php echo esc_html__( 'Cookiebot Manager', 'cookiebot' ); ?></a>
    76                             <?php echo esc_html__( 'or', 'cookiebot' ); ?>
    77                             <a href="<?php echo esc_url( $template_args['uc_admin_link'] ); ?>" target="_blank"><?php echo esc_html__( 'Usercentrics Admin', 'cookiebot' ); ?></a>.
    78                         </p>
    79                     </div>
    80                 </div>
    81             </div>
    82         <?php endif; ?>
    83 
    8465        <!-- Banner is live notice -->
    8566        <?php
     
    126107                    <div class="header-section-no-margin">
    127108                        <img src="<?php echo \esc_url( CYBOT_COOKIEBOT_PLUGIN_URL . 'assets/img/icons/set-up-icon.svg' ); ?>" alt="Usercentrics Logo">
    128                         <?php if ( ! empty( $template_args['cbid'] ) && empty( $template_args['user_data'] ) ) : ?>
    129                             <h1><?php echo \esc_html__( 'Simplify your banner management', 'cookiebot' ); ?></h1>
    130                         <?php else : ?>
    131                             <h1><?php echo \esc_html__( 'Set up your consent banner', 'cookiebot' ); ?></h1>
    132                         <?php endif; ?>
     109                        <h1><?php echo \esc_html__( 'Set up your consent banner', 'cookiebot' ); ?></h1>
    133110                    </div>
    134111                    <div class="header-section">
    135                         <?php if ( empty( $template_args['cbid'] ) && empty( $template_args['user_data'] ) ) : ?>
    136                             <p class="subtitle">
    137                                 <?php echo esc_html__( 'Get your site GDPR-compliant in', 'cookiebot' ); ?>
    138                                 <strong><?php echo esc_html__( 'just a few clicks.', 'cookiebot' ); ?></strong>
    139                                 <?php echo esc_html__( 'Enter your email, verify it, and create your password.', 'cookiebot' ); ?>
    140                             </p>
    141                         <?php endif; ?>
    142                         <?php if ( ! empty( $template_args['cbid'] ) && empty( $template_args['user_data'] ) ) : ?>
    143                             <p class="subtitle">
    144                                 <?php echo esc_html__( 'Your setup is good to go - but we\'re making banner control even easier inside WordPress.', 'cookiebot' ); ?>
    145                                 <strong><?php echo esc_html__( 'Get access to new features', 'cookiebot' ); ?></strong>
    146                                 <?php echo esc_html__( 'by updating your banner today.', 'cookiebot' ); ?>
    147                             </p>
    148                         <?php endif; ?>
    149                     </div>
    150 
     112                        <p class="subtitle">
     113                            <?php echo esc_html__( 'Get your site GDPR-compliant in', 'cookiebot' ); ?>
     114                            <strong><?php echo esc_html__( 'just a few clicks.', 'cookiebot' ); ?></strong>
     115                            <?php echo esc_html__( 'Enter your email, verify it, and create your password.', 'cookiebot' ); ?>
     116                        </p>
     117                    </div>
    151118
    152119                    <!-- Steps Container -->
     
    155122                        <div class="step-box <?php echo ! empty( $template_args['cbid'] ) ? 'completed' : ''; ?>">
    156123                            <div class="step-row">
    157 
    158                                 <?php if ( ! empty( $template_args['cbid'] ) && empty( $template_args['user_data'] ) ) : ?>
    159                                     <div class="step-icon">
    160                                         <div class="empty-circle"></div>
    161                                     </div>
    162                                     <div class="step-content">
    163                                         <h2><?php echo \esc_html__( 'Unlock new banner', 'cookiebot' ); ?></h2>
    164                                     </div>
    165                                 <?php endif; ?>
    166 
    167                                 <?php if ( empty( $template_args['cbid'] ) && empty( $template_args['user_data'] ) ) : ?>
    168                                     <div class="step-icon">
    169                                         <div class="empty-circle"></div>
    170                                     </div>
    171                                     <div class="step-content">
    172                                         <h2><?php echo \esc_html__( 'Get your banner live in seconds', 'cookiebot' ); ?></h2>
    173                                     </div>
    174                                 <?php endif; ?>
    175 
    176124                                <?php if ( ! empty( $template_args['cbid'] ) && ! empty( $template_args['user_data'] ) ) : ?>
    177125                                    <div class="step-icon">
     
    182130                                    </div>
    183131                                    <span class="done-status">Done!</span>
     132                                <?php else : ?>
     133                                    <div class="step-icon">
     134                                        <div class="empty-circle"></div>
     135                                    </div>
     136                                    <div class="step-content">
     137                                        <h2><?php echo \esc_html__( 'Get your banner live in seconds', 'cookiebot' ); ?></h2>
     138                                    </div>
    184139                                <?php endif; ?>
    185 
    186                             </div>
    187 
    188                             <?php if ( empty( $template_args['user_data'] ) ) : ?>
     140                            </div>
     141
     142                            <?php if ( empty( $template_args['user_data'] ) || empty( $template_args['cbid'] ) && ! empty( $template_args['scan_id'] ) ) : ?>
    189143                                <div class="banner-preview-container">
    190144                                    <div class="divider"></div>
    191                                     <?php if ( ! empty( $template_args['cbid'] ) && empty( $template_args['user_data'] ) ) : ?>
    192                                         <p class="step-description">
    193                                             <?php echo esc_html__( 'We\'ve simplified privacy compliance for you. Save time with auto-setup, website scanning for data processing services, and consent-first blocking.', 'cookiebot' ); ?>
    194                                         </p>
    195                                     <?php else : ?>
    196                                         <p class="step-description">
    197                                             <?php
    198                                             echo wp_kses(
    199                                                 __( 'Instant setup with automatic cookie blocking. Try all features free for 14 days - no credit card needed.<br> Choose Free or Premium before your trial ends to stay live.', 'cookiebot' ),
    200                                                 array(
    201                                                     'strong' => array(),
    202                                                     'br' => array(),
    203                                                 )
    204                                             );
    205                                             ?>
    206                                         </p>
    207                                     <?php endif; ?>
     145                                    <p class="step-description">
     146                                        <?php
     147                                        echo wp_kses(
     148                                            __( 'Instant setup with automatic cookie blocking. Try all features free for 14 days - no credit card needed.<br> Choose Free or Premium before your trial ends to stay live.', 'cookiebot' ),
     149                                            array(
     150                                                'strong' => array(),
     151                                                'br'     => array(),
     152                                            )
     153                                        );
     154                                        ?>
     155                                    </p>
    208156                                    <div class="banner-images">
    209157                                        <?php
     
    228176                                    </div>
    229177
    230                                     <?php if ( ! empty( $template_args['cbid'] ) ) : ?>
    231                                         <div class="note-text">
    232                                             <img class="note-icon" src="<?php echo esc_url( CYBOT_COOKIEBOT_PLUGIN_URL . 'assets/img/icons/info.svg' ); ?>" />
    233                                             <span>Note: A new account comes with a new banner, which will replace your existing one.</span>
    234                                         </div>
    235                                     <?php endif; ?>
    236178                                    <div>
    237179                                        <div class="cb-general__info__text">
     
    249191
    250192                        <!-- Scan website step - only show when CBID exists -->
    251                         <?php if ( ! empty( $template_args['user_data'] ) ) : ?>
     193                        <?php if ( ! empty( $template_args['user_data'] ) && ! empty( $template_args['cbid'] ) ) : ?>
    252194                            <div class="step-box">
    253195                                <div class="step-row">
     
    313255
    314256                        <!-- Upgrade your plan step -->
    315                         <?php if ( ! empty( $template_args['user_data'] ) ) : ?>
     257                        <?php if ( ! empty( $template_args['user_data'] ) && ! empty( $template_args['cbid'] ) ) : ?>
    316258                            <div class="step-box">
    317259                                <div class="step-row">
     
    401343
    402344                <!-- Right Side - Banner Control (only show when CBID exists) -->
    403                 <?php if ( $template_args['user_data'] ) : ?>
     345                <?php if ( $template_args['user_data'] && $template_args['cbid'] ) : ?>
    404346                    <div class="gray-box-overview">
    405347                        <div class="header-section">
  • cookiebot/trunk/src/view/admin/common/templates/header.php

    r3284229 r3298601  
    3131if ( ! empty( $_GET['settings-updated'] ) ) :
    3232    ?>
    33     <div class="cb-submit__msg"><?php esc_html_e( 'Changes has been saved', 'cookiebot' ); ?></div>
     33    <div class="cb-submit__msg"><?php esc_html_e( 'Changes have been saved', 'cookiebot' ); ?></div>
    3434<?php endif; ?>
    3535<?php
  • cookiebot/trunk/src/view/admin/uc_frame/settings-page.php

    r3284229 r3298601  
    3737
    3838// Check if user was onboarded via signup
    39 $was_onboarded = Cookiebot_WP::was_onboarded_via_signup();
     39$was_onboarded = Cookiebot_WP::was_onboarded_via_signup() && ! empty( Cookiebot_WP::get_auth_token() );
    4040
    4141$header->display();
  • cookiebot/trunk/src/view/admin/uc_frame/settings/general-page.php

    r3289355 r3298601  
    1616
    1717// Check if user was onboarded via signup
    18 $was_onboarded = Cookiebot_WP::was_onboarded_via_signup();
     18$was_onboarded = Cookiebot_WP::was_onboarded_via_signup() && ! empty( Cookiebot_WP::get_auth_token() );
    1919
    2020?>
  • cookiebot/trunk/uninstall.php

    r3270554 r3298601  
    11<?php // exit if uninstall constant is not defined
    2 if (!defined('WP_UNINSTALL_PLUGIN')) exit;
     2if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
     3    exit;
     4}
    35
    4 // All new and legacy config params (except param: 'cookiebot-uc-onboarded-via-signup')
     6// All new and legacy config params
     7// phpcs:ignore
     8// phpcs:ignore
    59$options = array(
    6     'cookiebot-cbid',
    7     'cookiebot-auth-token',
    8     'cookiebot-user-data',
    9     'cookiebot-configuration',
    10     'cookiebot-scan-id',
    11     'cookiebot-scan-status',
    12     'cookiebot-banner-enabled',
    13     'cookiebot_banner_live_dismissed',
    14     'cookiebot-uc-auto-blocking-mode',
     10    'cookiebot-cbid',
     11    'cookiebot-auth-token',
     12    'cookiebot-user-data',
     13    'cookiebot-configuration',
     14    'cookiebot-scan-id',
     15    'cookiebot-scan-status',
     16    'cookiebot-banner-enabled',
     17    'cookiebot_banner_live_dismissed',
     18    'cookiebot-uc-auto-blocking-mode',
     19    'cookiebot-uc-onboarded-via-signup',
    1520
    16     'cookiebot-ruleset-id',
    17     'cookiebot-language',
    18     'cookiebot-front-language',
    19     'cookiebot-nooutput',
    20     'cookiebot-nooutput-admin',
    21     'cookiebot-output-logged-in',
    22     'cookiebot-ignore-scripts',
    23     'cookiebot-autoupdate',
    24     'cookiebot-script-tag-uc-attribute',
    25     'cookiebot-script-tag-cd-attribute',
    26     'cookiebot-cookie-blocking-mode',
    27     'cookiebot-iab',
    28     'cookiebot-tcf-version',
    29     'cookiebot-tcf-purposes',
    30     'cookiebot-tcf-special-purposes',
    31     'cookiebot-tcf-features',
    32     'cookiebot-tcf-special-features',
    33     'cookiebot-tcf-vendors',
    34     'cookiebot-tcf-disallowed',
    35     'cookiebot-tcf-ac-vendors',
    36     'cookiebot-ccpa',
    37     'cookiebot-ccpa-domain-group-id',
    38     'cookiebot-gtm',
    39     'cookiebot-gtm-id',
    40     'cookiebot-gtm-cookies',
    41     'cookiebot-data-layer',
    42     'cookiebot-gcm',
    43     'cookiebot-gcm-first-run',
    44     'cookiebot-gcm-url-passthrough',
    45     'cookiebot-gcm-cookies',
    46     'cookiebot-multiple-config',
    47     'cookiebot-second-banner-regions',
    48     'cookiebot-second-banner-id',
    49     'cookiebot-multiple-banners',
     21    'cookiebot-ruleset-id',
     22    'cookiebot-language',
     23    'cookiebot-front-language',
     24    'cookiebot-nooutput',
     25    'cookiebot-nooutput-admin',
     26    'cookiebot-output-logged-in',
     27    'cookiebot-ignore-scripts',
     28    'cookiebot-autoupdate',
     29    'cookiebot-script-tag-uc-attribute',
     30    'cookiebot-script-tag-cd-attribute',
     31    'cookiebot-cookie-blocking-mode',
     32    'cookiebot-iab',
     33    'cookiebot-tcf-version',
     34    'cookiebot-tcf-purposes',
     35    'cookiebot-tcf-special-purposes',
     36    'cookiebot-tcf-features',
     37    'cookiebot-tcf-special-features',
     38    'cookiebot-tcf-vendors',
     39    'cookiebot-tcf-disallowed',
     40    'cookiebot-tcf-ac-vendors',
     41    'cookiebot-ccpa',
     42    'cookiebot-ccpa-domain-group-id',
     43    'cookiebot-gtm',
     44    'cookiebot-gtm-id',
     45    'cookiebot-gtm-cookies',
     46    'cookiebot-data-layer',
     47    'cookiebot-gcm',
     48    'cookiebot-gcm-first-run',
     49    'cookiebot-gcm-url-passthrough',
     50    'cookiebot-gcm-cookies',
     51    'cookiebot-multiple-config',
     52    'cookiebot-second-banner-regions',
     53    'cookiebot-second-banner-id',
     54    'cookiebot-multiple-banners',
    5055);
    51 
    5256// Delete all config params
     57// phpcs:ignore
    5358foreach ( $options as $option ) {
    54     delete_option( $option );
     59    delete_option( $option );
    5560}
Note: See TracChangeset for help on using the changeset viewer.