Merge pull request #3302 from Safelite/feature/CASH-2802

CASH-2802 - GA for Mobile Availability
This commit is contained in:
mvalaiyapathi 2026-08-03 10:41:39 -04:00 committed by GitHub
commit 9d696e2b2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View file

@ -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: [

View file

@ -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);