From 91fe05f0c6376b7ab9d8ee304160bfe6373a7f33 Mon Sep 17 00:00:00 2001 From: Peter Petrov Date: Wed, 19 Jul 2023 06:21:20 +0300 Subject: [PATCH] Boost: On premium upgrade (if image guide is enabled), request an ISA report (#31888) * Update purchase flow to request a new ISA report if image guide is on * add changelog * Revert linter update after merging with trunk * [not verified] Revert linter update after merging with trunk * Remove critical css regen code, as it happens in the back-end now --- .../js/pages/purchase-success/PurchaseSuccess.svelte | 11 ++++++++++- .../update-request-isa-after-premium-upgrade | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 projects/plugins/boost/changelog/update-request-isa-after-premium-upgrade diff --git a/projects/plugins/boost/app/assets/src/js/pages/purchase-success/PurchaseSuccess.svelte b/projects/plugins/boost/app/assets/src/js/pages/purchase-success/PurchaseSuccess.svelte index 3ad064bd75751..344139e698384 100644 --- a/projects/plugins/boost/app/assets/src/js/pages/purchase-success/PurchaseSuccess.svelte +++ b/projects/plugins/boost/app/assets/src/js/pages/purchase-success/PurchaseSuccess.svelte @@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n'; import ReactComponent from '../../elements/ReactComponent.svelte'; import TemplatedString from '../../elements/TemplatedString.svelte'; + import { requestImageAnalysis } from '../../modules/image-size-analysis/store/isa-summary'; import { modulesState } from '../../stores/modules'; import Logo from '../../svg/jetpack-green.svg'; import externalLinkTemplateVar from '../../utils/external-link-template-var'; @@ -14,9 +15,17 @@ // svelte-ignore unused-export-let - Ignored values supplied by svelte-navigator. export let location, navigate; - onMount( () => { + onMount( async () => { // Enable cloud css module on upgrade. $modulesState.cloud_css.active = true; + + // If image guide is enabled, request a new ISA report. + if ( $modulesState.image_guide.active ) { + // Check if images can be resized. + if ( false !== Jetpack_Boost.site.canResizeImages ) { + await requestImageAnalysis(); + } + } } ); diff --git a/projects/plugins/boost/changelog/update-request-isa-after-premium-upgrade b/projects/plugins/boost/changelog/update-request-isa-after-premium-upgrade new file mode 100644 index 0000000000000..998d622b4d5e1 --- /dev/null +++ b/projects/plugins/boost/changelog/update-request-isa-after-premium-upgrade @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Update premium purchase flow to request an ISA report if Image Guide is enabled. + +