|
1 | 1 | import { log } from '@guardian/libs'; |
2 | 2 | import { useEffect, useState } from 'react'; |
3 | | -import { |
4 | | - getListenToArticleClient, |
5 | | - getNativeABTestingClient, |
6 | | -} from '../lib/bridgetApi'; |
| 3 | +import { getListenToArticleClient } from '../lib/bridgetApi'; |
7 | 4 | import { useIsBridgetCompatible } from '../lib/useIsBridgetCompatible'; |
8 | 5 | import { ListenToArticleButton } from './ListenToArticleButton'; |
9 | 6 |
|
@@ -37,39 +34,19 @@ export const ListenToArticle = ({ articleId }: Props) => { |
37 | 34 | useEffect(() => { |
38 | 35 | if (isBridgetCompatible) { |
39 | 36 | Promise.all([ |
40 | | - // AB TESTING native |
41 | | - getNativeABTestingClient().getParticipations(), |
42 | 37 | getListenToArticleClient().isAvailable(articleId), |
43 | 38 | getListenToArticleClient().isPlaying(articleId), |
44 | 39 | getListenToArticleClient().getAudioDurationSeconds(articleId), |
45 | 40 | ]) |
46 | | - .then( |
47 | | - ([ |
48 | | - abParticipations, |
49 | | - isAvailable, |
50 | | - isPlaying, |
51 | | - durationSeconds, |
52 | | - ]) => { |
53 | | - // AB TESTING native start |
54 | | - const variant = abParticipations.get( |
55 | | - 'l2a_article_button_test', |
56 | | - ); |
57 | | - if (variant === 'no-button') { |
58 | | - setShowButton(false); |
59 | | - } else if (variant === 'with-duration') { |
60 | | - setAudioDurationSeconds( |
61 | | - typeof durationSeconds === 'number' && |
62 | | - durationSeconds > 0 |
63 | | - ? durationSeconds |
64 | | - : undefined, |
65 | | - ); |
66 | | - setShowButton(isAvailable && !isPlaying); |
67 | | - } else if (variant === 'without-duration') { |
68 | | - setShowButton(isAvailable && !isPlaying); |
69 | | - } |
70 | | - // AB TESTING native ends |
71 | | - }, |
72 | | - ) |
| 41 | + .then(([isAvailable, isPlaying, durationSeconds]) => { |
| 42 | + setAudioDurationSeconds( |
| 43 | + typeof durationSeconds === 'number' && |
| 44 | + durationSeconds > 0 |
| 45 | + ? durationSeconds |
| 46 | + : undefined, |
| 47 | + ); |
| 48 | + setShowButton(isAvailable && !isPlaying); |
| 49 | + }) |
73 | 50 | .catch((error) => { |
74 | 51 | console.error( |
75 | 52 | 'Error fetching article audio status: ', |
|
0 commit comments