Skip to content

Commit 1c373fe

Browse files
authored
Merge pull request #15021 from guardian/ash/google-one-tap-in-NZ
feat: Launch Google One Tap to New Zealand
2 parents b8c885a + 067b99c commit 1c373fe

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

dotcom-rendering/src/components/GoogleOneTap.importable.tsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { CountryCode } from '@guardian/libs';
22
import { isObject, log } from '@guardian/libs';
3-
import type { TAction, TComponentType } from '@guardian/ophan-tracker-js';
43
import { submitComponentEvent } from '../client/ophan/ophan';
54
import type { Result } from '../lib/result';
65
import { error, ok } from '../lib/result';
@@ -122,6 +121,8 @@ const getProviders = (stage: StageType): IdentityProviderConfig[] => {
122121
}
123122
};
124123

124+
const ENABLED_COUNTRIES: CountryCode[] = ['IE', 'NZ'];
125+
125126
export const initializeFedCM = async ({
126127
isSignedIn,
127128
countryCode,
@@ -138,23 +139,17 @@ export const initializeFedCM = async ({
138139

139140
void submitComponentEvent(
140141
{
141-
// TODO: @guardian/[email protected] has some changes to how page views are tracked
142-
// unrelated to Google One Tap which isn't safe to be released yet. Upgrade this once
143-
// v2.4.1 is safe to use.
144-
action: 'DETECT' as TAction,
142+
action: 'DETECT',
145143
component: {
146-
// TODO: @guardian/[email protected] has some changes to how page views are tracked
147-
// unrelated to Google One Tap which isn't safe to be released yet. Upgrade this once
148-
// v2.4.1 is safe to use.
149-
componentType: 'SIGN_IN_GOOGLE_ONE_TAP' as TComponentType,
144+
componentType: 'SIGN_IN_GOOGLE_ONE_TAP',
150145
},
151146
value: isSupported ? 'SUPPORTED' : 'NOT_SUPPORTED',
152147
},
153148
'Web',
154149
);
155150

156151
// TODO: Expand Google One Tap to outside Ireland
157-
if (countryCode !== 'IE') return;
152+
if (!countryCode || !ENABLED_COUNTRIES.includes(countryCode)) return;
158153
if (isSignedIn) return;
159154

160155
/**
@@ -232,10 +227,7 @@ export const initializeFedCM = async ({
232227
{
233228
action: 'SIGN_IN',
234229
component: {
235-
// TODO: @guardian/[email protected] has some changes to how page views are tracked
236-
// unrelated to Google One Tap which isn't safe to be released yet. Upgrade this once
237-
// v2.4.1 is safe to use.
238-
componentType: 'SIGN_IN_GOOGLE_ONE_TAP' as TComponentType,
230+
componentType: 'SIGN_IN_GOOGLE_ONE_TAP',
239231
},
240232
},
241233
'Web',
@@ -253,10 +245,7 @@ export const initializeFedCM = async ({
253245
{
254246
action: 'CLOSE',
255247
component: {
256-
// TODO: @guardian/[email protected] has some changes to how page views are tracked
257-
// unrelated to Google One Tap which isn't safe to be released yet. Upgrade this once
258-
// v2.4.1 is safe to use.
259-
componentType: 'SIGN_IN_GOOGLE_ONE_TAP' as TComponentType,
248+
componentType: 'SIGN_IN_GOOGLE_ONE_TAP',
260249
},
261250
},
262251
'Web',

0 commit comments

Comments
 (0)