Plugin Directory

Changeset 3274838


Ignore:
Timestamp:
04/16/2025 02:14:25 PM (12 months ago)
Author:
sendcloudbv
Message:

Mark compatibility

Location:
sendcloud-connected-shipping
Files:
130 added
15 edited

Legend:

Unmodified
Added
Removed
  • sendcloud-connected-shipping/trunk/changelog.txt

    r3266337 r3274838  
    11*** WooCommerce Sendcloud | The all-in-one shipping platform Changelog ***
    22
    3 = 2025-04-03 - version 1.0.6 =
     3= 2025-04-09 - version 1.0.7 =
    44* Integrate WooCommerce with an existing SendCloud account enabling service point delivery locations to be selected at the checkout.
  • sendcloud-connected-shipping/trunk/includes/Controllers/Api/class-integration-controller.php

    r3266337 r3274838  
    1313class SCCSP_Integration_Controller extends SCCSP_Base_WC_REST_Controller {
    1414    const CLASS_NAME = __CLASS__;
     15    const SENDCLOUD_V1_CARRIERS = 'sendcloudshipping_service_point_carriers';
    1516
    16     protected $rest_base = '/integration';
     17    protected $rest_base = '/integration';
    1718
    1819    /**
     
    5455        if ( isset( $data['integration_id'] ) ) {
    5556            $this->config_service->set_integration_id( $data['integration_id'] );
    56         } else {
     57            $carriers_option = get_option(self::SENDCLOUD_V1_CARRIERS);
     58
     59            if ($carriers_option && !$this->config_service->is_migration_completed()) {
     60                $this->config_service->set_migration_required(true);
     61            }
     62        } else {
    5763            SCCSP_Logger::error( 'Integration ID missing in the payload. Data: ' . json_encode( $data ) );
    5864
     
    7682        if ( isset( $data['integration_id'] ) ) {
    7783            $this->config_service->set_integration_id( null );
     84            $this->config_service->delete_migration_required();
     85            $this->config_service->delete_migration_completed();
     86
    7887            $this->webhook_service->remove_woocommerce_webhooks();
    7988        } else {
  • sendcloud-connected-shipping/trunk/includes/Controllers/Backend/class-view-controller.php

    r3266337 r3274838  
    2020    public function __construct() {
    2121        $this->config_service = new SCCSP_Config_Service();
    22         wp_enqueue_style( 'sendcloud-v2-css',
     22        wp_enqueue_style( 'sendcloud-v2-css',
    2323            SCCSP_Sendcloud::get_plugin_url( 'resources/css/sendcloud.css' ),
    2424            array(),
     
    4343            'currency'           => get_woocommerce_currency_symbol( get_option( 'woocommerce_currency' ) ),
    4444            'types'              => array(),
    45         ) ), SCCSP_View::get_allowed_tags() );
     45            'migration_required' => $this->config_service->is_migration_required(),
     46        ) ), SCCSP_View::get_allowed_tags() );
    4647    }
    4748}
  • sendcloud-connected-shipping/trunk/includes/HookHandlers/class-api-handler.php

    r3266337 r3274838  
    88use SCCSP\SendCloud\Connected\Shipping\Controllers\Backend\SCCSP_Connect_Controller;
    99use SCCSP\SendCloud\Connected\Shipping\Controllers\Backend\SCCSP_Support_Controller;
     10use SCCSP\SendCloud\Connected\Shipping\Controllers\Backend\SCCSP_Migration_Controller;
    1011
    1112if (!defined('ABSPATH')) {
     
    6869            'save',
    6970        ) );
     71        add_action( 'wp_ajax_migrate_service_points', array(
     72            new SCCSP_Migration_Controller(),
     73            'migrate_service_points'
     74        ));
     75        add_action('wp_ajax_sc_check_migration', array(
     76            new SCCSP_Migration_Controller(),
     77            'check_migration_status',
     78        ));
    7079    }
    7180}
  • sendcloud-connected-shipping/trunk/includes/ServicePoint/Shipping/class-service-point-shipping-method.php

    r3266337 r3274838  
    3232        parent::init();
    3333
    34         $this->carrier_select = $this->get_option( 'carrier_select' );
     34        $this->carrier_select = explode(',', $this->get_option( 'carrier_select') );
    3535    }
    3636
     
    5656    protected function add_extra_fields( &$form_fields ) {
    5757        parent::add_extra_fields( $form_fields );
    58         $form_fields['carrier_select'] = array(
     58        $settings = get_option($this->get_instance_option_key());
     59        $carrier_select = isset($settings['carrier_select']) && is_array($settings['carrier_select'])
     60            ? array_map('trim', $settings['carrier_select'])
     61            : [];
     62        $form_fields['carrier_select_v2'] = array(
     63            'id'          => 'sendcloud_shipping',
     64            'option_key'  => 'sendcloud_shipping',
    5965            'title'       => esc_html__( 'Carrier Selection', 'sendcloud-connected-shipping' ),
    6066            'type'        => 'multiselect',
    61             'default'     => '',
     67            'default'     => $carrier_select,
    6268            'desc_tip'    => true,
    6369            'description' => esc_html__( "Select one or more carriers from your Sendcloud enabled list (e.g. UPS, DPD, DHL). An empty selection will display all your Sendcloud enabled carriers.",
  • sendcloud-connected-shipping/trunk/includes/Services/class-config-service.php

    r3266337 r3274838  
    165165        return $panel_url;
    166166    }
     167
     168    /**
     169     * Sets the migration required flag.
     170     *
     171     * @param bool $value
     172     *
     173     * @return void
     174     */
     175    public function set_migration_required($value) {
     176        $this->config_repository->save('MIGRATION_REQUIRED', $value ? 1 : 0);
     177    }
     178
     179    /**
     180     * Sets the migration completed flag.
     181     *
     182     * @return void
     183     */
     184    public function set_migration_completed() {
     185        $this->config_repository->save('MIGRATION_COMPLETED', 1);
     186    }
     187
     188    /**
     189     * Deletes the migration required flag.
     190     *
     191     * @return void
     192     */
     193    public function delete_migration_required() {
     194        $this->config_repository->delete('MIGRATION_REQUIRED');
     195    }
     196
     197    /**
     198     * Deletes the migration completed flag.
     199     *
     200     * @return void
     201     */
     202    public function delete_migration_completed() {
     203        $this->config_repository->delete('MIGRATION_COMPLETED');
     204    }
     205
     206    /**
     207     * Returns is migration required flag.
     208     *
     209     * @return bool
     210     */
     211    public function is_migration_required(): bool
     212    {
     213        return (bool)$this->config_repository->get('MIGRATION_REQUIRED');
     214    }
     215
     216    /**
     217     * Returns is migration completed flag.
     218     *
     219     * @return bool
     220     */
     221    public function is_migration_completed(): bool
     222    {
     223        return (bool)$this->config_repository->get('MIGRATION_COMPLETED');
     224    }
    167225}
  • sendcloud-connected-shipping/trunk/readme.txt

    r3266337 r3274838  
    11=== Sendcloud Shipping ===
    2 Version: 1.0.6
     2Version: 1.0.7
    33Developer: SendCloud Global B.V.
    44Developer URI: http://sendcloud.com
     
    77Requires PHP: 7.0
    88Tested up to: 6.7
    9 Stable tag: 1.0.6
     9Stable tag: 1.0.7
    1010License: GPLv2
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    116116== Changelog ==
    117117
    118 = 1.0.6 =
     118= 1.0.7 =
    119119* Integrate WooCommerce with an existing SendCloud account enabling service point delivery
    120120  locations to be selected at the checkout.
  • sendcloud-connected-shipping/trunk/resources/css/sendcloud.css

    r3266337 r3274838  
    304304    100% { transform: rotate(360deg); }
    305305}
     306
     307#migration-message {
     308    margin-top: 20px;
     309    font-size: 14px;
     310    font-weight: bold;
     311}
     312
     313#migrate-service-points:disabled {
     314    background-color: #cccccc;
     315    cursor: not-allowed;
     316    color: #666666;
     317    border: 1px solid #aaaaaa;
     318    opacity: 0.6;
     319}
  • sendcloud-connected-shipping/trunk/resources/js/sendcloud.page.js

    r3266337 r3274838  
    33    $(document).ready(function () {
    44        let button = $('#sendcloud_shipping_connect .connect-button'),
    5         connectingLabel = $('#sc-connecting-label')[0],
    6         connectContainer = $('#sc-connect-container')[0],
    7         dashboardContainer = $('#sc-dashboard-container')[0];
     5            connectingLabel = $('#sc-connecting-label')[0],
     6            connectContainer = $('#sc-connect-container')[0],
     7            dashboardContainer = $('#sc-dashboard-container')[0];
    88        button.click(function () {
    99            let data = {
     
    2222            var pollingInterval = setInterval(checkStatus, 2000);
    2323
    24             function checkStatus(){
     24            function checkStatus() {
    2525                $.post(ajaxurl, data, function (response) {
    2626                    if (response.is_connected) {
     
    3131            }
    3232        });
     33
     34        let migrationPanel = $('#sendcloud_migration_panel')[0];
     35
     36        function checkMigrationStatus() {
     37            let data = {
     38                'action': 'sc_check_migration'
     39            };
     40
     41            $.post(ajaxurl, data, function (response) {
     42                if (response.show_migration_button) {
     43                    migrationPanel.style.display = 'block';
     44                } else {
     45                    migrationPanel.style.display = 'none';
     46                }
     47            });
     48        }
     49
     50        setInterval(checkMigrationStatus, 1000);
     51
     52        let migrateButton = $('#migrate-service-points');
     53        let message = $('#migration-message');
     54
     55        migrateButton.click(function () {
     56            let data = {
     57                'action': 'migrate_service_points'
     58            };
     59
     60            message.text('').hide();
     61
     62            $.post(ajaxurl, data, function (response) {
     63                if (response.success) {
     64                    showMessage(response.message, 'green');
     65                } else {
     66                    showMessage(response.message || 'Unknown error occurred.', 'red');
     67                }
     68            }).fail(function () {
     69                showMessage('AJAX request failed.', 'red');
     70            });
     71
     72            function showMessage(text, color) {
     73                message
     74                    .text(text)
     75                    .css({'color': color, 'display': 'block'})
     76                    .fadeIn();
     77
     78                setTimeout(() => {
     79                    message.fadeOut();
     80                }, 3000);
     81            }
     82        });
    3383    });
    3484})(jQuery);
  • sendcloud-connected-shipping/trunk/resources/views/wc-settings/sendcloud-page.php

    r3266337 r3274838  
    4444                </a>
    4545            </div>
     46            <div id="sendcloud_migration_panel" class="sendcloud-button-text-container <?php if (!$data['integration_id'] || !$data['migration_required']) {
     47                echo esc_attr('sc-hidden');
     48            } ?>">
     49                <h3><?php esc_html_e('Service Point Migration', 'sendcloud-connected-shipping'); ?></h3>
     50                <p>
     51                    <?php esc_html_e('Click the button below to migrate your service points from V1 to V2.', 'sendcloud-connected-shipping'); ?>
     52                </p>
     53                <button id="migrate-service-points" class="sendcloud-button sendcloud-button--primary">
     54                    <?php esc_html_e('Migrate Service Points', 'sendcloud-connected-shipping'); ?>
     55                </button>
     56                <div id="migration-message" class="sendcloud-notification" style="display: none;"></div>
     57            </div>
    4658        </div>
    4759    </li>
  • sendcloud-connected-shipping/trunk/sendcloud-connected-shipping.php

    r3266337 r3274838  
    44 * Plugin URI: https://wordpress.org/plugins/sendcloud-connected-shipping/
    55 * Description: Sendcloud plugin.
    6  * Version: 1.0.6
     6 * Version: 1.0.7
    77 * Woo:
    88 * Author: Sendcloud B.V.
  • sendcloud-connected-shipping/trunk/vendor/autoload.php

    r3266337 r3274838  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit8555f216b080450eca56d6056cb6538b::getLoader();
     7return ComposerAutoloaderInitcc349661a2f0f4cd9aeec16c2faff491::getLoader();
  • sendcloud-connected-shipping/trunk/vendor/composer/autoload_classmap.php

    r3266337 r3274838  
    1414    'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Api\\SCCSP_Status_Controller' => $baseDir . '/includes/Controllers/Api/class-status-controller.php',
    1515    'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Backend\\SCCSP_Connect_Controller' => $baseDir . '/includes/Controllers/Backend/class-connect-controller.php',
     16    'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Backend\\SCCSP_Migration_Controller' => $baseDir . '/includes/Controllers/Backend/class-migration-controller.php',
    1617    'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Backend\\SCCSP_Support_Controller' => $baseDir . '/includes/Controllers/Backend/class-support-controller.php',
    1718    'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Backend\\SCCSP_View_Controller' => $baseDir . '/includes/Controllers/Backend/class-view-controller.php',
  • sendcloud-connected-shipping/trunk/vendor/composer/autoload_real.php

    r3266337 r3274838  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit8555f216b080450eca56d6056cb6538b
     5class ComposerAutoloaderInitcc349661a2f0f4cd9aeec16c2faff491
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit8555f216b080450eca56d6056cb6538b', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitcc349661a2f0f4cd9aeec16c2faff491', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit8555f216b080450eca56d6056cb6538b', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitcc349661a2f0f4cd9aeec16c2faff491', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInit8555f216b080450eca56d6056cb6538b::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInitcc349661a2f0f4cd9aeec16c2faff491::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • sendcloud-connected-shipping/trunk/vendor/composer/autoload_static.php

    r3266337 r3274838  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit8555f216b080450eca56d6056cb6538b
     7class ComposerStaticInitcc349661a2f0f4cd9aeec16c2faff491
    88{
    99    public static $classMap = array (
     
    1515        'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Api\\SCCSP_Status_Controller' => __DIR__ . '/../..' . '/includes/Controllers/Api/class-status-controller.php',
    1616        'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Backend\\SCCSP_Connect_Controller' => __DIR__ . '/../..' . '/includes/Controllers/Backend/class-connect-controller.php',
     17        'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Backend\\SCCSP_Migration_Controller' => __DIR__ . '/../..' . '/includes/Controllers/Backend/class-migration-controller.php',
    1718        'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Backend\\SCCSP_Support_Controller' => __DIR__ . '/../..' . '/includes/Controllers/Backend/class-support-controller.php',
    1819        'SCCSP\\SendCloud\\Connected\\Shipping\\Controllers\\Backend\\SCCSP_View_Controller' => __DIR__ . '/../..' . '/includes/Controllers/Backend/class-view-controller.php',
     
    7071    {
    7172        return \Closure::bind(function () use ($loader) {
    72             $loader->classMap = ComposerStaticInit8555f216b080450eca56d6056cb6538b::$classMap;
     73            $loader->classMap = ComposerStaticInitcc349661a2f0f4cd9aeec16c2faff491::$classMap;
    7374
    7475        }, null, ClassLoader::class);
Note: See TracChangeset for help on using the changeset viewer.