fix(pwa): onboarding deep_links — make tg/max optional (MAX not configured in prod)

Backend omits channels without a configured username; strict zod schema
threw on missing 'max', surfacing as 'Не удалось отправить код' instead of
routing to the onboarding screen. Make both optional + regression test.

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
tremble7681andclaude-flow committed 2026-06-18 23:05:12 +10:00
1 parent 08ebc09814
commit b419a456fe
2 files changed
+4 -1

No files matched your search

@@ -14,6 +14,9 @@ describe("driver api schemas", () => {
expect(AuthRequestSchema.parse({ status: "code_sent", channel: "tg" }).status).toBe("code_sent");
const o = AuthRequestSchema.parse({ status: "onboarding", deep_links: { tg: "t", max: "m" } });
expect(o.status === "onboarding" && o.deep_links.tg).toBe("t");
// prod: MAX bot not configured → backend omits `max`, must still parse (regression guard)
const tgOnly = AuthRequestSchema.parse({ status: "onboarding", deep_links: { tg: "t" } });
expect(tgOnly.status === "onboarding" && tgOnly.deep_links.tg).toBe("t");
});
it("parses payments history", () => {
const v = PaymentsSchema.parse({ payments: [{ order_id: "o1", bucket: "b", amount: 100,