woocommerce/plugins/woocommerce-admin/client/wp-admin-scripts/marketing-coupons/index.js

22 lines
436 B
JavaScript
Raw Normal View History

Add Coupon feature (https://github.com/woocommerce/woocommerce-admin/pull/4526) * Handle new object for posts and recommendations * Set breadcrumb parent for woocommerce-coupons to be woocommerce-marketing * Add main coupon wrapping component * Render coupon wrapper element below coupon table using wp-admin-scripts * Finish off implementing category param for data store resolvers * Create a helper trait for legacy coupons * Add coupon related titles and descriptions * Add note for the coupons being moved * Allow for querying by note name in the notes Data Store * Revamp coupon moved trait * Add the new note only if we don't have an unactioned note and perform a redirect to ensure menu updates * set_icon is deprecated * Move coupon menu, adding a note for customers * Translate title and descriptions * Whitespace * Account for coupon functionality being disabled * Hide legacy menu before redirect * Don’t keep adding the note if customer dismisses it from inbox * Move behind feature flag * Add note if feature enabled * Add filter to override coupon feature * Tweak option name to refer to wc_admin To help with finding etc. * use css variables * Add the new note only if we don't have an unactioned note * Switch the filter logic so `false` turns off the feature This is a bit more intuitive when utilizing the filter * Remove extraneous string and add trailing new lines * Use correct posts object in tests * Revert accidental removal of where_types * Add coupons category to RecommendedExtensions * Use 1.1 api to get categorized recommendations * Add missing text domains * Fix menu handling to point to woocommerce-marketing * Only load coupon scripts on the coupon page * Rework marketing menu logic to register pages more properly * Use correct wc-admin path for marketing page * Remove separate feature flag WC Admin has existing feature flags to load enable/disable the feature * Only set the coupon parent to marketing when the feature is enabled * Only load coupon feature if marketing feature is enabled Co-authored-by: Dan Bitzer <danielbitzer@gmail.com> Co-authored-by: Jeremy Pry <jeremy.pry@gmail.com>
2020-06-16 02:30:41 +00:00
/**
* External dependencies
*/
import { render } from '@wordpress/element';
/**
* Internal dependencies
*/
import CouponsOverview from '../../marketing/coupons';
const postForm = document.getElementById( 'posts-filter' );
if ( postForm ) {
const couponRoot = document.createElement( 'div' );
couponRoot.setAttribute( 'id', 'coupon-root' );
render(
<CouponsOverview />,
postForm.parentNode.appendChild( couponRoot )
);
}