diff --git a/public/service-worker.js b/public/service-worker.js index 38b9354..9252f3e 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,7 +1,7 @@ const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1"; if (!isLocalhost) { - const STATIC_CACHE = "construction-delivery-static-v131"; + const STATIC_CACHE = "construction-delivery-static-v132"; const RUNTIME_CACHE = "construction-delivery-runtime-v119"; const APP_SHELL_URLS = ["/", "/client", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"]; diff --git a/src/services/deliveryInvitationApi.js b/src/services/deliveryInvitationApi.js index e041924..c5d3fdc 100644 --- a/src/services/deliveryInvitationApi.js +++ b/src/services/deliveryInvitationApi.js @@ -278,7 +278,7 @@ export const fetchDeliveryInvitation = async (token) => { } }; -export const confirmDeliveryChoice = async ({ token, deliveryDate, deliveryTime, deliveryType, pickupDate, pickupTimeSlot, deliveryAddress }) => { +export const confirmDeliveryChoice = async ({ token, deliveryDate, deliveryTime, deliveryType, pickupDate, pickupTimeSlot, deliveryAddress, src }) => { if (isLocalClientInvitationToken(token)) { const baseInvitation = getCachedInvitation(token) ?? buildFallbackInvitation(token); const invitation = cacheInvitation({ diff --git a/src/services/deliveryInvitationApi.test.js b/src/services/deliveryInvitationApi.test.js index 99086ee..ea1e264 100644 --- a/src/services/deliveryInvitationApi.test.js +++ b/src/services/deliveryInvitationApi.test.js @@ -169,10 +169,33 @@ describe("deliveryInvitationApi", () => { p_token: "token-1", p_delivery_date: "2026-04-01", p_delivery_time: "Первая половина дня", + p_delivery_type: "delivery", + p_pickup_date: null, + p_pickup_time_slot: null, + p_delivery_address: null, + p_src: null, }); expect(invoke).not.toHaveBeenCalled(); }); + it("passes the channel the client came from (src) to the confirm RPC", async () => { + rpc.mockResolvedValueOnce({ data: { ok: true }, error: null }); + + await expect( + confirmDeliveryChoice({ + token: "token-1", + deliveryDate: "2026-04-01", + deliveryTime: "Первая половина дня", + src: "sms", + }), + ).resolves.toEqual({ ok: true }); + + expect(rpc).toHaveBeenCalledWith( + "confirm_delivery_choice_by_token", + expect.objectContaining({ p_src: "sms" }), + ); + }); + it("updates the local client invitation when confirmation falls back to cache", async () => { invoke.mockRejectedValueOnce(new Error("worker boot error")); await fetchDeliveryInvitation("client-flow-1001");