-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add connect.js library and embedded onboarding integration (#9251)
Co-authored-by: oaratovskyi <oleksandr.aratovskyi@automattic.com> Co-authored-by: Oleksandr Aratovskyi <79862886+oaratovskyi@users.noreply.github.com> Co-authored-by: Vlad Olaru <vlad@pixelgrade.com>
- Loading branch information
1 parent
f65efc5
commit 1b17a55
Showing
30 changed files
with
1,489 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Added Embdedded KYC, currently behind feature flag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-disable max-len */ | ||
|
||
/** | ||
* Customised appearance variables for the external KYC flow. | ||
*/ | ||
export default { | ||
variables: { | ||
colorPrimary: '#3C2861', | ||
colorBackground: '#FFFFFF', | ||
buttonPrimaryColorBackground: '#3858E9', | ||
buttonPrimaryColorBorder: '#3858E9', | ||
buttonPrimaryColorText: '#FFFFFF', | ||
buttonSecondaryColorBackground: '#FFFFFF', | ||
buttonSecondaryColorBorder: '#3858E9', | ||
buttonSecondaryColorText: '#3858E9', | ||
colorText: '#101517', | ||
colorSecondaryText: '#50575E', | ||
actionPrimaryColorText: '#3858E9', | ||
actionSecondaryColorText: '#101517', | ||
colorBorder: '#DDDDDD', | ||
formHighlightColorBorder: '#3858E9', | ||
formAccentColor: '#3858E9', | ||
colorDanger: '#CC1818', | ||
offsetBackgroundColor: '#F0F0F0', | ||
formBackgroundColor: '#FFFFFF', | ||
badgeNeutralColorText: '#2C3338', | ||
badgeNeutralColorBackground: '#F6F7F7', | ||
badgeNeutralColorBorder: '#F6F7F7', | ||
badgeSuccessColorText: '#005C12', | ||
badgeSuccessColorBackground: '#EDFAEF', | ||
badgeSuccessColorBorder: '#EDFAEF', | ||
badgeWarningColorText: '#614200', | ||
badgeWarningColorBackground: '#FCF9E8', | ||
badgeWarningColorBorder: '#FCF9E8', | ||
badgeDangerColorText: '#8A2424', | ||
badgeDangerColorBackground: '#FCF0F1', | ||
badgeDangerColorBorder: '#FCF0F1', | ||
borderRadius: '2px', | ||
buttonBorderRadius: '2px', | ||
formBorderRadius: '2px', | ||
badgeBorderRadius: '2px', | ||
overlayBorderRadius: '8px', | ||
spacingUnit: '10px', | ||
fontFamily: | ||
"-apple-system, BlinkMacSystemFont, 'system-ui', 'Segoe UI', 'Helvetica Neue', 'Helvetica', 'Roboto', 'Arial', sans-serif", | ||
fontSizeBase: '16px', | ||
headingXlFontSize: '32px', | ||
headingXlFontWeight: '400', | ||
headingLgFontSize: '24px', | ||
headingLgFontWeight: '400', | ||
headingMdFontSize: '20px', | ||
headingMdFontWeight: '400', | ||
headingSmFontSize: '16px', | ||
headingSmFontWeight: '600', | ||
headingXsFontSize: '12px', | ||
headingXsFontWeight: '600', | ||
bodyMdFontWeight: '400', | ||
bodyMdFontSize: '16px', | ||
bodySmFontSize: '14px', | ||
bodySmFontWeight: '400', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React, { useEffect } from 'react'; | ||
import { closeSmall, Icon } from '@wordpress/icons'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Logo from 'assets/images/woopayments.svg'; | ||
import Page from 'components/page'; | ||
import { OnboardingContextProvider } from 'onboarding/context'; | ||
import EmbeddedKyc from 'onboarding/steps/embedded-kyc'; | ||
import strings from 'onboarding/strings'; | ||
import { getConnectUrl } from 'utils'; | ||
|
||
const OnboardingKycPage: React.FC = () => { | ||
const handleExit = () => { | ||
const urlParams = new URLSearchParams( window.location.search ); | ||
|
||
window.location.href = getConnectUrl( | ||
{ | ||
source: | ||
urlParams.get( 'source' )?.replace( /[^\w-]+/g, '' ) || | ||
'unknown', | ||
}, | ||
'WCPAY_ONBOARDING_KYC' | ||
); | ||
}; | ||
|
||
useEffect( () => { | ||
// Remove loading class and add those required for full screen. | ||
document.body.classList.remove( 'woocommerce-admin-is-loading' ); | ||
document.body.classList.add( 'woocommerce-admin-full-screen' ); | ||
document.body.classList.add( 'is-wp-toolbar-disabled' ); | ||
document.body.classList.add( 'wcpay-onboarding__body' ); | ||
|
||
// Remove full screen classes on unmount. | ||
return () => { | ||
document.body.classList.remove( 'woocommerce-admin-full-screen' ); | ||
document.body.classList.remove( 'is-wp-toolbar-disabled' ); | ||
document.body.classList.remove( 'wcpay-onboarding__body' ); | ||
}; | ||
}, [] ); | ||
return ( | ||
<Page className="wcpay-onboarding-prototype"> | ||
<OnboardingContextProvider> | ||
<div className="stepper__nav"> | ||
<button | ||
type="button" | ||
className={ `stepper__nav-button hide` } | ||
> | ||
{ strings.back } | ||
</button> | ||
<img | ||
src={ Logo } | ||
alt="WooPayments" | ||
className="stepper__nav-logo" | ||
/> | ||
<button | ||
type="button" | ||
className="stepper__nav-button" | ||
onClick={ handleExit } | ||
> | ||
<Icon icon={ closeSmall } /> | ||
</button> | ||
</div> | ||
<div className="stepper__wrapper"> | ||
<div className="stepper__content"> | ||
<EmbeddedKyc continueKyc={ true } /> | ||
</div> | ||
</div> | ||
</OnboardingContextProvider> | ||
</Page> | ||
); | ||
}; | ||
export default OnboardingKycPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.