-
Notifications
You must be signed in to change notification settings - Fork 21
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
R2: Updated Enhanced Conversion flow #2361
Open
asvinb
wants to merge
14
commits into
feature/2239-enhanced-conversions-panel
Choose a base branch
from
feature/2239-enhanced-conversion-updated
base: feature/2239-enhanced-conversions-panel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5e72c9e
Add minor CR feedback.
asvinb 5033e0d
Review enhanced conversions panel wordings and CTAs.
asvinb 2582e18
Refactor EC pannel settings.
asvinb 0a35f0c
Changes to useTermsPolling hook.
asvinb 891676a
Delete unused useGoogleAdsEnhancedConversionTermsURL.js.
asvinb ec33c2a
Simplify useGoogleAdsEnhancedConversionSettingsURL.js hook.
asvinb 6a95b1f
Removed unused imports.
asvinb 95cc03e
Remove copy to minimize modal height.
asvinb 489a3f4
Address CR feedback.
asvinb 9141797
Address CR feedback.
asvinb 5f4648f
Remove unused import.
asvinb e9dcd38
Add Success screen.
asvinb 1671f7c
Fix failing tests.
asvinb 62b19a2
Address CR feedback.
asvinb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
js/src/components/enhanced-conversion-tracking-settings/confirm-button.js
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,21 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { noop } from 'lodash'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
|
||
import AppButton from '.~/components/app-button'; | ||
|
||
const ConfirmButton = ( { onConfirm = noop } ) => { | ||
return ( | ||
<AppButton isPrimary onClick={ onConfirm }> | ||
{ __( 'Confirm', 'google-listings-and-ads' ) } | ||
</AppButton> | ||
); | ||
}; | ||
|
||
export default ConfirmButton; |
60 changes: 60 additions & 0 deletions
60
js/src/components/enhanced-conversion-tracking-settings/cta.js
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,60 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { noop } from 'lodash'; | ||
import { useEffect, useCallback } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { useAppDispatch } from '.~/data'; | ||
import { ENHANCED_ADS_CONVERSION_STATUS } from '.~/constants'; | ||
import AppButton from '.~/components/app-button'; | ||
import EnableButton from './enable-button'; | ||
import ConfirmButton from './confirm-button'; | ||
import useAutoCheckEnhancedConversionTOS from '.~/hooks/useAutoCheckEnhancedConversionTOS'; | ||
|
||
const CTA = ( { onConfirm = noop } ) => { | ||
const { updateEnhancedAdsConversionStatus } = useAppDispatch(); | ||
const { | ||
acceptedCustomerDataTerms, | ||
hasFinishedResolution, | ||
isPolling, | ||
setIsPolling, | ||
} = useAutoCheckEnhancedConversionTOS(); | ||
|
||
const handleConfirm = useCallback( () => { | ||
updateEnhancedAdsConversionStatus( | ||
ENHANCED_ADS_CONVERSION_STATUS.ENABLED | ||
); | ||
|
||
onConfirm(); | ||
}, [ onConfirm, updateEnhancedAdsConversionStatus ] ); | ||
|
||
useEffect( () => { | ||
// As soon as the terms are accepted, do not show the spinner | ||
if ( acceptedCustomerDataTerms && isPolling ) { | ||
setIsPolling( false ); | ||
} | ||
}, [ acceptedCustomerDataTerms, setIsPolling, isPolling, handleConfirm ] ); | ||
|
||
const handleOnEnable = () => { | ||
setIsPolling( true ); | ||
}; | ||
|
||
if ( ! hasFinishedResolution ) { | ||
return null; | ||
} | ||
|
||
if ( isPolling ) { | ||
return <AppButton isSecondary disabled loading />; | ||
} | ||
|
||
if ( ! acceptedCustomerDataTerms ) { | ||
return <EnableButton onEnable={ handleOnEnable } />; | ||
} | ||
|
||
return <ConfirmButton onConfirm={ handleConfirm } />; | ||
}; | ||
|
||
export default CTA; |
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
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
32 changes: 0 additions & 32 deletions
32
js/src/product-feed/submission-success-guide/enhanced-conversions/confirm-button.js
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
js/src/product-feed/submission-success-guide/enhanced-conversions/cta.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
✨ perfect icon choice