(t0)
| 142 | return t6; |
| 143 | } |
| 144 | export function GroveDialog(t0) { |
| 145 | const $ = _c(34); |
| 146 | const { |
| 147 | showIfAlreadyViewed, |
| 148 | location, |
| 149 | onDone |
| 150 | } = t0; |
| 151 | const [shouldShowDialog, setShouldShowDialog] = useState(null); |
| 152 | const [groveConfig, setGroveConfig] = useState(null); |
| 153 | let t1; |
| 154 | let t2; |
| 155 | if ($[0] !== location || $[1] !== onDone || $[2] !== showIfAlreadyViewed) { |
| 156 | t1 = () => { |
| 157 | const checkGroveSettings = async function checkGroveSettings() { |
| 158 | const [settingsResult, configResult] = await Promise.all([getGroveSettings(), getGroveNoticeConfig()]); |
| 159 | const config = configResult.success ? configResult.data : null; |
| 160 | setGroveConfig(config); |
| 161 | const shouldShow = calculateShouldShowGrove(settingsResult, configResult, showIfAlreadyViewed); |
| 162 | setShouldShowDialog(shouldShow); |
| 163 | if (!shouldShow) { |
| 164 | onDone("skip_rendering"); |
| 165 | return; |
| 166 | } |
| 167 | markGroveNoticeViewed(); |
| 168 | logEvent("tengu_grove_policy_viewed", { |
| 169 | location: location as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 170 | dismissable: config?.notice_is_grace_period as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 171 | }); |
| 172 | }; |
| 173 | checkGroveSettings(); |
| 174 | }; |
| 175 | t2 = [showIfAlreadyViewed, location, onDone]; |
| 176 | $[0] = location; |
| 177 | $[1] = onDone; |
| 178 | $[2] = showIfAlreadyViewed; |
| 179 | $[3] = t1; |
| 180 | $[4] = t2; |
| 181 | } else { |
| 182 | t1 = $[3]; |
| 183 | t2 = $[4]; |
| 184 | } |
| 185 | useEffect(t1, t2); |
| 186 | if (shouldShowDialog === null) { |
| 187 | return null; |
| 188 | } |
| 189 | if (!shouldShowDialog) { |
| 190 | return null; |
| 191 | } |
| 192 | let t3; |
| 193 | if ($[5] !== groveConfig?.notice_is_grace_period || $[6] !== onDone) { |
| 194 | t3 = async function onChange(value) { |
| 195 | bb21: switch (value) { |
| 196 | case "accept_opt_in": |
| 197 | { |
| 198 | await updateGroveSettings(true); |
| 199 | logEvent("tengu_grove_policy_submitted", { |
| 200 | state: true, |
| 201 | dismissable: groveConfig?.notice_is_grace_period as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
nothing calls this directly
no test coverage detected