-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NCPS v2 πΎ #2389
NCPS v2 πΎ #2389
Conversation
β¦ing standalone button
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a couple of helpful notes as you review this PR π β¬οΈ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty good so far π
@@ -63,30 +68,25 @@ export const getHostedButtonsComponent = (): HostedButtonsComponent => { | |||
style, | |||
}; | |||
|
|||
if (shouldRenderSDKButtons(fundingSources)) { | |||
if (version === "2") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we anticipate additional major API versions frequently needing to maintain backwards compatibility like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from what we've been told, this is an evergreen experience so any major changes would be a change in the sdk itself.
This version check is more like a feature-flag so we don't break the current experience while we work on the new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! I think once v2 is completely rolled out, we can remove this check and all the v1 handling. I should totally add a comment for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good! my concern was maintaining this version-based model of backwards compatibility with future versions, but doesn't sound like an issue here π
@@ -602,4 +588,234 @@ test("getElementFromSelector", () => { | |||
expect(mockQuerySelector).toHaveBeenCalledWith(containerId); | |||
}); | |||
|
|||
describe("getButtonPreferences", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Description
Note
Very sorry this PR became a bit larger than originally expected. I'll try to leave some comments around to point out some of the main parts.
.setAttribute()
as it violates some CSP's.function name() {}
and sometimes we were usingconst name = () => {}
... TBH, I'd rather usefunction
, but it seems like we useconst
more, so I went with that. Would love some opinions here πWhy are we making these changes? Include references to any related Jira tasks or GitHub Issues
JIRA: DTPPCPSDK-2228 & DTPPCPSDK-2229
Reproduction Steps (if applicable)
Setup
Creating a local no-code integration
Screenshots (if applicable)
Important
The styles are a bit off in these screenshots since the NCP team has not included finalized styles in their API response. So ignore the lack of margin between our buttons & their "checkout" button. π
Click through to see the different cases:
Prefers only PayPal button
Prefers PayPal & Venmo, both are eligible.
Prefers PayPal & PayLater, both are eligible.
Prefers PayPal & Venmo, Venmo not eligible. (Shows only PayPal)
Prefers PayPal & default second button.
Prefers PayPal & default second button, but all second buttons fail
Buttons().isEligible()
check. (Shows only PayPal)Horizontal layout example (S/O @nikrom17 )
β€οΈ Thank you!