From fe886fa77dbf6846df7219f035ce042c8716362c Mon Sep 17 00:00:00 2001 From: Minojhini Valaiyapathi Date: Mon, 3 Aug 2026 10:24:07 -0400 Subject: [PATCH] CASH-2802 - GA for Mobile Availability --- src/layouts/scheduling/scheduling.spec.js | 25 +++++++++++++++++++++++ src/layouts/scheduling/scheduling.vue | 11 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/layouts/scheduling/scheduling.spec.js b/src/layouts/scheduling/scheduling.spec.js index d6daabebb..02e182056 100644 --- a/src/layouts/scheduling/scheduling.spec.js +++ b/src/layouts/scheduling/scheduling.spec.js @@ -3,6 +3,7 @@ import scheduling from "./scheduling"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { settleAllPromises } from "@/helpers/layout-helper"; import { AppointmentTypeStrings } from "@/constants/schedule-constants"; +import { GaActions, GaCategories, GaLabels } from "@/constants/analytics"; import store from "@/store"; jest.mock("@/store", () => ({ @@ -286,6 +287,30 @@ describe("scheduling.vue", () => { wrapper.unmount(); }); + test.each([ + ["yes", "12345", GaLabels.YES], + ["no", null, GaLabels.NO], + ])( + "pushes mobile_available %s when mobileProviderNumber is %s", + async (_label, mobileProviderNumber, expectedGaLabel) => { + settleAllPromises.mockResolvedValueOnce({}); + const { wrapper } = setupMocks(); + wrapper.vm.pushEventToGA.mockClear(); + + await wrapper.vm.loadSchedulingData("43235", { + providersResult: { shopProviders: [], mobileProviderNumber }, + }); + + expect(wrapper.vm.pushEventToGA).toHaveBeenCalledWith( + GaCategories.APPOINTMENT, + GaActions.MOBILE_AVAILABLE, + expectedGaLabel, + true + ); + wrapper.unmount(); + } + ); + test("navigates to service-zip when zip changes and recal acknowledgement applies", async () => { store.getters.order.lineItems = { glassParts: [ diff --git a/src/layouts/scheduling/scheduling.vue b/src/layouts/scheduling/scheduling.vue index ce27ed3b2..f8f2da86b 100644 --- a/src/layouts/scheduling/scheduling.vue +++ b/src/layouts/scheduling/scheduling.vue @@ -439,6 +439,17 @@ export default { ? { providerNumber: mobileProviderNumber, timeSlots: null } : null; + var gaLabel = this.GaLabels.NO; + if (this.mobileProviderAndTimeSlot) { + gaLabel = this.GaLabels.YES; + } + this.pushEventToGA( + this.GaCategories.APPOINTMENT, + this.GaActions.MOBILE_AVAILABLE, + gaLabel, + true + ); + const startDate = toDateString(0); const endDate = toDateString(SCHEDULE_FETCH_DAYS - 1); const providerNumbers = providers.map((provider) => provider.providerNumber);