mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 00:03:52 +00:00
fix(browser): preserve unknown remote warning fallback
This commit is contained in:
@@ -73,6 +73,26 @@ describe('emitBrowserCookieImportToast', () => {
|
||||
expect(message).not.toContain('export')
|
||||
})
|
||||
|
||||
it('uses the generic warning for a reason added by a newer runtime host', () => {
|
||||
emitBrowserCookieImportToast(
|
||||
{
|
||||
...summary,
|
||||
warning: {
|
||||
code: 'cookies-undecryptable',
|
||||
failedCookies: 3,
|
||||
reason: 'newer-runtime-reason'
|
||||
}
|
||||
} as unknown as BrowserCookieImportSummary,
|
||||
'Imported 0 cookies.',
|
||||
'Remote Mac'
|
||||
)
|
||||
|
||||
expect(warningToastMock).toHaveBeenCalledWith(
|
||||
'3 cookies could not be decrypted and were skipped. Close the source browser completely and try the import again.'
|
||||
)
|
||||
expect(successToastMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('shows separate host-specific Google guidance after success', () => {
|
||||
emitBrowserCookieImportToast(
|
||||
{ ...summary, importedCookies: 2, skippedCookies: 1, googleCookiesSkipped: 1 },
|
||||
|
||||
@@ -4,6 +4,14 @@ import { translate } from '@/i18n/i18n'
|
||||
|
||||
type CookieImportWarning = NonNullable<BrowserCookieImportSummary['warning']>
|
||||
|
||||
function formatUnknownCookieImportWarning(failedCookies: number): string {
|
||||
return translate(
|
||||
'auto.lib.browser.cookie.import.toast.undecryptableUnknown',
|
||||
'{{value0}} cookies could not be decrypted and were skipped. Close the source browser completely and try the import again.',
|
||||
{ value0: failedCookies }
|
||||
)
|
||||
}
|
||||
|
||||
function formatCookieImportWarning(warning: CookieImportWarning): string {
|
||||
switch (warning.code) {
|
||||
case 'restart-fallback-unavailable':
|
||||
@@ -48,12 +56,10 @@ function formatCookieImportWarning(warning: CookieImportWarning): string {
|
||||
{ value0: warning.failedCookies }
|
||||
)
|
||||
case 'unknown':
|
||||
return translate(
|
||||
'auto.lib.browser.cookie.import.toast.undecryptableUnknown',
|
||||
'{{value0}} cookies could not be decrypted and were skipped. Close the source browser completely and try the import again.',
|
||||
{ value0: warning.failedCookies }
|
||||
)
|
||||
return formatUnknownCookieImportWarning(warning.failedCookies)
|
||||
}
|
||||
// Older clients can receive a reason added by a newer runtime host before their types know it.
|
||||
return formatUnknownCookieImportWarning(warning.failedCookies)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user