Skip to content

Commit

Permalink
chore: telemetry Modal replaced with Multi Step Modal
Browse files Browse the repository at this point in the history
  • Loading branch information
MdSoikot committed Sep 29, 2024
1 parent 617995e commit 1a67a98
Show file tree
Hide file tree
Showing 20 changed files with 558 additions and 232 deletions.
2 changes: 1 addition & 1 deletion backend/app/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Config

public const VAR_PREFIX = 'bit_smtp_';

public const VERSION = '1.1.1';
public const VERSION = '1.1.2';

public const DB_VERSION = '1.0';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace BitApps\SMTP\HTTP\Controllers;

use BitApps\SMTP\Config;
use BitApps\SMTP\Deps\BitApps\WPKit\Http\Request\Request;
use BitApps\SMTP\Deps\BitApps\WPTelemetry\Telemetry\Telemetry;
use BitApps\SMTP\HTTP\Requests\TelemetryAccessRequest;

final class SMTPAnalyticsController
class TelemetryPopupController
{
public function filterTrackingData($additional_data)
{
Expand All @@ -16,7 +16,7 @@ public function filterTrackingData($additional_data)
return $additional_data;
}

public function telemetryPermissionHandle(TelemetryAccessRequest $request)
public function handleTelemetryPermission(Request $request)
{
if ($request->isChecked == true) {
Telemetry::report()->trackingOptIn();
Expand All @@ -31,16 +31,16 @@ public function telemetryPermissionHandle(TelemetryAccessRequest $request)
return false;
}

public function telemetryPopupDisableCheck()
public function isPopupDisabled()
{
$allowed = Telemetry::report()->isTrackingAllowed();
if ($allowed == true) {
return true;
}

$skipped = get_option(Config::VAR_PREFIX . 'tracking_skipped');
$getOldPluginVersion = get_option(Config::VAR_PREFIX . 'old_version');
$popupSkipped = get_option(Config::VAR_PREFIX . 'tracking_skipped');
$getOldPluginVersion = get_option(Config::VAR_PREFIX . 'old_version');

return (bool) ($skipped == true && $getOldPluginVersion === Config::VERSION);
return (bool) (($popupSkipped == true) && $getOldPluginVersion === Config::VERSION);
}
}
4 changes: 2 additions & 2 deletions backend/app/Providers/HookProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use BitApps\SMTP\Deps\BitApps\WPKit\Hooks\Hooks;
use BitApps\SMTP\Deps\BitApps\WPKit\Http\RequestType;
use BitApps\SMTP\Deps\BitApps\WPKit\Http\Router\Router;
use BitApps\SMTP\HTTP\Controllers\SMTPAnalyticsController;
use BitApps\SMTP\HTTP\Controllers\TelemetryPopupController;
use BitApps\SMTP\Plugin;

class HookProvider
Expand All @@ -19,7 +19,7 @@ public function __construct()
$this->loadAppHooks();
Hooks::addAction('phpmailer_init', [$this, 'mailConfig'], 1000);
Hooks::addAction('rest_api_init', [$this, 'loadApi']);
Hooks::addFilter(Config::VAR_PREFIX . 'telemetry_additional_data', [new SMTPAnalyticsController(), 'filterTrackingData']);
Hooks::addFilter(Config::VAR_PREFIX . 'telemetry_additional_data', [new TelemetryPopupController(), 'filterTrackingData']);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions backend/hooks/ajax.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use BitApps\SMTP\Deps\BitApps\WPKit\Http\Router\Route;
use BitApps\SMTP\HTTP\Controllers\SMTPAnalyticsController;
use BitApps\SMTP\HTTP\Controllers\SMTPController;
use BitApps\SMTP\HTTP\Controllers\TelemetryPopupController;

if (!\defined('ABSPATH')) {
exit;
Expand All @@ -12,6 +12,6 @@
Route::post('save_mail_config', [SMTPController::class, 'saveMailConfig']);
Route::get('get_mail_config', [SMTPController::class, 'index']);
Route::post('send_test_mail', [SMTPController::class, 'sendTestEmail']);
Route::post('telemetry_permission_handle', [SMTPAnalyticsController::class, 'telemetryPermissionHandle']);
Route::get('telemetry_popup_disable_check', [SMTPAnalyticsController::class, 'telemetryPopupDisableCheck']);
Route::post('telemetry_permission_handle', [TelemetryPopupController::class, 'handleTelemetryPermission']);
Route::get('telemetry_popup_disable_check', [TelemetryPopupController::class, 'isPopupDisabled']);
})->middleware('nonce:admin');
2 changes: 1 addition & 1 deletion bit_smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: BIT SMTP
* Plugin URI: https://www.bitapps.pro/bit-smtp
* Description: Send email via SMTP using BIT SMTP plugin by Bit Apps
* Version: 1.1.1
* Version: 1.1.2
* Author: Bit Apps
* Author URI: https://bitapps.pro
* Text Domain: bit-smtp
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/changeLogs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const changeLogs = {
improvements: [
'SMTP debug enable/disable option added.',
'UI modified.',
'Improves confirmation message.'
],
fixed: [
'Namespace conflict issue fixed.',
'Illegal string offset (PHP Warning).',
'Some minor issue fixed.'
]
}

export default changeLogs
3 changes: 0 additions & 3 deletions frontend/src/components/Modal/Index.ts

This file was deleted.

39 changes: 0 additions & 39 deletions frontend/src/components/Modal/Modal.module.css

This file was deleted.

48 changes: 0 additions & 48 deletions frontend/src/components/Modal/Modal.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions frontend/src/components/TelemetryPopup/Index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TelemetryPopup from './TelemetryPopup'

export default TelemetryPopup
85 changes: 85 additions & 0 deletions frontend/src/components/TelemetryPopup/TelemetryPopup.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* stylelint-disable no-descending-specificity */
.popupContent {
margin-block: 20px;
}

.popupContent ul {
list-style-type: disc;
margin-left: 15px;
}

.improvementsTitle {
background-color: orange;
color: #000;
padding: 4px 8px;
border-radius: 5px;
text-align: center;
}

.fixedTitle {
background-color: #087d08;
color: #fff;
padding: 4px 8px;
border-radius: 5px;
text-align: center;
}

.skipBtn {
border: none;
box-shadow: none;
padding: 0;
}

.skipBtn span {
color: #776d6d;
}

.skipBtn span:hover {
color: #534e4e;
}

.okBtn span {
color: white !important;
}

.bitSocialReleaseBanner a:focus {
box-shadow: none;
}

.improvements,
.fixed {
display: flex;
flex-direction: column;
margin: 8px;
color: #000;
}

.improvements span {
color: #000;
}

.telemetryContent span {
color: #000;
}

.telemetryContent h3 {
margin-bottom: 0;
}

.telemetryContent button {
margin-top: 10px;
border: none;
background: none;
color: black;
padding: 0;
cursor: pointer;
text-decoration: underline;
}

.telemetryContent a:hover {
color: #1577ff;
}

.telemetryContent a:focus {
box-shadow: none;
}
Loading

0 comments on commit 1a67a98

Please sign in to comment.