diff --git a/classes/class-wc-connect-service-settings-store.php b/classes/class-wc-connect-service-settings-store.php index 90ad83c67..dfa4f2eb1 100644 --- a/classes/class-wc-connect-service-settings-store.php +++ b/classes/class-wc-connect-service-settings-store.php @@ -616,9 +616,9 @@ public function get_package_lookup() { return $lookup; } - + public function is_eligible_for_migration() { - return false; + return true; } private function translate_unit( $value ) { diff --git a/client/apps/shipping-label/view-wrapper-label.js b/client/apps/shipping-label/view-wrapper-label.js index 2613a0c91..033d540a6 100644 --- a/client/apps/shipping-label/view-wrapper-label.js +++ b/client/apps/shipping-label/view-wrapper-label.js @@ -10,7 +10,6 @@ import classNames from 'classnames'; import Gridicon from 'gridicons'; import { sumBy, differenceBy, filter, maxBy } from 'lodash'; import { Button } from '@wordpress/components'; -import {getNonce} from 'api/request'; // client/api/request.js /** * Internal dependencies @@ -97,15 +96,6 @@ export class ShippingLabelViewWrapper extends Component { > { translate( 'Create shipping label' ) } - }> @@ -174,47 +164,6 @@ export class ShippingLabelViewWrapper extends Component { ); }; - handleActivateLabelButtonClick = () => { - const plugins = 'hello-dolly'; //this needs to be a CSV string. - const installPluginAPICall = () => - fetch( '/wp-json/wc-admin/plugins/install', { - method: 'POST', - headers: { - "Content-Type": "application/json", - 'X-WP-Nonce': getNonce() - }, - body: JSON.stringify({ - plugins - }) - } ); - - const activatePluginAPICall = () => - fetch( '/wp-json/wc-admin/plugins/activate', { - method: 'POST', - headers: { - "Content-Type": "application/json", - 'X-WP-Nonce': getNonce() - }, - body: JSON.stringify({ - plugins - }) - } ); - - - const installAndActivatePlugins = async() => { - try { - //TODO: status update - await installPluginAPICall(); - await activatePluginAPICall(); - } catch (e) { - //TODO: error handling. - // console.log('Failed to install or activate.', e); - } - }; - - installAndActivatePlugins(); - }; - handleCreateLabelButtonClick = () => { const { orderId, diff --git a/client/components/migration/feature-announcement.jsx b/client/components/migration/feature-announcement.jsx index 3eaf2cd66..520ea7ced 100644 --- a/client/components/migration/feature-announcement.jsx +++ b/client/components/migration/feature-announcement.jsx @@ -7,6 +7,7 @@ import { useState } from '@wordpress/element'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { localize } from 'i18n-calypso'; +import { getNonce } from 'api/request'; // client/api/request.js /** * Internal dependencies @@ -30,9 +31,45 @@ const FeatureAnnouncement = ({ translate, isEligable }) => { }; const update = () => { - // Todo: implement update - setIsUpdating(true); - setTimeout(() => setIsUpdating(false), 2000); + const plugins = 'hello-dolly'; //this needs to be a CSV string. + const installPluginAPICall = () => + fetch( '/wp-json/wc-admin/plugins/install', { + method: 'POST', + headers: { + "Content-Type": "application/json", + 'X-WP-Nonce': getNonce() + }, + body: JSON.stringify({ + plugins + }) + } ); + + const activatePluginAPICall = () => + fetch( '/wp-json/wc-admin/plugins/activate', { + method: 'POST', + headers: { + "Content-Type": "application/json", + 'X-WP-Nonce': getNonce() + }, + body: JSON.stringify({ + plugins + }) + } ); + + + const installAndActivatePlugins = async() => { + try { + setIsUpdating(true); + await installPluginAPICall(); + await activatePluginAPICall(); + setIsUpdating(false); + } catch (e) { + //TODO: error handling. + // console.log('Failed to install or activate.', e); + } + }; + + installAndActivatePlugins(); }; return <>{isOpen && (