Skip to content

Commit b76ebd3

Browse files
authored
Renaming SPE references to OC (Optimized Checkout) (#4284)
* Smart Checkout design updates * Fix tests * Readme and changelog entries * Renaming SPE references to OC * Replacing references in tests * Replacing references on the frontend * Changelog and readme entries * Deprecating feature flag methods instead of removing them
1 parent ae35fb2 commit b76ebd3

36 files changed

+228
-160
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Changelog ***
22

33
= 9.5.0 - xxxx-xx-xx =
4+
* Dev - Renames all references to "Smart Checkout" and "Single Payment Element" (and "SPE") to "Optimized Checkout" (and "OC"), following the feature rebranding.
45
* Tweak - Updates the "Smart Checkout" setting name to "Optimized Checkout", and the description accordingly.
56
* Fix - Checks for the existence of the WC_Stripe_Feature_Flags class before including it during extension initialization.
67
* Dev - Implements the new Stripe order class into the new checkout experience files.

client/blocks/upe/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const methodsToFilter = [
4545
];
4646

4747
// Register UPE Elements.
48-
if ( getBlocksConfiguration()?.isSPEEnabled ) {
48+
if ( getBlocksConfiguration()?.isOCEnabled ) {
4949
registerPaymentMethod(
5050
upeElement( PAYMENT_METHOD_CARD, api, paymentMethodsConfig.card )
5151
);

client/blocks/upe/upe-deferred-intent-creation/payment-elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const PaymentElements = ( {
135135
},
136136
};
137137

138-
if ( getBlocksConfiguration()?.isSPEEnabled ) {
138+
if ( getBlocksConfiguration()?.isOCEnabled ) {
139139
options = {
140140
...options,
141141
...{

client/blocks/upe/upe-deferred-intent-creation/payment-processor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import {
2626
PAYMENT_METHOD_BLIK,
2727
PAYMENT_METHOD_CASHAPP,
2828
} from 'wcstripe/stripe-utils/constants';
29-
import { handleDisplayOfPaymentInstructions } from 'wcstripe/smart-checkout/handle-display-of-payment-instructions';
30-
import { applyStyles } from 'wcstripe/smart-checkout/apply-styles';
31-
import { handleDisplayOfSavingCheckbox } from 'wcstripe/smart-checkout/handle-display-of-saving-checkbox';
29+
import { handleDisplayOfPaymentInstructions } from 'wcstripe/optimized-checkout/handle-display-of-payment-instructions';
30+
import { applyStyles } from 'wcstripe/optimized-checkout/apply-styles';
31+
import { handleDisplayOfSavingCheckbox } from 'wcstripe/optimized-checkout/handle-display-of-saving-checkbox';
3232

3333
const noop = () => null;
3434

@@ -82,7 +82,7 @@ const getStripeElementOptions = () => {
8282
}
8383
}
8484

85-
if ( getBlocksConfiguration()?.isSPEEnabled ) {
85+
if ( getBlocksConfiguration()?.isOCEnabled ) {
8686
options = {
8787
...options,
8888
layout: {
@@ -334,7 +334,7 @@ const PaymentProcessor = ( {
334334
removeCashAppLimitNotice();
335335
}
336336
// Apply single payment element styles if the selected payment method is card and SPE is enabled.
337-
if ( getBlocksConfiguration()?.isSPEEnabled ) {
337+
if ( getBlocksConfiguration()?.isOCEnabled ) {
338338
applyStyles();
339339
}
340340
}, [ selectedPaymentMethodType ] );
@@ -359,7 +359,7 @@ const PaymentProcessor = ( {
359359
const onSelectedPaymentMethodChange = ( { value, complete } ) => {
360360
setSelectedPaymentMethodType( value.type );
361361
setIsPaymentElementComplete( complete );
362-
if ( getBlocksConfiguration()?.isSPEEnabled ) {
362+
if ( getBlocksConfiguration()?.isOCEnabled ) {
363363
handleDisplayOfPaymentInstructions( value.type );
364364
handleDisplayOfSavingCheckbox( value.type );
365365
}

client/blocks/upe/upe-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const upeElement = ( paymentMethod, api, upeConfig ) => {
101101
* @return {JSX.Element|null} The icon element.
102102
*/
103103
const getUpeElementIcon = ( paymentMethod ) => {
104-
if ( getBlocksConfiguration()?.isSPEEnabled ) {
104+
if ( getBlocksConfiguration()?.isOCEnabled ) {
105105
return null;
106106
}
107107

client/classic/upe/payment-processing.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import {
2626
PAYMENT_METHOD_MULTIBANCO,
2727
PAYMENT_METHOD_WECHAT_PAY,
2828
} from 'wcstripe/stripe-utils/constants';
29-
import { handleDisplayOfPaymentInstructions } from 'wcstripe/smart-checkout/handle-display-of-payment-instructions';
30-
import { handleDisplayOfSavingCheckbox } from 'wcstripe/smart-checkout/handle-display-of-saving-checkbox';
29+
import { handleDisplayOfPaymentInstructions } from 'wcstripe/optimized-checkout/handle-display-of-payment-instructions';
30+
import { handleDisplayOfSavingCheckbox } from 'wcstripe/optimized-checkout/handle-display-of-saving-checkbox';
3131

3232
const gatewayUPEComponents = {};
3333
const paymentMethodsConfig = getStripeServerData()?.paymentMethodsConfig;
@@ -143,7 +143,7 @@ async function createStripePaymentElement( api, paymentMethodType ) {
143143
amount,
144144
};
145145

146-
if ( getStripeServerData()?.isSPEEnabled ) {
146+
if ( getStripeServerData()?.isOCEnabled ) {
147147
options = {
148148
...options,
149149
paymentMethodConfiguration: getStripeServerData()
@@ -176,8 +176,8 @@ async function createStripePaymentElement( api, paymentMethodType ) {
176176
},
177177
};
178178

179-
// Set the layout to accordion if SPE is enabled.
180-
if ( getStripeServerData()?.isSPEEnabled ) {
179+
// Set the layout to accordion if OC is enabled.
180+
if ( getStripeServerData()?.isOCEnabled ) {
181181
paymentElementOptions = {
182182
...paymentElementOptions,
183183
layout: {
@@ -343,9 +343,9 @@ export async function mountStripePaymentElement( api, domElement ) {
343343
// Setting the flag to true to prevent the form from being submitted.
344344
gatewayUPEComponents[ paymentMethodType ].hasLoadError = true;
345345
} );
346-
if ( getStripeServerData()?.isSPEEnabled ) {
346+
if ( getStripeServerData()?.isOCEnabled ) {
347347
upeElement.on( 'change', ( { value } ) => {
348-
// If the SPE is enabled, we need to handle the display of the saving checkbox.
348+
// If the OC is enabled, we need to handle the display of the saving checkbox.
349349
handleDisplayOfPaymentInstructions( value.type );
350350

351351
// Bind the create account checkbox to the save card info container display function.

client/data/settings/__tests__/hooks.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
useAmazonPayLocations,
2323
useAmazonPayButtonSize,
2424
useSepaTokensForOtherMethods,
25-
useIsSPEEnabled,
25+
useIsOCEnabled,
2626
} from '../hooks';
2727
import { STORE_NAME } from '../../constants';
2828
import {
@@ -335,9 +335,9 @@ describe( 'Settings hooks tests', () => {
335335
testedValue: [ 'checkout', 'cart' ],
336336
fallbackValue: [],
337337
},
338-
useIsSPEEnabledSettings: {
339-
hook: useIsSPEEnabled,
340-
storeKey: 'is_spe_enabled',
338+
useIsOCEnabledSettings: {
339+
hook: useIsOCEnabled,
340+
storeKey: 'is_oc_enabled',
341341
testedValue: true,
342342
fallbackValue: false,
343343
},

client/data/settings/hooks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ export const useIsShortAccountStatementEnabled = makeSettingsHook(
206206
);
207207
export const useDebugLog = makeSettingsHook( 'is_debug_log_enabled' );
208208
export const useIsUpeEnabled = makeSettingsHook( 'is_upe_enabled' );
209-
export const useIsSPEEnabled = makeSettingsHook( 'is_spe_enabled' );
210-
export const useSPETitle = makeSettingsHook( 'spe_title', 'Stripe' );
209+
export const useIsOCEnabled = makeSettingsHook( 'is_oc_enabled' );
210+
export const useOCTitle = makeSettingsHook( 'oc_title', 'Stripe' );
211211

212212
export const useIndividualPaymentMethodSettings = makeSettingsHook(
213213
'individual_payment_method_settings',

client/smart-checkout/__tests__/apply-styles.test.js renamed to client/optimized-checkout/__tests__/apply-styles.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { applyStyles } from 'wcstripe/smart-checkout/apply-styles';
1+
import { applyStyles } from 'wcstripe/optimized-checkout/apply-styles';
22

33
describe( 'applyStyles', () => {
44
it( 'Correctly apply the required styles to HTML elements', () => {
@@ -24,14 +24,14 @@ describe( 'applyStyles', () => {
2424
'radio-control-wc-payment-method-options-stripe__content'
2525
);
2626
expect(
27-
stripeContent.classList.contains( 'single-payment-element' )
27+
stripeContent.classList.contains( 'optimized-checkout-element' )
2828
).toBe( true );
2929

3030
const stripeLabel = document.getElementById(
3131
'radio-control-wc-payment-method-options-stripe__label'
3232
);
3333
expect(
34-
stripeLabel.classList.contains( 'single-payment-element' )
34+
stripeLabel.classList.contains( 'optimized-checkout-element' )
3535
).toBe( true );
3636

3737
const stripeIframe = document.querySelector(

client/smart-checkout/__tests__/handle-display-of-payment-instructions.test.js renamed to client/optimized-checkout/__tests__/handle-display-of-payment-instructions.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { handleDisplayOfPaymentInstructions } from 'wcstripe/smart-checkout/handle-display-of-payment-instructions';
1+
import { handleDisplayOfPaymentInstructions } from 'wcstripe/optimized-checkout/handle-display-of-payment-instructions';
22

33
describe( 'handleDisplayOfPaymentInstructions', () => {
44
document.body.innerHTML = `

0 commit comments

Comments
 (0)