deadline ??= microtime(true) + (int) config('trypost.meta_page_walk_seconds'); } /** Meta's app review wants to see this called; the answer is unused, so nothing it does can fail the connect. */ protected function touchProfile(string $userToken): void { rescue(fn () => Http::timeout(5)->connectTimeout(5)->get("{$this->graphApi()}/me", [ 'fields' => 'id,name', 'access_token' => $userToken, ]), report: false); } /** * The scopes this login did not refuse, or the popup refusing the connect because * one the platform needs to publish is among them. * * @return array|InertiaResponse */ protected function grantedScopes(string $userToken): array|InertiaResponse { $granted = GrantedPermissions::for($this->graphApi(), $userToken, $this->scopes); return array_diff($this->platform->requiredPublishScopes(), $granted) === [] ? $granted : $this->popupCallback(false, __('accounts.popup_callback.publish_permission_refused'), $this->platform->value); } /** * A walk that could not finish outranks the other answers, since neither would be * true of what it did not read. * * @param array> $listed */ protected function noPagesOnOffer(ManagedPageList $walk, array $listed): InertiaResponse { return $this->popupCallback(false, __(match (true) { ! $walk->complete => 'accounts.popup_callback.pages_read_incomplete', empty($listed) => $this->noPagesKey, default => 'accounts.popup_callback.pages_missing_permission', }), $this->platform->value); } }