Skip to content

Commit

Permalink
Try adding WooCommerce share key to Stripe onboarding (#8851)
Browse files Browse the repository at this point in the history
Co-authored-by: Oleksandr Aratovskyi <79862886+oaratovskyi@users.noreply.github.com>
  • Loading branch information
psealock and oaratovskyi committed May 24, 2024
1 parent 97a7fee commit 05b4cc1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog/try-add-woo-share-key-stripe
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: add

Add share key query param when sending data to Stripe KYC
5 changes: 5 additions & 0 deletions client/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ declare global {
woocommerce_default_country: string;
};
};
siteVisibilitySettings: {
woocommerce_share_key: string;
woocommerce_coming_soon: string;
woocommerce_private_link: string;
};
};
adminUrl: string;
countries: Record< string, string >;
Expand Down
16 changes: 15 additions & 1 deletion client/onboarding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,27 @@ const OnboardingStepper = () => {
);
};

const getComingSoonShareKey = () => {
const {
woocommerce_share_key: shareKey,
woocommerce_coming_soon: comingSoon,
woocommerce_private_link: privateLink,
} = wcSettings?.admin?.siteVisibilitySettings || {};

if ( comingSoon !== 'yes' || privateLink === 'no' ) {
return '';
}

return shareKey ? '?woo-share=' + shareKey : '';
};

const initialData = {
business_name: wcSettings?.siteTitle,
mcc: getMccFromIndustry(),
url:
location.hostname === 'localhost'
? 'https://wcpay.test'
: wcSettings?.homeUrl,
: wcSettings?.homeUrl + getComingSoonShareKey(),
country: wcpaySettings?.connect?.country,
};

Expand Down

0 comments on commit 05b4cc1

Please sign in to comment.