Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
79013c8
feat: ai (cursor) implementation
yuskithedeveloper Oct 14, 2025
b8665a6
feat: ai (cursor) implementation, layout fix
yuskithedeveloper Oct 14, 2025
0d4fdee
feat: ai (cursor) implementation, localization
yuskithedeveloper Oct 14, 2025
fd06fd1
feat: ai (cursor) implementation, issues fix
yuskithedeveloper Oct 14, 2025
ab4eb8d
feat: types.ts regenerated
yuskithedeveloper Oct 14, 2025
6535147
Merge branch 'dev' into feat/VCST-3865-cart-pickup-locations-facet-se…
yuskithedeveloper Oct 14, 2025
9a71836
feat: map reload on addresses change
yuskithedeveloper Oct 14, 2025
c7898bd
feat: zoom to markers if selected address not found
yuskithedeveloper Oct 14, 2025
6d6f363
feat: not found block
yuskithedeveloper Oct 15, 2025
0ef16a7
feat: reset search button
yuskithedeveloper Oct 15, 2025
a8d464f
feat: pickup locations grid (without map)
yuskithedeveloper Oct 15, 2025
aa59525
feat: addresses fetch limit
yuskithedeveloper Oct 15, 2025
7034135
fix: locales
yuskithedeveloper Oct 15, 2025
68f9d8d
Merge branch 'dev' into feat/VCST-3865-cart-pickup-locations-facet-se…
yuskithedeveloper Oct 15, 2025
58e5cdb
refactor: filter countries, regions and cities moved to composable
yuskithedeveloper Oct 15, 2025
cfecaf8
refactor: filter countries, regions and cities moved to composable
yuskithedeveloper Oct 15, 2025
d9306df
refactor: facet keys moved to composable
yuskithedeveloper Oct 15, 2025
3470925
refactor: rename
yuskithedeveloper Oct 15, 2025
d554fbe
refactor: rename, resetFilter moved
yuskithedeveloper Oct 15, 2025
65df7dc
refactor: minor
yuskithedeveloper Oct 15, 2025
f02f203
Merge branch 'dev' into feat/VCST-3865-cart-pickup-locations-facet-se…
yuskithedeveloper Oct 16, 2025
3b11128
refactor: layout formatting
yuskithedeveloper Oct 16, 2025
0021eb4
refactor: types fix
yuskithedeveloper Oct 16, 2025
3874164
feat: aria-labels
yuskithedeveloper Oct 16, 2025
daa5677
feat: nextTick for unwatch-s
yuskithedeveloper Oct 16, 2025
642cd55
Merge branch 'dev' into feat/VCST-3865-cart-pickup-locations-facet-se…
yuskithedeveloper Oct 20, 2025
d534cfd
Merge branch 'dev' into feat/VCST-3865-cart-pickup-locations-facet-se…
yuskithedeveloper Oct 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ query GetCartPickupLocations(
$cultureName: String!
$cartId: String!
$keyword: String
$filter: String
$first: Int
$after: String
$sort: String
$facet: String
) {
cartPickupLocations(
storeId: $storeId
cultureName: $cultureName
cartId: $cartId
keyword: $keyword
filter: $filter
first: $first
after: $after
sort: $sort
facet: $facet
) {
totalCount
items {
Expand All @@ -40,5 +44,13 @@ query GetCartPickupLocations(
phone
}
}
term_facets {
name
terms {
term
label
count
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { globals } from "@/core/globals";
import { graphqlClient } from "../../../client";
import getCartPickupLocationsQueryDocument from "./getCartPickupLocationsQuery.graphql";
import type { Query, QueryCartPickupLocationsArgs, ProductPickupLocationConnection } from "@/core/api/graphql/types";
import type { Query, QueryCartPickupLocationsArgs, CartPickupLocationConnection } from "@/core/api/graphql/types";

export async function getCartPickupLocations(
payload: Omit<QueryCartPickupLocationsArgs, "storeId" | "cultureName">,
): Promise<ProductPickupLocationConnection> {
): Promise<CartPickupLocationConnection> {
const { storeId, cultureName } = globals;

const { data } = await graphqlClient.query<
Expand Down
28 changes: 25 additions & 3 deletions client-app/core/api/graphql/types.ts

Large diffs are not rendered by default.

80 changes: 75 additions & 5 deletions client-app/shared/cart/composables/useCartPickupLocations.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,77 @@
import { ref } from "vue";
import { createSharedComposable } from "@vueuse/core";
import { ref, computed } from "vue";
import { getCartPickupLocations } from "@/core/api/graphql/cart";
import { Logger } from "@/core/utilities";
import type { ProductPickupLocation, QueryCartPickupLocationsArgs } from "@/core/api/graphql/types";
import type {
ProductPickupLocation,
QueryCartPickupLocationsArgs,
TermFacet,
FacetTermType,
} from "@/core/api/graphql/types";

export function useCartPickupLocations() {
const COUNTRY_NAME_FACET = "address_countryname";
const REGION_NAME_FACET = "address_regionname";
const CITY_FACET = "address_city";

export type PickupLocationsFilterOptionsType = {
countries: FacetTermType[];
regions: FacetTermType[];
cities: FacetTermType[];
};

export function _useCartPickupLocations() {
const pickupLocationsLoading = ref(false);

const pickupLocations = ref<ProductPickupLocation[]>([]);
const termFacets = ref<TermFacet[] | undefined>();

const filterOptions = computed(
() =>
({
countries: termFacets.value?.find((f) => f.name === COUNTRY_NAME_FACET)?.terms ?? [],
regions: termFacets.value?.find((f) => f.name === REGION_NAME_FACET)?.terms ?? [],
cities: termFacets.value?.find((f) => f.name === CITY_FACET)?.terms ?? [],
}) as PickupLocationsFilterOptionsType,
);

const filterKeyword = ref<string>("");
const filterCountry = ref<string | undefined>();
const filterRegion = ref<string | undefined>();
const filterCity = ref<string | undefined>();

const filterApplied = ref(false);

function buildFilter(): string | undefined {
if (filterCity.value) {
return `${CITY_FACET}:"${filterCity.value}"`;
}
if (filterRegion.value) {
return `${REGION_NAME_FACET}:"${filterRegion.value}"`;
}
if (filterCountry.value) {
return `${COUNTRY_NAME_FACET}:"${filterCountry.value}"`;
}
return undefined;
}

async function fetchPickupLocations(payload: Omit<QueryCartPickupLocationsArgs, "storeId" | "cultureName">) {
function resetFilter() {
filterKeyword.value = "";
filterCountry.value = undefined;
filterRegion.value = undefined;
filterCity.value = undefined;
}

async function fetchPickupLocations(
payload: Omit<QueryCartPickupLocationsArgs, "storeId" | "cultureName" | "facet">,
) {
pickupLocationsLoading.value = true;
try {
const data = await getCartPickupLocations(payload);
const data = await getCartPickupLocations({
facet: `${COUNTRY_NAME_FACET} ${REGION_NAME_FACET} ${CITY_FACET}`,
...payload,
});
pickupLocations.value = data.items ?? [];
termFacets.value = data.term_facets ?? undefined;
} catch (e) {
Logger.error(`${useCartPickupLocations.name}.${fetchPickupLocations.name}`, e);
throw e;
Expand All @@ -24,5 +83,16 @@ export function useCartPickupLocations() {
pickupLocationsLoading,
pickupLocations,
fetchPickupLocations,

filterOptions,
filterKeyword,
filterCountry,
filterRegion,
filterCity,
filterApplied,
buildFilter,
resetFilter,
};
}

export const useCartPickupLocations = createSharedComposable(_useCartPickupLocations);
Loading
Loading