Skip to content

Commit 1c0ef5d

Browse files
committed
fix(eid-wallet): word the cancel refusal through the message catalog
The cancel path's one user-facing refusal was an English sentence thrown from socialBinding.ts. That module deliberately carries no i18n — it is the one the spec drives directly, without the app's module aliases — so it now throws a code and the details sheet words it. Adds the four keys this branch introduces in all three locales, and rebuilds the published catalog.
1 parent 2de2831 commit 1c0ef5d

7 files changed

Lines changed: 37 additions & 6 deletions

File tree

‎docs/static/translations.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,12 @@
505505
"social_bindings_empty_body": "Invite a contact from your eName card.",
506506
"social_bindings_empty_title": "No social bindings yet",
507507
"social_bindings_page_title": "Social bindings",
508+
"social_cancel_not_pending": "This request is no longer pending — reopen the list to see where it landed.",
508509
"social_details_awaiting": "Awaiting confirmation",
509510
"social_details_awaiting_suffix": "· Awaiting confirmation",
511+
"social_details_awaiting_you_suffix": "· Awaiting your confirmation",
512+
"social_details_cancel_invite": "Cancel invite",
513+
"social_details_not_ready": "Wallet not ready.",
510514
"social_details_view_full_list": "View on full list",
511515
"social_drawer_counter_signing": "Completing mutual binding…",
512516
"social_drawer_error_fallback": "Failed to complete the binding.",
@@ -1041,8 +1045,12 @@
10411045
"social_bindings_empty_body": "Пригласите контакт с карточки вашего eName.",
10421046
"social_bindings_empty_title": "Социальных связей пока нет",
10431047
"social_bindings_page_title": "Социальные связи",
1048+
"social_cancel_not_pending": "Этот запрос больше не ожидает ответа — откройте список заново, чтобы увидеть результат.",
10441049
"social_details_awaiting": "Ожидает подтверждения",
10451050
"social_details_awaiting_suffix": "· Ожидает подтверждения",
1051+
"social_details_awaiting_you_suffix": "· Ожидает вашего подтверждения",
1052+
"social_details_cancel_invite": "Отменить приглашение",
1053+
"social_details_not_ready": "Кошелёк не готов.",
10461054
"social_details_view_full_list": "Открыть полный список",
10471055
"social_drawer_counter_signing": "Завершаем взаимную связь…",
10481056
"social_drawer_error_fallback": "Не удалось завершить создание связи.",
@@ -1577,8 +1585,12 @@
15771585
"social_bindings_empty_body": "Запросіть контакт із картки вашого eName.",
15781586
"social_bindings_empty_title": "Соціальних зв’язків поки немає",
15791587
"social_bindings_page_title": "Соціальні зв’язки",
1588+
"social_cancel_not_pending": "Цей запит більше не очікує відповіді — відкрийте список знову, щоб побачити результат.",
15801589
"social_details_awaiting": "Очікує підтвердження",
15811590
"social_details_awaiting_suffix": "· Очікує підтвердження",
1591+
"social_details_awaiting_you_suffix": "· Очікує вашого підтвердження",
1592+
"social_details_cancel_invite": "Скасувати запрошення",
1593+
"social_details_not_ready": "Гаманець не готовий.",
15821594
"social_details_view_full_list": "Відкрити повний список",
15831595
"social_drawer_counter_signing": "Завершуємо взаємний зв’язок…",
15841596
"social_drawer_error_fallback": "Не вдалося завершити створення зв’язку.",

‎infrastructure/eid-wallet/messages/en.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@
655655
"social_bindings_empty_body": "Invite a contact from your eName card.",
656656
"social_bindings_empty_title": "No social bindings yet",
657657
"social_bindings_page_title": "Social bindings",
658+
"social_cancel_not_pending": "This request is no longer pending — reopen the list to see where it landed.",
658659
"social_details_awaiting": "Awaiting confirmation",
659660
"social_details_awaiting_suffix": "· Awaiting confirmation",
660661
"social_details_awaiting_you_suffix": "· Awaiting your confirmation",

‎infrastructure/eid-wallet/messages/ru.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@
675675
"social_bindings_empty_body": "Пригласите контакт с карточки вашего eName.",
676676
"social_bindings_empty_title": "Социальных связей пока нет",
677677
"social_bindings_page_title": "Социальные связи",
678+
"social_cancel_not_pending": "Этот запрос больше не ожидает ответа — откройте список заново, чтобы увидеть результат.",
678679
"social_details_awaiting": "Ожидает подтверждения",
679680
"social_details_awaiting_suffix": "· Ожидает подтверждения",
680681
"social_details_awaiting_you_suffix": "· Ожидает вашего подтверждения",

‎infrastructure/eid-wallet/messages/uk.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@
675675
"social_bindings_empty_body": "Запросіть контакт із картки вашого eName.",
676676
"social_bindings_empty_title": "Соціальних зв’язків поки немає",
677677
"social_bindings_page_title": "Соціальні зв’язки",
678+
"social_cancel_not_pending": "Цей запит більше не очікує відповіді — відкрийте список знову, щоб побачити результат.",
678679
"social_details_awaiting": "Очікує підтвердження",
679680
"social_details_awaiting_suffix": "· Очікує підтвердження",
680681
"social_details_awaiting_you_suffix": "· Очікує вашого підтвердження",

‎infrastructure/eid-wallet/src/lib/utils/socialBinding.spec.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ vi.mock("$env/static/public", () => ({
66
}));
77

88
import {
9+
CANCEL_NOT_PENDING,
910
acceptSocialBinding,
1011
cancelSentSocialBinding,
1112
declineSocialBinding,
@@ -379,7 +380,7 @@ describe("cancelling a sent invite", () => {
379380

380381
await expect(
381382
cancelSentSocialBinding(gql(ME), ME, "M2", BOB, ""),
382-
).rejects.toThrow(/no longer pending/);
383+
).rejects.toThrow(CANCEL_NOT_PENDING);
383384
expect(deletes).toEqual([]);
384385
});
385386

@@ -402,7 +403,7 @@ describe("cancelling a sent invite", () => {
402403

403404
await expect(
404405
cancelSentSocialBinding(gql(ME), ME, "M1", BOB, "x"),
405-
).rejects.toThrow(/no longer pending/);
406+
).rejects.toThrow(CANCEL_NOT_PENDING);
406407
expect(deletes).toEqual([]);
407408
});
408409
});

‎infrastructure/eid-wallet/src/lib/utils/socialBinding.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,12 @@ export async function declineSocialBinding(
811811
if (parsed) await pruneDuplicatesOf(ownGqlUrl, normalized, docId, parsed);
812812
}
813813

814+
/**
815+
* The one refusal cancelSentSocialBinding surfaces to the user, as a code rather
816+
* than a sentence: this module has no i18n, so the caller renders the wording.
817+
*/
818+
export const CANCEL_NOT_PENDING = "social-binding/cancel-not-pending";
819+
814820
/**
815821
* Withdraw an invite the caller sent by scanning: delete the pending doc from
816822
* the counterparty's vault first, then the caller's local mirror.
@@ -850,9 +856,7 @@ export async function cancelSentSocialBinding(
850856
// often the empty one) is what we are seeing. The description is
851857
// all we have to match on, so don't guess which: leave the mirror
852858
// alone and let the reconcile settle it on the next read.
853-
throw new Error(
854-
"This request is no longer pending — reopen the list to see where it landed.",
855-
);
859+
throw new Error(CANCEL_NOT_PENDING);
856860
}
857861
// Nothing with this description on their side at all: they declined and
858862
// deleted it, so only the orphaned mirror is left.

‎infrastructure/eid-wallet/src/routes/(app)/main/components/SocialBindingDetailsSheet.svelte‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { m } from "$lib/i18n";
44
import { getLocale } from "$lib/paraglide/runtime";
55
import { BottomSheet, ButtonAction } from "$lib/ui";
66
import {
7+
CANCEL_NOT_PENDING,
78
type SocialBindingSummary,
89
acceptSocialBinding,
910
cancelSentSocialBinding,
@@ -93,6 +94,16 @@ async function callerContext(): Promise<CallerContext> {
9394
};
9495
}
9596
97+
/**
98+
* socialBinding.ts carries no i18n so it stays testable without the app's module
99+
* aliases; its one user-facing refusal arrives as a code and is worded here.
100+
*/
101+
function messageFor(err: Error): string {
102+
return err.message === CANCEL_NOT_PENDING
103+
? m.social_cancel_not_pending()
104+
: err.message;
105+
}
106+
96107
async function runAction(
97108
binding: SocialBindingSummary,
98109
action: (ctx: CallerContext) => Promise<void>,
@@ -107,7 +118,7 @@ async function runAction(
107118
console.error("[SocialBindingDetailsSheet] action failed:", err);
108119
actionError =
109120
err instanceof Error
110-
? err.message
121+
? messageFor(err)
111122
: m.social_drawer_error_generic();
112123
} finally {
113124
busyDocId = null;

0 commit comments

Comments
 (0)