Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
All the bugs seem to be gone now. Finally.
Browse files Browse the repository at this point in the history
  • Loading branch information
dovy committed Sep 9, 2020
1 parent e05bf8e commit 338f29d
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 26 deletions.
23 changes: 14 additions & 9 deletions redux-templates/assets/js/redux-templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -4416,7 +4416,7 @@ function TemplateListSubHeader(props) {
marginRight: '10px',
verticalAlign: 'middle'
}
}, '0' === redux_templates.left && wp.element.createElement(React.Fragment, null, sprintf(__('You\'ve imported %d/%d Templates', redux_templates.i18n), 5 - redux_templates.left, 5)), '0' !== redux_templates.left && wp.element.createElement(React.Fragment, null, sprintf(__('Trial: %d/%d Imports Remaining', redux_templates.i18n), redux_templates.left, 5))), wp.element.createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__["Button"], {
}, redux_templates.left <= 0 && wp.element.createElement(React.Fragment, null, sprintf(__('Trial Ended: %d/%d Imported', redux_templates.i18n), 5 - redux_templates.left, 5)), redux_templates.left > 0 && wp.element.createElement(React.Fragment, null, sprintf(__('Trial: %d/%d Imports Remaining', redux_templates.i18n), redux_templates.left, 5))), wp.element.createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__["Button"], {
isPrimary: true,
isSmall: true,
icon: _redux_templates_icons__WEBPACK_IMPORTED_MODULE_6__["redux"],
Expand Down Expand Up @@ -7510,7 +7510,7 @@ function ReduxTemplatesPremiumActivate(props) {
const toPluginStep = props.toPluginStep;

const installReduxPlugin = async () => {
if (redux_templates.supported_plugins['redux-framework'].plugin) {
if (!redux_templates.supported_plugins['redux-framework'].plugin) {
setStatus(__('Installing the redux-framework plugin.', redux_templates.i18n));
await apiFetch({
path: 'redux/v1/templates/plugin-install?slug=redux-framework'
Expand Down Expand Up @@ -7634,10 +7634,10 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return ReduxTemplatesPremiumBox; });
const __ = wp.i18n.__;
function ReduxTemplatesPremiumBox(props) {
const toNextStep = props.toNextStep;
const toProActivateStep = props.toProActivateStep;

const onNextStep = () => {
toNextStep();
toProActivateStep();
};

return wp.element.createElement("div", {
Expand Down Expand Up @@ -7767,10 +7767,11 @@ function ImportWizard(props) {

const leftTry = isNaN(redux_templates.left) === false ? parseInt(redux_templates.left) : 0;

if (!!redux_templates.mokama === false && leftTry < 1) {
//setCurrentStep(REDUX_ACTIVATE_STEP);
setCurrentStep(REDUX_PRO_STEP);
return;
if (!!redux_templates.mokama === false && leftTry < 1 && currentStep !== REDUX_PRO_ACTIVATE_STEP) {
if (currentStep !== REDUX_ACTIVATE_STEP) {
setCurrentStep(REDUX_PRO_STEP);
return;
}
}
/* Redux pro check */

Expand Down Expand Up @@ -7831,6 +7832,10 @@ function ImportWizard(props) {
setCurrentStep(PRO_STEP);
};

const toProActivateStep = () => {
setCurrentStep(REDUX_PRO_ACTIVATE_STEP);
};

const onCloseWizard = () => {
if (isChallengeOpen) return; // When in tour mode, we don't accept mouse event.

Expand Down Expand Up @@ -7893,7 +7898,7 @@ function ImportWizard(props) {
}), currentStep === REDUX_PRO_ACTIVATE_STEP && wp.element.createElement(_ReduxTemplatesPremiumActivate__WEBPACK_IMPORTED_MODULE_5__["default"], {
toPluginStep: toPluginStep
}), currentStep === REDUX_PRO_STEP && wp.element.createElement(_ReduxTemplatesPremiumBox__WEBPACK_IMPORTED_MODULE_4__["default"], {
toNextStep: toNextStep
toProActivateStep: toProActivateStep
}), isInstalledDependencies && wp.element.createElement("iframe", {
src: "./",
width: "0",
Expand Down
2 changes: 1 addition & 1 deletion redux-templates/assets/js/redux-templates.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion redux-templates/assets/js/redux-templates.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion redux-templates/assets/js/redux-templates.min.js.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions redux-templates/classes/class-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,12 @@ public function check_template_response( $parameters ) {
$response['left'] = 999;
} else {
$count = ReduxTemplates\Init::left( $parameters['uid'] );

$count = intval( $count ) - 1;
if ( intval( $count ) < 0 ) {
update_user_meta( $parameters['uid'], '_redux_templates_counts', 0 );
if ( $count === 0 ) {
$response['left'] = $count;
update_user_meta( $parameters['uid'], '_redux_templates_counts', -1 );
} else if ( $count < 0 ) {
wp_send_json_error(
array(
'message' => 'Please activate Redux',
Expand Down Expand Up @@ -1004,6 +1007,7 @@ public function license( \WP_REST_Request $request ) {
)
);
}

$array = array(
'edd_action' => 'check_license',
'license' => $data['key'],
Expand Down
6 changes: 5 additions & 1 deletion redux-templates/classes/class-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,13 @@ public function admin_assets() {
*/
public static function left( $uid ) {
$count = get_user_meta( $uid, '_redux_templates_counts', true );
if ( 0 !== $count && empty( $count ) ) {
if ( empty( $count ) ) {
$count = self::$default_left;
}
if ( $count <= 0 ) {
$count = 0;
}

return $count;
}

Expand Down
6 changes: 6 additions & 0 deletions redux-templates/classes/class-installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ public static function run( $slug, $download_link = '' ) {

return $status;
}

// Stop UAGB redirect.
if ( 'ultimate-addons-for-gutenberg' === $slug ) {
update_option( '__uagb_do_redirect', false );
}

$status['install'] = 'success';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ function TemplateListSubHeader(props) {
<div style={{verticalAlign:'middle'}}>
<Notice status="info" isDismissible={false}>
<strong style={{display:'inline-block', marginRight:'10px', verticalAlign:'middle'}}>
{ '0' === redux_templates.left &&
{ redux_templates.left <= 0 &&
<>
{sprintf( __( 'You\'ve imported %d/%d Templates', redux_templates.i18n ), 5-redux_templates.left, 5 )}
{sprintf( __( 'Trial Ended: %d/%d Imported', redux_templates.i18n ), 5-redux_templates.left, 5 )}
</>
}
{ '0' !== redux_templates.left &&
{ redux_templates.left > 0 &&
<>
{sprintf( __( 'Trial: %d/%d Imports Remaining', redux_templates.i18n ), redux_templates.left, 5 )}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function ReduxTemplatesPremiumActivate(props) {
const {toPluginStep} = props;

const installReduxPlugin = async () => {
if ( redux_templates.supported_plugins['redux-framework'].plugin ) {
if ( ! redux_templates.supported_plugins['redux-framework'].plugin ) {
setStatus(__('Installing the redux-framework plugin.', redux_templates.i18n));
await apiFetch({
path: 'redux/v1/templates/plugin-install?slug=redux-framework',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const {__} = wp.i18n

export default function ReduxTemplatesPremiumBox(props) {

const {toNextStep} = props;
const {toProActivateStep} = props;

const onNextStep = () => {
toNextStep();
toProActivateStep();
}

return (
Expand Down
14 changes: 9 additions & 5 deletions redux-templates/src/modal-import-wizard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ function ImportWizard(props) {
}
// IMPORTANT First check: can you use redux pro?
const leftTry = isNaN(redux_templates.left) === false ? parseInt(redux_templates.left) : 0;
if ((!!(redux_templates.mokama) === false) && leftTry < 1) {
//setCurrentStep(REDUX_ACTIVATE_STEP);
setCurrentStep(REDUX_PRO_STEP);
return;
if ((!!(redux_templates.mokama) === false) && leftTry < 1 && currentStep !== REDUX_PRO_ACTIVATE_STEP ) {
if ( currentStep !== REDUX_ACTIVATE_STEP ) {
setCurrentStep(REDUX_PRO_STEP);
return;
}
}
/* Redux pro check */
if (requiresReduxPro(importingTemplate)) {
Expand Down Expand Up @@ -107,6 +108,9 @@ function ImportWizard(props) {
const toPluginStep = () => {
setCurrentStep(PRO_STEP);
};
const toProActivateStep = () => {
setCurrentStep(REDUX_PRO_ACTIVATE_STEP);
};

const onCloseWizard = () => {
if (isChallengeOpen) return; // When in tour mode, we don't accept mouse event.
Expand Down Expand Up @@ -156,7 +160,7 @@ function ImportWizard(props) {
{currentStep === IMPORT_STEP && <ImportingStep />}
{currentStep === REDUX_ACTIVATE_STEP && <ReduxTemplatesActivateBox onActivateRedux={activateReduxTracking} activating={activating} />}
{currentStep === REDUX_PRO_ACTIVATE_STEP && <ReduxTemplatesPremiumActivate toPluginStep={toPluginStep} />}
{currentStep === REDUX_PRO_STEP && <ReduxTemplatesPremiumBox toNextStep={toNextStep} />}
{currentStep === REDUX_PRO_STEP && <ReduxTemplatesPremiumBox toProActivateStep={toProActivateStep} />}
{isInstalledDependencies && <iframe src='./' width="0" height="0" />}
</div>
</div>
Expand Down

0 comments on commit 338f29d

Please sign in to comment.