-
-
-
-
-
-
setShowFilterMenu(false)}
+
+ setShowFilterMenu(false)}
+ >
+
+
+
+
+
+
+
+
-
-
-
+
+ setShowFilterMenu(false)}
+ >
+
+
+
-
-
-
-
-
-
- Category
-
-
-
-
-
+
+
+
+
+
+
+ Category
+
+
+
+
+
+
+
-
-
-
-
+
+
);
- }
+}
diff --git a/examples/algolia/src/components/search/NoResults.tsx b/examples/algolia/src/components/search/NoResults.tsx
index 4b6d5652..22276594 100644
--- a/examples/algolia/src/components/search/NoResults.tsx
+++ b/examples/algolia/src/components/search/NoResults.tsx
@@ -20,4 +20,4 @@ export const NoResults = ({
);
};
-export default NoResults;
\ No newline at end of file
+export default NoResults;
diff --git a/examples/algolia/src/components/search/Pagination.tsx b/examples/algolia/src/components/search/Pagination.tsx
index 2972327d..77231f6e 100644
--- a/examples/algolia/src/components/search/Pagination.tsx
+++ b/examples/algolia/src/components/search/Pagination.tsx
@@ -13,7 +13,7 @@ export const Pagination = (): JSX.Element => {
className={clsx(
currentRefinement === page ? "bg-brand-primary" : "bg-gray-100",
currentRefinement === page ? "text-white" : "text-black",
- "primary-btn w-fit cursor-pointer"
+ "primary-btn w-fit cursor-pointer",
)}
key={page}
onClick={() => refine(page)}
diff --git a/examples/algolia/src/components/search/SearchBox.tsx b/examples/algolia/src/components/search/SearchBox.tsx
index f675ddbb..7fbf39f7 100644
--- a/examples/algolia/src/components/search/SearchBox.tsx
+++ b/examples/algolia/src/components/search/SearchBox.tsx
@@ -14,7 +14,7 @@ export default function SearchBox(): JSX.Element {
}
},
400,
- [search]
+ [search],
);
return (
diff --git a/examples/algolia/src/components/search/SearchModal.tsx b/examples/algolia/src/components/search/SearchModal.tsx
index 483c2e46..19de1ff9 100644
--- a/examples/algolia/src/components/search/SearchModal.tsx
+++ b/examples/algolia/src/components/search/SearchModal.tsx
@@ -35,7 +35,7 @@ const SearchBox = ({
}
},
400,
- [search]
+ [search],
);
return (
@@ -60,7 +60,7 @@ const SearchBox = ({
= ({
lookup,
}: ISearch) => {
const { initialUiState, NextRouterHandler } = useNextRouterHandler(
- resolveRouting(url)
+ resolveRouting(url),
);
return (
diff --git a/examples/algolia/src/components/search/price-range-slider/PriceRangeSliderWrapper.tsx b/examples/algolia/src/components/search/price-range-slider/PriceRangeSliderWrapper.tsx
index 2de6be1a..86a87767 100644
--- a/examples/algolia/src/components/search/price-range-slider/PriceRangeSliderWrapper.tsx
+++ b/examples/algolia/src/components/search/price-range-slider/PriceRangeSliderWrapper.tsx
@@ -1,4 +1,3 @@
-
import type {
RangeConnectorParams,
RangeWidgetDescription,
@@ -10,12 +9,12 @@ import PriceRangeSliderComponent from "./PriceRangeSlider";
export type UseRangeSliderProps = RangeConnectorParams;
export default function PriceRangeSliderWrapper(
- props: UseRangeSliderProps
+ props: UseRangeSliderProps,
): JSX.Element {
const useRangeSlider = (props?: UseRangeSliderProps) => {
return useConnector(
connectRange,
- props
+ props,
);
};
diff --git a/examples/algolia/src/lib/algolia-search-routing.ts b/examples/algolia/src/lib/algolia-search-routing.ts
index 65f92157..3016dd76 100644
--- a/examples/algolia/src/lib/algolia-search-routing.ts
+++ b/examples/algolia/src/lib/algolia-search-routing.ts
@@ -10,7 +10,7 @@ const EP_ROUTE_PRICE = `ep_price.${EP_CURRENCY_CODE}.float_price`;
const EP_ROUTE_COLOR = "ep_extensions_products_specifications.color";
export function resolveRouting(
- url: string
+ url: string,
): NextRouterHandlerProps & { url: string } {
return {
dynamicRouteQuery: {},
diff --git a/examples/algolia/src/lib/build-breadcrumb-lookup.ts b/examples/algolia/src/lib/build-breadcrumb-lookup.ts
index 01c72a86..4d170da9 100644
--- a/examples/algolia/src/lib/build-breadcrumb-lookup.ts
+++ b/examples/algolia/src/lib/build-breadcrumb-lookup.ts
@@ -2,7 +2,7 @@ import { NavigationNode } from "./build-site-navigation";
import { BreadcrumbLookup } from "./types/breadcrumb-lookup";
export function buildBreadcrumbLookup(
- nodes: NavigationNode[]
+ nodes: NavigationNode[],
): BreadcrumbLookup {
return nodes.reduce((acc, curr) => {
const { href, name, children, slug } = curr;
diff --git a/examples/algolia/src/lib/create-breadcrumb.ts b/examples/algolia/src/lib/create-breadcrumb.ts
index e2e2045c..f3c1c8e2 100644
--- a/examples/algolia/src/lib/create-breadcrumb.ts
+++ b/examples/algolia/src/lib/create-breadcrumb.ts
@@ -10,7 +10,7 @@ export function createBreadcrumb(
[head, ...tail]: string[],
lookup?: BreadcrumbLookup,
acc: BreadcrumbEntry[] = [],
- breadcrumb?: string
+ breadcrumb?: string,
): BreadcrumbEntry[] {
const updatedBreadcrumb = `${breadcrumb ? `${breadcrumb}/` : ""}${head}`;
diff --git a/examples/algolia/src/lib/resolve-algolia-env.ts b/examples/algolia/src/lib/resolve-algolia-env.ts
index f0d01075..b6ed2d52 100644
--- a/examples/algolia/src/lib/resolve-algolia-env.ts
+++ b/examples/algolia/src/lib/resolve-algolia-env.ts
@@ -6,7 +6,7 @@ function algoliaEnv(): { appId: string; apiKey: string; indexName: string } {
const indexName = process.env.NEXT_PUBLIC_ALGOLIA_INDEX_NAME;
if (!appId || !apiKey || !indexName) {
throw new Error(
- `Failed to get algolia search environment variables. \n Make sure you have set NEXT_PUBLIC_ALGOLIA_APP_ID, NEXT_PUBLIC_ALGOLIA_API_KEY and NEXT_PUBLIC_ALGOLIA_INDEX_NAME`
+ `Failed to get algolia search environment variables. \n Make sure you have set NEXT_PUBLIC_ALGOLIA_APP_ID, NEXT_PUBLIC_ALGOLIA_API_KEY and NEXT_PUBLIC_ALGOLIA_INDEX_NAME`,
);
}
return { appId, apiKey, indexName };
diff --git a/examples/algolia/src/lib/search-client.ts b/examples/algolia/src/lib/search-client.ts
index 7684abf7..7c2a6242 100644
--- a/examples/algolia/src/lib/search-client.ts
+++ b/examples/algolia/src/lib/search-client.ts
@@ -3,5 +3,5 @@ import { algoliaEnvData } from "./resolve-algolia-env";
export const searchClient = algoliasearch(
algoliaEnvData.appId,
- algoliaEnvData.apiKey
+ algoliaEnvData.apiKey,
);
diff --git a/examples/algolia/src/lib/search-props.tsx b/examples/algolia/src/lib/search-props.tsx
index 4ffb70bf..aea54db1 100644
--- a/examples/algolia/src/lib/search-props.tsx
+++ b/examples/algolia/src/lib/search-props.tsx
@@ -24,7 +24,7 @@ export interface ISearch {
export const getSearchSSRProps =
(
SearchComponent: NextPage,
- lookup: BreadcrumbLookup
+ lookup: BreadcrumbLookup,
): GetServerSideProps =>
async ({ req, params }) => {
const protocol = req.headers.referer?.split("://")[0] || "https";
@@ -39,7 +39,7 @@ export const getSearchSSRProps =
breadcrumbEntries={breadcrumbEntries}
lookup={lookup}
/>,
- { renderToString }
+ { renderToString },
);
return {
diff --git a/examples/algolia/src/lib/sort-alphabetically.ts b/examples/algolia/src/lib/sort-alphabetically.ts
index 35118174..a69ce476 100644
--- a/examples/algolia/src/lib/sort-alphabetically.ts
+++ b/examples/algolia/src/lib/sort-alphabetically.ts
@@ -1,4 +1,4 @@
export const sortAlphabetically = (
a: { name: string },
- b: { name: string }
+ b: { name: string },
): number => a.name.localeCompare(b.name);
diff --git a/examples/algolia/src/lib/use-debounced.ts b/examples/algolia/src/lib/use-debounced.ts
index f0fc486f..2b799e94 100644
--- a/examples/algolia/src/lib/use-debounced.ts
+++ b/examples/algolia/src/lib/use-debounced.ts
@@ -3,11 +3,12 @@ import { DependencyList, EffectCallback, useEffect } from "react";
export const useDebouncedEffect = (
effect: EffectCallback,
delay: number,
- deps?: DependencyList
+ deps?: DependencyList,
) => {
useEffect(() => {
const handler = setTimeout(() => effect(), delay);
return () => clearTimeout(handler);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [...(deps || []), delay, effect]);
};
diff --git a/examples/algolia/src/pages/search/[...node].tsx b/examples/algolia/src/pages/search/[...node].tsx
index 48931b1f..29e7d1c7 100644
--- a/examples/algolia/src/pages/search/[...node].tsx
+++ b/examples/algolia/src/pages/search/[...node].tsx
@@ -25,7 +25,7 @@ export function NodeSearch(props: INodeSearch): JSX.Element {
NodeSearch.getLayout = function getLayout(
page: ReactElement,
pageProps: { node: string[] },
- ctx?: StoreContext
+ ctx?: StoreContext,
) {
return (
<>
diff --git a/examples/basic/e2e/util/gateway-check.ts b/examples/basic/e2e/util/gateway-check.ts
index 3422c5fd..b1ecf29c 100644
--- a/examples/basic/e2e/util/gateway-check.ts
+++ b/examples/basic/e2e/util/gateway-check.ts
@@ -4,7 +4,7 @@ export async function gatewayCheck(client: EPCCClient): Promise {
try {
const gateways = await client.Gateways.All();
const epPaymentGateway = gateways.data.find(
- (gateway) => gateway.slug === "elastic_path_payments_stripe"
+ (gateway) => gateway.slug === "elastic_path_payments_stripe",
)?.enabled;
return !!epPaymentGateway;
} catch (err) {
diff --git a/examples/basic/e2e/util/gateway-is-enabled.ts b/examples/basic/e2e/util/gateway-is-enabled.ts
index 796879cc..12e55d3a 100644
--- a/examples/basic/e2e/util/gateway-is-enabled.ts
+++ b/examples/basic/e2e/util/gateway-is-enabled.ts
@@ -5,6 +5,6 @@ import { adminClient } from "./epcc-admin-client";
export async function gatewayIsEnabled(): Promise {
test.skip(
!(await gatewayCheck(adminClient)),
- "Skipping tests because they payment gateway is not enabled."
+ "Skipping tests because they payment gateway is not enabled.",
);
}
diff --git a/examples/basic/src/components/header/cart/CartMenu.tsx b/examples/basic/src/components/header/cart/CartMenu.tsx
index ae7dfa52..bc315b94 100644
--- a/examples/basic/src/components/header/cart/CartMenu.tsx
+++ b/examples/basic/src/components/header/cart/CartMenu.tsx
@@ -1,125 +1,48 @@
-import Link from "next/link";
-import ModalCartItems from "./ModalCartItem";
-import {
- CartState,
- getPresentCartState,
- RefinedCartItem,
- useCart,
-} from "@elasticpath/react-shopper-hooks";
-import { Popover, Transition } from "@headlessui/react";
-import { Fragment } from "react";
-import { ReadonlyNonEmptyArray } from "@elasticpath/react-shopper-hooks/dist/shared/types/read-only-non-empty-array";
-import CartUpdatingSpinner from "./CartUpdatingSpinner";
+import { test, expect } from "@playwright/test";
+import { gateway } from "@moltin/sdk";
-export default function CartMenu(): JSX.Element {
- const { state } = useCart();
+const host = process.env.NEXT_PUBLIC_EPCC_ENDPOINT_URL;
+const client_id = process.env.NEXT_PUBLIC_EPCC_CLIENT_ID;
- const stateItems = resolveStateCartItems(state);
+const client = gateway({
+ client_id,
+ host,
+});
- function resolveStateCartItems(
- state: CartState,
- ): ReadonlyNonEmptyArray | undefined {
- const presentCartState = getPresentCartState(state);
- return presentCartState && presentCartState.items;
+test("should be able to use quick view to view full product details", async ({
+ page,
+ isMobile,
+}) => {
+ /* Go to home page */
+ await page.goto("/");
+
+ /* Get the cart id from the cookie */
+ const allCookies = await page.context().cookies();
+ const cartId = allCookies.find((cookie) => cookie.name === "_store_ep_cart")
+ ?.value;
+
+ /* Mobile - open hamburger menu */
+ if (isMobile) {
+ await page.getByRole("button", { name: "Menu" }).click();
}
- return (
-
- {/* Headless */}
-
- {({ close }) => (
- <>
-
- {(state.kind === "updating-cart-state" ||
- state.kind === "loading-cart-state" ||
- state.kind === "uninitialised-cart-state") && (
-
-
-
- )}
- {state.kind === "present-cart-state" && (
-
- {stateItems?.length}
-
- )}
-
-
-
-
+ /* Select the Men's / T-Shirts menu option */
+ await page.getByRole("button", { name: "Men's", exact: true }).click();
+ await page.getByRole("menuitem", { name: "T-Shirts", exact: true }).click();
-
-
-
-
-
- >
- )}
-
-
- );
-}
+ /* Check to make sure the page has navigated to the product list page for Men's / T-Shirts */
+ await expect(page).toHaveURL("/search/menswear/shirts/t-shirts");
-function CartPopoverFooter({
- state,
- onClose,
-}: {
- state: CartState;
- onClose: () => void;
-}): JSX.Element {
- const checkoutHref =
- state.kind === "present-cart-state" ? `/checkout/${state.id}` : "#";
- const hasCartItems = state.kind === "present-cart-state";
- return (
-
-
- onClose()}
- >
- Checkout
-
-
-
- onClose()}
- >
- View cart
-
-
-
- );
-}
+ await page
+ .getByTestId("2f435914-03b5-4b9e-80cb-08d3baa4c1d3")
+ .getByRole("button", { name: "Quick View" })
+ .click();
+
+ await page.getByRole("link", { name: "View full details" }).click();
+ /* Check to make sure the page has navigated to the product details page for Simple T-Shirt */
+ await page.waitForURL("/products/2f435914-03b5-4b9e-80cb-08d3baa4c1d3");
+ await expect(page).toHaveURL(
+ "/products/2f435914-03b5-4b9e-80cb-08d3baa4c1d3",
+ );
+});
diff --git a/examples/basic/src/lib/resolve-ep-stripe-env.ts b/examples/basic/src/lib/resolve-ep-stripe-env.ts
index 35c2df40..66f8e0bc 100644
--- a/examples/basic/src/lib/resolve-ep-stripe-env.ts
+++ b/examples/basic/src/lib/resolve-ep-stripe-env.ts
@@ -11,7 +11,7 @@ function retrieveStripePublishableKey(): string {
const stripePublishableKey = process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY;
if (!stripePublishableKey) {
throw new Error(
- `Failed to get stripe instance. Make sure you have set NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`
+ `Failed to get stripe instance. Make sure you have set NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`,
);
}
return stripePublishableKey;
@@ -21,7 +21,7 @@ function retrieveStripeAccountId(): string {
const stripeAccountId = process.env.NEXT_PUBLIC_STRIPE_ACCOUNT_ID;
if (!stripeAccountId) {
throw new Error(
- `Failed to get stripe instance. Make sure you have set NEXT_PUBLIC_STRIPE_ACCOUNT_ID`
+ `Failed to get stripe instance. Make sure you have set NEXT_PUBLIC_STRIPE_ACCOUNT_ID`,
);
}
return stripeAccountId;
diff --git a/examples/basic/src/lib/sort-alphabetically.ts b/examples/basic/src/lib/sort-alphabetically.ts
index 35118174..a69ce476 100644
--- a/examples/basic/src/lib/sort-alphabetically.ts
+++ b/examples/basic/src/lib/sort-alphabetically.ts
@@ -1,4 +1,4 @@
export const sortAlphabetically = (
a: { name: string },
- b: { name: string }
+ b: { name: string },
): number => a.name.localeCompare(b.name);
diff --git a/examples/basic/src/services/checkout.ts b/examples/basic/src/services/checkout.ts
index 2dbed4b4..2bfeeb60 100644
--- a/examples/basic/src/services/checkout.ts
+++ b/examples/basic/src/services/checkout.ts
@@ -13,7 +13,7 @@ export function checkout(
customer: CheckoutCustomerObject,
billing: Partial,
shipping: Partial,
- client?: EPCCClient
+ client?: EPCCClient,
): Promise<{ data: Order }> {
return (client ?? getEpccImplicitClient())
.Cart(id)
@@ -23,7 +23,7 @@ export function checkout(
export function makePayment(
payment: PaymentRequestBody,
orderId: string,
- client?: EPCCClient
+ client?: EPCCClient,
): Promise {
return (client ?? getEpccImplicitClient()).Orders.Payment(orderId, payment);
}
@@ -31,11 +31,11 @@ export function makePayment(
export function confirmOrder(
orderId: string,
transactionId: string,
- client?: EPCCClient
+ client?: EPCCClient,
): Promise {
return (client ?? getEpccImplicitClient()).Orders.Confirm(
orderId,
transactionId,
- { data: {} }
+ { data: {} },
);
}