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

Commit 338f29d

Browse files
committed
All the bugs seem to be gone now. Finally.
1 parent e05bf8e commit 338f29d

File tree

11 files changed

+49
-26
lines changed

11 files changed

+49
-26
lines changed

redux-templates/assets/js/redux-templates.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -4416,7 +4416,7 @@ function TemplateListSubHeader(props) {
44164416
marginRight: '10px',
44174417
verticalAlign: 'middle'
44184418
}
4419-
}, '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"], {
4419+
}, 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"], {
44204420
isPrimary: true,
44214421
isSmall: true,
44224422
icon: _redux_templates_icons__WEBPACK_IMPORTED_MODULE_6__["redux"],
@@ -7510,7 +7510,7 @@ function ReduxTemplatesPremiumActivate(props) {
75107510
const toPluginStep = props.toPluginStep;
75117511

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

76397639
const onNextStep = () => {
7640-
toNextStep();
7640+
toProActivateStep();
76417641
};
76427642

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

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

7770-
if (!!redux_templates.mokama === false && leftTry < 1) {
7771-
//setCurrentStep(REDUX_ACTIVATE_STEP);
7772-
setCurrentStep(REDUX_PRO_STEP);
7773-
return;
7770+
if (!!redux_templates.mokama === false && leftTry < 1 && currentStep !== REDUX_PRO_ACTIVATE_STEP) {
7771+
if (currentStep !== REDUX_ACTIVATE_STEP) {
7772+
setCurrentStep(REDUX_PRO_STEP);
7773+
return;
7774+
}
77747775
}
77757776
/* Redux pro check */
77767777

@@ -7831,6 +7832,10 @@ function ImportWizard(props) {
78317832
setCurrentStep(PRO_STEP);
78327833
};
78337834

7835+
const toProActivateStep = () => {
7836+
setCurrentStep(REDUX_PRO_ACTIVATE_STEP);
7837+
};
7838+
78347839
const onCloseWizard = () => {
78357840
if (isChallengeOpen) return; // When in tour mode, we don't accept mouse event.
78367841

@@ -7893,7 +7898,7 @@ function ImportWizard(props) {
78937898
}), currentStep === REDUX_PRO_ACTIVATE_STEP && wp.element.createElement(_ReduxTemplatesPremiumActivate__WEBPACK_IMPORTED_MODULE_5__["default"], {
78947899
toPluginStep: toPluginStep
78957900
}), currentStep === REDUX_PRO_STEP && wp.element.createElement(_ReduxTemplatesPremiumBox__WEBPACK_IMPORTED_MODULE_4__["default"], {
7896-
toNextStep: toNextStep
7901+
toProActivateStep: toProActivateStep
78977902
}), isInstalledDependencies && wp.element.createElement("iframe", {
78987903
src: "./",
78997904
width: "0",

redux-templates/assets/js/redux-templates.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

redux-templates/assets/js/redux-templates.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

redux-templates/assets/js/redux-templates.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

redux-templates/classes/class-api.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,12 @@ public function check_template_response( $parameters ) {
628628
$response['left'] = 999;
629629
} else {
630630
$count = ReduxTemplates\Init::left( $parameters['uid'] );
631+
631632
$count = intval( $count ) - 1;
632-
if ( intval( $count ) < 0 ) {
633-
update_user_meta( $parameters['uid'], '_redux_templates_counts', 0 );
633+
if ( $count === 0 ) {
634+
$response['left'] = $count;
635+
update_user_meta( $parameters['uid'], '_redux_templates_counts', -1 );
636+
} else if ( $count < 0 ) {
634637
wp_send_json_error(
635638
array(
636639
'message' => 'Please activate Redux',
@@ -1004,6 +1007,7 @@ public function license( \WP_REST_Request $request ) {
10041007
)
10051008
);
10061009
}
1010+
10071011
$array = array(
10081012
'edd_action' => 'check_license',
10091013
'license' => $data['key'],

redux-templates/classes/class-init.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,13 @@ public function admin_assets() {
202202
*/
203203
public static function left( $uid ) {
204204
$count = get_user_meta( $uid, '_redux_templates_counts', true );
205-
if ( 0 !== $count && empty( $count ) ) {
205+
if ( empty( $count ) ) {
206206
$count = self::$default_left;
207207
}
208+
if ( $count <= 0 ) {
209+
$count = 0;
210+
}
211+
208212
return $count;
209213
}
210214

redux-templates/classes/class-installer.php

+6
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ public static function run( $slug, $download_link = '' ) {
101101

102102
return $status;
103103
}
104+
105+
// Stop UAGB redirect.
106+
if ( 'ultimate-addons-for-gutenberg' === $slug ) {
107+
update_option( '__uagb_do_redirect', false );
108+
}
109+
104110
$status['install'] = 'success';
105111
}
106112

redux-templates/src/components/template-list-subheader/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ function TemplateListSubHeader(props) {
4747
<div style={{verticalAlign:'middle'}}>
4848
<Notice status="info" isDismissible={false}>
4949
<strong style={{display:'inline-block', marginRight:'10px', verticalAlign:'middle'}}>
50-
{ '0' === redux_templates.left &&
50+
{ redux_templates.left <= 0 &&
5151
<>
52-
{sprintf( __( 'You\'ve imported %d/%d Templates', redux_templates.i18n ), 5-redux_templates.left, 5 )}
52+
{sprintf( __( 'Trial Ended: %d/%d Imported', redux_templates.i18n ), 5-redux_templates.left, 5 )}
5353
</>
5454
}
55-
{ '0' !== redux_templates.left &&
55+
{ redux_templates.left > 0 &&
5656
<>
5757
{sprintf( __( 'Trial: %d/%d Imports Remaining', redux_templates.i18n ), redux_templates.left, 5 )}
5858
</>

redux-templates/src/modal-import-wizard/ReduxTemplatesPremiumActivate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function ReduxTemplatesPremiumActivate(props) {
1111
const {toPluginStep} = props;
1212

1313
const installReduxPlugin = async () => {
14-
if ( redux_templates.supported_plugins['redux-framework'].plugin ) {
14+
if ( ! redux_templates.supported_plugins['redux-framework'].plugin ) {
1515
setStatus(__('Installing the redux-framework plugin.', redux_templates.i18n));
1616
await apiFetch({
1717
path: 'redux/v1/templates/plugin-install?slug=redux-framework',

redux-templates/src/modal-import-wizard/ReduxTemplatesPremiumBox.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ const {__} = wp.i18n
22

33
export default function ReduxTemplatesPremiumBox(props) {
44

5-
const {toNextStep} = props;
5+
const {toProActivateStep} = props;
66

77
const onNextStep = () => {
8-
toNextStep();
8+
toProActivateStep();
99
}
1010

1111
return (

redux-templates/src/modal-import-wizard/index.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ function ImportWizard(props) {
4444
}
4545
// IMPORTANT First check: can you use redux pro?
4646
const leftTry = isNaN(redux_templates.left) === false ? parseInt(redux_templates.left) : 0;
47-
if ((!!(redux_templates.mokama) === false) && leftTry < 1) {
48-
//setCurrentStep(REDUX_ACTIVATE_STEP);
49-
setCurrentStep(REDUX_PRO_STEP);
50-
return;
47+
if ((!!(redux_templates.mokama) === false) && leftTry < 1 && currentStep !== REDUX_PRO_ACTIVATE_STEP ) {
48+
if ( currentStep !== REDUX_ACTIVATE_STEP ) {
49+
setCurrentStep(REDUX_PRO_STEP);
50+
return;
51+
}
5152
}
5253
/* Redux pro check */
5354
if (requiresReduxPro(importingTemplate)) {
@@ -107,6 +108,9 @@ function ImportWizard(props) {
107108
const toPluginStep = () => {
108109
setCurrentStep(PRO_STEP);
109110
};
111+
const toProActivateStep = () => {
112+
setCurrentStep(REDUX_PRO_ACTIVATE_STEP);
113+
};
110114

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

0 commit comments

Comments
 (0)