woocommerce/plugins/woocommerce-admin/client/payments-welcome/index.tsx

145 lines
3.8 KiB
TypeScript
Raw Normal View History

Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
/**
* External dependencies
*/
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
import { Notice } from '@wordpress/components';
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
import { useState, useEffect } from '@wordpress/element';
import { recordEvent } from '@woocommerce/tracks';
import { useDispatch, useSelect } from '@wordpress/data';
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
import apiFetch from '@wordpress/api-fetch';
/**
* Internal dependencies
*/
import Banner from './banner';
import ApmList, { Apm } from './apms';
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
import './style.scss';
import { getAdminSetting } from '~/utils/admin-settings';
import FrequentlyAskedQuestionsSimple from './faq-simple';
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
declare global {
interface Window {
wcCalypsoBridge: unknown;
location: Location;
wcSettings: {
admin: {
wcpay_welcome_page_connect_nonce: string;
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
currentUserData: {
first_name: string;
};
wcpayWelcomePageIncentive: {
id: string;
description: string;
cta_label: string;
tc_url: string;
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
};
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
};
};
}
}
interface activatePromoResponse {
success: boolean;
}
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
const ConnectAccountPage = () => {
const incentive = getAdminSetting( 'wcpayWelcomePageIncentive' );
const { updateOptions } = useDispatch( OPTIONS_STORE_NAME );
const { installAndActivatePlugins } = useDispatch( 'wc/admin/plugins' );
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
const [ isSubmitted, setSubmitted ] = useState( false );
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
const [ errorMessage, setErrorMessage ] = useState( '' );
const [ enabledApms, setEnabledApms ] = useState( new Set< Apm >() );
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
const { isJetpackConnected, connectUrl } = useSelect( ( select ) => {
return {
isJetpackConnected:
select( 'wc/admin/plugins' ).isJetpackConnected(),
connectUrl:
2023-06-19 15:14:05 +00:00
'admin.php?wcpay-connect=1&promo=' + encodeURIComponent( incentive.id ) +
2023-06-19 15:05:45 +00:00
'&_wpnonce=' + getAdminSetting( 'wcpay_welcome_page_connect_nonce' ),
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
};
} );
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
/**
* Record page view and save viewed timestamp.
*/
useEffect( () => {
recordEvent( 'page_view', {
path: 'payments_connect_core_test',
incentive_id: incentive.id,
} );
updateOptions( {
wcpay_welcome_page_viewed_timestamp: Math.floor(
Date.now() / 1000
),
} );
// We only want to record this once, so we don't want to re-run this effect.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [] );
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
const activatePromo = async () => {
const activatePromoRequest: activatePromoResponse = await apiFetch( {
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
path: `/wc-analytics/admin/notes/experimental-activate-promo/${ incentive.id }`,
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
method: 'POST',
} );
if ( activatePromoRequest?.success ) {
window.location.href = connectUrl;
}
};
const handleSetup = async () => {
setSubmitted( true );
recordEvent( 'wcpay_connect_account_clicked', {
wpcom_connection: isJetpackConnected ? 'Yes' : 'No',
incentive_id: incentive.id,
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
} );
const pluginsToInstall = [ ...enabledApms ].map(
( apm ) => apm.extension
);
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
try {
const installAndActivateResponse = await installAndActivatePlugins(
[ 'woocommerce-payments' ].concat( pluginsToInstall )
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
);
if ( installAndActivateResponse?.success ) {
recordEvent( 'wcpay_extension_installed', {
extensions: [ ...enabledApms ]
.map( ( apm ) => apm.id )
.join( ', ' ),
incentive_id: incentive.id,
} );
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
await activatePromo();
} else {
throw new Error( installAndActivateResponse.message );
}
} catch ( e ) {
2022-04-19 09:07:55 +00:00
if ( e instanceof Error ) {
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
setErrorMessage( e.message );
setSubmitted( false );
2022-04-19 09:07:55 +00:00
} else {
throw new Error( `Unexpected error occurred. ${ e }` );
}
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
}
};
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
if ( ! incentive ) return null;
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
return (
Update WCPay welcome page incentives (#38689) * Initial refactor of components Move out from index every UI component to make it easier to maintain. * Initial implementation of new design Some minor adjustments are missing, and I've added a few TODOs to complete later. * Add changelog entry * Finish design update * Compress menu icon * Add user's first name to heading copy * Fetch and cache eligible incentive from WCPay API Sharing its properties under `window.WcSettings.admin` * Filter `allowed_promo_notes` To be able to add those form WCPay API request * Update JS side to use the new shared incentive details * Ensure we cache requests even if there are no eligible incentives * Fix a typo in WCPayBanner * Move incentive preloaded data from wcSettings to a new window variable which will be only loaded on WCPay welcome page. * Simplify `has_wcpay` check * Render sanitized HTML from incentive description * Update get incentive logic to also cache non success responses * Add incentive ID to page view track * Add changelog entry for the onboarding package * Update used options names and add them to `get_default_option_permissions * Differentiate every dismissed incentive Reuse WCPay welcome page logic for notes display conditions * Use tos_url instead of tos_link to match response * Fix incentives endpoint request payload * Back to preload incentive on admin shared settings * Move promo notes filter to where it's used to avoid any possible race conditions. * Replace every occurrence of `WooCommerce Payments` with `WooPayments` * Prevent modal large padding-bottom * Prevent another global style override on modal * Fix TS error coming from trunk merge * Fix wrong style property * Further restrict WCPay incentives to plugin not active and countries supported * Adjust the meaning of has_wcpay * Wait for dismiss option update before redirect to prevent the side menu entry to be visible after redirecting back to WC admin. * Enforce TOS asterix at the end of incentive description * Remove underscore from priavate instance var. * Fix ESLint error * Fix SCSS linting issues * Refine `has_wcpay` and `has_orders` * Enforce consistent WooPayments branding * Enforce stricter i18n calls with escape * Update page title to match new branding * docs: Enforce branding in code docs also * Remove method that is unreliable to be used outside of onboarding * Remove unused constant * Missing new line Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> --------- Co-authored-by: Vlad Olaru <vlad@pixelgrade.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-16 14:32:58 +00:00
<div className="woopayments-welcome-page">
{ errorMessage && (
<Notice status="error" isDismissible={ false }>
{ errorMessage }
</Notice>
) }
<Banner isSubmitted={ isSubmitted } handleSetup={ handleSetup } />
<ApmList
enabledApms={ enabledApms }
setEnabledApms={ setEnabledApms }
/>
<FrequentlyAskedQuestionsSimple />
Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8151) * Move WC Pay welcome page from wc-calypso-bridge (https://github.com/woocommerce/woocommerce-admin/pull/8083) * Add wc-pay-welcome-screen flags * Add wc pay welcome page from wc calpyso bridge * Add changelog * Rename var to pageViewTimestamp to prevent confusion * Remove unused code * Make sure hasViewedWelcomePage is a boolean value * Simplify storeViewWelcome * Add payments remind me later note (https://github.com/woocommerce/woocommerce-admin/pull/8085) * Add payments remind me later note Fix wcpay path * Add changelogs * Update src/Notes/PaymentsRemindMeLater.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Fix possibly_add_note syntax error Update Events.php Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> * Replace flag icon with component and svg background to png (https://github.com/woocommerce/woocommerce-admin/pull/8101) * Activate promo note after WC Pay is activated (https://github.com/woocommerce/woocommerce-admin/pull/8104) * Activate promo after wcpay is a\ctivated * Add changelogs * Add experimental to promo API path and limit the promo names * Use ExPlat to render the WC Pay menu conditionally (https://github.com/woocommerce/woocommerce-admin/pull/8115) * Check ExPlat to render the menu conditionally * Update the experiment name * Fix letter case to follow feature class naming convention * Enable wc-pay-welcome-page feature in core config (https://github.com/woocommerce/woocommerce-admin/pull/8124) * Use wc_calypso_bridge_payments_dismissed option name to respect the previously saved setting from wp.com * Missed wc_calypso_bridge_payments_dismissed rename * Use the existing code to prevent duplication * Fix warning (https://github.com/woocommerce/woocommerce-admin/pull/8141) * Change experiment to come after checks (https://github.com/woocommerce/woocommerce-admin/pull/8142) * Change track path to (https://github.com/woocommerce/woocommerce-admin/pull/8143) Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com> Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com> * Replace deprecated wc-admin-settings package Co-authored-by: Moon <moon.kyong@automattic.com> Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com> Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2022-01-12 06:46:33 +00:00
</div>
);
};
export default ConnectAccountPage;