Skip to content

feature(venmo): add venmoEnableOnNonNativeBrowser experiment #2468

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

Merged
merged 9 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/funding/venmo/config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@ export function getVenmoConfig(): FundingSourceConfig {

eligible: ({ experiment, shippingChange, displayOnly, flow }) => {
/**
* This could probably be removed if the enableVenmo experiment is
* rolled out to 100%.
* enableVenmo checks native browser compatibility and ramp
* ignore above compatibility if forcing to web
*/
if (experiment && experiment.enableVenmo === false) {
if (
experiment &&
experiment.enableVenmo === false &&
experiment.venmoWebEnabled !== true &&
experiment.venmoEnableWebOnNonNativeBrowser !== true
) {
return false;
}

/**
* Shipping callbacks will not work with Venmo unless venmo web is enabled.
*
* Note that this could cause the Venmo button to not show up on first render
* if a merchant passes a shipping callback but does not have a client ID
* that has Venmo Web enabled.
*/
if (!experiment?.venmoWebEnabled && shippingChange) {
return false;
Expand All @@ -62,7 +63,8 @@ export function getVenmoConfig(): FundingSourceConfig {
if (
platform === PLATFORM.MOBILE &&
experiment &&
experiment.venmoWebEnabled === false
experiment.venmoWebEnabled !== true &&
experiment.venmoEnableWebOnNonNativeBrowser !== true
) {
return {
native: true,
Expand Down
5 changes: 3 additions & 2 deletions src/funding/venmo/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe("Venmo eligibility", () => {
fundingEligibility: {},
experiment: {
venmoWebEnabled: true,
venmoEnableWebOnNonNativeBrowser: true,
},
wallet: expect.any,
flow: BUTTON_FLOW.PURCHASE,
Expand Down Expand Up @@ -74,7 +75,7 @@ describe("Venmo eligibility", () => {
expect(isVenmoEligible).toEqual(true);
});

test("should not be eligible if a shipping callback is passed & experiment does not include venmoWebEnabled", () => {
test("should not be eligible if a shipping callback is passed & experiment does not include venmoWebEnabled or venmoEnableWebOnNonNativeBrowser", () => {
const isVenmoEligible = venmoConfig.eligible?.({
...baseEligibilityProps,
experiment: {},
Expand All @@ -84,7 +85,7 @@ describe("Venmo eligibility", () => {
expect(isVenmoEligible).toEqual(false);
});

test("should be eligible if shipping callback exists & experiment includes venmoWebEnabled", () => {
test("should be eligible if shipping callback exists & experiment includes venmoWebEnabled or venmoEnableWebOnNonNativeBrowser", () => {
const isVenmoEligible = venmoConfig.eligible?.({
...baseEligibilityProps,
shippingChange: true,
Expand Down
1 change: 1 addition & 0 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export type Experiment = {|
venmoWebEnabled?: boolean,
// first render experiments
venmoVaultWithoutPurchase?: boolean,
venmoEnableWebOnNonNativeBrowser?: boolean,
|};

export type Requires = {|
Expand Down
6 changes: 6 additions & 0 deletions src/zoid/venmo/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ export function getVenmoCheckoutComponent(): VenmoCheckoutComponent {
required: false,
},

venmoEnableWebOnNonNativeBrowser: {
type: "boolean",
queryParam: true,
required: false,
},

venmoVaultEnabled: {
type: "boolean",
queryParam: true,
Expand Down