woocommerce/plugins/woocommerce-admin/client/marketplace/utils/functions.tsx

514 lines
13 KiB
TypeScript
Raw Normal View History

/**
* External dependencies
*/
import apiFetch from '@wordpress/api-fetch';
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
import { __, sprintf } from '@wordpress/i18n';
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
import { dispatch } from '@wordpress/data';
import { Options } from '@wordpress/notices';
import { Icon } from '@wordpress/components';
/**
* Internal dependencies
*/
import { LOCALE, getAdminSetting } from '../../utils/admin-settings';
My subscription product updates (#40752) * 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 * 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> --------- 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-10-27 04:08:27 +00:00
import { CategoryAPIItem } from '../components/category-selector/types';
2023-09-28 15:09:37 +00:00
import {
MARKETPLACE_CART_PATH,
MARKETPLACE_CATEGORY_API_PATH,
My subscription product updates (#40752) * 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 * 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> --------- 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-10-27 04:08:27 +00:00
MARKETPLACE_HOST,
MARKETPLACE_SEARCH_API_PATH,
MARKETPLACE_RENEW_SUBSCRIPTON_PATH,
} from '../components/constants';
2023-09-26 12:12:14 +00:00
import { Subscription } from '../components/my-subscriptions/types';
My subscription product updates (#40752) * 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 * 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> --------- 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-10-27 04:08:27 +00:00
import {
Product,
ProductType,
SearchAPIJSONType,
SearchAPIProductType,
} from '../components/product-list/types';
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
import { NoticeStatus } from '../contexts/types';
import { noticeStore } from '../contexts/notice-store';
interface ProductGroup {
2023-08-15 12:37:50 +00:00
id: string;
title: string;
items: Product[];
url: string;
Marketplace Themes: Feature Branch (#40159) * Support for themes in in-app marketplace. Contains the changes from: https://github.com/woocommerce/woocommerce/pull/40247 https://github.com/woocommerce/woocommerce/pull/40272 https://github.com/woocommerce/woocommerce/pull/40302 https://github.com/woocommerce/woocommerce/pull/40303 https://github.com/woocommerce/woocommerce/pull/40333 https://github.com/woocommerce/woocommerce/pull/40368 https://github.com/woocommerce/woocommerce/pull/40375 https://github.com/woocommerce/woocommerce/pull/40375 https://github.com/woocommerce/woocommerce/pull/40389 * `.woocommerce-marketplace__discover`: changed `align-items` `flex-start` to `stretch` to properly display products on large and very large viewports. * Delete plugins/woocommerce/changelog/add-18026-marketplace-theme-cards Removing from feature branch before final review * Delete plugins/woocommerce/changelog/add-18027-themes-to-in-app-search Removing from feature branch before final review * Delete plugins/woocommerce/changelog/add-marketplace-theme-discover-section Removing from feature branch before final review * Delete plugins/woocommerce/changelog/update-in-app-multiple-category-filters Removing from feature branch before final review * Delete plugins/woocommerce/changelog/update-theme-no-result-style Removing from feature branch before final review * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: Dan Q <dan@danq.me> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Dan Q <danq@automattic.com>
2023-10-04 16:59:34 +00:00
itemType: ProductType;
}
2023-09-28 16:05:51 +00:00
// The fetchCache stores the results of GET fetch/apiFetch calls from the Marketplace, in RAM, for performance
const maxFetchCacheSize = 100;
const fetchCache = new Map();
function maybePruneFetchCache() {
while ( fetchCache.size > maxFetchCacheSize ) {
fetchCache.delete( fetchCache.keys().next().value );
}
}
2023-09-28 16:14:02 +00:00
// Wrapper around apiFetch() that caches results in memory
async function apiFetchWithCache( params: object ): Promise< object > {
2023-09-28 16:14:02 +00:00
// Attempt to fetch from cache:
const cacheKey = JSON.stringify( params );
if ( fetchCache.get( cacheKey ) ) {
return new Promise( ( resolve ) => {
resolve( fetchCache.get( cacheKey ) );
} );
}
// Failing that, fetch using apiCache:
return new Promise( ( resolve, reject ) => {
apiFetch( params )
.then( ( json ) => {
fetchCache.set( cacheKey, json );
maybePruneFetchCache();
resolve( json as object );
2023-09-28 16:14:02 +00:00
} )
.catch( () => {
reject();
} );
} );
}
// Wrapper around fetch() that caches results in memory
2023-10-12 09:56:46 +00:00
async function fetchJsonWithCache(
url: string,
abortSignal?: AbortSignal
): Promise< object > {
// Attempt to fetch from cache:
2023-09-28 16:05:51 +00:00
if ( fetchCache.get( url ) ) {
2023-09-28 15:09:37 +00:00
return new Promise( ( resolve ) => {
2023-09-28 16:05:51 +00:00
resolve( fetchCache.get( url ) );
2023-09-28 15:09:37 +00:00
} );
}
// Failing that, fetch from net:
return new Promise( ( resolve, reject ) => {
fetch( url, { signal: abortSignal } )
2023-09-28 15:09:44 +00:00
.then( ( response ) => {
if ( ! response.ok ) {
throw new Error( response.statusText );
}
return response.json();
} )
.then( ( json ) => {
2023-09-28 16:05:51 +00:00
fetchCache.set( url, json );
maybePruneFetchCache();
2023-09-28 15:09:44 +00:00
resolve( json );
} )
.catch( () => {
reject();
} );
} );
}
// Fetch search results for a given set of URLSearchParams from the WooCommerce.com API
2023-09-28 15:09:37 +00:00
async function fetchSearchResults(
params: URLSearchParams,
abortSignal?: AbortSignal
In app search improvements feature branch (#51413) * Add search results count to the in-app marketplace (#51266) * Add searchResults to context * Use setSearchResults in Content * Add ribbons to the tabs * Changelog * Use setState as the function name * Only show ribbon counts when there's an active search * Refactor how 'setSearchResultsCount' is used (h/t @mcliwanow) * Don't populate initial search results * Unify css styling * Marketplace: bring back the loading state (#51342) * Marketplace: bring back the loading state * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com> * Remove in-app marketplace Search results tab and unify results into existing tabs (#51297) * Remove search results component and any references to it * Persist current tab for searching, or default to extensions if tab is not set * Persist term when switching across tabs * Lint * When a search is initiated, fetch all categories to keep the tab counts up to date. The necessary filtering to display data to the current screen will be performed on the frontend. * Apply correct colors to the tabs, as per design * Beyond query.term, also rely on isLoading so that search result counts don't jump * Address an issue when the user searches for something that returns no results in the business services tab * Changelog * Addressed :) * Change key to category * Fix category filter being broken Whenever a category is requested, we need to do an additional request with the category param being the current category (overriding extensions/theme/business services). Ideally the backend API would make a distinction between type (theme/extension/business service) and category, but this hack should do for now. * Lint * Remove unused variables h/t @KokkieH * Lint * Revert "Lint" This reverts commit 0b2d2dca6de5087b3b0ae5599f8bb0114cebc4ab. * Actually fix lint without introducing infinite loop Reproducible at http://localhost:8080/wp-admin/admin.php?page=wc-admin&term=payments&tab=extensions&path=%2Fextensions&category=customer-service * Show category selector even if there are no results displayed * Update comment to be less misleading * Query isn't used here * Update Marketplace search component (#51313) * Update Search placeholder text * Replace search component with one from @wordpress/components * Make mobile search field font consistent with desktop * Add changefile(s) from automation for the following project(s): woocommerce * Handle import errors for SearchControl component --------- Co-authored-by: github-actions <github-actions@github.com> * Marketplace: update category selector (#51309) * Marketplace: update category selector Remove the dropdown on the desktop view and show all items, even if overflowing. Added helper buttons to scroll to the right to show more. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove category sroll helpers from tabindex GitHub: https://github.com/woocommerce/woocommerce/pull/51309/files#r1758448638 * Marketplace: Remove selectedTab reference from product.tsx This is probably included due to the merge conflict * Marketplace: tweak category scroll button narrower --------- Co-authored-by: github-actions <github-actions@github.com> * Lint * Fix 2 lint errors * Fix another lint error (useMemo) h/t @KokkieH * Add load more button in-app (#51434) * Add additional fields returned by search API to marketplace types Ensure components have access to additional fields * Add LoadMoreButton component * Only render Load More button if there are additional pages of results * Fetch and display next page of results in Load More button is clicked * Simplify renderContent function to have less repetition - Hide load more button while fetching results * Improve loading of new products - Ensure keyboard focus goes to first new product after Load More is clicked * Add changefile(s) from automation for the following project(s): woocommerce * Add blank line to separate sections * Set category param based on current tab when loading more products * Improve busy-state screen reader text Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Add missing dependency * Move getProductType() function to functions.tsx - Do not show load more button if isLoading state is true --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Rework the values used with `setSearchResultsCount` After https://github.com/Automattic/woocommerce.com/pull/21678/files we get a `totalProducts` so we can re-use that. Also remove setting the counts when paginating since we set them to the total. * Add search complete announcement h/t @KokkieH * Show update count only if greater than 0 h/t @andfinally * Switch to Extensions tab if on My subscriptions when searching * yoda --------- Co-authored-by: Cem Ünalan <raicem@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Herman <KokkieH@users.noreply.github.com>
2024-09-18 12:14:30 +00:00
): Promise< {
products: Product[];
totalPages: number;
totalProducts: number;
} > {
const url =
MARKETPLACE_HOST +
MARKETPLACE_SEARCH_API_PATH +
'?' +
params.toString();
// Fetch data from WCCOM API
return new Promise( ( resolve, reject ) => {
fetchJsonWithCache( url, abortSignal )
.then( ( json ) => {
/**
* Product card component expects a Product type.
* So we build that object from the API response.
*/
2023-09-29 10:02:48 +00:00
const products = ( json as SearchAPIJSONType ).products.map(
( product: SearchAPIProductType ): Product => {
return {
id: product.id,
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
slug: product.slug,
title: product.title,
image: product.image,
type: product.type,
freemium_type: product.freemium_type,
description: product.excerpt,
vendorName: product.vendor_name,
vendorUrl: product.vendor_url,
icon: product.icon,
url: product.link,
// Due to backwards compatibility, raw_price is from search API, price is from featured API
price: product.raw_price ?? product.price,
averageRating: product.rating ?? null,
reviewsCount: product.reviews_count ?? null,
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
isInstallable: product.is_installable,
featuredImage: product.featured_image,
productCategory: product.product_category,
color: product.color,
billingPeriod: product.billing_period,
billingPeriodInterval:
product.billing_period_interval,
currency: product.currency,
};
}
);
In app search improvements feature branch (#51413) * Add search results count to the in-app marketplace (#51266) * Add searchResults to context * Use setSearchResults in Content * Add ribbons to the tabs * Changelog * Use setState as the function name * Only show ribbon counts when there's an active search * Refactor how 'setSearchResultsCount' is used (h/t @mcliwanow) * Don't populate initial search results * Unify css styling * Marketplace: bring back the loading state (#51342) * Marketplace: bring back the loading state * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com> * Remove in-app marketplace Search results tab and unify results into existing tabs (#51297) * Remove search results component and any references to it * Persist current tab for searching, or default to extensions if tab is not set * Persist term when switching across tabs * Lint * When a search is initiated, fetch all categories to keep the tab counts up to date. The necessary filtering to display data to the current screen will be performed on the frontend. * Apply correct colors to the tabs, as per design * Beyond query.term, also rely on isLoading so that search result counts don't jump * Address an issue when the user searches for something that returns no results in the business services tab * Changelog * Addressed :) * Change key to category * Fix category filter being broken Whenever a category is requested, we need to do an additional request with the category param being the current category (overriding extensions/theme/business services). Ideally the backend API would make a distinction between type (theme/extension/business service) and category, but this hack should do for now. * Lint * Remove unused variables h/t @KokkieH * Lint * Revert "Lint" This reverts commit 0b2d2dca6de5087b3b0ae5599f8bb0114cebc4ab. * Actually fix lint without introducing infinite loop Reproducible at http://localhost:8080/wp-admin/admin.php?page=wc-admin&term=payments&tab=extensions&path=%2Fextensions&category=customer-service * Show category selector even if there are no results displayed * Update comment to be less misleading * Query isn't used here * Update Marketplace search component (#51313) * Update Search placeholder text * Replace search component with one from @wordpress/components * Make mobile search field font consistent with desktop * Add changefile(s) from automation for the following project(s): woocommerce * Handle import errors for SearchControl component --------- Co-authored-by: github-actions <github-actions@github.com> * Marketplace: update category selector (#51309) * Marketplace: update category selector Remove the dropdown on the desktop view and show all items, even if overflowing. Added helper buttons to scroll to the right to show more. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove category sroll helpers from tabindex GitHub: https://github.com/woocommerce/woocommerce/pull/51309/files#r1758448638 * Marketplace: Remove selectedTab reference from product.tsx This is probably included due to the merge conflict * Marketplace: tweak category scroll button narrower --------- Co-authored-by: github-actions <github-actions@github.com> * Lint * Fix 2 lint errors * Fix another lint error (useMemo) h/t @KokkieH * Add load more button in-app (#51434) * Add additional fields returned by search API to marketplace types Ensure components have access to additional fields * Add LoadMoreButton component * Only render Load More button if there are additional pages of results * Fetch and display next page of results in Load More button is clicked * Simplify renderContent function to have less repetition - Hide load more button while fetching results * Improve loading of new products - Ensure keyboard focus goes to first new product after Load More is clicked * Add changefile(s) from automation for the following project(s): woocommerce * Add blank line to separate sections * Set category param based on current tab when loading more products * Improve busy-state screen reader text Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Add missing dependency * Move getProductType() function to functions.tsx - Do not show load more button if isLoading state is true --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Rework the values used with `setSearchResultsCount` After https://github.com/Automattic/woocommerce.com/pull/21678/files we get a `totalProducts` so we can re-use that. Also remove setting the counts when paginating since we set them to the total. * Add search complete announcement h/t @KokkieH * Show update count only if greater than 0 h/t @andfinally * Switch to Extensions tab if on My subscriptions when searching * yoda --------- Co-authored-by: Cem Ünalan <raicem@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Herman <KokkieH@users.noreply.github.com>
2024-09-18 12:14:30 +00:00
const totalPages = ( json as SearchAPIJSONType ).total_pages;
const totalProducts = ( json as SearchAPIJSONType )
.total_products;
resolve( { products, totalPages, totalProducts } );
} )
In app search improvements feature branch (#51413) * Add search results count to the in-app marketplace (#51266) * Add searchResults to context * Use setSearchResults in Content * Add ribbons to the tabs * Changelog * Use setState as the function name * Only show ribbon counts when there's an active search * Refactor how 'setSearchResultsCount' is used (h/t @mcliwanow) * Don't populate initial search results * Unify css styling * Marketplace: bring back the loading state (#51342) * Marketplace: bring back the loading state * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com> * Remove in-app marketplace Search results tab and unify results into existing tabs (#51297) * Remove search results component and any references to it * Persist current tab for searching, or default to extensions if tab is not set * Persist term when switching across tabs * Lint * When a search is initiated, fetch all categories to keep the tab counts up to date. The necessary filtering to display data to the current screen will be performed on the frontend. * Apply correct colors to the tabs, as per design * Beyond query.term, also rely on isLoading so that search result counts don't jump * Address an issue when the user searches for something that returns no results in the business services tab * Changelog * Addressed :) * Change key to category * Fix category filter being broken Whenever a category is requested, we need to do an additional request with the category param being the current category (overriding extensions/theme/business services). Ideally the backend API would make a distinction between type (theme/extension/business service) and category, but this hack should do for now. * Lint * Remove unused variables h/t @KokkieH * Lint * Revert "Lint" This reverts commit 0b2d2dca6de5087b3b0ae5599f8bb0114cebc4ab. * Actually fix lint without introducing infinite loop Reproducible at http://localhost:8080/wp-admin/admin.php?page=wc-admin&term=payments&tab=extensions&path=%2Fextensions&category=customer-service * Show category selector even if there are no results displayed * Update comment to be less misleading * Query isn't used here * Update Marketplace search component (#51313) * Update Search placeholder text * Replace search component with one from @wordpress/components * Make mobile search field font consistent with desktop * Add changefile(s) from automation for the following project(s): woocommerce * Handle import errors for SearchControl component --------- Co-authored-by: github-actions <github-actions@github.com> * Marketplace: update category selector (#51309) * Marketplace: update category selector Remove the dropdown on the desktop view and show all items, even if overflowing. Added helper buttons to scroll to the right to show more. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove category sroll helpers from tabindex GitHub: https://github.com/woocommerce/woocommerce/pull/51309/files#r1758448638 * Marketplace: Remove selectedTab reference from product.tsx This is probably included due to the merge conflict * Marketplace: tweak category scroll button narrower --------- Co-authored-by: github-actions <github-actions@github.com> * Lint * Fix 2 lint errors * Fix another lint error (useMemo) h/t @KokkieH * Add load more button in-app (#51434) * Add additional fields returned by search API to marketplace types Ensure components have access to additional fields * Add LoadMoreButton component * Only render Load More button if there are additional pages of results * Fetch and display next page of results in Load More button is clicked * Simplify renderContent function to have less repetition - Hide load more button while fetching results * Improve loading of new products - Ensure keyboard focus goes to first new product after Load More is clicked * Add changefile(s) from automation for the following project(s): woocommerce * Add blank line to separate sections * Set category param based on current tab when loading more products * Improve busy-state screen reader text Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Add missing dependency * Move getProductType() function to functions.tsx - Do not show load more button if isLoading state is true --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Rework the values used with `setSearchResultsCount` After https://github.com/Automattic/woocommerce.com/pull/21678/files we get a `totalProducts` so we can re-use that. Also remove setting the counts when paginating since we set them to the total. * Add search complete announcement h/t @KokkieH * Show update count only if greater than 0 h/t @andfinally * Switch to Extensions tab if on My subscriptions when searching * yoda --------- Co-authored-by: Cem Ünalan <raicem@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Herman <KokkieH@users.noreply.github.com>
2024-09-18 12:14:30 +00:00
.catch( reject );
} );
}
// Fetch data for the discover page from the WooCommerce.com API
async function fetchDiscoverPageData(): Promise< ProductGroup[] > {
let url = '/wc/v3/marketplace/featured';
if ( LOCALE.userLocale ) {
url = `${ url }?locale=${ LOCALE.userLocale }`;
}
try {
return ( await apiFetchWithCache( {
path: url.toString(),
} ) ) as Promise< ProductGroup[] >;
} catch ( error ) {
return [];
}
}
In app search improvements feature branch (#51413) * Add search results count to the in-app marketplace (#51266) * Add searchResults to context * Use setSearchResults in Content * Add ribbons to the tabs * Changelog * Use setState as the function name * Only show ribbon counts when there's an active search * Refactor how 'setSearchResultsCount' is used (h/t @mcliwanow) * Don't populate initial search results * Unify css styling * Marketplace: bring back the loading state (#51342) * Marketplace: bring back the loading state * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com> * Remove in-app marketplace Search results tab and unify results into existing tabs (#51297) * Remove search results component and any references to it * Persist current tab for searching, or default to extensions if tab is not set * Persist term when switching across tabs * Lint * When a search is initiated, fetch all categories to keep the tab counts up to date. The necessary filtering to display data to the current screen will be performed on the frontend. * Apply correct colors to the tabs, as per design * Beyond query.term, also rely on isLoading so that search result counts don't jump * Address an issue when the user searches for something that returns no results in the business services tab * Changelog * Addressed :) * Change key to category * Fix category filter being broken Whenever a category is requested, we need to do an additional request with the category param being the current category (overriding extensions/theme/business services). Ideally the backend API would make a distinction between type (theme/extension/business service) and category, but this hack should do for now. * Lint * Remove unused variables h/t @KokkieH * Lint * Revert "Lint" This reverts commit 0b2d2dca6de5087b3b0ae5599f8bb0114cebc4ab. * Actually fix lint without introducing infinite loop Reproducible at http://localhost:8080/wp-admin/admin.php?page=wc-admin&term=payments&tab=extensions&path=%2Fextensions&category=customer-service * Show category selector even if there are no results displayed * Update comment to be less misleading * Query isn't used here * Update Marketplace search component (#51313) * Update Search placeholder text * Replace search component with one from @wordpress/components * Make mobile search field font consistent with desktop * Add changefile(s) from automation for the following project(s): woocommerce * Handle import errors for SearchControl component --------- Co-authored-by: github-actions <github-actions@github.com> * Marketplace: update category selector (#51309) * Marketplace: update category selector Remove the dropdown on the desktop view and show all items, even if overflowing. Added helper buttons to scroll to the right to show more. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove category sroll helpers from tabindex GitHub: https://github.com/woocommerce/woocommerce/pull/51309/files#r1758448638 * Marketplace: Remove selectedTab reference from product.tsx This is probably included due to the merge conflict * Marketplace: tweak category scroll button narrower --------- Co-authored-by: github-actions <github-actions@github.com> * Lint * Fix 2 lint errors * Fix another lint error (useMemo) h/t @KokkieH * Add load more button in-app (#51434) * Add additional fields returned by search API to marketplace types Ensure components have access to additional fields * Add LoadMoreButton component * Only render Load More button if there are additional pages of results * Fetch and display next page of results in Load More button is clicked * Simplify renderContent function to have less repetition - Hide load more button while fetching results * Improve loading of new products - Ensure keyboard focus goes to first new product after Load More is clicked * Add changefile(s) from automation for the following project(s): woocommerce * Add blank line to separate sections * Set category param based on current tab when loading more products * Improve busy-state screen reader text Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Add missing dependency * Move getProductType() function to functions.tsx - Do not show load more button if isLoading state is true --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Rework the values used with `setSearchResultsCount` After https://github.com/Automattic/woocommerce.com/pull/21678/files we get a `totalProducts` so we can re-use that. Also remove setting the counts when paginating since we set them to the total. * Add search complete announcement h/t @KokkieH * Show update count only if greater than 0 h/t @andfinally * Switch to Extensions tab if on My subscriptions when searching * yoda --------- Co-authored-by: Cem Ünalan <raicem@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Herman <KokkieH@users.noreply.github.com>
2024-09-18 12:14:30 +00:00
function getProductType( tab: string ): ProductType {
switch ( tab ) {
case 'themes':
return ProductType.theme;
case 'business-services':
return ProductType.businessService;
default:
return ProductType.extension;
}
}
Marketplace Themes: Feature Branch (#40159) * Support for themes in in-app marketplace. Contains the changes from: https://github.com/woocommerce/woocommerce/pull/40247 https://github.com/woocommerce/woocommerce/pull/40272 https://github.com/woocommerce/woocommerce/pull/40302 https://github.com/woocommerce/woocommerce/pull/40303 https://github.com/woocommerce/woocommerce/pull/40333 https://github.com/woocommerce/woocommerce/pull/40368 https://github.com/woocommerce/woocommerce/pull/40375 https://github.com/woocommerce/woocommerce/pull/40375 https://github.com/woocommerce/woocommerce/pull/40389 * `.woocommerce-marketplace__discover`: changed `align-items` `flex-start` to `stretch` to properly display products on large and very large viewports. * Delete plugins/woocommerce/changelog/add-18026-marketplace-theme-cards Removing from feature branch before final review * Delete plugins/woocommerce/changelog/add-18027-themes-to-in-app-search Removing from feature branch before final review * Delete plugins/woocommerce/changelog/add-marketplace-theme-discover-section Removing from feature branch before final review * Delete plugins/woocommerce/changelog/update-in-app-multiple-category-filters Removing from feature branch before final review * Delete plugins/woocommerce/changelog/update-theme-no-result-style Removing from feature branch before final review * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: Dan Q <dan@danq.me> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Dan Q <danq@automattic.com>
2023-10-04 16:59:34 +00:00
function fetchCategories( type: ProductType ): Promise< CategoryAPIItem[] > {
const url = new URL( MARKETPLACE_HOST + MARKETPLACE_CATEGORY_API_PATH );
if ( LOCALE.userLocale ) {
Marketplace Themes: Feature Branch (#40159) * Support for themes in in-app marketplace. Contains the changes from: https://github.com/woocommerce/woocommerce/pull/40247 https://github.com/woocommerce/woocommerce/pull/40272 https://github.com/woocommerce/woocommerce/pull/40302 https://github.com/woocommerce/woocommerce/pull/40303 https://github.com/woocommerce/woocommerce/pull/40333 https://github.com/woocommerce/woocommerce/pull/40368 https://github.com/woocommerce/woocommerce/pull/40375 https://github.com/woocommerce/woocommerce/pull/40375 https://github.com/woocommerce/woocommerce/pull/40389 * `.woocommerce-marketplace__discover`: changed `align-items` `flex-start` to `stretch` to properly display products on large and very large viewports. * Delete plugins/woocommerce/changelog/add-18026-marketplace-theme-cards Removing from feature branch before final review * Delete plugins/woocommerce/changelog/add-18027-themes-to-in-app-search Removing from feature branch before final review * Delete plugins/woocommerce/changelog/add-marketplace-theme-discover-section Removing from feature branch before final review * Delete plugins/woocommerce/changelog/update-in-app-multiple-category-filters Removing from feature branch before final review * Delete plugins/woocommerce/changelog/update-theme-no-result-style Removing from feature branch before final review * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: Dan Q <dan@danq.me> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Dan Q <danq@automattic.com>
2023-10-04 16:59:34 +00:00
url.searchParams.set( 'locale', LOCALE.userLocale );
}
// We don't define parent for extensions since that is provided by default
// This is to ensure the old marketplace continues to work when this isn't defined
if ( type === ProductType.theme ) {
url.searchParams.set( 'parent', 'themes' );
} else if ( type === ProductType.businessService ) {
url.searchParams.set( 'parent', 'business-services' );
}
return (
fetchJsonWithCache( url.toString() ) as Promise< CategoryAPIItem[] >
)
2023-08-09 13:04:35 +00:00
.then( ( json ) => {
return json;
} )
.catch( () => {
return [];
} );
}
2023-09-26 12:12:14 +00:00
async function fetchSubscriptions(): Promise< Array< Subscription > > {
const url = '/wc/v3/marketplace/subscriptions';
return await apiFetch( { path: url.toString() } );
}
async function refreshSubscriptions(): Promise< Array< Subscription > > {
const url = '/wc/v3/marketplace/refresh';
return await apiFetch( {
path: url.toString(),
method: 'POST',
} );
}
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
function connectProduct( subscription: Subscription ): Promise< void > {
if ( subscription.active === true ) {
return Promise.resolve();
}
const url = '/wc/v3/marketplace/subscriptions/connect';
const data = new URLSearchParams();
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
data.append( 'product_key', subscription.product_key );
return apiFetch( {
path: url.toString(),
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: data,
} );
}
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
function disconnectProduct( subscription: Subscription ): Promise< void > {
if ( subscription.active === false ) {
return Promise.resolve();
}
const url = '/wc/v3/marketplace/subscriptions/disconnect';
const data = new URLSearchParams();
data.append( 'product_key', subscription.product_key );
return apiFetch( {
path: url.toString(),
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: data,
} );
}
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
type WpAjaxReponse = {
success: boolean;
data: WpAjaxResponseData;
};
type WpAjaxResponseData = {
errorMessage?: string;
activateUrl?: string;
};
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
function wpAjax(
action: string,
data: {
slug?: string;
plugin?: string;
theme?: string;
success?: boolean;
}
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
): Promise< WpAjaxReponse > {
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
return new Promise( ( resolve, reject ) => {
if ( ! window.wp.updates ) {
reject( __( 'Please reload and try again', 'woocommerce' ) );
return;
}
window.wp.updates.ajax( action, {
...data,
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
success: ( response: WpAjaxResponseData ) => {
resolve( {
success: true,
data: response,
} );
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
},
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
error: ( error: WpAjaxResponseData ) => {
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
reject( {
success: false,
data: {
message: error.errorMessage,
},
} );
},
} );
} );
}
function activateProduct( subscription: Subscription ): Promise< void > {
if ( subscription.local.active === true ) {
return Promise.resolve();
}
My subscription product updates (#40752) * 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 * 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> --------- 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-10-27 04:08:27 +00:00
const url = '/wc/v3/marketplace/subscriptions/activate';
const data = new URLSearchParams();
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
data.append( 'product_key', subscription.product_key );
My subscription product updates (#40752) * 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 * 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> --------- 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-10-27 04:08:27 +00:00
return apiFetch( {
path: url.toString(),
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: data,
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
} )
.then( () => Promise.resolve() )
.catch( () =>
Promise.reject( {
success: false,
data: {
message: sprintf(
// translators: %s is the product name.
__(
'%s could not be activated. Please activate it manually.',
'woocommerce'
),
subscription.product_name
),
},
} )
);
}
function getInstallUrl( subscription: Subscription ): Promise< string > {
return apiFetch( {
path:
'/wc/v3/marketplace/subscriptions/install-url?product_key=' +
subscription.product_key,
} ).then( ( response ) => {
return ( response as { data: { url: string } } )?.data.url;
} );
}
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
function downloadProduct( productType: string, zipSlug: string ) {
return wpAjax( 'install-' + productType, {
// The slug prefix is required for the install to use WCCOM install filters.
slug: zipSlug,
} );
}
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
function installProduct( subscription: Subscription ): Promise< void > {
return connectProduct( subscription ).then( () => {
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
return downloadProduct(
subscription.product_type,
subscription.zip_slug
)
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
.then( () => {
return activateProduct( subscription );
} )
.catch( ( error ) => {
// If install fails disconnect the product
return disconnectProduct( subscription ).finally( () =>
Promise.reject( error )
);
} );
My subscription product updates (#40752) * 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 * 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> --------- 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-10-27 04:08:27 +00:00
} );
}
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
function updateProduct( subscription: Subscription ): Promise< WpAjaxReponse > {
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
return wpAjax( 'update-' + subscription.product_type, {
slug: subscription.local.slug,
[ subscription.product_type ]: subscription.local.path,
} );
}
function addNotice(
productKey: string,
message: string,
status?: NoticeStatus,
options?: Partial< Options >
) {
if ( status === NoticeStatus.Error ) {
dispatch( noticeStore ).addNotice(
productKey,
message,
status,
options
);
} else {
if ( ! options?.icon ) {
options = {
...options,
icon: <Icon icon="saved" />,
};
}
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
dispatch( 'core/notices' ).createSuccessNotice( message, options );
}
}
const removeNotice = ( productKey: string ) => {
dispatch( noticeStore ).removeNotice( productKey );
};
const subscriptionToProduct = ( subscription: Subscription ): Product => {
return {
id: subscription.product_id,
title: subscription.product_name,
image: '',
type: subscription.product_type as ProductType,
description: '',
vendorName: '',
vendorUrl: '',
icon: subscription.product_icon,
url: subscription.product_url,
price: -1,
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
averageRating: null,
reviewsCount: null,
isInstallable: false,
currency: '',
};
};
// Append UTM parameters to a URL, being aware of existing query parameters
const appendURLParams = (
url: string,
utmParams: Array< [ string, string ] >
): string => {
Marketplace Themes: Feature Branch (#40159) * Support for themes in in-app marketplace. Contains the changes from: https://github.com/woocommerce/woocommerce/pull/40247 https://github.com/woocommerce/woocommerce/pull/40272 https://github.com/woocommerce/woocommerce/pull/40302 https://github.com/woocommerce/woocommerce/pull/40303 https://github.com/woocommerce/woocommerce/pull/40333 https://github.com/woocommerce/woocommerce/pull/40368 https://github.com/woocommerce/woocommerce/pull/40375 https://github.com/woocommerce/woocommerce/pull/40375 https://github.com/woocommerce/woocommerce/pull/40389 * `.woocommerce-marketplace__discover`: changed `align-items` `flex-start` to `stretch` to properly display products on large and very large viewports. * Delete plugins/woocommerce/changelog/add-18026-marketplace-theme-cards Removing from feature branch before final review * Delete plugins/woocommerce/changelog/add-18027-themes-to-in-app-search Removing from feature branch before final review * Delete plugins/woocommerce/changelog/add-marketplace-theme-discover-section Removing from feature branch before final review * Delete plugins/woocommerce/changelog/update-in-app-multiple-category-filters Removing from feature branch before final review * Delete plugins/woocommerce/changelog/update-theme-no-result-style Removing from feature branch before final review * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: Dan Q <dan@danq.me> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Dan Q <danq@automattic.com>
2023-10-04 16:59:34 +00:00
if ( ! url ) {
return url;
}
const urlObject = new URL( url );
if ( ! urlObject ) {
return url;
}
utmParams.forEach( ( [ key, value ] ) => {
urlObject.searchParams.set( key, value );
} );
return urlObject.toString();
};
const enableAutorenewalUrl = ( subscription: Subscription ): string => {
if ( ! subscription.product_key ) {
// review subscriptions on the Marketplace
return MARKETPLACE_RENEW_SUBSCRIPTON_PATH;
}
return appendURLParams( MARKETPLACE_RENEW_SUBSCRIPTON_PATH, [
[ 'key', subscription.product_key.toString() ],
] );
};
const renewUrl = ( subscription: Subscription ): string => {
return appendURLParams( MARKETPLACE_CART_PATH, [
[ 'renew_product', subscription.product_id.toString() ],
[ 'product_key', subscription.product_key ],
[ 'order_id', subscription.order_id.toString() ],
] );
};
const subscribeUrl = ( subscription: Subscription ): string => {
return appendURLParams( MARKETPLACE_CART_PATH, [
[ 'add-to-cart', subscription.product_id.toString() ],
] );
};
const connectUrl = (): string => {
const wccomSettings = getAdminSetting( 'wccomHelper', {} );
if ( ! wccomSettings.connectURL ) {
return '';
}
return appendURLParams( wccomSettings.connectURL, [
[ 'redirect_admin_url', encodeURIComponent( window.location.href ) ],
] );
};
export {
My subscription product updates (#40752) * 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 * 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> --------- 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-10-27 04:08:27 +00:00
ProductGroup,
appendURLParams,
connectProduct,
enableAutorenewalUrl,
fetchCategories,
My subscription product updates (#40752) * 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 * 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> --------- 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-10-27 04:08:27 +00:00
fetchDiscoverPageData,
fetchSearchResults,
In app search improvements feature branch (#51413) * Add search results count to the in-app marketplace (#51266) * Add searchResults to context * Use setSearchResults in Content * Add ribbons to the tabs * Changelog * Use setState as the function name * Only show ribbon counts when there's an active search * Refactor how 'setSearchResultsCount' is used (h/t @mcliwanow) * Don't populate initial search results * Unify css styling * Marketplace: bring back the loading state (#51342) * Marketplace: bring back the loading state * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com> * Remove in-app marketplace Search results tab and unify results into existing tabs (#51297) * Remove search results component and any references to it * Persist current tab for searching, or default to extensions if tab is not set * Persist term when switching across tabs * Lint * When a search is initiated, fetch all categories to keep the tab counts up to date. The necessary filtering to display data to the current screen will be performed on the frontend. * Apply correct colors to the tabs, as per design * Beyond query.term, also rely on isLoading so that search result counts don't jump * Address an issue when the user searches for something that returns no results in the business services tab * Changelog * Addressed :) * Change key to category * Fix category filter being broken Whenever a category is requested, we need to do an additional request with the category param being the current category (overriding extensions/theme/business services). Ideally the backend API would make a distinction between type (theme/extension/business service) and category, but this hack should do for now. * Lint * Remove unused variables h/t @KokkieH * Lint * Revert "Lint" This reverts commit 0b2d2dca6de5087b3b0ae5599f8bb0114cebc4ab. * Actually fix lint without introducing infinite loop Reproducible at http://localhost:8080/wp-admin/admin.php?page=wc-admin&term=payments&tab=extensions&path=%2Fextensions&category=customer-service * Show category selector even if there are no results displayed * Update comment to be less misleading * Query isn't used here * Update Marketplace search component (#51313) * Update Search placeholder text * Replace search component with one from @wordpress/components * Make mobile search field font consistent with desktop * Add changefile(s) from automation for the following project(s): woocommerce * Handle import errors for SearchControl component --------- Co-authored-by: github-actions <github-actions@github.com> * Marketplace: update category selector (#51309) * Marketplace: update category selector Remove the dropdown on the desktop view and show all items, even if overflowing. Added helper buttons to scroll to the right to show more. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove category sroll helpers from tabindex GitHub: https://github.com/woocommerce/woocommerce/pull/51309/files#r1758448638 * Marketplace: Remove selectedTab reference from product.tsx This is probably included due to the merge conflict * Marketplace: tweak category scroll button narrower --------- Co-authored-by: github-actions <github-actions@github.com> * Lint * Fix 2 lint errors * Fix another lint error (useMemo) h/t @KokkieH * Add load more button in-app (#51434) * Add additional fields returned by search API to marketplace types Ensure components have access to additional fields * Add LoadMoreButton component * Only render Load More button if there are additional pages of results * Fetch and display next page of results in Load More button is clicked * Simplify renderContent function to have less repetition - Hide load more button while fetching results * Improve loading of new products - Ensure keyboard focus goes to first new product after Load More is clicked * Add changefile(s) from automation for the following project(s): woocommerce * Add blank line to separate sections * Set category param based on current tab when loading more products * Improve busy-state screen reader text Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Add missing dependency * Move getProductType() function to functions.tsx - Do not show load more button if isLoading state is true --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Boro Sitnikovski <buritomath@gmail.com> * Rework the values used with `setSearchResultsCount` After https://github.com/Automattic/woocommerce.com/pull/21678/files we get a `totalProducts` so we can re-use that. Also remove setting the counts when paginating since we set them to the total. * Add search complete announcement h/t @KokkieH * Show update count only if greater than 0 h/t @andfinally * Switch to Extensions tab if on My subscriptions when searching * yoda --------- Co-authored-by: Cem Ünalan <raicem@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Herman <KokkieH@users.noreply.github.com>
2024-09-18 12:14:30 +00:00
getProductType,
2023-09-26 12:12:14 +00:00
fetchSubscriptions,
refreshSubscriptions,
getInstallUrl,
Marketplace: Add "Add to Store" button for free and WordPress.org products #43616 (#43983) * Marketplace: Add "Add to Store" button for free and WordPress.org products (#43616) * Marketplace: Install free .org plugins with Add to Store button * Marketplace: addressed feedback for the the new install free products flow - Moved notices to the top of the modal - Updated notice styles slightly - Updated the CreateOrderSuccessResponse to reflect API changes * Marketplace: Require the Helper orders API file * Marketplace: fix linter errors * Marketplace: form encode when submitting the request The body is encoded anyways by the WordPress core. However, if I don't do it here, I can't create a valid signature to be verified by Woo.com. I could have just submitted a JSON too, but this seamed easier since the body is parsed on Woo.com automatically when it's in this form. * Add changefile(s) from automation for the following project(s): woocommerce * Marketplace: remove "~" character in imports and use relative paths * Marketplace: fix margins in the product with the Add to Store button * Marketplace: Add conditions to hide the button We hide it if: - the product is already installed - user doesn't have the right capability - if the product is just installed using our flow and there is no page refresh * Marketplace: don't show Add to Store button on Themes and on Discover * Marketplace: fix linting * Marketplace: hide ratings from the product if "is-small" class exists * Marketplace: fix linting errors --------- Co-authored-by: github-actions <github-actions@github.com>
2024-01-24 20:02:20 +00:00
downloadProduct,
activateProduct,
installProduct,
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
updateProduct,
addNotice,
removeNotice,
renewUrl,
subscribeUrl,
subscriptionToProduct,
connectUrl,
};