diff --git a/changelog/add-8242-payment-overview-widget-feature-flag b/changelog/add-8242-payment-overview-widget-feature-flag new file mode 100644 index 00000000000..a580fffcbee --- /dev/null +++ b/changelog/add-8242-payment-overview-widget-feature-flag @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Implement a feature flag for the Payment Overview widget. diff --git a/client/globals.d.ts b/client/globals.d.ts index c948b2aa3b6..601ad52188f 100644 --- a/client/globals.d.ts +++ b/client/globals.d.ts @@ -17,6 +17,7 @@ declare global { isAuthAndCaptureEnabled: boolean; paymentTimeline: boolean; isDisputeIssuerEvidenceEnabled: boolean; + isPaymentOverviewWidgetEnabled?: boolean; }; fraudServices: unknown[]; testMode: boolean; diff --git a/includes/class-wc-payments-features.php b/includes/class-wc-payments-features.php index 57dbad4a32f..b1b474b2cdb 100644 --- a/includes/class-wc-payments-features.php +++ b/includes/class-wc-payments-features.php @@ -24,6 +24,7 @@ class WC_Payments_Features { const PAY_FOR_ORDER_FLOW = '_wcpay_feature_pay_for_order_flow'; const DISPUTE_ISSUER_EVIDENCE = '_wcpay_feature_dispute_issuer_evidence'; const STREAMLINE_REFUNDS_FLAG_NAME = '_wcpay_feature_streamline_refunds'; + const PAYMENT_OVERVIEW_WIDGET_FLAG_NAME = '_wcpay_feature_payment_overview_widget'; /** * Indicates whether card payments are enabled for this (Stripe) account. @@ -256,6 +257,15 @@ public static function is_woopay_first_party_auth_enabled() { return '1' === get_option( self::WOOPAY_FIRST_PARTY_AUTH_FLAG_NAME, '1' ) && self::is_woopay_express_checkout_enabled(); } + /** + * Checks whether Payment Overview Widget is enabled. + * + * @return bool + */ + public static function is_payment_overview_widget_ui_enabled(): bool { + return '1' === get_option( self::PAYMENT_OVERVIEW_WIDGET_FLAG_NAME, '0' ); + } + /** * Checks whether WooPay Direct Checkout is enabled. * @@ -385,6 +395,7 @@ public static function to_array() { 'isPayForOrderFlowEnabled' => self::is_pay_for_order_flow_enabled(), 'isDisputeIssuerEvidenceEnabled' => self::is_dispute_issuer_evidence_enabled(), 'isRefundControlsEnabled' => self::is_streamline_refunds_enabled(), + 'isPaymentOverviewWidgetEnabled' => self::is_payment_overview_widget_ui_enabled(), ] ); }