@gfed-medusa/sf-lib-common 2.3.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/breadcrumbs/index.d.ts +2 -2
- package/dist/components/cart-mismatch-banner/index.d.ts +2 -2
- package/dist/components/delete-button/index.d.ts +2 -2
- package/dist/components/delete-button/index.d.ts.map +1 -1
- package/dist/components/delete-button/index.js +2 -2
- package/dist/components/delete-button/index.js.map +1 -1
- package/dist/components/error-message/index.d.ts +2 -2
- package/dist/components/error-message/index.d.ts.map +1 -1
- package/dist/components/free-shipping-price-nudge/index.d.ts +4 -5
- package/dist/components/free-shipping-price-nudge/index.d.ts.map +1 -1
- package/dist/components/free-shipping-price-nudge/index.js +3 -3
- package/dist/components/free-shipping-price-nudge/index.js.map +1 -1
- package/dist/components/interactive-link/index.d.ts +2 -2
- package/dist/components/interactive-link/index.d.ts.map +1 -1
- package/dist/components/line-item-options/index.d.ts +2 -2
- package/dist/components/line-item-options/index.d.ts.map +1 -1
- package/dist/components/line-item-price/index.d.ts +2 -2
- package/dist/components/localized-client-link/index.d.ts +2 -2
- package/dist/components/localized-client-link/index.d.ts.map +1 -1
- package/dist/components/modal/index.d.ts +2 -2
- package/dist/components/preview-price/index.d.ts +2 -2
- package/dist/components/product-card/index.d.ts +2 -2
- package/dist/components/product-preview/index.d.ts +2 -2
- package/dist/components/submit-button/index.d.ts +2 -2
- package/dist/lib/context/apollo-context.d.ts +2 -2
- package/dist/lib/context/apollo-context.d.ts.map +1 -1
- package/dist/lib/context/modal-context.d.ts +2 -2
- package/dist/lib/context/modal-context.d.ts.map +1 -1
- package/dist/lib/data/cart.d.ts +2 -5
- package/dist/lib/data/cart.d.ts.map +1 -1
- package/dist/lib/data/cart.js +33 -22
- package/dist/lib/data/cart.js.map +1 -1
- package/dist/lib/data/context.d.ts +7 -7
- package/dist/lib/data/context.d.ts.map +1 -1
- package/dist/lib/data/context.js +19 -2
- package/dist/lib/data/context.js.map +1 -1
- package/dist/lib/data/cookies-utils.d.ts +1 -4
- package/dist/lib/data/cookies-utils.d.ts.map +1 -1
- package/dist/lib/data/cookies-utils.js +1 -6
- package/dist/lib/data/cookies-utils.js.map +1 -1
- package/dist/lib/data/customer.js +2 -4
- package/dist/lib/data/customer.js.map +1 -1
- package/dist/lib/data/footer.d.ts +2 -59
- package/dist/lib/data/footer.d.ts.map +1 -1
- package/dist/lib/data/next-context.js +0 -1
- package/dist/lib/data/next-context.js.map +1 -1
- package/dist/lib/data/orders.d.ts +1 -1
- package/dist/lib/data/orders.d.ts.map +1 -1
- package/dist/lib/data/orders.js +12 -13
- package/dist/lib/data/orders.js.map +1 -1
- package/dist/lib/data/regions.d.ts +2 -1
- package/dist/lib/data/regions.d.ts.map +1 -1
- package/dist/lib/data/regions.js +17 -11
- package/dist/lib/data/regions.js.map +1 -1
- package/dist/lib/globals/expose-globals.js +2 -2
- package/dist/lib/gql/apollo-client.d.ts.map +1 -1
- package/dist/lib/gql/apollo-client.js +4 -4
- package/dist/lib/gql/apollo-client.js.map +1 -1
- package/dist/lib/gql/fragments/cart.d.ts +9 -9
- package/dist/lib/gql/fragments/cart.d.ts.map +1 -1
- package/dist/lib/gql/fragments/customer.d.ts +3 -3
- package/dist/lib/gql/fragments/customer.d.ts.map +1 -1
- package/dist/lib/gql/fragments/product.d.ts +8 -8
- package/dist/lib/gql/mutations/cart.d.ts +7 -5
- package/dist/lib/gql/mutations/cart.d.ts.map +1 -1
- package/dist/lib/gql/mutations/cart.js +22 -2
- package/dist/lib/gql/mutations/cart.js.map +1 -1
- package/dist/lib/gql/queries/cart.d.ts +2 -2
- package/dist/lib/gql/queries/collections.d.ts +2 -2
- package/dist/lib/gql/queries/customer.d.ts +2 -2
- package/dist/lib/gql/queries/footer.d.ts +2 -2
- package/dist/lib/gql/queries/footer.d.ts.map +1 -1
- package/dist/lib/gql/queries/order.d.ts +9 -0
- package/dist/lib/gql/queries/order.d.ts.map +1 -0
- package/dist/lib/gql/queries/order.js +103 -0
- package/dist/lib/gql/queries/order.js.map +1 -0
- package/dist/lib/gql/queries/product.d.ts +3 -3
- package/dist/lib/gql/queries/product.d.ts.map +1 -1
- package/dist/lib/gql/queries/regions.d.ts +8 -0
- package/dist/lib/gql/queries/regions.d.ts.map +1 -0
- package/dist/lib/gql/queries/regions.js +39 -0
- package/dist/lib/gql/queries/regions.js.map +1 -0
- package/dist/lib/gql/queries/shipping.d.ts +8 -0
- package/dist/lib/gql/queries/shipping.d.ts.map +1 -0
- package/dist/lib/gql/queries/shipping.js +48 -0
- package/dist/lib/gql/queries/shipping.js.map +1 -0
- package/dist/lib/hooks/use-apollo.d.ts +2 -2
- package/dist/lib/hooks/use-apollo.d.ts.map +1 -1
- package/dist/lib/hooks/use-cart.d.ts +1 -2
- package/dist/lib/hooks/use-cart.d.ts.map +1 -1
- package/dist/lib/hooks/use-cart.js +9 -5
- package/dist/lib/hooks/use-cart.js.map +1 -1
- package/dist/types/cms.d.ts +85 -0
- package/dist/types/cms.d.ts.map +1 -0
- package/dist/types/cms.js +0 -0
- package/dist/types/graphql.d.ts +466 -481
- package/dist/types/graphql.d.ts.map +1 -1
- package/dist/types/graphql.js +3736 -7495
- package/dist/types/graphql.js.map +1 -1
- package/dist/types/prices.d.ts +5 -2
- package/package.json +3 -3
package/dist/lib/data/context.js
CHANGED
|
@@ -3,12 +3,29 @@
|
|
|
3
3
|
import { useStorefrontActions } from "./client-actions.js";
|
|
4
4
|
import { createContext, useContext } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import useSWR from "swr";
|
|
6
7
|
|
|
7
8
|
//#region src/lib/data/context.tsx
|
|
8
|
-
const StorefrontReactContext = createContext({
|
|
9
|
+
const StorefrontReactContext = createContext({
|
|
10
|
+
cartId: "",
|
|
11
|
+
cacheId: ""
|
|
12
|
+
});
|
|
13
|
+
const fetchContext = async () => {
|
|
14
|
+
const response = await fetch("/api/context", { credentials: "include" });
|
|
15
|
+
if (!response.ok) throw new Error("Failed to fetch context");
|
|
16
|
+
return response.json();
|
|
17
|
+
};
|
|
9
18
|
const StorefrontProvider = ({ children, value }) => {
|
|
19
|
+
const { data: fetchedContext } = useSWR(value ? null : "storefront-context", fetchContext, {
|
|
20
|
+
revalidateOnFocus: true,
|
|
21
|
+
revalidateOnReconnect: true
|
|
22
|
+
});
|
|
23
|
+
const contextValue = value ?? {
|
|
24
|
+
cartId: fetchedContext?.cartId ?? "",
|
|
25
|
+
cacheId: fetchedContext?.cacheId ?? ""
|
|
26
|
+
};
|
|
10
27
|
return /* @__PURE__ */ jsx(StorefrontReactContext.Provider, {
|
|
11
|
-
value,
|
|
28
|
+
value: contextValue,
|
|
12
29
|
children
|
|
13
30
|
});
|
|
14
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":[],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nexport interface StorefrontContext {\n cartId: string;\n
|
|
1
|
+
{"version":3,"file":"context.js","names":["contextValue: StorefrontContext"],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nimport useSWR from 'swr';\n\nexport interface StorefrontContext {\n cartId: string;\n cacheId: string;\n cookieHeader?: string;\n}\n\ninterface ClientContext {\n cartId: string;\n cacheId: string;\n}\n\nconst StorefrontReactContext = createContext<StorefrontContext>({\n cartId: '',\n cacheId: '',\n});\n\nconst fetchContext = async (): Promise<ClientContext> => {\n const response = await fetch('/api/context', {\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch context');\n }\n\n return response.json();\n};\n\ninterface StorefrontProviderProps {\n children: ReactNode;\n value?: StorefrontContext;\n}\n\nexport const StorefrontProvider = ({\n children,\n value,\n}: StorefrontProviderProps) => {\n // If value is provided (host apps), use it directly\n // If no value (horizontal components), fetch from API\n const { data: fetchedContext } = useSWR<ClientContext>(\n value ? null : 'storefront-context',\n fetchContext,\n {\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n }\n );\n\n const contextValue: StorefrontContext = value ?? {\n cartId: fetchedContext?.cartId ?? '',\n cacheId: fetchedContext?.cacheId ?? '',\n };\n\n return (\n <StorefrontReactContext.Provider value={contextValue}>\n {children}\n </StorefrontReactContext.Provider>\n );\n};\n\nexport const useStorefrontContext = () => useContext(StorefrontReactContext);\nexport { useStorefrontActions } from './client-actions';\n"],"mappings":";;;;;;;;AAiBA,MAAM,yBAAyB,cAAiC;CAC9D,QAAQ;CACR,SAAS;CACV,CAAC;AAEF,MAAM,eAAe,YAAoC;CACvD,MAAM,WAAW,MAAM,MAAM,gBAAgB,EAC3C,aAAa,WACd,CAAC;AAEF,KAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,0BAA0B;AAG5C,QAAO,SAAS,MAAM;;AAQxB,MAAa,sBAAsB,EACjC,UACA,YAC6B;CAG7B,MAAM,EAAE,MAAM,mBAAmB,OAC/B,QAAQ,OAAO,sBACf,cACA;EACE,mBAAmB;EACnB,uBAAuB;EACxB,CACF;CAED,MAAMA,eAAkC,SAAS;EAC/C,QAAQ,gBAAgB,UAAU;EAClC,SAAS,gBAAgB,WAAW;EACrC;AAED,QACE,oBAAC,uBAAuB;EAAS,OAAO;EACrC;GAC+B;;AAItC,MAAa,6BAA6B,WAAW,uBAAuB"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { StorefrontContext } from "./context.js";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/data/cookies-utils.d.ts
|
|
4
|
-
declare const getAuthHeaders: (ctx: StorefrontContext) => {
|
|
5
|
-
authorization: string;
|
|
6
|
-
} | {};
|
|
7
4
|
declare const getCacheTag: (tag: string, ctx: StorefrontContext) => string;
|
|
8
5
|
declare const getCacheOptions: (tag: string, ctx: StorefrontContext) => {
|
|
9
6
|
tags: string[];
|
|
10
7
|
} | {};
|
|
11
8
|
declare const getCartId: (ctx: StorefrontContext) => string;
|
|
12
9
|
//#endregion
|
|
13
|
-
export {
|
|
10
|
+
export { getCacheOptions, getCacheTag, getCartId };
|
|
14
11
|
//# sourceMappingURL=cookies-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies-utils.d.ts","names":[],"sources":["../../../src/lib/data/cookies-utils.ts"],"sourcesContent":[],"mappings":";;;cAEa,
|
|
1
|
+
{"version":3,"file":"cookies-utils.d.ts","names":[],"sources":["../../../src/lib/data/cookies-utils.ts"],"sourcesContent":[],"mappings":";;;cAEa,gCAAiC;cAUjC,oCAEN;EAZM,IAAA,EAAA,MAAA,EAQZ;AAED,CAAA,GAAa,CAAA,CAAA;AAiBA,cAAA,SAAkB,EAAA,CAAA,GAAA,EAAA,iBAAiB,EAAA,GAAA,MAAA"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
//#region src/lib/data/cookies-utils.ts
|
|
2
|
-
const getAuthHeaders = (ctx) => {
|
|
3
|
-
const token = ctx.customerToken;
|
|
4
|
-
if (!token) return {};
|
|
5
|
-
return { authorization: `Bearer ${token}` };
|
|
6
|
-
};
|
|
7
2
|
const getCacheTag = (tag, ctx) => {
|
|
8
3
|
const cacheId = ctx.cacheId;
|
|
9
4
|
if (!cacheId) return "";
|
|
@@ -20,5 +15,5 @@ const getCartId = (ctx) => {
|
|
|
20
15
|
};
|
|
21
16
|
|
|
22
17
|
//#endregion
|
|
23
|
-
export {
|
|
18
|
+
export { getCacheOptions, getCacheTag, getCartId };
|
|
24
19
|
//# sourceMappingURL=cookies-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies-utils.js","names":[],"sources":["../../../src/lib/data/cookies-utils.ts"],"sourcesContent":["import type { StorefrontContext } from './context';\n\nexport const
|
|
1
|
+
{"version":3,"file":"cookies-utils.js","names":[],"sources":["../../../src/lib/data/cookies-utils.ts"],"sourcesContent":["import type { StorefrontContext } from './context';\n\nexport const getCacheTag = (tag: string, ctx: StorefrontContext): string => {\n const cacheId = ctx.cacheId;\n\n if (!cacheId) {\n return '';\n }\n\n return `${tag}-${cacheId}`;\n};\n\nexport const getCacheOptions = (\n tag: string,\n ctx: StorefrontContext\n): { tags: string[] } | {} => {\n if (typeof window !== 'undefined') {\n return {};\n }\n\n const cacheTag = getCacheTag(tag, ctx);\n\n if (!cacheTag) {\n return {};\n }\n\n return { tags: [`${cacheTag}`] };\n};\n\nexport const getCartId = (ctx: StorefrontContext) => {\n return ctx.cartId;\n};\n"],"mappings":";AAEA,MAAa,eAAe,KAAa,QAAmC;CAC1E,MAAM,UAAU,IAAI;AAEpB,KAAI,CAAC,QACH,QAAO;AAGT,QAAO,GAAG,IAAI,GAAG;;AAGnB,MAAa,mBACX,KACA,QAC4B;AAC5B,KAAI,OAAO,WAAW,YACpB,QAAO,EAAE;CAGX,MAAM,WAAW,YAAY,KAAK,IAAI;AAEtC,KAAI,CAAC,SACH,QAAO,EAAE;AAGX,QAAO,EAAE,MAAM,CAAC,GAAG,WAAW,EAAE;;AAGlC,MAAa,aAAa,QAA2B;AACnD,QAAO,IAAI"}
|
|
@@ -6,8 +6,7 @@ import { GET_CUSTOMER_QUERY } from "../gql/queries/customer.js";
|
|
|
6
6
|
|
|
7
7
|
//#region src/lib/data/customer.ts
|
|
8
8
|
const transferCart = async (ctx) => {
|
|
9
|
-
const
|
|
10
|
-
const apolloClient = createServerApolloClient(cookieHeader);
|
|
9
|
+
const apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
|
|
11
10
|
const cartId = getCartId(ctx);
|
|
12
11
|
if (!cartId) return null;
|
|
13
12
|
try {
|
|
@@ -26,8 +25,7 @@ const transferCart = async (ctx) => {
|
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
27
|
const retrieveCustomer = async (ctx) => {
|
|
29
|
-
const
|
|
30
|
-
const apolloClient = createServerApolloClient(cookieHeader);
|
|
28
|
+
const apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
|
|
31
29
|
try {
|
|
32
30
|
return await graphqlFetch({
|
|
33
31
|
query: GET_CUSTOMER_QUERY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","names":[],"sources":["../../../src/lib/data/customer.ts"],"sourcesContent":["import {\n Customer,\n GetCustomerQuery,\n GetCustomerQueryVariables,\n TransferCartMutation,\n TransferCartMutationVariables,\n} from '../../types/graphql';\nimport {\n createServerApolloClient,\n graphqlFetch,\n graphqlMutation,\n} from '../gql/apollo-client';\nimport { TRANSFER_CART_MUTATION } from '../gql/mutations/cart';\nimport { GET_CUSTOMER_QUERY } from '../gql/queries/customer';\nimport { medusaError } from '../utils/medusa-error';\nimport type { StorefrontContext } from './context';\nimport { getCacheTag, getCartId } from './cookies-utils';\n\nexport const transferCart = async (\n ctx: StorefrontContext\n): Promise<TransferCartMutation['transferCart'] | null> => {\n const cookieHeader = ctx.cookieHeader;\n const apolloClient = createServerApolloClient(cookieHeader);\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n return null;\n }\n\n try {\n const result = await graphqlMutation<\n TransferCartMutation,\n TransferCartMutationVariables\n >(\n {\n mutation: TRANSFER_CART_MUTATION,\n variables: {\n cartId,\n },\n },\n apolloClient\n );\n\n const cart = result?.transferCart ?? null;\n\n if (cart) {\n try {\n const { revalidateTag } = await import('next/cache');\n const cartCacheTag = getCacheTag('carts', ctx);\n revalidateTag(cartCacheTag);\n } catch {\n // Not in Next.js environment\n }\n }\n\n return cart;\n } catch (err) {\n medusaError(err);\n return null;\n }\n};\n\nexport const retrieveCustomer = async (\n ctx: StorefrontContext\n): Promise<Customer | null> => {\n const cookieHeader = ctx.cookieHeader;\n const apolloClient = createServerApolloClient(cookieHeader);\n try {\n const customer = await graphqlFetch<\n GetCustomerQuery,\n GetCustomerQueryVariables\n >(\n {\n query: GET_CUSTOMER_QUERY,\n fetchPolicy: 'network-only',\n },\n apolloClient\n ).then((response) => response?.me ?? null);\n return customer;\n } catch {\n return null;\n }\n};\n"],"mappings":";;;;;;;AAkBA,MAAa,eAAe,OAC1B,QACyD;
|
|
1
|
+
{"version":3,"file":"customer.js","names":[],"sources":["../../../src/lib/data/customer.ts"],"sourcesContent":["import {\n Customer,\n GetCustomerQuery,\n GetCustomerQueryVariables,\n TransferCartMutation,\n TransferCartMutationVariables,\n} from '../../types/graphql';\nimport {\n createServerApolloClient,\n graphqlFetch,\n graphqlMutation,\n} from '../gql/apollo-client';\nimport { TRANSFER_CART_MUTATION } from '../gql/mutations/cart';\nimport { GET_CUSTOMER_QUERY } from '../gql/queries/customer';\nimport { medusaError } from '../utils/medusa-error';\nimport type { StorefrontContext } from './context';\nimport { getCacheTag, getCartId } from './cookies-utils';\n\nexport const transferCart = async (\n ctx: StorefrontContext\n): Promise<TransferCartMutation['transferCart'] | null> => {\n const cookieHeader = ctx.cookieHeader ?? '';\n const apolloClient = createServerApolloClient(cookieHeader);\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n return null;\n }\n\n try {\n const result = await graphqlMutation<\n TransferCartMutation,\n TransferCartMutationVariables\n >(\n {\n mutation: TRANSFER_CART_MUTATION,\n variables: {\n cartId,\n },\n },\n apolloClient\n );\n\n const cart = result?.transferCart ?? null;\n\n if (cart) {\n try {\n const { revalidateTag } = await import('next/cache');\n const cartCacheTag = getCacheTag('carts', ctx);\n revalidateTag(cartCacheTag);\n } catch {\n // Not in Next.js environment\n }\n }\n\n return cart;\n } catch (err) {\n medusaError(err);\n return null;\n }\n};\n\nexport const retrieveCustomer = async (\n ctx: StorefrontContext\n): Promise<Customer | null> => {\n const cookieHeader = ctx.cookieHeader ?? '';\n const apolloClient = createServerApolloClient(cookieHeader);\n try {\n const customer = await graphqlFetch<\n GetCustomerQuery,\n GetCustomerQueryVariables\n >(\n {\n query: GET_CUSTOMER_QUERY,\n fetchPolicy: 'network-only',\n },\n apolloClient\n ).then((response) => response?.me ?? null);\n return customer;\n } catch {\n return null;\n }\n};\n"],"mappings":";;;;;;;AAkBA,MAAa,eAAe,OAC1B,QACyD;CAEzD,MAAM,eAAe,yBADA,IAAI,gBAAgB,GACkB;CAC3D,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,QAAO;AAGT,KAAI;EAcF,MAAM,QAbS,MAAM,gBAInB;GACE,UAAU;GACV,WAAW,EACT,QACD;GACF,EACD,aACD,GAEoB,gBAAgB;AAErC,MAAI,KACF,KAAI;GACF,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,iBADqB,YAAY,SAAS,IAAI,CACnB;UACrB;AAKV,SAAO;UACA,KAAK;AACZ,cAAY,IAAI;AAChB,SAAO;;;AAIX,MAAa,mBAAmB,OAC9B,QAC6B;CAE7B,MAAM,eAAe,yBADA,IAAI,gBAAgB,GACkB;AAC3D,KAAI;AAWF,SAViB,MAAM,aAIrB;GACE,OAAO;GACP,aAAa;GACd,EACD,aACD,CAAC,MAAM,aAAa,UAAU,MAAM,KAAK;SAEpC;AACN,SAAO"}
|
|
@@ -9,65 +9,8 @@ declare const getFooterContent: () => Promise<{
|
|
|
9
9
|
url: string;
|
|
10
10
|
}> | null;
|
|
11
11
|
poweredByCta?: {
|
|
12
|
-
__typename?: "
|
|
13
|
-
text
|
|
14
|
-
__typename?: "FileBlock";
|
|
15
|
-
_key: string;
|
|
16
|
-
_type: string;
|
|
17
|
-
asset?: {
|
|
18
|
-
__typename?: "SanityFileAsset";
|
|
19
|
-
url: string;
|
|
20
|
-
originalFilename?: string | null;
|
|
21
|
-
size?: number | null;
|
|
22
|
-
mimeType?: string | null;
|
|
23
|
-
} | null;
|
|
24
|
-
} | {
|
|
25
|
-
__typename?: "ImageBlock";
|
|
26
|
-
_key: string;
|
|
27
|
-
_type: string;
|
|
28
|
-
alt?: string | null;
|
|
29
|
-
asset?: {
|
|
30
|
-
__typename?: "SanityImageAsset";
|
|
31
|
-
url: string;
|
|
32
|
-
} | null;
|
|
33
|
-
} | {
|
|
34
|
-
__typename?: "TextBlock";
|
|
35
|
-
_key: string;
|
|
36
|
-
_type: string;
|
|
37
|
-
style?: string | null;
|
|
38
|
-
children: Array<{
|
|
39
|
-
__typename?: "Span";
|
|
40
|
-
_key: string;
|
|
41
|
-
text: string;
|
|
42
|
-
marks?: Array<string> | null;
|
|
43
|
-
}>;
|
|
44
|
-
markDefs?: Array<{
|
|
45
|
-
__typename?: "IconLinkMark";
|
|
46
|
-
_key: string;
|
|
47
|
-
_type: string;
|
|
48
|
-
href: string;
|
|
49
|
-
iconType: string;
|
|
50
|
-
iconClass?: string | null;
|
|
51
|
-
iconFill?: string | null;
|
|
52
|
-
iconComponent?: string | null;
|
|
53
|
-
iconUrl?: string | null;
|
|
54
|
-
target?: string | null;
|
|
55
|
-
iconImage?: {
|
|
56
|
-
__typename?: "SanityImage";
|
|
57
|
-
alt?: string | null;
|
|
58
|
-
asset?: {
|
|
59
|
-
__typename?: "SanityImageAsset";
|
|
60
|
-
url: string;
|
|
61
|
-
} | null;
|
|
62
|
-
} | null;
|
|
63
|
-
} | {
|
|
64
|
-
__typename?: "LinkMark";
|
|
65
|
-
_key: string;
|
|
66
|
-
_type: string;
|
|
67
|
-
href: string;
|
|
68
|
-
target?: string | null;
|
|
69
|
-
}> | null;
|
|
70
|
-
}>;
|
|
12
|
+
__typename?: "PartialRichText";
|
|
13
|
+
text?: any | null;
|
|
71
14
|
} | null;
|
|
72
15
|
} | null>;
|
|
73
16
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","names":[],"sources":["../../../src/lib/data/footer.ts"],"sourcesContent":[],"mappings":";cAIa,wBAAgB;EAAhB,UAAA,CAAA,EAAA,QAUZ
|
|
1
|
+
{"version":3,"file":"footer.d.ts","names":[],"sources":["../../../src/lib/data/footer.ts"],"sourcesContent":[],"mappings":";cAIa,wBAAgB;EAAhB,UAAA,CAAA,EAAA,QAUZ;;;WAAA"}
|
|
@@ -7,7 +7,6 @@ const resolveNextContext = async () => {
|
|
|
7
7
|
const cookieStore = await cookies();
|
|
8
8
|
return {
|
|
9
9
|
cartId: cookieStore.get("_medusa_cart_id")?.value ?? "",
|
|
10
|
-
customerToken: cookieStore.get("_medusa_jwt")?.value ?? "",
|
|
11
10
|
cacheId: cookieStore.get("_medusa_cache_id")?.value ?? "",
|
|
12
11
|
cookieHeader: cookieStore.toString()
|
|
13
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-context.js","names":[],"sources":["../../../src/lib/data/next-context.ts"],"sourcesContent":["'use server';\n\nimport { revalidateTag } from 'next/cache';\nimport { cookies } from 'next/headers';\nimport { redirect } from 'next/navigation';\n\nimport { updateCart } from './cart';\nimport { StorefrontContext } from './context';\nimport { getCacheTag, getCartId } from './cookies-utils';\nimport { getRegion } from './regions';\n\nexport const resolveNextContext = async (): Promise<StorefrontContext> => {\n const cookieStore = await cookies();\n\n return {\n cartId: cookieStore.get('_medusa_cart_id')?.value ?? '',\n
|
|
1
|
+
{"version":3,"file":"next-context.js","names":[],"sources":["../../../src/lib/data/next-context.ts"],"sourcesContent":["'use server';\n\nimport { revalidateTag } from 'next/cache';\nimport { cookies } from 'next/headers';\nimport { redirect } from 'next/navigation';\n\nimport { updateCart } from './cart';\nimport { StorefrontContext } from './context';\nimport { getCacheTag, getCartId } from './cookies-utils';\nimport { getRegion } from './regions';\n\nexport const resolveNextContext = async (): Promise<StorefrontContext> => {\n const cookieStore = await cookies();\n\n return {\n cartId: cookieStore.get('_medusa_cart_id')?.value ?? '',\n cacheId: cookieStore.get('_medusa_cache_id')?.value ?? '',\n cookieHeader: cookieStore.toString(),\n };\n};\n"],"mappings":";;;;;AAWA,MAAa,qBAAqB,YAAwC;CACxE,MAAM,cAAc,MAAM,SAAS;AAEnC,QAAO;EACL,QAAQ,YAAY,IAAI,kBAAkB,EAAE,SAAS;EACrD,SAAS,YAAY,IAAI,mBAAmB,EAAE,SAAS;EACvD,cAAc,YAAY,UAAU;EACrC"}
|
|
@@ -2,7 +2,7 @@ import { Order } from "../../types/graphql.js";
|
|
|
2
2
|
import { StorefrontContext } from "./context.js";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/data/orders.d.ts
|
|
5
|
-
declare const retrieveOrder: (id: string, ctx: StorefrontContext) => Promise<Order>;
|
|
5
|
+
declare const retrieveOrder: (id: string, ctx: StorefrontContext) => Promise<Order | null>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { retrieveOrder };
|
|
8
8
|
//# sourceMappingURL=orders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.d.ts","names":[],"sources":["../../../src/lib/data/orders.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"orders.d.ts","names":[],"sources":["../../../src/lib/data/orders.ts"],"sourcesContent":[],"mappings":";;;;cAUa,iCAEN,sBACJ,QAAQ"}
|
package/dist/lib/data/orders.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getAuthHeaders, getCacheOptions } from "./cookies-utils.js";
|
|
4
|
-
import { normalizeOrder } from "../utils/normalize-functions.js";
|
|
1
|
+
import { createServerApolloClient, graphqlFetch } from "../gql/apollo-client.js";
|
|
2
|
+
import { GET_ORDER_QUERY } from "../gql/queries/order.js";
|
|
5
3
|
|
|
6
4
|
//#region src/lib/data/orders.ts
|
|
7
5
|
const retrieveOrder = async (id, ctx) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
const apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
|
|
7
|
+
try {
|
|
8
|
+
return (await graphqlFetch({
|
|
9
|
+
query: GET_ORDER_QUERY,
|
|
10
|
+
variables: { id }
|
|
11
|
+
}, apolloClient))?.order ?? null;
|
|
12
|
+
} catch (err) {
|
|
13
|
+
console.error("Failed to fetch order:", err);
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.js","names":[],"sources":["../../../src/lib/data/orders.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"orders.js","names":[],"sources":["../../../src/lib/data/orders.ts"],"sourcesContent":["import {\n GetOrderQuery,\n GetOrderQueryVariables,\n Order,\n} from '@/types/graphql';\n\nimport { createServerApolloClient, graphqlFetch } from '../gql/apollo-client';\nimport { GET_ORDER_QUERY } from '../gql/queries/order';\nimport { StorefrontContext } from './context';\n\nexport const retrieveOrder = async (\n id: string,\n ctx: StorefrontContext\n): Promise<Order | null> => {\n const apolloClient = createServerApolloClient(ctx.cookieHeader ?? '');\n try {\n const data = await graphqlFetch<GetOrderQuery, GetOrderQueryVariables>(\n { query: GET_ORDER_QUERY, variables: { id } },\n apolloClient\n );\n return data?.order ?? null;\n } catch (err) {\n console.error('Failed to fetch order:', err);\n return null;\n }\n};\n"],"mappings":";;;;AAUA,MAAa,gBAAgB,OAC3B,IACA,QAC0B;CAC1B,MAAM,eAAe,yBAAyB,IAAI,gBAAgB,GAAG;AACrE,KAAI;AAKF,UAJa,MAAM,aACjB;GAAE,OAAO;GAAiB,WAAW,EAAE,IAAI;GAAE,EAC7C,aACD,GACY,SAAS;UACf,KAAK;AACZ,UAAQ,MAAM,0BAA0B,IAAI;AAC5C,SAAO"}
|
|
@@ -3,7 +3,8 @@ import { StorefrontContext } from "./context.js";
|
|
|
3
3
|
|
|
4
4
|
//#region src/lib/data/regions.d.ts
|
|
5
5
|
declare const listRegions: (ctx: StorefrontContext) => Promise<Region[]>;
|
|
6
|
+
declare const retrieveRegion: (id: string, ctx: StorefrontContext) => Promise<Region | null>;
|
|
6
7
|
declare const getRegion: (countryCode: string, ctx: StorefrontContext) => Promise<Region | null>;
|
|
7
8
|
//#endregion
|
|
8
|
-
export { getRegion, listRegions };
|
|
9
|
+
export { getRegion, listRegions, retrieveRegion };
|
|
9
10
|
//# sourceMappingURL=regions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regions.d.ts","names":[],"sources":["../../../src/lib/data/regions.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"regions.d.ts","names":[],"sources":["../../../src/lib/data/regions.ts"],"sourcesContent":[],"mappings":";;;;cAea,mBAA0B,sBAAiB,QAAA;cAW3C,kCAAyC,sBAAiB,QAAA;AAX1D,cAsBA,SAbZ,EAAA,CAAA,WAAA,EAAA,MAAA,EAAA,GAAA,EAeM,iBAfN,EAAA,GAgBE,OAhBF,CAgBU,MAhBV,GAAA,IAAA,CAAA"}
|
package/dist/lib/data/regions.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createServerApolloClient, graphqlFetch } from "../gql/apollo-client.js";
|
|
2
2
|
import { medusaError } from "../utils/medusa-error.js";
|
|
3
|
-
import {
|
|
4
|
-
import { normalizeRegion } from "../utils/normalize-functions.js";
|
|
3
|
+
import { GET_REGION_QUERY, LIST_REGIONS_QUERY } from "../gql/queries/regions.js";
|
|
5
4
|
|
|
6
5
|
//#region src/lib/data/regions.ts
|
|
7
6
|
const regionMap = /* @__PURE__ */ new Map();
|
|
8
7
|
const listRegions = async (ctx) => {
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
|
|
9
|
+
return graphqlFetch({
|
|
10
|
+
query: LIST_REGIONS_QUERY,
|
|
11
|
+
fetchPolicy: "cache-first"
|
|
12
|
+
}, apolloClient).then((data) => data?.regions ?? []).catch(medusaError);
|
|
13
|
+
};
|
|
14
|
+
const retrieveRegion = async (id, ctx) => {
|
|
15
|
+
const apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
|
|
16
|
+
return graphqlFetch({
|
|
17
|
+
query: GET_REGION_QUERY,
|
|
18
|
+
variables: { id },
|
|
19
|
+
fetchPolicy: "cache-first"
|
|
20
|
+
}, apolloClient).then((data) => data?.region ?? null).catch(medusaError);
|
|
15
21
|
};
|
|
16
22
|
const getRegion = async (countryCode, ctx) => {
|
|
17
23
|
try {
|
|
@@ -24,11 +30,11 @@ const getRegion = async (countryCode, ctx) => {
|
|
|
24
30
|
});
|
|
25
31
|
});
|
|
26
32
|
return countryCode ? regionMap.get(countryCode) ?? null : regionMap.get("us") ?? null;
|
|
27
|
-
} catch
|
|
33
|
+
} catch {
|
|
28
34
|
return null;
|
|
29
35
|
}
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
//#endregion
|
|
33
|
-
export { getRegion, listRegions };
|
|
39
|
+
export { getRegion, listRegions, retrieveRegion };
|
|
34
40
|
//# sourceMappingURL=regions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regions.js","names":[
|
|
1
|
+
{"version":3,"file":"regions.js","names":[],"sources":["../../../src/lib/data/regions.ts"],"sourcesContent":["import type { Region } from '../../types/graphql';\nimport {\n createServerApolloClient,\n graphqlFetch,\n} from '../gql/apollo-client';\nimport { GET_REGION_QUERY, LIST_REGIONS_QUERY } from '../gql/queries/regions';\nimport { medusaError } from '../utils/medusa-error';\nimport type { StorefrontContext } from './context';\n\n// Inline types until codegen generates ListRegionsQuery / GetRegionQuery\ntype ListRegionsResult = { regions: Region[] };\ntype GetRegionResult = { region: Region | null };\n\nconst regionMap = new Map<string, Region>();\n\nexport const listRegions = async (ctx: StorefrontContext) => {\n const apolloClient = createServerApolloClient(ctx.cookieHeader ?? '');\n\n return graphqlFetch<ListRegionsResult, Record<string, never>>(\n { query: LIST_REGIONS_QUERY, fetchPolicy: 'cache-first' },\n apolloClient\n )\n .then((data) => data?.regions ?? [])\n .catch(medusaError);\n};\n\nexport const retrieveRegion = async (id: string, ctx: StorefrontContext) => {\n const apolloClient = createServerApolloClient(ctx.cookieHeader ?? '');\n\n return graphqlFetch<GetRegionResult, { id: string }>(\n { query: GET_REGION_QUERY, variables: { id }, fetchPolicy: 'cache-first' },\n apolloClient\n )\n .then((data) => data?.region ?? null)\n .catch(medusaError);\n};\n\nexport const getRegion = async (\n countryCode: string,\n ctx: StorefrontContext\n): Promise<Region | null> => {\n try {\n if (regionMap.has(countryCode)) {\n return regionMap.get(countryCode) ?? null;\n }\n\n const regions = await listRegions(ctx);\n\n if (!regions) return null;\n\n regions.forEach((region) => {\n region.countries?.forEach((c) => {\n regionMap.set(c?.iso2 ?? '', region);\n });\n });\n\n const region = countryCode\n ? (regionMap.get(countryCode) ?? null)\n : (regionMap.get('us') ?? null);\n\n return region;\n } catch {\n return null;\n }\n};\n"],"mappings":";;;;;AAaA,MAAM,4BAAY,IAAI,KAAqB;AAE3C,MAAa,cAAc,OAAO,QAA2B;CAC3D,MAAM,eAAe,yBAAyB,IAAI,gBAAgB,GAAG;AAErE,QAAO,aACL;EAAE,OAAO;EAAoB,aAAa;EAAe,EACzD,aACD,CACE,MAAM,SAAS,MAAM,WAAW,EAAE,CAAC,CACnC,MAAM,YAAY;;AAGvB,MAAa,iBAAiB,OAAO,IAAY,QAA2B;CAC1E,MAAM,eAAe,yBAAyB,IAAI,gBAAgB,GAAG;AAErE,QAAO,aACL;EAAE,OAAO;EAAkB,WAAW,EAAE,IAAI;EAAE,aAAa;EAAe,EAC1E,aACD,CACE,MAAM,SAAS,MAAM,UAAU,KAAK,CACpC,MAAM,YAAY;;AAGvB,MAAa,YAAY,OACvB,aACA,QAC2B;AAC3B,KAAI;AACF,MAAI,UAAU,IAAI,YAAY,CAC5B,QAAO,UAAU,IAAI,YAAY,IAAI;EAGvC,MAAM,UAAU,MAAM,YAAY,IAAI;AAEtC,MAAI,CAAC,QAAS,QAAO;AAErB,UAAQ,SAAS,WAAW;AAC1B,UAAO,WAAW,SAAS,MAAM;AAC/B,cAAU,IAAI,GAAG,QAAQ,IAAI,OAAO;KACpC;IACF;AAMF,SAJe,cACV,UAAU,IAAI,YAAY,IAAI,OAC9B,UAAU,IAAI,KAAK,IAAI;SAGtB;AACN,SAAO"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React$1 from "react";
|
|
4
|
-
import Medusa from "@medusajs/js-sdk";
|
|
5
|
-
import * as Apollo from "@apollo/client";
|
|
6
4
|
import * as SWRNamespace from "swr";
|
|
7
5
|
import useSWR from "swr";
|
|
6
|
+
import * as Apollo from "@apollo/client";
|
|
8
7
|
import * as ReactDOM from "react-dom";
|
|
8
|
+
import Medusa from "@medusajs/js-sdk";
|
|
9
9
|
import * as ReactDOMClient from "react-dom/client";
|
|
10
10
|
|
|
11
11
|
//#region src/lib/globals/expose-globals.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-client.d.ts","names":[],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"apollo-client.d.ts","names":[],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":[],"mappings":";;;;cAmBM,cAAY;;AAXM;AA2BxB;AA2BA;AASA;;AAIqC,iBAxCrB,wBAAA,CAwCqB,YAAA,CAAA,EAAA,MAAA,CAAA,EAxCyB,YAwCzB;AAAS,iBAb9B,gBAAA,CAa8B,GAAA,CAAA,EAbR,eAaQ,GAAA,IAAA,CAAA,EAbqB,YAarB;AAAnC,iBAJW,YAIE,CAAA,OAAA,EAAA,mBAFH,kBAEG,CAAA,CAAA,OAAA,EAAb,YAAA,CAAa,YAAA,CAAa,OAAb,EAAsB,UAAtB,CAAA,EAAA,oBAAA,CAAA,EACC,YADD,CAAA,EAErB,OAFqB,CAEb,OAFa,GAAA,SAAA,CAAA;AACC,iBAiBH,eAjBG,CAAA,OAAA,EAAA,mBAmBJ,kBAnBI,CAAA,CAAA,OAAA,EAqBd,YAAA,CAAa,aArBC,CAqBa,OArBb,EAqBsB,UArBtB,CAAA,EAAA,oBAAA,CAAA,EAsBA,YAtBA,CAAA,EAuBtB,OAvBsB,CAuBd,OAvBc,GAAA,SAAA,CAAA"}
|
|
@@ -21,10 +21,10 @@ const apolloClient = new ApolloClient({
|
|
|
21
21
|
function createServerApolloClient(cookieHeader) {
|
|
22
22
|
return new ApolloClient({
|
|
23
23
|
link: new ApolloLink((operation, forward) => {
|
|
24
|
-
if (cookieHeader) operation.setContext(
|
|
25
|
-
|
|
26
|
-
Cookie: cookieHeader
|
|
27
|
-
}
|
|
24
|
+
if (cookieHeader) operation.setContext({
|
|
25
|
+
http: { includeCredentials: true },
|
|
26
|
+
headers: { Cookie: cookieHeader }
|
|
27
|
+
});
|
|
28
28
|
return forward(operation);
|
|
29
29
|
}).concat(httpLink),
|
|
30
30
|
cache: new InMemoryCache({}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-client.js","names":["error: any"],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":["import { IncomingMessage } from 'http';\n\nimport { ApolloLink } from '@apollo/client';\nimport {\n ApolloClient,\n HttpLink,\n InMemoryCache,\n OperationVariables,\n} from '@apollo/client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"apollo-client.js","names":["error: any"],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":["import { IncomingMessage } from 'http';\n\nimport { ApolloLink } from '@apollo/client';\nimport {\n ApolloClient,\n HttpLink,\n InMemoryCache,\n OperationVariables,\n} from '@apollo/client';\n\nimport { getBaseURL } from '../utils/env';\n\nconst isServer = () => typeof window === 'undefined';\n\nconst httpLink = new HttpLink({\n uri: isServer() ? `${getBaseURL()}/api/graphql` : '/api/graphql',\n credentials: 'include',\n});\n\nconst apolloClient = new ApolloClient({\n link: httpLink,\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n});\n\n/**\n * When requests are sent from the server, cookies need to be manually attached.\n *\n * @param cookieHeader Cookies string to forward\n * @returns Server-side Apollo client\n */\nexport function createServerApolloClient(cookieHeader?: string) {\n const authLink = new ApolloLink((operation, forward) => {\n if (cookieHeader) {\n operation.setContext({\n http: {\n includeCredentials: true,\n },\n headers: {\n Cookie: cookieHeader,\n },\n });\n }\n\n return forward(operation);\n });\n\n return new ApolloClient({\n link: authLink.concat(httpLink),\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n });\n}\n\nexport function initializeApollo(req: IncomingMessage | null = null) {\n if (isServer()) {\n const cookieHeader = req?.headers.cookie;\n return createServerApolloClient(cookieHeader);\n }\n\n return apolloClient;\n}\n\nexport async function graphqlFetch<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.QueryOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.query<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n // TODO - Better error handling\n throw new Error(error.message || 'GraphQL error');\n }\n}\n\nexport async function graphqlMutation<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.MutateOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.mutate<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n // TODO - Better error handling\n throw new Error(error.message || 'GraphQL error');\n }\n}\nexport default apolloClient;\n"],"mappings":";;;;AAYA,MAAM,iBAAiB,OAAO,WAAW;AAEzC,MAAM,WAAW,IAAI,SAAS;CAC5B,KAAK,UAAU,GAAG,GAAG,YAAY,CAAC,gBAAgB;CAClD,aAAa;CACd,CAAC;AAEF,MAAM,eAAe,IAAI,aAAa;CACpC,MAAM;CACN,OAAO,IAAI,cAAc,EAAE,CAAC;CAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;CACF,CAAC;;;;;;;AAQF,SAAgB,yBAAyB,cAAuB;AAgB9D,QAAO,IAAI,aAAa;EACtB,MAhBe,IAAI,YAAY,WAAW,YAAY;AACtD,OAAI,aACF,WAAU,WAAW;IACnB,MAAM,EACJ,oBAAoB,MACrB;IACD,SAAS,EACP,QAAQ,cACT;IACF,CAAC;AAGJ,UAAO,QAAQ,UAAU;IACzB,CAGe,OAAO,SAAS;EAC/B,OAAO,IAAI,cAAc,EAAE,CAAC;EAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;EACF,CAAC;;AAGJ,SAAgB,iBAAiB,MAA8B,MAAM;AACnE,KAAI,UAAU,EAAE;EACd,MAAM,eAAe,KAAK,QAAQ;AAClC,SAAO,yBAAyB,aAAa;;AAG/C,QAAO;;AAGT,eAAsB,aAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,MAA2B;GACvD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AAEnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAIrD,eAAsB,gBAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,OAA4B;GACxD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AAEnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAGrD,4BAAe"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client0 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/fragments/cart.d.ts
|
|
4
|
-
declare const LINE_ITEM_FRAGMENT:
|
|
5
|
-
declare const COUNTRY_FRAGMENT:
|
|
6
|
-
declare const REGION_FRAGMENT:
|
|
7
|
-
declare const SHIPPING_METHODS_FRAGMENT:
|
|
8
|
-
declare const PAYMENT_COLLECTION_FRAGMENT:
|
|
9
|
-
declare const ADDRESS_FRAGMENT:
|
|
10
|
-
declare const PROMOTION_FRAGMENT:
|
|
11
|
-
declare const CART_FRAGMENT:
|
|
4
|
+
declare const LINE_ITEM_FRAGMENT: _apollo_client0.DocumentNode;
|
|
5
|
+
declare const COUNTRY_FRAGMENT: _apollo_client0.DocumentNode;
|
|
6
|
+
declare const REGION_FRAGMENT: _apollo_client0.DocumentNode;
|
|
7
|
+
declare const SHIPPING_METHODS_FRAGMENT: _apollo_client0.DocumentNode;
|
|
8
|
+
declare const PAYMENT_COLLECTION_FRAGMENT: _apollo_client0.DocumentNode;
|
|
9
|
+
declare const ADDRESS_FRAGMENT: _apollo_client0.DocumentNode;
|
|
10
|
+
declare const PROMOTION_FRAGMENT: _apollo_client0.DocumentNode;
|
|
11
|
+
declare const CART_FRAGMENT: _apollo_client0.DocumentNode;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { ADDRESS_FRAGMENT, CART_FRAGMENT, COUNTRY_FRAGMENT, LINE_ITEM_FRAGMENT, PAYMENT_COLLECTION_FRAGMENT, PROMOTION_FRAGMENT, REGION_FRAGMENT, SHIPPING_METHODS_FRAGMENT };
|
|
14
14
|
//# sourceMappingURL=cart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,oBAiBZ,
|
|
1
|
+
{"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,oBAiBZ,eAAA,CAjB8B;cAmBlB,kBAOZ,eAAA,CAP4B;cAShB,iBAWZ,eAAA,CAX2B;AA5Bf,cAyCA,yBAxBZ,EAkCA,eAAA,CAVqC,YAxBrC;AAEY,cAkCA,2BA3BZ,EA6CA,eAAA,CAlBuC,YA3BvC;AAEY,cA6CA,gBAlCZ,EA4CA,eAAA,CAV4B,YAlC5B;AAEY,cA4CA,kBAlCZ,EA4CA,eAAA,CAV8B,YAlC9B;AAEY,cA4CA,aA1BZ,EAqEA,eAAA,CA3CyB,YA5Cc"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client33 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/fragments/customer.d.ts
|
|
4
|
-
declare const CUSTOMER_ADDRESS_FRAGMENT:
|
|
5
|
-
declare const CUSTOMER_FRAGMENT:
|
|
4
|
+
declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client33.DocumentNode;
|
|
5
|
+
declare const CUSTOMER_FRAGMENT: _apollo_client33.DocumentNode;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { CUSTOMER_ADDRESS_FRAGMENT, CUSTOMER_FRAGMENT };
|
|
8
8
|
//# sourceMappingURL=customer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/customer.ts"],"sourcesContent":[],"mappings":";;;cAEa,2BAkBZ,
|
|
1
|
+
{"version":3,"file":"customer.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/customer.ts"],"sourcesContent":[],"mappings":";;;cAEa,2BAkBZ,gBAAA,CAlBqC;cAoBzB,mBAeZ,gBAAA,CAf6B"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client9 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/fragments/product.d.ts
|
|
4
|
-
declare const PRICE_FRAGMENT:
|
|
5
|
-
declare const PRODUCT_VARIANT_FRAGMENT:
|
|
6
|
-
declare const PRODUCT_HIT_FRAGMENT:
|
|
7
|
-
declare const PRODUCT_CATEGORY_FRAGMENT:
|
|
8
|
-
declare const PRODUCT_COLLECTION_FRAGMENT:
|
|
9
|
-
declare const PRODUCT_IMAGE_FRAGMENT:
|
|
10
|
-
declare const COLLECTION_PRODUCTS_FRAGMENT:
|
|
4
|
+
declare const PRICE_FRAGMENT: _apollo_client9.DocumentNode;
|
|
5
|
+
declare const PRODUCT_VARIANT_FRAGMENT: _apollo_client9.DocumentNode;
|
|
6
|
+
declare const PRODUCT_HIT_FRAGMENT: _apollo_client9.DocumentNode;
|
|
7
|
+
declare const PRODUCT_CATEGORY_FRAGMENT: _apollo_client9.DocumentNode;
|
|
8
|
+
declare const PRODUCT_COLLECTION_FRAGMENT: _apollo_client9.DocumentNode;
|
|
9
|
+
declare const PRODUCT_IMAGE_FRAGMENT: _apollo_client9.DocumentNode;
|
|
10
|
+
declare const COLLECTION_PRODUCTS_FRAGMENT: _apollo_client9.DocumentNode;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { COLLECTION_PRODUCTS_FRAGMENT, PRICE_FRAGMENT, PRODUCT_CATEGORY_FRAGMENT, PRODUCT_COLLECTION_FRAGMENT, PRODUCT_HIT_FRAGMENT, PRODUCT_IMAGE_FRAGMENT, PRODUCT_VARIANT_FRAGMENT };
|
|
13
13
|
//# sourceMappingURL=product.d.ts.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client28 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/mutations/cart.d.ts
|
|
4
|
-
declare const
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
4
|
+
declare const CREATE_CART_MUTATION: _apollo_client28.DocumentNode;
|
|
5
|
+
declare const CREATE_LINE_ITEM_MUTATION: _apollo_client28.DocumentNode;
|
|
6
|
+
declare const UPDATE_CART_MUTATION: _apollo_client28.DocumentNode;
|
|
7
|
+
declare const DELETE_LINE_ITEM_MUTATION: _apollo_client28.DocumentNode;
|
|
8
|
+
declare const TRANSFER_CART_MUTATION: _apollo_client28.DocumentNode;
|
|
7
9
|
//#endregion
|
|
8
|
-
export { DELETE_LINE_ITEM_MUTATION, TRANSFER_CART_MUTATION, UPDATE_CART_MUTATION };
|
|
10
|
+
export { CREATE_CART_MUTATION, CREATE_LINE_ITEM_MUTATION, DELETE_LINE_ITEM_MUTATION, TRANSFER_CART_MUTATION, UPDATE_CART_MUTATION };
|
|
9
11
|
//# sourceMappingURL=cart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/mutations/cart.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/mutations/cart.ts"],"sourcesContent":[],"mappings":";;;cAQa,sBAOZ,gBAAA,CAPgC;cASpB,2BAWZ,gBAAA,CAXqC;cAazB,sBAgBZ,gBAAA,CAhBgC;AAtBpB,cAwCA,yBAjCZ,EAyCA,gBAAA,CARqC,YAjCrC;AAEY,cAyCA,sBA9BZ,EAqCA,gBAAA,CAPkC,YA9BlC"}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
import { ADDRESS_FRAGMENT, CART_FRAGMENT } from "../fragments/cart.js";
|
|
1
|
+
import { ADDRESS_FRAGMENT, CART_FRAGMENT, LINE_ITEM_FRAGMENT } from "../fragments/cart.js";
|
|
2
2
|
import { gql } from "@apollo/client";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/gql/mutations/cart.ts
|
|
5
|
+
const CREATE_CART_MUTATION = gql`
|
|
6
|
+
mutation CreateCart($data: CreateCartInput!) {
|
|
7
|
+
createCart(data: $data) {
|
|
8
|
+
...CartFields
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
${CART_FRAGMENT}
|
|
12
|
+
`;
|
|
13
|
+
const CREATE_LINE_ITEM_MUTATION = gql`
|
|
14
|
+
mutation CreateLineItem($cartId: ID!, $data: CreateLineItemInput!) {
|
|
15
|
+
createLineItem(cartId: $cartId, data: $data) {
|
|
16
|
+
id
|
|
17
|
+
total
|
|
18
|
+
items {
|
|
19
|
+
...CartItemFields
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
${LINE_ITEM_FRAGMENT}
|
|
24
|
+
`;
|
|
5
25
|
const UPDATE_CART_MUTATION = gql`
|
|
6
26
|
mutation UpdateCart($id: ID!, $data: UpdateCartInput!) {
|
|
7
27
|
updateCart(id: $id, data: $data) {
|
|
@@ -38,5 +58,5 @@ const TRANSFER_CART_MUTATION = gql`
|
|
|
38
58
|
`;
|
|
39
59
|
|
|
40
60
|
//#endregion
|
|
41
|
-
export { DELETE_LINE_ITEM_MUTATION, TRANSFER_CART_MUTATION, UPDATE_CART_MUTATION };
|
|
61
|
+
export { CREATE_CART_MUTATION, CREATE_LINE_ITEM_MUTATION, DELETE_LINE_ITEM_MUTATION, TRANSFER_CART_MUTATION, UPDATE_CART_MUTATION };
|
|
42
62
|
//# sourceMappingURL=cart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.js","names":[],"sources":["../../../../src/lib/gql/mutations/cart.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"cart.js","names":[],"sources":["../../../../src/lib/gql/mutations/cart.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nimport {\n ADDRESS_FRAGMENT,\n CART_FRAGMENT,\n LINE_ITEM_FRAGMENT,\n} from '../fragments/cart';\n\nexport const CREATE_CART_MUTATION = gql`\n mutation CreateCart($data: CreateCartInput!) {\n createCart(data: $data) {\n ...CartFields\n }\n }\n ${CART_FRAGMENT}\n`;\n\nexport const CREATE_LINE_ITEM_MUTATION = gql`\n mutation CreateLineItem($cartId: ID!, $data: CreateLineItemInput!) {\n createLineItem(cartId: $cartId, data: $data) {\n id\n total\n items {\n ...CartItemFields\n }\n }\n }\n ${LINE_ITEM_FRAGMENT}\n`;\n\nexport const UPDATE_CART_MUTATION = gql`\n mutation UpdateCart($id: ID!, $data: UpdateCartInput!) {\n updateCart(id: $id, data: $data) {\n ...CartFields\n regionId\n currencyCode\n shippingAddress {\n ...AddressFields\n }\n billingAddress {\n ...AddressFields\n }\n }\n }\n ${CART_FRAGMENT}\n ${ADDRESS_FRAGMENT}\n`;\n\nexport const DELETE_LINE_ITEM_MUTATION = gql`\n mutation DeleteLineItem($cartId: ID!, $lineItemId: ID!) {\n deleteLineItem(cartId: $cartId, lineItemId: $lineItemId) {\n id\n object\n deleted\n }\n }\n`;\n\nexport const TRANSFER_CART_MUTATION = gql`\n mutation TransferCart($cartId: ID!) {\n transferCart(cartId: $cartId) {\n ...CartFields\n }\n }\n ${CART_FRAGMENT}\n`;\n"],"mappings":";;;;AAQA,MAAa,uBAAuB,GAAG;;;;;;IAMnC,cAAc;;AAGlB,MAAa,4BAA4B,GAAG;;;;;;;;;;IAUxC,mBAAmB;;AAGvB,MAAa,uBAAuB,GAAG;;;;;;;;;;;;;;IAcnC,cAAc;IACd,iBAAiB;;AAGrB,MAAa,4BAA4B,GAAG;;;;;;;;;AAU5C,MAAa,yBAAyB,GAAG;;;;;;IAMrC,cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client17 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/queries/cart.d.ts
|
|
4
|
-
declare const GET_CART_QUERY:
|
|
4
|
+
declare const GET_CART_QUERY: _apollo_client17.DocumentNode;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { GET_CART_QUERY };
|
|
7
7
|
//# sourceMappingURL=cart.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client16 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/queries/collections.d.ts
|
|
4
|
-
declare const GET_COLLECTIONS_QUERY:
|
|
4
|
+
declare const GET_COLLECTIONS_QUERY: _apollo_client16.DocumentNode;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { GET_COLLECTIONS_QUERY };
|
|
7
7
|
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client18 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/queries/customer.d.ts
|
|
4
|
-
declare const GET_CUSTOMER_QUERY:
|
|
4
|
+
declare const GET_CUSTOMER_QUERY: _apollo_client18.DocumentNode;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { GET_CUSTOMER_QUERY };
|
|
7
7
|
//# sourceMappingURL=customer.d.ts.map
|