( app: string, url?: string, pathname?: string, featuresVersion?: string, )
| 116 | }; |
| 117 | |
| 118 | const getBootURL = ( |
| 119 | app: string, |
| 120 | url?: string, |
| 121 | pathname?: string, |
| 122 | featuresVersion?: string, |
| 123 | ) => { |
| 124 | const appRoute = app === 'companion' ? '/companion' : ''; |
| 125 | const params = new URLSearchParams(); |
| 126 | if (process.env.CURRENT_VERSION) { |
| 127 | params.append('v', process.env.CURRENT_VERSION); |
| 128 | } |
| 129 | if (featuresVersion) { |
| 130 | params.append('fv', featuresVersion); |
| 131 | } |
| 132 | if (url) { |
| 133 | params.append('url', url); |
| 134 | } |
| 135 | const referrer = getReferrerType(pathname); |
| 136 | if (referrer) { |
| 137 | params.append('referrer', referrer); |
| 138 | } |
| 139 | // EngagementAdsProvider fetches the creatives once boot lands |
| 140 | params.append('engagement', 'lazy'); |
| 141 | |
| 142 | return `${apiUrl}/boot${appRoute}?${params}`; |
| 143 | }; |
| 144 | |
| 145 | const enrichBootWithFeatures = async (boot: Boot): Promise<Boot> => { |
| 146 | if (!boot.exp?.f || !process.env.NEXT_PUBLIC_EXPERIMENTATION_KEY) { |
no test coverage detected