woocommerce/plugins/woocommerce-admin/client/marketplace/contexts/install-store.tsx

76 lines
1.4 KiB
TypeScript
Raw Normal View History

Update/my subscriptions wp installer (#40990) * Marketplace: Populate the table rows with components * Marketplace: add links to dropdown menu and fix fallback product icons * Marketplace: fix popover width * Add My subscriptions install (#40630) * Marketplace: add plugin install from the subscriptions page Co-authored-by: berislav grgičak <berislav.grgicak@gmail.com> * Marketplace: Use the activation function to show install button --------- Co-authored-by: raicem <unalancem@gmail.com> * Add WP updates script to the extensions page * Add update button * Add update data to subscriptions * Update plugins * Prevent update if license unavailable * Add changefile(s) from automation for the following project(s): woocommerce * Remove all data from API * Linter fixes * Linter fixes * Remove merge string * Update link style * Add comment for updates.js * Prevent updates if required data is missing * Return removed slug code * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Switch to WP installer * Use WP installer * Remove install endpoint * Fix php warning * Add download_link if subscription exists * My subscriptions action modals (#40934) * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Update plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss Co-authored-by: And Finally <andfinally@users.noreply.github.com> * Update import path --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> * Use product slugs for installing * Add store for installing state * Add theme install support * Product activate endpoint * Activate after install * PHP warning * Update context * Debugging * Install context * Linter * Simplify context * Use Redux instead of context * Add changefile(s) from automation for the following project(s): woocommerce * Replace ~ with relative paths * Remove unnecessary is_null check --------- Co-authored-by: raicem <unalancem@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: And Finally <andfinally@users.noreply.github.com>
2023-11-06 08:35:43 +00:00
/**
* External dependencies
*/
import { createReduxStore, register } from '@wordpress/data';
My subscriptions error notices (#41124) * Marketplace: Populate the table rows with components * Marketplace: add links to dropdown menu and fix fallback product icons * Marketplace: fix popover width * Add My subscriptions install (#40630) * Marketplace: add plugin install from the subscriptions page Co-authored-by: berislav grgičak <berislav.grgicak@gmail.com> * Marketplace: Use the activation function to show install button --------- Co-authored-by: raicem <unalancem@gmail.com> * Add WP updates script to the extensions page * Add update button * Add update data to subscriptions * Update plugins * Prevent update if license unavailable * Add changefile(s) from automation for the following project(s): woocommerce * Remove all data from API * Linter fixes * Linter fixes * Remove merge string * Update link style * Add comment for updates.js * Prevent updates if required data is missing * Return removed slug code * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Switch to WP installer * Use WP installer * Remove install endpoint * Fix php warning * Add download_link if subscription exists * My subscriptions action modals (#40934) * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Update plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss Co-authored-by: And Finally <andfinally@users.noreply.github.com> * Update import path --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> * Use product slugs for installing * Add store for installing state * Add theme install support * Product activate endpoint * Activate after install * PHP warning * Update context * Debugging * Install context * Linter * Simplify context * Use Redux instead of context * Add changefile(s) from automation for the following project(s): woocommerce * Replace ~ with relative paths * Add error notices * Move update to functions * Add notice store * Fix linter errors * Remove temp file * Add changefile(s) from automation for the following project(s): woocommerce * Don't autoremove notices * Add status to notices * Send just required path field * Subvscribe hover color * Css linter fix * Fix error notice style * Update manage button text * Linter fixes --------- Co-authored-by: raicem <unalancem@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: And Finally <andfinally@users.noreply.github.com>
2023-11-07 08:21:12 +00:00
/**
* Internal dependencies
*/
import { InstallingState } from './types';
Update/my subscriptions wp installer (#40990) * Marketplace: Populate the table rows with components * Marketplace: add links to dropdown menu and fix fallback product icons * Marketplace: fix popover width * Add My subscriptions install (#40630) * Marketplace: add plugin install from the subscriptions page Co-authored-by: berislav grgičak <berislav.grgicak@gmail.com> * Marketplace: Use the activation function to show install button --------- Co-authored-by: raicem <unalancem@gmail.com> * Add WP updates script to the extensions page * Add update button * Add update data to subscriptions * Update plugins * Prevent update if license unavailable * Add changefile(s) from automation for the following project(s): woocommerce * Remove all data from API * Linter fixes * Linter fixes * Remove merge string * Update link style * Add comment for updates.js * Prevent updates if required data is missing * Return removed slug code * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Switch to WP installer * Use WP installer * Remove install endpoint * Fix php warning * Add download_link if subscription exists * My subscriptions action modals (#40934) * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Update plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss Co-authored-by: And Finally <andfinally@users.noreply.github.com> * Update import path --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> * Use product slugs for installing * Add store for installing state * Add theme install support * Product activate endpoint * Activate after install * PHP warning * Update context * Debugging * Install context * Linter * Simplify context * Use Redux instead of context * Add changefile(s) from automation for the following project(s): woocommerce * Replace ~ with relative paths * Remove unnecessary is_null check --------- Co-authored-by: raicem <unalancem@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: And Finally <andfinally@users.noreply.github.com>
2023-11-06 08:35:43 +00:00
const INSTALLING_STORE_NAME = 'woocommerce-admin/installing';
My subscriptions error notices (#41124) * Marketplace: Populate the table rows with components * Marketplace: add links to dropdown menu and fix fallback product icons * Marketplace: fix popover width * Add My subscriptions install (#40630) * Marketplace: add plugin install from the subscriptions page Co-authored-by: berislav grgičak <berislav.grgicak@gmail.com> * Marketplace: Use the activation function to show install button --------- Co-authored-by: raicem <unalancem@gmail.com> * Add WP updates script to the extensions page * Add update button * Add update data to subscriptions * Update plugins * Prevent update if license unavailable * Add changefile(s) from automation for the following project(s): woocommerce * Remove all data from API * Linter fixes * Linter fixes * Remove merge string * Update link style * Add comment for updates.js * Prevent updates if required data is missing * Return removed slug code * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Switch to WP installer * Use WP installer * Remove install endpoint * Fix php warning * Add download_link if subscription exists * My subscriptions action modals (#40934) * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Update plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss Co-authored-by: And Finally <andfinally@users.noreply.github.com> * Update import path --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> * Use product slugs for installing * Add store for installing state * Add theme install support * Product activate endpoint * Activate after install * PHP warning * Update context * Debugging * Install context * Linter * Simplify context * Use Redux instead of context * Add changefile(s) from automation for the following project(s): woocommerce * Replace ~ with relative paths * Add error notices * Move update to functions * Add notice store * Fix linter errors * Remove temp file * Add changefile(s) from automation for the following project(s): woocommerce * Don't autoremove notices * Add status to notices * Send just required path field * Subvscribe hover color * Css linter fix * Fix error notice style * Update manage button text * Linter fixes --------- Co-authored-by: raicem <unalancem@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: And Finally <andfinally@users.noreply.github.com>
2023-11-07 08:21:12 +00:00
export interface InstallingStateErrorAction {
label: string;
onClick: () => void;
Update/my subscriptions wp installer (#40990) * Marketplace: Populate the table rows with components * Marketplace: add links to dropdown menu and fix fallback product icons * Marketplace: fix popover width * Add My subscriptions install (#40630) * Marketplace: add plugin install from the subscriptions page Co-authored-by: berislav grgičak <berislav.grgicak@gmail.com> * Marketplace: Use the activation function to show install button --------- Co-authored-by: raicem <unalancem@gmail.com> * Add WP updates script to the extensions page * Add update button * Add update data to subscriptions * Update plugins * Prevent update if license unavailable * Add changefile(s) from automation for the following project(s): woocommerce * Remove all data from API * Linter fixes * Linter fixes * Remove merge string * Update link style * Add comment for updates.js * Prevent updates if required data is missing * Return removed slug code * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Switch to WP installer * Use WP installer * Remove install endpoint * Fix php warning * Add download_link if subscription exists * My subscriptions action modals (#40934) * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Update plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss Co-authored-by: And Finally <andfinally@users.noreply.github.com> * Update import path --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> * Use product slugs for installing * Add store for installing state * Add theme install support * Product activate endpoint * Activate after install * PHP warning * Update context * Debugging * Install context * Linter * Simplify context * Use Redux instead of context * Add changefile(s) from automation for the following project(s): woocommerce * Replace ~ with relative paths * Remove unnecessary is_null check --------- Co-authored-by: raicem <unalancem@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: And Finally <andfinally@users.noreply.github.com>
2023-11-06 08:35:43 +00:00
}
const DEFAULT_STATE: InstallingState = {
installingProducts: [],
};
const store = createReduxStore( INSTALLING_STORE_NAME, {
reducer( state: InstallingState | undefined = DEFAULT_STATE, action ) {
switch ( action.type ) {
case 'START_INSTALLING':
return {
...state,
installingProducts: [
...state.installingProducts,
action.productKey,
],
};
case 'STOP_INSTALLING':
return {
...state,
installingProducts: [
...state.installingProducts.filter(
( productKey ) => productKey !== action.productKey
),
],
};
}
return state;
},
My subscriptions error notices (#41124) * Marketplace: Populate the table rows with components * Marketplace: add links to dropdown menu and fix fallback product icons * Marketplace: fix popover width * Add My subscriptions install (#40630) * Marketplace: add plugin install from the subscriptions page Co-authored-by: berislav grgičak <berislav.grgicak@gmail.com> * Marketplace: Use the activation function to show install button --------- Co-authored-by: raicem <unalancem@gmail.com> * Add WP updates script to the extensions page * Add update button * Add update data to subscriptions * Update plugins * Prevent update if license unavailable * Add changefile(s) from automation for the following project(s): woocommerce * Remove all data from API * Linter fixes * Linter fixes * Remove merge string * Update link style * Add comment for updates.js * Prevent updates if required data is missing * Return removed slug code * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Switch to WP installer * Use WP installer * Remove install endpoint * Fix php warning * Add download_link if subscription exists * My subscriptions action modals (#40934) * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Update plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss Co-authored-by: And Finally <andfinally@users.noreply.github.com> * Update import path --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> * Use product slugs for installing * Add store for installing state * Add theme install support * Product activate endpoint * Activate after install * PHP warning * Update context * Debugging * Install context * Linter * Simplify context * Use Redux instead of context * Add changefile(s) from automation for the following project(s): woocommerce * Replace ~ with relative paths * Add error notices * Move update to functions * Add notice store * Fix linter errors * Remove temp file * Add changefile(s) from automation for the following project(s): woocommerce * Don't autoremove notices * Add status to notices * Send just required path field * Subvscribe hover color * Css linter fix * Fix error notice style * Update manage button text * Linter fixes --------- Co-authored-by: raicem <unalancem@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: And Finally <andfinally@users.noreply.github.com>
2023-11-07 08:21:12 +00:00
actions: {
startInstalling( productKey: string ) {
return {
type: 'START_INSTALLING',
productKey,
};
},
stopInstalling( productKey: string ) {
return {
type: 'STOP_INSTALLING',
productKey,
};
},
},
Update/my subscriptions wp installer (#40990) * Marketplace: Populate the table rows with components * Marketplace: add links to dropdown menu and fix fallback product icons * Marketplace: fix popover width * Add My subscriptions install (#40630) * Marketplace: add plugin install from the subscriptions page Co-authored-by: berislav grgičak <berislav.grgicak@gmail.com> * Marketplace: Use the activation function to show install button --------- Co-authored-by: raicem <unalancem@gmail.com> * Add WP updates script to the extensions page * Add update button * Add update data to subscriptions * Update plugins * Prevent update if license unavailable * Add changefile(s) from automation for the following project(s): woocommerce * Remove all data from API * Linter fixes * Linter fixes * Remove merge string * Update link style * Add comment for updates.js * Prevent updates if required data is missing * Return removed slug code * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Switch to WP installer * Use WP installer * Remove install endpoint * Fix php warning * Add download_link if subscription exists * My subscriptions action modals (#40934) * Add renew modal * Update install to run until new data loaded * Add activate modal * Add connect modal * Add renew button * Renewal button * Rename activate to connect * Add subscribe button * Add action buttons * Remove unused const * Add changefile(s) from automation for the following project(s): woocommerce * Update plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss Co-authored-by: And Finally <andfinally@users.noreply.github.com> * Update import path --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> * Use product slugs for installing * Add store for installing state * Add theme install support * Product activate endpoint * Activate after install * PHP warning * Update context * Debugging * Install context * Linter * Simplify context * Use Redux instead of context * Add changefile(s) from automation for the following project(s): woocommerce * Replace ~ with relative paths * Remove unnecessary is_null check --------- Co-authored-by: raicem <unalancem@gmail.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: And Finally <andfinally@users.noreply.github.com>
2023-11-06 08:35:43 +00:00
selectors: {
isInstalling(
state: InstallingState | undefined,
productKey: string
): boolean {
if ( ! state ) {
return false;
}
return state.installingProducts.includes( productKey );
},
},
} );
register( store );
export { store as installingStore, INSTALLING_STORE_NAME };