@php /** @var \Illuminate\Support\Collection $accounts */ /** @var bool $configured */ $tiktokGlyph = ''; @endphp
{{-- ===== Header ===== --}}
{{ __('Channel') }} · {{ __('TikTok') }}

{{ __('TikTok') }} {{ __('accounts') }}

{{ __('Connect a TikTok account to see its profile and, soon, publish content and read insights straight from :brand.', ['brand' => brand_name()]) }}

@if ($configured && $accounts->isNotEmpty()) {{ __('Insights') }} @endif @if ($configured) {!! $tiktokGlyph !!} {{ __('Connect TikTok') }} @endif
{{-- ===== Flash + errors ===== --}} @if (session('status'))
{{ session('status') }}
@endif @if ($errors->any())
    @foreach ($errors->all() as $e)
  • {{ $e }}
  • @endforeach
@endif @if (! $configured) {{-- Not configured by the platform admin yet --}}
{!! $tiktokGlyph !!}
{{ __('TikTok is not enabled yet') }}

{{ __('The platform admin needs to add the TikTok app credentials under Settings → :brand Message before accounts can be connected.', ['brand' => brand_name()]) }}

@elseif ($accounts->isEmpty()) {{-- Empty state --}}
{!! $tiktokGlyph !!}
{{ __('No TikTok account connected yet') }}

{{ __('Connect a TikTok Business account to manage it here. You will be redirected to TikTok to authorize :brand.', ['brand' => brand_name()]) }}

{!! $tiktokGlyph !!} {{ __('Connect TikTok') }}
@else {{-- Connected accounts --}}
@foreach ($accounts as $a) @php $live = $a->isLive(); $handle = $a->username ? '@' . ltrim($a->username, '@') : $a->open_id; @endphp
@if ($a->avatar_url) @else {{ strtoupper(mb_substr($a->display_name ?: 'T', 0, 1)) }} @endif
{{ $a->display_name ?: $handle }} @if ($a->is_verified) @endif
{{ $handle }}
@if ($live) {{ __('Connected') }} @else {{ __('Reconnect') }} @endif
{{-- Stats --}}
{{ $a->follower_count !== null ? number_format($a->follower_count) : '—' }}
{{ __('followers') }}
{{ $a->likes_count !== null ? number_format($a->likes_count) : '—' }}
{{ __('likes') }}
{{ $a->video_count !== null ? number_format($a->video_count) : '—' }}
{{ __('videos') }}
@if ($a->last_error && ! $live)
{{ $a->last_error }}
@endif {{-- Actions --}}
@unless ($live) {{ __('Reconnect') }} @else {{ __('Token OK') }}{{ $a->token_expires_at ? ' · ' . $a->token_expires_at->diffForHumans() : '' }} @endunless
@csrf
@csrf @method('DELETE')
{{-- DM inbox (Business Messaging) — shown only when the admin has configured the TikTok business app. Partner-gated. --}} @if (\App\Services\Tiktok\TiktokBusinessClient::enabled()) @php $biz = is_array($a->meta_json) ? (array) data_get($a->meta_json, 'business', []) : []; $bizOn = ! empty($biz['access_token'] ?? null); @endphp
{{ __('DM inbox') }} @if ($bizOn) {{ __('Connected') }}{{ ! empty($biz['region']) ? ' · ' . e($biz['region']) : '' }} @endif
@if ($bizOn)

{{ __('Incoming DMs route to the Team Inbox. Register this webhook URL on your TikTok app in the developer portal (subscribe new_message / new_conversation):') }}

{{ url('/webhooks/tiktok/business') }}
@csrf @method('DELETE')
@else

{{ __('Requires TikTok Messaging-Partner approval. Once approved, paste the business ID + access token from your partner authorization to route DMs into the Team Inbox.') }}

@csrf
@endif
@endif
@endforeach
{{-- ===== Feature availability & requirements ===== --}}
{{ __('What works, and what it needs') }}
@php $rows = [ ['t' => __('Connect account'), 'ok' => true, 'r' => __('Works everywhere. Needs the TikTok Login Kit app (admin-configured).')], ['t' => __('Profile & video insights'), 'ok' => true, 'r' => __('Works everywhere. Needs the user.info + video.list scopes approved on your TikTok app.')], ['t' => __('Posting to TikTok inbox'), 'ok' => true, 'r' => __('Works everywhere. Needs video.upload scope + a verified video-URL domain. The creator finishes the post in the TikTok app.')], ['t' => __('Direct publish to profile'), 'ok' => 'partial', 'r' => __('Needs TikTok\'s full app audit (demo video/screenshots). Until then posts go to the inbox as drafts.')], ['t' => __('DM inbox (Business Messaging)'), 'ok' => 'partial', 'r' => __('Wired end-to-end and connectable per account once you have a TikTok API for Business app + Messaging-Partner approval — paste the business ID + access token on the account card above. NOT available in the US, EEA, Switzerland or the UK. Capped at 10 messages per 48h after the first user message.')], ['t' => __('Comment reply / moderation'), 'ok' => 'partial', 'r' => __('Reply, hide and list comments need Business Account API approval (poll-based — no comment webhook).')], ['t' => __('Comment-to-DM automation'), 'ok' => false, 'r' => __('TikTok\'s API does not offer comment triggers, so this cannot be built for any vendor.')], ]; $dot = ['true' => 'bg-wa-green', 'partial' => 'bg-accent-amber', 'false' => 'bg-accent-coral']; @endphp @foreach ($rows as $row)
{{ $row['t'] }}
{{ $row['r'] }}
@endforeach
{{ __('available') }} {{ __('needs approval') }} {{ __('gated / not offered') }}
@endif