feat: localize OAuth popup callback messages across 12 controllers

User reported the social-account OAuth callback popup ('Threads account
connected!') stayed in English regardless of the active locale. The
hardcoded message was wired through SocialController and 11 platform
controllers (Bluesky, Facebook, Instagram, InstagramFacebook, LinkedIn,
LinkedInPage, Mastodon, Pinterest, Threads, TikTok, YouTube), plus the
Blade view that the popup renders.

Adds an accounts.popup_callback i18n block (en/pt-BR/es) covering:
- The popup chrome (title, closing/close-now status text).
- Generic success/reconnect messages (one shared 'Account connected!'
  / 'Account reconnected!' line — the popup already shows a checkmark
  and lives for ~2s so platform-specific wording wasn't pulling weight).
- Error variants (account/page/channel) and contextual edge cases
  (page not found, no Facebook pages, no YouTube channels, etc.).

Updates every popupCallback() callsite to read from these keys, plus
the Blade view's title and submessage. Regenerates the JSON locale
bundle so laravel-vue-i18n stays in sync.
This commit is contained in:
Paulo Castellano 2026-05-07 14:03:52 -03:00
parent 7a25ca0759
commit cbea8394fc
19 changed files with 149 additions and 80 deletions

View file

@ -112,7 +112,7 @@ public function store(Request $request): View|RedirectResponse
],
);
return $this->popupCallback(true, 'Bluesky account connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('Bluesky connection error', [
'error' => $e->getMessage(),

View file

@ -64,13 +64,13 @@ public function callback(Request $request): View|RedirectResponse
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -87,7 +87,7 @@ public function callback(Request $request): View|RedirectResponse
$pages = $this->fetchPages($socialUser->token);
if (empty($pages)) {
return $this->popupCallback(false, 'No Facebook Pages found. You need to be an admin of at least one page.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.no_facebook_pages'), $this->platform->value);
}
// If only one page, connect directly
@ -119,7 +119,7 @@ public function callback(Request $request): View|RedirectResponse
],
);
return $this->popupCallback(true, 'Facebook Page connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
}
// Multiple pages - store data and show selection
@ -138,7 +138,7 @@ public function callback(Request $request): View|RedirectResponse
'trace' => $e->getTraceAsString(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
@ -183,20 +183,20 @@ public function select(Request $request): View
$workspaceId = session('social_connect_workspace');
if (! $oauthData || ! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
$selectedPage = collect(data_get($oauthData, 'pages'))->firstWhere('id', $request->page_id);
if (! $selectedPage) {
return $this->popupCallback(false, 'Page not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.page_not_found'), $this->platform->value);
}
$avatarPath = uploadFromUrl(data_get($selectedPage, 'picture'));
@ -226,7 +226,7 @@ public function select(Request $request): View
session()->forget(['facebook_oauth', 'social_reconnect_id']);
return $this->popupCallback(true, 'Facebook Page reconnected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.reconnected'), $this->platform->value);
}
}
@ -256,13 +256,13 @@ public function select(Request $request): View
session()->forget(['facebook_oauth', 'social_reconnect_id']);
return $this->popupCallback(true, 'Facebook Page connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('Facebook page selection error', [
'error' => $e->getMessage(),
]);
return $this->popupCallback(false, 'Error connecting page. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting_page'), $this->platform->value);
}
}

View file

@ -59,13 +59,13 @@ public function callback(Request $request): View
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -100,14 +100,14 @@ public function callback(Request $request): View
],
);
return $this->popupCallback(true, 'Instagram account connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('Instagram OAuth Error', [
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
}

View file

@ -67,13 +67,13 @@ public function callback(Request $request): View|RedirectResponse
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
$reconnectId = session('social_reconnect_id');
@ -94,7 +94,7 @@ public function callback(Request $request): View|RedirectResponse
$pages = $this->fetchPagesWithInstagram($socialUser->token);
if (empty($pages)) {
return $this->popupCallback(false, 'No Facebook Pages with linked Instagram accounts found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.no_facebook_instagram_pages'), $this->platform->value);
}
if (count($pages) === 1) {
@ -117,7 +117,7 @@ public function callback(Request $request): View|RedirectResponse
'trace' => $e->getTraceAsString(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
@ -159,13 +159,13 @@ public function select(Request $request): View
$workspaceId = session('social_connect_workspace');
if (! $oauthData || ! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
$reconnectId = data_get($oauthData, 'reconnect_id');
@ -175,7 +175,7 @@ public function select(Request $request): View
$selectedPage = collect(data_get($oauthData, 'pages'))->firstWhere('page_id', $request->page_id);
if (! $selectedPage) {
return $this->popupCallback(false, 'Page not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.page_not_found'), $this->platform->value);
}
$result = $this->connectInstagramAccount($workspace, $selectedPage, $existingAccount);
@ -186,7 +186,7 @@ public function select(Request $request): View
} catch (\Exception $e) {
Log::error('Instagram via Facebook page selection error', ['error' => $e->getMessage()]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
@ -215,7 +215,7 @@ private function connectInstagramAccount(Workspace $workspace, array $pageData,
session()->forget('social_reconnect_id');
return $this->popupCallback(true, 'Instagram account reconnected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.reconnected'), $this->platform->value);
}
$account = $workspace->socialAccounts()->updateOrCreate(
@ -232,7 +232,7 @@ private function connectInstagramAccount(Workspace $workspace, array $pageData,
$isOnboarding = session('social_connect_onboarding', false);
return $this->popupCallback(true, 'Instagram account connected!', $this->platform->value, $isOnboarding);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value, $isOnboarding);
}
private function fetchPagesWithInstagram(string $userToken): array

View file

@ -50,13 +50,13 @@ public function callback(Request $request): View
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -95,13 +95,13 @@ public function callback(Request $request): View
// Sync tokens to LinkedIn Page if it exists
app(LinkedInTokenSynchronizer::class)->syncTokens($account);
return $this->popupCallback(true, 'LinkedIn account connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('LinkedIn OAuth Error', [
'error' => $e->getMessage(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}

View file

@ -69,13 +69,13 @@ public function callback(Request $request): View|RedirectResponse
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -90,7 +90,7 @@ public function callback(Request $request): View|RedirectResponse
$organizations = $this->fetchOrganizations($socialUser->token);
if (empty($organizations)) {
return $this->popupCallback(false, 'You are not an administrator of any LinkedIn page.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.not_linkedin_admin'), $this->platform->value);
}
// Store data in session and redirect to selection page
@ -114,7 +114,7 @@ public function callback(Request $request): View|RedirectResponse
'error' => $e->getMessage(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
@ -156,13 +156,13 @@ public function select(Request $request): View
$pendingData = session('linkedin_page_pending');
if (! $pendingData) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($pendingData['workspace_id']);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -195,7 +195,7 @@ public function select(Request $request): View
session()->forget(['linkedin_page_pending', 'linkedin_page_reconnect_id']);
return $this->popupCallback(true, 'LinkedIn Page reconnected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.reconnected'), $this->platform->value);
}
}
@ -227,13 +227,13 @@ public function select(Request $request): View
session()->forget(['linkedin_page_pending', 'linkedin_page_reconnect_id']);
return $this->popupCallback(true, 'LinkedIn Page connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('LinkedIn Page selection error', [
'error' => $e->getMessage(),
]);
return $this->popupCallback(false, 'Error connecting page. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting_page'), $this->platform->value);
}
}

View file

@ -129,13 +129,13 @@ public function callback(Request $request): View
if (! $workspaceId || ! $instance) {
$this->clearMastodonSession();
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
if ($request->state !== $savedState) {
$this->clearMastodonSession();
return $this->popupCallback(false, 'Invalid state. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.invalid_state'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
@ -143,7 +143,7 @@ public function callback(Request $request): View
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
$this->clearMastodonSession();
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -163,7 +163,7 @@ public function callback(Request $request): View
]);
$this->clearMastodonSession();
return $this->popupCallback(false, 'Failed to authenticate.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.failed_to_authenticate'), $this->platform->value);
}
$tokenData = $tokenResponse->json();
@ -176,7 +176,7 @@ public function callback(Request $request): View
if ($profileResponse->failed()) {
$this->clearMastodonSession();
return $this->popupCallback(false, 'Failed to get profile.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.failed_to_get_profile'), $this->platform->value);
}
$profile = $profileResponse->json();
@ -215,7 +215,7 @@ public function callback(Request $request): View
$this->clearMastodonSession();
return $this->popupCallback(true, 'Mastodon account connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('Mastodon callback error', [
'error' => $e->getMessage(),
@ -223,7 +223,7 @@ public function callback(Request $request): View
]);
$this->clearMastodonSession();
return $this->popupCallback(false, 'Error connecting account.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}

View file

@ -48,13 +48,13 @@ public function callback(Request $request): View
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -83,14 +83,14 @@ public function callback(Request $request): View
'status' => Status::Connected,
]);
return $this->popupCallback(true, 'Pinterest account connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('Pinterest OAuth Error', [
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
}

View file

@ -167,13 +167,13 @@ protected function handleCallback(
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $platform->value);
}
try {
@ -200,14 +200,14 @@ protected function handleCallback(
],
);
return $this->popupCallback(true, 'Account connected!', $platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $platform->value);
} catch (\Exception $e) {
Log::error('Social OAuth Error', [
'platform' => $platform->value,
'error' => $e->getMessage(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $platform->value);
}
}

View file

@ -65,13 +65,13 @@ public function callback(Request $request): View
if (! $workspaceId) {
session()->forget(['threads_oauth_state', 'social_reconnect_id']);
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
if ($request->state !== $savedState) {
session()->forget(['threads_oauth_state', 'social_reconnect_id']);
return $this->popupCallback(false, 'Invalid state. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.invalid_state'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
@ -79,7 +79,7 @@ public function callback(Request $request): View
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
session()->forget(['threads_oauth_state', 'social_reconnect_id']);
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -157,7 +157,7 @@ public function callback(Request $request): View
session()->forget(['threads_oauth_state', 'social_reconnect_id']);
return $this->popupCallback(true, 'Threads account connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('Threads OAuth Error', [
'error' => $e->getMessage(),
@ -166,7 +166,7 @@ public function callback(Request $request): View
session()->forget(['threads_oauth_state', 'social_reconnect_id']);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
}

View file

@ -51,13 +51,13 @@ public function callback(Request $request): View
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -96,13 +96,13 @@ public function callback(Request $request): View
session()->forget('social_reconnect_id');
return $this->popupCallback(true, 'TikTok account connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('TikTok OAuth Error', [
'error' => $e->getMessage(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
}

View file

@ -56,13 +56,13 @@ public function callback(Request $request): View|RedirectResponse
$workspaceId = session('social_connect_workspace');
if (! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -72,7 +72,7 @@ public function callback(Request $request): View|RedirectResponse
$channels = $this->fetchChannels($socialUser->token);
if (empty($channels)) {
return $this->popupCallback(false, 'No YouTube channels found. Please create a channel first.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.no_youtube_channels'), $this->platform->value);
}
// If only one channel, connect directly (most common case)
@ -103,7 +103,7 @@ public function callback(Request $request): View|RedirectResponse
],
);
return $this->popupCallback(true, 'YouTube channel connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
}
// Multiple channels - store data and show selection screen
@ -123,7 +123,7 @@ public function callback(Request $request): View|RedirectResponse
'trace' => $e->getTraceAsString(),
]);
return $this->popupCallback(false, 'Error connecting account. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting'), $this->platform->value);
}
}
@ -178,13 +178,13 @@ public function select(Request $request): View
$workspaceId = session('social_connect_workspace');
if (! $oauthData || ! $workspaceId) {
return $this->popupCallback(false, 'Session expired. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.session_expired'), $this->platform->value);
}
$workspace = Workspace::find($workspaceId);
if (! $workspace || ! $request->user()->can('manageAccounts', $workspace)) {
return $this->popupCallback(false, 'Workspace not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.workspace_not_found'), $this->platform->value);
}
try {
@ -192,7 +192,7 @@ public function select(Request $request): View
$selectedChannel = collect($channels)->firstWhere('id', $request->channel_id);
if (! $selectedChannel) {
return $this->popupCallback(false, 'Channel not found.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.channel_not_found'), $this->platform->value);
}
$avatarPath = uploadFromUrl(data_get($selectedChannel, 'thumbnail'));
@ -221,7 +221,7 @@ public function select(Request $request): View
session()->forget(['youtube_oauth', 'social_reconnect_id']);
return $this->popupCallback(true, 'YouTube channel reconnected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.reconnected'), $this->platform->value);
}
}
@ -250,13 +250,13 @@ public function select(Request $request): View
session()->forget(['youtube_oauth', 'social_reconnect_id']);
return $this->popupCallback(true, 'YouTube channel connected!', $this->platform->value);
return $this->popupCallback(true, __('accounts.popup_callback.connected'), $this->platform->value);
} catch (\Exception $e) {
Log::error('YouTube channel selection error', [
'error' => $e->getMessage(),
]);
return $this->popupCallback(false, 'Error connecting channel. Please try again.', $this->platform->value);
return $this->popupCallback(false, __('accounts.popup_callback.error_connecting_channel'), $this->platform->value);
}
}

View file

@ -115,4 +115,27 @@
'already_connected' => 'This platform is already connected.',
'no_youtube_channels' => 'No YouTube channels found. Please create a channel first.',
],
'popup_callback' => [
'title_success' => 'Connected',
'title_error' => 'Error',
'closing' => 'This window will close automatically...',
'close_now' => 'You can close this window now.',
'connected' => 'Account connected!',
'reconnected' => 'Account reconnected!',
'error_connecting' => 'Error connecting account. Please try again.',
'error_connecting_page' => 'Error connecting page. Please try again.',
'error_connecting_channel' => 'Error connecting channel. Please try again.',
'session_expired' => 'Session expired. Please try again.',
'workspace_not_found' => 'Workspace not found.',
'invalid_state' => 'Invalid state. Please try again.',
'failed_to_authenticate' => 'Failed to authenticate.',
'failed_to_get_profile' => 'Failed to get profile.',
'page_not_found' => 'Page not found.',
'channel_not_found' => 'Channel not found.',
'no_facebook_pages' => 'No Facebook Pages found. You need to be an admin of at least one page.',
'no_facebook_instagram_pages' => 'No Facebook Pages with linked Instagram accounts found.',
'no_youtube_channels' => 'No YouTube channels found. Please create a channel first.',
'not_linkedin_admin' => 'You are not an administrator of any LinkedIn page.',
],
];

View file

@ -115,4 +115,27 @@
'already_connected' => 'Esta plataforma ya está conectada.',
'no_youtube_channels' => 'No se encontraron canales de YouTube. Crea un canal primero.',
],
'popup_callback' => [
'title_success' => 'Conectado',
'title_error' => 'Error',
'closing' => 'Esta ventana se cerrará automáticamente...',
'close_now' => 'Puedes cerrar esta ventana ahora.',
'connected' => '¡Cuenta conectada!',
'reconnected' => '¡Cuenta reconectada!',
'error_connecting' => 'Error al conectar la cuenta. Inténtalo de nuevo.',
'error_connecting_page' => 'Error al conectar la página. Inténtalo de nuevo.',
'error_connecting_channel' => 'Error al conectar el canal. Inténtalo de nuevo.',
'session_expired' => 'Sesión expirada. Inténtalo de nuevo.',
'workspace_not_found' => 'Workspace no encontrado.',
'invalid_state' => 'Estado inválido. Inténtalo de nuevo.',
'failed_to_authenticate' => 'Falló la autenticación.',
'failed_to_get_profile' => 'Falló al obtener el perfil.',
'page_not_found' => 'Página no encontrada.',
'channel_not_found' => 'Canal no encontrado.',
'no_facebook_pages' => 'No se encontraron páginas de Facebook. Debes ser administrador de al menos una página.',
'no_facebook_instagram_pages' => 'No se encontraron páginas de Facebook con cuentas de Instagram vinculadas.',
'no_youtube_channels' => 'No se encontraron canales de YouTube. Crea un canal primero.',
'not_linkedin_admin' => 'No eres administrador de ninguna página de LinkedIn.',
],
];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -115,4 +115,27 @@
'already_connected' => 'Esta plataforma já está conectada.',
'no_youtube_channels' => 'Nenhum canal do YouTube encontrado. Por favor, crie um canal primeiro.',
],
'popup_callback' => [
'title_success' => 'Conectado',
'title_error' => 'Erro',
'closing' => 'Esta janela será fechada automaticamente...',
'close_now' => 'Você pode fechar esta janela agora.',
'connected' => 'Conta conectada!',
'reconnected' => 'Conta reconectada!',
'error_connecting' => 'Erro ao conectar conta. Por favor, tente novamente.',
'error_connecting_page' => 'Erro ao conectar página. Por favor, tente novamente.',
'error_connecting_channel' => 'Erro ao conectar canal. Por favor, tente novamente.',
'session_expired' => 'Sessão expirada. Por favor, tente novamente.',
'workspace_not_found' => 'Workspace não encontrado.',
'invalid_state' => 'Estado inválido. Por favor, tente novamente.',
'failed_to_authenticate' => 'Falha na autenticação.',
'failed_to_get_profile' => 'Falha ao obter perfil.',
'page_not_found' => 'Página não encontrada.',
'channel_not_found' => 'Canal não encontrado.',
'no_facebook_pages' => 'Nenhuma página do Facebook encontrada. Você precisa ser administrador de pelo menos uma página.',
'no_facebook_instagram_pages' => 'Nenhuma página do Facebook com conta do Instagram vinculada foi encontrada.',
'no_youtube_channels' => 'Nenhum canal do YouTube encontrado. Por favor, crie um canal primeiro.',
'not_linkedin_admin' => 'Você não é administrador de nenhuma página do LinkedIn.',
],
];

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ $success ? 'Connected' : 'Error' }}</title>
<title>{{ $success ? __('accounts.popup_callback.title_success') : __('accounts.popup_callback.title_error') }}</title>
<style>
body {
font-family: system-ui, -apple-system, sans-serif;
@ -35,7 +35,7 @@
<div class="container">
<div class="icon">{{ $success ? '✓' : '✕' }}</div>
<div class="message">{{ $message }}</div>
<div class="submessage">This window will close automatically...</div>
<div class="submessage">{{ __('accounts.popup_callback.closing') }}</div>
</div>
<script>
@ -80,7 +80,7 @@ function closeWindow() {
// If still open after 2 seconds, show manual close message
setTimeout(function() {
if (!window.closed) {
document.querySelector('.submessage').textContent = 'You can close this window now.';
document.querySelector('.submessage').textContent = @json(__('accounts.popup_callback.close_now'));
}
}, 2000);
})();