From f3e52c6081d658b828ed7fed54c58acd68f25676 Mon Sep 17 00:00:00 2001 From: JordanClemons <36278129+JordanClemons@users.noreply.github.com> Date: Thu, 9 May 2024 13:52:04 -0400 Subject: [PATCH 1/2] fix: update API domain (#1087) --- src/utils/sdk.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/sdk.js b/src/utils/sdk.js index 72d576cc4e..d58fd5d099 100644 --- a/src/utils/sdk.js +++ b/src/utils/sdk.js @@ -20,8 +20,7 @@ import { getStorageState as getSDKStorageState, getPayPalDomain as getSDKPayPalDomain, getDisableSetCookie as getSDKDisableCookie, - getPageType as getSDKPageType, - getPayPalAPIDomain as getSDKPayPalAPIDomain + getPageType as getSDKPageType } from '@paypal/sdk-client/src'; import { TAG } from './constants'; @@ -238,8 +237,13 @@ export function getPayPalAPIDomain() { } } + // Not using `getPayPalAPIDomain` function call here because it outputs 'cors.api.paypal.com' + // The domain with prefixed 'cors' does not route to logging application. if (__MESSAGES__.__TARGET__ === 'SDK') { - return getSDKPayPalAPIDomain(); + if (getEnv() === 'sandbox') { + return 'https://api.sandbox.paypal.com'; + } + return 'https://api.paypal.com'; } else { const domain = __MESSAGES__.__API_DOMAIN__[`__${getEnv().toUpperCase()}__`]; From a674430d2faa553c79a791db6dd2e995902aea7c Mon Sep 17 00:00:00 2001 From: surekhaw <71471412+surekhaw@users.noreply.github.com> Date: Thu, 9 May 2024 10:52:24 -0700 Subject: [PATCH 2/2] fix: update xo features conditional to allow for multiple features flags (#1086) --- src/components/modal/v2/parts/BodyContent.jsx | 4 ++-- src/components/modal/v2/parts/Container.jsx | 2 +- src/library/controllers/modal/interface.js | 2 +- src/library/zoid/modal/containerTemplate.jsx | 4 ++-- src/library/zoid/modal/prerenderTemplate.jsx | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/modal/v2/parts/BodyContent.jsx b/src/components/modal/v2/parts/BodyContent.jsx index baccd0a3b8..55402d96a1 100644 --- a/src/components/modal/v2/parts/BodyContent.jsx +++ b/src/components/modal/v2/parts/BodyContent.jsx @@ -62,7 +62,7 @@ const BodyContent = () => { const isQualifying = productMeta?.qualifying; const useV4Design = productMeta?.useV4Design === 'true'; - const useNewCheckoutDesign = features === 'new-checkout-design' ? 'true' : 'false'; + const useNewCheckoutDesign = features?.includes('new-checkout-design') ? 'true' : 'false'; // add v4Design class to root html to update lander specific styles to v4 const documentClassName = document.documentElement.className; @@ -124,7 +124,7 @@ const BodyContent = () => { // specific adjacent DOM structure return ( - {typeof cta !== 'undefined' && features === 'new-checkout-design' ? ( + {typeof cta !== 'undefined' && features?.includes('new-checkout-design') ? ( { } = useXProps(); const [transitionState] = useTransitionState(); const [loading, setLoading] = useState(false); - const useNewCheckoutDesign = features === 'new-checkout-design' ? 'true' : 'false'; + const useNewCheckoutDesign = features?.includes('new-checkout-design') ? 'true' : 'false'; useEffect(() => { if (transitionState === 'CLOSED') { diff --git a/src/library/controllers/modal/interface.js b/src/library/controllers/modal/interface.js index 99b11d89bc..3fdd4f83ff 100644 --- a/src/library/controllers/modal/interface.js +++ b/src/library/controllers/modal/interface.js @@ -75,7 +75,7 @@ const memoizedModal = memoizeOnProps( // eslint-disable-next-line default-param-last const renderModal = (selector = 'body', newProps, options = { intent: 'render' }) => { // TODO: determine a more flexible way to handle iframe vs. popup scenarios for our various entrypoints - const context = getTopWindow() === window || features === 'new-checkout-design' ? 'iframe' : 'popup'; + const context = getTopWindow() === window || features?.includes('new-checkout-design') ? 'iframe' : 'popup'; if (renderProm && context !== 'popup') { return renderProm.then(() => newProps && zoidComponent.updateProps(newProps)); diff --git a/src/library/zoid/modal/containerTemplate.jsx b/src/library/zoid/modal/containerTemplate.jsx index 8afae56ba5..05f2790913 100644 --- a/src/library/zoid/modal/containerTemplate.jsx +++ b/src/library/zoid/modal/containerTemplate.jsx @@ -16,8 +16,8 @@ export default ({ uid, frame, prerenderFrame, doc, event, state, props: { cspNon // cannot overlay across the entire screen if (context === 'popup') return undefined; - const TRANSITION_DELAY = features === 'new-checkout-design' ? 100 : 300; - const transitionPercent = features === 'new-checkout-design' ? 0 : 5; + const TRANSITION_DELAY = features?.includes('new-checkout-design') ? 100 : 300; + const transitionPercent = features?.includes('new-checkout-design') ? 0 : 5; const [hijackViewport, replaceViewport] = viewportHijack(); diff --git a/src/library/zoid/modal/prerenderTemplate.jsx b/src/library/zoid/modal/prerenderTemplate.jsx index e33d3ac1e0..ddf1932032 100644 --- a/src/library/zoid/modal/prerenderTemplate.jsx +++ b/src/library/zoid/modal/prerenderTemplate.jsx @@ -5,7 +5,7 @@ import { ZalgoPromise } from '@krakenjs/zalgo-promise/src'; export default ({ doc, props: { cspNonce, features, onError }, event, state }) => { const ERROR_DELAY = 15000; - const useNewCheckoutDesign = features === 'new-checkout-design' ? 'true' : 'false'; + const useNewCheckoutDesign = features?.includes('new-checkout-design') ? 'true' : 'false'; const styles = ` @font-face { font-family: 'PayPalOpen';