-
Notifications
You must be signed in to change notification settings - Fork 32
Add Authorization header to Reader Revenue /header request #15462
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
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d792eb9
feat: add identity headers to support banner requests when user is si…
757303d
Merge branch 'main' into jm/feat-mparticle-headers
juabara 7c3ea21
feat: use getAuthHeaders for support banner requests to include ident…
0d25675
Merge branch 'jm/feat-mparticle-headers' of github.com:guardian/dotco…
f92b557
Merge branch 'main' into jm/feat-mparticle-headers
juabara ae51860
Merge branch 'main' into jm/feat-mparticle-headers
juabara 1c45443
Merge branch 'main' into jm/feat-mparticle-headers
juabara 032f324
feat: mock contributions API in storybook to prevent hanging on conse…
a0a25b5
chore: remove commented-out alias assignment in Storybook config
d19eeee
Merge branch 'main' of github.com:guardian/dotcom-rendering into jm/f…
5dda22e
fix: webpack server build failing due broken parse5 source maps insid…
42c7887
refactor: update TopBarSupport to use `useAuthStatus`, add a timeout …
08cbf93
chore: fix empty line lint rule
854d94b
chore: better naming header variables
07a6f71
Merge branch 'main' into jm/feat-mparticle-headers
juabara 2c89d8e
fix: missing headers in DecideLayout, Gallery and Sport Data storybooks
8832f4d
Merge branch 'main' into jm/feat-mparticle-headers
juabara 4d11607
feat: use `useIsSignedIn` hook to determine user sign-in status.
c0a20e5
Merge branch 'main' into jm/feat-mparticle-headers
juabara aab700a
Merge branch 'main' into jm/feat-mparticle-headers
juabara f0befca
Merge branch 'main' into jm/feat-mparticle-headers
juabara 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| import { css } from '@emotion/react'; | ||
| import { getCookie, isUndefined } from '@guardian/libs'; | ||
| import type { ComponentEvent } from '@guardian/ophan-tracker-js'; | ||
| import { getHeader } from '@guardian/support-dotcom-components'; | ||
| import type { | ||
| HeaderPayload, | ||
| ModuleData, | ||
|
|
@@ -21,8 +20,10 @@ import { | |
| getPurchaseInfo, | ||
| shouldHideSupportMessaging, | ||
| } from '../lib/contributions'; | ||
| import { getOptionsHeaders } from '../lib/identity'; | ||
| import { getHeader } from '../lib/sdcRequests'; | ||
| import { useBetaAB } from '../lib/useAB'; | ||
| import { useIsSignedIn } from '../lib/useAuthStatus'; | ||
| import { useAuthStatus } from '../lib/useAuthStatus'; | ||
| import { useCountryCode } from '../lib/useCountryCode'; | ||
| import { usePageViewId } from '../lib/usePageViewId'; | ||
| import { useConfig } from './ConfigContext'; | ||
|
|
@@ -56,7 +57,11 @@ const ReaderRevenueLinksRemote = ({ | |
| useState<ModuleData<HeaderProps> | null>(null); | ||
| const [SupportHeader, setSupportHeader] = | ||
| useState<React.ElementType<HeaderProps> | null>(null); | ||
| const isSignedIn = useIsSignedIn(); | ||
| const authStatus = useAuthStatus(); | ||
| const isSignedIn = | ||
| authStatus.kind === 'Pending' | ||
| ? 'Pending' | ||
| : authStatus.kind === 'SignedIn'; | ||
|
|
||
| const { renderingTarget } = useConfig(); | ||
| const abTests = useBetaAB(); | ||
|
|
@@ -90,7 +95,12 @@ const ReaderRevenueLinksRemote = ({ | |
| }, | ||
| }; | ||
|
|
||
| getHeader(contributionsServiceUrl, requestData) | ||
| const headers = | ||
| authStatus.kind === 'SignedIn' | ||
| ? getOptionsHeaders(authStatus).headers | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should use getAuthHeaders, which also checks consent. |
||
| : undefined; | ||
|
|
||
| getHeader(contributionsServiceUrl, requestData, headers) | ||
| .then((response: ModuleDataResponse<HeaderProps>) => { | ||
| if (!response.data) { | ||
| return null; | ||
|
|
@@ -131,6 +141,7 @@ const ReaderRevenueLinksRemote = ({ | |
| pageViewId, | ||
| pageUrl, | ||
| abTests, | ||
| authStatus, | ||
| ]); | ||
|
|
||
| if (SupportHeader !== null && supportHeaderResponse) { | ||
|
|
||
This file contains hidden or 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.
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.
this seems to duplicate what
useIsSignedIndoes