File tree 27 files changed +50
-29
lines changed
27 files changed +50
-29
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { ACCOUNT_MEMBER_TOKEN_COOKIE_NAME } from "../../lib/cookie-constants";
7
7
import { retrieveAccountMemberCredentials } from "../../lib/retrieve-account-member-credentials" ;
8
8
import { revalidatePath , revalidateTag } from "next/cache" ;
9
9
import { getErrorMessage } from "../../lib/get-error-message" ;
10
- import { createElasticPathClient } from "../(store)/membership /create-elastic-path-client" ;
10
+ import { createElasticPathClient } from "../../lib /create-elastic-path-client" ;
11
11
import { postV2AccountMembersTokens } from "@epcc-sdk/sdks-shopper" ;
12
12
import { createCookieFromGenerateTokenResponse } from "../../lib/create-cookie-from-generate-token-response" ;
13
13
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { ReactNode } from "react";
3
3
import { getStoreInitialState } from "../../lib/get-store-initial-state" ;
4
4
import { Providers } from "../providers" ;
5
5
import clsx from "clsx" ;
6
- import { createElasticPathClient } from "../(store)/membership /create-elastic-path-client" ;
6
+ import { createElasticPathClient } from "../../lib /create-elastic-path-client" ;
7
7
8
8
const SITE_NAME = process . env . NEXT_PUBLIC_SITE_NAME ;
9
9
const baseUrl = process . env . NEXT_PUBLIC_VERCEL_URL
Original file line number Diff line number Diff line change 9
9
getV2AccountMembersAccountMemberId ,
10
10
ResponseCurrency ,
11
11
} from "@epcc-sdk/sdks-shopper" ;
12
- import { createElasticPathClient } from "../../(store)/membership /create-elastic-path-client" ;
12
+ import { createElasticPathClient } from "../../../lib /create-elastic-path-client" ;
13
13
import { getCart } from "@epcc-sdk/sdks-shopper" ;
14
14
import { TAGS } from "../../../lib/constants" ;
15
15
import { AccountCheckoutForm } from "./AccoutCheckoutForm" ;
Original file line number Diff line number Diff line change 6
6
CheckoutForm ,
7
7
checkoutFormSchema ,
8
8
} from "../../../components/checkout/form-schema/checkout-form-schema" ;
9
- import { createElasticPathClient } from "../../(store)/membership /create-elastic-path-client" ;
9
+ import { createElasticPathClient } from "../../../lib /create-elastic-path-client" ;
10
10
import {
11
11
manageCarts ,
12
12
checkoutApi ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { cookies } from "next/headers";
6
6
import { notFound } from "next/navigation" ;
7
7
import { CheckoutViews } from "./CheckoutViews" ;
8
8
import { getAllCurrencies , getCart } from "@epcc-sdk/sdks-shopper" ;
9
- import { createElasticPathClient } from "../../(store)/membership /create-elastic-path-client" ;
9
+ import { createElasticPathClient } from "../../../lib /create-elastic-path-client" ;
10
10
import { OrderConfirmationProvider } from "./OrderConfirmationProvider" ;
11
11
import { TAGS } from "../../../lib/constants" ;
12
12
import { isAccountAuthenticated } from "@epcc-sdk/sdks-nextjs" ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { ReactNode } from "react";
3
3
import { getStoreInitialState } from "../../lib/get-store-initial-state" ;
4
4
import { Providers } from "../providers" ;
5
5
import clsx from "clsx" ;
6
- import { createElasticPathClient } from "../(store)/membership /create-elastic-path-client" ;
6
+ import { createElasticPathClient } from "../../lib /create-elastic-path-client" ;
7
7
8
8
const SITE_NAME = process . env . NEXT_PUBLIC_SITE_NAME ;
9
9
const baseUrl = process . env . NEXT_PUBLIC_VERCEL_URL
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import { ArrowLeftIcon } from "@heroicons/react/24/outline";
11
11
import React from "react" ;
12
12
import { Separator } from "../../../../../components/separator/Separator" ;
13
13
import { UpdateForm } from "./UpdateForm" ;
14
- import { createElasticPathClient } from "../../../membership /create-elastic-path-client" ;
14
+ import { createElasticPathClient } from "../../../../../lib /create-elastic-path-client" ;
15
15
import { getV2AccountAddress } from "@epcc-sdk/sdks-shopper" ;
16
16
17
17
export const dynamic = "force-dynamic" ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { ACCOUNT_MEMBER_TOKEN_COOKIE_NAME } from "../../../../lib/cookie-constan
10
10
import { revalidatePath , revalidateTag } from "next/cache" ;
11
11
import { shippingAddressSchema } from "../../../../components/checkout/form-schema/checkout-form-schema" ;
12
12
import { redirect } from "next/navigation" ;
13
- import { createElasticPathClient } from "../../membership /create-elastic-path-client" ;
13
+ import { createElasticPathClient } from "../../../../lib /create-elastic-path-client" ;
14
14
import {
15
15
deleteV2AccountAddress ,
16
16
postV2AccountAddress ,
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import { Button } from "../../../../components/button/Button";
11
11
import { Separator } from "../../../../components/separator/Separator" ;
12
12
import React from "react" ;
13
13
import { DeleteAddressBtn } from "./DeleteAddressBtn" ;
14
- import { createElasticPathClient } from "../../membership /create-elastic-path-client" ;
14
+ import { createElasticPathClient } from "../../../../lib /create-elastic-path-client" ;
15
15
import { getV2AccountAddresses } from "@epcc-sdk/sdks-shopper" ;
16
16
import { TAGS } from "../../../../lib/constants" ;
17
17
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { ArrowLeftIcon } from "@heroicons/react/24/outline";
7
7
import Link from "next/link" ;
8
8
import { formatIsoDateString } from "../../../../../lib/format-iso-date-string" ;
9
9
import { OrderLineItem } from "./OrderLineItem" ;
10
- import { createElasticPathClient } from "../../../membership /create-elastic-path-client" ;
10
+ import { createElasticPathClient } from "../../../../../lib /create-elastic-path-client" ;
11
11
import {
12
12
getAnOrder ,
13
13
CartItemsObjectResponse ,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { retrieveAccountMemberCredentials } from "../../../../lib/retrieve-accou
5
5
import { ResourcePagination } from "../../../../components/pagination/ResourcePagination" ;
6
6
import { DEFAULT_PAGINATION_LIMIT , TAGS } from "../../../../lib/constants" ;
7
7
import { OrderItemWithDetails } from "./OrderItemWithDetails" ;
8
- import { createElasticPathClient } from "../../membership /create-elastic-path-client" ;
8
+ import { createElasticPathClient } from "../../../../lib /create-elastic-path-client" ;
9
9
import {
10
10
getByContextAllProducts ,
11
11
getCustomerOrders ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { retrieveAccountMemberCredentials } from "../../../../lib/retrieve-accou
6
6
import { ACCOUNT_MEMBER_TOKEN_COOKIE_NAME } from "../../../../lib/cookie-constants" ;
7
7
import { revalidatePath , revalidateTag } from "next/cache" ;
8
8
import { getErrorMessage } from "../../../../lib/get-error-message" ;
9
- import { createElasticPathClient } from "../../membership /create-elastic-path-client" ;
9
+ import { createElasticPathClient } from "../../../../lib /create-elastic-path-client" ;
10
10
import {
11
11
putV2AccountsAccountId ,
12
12
postV2AccountMembersTokens ,
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { Label } from "../../../../components/label/Label";
9
9
import { Input } from "../../../../components/input/Input" ;
10
10
import { FormStatusButton } from "../../../../components/button/FormStatusButton" ;
11
11
import { YourInfoForm } from "./YourInfoForm" ;
12
- import { createElasticPathClient } from "../../membership /create-elastic-path-client" ;
12
+ import { createElasticPathClient } from "../../../../lib /create-elastic-path-client" ;
13
13
import {
14
14
getV2AccountsAccountId ,
15
15
getV2AccountMembersAccountMemberId ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { LockClosedIcon } from "@heroicons/react/24/solid";
6
6
import { getCartItems , getByContextAllProducts } from "@epcc-sdk/sdks-shopper" ;
7
7
import { CART_COOKIE_NAME } from "../../../lib/cookie-constants" ;
8
8
import { cookies } from "next/headers" ;
9
- import { createElasticPathClient } from "../membership /create-elastic-path-client" ;
9
+ import { createElasticPathClient } from "../../../lib /create-elastic-path-client" ;
10
10
import { TAGS } from "../../../lib/constants" ;
11
11
12
12
export default async function CartPage ( ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { Providers } from "../providers";
5
5
import Header from "../../components/header/Header" ;
6
6
import { Toaster } from "../../components/toast/toaster" ;
7
7
import Footer from "../../components/footer/Footer" ;
8
- import { createElasticPathClient } from "./membership /create-elastic-path-client" ;
8
+ import { createElasticPathClient } from "../../lib /create-elastic-path-client" ;
9
9
10
10
const { SITE_NAME } = process . env ;
11
11
const baseUrl = process . env . NEXT_PUBLIC_VERCEL_URL
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
10
10
updateACartItem ,
11
11
} from "@epcc-sdk/sdks-shopper" ;
12
12
import { revalidateTag } from "next/cache" ;
13
- import { createElasticPathClient } from "../../../membership /create-elastic-path-client" ;
13
+ import { createElasticPathClient } from "../../../../../lib /create-elastic-path-client" ;
14
14
import { createBundleFormSchema } from "../../../../../components/product/bundles/validation-schema" ;
15
15
import { formSelectedOptionsToData } from "../../../../../components/product/bundles/form-parsers" ;
16
16
Original file line number Diff line number Diff line change 7
7
getAllFiles ,
8
8
ElasticPathFile ,
9
9
} from "@epcc-sdk/sdks-shopper" ;
10
- import { createElasticPathClient } from "../../membership /create-elastic-path-client" ;
10
+ import { createElasticPathClient } from "../../../../lib /create-elastic-path-client" ;
11
11
import { SimpleProductContent } from "../../../../components/product/standard/SimpleProductContent" ;
12
12
import { SimpleProductProvider } from "../../../../components/product/standard/SimpleProductProvider" ;
13
13
import { VariationProductProvider } from "../../../../components/product/variations/VariationProductProvider" ;
Original file line number Diff line number Diff line change 1
1
import { Search } from "../search" ;
2
2
import { Metadata } from "next" ;
3
3
import { notFound } from "next/navigation" ;
4
- import { createElasticPathClient } from "../../membership /create-elastic-path-client" ;
4
+ import { createElasticPathClient } from "../../../../lib /create-elastic-path-client" ;
5
5
import {
6
6
Client ,
7
7
getByContextAllHierarchies ,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { Events } from "../lib/event-context";
5
5
import { StoreProvider } from "./(store)/StoreProvider" ;
6
6
import { InitialState } from "../lib/get-store-initial-state" ;
7
7
import { ClientProvider } from "./(store)/ClientProvider" ;
8
- import { createElasticPathClient } from "./(store)/membership /create-elastic-path-client" ;
8
+ import { createElasticPathClient } from "../lib /create-elastic-path-client" ;
9
9
10
10
const queryClient = new QueryClient ( {
11
11
defaultOptions : {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { cookies } from "next/headers";
3
3
import { revalidateTag } from "next/cache" ;
4
4
import { z } from "zod" ;
5
5
import { getErrorMessage } from "../../lib/get-error-message" ;
6
- import { createElasticPathClient } from "../../app/(store)/membership /create-elastic-path-client" ;
6
+ import { createElasticPathClient } from "../../lib /create-elastic-path-client" ;
7
7
import { manageCarts } from "@epcc-sdk/sdks-shopper" ;
8
8
import { COOKIE_PREFIX_KEY } from "../../lib/cookie-constants" ;
9
9
@@ -15,9 +15,8 @@ export async function applyDiscount(formData: FormData) {
15
15
try {
16
16
const client = await createElasticPathClient ( ) ;
17
17
18
- const cartCookie = ( await cookies ( ) ) . get (
19
- `${ COOKIE_PREFIX_KEY } _ep_cart` ,
20
- ) ?. value ;
18
+ const cartCookie = ( await cookies ( ) ) . get ( `${ COOKIE_PREFIX_KEY } _ep_cart` )
19
+ ?. value ;
21
20
22
21
if ( ! cartCookie ) {
23
22
throw new Error ( "Cart cookie not found" ) ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import Link from "next/link";
4
4
import { ArrowRightIcon , EyeSlashIcon } from "@heroicons/react/24/outline" ;
5
5
import Image from "next/image" ;
6
6
import { fetchFeaturedProducts } from "./fetchFeaturedProducts" ;
7
- import { createElasticPathClient } from "../../app/(store)/membership /create-elastic-path-client" ;
7
+ import { createElasticPathClient } from "../../lib /create-elastic-path-client" ;
8
8
9
9
interface IFeaturedProductsProps {
10
10
title : string ;
Original file line number Diff line number Diff line change 1
1
import { AccountSwitcher } from "./AccountSwitcher" ;
2
2
import { AccountPopover } from "./AccountPopover" ;
3
3
import { getV2AccountMembersAccountMemberId } from "@epcc-sdk/sdks-shopper" ;
4
- import { createElasticPathClient } from "../../../app/(store)/membership /create-elastic-path-client" ;
4
+ import { createElasticPathClient } from "../../../lib /create-elastic-path-client" ;
5
5
import { retrieveAccountMemberCredentials } from "../../../lib/retrieve-account-member-credentials" ;
6
6
import { cookies } from "next/headers" ;
7
7
import { ACCOUNT_MEMBER_TOKEN_COOKIE_NAME } from "../../../lib/cookie-constants" ;
Original file line number Diff line number Diff line change 1
1
"use server" ;
2
2
3
3
import { CartSheet } from "../../cart/CartSheet" ;
4
- import { createElasticPathClient } from "../../../app/(store)/membership /create-elastic-path-client" ;
4
+ import { createElasticPathClient } from "../../../lib /create-elastic-path-client" ;
5
5
import { cookies } from "next/headers" ;
6
6
import { CART_COOKIE_NAME } from "../../../lib/cookie-constants" ;
7
7
import { getCart } from "@epcc-sdk/sdks-shopper" ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import EpIcon from "../../icons/ep-icon";
4
4
import { MobileNavBarButton } from "./MobileNavBarButton" ;
5
5
import { buildSiteNavigation } from "../../../lib/build-site-navigation" ;
6
6
import { CartSheet } from "../../cart/CartSheet" ;
7
- import { createElasticPathClient } from "../../../app/(store)/membership /create-elastic-path-client" ;
7
+ import { createElasticPathClient } from "../../../lib /create-elastic-path-client" ;
8
8
import { cookies } from "next/headers" ;
9
9
import {
10
10
ACCOUNT_MEMBER_TOKEN_COOKIE_NAME ,
Original file line number Diff line number Diff line change 1
1
"use server" ;
2
2
import { NavBarPopover } from "./NavBarPopover" ;
3
3
import { buildSiteNavigation } from "../../../lib/build-site-navigation" ;
4
- import { createElasticPathClient } from "../../../app/(store)/membership /create-elastic-path-client" ;
4
+ import { createElasticPathClient } from "../../../lib /create-elastic-path-client" ;
5
5
6
6
export default async function NavBar ( ) {
7
7
const client = await createElasticPathClient ( ) ;
Original file line number Diff line number Diff line change 1
- import { createElasticPathClient } from "../app/(store)/membership /create-elastic-path-client" ;
1
+ import { createElasticPathClient } from "./create-elastic-path-client" ;
2
2
3
3
export const client = createElasticPathClient ( ) ;
Original file line number Diff line number Diff line change
1
+ import { createClient } from "@epcc-sdk/sdks-shopper" ;
2
+ import { applyDefaultNextMiddleware } from "@epcc-sdk/sdks-nextjs" ;
3
+
4
+ export function createElasticPathClient ( ) {
5
+ const localClient = createClient ( {
6
+ // set default base url for requests made by this client
7
+ baseUrl : `https://${ process . env . NEXT_PUBLIC_EPCC_ENDPOINT_URL } ` ,
8
+ } ) ;
9
+ applyDefaultNextMiddleware ( localClient ) ;
10
+ applyMultiLocationInventoryMiddleware ( localClient ) ;
11
+
12
+ return localClient ;
13
+ }
14
+
15
+ function applyMultiLocationInventoryMiddleware (
16
+ client : ReturnType < typeof createClient > ,
17
+ ) {
18
+ client . interceptors . request . use ( ( request ) => {
19
+ request . headers . set ( "EP-Inventories-Multi-Location" , "true" ) ;
20
+ return request ;
21
+ } ) ;
22
+ }
You can’t perform that action at this time.
0 commit comments